@nonoun/native-cdn 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ var NativeUI=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=null,n=0,r=new Set;let i=new WeakMap,a=new Set;function o(){return t}function s(e){t=e}function c(){return n}function l(){n++}function u(){n--}var d=class{_value;_subs=new Set;constructor(e){this._value=e}},f=class e{_subs=new Set;_deps=new Set;_fn;_value=void 0;_dirty=!0;constructor(e){this._fn=e}_notify(){if(!this._dirty){this._dirty=!0;for(let t of[...this._subs])t instanceof e?t._notify():n>0?r.add(t):_(t)}}},p=class{_deps=new Set;_fn;_disposed=!1;_running=!1;constructor(e){this._fn=e}};function m(e){t!==null&&(e._subs.add(t),t._deps.add(e))}function h(e){for(let t of e._deps)t._subs.delete(e);e._deps.clear()}function g(e){for(let t of[...e._subs])t instanceof f?t._notify():n>0?r.add(t):_(t)}function _(e){if(e._disposed||e._running)return;h(e);let n=t;t=e,e._running=!0;try{e._fn()}finally{t=n,e._running=!1}}function ee(){let e=0;for(;r.size>0;){if(++e>100)throw Error(`Reactive flush limit exceeded (100 iterations). Possible infinite loop.`);let t=[...r];r.clear();for(let e of t)_(e)}}var te=class{[Symbol.toStringTag]=`Signal`;#e;constructor(e){this.#e=e}get value(){return m(this.#e),this.#e._value}set value(e){Object.is(this.#e._value,e)||(this.#e._value=e,g(this.#e))}peek(){return this.#e._value}};function v(e){let t=new d(e),n=new te(t);return i.set(n,t),n}var ne=class{[Symbol.toStringTag]=`Computed`;#e;constructor(e){this.#e=e}get value(){return m(this.#e),this.#e._dirty&&this.#t(),this.#e._value}peek(){return this.#e._dirty&&this.#t(),this.#e._value}#t(){let e=this.#e;if(a.has(e))throw Error(`Circular computed dependency detected.`);h(e),a.add(e);let t=o();s(e);try{e._value=e._fn()}finally{s(t),a.delete(e),e._dirty=!1}}};function y(e){let t=new f(e),n=new ne(t);return i.set(n,t),n}function b(e){let t=new p(e);return _(t),()=>{t._disposed||(t._disposed=!0,h(t))}}function x(e){l();try{e()}finally{u(),c()===0&&ee()}}function S(e){let t=o();s(null);try{return e()}finally{s(t)}}function re(e){let t=i.get(e);return t?t instanceof d?{type:`signal`,value:t._value,subscriberCount:t._subs.size,dependencyCount:0}:{type:`computed`,value:t._value,subscriberCount:t._subs.size,dependencyCount:t._deps.size}:{type:`unknown`,value:void 0,subscriberCount:0,dependencyCount:0}}function ie(e){return typeof e==`object`&&!!e&&Symbol.toStringTag in e&&e[Symbol.toStringTag]===`Signal`}function ae(e){return typeof e==`object`&&!!e&&Symbol.toStringTag in e&&e[Symbol.toStringTag]===`Computed`}var C=new Map,w=new Set;function T(e){if(C.has(e.name)){console.warn(`[native-ui] Trait "${e.name}" is already registered.`);return}C.set(e.name,e);for(let t of w)t(e.name)}function oe(e){return w.add(e),()=>w.delete(e)}function E(e){return C.get(e)}function D(){return new Set(C.keys())}function O(e){let t=D();for(let n of t)if(e.startsWith(n+`-`))return{trait:n,key:e.slice(n.length+1)};return null}function k(e,t){let n=t+`-`,r={};for(let t of e.attributes)t.name.startsWith(n)&&(r[t.name.slice(n.length)]=t.value);return r}var A=class extends HTMLElement{#e=[];#t=new Map;#n=null;#r=new Set;#i=null;#a=!1;#o=null;ready=new Promise(e=>{this.#o=e});addEffect(e){this.#e.push(b(e))}connectedCallback(){if(this.#a)return;this.#a=!0,this.setup();let e=this.getAttribute(`traits`);e!==null&&this.#s(e),queueMicrotask(()=>this.#o?.())}disconnectedCallback(){this.#a=!1,this.#l(),this.#n?.disconnect(),this.#n=null,this.#i?.(),this.#i=null,this.#r.clear(),this.teardown();for(let e of this.#e)e();this.#e=[]}setup(){}teardown(){}deferChildren(e){this.firstChild?e():queueMicrotask(()=>{this.isConnected&&e()})}attributeChangedCallback(e,t,n){}getTraitController(e){return this.#t.get(e)??null}#s(e){this.#c(e),this.#n=new MutationObserver(e=>{for(let t of e)if(t.attributeName===`traits`)this.#c(this.getAttribute(`traits`)??``);else if(t.attributeName){let e=O(t.attributeName);if(e){let t=E(e.trait),n=this.#t.get(e.trait);t&&n&&t.update&&t.update(n,k(this,e.trait))}}}),this.#n.observe(this,{attributes:!0})}#c(e){let t=new Set(e.split(/\s+/).filter(Boolean));for(let[e,n]of this.#t)if(!t.has(e)){let t=E(e);t&&t.destroy(n),this.#t.delete(e)}this.#r.clear();for(let e of t){if(this.#t.has(e))continue;let t=E(e);if(!t){this.#r.add(e);continue}for(let[n]of this.#t)if(E(n)?.conflicts?.includes(e)||t.conflicts?.includes(n)){let t=`[native-ui] Trait conflict: "${e}" and "${n}" are incompatible.`;console.warn(t)}let n=k(this,e),r=t.create(this,n);this.#t.set(e,r)}this.#r.size>0&&!this.#i?this.#i=oe(e=>{this.#r.has(e)&&(this.#r.delete(e),this.#c(this.getAttribute(`traits`)??``),this.#r.size===0&&(this.#i?.(),this.#i=null))}):this.#r.size===0&&this.#i&&(this.#i(),this.#i=null)}#l(){for(let[e,t]of this.#t){let n=E(e);n&&n.destroy(t)}this.#t.clear()}};function se(e,t){customElements.get(e)||customElements.define(e,t)}function j(e=`ui`){return`${e}-${crypto.randomUUID().slice(0,8)}`}function M(e,t,n,r){let i;return()=>{let n=t.value;e.toggleAttribute(`disabled`,n),n?e.setAttribute(`aria-disabled`,`true`):e.removeAttribute(`aria-disabled`),r?.manageTabindex&&e.setAttribute(`tabindex`,n?`-1`:`0`),i!==void 0&&i!==n&&e.dispatchEvent(new CustomEvent(`ui-disabled`,{bubbles:!0,composed:!0,detail:{disabled:n}})),i=n}}function N(e,t,n){let r=n.attribute??t;if(n.type===`boolean`){let t=v(!1);return{get signal(){return t},get value(){return t.value},set(n){t.value=n,e.toggleAttribute(r,n)},fromAttribute(e){t.value=e!==null}}}if(n.type===`number`){let t=n.initial??0,i=v(t);return{get signal(){return i},get value(){return i.value},set(t){i.value=t,e.setAttribute(r,String(t))},fromAttribute(e){i.value=parseFloat(e??String(t))||t}}}let i=n.initial??``,a=v(i);return{get signal(){return a},get value(){return a.value},set(t){a.value=t,t?e.getAttribute(r)!==t&&e.setAttribute(r,t):e.removeAttribute(r)},fromAttribute(e){a.value=e??i}}}function P(e,t,n){let r=e[t];return r?(r.fromAttribute(n),!0):!1}var F=class extends Event{context;callback;constructor(e,t){super(`context-request`,{bubbles:!0,composed:!0}),this.context=e,this.callback=t}};function ce(e){return class extends e{#e=new Map;provideContext(e,t){this.#e.set(e,t)}connectedCallback(){super.connectedCallback?.(),this.addEventListener(`context-request`,this.#t)}disconnectedCallback(){super.disconnectedCallback?.(),this.removeEventListener(`context-request`,this.#t)}#t=e=>{if(!(e instanceof F))return;let t=this.#e.get(e.context);t!==void 0&&(e.stopPropagation(),e.callback(t))}}}function le(e){return class extends e{#e=new Map;requestContext(e,t){this.dispatchEvent(new F(e,n=>{this.#e.set(e,n),t?.(n)}))}getContext(e){return this.#e.get(e)??null}}}function I(e){return class extends e{static formAssociated=!0;onFormDisabled(e){}onFormReset(){}onFormStateRestore(e){}formDisabledCallback(e){this.onFormDisabled(e)}formResetCallback(){this.onFormReset()}formStateRestoreCallback(e,t){this.onFormStateRestore(e)}formAssociatedCallback(e){}}}var ue=class{#e=new Set;#t=null;#n=!1;register(e){this.#e.add(e),this.#a()}unregister(e){this.#e.delete(e),this.#t===e&&(this.#t=null),this.#e.size===0&&this.#o()}release(){this.#t=null}get activeParticipant(){return this.#t}#r=e=>{if(this.#t)return;let t=e.target,n=[];for(let e of this.#e)e.host.contains(t)&&n.push(e);if(n.length!==0){n.sort((e,t)=>e.priority-t.priority);for(let t of n)if(t.onGestureStart(e)===`claim`){this.#t=t;for(let e of n)e!==t&&e.onGestureCancel?.();return}}};#i=()=>{this.release()};#a(){this.#n||=(document.addEventListener(`pointerdown`,this.#r,!0),document.addEventListener(`pointerup`,this.#i,!0),document.addEventListener(`pointercancel`,this.#i,!0),!0)}#o(){this.#n&&=(document.removeEventListener(`pointerdown`,this.#r,!0),document.removeEventListener(`pointerup`,this.#i,!0),document.removeEventListener(`pointercancel`,this.#i,!0),!1)}},de=class{#e=[];#t=!1;#n=e=>{let t=this.#e[this.#e.length-1];t&&(e.composedPath().includes(t)||t.dispatchEvent(new CustomEvent(`ui-dismiss`,{bubbles:!0,composed:!0})))};#r=e=>{if(e.key!==`Escape`)return;let t=this.#e[this.#e.length-1];t&&(e.preventDefault(),t.dispatchEvent(new CustomEvent(`ui-dismiss`,{bubbles:!0,composed:!0})))};push(e){let t=this.#e.indexOf(e);t!==-1&&this.#e.splice(t,1),this.#e.push(e),this.#i()}remove(e){let t=this.#e.indexOf(e);t!==-1&&this.#e.splice(t,1),this.#a()}#i(){this.#t||=(document.addEventListener(`pointerdown`,this.#n,!0),document.addEventListener(`keydown`,this.#r),!0)}#a(){this.#e.length>0||(document.removeEventListener(`pointerdown`,this.#n,!0),document.removeEventListener(`keydown`,this.#r),this.#t=!1)}},fe=class{#e=null;#t=0;#n=[];#r(){return this.#e&&this.#e.isConnected?this.#e:(this.#e=document.createElement(`div`),this.#e.className=`ui-toast-container`,this.#e.setAttribute(`role`,`status`),this.#e.setAttribute(`aria-live`,`polite`),this.#e.setAttribute(`aria-atomic`,`false`),this.#e.style.cssText=`
2
+ position: fixed;
3
+ top: 1rem;
4
+ right: 1rem;
5
+ display: flex;
6
+ flex-direction: column;
7
+ gap: 0.5rem;
8
+ z-index: 10000;
9
+ pointer-events: none;
10
+ `,document.body.appendChild(this.#e),this.#e)}toast(e,t){let{message:n,intent:r=`info`,duration:i=4e3,dismissible:a=!0}=t,o=this.#t++,s=this.#r(),c=document.createElement(`div`);c.className=`ui-toast`,c.setAttribute(`intent`,r),c.setAttribute(`role`,`alert`),c.style.cssText=`pointer-events: auto;`;let l=document.createElement(`span`);if(l.className=`ui-toast-message`,l.textContent=n,c.appendChild(l),a){let e=document.createElement(`button`);e.className=`ui-toast-close`,e.setAttribute(`aria-label`,`Dismiss`),e.textContent=`×`,e.addEventListener(`click`,()=>this.dismiss(o)),c.appendChild(e)}s.appendChild(c);let u=i>0?setTimeout(()=>this.dismiss(o),i):null;return this.#n.push({id:o,el:c,timer:u}),e.dispatchEvent(new CustomEvent(`ui-toast`,{bubbles:!0,composed:!0,detail:{id:o,message:n,intent:r}})),o}dismiss(e){let t=this.#n.findIndex(t=>t.id===e);if(t===-1)return;let n=this.#n[t];n.timer&&clearTimeout(n.timer),n.el.remove(),this.#n.splice(t,1),this.#n.length===0&&this.#e&&(this.#e.remove(),this.#e=null)}dismissAll(){for(let e of[...this.#n])this.dismiss(e.id)}},pe=null;function L(){return pe||={dismissStack:new de,toastManager:new fe,gestureRouter:new ue},pe}function me(e,t){return e.label.toLowerCase().includes(t.toLowerCase())}var R=class{data;query;#e;#t;filtered;sorted;activeIndex;activeItem;value;selected;#n;selectedItem;empty;constructor(e={}){this.data=v([]),this.query=v(``),this.#e=v(e.filterFn??me),this.#t=v(e.sortFn??null),this.#n=v(e.multiple??!1),this.activeIndex=v(e.initialActiveIndex??-1),this.value=v(null),this.selected=v(new Set),this.filtered=y(()=>{let e=this.data.value,t=this.query.value,n=this.#e.value;return t?e.filter(e=>n(e,t)):e}),this.sorted=y(()=>{let e=this.filtered.value,t=this.#t.value;return t?[...e].sort(t):e}),this.activeItem=y(()=>{let e=this.view.value,t=this.activeIndex.value;return t>=0&&t<e.length?e[t]:null}),this.selectedItem=y(()=>{let e=this.value.value;return e===null?null:this.data.value.find(t=>t.value===e)??null}),this.empty=y(()=>this.view.value.length===0)}get view(){return this.sorted}get multiple(){return this.#n.value}set multiple(e){this.#n.value=e}setQuery(e,t){x(()=>{this.query.value=e,this.activeIndex.value=t??-1})}moveActive(e,t){let n=t??this.view.value.length;if(n===0)return;let r=this.activeIndex.value;if(t==null){let t=this.view.value,i=(r+e+n)%n,a=0;for(;t[i]?.disabled&&a<n;)i=(i+e+n)%n,a++;this.activeIndex.value=i;return}this.activeIndex.value=(r+e+n)%n}selectActive(){let e=this.activeItem.value;e&&this.select(e.value)}select(e){if(this.#n.value){let t=new Set(this.selected.value);t.add(e),x(()=>{this.selected.value=t,this.value.value=e})}else this.value.value=e}deselect(e){if(!this.#n.value)return;let t=new Set(this.selected.value);t.delete(e),x(()=>{this.selected.value=t,this.value.value===e&&(this.value.value=null)})}toggle(e){this.#n.value&&this.selected.value.has(e)?this.deselect(e):this.select(e)}selectAll(){if(!this.#n.value)return;let e=this.view.value;this.selected.value=new Set(e.map(e=>e.value))}clearSelection(){x(()=>{this.value.value=null,this.selected.value=new Set})}reset(){x(()=>{this.data.value=[],this.query.value=``,this.activeIndex.value=-1,this.value.value=null,this.selected.value=new Set})}setFilter(e){this.#e.value=e}setSort(e){this.#t.value=e}};function he(e){return new R(e)}function z(e,t){try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.value==`string`&&typeof e.label==`string`):[]}catch{return console.warn(`<${t}>: invalid options JSON`,e),[]}}async function B(e,t,n,r){t?.abort();let i=new AbortController;try{let t=await fetch(e,{signal:i.signal});if(!t.ok)return console.warn(`<${r}>: fetch failed (${t.status}) for ${e}`),i;let a=await t.json();if(i.signal.aborted)return i;n.value=(Array.isArray(a)?a:[]).filter(e=>typeof e==`object`&&!!e&&typeof e.value==`string`&&typeof e.label==`string`)}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return i;console.warn(`<${r}>: fetch error`,e)}return i}var V=class{host;selector;dropZoneSelector;axis;mode;disabled;animate;#e=null;#t=null;#n=null;#r=0;#i=0;#a=0;#o=0;#s=-1;#c=-1;#l=!1;#u=null;#d=null;#f=-1;constructor(e,t){this.host=e,this.selector=t.selector,this.dropZoneSelector=t.dropZoneSelector??``,this.axis=t.axis??`both`,this.mode=t.mode??`drop`,this.disabled=t.disabled??!1,this.animate=t.animate??!0,this.attach()}attach(){this.#l||(this.#l=!0,this.host.addEventListener(`pointerdown`,this.#_),this.host.addEventListener(`pointerenter`,this.#h,!0),this.host.addEventListener(`pointerleave`,this.#g,!0))}detach(){this.#l&&(this.#l=!1,this.host.removeEventListener(`pointerdown`,this.#_),this.host.removeEventListener(`pointerenter`,this.#h,!0),this.host.removeEventListener(`pointerleave`,this.#g,!0),this.#A())}destroy(){this.detach()}#p(){return this.selector?[...this.host.querySelectorAll(this.selector)]:[]}#m(){return this.dropZoneSelector?[...this.host.querySelectorAll(this.dropZoneSelector)]:this.#p()}#h=e=>{if(this.disabled||!this.selector||this.#t)return;let t=e.target.closest?.(this.selector);!t||!this.host.contains(t)||(t.style.outline=`2px solid var(--ui-focus-ring, highlight)`,t.style.outlineOffset=`2px`)};#g=e=>{if(!this.selector)return;let t=e.target.closest?.(this.selector);!t||!this.host.contains(t)||(t.style.removeProperty(`outline`),t.style.removeProperty(`outline-offset`))};#_=e=>{if(e.button!==0||this.disabled||!this.selector)return;let t=e.target.closest?.(this.selector);if(!t||!this.host.contains(t))return;let n=this.#p().indexOf(t);if(n===-1)return;e.preventDefault(),this.#e=t,this.#s=n,this.#r=e.clientX,this.#i=e.clientY;let r=t.getBoundingClientRect();this.#a=r.left+r.width/2-e.clientX,this.#o=r.top+r.height/2-e.clientY,document.addEventListener(`pointermove`,this.#v),document.addEventListener(`pointerup`,this.#E),document.addEventListener(`pointercancel`,this.#D),document.addEventListener(`keydown`,this.#O)};#v=e=>{if(!this.#e)return;if(!this.#t){this.#e.style.removeProperty(`outline`),this.#e.style.removeProperty(`outline-offset`);try{this.#k(e)}catch{this.#A();return}this.#e.setAttribute(`dragging`,``),this.mode===`preview`&&(this.#u=this.#e.parentElement,this.#d=this.#e.nextElementSibling,this.#f=-1,this.animate&&this.#C()),this.host.dispatchEvent(new CustomEvent(`ui-drag-start`,{bubbles:!0,composed:!0,detail:{item:this.#e,index:this.#s}}))}let t=e.clientX-this.#r,n=e.clientY-this.#i;this.#t.style.transform=`translate(${t}px, ${n}px) scale(0.9)`,this.host.dispatchEvent(new CustomEvent(`ui-drag-move`,{bubbles:!0,composed:!0,detail:{item:this.#e,x:e.clientX,y:e.clientY}}));let r=this.#m().filter(e=>e!==this.#t);if(this.mode===`slot`){let t=e.clientX+this.#a,n=e.clientY+this.#o,i=r.filter(e=>e!==this.#e),a=0;for(let e=0;e<i.length;e++){let r=i[e].getBoundingClientRect(),o=r.left+r.width/2,s=r.top+r.height/2;if(this.axis===`horizontal`?t>o:(this.axis===`vertical`||t>o)&&n>s)a=e+1;else break}this.#b(r,a)}else if(this.mode===`preview`){let t=e.clientX+this.#a,n=e.clientY+this.#o;this.#S(r,t,n)}else{let t=null,n=-1;for(let i=0;i<r.length;i++){let a=r[i].getBoundingClientRect(),o=a.left+a.width/2,s=a.top+a.height/2;if(this.axis===`vertical`?e.clientY>=a.top&&e.clientY<=a.bottom:this.axis===`horizontal`?e.clientX>=a.left&&e.clientX<=a.right:e.clientX>=a.left&&e.clientX<=a.right&&e.clientY>=a.top&&e.clientY<=a.bottom){n=(this.axis===`horizontal`?e.clientX<o:e.clientY<s)?i:i+1,t=r[i];break}}this.#y(r,t,n)}};#y(e,t,n){for(let n of e)n!==t&&(n.removeAttribute(`drag-over`),n.style.removeProperty(`outline`),n.style.removeProperty(`outline-offset`));t&&(t.setAttribute(`drag-over`,``),t.style.outline=`2px solid var(--ui-focus-ring, highlight)`,t.style.outlineOffset=`2px`,this.host.dispatchEvent(new CustomEvent(`ui-drag-over`,{bubbles:!0,composed:!0,detail:{item:this.#e,target:t,index:n}})))}#b(e,t){if(t===-1||t===this.#c)return;this.#c=t,this.#x(e),this.#n||(this.#n=document.createElement(`div`),this.#n.className=`drag-placeholder`,this.#n.setAttribute(`aria-hidden`,`true`));let n=e.filter(e=>e!==this.#e),r=Math.min(t,n.length);r<n.length?n[r].before(this.#n):n.length>0?n[n.length-1].after(this.#n):this.host.appendChild(this.#n),r<n.length&&n[r].setAttribute(`drag-slot-before`,``),r>0&&r-1<n.length&&n[r-1].setAttribute(`drag-slot-after`,``);let i=r<n.length?n[r]:null;this.host.dispatchEvent(new CustomEvent(`ui-drag-over`,{bubbles:!0,composed:!0,detail:{item:this.#e,index:t,insertBefore:i}}))}#x(e){for(let t of e)t.removeAttribute(`drag-slot-before`),t.removeAttribute(`drag-slot-after`)}#S(e,t,n){let r=e.filter(e=>e!==this.#e);if(r.length===0)return;let i=e[0].getBoundingClientRect(),a=1;for(let t=1;t<e.length&&Math.abs(e[t].getBoundingClientRect().top-i.top)<i.height*.5;t++)a=t+1;let o=a>1?e[1].getBoundingClientRect().left-i.left:i.width,s=a<e.length?e[a].getBoundingClientRect().top-i.top:i.height,c=Math.round((t-(i.left+i.width/2))/o),l=Math.round((n-(i.top+i.height/2))/s),u=Math.ceil(r.length/a)-1,d=Math.max(0,Math.min(c,a-1)),f=Math.max(0,Math.min(l,u))*a+d;if(f=Math.max(0,Math.min(f,r.length)),f===this.#f)return;this.#f=f;let p=f<r.length?r[f]:null,m=()=>{p?p.before(this.#e):r[r.length-1].after(this.#e)};this.animate&&typeof document.startViewTransition==`function`?document.startViewTransition(()=>{m(),this.#C()}).finished.catch(()=>{}):m(),this.host.dispatchEvent(new CustomEvent(`ui-drag-over`,{bubbles:!0,composed:!0,detail:{item:this.#e,index:f,insertBefore:p}}))}#C(){let e=this.#p();for(let t=0;t<e.length;t++)e[t].style.viewTransitionName=e[t]===this.#e?`none`:`drag-item-${t}`}#w(){for(let e of this.#p())e.style.removeProperty(`view-transition-name`)}#T(){if(this.mode!==`preview`||!this.#e||!this.#u)return;let e=this.#e,t=this.#d,n=this.#u,r=()=>{t&&t.isConnected?t.before(e):n.appendChild(e)};this.animate&&typeof document.startViewTransition==`function`?document.startViewTransition(()=>{r(),this.#C()}).finished.catch(()=>{}):r()}#E=e=>{if(this.#e){if(this.#t)if(this.mode===`slot`){let e=this.#p().filter(e=>e!==this.#e),t=this.#c>=0&&this.#c<e.length?e[this.#c]:null;this.host.dispatchEvent(new CustomEvent(`ui-drop`,{bubbles:!0,composed:!0,detail:{item:this.#e,fromIndex:this.#s,toIndex:this.#c,insertBefore:t}}))}else if(this.mode===`preview`){let e=this.#p(),t=this.#e?e.indexOf(this.#e):-1;this.#u=null,this.#d=null,this.host.dispatchEvent(new CustomEvent(`ui-drop`,{bubbles:!0,composed:!0,detail:{item:this.#e,fromIndex:this.#s,toIndex:t}}))}else{let e=this.#m(),t=e.find(e=>e.hasAttribute(`drag-over`))??null,n=t?e.indexOf(t):-1;this.host.dispatchEvent(new CustomEvent(`ui-drop`,{bubbles:!0,composed:!0,detail:{item:this.#e,target:t,fromIndex:this.#s,toIndex:n}}))}this.#A()}};#D=()=>{this.#e&&(this.#T(),this.#t&&this.host.dispatchEvent(new CustomEvent(`ui-drag-cancel`,{bubbles:!0,composed:!0,detail:{item:this.#e}})),this.#A())};#O=e=>{e.key===`Escape`&&this.#e&&(e.preventDefault(),this.#T(),this.#t&&this.host.dispatchEvent(new CustomEvent(`ui-drag-cancel`,{bubbles:!0,composed:!0,detail:{item:this.#e}})),this.#A())};#k(e){if(!this.#e)return;let t=this.#e.getBoundingClientRect(),n=this.#e.cloneNode(!0);n.setAttribute(`popover`,`manual`),n.setAttribute(`aria-hidden`,`true`),document.body.appendChild(n),n.showPopover(),n.style.position=`fixed`,n.style.inset=`unset`,n.style.left=`${t.left}px`,n.style.top=`${t.top}px`,n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.style.margin=`0`,n.style.pointerEvents=`none`,n.style.opacity=`0.8`,n.style.transformOrigin=`center center`,n.style.border=`none`,n.style.outline=`none`,this.#t=n,this.#r=e.clientX,this.#i=e.clientY}#A(){if(this.#t){if(this.#t.isConnected)try{this.#t.hidePopover()}catch{}this.#t.remove(),this.#t=null}this.#e&&this.#e.removeAttribute(`dragging`),this.mode===`preview`&&this.animate&&this.#w();let e=this.#m();if(this.mode===`slot`)this.#x(e);else for(let t of e)t.removeAttribute(`drag-over`),t.style.removeProperty(`outline`),t.style.removeProperty(`outline-offset`);this.#n&&=(this.#n.remove(),null),this.#e=null,this.#s=-1,this.#c=-1,this.#u=null,this.#d=null,this.#f=-1,document.removeEventListener(`pointermove`,this.#v),document.removeEventListener(`pointerup`,this.#E),document.removeEventListener(`pointercancel`,this.#D),document.removeEventListener(`keydown`,this.#O)}},ge=class{host;selector;mode;disabled;#e=-1;#t=-1;#n=!1;#r=!1;#i=`idle`;constructor(e,t){this.host=e,this.selector=t.selector,this.mode=t.mode??`drag`,this.disabled=t.disabled??!1,this.attach()}attach(){this.#r||(this.#r=!0,this.host.addEventListener(`pointerdown`,this.#c))}detach(){this.#r&&(this.#r=!1,this.host.removeEventListener(`pointerdown`,this.#c),this.#T())}destroy(){this.detach()}clearRange(){this.#T()}#a(){return this.selector?[...this.host.querySelectorAll(this.selector)]:[]}#o(e){let t=this.#a(),n=document.elementFromPoint(e.clientX,e.clientY)??e.target;if(!n)return-1;let r=n.closest?.(this.selector);return!r||!this.host.contains(r)?-1:t.indexOf(r)}#s(e){let t=this.#a(),n=e.target.closest?.(this.selector);return!n||!this.host.contains(n)?-1:t.indexOf(n)}#c=e=>{e.button===0&&(this.disabled||this.selector&&(this.mode===`click`?this.#m(e):this.#l(e)))};#l(e){let t=this.#o(e);t!==-1&&(e.preventDefault(),this.#n=!0,this.#e=t,this.#t=t,this.#C(),this.host.setPointerCapture(e.pointerId),document.addEventListener(`pointermove`,this.#u),document.addEventListener(`pointerup`,this.#d),document.addEventListener(`pointercancel`,this.#f))}#u=e=>{if(!this.#n)return;let t=this.#o(e);t!==-1&&t!==this.#t&&(this.#t=t,this.#C(),this.#x())};#d=e=>{this.#n&&=(this.#S(),this.#p(),!1)};#f=()=>{this.#T()};#p(){document.removeEventListener(`pointermove`,this.#u),document.removeEventListener(`pointerup`,this.#d),document.removeEventListener(`pointercancel`,this.#f)}#m(e){let t=this.#s(e);t!==-1&&(e.preventDefault(),this.#i===`idle`?(this.#e=t,this.#t=t,this.#C(),this.#i=`selecting`,this.host.addEventListener(`pointermove`,this.#h)):this.#i===`selecting`&&(this.#t=t,this.#C(),this.#i=`adjusting`,this.host.setPointerCapture(e.pointerId),document.addEventListener(`pointermove`,this.#g),document.addEventListener(`pointerup`,this.#_),document.addEventListener(`pointercancel`,this.#v)))}#h=e=>{if(this.#i!==`selecting`)return;let t=this.#s(e);t!==-1&&t!==this.#t&&(this.#t=t,this.#C(),this.#x())};#g=e=>{if(this.#i!==`adjusting`)return;let t=this.#o(e);t!==-1&&t!==this.#t&&(this.#t=t,this.#C(),this.#x())};#_=e=>{this.#i===`adjusting`&&(this.#S(),this.#y(),this.#i=`idle`)};#v=()=>{this.#T()};#y(){this.host.removeEventListener(`pointermove`,this.#h),document.removeEventListener(`pointermove`,this.#g),document.removeEventListener(`pointerup`,this.#_),document.removeEventListener(`pointercancel`,this.#v)}#b(){return[Math.min(this.#e,this.#t),Math.max(this.#e,this.#t)]}#x(){let e=this.#a(),[t,n]=this.#b();this.host.dispatchEvent(new CustomEvent(`ui-range-change`,{bubbles:!0,composed:!0,detail:{startIndex:t,endIndex:n,items:e.slice(t,n+1)}}))}#S(){let e=this.#a(),[t,n]=this.#b();this.host.dispatchEvent(new CustomEvent(`ui-range-select`,{bubbles:!0,composed:!0,detail:{startIndex:t,endIndex:n,items:e.slice(t,n+1)}}))}#C(){let e=this.#a(),[t,n]=this.#b();for(let r=0;r<e.length;r++){let i=r>=t&&r<=n;e[r].toggleAttribute(`range-selected`,i),r===t?e[r].setAttribute(`range-start`,``):e[r].removeAttribute(`range-start`),r===n?e[r].setAttribute(`range-end`,``):e[r].removeAttribute(`range-end`)}}#w(){let e=this.#a();for(let t of e)t.removeAttribute(`range-selected`),t.removeAttribute(`range-start`),t.removeAttribute(`range-end`)}#T(){this.#w(),this.#p(),this.#y(),this.#n=!1,this.#i=`idle`,this.#e=-1,this.#t=-1}},_e=class{host;handleSelector;axis;min;max;disabled;reverse;#e=0;#t=0;#n=0;#r=0;#i=!1;#a=!1;constructor(e,t){this.host=e,this.handleSelector=t.handleSelector,this.axis=t.axis??`horizontal`,this.min=t.min??0,this.max=t.max??1/0,this.disabled=t.disabled??!1,this.reverse=t.reverse??!1,this.attach()}attach(){this.#a||(this.#a=!0,this.host.addEventListener(`pointerdown`,this.#o))}detach(){this.#a&&(this.#a=!1,this.host.removeEventListener(`pointerdown`,this.#o),this.#d())}destroy(){this.detach()}#o=e=>{if(e.button!==0||this.disabled||!this.handleSelector)return;let t=e.target.closest?.(this.handleSelector);if(!t||!this.host.contains(t))return;e.preventDefault(),this.#i=!0,this.#e=e.clientX,this.#t=e.clientY;let n=this.host.getBoundingClientRect();this.#n=n.width,this.#r=n.height,this.host.setAttribute(`resizing`,``),this.host.setPointerCapture(e.pointerId),document.addEventListener(`pointermove`,this.#s),document.addEventListener(`pointerup`,this.#c),document.addEventListener(`pointercancel`,this.#l),document.addEventListener(`keydown`,this.#u),this.host.dispatchEvent(new CustomEvent(`ui-resize-start`,{bubbles:!0,composed:!0,detail:{width:this.#n,height:this.#r}}))};#s=e=>{if(!this.#i)return;let t=this.reverse?-1:1,n=(e.clientX-this.#e)*t,r=(e.clientY-this.#t)*t;if(this.axis===`horizontal`||this.axis===`both`){let e=Math.min(this.max,Math.max(this.min,this.#n+n));this.host.style.width=`${e}px`}if(this.axis===`vertical`||this.axis===`both`){let e=Math.min(this.max,Math.max(this.min,this.#r+r));this.host.style.height=`${e}px`}let i=this.host.getBoundingClientRect();this.host.dispatchEvent(new CustomEvent(`ui-resize-move`,{bubbles:!0,composed:!0,detail:{width:i.width,height:i.height}}))};#c=e=>{if(!this.#i)return;let t=this.host.getBoundingClientRect();this.host.dispatchEvent(new CustomEvent(`ui-resize-end`,{bubbles:!0,composed:!0,detail:{width:t.width,height:t.height}})),this.#d()};#l=()=>{this.#i&&((this.axis===`horizontal`||this.axis===`both`)&&(this.host.style.width=`${this.#n}px`),(this.axis===`vertical`||this.axis===`both`)&&(this.host.style.height=`${this.#r}px`),this.#d())};#u=e=>{e.key===`Escape`&&this.#i&&(e.preventDefault(),(this.axis===`horizontal`||this.axis===`both`)&&(this.host.style.width=`${this.#n}px`),(this.axis===`vertical`||this.axis===`both`)&&(this.host.style.height=`${this.#r}px`),this.#d())};#d(){this.#i=!1,this.host.removeAttribute(`resizing`),document.removeEventListener(`pointermove`,this.#s),document.removeEventListener(`pointerup`,this.#c),document.removeEventListener(`pointercancel`,this.#l),document.removeEventListener(`keydown`,this.#u)}},ve=class{host;itemHeight;overscan;#e=0;#t=0;#n=0;#r=null;#i=null;#a=null;#o=0;constructor(e,t={}){this.host=e,this.itemHeight=t.itemHeight??40,this.overscan=t.overscan??5}get start(){return this.#t}get end(){return this.#n}enable(e,t,n){this.#r=e,this.#e=n,this.#i=document.createElement(`div`),this.#i.className=`ui-virtual-spacer-top`,this.#i.setAttribute(`aria-hidden`,`true`),this.#a=document.createElement(`div`),this.#a.className=`ui-virtual-spacer-bottom`,this.#a.setAttribute(`aria-hidden`,`true`),t.prepend(this.#i),t.appendChild(this.#a),e.addEventListener(`scroll`,this.#s,{passive:!0}),this.#c()}disable(){this.#r&&this.#r.removeEventListener(`scroll`,this.#s),this.#o&&=(cancelAnimationFrame(this.#o),0),this.#i?.remove(),this.#a?.remove(),this.#r=null,this.#i=null,this.#a=null}updateCount(e){this.#e=e,this.#c()}destroy(){this.disable()}#s=()=>{this.#o||=requestAnimationFrame(()=>{this.#o=0,this.#c()})};#c(){if(!this.#r||!this.#i||!this.#a)return;let e=this.#r.scrollTop,t=this.#r.clientHeight,n=Math.floor(e/this.itemHeight),r=Math.ceil((e+t)/this.itemHeight),i=Math.max(0,n-this.overscan),a=Math.min(this.#e,r+this.overscan);i===this.#t&&a===this.#n||(this.#t=i,this.#n=a,this.#i.style.height=`${i*this.itemHeight}px`,this.#a.style.height=`${Math.max(0,(this.#e-a)*this.itemHeight)}px`,this.host.dispatchEvent(new CustomEvent(`ui-virtual-change`,{bubbles:!0,composed:!0,detail:{start:i,end:a,totalCount:this.#e}})))}},ye=class{host;selector;mode;disabled;#e=new Set;#t=null;#n=!1;constructor(e,t){this.host=e,this.selector=t.selector,this.mode=t.mode??`multiple`,this.disabled=t.disabled??!1,this.attach()}attach(){this.#n||(this.#n=!0,this.host.addEventListener(`click`,this.#o),this.host.addEventListener(`keydown`,this.#s))}detach(){this.#n&&(this.#n=!1,this.host.removeEventListener(`click`,this.#o),this.host.removeEventListener(`keydown`,this.#s))}destroy(){this.clear(),this.detach()}select(e){this.disabled||(this.#i(),this.#e.clear(),this.#e.add(e),this.#t=e,e.setAttribute(`selected`,``),e.setAttribute(`selection-anchor`,``),this.#a())}toggle(e){if(!this.disabled){this.#e.has(e)?(this.#e.delete(e),e.removeAttribute(`selected`)):(this.#e.add(e),e.setAttribute(`selected`,``));for(let e of this.#r())e.removeAttribute(`selection-anchor`);this.#t=e,e.setAttribute(`selection-anchor`,``),this.#a()}}rangeTo(e){if(this.disabled||!this.#t)return;let t=this.#r(),n=t.indexOf(this.#t),r=t.indexOf(e);if(n===-1||r===-1)return;let i=Math.min(n,r),a=Math.max(n,r);this.#i(),this.#e.clear();for(let e=i;e<=a;e++)this.#e.add(t[e]),t[e].setAttribute(`selected`,``);this.#t&&this.#t.setAttribute(`selection-anchor`,``),this.#a()}selectAll(){if(!(this.disabled||this.mode===`single`)){this.#i(),this.#e.clear();for(let e of this.#r())this.#e.add(e),e.setAttribute(`selected`,``);this.#a()}}clear(){let e=this.#e.size===0;this.#i(),this.#e.clear(),this.#t=null,e||this.#a()}getSelection(){return[...this.#e]}handleClick(e,t){this.disabled||(this.mode===`single`?this.select(e):t.shift&&this.#t?this.rangeTo(e):t.ctrl?this.toggle(e):this.select(e))}#r(){return[...this.host.querySelectorAll(this.selector)]}#i(){for(let e of this.#r())e.removeAttribute(`selected`),e.removeAttribute(`selection-anchor`)}#a(){this.host.dispatchEvent(new CustomEvent(`ui-selection-change`,{bubbles:!0,composed:!0,detail:{selected:[...this.#e],count:this.#e.size}}))}#o=e=>{if(this.disabled)return;let t=e.target.closest(this.selector);!t||!this.host.contains(t)||this.handleClick(t,{shift:e.shiftKey,ctrl:e.ctrlKey||e.metaKey})};#s=e=>{this.disabled||(e.ctrlKey||e.metaKey)&&e.key===`a`&&(e.preventDefault(),this.selectAll())}},be=class{host;selector;textField;disabled;#e=``;#t=!1;constructor(e,t){this.host=e,this.selector=t.selector,this.textField=t.textField??`textContent`,this.disabled=t.disabled??!1,this.attach()}attach(){this.#t||=!0}detach(){this.#t&&=!1}destroy(){this.clear(),this.detach()}get query(){return this.#e}filter(e){this.#e=e;let t=[...this.host.querySelectorAll(this.selector)],n=t.length,r=[],i=[];if(!e||this.disabled){for(let e of t)e.removeAttribute(`search-hidden`),e.setAttribute(`search-match`,``),r.push(e);return this.host.dispatchEvent(new CustomEvent(`ui-search`,{bubbles:!0,composed:!0,detail:{query:e,matchCount:r.length,total:n}})),{matches:r,hidden:i,total:n}}let a=e.toLowerCase();for(let e of t)this.#n(e).toLowerCase().includes(a)?(e.removeAttribute(`search-hidden`),e.setAttribute(`search-match`,``),r.push(e)):(e.setAttribute(`search-hidden`,``),e.removeAttribute(`search-match`),i.push(e));return this.host.dispatchEvent(new CustomEvent(`ui-search`,{bubbles:!0,composed:!0,detail:{query:e,matchCount:r.length,total:n}})),{matches:r,hidden:i,total:n}}clear(){this.#e=``;for(let e of this.host.querySelectorAll(this.selector))e.removeAttribute(`search-hidden`),e.removeAttribute(`search-match`)}static highlight(e,t){if(!t)return e;let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return e.replace(RegExp(`(${n})`,`gi`),`<mark>$1</mark>`)}#n(e){return this.textField===`textContent`?e.textContent??``:e.getAttribute(this.textField)??e.textContent??``}},xe=class{host;threshold;velocityThreshold;axis;disabled;#e=0;#t=0;#n=0;#r=!1;#i=!1;#a=null;#o=0;#s=null;#c=0;constructor(e,t={}){this.host=e,this.threshold=t.threshold??50,this.velocityThreshold=t.velocityThreshold??.3,this.axis=t.axis??`horizontal`,this.disabled=t.disabled??!1,this.attach()}get direction(){return this.#a}get distance(){return this.#o}get velocity(){return this.#c}attach(){this.#r||(this.#r=!0,this.host.addEventListener(`pointerdown`,this.#l))}detach(){this.#r&&(this.#r=!1,this.host.removeEventListener(`pointerdown`,this.#l),this.#i&&=(this.host.removeEventListener(`pointerup`,this.#u),this.host.removeEventListener(`pointercancel`,this.#d),!1))}destroy(){this.#s!==null&&(clearTimeout(this.#s),this.#s=null),this.detach()}#l=e=>{this.disabled||e.button!==0||e.pointerType===`touch`&&!e.isPrimary||(this.#e=e.clientX,this.#t=e.clientY,this.#n=Date.now(),this.#a=null,this.#o=0,this.#c=0,this.host.setPointerCapture(e.pointerId),this.host.toggleAttribute(`swiping`,!0),this.#i=!0,this.host.addEventListener(`pointerup`,this.#u),this.host.addEventListener(`pointercancel`,this.#d))};#u=e=>{this.#i=!1,this.host.removeAttribute(`swiping`),this.host.removeEventListener(`pointerup`,this.#u),this.host.removeEventListener(`pointercancel`,this.#d);let t=e.clientX-this.#e,n=e.clientY-this.#t,r=Date.now()-this.#n,i=Math.abs(t),a=Math.abs(n),o=null,s=0;this.axis===`horizontal`||this.axis===`both`&&i>=a?(s=i,o=t>0?`right`:`left`):(s=a,o=n>0?`down`:`up`);let c=r>0?s/r:0;if(s>=this.threshold&&c>=this.velocityThreshold){if(this.#a=o,this.#o=s,this.#c=c,this.#s!==null){clearTimeout(this.#s),this.#s=null;for(let e of[`swipe-left`,`swipe-right`,`swipe-up`,`swipe-down`])this.host.removeAttribute(e)}this.host.setAttribute(`swipe-${o}`,``),this.#s=setTimeout(()=>{this.host.removeAttribute(`swipe-${o}`),this.#s=null},300),this.host.dispatchEvent(new CustomEvent(`ui-swipe`,{bubbles:!0,composed:!0,detail:{direction:o,distance:s,velocity:c}}))}};#d=()=>{this.#i=!1,this.host.removeAttribute(`swiping`),this.host.removeEventListener(`pointerup`,this.#u),this.host.removeEventListener(`pointercancel`,this.#d)}},Se=class{host;trigger;disabled;#e=``;#t=!1;#n=!1;constructor(e,t={}){this.host=e,this.trigger=t.trigger??`dblclick`,this.disabled=t.disabled??!1,this.attach()}get isEditing(){return this.#t}get originalValue(){return this.#e}get currentValue(){return this.host.textContent??``}attach(){this.#n||(this.#n=!0,this.host.addEventListener(this.trigger,this.#r),this.host.addEventListener(`keydown`,this.#i),this.host.addEventListener(`blur`,this.#a))}detach(){this.#n&&(this.#n=!1,this.host.removeEventListener(this.trigger,this.#r),this.host.removeEventListener(`keydown`,this.#i),this.host.removeEventListener(`blur`,this.#a))}destroy(){this.#t&&this.cancelEdit(),this.detach()}startEdit(){if(this.disabled||this.#t)return;this.#e=this.host.textContent??``,this.#t=!0,this.host.setAttribute(`contenteditable`,`plaintext-only`),this.host.setAttribute(`editing`,``),this.host.focus();let e=window.getSelection();e&&(e.selectAllChildren(this.host),e.collapseToEnd()),this.host.dispatchEvent(new CustomEvent(`ui-edit-start`,{bubbles:!0,composed:!0,detail:{value:this.#e}}))}commitEdit(){if(!this.#t)return this.#e;let e=this.host.textContent??``;return this.#t=!1,this.host.removeAttribute(`contenteditable`),this.host.removeAttribute(`editing`),this.host.dispatchEvent(new CustomEvent(`ui-edit-commit`,{bubbles:!0,composed:!0,detail:{value:e,previousValue:this.#e}})),e}cancelEdit(){this.#t&&(this.host.textContent=this.#e,this.#t=!1,this.host.removeAttribute(`contenteditable`),this.host.removeAttribute(`editing`),this.host.dispatchEvent(new CustomEvent(`ui-edit-cancel`,{bubbles:!0,composed:!0,detail:{value:this.#e}})))}#r=()=>{this.startEdit()};#i=e=>{this.#t&&(e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),this.commitEdit()):e.key===`Escape`&&(e.preventDefault(),this.cancelEdit()))};#a=()=>{this.#t&&this.commitEdit()}},Ce=class{host;selector;disabled;#e=new Set;#t=!1;constructor(e,t){this.host=e,this.selector=t.selector,this.disabled=t.disabled??!1,this.attach()}attach(){this.#t||(this.#t=!0,this.host.addEventListener(`keydown`,this.#n))}detach(){this.#t&&(this.#t=!1,this.host.removeEventListener(`keydown`,this.#n))}destroy(){this.cancelCut(),this.detach()}serialize(e){return e.map(e=>e.textContent??``).join(`
11
+ `)}deserialize(e){return e.split(`
12
+ `)}async copy(e){if(this.disabled)return``;let t=this.serialize(e);return await navigator.clipboard.writeText(t),this.host.dispatchEvent(new CustomEvent(`ui-clip-copy`,{bubbles:!0,composed:!0,detail:{items:e,data:t}})),t}async cut(e){if(this.disabled)return``;let t=this.serialize(e);await navigator.clipboard.writeText(t),this.cancelCut();for(let t of e)this.#e.add(t),t.setAttribute(`clip-cut`,``);return this.host.dispatchEvent(new CustomEvent(`ui-clip-cut`,{bubbles:!0,composed:!0,detail:{items:e,data:t}})),t}async paste(){if(this.disabled)return``;let e=await navigator.clipboard.readText();return this.cancelCut(),this.host.dispatchEvent(new CustomEvent(`ui-clip-paste`,{bubbles:!0,composed:!0,detail:{data:e}})),e}cancelCut(){for(let e of this.#e)e.removeAttribute(`clip-cut`);this.#e.clear()}get hasCutPending(){return this.#e.size>0}get cutItems(){return this.#e}#n=e=>{if(this.disabled||!(e.ctrlKey||e.metaKey))return;let t=[...this.host.querySelectorAll(`${this.selector}[selected]`)];if(t.length!==0)switch(e.key){case`c`:e.preventDefault(),this.copy(t);break;case`x`:e.preventDefault(),this.cut(t);break;case`v`:e.preventDefault(),this.paste();break}}},H=class{host;disabled;#e=!1;#t=`mouse`;#n=!1;constructor(e,t={}){this.host=e,this.disabled=t.disabled??!1,this.attach()}#r(){return typeof this.disabled==`function`?this.disabled():this.disabled?!0:this.host.disabled===!0}attach(){this.#n||(this.#n=!0,this.host.addEventListener(`pointerdown`,this.#i),this.host.addEventListener(`pointerup`,this.#a),this.host.addEventListener(`pointercancel`,this.#o),this.host.addEventListener(`lostpointercapture`,this.#s),this.host.addEventListener(`keydown`,this.#c),this.host.addEventListener(`keyup`,this.#l))}detach(){this.#n&&(this.#n=!1,this.host.removeEventListener(`pointerdown`,this.#i),this.host.removeEventListener(`pointerup`,this.#a),this.host.removeEventListener(`pointercancel`,this.#o),this.host.removeEventListener(`lostpointercapture`,this.#s),this.host.removeEventListener(`keydown`,this.#c),this.host.removeEventListener(`keyup`,this.#l),this.host.removeAttribute(`pressed`))}destroy(){this.detach()}#i=e=>{e.button===0&&(this.#r()||(this.#t=e.pointerType,this.host.setPointerCapture(e.pointerId),this.#e=!0,this.host.toggleAttribute(`pressed`,!0)))};#a=e=>{this.#e&&(this.#e=!1,this.host.removeAttribute(`pressed`),this.host.dispatchEvent(new CustomEvent(`ui-press`,{bubbles:!0,composed:!0,detail:{pointerType:this.#t}})))};#o=()=>{this.#e=!1,this.host.removeAttribute(`pressed`)};#s=()=>{this.#e=!1,this.host.removeAttribute(`pressed`)};#c=e=>{e.repeat||this.#r()||e.key!==`Enter`&&e.key!==` `||(e.key===` `&&e.preventDefault(),this.host.toggleAttribute(`pressed`,!0))};#l=e=>{e.key!==`Enter`&&e.key!==` `||(this.host.removeAttribute(`pressed`),!this.#r()&&this.host.dispatchEvent(new CustomEvent(`ui-press`,{bubbles:!0,composed:!0,detail:{pointerType:`keyboard`}})))}},we=class{host;delay;leaveDelay;disabled;#e;#t;#n=!1;constructor(e,t={}){this.host=e,this.delay=t.delay??0,this.leaveDelay=t.leaveDelay??0,this.disabled=t.disabled??!1,this.attach()}attach(){this.#n||(this.#n=!0,this.host.addEventListener(`pointerenter`,this.#r),this.host.addEventListener(`pointerleave`,this.#i))}detach(){this.#n&&(this.#n=!1,this.host.removeEventListener(`pointerenter`,this.#r),this.host.removeEventListener(`pointerleave`,this.#i),clearTimeout(this.#e),clearTimeout(this.#t),this.host.removeAttribute(`hovered`))}destroy(){this.detach()}#r=e=>{this.disabled||(clearTimeout(this.#t),this.delay>0?this.#e=setTimeout(()=>{this.host.toggleAttribute(`hovered`,!0),this.host.dispatchEvent(new CustomEvent(`ui-hover-start`,{bubbles:!0,composed:!0,detail:{pointerType:e.pointerType}}))},this.delay):(this.host.toggleAttribute(`hovered`,!0),this.host.dispatchEvent(new CustomEvent(`ui-hover-start`,{bubbles:!0,composed:!0,detail:{pointerType:e.pointerType}}))))};#i=e=>{this.disabled||(clearTimeout(this.#e),this.leaveDelay>0?this.#t=setTimeout(()=>{this.host.removeAttribute(`hovered`),this.host.dispatchEvent(new CustomEvent(`ui-hover-end`,{bubbles:!0,composed:!0,detail:{pointerType:e.pointerType}}))},this.leaveDelay):(this.host.removeAttribute(`hovered`),this.host.dispatchEvent(new CustomEvent(`ui-hover-end`,{bubbles:!0,composed:!0,detail:{pointerType:e.pointerType}}))))}},Te=class{host;value;feedbackDuration;#e;constructor(e,t={}){this.host=e,this.value=t.value??``,this.feedbackDuration=t.feedbackDuration??2e3}async copy(){let e=typeof this.value==`function`?this.value():this.value;await navigator.clipboard.writeText(e),this.host.toggleAttribute(`copied`,!0),clearTimeout(this.#e),this.#e=setTimeout(()=>this.host.removeAttribute(`copied`),this.feedbackDuration),this.host.dispatchEvent(new CustomEvent(`ui-copy`,{bubbles:!0,composed:!0,detail:{value:e}}))}destroy(){clearTimeout(this.#e)}},Ee=class{host;threshold;root;margin;once;disabled;#e=null;#t=!1;constructor(e,t={}){this.host=e,this.threshold=t.threshold??0,this.root=t.root??null,this.margin=t.margin??`0px`,this.once=t.once??!1,this.disabled=t.disabled??!1,this.attach()}attach(){if(this.#t||this.disabled)return;this.#t=!0;let e=this.root?document.querySelector(this.root):null;this.#e=new IntersectionObserver(this.#n,{root:e,rootMargin:this.margin,threshold:this.threshold}),this.#e.observe(this.host)}detach(){this.#t&&(this.#t=!1,this.#e?.disconnect(),this.#e=null,this.host.removeAttribute(`intersecting`))}destroy(){this.detach()}#n=e=>{for(let t of e){let e=t.isIntersecting;this.host.toggleAttribute(`intersecting`,e),this.host.dispatchEvent(new CustomEvent(`ui-intersect`,{bubbles:!0,composed:!0,detail:{isIntersecting:e,ratio:t.intersectionRatio}})),e&&this.once&&(this.#e?.disconnect(),this.#e=null,this.#t=!1)}}},De=class{host;accept;disabled;multiple;#e=0;#t=!1;constructor(e,t={}){this.host=e,this.accept=t.accept??`*`,this.disabled=t.disabled??!1,this.multiple=t.multiple??!0,this.attach()}attach(){this.#t||(this.#t=!0,this.host.addEventListener(`dragenter`,this.#r),this.host.addEventListener(`dragover`,this.#i),this.host.addEventListener(`dragleave`,this.#a),this.host.addEventListener(`drop`,this.#o))}detach(){this.#t&&(this.#t=!1,this.host.removeEventListener(`dragenter`,this.#r),this.host.removeEventListener(`dragover`,this.#i),this.host.removeEventListener(`dragleave`,this.#a),this.host.removeEventListener(`drop`,this.#o),this.host.removeAttribute(`drop-active`),this.host.removeAttribute(`drop-invalid`),this.#e=0)}destroy(){this.detach()}#n(e){if(this.accept===`*`)return!0;for(let t of e.items)if(t.type.match(this.accept.replace(`*`,`.*`)))return!0;return!1}#r=e=>{if(this.disabled||!e.dataTransfer)return;e.preventDefault(),this.#e++;let t=this.#n(e.dataTransfer);t?(this.host.toggleAttribute(`drop-active`,!0),this.host.removeAttribute(`drop-invalid`)):(this.host.toggleAttribute(`drop-invalid`,!0),this.host.removeAttribute(`drop-active`)),this.#e===1&&this.host.dispatchEvent(new CustomEvent(`ui-drop-enter`,{bubbles:!0,composed:!0,detail:{valid:t}}))};#i=e=>{this.disabled||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=`copy`))};#a=e=>{this.#e--,this.#e<=0&&(this.#e=0,this.host.removeAttribute(`drop-active`),this.host.removeAttribute(`drop-invalid`),this.host.dispatchEvent(new CustomEvent(`ui-drop-leave`,{bubbles:!0,composed:!0})))};#o=e=>{if(e.preventDefault(),this.#e=0,this.host.removeAttribute(`drop-active`),this.host.removeAttribute(`drop-invalid`),this.disabled||!e.dataTransfer)return;if(e.dataTransfer.files.length>0){let t=Array.from(e.dataTransfer.files);this.multiple||(t=t.slice(0,1)),this.host.dispatchEvent(new CustomEvent(`ui-drop`,{bubbles:!0,composed:!0,detail:{type:`file`,files:t,dataTransfer:e.dataTransfer}}));return}let t=e.dataTransfer.getData(`text/plain`);t&&this.host.dispatchEvent(new CustomEvent(`ui-drop`,{bubbles:!0,composed:!0,detail:{type:`text`,text:t}}))}},Oe=class{host;selector;disabled;#e=null;#t=`none`;#n=!1;constructor(e,t={}){this.host=e,this.selector=t.selector??``,this.disabled=t.disabled??!1,this.attach()}get sortColumn(){return this.#e}get sortDirection(){return this.#t}attach(){this.#n||(this.#n=!0,this.host.addEventListener(`click`,this.#r))}detach(){this.#n&&(this.#n=!1,this.host.removeEventListener(`click`,this.#r))}destroy(){this.detach()}#r=e=>{if(this.disabled||!this.selector)return;let t=e.target.closest(this.selector);if(!t||!this.host.contains(t))return;let n=t.dataset.column??t.textContent?.trim()??``;n===this.#e?this.#t===`asc`?this.#t=`desc`:this.#t===`desc`?this.#t=`none`:this.#t=`asc`:(this.#e=n,this.#t=`asc`);for(let e of this.host.querySelectorAll(this.selector))(e.dataset.column??e.textContent?.trim()??``)===this.#e&&this.#t!==`none`?e.setAttribute(`aria-sort`,this.#t===`asc`?`ascending`:`descending`):e.removeAttribute(`aria-sort`);this.host.dispatchEvent(new CustomEvent(`ui-sort`,{bubbles:!0,composed:!0,detail:{column:this.#e,direction:this.#t}}))}},ke=class{host;rules;#e;#t=!0;#n=``;constructor(e,t={}){this.host=e,this.rules=t.rules??[],this.#e=t.internals??null}get valid(){return this.#t}get errorMessage(){return this.#n}validate(e){let t=e??this.#r();for(let e of this.rules)if(!e.test(t))return this.#t=!1,this.#n=e.message,this.host.setAttribute(`invalid`,``),this.host.setAttribute(`aria-invalid`,`true`),this.#e?.setValidity({customError:!0},e.message,this.host),this.host.dispatchEvent(new CustomEvent(`ui-invalid`,{bubbles:!0,composed:!0,detail:{message:e.message,value:t}})),!1;return this.#t=!0,this.#n=``,this.host.removeAttribute(`invalid`),this.host.removeAttribute(`aria-invalid`),this.#e?.setValidity({}),this.host.dispatchEvent(new CustomEvent(`ui-valid`,{bubbles:!0,composed:!0,detail:{value:t}})),!0}clearValidation(){this.#t=!0,this.#n=``,this.host.removeAttribute(`invalid`),this.host.removeAttribute(`aria-invalid`),this.#e?.setValidity({})}destroy(){}static required(e=`This field is required`){return{test:e=>e.trim().length>0,message:e}}static minLength(e,t){return{test:t=>t.length>=e,message:t??`Must be at least ${e} characters`}}static maxLength(e,t){return{test:t=>t.length<=e,message:t??`Must be at most ${e} characters`}}static pattern(e,t=`Invalid format`){return{test:t=>e.test(t),message:t}}#r(){return this.#i(this.host)?this.host.value:this.host.querySelector(`input, textarea, select`)?.value??``}#i(e){return`value`in e&&typeof e.value==`string`}},Ae=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])`,je=class{host;#e=null;#t=null;constructor(e){this.host=e}enable(){this.#t&&this.host.removeEventListener(`keydown`,this.#t),this.#e=document.activeElement,this.#t=e=>{if(e.key!==`Tab`)return;let t=[...this.host.querySelectorAll(Ae)];if(t.length===0)return;let n=t[0],r=t[t.length-1];e.shiftKey&&document.activeElement===n?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n.focus())},this.host.addEventListener(`keydown`,this.#t);let e=this.host.querySelector(`[autofocus]`);if(e)e.focus();else{let e=this.host.querySelectorAll(Ae);e.length>0?e[0].focus():(this.host.setAttribute(`tabindex`,`-1`),this.host.focus())}}disable(){this.#t&&=(this.host.removeEventListener(`keydown`,this.#t),null),this.#e instanceof HTMLElement&&this.#e.isConnected&&this.#e.focus(),this.#e=null}destroy(){this.disable()}},Me=class{host;duration;#e=!1;#t=null;#n=0;constructor(e,t={}){this.host=e,this.duration=t.duration??200}get collapsed(){return this.host.hasAttribute(`collapsed`)}set collapsed(e){e?this.collapse():this.expand()}expand(){this.host.hasAttribute(`collapsed`)&&(this.#e||(this.#e=!0,this.host.removeAttribute(`collapsed`),this.host.style.overflow=`clip`,this.host.style.height=`0px`,this.#n=requestAnimationFrame(()=>{let e=this.host.scrollHeight;this.host.style.transition=`height ${this.duration}ms var(--ui-easing, ease)`,this.host.style.height=`${e}px`;let t=()=>{this.host.removeEventListener(`transitionend`,t),this.host.style.removeProperty(`height`),this.host.style.removeProperty(`overflow`),this.host.style.removeProperty(`transition`),this.#e=!1,this.host.dispatchEvent(new CustomEvent(`ui-expand`,{bubbles:!0,composed:!0}))};this.host.addEventListener(`transitionend`,t,{once:!0}),this.#t=setTimeout(()=>{this.#e&&t()},this.duration+50)})))}collapse(){if(this.host.hasAttribute(`collapsed`)||this.#e)return;this.#e=!0;let e=this.host.scrollHeight;this.host.style.overflow=`clip`,this.host.style.height=`${e}px`,this.#n=requestAnimationFrame(()=>{this.host.style.transition=`height ${this.duration}ms var(--ui-easing, ease)`,this.host.style.height=`0px`;let e=()=>{this.host.removeEventListener(`transitionend`,e),this.host.style.removeProperty(`height`),this.host.style.removeProperty(`overflow`),this.host.style.removeProperty(`transition`),this.#e=!1,this.host.setAttribute(`collapsed`,``),this.host.dispatchEvent(new CustomEvent(`ui-collapse`,{bubbles:!0,composed:!0}))};this.host.addEventListener(`transitionend`,e,{once:!0}),this.#t=setTimeout(()=>{this.#e&&e()},this.duration+50)})}toggle(){this.host.hasAttribute(`collapsed`)?this.expand():this.collapse()}destroy(){cancelAnimationFrame(this.#n),this.#t!==null&&(clearTimeout(this.#t),this.#t=null),this.#e&&(this.host.style.removeProperty(`height`),this.host.style.removeProperty(`overflow`),this.host.style.removeProperty(`transition`)),this.#e=!1}},U=class{host;selector;orientation;wrap;disabled;#e=0;#t=!1;constructor(e,t={}){this.host=e,this.selector=t.selector??`:scope > [role]`,this.orientation=t.orientation??`vertical`,this.wrap=t.wrap??!0,this.disabled=t.disabled??!1,this.attach()}attach(){if(this.#t||this.disabled)return;this.#t=!0,this.host.addEventListener(`keydown`,this.#r),this.host.addEventListener(`focusin`,this.#i);let e=this.#n();for(let t=0;t<e.length;t++)e[t].setAttribute(`tabindex`,t===0?`0`:`-1`)}detach(){this.#t&&(this.#t=!1,this.host.removeEventListener(`keydown`,this.#r),this.host.removeEventListener(`focusin`,this.#i))}destroy(){this.detach()}#n(){return[...this.host.querySelectorAll(this.selector)].filter(e=>!e.hasAttribute(`disabled`)&&e.getAttribute(`aria-disabled`)!==`true`)}#r=e=>{let t=this.#n();if(t.length===0)return;let n=0,r=this.orientation===`vertical`||this.orientation===`both`,i=this.orientation===`horizontal`||this.orientation===`both`;if(e.key===`ArrowDown`&&r)n=1;else if(e.key===`ArrowUp`&&r)n=-1;else if(e.key===`ArrowRight`&&i)n=1;else if(e.key===`ArrowLeft`&&i)n=-1;else if(e.key===`Home`){this.#a(t,0),e.preventDefault();return}else if(e.key===`End`){this.#a(t,t.length-1),e.preventDefault();return}else return;e.preventDefault();let a=this.#e+n;a=this.wrap?(a+t.length)%t.length:Math.max(0,Math.min(t.length-1,a)),this.#a(t,a)};#i=e=>{e.target===this.host&&this.#n()[this.#e]?.focus()};#a(e,t){let n=e[this.#e];n&&n.setAttribute(`tabindex`,`-1`),this.#e=t;let r=e[t];r&&(r.setAttribute(`tabindex`,`0`),r.focus())}},W=class{host;#e=0;constructor(e){this.host=e}enable(){this.#e=requestAnimationFrame(()=>{this.#e=0,L().dismissStack.push(this.host)})}disable(){this.#e&&=(cancelAnimationFrame(this.#e),0),L().dismissStack.remove(this.host)}destroy(){this.#e&&=(cancelAnimationFrame(this.#e),0),L().dismissStack.remove(this.host)}},Ne=class{host;constructor(e){this.host=e}toast(e){return L().toastManager.toast(this.host,e)}dismissToast(e){L().toastManager.dismiss(e)}dismissAllToasts(){L().toastManager.dismissAll()}destroy(){}},G=class{host;#e;#t=null;#n=null;constructor(e){this.host=e,this.#e=new W(e)}wirePopover(e,t){this.#t=e,this.#n=t;let n=j(`anchor`);e.style.setProperty(`anchor-name`,`--${n}`),t.style.setProperty(`position-anchor`,`--${n}`)}syncPopover(e){if(e){try{this.#n?.showPopover()}catch{}this.#e.enable()}else{try{this.#n?.hidePopover()}catch{}this.#e.disable()}}destroy(){this.#e.destroy(),this.#t?.style.removeProperty(`anchor-name`),this.#t=null,this.#n?.style.removeProperty(`position-anchor`),this.#n=null}},K=class{host;listValue=v(null);itemSelector;ariaAttr;autoSync;onChildSelect;#e;#t=!1;constructor(e,t={}){if(this.host=e,this.itemSelector=t.itemSelector??`:scope > [role]`,this.ariaAttr=t.ariaAttr??`aria-selected`,this.autoSync=t.autoSync??!0,this.onChildSelect=t.onChildSelect??(t=>{this.listValue.value=t.value,e.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,cancelable:!0,detail:t}))}),this.#e=new U(e,{selector:this.itemSelector,orientation:t.orientation??`vertical`,wrap:t.wrap??!0,disabled:t.disabled??!1}),this.attach(),this.autoSync&&t.addEffect&&t.deferChildren){let n=t.addEffect;t.deferChildren(()=>{n(()=>{let t=this.listValue.value,n=e.querySelectorAll(this.itemSelector),r=this.ariaAttr===`aria-current`;for(let e of n){let n=e.getAttribute(`value`)??e.value;if(n!==void 0){let i=n===t;r?i?e.setAttribute(`aria-current`,`page`):e.removeAttribute(`aria-current`):e.setAttribute(this.ariaAttr,i?`true`:`false`)}}})})}}attach(){this.#t||(this.#t=!0,this.host.addEventListener(`ui-select`,this.#n))}detach(){this.#t&&(this.#t=!1,this.host.removeEventListener(`ui-select`,this.#n))}destroy(){this.detach(),this.#e.destroy()}get rovingFocus(){return this.#e}#n=e=>{if(this.host.disabled===!0)return;let t=e.detail;this.onChildSelect(t)}},q=class{host;#e=null;#t;constructor(e,t={}){this.host=e,this.#t=t.contentTarget,this.#a()}get open(){return this.#e?.open??!1}showModal(){!this.#e||this.open||(this.#e.showModal(),this.host.toggleAttribute(`open`,!0),queueMicrotask(()=>{let e=this.#e?.querySelector(`[autofocus]`);if(e){e.focus();return}(this.#e?.querySelector(`ui-input, ui-textarea, ui-button, ui-select, ui-listbox, input, textarea, select, button, [tabindex]:not([tabindex="-1"])`))?.focus()}))}close(){!this.#e||!this.open||(this.#e.close(),this.host.toggleAttribute(`open`,!1),this.host.dispatchEvent(new Event(`close`)))}destroy(){this.#e&&(this.#e.removeEventListener(`cancel`,this.#n),this.#e.removeEventListener(`click`,this.#r)),this.host.removeEventListener(`ui-dismiss`,this.#i),this.#e=null}#n=e=>{e.preventDefault(),this.host.hasAttribute(`no-close-on-escape`)||this.close()};#r=e=>{e.target===this.#e&&!this.host.hasAttribute(`no-close-on-backdrop`)&&this.close()};#i=()=>{this.host.hasAttribute(`no-close-on-escape`)||this.close()};#a(){let e=document.createElement(`dialog`),t=this.#t?this.#t(e):e;for(;this.host.firstChild;)t.appendChild(this.host.firstChild);t!==e&&e.appendChild(t),this.host.appendChild(e),this.#e=e,e.addEventListener(`cancel`,this.#n),e.addEventListener(`click`,this.#r),this.host.addEventListener(`ui-dismiss`,this.#i)}};let Pe={name:`pressable`,create(e,t){return new H(e,{disabled:t.disabled===`true`})},destroy(e){e.destroy()}},Fe={name:`hoverable`,create(e,t){return new we(e,{delay:t.delay?Number(t.delay):void 0,leaveDelay:t[`leave-delay`]?Number(t[`leave-delay`]):void 0,disabled:t.disabled===`true`})},destroy(e){e.destroy()},update(e,t){if(`delay`in t){let n=t.delay,r=Number(n);n!==``&&!isNaN(r)&&(e.delay=r)}if(`leave-delay`in t){let n=t[`leave-delay`],r=Number(n);n!==``&&!isNaN(r)&&(e.leaveDelay=r)}`disabled`in t&&(e.disabled=t.disabled===`true`)}},Ie={name:`copyable`,create(e,t){return new Te(e,{value:t.value??``,feedbackDuration:t[`feedback-duration`]?Number(t[`feedback-duration`]):void 0})},destroy(e){e.destroy()},update(e,t){if(`value`in t&&(e.value=t.value),`feedback-duration`in t){let n=t[`feedback-duration`],r=Number(n);n!==``&&!isNaN(r)&&(e.feedbackDuration=r)}}},Le={name:`intersectable`,create(e,t){return new Ee(e,{threshold:t.threshold?Number(t.threshold):void 0,root:t.root??null,margin:t.margin??void 0,once:t.once===`true`,disabled:t.disabled===`true`})},destroy(e){e.destroy()},update(e,t){if(`threshold`in t||`margin`in t||`root`in t){if(e.detach(),`threshold`in t){let n=t.threshold,r=Number(n);n!==``&&!isNaN(r)&&(e.threshold=r)}`margin`in t&&(e.margin=t.margin??e.margin),`root`in t&&(e.root=t.root??e.root),e.disabled||e.attach();return}`disabled`in t&&(e.disabled=t.disabled===`true`,e.disabled?e.detach():e.attach()),`once`in t&&(e.once=t.once===`true`)}},Re={name:`droppable`,create(e,t){return new De(e,{accept:t.accept??void 0,disabled:t.disabled===`true`,multiple:t.multiple!==`false`})},destroy(e){e.destroy()},update(e,t){`accept`in t&&(e.accept=t.accept),`disabled`in t&&(e.disabled=t.disabled===`true`),`multiple`in t&&(e.multiple=t.multiple!==`false`)}},ze={name:`sortable`,create(e,t){return new Oe(e,{selector:t.selector??``,disabled:t.disabled===`true`})},destroy(e){e.destroy()},update(e,t){`selector`in t&&(e.selector=t.selector??``),`disabled`in t&&(e.disabled=t.disabled===`true`)}},Be={name:`validatable`,create(e){return new ke(e)},destroy(e){e.destroy()}},Ve={name:`focus-trappable`,create(e){return new je(e)},destroy(e){e.destroy()}},He={name:`collapsible`,create(e,t){return new Me(e,{duration:t.duration?Number(t.duration):void 0})},destroy(e){e.destroy()},update(e,t){if(`duration`in t){let n=t.duration,r=Number(n);n!==``&&!isNaN(r)&&(e.duration=r)}}},Ue={name:`roving-focusable`,create(e,t){return new U(e,{selector:t.selector??void 0,orientation:t.orientation??void 0,wrap:t.wrap!==`false`,disabled:t.disabled===`true`})},destroy(e){e.destroy()},update(e,t){`selector`in t&&(e.selector=t.selector),`orientation`in t&&(e.orientation=t.orientation),`wrap`in t&&(e.wrap=t.wrap!==`false`),`disabled`in t&&(e.disabled=t.disabled===`true`)}},We={name:`dismissable`,create(e){return new W(e)},destroy(e){e.destroy()}},Ge={name:`toastable`,create(e){return new Ne(e)},destroy(e){e.destroy()}},Ke={name:`popoverable`,create(e){return new G(e)},destroy(e){e.destroy()}},qe={name:`list-navigable`,create(e,t){return new K(e,{itemSelector:t[`item-selector`]??void 0,ariaAttr:t[`aria-attr`]??void 0,autoSync:t[`auto-sync`]!==`false`,orientation:t.orientation??void 0,wrap:t.wrap!==`false`,disabled:t.disabled===`true`})},destroy(e){e.destroy()}},J={name:`dialogable`,create(e){return new q(e)},destroy(e){e.destroy()}},Je={name:`draggable`,create(e,t){return new V(e,{selector:t.selector??``,dropZoneSelector:t[`drop-zone-selector`]??``,axis:t.axis??`both`,mode:t.mode??`drop`,disabled:t.disabled===`true`,animate:t.animate!==`false`})},destroy(e){e.destroy()},update(e,t){`selector`in t&&(e.selector=t.selector),`drop-zone-selector`in t&&(e.dropZoneSelector=t[`drop-zone-selector`]),`axis`in t&&(e.axis=t.axis),`mode`in t&&(e.mode=t.mode),`disabled`in t&&(e.disabled=t.disabled===`true`),`animate`in t&&(e.animate=t.animate!==`false`)}},Ye={name:`range-selectable`,create(e,t){return new ge(e,{selector:t.selector??``,mode:t.mode??`drag`,disabled:t.disabled===`true`})},destroy(e){e.destroy()},update(e,t){`selector`in t&&(e.selector=t.selector),`mode`in t&&(e.mode=t.mode),`disabled`in t&&(e.disabled=t.disabled===`true`)}},Xe={name:`resizable`,create(e,t){return new _e(e,{handleSelector:t[`handle-selector`]??``,axis:t.axis??`horizontal`,min:t.min?Number(t.min):void 0,max:t.max?Number(t.max):void 0,disabled:t.disabled===`true`,reverse:t.reverse===`true`})},destroy(e){e.destroy()},update(e,t){if(`axis`in t&&(e.axis=t.axis),`min`in t){let n=t.min,r=Number(n);n!==``&&!isNaN(r)&&(e.min=r)}if(`max`in t){let n=t.max,r=Number(n);n!==``&&!isNaN(r)&&(e.max=r)}`disabled`in t&&(e.disabled=t.disabled===`true`),`reverse`in t&&(e.reverse=t.reverse===`true`)}},Ze={name:`virtualizable`,create(e,t){return new ve(e,{itemHeight:t[`item-height`]?Number(t[`item-height`]):void 0,overscan:t.overscan?Number(t.overscan):void 0})},destroy(e){e.destroy()},update(e,t){if(`item-height`in t){let n=t[`item-height`],r=Number(n);n!==``&&!isNaN(r)&&(e.itemHeight=r)}if(`overscan`in t){let n=t.overscan,r=Number(n);n!==``&&!isNaN(r)&&(e.overscan=r)}}},Qe={name:`selectable`,create(e,t){return new ye(e,{selector:t.selector??``,mode:t.mode??`multiple`,disabled:t.disabled===`true`})},destroy(e){e.destroy()},update(e,t){`selector`in t&&(e.selector=t.selector),`mode`in t&&(e.mode=t.mode),`disabled`in t&&(e.disabled=t.disabled===`true`)}},$e={name:`searchable`,create(e,t){return new be(e,{selector:t.selector??``,textField:t[`text-field`]??void 0,disabled:t.disabled===`true`})},destroy(e){e.destroy()},update(e,t){`selector`in t&&(e.selector=t.selector),`text-field`in t&&(e.textField=t[`text-field`]??`textContent`),`disabled`in t&&(e.disabled=t.disabled===`true`)}},et={name:`clippable`,create(e,t){return new Ce(e,{selector:t.selector??``,disabled:t.disabled===`true`})},destroy(e){e.destroy()},update(e,t){`selector`in t&&(e.selector=t.selector),`disabled`in t&&(e.disabled=t.disabled===`true`)}},tt={name:`swipeable`,create(e,t){return new xe(e,{threshold:t.threshold?Number(t.threshold):void 0,velocityThreshold:t[`velocity-threshold`]?Number(t[`velocity-threshold`]):void 0,axis:t.axis??void 0,disabled:t.disabled===`true`})},destroy(e){e.destroy()},update(e,t){if(`threshold`in t){let n=t.threshold,r=Number(n);n!==``&&!isNaN(r)&&(e.threshold=r)}if(`velocity-threshold`in t){let n=t[`velocity-threshold`],r=Number(n);n!==``&&!isNaN(r)&&(e.velocityThreshold=r)}`axis`in t&&(e.axis=t.axis),`disabled`in t&&(e.disabled=t.disabled===`true`)}},nt={name:`editable`,create(e,t){return new Se(e,{trigger:t.trigger??void 0,disabled:t.disabled===`true`})},destroy(e){e.destroy()},update(e,t){`trigger`in t&&(e.trigger=t.trigger),`disabled`in t&&(e.disabled=t.disabled===`true`)}};function rt(){T(Pe),T(Fe),T(Ie),T(Le),T(Re),T(ze),T(Be),T(Ve),T(He),T(Ue),T(We),T(Ge),T(Ke),T(qe),T(J),T(Je),T(Ye),T(Xe),T(Ze),T(Qe),T($e),T(et),T(tt),T(nt)}var it=class extends I(A){static observedAttributes=[`disabled`,`type`];#e;#t;#n;#r;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`button`,this.#t=N(this,`disabled`,{type:`boolean`}),this.#n=N(this,`type`,{type:`string`,initial:`button`})}get disabled(){return this.#t.value}set disabled(e){this.#t.set(e)}get type(){return this.#n.value}set type(e){this.#n.set(e)}attributeChangedCallback(e,t,n){t!==n&&(P({disabled:this.#t,type:this.#n},e,n),super.attributeChangedCallback?.(e,t,n))}setup(){super.setup(),this.#r=new H(this,{disabled:()=>this.disabled}),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this.addEffect(M(this,this.#t.signal,this.#e,{manageTabindex:!0})),this.addEventListener(`ui-press`,this.#i)}teardown(){this.removeEventListener(`ui-press`,this.#i),this.#r.destroy(),super.teardown()}#i=()=>{if(this.#t.value)return;let e=this.#e.form;if(!e)return;let t=this.#n.value;t===`submit`?e.requestSubmit():t===`reset`&&e.reset()};onFormDisabled(e){this.#t.signal.value=e}onFormReset(){this.#t.signal.value=this.hasAttribute(`disabled`)}},at=class extends I(A){static observedAttributes=[`value`,`placeholder`,`disabled`,`readonly`,`required`,`pattern`];#e;#t=v(!1);#n=v(!1);#r=v(``);#i=``;#a=null;#o=[];constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`textbox`}get value(){return this.#s()}set value(e){this.#c(e),this.#r.value=e,this.#e.setFormValue(e),this.#l()}#s(){let e=``;for(let t of this.childNodes)t.nodeType===Node.TEXT_NODE&&(e+=t.textContent);return e}#c(e){for(let e of[...this.childNodes])e.nodeType===Node.TEXT_NODE&&e.remove();e&&this.append(e)}get placeholder(){return this.getAttribute(`placeholder`)??``}set placeholder(e){this.setAttribute(`placeholder`,e)}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get disabled(){return this.#t.value}set disabled(e){this.#t.value=e,this.toggleAttribute(`disabled`,e)}get readOnly(){return this.hasAttribute(`readonly`)}set readOnly(e){this.toggleAttribute(`readonly`,e),this.setAttribute(`contenteditable`,e?`false`:`plaintext-only`)}get required(){return this.#n.value}set required(e){this.#n.value=e,this.toggleAttribute(`required`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`value`:this.#c(n??``),this.#r.value=n??``,this.#e.setFormValue(n??``),this.#l();break;case`disabled`:this.#t.value=n!==null,this.setAttribute(`contenteditable`,n!==null||this.hasAttribute(`readonly`)?`false`:`plaintext-only`);break;case`readonly`:this.setAttribute(`contenteditable`,n!==null||this.#t.value?`false`:`plaintext-only`);break;case`required`:this.#n.value=n!==null;break;case`pattern`:this.#a=n;break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.hasAttribute(`contenteditable`)||this.setAttribute(`contenteditable`,`plaintext-only`),this.#o=[...this.querySelectorAll(`:scope > [slot]`)];for(let e of this.#o)e.setAttribute(`contenteditable`,`false`);this.#n.value=this.hasAttribute(`required`),this.#a=this.getAttribute(`pattern`),this.#i=this.getAttribute(`value`)??this.#s(),this.#r.value=this.#s(),this.#l(),this.addEffect(M(this,this.#t,this.#e,{manageTabindex:!0})),this.addEffect(()=>{let e=this.#r.value;this.#n.value&&e===``?this.#e.setValidity({valueMissing:!0},`Please fill out this field.`,this):this.#a!==null&&e!==``&&!RegExp(`^(?:${this.#a})$`).test(e)?this.#e.setValidity({patternMismatch:!0},`Please match the requested format.`,this):this.#e.setValidity({})}),this.addEventListener(`input`,this.#u),this.addEventListener(`blur`,this.#d)}teardown(){this.removeEventListener(`input`,this.#u),this.removeEventListener(`blur`,this.#d),super.teardown()}select(){let e=document.createRange();e.selectNodeContents(this);let t=window.getSelection();t?.removeAllRanges(),t?.addRange(e)}onFormDisabled(e){this.#t.value=e,this.setAttribute(`contenteditable`,e||this.hasAttribute(`readonly`)?`false`:`plaintext-only`)}onFormReset(){this.#c(this.#i),this.#r.value=this.#i,this.#e.setFormValue(this.#i),this.#l(),this.#t.value=this.hasAttribute(`disabled`),this.setAttribute(`contenteditable`,this.#t.value||this.hasAttribute(`readonly`)?`false`:`plaintext-only`)}onFormStateRestore(e){this.value=typeof e==`string`?e:``}#l(){this.#s().trim()===``?this.#e.states.add(`empty`):this.#e.states.delete(`empty`)}#u=()=>{for(let e of this.#o)e.parentNode||this.appendChild(e);let e=this.#s();this.#r.value=e,this.#e.setFormValue(e),this.#l(),this.dispatchEvent(new CustomEvent(`ui-input`,{bubbles:!0,composed:!0,detail:{value:e}}))};#d=()=>{this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:{value:this.#s()}}))}},ot=class extends A{static observedAttributes=[`disabled`,`multiple`,`virtual-focus`];#e;#t;#n=v(!1);#r=new R;#i;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`listbox`,this.#t=N(this,`disabled`,{type:`boolean`})}get virtualFocus(){return this.hasAttribute(`virtual-focus`)}set virtualFocus(e){this.toggleAttribute(`virtual-focus`,e)}get disabled(){return this.#t.value}set disabled(e){this.#t.set(e)}get multiple(){return this.#n.value}set multiple(e){this.#n.value=e,this.#r.multiple=e,this.toggleAttribute(`multiple`,e)}get value(){return this.#r.value.value}get controller(){return this.#r}get listValue(){return this.#i.listValue}attributeChangedCallback(e,t,n){if(t!==n){if(P({disabled:this.#t},e,n)){super.attributeChangedCallback?.(e,t,n);return}switch(e){case`multiple`:this.#n.value=n!==null,this.#r.multiple=n!==null;break;case`virtual-focus`:this.#i&&(this.#i.rovingFocus.disabled=n!==null);break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.#i=new K(this,{itemSelector:`:scope ui-option:not([disabled])`,autoSync:!1,orientation:`vertical`,disabled:this.virtualFocus,onChildSelect:e=>{this.#n.value?this.#r.toggle(e.value):this.#r.select(e.value),this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,cancelable:!0,detail:e}))},addEffect:e=>this.addEffect(e),deferChildren:e=>this.deferChildren(e)}),this.addEffect(M(this,this.#t.signal,this.#e)),this.deferChildren(()=>{this.addEffect(()=>{let e=this.#r.value.value,t=this.#r.selected.value,n=this.#n.value,r=this.querySelectorAll(`:scope ui-option`);for(let i of r){let r=i.getAttribute(`value`)??``,a=n?t.has(r):r===e;i.setAttribute(`aria-selected`,a?`true`:`false`)}}),this.addEffect(()=>{let e=this.#r.activeIndex.value,t=this.querySelectorAll(`:scope ui-option:not([disabled])`);for(let n=0;n<t.length;n++){let r=t[n],i=n===e;r.toggleAttribute(`active`,i),i&&(r.id||=j(`opt`),this.setAttribute(`aria-activedescendant`,r.id))}(e<0||e>=t.length)&&this.removeAttribute(`aria-activedescendant`)})})}teardown(){this.#i.destroy(),super.teardown()}getActiveOption(){let e=this.#r.activeIndex.value;return this.querySelectorAll(`:scope ui-option:not([disabled])`)[e]??null}},st=class extends A{static observedAttributes=[`value`,`disabled`,`label`];#e;#t=v(``);#n;#r=v(``);constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`option`,this.#n=N(this,`disabled`,{type:`boolean`})}get value(){return this.#t.value}set value(e){this.#t.value=e,this.getAttribute(`value`)!==e&&this.setAttribute(`value`,e)}get disabled(){return this.#n.value}set disabled(e){this.#n.set(e)}get label(){return this.#r.value||this.textContent?.trim()||``}set label(e){this.#r.value=e,e?this.getAttribute(`label`)!==e&&this.setAttribute(`label`,e):this.removeAttribute(`label`)}attributeChangedCallback(e,t,n){if(t!==n){if(P({disabled:this.#n},e,n)){super.attributeChangedCallback?.(e,t,n);return}switch(e){case`value`:this.#t.value=n??``;break;case`label`:this.#r.value=n??``;break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.addEffect(M(this,this.#n.signal,this.#e)),this.addEventListener(`click`,this.#i)}teardown(){this.removeEventListener(`click`,this.#i),super.teardown()}#i=()=>{this.disabled||this.dispatchEvent(new CustomEvent(`ui-select`,{bubbles:!0,composed:!0,detail:{value:this.#t.value,label:this.label}}))}},ct=class extends A{constructor(){super();let e=this.attachInternals();e.role=`presentation`}setup(){super.setup(),this.id||=j(`ogh`);let e=this.closest(`ui-option-group`);e&&e.setAttribute(`aria-labelledby`,this.id)}},lt=class extends A{constructor(){super();let e=this.attachInternals();e.role=`group`}},ut=class extends A{static observedAttributes=[`disabled`];#e;#t=new R({initialActiveIndex:0});#n=v(!1);constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`search`}get store(){return this.#t}get disabled(){return this.#n.value}set disabled(e){this.#n.value=e,this.toggleAttribute(`disabled`,e)}attributeChangedCallback(e,t,n){t!==n&&(e===`disabled`&&(this.#n.value=n!==null),super.attributeChangedCallback?.(e,t,n))}setup(){super.setup(),this.addEffect(M(this,this.#n,this.#e)),this.addEventListener(`ui-input`,this.#i),this.addEventListener(`ui-select`,this.#a),this.addEventListener(`keydown`,this.#o),this.deferChildren(()=>{this.addEffect(()=>{let e=this.#t.query.value.toLowerCase().trim(),t=this.querySelectorAll(`ui-command-item`);for(let n of t){let t=!e||n.searchText.includes(e);n.toggleAttribute(`hidden`,!t)}}),this.addEffect(()=>{this.#t.query.value;let e=this.#t.activeIndex.value,t=this.#r(),n=this.querySelector(`ui-command-list`);for(let n=0;n<t.length;n++)t[n].toggleAttribute(`active`,n===e);let r=t[e];r&&n?(r.id||=j(`cmd`),n.setAttribute(`aria-activedescendant`,r.id),r.scrollIntoView({block:`nearest`})):n?.removeAttribute(`aria-activedescendant`)}),this.addEffect(()=>{this.#t.query.value;let e=this.#r(),t=this.querySelector(`ui-command-empty`);t&&t.toggleAttribute(`hidden`,e.length>0)})})}teardown(){this.removeEventListener(`ui-input`,this.#i),this.removeEventListener(`ui-select`,this.#a),this.removeEventListener(`keydown`,this.#o),super.teardown()}#r(){return[...this.querySelectorAll(`ui-command-item:not([hidden]):not([disabled])`)]}#i=e=>{if(this.#n.value)return;let t=e.detail;this.#t.setQuery(t.value,0)};#a=e=>{if(this.#n.value)return;let t=e.detail;this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:t}))};#o=e=>{if(this.#n.value)return;let t=this.#r();if(!(t.length===0&&e.key!==`Escape`))switch(e.key){case`ArrowDown`:e.preventDefault(),this.#t.moveActive(1,t.length);break;case`ArrowUp`:e.preventDefault(),this.#t.moveActive(-1,t.length);break;case`Home`:e.preventDefault(),this.#t.activeIndex.value=0;break;case`End`:e.preventDefault(),this.#t.activeIndex.value=Math.max(0,t.length-1);break;case`Enter`:{e.preventDefault();let n=t[this.#t.activeIndex.value];n&&n.click();break}case`Escape`:this.dispatchEvent(new CustomEvent(`ui-dismiss`,{bubbles:!0,composed:!0}));break}}},dt=class extends A{#e=null;setup(){super.setup(),this.deferChildren(()=>{this.#e=this.querySelector(`input`),this.#e&&this.#e.addEventListener(`input`,this.#t)})}teardown(){this.#e&&this.#e.removeEventListener(`input`,this.#t),this.#e=null,super.teardown()}get inputElement(){return this.#e}focus(e){this.#e?.focus(e)}clear(){this.#e&&(this.#e.value=``,this.#t())}#t=()=>{let e=this.#e?.value??``;this.dispatchEvent(new CustomEvent(`ui-input`,{bubbles:!0,composed:!0,detail:{value:e}}))}},ft=class extends A{constructor(){super();let e=this.attachInternals();e.role=`listbox`}},pt=class extends A{static observedAttributes=[`value`,`disabled`,`keywords`];#e;#t=v(``);#n=v(!1);#r=v(``);constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`option`}get value(){return this.#t.value}set value(e){this.#t.value=e,this.getAttribute(`value`)!==e&&this.setAttribute(`value`,e)}get disabled(){return this.#n.value}set disabled(e){this.#n.value=e,this.toggleAttribute(`disabled`,e)}get keywords(){return this.#r.value}set keywords(e){this.#r.value=e,e?this.getAttribute(`keywords`)!==e&&this.setAttribute(`keywords`,e):this.removeAttribute(`keywords`)}get label(){return this.textContent?.trim()||``}get searchText(){return`${this.label} ${this.#t.value} ${this.#r.value}`.toLowerCase()}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`value`:this.#t.value=n??``;break;case`disabled`:this.#n.value=n!==null;break;case`keywords`:this.#r.value=n??``;break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.addEffect(M(this,this.#n,this.#e)),this.addEventListener(`click`,this.#i)}teardown(){this.removeEventListener(`click`,this.#i),super.teardown()}#i=()=>{this.#n.value||this.dispatchEvent(new CustomEvent(`ui-select`,{bubbles:!0,composed:!0,detail:{value:this.#t.value,label:this.label}}))}},mt=class extends A{constructor(){super();let e=this.attachInternals();e.role=`group`}setup(){super.setup();let e=this.querySelector(`[slot="heading"]`);e&&(e.id||=j(`cg`),this.setAttribute(`aria-labelledby`,e.id))}},ht=class extends A{},gt=class extends I(A){static observedAttributes=[`checked`,`indeterminate`,`disabled`,`name`,`value`,`required`];#e;#t;#n;#r;#i=v(!1);#a=!1;#o;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`checkbox`,this.#t=N(this,`checked`,{type:`boolean`}),this.#n=N(this,`indeterminate`,{type:`boolean`}),this.#r=N(this,`disabled`,{type:`boolean`})}get checked(){return this.#t.value}set checked(e){this.#t.set(e)}get indeterminate(){return this.#n.value}set indeterminate(e){this.#n.set(e)}get disabled(){return this.#r.value}set disabled(e){this.#r.set(e)}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get value(){return this.getAttribute(`value`)??`on`}set value(e){this.setAttribute(`value`,e)}get required(){return this.#i.value}set required(e){this.#i.value=e,this.toggleAttribute(`required`,e)}attributeChangedCallback(e,t,n){if(t!==n){if(P({checked:this.#t,indeterminate:this.#n,disabled:this.#r},e,n)){super.attributeChangedCallback?.(e,t,n);return}e===`required`&&(this.#i.value=n!==null),super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.#o=new H(this,{disabled:()=>this.disabled}),this.#a=this.hasAttribute(`checked`),this.#i.value=this.hasAttribute(`required`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this.addEffect(M(this,this.#r.signal,this.#e,{manageTabindex:!0})),this.addEffect(()=>{let e=this.#t.value,t=this.#n.value?`mixed`:e?`true`:`false`;this.setAttribute(`aria-checked`,t),this.#e.setFormValue(e?this.value:null)}),this.addEffect(()=>{this.#i.value?this.setAttribute(`aria-required`,`true`):this.removeAttribute(`aria-required`)}),this.addEffect(()=>{this.#i.value&&!this.#t.value?this.#e.setValidity({valueMissing:!0},`Please check this box if you want to proceed.`,this):this.#e.setValidity({})}),this.addEventListener(`ui-press`,this.#s)}teardown(){this.removeEventListener(`ui-press`,this.#s),this.#o.destroy(),super.teardown()}onFormDisabled(e){this.#r.signal.value=e}onFormReset(){this.#t.set(this.#a),this.#n.set(!1)}onFormStateRestore(e){this.checked=typeof e==`string`&&e===this.value}#s=()=>{this.#r.value||(this.#n.value?(this.indeterminate=!1,this.checked=!0):this.checked=!this.#t.value,this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:{checked:this.#t.value,value:this.value}})))}},_t=class extends I(A){static observedAttributes=[`checked`,`disabled`,`name`,`value`,`required`];#e;#t;#n;#r;#i=!1;#a;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`switch`,this.#t=N(this,`checked`,{type:`boolean`}),this.#n=N(this,`disabled`,{type:`boolean`}),this.#r=N(this,`required`,{type:`boolean`})}get checked(){return this.#t.value}set checked(e){this.#t.set(e)}get disabled(){return this.#n.value}set disabled(e){this.#n.set(e)}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get value(){return this.getAttribute(`value`)??`on`}set value(e){this.setAttribute(`value`,e)}get required(){return this.#r.value}set required(e){this.#r.set(e)}attributeChangedCallback(e,t,n){t!==n&&(P({checked:this.#t,disabled:this.#n,required:this.#r},e,n),super.attributeChangedCallback?.(e,t,n))}setup(){super.setup(),this.#a=new H(this,{disabled:()=>this.disabled}),this.#i=this.hasAttribute(`checked`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this.addEffect(M(this,this.#n.signal,this.#e,{manageTabindex:!0})),this.addEffect(()=>{let e=this.#t.value;this.setAttribute(`aria-checked`,e?`true`:`false`),this.#e.setFormValue(e?this.value:null)}),this.addEffect(()=>{this.#r.value&&!this.#t.value?this.#e.setValidity({valueMissing:!0},`Please toggle this switch.`,this):this.#e.setValidity({})}),this.addEventListener(`ui-press`,this.#o)}teardown(){this.removeEventListener(`ui-press`,this.#o),this.#a.destroy(),super.teardown()}onFormDisabled(e){this.#n.signal.value=e}onFormReset(){this.#t.set(this.#i)}onFormStateRestore(e){this.checked=typeof e==`string`&&e===this.value}#o=()=>{this.#n.value||(this.checked=!this.#t.value,this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:{checked:this.#t.value,value:this.value}})))}},vt=class extends A{static observedAttributes=[`disabled`];#e;#t;#n;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`radio`,this.#t=N(this,`disabled`,{type:`boolean`})}get value(){return this.getAttribute(`value`)??``}set value(e){this.setAttribute(`value`,e)}get disabled(){return this.#t.value}set disabled(e){this.#t.set(e)}get label(){return this.getAttribute(`label`)??this.textContent?.trim()??``}attributeChangedCallback(e,t,n){t!==n&&(P({disabled:this.#t},e,n),super.attributeChangedCallback?.(e,t,n))}setup(){super.setup(),this.setAttribute(`aria-checked`,`false`),this.#n=new H(this,{disabled:()=>this.disabled}),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`-1`),this.addEffect(M(this,this.#t.signal,this.#e)),this.addEventListener(`click`,this.#r),this.addEventListener(`keydown`,this.#i)}teardown(){this.removeEventListener(`click`,this.#r),this.removeEventListener(`keydown`,this.#i),this.#n.destroy(),super.teardown()}#r=()=>{this.disabled||this.dispatchEvent(new CustomEvent(`ui-select`,{bubbles:!0,composed:!0,detail:{value:this.value,label:this.label}}))};#i=e=>{e.key!==`Enter`&&e.key!==` `||this.disabled||(e.preventDefault(),this.dispatchEvent(new CustomEvent(`ui-select`,{bubbles:!0,composed:!0,detail:{value:this.value,label:this.label}})))}},yt=class extends I(A){static observedAttributes=[`value`,`disabled`,`name`,`required`,`orientation`];#e;#t=v(!1);#n=v(!1);#r=null;#i;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`radiogroup`}get value(){return this.#i?.listValue.value??null}set value(e){this.#i&&(this.#i.listValue.value=e),e===null?this.removeAttribute(`value`):this.setAttribute(`value`,e)}get disabled(){return this.#t.value}set disabled(e){this.#t.value=e,this.toggleAttribute(`disabled`,e)}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get required(){return this.#n.value}set required(e){this.#n.value=e,this.toggleAttribute(`required`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`value`:this.#i&&(this.#i.listValue.value=n);break;case`disabled`:this.#t.value=n!==null;break;case`required`:this.#n.value=n!==null;break;case`orientation`:this.#i&&(this.#i.rovingFocus.orientation=n??`vertical`);break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.#r=this.getAttribute(`value`),this.#n.value=this.hasAttribute(`required`),this.#i=new K(this,{itemSelector:`:scope ui-radio:not([disabled])`,ariaAttr:`aria-checked`,orientation:`vertical`,onChildSelect:e=>{this.#i.listValue.value=e.value,this.setAttribute(`value`,e.value),this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:e}))},addEffect:e=>this.addEffect(e),deferChildren:e=>this.deferChildren(e)});let e=this.getAttribute(`value`);e!==null&&(this.#i.listValue.value=e),this.addEffect(M(this,this.#t,this.#e)),this.addEffect(()=>{let e=this.#t.value,t=this.querySelectorAll(`ui-radio`);for(let n of t)n.toggleAttribute(`disabled`,e)}),this.addEffect(()=>{this.#n.value?this.setAttribute(`aria-required`,`true`):this.removeAttribute(`aria-required`)}),this.addEffect(()=>{let e=this.#i.listValue.value;this.#e.setFormValue(e)}),this.addEffect(()=>{let e=this.#i.listValue.value;this.#n.value&&(e===null||e===``)?this.#e.setValidity({valueMissing:!0},`Please select one of these options.`,this):this.#e.setValidity({})})}teardown(){this.#i.destroy(),super.teardown()}onFormDisabled(e){this.#t.value=e}onFormReset(){this.#i&&(this.#i.listValue.value=this.#r),this.#r===null?this.removeAttribute(`value`):this.setAttribute(`value`,this.#r)}onFormStateRestore(e){typeof e==`string`&&e&&(this.value=e)}},bt=class extends I(A){static observedAttributes=[`value`,`disabled`,`name`,`required`];#e;#t=v(!1);#n=v(!1);#r=null;#i;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`radiogroup`}get value(){return this.#i?.listValue.value??null}set value(e){this.#i&&(this.#i.listValue.value=e),e===null?this.removeAttribute(`value`):this.setAttribute(`value`,e)}get disabled(){return this.#t.value}set disabled(e){this.#t.value=e,this.toggleAttribute(`disabled`,e)}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get required(){return this.#n.value}set required(e){this.#n.value=e,this.toggleAttribute(`required`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`value`:this.#i&&(this.#i.listValue.value=n);break;case`disabled`:this.#t.value=n!==null;break;case`required`:this.#n.value=n!==null;break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.#r=this.getAttribute(`value`),this.#i=new K(this,{itemSelector:`:scope > ui-segment:not([disabled])`,ariaAttr:`aria-checked`,orientation:`horizontal`,onChildSelect:e=>{this.#i.listValue.value=e.value,this.setAttribute(`value`,e.value),this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:e}))},addEffect:e=>this.addEffect(e),deferChildren:e=>this.deferChildren(e)});let e=this.getAttribute(`value`);e!==null&&(this.#i.listValue.value=e),this.addEffect(M(this,this.#t,this.#e)),this.#n.value=this.hasAttribute(`required`),this.addEffect(()=>{let e=this.#i.listValue.value;this.#n.value&&(e===null||e===``)?this.#e.setValidity({valueMissing:!0},`Please select one of these options.`,this):this.#e.setValidity({})}),this.addEffect(()=>{let e=this.#i.listValue.value;this.#e.setFormValue(e)}),this.deferChildren(()=>{this.addEffect(()=>{let e=this.#i.listValue.value,t=this.querySelectorAll(`:scope > ui-segment`),n=-1,r=0;for(let i of t)(i.getAttribute(`value`)??``)===e&&(n=r),r++;this.#a(n,r)})})}teardown(){this.#i.destroy(),super.teardown()}onFormDisabled(e){this.#t.value=e}onFormReset(){this.#i&&(this.#i.listValue.value=this.#r),this.#r===null?this.removeAttribute(`value`):this.setAttribute(`value`,this.#r)}onFormStateRestore(e){typeof e==`string`&&e&&(this.value=e)}#a(e,t){if(e<0){this.#e.states.delete(`ready`);return}this.style.setProperty(`--_indicator-index`,`${e}`),this.style.setProperty(`--_segment-count`,`${t}`),this.#e.states.add(`ready`)}},xt=class extends A{static observedAttributes=[`disabled`];#e;#t;#n;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`radio`,this.#t=N(this,`disabled`,{type:`boolean`}),this.setAttribute(`aria-checked`,`false`)}get value(){return this.getAttribute(`value`)??``}set value(e){this.setAttribute(`value`,e)}get disabled(){return this.#t.value}set disabled(e){this.#t.set(e)}get label(){return this.getAttribute(`label`)??this.textContent?.trim()??``}attributeChangedCallback(e,t,n){t!==n&&(P({disabled:this.#t},e,n),super.attributeChangedCallback?.(e,t,n))}setup(){super.setup(),this.#n=new H(this,{disabled:()=>this.disabled}),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`-1`),this.addEffect(M(this,this.#t.signal,this.#e)),this.addEventListener(`ui-press`,this.#r)}teardown(){this.removeEventListener(`ui-press`,this.#r),this.#n.destroy(),super.teardown()}#r=()=>{this.#t.value||this.dispatchEvent(new CustomEvent(`ui-select`,{bubbles:!0,composed:!0,detail:{value:this.value,label:this.label}}))}},St=class extends A{static observedAttributes=[`placement`,`delay`,`disabled`];#e;#t=v(!1);#n=v(!1);#r=null;#i=null;#a=``;constructor(){super(),this.#e=this.attachInternals()}get disabled(){return this.#n.value}set disabled(e){this.#n.value=e,this.toggleAttribute(`disabled`,e)}get placement(){return this.getAttribute(`placement`)??`top`}set placement(e){this.setAttribute(`placement`,e)}get delay(){return Number(this.getAttribute(`delay`)??500)}set delay(e){this.setAttribute(`delay`,String(e))}attributeChangedCallback(e,t,n){t!==n&&(e===`disabled`&&(this.#n.value=n!==null),super.attributeChangedCallback?.(e,t,n))}setup(){super.setup(),this.addEffect(M(this,this.#n,this.#e)),this.#i=this.parentElement,this.#i&&(this.#a=j(`tip`),this.#i.style.setProperty(`anchor-name`,`--${this.#a}`),this.style.setProperty(`position-anchor`,`--${this.#a}`),this.hasAttribute(`popover`)||this.setAttribute(`popover`,`manual`),this.id||=j(`tooltip`),this.#i.setAttribute(`aria-describedby`,this.id),this.#i.addEventListener(`mouseenter`,this.#o),this.#i.addEventListener(`mouseleave`,this.#s),this.#i.addEventListener(`focusin`,this.#o),this.#i.addEventListener(`focusout`,this.#s),this.#i.addEventListener(`keydown`,this.#c),this.addEffect(()=>{this.#n.value&&this.#t.value&&(this.#l(),this.#t.value=!1)}),this.addEffect(()=>{if(this.#t.value)try{this.showPopover()}catch{}else try{this.hidePopover()}catch{}}))}teardown(){this.#l(),this.#i&&=(this.#i.removeEventListener(`mouseenter`,this.#o),this.#i.removeEventListener(`mouseleave`,this.#s),this.#i.removeEventListener(`focusin`,this.#o),this.#i.removeEventListener(`focusout`,this.#s),this.#i.removeEventListener(`keydown`,this.#c),this.#i.removeAttribute(`aria-describedby`),this.#i.style.removeProperty(`anchor-name`),null),super.teardown()}#o=()=>{this.#n.value||(this.#l(),this.#r=setTimeout(()=>{this.#t.value=!0},this.delay))};#s=()=>{this.#l(),this.#t.value=!1};#c=e=>{e.key===`Escape`&&this.#t.value&&(this.#t.value=!1)};#l(){this.#r!==null&&(clearTimeout(this.#r),this.#r=null)}},Ct=class extends A{static observedAttributes=[`multiple`,`disabled`];#e=v(!1);get multiple(){return this.hasAttribute(`multiple`)}set multiple(e){this.toggleAttribute(`multiple`,e)}get disabled(){return this.#e.value}set disabled(e){this.#e.value=e,this.toggleAttribute(`disabled`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`disabled`:this.#e.value=n!==null;break;case`multiple`:if(n===null&&this.isConnected){let e=[...this.querySelectorAll(`:scope > ui-accordion-item[open]`)];for(let t=1;t<e.length;t++)e[t].open=!1}break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.addEffect(M(this,this.#e)),this.addEventListener(`toggle`,this.#t,!0)}teardown(){this.removeEventListener(`toggle`,this.#t,!0),super.teardown()}#t=e=>{if(this.multiple)return;let t=e.target;if(!t.open)return;let n=t.closest(`ui-accordion-item`);if(!n)return;let r=this.querySelectorAll(`:scope > ui-accordion-item[open]`);for(let e of r)e!==n&&(e.open=!1)}},wt=class extends A{static observedAttributes=[`open`,`disabled`];#e=v(!1);#t=v(!1);#n=null;get open(){return this.#e.value}set open(e){this.#e.value=e,this.toggleAttribute(`open`,e)}get disabled(){return this.#t.value}set disabled(e){this.#t.value=e,this.toggleAttribute(`disabled`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`open`:this.#e.value=n!==null;break;case`disabled`:this.#t.value=n!==null;break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup();let e=document.createElement(`details`),t=document.createElement(`summary`),n=this.querySelector(`:scope > [slot="heading"]`);n&&(n.removeAttribute(`slot`),t.appendChild(n));let r=document.createElement(`div`);for(r.setAttribute(`part`,`content`);this.firstChild;)r.appendChild(this.firstChild);e.appendChild(t),e.appendChild(r),this.appendChild(e),this.#n=e,this.addEffect(()=>{let e=this.#e.value;this.#n&&(this.#n.open=e)}),this.addEffect(M(this,this.#t)),e.addEventListener(`toggle`,this.#r)}teardown(){this.#n?.removeEventListener(`toggle`,this.#r),this.#n=null,super.teardown()}#r=()=>{if(!this.#n)return;let e=this.#n.open;this.#e.value=e,this.toggleAttribute(`open`,e)}},Tt=class extends A{#e;get open(){return this.#e.open}showModal(){this.#e.showModal()}close(){this.#e.close()}setup(){super.setup(),this.#e=new q(this)}teardown(){this.#e.destroy(),super.teardown()}},Et=class extends A{static observedAttributes=[`value`,`disabled`,`orientation`];#e;#t=v(!1);#n;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`tablist`}get value(){return this.#n?.listValue.value??null}set value(e){this.#n&&(this.#n.listValue.value=e),e===null?this.removeAttribute(`value`):this.setAttribute(`value`,e)}get disabled(){return this.#t.value}set disabled(e){this.#t.value=e,this.toggleAttribute(`disabled`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`value`:this.#n&&(this.#n.listValue.value=n);break;case`disabled`:this.#t.value=n!==null;break;case`orientation`:this.#n&&(this.#n.rovingFocus.orientation=n===`vertical`?`vertical`:`horizontal`);break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.#n=new K(this,{itemSelector:`:scope > ui-tab:not([disabled])`,orientation:`horizontal`,autoSync:!0,onChildSelect:e=>{this.#n.listValue.value=e.value,this.setAttribute(`value`,e.value),this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:e}))},addEffect:e=>this.addEffect(e),deferChildren:e=>this.deferChildren(e)});let e=this.getAttribute(`value`);e!==null&&(this.#n.listValue.value=e),this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,`Tabs`),this.addEffect(M(this,this.#t,this.#e)),this.addEffect(()=>{let e=this.#t.value,t=this.querySelectorAll(`:scope > ui-tab`);for(let n of t)n.toggleAttribute(`disabled`,e)}),this.deferChildren(()=>{this.#r(),this.addEffect(()=>{let e=this.#n.listValue.value,t=this.querySelectorAll(`:scope > ui-tab`),n=this.querySelectorAll(`:scope > ui-tab-panels > ui-tab-panel`),r=-1,i=0;for(let n of t)(n.getAttribute(`value`)??``)===e&&(r=i),i++;for(let t of n){let n=(t.getAttribute(`value`)??``)===e;t.toggleAttribute(`hidden`,!n),t.setAttribute(`tabindex`,n?`0`:`-1`)}this.#i(r,i)})})}teardown(){this.#n.destroy(),super.teardown()}#r(){let e=this.querySelectorAll(`:scope > ui-tab`),t=this.querySelectorAll(`:scope > ui-tab-panels > ui-tab-panel`),n=new Map;for(let e of t)e.id||=j(`tp`),n.set(e.getAttribute(`value`)??``,e);for(let t of e){t.id||=j(`tab`);let e=n.get(t.getAttribute(`value`)??``);e&&(t.setAttribute(`aria-controls`,e.id),e.setAttribute(`aria-labelledby`,t.id))}}#i(e,t){if(e<0){this.#e.states.delete(`ready`);return}this.style.setProperty(`--_indicator-index`,`${e}`),this.style.setProperty(`--_tab-count`,`${t}`),this.#e.states.add(`ready`)}},Dt=class extends A{static observedAttributes=[`disabled`];#e;#t;#n;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`tab`,this.#t=N(this,`disabled`,{type:`boolean`})}get value(){return this.getAttribute(`value`)??``}set value(e){this.setAttribute(`value`,e)}get disabled(){return this.#t.value}set disabled(e){this.#t.set(e)}get label(){return this.getAttribute(`label`)??this.textContent?.trim()??``}attributeChangedCallback(e,t,n){t!==n&&(P({disabled:this.#t},e,n),super.attributeChangedCallback?.(e,t,n))}setup(){super.setup(),this.#n=new H(this,{disabled:()=>this.disabled}),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`-1`),this.addEffect(M(this,this.#t.signal,this.#e)),this.addEventListener(`ui-press`,this.#r)}teardown(){this.removeEventListener(`ui-press`,this.#r),this.#n.destroy(),super.teardown()}#r=()=>{this.disabled||this.dispatchEvent(new CustomEvent(`ui-select`,{bubbles:!0,composed:!0,detail:{value:this.value,label:this.label}}))}},Ot=class extends A{static observedAttributes=[`value`];#e;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`tabpanel`}get value(){return this.getAttribute(`value`)??``}set value(e){this.setAttribute(`value`,e)}attributeChangedCallback(e,t,n){t!==n&&super.attributeChangedCallback?.(e,t,n)}},kt=class extends A{#e;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`presentation`}},Y=class{sortColumn;sortDirection;selected;columnWidths;constructor(e={}){this.sortColumn=v(e.sortColumn??null),this.sortDirection=v(e.sortDirection??`none`),this.selected=v(new Set),this.columnWidths=v([])}toggleSort(e){x(()=>{if(this.sortColumn.value===e){let e=this.sortDirection.value;this.sortDirection.value=e===`asc`?`desc`:e===`desc`?`none`:`asc`,this.sortDirection.value===`none`&&(this.sortColumn.value=null)}else this.sortColumn.value=e,this.sortDirection.value=`asc`})}select(e){let t=new Set(this.selected.value);t.add(e),this.selected.value=t}deselect(e){let t=new Set(this.selected.value);t.delete(e),this.selected.value=t}toggle(e){this.selected.value.has(e)?this.deselect(e):this.select(e)}selectAll(e){this.selected.value=new Set(e)}clearSelection(){this.selected.value=new Set}isSelected(e){return this.selected.value.has(e)}};function At(e={}){return new Y(e)}var jt=class{table;#e=[];#t=-1;#n=0;#r=0;#i=!1;#a;#o;constructor(e,t={}){this.table=e,this.#a=t.minWidth??48,this.#o=t.maxWidth??1/0}init(){this.table.addEventListener(`pointerdown`,this.#l)}destroy(){this.table.removeEventListener(`pointerdown`,this.#l),this.#m()}#s(){this.#e=getComputedStyle(this.table).gridTemplateColumns.split(/\s+/).map(e=>parseFloat(e))}#c(){this.table.style.gridTemplateColumns=this.#e.map(e=>`${e}px`).join(` `)}#l=e=>{if(e.button!==0)return;let t=e.target.closest?.(`.table-resize-handle`);if(!t||!this.table.contains(t))return;let n=t.closest(`ui-table-header`);if(!n)return;let r=n.closest(`ui-table-row`);if(!r)return;let i=[...r.querySelectorAll(`ui-table-header`)];this.#s();let a=i.indexOf(n);a===-1||a>=this.#e.length||(e.preventDefault(),e.stopPropagation(),this.table.style.width||(this.table.style.width=`${this.table.offsetWidth}px`),this.#i=!0,this.#t=a,this.#n=e.clientX,this.#r=this.#e[a],t.setPointerCapture(e.pointerId),this.table.setAttribute(`resizing`,``),document.addEventListener(`pointermove`,this.#u),document.addEventListener(`pointerup`,this.#d),document.addEventListener(`pointercancel`,this.#f),document.addEventListener(`keydown`,this.#p),this.table.dispatchEvent(new CustomEvent(`ui-table-resize-start`,{bubbles:!0,composed:!0,detail:{column:a,width:this.#r}})))};#u=e=>{if(!this.#i)return;let t=e.clientX-this.#n,n=Math.min(this.#o,Math.max(this.#a,this.#r+t));this.#e[this.#t]=n,this.#c(),this.table.dispatchEvent(new CustomEvent(`ui-table-resize`,{bubbles:!0,composed:!0,detail:{column:this.#t,width:n}}))};#d=e=>{this.#i&&(this.table.dispatchEvent(new CustomEvent(`ui-table-resize-end`,{bubbles:!0,composed:!0,detail:{column:this.#t,width:this.#e[this.#t],allWidths:[...this.#e]}})),this.#m())};#f=()=>{this.#i&&(this.#e[this.#t]=this.#r,this.#c(),this.#m())};#p=e=>{e.key===`Escape`&&this.#i&&(e.preventDefault(),this.#e[this.#t]=this.#r,this.#c(),this.#m())};#m(){this.#i=!1,this.#t=-1,this.table.removeAttribute(`resizing`),document.removeEventListener(`pointermove`,this.#u),document.removeEventListener(`pointerup`,this.#d),document.removeEventListener(`pointercancel`,this.#f),document.removeEventListener(`keydown`,this.#p)}},Mt=class{#e;#t;#n;#r=!1;constructor(e,t){this.#t=t,this.#n=e,this.#e=new V(e,{selector:`ui-table-row:not([colspan])`,axis:`vertical`,mode:`slot`}),e.addEventListener(`ui-drag-start`,this.#i),e.addEventListener(`ui-drop`,this.#a),e.addEventListener(`click`,this.#o,{capture:!0})}#i=e=>{this.#r=!0;let t=this.#n.querySelector(`:scope > [popover][aria-hidden="true"]`);t&&(t.style.gridTemplateColumns=getComputedStyle(this.#t).gridTemplateColumns,t.style.display=`grid`,t.style.alignItems=`center`)};#a=e=>{let t=e.detail,n=new CustomEvent(`ui-table-reorder`,{bubbles:!0,composed:!0,cancelable:!0,detail:{row:t.item,fromIndex:t.fromIndex,toIndex:t.toIndex}});this.#t.dispatchEvent(n)&&(t.insertBefore?this.#n.insertBefore(t.item,t.insertBefore):this.#n.appendChild(t.item))};#o=e=>{this.#r&&=(e.stopPropagation(),!1)};destroy(){this.#n.removeEventListener(`ui-drag-start`,this.#i),this.#n.removeEventListener(`ui-drop`,this.#a),this.#n.removeEventListener(`click`,this.#o,{capture:!0}),this.#e.destroy()}},Nt=class extends A{static observedAttributes=[`selectable`,`resizable`,`reorderable`];#e;#t=new Y;#n=null;#r=null;#i=null;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`table`}get store(){return this.#t}set store(e){this.#t=e}get selectable(){return this.hasAttribute(`selectable`)}set selectable(e){this.toggleAttribute(`selectable`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`resizable`:n!==null&&!this.#n?this.#a():n===null&&this.#n&&(this.#n.destroy(),this.#n=null);break;case`reorderable`:n!==null&&!this.#i?this.#s():n===null&&this.#i&&(this.#i.destroy(),this.#i=null);break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.addEventListener(`ui-sort`,this.#c),this.addEventListener(`ui-row-select`,this.#l),this.deferChildren(()=>{this.addEffect(()=>{let e=this.#t.sortColumn.value,t=this.#t.sortDirection.value,n=this.querySelectorAll(`ui-table-header[sortable]`);for(let r of n)r.column===e?(r.setAttribute(`sort`,t),r.setAttribute(`aria-sort`,t===`asc`?`ascending`:t===`desc`?`descending`:`none`)):(r.setAttribute(`sort`,`none`),r.removeAttribute(`aria-sort`))}),this.addEffect(()=>{let e=this.#t.selected.value,t=this.querySelectorAll(`ui-table-body ui-table-row`);for(let n of t){let t=e.has(n.value);n.toggleAttribute(`selected`,t),n.setAttribute(`aria-selected`,t?`true`:`false`)}}),this.addEffect(()=>{let e=this.#t.sortColumn.value,t=this.querySelectorAll(`ui-table-body ui-table-row[colspan]`);for(let n of t)n.toggleAttribute(`hidden`,e!==null)}),this.hasAttribute(`resizable`)&&this.#a(),this.hasAttribute(`sticky-header`)&&this.#o(),this.hasAttribute(`reorderable`)&&this.#s()})}teardown(){this.#n?.destroy(),this.#n=null,this.#r?.disconnect(),this.#r=null,this.#i?.destroy(),this.#i=null,this.removeEventListener(`ui-sort`,this.#c),this.removeEventListener(`ui-row-select`,this.#l),super.teardown()}#a(){let e=this.querySelectorAll(`ui-table-header`);for(let t of e){let e=document.createElement(`div`);e.className=`table-resize-handle`,e.setAttribute(`aria-hidden`,`true`),e.addEventListener(`click`,e=>e.stopPropagation()),t.appendChild(e)}this.#n=new jt(this),this.#n.init()}#o(){let e=this.querySelector(`:scope > ui-table-head > ui-table-row`);e&&(this.#r=new ResizeObserver(e=>{for(let t of e){let e=t.borderBoxSize?.[0]?.blockSize??t.target.getBoundingClientRect().height;this.style.setProperty(`--_header-height`,`${e}px`)}}),this.#r.observe(e))}#s(){let e=this.querySelector(`:scope > ui-table-body`);e&&(this.#i=new Mt(e,this))}#c=e=>{let t=e.detail;this.#t.toggleSort(t.column),this.dispatchEvent(new CustomEvent(`ui-table-sort`,{bubbles:!0,composed:!0,detail:{column:this.#t.sortColumn.value,direction:this.#t.sortDirection.value}}))};#l=e=>{if(!this.selectable)return;let t=e.detail;this.#t.toggle(t.value),this.dispatchEvent(new CustomEvent(`ui-table-select`,{bubbles:!0,composed:!0,detail:{value:t.value,selected:this.#t.isSelected(t.value),allSelected:[...this.#t.selected.value]}}))}},Pt=class extends A{#e;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`rowgroup`}},Ft=class extends A{#e;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`rowgroup`}},It=class extends A{static observedAttributes=[`value`,`selected`];#e;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`row`}get value(){return this.getAttribute(`value`)??``}set value(e){this.setAttribute(`value`,e)}get selected(){return this.hasAttribute(`selected`)}set selected(e){this.toggleAttribute(`selected`,e)}setup(){super.setup(),this.addEventListener(`click`,this.#t)}teardown(){this.removeEventListener(`click`,this.#t),super.teardown()}#t=()=>{this.hasAttribute(`colspan`)||this.closest(`ui-table`)?.hasAttribute(`selectable`)&&this.dispatchEvent(new CustomEvent(`ui-row-select`,{bubbles:!0,composed:!0,detail:{value:this.value}}))}},Lt=class extends A{#e;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`cell`}},Rt=class extends A{static observedAttributes=[`sort`,`sortable`];#e;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`columnheader`}get column(){return this.getAttribute(`column`)??``}get sortable(){return this.hasAttribute(`sortable`)}get sort(){return this.getAttribute(`sort`)??`none`}set sort(e){this.setAttribute(`sort`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`sortable`:n===null?(this.removeAttribute(`tabindex`),this.removeEventListener(`click`,this.#t),this.removeEventListener(`keydown`,this.#n)):(this.setAttribute(`tabindex`,`0`),this.addEventListener(`click`,this.#t),this.addEventListener(`keydown`,this.#n));break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.sortable&&(this.setAttribute(`tabindex`,`0`),this.addEventListener(`click`,this.#t),this.addEventListener(`keydown`,this.#n))}teardown(){this.removeEventListener(`click`,this.#t),this.removeEventListener(`keydown`,this.#n),super.teardown()}#t=()=>{this.sortable&&this.dispatchEvent(new CustomEvent(`ui-sort`,{bubbles:!0,composed:!0,detail:{column:this.column}}))};#n=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.#t())}};function X(e){if(!e)return null;let t=new Date(e+`T00:00:00`);return isNaN(t.getTime())?null:t}function zt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function Z(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}var Q=class{view;focusedYear;focusedMonth;value;rangeStart;rangeEnd;min;max;days;months;years;title;constructor(e={}){let t=new Date,n=X(e.value??null)??t;this.view=v(`day`),this.focusedYear=v(n.getFullYear()),this.focusedMonth=v(n.getMonth()),this.value=v(e.value??null),this.rangeStart=v(e.rangeStart??null),this.rangeEnd=v(e.rangeEnd??null),this.min=v(e.min??null),this.max=v(e.max??null),this.days=y(()=>this.#e()),this.months=y(()=>this.#t()),this.years=y(()=>this.#n()),this.title=y(()=>this.#r())}prevMonth(){x(()=>{this.focusedMonth.value===0?(this.focusedMonth.value=11,this.focusedYear.value--):this.focusedMonth.value--})}nextMonth(){x(()=>{this.focusedMonth.value===11?(this.focusedMonth.value=0,this.focusedYear.value++):this.focusedMonth.value++})}prevYear(){this.focusedYear.value--}nextYear(){this.focusedYear.value++}prevDecade(){this.focusedYear.value-=10}nextDecade(){this.focusedYear.value+=10}selectDate(e){this.value.value=e}selectMonth(e){x(()=>{this.focusedMonth.value=e,this.view.value=`day`})}selectYear(e){x(()=>{this.focusedYear.value=e,this.view.value=`month`})}setRange(e,t){x(()=>{this.rangeStart.value=e,this.rangeEnd.value=t})}isDateDisabled(e){let t=X(this.min.value),n=X(this.max.value),r=X(e);return!!(!r||t&&r<t||n&&r>n)}#e(){let e=this.focusedYear.value,t=this.focusedMonth.value,n=X(this.value.value),r=new Date,i=X(this.rangeStart.value),a=X(this.rangeEnd.value),o=new Date(e,t,1).getDay(),s=new Date(e,t,1-o),c=[];for(let e=0;e<42;e++){let o=new Date(s.getFullYear(),s.getMonth(),s.getDate()+e),l=zt(o),u=o.getMonth()===t,d=Z(o,r),f=n?Z(o,n):!1,p=this.isDateDisabled(l),m=!1,h=!1,g=!1;if(i&&a){let e=i<=a?i:a,t=i<=a?a:i;m=o>=e&&o<=t,h=Z(o,e),g=Z(o,t)}c.push({date:l,day:o.getDate(),inMonth:u,isToday:d,isSelected:f,isDisabled:p,inRange:m,isRangeStart:h,isRangeEnd:g})}return c}#t(){let e=this.focusedYear.value,t=this.focusedMonth.value;return[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`].map((n,r)=>({month:r,name:n,isCurrent:r===t&&e===new Date().getFullYear(),isSelected:r===t}))}#n(){let e=this.focusedYear.value,t=Math.floor(e/10)*10,n=new Date().getFullYear(),r=[];for(let i=t-1;i<=t+10;i++)r.push({year:i,inDecade:i>=t&&i<t+10,isCurrent:i===n,isSelected:i===e});return r}#r(){let e=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`];switch(this.view.value){case`day`:return`${e[this.focusedMonth.value]} ${this.focusedYear.value}`;case`month`:return`${this.focusedYear.value}`;case`year`:{let e=Math.floor(this.focusedYear.value/10)*10;return`${e}–${e+9}`}}}};function Bt(e={}){return new Q(e)}var Vt=class extends I(A){static observedAttributes=[`value`,`min`,`max`,`disabled`,`name`,`range`,`required`];#e;#t=new Q;#n=v(!1);#r=v(!1);#i=null;#a=v(0);#o=`idle`;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`group`}get store(){return this.#t}get value(){return this.#t.value.value}set value(e){this.#t.value.value=e,e?this.setAttribute(`value`,e):this.removeAttribute(`value`)}get disabled(){return this.#n.value}set disabled(e){this.#n.value=e,this.toggleAttribute(`disabled`,e)}get required(){return this.#r.value}set required(e){this.#r.value=e,this.toggleAttribute(`required`,e)}get range(){return this.hasAttribute(`range`)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`value`:this.#t.value.value=n;break;case`min`:this.#t.min.value=n;break;case`max`:this.#t.max.value=n;break;case`disabled`:this.#n.value=n!==null;break;case`required`:this.#r.value=n!==null;break;case`range`:this.#o=`idle`,this.#t.setRange(null,null);break;case`name`:break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this.#i=this.getAttribute(`value`);let e=this.getAttribute(`value`),t=this.getAttribute(`min`),n=this.getAttribute(`max`);x(()=>{e&&(this.#t.value.value=e),t&&(this.#t.min.value=t),n&&(this.#t.max.value=n)}),this.#s(),this.addEventListener(`keydown`,this.#b),this.addEffect(()=>this.#c()),this.addEffect(()=>{this.#e.setFormValue(this.#t.value.value)}),this.addEffect(()=>{this.setAttribute(`aria-label`,this.#t.title.value)}),this.addEffect(M(this,this.#n,this.#e,{manageTabindex:!0})),this.#r.value=this.hasAttribute(`required`),this.addEffect(()=>{let e=this.#t.value.value;this.#r.value&&(e===null||e===``)?this.#e.setValidity({valueMissing:!0},`Please select a date.`,this):this.#e.setValidity({})})}teardown(){this.querySelector(`.cal-prev`)?.removeEventListener(`click`,this.#l),this.querySelector(`.cal-next`)?.removeEventListener(`click`,this.#u),this.querySelector(`.cal-title`)?.removeEventListener(`click`,this.#d);let e=this.querySelector(`.cal-grid`);e?.removeEventListener(`click`,this.#f),e?.removeEventListener(`pointermove`,this.#p),this.removeEventListener(`keydown`,this.#b),super.teardown()}onFormDisabled(e){this.#n.value=e}onFormReset(){this.#t.value.value=this.#i,this.#i?this.setAttribute(`value`,this.#i):this.removeAttribute(`value`)}onFormStateRestore(e){typeof e==`string`&&e&&(this.value=e)}#s(){this.innerHTML=`
13
+ <div class="cal-header">
14
+ <button type="button" class="cal-prev" aria-label="Previous" tabindex="-1"></button>
15
+ <button type="button" class="cal-title" tabindex="-1"></button>
16
+ <button type="button" class="cal-next" aria-label="Next" tabindex="-1"></button>
17
+ </div>
18
+ <div class="cal-weekdays"></div>
19
+ <div class="cal-grid" role="grid"></div>
20
+ `;let e=this.querySelector(`.cal-prev`),t=this.querySelector(`.cal-next`),n=this.querySelector(`.cal-title`);e?.addEventListener(`click`,this.#l),t?.addEventListener(`click`,this.#u),n?.addEventListener(`click`,this.#d);let r=this.querySelector(`.cal-grid`);r?.addEventListener(`click`,this.#f),r?.addEventListener(`pointermove`,this.#p)}#c(){let e=this.#t.view.value,t=this.querySelector(`.cal-title`),n=this.querySelector(`.cal-weekdays`),r=this.querySelector(`.cal-grid`);!t||!n||!r||(t.textContent=this.#t.title.value,e===`day`?(this.setAttribute(`view`,`day`),n.innerHTML=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`].map(e=>`<span class="cal-weekday">${e}</span>`).join(``),r.innerHTML=this.#t.days.value.map((e,t)=>{let n=`class="cal-cell" data-date="${e.date}" data-index="${t}" tabindex="-1"`;return e.inMonth||(n+=` data-outside`),e.isToday&&(n+=` data-today`),e.isSelected&&(n+=` data-selected`),e.isDisabled&&(n+=` disabled`),e.inRange&&(n+=` data-in-range`),e.isRangeStart&&(n+=` data-range-start`),e.isRangeEnd&&(n+=` data-range-end`),`<button type="button" ${n}>${e.day}</button>`}).join(``)):e===`month`?(this.setAttribute(`view`,`month`),n.innerHTML=``,r.innerHTML=this.#t.months.value.map(e=>{let t=`class="cal-cell" data-month="${e.month}" tabindex="-1"`;return e.isCurrent&&(t+=` data-today`),e.isSelected&&(t+=` data-selected`),`<button type="button" ${t}>${e.name}</button>`}).join(``)):(this.setAttribute(`view`,`year`),n.innerHTML=``,r.innerHTML=this.#t.years.value.map(e=>{let t=`class="cal-cell" data-year="${e.year}" tabindex="-1"`;return e.inDecade||(t+=` data-outside`),e.isCurrent&&(t+=` data-today`),e.isSelected&&(t+=` data-selected`),`<button type="button" ${t}>${e.year}</button>`}).join(``)))}#l=()=>{this.#m()};#u=()=>{this.#h()};#d=()=>{this.#g()};#f=e=>{this.#_(e)};#p=e=>{this.#y(e)};#m(){let e=this.#t.view.value;e===`day`?this.#t.prevMonth():e===`month`?this.#t.prevYear():this.#t.prevDecade()}#h(){let e=this.#t.view.value;e===`day`?this.#t.nextMonth():e===`month`?this.#t.nextYear():this.#t.nextDecade()}#g(){let e=this.#t.view.value;e===`day`?this.#t.view.value=`month`:e===`month`&&(this.#t.view.value=`year`)}#_(e){if(this.#n.value)return;let t=e.target.closest(`.cal-cell`);if(!t||t.hasAttribute(`disabled`))return;let n=t.dataset.date,r=t.dataset.month,i=t.dataset.year;n?this.#v(n):r===void 0?i!==void 0&&this.#t.selectYear(Number(i)):this.#t.selectMonth(Number(r))}#v(e){if(this.range)if(this.#o===`idle`)x(()=>{this.#t.selectDate(e),this.#t.setRange(e,null)}),this.setAttribute(`value`,e),this.#o=`selecting`;else if(this.#o===`selecting`){let t=this.#t.rangeStart.value;if(!t)return;this.#t.setRange(t,e),this.#o=`committed`,this.dispatchEvent(new CustomEvent(`ui-range-select`,{bubbles:!0,composed:!0,detail:{start:this.#t.rangeStart.value,end:this.#t.rangeEnd.value}}))}else x(()=>{this.#t.value.value=null,this.#t.setRange(null,null)}),this.removeAttribute(`value`),this.#o=`idle`;else this.#t.selectDate(e),this.setAttribute(`value`,e),this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:{value:e}}))}#y(e){if(this.#n.value||!this.range||this.#o!==`selecting`)return;let t=e.target.closest(`.cal-cell`);if(!t||t.hasAttribute(`disabled`))return;let n=t.dataset.date;if(!n)return;let r=this.#t.rangeStart.value;r&&this.#t.setRange(r,n)}#b=e=>{if(this.#n.value||this.#t.view.value!==`day`)return;let t=this.#t.days.value,n=this.#a.value,r=!0;switch(e.key){case`ArrowRight`:n+=1;break;case`ArrowLeft`:--n;break;case`ArrowDown`:n+=7;break;case`ArrowUp`:n-=7;break;case`Home`:n-=n%7;break;case`End`:n=n-n%7+6;break;case`PageDown`:e.shiftKey?this.#t.nextYear():this.#t.nextMonth();break;case`PageUp`:e.shiftKey?this.#t.prevYear():this.#t.prevMonth();break;case`Enter`:case` `:{let e=t[n];e&&!e.isDisabled&&this.#v(e.date);break}default:r=!1}r&&(e.preventDefault(),n=Math.max(0,Math.min(41,n)),this.#a.value=n,n<0&&this.#t.prevMonth(),n>41&&this.#t.nextMonth())}},Ht=class{open=v(!1);value=v(null);label=v(``);toggle(){this.open.value=!this.open.value}show(){this.open.value=!0}hide(){this.open.value=!1}select(e,t){x(()=>{this.value.value=e,this.label.value=t,this.open.value=!1})}reset(){x(()=>{this.open.value=!1,this.value.value=null,this.label.value=``})}},Ut=class extends I(A){static observedAttributes=[`value`,`disabled`,`name`,`options`,`src`,`placeholder`,`required`];#e;#t=new Ht;#n=v(!1);#r=v(!1);#i;#a=v([]);#o=v(null);#s=v(``);#c=!1;#l=null;#u=null;#d=null;#f=null;#p=``;constructor(){super(),this.#e=this.attachInternals()}get controller(){return this.#t}get value(){return this.#t.value.value}set value(e){if(e===null){this.#t.reset();return}let t=this.querySelector(`ui-option[value="${CSS.escape(e)}"]`),n=t?.getAttribute(`label`)??t?.textContent?.trim()??e;this.#t.select(e,n)}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get disabled(){return this.#n.value}set disabled(e){this.#n.value=e,this.toggleAttribute(`disabled`,e)}get required(){return this.#r.value}set required(e){this.#r.value=e,this.toggleAttribute(`required`,e)}get options(){return this.#a.value}set options(e){this.#a.value=e,this.setAttribute(`options`,JSON.stringify(e))}get src(){return this.#o.value}set src(e){this.#o.value=e,e==null?this.removeAttribute(`src`):this.setAttribute(`src`,e)}get placeholder(){return this.#s.value}set placeholder(e){this.#s.value=e,e?this.setAttribute(`placeholder`,e):this.removeAttribute(`placeholder`)}#m(e){return z(e,`ui-select`)}async#h(e){this.#l=await B(e,this.#l,this.#a,`ui-select`)}#g(){let e=document.createElement(`ui-button`);e.setAttribute(`justify`,`spread`);let t=document.createElement(`span`);t.setAttribute(`slot`,`label`),t.textContent=this.#s.value||`\xA0`,e.appendChild(t);let n=document.createElement(`ui-icon`);n.setAttribute(`name`,`caret-up-down`),n.setAttribute(`slot`,`trailing`),e.appendChild(n);let r=document.createElement(`ui-listbox`);r.setAttribute(`popover`,`manual`),this.appendChild(e),this.appendChild(r)}#_(e){let t=this.#u;if(t){for(;t.firstChild;)t.removeChild(t.firstChild);for(let n of e){let e=document.createElement(`ui-option`);e.setAttribute(`value`,n.value),e.setAttribute(`label`,n.label),e.textContent=n.label,n.disabled&&e.setAttribute(`disabled`,``),t.appendChild(e)}}}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`value`:if(n!==null){let e=this.querySelector(`ui-option[value="${CSS.escape(n)}"]`),t=e?.getAttribute(`label`)??e?.textContent?.trim()??n;this.#t.select(n,t)}else this.#t.reset();break;case`disabled`:this.#n.value=n!==null;break;case`required`:this.#r.value=n!==null;break;case`options`:n?this.#a.value=this.#m(n):this.#a.value=[];break;case`src`:this.#o.value=n;break;case`placeholder`:this.#s.value=n??``;break}super.attributeChangedCallback?.(e,t,n)}}setup(){if(super.setup(),this.#i=new G(this),this.#c=this.hasAttribute(`options`)||this.hasAttribute(`src`),this.#c){let e=this.getAttribute(`options`);e&&(this.#a.value=this.#m(e)),this.#o.value=this.getAttribute(`src`),this.#s.value=this.getAttribute(`placeholder`)??``,this.#g()}let e=this.querySelector(`:scope > ui-button`);this.#d=e;let t=this.querySelector(`:scope > ui-listbox[popover]`);this.#u=t,t?.setAttribute(`popover`,`manual`),e&&t&&this.#i.wirePopover(e,t),e?.setAttribute(`aria-haspopup`,`listbox`),e&&t&&(t.id||=j(`lb`),e.setAttribute(`aria-controls`,t.id)),this.#c&&(this.addEffect(()=>{let e=this.#a.value;this.#_(e)}),this.addEffect(()=>{let e=this.#o.value;e&&this.#h(e)}),this.addEffect(()=>{let t=this.#s.value,n=this.#t.label.value,r=e?.querySelector(`[slot="label"]`);r&&!n&&(r.textContent=t||`\xA0`)})),this.deferChildren(()=>{let n=this.getAttribute(`value`);if(n){let e=this.querySelector(`ui-option[value="${CSS.escape(n)}"]`),t=e?.getAttribute(`label`)??e?.textContent?.trim()??n;this.#t.value.value=n,this.#t.label.value=t,this.#f=n,this.#p=t}this.addEffect(()=>{let t=this.#t.label.value,n=e?.querySelector(`[slot="label"]`);n&&(n.textContent=t||(this.#c?this.#s.value||`\xA0`:n.textContent??``))}),this.addEffect(()=>{let e=this.#t.value.value,n=t?.querySelectorAll(`ui-option`)??[];for(let t of n){let n=t.getAttribute(`value`)===e;t.setAttribute(`aria-selected`,String(n))}})}),this.addEffect(M(this,this.#n,this.#e)),this.addEffect(()=>{let t=this.#n.value;e&&e.toggleAttribute(`disabled`,t),t&&this.#t.open.peek()&&this.#t.hide()}),this.#r.value=this.hasAttribute(`required`),this.addEffect(()=>{let e=this.#t.value.value;this.#r.value&&(e===null||e===``)?this.#e.setValidity({valueMissing:!0},`Please select an option.`,this):this.#e.setValidity({})}),this.addEffect(()=>{let t=this.#t.open.value;this.#i.syncPopover(t),e?.setAttribute(`aria-expanded`,String(t))}),this.addEffect(()=>{let e=this.#t.value.value;this.#e.setFormValue(e??``),e==null?this.removeAttribute(`value`):this.setAttribute(`value`,e)}),e?.addEventListener(`ui-press`,this.#v),this.addEventListener(`ui-change`,this.#y),this.addEventListener(`ui-select`,this.#b),this.addEventListener(`ui-dismiss`,this.#x),e?.addEventListener(`keydown`,this.#S)}#v=()=>{this.#n.value||this.#t.toggle()};#y=e=>{e.target!==this&&e.stopImmediatePropagation()};#b=e=>{let t=e.detail;this.#t.select(t.value,t.label),this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:t}))};#x=()=>{this.#t.hide()};#S=e=>{if(this.#n.value)return;let t=this.#u;switch(e.key){case`ArrowDown`:case`ArrowUp`:{e.preventDefault();let n=t?.controller;if(this.#t.open.value||this.#t.show(),n){let r=t?.querySelectorAll(`:scope ui-option:not([disabled])`)?.length??0;n.moveActive(e.key===`ArrowDown`?1:-1,r)}break}case`Enter`:case` `:if(e.preventDefault(),this.#t.open.value){let e=t?.getActiveOption();e&&e.click()}else this.#t.toggle();break;case`Escape`:this.#t.open.value&&(e.preventDefault(),this.#t.hide());break;case`Home`:{e.preventDefault();let n=t?.controller;n&&(n.activeIndex.value=0);break}case`End`:{e.preventDefault();let n=t?.controller;if(n){let e=t?.querySelectorAll(`:scope ui-option:not([disabled])`);n.activeIndex.value=Math.max(0,(e?.length??1)-1)}break}}};teardown(){this.#d?.removeEventListener(`ui-press`,this.#v),this.#d?.removeEventListener(`keydown`,this.#S),this.removeEventListener(`ui-change`,this.#y),this.removeEventListener(`ui-select`,this.#b),this.removeEventListener(`ui-dismiss`,this.#x),this.#d=null,this.#l?.abort(),this.#l=null,this.#u=null,this.#i.destroy(),super.teardown()}onFormReset(){this.#f===null?this.#t.reset():this.#t.select(this.#f,this.#p)}onFormStateRestore(e){typeof e==`string`&&e&&(this.value=e)}onFormDisabled(e){this.#n.value=e}},Wt=class extends I(A){static observedAttributes=[`value`,`disabled`,`name`,`options`,`src`,`placeholder`,`required`];#e;#t=new R;#n=v(!1);#r=v(!1);#i=v(!1);#a;#o=j(`listbox`);#s=null;#c=v([]);#l=v(null);#u=v(``);#d=!1;#f=null;#p=null;#m=null;#h=``;constructor(){super(),this.#e=this.attachInternals()}get store(){return this.#t}get value(){return this.#t.value.value}set value(e){if(e===null){x(()=>{this.#t.clearSelection(),this.#t.query.value=``,this.#t.activeIndex.value=-1,this.#n.value=!1});return}this.#t.select(e)}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get disabled(){return this.#r.value}set disabled(e){this.#r.value=e,this.toggleAttribute(`disabled`,e)}get required(){return this.#i.value}set required(e){this.#i.value=e,this.toggleAttribute(`required`,e)}get options(){return this.#c.value}set options(e){this.#c.value=e,this.setAttribute(`options`,JSON.stringify(e))}get src(){return this.#l.value}set src(e){this.#l.value=e,e==null?this.removeAttribute(`src`):this.setAttribute(`src`,e)}get placeholder(){return this.#u.value}set placeholder(e){this.#u.value=e,e?this.setAttribute(`placeholder`,e):this.removeAttribute(`placeholder`)}#g(e){return z(e,`ui-combobox`)}async#_(e){this.#f=await B(e,this.#f,this.#c,`ui-combobox`)}#v(){let e=document.createElement(`ui-input`),t=this.#u.value;t&&e.setAttribute(`placeholder`,t);let n=this.getAttribute(`size`);n&&e.setAttribute(`size`,n);let r=document.createElement(`ui-listbox`);r.setAttribute(`popover`,`manual`),this.appendChild(e),this.appendChild(r)}#y(e){let t=this.#p;if(t){for(;t.firstChild;)t.removeChild(t.firstChild);for(let n of e){let e=document.createElement(`ui-option`);e.setAttribute(`value`,n.value),e.setAttribute(`label`,n.label),e.textContent=n.label,n.disabled&&e.setAttribute(`disabled`,``),t.appendChild(e)}this.#t.data.value=e}}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`value`:if(n!==null){let e=this.querySelector(`ui-option[value="${CSS.escape(n)}"]`),t=e?.getAttribute(`label`)??e?.textContent?.trim()??n;this.#t.select(n),this.#t.query.value=t,this.#s&&`value`in this.#s&&(this.#s.value=t)}else x(()=>{this.#t.clearSelection(),this.#t.query.value=``}),this.#s&&`value`in this.#s&&(this.#s.value=``);break;case`disabled`:this.#r.value=n!==null;break;case`required`:this.#i.value=n!==null;break;case`options`:n?this.#c.value=this.#g(n):this.#c.value=[];break;case`src`:this.#l.value=n;break;case`placeholder`:this.#u.value=n??``;break}super.attributeChangedCallback?.(e,t,n)}}setup(){if(super.setup(),this.#a=new G(this),this.#d=this.hasAttribute(`options`)||this.hasAttribute(`src`),this.#d){let e=this.getAttribute(`options`);e&&(this.#c.value=this.#g(e)),this.#l.value=this.getAttribute(`src`),this.#u.value=this.getAttribute(`placeholder`)??``,this.#v()}let e=this.querySelector(`:scope > ui-input`);this.#s=e;let t=this.querySelector(`:scope > ui-listbox[popover]`);this.#p=t,t?.setAttribute(`popover`,`manual`),t?.setAttribute(`virtual-focus`,``),e&&t&&(this.#a.wirePopover(e,t),t.id||=this.#o),e?.setAttribute(`role`,`combobox`),e?.setAttribute(`aria-autocomplete`,`list`),e?.setAttribute(`aria-controls`,t?.id??``),e?.setAttribute(`aria-expanded`,`false`),this.#d&&(this.addEffect(()=>{let e=this.#c.value;this.#y(e)}),this.addEffect(()=>{let e=this.#l.value;e&&this.#_(e)}),this.addEffect(()=>{let t=this.#u.value;e&&(t?e.setAttribute(`placeholder`,t):e.removeAttribute(`placeholder`))})),this.deferChildren(()=>{if(!this.#d){let e=t?.querySelectorAll(`ui-option`)??[];this.#t.data.value=[...e].map(e=>({value:e.getAttribute(`value`)??``,label:e.getAttribute(`label`)??e.textContent?.trim()??``}))}let n=this.getAttribute(`value`);if(n){let e=this.querySelector(`ui-option[value="${CSS.escape(n)}"]`),t=e?.getAttribute(`label`)??e?.textContent?.trim()??n;this.#t.value.value=n,this.#t.query.value=t,this.#m=n,this.#h=t}this.addEffect(()=>{let e=this.#t.view.value,n=new Set(e.map(e=>e.value)),r=t?.querySelectorAll(`ui-option`)??[];for(let e of r)e.toggleAttribute(`hidden`,!n.has(e.getAttribute(`value`)??``))}),this.addEffect(()=>{this.#t.view.value;let n=this.#t.activeIndex.value,r=[...t?.querySelectorAll(`ui-option:not([hidden]):not([disabled])`)??[]];for(let e=0;e<r.length;e++)r[e].toggleAttribute(`active`,e===n);let i=r[n];i?(i.scrollIntoView({block:`nearest`}),i.id||=j(`opt`),e?.setAttribute(`aria-activedescendant`,i.id)):e?.removeAttribute(`aria-activedescendant`)}),this.addEffect(()=>{let e=this.#t.value.value,n=t?.querySelectorAll(`ui-option`)??[];for(let t of n){let n=t.getAttribute(`value`)===e;t.setAttribute(`aria-selected`,String(n))}})}),this.addEffect(M(this,this.#r,this.#e)),this.addEffect(()=>{let t=this.#r.value;e&&e.toggleAttribute(`disabled`,t),t&&this.#n.peek()&&(this.#n.value=!1)}),this.#i.value=this.hasAttribute(`required`),this.addEffect(()=>{let e=this.#t.value.value;this.#i.value&&(e===null||e===``)?this.#e.setValidity({valueMissing:!0},`Please select an option.`,this):this.#e.setValidity({})}),this.addEffect(()=>{let t=this.#n.value;this.#a.syncPopover(t),e?.setAttribute(`aria-expanded`,String(t))}),this.addEffect(()=>{let e=this.#t.value.value;this.#e.setFormValue(e??``),e==null?this.removeAttribute(`value`):this.setAttribute(`value`,e)}),e?.addEventListener(`focus`,this.#b),this.addEventListener(`ui-input`,this.#x),this.addEventListener(`ui-change`,this.#S),this.addEventListener(`ui-select`,this.#C),this.addEventListener(`ui-dismiss`,this.#w),e?.addEventListener(`keydown`,this.#T)}#b=()=>{!this.#r.value&&!this.#n.value&&(this.#n.value=!0)};#x=e=>{this.#t.setQuery(e.detail.value),this.#n.value=!0};#S=e=>{e.target!==this&&e.stopImmediatePropagation()};#C=e=>{let t=e.detail;x(()=>{this.#t.select(t.value),this.#t.query.value=t.label,this.#t.activeIndex.value=-1,this.#n.value=!1});let n=this.#s;n&&`value`in n&&(n.value=t.label),this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:t}))};#w=()=>{this.#n.value=!1};#T=e=>{if(this.#r.value)return;let t=this.#s;switch(e.key){case`ArrowDown`:e.preventDefault(),this.#n.value||(this.#n.value=!0),this.#t.moveActive(1);break;case`ArrowUp`:e.preventDefault(),this.#n.value||(this.#n.value=!0),this.#t.moveActive(-1);break;case`Enter`:if(this.#n.value){e.preventDefault();let n=this.#t.activeItem.value;this.#t.selectActive(),n&&t&&`value`in t&&(this.#t.query.value=n.label,t.value=n.label),this.#t.activeIndex.value=-1,this.#n.value=!1}break;case`Escape`:this.#n.value&&(e.preventDefault(),this.#n.value=!1);break;case`Home`:this.#n.value&&(e.preventDefault(),this.#t.activeIndex.value=0);break;case`End`:if(this.#n.value){e.preventDefault();let t=this.#t.view.value.length;this.#t.activeIndex.value=Math.max(0,t-1)}break}};teardown(){this.#s?.removeEventListener(`focus`,this.#b),this.#s?.removeEventListener(`keydown`,this.#T),this.removeEventListener(`ui-input`,this.#x),this.removeEventListener(`ui-change`,this.#S),this.removeEventListener(`ui-select`,this.#C),this.removeEventListener(`ui-dismiss`,this.#w),this.#s=null,this.#p=null,this.#f?.abort(),this.#f=null,this.#a.destroy(),super.teardown()}onFormReset(){x(()=>{this.#m===null?(this.#t.clearSelection(),this.#t.query.value=``):(this.#t.select(this.#m),this.#t.query.value=this.#h),this.#t.activeIndex.value=-1,this.#n.value=!1});let e=this.querySelector(`:scope > ui-input`);e&&(e.value=this.#h)}onFormStateRestore(e){typeof e==`string`&&e&&(this.value=e)}onFormDisabled(e){this.#r.value=e}},Gt=class extends A{static observedAttributes=[`disabled`,`required`];#e=j(`field-label`);#t=j(`field-desc`);#n=j(`field-err`);#r=null;setup(){super.setup(),this.deferChildren(()=>{this.#i(),this.#a(),this.#o(),this.#s(),this.#c()}),this.addEventListener(`ui-invalid`,this.#l),this.addEventListener(`ui-valid`,this.#u)}teardown(){this.removeEventListener(`ui-invalid`,this.#l),this.removeEventListener(`ui-valid`,this.#u),super.teardown()}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`disabled`:this.#s();break;case`required`:this.#c();break}super.attributeChangedCallback(e,t,n)}}#i(){let e=this.querySelectorAll(`ui-input, ui-select, ui-combobox, ui-checkbox, ui-switch, ui-radio, ui-range, ui-textarea, ui-input-otp, input, select, textarea`);for(let t of e)if(!t.hasAttribute(`slot`)){this.#r=t;break}}#a(){let e=this.querySelector(`[slot="label"]`),t=this.querySelector(`[slot="description"]`),n=this.querySelector(`[slot="error"]`);e&&!e.id&&(e.id=this.#e),t&&!t.id&&(t.id=this.#t),n&&!n.id&&(n.id=this.#n)}#o(){if(!this.#r)return;let e=this.querySelector(`[slot="label"]`),t=this.querySelector(`[slot="description"]`);e&&this.#r.setAttribute(`aria-labelledby`,e.id),t&&this.#r.setAttribute(`aria-describedby`,t.id)}#s(){let e=this.hasAttribute(`disabled`);e?this.setAttribute(`aria-disabled`,`true`):this.removeAttribute(`aria-disabled`),this.#r&&(e?this.#r.setAttribute(`disabled`,``):this.#r.removeAttribute(`disabled`))}#c(){this.#r&&(this.hasAttribute(`required`)?this.#r.setAttribute(`required`,``):this.#r.removeAttribute(`required`))}#l=e=>{let t=e;this.setAttribute(`invalid`,``);let n=this.querySelector(`[slot="error"]`);n&&t.detail?.message&&(n.textContent=t.detail.message),this.#d(!0)};#u=()=>{this.removeAttribute(`invalid`),this.#d(!1)};#d(e){if(!this.#r)return;let t=this.querySelector(`[slot="description"]`),n=this.querySelector(`[slot="error"]`),r=[];t&&r.push(t.id),e&&n&&r.push(n.id),r.length?this.#r.setAttribute(`aria-describedby`,r.join(` `)):this.#r.removeAttribute(`aria-describedby`)}},Kt=class extends I(A){static observedAttributes=[`value`,`placeholder`,`disabled`,`readonly`,`required`,`rows`,`maxlength`,`autogrow`,`pattern`];#e;#t=v(!1);#n=v(!1);#r=v(NaN);#i=v(``);#a=``;#o=0;#s=null;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`textbox`,this.#e.ariaMultiLine=`true`}get value(){return this.textContent??``}set value(e){this.textContent=e,this.#i.value=e,this.#e.setFormValue(e),this.#c(),this.#l()}get placeholder(){return this.getAttribute(`placeholder`)??``}set placeholder(e){this.setAttribute(`placeholder`,e)}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get disabled(){return this.#t.value}set disabled(e){this.#t.value=e,this.toggleAttribute(`disabled`,e)}get readOnly(){return this.hasAttribute(`readonly`)}set readOnly(e){this.toggleAttribute(`readonly`,e),this.setAttribute(`contenteditable`,e?`false`:`plaintext-only`)}get required(){return this.#n.value}set required(e){this.#n.value=e,this.toggleAttribute(`required`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`value`:this.textContent=n??``,this.#i.value=n??``,this.#e.setFormValue(n??``),this.#c(),this.#l();break;case`disabled`:this.#t.value=n!==null,this.setAttribute(`contenteditable`,n!==null||this.hasAttribute(`readonly`)?`false`:`plaintext-only`);break;case`readonly`:this.setAttribute(`contenteditable`,n!==null||this.#t.value?`false`:`plaintext-only`);break;case`required`:this.#n.value=n!==null;break;case`maxlength`:this.#r.value=n===null?NaN:parseInt(n,10);break;case`autogrow`:this.#l();break;case`pattern`:this.#s=n;break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.setAttribute(`aria-multiline`,`true`),this.hasAttribute(`contenteditable`)||this.setAttribute(`contenteditable`,`plaintext-only`),this.#n.value=this.hasAttribute(`required`);let e=this.getAttribute(`maxlength`);this.#r.value=e===null?NaN:parseInt(e,10),this.#s=this.getAttribute(`pattern`),this.#a=this.getAttribute(`value`)??this.textContent??``,this.#i.value=this.textContent??``,this.#c(),this.#l(),this.addEffect(M(this,this.#t,this.#e,{manageTabindex:!0})),this.addEffect(()=>{let e=this.#i.value,t=this.#r.value;this.#n.value&&e===``?this.#e.setValidity({valueMissing:!0},`Please fill out this field.`,this):!isNaN(t)&&e.length>t?this.#e.setValidity({tooLong:!0},`Please shorten this text to ${t} characters or less.`,this):this.#s!==null&&e!==``&&!RegExp(`^(?:${this.#s})$`).test(e)?this.#e.setValidity({patternMismatch:!0},`Please match the requested format.`,this):this.#e.setValidity({})}),this.addEventListener(`input`,this.#u),this.addEventListener(`blur`,this.#d)}teardown(){cancelAnimationFrame(this.#o),this.removeEventListener(`input`,this.#u),this.removeEventListener(`blur`,this.#d),super.teardown()}onFormDisabled(e){this.#t.value=e,this.setAttribute(`contenteditable`,e||this.hasAttribute(`readonly`)?`false`:`plaintext-only`)}onFormReset(){this.textContent=this.#a,this.#i.value=this.#a,this.#e.setFormValue(this.#a),this.#c(),this.#l(),this.#t.value=this.hasAttribute(`disabled`),this.setAttribute(`contenteditable`,this.#t.value||this.hasAttribute(`readonly`)?`false`:`plaintext-only`)}onFormStateRestore(e){this.value=typeof e==`string`?e:``}#c(){(this.textContent??``).trim()===``?this.#e.states.add(`empty`):this.#e.states.delete(`empty`)}#l(){!this.hasAttribute(`autogrow`)||!this.isConnected||(this.style.setProperty(`--_autogrow-height`,`auto`),cancelAnimationFrame(this.#o),this.#o=requestAnimationFrame(()=>{this.style.setProperty(`--_autogrow-height`,`${this.scrollHeight}px`)}))}#u=()=>{let e=this.textContent??``;this.#i.value=e,this.#e.setFormValue(e),this.#c(),this.#l(),this.dispatchEvent(new CustomEvent(`ui-input`,{bubbles:!0,composed:!0,detail:{value:e}}))};#d=()=>{this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:{value:this.textContent??``}}))}},qt=class extends I(A){static observedAttributes=[`value`,`min`,`max`,`step`,`disabled`,`name`,`required`];#e;#t=v(!1);#n=v(!1);#r=v(50);#i=50;#a=v(0);#o=v(100);#s=v(1);#c=null;#l=!1;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`slider`}get value(){return this.#r.value}set value(e){this.#r.value=this.#u(e)}get min(){return this.#a.value}set min(e){this.#a.value=e,this.setAttribute(`min`,String(e))}get max(){return this.#o.value}set max(e){this.#o.value=e,this.setAttribute(`max`,String(e))}get step(){return this.#s.value}set step(e){this.#s.value=e,this.setAttribute(`step`,String(e))}get disabled(){return this.#t.value}set disabled(e){this.#t.value=e,this.toggleAttribute(`disabled`,e)}get required(){return this.#n.value}set required(e){this.#n.value=e,this.toggleAttribute(`required`,e)}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`value`:this.#r.value=this.#u(parseFloat(n??`50`)||50);break;case`min`:this.#a.value=parseFloat(n??`0`)||0;break;case`max`:this.#o.value=parseFloat(n??`100`)||100;break;case`step`:this.#s.value=parseFloat(n??`1`)||1;break;case`disabled`:this.#t.value=n!==null;break;case`required`:this.#n.value=n!==null;break}super.attributeChangedCallback(e,t,n)}}setup(){super.setup(),this.#i=this.#r.value,this.#c=document.createElement(`div`),this.#c.classList.add(`ui-range-thumb`),this.appendChild(this.#c),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this.addEffect(M(this,this.#t,this.#e,{manageTabindex:!0})),this.#n.value=this.hasAttribute(`required`),this.addEffect(()=>{let e=this.#r.value,t=this.#d();this.style.setProperty(`--_progress`,String(t)),this.setAttribute(`aria-valuenow`,String(e)),this.setAttribute(`aria-valuemin`,String(this.#a.value)),this.setAttribute(`aria-valuemax`,String(this.#o.value)),this.#e.setFormValue(String(e))}),this.addEventListener(`pointerdown`,this.#p),this.addEventListener(`keydown`,this.#_)}teardown(){this.removeEventListener(`pointerdown`,this.#p),this.removeEventListener(`keydown`,this.#_),this.#c&&=(this.#c.remove(),null),super.teardown()}onFormDisabled(e){this.#t.value=e}onFormReset(){this.#r.value=this.#i}onFormStateRestore(e){if(typeof e==`string`){let t=parseFloat(e);isNaN(t)||(this.value=t)}}#u(e){let t=this.#a.value,n=this.#o.value,r=this.#s.value,i=Math.round((e-t)/r)*r+t;return Math.min(n,Math.max(t,i))}#d(){let e=this.#o.value-this.#a.value;return e===0?0:(this.#r.value-this.#a.value)/e}#f(e){let t=this.getBoundingClientRect(),n=this.#c?.offsetWidth??0,r=n/2,i=t.width-n;if(i<=0)return this.#a.value;let a=e.clientX-t.left-r,o=Math.min(1,Math.max(0,a/i));return this.#a.value+o*(this.#o.value-this.#a.value)}#p=e=>{if(e.button!==0||this.#t.value)return;this.setPointerCapture(e.pointerId),this.#l=!0,this.toggleAttribute(`pressed`,!0);let t=this.#u(this.#f(e));this.#r.value=t,this.#v(),this.addEventListener(`pointermove`,this.#m),this.addEventListener(`pointerup`,this.#h),this.addEventListener(`pointercancel`,this.#g)};#m=e=>{if(!this.#l||this.#t.value)return;let t=this.#u(this.#f(e));t!==this.#r.value&&(this.#r.value=t,this.#v())};#h=()=>{this.#l=!1,this.removeAttribute(`pressed`),this.removeEventListener(`pointermove`,this.#m),this.removeEventListener(`pointerup`,this.#h),this.removeEventListener(`pointercancel`,this.#g),this.#y()};#g=()=>{this.#l=!1,this.removeAttribute(`pressed`),this.removeEventListener(`pointermove`,this.#m),this.removeEventListener(`pointerup`,this.#h),this.removeEventListener(`pointercancel`,this.#g)};#_=e=>{if(this.#t.value)return;let t=this.#s.value,n=t*10,r=this.#r.value;switch(e.key){case`ArrowRight`:case`ArrowUp`:r+=t;break;case`ArrowLeft`:case`ArrowDown`:r-=t;break;case`PageUp`:r+=n;break;case`PageDown`:r-=n;break;case`Home`:r=this.#a.value;break;case`End`:r=this.#o.value;break;default:return}e.preventDefault(),r=this.#u(r),r!==this.#r.value&&(this.#r.value=r,this.#v(),this.#y())};#v(){this.dispatchEvent(new CustomEvent(`ui-input`,{bubbles:!0,composed:!0,detail:{value:this.#r.value}}))}#y(){this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:{value:this.#r.value}}))}},Jt=class extends I(A){static observedAttributes=[`value`,`length`,`disabled`,`name`,`pattern`,`mask`,`required`];#e;#t=v(!1);#n;#r=[];#i=[];#a=6;#o=/[0-9]/;#s=null;#c=``;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`group`,this.#n=N(this,`disabled`,{type:`boolean`})}get value(){return this.#i.join(``)}set value(e){this.#i=e.split(``).slice(0,this.#a),this.#u(),this.#d()}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get disabled(){return this.#n.value}set disabled(e){this.#n.set(e)}get required(){return this.#t.value}set required(e){this.#t.value=e,this.toggleAttribute(`required`,e)}attributeChangedCallback(e,t,n){if(t!==n){if(P({disabled:this.#n},e,n)){super.attributeChangedCallback(e,t,n);return}switch(e){case`value`:this.value=n??``;break;case`length`:{let e=parseInt(n??`6`,10);!isNaN(e)&&e>=1&&e<=12&&(this.#a=e,this.isConnected&&this.#l());break}case`pattern`:try{this.#o=new RegExp(n??`[0-9]`)}catch{}break;case`mask`:this.#s=n,this.isConnected&&this.#u();break;case`required`:this.#t.value=n!==null,this.isConnected&&this.#d();break}super.attributeChangedCallback(e,t,n)}}setup(){super.setup();let e=this.getAttribute(`length`);if(e){let t=parseInt(e,10);!isNaN(t)&&t>=1&&t<=12&&(this.#a=t)}let t=this.getAttribute(`pattern`);if(t)try{this.#o=new RegExp(t)}catch{}this.#s=this.getAttribute(`mask`),this.#l(),this.addEffect(M(this,this.#n.signal,this.#e,{manageTabindex:!1})),this.addEffect(()=>{let e=this.#n.value;for(let t of this.#r)t.setAttribute(`contenteditable`,e?`false`:`plaintext-only`)}),this.#t.value=this.hasAttribute(`required`);let n=this.getAttribute(`value`);this.#c=n??``,n&&(this.value=n),this.addEventListener(`paste`,this.#g)}teardown(){for(let e of this.#r)e.removeEventListener(`input`,this.#p),e.removeEventListener(`keydown`,this.#m),e.removeEventListener(`focus`,this.#h);this.removeEventListener(`paste`,this.#g),super.teardown()}#l(){for(let e of this.#r)e.removeEventListener(`input`,this.#p),e.removeEventListener(`keydown`,this.#m),e.removeEventListener(`focus`,this.#h),e.remove();this.#r=[],this.#i=[];for(let e=0;e<this.#a;e++){let e=document.createElement(`div`);e.classList.add(`ui-otp-cell`),e.setAttribute(`data-empty`,``),e.setAttribute(`contenteditable`,`plaintext-only`),e.setAttribute(`inputmode`,`numeric`),e.addEventListener(`input`,this.#p),e.addEventListener(`keydown`,this.#m),e.addEventListener(`focus`,this.#h),this.appendChild(e),this.#r.push(e),this.#i.push(``)}}#u(){for(let e=0;e<this.#a;e++){let t=this.#r[e];if(!t)continue;let n=this.#i[e]??``;t.textContent=n?this.#s??n:``,n?t.removeAttribute(`data-empty`):t.setAttribute(`data-empty`,``)}}#d(){let e=this.value;this.#e.setFormValue(e),this.#t.value&&e.length===0?this.#e.setValidity({valueMissing:!0},`Please fill out this field.`,this):this.#t.value&&e.length<this.#a?this.#e.setValidity({tooShort:!0},`Please enter ${this.#a} characters.`,this):this.#e.setValidity({})}#f(e){let t=this.#r[e];if(t){t.focus();let e=window.getSelection();e&&(e.selectAllChildren(t),e.collapseToEnd())}}#p=e=>{if(this.disabled)return;let t=e.target,n=this.#r.indexOf(t);if(n===-1)return;let r=t.textContent??``;if(r.length>0){let e=r[r.length-1];if(this.#o.test(e))this.#i[n]=e,t.textContent=this.#s??e,t.removeAttribute(`data-empty`),this.#d(),this.#_(),n<this.#a-1&&this.#f(n+1),this.value.length===this.#a&&this.#v();else{let e=this.#i[n]||``;t.textContent=e?this.#s??e:``}}else this.#i[n]=``,t.setAttribute(`data-empty`,``),this.#d(),this.#_()};#m=e=>{if(this.disabled)return;let t=e.target,n=this.#r.indexOf(t);n!==-1&&(e.key===`Backspace`?(this.#i[n]?(this.#i[n]=``,t.textContent=``,t.setAttribute(`data-empty`,``),this.#d(),this.#_()):n>0&&this.#f(n-1),e.preventDefault()):e.key===`ArrowLeft`&&n>0?(this.#f(n-1),e.preventDefault()):e.key===`ArrowRight`&&n<this.#a-1?(this.#f(n+1),e.preventDefault()):e.key===`Delete`&&(this.#i[n]=``,t.textContent=``,t.setAttribute(`data-empty`,``),this.#d(),this.#_(),e.preventDefault()))};#h=e=>{let t=e.target,n=window.getSelection();n&&(n.selectAllChildren(t),n.collapseToEnd())};#g=e=>{if(this.disabled){e.preventDefault();return}e.preventDefault();let t=(e.clipboardData?.getData(`text`)??``).split(``).filter(e=>this.#o.test(e)).slice(0,this.#a);for(let e=0;e<this.#a;e++)this.#i[e]=t[e]??``;this.#u(),this.#d(),this.#_();let n=this.#i.findIndex(e=>!e);this.#f(n>=0?n:this.#a-1),t.length===this.#a&&this.#v()};onFormDisabled(e){this.#n.signal.value=e;for(let t of this.#r)t.setAttribute(`contenteditable`,e?`false`:`plaintext-only`)}onFormReset(){this.value=this.#c,this.#n.signal.value=this.hasAttribute(`disabled`)}onFormStateRestore(e){this.value=typeof e==`string`?e:``}#_(){this.dispatchEvent(new CustomEvent(`ui-input`,{bubbles:!0,composed:!0,detail:{value:this.value}}))}#v(){this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:{value:this.value}}))}},Yt=class extends A{static observedAttributes=[`src`,`name`,`alt`];#e;#t=null;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`img`}get src(){return this.getAttribute(`src`)??``}set src(e){this.setAttribute(`src`,e)}get name(){return this.getAttribute(`name`)??``}set name(e){this.setAttribute(`name`,e)}get alt(){return this.getAttribute(`alt`)??``}set alt(e){this.setAttribute(`alt`,e)}attributeChangedCallback(e,t,n){t!==n&&(this.isConnected&&this.#n(),super.attributeChangedCallback(e,t,n))}setup(){super.setup(),this.#n()}teardown(){this.#t&&=(this.#t.removeEventListener(`error`,this.#i),null),super.teardown()}#n(){this.textContent=``,this.#t=null;let e=this.getAttribute(`src`),t=this.getAttribute(`name`),n=this.getAttribute(`alt`)??t??``;this.#e.ariaLabel=n,this.setAttribute(`aria-label`,n),e?(this.#t=document.createElement(`img`),this.#t.src=e,this.#t.alt=n,this.#t.addEventListener(`error`,this.#i),this.appendChild(this.#t)):t?this.textContent=this.#r(t):this.textContent=`?`}#r(e){let t=e.trim().split(/\s+/);return t.length===0?`?`:t.length===1?t[0][0].toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}#i=()=>{this.#t&&=(this.#t.removeEventListener(`error`,this.#i),this.#t.remove(),null);let e=this.getAttribute(`name`);e?this.textContent=this.#r(e):this.textContent=`?`}},Xt=class extends A{static observedAttributes=[`max`];#e;#t=``;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`status`}attributeChangedCallback(e,t,n){t!==n&&(e===`max`&&this.isConnected&&this.#n(),super.attributeChangedCallback(e,t,n))}setup(){super.setup(),this.#t=this.textContent?.trim()??``,this.#n()}#n(){let e=this.getAttribute(`max`);if(!e)return;let t=parseInt(e,10);if(isNaN(t))return;let n=parseInt(this.#t,10);isNaN(n)||(n>t?this.textContent=`${t}+`:this.textContent=this.#t)}},Zt=class extends A{},Qt=class extends A{#e;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`navigation`}setup(){super.setup();let e=this.getAttribute(`aria-label`)??`Breadcrumb`;this.#e.ariaLabel=e,this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,e)}},$t=class extends A{static observedAttributes=[`href`,`current`];#e;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`link`}setup(){super.setup(),this.#t(),!this.hasAttribute(`current`)&&!this.hasAttribute(`tabindex`)&&this.setAttribute(`tabindex`,`0`),this.addEventListener(`click`,this.#n),this.addEventListener(`keydown`,this.#r)}teardown(){this.removeEventListener(`click`,this.#n),this.removeEventListener(`keydown`,this.#r),super.teardown()}attributeChangedCallback(e,t,n){t!==n&&(this.isConnected&&this.#t(),super.attributeChangedCallback(e,t,n))}#t(){this.hasAttribute(`current`)?(this.setAttribute(`aria-disabled`,`true`),this.setAttribute(`aria-current`,`page`),this.removeAttribute(`tabindex`)):(this.removeAttribute(`aria-disabled`),this.removeAttribute(`aria-current`),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`))}#n=()=>{if(this.hasAttribute(`current`))return;let e=this.getAttribute(`href`);e&&(window.location.href=e)};#r=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.#n())}},en=class extends A{static observedAttributes=[`total`,`value`,`siblings`,`boundaries`,`disabled`];#e;#t=v(1);#n=v(1);#r=v(1);#i=v(1);#a=v(!1);constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`navigation`}get total(){return this.#t.value}set total(e){this.#t.value=Math.max(1,e)}get value(){return this.#n.value}set value(e){this.#n.value=Math.min(Math.max(1,e),this.#t.value)}get siblings(){return this.#r.value}set siblings(e){this.#r.value=Math.max(0,e)}get boundaries(){return this.#i.value}set boundaries(e){this.#i.value=Math.max(0,e)}get disabled(){return this.#a.value}set disabled(e){this.#a.value=e,this.toggleAttribute(`disabled`,e)}attributeChangedCallback(e,t,n){if(t===n)return;let r=parseInt(n??``,10);switch(e){case`total`:this.#t.value=Math.max(1,isNaN(r)?1:r);break;case`value`:this.#n.value=Math.min(Math.max(1,isNaN(r)?1:r),this.#t.value);break;case`siblings`:this.#r.value=Math.max(0,isNaN(r)?1:r);break;case`boundaries`:this.#i.value=Math.max(0,isNaN(r)?1:r);break;case`disabled`:this.#a.value=n!==null;break}super.attributeChangedCallback(e,t,n)}setup(){super.setup();let e=this.getAttribute(`aria-label`)??`Pagination`;this.#e.ariaLabel=e,this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,e),this.addEffect(M(this,this.#a,this.#e)),this.addEffect(()=>{this.#l()}),this.addEffect(()=>{let e=this.#a.value,t=S(()=>this.#n.value),n=S(()=>this.#t.value);for(let r of this.querySelectorAll(`ui-button`)){let i=r.getAttribute(`aria-label`)??``;i===`Previous page`?r.toggleAttribute(`disabled`,e||t<=1):i===`Next page`?r.toggleAttribute(`disabled`,e||t>=n):r.toggleAttribute(`disabled`,e)}})}teardown(){this.textContent=``,super.teardown()}#o(){let e=this.#t.value,t=this.#n.value,n=this.#r.value,r=this.#i.value;if(e<=r*2+n*2+3)return Array.from({length:e},(e,t)=>t+1);let i=[];for(let e=1;e<=r;e++)i.push(e);let a=Math.max(r+1,t-n);a>r+1&&i.push(`ellipsis`);let o=Math.min(e-r,t+n);for(let e=a;e<=o;e++)i.includes(e)||i.push(e);o<e-r&&i.push(`ellipsis`);for(let t=e-r+1;t<=e;t++)i.includes(t)||i.push(t);return i}#s(e,t,n,r){let i=document.createElement(`ui-button`);return i.setAttribute(`variant`,`ghost`),i.setAttribute(`aria-label`,t),n&&i.setAttribute(`disabled`,``),i.textContent=e,i.addEventListener(`ui-press`,r),i}#c(e,t,n,r){let i=document.createElement(`ui-button`);i.setAttribute(`variant`,`ghost`),i.setAttribute(`aria-label`,t),n&&i.setAttribute(`disabled`,``);let a=document.createElement(`ui-icon`);return a.setAttribute(`name`,e),i.appendChild(a),i.addEventListener(`ui-press`,r),i}#l(){let e=this.#t.value,t=this.#n.value,n=S(()=>this.#a.value),r=this.#o();this.textContent=``,this.appendChild(this.#c(`caret-left`,`Previous page`,n||t<=1,()=>this.#u(t-1)));for(let e of r)if(e===`ellipsis`){let e=document.createElement(`span`);e.classList.add(`ui-pagination-ellipsis`),e.textContent=`…`,this.appendChild(e)}else{let r=this.#s(String(e),`Page ${e}`,n,()=>this.#u(e));e===t&&r.setAttribute(`aria-current`,`page`),this.appendChild(r)}this.appendChild(this.#c(`caret-right`,`Next page`,n||t>=e,()=>this.#u(t+1)))}#u(e){if(this.#a.value)return;let t=Math.min(Math.max(1,e),this.#t.value);t!==this.#n.value&&(this.#n.value=t,this.setAttribute(`value`,String(t)),this.dispatchEvent(new CustomEvent(`ui-change`,{bubbles:!0,composed:!0,detail:{value:t}})))}},tn=class extends A{#e;get open(){return this.#e.open}showModal(){this.#e.showModal()}close(){this.#e.close()}setup(){super.setup(),this.#e=new q(this,{contentTarget:()=>document.createElement(`ui-drawer-panel`)})}teardown(){this.#e.destroy(),super.teardown()}},nn=class extends A{static observedAttributes=[`disabled`];#e;#t=v(!1);#n;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`tree`}get disabled(){return this.#t.value}set disabled(e){this.#t.value=e,this.toggleAttribute(`disabled`,e)}attributeChangedCallback(e,t,n){t!==n&&(e===`disabled`&&(this.#t.value=n!==null),super.attributeChangedCallback?.(e,t,n))}setup(){super.setup(),this.#n=new U(this,{selector:`:scope ui-tree-item > [slot="label"]`,orientation:`vertical`});let e=this.getAttribute(`aria-label`)??`Tree`;this.#e.ariaLabel=e,this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,e),this.addEffect(M(this,this.#t,this.#e))}teardown(){this.#n.destroy(),super.teardown()}},rn=class extends A{static observedAttributes=[`expanded`,`selected`,`disabled`];#e;#t=null;#n=null;#r=v(!1);constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`treeitem`}get expanded(){return this.hasAttribute(`expanded`)}set expanded(e){this.toggleAttribute(`expanded`,e),this.isConnected&&this.#a()}get selected(){return this.hasAttribute(`selected`)}set selected(e){this.toggleAttribute(`selected`,e),this.isConnected&&this.#a()}get disabled(){return this.#r.value}set disabled(e){this.#r.value=e,this.toggleAttribute(`disabled`,e)}setup(){super.setup(),this.addEffect(M(this,this.#r,this.#e)),this.deferChildren(()=>{this.#i(),this.#a()}),this.addEventListener(`click`,this.#o),this.addEventListener(`keydown`,this.#s)}teardown(){this.removeEventListener(`click`,this.#o),this.removeEventListener(`keydown`,this.#s),super.teardown()}attributeChangedCallback(e,t,n){t!==n&&(e===`disabled`&&(this.#r.value=n!==null),this.isConnected&&this.#a(),super.attributeChangedCallback(e,t,n))}#i(){let e=this.querySelectorAll(`:scope > ui-tree-item`);if(e.length>0){this.setAttribute(`expandable`,``);let t=this.querySelector(`:scope > [slot="label"]`);t&&(this.#n=document.createElement(`ui-icon`),this.#n.setAttribute(`name`,this.hasAttribute(`expanded`)?`caret-down`:`caret-right`),this.#n.classList.add(`ui-tree-caret`),t.prepend(this.#n)),this.#t=document.createElement(`div`),this.#t.classList.add(`ui-tree-children`);for(let t of e)this.#t.appendChild(t);this.appendChild(this.#t)}let t=0,n=this.parentElement;for(;n;){if(n.tagName===`UI-TREE-ITEM`)t++;else if(!n.classList?.contains(`ui-tree-children`))break;n=n.parentElement}if(t>0){let e=this.querySelector(`:scope > [slot="label"]`);e instanceof HTMLElement&&e.style.setProperty(`--_tree-depth`,String(t))}let r=this.querySelector(`:scope > [slot="label"]`);r instanceof HTMLElement&&!r.hasAttribute(`tabindex`)&&r.setAttribute(`tabindex`,`-1`)}#a(){let e=this.hasAttribute(`expanded`),t=this.hasAttribute(`selected`);this.hasAttribute(`expandable`)?this.setAttribute(`aria-expanded`,String(e)):this.removeAttribute(`aria-expanded`),this.setAttribute(`aria-selected`,String(t)),this.#n&&this.#n.setAttribute(`name`,e?`caret-down`:`caret-right`)}#o=e=>{let t=e.target,n=this.querySelector(`:scope > [slot="label"]`);t!==n&&!n?.contains(t)||(e.stopPropagation(),!this.#r.value&&(this.hasAttribute(`expandable`)&&this.toggleAttribute(`expanded`),this.toggleAttribute(`selected`,!0)))};#s=e=>{if(e.target===this.querySelector(`:scope > [slot="label"]`)&&!this.#r.value)switch(e.key){case`ArrowRight`:if(this.hasAttribute(`expandable`)&&!this.hasAttribute(`expanded`))this.setAttribute(`expanded`,``),e.preventDefault(),e.stopPropagation();else if(this.hasAttribute(`expanded`)){let t=this.querySelector(`:scope > .ui-tree-children > ui-tree-item > [slot="label"]`);t&&(t.focus(),e.preventDefault(),e.stopPropagation())}break;case`ArrowLeft`:if(this.hasAttribute(`expanded`))this.removeAttribute(`expanded`),e.preventDefault(),e.stopPropagation();else{let t=(this.parentElement?.closest(`ui-tree-item`))?.querySelector(`:scope > [slot="label"]`);t&&(t.focus(),e.preventDefault(),e.stopPropagation())}break;case`Enter`:case` `:e.preventDefault(),e.stopPropagation(),this.toggleAttribute(`selected`,!0),this.hasAttribute(`expandable`)&&this.toggleAttribute(`expanded`);break}}},an=class extends A{static observedAttributes=[`direction`,`controls`,`indicators`,`autoplay`,`interval`,`loop`,`peek`,`per-view`,`gap`,`disabled`];#e=null;#t=null;#n=null;#r=null;#i=null;#a=v(0);#o=v(0);#s=v(!1);#c=null;#l=null;#u=null;#d=[];#f=!1;#p=0;#m=0;#h=0;#g=0;#_;constructor(){super(),this.#_=this.attachInternals(),this.#_.role=`region`}get index(){return this.#a.value}goTo(e){let t=this.#d.length;if(t===0)return;let n=e;n=this.hasAttribute(`loop`)?(e%t+t)%t:Math.max(0,Math.min(e,t-1));let r=this.#d[n];if(!r)return;let i=this.getAttribute(`direction`)===`vertical`;r.scrollIntoView({block:i?`start`:`nearest`,inline:i?`nearest`:`start`})}next(){this.goTo(this.#a.value+1)}prev(){this.goTo(this.#a.value-1)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`disabled`:this.#s.value=n!==null;break;case`per-view`:this.#v(n);break;case`autoplay`:n===null?this.#E():this.#T();break;case`interval`:this.hasAttribute(`autoplay`)&&(this.#E(),this.#T());break;case`loop`:this.#w(this.#a.value,this.#o.value);break}super.attributeChangedCallback?.(e,t,n)}}setup(){super.setup(),this.#l=window.matchMedia(`(prefers-reduced-motion: reduce)`);let e=document.createElement(`div`);e.setAttribute(`part`,`track`),e.id=j(`ss-track`),e.setAttribute(`tabindex`,`0`);let t=[];for(;this.firstChild;){let n=this.firstChild;e.appendChild(n),n instanceof HTMLElement&&n.tagName.toLowerCase()===`ui-slide`&&t.push(n)}this.appendChild(e),this.#e=e,this.#d=t;let n=document.createElement(`div`);n.setAttribute(`part`,`controls`);let r=document.createElement(`button`);r.setAttribute(`part`,`prev`),r.setAttribute(`aria-label`,`Previous slide`),r.setAttribute(`type`,`button`),r.innerHTML=`<svg width="16" height="16" viewBox="0 0 256 256" aria-hidden="true" focusable="false"><path d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z" fill="currentColor"/></svg>`;let i=document.createElement(`button`);i.setAttribute(`part`,`next`),i.setAttribute(`aria-label`,`Next slide`),i.setAttribute(`type`,`button`),i.innerHTML=`<svg width="16" height="16" viewBox="0 0 256 256" aria-hidden="true" focusable="false"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z" fill="currentColor"/></svg>`,n.appendChild(r),n.appendChild(i),this.appendChild(n),this.#n=r,this.#r=i;let a=document.createElement(`div`);a.setAttribute(`part`,`indicators`),a.setAttribute(`aria-hidden`,`true`),this.appendChild(a),this.#t=a;let o=document.createElement(`div`);o.id=j(`ss-live`),o.setAttribute(`aria-live`,`polite`),o.setAttribute(`aria-atomic`,`true`),o.setAttribute(`data-visually-hidden`,``),this.appendChild(o),this.#i=o,this.setAttribute(`aria-roledescription`,`carousel`),this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,`Slideshow`),this.#v(this.getAttribute(`per-view`)),this.#o.value=t.length,this.#y(t),this.#b(t.length),this.#S(t),t.length>0&&t[0].toggleAttribute(`active`,!0),this.addEffect(()=>{let e=this.#a.value,t=this.#o.value;this.#C(e),this.#w(e,t),this.#i&&(this.#i.textContent=`Slide ${e+1} of ${t}`)}),this.addEffect(M(this,this.#s,this.#_)),r.addEventListener(`click`,this.#D),i.addEventListener(`click`,this.#O),e.addEventListener(`keydown`,this.#P),e.addEventListener(`pointerdown`,this.#j),this.addEventListener(`mouseenter`,this.#k),this.addEventListener(`mouseleave`,this.#A),this.addEventListener(`focusin`,this.#k),this.addEventListener(`focusout`,this.#A),this.hasAttribute(`autoplay`)&&this.#T()}teardown(){this.#E(),this.#u?.disconnect(),this.#u=null,this.#n?.removeEventListener(`click`,this.#D),this.#r?.removeEventListener(`click`,this.#O),this.#e?.removeEventListener(`keydown`,this.#P),this.#e?.removeEventListener(`pointerdown`,this.#j),this.removeEventListener(`mouseenter`,this.#k),this.removeEventListener(`mouseleave`,this.#A),this.removeEventListener(`focusin`,this.#k),this.removeEventListener(`focusout`,this.#A),this.#e=null,this.#t?.removeEventListener(`click`,this.#x),this.#t&&(this.#t.innerHTML=``),this.#t=null,this.#n=null,this.#r=null,this.#i=null,this.#d=[],super.teardown()}#v(e){let t=Math.max(1,parseInt(e??`1`,10)||1);this.style.setProperty(`--_per-view`,String(t))}#y(e){let t=e.length;for(let n=0;n<t;n++){let r=e[n];r.setAttribute(`role`,`group`),r.setAttribute(`aria-roledescription`,`slide`),r.setAttribute(`aria-label`,`${n+1} of ${t}`),r.id||=j(`slide`)}}#b(e){let t=this.#t;if(t){t.addEventListener(`click`,this.#x);for(let n=0;n<e;n++){let e=document.createElement(`button`);e.setAttribute(`part`,`dot`),e.setAttribute(`type`,`button`),e.setAttribute(`aria-label`,`Go to slide ${n+1}`),e.setAttribute(`data-index`,String(n)),n===0&&e.toggleAttribute(`active`,!0),t.appendChild(e)}}}#x=e=>{let t=e.target.closest(`[data-index]`);if(!t)return;let n=parseInt(t.dataset.index??``,10);isNaN(n)||(this.#E(),this.goTo(n))};#S(e){let t=this.#e;if(!(!t||e.length===0)){this.#u=new IntersectionObserver(e=>{for(let t of e)if(t.isIntersecting&&t.intersectionRatio>=.5){let e=t.target,n=this.#d.indexOf(e);n!==-1&&n!==this.#a.value&&(this.#a.value=n,this.#d.forEach((e,t)=>e.toggleAttribute(`active`,t===n)),this.dispatchEvent(new CustomEvent(`ui-slide-change`,{bubbles:!0,composed:!0,detail:{index:n,slide:e}})))}},{root:t,threshold:.5});for(let t of e)this.#u.observe(t)}}#C(e){let t=this.#t?.querySelectorAll(`[part="dot"]`);t&&t.forEach((t,n)=>t.toggleAttribute(`active`,n===e))}#w(e,t){if(!this.#n||!this.#r)return;let n=this.hasAttribute(`loop`);this.#n.disabled=!n&&e===0,this.#r.disabled=!n&&e===t-1}#T(){if(this.#l?.matches)return;this.#E();let e=parseInt(this.getAttribute(`interval`)??`5000`,10)||5e3;this.#c=setInterval(()=>this.next(),e)}#E(){this.#c!==null&&(clearInterval(this.#c),this.#c=null)}#D=()=>{this.#E(),this.prev()};#O=()=>{this.#E(),this.next()};#k=()=>{this.#c!==null&&(clearInterval(this.#c),this.#c=null)};#A=()=>{this.hasAttribute(`autoplay`)&&!this.#l?.matches&&this.#c===null&&this.#T()};#j=e=>{if(e.button!==0||e.pointerType===`touch`)return;let t=this.#e;t&&(this.#f=!0,this.#p=e.clientX,this.#m=e.clientY,this.#h=t.scrollLeft,this.#g=t.scrollTop,t.style.scrollBehavior=`auto`,t.style.scrollSnapType=`none`,t.setPointerCapture(e.pointerId),t.setAttribute(`data-dragging`,``),t.addEventListener(`pointermove`,this.#M),t.addEventListener(`pointerup`,this.#N),t.addEventListener(`pointercancel`,this.#N))};#M=e=>{if(!(!this.#f||!this.#e))if(e.preventDefault(),this.getAttribute(`direction`)===`vertical`){let t=e.clientY-this.#m;this.#e.scrollTop=this.#g-t}else{let t=e.clientX-this.#p;this.#e.scrollLeft=this.#h-t}};#N=e=>{!this.#f||!this.#e||(this.#f=!1,this.#e.releasePointerCapture(e.pointerId),this.#e.removeAttribute(`data-dragging`),this.#e.removeEventListener(`pointermove`,this.#M),this.#e.removeEventListener(`pointerup`,this.#N),this.#e.removeEventListener(`pointercancel`,this.#N),this.#e.style.scrollBehavior=``,this.#e.style.scrollSnapType=``)};#P=e=>{if(this.#s.value)return;let t=this.getAttribute(`direction`)===`vertical`;switch(e.key){case t?`ArrowDown`:`ArrowRight`:e.preventDefault(),this.next();break;case t?`ArrowUp`:`ArrowLeft`:e.preventDefault(),this.prev();break;case`Home`:e.preventDefault(),this.goTo(0);break;case`End`:e.preventDefault(),this.goTo(this.#o.value-1);break}}},on=class extends A{setup(){super.setup(),this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`-1`)}},sn=class extends A{static observedAttributes=[`traits`,`for`,`provides`];#e=new Map;#t=null;#n=null;#r=new Set;#i=null;#a=!1;connectedCallback(){this.#a||(this.#a=!0,this.setup())}disconnectedCallback(){this.#a=!1,super.disconnectedCallback()}setup(){super.setup(),this.#o(),this.#m()}teardown(){this.#p(),this.#t?.disconnect(),this.#t=null,this.#n?.disconnect(),this.#n=null,this.#i?.(),this.#i=null,this.#r.clear(),super.teardown()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),this.isConnected&&(e===`traits`||e===`for`||e===`provides`)&&(this.#p(),this.#t?.disconnect(),this.#t=null,this.#o())}#o(){if(this.getAttribute(`provides`)!==null)return;let e=this.getAttribute(`traits`);if(!e)return;let t=this.getAttribute(`for`);t===null?this.#s(e):this.#c(e,t),this.#r.size>0&&!this.#i&&(this.#i=oe(e=>{this.#r.has(e)&&(this.#r.delete(e),this.#o(),this.#r.size===0&&(this.#i?.(),this.#i=null))}))}#s(e){let t=this.#d();t&&this.#u(t,e),this.#t=new MutationObserver(t=>{for(let n of t){if(n.type!==`childList`)continue;for(let e of n.removedNodes)if(e instanceof HTMLElement){let t=this.#e.get(e);t&&(this.#f(e,t),this.#e.delete(e))}let t=this.#d();t&&!this.#e.has(t)&&this.#u(t,e)}}),this.#t.observe(this,{childList:!0})}#c(e,t){let n=this.querySelectorAll(t);for(let t of n)this.#u(t,e);this.#t=new MutationObserver(()=>{this.#l(e,t)}),this.#t.observe(this,{childList:!0,subtree:!0})}#l(e,t){let n=new Set(this.querySelectorAll(t));for(let[e,t]of this.#e)n.has(e)||(this.#f(e,t),this.#e.delete(e));for(let t of n)this.#e.has(t)||this.#u(t,e)}#u(e,t){let n=t.split(/\s+/).filter(Boolean),r=this.#e.get(e)??new Map;for(let t of n){if(r.has(t))continue;let n=E(t);if(!n){this.#r.add(t);continue}for(let[e]of r)if(E(e)?.conflicts?.includes(t)||n.conflicts?.includes(e)){let n=`[native-ui] Trait conflict: "${t}" and "${e}" are incompatible.`;console.warn(n)}let i=k(this,t),a=n.create(e,i);r.set(t,a)}this.#e.set(e,r)}#d(){for(let e of this.children)if(e instanceof HTMLElement)return e;return null}#f(e,t){for(let[e,n]of t){let t=E(e);t&&t.destroy(n)}t.clear()}#p(){for(let[e,t]of this.#e)this.#f(e,t);this.#e.clear()}#m(){this.#n=new MutationObserver(e=>{for(let t of e){if(!t.attributeName)continue;let e=O(t.attributeName);if(!e)continue;let n=E(e.trait);if(!n?.update)continue;let r=k(this,e.trait);for(let[,t]of this.#e){let i=t.get(e.trait);i&&n.update(i,r)}}});let e=this.#h();e.length>0?this.#n.observe(this,{attributes:!0,attributeFilter:e}):this.#n.observe(this,{attributes:!0})}#h(){let e=D(),t=[];for(let n of this.attributes)for(let r of e)if(n.name.startsWith(r+`-`)){t.push(n.name);break}return t}},cn=class extends A{static observedAttributes=[`disabled`];#e;#t=v(!1);#n=null;#r=null;constructor(){super(),this.#e=this.attachInternals()}get value(){return this.#n?.value??``}set value(e){this.#n&&(this.#n.value=e)}get disabled(){return this.#t.value}set disabled(e){this.#t.value=e,this.toggleAttribute(`disabled`,e)}attributeChangedCallback(e,t,n){if(t!==n){switch(e){case`disabled`:this.#t.value=n!==null;break}super.attributeChangedCallback(e,t,n)}}setup(){super.setup(),this.addEffect(M(this,this.#t,this.#e)),this.deferChildren(()=>{this.#i(),this.addEffect(()=>{let e=this.#t.value;this.#n&&this.#n.toggleAttribute(`disabled`,e),this.#r&&(e?this.#r.setAttribute(`disabled`,``):this.#o())})}),this.addEventListener(`ui-input`,this.#s),this.addEventListener(`ui-press`,this.#c),this.addEventListener(`keydown`,this.#l)}teardown(){this.removeEventListener(`ui-input`,this.#s),this.removeEventListener(`ui-press`,this.#c),this.removeEventListener(`keydown`,this.#l),this.#n=null,this.#r=null,super.teardown()}#i(){this.#n=this.querySelector(`:scope > ui-textarea`),this.#r=this.querySelector(`[data-submit]`)??this.#a()}#a(){let e=this.querySelector(`:scope > ui-chat-input-actions`);if(!e)return null;let t=e.querySelectorAll(`ui-button[variant="primary"]`);return t.length?t[t.length-1]:null}#o(){!this.#r||this.#t.value||(this.value.trim()?this.#r.removeAttribute(`disabled`):this.#r.setAttribute(`disabled`,``))}#s=e=>{this.#t.value||this.#o()};#c=e=>{this.#t.value||e.target===this.#r&&this.#u()};#l=e=>{if(this.#t.value||this.hasAttribute(`no-enter-submit`))return;let t=e;if(t.isComposing)return;let n=t.target;!this.#n?.contains(n)&&n!==this.#n||t.key===`Enter`&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&(t.preventDefault(),this.value.trim()&&this.#u())};#u(){let e=this.value.trim();e&&this.dispatchEvent(new CustomEvent(`ui-send`,{bubbles:!0,composed:!0,cancelable:!0,detail:{value:e}}))&&!this.hasAttribute(`no-auto-clear`)&&(this.value=``,this.#r?.setAttribute(`disabled`,``))}},ln=class extends A{static observedAttributes=[`interactive`,`href`];setup(){super.setup(),this.hasAttribute(`interactive`)&&(this.hasAttribute(`tabindex`)||this.setAttribute(`tabindex`,`0`),this.addEventListener(`click`,this.#e),this.addEventListener(`keydown`,this.#t))}teardown(){this.removeEventListener(`click`,this.#e),this.removeEventListener(`keydown`,this.#t),super.teardown()}#e=()=>{let e=this.getAttribute(`href`);e&&(window.location.href=e)};#t=e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),this.#e())}},un=class extends A{static observedAttributes=[`collapsible`,`collapsed`,`divider`];setup(){if(super.setup(),this.hasAttribute(`collapsible`)){let e=this.querySelector(`[slot="heading"]`);e&&e.addEventListener(`click`,this.#e)}}teardown(){let e=this.querySelector(`[slot="heading"]`);e&&e.removeEventListener(`click`,this.#e),super.teardown()}#e=()=>{this.hasAttribute(`collapsible`)&&this.toggleAttribute(`collapsed`)}},dn=class extends A{#e;#t;constructor(){super(),this.#e=this.attachInternals(),this.#e.role=`toolbar`}setup(){super.setup(),this.#t=new U(this,{selector:`:scope > ui-button:not([disabled]), :scope > button:not([disabled])`,orientation:`horizontal`}),this.hasAttribute(`aria-label`)||this.setAttribute(`aria-label`,`Toolbar`)}teardown(){this.#t.destroy(),super.teardown()}},fn=new Map,$=new Set;function pn(e,t){fn.set(e,t),$.forEach(t=>t(e))}function mn(e){return fn.get(e)}function hn(e){return $.add(e),()=>$.delete(e)}var gn=class extends A{static observedAttributes=[`name`,`weight`,`size`,`aria-label`];#e=null;setup(){super.setup(),this.#t(),this.#r()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(e,t,n),(e===`name`||e===`weight`)&&this.#r(),e===`aria-label`&&this.#t()}disconnectedCallback(){super.disconnectedCallback(),this.#e?.(),this.#e=null}#t(){this.hasAttribute(`aria-label`)?(this.setAttribute(`role`,`img`),this.removeAttribute(`aria-hidden`)):(this.setAttribute(`aria-hidden`,`true`),this.removeAttribute(`role`))}#n(){let e=this.getAttribute(`name`);return e?this.getAttribute(`weight`)===`fill`&&!e.endsWith(`-fill`)?`${e}-fill`:e:null}#r(){let e=this.#n();if(!e){this.innerHTML=``,this.#e?.(),this.#e=null;return}let t=mn(e);t?(this.innerHTML=t,this.#e?.(),this.#e=null):(this.innerHTML=``,this.#e||=hn(e=>{e===this.#n()&&this.#r()}))}};return e.CalendarStore=Q,e.ClipboardController=Ce,e.CollapsibleController=Me,e.ColumnResizeController=jt,e.ContextConsumer=le,e.ContextProvider=ce,e.ContextRequestEvent=F,e.CopyController=Te,e.DataListController=R,e.DialogController=q,e.DismissController=W,e.DismissStack=de,e.DragController=V,e.DropZoneController=De,e.EditController=Se,e.FocusTrapController=je,e.FormAssociable=I,e.GestureRouter=ue,e.HoverController=we,e.IntersectController=Ee,e.ListNavigateController=K,e.PopoverController=G,e.PressController=H,e.RangeSelectController=ge,e.ResizeController=_e,e.RovingFocusController=U,e.SearchController=be,e.SelectController=Ht,e.SelectionController=ye,e.SortController=Oe,e.SwipeController=xe,e.TableStore=Y,e.ToastController=Ne,e.ToastManager=fe,e.UIAccordion=Ct,e.UIAccordionItem=wt,e.UIAvatar=Yt,e.UIBadge=Xt,e.UIBreadcrumb=Qt,e.UIBreadcrumbItem=$t,e.UIButton=it,e.UICalendar=Vt,e.UICard=ln,e.UIChatInput=cn,e.UICheckbox=gt,e.UICombobox=Wt,e.UICommand=ut,e.UICommandEmpty=ht,e.UICommandGroup=mt,e.UICommandInput=dt,e.UICommandItem=pt,e.UICommandList=ft,e.UIController=sn,e.UIDialog=Tt,e.UIDrawer=tn,e.UIElement=A,e.UIField=Gt,e.UIIcon=gn,e.UIInput=at,e.UIInputOtp=Jt,e.UIKbd=Zt,e.UIListbox=ot,e.UIOption=st,e.UIOptionGroup=lt,e.UIOptionGroupHeader=ct,e.UIPagination=en,e.UIRadio=vt,e.UIRadioGroup=yt,e.UIRange=qt,e.UISection=un,e.UISegment=xt,e.UISegmentedControl=bt,e.UISelect=Ut,e.UISlide=on,e.UISlideshow=an,e.UISwitch=_t,e.UITab=Dt,e.UITabPanel=Ot,e.UITabPanels=kt,e.UITable=Nt,e.UITableBody=Ft,e.UITableCell=Lt,e.UITableHead=Pt,e.UITableHeader=Rt,e.UITableRow=It,e.UITabs=Et,e.UITextarea=Kt,e.UIToolbar=dn,e.UITooltip=St,e.UITree=nn,e.UITreeItem=rn,e.ValidateController=ke,e.VirtualScrollController=ve,e.batch=x,e.clippableAdapter=et,e.collapsibleAdapter=He,e.collectTraitOptions=k,e.computed=y,e.copyableAdapter=Ie,e.createCalendarStore=Bt,e.createDataList=he,e.createDisabledEffect=M,e.createTableStore=At,e.debugReactive=re,e.define=se,e.dialogableAdapter=J,e.dismissableAdapter=We,e.draggableAdapter=Je,e.droppableAdapter=Re,e.editableAdapter=nt,e.effect=b,e.fetchDataOptions=B,e.focusTrappableAdapter=Ve,e.getIcon=mn,e.getRegisteredTraitNames=D,e.getTrait=E,e.getTraitRuntime=L,e.hoverableAdapter=Fe,e.intersectableAdapter=Le,e.isComputed=ae,e.isSignal=ie,e.listNavigableAdapter=qe,e.onIconRegistered=hn,e.parseDataOptions=z,e.parseTraitAttribute=O,e.popoverableAdapter=Ke,e.pressableAdapter=Pe,e.prop=N,e.rangeSelectableAdapter=Ye,e.registerAllTraits=rt,e.registerIcon=pn,e.registerTrait=T,e.resizableAdapter=Xe,e.rovingFocusableAdapter=Ue,e.searchableAdapter=$e,e.selectableAdapter=Qe,e.signal=v,e.sortableAdapter=ze,e.swipeableAdapter=tt,e.syncProp=P,e.toastableAdapter=Ge,e.uid=j,e.untrack=S,e.validatableAdapter=Be,e.virtualizableAdapter=Ze,e})({});
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@nonoun/native-cdn",
3
+ "version": "0.2.0",
4
+ "description": "Single-file IIFE bundle of @nonoun/native-ui for CDN and artifact use",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/native-ui.iife.js",
8
+ "exports": {
9
+ ".": "./dist/native-ui.iife.js",
10
+ "./css": "./dist/native-ui.css"
11
+ },
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "peerDependencies": {
16
+ "@nonoun/native-ui": ">=0.5.0"
17
+ },
18
+ "scripts": {
19
+ "build": "npm run build:js && npm run build:css",
20
+ "build:js": "vite build",
21
+ "build:css": "cp ../../dist/native-ui.css dist/native-ui.css"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ }
26
+ }