@mndw/cli 0.1.4 → 0.1.6

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,1790 @@
1
+ var St=globalThis,xt=St.ShadowRoot&&(St.ShadyCSS===void 0||St.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,cr=Symbol(),ui=new WeakMap,Ne=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==cr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(xt&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=ui.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&ui.set(t,e))}return e}toString(){return this.cssText}},hi=i=>new Ne(typeof i=="string"?i:i+"",void 0,cr),v=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,n,o)=>r+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[o+1],i[0]);return new Ne(t,i,cr)},pi=(i,e)=>{if(xt)i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),n=St.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)}},ur=xt?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return hi(t)})(i):i;var{is:to,defineProperty:ro,getOwnPropertyDescriptor:io,getOwnPropertyNames:no,getOwnPropertySymbols:oo,getPrototypeOf:ao}=Object,Ct=globalThis,mi=Ct.trustedTypes,so=mi?mi.emptyScript:"",lo=Ct.reactiveElementPolyfillSupport,Oe=(i,e)=>i,hr={toAttribute(i,e){switch(e){case Boolean:i=i?so:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},fi=(i,e)=>!to(i,e),bi={attribute:!0,type:String,converter:hr,reflect:!1,useDefault:!1,hasChanged:fi};Symbol.metadata??=Symbol("metadata"),Ct.litPropertyMetadata??=new WeakMap;var H=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=bi){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),n=this.getPropertyDescriptor(e,r,t);n!==void 0&&ro(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){let{get:n,set:o}=io(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:n,set(a){let s=n?.call(this);o?.call(this,a),this.requestUpdate(e,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??bi}static _$Ei(){if(this.hasOwnProperty(Oe("elementProperties")))return;let e=ao(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Oe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Oe("properties"))){let t=this.properties,r=[...no(t),...oo(t)];for(let n of r)this.createProperty(n,t[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,n]of t)this.elementProperties.set(r,n)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let n=this._$Eu(t,r);n!==void 0&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let n of r)t.unshift(ur(n))}else e!==void 0&&t.push(ur(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return pi(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(n!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:hr).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,n=r._$Eh.get(e);if(n!==void 0&&this._$Em!==n){let o=r.getPropertyOptions(n),a=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:hr;this._$Em=n;let s=a.fromAttribute(t,o.type);this[n]=s??this._$Ej?.get(n)??s,this._$Em=null}}requestUpdate(e,t,r,n=!1,o){if(e!==void 0){let a=this.constructor;if(n===!1&&(o=this[e]),r??=a.getPropertyOptions(e),!((r.hasChanged??fi)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:n,wrapped:o},a){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),o!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),n===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[n,o]of this._$Ep)this[n]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[n,o]of r){let{wrapped:a}=o,s=this[n];a!==!0||this._$AL.has(n)||s===void 0||this.C(n,void 0,o,s)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};H.elementStyles=[],H.shadowRootOptions={mode:"open"},H[Oe("elementProperties")]=new Map,H[Oe("finalized")]=new Map,lo?.({ReactiveElement:H}),(Ct.reactiveElementVersions??=[]).push("2.1.2");var mr=globalThis,vi=i=>i,Mt=mr.trustedTypes,gi=Mt?Mt.createPolicy("lit-html",{createHTML:i=>i}):void 0,br="$lit$",j=`lit$${Math.random().toFixed(9).slice(2)}$`,fr="?"+j,co=`<${fr}>`,se=document,Ie=()=>se.createComment(""),Fe=i=>i===null||typeof i!="object"&&typeof i!="function",vr=Array.isArray,Mi=i=>vr(i)||typeof i?.[Symbol.iterator]=="function",pr=`[
2
+ \f\r]`,$e=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,wi=/-->/g,yi=/>/g,oe=RegExp(`>|${pr}(?:([^\\s"'>=/]+)(${pr}*=${pr}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Si=/'/g,xi=/"/g,Ei=/^(?:script|style|textarea|title)$/i,gr=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),u=gr(1),ce=gr(2),Fa=gr(3),Y=Symbol.for("lit-noChange"),b=Symbol.for("lit-nothing"),Ci=new WeakMap,ae=se.createTreeWalker(se,129);function Ti(i,e){if(!vr(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return gi!==void 0?gi.createHTML(e):e}var Ri=(i,e)=>{let t=i.length-1,r=[],n,o=e===2?"<svg>":e===3?"<math>":"",a=$e;for(let s=0;s<t;s++){let l=i[s],c,d,h=-1,p=0;for(;p<l.length&&(a.lastIndex=p,d=a.exec(l),d!==null);)p=a.lastIndex,a===$e?d[1]==="!--"?a=wi:d[1]!==void 0?a=yi:d[2]!==void 0?(Ei.test(d[2])&&(n=RegExp("</"+d[2],"g")),a=oe):d[3]!==void 0&&(a=oe):a===oe?d[0]===">"?(a=n??$e,h=-1):d[1]===void 0?h=-2:(h=a.lastIndex-d[2].length,c=d[1],a=d[3]===void 0?oe:d[3]==='"'?xi:Si):a===xi||a===Si?a=oe:a===wi||a===yi?a=$e:(a=oe,n=void 0);let f=a===oe&&i[s+1].startsWith("/>")?" ":"";o+=a===$e?l+co:h>=0?(r.push(c),l.slice(0,h)+br+l.slice(h)+j+f):l+j+(h===-2?s:f)}return[Ti(i,o+(i[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},He=class i{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let o=0,a=0,s=e.length-1,l=this.parts,[c,d]=Ri(e,t);if(this.el=i.createElement(c,r),ae.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=ae.nextNode())!==null&&l.length<s;){if(n.nodeType===1){if(n.hasAttributes())for(let h of n.getAttributeNames())if(h.endsWith(br)){let p=d[a++],f=n.getAttribute(h).split(j),m=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:m[2],strings:f,ctor:m[1]==="."?Tt:m[1]==="?"?Rt:m[1]==="@"?At:de}),n.removeAttribute(h)}else h.startsWith(j)&&(l.push({type:6,index:o}),n.removeAttribute(h));if(Ei.test(n.tagName)){let h=n.textContent.split(j),p=h.length-1;if(p>0){n.textContent=Mt?Mt.emptyScript:"";for(let f=0;f<p;f++)n.append(h[f],Ie()),ae.nextNode(),l.push({type:2,index:++o});n.append(h[p],Ie())}}}else if(n.nodeType===8)if(n.data===fr)l.push({type:2,index:o});else{let h=-1;for(;(h=n.data.indexOf(j,h+1))!==-1;)l.push({type:7,index:o}),h+=j.length-1}o++}}static createElement(e,t){let r=se.createElement("template");return r.innerHTML=e,r}};function le(i,e,t=i,r){if(e===Y)return e;let n=r!==void 0?t._$Co?.[r]:t._$Cl,o=Fe(e)?void 0:e._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),o===void 0?n=void 0:(n=new o(i),n._$AT(i,t,r)),r!==void 0?(t._$Co??=[])[r]=n:t._$Cl=n),n!==void 0&&(e=le(i,n._$AS(i,e.values),n,r)),e}var Et=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??se).importNode(t,!0);ae.currentNode=n;let o=ae.nextNode(),a=0,s=0,l=r[0];for(;l!==void 0;){if(a===l.index){let c;l.type===2?c=new ge(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new Lt(o,this,e)),this._$AV.push(c),l=r[++s]}a!==l?.index&&(o=ae.nextNode(),a++)}return ae.currentNode=se,n}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},ge=class i{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=b,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=le(this,e,t),Fe(e)?e===b||e==null||e===""?(this._$AH!==b&&this._$AR(),this._$AH=b):e!==this._$AH&&e!==Y&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Mi(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==b&&Fe(this._$AH)?this._$AA.nextSibling.data=e:this.T(se.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,n=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=He.createElement(Ti(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{let o=new Et(n,this),a=o.u(this.options);o.p(t),this.T(a),this._$AH=o}}_$AC(e){let t=Ci.get(e.strings);return t===void 0&&Ci.set(e.strings,t=new He(e)),t}k(e){vr(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let o of e)n===t.length?t.push(r=new i(this.O(Ie()),this.O(Ie()),this,this.options)):r=t[n],r._$AI(o),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=vi(e).nextSibling;vi(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},de=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,o){this.type=1,this._$AH=b,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=b}_$AI(e,t=this,r,n){let o=this.strings,a=!1;if(o===void 0)e=le(this,e,t,0),a=!Fe(e)||e!==this._$AH&&e!==Y,a&&(this._$AH=e);else{let s=e,l,c;for(e=o[0],l=0;l<o.length-1;l++)c=le(this,s[r+l],t,l),c===Y&&(c=this._$AH[l]),a||=!Fe(c)||c!==this._$AH[l],c===b?e=b:e!==b&&(e+=(c??"")+o[l+1]),this._$AH[l]=c}a&&!n&&this.j(e)}j(e){e===b?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Tt=class extends de{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===b?void 0:e}},Rt=class extends de{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==b)}},At=class extends de{constructor(e,t,r,n,o){super(e,t,r,n,o),this.type=5}_$AI(e,t=this){if((e=le(this,e,t,0)??b)===Y)return;let r=this._$AH,n=e===b&&r!==b||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==b&&(r===b||n);n&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Lt=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){le(this,e)}},Ai={M:br,P:j,A:fr,C:1,L:Ri,R:Et,D:Mi,V:le,I:ge,H:de,N:Rt,U:At,B:Tt,F:Lt},uo=mr.litHtmlPolyfillSupport;uo?.(He,ge),(mr.litHtmlVersions??=[]).push("3.3.3");var Li=(i,e,t)=>{let r=t?.renderBefore??e,n=r._$litPart$;if(n===void 0){let o=t?.renderBefore??null;r._$litPart$=n=new ge(e.insertBefore(Ie(),o),o,void 0,t??{})}return n._$AI(i),n};var wr=globalThis,g=class extends H{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Li(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Y}};g._$litElement$=!0,g.finalized=!0,wr.litElementHydrateSupport?.({LitElement:g});var ho=wr.litElementPolyfillSupport;ho?.({LitElement:g});(wr.litElementVersions??=[]).push("4.2.2");import*as V from"d3";var ki={select:{placeholder:"Select\u2026",validation:{required:"Please select an option."},overlay:{title:"Select option"}},overlay:{close:"Close"},chart:{empty:"No data available",values:"Values"},input:{password:{show:"Show password",hide:"Hide password"}},checkbox:{validation:{required:"Please select this option."}},segmented:{validation:{required:"Please select an option."}},table:{selectRow:"Select {rowName}",selectAll:"Select all",sortBy:"Sort by {column}",columnMenu:"Column menu",rowFallback:"Row {index}",reordered:"{rowName} moved to position {pos} of {total}",invalidData:"Table data is invalid"}};var _i={select:{placeholder:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435\u2026",validation:{required:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442."},overlay:{title:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442"}},overlay:{close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C"},chart:{empty:"\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445",values:"\u0417\u043D\u0430\u0447\u0435\u043D\u0438\u044F"},input:{password:{show:"\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C",hide:"\u0421\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C"}},checkbox:{validation:{required:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u044D\u0442\u043E\u0442 \u0432\u0430\u0440\u0438\u0430\u043D\u0442."}},segmented:{validation:{required:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442."}},table:{selectRow:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C {rowName}",selectAll:"\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0432\u0441\u0435",sortBy:"\u0421\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E {column}",columnMenu:"\u041C\u0435\u043D\u044E \u0441\u0442\u043E\u043B\u0431\u0446\u043E\u0432",rowFallback:"\u0421\u0442\u0440\u043E\u043A\u0430 {index}",reordered:"{rowName} \u043F\u0435\u0440\u0435\u043C\u0435\u0449\u0435\u043D\u0430 \u043D\u0430 \u043F\u043E\u0437\u0438\u0446\u0438\u044E {pos} \u0438\u0437 {total}",invalidData:"\u0414\u0430\u043D\u043D\u044B\u0435 \u0442\u0430\u0431\u043B\u0438\u0446\u044B \u043D\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u044C\u043D\u044B"}};var kt={en:ki,ru:_i},_t="en",yr=new Set;function bo(i){try{if(typeof Intl.getCanonicalLocales=="function")return Intl.getCanonicalLocales(i)[0]??"en";if(typeof Intl.Locale=="function")return new Intl.Locale(i).toString()}catch{}return"en"}function fo(i){let e=i==="en-XA"?"en":bo(i);if(kt[e]!==void 0)return e;let t=e.split("-")[0];return kt[t]!==void 0?t:"en"}function Sr(i){let e=fo(i);if(e!==_t){_t=e;for(let t of yr)t()}}function xr(){return _t}function y(i){return Pi(kt[_t],i)??Pi(kt.en,i)??i}function Pi(i,e){let t=i;for(let r of e.split(".")){if(typeof t!="object"||t===void 0)return;t=t[r]}return typeof t=="string"?t:void 0}function Cr(i){return yr.add(i),()=>{yr.delete(i)}}var Di=5e3,vo=i=>{if(i===0)return"0 b/s";let e=Math.abs(i),t=["b/s","Kb/s","Mb/s","Gb/s"],r=0,n=e;for(;n>=1e3&&r<t.length-1;)n/=1e3,r+=1;return`${r===0?n:n.toFixed(1)} ${t[r]}`},go=i=>{if(!Number.isFinite(i)||i<=0)return Di;let e=String(Math.floor(i)).length-1,t=Math.pow(10,e),r=Math.ceil(i/t)*t;return Math.max(r,Di)},we=i=>new Intl.NumberFormat(xr()).format(i),Pt=i=>{if(!Number.isFinite(i)||i<=0)return 1;let e=Math.pow(10,Math.floor(Math.log10(i))),t=i/e,n=([1,1.5,2,2.5,5,10].find(o=>o>=t)??10)*e;return Number.isFinite(n)?n:i},Q=i=>{let e=new Date(i),t=r=>String(r).padStart(2,"0");return`${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}`},Dt=i=>`${Math.round(i)}%`,Nt=i=>Number.isFinite(i)&&i>0?i:100,wo=["accent","success","warning","muted"],Ot=i=>wo.includes(i)?i:"accent",Ve=i=>i.flatMap(e=>!Number.isFinite(e.value)||e.time!==void 0&&!Number.isFinite(e.time)?[]:e.time===void 0?[{value:e.value}]:[{time:e.time,value:e.value}]),U=i=>i.filter(e=>Number.isFinite(e.time)&&Number.isFinite(e.value)),Ni=i=>{let e=[],t=[];for(let r of i){if(!Number.isFinite(r.time)||!Number.isFinite(r.value)){t.length>0&&(e.push(t),t=[]);continue}t.push(r)}return t.length>0&&e.push(t),e},Oi=(i,e)=>{if(e!==void 0&&Number.isFinite(e.start)&&Number.isFinite(e.end)&&e.start<e.end)return{start:e.start,end:e.end};let t=U(i);return t.length===0?null:{start:Math.min(...t.map(r=>r.time)),end:Math.max(...t.map(r=>r.time))}},ye=(i,e,t)=>{let r=Ve(i);if(r.length===0)return null;let o=r.every(l=>l.time!==void 0)?r.reduce((l,c)=>l.time===void 0||c.time===void 0?l:c.time>l.time?c:l):r[r.length-1],a=Math.min(...r.map(l=>l.value)),s=Math.max(...r.map(l=>l.value));return o===void 0?null:`${e}: latest ${t(o.value)}; range ${t(a)} to ${t(s)}`},$i=(i,e,t=we,r)=>{let n=i.map(a=>ye(a.data,a.label??a.id,t)).filter(a=>a!==null);return n.length===0?e:`${r===void 0?"Chart. ":`Chart. ${r}: `}${n.join("; ")}`},Ii=(i,e,t,r=we)=>ye(i,e,r)??t;var Se=class{constructor(e,t){this.host=e;this.onResize=t;e.addController(this)}plotElement=null;disposePlot=null;resizeObserver=null;observedContainer=null;hostConnected(){this.host.setAttribute("role","img"),this.host.requestUpdate()}hostDisconnected(){this.disconnectPlot(),this.resizeObserver!==null&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.observedContainer=null}setPlot(e,t){this.disconnectPlot(),this.plotElement=e,this.disposePlot=t}observeContainer(e){typeof ResizeObserver>"u"||(this.resizeObserver===null&&(this.resizeObserver=new ResizeObserver(t=>{let r=t[0];this.onResize(r===void 0?void 0:{width:r.contentRect.width,height:r.contentRect.height})})),this.observedContainer!==e&&(this.observedContainer!==null&&this.resizeObserver.unobserve(this.observedContainer),this.resizeObserver.observe(e),this.observedContainer=e))}disconnectPlot(){this.disposePlot!==null&&(this.disposePlot(),this.disposePlot=null),this.plotElement=null}};var $t=v`
4
+ :host {
5
+ display: block;
6
+ width: 100%;
7
+ height: 100%;
8
+ min-width: 0;
9
+ min-height: 0;
10
+ color: var(--mndw-text);
11
+ font-family: inherit;
12
+ }
13
+
14
+ .container {
15
+ position: relative;
16
+ width: 100%;
17
+ height: 100%;
18
+ min-height: 7.5rem;
19
+ }
20
+
21
+ svg {
22
+ display: block;
23
+ width: 100%;
24
+ height: 100%;
25
+ overflow: visible;
26
+ }
27
+
28
+ .empty {
29
+ display: grid;
30
+ height: 100%;
31
+ min-height: 7.5rem;
32
+ place-items: center;
33
+ color: var(--mndw-text-subtle);
34
+ text-align: center;
35
+ }
36
+
37
+ .tooltip {
38
+ position: absolute;
39
+ z-index: 1;
40
+ display: none;
41
+ padding: 0.25rem 0.5rem;
42
+ border: 1px solid var(--mndw-border);
43
+ border-radius: 0.25rem;
44
+ background: var(--mndw-surface-raised);
45
+ color: var(--mndw-text);
46
+ font-size: 0.6875rem;
47
+ line-height: 1.4;
48
+ pointer-events: none;
49
+ white-space: nowrap;
50
+ }
51
+
52
+ .tooltip[data-visible] {
53
+ display: block;
54
+ }
55
+
56
+ [part='grid'] .tick line {
57
+ stroke: var(--mndw-border);
58
+ stroke-dasharray: 4, 4;
59
+ }
60
+
61
+ [part='grid'] .domain,
62
+ [part='axis'] .domain {
63
+ display: none;
64
+ }
65
+
66
+ [part='grid'] text,
67
+ [part='axis'] text {
68
+ fill: var(--mndw-text-subtle);
69
+ }
70
+ `,yo=i=>i===null?"":`left: ${i.left}px; top: ${i.top}px;`,It=i=>u`
71
+ <div class="container" part="container">
72
+ ${i.hasContent?u`<svg part="plot" aria-hidden="true"></svg>`:u`<div class="empty" part="empty">${i.emptyLabel}</div>`}
73
+ <div
74
+ class="tooltip"
75
+ part="tooltip"
76
+ ?data-visible=${i.tooltip!==null}
77
+ style=${yo(i.tooltip)}
78
+ >
79
+ ${i.tooltip===null?"":i.tooltipBody}
80
+ </div>
81
+ </div>
82
+ `;var L=class{constructor(e,t={}){this.host=e;this.options=t;e.addController(this)}unsubscribe=null;hostConnected(){this.options.applyLocale?.(),this.unsubscribe=Cr(()=>{this.options.applyLocale?.(),this.host.requestUpdate()})}hostDisconnected(){this.unsubscribe?.(),this.unsubscribe=null}};var Mr=new WeakMap,Fi=new WeakMap;function So(i,e){let t=Object.getPrototypeOf(i);for(;t!==null;){let r=Object.getOwnPropertyDescriptor(t,e);if(r!==void 0)return{prototype:t,descriptor:r};t=Object.getPrototypeOf(t)}}function xo(i,e){return Mr.get(i)?.get(e)}function Co(i,e){let t=Fi.get(i.prototype);t?.has(e)||(t===void 0&&(t=new Map,Fi.set(i.prototype,t)),t.set(e,i.descriptor),Object.defineProperty(i.prototype,e,{configurable:i.descriptor.configurable,enumerable:i.descriptor.enumerable,get:function(){return i.descriptor.get?.call(this)},set:function(r){let n=xo(this,e);n!==void 0&&!n.internal&&(n.dirty=!0),i.descriptor.set?.call(this,r)}}))}function Hi(i,e,t){let r=!1,n=i.setAttribute.bind(i),o=i.removeAttribute.bind(i),a=i.toggleAttribute.bind(i);return Object.defineProperty(i,"setAttribute",{configurable:!0,value:(s,l)=>{s===e&&!r&&t(),n(s,l)}}),Object.defineProperty(i,"removeAttribute",{configurable:!0,value:s=>{s===e&&!r&&t(),o(s)}}),Object.defineProperty(i,"toggleAttribute",{configurable:!0,value:(s,l)=>(s===e&&!r&&t(),a(s,l))}),s=>{r=!0;try{s()}finally{r=!1}}}function O(i,e,t=e){let r=So(i,e);if(r?.descriptor.set===void 0||r.descriptor.get===void 0)throw new Error(`Property ${e} has no accessor on ${i.localName}`);Co(r,e);let n={dirty:i.hasAttribute(t),internal:!1},o=Mr.get(i)??new Map;o.set(e,n),Mr.set(i,o);let a=Hi(i,t,()=>{n.dirty=!0});return{get dirty(){return n.dirty},setGenerated(s){n.dirty||a(()=>{n.internal=!0;try{r.descriptor.set?.call(i,s)}finally{n.internal=!1}})}}}function X(i,e){let t=i.hasAttribute(e),r=Hi(i,e,()=>{t=!0});return{get dirty(){return t},setGenerated(n){t||r(()=>{n===null?i.removeAttribute(e):i.setAttribute(e,n)})}}}var Er="mndw-bar-chart",ze=class extends g{static shadowRootOptions={mode:"open"};static properties={points:{attribute:!1},valueDomain:{attribute:!1},emptyLabel:{type:String,attribute:"empty-label"},valueLabel:{type:String,attribute:"value-label"},valueFormatter:{attribute:!1},timeFormatter:{attribute:!1},color:{type:String,reflect:!0}};static styles=[$t,v`
83
+ [part='hover-band'] {
84
+ fill: color-mix(in srgb, var(--mndw-text) 12%, transparent);
85
+ opacity: 0;
86
+ pointer-events: none;
87
+ }
88
+
89
+ [part='hover-band'][data-active] {
90
+ opacity: 1;
91
+ }
92
+
93
+ .tooltip {
94
+ min-width: 6.25rem;
95
+ }
96
+ `];tooltipState=null;emptyLabelState;valueLabelState;ariaLabelState;localeController=new L(this,{applyLocale:()=>{this.applyLocale()}});frame=new Se(this,e=>{this.drawChart(e)});constructor(){super(),this.points=[],this.valueDomain=void 0,this.valueFormatter=we,this.timeFormatter=Q,this.color="accent",this.emptyLabelState=O(this,"emptyLabel","empty-label"),this.valueLabelState=O(this,"valueLabel","value-label"),this.ariaLabelState=X(this,"aria-label")}render(){let e=U(this.points).length>0;return It({hasContent:e,emptyLabel:this.emptyLabel??y("chart.empty"),tooltip:this.tooltipState,tooltipBody:this.tooltipState===null?"":u`
97
+ <div>${this.tooltipState.time}</div>
98
+ <div>${this.valueLabel??y("chart.values")}: <strong>${this.tooltipState.value}</strong></div>
99
+ `})}willUpdate(e){(e.has("points")||e.has("valueDomain")||e.has("emptyLabel")||e.has("valueLabel")||e.has("valueFormatter")||e.has("timeFormatter")||e.has("color"))&&(this.tooltipState=null)}updated(e){(e.has("points")||e.has("valueDomain")||e.has("emptyLabel")||e.has("valueLabel")||e.has("valueFormatter")||e.has("timeFormatter")||e.has("color")||this.frame.plotElement===null)&&(this.updateAccessibilityLabel(),this.drawChart())}updateAccessibilityLabel(){this.ariaLabelState.setGenerated(Ii(this.points,this.valueLabel??y("chart.values"),this.emptyLabel??y("chart.empty"),this.valueFormatter))}applyLocale(){this.emptyLabelState.setGenerated(y("chart.empty")),this.valueLabelState.setGenerated(y("chart.values"))}drawChart(e){let t=this.renderRoot.querySelector(".container");if(t===null)return;this.frame.observeContainer(t),this.frame.disconnectPlot();let r=this.tooltipState!==null;this.tooltipState=null,r&&this.requestUpdate();let n=t.querySelector("svg"),o=U(this.points).sort((C,P)=>C.time-P.time);if(n===null||o.length===0)return;let a=t.getBoundingClientRect(),s=e?.width||a.width||400,l=e?.height||a.height||200,c=s<300,d=c?{top:15,right:10,bottom:25,left:50}:{top:20,right:15,bottom:30,left:60},h=Math.max(s-d.left-d.right,50),p=Math.max(l-d.top-d.bottom,50),f=Math.max(...o.map(C=>C.value),1),m=this.valueDomain?.min??0,S=this.valueDomain?.max??Pt(f),x=V.scaleBand().domain(o.map((C,P)=>String(P))).range([0,h]).padding(.15),E=V.scaleLinear().domain([m,S]).range([p,0]),A=V.select(n).attr("width",s).attr("height",l);A.selectAll("*").remove();let k=A.append("g").attr("transform",`translate(${d.left}, ${d.top})`);k.append("g").attr("part","grid").call(V.axisLeft(E).ticks(3).tickSize(-h).tickFormat(()=>"")).select(".domain").remove();let gt=c?9:10,or=k.append("g").attr("part","axis").call(V.axisLeft(E).ticks(3).tickFormat(C=>this.valueFormatter(C.valueOf())));or.selectAll("text").attr("font-size",gt),or.select(".domain").remove();let ar=Ot(this.color),wt=k.append("rect").attr("part","hover-band").attr("y",0).attr("height",p);for(let[C,P]of o.entries()){let I=x(String(C))??0;k.append("rect").attr("data-bar","true").attr("data-color",ar).attr("x",I).attr("y",E(P.value)).attr("width",x.bandwidth()).attr("height",E(m)-E(P.value)).style("fill",`var(--mndw-${ar})`)}let ve=Math.min(o.length,5),_e=Math.max(Math.ceil(o.length/ve),1),z=[];for(let C=0;C<o.length&&z.length<ve;C+=_e)z.push(C);z[z.length-1]!==o.length-1&&o.length>1&&(z[z.length-1]=o.length-1),k.append("g").attr("part","axis").attr("transform",`translate(0, ${p})`).selectAll("text").data(z).enter().append("text").attr("x",C=>(x(String(C))??0)+x.bandwidth()/2).attr("dy","1.2em").style("text-anchor","middle").attr("font-size",gt-1).text(C=>{let P=o[C];return P===void 0?"":this.timeFormatter(P.time)});let w=k.append("rect").attr("width",h).attr("height",p).attr("fill","transparent").style("cursor","crosshair"),D=C=>{let P=k.node();if(P===null)return;let[I,q]=V.pointer(C,P);if(I<0||I>h||q<0||q>p){wt.attr("data-active",null),this.tooltipState=null,this.requestUpdate();return}let ne=x.step(),sr=x(String(0))??0,yt=(ne-x.bandwidth())/2,Pe=Math.min(Math.max(Math.floor((I-sr+yt)/ne),0),o.length-1),lr=o[Pe];if(lr===void 0)return;let eo=x(String(Pe))??0,di=ne,ci=Math.max(0,eo-(di-x.bandwidth())/2);wt.attr("x",ci).attr("width",Math.min(di,h-ci)).attr("data-active","");let dr=I+d.left+8,De=q-30;dr+120>s&&(dr=I+d.left-128),De<0&&(De=0),De+50>l&&(De=Math.max(0,l-50)),this.tooltipState={left:dr,top:De,time:this.timeFormatter(lr.time),value:this.valueFormatter(lr.value)},this.requestUpdate()};w.on("mousemove.chart",D),w.on("mouseleave.chart",()=>{wt.attr("data-active",null),this.tooltipState=null,this.requestUpdate()}),this.frame.setPlot(n,()=>{w.on(".chart",null)})}};var Rr="mndw-heat-strip",xe=[{at:10,token:"var(--mndw-util-low)"},{at:25,token:"var(--mndw-util-moderate)"},{at:40,token:"var(--mndw-util-elevated)"},{at:55,token:"var(--mndw-util-high)"},{at:70,token:"var(--mndw-util-critical)"}],Vi=xe[0],Tr=xe[xe.length-1],zi=10,Mo=(i,e,t)=>{let r=Math.min(Math.max(e,0),Math.max(t,0))/2,n=r,o=Math.max(n,t-r);return Math.min(Math.max(i,n),o)},Eo=(i,e)=>Number.isFinite(i)?Math.min(Math.max(i,0),e):0,To=i=>Math.min(100,Math.floor(i/zi)*zi),Ro=i=>{if(i<=Vi.at)return Vi.token;if(i>=Tr.at)return Tr.token;for(let e=0;e<xe.length-1;e+=1){let t=xe[e],r=xe[e+1];if(i<=r.at){let n=Math.round((r.at-i)/(r.at-t.at)*100);return`color-mix(in srgb, ${t.token} ${n}%, ${r.token})`}}return Tr.token},Ue=class extends g{static shadowRootOptions={mode:"open"};static properties={points:{attribute:!1},max:{type:Number},emptyLabel:{type:String,attribute:"empty-label"},valueLabel:{type:String,attribute:"value-label"},valueFormatter:{attribute:!1},timeFormatter:{attribute:!1}};static styles=v`
100
+ :host {
101
+ display: block;
102
+ width: 100%;
103
+ color: var(--mndw-text);
104
+ font-family: inherit;
105
+ }
106
+
107
+ .plot {
108
+ position: relative;
109
+ width: 100%;
110
+ height: var(--mndw-heat-strip-height);
111
+ }
112
+
113
+ svg {
114
+ display: block;
115
+ width: 100%;
116
+ height: 100%;
117
+ border-radius: var(--mndw-radius-sm);
118
+ }
119
+
120
+ .empty {
121
+ display: grid;
122
+ height: var(--mndw-heat-strip-height);
123
+ place-items: center;
124
+ border: 1px solid var(--mndw-border);
125
+ border-radius: var(--mndw-radius-sm);
126
+ color: var(--mndw-text-subtle);
127
+ font-size: 0.6875rem;
128
+ }
129
+
130
+ .axis {
131
+ display: flex;
132
+ justify-content: space-between;
133
+ margin-top: 0.125rem;
134
+ color: var(--mndw-text-subtle);
135
+ font-size: 0.625rem;
136
+ font-variant-numeric: tabular-nums;
137
+ }
138
+
139
+ .tooltip {
140
+ position: absolute;
141
+ bottom: calc(100% + 0.125rem);
142
+ transform: translateX(-50%);
143
+ padding: 0.0625rem 0.3125rem;
144
+ border: 1px solid var(--mndw-border);
145
+ border-radius: 0.1875rem;
146
+ background: var(--mndw-surface-raised);
147
+ color: var(--mndw-text);
148
+ font-size: 0.6875rem;
149
+ font-variant-numeric: tabular-nums;
150
+ max-width: calc(100% - 0.5rem);
151
+ white-space: normal;
152
+ overflow-wrap: anywhere;
153
+ pointer-events: none;
154
+ }
155
+ `;hoverIndex=null;emptyLabelState;valueLabelState;ariaLabelState;localeController=new L(this,{applyLocale:()=>{this.applyLocale()}});constructor(){super(),this.points=[],this.max=100,this.emptyLabel=void 0,this.valueLabel=void 0,this.valueFormatter=Dt,this.timeFormatter=Q,this.emptyLabelState=O(this,"emptyLabel","empty-label"),this.valueLabelState=O(this,"valueLabel","value-label"),this.ariaLabelState=X(this,"aria-label")}connectedCallback(){super.connectedCallback(),this.setAttribute("role","img")}updated(){this.ariaLabelState.setGenerated(this.computeAriaLabel()),this.positionTooltip()}positionTooltip(){let e=this.shadowRoot?.querySelector(".plot"),t=this.shadowRoot?.querySelector('[part="tooltip"]');if(e==null||t===null||t===void 0)return;let r=e.getBoundingClientRect(),n=t.getBoundingClientRect();if(r.width<=0||n.width<=0)return;let o=Number.parseFloat(t.style.left),a=Number.isFinite(o)?o/100*r.width:r.width/2,s=Mo(a,n.width,r.width);t.style.left=`${s}px`}render(){let e=this.samples();if(e.length===0)return u`
156
+ <div class="container" part="container">
157
+ <div class="empty" part="empty">${this.emptyLabel??y("chart.empty")}</div>
158
+ </div>
159
+ `;let t=this.tooltipState(e);return u`
160
+ <div class="container" part="container">
161
+ <div class="plot" part="plot">
162
+ <svg
163
+ part="plot"
164
+ viewBox="0 0 ${e.length} 1"
165
+ preserveAspectRatio="none"
166
+ aria-hidden="true"
167
+ @pointermove=${this.onPointerMove}
168
+ @pointerleave=${this.onPointerLeave}
169
+ >
170
+ ${e.map((r,n)=>this.renderSlice(r.value,n))}
171
+ ${this.hoverIndex===null?b:ce`
172
+ <rect
173
+ part="hover-cell"
174
+ fill="color-mix(in srgb, var(--mndw-text) 22%, transparent)"
175
+ pointer-events="none"
176
+ x=${this.hoverIndex}
177
+ y="0"
178
+ width="1.02"
179
+ height="1"
180
+ ></rect>
181
+ `}
182
+ </svg>
183
+ ${t===null?"":u`
184
+ <div class="tooltip" part="tooltip" style="left: ${t.left}%">${t.time===null?"":u`${t.time} · `}${this.valueFormatter(t.value)}</div>
185
+ `}
186
+ </div>
187
+ ${this.renderAxis(e)}
188
+ </div>
189
+ `}renderAxis(e){if(e.length===0||!e.every(n=>n.time!==void 0))return"";let t=e[0]?.time,r=e[e.length-1]?.time;return t===void 0||r===void 0||!Number.isFinite(t)||!Number.isFinite(r)?"":u`
190
+ <div class="axis" part="axis" aria-hidden="true">
191
+ <span>${this.timeFormatter(t)}</span>
192
+ <span>${this.timeFormatter(r)}</span>
193
+ </div>
194
+ `}renderSlice(e,t){let r=Nt(this.max),n=Eo(e,r),o=To(n/r*100);return ce`
195
+ <rect
196
+ class="slice"
197
+ style=${`fill: ${Ro(o)}`}
198
+ ?data-active=${t===this.hoverIndex}
199
+ x=${t}
200
+ y="0"
201
+ width="1.02"
202
+ height="1"
203
+ ></rect>
204
+ `}tooltipState(e){if(this.hoverIndex===null||this.hoverIndex<0||this.hoverIndex>=e.length)return null;let t=e[this.hoverIndex];return t===void 0?null:{left:(this.hoverIndex+.5)/e.length*100,value:t.value,time:t.time===void 0?null:this.timeFormatter(t.time)}}onPointerMove=e=>{let t=this.samples();if(t.length===0)return;let n=e.currentTarget.getBoundingClientRect();if(n.width<=0)return;let o=(e.clientX-n.left)/n.width,a=Math.min(t.length-1,Math.max(0,Math.floor(o*t.length)));a!==this.hoverIndex&&(this.hoverIndex=a,this.requestUpdate())};onPointerLeave=()=>{this.hoverIndex!==null&&(this.hoverIndex=null,this.requestUpdate())};samples(){return Ve(this.points)}computeAriaLabel(){return ye(this.samples(),this.valueLabel??y("chart.values"),this.valueFormatter)??this.emptyLabel??y("chart.empty")}applyLocale(){this.emptyLabelState.setGenerated(y("chart.empty")),this.valueLabelState.setGenerated(y("chart.values"))}};import*as _ from"d3";var Ar="mndw-line-chart",Ui=i=>`var(--mndw-${i})`,Ao=(i,e)=>{let t=e.getBoundingClientRect();return[i.clientX-t.left,i.clientY-t.top]},Be=class extends g{static shadowRootOptions={mode:"open"};static properties={series:{attribute:!1},bands:{attribute:!1},domain:{attribute:!1},valueDomain:{attribute:!1},emptyLabel:{type:String,attribute:"empty-label"},valueLabel:{type:String,attribute:"value-label"},valueFormatter:{attribute:!1},timeFormatter:{attribute:!1}};static styles=[$t,v`
205
+ .tooltip {
206
+ min-width: 7.5rem;
207
+ }
208
+ `];tooltipState=null;lastPointerPosition=null;emptyLabelState;valueLabelState;ariaLabelState;localeController=new L(this,{applyLocale:()=>{this.applyLocale()}});frame=new Se(this,e=>{this.drawChart(e)});constructor(){super(),this.series=[],this.bands=[],this.domain=void 0,this.valueFormatter=we,this.timeFormatter=Q,this.emptyLabelState=O(this,"emptyLabel","empty-label"),this.valueLabelState=O(this,"valueLabel","value-label"),this.ariaLabelState=X(this,"aria-label")}render(){let e=this.series.some(t=>U(t.data).length>0)||this.bands.some(t=>t.data.length>0);return It({hasContent:e,emptyLabel:this.emptyLabel??y("chart.empty"),tooltip:this.tooltipState,tooltipBody:this.tooltipState===null?"":u`
209
+ <div>${this.tooltipState.time}</div>
210
+ ${this.tooltipState.values.map(t=>u`<div>${t.label}: <strong>${t.value}</strong></div>`)}
211
+ `})}willUpdate(e){if(e.has("series")||e.has("bands")||e.has("domain")||e.has("valueDomain")||e.has("emptyLabel")||e.has("valueLabel")||e.has("valueFormatter")||e.has("timeFormatter")){let t=this.series.some(r=>U(r.data).length>0)||this.bands.some(r=>r.data.length>0);(this.lastPointerPosition===null||!t)&&(this.tooltipState=null),t||(this.lastPointerPosition=null)}}updated(e){(e.has("series")||e.has("bands")||e.has("domain")||e.has("valueDomain")||e.has("emptyLabel")||e.has("valueLabel")||e.has("valueFormatter")||e.has("timeFormatter")||this.frame.plotElement===null)&&(this.updateAccessibilityLabel(),this.drawChart())}disconnectedCallback(){this.lastPointerPosition=null,super.disconnectedCallback()}updateAccessibilityLabel(){this.ariaLabelState.setGenerated($i(this.series,this.emptyLabel??y("chart.empty"),this.valueFormatter,this.valueLabelState.dirty?this.valueLabel:void 0))}applyLocale(){this.emptyLabelState.setGenerated(y("chart.empty")),this.valueLabelState.setGenerated(y("chart.values"))}drawChart(e){let t=this.renderRoot.querySelector(".container");if(t===null)return;this.frame.observeContainer(t),this.frame.disconnectPlot();let r=t.querySelector("svg"),n=this.series.filter(w=>U(w.data).length>0),o=this.bands.filter(w=>w.data.length>0);if(r===null||n.length===0&&o.length===0)return;let a=t.getBoundingClientRect(),s=e?.width||a.width||400,l=e?.height||a.height||200,c=s<400,d=c?{top:6,right:40,bottom:22,left:58}:{top:10,right:60,bottom:30,left:72},h=n.length>0?n.flatMap(w=>U(w.data)):o.flatMap(w=>w.data.map(D=>({time:D.time,value:D.max}))),p=Oi(h,this.domain);if(p===null)return;let f=Math.max(...h.map(w=>w.value),1),m=this.valueDomain?.min??0,S=this.valueDomain?.max??Pt(f),x=_.scaleTime().domain([new Date(p.start),new Date(p.end)]).range([d.left,Math.max(s-d.right,d.left+1)]),E=_.scaleLinear().domain([m,S]).range([Math.max(l-d.bottom,d.top+1),d.top]),A=c?Math.max(8,Math.min(11,Math.floor(s/50))):Math.max(10,Math.min(13,Math.floor(s/50))),k=_.select(r).attr("width",s).attr("height",l);k.selectAll("*").remove();let si=_.line().x(w=>x(w.time)).y(w=>E(w.value)).curve(_.curveMonotoneX),gt=_.area().x(w=>x(w.time)).y0(E(m)).y1(w=>E(w.value)).curve(_.curveMonotoneX);for(let w of n){let D=Ui(w.color),C=w.segments?.map(P=>U(P.data))??Ni(w.data);for(let P of C.filter(I=>I.length>0))w.fill&&k.append("path").attr("data-color",w.color).style("fill",`color-mix(in srgb, ${D} 15%, transparent)`).attr("d",gt(P)),k.append("path").attr("data-color",w.color).style("fill","none").style("stroke",D).attr("stroke-width",2).attr("d",si(P))}for(let w of o){let D=_.area().x(C=>x(C.time)).y0(C=>E(C.min)).y1(C=>E(C.max)).curve(_.curveMonotoneX);k.append("path").attr("data-band",w.id).style("fill",`color-mix(in srgb, ${Ui(w.color)} 15%, transparent)`).attr("d",D(w.data))}k.append("g").attr("part","grid").attr("transform",`translate(${d.left}, 0)`).call(_.axisLeft(E).ticks(c?2:4).tickFormat(()=>"").tickSize(-(s-d.left-d.right))).selectAll("text").attr("font-size",A),k.append("g").attr("part","axis").attr("transform",`translate(${d.left}, 0)`).call(_.axisLeft(E).ticks(c?2:4).tickFormat(w=>w.valueOf()===0?"":this.valueFormatter(w.valueOf()))).selectAll("text").attr("font-size",A),k.append("g").attr("part","axis").attr("transform",`translate(0, ${l-d.bottom})`).call(_.axisBottom(x).tickValues(x.domain()).tickFormat(w=>{let D=w instanceof Date?w.getTime():w.valueOf();return this.timeFormatter(D)})).selectAll("text").attr("font-size",A);let ve=k.append("rect").attr("x",d.left).attr("y",d.top).attr("width",Math.max(s-d.left-d.right,1)).attr("height",Math.max(l-d.top-d.bottom,1)).attr("fill","transparent").style("cursor","crosshair"),_e=k.append("line").style("stroke","var(--mndw-text-subtle)").attr("pointer-events","none").attr("stroke-width",1).attr("stroke-dasharray","2,2").attr("y1",d.top).attr("y2",l-d.bottom).style("display","none"),z=(w,D)=>{if(w<d.left||w>s-d.right||D<d.top||D>l-d.bottom){this.lastPointerPosition=null,_e.style("display","none"),this.tooltipState=null,this.requestUpdate();return}this.lastPointerPosition=[w,D];let C=x.invert(w),P=n.map(ne=>{let sr=ne.data.reduce((yt,Pe)=>Math.abs(Pe.time-C.getTime())<Math.abs(yt.time-C.getTime())?Pe:yt);return{label:ne.label??ne.id,value:this.valueFormatter(sr.value)}});_e.style("display",null).attr("x1",w).attr("x2",w);let I=w+12,q=D-30;I+140>s&&(I=w-152),q<d.top&&(q=d.top+4),q+60>l-d.bottom&&(q=Math.max(d.top,l-d.bottom-64)),this.tooltipState={left:I,top:q,time:this.timeFormatter(C.getTime()),values:P},this.requestUpdate()},li=w=>{let[D,C]=Ao(w,r);z(D,C)};ve.on("mousemove.chart",li),ve.on("mouseleave.chart",()=>{this.lastPointerPosition=null,_e.style("display","none"),this.tooltipState=null,this.requestUpdate()}),this.frame.setPlot(r,()=>{ve.on(".chart",null)}),this.lastPointerPosition!==null&&z(...this.lastPointerPosition)}};function Bi(i,e,t,r,n){if(i.length===0||t<=0||r<=0||!(e>0))return[];let o=t/i.length,a=Math.max(1,o-n);return i.map((s,l)=>{let c=Math.min(Math.max(Number.isFinite(s)?s:0,0),e),d=Math.max(1,c/e*r);return{value:s,left:l*o,top:r-d,width:a,height:d}})}function Ki(i,e,t){if(t===0||e<=0)return null;let r=Math.floor(i/e*t);return Math.min(t-1,Math.max(0,r))}var Lr="mndw-sparkline",Ft=28,Lo=1,ko=240,_o=i=>`var(--mndw-${i})`,Ke=class extends g{static shadowRootOptions={mode:"open"};static properties={points:{attribute:!1},timeDomain:{attribute:!1},max:{type:Number},color:{type:String},emptyLabel:{type:String,attribute:"empty-label"},valueLabel:{type:String,attribute:"value-label"},valueFormatter:{attribute:!1},timeFormatter:{attribute:!1}};static styles=v`
212
+ :host {
213
+ display: block;
214
+ width: 100%;
215
+ height: 100%;
216
+ color: var(--mndw-text);
217
+ font-family: inherit;
218
+ }
219
+
220
+ .container {
221
+ display: flex;
222
+ flex-direction: column;
223
+ width: 100%;
224
+ height: 100%;
225
+ }
226
+
227
+ .plot {
228
+ position: relative;
229
+ flex: 1 1 auto;
230
+ width: 100%;
231
+ min-height: 1.75rem;
232
+ }
233
+
234
+ svg {
235
+ display: block;
236
+ width: 100%;
237
+ height: 100%;
238
+ }
239
+
240
+ .bar {
241
+ fill: var(--spark-fill, var(--mndw-accent));
242
+ }
243
+
244
+ .bar[data-active] {
245
+ fill: var(--mndw-text);
246
+ }
247
+
248
+ .frame {
249
+ stroke: var(--mndw-border);
250
+ stroke-width: 1;
251
+ stroke-dasharray: 2 2;
252
+ vector-effect: non-scaling-stroke;
253
+ }
254
+
255
+ .empty {
256
+ display: grid;
257
+ flex: 1 1 auto;
258
+ min-height: 1.75rem;
259
+ place-items: center;
260
+ color: var(--mndw-text-subtle);
261
+ font-size: 0.6875rem;
262
+ }
263
+
264
+ .axis {
265
+ display: flex;
266
+ justify-content: space-between;
267
+ margin-top: 0.125rem;
268
+ color: var(--mndw-text-subtle);
269
+ font-size: 0.625rem;
270
+ font-variant-numeric: tabular-nums;
271
+ }
272
+
273
+ .tooltip {
274
+ position: absolute;
275
+ bottom: calc(100% + 0.125rem);
276
+ transform: translateX(-50%);
277
+ padding: 0.0625rem 0.3125rem;
278
+ border: 1px solid var(--mndw-border);
279
+ border-radius: 0.1875rem;
280
+ background: var(--mndw-surface-raised);
281
+ color: var(--mndw-text);
282
+ font-size: 0.6875rem;
283
+ font-variant-numeric: tabular-nums;
284
+ white-space: nowrap;
285
+ pointer-events: none;
286
+ }
287
+ `;hoverIndex=null;chartWidth=0;resizeObserver=null;emptyLabelState;valueLabelState;ariaLabelState;localeController=new L(this,{applyLocale:()=>{this.applyLocale()}});constructor(){super(),this.points=[],this.timeDomain=void 0,this.max=100,this.color="accent",this.emptyLabel=void 0,this.valueLabel=void 0,this.valueFormatter=Dt,this.timeFormatter=Q,this.emptyLabelState=O(this,"emptyLabel","empty-label"),this.valueLabelState=O(this,"valueLabel","value-label"),this.ariaLabelState=X(this,"aria-label")}connectedCallback(){super.connectedCallback(),this.setAttribute("role","img"),this.observeSize()}disconnectedCallback(){this.resizeObserver?.disconnect(),this.resizeObserver=null,super.disconnectedCallback()}updated(){this.ariaLabelState.setGenerated(this.computeAriaLabel())}render(){if(this.samples().length===0)return u`
288
+ <div class="container" part="container">
289
+ <div class="empty" part="empty">${this.emptyLabel??y("chart.empty")}</div>
290
+ </div>
291
+ `;let t=this.layoutSamples(),r=this.plotWidth(),n=Bi(t.map(s=>s.value),Nt(this.max),r,Ft,Lo),o=this.tooltipState(n,t,r),a=Ot(this.color);return u`
292
+ <div class="container" part="container">
293
+ <div class="plot" style=${`--spark-fill: ${_o(a)}`}>
294
+ <svg
295
+ part="plot"
296
+ viewBox="0 0 ${r} ${Ft}"
297
+ preserveAspectRatio="none"
298
+ aria-hidden="true"
299
+ @pointermove=${this.onPointerMove}
300
+ @pointerleave=${this.onPointerLeave}
301
+ >
302
+ ${n.map((s,l)=>this.renderBar(s,l))}
303
+ <line class="frame" x1="0" x2=${r} y1="0.5" y2="0.5"></line>
304
+ <line class="frame" x1="0" x2=${r} y1=${Ft-.5} y2=${Ft-.5}></line>
305
+ </svg>
306
+ ${o===null?"":u`
307
+ <div class="tooltip" part="tooltip" style="left: ${o.left}px">${o.time===null?"":u`${o.time} · `}${this.valueFormatter(o.value)}</div>
308
+ `}
309
+ </div>
310
+ ${this.renderAxis(t)}
311
+ </div>
312
+ `}renderBar(e,t){return Number.isFinite(e.value)?ce`
313
+ <rect
314
+ class="bar"
315
+ ?data-active=${t===this.hoverIndex}
316
+ x=${e.left}
317
+ y=${e.top}
318
+ width=${e.width}
319
+ height=${e.height}
320
+ ></rect>
321
+ `:""}renderAxis(e){if(!e.every(n=>n.time!==void 0))return"";let t=this.timeDomain?.start??e[0]?.time,r=this.timeDomain?.end??e[e.length-1]?.time;return t==null||!Number.isFinite(t)||r===null||r===void 0||!Number.isFinite(r)||t>r?"":u`
322
+ <div class="axis" part="axis" aria-hidden="true">
323
+ <span>${this.timeFormatter(t)}</span>
324
+ <span>${this.timeFormatter(r)}</span>
325
+ </div>
326
+ `}tooltipState(e,t,r){if(this.hoverIndex===null||this.hoverIndex<0||this.hoverIndex>=e.length)return null;let n=e[this.hoverIndex],o=t[this.hoverIndex];return o===void 0||!Number.isFinite(o.value)?null:{left:(n.left+n.width/2)/r*(this.chartWidth||r),value:o.value,time:o.time===void 0?null:this.timeFormatter(o.time)}}onPointerMove=e=>{let t=this.layoutSamples();if(t.length===0)return;let n=e.currentTarget.getBoundingClientRect(),o=Ki(e.clientX-n.left,n.width,t.length);o!==this.hoverIndex&&(this.hoverIndex=o,this.requestUpdate())};onPointerLeave=()=>{this.hoverIndex!==null&&(this.hoverIndex=null,this.requestUpdate())};observeSize(){typeof ResizeObserver>"u"||this.resizeObserver!==null||(this.resizeObserver=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??0;t!==this.chartWidth&&(this.chartWidth=t,this.requestUpdate())}),this.resizeObserver.observe(this))}plotWidth(){return this.chartWidth>0?this.chartWidth:ko}samples(){return Ve(this.points)}layoutSamples(){return this.timeDomain===void 0?this.samples():this.points.flatMap(e=>e.time===void 0||!Number.isFinite(e.time)?[]:[{time:e.time,value:e.value}])}computeAriaLabel(){return ye(this.samples(),this.valueLabel??y("chart.values"),this.valueFormatter)??this.emptyLabel??y("chart.empty")}applyLocale(){this.emptyLabelState.setGenerated(y("chart.empty")),this.valueLabelState.setGenerated(y("chart.values"))}};var Gi=0,ee=class{host;baseId;generatedIds=new Map;constructor(e){this.host=e,this.baseId=`mndw-${e.localName}-${Gi}`,Gi+=1}sync(e,t=null){let r=new Set,n=e.map((o,a)=>{if(o.id===""){let s=this.generatedIds.get(o);if(s!==void 0)o.id=s;else{let l=a;for(;r.has(`${this.baseId}-label-${l}`);)l+=1;let c=`${this.baseId}-label-${l}`;this.generatedIds.set(o,c),o.id=c}}return r.add(o.id),o.id});n.length===0?this.host.removeAttribute("aria-labelledby"):this.host.setAttribute("aria-labelledby",n.join(" ")),t!==null&&(t.ariaLabelledByElements=Array.from(e))}},N=class{internals;host;options;fieldsetDisabled=!1;initialAttributes=null;constructor(e,t){this.host=e,this.options=t,this.internals=typeof e.attachInternals=="function"?e.attachInternals():null}get form(){return this.internals?.form??null}get labels(){let e=this.internals?.labels;return e?Array.from(e):[]}get effectiveDisabled(){return this.options.isExplicitlyDisabled()||this.fieldsetDisabled}captureInitialAttributes(e){this.initialAttributes||(this.initialAttributes=new Map(e.map(t=>[t,this.host.getAttribute(t)])))}restoreInitialAttributes(){if(this.initialAttributes)for(let[e,t]of this.initialAttributes)t===null?this.host.removeAttribute(e):this.host.setAttribute(e,t)}formDisabledCallback(e){this.fieldsetDisabled=e,this.options.onDisabledChange?.(this.effectiveDisabled)}formResetCallback(){this.restoreInitialAttributes(),this.options.onReset()}formStateRestoreCallback(e,t){this.options.onStateRestore(e,t)}setFormValue(e,t){this.internals&&(t===void 0?this.internals.setFormValue(e):this.internals.setFormValue(e,t))}setValidity(e,t="",r){this.internals&&(Object.keys(e).length===0?this.internals.setValidity({}):this.internals.setValidity(e,t,r))}clearValidity(){this.setValidity({})}};var R=v`
327
+ outline: var(--mndw-focus-w) solid var(--mndw-focus-ring);
328
+ outline-offset: 0.0625rem;
329
+ `,Ce=v`
330
+ border-color: var(--mndw-text-subtle);
331
+ `,$=v`
332
+ background: var(--mndw-surface-hover);
333
+ `,Me=v`
334
+ background: var(--mndw-control-hover);
335
+ `,te=v`
336
+ border-color: var(--mndw-accent-hover);
337
+ background: var(--mndw-accent-hover);
338
+ `,re=v`
339
+ color: var(--mndw-text);
340
+ `,B=v`
341
+ box-sizing: border-box;
342
+ min-height: var(--mndw-control-h);
343
+ padding: 0 var(--mndw-space-3);
344
+ border-radius: var(--mndw-radius-md);
345
+ font-family: inherit;
346
+ font-size: inherit;
347
+ line-height: var(--mndw-leading);
348
+ `,M=v`
349
+ font-family: var(--mndw-font-sans);
350
+ font-size: var(--mndw-text-sm);
351
+ `;var kr="mndw-button",Ge=class extends g{static formAssociated=!0;static shadowRootOptions={mode:"open",delegatesFocus:!0};static properties={variant:{type:String,reflect:!0},disabled:{type:Boolean,reflect:!0},type:{type:String},ariaLabel:{type:String,attribute:"aria-label"}};static styles=v`
352
+ :host {
353
+ ${M}
354
+
355
+ display: inline-block;
356
+ }
357
+
358
+ :host([disabled]) {
359
+ pointer-events: none;
360
+ opacity: 0.5;
361
+ }
362
+
363
+ button {
364
+ ${B}
365
+
366
+ display: inline-flex;
367
+ gap: var(--mndw-space-2);
368
+ align-items: center;
369
+ justify-content: center;
370
+ border: 1px solid transparent;
371
+ font-weight: var(--mndw-weight-semibold);
372
+ cursor: pointer;
373
+ }
374
+
375
+ button:focus-visible {
376
+ ${R}
377
+ }
378
+
379
+ :host([variant='primary']) button {
380
+ border-color: var(--mndw-accent);
381
+ background: var(--mndw-accent);
382
+ color: var(--mndw-accent-contrast);
383
+ }
384
+
385
+ :host([variant='primary']) button:not(:disabled):hover {
386
+ ${te}
387
+ }
388
+
389
+ :host([variant='secondary']) button {
390
+ border-color: var(--mndw-border);
391
+ background: var(--mndw-surface-raised);
392
+ color: var(--mndw-text);
393
+ }
394
+
395
+ :host([variant='secondary']) button:not(:disabled):hover {
396
+ ${$}
397
+ border-color: var(--mndw-text-subtle);
398
+ }
399
+
400
+ :host([variant='ghost']) button {
401
+ background: transparent;
402
+ color: var(--mndw-text-subtle);
403
+ }
404
+
405
+ :host([variant='ghost']) button:not(:disabled):hover {
406
+ ${Me}
407
+ ${re}
408
+ }
409
+
410
+ /*
411
+ * A tint, not a solid fill: the palette models danger as a foreground and emits no
412
+ * dangerContrast pair, so filling the button with it would be an unvalidated combination.
413
+ */
414
+ :host([variant='danger']) button {
415
+ border-color: var(--mndw-danger);
416
+ background: var(--mndw-danger-bg);
417
+ color: var(--mndw-danger);
418
+ }
419
+
420
+ :host([variant='danger']) button:not(:disabled):hover {
421
+ background: color-mix(in srgb, var(--mndw-danger) 12%, var(--mndw-danger-bg));
422
+ }
423
+ `;formState=new N(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>{},onStateRestore:()=>{},onDisabledChange:()=>{this.requestUpdate()}});constructor(){super(),this.variant="secondary",this.disabled=!1,this.type="button",this.ariaLabel="",this.addEventListener("click",this.onClick)}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}render(){return u`
424
+ <button
425
+ part="button"
426
+ type="button"
427
+ aria-label=${this.ariaLabel||b}
428
+ ?disabled=${this.formState.effectiveDisabled}
429
+ >
430
+ <slot></slot>
431
+ </button>
432
+ `}updated(){let e=this.renderRoot.querySelector("button");e&&(e.disabled=this.formState.effectiveDisabled)}onClick=e=>{if(this.formState.effectiveDisabled){e.preventDefault();return}let t=this.formState.form;t&&(this.type==="submit"?t.requestSubmit():this.type==="reset"&&t.reset())}};var Vt="mndw-field",Ht="mndwlabelchange";function ue(i){i.dispatchEvent(new Event(Ht,{bubbles:!0,composed:!0}))}var Po=new Set(["button","input","meter","output","progress","select","textarea"]),Do=/\s+/u,Wi=0;function _r(i){let e=i.getRootNode();return typeof e.querySelectorAll=="function"?e:null}function qi(i,e){return(i.getAttribute(e)??"").split(Do).filter(t=>t!=="")}var We=class extends H{static properties={label:{type:String},hint:{type:String},error:{type:String},required:{type:Boolean,reflect:!0}};fieldId;observer;ownedTokens=new Map;ownedAttributes=new Map;ownedNodes=null;control=null;ownsControlId=!1;constructor(){super(),Wi+=1,this.fieldId=`mndw-field-${Wi}`,this.label="",this.hint="",this.error="",this.required=!1,this.observer=new MutationObserver(this.onMutations)}connectedCallback(){super.connectedCallback(),this.ownedNodes??=this.createOwnedNodes(),this.classList.add("mndw-field"),this.addEventListener(Ht,this.onLabelChange),this.observe(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(Ht,this.onLabelChange),this.observer.disconnect(),this.releaseControl()}createRenderRoot(){return this}updated(){this.wire()}createOwnedNodes(){let e=document.createElement("label"),t=document.createTextNode(""),r=document.createElement("span"),n=document.createElement("div"),o=document.createElement("div");return e.className="mndw-field__label",e.id=`${this.fieldId}-label`,r.className="mndw-field__required",r.setAttribute("aria-hidden","true"),r.textContent=" *",r.hidden=!0,e.append(t,r),n.className="mndw-field__hint",n.id=`${this.fieldId}-hint`,n.hidden=!0,o.className="mndw-field__error",o.id=`${this.fieldId}-error`,o.setAttribute("role","alert"),o.hidden=!0,{label:e,text:t,marker:r,hint:n,error:o}}wire(){let e=this.ownedNodes;if(!e||!this.isConnected)return;this.placeOwnedNodes(e);let t=this.resolveControl(e);t!==this.control&&(this.releaseControl(),this.control=t,this.observe());let r=this.label.trim()!==""&&(t===null||!this.hasOwnLabel(t,e));if(e.text.textContent=this.label,e.marker.hidden=!this.required,e.label.hidden=!r,e.hint.textContent=this.hint,e.hint.hidden=this.hint==="",e.error.textContent=this.error,e.error.hidden=this.error==="",!t){e.label.removeAttribute("for");return}this.syncControlId(t),this.syncLabelAssociation(t,e,r),this.syncDescriptions(t,e),this.syncStates(t)}placeOwnedNodes(e){this.firstChild!==e.label&&this.insertBefore(e.label,this.firstChild),this.lastChild!==e.error&&this.appendChild(e.error),e.error.previousSibling!==e.hint&&this.insertBefore(e.hint,e.error)}resolveControl(e){for(let t of this.childNodes)if(t.nodeType===Node.ELEMENT_NODE&&!this.isOwnedNode(t,e))return t;return null}syncControlId(e){let t=`${this.fieldId}-control`;e.id===""?(e.id=t,this.ownsControlId=!0):e.id!==t&&(this.ownsControlId=!1)}syncLabelAssociation(e,t,r){if(r&&this.isLabelable(e)){let a=t.label.htmlFor;t.label.htmlFor=e.id;let s=this.syncTokens(e,"aria-labelledby",[]);(a!==t.label.htmlFor||s)&&this.refreshAccessibleName(e);return}let n=t.label.hasAttribute("for");t.label.removeAttribute("for");let o=this.syncTokens(e,"aria-labelledby",r?[t.label.id]:[]);(n||o)&&this.refreshAccessibleName(e)}refreshAccessibleName(e){e.refreshAccessibleName?.call(e)}syncDescriptions(e,t){let r=[];this.hint!==""&&r.push(t.hint.id),this.error!==""&&r.push(t.error.id),this.syncTokens(e,"aria-describedby",r)}syncStates(e){this.error!==""?this.setOwnedAttribute(e,"aria-invalid","true"):this.clearOwnedAttribute(e,"aria-invalid"),this.required?this.setOwnedAttribute(e,"required",""):this.clearOwnedAttribute(e,"required")}syncTokens(e,t,r){let n=this.ownedTokens.get(t)??new Set,o=qi(e,t).filter(c=>!n.has(c)),a=[...o,...r.filter(c=>!o.includes(c))];if(r.length===0?this.ownedTokens.delete(t):this.ownedTokens.set(t,new Set(r)),a.length===0){let c=e.hasAttribute(t);return e.removeAttribute(t),c}let s=a.join(" "),l=e.getAttribute(t)!==s;return l&&e.setAttribute(t,s),l}setOwnedAttribute(e,t,r){this.ownedAttributes.has(t)||this.ownedAttributes.set(t,e.getAttribute(t)),e.getAttribute(t)!==r&&e.setAttribute(t,r)}clearOwnedAttribute(e,t){if(!this.ownedAttributes.has(t))return;let r=this.ownedAttributes.get(t)??null;this.ownedAttributes.delete(t),r===null?e.removeAttribute(t):e.setAttribute(t,r)}releaseControl(){let e=this.control;if(e){for(let t of[...this.ownedTokens.keys()])this.syncTokens(e,t,[]);for(let t of[...this.ownedAttributes.keys()])this.clearOwnedAttribute(e,t);this.ownsControlId&&e.id===`${this.fieldId}-control`&&e.removeAttribute("id"),this.ownedNodes?.label.removeAttribute("for"),this.ownsControlId=!1,this.control=null}}hasOwnLabel(e,t){return(e.getAttribute("aria-label")??"").trim()!==""||this.hasResolvedLabelledBy(e,t)||this.associatedLabels(e,t).length>0?!0:this.hasControlLabelSource(e)}hasResolvedLabelledBy(e,t){let r=_r(e);if(!r)return!1;let n=[...r.querySelectorAll("[id]")];return qi(e,"aria-labelledby").some(a=>n.some(s=>s.id===a&&s!==t.label))}associatedLabels(e,t){let r=_r(e);return r?[...r.querySelectorAll("label")].filter(n=>n!==t.label&&this.labelsControl(n,e)):[]}labelsControl(e,t){return e.control===t?!0:e.control===null&&e.htmlFor!==""&&e.htmlFor===t.id&&this.isLabelable(t)}hasControlLabelSource(e){let t=e.constructor.mndwLabelSource;if(t==="label-property"){let r=e.label;return typeof r=="string"&&r.trim()!==""}return t==="slot"?(e.textContent??"").trim()!=="":!1}isLabelable(e){return Po.has(e.localName)?e.localName!=="input"||e.getAttribute("type")!=="hidden":e.constructor.formAssociated===!0}isOwnedNode(e,t){return e===t.label||e===t.hint||e===t.error||t.label.contains(e)||t.hint.contains(e)||t.error.contains(e)}observe(){if(!this.isConnected)return;this.observer.disconnect(),this.observer.observe(this,{childList:!0,subtree:!0,characterData:!0});let e=this.control;if(!e)return;this.observer.observe(e,{attributes:!0,attributeFilter:["id","aria-label","aria-labelledby"]});let t=_r(e);t&&this.observer.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["for"]})}onMutations=e=>{let t=this.ownedNodes;if(!t)return;e.some(n=>this.isRelevantMutation(n,t))&&this.requestUpdate()};isRelevantMutation(e,t){return this.isOwnedNode(e.target,t)||this.isInAnotherField(e.target)?!1:e.type!=="childList"?!0:[...e.addedNodes,...e.removedNodes].some(n=>!this.isOwnedNode(n,t)&&!this.isInAnotherField(n))}isInAnotherField(e){let r=(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(Vt);return r!=null&&r!==this}onLabelChange=()=>{this.requestUpdate()}};var Pr="mndw-checkbox",qe=class extends g{static formAssociated=!0;static mndwLabelSource="slot";static properties={checked:{type:Boolean,reflect:!0},indeterminate:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},value:{type:String,reflect:!0},name:{type:String,reflect:!0}};static styles=v`
433
+ :host {
434
+ ${M}
435
+
436
+ display: inline-flex;
437
+ align-items: center;
438
+ gap: var(--mndw-space-2);
439
+ color: var(--mndw-text);
440
+ cursor: pointer;
441
+ user-select: none;
442
+ }
443
+
444
+ :host([disabled]) {
445
+ color: var(--mndw-text-muted);
446
+ cursor: not-allowed;
447
+ opacity: 0.65;
448
+ }
449
+
450
+ [part='label'] {
451
+ cursor: pointer;
452
+ }
453
+
454
+ :host([disabled]) [part='label'] {
455
+ cursor: not-allowed;
456
+ }
457
+
458
+ [part='box'] {
459
+ position: relative;
460
+ display: inline-grid;
461
+ width: 1.125rem;
462
+ height: 1.125rem;
463
+ place-items: center;
464
+ border: 1px solid var(--mndw-border);
465
+ border-radius: var(--mndw-radius-sm);
466
+ background: var(--mndw-surface);
467
+ color: var(--mndw-accent-contrast);
468
+ flex: 0 0 auto;
469
+ }
470
+
471
+ :host([checked]) [part='box'],
472
+ :host([indeterminate]) [part='box'] {
473
+ border-color: var(--mndw-accent);
474
+ background: var(--mndw-accent);
475
+ }
476
+
477
+ :host(:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true']):hover) [part='box'] {
478
+ ${$}
479
+ }
480
+
481
+ :host([checked]:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true']):hover) [part='box'],
482
+ :host([indeterminate]:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true']):hover) [part='box'] {
483
+ ${te}
484
+ }
485
+
486
+ [part='mark'] {
487
+ position: absolute;
488
+ top: 50%;
489
+ left: 50%;
490
+ transform: translate(-50%, -50%);
491
+ display: block;
492
+ visibility: hidden;
493
+ font-size: var(--mndw-text-md);
494
+ font-weight: var(--mndw-weight-semibold);
495
+ line-height: 1;
496
+ }
497
+
498
+ :host([checked]:not([indeterminate])) [part='mark'] {
499
+ visibility: visible;
500
+ }
501
+
502
+ :host([indeterminate]) [part='mark'] {
503
+ visibility: visible;
504
+ width: 0.5625rem;
505
+ height: 0.125rem;
506
+ background: currentColor;
507
+ font-size: 0;
508
+ }
509
+
510
+ :host(:focus-visible) {
511
+ outline: none;
512
+ }
513
+
514
+ :host(:focus-visible) [part='box'] {
515
+ ${R}
516
+ }
517
+ `;formState=new N(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});labelController=new ee(this);labelObserver;labelSlot=null;localeController=new L(this);constructor(){super(),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this.required=!1,this.invalid=!1,this.value="on",this.name="",this.labelObserver=new MutationObserver(()=>{ue(this)}),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["checked"]),this.labelObserver.observe(this,{childList:!0,subtree:!0,characterData:!0})}disconnectedCallback(){this.labelObserver.disconnect(),this.labelSlot?.removeEventListener("slotchange",this.onLabelSlotChange),this.labelSlot=null,super.disconnectedCallback()}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}render(){return u`
518
+ <div
519
+ part="box"
520
+ aria-hidden="true"
521
+ >
522
+ <span part="mark"><mndw-icon name="check"></mndw-icon></span>
523
+ </div>
524
+ <slot part="label"></slot>
525
+ `}updated(){let e=this.shadowRoot?.querySelector('slot[part="label"]')??null;e!==this.labelSlot&&(this.labelSlot?.removeEventListener("slotchange",this.onLabelSlotChange),e?.addEventListener("slotchange",this.onLabelSlotChange),this.labelSlot=e);let t=this.indeterminate?"mixed":String(this.checked),r=this.formState.effectiveDisabled;this.setAttribute("role","checkbox"),this.setAttribute("aria-checked",t),this.setAttribute("aria-disabled",String(r)),this.setAttribute("aria-required",String(this.required)),this.tabIndex=r?-1:0;let n=this.formState.labels;this.labelController.sync(n,this.formState.internals),this.formState.internals?.setFormValue(this.checked?this.value:null,this.indeterminate?"indeterminate":this.checked?"checked":"unchecked"),this.formState.internals&&(this.formState.internals.role="checkbox",this.formState.internals.ariaChecked=t,this.formState.internals.ariaDisabled=String(r),this.formState.internals.ariaRequired=String(this.required),this.checked?this.formState.internals.states.add("checked"):this.formState.internals.states.delete("checked")),this.required&&!this.checked?this.formState.setValidity({valueMissing:!0},y("checkbox.validation.required")):this.formState.clearValidity();let o=this.invalid||this.required&&!this.checked||this.formState.internals?.validity?.valid===!1;this.setAttribute("aria-invalid",String(o)),this.formState.internals&&(this.formState.internals.ariaInvalid=String(o))}onLabelSlotChange=()=>{ue(this)};handleClick=e=>{if(this.formState.effectiveDisabled){e.preventDefault();return}this.toggle()};handleKeyDown=e=>{this.formState.effectiveDisabled||e.key!==" "||(e.preventDefault(),this.toggle())};toggle(){this.indeterminate=!1,this.checked=!this.checked,this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{checked:this.checked,indeterminate:this.indeterminate}}))}resetForm=()=>{this.checked=this.hasAttribute("checked"),this.indeterminate=!1};restoreFormState=e=>{typeof e=="string"&&(e==="checked"?(this.checked=!0,this.indeterminate=!1):e==="unchecked"?(this.checked=!1,this.indeterminate=!1):e==="indeterminate"&&(this.checked=!1,this.indeterminate=!0))}};var ji=["activity","arrow-down","arrow-left","arrow-right","arrow-up","arrow-up-down","check","chevron-down","chevron-left","chevron-right","chevron-up","circle-alert","circle-arrow-up","circle-question-mark","circle-x","copy","download","ellipsis","ellipsis-vertical","eye","eye-off","info","log-out","menu","minus","moon","pencil","plus","refresh-cw","search","settings","sun","trash","unlink","x"],No=new Set(ji);function Yi(i){return No.has(i)}var Xi=Symbol.for("mndw.ui.iconSprite"),Ji=globalThis;function Dr(){let i=Ji[Xi];if(i!==void 0)return i;let e={url:"",listeners:new Set};return Ji[Xi]=e,e}function Zi(){return Dr().url}function Qi(i){if(i.includes("#"))throw new Error(`iconSpriteUrl must not contain a fragment reference: "${i}"`);let e=Dr();if(i!==e.url){e.url=i;for(let t of[...e.listeners])t()}}function Nr(i){let e=Dr().listeners;return e.add(i),()=>{e.delete(i)}}var Or="mndw-icon",Oo="0 0 24 24";function en(i){let e=Zi();return e===""?"":`${e}#mndw-icon-${i}`}var je=class extends g{static properties={name:{type:String,reflect:!0},label:{type:String,reflect:!0}};static styles=v`
526
+ :host {
527
+ display: inline-block;
528
+ width: 1em;
529
+ height: 1em;
530
+ flex: none;
531
+ vertical-align: -0.125em;
532
+ }
533
+
534
+ svg {
535
+ display: block;
536
+ width: 100%;
537
+ height: 100%;
538
+ }
539
+ `;constructor(){super(),this.name="",this.label=""}_unsubscribe=null;_onSpriteUrlChange=()=>{this.requestUpdate()};connectedCallback(){super.connectedCallback(),this._unsubscribe?.(),this._unsubscribe=Nr(this._onSpriteUrlChange),this.requestUpdate()}disconnectedCallback(){this._unsubscribe?.(),this._unsubscribe=null,super.disconnectedCallback()}render(){let e=this._href(),t=this.label!=="";return u`
540
+ <svg
541
+ part="svg"
542
+ viewBox=${Oo}
543
+ role="img"
544
+ focusable="false"
545
+ aria-hidden=${t?b:"true"}
546
+ aria-label=${t?this.label:b}
547
+ >
548
+ ${e===""?b:ce`<use href=${e}></use>`}
549
+ </svg>
550
+ `}_href(){return Yi(this.name)?en(this.name):""}};var $o=["id","aria-label","aria-labelledby","aria-describedby","aria-invalid","aria-required"],nn=/\s+/u,Io=/\s+/gu,Fo="ariaDescription"in Element.prototype;function tn(i){let e=i.getRootNode();return typeof e.querySelectorAll=="function"?e:null}function on(i,e){return typeof i.getElementById=="function"?i.getElementById(e):i.querySelector(`[id="${e}"]`)}function F(i,e,t){if(t===""){i.removeAttribute(e);return}i.getAttribute(e)!==t&&i.setAttribute(e,t)}function $r(i){return(i??"").replace(Io," ").trim()}function Ir(i){if(i.nodeType===Node.TEXT_NODE)return i.textContent??"";if(i.nodeType!==Node.ELEMENT_NODE||i.getAttribute("aria-hidden")==="true")return"";let e="";for(let t of i.childNodes)e+=Ir(t);return e}function Ho(i){return i.map(e=>$r(Ir(e))).filter(e=>e!=="").join(" ")}function rn(i,e){return!i||e===null?"":e.split(nn).filter(t=>t!=="").map(t=>on(i,t)).filter(t=>t!==null).map(t=>$r(Ir(t))).filter(t=>t!=="").join(" ")}function Vo(i,e,t=Fo){return t?i:[i,e].filter(r=>r!=="").join(" ")}function zt(i){return{badInput:i.badInput,patternMismatch:i.patternMismatch,rangeOverflow:i.rangeOverflow,rangeUnderflow:i.rangeUnderflow,stepMismatch:i.stepMismatch,tooLong:i.tooLong,tooShort:i.tooShort,typeMismatch:i.typeMismatch,valueMissing:i.valueMissing}}var Ee=class{host;options;hostObserver;referenceObserver;constructor(e,t){this.host=e,this.options=t,this.hostObserver=new MutationObserver(this.onMutation),this.referenceObserver=new MutationObserver(this.onMutation)}connect(){this.hostObserver.observe(this.host,{attributes:!0,attributeFilter:$o})}disconnect(){this.hostObserver.disconnect(),this.referenceObserver.disconnect()}get hasAriaRequired(){return this.host.getAttribute("aria-required")==="true"}get labels(){let e=this.options.formState.labels;if(e.length>0)return e;let t=tn(this.host);return!t||this.host.id===""?[]:[...t.querySelectorAll("label")].filter(r=>r.htmlFor===this.host.id)}sync(e){let t=this.labels,r=tn(this.host),n=this.resolveName(t,r),o=rn(r,this.host.getAttribute("aria-describedby"));F(e,"aria-label",Vo(n,o)),F(e,"aria-description",o),F(e,"aria-invalid",this.announcedInvalid()?"true":""),this.observeReferences(t,r)}resolveName(e,t){return this.host.hasAttribute("aria-labelledby")?rn(t,this.host.getAttribute("aria-labelledby")):this.host.hasAttribute("aria-label")?$r(this.host.getAttribute("aria-label")):Ho(e)}announcedInvalid(){let e=this.host.getAttribute("aria-invalid");return e!==null?e!=="false":this.options.isInvalid()?!0:this.options.formState.internals?.validity.valid===!1}observeReferences(e,t){this.referenceObserver.disconnect();let r=new Set(e);for(let n of["aria-labelledby","aria-describedby"]){let o=this.host.getAttribute(n);if(!(o===null||!t))for(let a of o.split(nn).filter(s=>s!=="")){let s=on(t,a);s&&r.add(s)}}for(let n of r)this.referenceObserver.observe(n,{childList:!0,subtree:!0,characterData:!0})}onMutation=()=>{this.host.requestUpdate()}},Te=class{onCommit;baseline=null;fromUserInput=!1;constructor(e){this.onCommit=e}captureBaseline(e){this.baseline=e}releaseBaseline(){this.baseline=null}markUserInput(){this.fromUserInput=!0}syncValue(e){if(this.fromUserInput){this.fromUserInput=!1;return}this.baseline!==null&&(this.baseline=e)}commit(e){this.baseline===null||this.baseline===e||(this.baseline=e,this.onCommit(e))}};var Fr="mndw-input",an=["text","password","search","number","url"],Ye=class extends g{static formAssociated=!0;static shadowRootOptions={mode:"open",delegatesFocus:!0};static properties={value:{type:String},type:{type:String,reflect:!0},placeholder:{type:String,reflect:!0},autocomplete:{type:String,reflect:!0},readonly:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},name:{type:String,reflect:!0},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},step:{type:Number,reflect:!0},maxlength:{type:Number,reflect:!0}};static styles=v`
551
+ :host {
552
+ ${M}
553
+
554
+ display: inline-block;
555
+ width: 100%;
556
+ }
557
+
558
+ :host([disabled]) {
559
+ opacity: 0.5;
560
+ }
561
+
562
+ [part='field'] {
563
+ ${B}
564
+
565
+ display: flex;
566
+ gap: var(--mndw-space-2);
567
+ align-items: center;
568
+ width: 100%;
569
+ border: var(--mndw-border-w) solid var(--mndw-border);
570
+ background: var(--mndw-surface-raised);
571
+ color: var(--mndw-text);
572
+ }
573
+
574
+ :host(:not([disabled]):not([readonly]):not([invalid]):not([aria-invalid='true'])) [part='field']:hover {
575
+ ${Ce}
576
+ }
577
+
578
+ :host(:focus-within) [part='field'] {
579
+ ${R}
580
+ }
581
+
582
+ input {
583
+ width: 100%;
584
+ padding: 0;
585
+ border: 0;
586
+ background: none;
587
+ color: inherit;
588
+ font: inherit;
589
+ line-height: var(--mndw-leading);
590
+ }
591
+
592
+ input:focus {
593
+ outline: none;
594
+ }
595
+
596
+ input::placeholder {
597
+ color: var(--mndw-text-subtle);
598
+ }
599
+
600
+ [part='prefix'],
601
+ [part='suffix'] {
602
+ display: inline-flex;
603
+ align-items: center;
604
+ color: var(--mndw-text-subtle);
605
+ }
606
+
607
+ [part='prefix'][hidden],
608
+ [part='suffix'][hidden] {
609
+ display: none;
610
+ }
611
+
612
+ [part='password-toggle'] {
613
+ display: inline-flex;
614
+ align-items: center;
615
+ justify-content: center;
616
+ flex-shrink: 0;
617
+ padding: var(--mndw-space-1);
618
+ border: 0;
619
+ border-radius: var(--mndw-radius-sm);
620
+ background: none;
621
+ color: var(--mndw-text-subtle);
622
+ cursor: pointer;
623
+ font: inherit;
624
+ }
625
+
626
+ :host(:not([disabled]):not([readonly]):not([invalid]):not([aria-invalid='true'])) [part='password-toggle']:hover {
627
+ ${re}
628
+ }
629
+
630
+ [part='password-toggle'] mndw-icon {
631
+ width: 16px;
632
+ height: 16px;
633
+ }
634
+
635
+ :host([disabled]) [part='password-toggle'] {
636
+ pointer-events: none;
637
+ }
638
+ `;formState=new N(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});announcement=new Ee(this,{formState:this.formState,isInvalid:()=>this.invalid});commits=new Te(e=>this.emitChange(e));localeController=new L(this);_showPassword=!1;constructor(){super(),this.value="",this.type="text",this.placeholder="",this.autocomplete="",this.readonly=!1,this.disabled=!1,this.required=!1,this.invalid=!1,this.name="",this.min=null,this.max=null,this.step=null,this.maxlength=null}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["value"]),this.announcement.connect(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.announcement.disconnect()}refreshAccessibleName(){this.requestUpdate()}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}focus(e){this.innerInput?.focus(e)}render(){return u`
639
+ <div part="field">
640
+ <slot name="prefix" part="prefix" @slotchange=${this.onAdornmentSlotChange}></slot>
641
+ <input
642
+ part="input"
643
+ type=${this._effectiveType}
644
+ @input=${this.onInnerInput}
645
+ @focus=${this.onInnerFocus}
646
+ @blur=${this.onInnerBlur}
647
+ @keydown=${this.onInnerKeyDown}
648
+ />
649
+ ${this.type==="password"?this._renderPasswordToggle():b}
650
+ <slot name="suffix" part="suffix" @slotchange=${this.onAdornmentSlotChange}></slot>
651
+ </div>
652
+ `}updated(e){this.syncAdornmentSlots();let t=this.innerInput;t&&(this.syncInner(t),e.has("value")&&this.commits.syncValue(this.value),this.syncFormState(t),this.announcement.sync(t))}syncAdornmentSlots(){let e=this.renderRoot.querySelectorAll('slot[name="prefix"], slot[name="suffix"]');for(let t of e)this.syncAdornmentSlot(t)}syncAdornmentSlot(e){e.hidden=e.assignedNodes().length===0}onAdornmentSlotChange=e=>{let t=e.currentTarget;t&&this.syncAdornmentSlot(t)};get innerInput(){return this.renderRoot.querySelector("input")}get resolvedType(){return an.includes(this.type)?this.type:"text"}get _effectiveType(){return this.type==="password"&&this._showPassword?"text":this.resolvedType}syncInner(e){F(e,"placeholder",this.placeholder),F(e,"autocomplete",this.autocomplete),F(e,"min",this.min===null?"":String(this.min)),F(e,"max",this.max===null?"":String(this.max)),F(e,"step",this.step===null?"":String(this.step)),F(e,"maxlength",this.maxlength===null?"":String(this.maxlength)),e.toggleAttribute("readonly",this.readonly),e.toggleAttribute("disabled",this.formState.effectiveDisabled),e.toggleAttribute("required",this.required||this.announcement.hasAriaRequired),e.value!==this.value&&(e.value=this.value)}syncFormState(e){this.formState.setFormValue(this.value),this.formState.setValidity(zt(e.validity),e.validationMessage)}onInnerInput=e=>{this.commits.markUserInput(),this.value=e.target.value,this.dispatchEvent(new CustomEvent("mndwinput",{bubbles:!0,composed:!0,detail:{value:this.value}}))};onInnerFocus=()=>{this.commits.captureBaseline(this.value)};onInnerBlur=()=>{this.commits.commit(this.value),this.commits.releaseBaseline()};onInnerKeyDown=e=>{e.key==="Enter"&&this.commits.commit(this.value)};emitChange(e){this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:e}}))}_onTogglePassword=()=>{this._showPassword=!this._showPassword,this.requestUpdate(),this.updateComplete.then(()=>{this.innerInput?.focus()})};_renderPasswordToggle(){return u`
653
+ <button
654
+ part="password-toggle"
655
+ type="button"
656
+ aria-label=${y(this._showPassword?"input.password.hide":"input.password.show")}
657
+ ?disabled=${this.formState.effectiveDisabled}
658
+ @click=${this._onTogglePassword}
659
+ >
660
+ <mndw-icon name=${this._showPassword?"eye-off":"eye"}></mndw-icon>
661
+ </button>
662
+ `}resetForm(){this.value=this.getAttribute("value")??""}restoreFormState(e){typeof e=="string"&&(this.value=e)}};function sn(i){switch(i){case"escape":return"escape";case"outside-click":return"outside";case"host-navigation":case"plugin-unmount":case"replaced":return"detached";default:return"api"}}function ln(i){return{open(e){if(e.presentation==="sheet"){let r=i.open({kind:"drawer",placement:"bottom",title:e.title??y("select.overlay.title"),showCloseButton:!0,closeOnEscape:!0,closeOnOutsideClick:!0,trapFocus:!0,restoreFocus:!0,lockScroll:!0,width:"100%",height:"auto",maxHeight:"100dvh",className:["mndw-ui-select-sheet",e.className].filter(Boolean).join(" "),mount(n){n.style.removeProperty("height"),n.style.minHeight="0"}});return{contentElement:r.contentElement,closed:r.closed.then(n=>sn(n.reason)),close:()=>{r.close()},reposition:()=>{}}}let t=i.createLayer({kind:"popover",anchor:{element:e.anchor},placement:"bottom-start",closeOnEscape:!0,closeOnOutsideClick:!0,trapFocus:e.trapFocus,restoreFocus:e.restoreFocus,className:e.className});return t.markReady(),{contentElement:t.contentElement,closed:t.closed.then(r=>sn(r.reason)),close:()=>{t.close()},reposition:()=>{t.update({anchor:{element:e.anchor}})}}}}}var zo=600,Uo=8,Bo=8,Ko=600,Go=8,Hr=8,Bt=["bottom-start","top-start","bottom-end","top-end"],Wo=new Set(["right","left","top","bottom"]),qo=new Set(["top-start","top-end","bottom-start","bottom-end","left-start","left-end","right-start","right-end"]);function jo(i,e=window.innerWidth){return e<=600&&(i==="modal"||i==="drawer")}function Yo(i,e){switch(i){case"modal":return"center";case"drawer":return e&&Wo.has(e)?e:"right";case"popover":return e&&qo.has(e)?e:"bottom-start";case"custom":return e??"center"}}function dn(i,e,t){switch(t){case"top-start":return{top:i.top-e.height-8,left:i.left};case"top-end":return{top:i.top-e.height-8,left:i.right-e.width};case"bottom-end":return{top:i.bottom+8,left:i.right-e.width};case"bottom-start":default:return{top:i.bottom+8,left:i.left}}}function cn(i,e,t,r){return i>=0&&e>=0&&i+t.height<=r.height&&e+t.width<=r.width}function Vr(i,e,t,r={width:window.innerWidth,height:window.innerHeight}){let n=i.element.getBoundingClientRect(),o=dn(n,e,t);if(cn(o.top,o.left,e,r))return{...o,placement:t};let a=t===Bt[0]?Bt:[t,...Bt];for(let s of a){let l=dn(n,e,s);if(cn(l.top,l.left,e,r))return{...l,placement:s}}return{...o,placement:t}}var Xo={top:["top","bottom","right","left"],bottom:["bottom","top","right","left"],left:["left","right","bottom","top"],right:["right","left","bottom","top"]};function un(i,e,t){return Math.max(e,Math.min(i,t))}function hn(i,e,t,r){let n=i.left+(i.width-e.width)/2,o=i.top+(i.height-e.height)/2;switch(t){case"bottom":return{top:i.bottom+r,left:n};case"left":return{top:o,left:i.left-e.width-r};case"right":return{top:o,left:i.right+r};case"top":default:return{top:i.top-e.height-r,left:n}}}function Jo(i,e,t,r,n){switch(t){case"bottom":return i.top+e.height<=r.height-n;case"left":return i.left>=n;case"right":return i.left+e.width<=r.width-n;case"top":default:return i.top>=n}}function zr(i,e,t,r={width:window.innerWidth,height:window.innerHeight},n=8,o=8){let s=Xo[t].find(d=>Jo(hn(i,e,d,n),e,d,r,o))??t,l=hn(i,e,s,n),c=s==="top"||s==="bottom";return{top:c?l.top:un(l.top,o,Math.max(r.height-o-e.height,o)),left:c?un(l.left,o,Math.max(r.width-o-e.width,o)):l.left,placement:s}}function Ur(i,e=600){return i<=e?"sheet":"popover"}function Br(i,e,t=8,r=8){let n=t+r,o=Math.max(e.height-i.bottom-n,0),a=Math.max(i.top-n,0);return Math.max(Math.max(o,a),1)}function Ut(i){if(i!==void 0)return typeof i=="number"?`${i}px`:i}function Zo(i,e,t=!1){if(t&&(i==="modal"||i==="drawer"))return{width:"100%",height:"auto",maxHeight:"100dvh"};let r=Ut(e.width),n=Ut(e.height),o=Ut(e.maxWidth),a=Ut(e.maxHeight);return i==="modal"?{width:r??"min(560px, calc(100vw - 32px))",height:n,maxWidth:o,maxHeight:a??"calc(100vh - 32px)"}:i==="drawer"?{width:r??"min(420px, 100vw)",height:n??"100%",maxWidth:o,maxHeight:a}:{width:r,height:n,maxWidth:o,maxHeight:a}}var Qo=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","SUMMARY","IFRAME"]),he=[];function J(){let i=document.activeElement;for(;i?.shadowRoot?.activeElement;)i=i.shadowRoot.activeElement;return i}function pe(i,e){let t=e;for(;t;){if(t===i)return!0;t=t instanceof ShadowRoot?t.host:t.parentNode}return!1}function bn(i,e,t,r,n=5){let o=!1,a=null,s=n,l=()=>{o=!0,a!==null&&(cancelAnimationFrame(a),a=null)},c=()=>{if(a=null,o||!t()){l();return}if(e(),o||!t()){l();return}if(pe(i,J())){r(),l();return}if(s<=0){l();return}s-=1,a=requestAnimationFrame(c)};return c(),l}function ea(i){let e=i.getAttribute("contenteditable")?.toLowerCase();if(e!==""&&e!=="true"&&e!=="plaintext-only")return!1;let t=i.parentElement;for(;t;){let r=t.getAttribute("contenteditable")?.toLowerCase();if(r===""||r==="true"||r==="plaintext-only")return!1;if(r==="false")return!0;t=t.parentElement}return!0}function ta(i){let e=i.getAttribute("tabindex");if(e!==null){let t=Number.parseInt(e,10);return Number.isNaN(t)?-1:t}return i.tagName==="A"?i.hasAttribute("href")?0:-1:ea(i)||Qo.has(i.tagName)?0:-1}function ra(i){if(i.matches(":disabled"))return!0;let e=i.parentElement;for(;e;){if(e instanceof HTMLFieldSetElement&&e.disabled&&![...e.children].find(r=>r instanceof HTMLLegendElement)?.contains(i))return!0;e=e.parentElement}return!1}function ia(i){return ta(i)<0||ra(i)||i instanceof HTMLInputElement&&i.type==="hidden"?!1:typeof i.checkVisibility=="function"?i.checkVisibility():!0}function na(i){if(i instanceof HTMLSlotElement){let e=i.assignedNodes({flatten:!0});return e.length>0?e.filter(t=>t instanceof Element):[...i.children]}return i instanceof Element&&i.shadowRoot?[...i.shadowRoot.children]:i instanceof Element||i instanceof ShadowRoot?[...i.children]:[]}function fn(i,e){for(let t of na(i))t instanceof HTMLElement&&(t.hidden||t.hasAttribute("inert")||(ia(t)&&e.push(t),fn(t,e)))}function me(i){let e=[];return fn(i,e),e}function vn(i){return i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1"),i}function gn(i){let[e]=me(i.container);(e??vn(i.container)).focus()}function pn(i){let e=he.at(-1);if(!e||i.key!=="Tab"||i.defaultPrevented)return;let t=J();if(t&&!pe(e.container,t)&&e.options.allowFocus?.(t)===!0)return;let r=me(e.container);if(i.preventDefault(),r.length===0){vn(e.container).focus();return}let n=t instanceof HTMLElement?r.indexOf(t):-1,o=r.length,a=n===-1?i.shiftKey?o-1:0:(n+(i.shiftKey?-1:1)+o)%o;r[a]?.focus()}function mn(i){let e=he.at(-1);if(!e)return;let[t]=i.composedPath();if(!(t instanceof Node))return;if(pe(e.container,t)){e.lastFocused=t instanceof HTMLElement?t:e.lastFocused;return}if(e.options.allowFocus?.(t)===!0)return;let r=e.lastFocused;r?.isConnected===!0&&pe(e.container,r)?r.focus():gn(e)}function Kt(i,e={}){let t=J(),r={container:i,options:e,lastFocused:null};he.length===0&&(document.addEventListener("keydown",pn),document.addEventListener("focusin",mn,!0)),he.push(r);let n=J();if(n instanceof HTMLElement&&pe(i,n)&&(r.lastFocused=n),!n||!pe(i,n)){let a=e.initialFocus?.()??null;a?a.focus():gn(r)}let o=!0;return{deactivate(){if(!o)return;o=!1;let a=he.indexOf(r);a!==-1&&he.splice(a,1),he.length===0&&(document.removeEventListener("keydown",pn),document.removeEventListener("focusin",mn,!0)),e.restoreFocus!==!1&&t instanceof HTMLElement&&t.isConnected&&t.focus()}}}function oa(){return{open(i){if(i.presentation==="sheet")return aa(i);let e=document.createElement("div");e.className=i.className??"",e.style.position="fixed",e.style.zIndex="1000",e.style.opacity="0",e.style.pointerEvents="none",document.body.appendChild(e);let t=d=>{},r=new Promise(d=>{t=d}),n=!1,o=null,a=(d="api")=>{n||(n=!0,o?.deactivate(),o=null,document.removeEventListener("pointerdown",s,!0),document.removeEventListener("keydown",l,!0),window.removeEventListener("resize",c),window.removeEventListener("scroll",c,!0),e.remove(),t(d))};function s(d){let h=d.composedPath();h.includes(e)||h.includes(i.anchor)||a("outside")}function l(d){d.key==="Escape"&&a("escape")}function c(){if(n)return;let d=window.innerHeight,h=window.innerWidth,p=e.offsetHeight,f=e.offsetWidth,m=Vr({element:i.anchor},{width:f,height:p},"bottom-start",{width:h,height:d});e.style.left=`${m.left}px`,e.style.top=`${m.top}px`,e.style.opacity="1",e.style.pointerEvents="auto"}return document.addEventListener("pointerdown",s,!0),document.addEventListener("keydown",l,!0),window.addEventListener("resize",c),window.addEventListener("scroll",c,!0),i.trapFocus===!0&&requestAnimationFrame(()=>{n||(o=Kt(e,{restoreFocus:!1,allowFocus:d=>d===i.anchor||i.anchor.contains(d)}))}),{contentElement:e,closed:r,setTitle:()=>{},close:()=>{a("api")},reposition:c}}}}function aa(i){let e=document.createElement("div");e.className=["mndw-ui-sheet-root",i.className].filter(Boolean).join(" "),e.style.position="fixed",e.style.inset="0",e.style.zIndex="1000",e.style.display="flex",e.style.flexDirection="column",e.style.justifyContent="flex-end";let t=document.createElement("div");t.className="mndw-ui-sheet__backdrop",t.style.position="absolute",t.style.inset="0";let r=document.createElement("div");r.className="mndw-ui-sheet",r.setAttribute("role","dialog"),r.style.position="relative",r.style.display="flex",r.style.flexDirection="column",r.style.width="100%",r.style.height="auto",r.style.maxHeight="100dvh",r.style.minHeight="0";let n=document.createElement("header");n.className="mndw-ui-sheet__header",n.style.display="flex",n.style.flexShrink="0",n.style.alignItems="center",n.style.justifyContent="space-between";let o=document.createElement("span");o.textContent=i.title??y("select.overlay.title");let a=document.createElement("button");a.type="button",a.setAttribute("aria-label",y("overlay.close"));let s=document.createElement("mndw-icon");s.setAttribute("name","x"),a.append(s);let l=document.createElement("div");l.className="mndw-ui-sheet__body",l.style.flex="0 1 auto",l.style.display="flex",l.style.flexDirection="column",l.style.minHeight="0",l.style.overflow="hidden";let c=document.createElement("div");c.style.display="flex",c.style.flex="1 1 auto",c.style.flexDirection="column",c.style.minHeight="0",c.style.overflow="hidden";let d=A=>{},h=new Promise(A=>{d=A}),p=!1,f=null,m=(A="api")=>{p||(p=!0,f?.deactivate(),f=null,document.removeEventListener("pointerdown",S,!0),document.removeEventListener("keydown",x,!0),a.removeEventListener("click",E),e.remove(),d(A))};function S(A){A.composedPath().includes(r)||m("outside")}function x(A){A.key==="Escape"&&m("escape")}function E(){m("api")}return l.appendChild(c),n.append(o,a),r.append(n,l),e.append(t,r),document.body.appendChild(e),a.addEventListener("click",E),document.addEventListener("pointerdown",S,!0),document.addEventListener("keydown",x,!0),i.trapFocus!==!1&&requestAnimationFrame(()=>{p||(f=Kt(r,{restoreFocus:!1}))}),{contentElement:c,closed:h,setTitle:A=>{o.textContent=A},close:()=>{m("api")},reposition:()=>{}}}var Kr,wn;function yn(i){Kr=i}function Gt(){return Kr||(wn??=oa(),wn)}var Je="mndw-option",Ze="mndwoptionchange",Xe=class extends HTMLElement{static observedAttributes=["value","disabled"];observer=null;skipNextTextMutation=!1;get textContent(){return super.textContent}set textContent(e){let t=super.textContent;super.textContent=e,t!==e&&(this.skipNextTextMutation=!0,this.announce())}get value(){return this.getAttribute("value")??""}set value(e){this.setAttribute("value",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}connectedCallback(){if(!this.observer&&typeof MutationObserver<"u"){let e=new MutationObserver(()=>{if(this.skipNextTextMutation){this.skipNextTextMutation=!1;return}this.announce()});typeof e.observe=="function"&&(this.observer=e,e.observe(this,{characterData:!0,childList:!0,subtree:!0}))}}disconnectedCallback(){this.observer?.disconnect()}attributeChangedCallback(e,t,r){t!==r&&this.announce()}announce(){this.dispatchEvent(new CustomEvent(Ze,{bubbles:!0,composed:!1}))}};var Sn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},xn=i=>(...e)=>({_$litDirective$:i,values:e}),Wt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:sa}=Ai,Cn=i=>i;var Mn=()=>document.createComment(""),Re=(i,e,t)=>{let r=i._$AA.parentNode,n=e===void 0?i._$AB:e._$AA;if(t===void 0){let o=r.insertBefore(Mn(),n),a=r.insertBefore(Mn(),n);t=new sa(o,a,i,i.options)}else{let o=t._$AB.nextSibling,a=t._$AM,s=a!==i;if(s){let l;t._$AQ?.(i),t._$AM=i,t._$AP!==void 0&&(l=i._$AU)!==a._$AU&&t._$AP(l)}if(o!==n||s){let l=t._$AA;for(;l!==o;){let c=Cn(l).nextSibling;Cn(r).insertBefore(l,n),l=c}}}return t},ie=(i,e,t=i)=>(i._$AI(e,t),i),la={},En=(i,e=la)=>i._$AH=e,Tn=i=>i._$AH,qt=i=>{i._$AR(),i._$AA.remove()};var Rn=(i,e,t)=>{let r=new Map;for(let n=e;n<=t;n++)r.set(i[n],n);return r},jt=xn(class extends Wt{constructor(i){if(super(i),i.type!==Sn.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let n=[],o=[],a=0;for(let s of i)n[a]=r?r(s,a):a,o[a]=t(s,a),a++;return{values:o,keys:n}}render(i,e,t){return this.dt(i,e,t).values}update(i,[e,t,r]){let n=Tn(i),{values:o,keys:a}=this.dt(e,t,r);if(!Array.isArray(n))return this.ut=a,o;let s=this.ut??=[],l=[],c,d,h=0,p=n.length-1,f=0,m=o.length-1;for(;h<=p&&f<=m;)if(n[h]===null)h++;else if(n[p]===null)p--;else if(s[h]===a[f])l[f]=ie(n[h],o[f]),h++,f++;else if(s[p]===a[m])l[m]=ie(n[p],o[m]),p--,m--;else if(s[h]===a[m])l[m]=ie(n[h],o[m]),Re(i,l[m+1],n[h]),h++,m--;else if(s[p]===a[f])l[f]=ie(n[p],o[f]),Re(i,n[h],n[p]),p--,f++;else if(c===void 0&&(c=Rn(a,f,m),d=Rn(s,h,p)),c.has(s[h]))if(c.has(s[p])){let S=d.get(a[f]),x=S!==void 0?n[S]:null;if(x===null){let E=Re(i,n[h]);ie(E,o[f]),l[f]=E}else l[f]=ie(x,o[f]),Re(i,n[h],x),n[S]=null;f++}else qt(n[p]),p--;else qt(n[h]),h++;for(;f<=m;){let S=Re(i,l[m+1]);ie(S,o[f]),l[f++]=S}for(;h<=p;){let S=n[h++];S!==null&&qt(S)}return this.ut=a,En(i,l),Y}});var et="mndw-select-panel",da=0,Qe=class extends g{static properties={options:{type:Array},value:{type:String},label:{type:String},sheet:{type:Boolean,reflect:!0},activeIndex:{type:Number,state:!0}};static styles=v`
663
+ :host {
664
+ ${M}
665
+
666
+ box-sizing: border-box;
667
+ display: flex;
668
+ flex: 0 1 auto;
669
+ flex-direction: column;
670
+ min-height: 0;
671
+ width: 100%;
672
+ max-width: 100%;
673
+ overflow: hidden;
674
+ border: var(--mndw-border-w) solid var(--mndw-border);
675
+ border-radius: var(--mndw-radius-md);
676
+ background: var(--mndw-surface-raised);
677
+ box-shadow: var(--mndw-shadow-2);
678
+ }
679
+
680
+ mndw-scroll-area {
681
+ flex: 0 1 auto;
682
+ min-height: 0;
683
+ }
684
+
685
+ .listbox {
686
+ padding: var(--mndw-space-1);
687
+ padding-inline-end: calc(var(--mndw-space-1) + var(--mndw-scrollbar-size));
688
+ font-family: inherit;
689
+ font-size: inherit;
690
+ }
691
+
692
+ .listbox:focus-visible {
693
+ ${R}
694
+ outline-offset: -2px;
695
+ }
696
+
697
+ :host([sheet]) {
698
+ display: flex;
699
+ flex-direction: column;
700
+ min-height: 0;
701
+ border: none;
702
+ border-radius: 0;
703
+ box-shadow: none;
704
+ }
705
+
706
+ .option {
707
+ display: flex;
708
+ gap: var(--mndw-space-2);
709
+ align-items: center;
710
+ justify-content: space-between;
711
+ padding: var(--mndw-space-2) var(--mndw-space-3);
712
+ border-radius: var(--mndw-radius-sm);
713
+ color: var(--mndw-text);
714
+ cursor: pointer;
715
+ }
716
+
717
+ .option:not([aria-disabled='true']):hover {
718
+ ${$}
719
+ }
720
+
721
+ .option[aria-selected='true'] {
722
+ color: var(--mndw-accent);
723
+ }
724
+
725
+ .option[aria-disabled='true'] {
726
+ color: var(--mndw-text-subtle);
727
+ cursor: not-allowed;
728
+ }
729
+ `;panelId=da++;constructor(){super(),this.options=[],this.value="",this.label="",this.sheet=!1,this.activeIndex=-1}get listboxElement(){return this.renderRoot.querySelector('[role="listbox"]')}get activeOptionElement(){return this.renderRoot.querySelector(`#${this.optionId(this.activeIndex)}`)}focusListbox(){this.listboxElement?.focus()}willUpdate(e){if(e.has("options")||e.has("value")){let t=this.options.findIndex(r=>r.value===this.value);this.activeIndex=t>=0&&!this.options[t]?.disabled?t:this.firstEnabledIndex()}}render(){return u`
730
+ <mndw-scroll-area exportparts="viewport,scrollbar,track,thumb">
731
+ <div
732
+ class="listbox"
733
+ part="listbox"
734
+ role="listbox"
735
+ aria-label=${this.label}
736
+ aria-activedescendant=${this.optionId(this.activeIndex)}
737
+ tabindex="0"
738
+ >
739
+ ${jt(this.options,(e,t)=>`${t}:${e.value}`,(e,t)=>{let r=e.labelNodes.length>0?e.labelNodes.map(n=>n.cloneNode(!0)):e.label;return u`
740
+ <div
741
+ class="option"
742
+ part="option"
743
+ role="option"
744
+ id=${this.optionId(t)}
745
+ aria-selected=${String(t===this.activeIndex)}
746
+ aria-disabled=${String(e.disabled)}
747
+ @click=${()=>this.select(t)}
748
+ >
749
+ <span>${r}</span>
750
+ ${t===this.activeIndex?u`<mndw-icon name="check" aria-hidden="true"></mndw-icon>`:null}
751
+ </div>
752
+ `})}
753
+ </div>
754
+ </mndw-scroll-area>
755
+ `}firstEnabledIndex(){return this.options.findIndex(e=>!e.disabled)}optionId(e){return`mndw-select-${this.panelId}-option-${e}`}select(e){let t=this.options[e];!t||t.disabled||this.dispatchEvent(new CustomEvent("mndwpanelselect",{detail:{value:t.value}}))}dismiss(){this.dispatchEvent(new CustomEvent("mndwpaneldismiss",{detail:{restoreFocus:!0}}))}};var Ae=class{getLabel;isDisabled;pageSize;typeaheadTimeout;now;typeaheadBuffer="";lastTypeaheadAt=Number.NEGATIVE_INFINITY;constructor(e){this.getLabel=e.getLabel,this.isDisabled=e.isDisabled,this.pageSize=e.pageSize??10,this.typeaheadTimeout=e.typeaheadTimeout??500,this.now=e.now??Date.now}handleKeydown(e,t){let r=null;switch(e.key){case"ArrowDown":r=this.move(t,1);break;case"ArrowUp":r=this.move(t,-1);break;case"Home":r=this.edge(t,1);break;case"End":r=this.edge(t,-1);break;case"PageDown":r=this.page(t,1);break;case"PageUp":r=this.page(t,-1);break;default:if(this.isPrintable(e))r=this.typeahead(e.key,t);else return!1}return e.preventDefault(),r!==null&&r!==t.activeIndex&&(t.setActiveIndex(r),t.mode==="roving-focus"&&t.focusItem?.(r)),!0}isPrintable(e){return!e.ctrlKey&&!e.altKey&&!e.metaKey&&!e.isComposing&&e.key!==" "&&[...e.key].length===1}move(e,t){let r=e.items.length;if(r===0)return null;let n=e.activeIndex;if(n<0)return this.edge(e,t);for(let o=0;o<r;o+=1){if(n+=t,e.wrap)n=(n+r)%r;else if(n<0||n>=r)return null;if(!this.isDisabled(e.items[n]))return n}return null}edge(e,t){let r=t>0?0:e.items.length-1,n=t>0?e.items.length:-1;for(let o=r;o!==n;o+=t)if(!this.isDisabled(e.items[o]))return o;return null}page(e,t){if(e.items.length===0)return null;if(e.activeIndex<0)return this.edge(e,t);let r=e.activeIndex+t*this.pageSize,n=e.wrap?(r%e.items.length+e.items.length)%e.items.length:Math.max(0,Math.min(e.items.length-1,r)),o=0;for(;o<e.items.length;){if(!this.isDisabled(e.items[n]))return n;if(n+=t,e.wrap)n=(n+e.items.length)%e.items.length;else if(n<0||n>=e.items.length)return null;o+=1}return null}typeahead(e,t){let r=this.now(),o=r-this.lastTypeaheadAt<=this.typeaheadTimeout?this.typeaheadBuffer:"",a=o!==""&&[...o].every(d=>d===e.toLocaleLowerCase()),s=a?e.toLocaleLowerCase():`${o}${e}`.toLocaleLowerCase();this.typeaheadBuffer=s,this.lastTypeaheadAt=r;let l=t.items[t.activeIndex];if(o!==""&&!a&&l&&!this.isDisabled(l)&&this.normalize(this.getLabel(l)).startsWith(s))return t.activeIndex;let c=t.items.length;for(let d=1;d<=c;d+=1){let h=t.activeIndex<0?d-1:(t.activeIndex+d)%c,p=t.items[h];if(!this.isDisabled(p)&&this.normalize(this.getLabel(p)).startsWith(s))return h}return null}normalize(e){return e.trimStart().toLocaleLowerCase()}};function An(i){let e=i.querySelectorAll(Je);return Array.from(e,t=>{let r=t.getAttribute("value")??"",n=(t.textContent??"").replace(/\s+/g," ").trim(),o=Array.from(t.childNodes,a=>a.cloneNode(!0));return{value:r,label:n===""?r:n,labelNodes:o,disabled:t.hasAttribute("disabled")}})}var ca=180;function ua(i){return{top:i.top,right:i.right,bottom:i.bottom,left:i.left,width:i.width,height:i.height}}function ha(i,e){return i?.top===e.top&&i.right===e.right&&i.bottom===e.bottom&&i.left===e.left&&i.width===e.width&&i.height===e.height}function Ln(i,e,t){i.style.minWidth=`${Math.max(e.width,ca)}px`,i.style.maxWidth=`calc(100vw - ${16}px)`,i.style.maxHeight=`${Br(e,t)}px`,i.style.overflow="hidden",i.style.display="flex",i.style.flexDirection="column"}var Yt=class{options;geometry=null;needsReposition=!1;frame=null;constructor(e){this.options={...e,requestFrame:e.requestFrame??(t=>requestAnimationFrame(t)),cancelFrame:e.cancelFrame??(t=>cancelAnimationFrame(t))}}start(){this.cancel(),this.needsReposition=!0,this.frame=this.options.requestFrame(this.tick)}cancel(){this.frame!==null&&(this.options.cancelFrame(this.frame),this.frame=null),this.geometry=null,this.needsReposition=!1}tick=()=>{if(this.frame=null,!this.options.isActive())return;let e=this.options.readAnchorRect(),t=ua(e),r=!ha(this.geometry,t);r&&(this.options.onGeometryChange(e),this.geometry=t),(this.needsReposition||r)&&this.options.isConnected()&&(this.options.onReposition(),this.needsReposition=!1),this.frame=this.options.requestFrame(this.tick)}};var Gr="mndw-select",tt=class extends g{static formAssociated=!0;static shadowRootOptions={...g.shadowRootOptions,delegatesFocus:!0};static mndwLabelSource="label-property";static properties={value:{type:String},placeholder:{type:String},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},name:{type:String,reflect:!0},panelClass:{type:String,attribute:"panel-class"},label:{type:String},open:{type:Boolean,state:!0}};static styles=v`
756
+ :host {
757
+ ${M}
758
+
759
+ display: inline-block;
760
+ width: 100%;
761
+ border-radius: var(--mndw-radius-md);
762
+ }
763
+
764
+ :host([disabled]) {
765
+ pointer-events: none;
766
+ opacity: 0.5;
767
+ }
768
+
769
+ [part='trigger'] {
770
+ ${B}
771
+
772
+ display: flex;
773
+ gap: var(--mndw-space-2);
774
+ align-items: center;
775
+ justify-content: space-between;
776
+ width: 100%;
777
+ border: 1px solid var(--mndw-border);
778
+ background: var(--mndw-surface-raised);
779
+ color: var(--mndw-text);
780
+ text-align: left;
781
+ cursor: pointer;
782
+ }
783
+
784
+ :host(:not([disabled]):not([invalid]):not([aria-invalid='true'])) [part='trigger']:hover {
785
+ ${Ce}
786
+ }
787
+
788
+ [part='trigger']:focus-visible {
789
+ ${R}
790
+ }
791
+
792
+ .value {
793
+ overflow: hidden;
794
+ text-overflow: ellipsis;
795
+ white-space: nowrap;
796
+ }
797
+
798
+ .value.placeholder {
799
+ color: var(--mndw-text-subtle);
800
+ }
801
+
802
+ .indicator {
803
+ flex-shrink: 0;
804
+ color: var(--mndw-text-subtle);
805
+ }
806
+ `;layer=null;panel=null;presentation=null;keyManager=new Ae({getLabel:e=>e.label,isDisabled:e=>e.disabled});placeholderState;localeController=new L(this,{applyLocale:()=>{this.applyLocale()}});formState=new N(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});popoverTracker=new Yt({isActive:()=>this.presentation==="popover"&&this.layer!==null,isConnected:()=>this.layer?.contentElement.isConnected===!0,readAnchorRect:()=>this.getBoundingClientRect(),onGeometryChange:e=>{this.layer!==null&&this.applyPopoverSizing(this.layer,e)},onReposition:()=>this.layer?.reposition()});constructor(){super(),this.placeholderState=O(this,"placeholder"),this.value="",this.disabled=!1,this.required=!1,this.invalid=!1,this.name="",this.panelClass="",this.label="",this.open=!1,this.addEventListener("click",this.onTriggerClick),this.addEventListener("keydown",this.onTriggerKeydown)}focus(e){this.triggerElement()?.focus(e)}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["value"]),this.addEventListener(Ze,this.onOptionChange)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(Ze,this.onOptionChange),this.closePanel(!1)}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}refreshAccessibleName(){this.requestUpdate()}render(){let e=this.options().find(n=>n.value===this.value),t=this.formState.effectiveDisabled,r=this.isInvalid(e);return u`
807
+ <button
808
+ type="button"
809
+ part="trigger"
810
+ aria-label=${this.triggerLabel()??b}
811
+ aria-haspopup="listbox"
812
+ aria-expanded=${String(this.open)}
813
+ aria-invalid=${String(r)}
814
+ ?disabled=${t}
815
+ >
816
+ <span class="value ${e?"":"placeholder"}" part="value">
817
+ ${e?e.label:this.placeholder??y("select.placeholder")}
818
+ </span>
819
+ <span class="indicator" part="indicator" aria-hidden="true"><mndw-icon name="chevron-down"></mndw-icon></span>
820
+ </button>
821
+ <slot hidden @slotchange=${this.onSlotChange}></slot>
822
+ `}updated(e){let t=this.options().find(n=>n.value===this.value),r=t?t.value:null;this.formState.setFormValue(r,this.value),this.required&&!t?this.formState.setValidity({valueMissing:!0},y("select.validation.required")):this.formState.clearValidity(),e.has("label")&&e.get("label")!==void 0&&ue(this)}options(){return An(this)}applyLocale(){this.placeholderState.setGenerated(y("select.placeholder")),this.layer?.setTitle?.(this.label||y("select.overlay.title"))}onSlotChange=()=>{this.syncOptions()};onOptionChange=()=>{this.syncOptions()};syncOptions(){this.requestUpdate(),this.panel&&(this.panel.options=this.options())}onTriggerClick=e=>{let t=this.triggerElement();if(t!==null&&!e.composedPath().includes(t)&&this.focus(),!this.formState.effectiveDisabled){if(this.open){this.closePanel(!0);return}this.openPanel()}};onTriggerKeydown=e=>{if(this.formState.effectiveDisabled||this.open)return;let t="selected";switch(e.key){case"ArrowDown":t=e.altKey?"selected":"first";break;case"ArrowUp":t="last";break;case"Home":t="first";break;case"End":t="last";break;case"Enter":case" ":break;default:{let r=this.options(),n=this.selectedEnabledIndex(r),o={items:r,wrap:!1,mode:"active-descendant",get activeIndex(){return n},set activeIndex(a){n=a},setActiveIndex(a){n=a}};if(!this.keyManager.handleKeydown(e,o))return;this.openPanel("active",n);return}}e.altKey&&e.key!=="ArrowDown"||(e.preventDefault(),this.openPanel(t))};handleOpenKeydown(e){if(e.key==="Escape"){e.preventDefault(),this.closePanel(!0);return}if(e.key==="Tab"){this.commitActiveOption(e.shiftKey?"backward":"forward");return}if(e.altKey&&e.key==="ArrowUp"){e.preventDefault(),this.commitActiveOption();return}if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.commitActiveOption();return}e.altKey||!this.panel||this.keyManager.handleKeydown(e,this.keyList(this.panel))}onPanelKeydown=e=>{this.open&&this.handleOpenKeydown(e)};openPanel(e="selected",t){if(this.formState.effectiveDisabled||this.open||!this.isConnected)return;let r=Ur(window.innerWidth),n=Gt().open({anchor:this,presentation:r,title:this.label||y("select.overlay.title"),className:this.panelClass||void 0});r==="popover"&&(this.applyPopoverSizing(n),window.addEventListener("resize",this.onViewportChange),window.addEventListener("scroll",this.onViewportChange,!0));let o=document.createElement(et);o.options=this.options(),o.value=this.value,o.label=this.label,o.sheet=r==="sheet",o.addEventListener("mndwpanelselect",this.onPanelSelect),o.addEventListener("mndwpaneldismiss",this.onPanelDismiss),o.addEventListener("keydown",this.onPanelKeydown),n.contentElement.appendChild(o),this.layer=n,this.panel=o,this.presentation=r,this.open=!0,r==="popover"&&this.startPopoverTracking(),o.updateComplete.then(async()=>{this.layer===n&&(e==="active"&&t!==void 0?o.activeIndex=t:e==="first"?o.activeIndex=this.firstEnabledIndex(o.options):e==="last"&&(o.activeIndex=this.lastEnabledIndex(o.options)),await o.updateComplete,o.focusListbox())}),n.closed.then(a=>{this.layer===n&&(this.forgetLayer(),this.restoreFocus(a))})}applyPopoverSizing(e,t=this.getBoundingClientRect()){Ln(e.contentElement,t,{width:window.innerWidth,height:window.innerHeight})}startPopoverTracking(){this.popoverTracker.start()}cancelPopoverTracking(){this.popoverTracker.cancel()}onViewportChange=()=>{let e=this.layer;this.presentation!=="popover"||!e||(this.applyPopoverSizing(e),e.reposition())};restoreFocus(e){if(e==="detached"||!this.isConnected)return;let t=J(),r=t===null||t===document.body;e!=="escape"&&!r||this.focus()}onPanelSelect=e=>{let t=e.detail;this.value=t.value,this.closePanel(!0),this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:t.value}}))};onPanelDismiss=e=>{let t=e.detail;this.closePanel(t.restoreFocus)};commitActiveOption(e){let t=this.panel?.options[this.panel.activeIndex];if(!t||t.disabled){e===void 0?this.closePanel(!0):this.closePanelAfterTab(e);return}this.value=t.value,this.dispatchChange(t.value),e===void 0?this.closePanel(!0):this.closePanelAfterTab(e)}dispatchChange(e){this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:e}}))}keyList(e){return{items:e.options,wrap:!1,mode:"active-descendant",get activeIndex(){return e.activeIndex},set activeIndex(t){e.activeIndex=t},setActiveIndex:t=>{e.activeIndex=t}}}closePanelAfterTab(e){let t=this.layer;if(t===null)return;let r=this.tabDestination(e);window.setTimeout(()=>{this.layer===t&&(this.forgetLayer(),t.close(),t.closed.then(()=>{r?.isConnected&&r.focus()}))},0)}tabDestination(e){let t=this.triggerElement();if(t===null)return null;let r=me(document.body),n=r.indexOf(t);if(n<0||r.length<2)return null;let a=(n+(e==="forward"?1:-1)+r.length)%r.length;return r[a]??null}triggerElement(){return this.renderRoot.querySelector('[part="trigger"]')}triggerLabel(){let e=this.label.trim();if(e!=="")return e;let t=this.formState.labels.map(r=>r.textContent?.trim()??"").filter(r=>r!=="").join(" ");return t===""?void 0:t}isInvalid(e){return this.invalid||this.required&&!e}closePanel(e){let t=this.layer;t&&(this.forgetLayer(),t.close(),e&&this.focus())}forgetLayer(){this.cancelPopoverTracking(),window.removeEventListener("resize",this.onViewportChange),window.removeEventListener("scroll",this.onViewportChange,!0),this.panel?.removeEventListener("mndwpanelselect",this.onPanelSelect),this.panel?.removeEventListener("mndwpaneldismiss",this.onPanelDismiss),this.panel?.removeEventListener("keydown",this.onPanelKeydown),this.panel=null,this.layer=null,this.presentation=null,this.open=!1}selectedEnabledIndex(e){let t=e.findIndex(r=>r.value===this.value&&!r.disabled);return t>=0?t:this.firstEnabledIndex(e)}firstEnabledIndex(e){return e.findIndex(t=>!t.disabled)}lastEnabledIndex(e){for(let t=e.length-1;t>=0;t-=1)if(!e[t].disabled)return t;return-1}resetForm(){this.value=this.getAttribute("value")??this.options()[0]?.value??""}restoreFormState(e){typeof e=="string"&&(this.value=e)}};var Wr=24,qr="mndw-scroll-area";function K(i,e=0){return Number.isFinite(i)&&i>=0?i:e}function kn(i,e,t){return Math.min(t,Math.max(e,i))}var rt=class extends g{static styles=v`
823
+ :host {
824
+ box-sizing: border-box;
825
+ display: flex;
826
+ flex: 0 1 auto;
827
+ flex-direction: column;
828
+ min-height: 0;
829
+ max-width: 100%;
830
+ position: relative;
831
+ overflow: hidden;
832
+ }
833
+
834
+ .viewport {
835
+ min-height: 0;
836
+ flex: 0 1 auto;
837
+ overflow-x: hidden;
838
+ overflow-y: auto;
839
+ scrollbar-width: none;
840
+ }
841
+
842
+ .viewport::-webkit-scrollbar {
843
+ display: none;
844
+ }
845
+
846
+ .scrollbar {
847
+ display: none;
848
+ position: absolute;
849
+ inset-block: 0;
850
+ inset-inline-end: 0;
851
+ width: var(--mndw-scrollbar-size);
852
+ touch-action: none;
853
+ user-select: none;
854
+ }
855
+
856
+ .track {
857
+ height: 100%;
858
+ border-radius: var(--mndw-scrollbar-radius);
859
+ background: var(--mndw-scrollbar-track);
860
+ touch-action: none;
861
+ }
862
+
863
+ .thumb {
864
+ box-sizing: border-box;
865
+ border: var(--mndw-focus-w) solid var(--mndw-scrollbar-track);
866
+ border-radius: var(--mndw-scrollbar-radius);
867
+ background: var(--mndw-scrollbar-thumb);
868
+ touch-action: none;
869
+ }
870
+
871
+ .thumb:hover,
872
+ .thumb.dragging {
873
+ background: var(--mndw-scrollbar-thumb-hover);
874
+ }
875
+
876
+ :host(.dragging) {
877
+ user-select: none;
878
+ }
879
+
880
+ [data-measure='thumb-min'] {
881
+ position: absolute;
882
+ visibility: hidden;
883
+ width: 0;
884
+ height: var(--mndw-scrollbar-thumb-min-size);
885
+ pointer-events: none;
886
+ }
887
+ `;viewportResizeObserver=null;contentResizeObserver=null;refreshFrame=null;shouldMeasureOnRefresh=!0;measuredMinThumbPx=Wr;assignedContent=null;listenersAttached=!1;activeDrag=null;maxScroll=0;thumbLength=0;trackTravel=0;trackTop=0;get viewportElement(){return this.shadowRoot?.querySelector('[part="viewport"]')??null}refresh(){this.scheduleRefresh(!0)}firstUpdated(){this.attachListeners(),this.scheduleRefresh(!0)}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.attachListeners(),this.scheduleRefresh(!0))}disconnectedCallback(){let e=this.viewportElement;e&&this.listenersAttached&&e.removeEventListener("scroll",this.handleScroll),this.listenersAttached=!1,this.viewportResizeObserver?.disconnect(),this.contentResizeObserver?.disconnect(),this.assignedContent=null,this.refreshFrame!==null&&(cancelAnimationFrame(this.refreshFrame),this.refreshFrame=null),this.shouldMeasureOnRefresh=!0,this.endDrag(),super.disconnectedCallback()}render(){return u`
888
+ <div part="viewport" class="viewport"><slot @slotchange=${this.handleSlotChange}></slot></div>
889
+ <div
890
+ part="scrollbar"
891
+ class="scrollbar"
892
+ aria-hidden="true"
893
+ @pointermove=${this.handlePointerMove}
894
+ @pointerup=${this.handlePointerUp}
895
+ @pointercancel=${this.handlePointerCancel}
896
+ >
897
+ <div part="track" class="track" @pointerdown=${this.handleTrackPointerDown}>
898
+ <div part="thumb" class="thumb" @pointerdown=${this.handleThumbPointerDown}></div>
899
+ </div>
900
+ </div>
901
+ <div data-measure="thumb-min" aria-hidden="true"></div>
902
+ `}attachListeners(){let e=this.viewportElement;e&&(this.listenersAttached||(e.addEventListener("scroll",this.handleScroll,{passive:!0}),this.listenersAttached=!0),typeof ResizeObserver<"u"&&(this.viewportResizeObserver||(this.viewportResizeObserver=new ResizeObserver(this.handleResize)),this.contentResizeObserver||(this.contentResizeObserver=new ResizeObserver(this.handleResize)),this.viewportResizeObserver.observe(e),this.observeAssignedContent()))}observeAssignedContent(){let e=this.shadowRoot?.querySelector("slot");if(!e||!this.contentResizeObserver)return;let t=e.assignedElements({flatten:!0})[0]??null;t!==this.assignedContent&&(this.contentResizeObserver.disconnect(),this.assignedContent=t,t&&this.contentResizeObserver.observe(t))}scheduleRefresh(e){e&&(this.shouldMeasureOnRefresh=!0),this.refreshFrame===null&&(this.refreshFrame=requestAnimationFrame(()=>{this.refreshFrame=null;let t=this.shouldMeasureOnRefresh;this.shouldMeasureOnRefresh=!1,this.updateGeometry(t)}))}updateGeometry(e){let t=this.viewportElement,r=this.shadowRoot?.querySelector('[part="scrollbar"]'),n=this.shadowRoot?.querySelector('[part="track"]'),o=this.shadowRoot?.querySelector('[part="thumb"]');if(!t||!r||!n||!o)return;e&&(this.measuredMinThumbPx=this.measureMinimumThumb());let a=K(t.clientHeight),s=K(t.scrollHeight),l=K(t.scrollTop);r.style.display="block";let c=n.getBoundingClientRect(),d=K(c.height),h=Math.max(0,s-a),f=h>1&&d>0;if(this.trackTop=Number.isFinite(c.top)?c.top:0,this.maxScroll=h,r.style.display=f?"block":"none",!f){this.thumbLength=d,this.trackTravel=0,o.style.height=`${d}px`,o.style.transform="translateY(0px)";return}let m=Math.min(d,this.measuredMinThumbPx),S=s>0?a/s:1,x=K(d*S),E=Math.min(d,Math.max(m,x)),A=Math.max(0,d-E),k=h>0?A*kn(l,0,h)/h:0;this.thumbLength=E,this.trackTravel=A,o.style.height=`${E}px`,o.style.transform=`translateY(${K(k)}px)`}measureMinimumThumb(){let e=this.shadowRoot?.querySelector('[data-measure="thumb-min"]');if(!e)return Wr;let t=e.getBoundingClientRect().height;return Number.isFinite(t)&&t>0?t:Wr}setScrollFromThumbTop(e){let t=this.viewportElement;if(!t)return;let r=kn(K(e),0,this.trackTravel),n=this.trackTravel>0?this.maxScroll*r/this.trackTravel:0;t.scrollTop=K(n),this.writeThumbOffset(r),this.scheduleRefresh(!1)}writeThumbOffset(e){let t=this.shadowRoot?.querySelector('[part="thumb"]');t&&(t.style.transform=`translateY(${K(e)}px)`)}setDragging(e){let t=this.shadowRoot?.querySelector('[part="thumb"]');this.classList.toggle("dragging",e),t?.classList.toggle("dragging",e)}endDrag(){if(!this.activeDrag){this.setDragging(!1);return}let{pointerId:e,captureTarget:t}=this.activeDrag;t.releasePointerCapture?.(e),this.activeDrag=null,this.setDragging(!1)}capturePointer(e,t){e.setPointerCapture?.(t)}handleScroll=()=>{this.scheduleRefresh(!1)};handleResize=()=>{this.scheduleRefresh(!0)};handleSlotChange=()=>{this.observeAssignedContent(),this.scheduleRefresh(!1)};handleThumbPointerDown=e=>{let t=e.currentTarget,r=t.getBoundingClientRect();this.activeDrag={pointerId:e.pointerId,offset:K(e.clientY-r.top),captureTarget:t},this.capturePointer(t,e.pointerId),e.preventDefault(),this.setDragging(!0)};handleTrackPointerDown=e=>{let t=this.shadowRoot?.querySelector('[part="thumb"]');if(e.target===t)return;let r=e.currentTarget,n=r.getBoundingClientRect(),o=e.clientY-n.top-this.thumbLength/2;this.setScrollFromThumbTop(o),this.activeDrag={pointerId:e.pointerId,offset:this.thumbLength/2,captureTarget:r},this.capturePointer(r,e.pointerId),e.preventDefault(),this.setDragging(!0)};handlePointerMove=e=>{if(this.activeDrag?.pointerId!==e.pointerId)return;let t=e.clientY-this.trackTop-this.activeDrag.offset;this.setScrollFromThumbTop(t)};handlePointerUp=e=>{this.activeDrag?.pointerId===e.pointerId&&this.endDrag()};handlePointerCancel=e=>{this.activeDrag?.pointerId===e.pointerId&&this.endDrag()}};var Le="mndw-segment",nt="mndwsegmentchange",it=class extends g{static properties={value:{type:String,reflect:!0},disabled:{type:Boolean,reflect:!0}};static styles=v`
903
+ :host {
904
+ ${M}
905
+
906
+ display: inline-flex;
907
+ cursor: pointer;
908
+ user-select: none;
909
+ }
910
+
911
+ :host([disabled]) {
912
+ cursor: not-allowed;
913
+ opacity: 0.5;
914
+ }
915
+
916
+ :host(:focus-visible) {
917
+ outline: none;
918
+ }
919
+
920
+ [part='segment'] {
921
+ ${B}
922
+
923
+ display: inline-flex;
924
+ align-items: center;
925
+ justify-content: center;
926
+ border-radius: var(--mndw-radius-sm);
927
+ color: var(--mndw-text-subtle);
928
+ white-space: nowrap;
929
+ transition: background var(--mndw-duration-fast) var(--mndw-easing);
930
+ }
931
+
932
+ :host([aria-checked='true']) [part='segment'] {
933
+ background: var(--mndw-accent);
934
+ color: var(--mndw-accent-contrast);
935
+ font-weight: var(--mndw-weight-semibold);
936
+ }
937
+
938
+ :host([aria-checked='false']:not([disabled]):not([aria-disabled='true']):hover) [part='segment'] {
939
+ ${Me}
940
+ ${re}
941
+ }
942
+
943
+ :host([aria-checked='true']:not([disabled]):not([aria-disabled='true']):hover) [part='segment'] {
944
+ background: var(--mndw-accent-hover);
945
+ color: var(--mndw-accent-contrast);
946
+ }
947
+ `;constructor(){super(),this.value="",this.disabled=!1}render(){return u`
948
+ <span part="segment">
949
+ <slot></slot>
950
+ </span>
951
+ `}updated(e){["value","disabled"].some(r=>e.has(r)&&e.get(r)!==void 0)&&this.dispatchEvent(new CustomEvent(nt,{bubbles:!0,composed:!1}))}};var jr="mndw-segmented",pa=["role","aria-checked","aria-disabled","tabindex"],ma=["ArrowRight","ArrowDown"],ba=["ArrowLeft","ArrowUp"],ot=class extends g{static formAssociated=!0;static mndwLabelSource="label-property";static properties={value:{type:String},label:{type:String},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}};static styles=v`
952
+ :host {
953
+ ${M}
954
+
955
+ display: inline-flex;
956
+ }
957
+
958
+ :host([disabled]) {
959
+ pointer-events: none;
960
+ opacity: 0.5;
961
+ }
962
+
963
+ [part='group'] {
964
+ display: inline-flex;
965
+ gap: var(--mndw-space-1);
966
+ padding: var(--mndw-space-1);
967
+ border: var(--mndw-border-w) solid var(--mndw-border);
968
+ border-radius: var(--mndw-radius-md);
969
+ background: var(--mndw-surface);
970
+ }
971
+
972
+ ::slotted(mndw-segment:focus-visible) {
973
+ ${R}
974
+
975
+ border-radius: var(--mndw-radius-sm);
976
+ }
977
+ `;formState=new N(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});owned=[];ownsAriaLabel=!1;ownedAriaLabel=null;localeController=new L(this);constructor(){super(),this.value="",this.label="",this.disabled=!1,this.required=!1,this.invalid=!1,this.name="",this.addEventListener("click",this.onClick),this.addEventListener("keydown",this.onKeyDown)}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["value"]),this.addEventListener(nt,this.onSegmentChange)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(nt,this.onSegmentChange),this.releaseSegments(this.owned),this.owned=[]}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}render(){return u`
978
+ <div part="group">
979
+ <slot @slotchange=${this.onSlotChange}></slot>
980
+ </div>
981
+ `}updated(e){let t=this.syncSegments();this.syncHost(t),this.syncFormState(t),e.has("label")&&e.get("label")!==void 0&&ue(this)}segments(){return[...this.children].filter(e=>e.localName===Le&&e.value!=="")}isSegmentDisabled(e){return e.disabled||this.formState.effectiveDisabled}syncSegments(){let e=this.segments(),t=e.find(n=>n.value===this.value)??null,r=t&&!this.isSegmentDisabled(t)?t:e.find(n=>!this.isSegmentDisabled(n))??null;this.releaseSegments(this.owned.filter(n=>!e.includes(n)));for(let n of e)n.setAttribute("role","radio"),n.setAttribute("aria-checked",String(n===t)),n.setAttribute("aria-disabled",String(this.isSegmentDisabled(n))),n.setAttribute("tabindex",n===r&&!this.formState.effectiveDisabled?"0":"-1");return this.owned=e,t}releaseSegments(e){for(let t of e)for(let r of pa)t.removeAttribute(r)}syncHost(e){let t=this.formState.effectiveDisabled,r=this.invalid||this.required&&!e;this.setAttribute("role","radiogroup"),this.setAttribute("aria-orientation","horizontal"),this.setAttribute("aria-disabled",String(t)),this.setAttribute("aria-required",String(this.required)),this.setAttribute("aria-invalid",String(r)),this.syncAccessibleLabel();let n=this.formState.internals;n&&(n.role="radiogroup",n.ariaOrientation="horizontal",n.ariaLabel=this.label||null,n.ariaDisabled=String(t),n.ariaRequired=String(this.required),n.ariaInvalid=String(r))}syncAccessibleLabel(){let e=this.getAttribute("aria-label");if(this.ownsAriaLabel&&e!==this.ownedAriaLabel&&(this.ownsAriaLabel=!1,this.ownedAriaLabel=null),this.label){(this.ownsAriaLabel||e===null)&&(this.setAttribute("aria-label",this.label),this.ownsAriaLabel=!0,this.ownedAriaLabel=this.label);return}this.ownsAriaLabel&&(this.removeAttribute("aria-label"),this.ownsAriaLabel=!1,this.ownedAriaLabel=null)}syncFormState(e){if(this.formState.setFormValue(e?e.value:null,this.value),this.required&&!e){let t=this.segments().find(r=>!this.isSegmentDisabled(r));this.formState.setValidity({valueMissing:!0},y("segmented.validation.required"),t)}else this.formState.clearValidity()}onSlotChange=()=>{this.requestUpdate()};onSegmentChange=()=>{this.requestUpdate()};onClick=e=>{let t=this.segmentFrom(e.target);!t||this.isSegmentDisabled(t)||this.activate(t)};onKeyDown=e=>{if(this.formState.effectiveDisabled)return;let t=this.segments().filter(n=>!this.isSegmentDisabled(n));if(t.length===0)return;let r=this.nextSegment(e.key,t,this.segmentFrom(e.target));r&&(e.preventDefault(),this.activate(r))};nextSegment(e,t,r){let n=r?t.indexOf(r):-1,o=t.length-1;return ma.includes(e)?t[n<0||n===o?0:n+1]:ba.includes(e)?t[n<=0?o:n-1]:e===" "&&n>=0?t[n]:null}segmentFrom(e){let t=e instanceof Element?e.closest(Le):null;return t?.parentElement===this?t:null}activate(e){let t=this.value!==e.value;this.value=e.value,e.focus(),t&&this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:this.value}}))}resetForm(){this.value=this.getAttribute("value")??""}restoreFormState(e){typeof e=="string"&&(this.value=e)}};var Xr="mndw-slider",Yr=0,_n=100,Pn=1,fa=10,va=12,ga=["ArrowRight","ArrowUp"],wa=["ArrowLeft","ArrowDown"],at=class extends g{static formAssociated=!0;static properties={value:{type:Number},min:{type:Number,reflect:!0},max:{type:Number,reflect:!0},step:{type:Number,reflect:!0},valueFormatter:{attribute:!1},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},name:{type:String,reflect:!0}};static styles=v`
982
+ :host {
983
+ ${M}
984
+
985
+ display: inline-flex;
986
+ width: 100%;
987
+ min-height: var(--mndw-control-h);
988
+ gap: var(--mndw-space-3);
989
+ align-items: center;
990
+ color: var(--mndw-text);
991
+ cursor: pointer;
992
+ touch-action: none;
993
+ user-select: none;
994
+ }
995
+
996
+ :host([disabled]) {
997
+ color: var(--mndw-text-muted);
998
+ cursor: not-allowed;
999
+ opacity: 0.65;
1000
+ }
1001
+
1002
+ :host(:focus-visible) {
1003
+ outline: none;
1004
+ }
1005
+
1006
+ [part='track'] {
1007
+ position: relative;
1008
+ height: var(--mndw-slider-track-h);
1009
+ flex: 1 1 auto;
1010
+ border-radius: var(--mndw-slider-track-h);
1011
+ background: var(--mndw-surface);
1012
+ }
1013
+
1014
+ :host(:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true'])) [part='track']:hover {
1015
+ ${$}
1016
+ }
1017
+
1018
+ [part='fill'] {
1019
+ position: absolute;
1020
+ top: 0;
1021
+ left: 0;
1022
+ height: 100%;
1023
+ border-radius: inherit;
1024
+ background: var(--mndw-accent);
1025
+ }
1026
+
1027
+ [part='thumb'] {
1028
+ position: absolute;
1029
+ top: 50%;
1030
+ width: var(--mndw-slider-thumb-size);
1031
+ height: var(--mndw-slider-thumb-size);
1032
+ border: var(--mndw-border-w) solid var(--mndw-accent-contrast);
1033
+ border-radius: 50%;
1034
+ background: var(--mndw-accent);
1035
+ box-sizing: border-box;
1036
+ transform: translate(-50%, -50%);
1037
+ }
1038
+
1039
+ :host(:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true'])) [part='thumb']:hover {
1040
+ ${te}
1041
+ }
1042
+
1043
+ :host(:focus-visible) [part='thumb'] {
1044
+ ${R}
1045
+ }
1046
+
1047
+ :host([disabled]) [part='fill'],
1048
+ :host([disabled]) [part='thumb'] {
1049
+ background: var(--mndw-text-subtle);
1050
+ }
1051
+
1052
+ :host([disabled]) [part='thumb'] {
1053
+ border-color: var(--mndw-surface);
1054
+ }
1055
+
1056
+ [part='output'] {
1057
+ flex: 0 0 auto;
1058
+ color: var(--mndw-text-muted);
1059
+ font-size: var(--mndw-text-xs);
1060
+ font-variant-numeric: tabular-nums;
1061
+ }
1062
+ `;formState=new N(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});labelController=new ee(this);dragPointer=null;dragBaseline=0;constructor(){super(),this.value=Yr,this.min=Yr,this.max=_n,this.step=Pn,this.disabled=!1,this.required=!1,this.invalid=!1,this.name="",this.addEventListener("keydown",this.onKeyDown),this.addEventListener("pointerdown",this.onPointerDown)}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["value"])}disconnectedCallback(){super.disconnectedCallback(),this.endDrag(!1)}refreshAccessibleName(){this.requestUpdate()}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}willUpdate(){this.min=Number.isFinite(this.min)?this.min:Yr,this.max=Number.isFinite(this.max)?this.max:_n,this.step=Number.isFinite(this.step)&&this.step>0?this.step:Pn;let e=this.normalizeValue(this.value);e!==this.value&&(this.value=e)}render(){let e=this.percent;return u`
1063
+ <div part="track">
1064
+ <div part="fill" style="width: ${e}%"></div>
1065
+ <div part="thumb" style="left: ${e}%"></div>
1066
+ </div>
1067
+ <span part="output" aria-hidden="true">${this.formatValue(this.value)}</span>
1068
+ `}updated(){let e=this.formState.effectiveDisabled;this.setAttribute("role","slider"),this.setAttribute("aria-valuenow",String(this.value)),this.setAttribute("aria-valuemin",String(this.min)),this.setAttribute("aria-valuemax",String(this.max)),this.setAttribute("aria-orientation","horizontal"),this.setAttribute("aria-disabled",String(e)),this.tabIndex=e?-1:0,this.valueFormatter?this.setAttribute("aria-valuetext",this.formatValue(this.value)):this.removeAttribute("aria-valuetext"),this.formState.setFormValue(String(this.value),String(this.value)),this.syncValidity(),this.syncLabels()}get percent(){let e=this.max-this.min;return e<=0?0:Math.min(Math.max((this.value-this.min)/e*100,0),100)}formatValue(e){try{let t=this.valueFormatter?.(e);return typeof t=="string"?t:String(e)}catch{return String(e)}}normalizeValue(e){let t=Number.isFinite(e)?e:this.min,r=Math.min(Math.max(t,this.min),this.max),n=Math.round((r-this.min)/this.step),o=this.min+n*this.step,a=o>this.max?this.min+Math.floor((this.max-this.min)/this.step)*this.step:o;return Number.parseFloat(a.toPrecision(va))}syncLabels(){let e=this.formState.labels,t=this.formState.internals;this.labelController.sync(e,t),t&&(t.role="slider",t.ariaValueNow=String(this.value),t.ariaValueMin=String(this.min),t.ariaValueMax=String(this.max),t.ariaValueText=this.valueFormatter?this.formatValue(this.value):null,t.ariaOrientation="horizontal",t.ariaDisabled=String(this.formState.effectiveDisabled))}syncValidity(){if(this.value<this.min){this.formState.setValidity({rangeUnderflow:!0},`Value must be ${this.min} or more.`);return}if(this.value>this.max){this.formState.setValidity({rangeOverflow:!0},`Value must be ${this.max} or less.`);return}let e=(this.value-this.min)/this.step;if(Math.abs(e-Math.round(e))>Number.EPSILON){this.formState.setValidity({stepMismatch:!0},`Value must be a multiple of ${this.step}.`);return}this.formState.clearValidity()}onKeyDown=e=>{if(this.formState.effectiveDisabled)return;let t=this.keyValue(e.key);t!==null&&(e.preventDefault(),this.applyUserValue(t)&&this.dispatchChange())};keyValue(e){if(ga.includes(e))return this.value+this.step;if(wa.includes(e))return this.value-this.step;let t=Math.max(this.step,(this.max-this.min)/fa);return e==="PageUp"?this.value+t:e==="PageDown"?this.value-t:e==="Home"?this.min:e==="End"?this.max:null}onPointerDown=e=>{this.formState.effectiveDisabled||e.isPrimary===!1||this.dragPointer!==null||(e.preventDefault(),this.dragPointer=e.pointerId,this.dragBaseline=this.value,this.focus(),typeof this.setPointerCapture=="function"&&this.setPointerCapture(e.pointerId),window.addEventListener("pointermove",this.onPointerMove),window.addEventListener("pointerup",this.onPointerUp),window.addEventListener("pointercancel",this.onPointerUp),this.applyUserValue(this.valueFromPointer(e)))};onPointerMove=e=>{this.dragPointer===e.pointerId&&this.applyUserValue(this.valueFromPointer(e))};onPointerUp=e=>{this.dragPointer===e.pointerId&&this.endDrag(!0)};endDrag(e){if(this.dragPointer===null)return;let t=this.dragPointer;this.dragPointer=null,window.removeEventListener("pointermove",this.onPointerMove),window.removeEventListener("pointerup",this.onPointerUp),window.removeEventListener("pointercancel",this.onPointerUp),typeof this.releasePointerCapture=="function"&&this.hasPointerCapture(t)&&this.releasePointerCapture(t),e&&this.value!==this.dragBaseline&&this.dispatchChange()}valueFromPointer(e){let r=this.renderRoot.querySelector('[part="track"]')?.getBoundingClientRect();return!r||r.width===0?this.value:this.min+(e.clientX-r.left)/r.width*(this.max-this.min)}applyUserValue(e){let t=this.normalizeValue(e);return t===this.value?!1:(this.value=t,this.dispatchEvent(new CustomEvent("mndwinput",{bubbles:!0,composed:!0,detail:{value:t}})),!0)}dispatchChange(){this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:this.value}}))}resetForm(){let e=this.getAttribute("value"),t=e===null?Number.NaN:Number(e);this.value=Number.isFinite(t)?t:this.min}restoreFormState(e){if(typeof e!="string")return;let t=Number(e);Number.isFinite(t)&&e.trim()!==""&&(this.value=t)}};var Jr="mndw-switch",st=class extends g{static formAssociated=!0;static properties={checked:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},value:{type:String,reflect:!0},name:{type:String,reflect:!0}};static styles=v`
1069
+ :host {
1070
+ ${M}
1071
+
1072
+ display: inline-flex;
1073
+ gap: var(--mndw-space-2);
1074
+ align-items: center;
1075
+ color: var(--mndw-text);
1076
+ cursor: pointer;
1077
+ user-select: none;
1078
+ }
1079
+
1080
+ :host([disabled]) {
1081
+ color: var(--mndw-text-muted);
1082
+ cursor: not-allowed;
1083
+ opacity: 0.65;
1084
+ }
1085
+
1086
+ :host(:focus-visible) {
1087
+ outline: none;
1088
+ }
1089
+
1090
+ [part='track'] {
1091
+ position: relative;
1092
+ display: inline-flex;
1093
+ width: var(--mndw-switch-w);
1094
+ height: var(--mndw-switch-h);
1095
+ flex: 0 0 auto;
1096
+ align-items: center;
1097
+ padding: 0.125rem;
1098
+ border: var(--mndw-border-w) solid var(--mndw-border);
1099
+ border-radius: var(--mndw-switch-h);
1100
+ background: var(--mndw-surface);
1101
+ box-sizing: border-box;
1102
+ transition: background var(--mndw-duration-fast) var(--mndw-easing);
1103
+ }
1104
+
1105
+ :host(:focus-visible) [part='track'] {
1106
+ ${R}
1107
+ }
1108
+
1109
+ :host([checked]) [part='track'] {
1110
+ border-color: var(--mndw-accent);
1111
+ background: var(--mndw-accent);
1112
+ }
1113
+
1114
+ :host(:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true']):hover) [part='track'] {
1115
+ ${$}
1116
+ }
1117
+
1118
+ :host([checked]:not([disabled]):not([aria-disabled='true']):not([invalid]):not([aria-invalid='true']):hover) [part='track'] {
1119
+ ${te}
1120
+ }
1121
+
1122
+ [part='thumb'] {
1123
+ width: calc(var(--mndw-switch-h) - 0.5rem);
1124
+ height: calc(var(--mndw-switch-h) - 0.5rem);
1125
+ border-radius: 50%;
1126
+ background: var(--mndw-text-subtle);
1127
+ transition: transform var(--mndw-duration-fast) var(--mndw-easing);
1128
+ }
1129
+
1130
+ :host([checked]) [part='thumb'] {
1131
+ background: var(--mndw-accent-contrast);
1132
+ transform: translateX(calc(var(--mndw-switch-w) - var(--mndw-switch-h)));
1133
+ }
1134
+ `;formState=new N(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});labelController=new ee(this);constructor(){super(),this.checked=!1,this.disabled=!1,this.required=!1,this.invalid=!1,this.value="on",this.name="",this.addEventListener("click",this.onClick),this.addEventListener("keydown",this.onKeyDown)}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["checked"])}refreshAccessibleName(){this.requestUpdate()}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}render(){return u`
1135
+ <span part="track" aria-hidden="true">
1136
+ <span part="thumb"></span>
1137
+ </span>
1138
+ <slot part="label"></slot>
1139
+ `}updated(){let e=this.formState.effectiveDisabled,t=String(this.checked);this.setAttribute("role","switch"),this.setAttribute("aria-checked",t),this.setAttribute("aria-disabled",String(e)),this.tabIndex=e?-1:0,this.formState.setFormValue(this.checked?this.value:null,this.checked?"checked":"unchecked");let r=this.formState.internals,n=this.formState.labels;this.labelController.sync(n,r),r&&(r.role="switch",r.ariaChecked=t,r.ariaDisabled=String(e),this.checked?r.states.add("checked"):r.states.delete("checked"))}onClick=e=>{if(this.formState.effectiveDisabled){e.preventDefault();return}this.toggle()};onKeyDown=e=>{this.formState.effectiveDisabled||e.key!==" "&&e.key!=="Enter"||(e.preventDefault(),this.toggle())};toggle(){this.checked=!this.checked,this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{checked:this.checked}}))}resetForm(){this.checked=this.hasAttribute("checked")}restoreFormState(e){e==="checked"?this.checked=!0:e==="unchecked"&&(this.checked=!1)}};var ke="mndw-tab-panel",Dn=0,lt=class extends g{static properties={for:{type:String,reflect:!0}};static styles=v`
1140
+ :host {
1141
+ ${M}
1142
+
1143
+ display: block;
1144
+ padding: var(--mndw-space-3);
1145
+ color: var(--mndw-text);
1146
+ }
1147
+
1148
+ :host([hidden]) {
1149
+ display: none;
1150
+ }
1151
+ `;constructor(){super(),this.for=""}connectedCallback(){super.connectedCallback(),this.id===""&&(Dn+=1,this.id=`mndw-tab-panel-${Dn}`)}render(){return u`
1152
+ <div part="panel">
1153
+ <slot></slot>
1154
+ </div>
1155
+ `}};var G="mndw-tab",dt=class extends g{static properties={disabled:{type:Boolean,reflect:!0}};static styles=v`
1156
+ :host {
1157
+ ${M}
1158
+
1159
+ display: inline-flex;
1160
+ cursor: pointer;
1161
+ user-select: none;
1162
+ }
1163
+
1164
+ :host([aria-disabled='true']) {
1165
+ cursor: not-allowed;
1166
+ opacity: 0.5;
1167
+ }
1168
+
1169
+ :host(:focus-visible) {
1170
+ outline: none;
1171
+ }
1172
+
1173
+ [part='tab'] {
1174
+ ${B}
1175
+
1176
+ display: inline-flex;
1177
+ align-items: center;
1178
+ justify-content: center;
1179
+ border-bottom: 2px solid transparent;
1180
+ border-radius: var(--mndw-radius-sm) var(--mndw-radius-sm) 0 0;
1181
+ color: var(--mndw-text-subtle);
1182
+ white-space: nowrap;
1183
+ transition: background var(--mndw-duration-fast) var(--mndw-easing),
1184
+ color var(--mndw-duration-fast) var(--mndw-easing);
1185
+ }
1186
+
1187
+ :host(:focus-visible) [part='tab'] {
1188
+ outline: var(--mndw-focus-w) solid var(--mndw-focus-ring);
1189
+ outline-offset: -0.0625rem;
1190
+ }
1191
+
1192
+ :host([aria-selected='true']) [part='tab'] {
1193
+ border-bottom-color: var(--mndw-accent);
1194
+ color: var(--mndw-text);
1195
+ font-weight: var(--mndw-weight-semibold);
1196
+ }
1197
+
1198
+ :host(:not([disabled]):not([aria-disabled='true']):hover) [part='tab'] {
1199
+ ${Me}
1200
+ ${re}
1201
+ }
1202
+ `;constructor(){super(),this.disabled=!1}connectedCallback(){super.connectedCallback(),this.hasAttribute("for")&&console.warn(`<${G} id="${this.id}"> has a "for" attribute; the panel points at its tab, so put "for" on the <mndw-tab-panel> instead.`)}render(){return u`
1203
+ <span part="tab">
1204
+ <slot></slot>
1205
+ </span>
1206
+ `}};var Zr="mndw-tabs",ya=["role","aria-selected","aria-controls","aria-disabled","tabindex","slot"],Sa=["role","aria-labelledby","hidden"],xa=["id","for","disabled"],Ca=["ArrowRight"],Ma=["ArrowLeft"],ct=class extends g{static properties={value:{type:String}};static styles=v`
1207
+ :host {
1208
+ ${M}
1209
+
1210
+ display: block;
1211
+ }
1212
+
1213
+ [part='tablist'] {
1214
+ display: flex;
1215
+ gap: var(--mndw-space-1);
1216
+ border-bottom: var(--mndw-border-w) solid var(--mndw-border);
1217
+ }
1218
+ `;observer;ownedTabs=[];ownedPanels=[];warnedPanels=new WeakSet;warnedTabs=new WeakSet;constructor(){super(),this.value="",this.observer=new MutationObserver(this.onMutations),this.addEventListener("click",this.onClick),this.addEventListener("keydown",this.onKeyDown)}connectedCallback(){super.connectedCallback(),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:xa})}disconnectedCallback(){super.disconnectedCallback(),this.observer.disconnect(),this.release(this.ownedTabs,this.ownedPanels),this.ownedTabs=[],this.ownedPanels=[]}render(){return u`
1219
+ <div part="tablist" role="tablist" aria-orientation="horizontal">
1220
+ <slot name="tab"></slot>
1221
+ </div>
1222
+ <slot></slot>
1223
+ `}willUpdate(){if(!this.isConnected)return;let e=this.resolveActive(this.tabChildren());this.value!==(e?.id??"")&&(this.value=e?.id??"")}updated(){if(!this.isConnected)return;let e=this.pairing(),t=this.resolveActive(e.tabs);this.release(this.ownedTabs.filter(r=>!e.tabs.includes(r)),this.ownedPanels.filter(r=>!e.panels.includes(r))),this.syncTabs(e,t),this.syncPanels(e,t),this.ownedTabs=e.tabs,this.ownedPanels=e.panels}tabChildren(){return[...this.children].filter(e=>e.localName===G)}pairing(){let e=this.tabChildren(),t=[...this.children].filter(o=>o.localName===ke),r=new Map,n=new Set;for(let o of e){if(o.id==="")continue;let a=t.find(s=>s.for===o.id&&!n.has(s));a&&(n.add(a),r.set(o,a))}return{tabs:e,panels:t,panelOf:r}}isSelectable(e){return e.id!==""&&!e.disabled}resolveActive(e){return e.find(r=>r.id===this.value&&this.isSelectable(r))??e.find(r=>this.isSelectable(r))??null}syncTabs(e,t){for(let r of e.tabs){let n=e.panelOf.get(r),o=this.isSelectable(r);r.setAttribute("slot","tab"),r.setAttribute("role","tab"),r.setAttribute("aria-selected",String(r===t)),r.setAttribute("aria-disabled",String(!o)),r.setAttribute("tabindex",r===t?"0":"-1"),n?r.setAttribute("aria-controls",n.id):r.removeAttribute("aria-controls"),r.id===""&&!this.warnedTabs.has(r)&&(this.warnedTabs.add(r),console.warn(`<${G}> needs an id for its panel to reference; this one is inert.`))}}syncPanels(e,t){let r=new Map;for(let[n,o]of e.panelOf)r.set(o,n);for(let n of e.panels){let o=r.get(n);if(n.setAttribute("role","tabpanel"),n.hidden=o!==t,o){n.setAttribute("aria-labelledby",o.id);continue}n.removeAttribute("aria-labelledby"),this.warnedPanels.has(n)||(this.warnedPanels.add(n),console.warn(`<${ke} for="${n.for}"> matches no <${G}> id; it stays hidden.`))}}release(e,t){for(let r of e)for(let n of ya)r.removeAttribute(n);for(let r of t)for(let n of Sa)r.removeAttribute(n)}onMutations=()=>{this.requestUpdate()};onClick=e=>{let t=this.tabFrom(e.target);!t||!this.isSelectable(t)||this.activate(t)};onKeyDown=e=>{let t=[...this.children].filter(n=>n.localName===G).filter(n=>this.isSelectable(n));if(t.length===0)return;let r=this.nextTab(e.key,t,this.tabFrom(e.target));r&&(e.preventDefault(),this.activate(r))};nextTab(e,t,r){let n=r?t.indexOf(r):-1,o=t.length-1;return Ca.includes(e)?t[n<0||n===o?0:n+1]:Ma.includes(e)?t[n<=0?o:n-1]:e==="Home"?t[0]:e==="End"?t[o]:null}tabFrom(e){let t=e instanceof Element?e.closest(G):null;return t?.parentElement===this?t:null}activate(e){let t=this.value!==e.id;this.value=e.id,e.focus(),t&&this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:this.value}}))}};var Qr="mndw-textarea",ut=class extends g{static formAssociated=!0;static shadowRootOptions={mode:"open",delegatesFocus:!0};static properties={value:{type:String},rows:{type:Number,reflect:!0},autosize:{type:Boolean,reflect:!0},readonly:{type:Boolean,reflect:!0},disabled:{type:Boolean,reflect:!0},required:{type:Boolean,reflect:!0},invalid:{type:Boolean,reflect:!0},name:{type:String,reflect:!0},maxlength:{type:Number,reflect:!0}};static styles=v`
1224
+ :host {
1225
+ ${M}
1226
+
1227
+ display: inline-block;
1228
+ width: 100%;
1229
+ }
1230
+
1231
+ :host([disabled]) {
1232
+ opacity: 0.5;
1233
+ }
1234
+
1235
+ [part='field'] {
1236
+ box-sizing: border-box;
1237
+ display: flex;
1238
+ width: 100%;
1239
+ padding: var(--mndw-space-2) var(--mndw-space-3);
1240
+ border: var(--mndw-border-w) solid var(--mndw-border);
1241
+ border-radius: var(--mndw-radius-md);
1242
+ background: var(--mndw-surface-raised);
1243
+ color: var(--mndw-text);
1244
+ }
1245
+
1246
+ :host(:not([disabled]):not([readonly]):not([invalid]):not([aria-invalid='true'])) [part='field']:hover {
1247
+ ${Ce}
1248
+ }
1249
+
1250
+ :host(:focus-within) [part='field'] {
1251
+ ${R}
1252
+ }
1253
+
1254
+ textarea {
1255
+ width: 100%;
1256
+ padding: 0;
1257
+ border: 0;
1258
+ background: none;
1259
+ color: inherit;
1260
+ font: inherit;
1261
+ line-height: var(--mndw-leading);
1262
+ resize: vertical;
1263
+ }
1264
+
1265
+ :host([autosize]) textarea {
1266
+ overflow: hidden;
1267
+ resize: none;
1268
+ }
1269
+
1270
+ textarea:focus {
1271
+ outline: none;
1272
+ }
1273
+
1274
+ textarea::placeholder {
1275
+ color: var(--mndw-text-subtle);
1276
+ }
1277
+ `;formState=new N(this,{isExplicitlyDisabled:()=>this.disabled,onReset:()=>this.resetForm(),onStateRestore:e=>this.restoreFormState(e),onDisabledChange:()=>{this.requestUpdate()}});announcement=new Ee(this,{formState:this.formState,isInvalid:()=>this.invalid});commits=new Te(e=>this.emitChange(e));resizeObserver=null;constructor(){super(),this.value="",this.rows=3,this.autosize=!1,this.readonly=!1,this.disabled=!1,this.required=!1,this.invalid=!1,this.name="",this.maxlength=null}connectedCallback(){super.connectedCallback(),this.formState.captureInitialAttributes(["value"]),this.announcement.connect(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),this.announcement.disconnect(),this.stopAutosize()}refreshAccessibleName(){this.requestUpdate()}formDisabledCallback(e){this.formState.formDisabledCallback(e)}formResetCallback(){this.formState.formResetCallback()}formStateRestoreCallback(e,t){this.formState.formStateRestoreCallback(e,t)}focus(e){this.innerTextarea?.focus(e)}render(){return u`
1278
+ <div part="field">
1279
+ <textarea
1280
+ part="textarea"
1281
+ @input=${this.onInnerInput}
1282
+ @focus=${this.onInnerFocus}
1283
+ @blur=${this.onInnerBlur}
1284
+ ></textarea>
1285
+ </div>
1286
+ `}updated(e){let t=this.innerTextarea;t&&(this.syncInner(t),e.has("value")&&this.commits.syncValue(this.value),this.syncFormState(t),this.announcement.sync(t),this.syncAutosize(t))}get innerTextarea(){return this.renderRoot.querySelector("textarea")}syncInner(e){F(e,"maxlength",this.maxlength===null?"":String(this.maxlength)),F(e,"rows",this.autosize?"":String(this.rows)),e.toggleAttribute("readonly",this.readonly),e.toggleAttribute("disabled",this.formState.effectiveDisabled),e.toggleAttribute("required",this.required||this.announcement.hasAriaRequired),e.value!==this.value&&(e.value=this.value)}syncFormState(e){this.formState.setFormValue(this.value),this.formState.setValidity(zt(e.validity),e.validationMessage)}syncAutosize(e){if(!this.autosize){this.stopAutosize(),e.style.removeProperty("height");return}!this.resizeObserver&&typeof ResizeObserver=="function"&&(this.resizeObserver=new ResizeObserver(()=>{this.resizeToContent(e)}),this.resizeObserver.observe(e)),this.resizeToContent(e)}resizeToContent(e){e.style.height="auto",e.style.height=`${e.scrollHeight}px`}stopAutosize(){this.resizeObserver?.disconnect(),this.resizeObserver=null}onInnerInput=e=>{this.commits.markUserInput(),this.value=e.target.value,this.dispatchEvent(new CustomEvent("mndwinput",{bubbles:!0,composed:!0,detail:{value:this.value}}))};onInnerFocus=()=>{this.commits.captureBaseline(this.value)};onInnerBlur=()=>{this.commits.commit(this.value),this.commits.releaseBaseline()};emitChange(e){this.dispatchEvent(new CustomEvent("mndwchange",{bubbles:!0,composed:!0,detail:{value:e}}))}resetForm(){this.value=this.getAttribute("value")??""}restoreFormState(e){typeof e=="string"&&(this.value=e)}};var Xt="mndw-tooltip",ht="aria-describedby",Ea=/\s+/u,Ta=500,Nn=0;function ei(i){return(i.getAttribute(ht)??"").split(Ea).filter(e=>e!=="")}var pt=class extends g{static properties={text:{type:String},placement:{type:String,reflect:!0},delay:{type:Number,reflect:!0},visible:{type:Boolean,state:!0}};static styles=v`
1287
+ :host {
1288
+ ${M}
1289
+
1290
+ display: contents;
1291
+ }
1292
+
1293
+ /*
1294
+ * Closed means invisible, never removed: the description is resolved from this text, so
1295
+ * \`display: none\` or \`hidden\` would leave the trigger describing nothing.
1296
+ */
1297
+ [part='tooltip'] {
1298
+ position: fixed;
1299
+ z-index: 1000;
1300
+ max-width: 15rem;
1301
+ padding: var(--mndw-space-1) var(--mndw-space-2);
1302
+ border: var(--mndw-border-w) solid var(--mndw-border);
1303
+ border-radius: var(--mndw-radius-sm);
1304
+ background: var(--mndw-surface-raised);
1305
+ box-shadow: var(--mndw-shadow-2);
1306
+ color: var(--mndw-text);
1307
+ font-size: var(--mndw-text-xs);
1308
+ line-height: var(--mndw-leading);
1309
+ opacity: 0;
1310
+ pointer-events: none;
1311
+ transition: opacity var(--mndw-duration-fast) var(--mndw-easing);
1312
+ }
1313
+
1314
+ :host([open]) [part='tooltip'] {
1315
+ opacity: 1;
1316
+ }
1317
+ `;observer;trigger=null;ownedToken=null;showTimer=null;warnedExtras=!1;constructor(){super(),this.text="",this.placement="top",this.delay=Ta,this.visible=!1,this.observer=new MutationObserver(this.onMutations),this.addEventListener("keydown",this.onKeyDown)}connectedCallback(){super.connectedCallback(),this.id===""&&(Nn+=1,this.id=`mndw-tooltip-${Nn}`),this.observer.observe(this,{attributes:!0,attributeFilter:["id"],childList:!0})}disconnectedCallback(){super.disconnectedCallback(),this.cancelShow(),this.observer.disconnect(),this.releaseTrigger(),this.visible=!1}render(){return u`
1318
+ <slot></slot>
1319
+ ${this.text?u`<div part="tooltip" role="none">${this.text}</div>`:b}
1320
+ `}willUpdate(){this.text||(this.cancelShow(),this.visible=!1)}updated(){this.isConnected&&(this.text?this.setAttribute("role","tooltip"):this.removeAttribute("role"),this.toggleAttribute("open",this.visible),this.wireTrigger())}bubble(){return this.renderRoot.querySelector('[part="tooltip"]')}assignedTrigger(){let t=this.renderRoot.querySelector("slot")?.assignedElements()??[];return t.length>1&&!this.warnedExtras&&(this.warnedExtras=!0,console.warn(`<${Xt} id="${this.id}"> takes one trigger element; the rest are ignored.`)),t[0]??null}wireTrigger(){let e=this.assignedTrigger();if(e!==this.trigger&&(this.releaseTrigger(),this.trigger=e,e&&(this.observer.observe(e,{attributes:!0,attributeFilter:[ht]}),e.addEventListener("pointerenter",this.onShowIntent),e.addEventListener("focusin",this.onShowIntent),e.addEventListener("pointerleave",this.onHideIntent),e.addEventListener("focusout",this.onHideIntent))),!e)return;let t=this.text?this.id:null;if(t===null){this.writeTokens(e,ei(e).filter(n=>n!==this.ownedToken)),this.ownedToken=null;return}let r=ei(e).filter(n=>n!==this.ownedToken&&n!==t);this.writeTokens(e,[...r,t]),this.ownedToken=t}writeTokens(e,t){if(t.length===0){e.removeAttribute(ht);return}let r=t.join(" ");e.getAttribute(ht)!==r&&e.setAttribute(ht,r)}releaseTrigger(){let e=this.trigger;e&&(e.removeEventListener("pointerenter",this.onShowIntent),e.removeEventListener("focusin",this.onShowIntent),e.removeEventListener("pointerleave",this.onHideIntent),e.removeEventListener("focusout",this.onHideIntent)),e&&this.ownedToken!==null&&this.writeTokens(e,ei(e).filter(t=>t!==this.ownedToken)),this.ownedToken=null,this.trigger=null}onMutations=()=>{this.requestUpdate()};onShowIntent=()=>{!this.text||this.visible||this.showTimer!==null||(this.showTimer=setTimeout(()=>{this.showTimer=null,this.show()},Math.max(this.delay,0)))};onHideIntent=()=>{this.cancelShow(),this.hide()};onKeyDown=e=>{e.key==="Escape"&&this.onHideIntent()};cancelShow(){this.showTimer!==null&&(clearTimeout(this.showTimer),this.showTimer=null)}show(){!this.text||!this.isConnected||(this.visible=!0,this.position())}hide(){this.visible=!1}position(){let e=this.bubble();if(!this.trigger||!e)return;let t=this.trigger.getBoundingClientRect(),r=e.getBoundingClientRect(),n=zr(t,{width:r.width,height:r.height},this.placement);e.style.top=`${n.top}px`,e.style.left=`${n.left}px`,this.setAttribute("data-placement",n.placement)}};var bt="mndw-column-menu",ti="mndwcolumnmenucheck",mt=class extends g{static properties={columns:{type:Array,attribute:!1},hiddenColumns:{type:Array,attribute:!1},initialFocus:{type:String,attribute:!1}};static styles=v`
1321
+ :host {
1322
+ ${M}
1323
+ display: block;
1324
+ color: var(--mndw-text);
1325
+ }
1326
+
1327
+ [part='menu'] {
1328
+ display: flex;
1329
+ flex-direction: column;
1330
+ min-width: 11.25rem;
1331
+ padding: var(--mndw-space-2);
1332
+ gap: var(--mndw-space-1);
1333
+ background: var(--mndw-surface-raised);
1334
+ border: 1px solid var(--mndw-border);
1335
+ border-radius: var(--mndw-radius-md);
1336
+ box-shadow: var(--mndw-shadow-2);
1337
+ }
1338
+
1339
+ [part='option'] {
1340
+ display: flex;
1341
+ align-items: center;
1342
+ gap: var(--mndw-space-2);
1343
+ padding: var(--mndw-space-2);
1344
+ border: 0;
1345
+ border-radius: var(--mndw-radius-sm);
1346
+ background: none;
1347
+ color: inherit;
1348
+ font: inherit;
1349
+ text-align: start;
1350
+ cursor: pointer;
1351
+ }
1352
+
1353
+ [part='option']:hover {
1354
+ ${$}
1355
+ }
1356
+
1357
+ [part='option']:focus-visible {
1358
+ ${R}
1359
+ }
1360
+
1361
+ [part='indicator'] {
1362
+ display: inline-grid;
1363
+ width: 1.125rem;
1364
+ height: 1.125rem;
1365
+ place-items: center;
1366
+ border: 1px solid var(--mndw-border);
1367
+ border-radius: var(--mndw-radius-sm);
1368
+ background: var(--mndw-surface);
1369
+ color: var(--mndw-accent-contrast);
1370
+ flex: 0 0 auto;
1371
+ }
1372
+
1373
+ [part='indicator'][data-checked='true'] {
1374
+ border-color: var(--mndw-accent);
1375
+ background: var(--mndw-accent);
1376
+ }
1377
+
1378
+ [part='checkmark'] {
1379
+ width: 0.3rem;
1380
+ height: 0.55rem;
1381
+ border: solid currentColor;
1382
+ border-width: 0 2px 2px 0;
1383
+ transform: translateY(-0.0625rem) rotate(45deg);
1384
+ }
1385
+ `;workingHidden=new Set;keyManager=new Ae({getLabel:e=>e.label,isDisabled:()=>!1});constructor(){super(),this.columns=[],this.hiddenColumns=[],this.initialFocus="first"}connectedCallback(){super.connectedCallback(),this.workingHidden=new Set(this.hiddenColumns)}firstUpdated(){this.focusInitialOption()}render(){return u`
1386
+ <div
1387
+ part="menu"
1388
+ role="menu"
1389
+ @keydown=${this.handleKeydown}
1390
+ >
1391
+ ${this.columns.map(e=>{let t=!this.workingHidden.has(e.id);return u`
1392
+ <button
1393
+ type="button"
1394
+ part="option"
1395
+ role="menuitemcheckbox"
1396
+ tabindex="-1"
1397
+ data-column-id=${e.id}
1398
+ aria-checked=${String(t)}
1399
+ @click=${()=>this.toggle(e.id)}
1400
+ >
1401
+ <span part="indicator" data-checked=${String(t)} aria-hidden="true">
1402
+ ${t?u`<span part="checkmark"></span>`:null}
1403
+ </span>
1404
+ ${e.label}
1405
+ </button>
1406
+ `})}
1407
+ </div>
1408
+ `}toggle(e){this.workingHidden.has(e)?this.workingHidden.delete(e):this.workingHidden.add(e),this.requestUpdate(),this.dispatchEvent(new CustomEvent(ti,{bubbles:!0,composed:!0,detail:{hidden:[...this.workingHidden]}}))}focusFirstOption(){this.focusOption(0)}focusInitialOption(){this.focusOption(this.initialFocus==="last"?this.columns.length-1:0)}focusOption(e){let t=[...this.renderRoot.querySelectorAll("button[data-column-id]")];t.length!==0&&t[(e%t.length+t.length)%t.length]?.focus()}handleKeydown=e=>{let t=[...this.renderRoot.querySelectorAll("button[data-column-id]")],r=J(),n=t.indexOf(r);if(n<0&&(n=0),e.key==="Enter"){e.preventDefault(),t[n]?.click(),this.dismiss(!0);return}if(e.key==="Escape"){e.preventDefault(),e.stopPropagation(),this.dismiss(!0);return}if(e.key==="Tab"){this.dismiss(!1,!0,e.shiftKey?"backward":"forward");return}let o={items:this.columns,wrap:!0,mode:"roving-focus",get activeIndex(){return n},set activeIndex(a){n=a},setActiveIndex(a){n=a},focusItem(a){t[a]?.focus()}};this.keyManager.handleKeydown(e,o)};dismiss(e,t=!1,r){let n=t&&r!==void 0?{restoreFocus:e,defer:!0,tabDirection:r}:t?{restoreFocus:e,defer:!0}:{restoreFocus:e};this.dispatchEvent(new CustomEvent("mndwpaneldismiss",{bubbles:!0,composed:!0,detail:n}))}};var Jt="mndwselectionchange",ri="mndwsortchange",ii="mndwrowreorder",ni="mndwcolumnvisibilitychange",oi="mndwerror",ai="mndwrowexpand",W="__mndw_detail__";var Zt=class{entries=new Map;host;nextSlotId=1;constructor(e){this.host=e}reconcile(e,t,r,n,o,a=new Set,s){let l=new Set;for(let c of e)this.reconcileRow(c,t(c),r,n,o,l,a,s);this.pruneRemoved(l)}reconcileRow(e,t,r,n,o,a,s,l){let c=this.entries.get(t);c===void 0&&(c=new Map,this.entries.set(t,c));for(let d of r){if(d.renderer===void 0||!n.has(d.id))continue;a.add(`${t}\0${d.id}`);let h=c.get(d.id),p={node:h?.node??document.createElement("div"),row:e,value:o(d,e),colId:d.id};if(h?.rendererFactory===d.renderer){h.renderer.update(p);continue}h!==void 0&&(h.renderer.destroy(),h.node.remove());let f=d.renderer(),m=p.node;m.setAttribute("slot",`mc-${this.nextSlotId++}`),this.host.appendChild(m);let S={slotId:m.getAttribute("slot")??"",node:m,renderer:f,rendererFactory:d.renderer,rowKey:t,colId:d.id};f.mount({node:m,row:e,value:p.value,colId:d.id}),c.set(d.id,S)}if(l!==void 0&&s.has(t)){a.add(`${t}\0${W}`);let d=c.get(W),h={node:d?.node??document.createElement("div"),row:e,value:e,colId:W};if(d?.rendererFactory===l)d.renderer.update(h);else{d!==void 0&&(d.renderer.destroy(),d.node.remove());let p=l(),f=h.node;f.setAttribute("slot",`mc-${this.nextSlotId++}`),this.host.appendChild(f),p.mount({node:f,row:e,value:e,colId:W}),c.set(W,{slotId:f.getAttribute("slot")??"",node:f,renderer:p,rendererFactory:l,rowKey:t,colId:W})}}}pruneRemoved(e){for(let[t,r]of this.entries){for(let[n,o]of r)e.has(`${t}\0${n}`)||(o.renderer.destroy(),o.node.remove(),r.delete(n));r.size===0&&this.entries.delete(t)}}getSlotId(e,t){return this.entries.get(e)?.get(t)?.slotId}getRowKeyForNode(e){for(let[t,r]of this.entries)for(let n of r.values())if(n.node===e||n.node.contains(e))return t}drain(){for(let e of this.entries.values())for(let t of e.values())t.renderer.destroy(),t.node.remove();this.entries.clear()}};function On(i){for(let e=i.length-1;e>=0;e-=1){let t=i[e]?.rowKey;if(t!==void 0)return t}}var $n=new WeakMap;function In(i,e){$n.set(i,e)}function Qt(i){return $n.get(i)}function Fn(){return{createResizeObserver(i){return typeof ResizeObserver>"u"?null:new ResizeObserver(i)},requestAnimationFrame(i){return requestAnimationFrame(i)},cancelAnimationFrame(i){cancelAnimationFrame(i)},measure(i){return i.getBoundingClientRect()},getViewportScrollTop(i){return i.scrollTop},setViewportScrollTop(i,e){i.scrollTop=e},getViewportClientHeight(i){return i.clientHeight},getViewportContentWidth(i){return i.clientWidth}}}function be(i){return i!==void 0&&Number.isFinite(i)&&i>0}function Hn(i,e){return be(i)?i:e}function zn(i){let e=Hn(i.estimatedRowHeight,1),t=Hn(i.detailEstimate,1);return i.keys.map(r=>{let n=i.measurements.get(r),o=be(n?.summary)?n.summary:e,a=i.expandedKeys.has(r)?be(n?.detail)?n.detail:t:0;return o+a})}function Un(i){let e=[0];for(let t of i)e.push(e[e.length-1]+t);return e}function Bn(i,e){let t=0,r=i.length-1;for(;t<r;){let n=Math.floor((t+r)/2);i[n+1]<e?t=n+1:r=n}return Math.min(t,i.length-2)}function Ra(i,e){let t=0,r=i.length-2;for(;t<r;){let n=Math.ceil((t+r)/2);i[n]<=e?t=n:r=n-1}return Math.max(0,t)}function Vn(i){if(i.keys.length===0)return{start:0,end:0,paddingBefore:0,paddingAfter:0,totalHeight:0};let e=Un(zn(i)),t=e[e.length-1],r=Math.max(0,Number.isFinite(i.scrollOffset)?i.scrollOffset:0),n=Math.max(0,Number.isFinite(i.viewportHeight)?i.viewportHeight:0),o=Math.max(0,Number.isFinite(i.overscan)?i.overscan:0),a=Math.max(0,r-o),s=r+n+o,l=Bn(e,a),c=Ra(e,s),d=Math.max(l+1,c+1);return{start:l,end:d,paddingBefore:e[l],paddingAfter:Math.max(0,t-e[d]),totalHeight:t}}var er=class{config;keys=[];expandedKeys=new Set;measurements=new Map;prefix=[0];prefixDirty=!0;bootstrapSamples=new Map;frozenMean;initialCohortKeys;constructor(e){this.config={...e}}configure(e){let t=this.config.estimatedRowHeight!==e.estimatedRowHeight||this.config.detailEstimate!==e.detailEstimate;this.config={...e},t&&this.frozenMean===void 0&&this.bootstrapSamples.size<4&&(this.prefixDirty=!0)}setRows(e,t){this.keys=[...e],this.expandedKeys=new Set(t),this.removeMissingKeys(new Set(this.keys)),this.prefixDirty=!0}recordSummaryMeasurement(e,t){if(!this.keys.includes(e)||!be(t))return!1;let r=this.measurements.get(e)?.summary;if(be(r)&&Math.abs(r-t)<=.25)return!1;let n=this.measurements.get(e)??{};return n.summary=t,this.measurements.set(e,n),this.prefixDirty=!0,this.frozenMean===void 0&&(this.bootstrapSamples.set(e,t),this.freezeBootstrapIfReady()),!0}recordDetailMeasurement(e,t){if(!this.keys.includes(e)||!be(t))return!1;let r=this.measurements.get(e)?.detail;if(be(r)&&Math.abs(r-t)<=.25)return!1;let n=this.measurements.get(e)??{};return n.detail=t,this.measurements.set(e,n),this.prefixDirty=!0,!0}clearDetailMeasurement(e){let t=this.measurements.get(e);return t?.detail===void 0?!1:(delete t.detail,t.summary===void 0&&this.measurements.delete(e),this.prefixDirty=!0,!0)}removeMissingKeys(e){for(let t of this.measurements.keys())e.has(t)||this.measurements.delete(t);for(let t of this.bootstrapSamples.keys())e.has(t)||this.bootstrapSamples.delete(t);if(this.initialCohortKeys!==void 0)for(let t of this.initialCohortKeys)e.has(t)||this.initialCohortKeys.delete(t);this.prefixDirty=!0}resetWidthEpoch(){this.measurements.clear(),this.bootstrapSamples.clear(),this.frozenMean=void 0,this.initialCohortKeys=void 0,this.prefixDirty=!0}effectiveSummaryEstimate(){return this.frozenMean!==void 0?this.frozenMean:this.bootstrapSamples.size>=4?this.runningMean():this.config.estimatedRowHeight}range(e,t,r){if(this.initialCohortKeys===void 0&&this.keys.length>0){let n=Vn(this.input(e,t,r));this.initialCohortKeys=new Set(this.keys.slice(n.start,n.end))}return Vn(this.input(e,t,r))}offsetOf(e){let t=this.keys.indexOf(e);if(!(t<0))return this.ensurePrefix(),this.prefix[t]}captureAnchor(e){if(this.keys.length===0)return;this.ensurePrefix();let t=Math.max(0,e),r=Math.min(this.keys.length-1,Bn(this.prefix,t));return{key:this.keys[r],logicalIndex:r,intraRowOffset:Math.max(0,t-this.prefix[r])}}restoreAnchor(e,t){this.ensurePrefix();let r=this.keys.indexOf(e.key),n=r>=0?r:Math.min(Math.max(e.logicalIndex,0),Math.max(0,this.keys.length-1)),o=this.prefix[n]+e.intraRowOffset;return Math.min(Math.max(0,t),Math.max(0,o))}offsetForRow(e,t,r,n){let o=this.keys.indexOf(e);if(o<0)return;this.ensurePrefix();let a=this.prefix[o],s=this.prefix[o+1],l=s-a,c=Math.max(0,r),d=Math.max(0,n);return t==="center"?Math.max(0,a-(c-l)/2):t==="end"?Math.max(0,s-c):t==="nearest"?a<d?a:s>d+c?Math.max(0,s-c):d:a}input(e,t,r){return{keys:this.keys,expandedKeys:this.expandedKeys,measurements:this.measurements,estimatedRowHeight:this.effectiveSummaryEstimate(),detailEstimate:this.config.detailEstimate,scrollOffset:e,viewportHeight:t,overscan:r}}ensurePrefix(){this.prefixDirty&&(this.prefix=Un(zn(this.input(0,0,0))),this.prefixDirty=!1)}runningMean(){let e=0;for(let t of this.bootstrapSamples.values())e+=t;return e/this.bootstrapSamples.size}freezeBootstrapIfReady(){if(this.bootstrapSamples.size<4)return;let e=this.initialCohortKeys!==void 0&&this.initialCohortKeys.size>=4&&[...this.initialCohortKeys].every(t=>this.bootstrapSamples.has(t));(this.bootstrapSamples.size>=16||e)&&(this.frozenMean=this.runningMean())}};function T(i,e){if(typeof i=="function")return i(e);let t=e[i];return typeof t=="string"?t:""}function Wn(i,e){let t=[],r=new Set,n=new Set,o=0;for(let s of i){let l=T(e,s);if(l===""){o++;continue}if(r.has(l)){n.add(l);continue}r.add(l),t.push(s)}let a=[];return n.size>0&&a.push({category:"duplicate-row-key",rowKeys:[...n]}),o>0&&a.push({category:"empty-row-key",count:o}),{rows:t,violations:a}}function qn(i){let e=[],t=new Set,r=new Set;for(let o of i)t.has(o.id)&&r.add(o.id),t.add(o.id);r.size>0&&e.push({category:"duplicate-column-id",columnIds:[...r]});let n=i.map(o=>o.id).filter(o=>o.startsWith("__mndw_"));return n.length>0&&e.push({category:"reserved-column-id",columnIds:n}),e}function jn(i,e){return i.find(t=>t.id===e)}function rr(i,e){let t=i.accessor;return t===void 0?e[i.id]:typeof t=="function"?t(e):e[t]}function Yn(i,e,t){return e==null||jn(i,e.columnId)?.sortable!==!0||t.has(e.columnId)?null:e}function Xn(i,e){return i?.columnId!==e?{columnId:e,direction:"asc"}:i.direction==="asc"?{columnId:e,direction:"desc"}:null}function Kn(i){return i==null||typeof i=="number"&&Number.isNaN(i)}function Aa(i,e,t){let r=i.localeCompare(e,t,{sensitivity:"base"});return r!==0?r:i.localeCompare(e,t,{sensitivity:"case"})}function La(i,e,t,r="en"){return i.comparator!==void 0?i.comparator(e,t):i.kind==="number"||i.kind==="boolean"?Number(e)-Number(t):Aa(String(e),String(t),r)}function Jn(i,e,t,r="en"){if(t==null)return i;let n=jn(e,t.columnId);if(n?.sortable!==!0)return i;let o=t.direction==="desc"?-1:1,a=i.map((s,l)=>({row:s,index:l,value:rr(n,s)}));return a.sort((s,l)=>{let c=Kn(s.value),d=Kn(l.value);if(c&&d)return s.index-l.index;if(c)return 1;if(d)return-1;let h=La(n,s.value,l.value,r);return h!==0?h*o:s.index-l.index}),a.map(s=>s.row)}function ir(i,e){if(e.length===0)return"none";let t=0;for(let r of e)i.has(r)&&t++;return t===e.length?"all":t===0?"none":"indeterminate"}function Zn(i,e){let t=new Set(i);return t.has(e)?t.delete(e):t.add(e),[...t]}function Qn(i,e){let t=new Set(i);if(ir(t,e)==="all")for(let n of e)t.delete(n);else for(let n of e)t.add(n);return[...t]}function Gn(i){return new Set(i.filter(e=>e.hideable!==!1).map(e=>e.id))}function ka(i,e){let t=new Set(i);return t.has(e)?t.delete(e):t.add(e),t}var tr=class{internalHidden=new Set;seededIds=new Set;lastEffective=new Set;wasControlled=!1;effectiveHidden(e,t){this.seed(e);let r=Gn(e);if(t!==void 0){let o=new Set;for(let a of t)r.has(a)&&o.add(a);return this.lastEffective=new Set(o),this.wasControlled=!0,o}this.wasControlled&&(this.internalHidden=new Set(this.lastEffective),this.wasControlled=!1);let n=new Set;for(let o of this.internalHidden)r.has(o)&&n.add(o);return n}toggle(e,t,r){let n=this.effectiveHidden(e,t),o=ka(n,r),a=Gn(e),s=[...o].filter(l=>a.has(l));return t===void 0&&(this.internalHidden=new Set(s)),s}applyInternal(e){this.internalHidden=new Set(e),this.wasControlled=!1}seed(e){for(let t of e)this.seededIds.has(t.id)||(this.seededIds.add(t.id),t.hidden===!0&&this.internalHidden.add(t.id))}};var ft="mndw-table",fe={bubbles:!0,composed:!0,cancelable:!1};function nr(i,e){return i.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??""))}function Z(i){return i.length>0?i.join(" "):b}function _a(){return{selectRow:i=>nr(y("table.selectRow"),{rowName:i}),selectAll:y("table.selectAll"),sortBy:i=>nr(y("table.sortBy"),{column:i}),columnMenu:y("table.columnMenu"),rowFallback:i=>nr(y("table.rowFallback"),{index:i}),reordered:(i,e,t)=>nr(y("table.reordered"),{rowName:i,pos:e,total:t}),invalidData:y("table.invalidData"),expandRow:i=>`Expand ${i}`,collapseRow:i=>`Collapse ${i}`}}var vt=class i extends g{static properties={columns:{type:Array,attribute:!1},rows:{type:Array,attribute:!1},rowKey:{type:String,attribute:"row-key"},virtual:{type:Boolean,reflect:!0},estimatedRowHeight:{type:Number,attribute:"estimated-row-height",reflect:!0},overscan:{type:Number,attribute:"overscan",reflect:!0},selectable:{type:Boolean,reflect:!0},selected:{type:Array,attribute:!1},reorderable:{type:Boolean,reflect:!0},expandable:{type:Boolean,attribute:!1},expandOn:{type:String,attribute:"expand-on"},toggleCell:{type:String,attribute:"toggle-cell"},toggleAfterColumn:{type:String,attribute:"toggle-after-column"},expanded:{type:Array,attribute:!1},expandedRenderer:{type:Object,attribute:!1},sort:{type:Object,attribute:!1},sortMode:{type:String,attribute:"sort-mode"},hiddenColumns:{type:Array,attribute:!1},columnMenu:{type:Boolean,attribute:!1},columnMenuOpen:{state:!0},columnMenuPanelClass:{type:String,attribute:"column-menu-panel-class"},caption:{type:String},label:{type:String},rowLabel:{type:Object,attribute:!1},labels:{type:Object,attribute:!1},emptyLabel:{type:String,attribute:"empty-label"},layout:{type:String,reflect:!0},minWidth:{type:String,attribute:"min-width"},stickyHeader:{type:Boolean,attribute:"sticky-header",reflect:!0}};static styles=v`
1409
+ :host {
1410
+ ${M}
1411
+ display: block;
1412
+ color: var(--mndw-text);
1413
+ }
1414
+
1415
+ [part='viewport'] {
1416
+ box-sizing: border-box;
1417
+ overflow: auto;
1418
+ min-height: 0;
1419
+ overflow-anchor: none;
1420
+ scroll-behavior: auto !important;
1421
+ scrollbar-gutter: stable;
1422
+ /* Keep native table scrolling visually aligned with <mndw-scroll-area>'s custom scrollbar. */
1423
+ scrollbar-width: thin;
1424
+ scrollbar-color: var(--mndw-scrollbar-thumb) var(--mndw-scrollbar-track);
1425
+ }
1426
+
1427
+ [part='viewport']::-webkit-scrollbar {
1428
+ width: var(--mndw-scrollbar-size);
1429
+ height: var(--mndw-scrollbar-size);
1430
+ }
1431
+
1432
+ [part='viewport']::-webkit-scrollbar-track {
1433
+ background: var(--mndw-scrollbar-track);
1434
+ }
1435
+
1436
+ [part='viewport']::-webkit-scrollbar-thumb {
1437
+ border: var(--mndw-focus-w) solid var(--mndw-scrollbar-track);
1438
+ border-radius: var(--mndw-scrollbar-radius);
1439
+ background: var(--mndw-scrollbar-thumb);
1440
+ }
1441
+
1442
+ [part='viewport']::-webkit-scrollbar-thumb:hover {
1443
+ background: var(--mndw-scrollbar-thumb-hover);
1444
+ }
1445
+
1446
+ [part='viewport']::-webkit-scrollbar-corner {
1447
+ background: var(--mndw-scrollbar-track);
1448
+ }
1449
+
1450
+ [part='table'] {
1451
+ width: 100%;
1452
+ border-collapse: collapse;
1453
+ table-layout: fixed;
1454
+ }
1455
+
1456
+ :host([layout='auto']) [part='table'] {
1457
+ table-layout: auto;
1458
+ width: max-content;
1459
+ }
1460
+
1461
+ :host([virtual][layout='auto']) [part='table'] {
1462
+ table-layout: fixed;
1463
+ width: 100%;
1464
+ }
1465
+
1466
+ [part='caption'] {
1467
+ text-align: start;
1468
+ }
1469
+
1470
+ [part~='header-cell'] {
1471
+ text-align: start;
1472
+ padding: var(--mndw-space-2);
1473
+ border-bottom: 1px solid var(--mndw-border);
1474
+ font-size: var(--mndw-text-sm);
1475
+ color: var(--mndw-text-muted);
1476
+ }
1477
+
1478
+ [part~='cell'] {
1479
+ padding: var(--mndw-space-2);
1480
+ border-bottom: 1px solid var(--mndw-border);
1481
+ }
1482
+
1483
+ [part~='select-cell'] {
1484
+ width: 2.5rem;
1485
+ padding-inline: var(--mndw-space-1);
1486
+ text-align: center;
1487
+ }
1488
+
1489
+ [part~='expand-cell'] {
1490
+ width: 2.5rem;
1491
+ padding-inline: var(--mndw-space-1);
1492
+ text-align: center;
1493
+ }
1494
+
1495
+ [part='expand-toggle'] {
1496
+ border: 0;
1497
+ background: none;
1498
+ color: inherit;
1499
+ font: inherit;
1500
+ cursor: pointer;
1501
+ padding: var(--mndw-space-1);
1502
+ font-size: var(--mndw-text-lg);
1503
+ line-height: 1;
1504
+ }
1505
+
1506
+ [part='expand-toggle']:focus-visible {
1507
+ ${R}
1508
+ }
1509
+
1510
+ [part='detail-cell'] {
1511
+ padding: 0;
1512
+ border-bottom: 1px solid var(--mndw-border);
1513
+ }
1514
+
1515
+ [part='detail-row'] [part='detail-cell'] {
1516
+ background: var(--mndw-surface-raised);
1517
+ }
1518
+
1519
+ [part='row']:hover [part~='cell'] {
1520
+ ${$}
1521
+ }
1522
+
1523
+ .nowrap {
1524
+ white-space: nowrap;
1525
+ }
1526
+
1527
+ .pinned {
1528
+ position: sticky;
1529
+ z-index: 1;
1530
+ background: var(--mndw-surface);
1531
+ }
1532
+
1533
+ [part~='header-cell'].pinned {
1534
+ z-index: 2;
1535
+ }
1536
+
1537
+ .pinned-last {
1538
+ border-inline-end: 1px solid var(--mndw-border);
1539
+ }
1540
+
1541
+ :host([sticky-header]) [part~='header-cell'] {
1542
+ position: sticky;
1543
+ top: 0;
1544
+ z-index: 2;
1545
+ background: var(--mndw-surface);
1546
+ }
1547
+
1548
+ :host([sticky-header]) [part~='header-cell'].pinned {
1549
+ z-index: 3;
1550
+ }
1551
+
1552
+ [part='sort-indicator'] {
1553
+ display: inline-flex;
1554
+ width: 1rem;
1555
+ flex: 0 0 1rem;
1556
+ align-items: center;
1557
+ justify-content: center;
1558
+ margin-inline-start: var(--mndw-space-1);
1559
+ color: var(--mndw-text-subtle);
1560
+ }
1561
+
1562
+ [part='sort-indicator'][data-sorted] {
1563
+ color: var(--mndw-text);
1564
+ }
1565
+
1566
+ [part='drag-handle'] {
1567
+ cursor: grab;
1568
+ }
1569
+
1570
+ [part='error'] {
1571
+ padding: var(--mndw-space-2);
1572
+ color: var(--mndw-danger);
1573
+ background: var(--mndw-danger-bg);
1574
+ border-radius: var(--mndw-radius-sm);
1575
+ margin-bottom: var(--mndw-space-2);
1576
+ }
1577
+
1578
+ [part='empty'] {
1579
+ padding: var(--mndw-space-3);
1580
+ color: var(--mndw-text-muted);
1581
+ text-align: center;
1582
+ }
1583
+
1584
+ [part='badge'] {
1585
+ display: inline-flex;
1586
+ align-items: center;
1587
+ gap: var(--mndw-space-1);
1588
+ padding: var(--mndw-space-1) var(--mndw-space-2);
1589
+ border-radius: var(--mndw-radius-sm);
1590
+ background: var(--mndw-surface-raised);
1591
+ color: var(--mndw-text);
1592
+ font-size: var(--mndw-text-sm);
1593
+ }
1594
+
1595
+ [part='badge-dot'] {
1596
+ width: 0.5rem;
1597
+ height: 0.5rem;
1598
+ border-radius: 50%;
1599
+ }
1600
+
1601
+ .align-end {
1602
+ text-align: end;
1603
+ }
1604
+
1605
+ .align-center {
1606
+ text-align: center;
1607
+ }
1608
+
1609
+ .cell-kind-number {
1610
+ font-variant-numeric: tabular-nums;
1611
+ }
1612
+
1613
+ .sort-button {
1614
+ border: 0;
1615
+ background: none;
1616
+ color: inherit;
1617
+ font: inherit;
1618
+ cursor: pointer;
1619
+ padding: 0;
1620
+ display: inline-flex;
1621
+ align-items: center;
1622
+ }
1623
+
1624
+ .sort-button:focus-visible,
1625
+ [part='drag-handle']:focus-visible,
1626
+ [part='column-menu-trigger']:focus-visible {
1627
+ ${R}
1628
+ }
1629
+ `;visibilityState=new tr;geometryProvider;virtualizer=null;resizeObserver=null;observedElements=new Set;observedViewport=null;pendingGeometryFrame=null;observerAttempted=!1;warnedInactiveReason=null;warnedStickyReason=null;pinState={byKey:new Map,inactiveReason:null,inactiveColumnId:null};lastViewportContentWidth;pendingScrollTarget=null;expectedProgrammaticScrollTop;cellRegistry=null;localeController=new L(this);menuLayer=null;cancelMenuFocusRetry=null;menuTrigger=null;effectiveColumns=[];displayRows=[];effectiveHidden=new Set;internalVisibilityNeedsReconcile=!1;effectiveSortState=null;selectedKeySet=new Set;lastCellReconcileSignature=null;lastExpandedKeys=new Set;windowRows=[];virtualRange=null;violations=[];lastViolationSignature="";optimisticOrder=null;dragKey=null;announceText="";static WIDTH_EPSILON=1;static UTILITY_COL_WIDTH="2.5rem";static PIN_KEYS={expandLead:"__mndw_pin_expandLead",select:"__mndw_pin_select",drag:"__mndw_pin_drag"};constructor(e){super(),this.geometryProvider=e??Fn(),this.columns=[],this.rows=[],this.rowKey="id",this.virtual=!1,this.estimatedRowHeight=49,this.overscan=400,this.selectable=!1,this.selected=[],this.reorderable=!1,this.expandable=!1,this.expandOn="toggle",this.toggleCell="leading",this.toggleAfterColumn=void 0,this.expanded=[],this.expandedRenderer=void 0,this.sort=null,this.sortMode="client",this.hiddenColumns=void 0,this.columnMenu=!0,this.columnMenuOpen=!1,this.columnMenuPanelClass="",this.caption="",this.label="",this.rowLabel=void 0,this.labels=void 0,this.emptyLabel="",this.layout="fixed",this.minWidth="",this.stickyHeader=!1,this.addEventListener("mndwchange",this.handleCheckboxChange),this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}connectedCallback(){super.connectedCallback(),this.observerAttempted=!1,this.cellRegistry=new Zt(this),this.lastCellReconcileSignature=null}disconnectedCallback(){this.teardownGeometry(),this.closeColumnMenu(),this.cellRegistry?.drain(),this.cellRegistry=null,super.disconnectedCallback()}willUpdate(e){!this.hasUpdated||e.size>0||this.internalVisibilityNeedsReconcile?(this.internalVisibilityNeedsReconcile=!1,this.reconcileState(!0)):this.updateVirtualWindow(),this.unobserveStaleGeometryTargets()}reconcileState(e){let t=this.effectiveSortState,r=this.logicalStructureSignature(this.displayRows,this.lastExpandedKeys),n=this.captureCurrentAnchor();this.configureGeometryMode(),this.configureLayoutMode();let o=qn(this.columns),{rows:a,violations:s}=Wn(this.rows,this.rowKey);this.violations=[...o,...s],this.emitErrorIfChanged(),this.effectiveColumns=this.columns.filter((p,f,m)=>m.findIndex(S=>S.id===p.id)===f).filter(p=>!p.id.startsWith("__mndw_")),this.effectiveHidden=this.visibilityState.effectiveHidden(this.effectiveColumns,this.hiddenColumns),this.effectiveSortState=Yn(this.effectiveColumns,this.sort,this.effectiveHidden),this.pinState=this.computePinState(),this.applyStickyInactive(this.pinState);let l=!this.sameSortState(t,this.effectiveSortState),c=new Set(this.effectiveColumns.filter(p=>!this.effectiveHidden.has(p.id)).map(p=>p.id));this.optimisticOrder!==null?this.displayRows=this.optimisticOrder:this.sortMode==="client"&&this.effectiveSortState!==null?this.displayRows=Jn(a,this.effectiveColumns,this.effectiveSortState,this.locale()):this.displayRows=a;let d=this.expandedSet();this.selectedKeySet=new Set(this.selected);let h=r!==this.logicalStructureSignature(this.displayRows,d);if(this.isVirtualRenderingActive()){let p=this.getVirtualizer(),f=this.displayRows.map(m=>T(this.rowKey,m));for(let m of this.lastExpandedKeys)d.has(m)||p.clearDetailMeasurement(m);if(p.configure({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160}),p.setRows(f,d),this.updateVirtualWindow(!1),l){let m=this.viewportElement(),S=this.headerElement();m!==null&&S!==null&&(this.pendingScrollTarget=null,this.writeBodyScrollOffset(m,S,0),this.updateVirtualWindow(!1))}else if(h&&n!==void 0){let m=this.viewportElement(),S=this.headerElement();if(m!==null&&S!==null){let x=p.range(this.bodyScrollOffset(m,S),this.geometryProvider.getViewportClientHeight(m),this.normalizedOverscan()),E=Math.max(0,x.totalHeight-this.geometryProvider.getViewportClientHeight(m)),A=p.restoreAnchor(n,E);this.writeBodyScrollOffset(m,S,A),this.updateVirtualWindow(!1)}}this.lastExpandedKeys=new Set(d)}else this.virtualRange=null,this.windowRows=this.displayRows;this.pendingScrollTarget!==null&&!this.displayRows.some(p=>T(this.rowKey,p)===this.pendingScrollTarget?.key)&&(this.pendingScrollTarget=null),this.reconcileVisibleCells(e,c)}updated(e){if(this.menuLayer?.reposition(),!this.isVirtualRenderingActive()){this.teardownGeometry();return}this.syncGeometryTargets(),this.scheduleGeometryFrame()}render(){let e=this.resolveLabels(),t=this.displayRows.length===0&&this.emptyLabel;return u`
1630
+ ${this.violations.length>0?u`<div part="error" role="alert">${e.invalidData}</div>`:b}
1631
+ ${t?u`<div part="empty">${this.emptyLabel}</div>`:u`
1632
+ <div class="mndw-table-viewport" part="viewport" tabindex="-1">
1633
+ <table
1634
+ part="table"
1635
+ style=${this.tableStyle()}
1636
+ aria-label=${this.caption?b:this.label||b}
1637
+ aria-rowcount=${this.virtual?this.logicalRowCount():b}
1638
+ >
1639
+ ${this.caption?u`<caption part="caption">${this.caption}</caption>`:b}
1640
+ ${this.renderHeader(e)}
1641
+ <tbody>
1642
+ ${this.virtualRange===null?b:this.renderSpacer(this.virtualRange.paddingBefore)}
1643
+ ${jt(this.windowRows,r=>T(this.rowKey,r),(r,n)=>this.renderRow(r,n,e))}
1644
+ ${this.virtualRange===null?b:this.renderSpacer(this.virtualRange.paddingAfter)}
1645
+ </tbody>
1646
+ </table>
1647
+ </div>`}
1648
+ <div part="live-region" aria-live="polite">${this.announceText}</div>
1649
+ `}renderSpacer(e){return!Number.isFinite(e)||e<=0?b:u`<tr part="virtual-spacer" aria-hidden="true">
1650
+ <td colspan=${this.columnSpan()} style="height: ${e}px; padding: 0; border: 0;"></td>
1651
+ </tr>`}renderHeader(e){return u`
1652
+ <thead part="header">
1653
+ <tr part="header-row" aria-rowindex=${this.virtual?1:b}>
1654
+ ${this.shouldRenderLeadingToggle()?this.renderExpandHeaderCell(i.PIN_KEYS.expandLead):b}
1655
+ ${this.selectable?u`<th
1656
+ part="header-cell select-cell"
1657
+ scope="col"
1658
+ class=${Z(this.pinClasses(i.PIN_KEYS.select))}
1659
+ style=${this.utilityPinStyle(i.PIN_KEYS.select)}
1660
+ >
1661
+ ${this.renderCheckbox({ariaLabel:e.selectAll,checked:this.isAllSelected(),indeterminate:this.isIndeterminate(),selectAll:!0})}
1662
+ </th>`:b}
1663
+ ${this.reorderable&&this.effectiveSortState===null?u`<th
1664
+ part="header-cell"
1665
+ scope="col"
1666
+ class=${Z(this.pinClasses(i.PIN_KEYS.drag))}
1667
+ style=${this.utilityPinStyle(i.PIN_KEYS.drag)}
1668
+ ></th>`:b}
1669
+ ${this.effectiveColumns.filter(t=>!this.effectiveHidden.has(t.id)).map(t=>u`
1670
+ ${this.renderHeaderCell(t,e)}
1671
+ ${this.shouldRenderToggleAfter(t.id)?this.renderExpandHeaderCell():b}
1672
+ `)}
1673
+ ${this.columnMenu?u`<th part="header-cell" scope="col" class="align-end">
1674
+ <button
1675
+ part="column-menu-trigger"
1676
+ class="sort-button"
1677
+ type="button"
1678
+ aria-label=${e.columnMenu}
1679
+ aria-haspopup="menu"
1680
+ aria-expanded=${String(this.columnMenuOpen)}
1681
+ ><mndw-icon name="settings"></mndw-icon></button>
1682
+ </th>`:b}
1683
+ ${this.shouldRenderTrailingToggle()?this.renderExpandHeaderCell():b}
1684
+ </tr>
1685
+ </thead>
1686
+ `}renderExpandHeaderCell(e){return u`<th
1687
+ part="header-cell expand-cell"
1688
+ scope="col"
1689
+ class=${Z(e===void 0?[]:this.pinClasses(e))}
1690
+ style=${e===void 0?b:this.utilityPinStyle(e)}
1691
+ ></th>`}renderHeaderCell(e,t){let r=Z([...this.alignClassList(e),...this.pinClasses(e.id)]),n=this.columnStyle(e);if(e.sortable!==!0)return u`<th part="header-cell" scope="col" class=${r} style=${n}>${e.label}</th>`;let o=this.effectiveSortState?.columnId===e.id?this.effectiveSortState?.direction:void 0,a=o==="asc"?"ascending":o==="desc"?"descending":b,s=o==="asc"?"arrow-up":o==="desc"?"arrow-down":"arrow-up-down";return u`
1692
+ <th part="header-cell" scope="col" class=${r} style=${n} aria-sort=${a}>
1693
+ <button
1694
+ class="sort-button"
1695
+ type="button"
1696
+ data-sort-column=${e.id}
1697
+ aria-label=${t.sortBy(e.label)}
1698
+ >${e.label}<span part="sort-indicator" ?data-sorted=${o!==void 0}>
1699
+ <mndw-icon name=${s}></mndw-icon>
1700
+ </span></button>
1701
+ </th>
1702
+ `}renderRow(e,t,r){let n=T(this.rowKey,e),o=this.expandedSet().has(n),a=this.cellRegistry?.getSlotId(n,W);return u`
1703
+ <tr part="row" data-row-key=${n} aria-rowindex=${this.virtual?this.logicalRowIndex(n,!1):b}>
1704
+ ${this.shouldRenderLeadingToggle()?this.renderExpandCell(e,t,n,r,i.PIN_KEYS.expandLead):b}
1705
+ ${this.selectable?u`<td
1706
+ part="select-cell cell"
1707
+ class=${Z(this.pinClasses(i.PIN_KEYS.select))}
1708
+ style=${this.utilityPinStyle(i.PIN_KEYS.select)}
1709
+ >
1710
+ ${this.renderCheckbox({ariaLabel:r.selectRow(this.rowName(e,t)),checked:this.selectedKeySet.has(n),indeterminate:!1,rowKey:n})}
1711
+ </td>`:b}
1712
+ ${this.reorderable&&this.effectiveSortState===null?u`<td
1713
+ part="cell"
1714
+ class=${Z(this.pinClasses(i.PIN_KEYS.drag))}
1715
+ style=${this.utilityPinStyle(i.PIN_KEYS.drag)}
1716
+ >
1717
+ <button
1718
+ part="drag-handle"
1719
+ type="button"
1720
+ data-row-key=${n}
1721
+ aria-label=${r.selectRow(this.rowName(e,t))}
1722
+ >⠿</button>
1723
+ </td>`:b}
1724
+ ${this.effectiveColumns.filter(s=>!this.effectiveHidden.has(s.id)).map(s=>u`
1725
+ ${this.renderCell(s,e)}
1726
+ ${this.shouldRenderToggleAfter(s.id)?this.renderExpandCell(e,t,n,r):b}
1727
+ `)}
1728
+ ${this.columnMenu?u`<td part="cell"></td>`:b}
1729
+ ${this.shouldRenderTrailingToggle()?this.renderExpandCell(e,t,n,r):b}
1730
+ </tr>
1731
+ ${this.expandable&&o?u`<tr
1732
+ part="detail-row"
1733
+ data-row-key=${n}
1734
+ aria-rowindex=${this.virtual?this.logicalRowIndex(n,!0):b}
1735
+ ><td part="detail-cell" colspan=${this.columnSpan()}>${a!==void 0?u`<slot name=${a}></slot>`:b}</td></tr>`:b}
1736
+ `}renderExpandCell(e,t,r,n,o){let a=this.expandedSet().has(r),s=this.rowName(e,t);return u`<td
1737
+ part="cell expand-cell"
1738
+ class=${Z(o===void 0?[]:this.pinClasses(o))}
1739
+ style=${o===void 0?b:this.utilityPinStyle(o)}
1740
+ >
1741
+ <button
1742
+ part="expand-toggle"
1743
+ type="button"
1744
+ data-expand-key=${r}
1745
+ aria-expanded=${a?"true":"false"}
1746
+ aria-label=${a?n.collapseRow(s):n.expandRow(s)}
1747
+ ><mndw-icon name=${a?"chevron-down":"chevron-right"}></mndw-icon></button>
1748
+ </td>`}renderCell(e,t){let r=[...this.alignClassList(e),...this.pinClasses(e.id)],n=this.columnStyle(e),o=e.renderer!==void 0?this.cellRegistry?.getSlotId(T(this.rowKey,t),e.id):void 0;if(o!==void 0)return u`<td part="cell" class=${Z(r)} style=${n}><slot name=${o}></slot></td>`;let a=e.kind==="number"?[...r,"cell-kind-number"]:r,s=rr(e,t);return u`<td part="cell" class=${Z(a)} style=${n}>${this.renderBuiltIn(e,s,t)}</td>`}renderBuiltIn(e,t,r){if(e.kind==="badge"){let n=e.badge?.(t,r);return n===void 0?b:u`<span part="badge"
1749
+ ><span part="badge-dot" style="background: ${this.toneColor(n.tone)};"></span>${n.text}</span>`}return e.kind==="boolean"?t?u`<mndw-icon name="check"></mndw-icon>`:u`<mndw-icon name="minus"></mndw-icon>`:t==null?"":String(t)}renderCheckbox(e){return u`<mndw-checkbox
1750
+ aria-label=${e.ariaLabel}
1751
+ part=${e.selectAll?"select-all":b}
1752
+ ?data-select-all=${e.selectAll??!1}
1753
+ data-row-key=${e.rowKey??b}
1754
+ .checked=${e.checked}
1755
+ .indeterminate=${e.indeterminate}
1756
+ ></mndw-checkbox>`}expandedSet(){return new Set(this.expanded)}getVirtualizer(){return this.virtualizer===null&&(this.virtualizer=new er({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160})),this.virtualizer}captureCurrentAnchor(){if(!this.isVirtualRenderingActive()||this.virtualizer===null)return;let e=this.viewportElement(),t=this.headerElement();return e===null||t===null?void 0:this.virtualizer.captureAnchor(this.bodyScrollOffset(e,t))}logicalStructureSignature(e,t){return[e.map(r=>T(this.rowKey,r)).join("\0"),[...t].join("\0")].join("")}configureGeometryMode(){if(!this.virtual){this.setVirtualInactiveReason(null),this.teardownGeometry();return}if(this.resizeObserver===null&&!this.observerAttempted&&(this.observerAttempted=!0,this.resizeObserver=this.geometryProvider.createResizeObserver(this.handleGeometryResize)),this.resizeObserver===null){this.setVirtualInactiveReason("resize-observer-unavailable");return}if(this.reorderable){this.teardownGeometry(),this.setVirtualInactiveReason("reorderable");return}this.setVirtualInactiveReason(null)}configureLayoutMode(){this.virtual&&this.layout==="auto"?this.setAttribute("data-mndw-layout-inactive","virtual"):this.removeAttribute("data-mndw-layout-inactive")}isVirtualRenderingActive(){return this.virtual&&!this.reorderable&&this.resizeObserver!==null}setVirtualInactiveReason(e){e===null?this.removeAttribute("data-mndw-virtual-inactive"):(this.setAttribute("data-mndw-virtual-inactive",e),this.warnedInactiveReason!==e&&(this.warnedInactiveReason=e,console.warn(`<${ft}> virtualization inactive: ${e}`)))}updateVirtualWindow(e=!0){if(!this.isVirtualRenderingActive()||this.virtualizer===null)return;let t=this.viewportElement(),r=this.headerElement(),n=t===null||r===null?0:this.bodyScrollOffset(t,r),o=t===null?0:this.geometryProvider.getViewportClientHeight(t);this.virtualRange=this.virtualizer.range(n,o,this.normalizedOverscan());let a=this.displayRows.slice(this.virtualRange.start,this.virtualRange.end);if(t!==null&&this.windowRows!==a){let s=this.windowRows.map(c=>T(this.rowKey,c)).join("\0"),l=a.map(c=>T(this.rowKey,c)).join("\0");s!==l&&this.evacuateFocusBeforeWindowRemoval(t,this.windowRows,a)}this.windowRows=a,e&&this.reconcileVisibleCells(!1)}reconcileVisibleCells(e,t){let r=t??new Set(this.effectiveColumns.filter(o=>!this.effectiveHidden.has(o.id)).map(o=>o.id)),n=[this.windowRows.map(o=>T(this.rowKey,o)).join("\0"),[...r].join("\0"),[...this.expandedSet()].join("\0")].join("");!e&&n===this.lastCellReconcileSignature||(this.cellRegistry?.reconcile(this.windowRows,o=>T(this.rowKey,o),this.effectiveColumns,r,rr,this.expandedSet(),this.expandedRenderer),this.lastCellReconcileSignature=n)}bodyScrollOffset(e,t){return Math.max(0,this.geometryProvider.getViewportScrollTop(e)-this.geometryProvider.measure(t).height)}writeBodyScrollOffset(e,t,r){if(this.virtualizer===null)return;let n=this.geometryProvider.measure(t).height,o=this.geometryProvider.getViewportClientHeight(e),a=this.geometryProvider.getViewportScrollTop(e),s=this.virtualizer.range(this.bodyScrollOffset(e,t),o,this.normalizedOverscan()).totalHeight,l=Math.max(0,n+s-o),c=r<=0&&a<n?a:n+Math.max(0,r),d=Math.min(l,Math.max(0,c));this.expectedProgrammaticScrollTop=d,this.geometryProvider.setViewportScrollTop(e,d)}syncGeometryTargets(){let e=this.resizeObserver,t=this.viewportElement(),r=this.headerElement();if(e===null||t===null||r===null)return;let n=new Map;n.set(t,{kind:"viewport"}),n.set(r,{kind:"header"});for(let o of this.shadowRoot?.querySelectorAll('[part="row"]')??[]){let a=o.getAttribute("data-row-key");a!==null&&a!==""&&n.set(o,{kind:"summary",rowKey:a})}for(let o of this.shadowRoot?.querySelectorAll('[part="detail-row"]')??[]){let a=o.getAttribute("data-row-key");a!==null&&a!==""&&n.set(o,{kind:"detail",rowKey:a})}for(let o of this.observedElements)n.has(o)||(e.unobserve(o),this.observedElements.delete(o));for(let[o,a]of n)In(o,a),this.observedElements.has(o)||(e.observe(o),this.observedElements.add(o));this.observedViewport!==t&&(this.observedViewport?.removeEventListener("scroll",this.handleViewportScroll),t.addEventListener("scroll",this.handleViewportScroll),this.observedViewport=t)}unobserveStaleGeometryTargets(){if(this.resizeObserver===null)return;let e=new Set(this.windowRows.map(r=>T(this.rowKey,r))),t=this.expandedSet();for(let r of this.observedElements){let n=Qt(r);(n?.kind==="summary"&&!e.has(n.rowKey)||n?.kind==="detail"&&(!e.has(n.rowKey)||!t.has(n.rowKey)))&&(this.resizeObserver.unobserve(r),this.observedElements.delete(r))}}scheduleGeometryFrame(){!this.isVirtualRenderingActive()||this.pendingGeometryFrame!==null||(this.pendingGeometryFrame=this.geometryProvider.requestAnimationFrame(this.handleGeometryFrame))}handleGeometryResize=()=>{this.scheduleGeometryFrame()};handleViewportScroll=()=>{let e=this.observedViewport;if(e!==null&&this.expectedProgrammaticScrollTop!==void 0){let t=this.geometryProvider.getViewportScrollTop(e);if(Math.abs(t-this.expectedProgrammaticScrollTop)<=.25){this.expectedProgrammaticScrollTop=void 0,this.scheduleGeometryFrame();return}}this.pendingScrollTarget=null,this.scheduleGeometryFrame()};handleGeometryFrame=()=>{if(this.pendingGeometryFrame=null,!this.isConnected||!this.isVirtualRenderingActive()||this.virtualizer===null)return;let e=this.viewportElement(),t=this.headerElement();if(e===null||t===null)return;this.geometryProvider.measure(e);let r=this.geometryProvider.measure(t),n=this.geometryProvider.getViewportContentWidth(e),o=this.bodyScrollOffset(e,t),a=this.virtualizer.captureAnchor(o),s=!1;this.lastViewportContentWidth===void 0?this.lastViewportContentWidth=n:Number.isFinite(n)&&Math.abs(n-this.lastViewportContentWidth)>=i.WIDTH_EPSILON&&(this.lastViewportContentWidth=n,this.virtualizer.resetWidthEpoch(),s=!0);for(let m of this.observedElements){let S=Qt(m);S?.kind==="summary"?s=this.virtualizer.recordSummaryMeasurement(S.rowKey,this.geometryProvider.measure(m).height)||s:S?.kind==="detail"&&(s=this.virtualizer.recordDetailMeasurement(S.rowKey,this.geometryProvider.measure(m).height)||s)}let l=Math.max(0,this.geometryProvider.getViewportScrollTop(e)-r.height),c=this.virtualizer.range(l,this.geometryProvider.getViewportClientHeight(e),this.normalizedOverscan()),d=this.windowRows.map(m=>T(this.rowKey,m)).join("\0"),h=this.displayRows.slice(c.start,c.end),p=h.map(m=>T(this.rowKey,m)).join("\0");d!==p&&this.evacuateFocusBeforeWindowRemoval(e,this.windowRows,h),this.virtualRange=c,this.windowRows=h,this.reconcileVisibleCells(!1);let f=!1;if(this.pendingScrollTarget!==null){let m=this.pendingScrollTarget;if([...this.observedElements].find(x=>{let E=Qt(x);return E?.kind==="summary"&&E.rowKey===m.key})!==void 0){let x=this.virtualizer.offsetForRow(m.key,m.align,this.geometryProvider.getViewportClientHeight(e),l);x!==void 0&&this.writeBodyScrollOffset(e,t,x),this.pendingScrollTarget=null,f=!0}}if(s&&!f&&a!==void 0){let m=Math.max(0,c.totalHeight-this.geometryProvider.getViewportClientHeight(e)),S=this.virtualizer.restoreAnchor(a,m);this.writeBodyScrollOffset(e,t,S)}(s||d!==p)&&this.requestUpdate()};teardownGeometry(){if(this.observedViewport?.removeEventListener("scroll",this.handleViewportScroll),this.observedViewport=null,this.resizeObserver!==null){for(let e of this.observedElements)this.resizeObserver.unobserve(e);this.resizeObserver.disconnect(),this.resizeObserver=null}this.observedElements.clear(),this.observerAttempted=!1,this.pendingGeometryFrame!==null&&(this.geometryProvider.cancelAnimationFrame(this.pendingGeometryFrame),this.pendingGeometryFrame=null),this.lastViewportContentWidth=void 0,this.expectedProgrammaticScrollTop=void 0}normalizedEstimatedRowHeight(){return Number.isFinite(this.estimatedRowHeight)&&this.estimatedRowHeight>0?this.estimatedRowHeight:49}normalizedOverscan(){return Number.isFinite(this.overscan)&&this.overscan>=0?this.overscan:400}viewportElement(){return this.shadowRoot?.querySelector('[part="viewport"]')??null}headerElement(){return this.shadowRoot?.querySelector('[part="header-row"]')??null}collectFocusChain(){let e=[],t=document.activeElement;for(;t!==null;){e.push({rowKey:this.focusedRowKeyForElement(t)});let r=t.shadowRoot?.activeElement;if(!(r instanceof Element)||r===t)break;t=r}return e}focusedRowKeyForElement(e){let t=this.cellRegistry?.getRowKeyForNode(e);return t!==void 0?t:e.closest('[part="row"], [part="detail-row"]')?.getAttribute("data-row-key")??void 0}evacuateFocusBeforeWindowRemoval(e,t,r){let n=new Set(t.map(s=>T(this.rowKey,s))),o=new Set(r.map(s=>T(this.rowKey,s))),a=On(this.collectFocusChain());a!==void 0&&n.has(a)&&!o.has(a)&&e.focus()}shouldRenderLeadingToggle(){return this.expandable&&this.toggleAfterColumn===void 0&&this.toggleCell==="leading"}shouldRenderTrailingToggle(){return this.expandable&&this.toggleAfterColumn===void 0&&this.toggleCell==="trailing"}shouldRenderToggleAfter(e){return this.expandable&&this.toggleAfterColumn===e}leadingUtilityKeys(){let e=[];return this.shouldRenderLeadingToggle()&&e.push(i.PIN_KEYS.expandLead),this.selectable&&e.push(i.PIN_KEYS.select),this.reorderable&&this.effectiveSortState===null&&e.push(i.PIN_KEYS.drag),e}computePinState(){let e=this.effectiveColumns.filter(a=>!this.effectiveHidden.has(a.id)),t=[],r=null,n=null;for(let a of e){if(a.sticky!=="start")break;if(a.width===void 0){r="missing-width",n=a.id;break}t.push({...a,width:a.width})}if(r===null){let a=e.slice(t.length).find(s=>s.sticky==="start");a!==void 0&&(r="not-leading",n=a.id)}let o=new Map;if(t.length>0){let a=[...this.leadingUtilityKeys().map(l=>({key:l,width:i.UTILITY_COL_WIDTH})),...t.map(l=>({key:l.id,width:l.width}))],s=[];a.forEach((l,c)=>{let d=s.length===0?"0":s.length===1?s[0]:`calc(${s.join(" + ")})`;o.set(l.key,{insetInlineStart:d,isLast:c===a.length-1}),s.push(l.width)})}return{byKey:o,inactiveReason:r,inactiveColumnId:n}}applyStickyInactive(e){if(e.inactiveReason===null){this.removeAttribute("data-mndw-sticky-inactive"),this.warnedStickyReason=null;return}this.setAttribute("data-mndw-sticky-inactive",e.inactiveReason);let t=`${e.inactiveReason}:${e.inactiveColumnId??""}`;this.warnedStickyReason!==t&&(this.warnedStickyReason=t,console.warn(`<${ft}> sticky column "${e.inactiveColumnId??""}" inactive: ${e.inactiveReason}`))}tableStyle(){return this.minWidth===""?b:`min-width: ${this.minWidth};`}columnStyle(e){let t=this.pinState.byKey.get(e.id),r=[];return e.width!==void 0&&r.push(`width: ${e.width};`),t!==void 0&&e.width!==void 0&&r.push(`min-width: ${e.width};`,`max-width: ${e.width};`,"box-sizing: border-box;",`inset-inline-start: ${t.insetInlineStart};`),r.length===0?b:r.join(" ")}pinClasses(e){let t=this.pinState.byKey.get(e);return t===void 0?[]:t.isLast?["pinned","pinned-last"]:["pinned"]}utilityPinStyle(e){let t=this.pinState.byKey.get(e);if(t===void 0)return b;let r=i.UTILITY_COL_WIDTH;return`width: ${r}; min-width: ${r}; max-width: ${r}; box-sizing: border-box; inset-inline-start: ${t.insetInlineStart};`}columnSpan(){let e=this.effectiveColumns.filter(t=>!this.effectiveHidden.has(t.id)).length;return(this.expandable?1:0)+(this.selectable?1:0)+(this.reorderable&&this.effectiveSortState===null?1:0)+e+(this.columnMenu?1:0)}alignClassList(e){let t=[];return e.align==="end"&&t.push("align-end"),e.align==="center"&&t.push("align-center"),e.nowrap===!0&&t.push("nowrap"),t}toneColor(e){return`var(--mndw-${e==="neutral"?"text-muted":e})`}resolveLabels(){return{..._a(),...this.labels}}rowName(e,t){return this.rowLabel?.(e)??this.resolveLabels().rowFallback(t+1)}sameSortState(e,t){return e?.columnId===t?.columnId&&e?.direction===t?.direction}logicalRowCount(){let e=this.expandedSet(),t=new Set(this.displayRows.map(n=>T(this.rowKey,n))),r=[...e].filter(n=>t.has(n)).length;return 1+this.displayRows.length+r}logicalRowIndex(e,t){let r=2,n=this.expandedSet();for(let o of this.displayRows){let a=T(this.rowKey,o);if(a===e)return t?r+1:r;r+=1,n.has(a)&&(r+=1)}return r}locale(){return document.documentElement.lang||"en"}isAllSelected(){return ir(this.selectedKeySet,this.displayRows.map(e=>T(this.rowKey,e)))==="all"}isIndeterminate(){return ir(this.selectedKeySet,this.displayRows.map(e=>T(this.rowKey,e)))==="indeterminate"}emitErrorIfChanged(){let e=JSON.stringify(this.violations);e!==this.lastViolationSignature&&(this.lastViolationSignature=e,this.violations.length!==0&&this.dispatchEvent(new CustomEvent(oi,{...fe,detail:{violations:this.violations}})))}handleCheckboxChange=e=>{let t=e.composedPath()[0]??null;if(t===null)return;if(t.hasAttribute("data-select-all")){let n=this.displayRows.map(a=>T(this.rowKey,a)),o=Qn(this.selected,n);this.dispatchEvent(new CustomEvent(Jt,{...fe,detail:{selected:o}}));return}let r=t.getAttribute("data-row-key");if(r!==null){let n=Zn(this.selected,r);this.dispatchEvent(new CustomEvent(Jt,{...fe,detail:{selected:n}}))}};handleClick=e=>{let t=e.composedPath().find(o=>o instanceof HTMLElement)??null,r=t?.closest?.('[part="expand-toggle"]');if(r!=null){this.emitExpand(r.getAttribute("data-expand-key")??"");return}if(this.expandable&&this.expandOn==="row"){let o=e.composedPath();if(!o.some(s=>s instanceof HTMLElement&&(s.tagName==="BUTTON"||s.tagName==="A"||s.tagName==="INPUT"||s.tagName==="MNDW-CHECKBOX"||s.getAttribute("part")==="drag-handle"||s.hasAttribute("data-no-expand")))){let s=o.find(c=>c instanceof HTMLElement&&c.getAttribute("part")==="row"),l=s instanceof HTMLElement?s.getAttribute("data-row-key"):null;l!=null&&l!==""&&this.emitExpand(l)}}let n=t?.closest?.("[data-sort-column]");if(n!=null){this.activateSort(n.getAttribute("data-sort-column")??"");return}t?.closest?.('[part="column-menu-trigger"]')!==null&&t?.closest?.('[part="column-menu-trigger"]')!==void 0&&this.openColumnMenu(t)};emitExpand(e){let t=new Set(this.expanded);t.has(e)?t.delete(e):t.add(e),this.dispatchEvent(new CustomEvent(ai,{...fe,detail:{expanded:[...t]}}))}handleKeyDown=e=>{let t=e.composedPath().find(n=>n instanceof HTMLElement&&n.getAttribute("part")==="column-menu-trigger");if(t&&(e.key==="ArrowDown"||e.key==="ArrowUp")){e.preventDefault(),this.openColumnMenu(t,e.key==="ArrowUp"?"last":"first");return}let r=e.composedPath()[0]??null;r?.getAttribute("part")==="drag-handle"&&(e.key==="ArrowUp"||e.key==="ArrowDown")&&(e.preventDefault(),this.keyboardReorder(r.getAttribute("data-row-key")??"",e.key==="ArrowUp"?-1:1))};activateSort(e){if(this.effectiveColumns.find(n=>n.id===e)?.sortable!==!0)return;let r=Xn(this.sort,e);this.dispatchEvent(new CustomEvent(ri,{...fe,detail:{sort:r}}))}keyboardReorder(e,t){let r=this.displayRows.findIndex(s=>T(this.rowKey,s)===e);if(r===-1)return;let n=r+t;if(n<0||n>=this.displayRows.length)return;let o=t===-1?n:n+1,a=o<this.displayRows.length?T(this.rowKey,this.displayRows[o]):null;this.emitReorder(e,a)}emitReorder(e,t){let r=this.resolveLabels(),n=this.displayRows.find(o=>T(this.rowKey,o)===e);this.announceText=n===void 0?"":r.reordered(this.rowName(n,this.displayRows.indexOf(n)),this.displayRows.indexOf(n)+1,this.displayRows.length),this.dispatchEvent(new CustomEvent(ii,{...fe,detail:{key:e,beforeKey:t}}))}applyColumnVisibility(e){this.dispatchEvent(new CustomEvent(ni,{...fe,detail:{hidden:e}}))}getVisibleColumnIds(){return this.effectiveColumns.filter(e=>!this.effectiveHidden.has(e.id)).map(e=>e.id)}scrollToRow(e,t={}){if(!this.displayRows.some(c=>T(this.rowKey,c)===e))return!1;let n=this.viewportElement(),o=this.headerElement();if(n===null||o===null)return!1;let a=this.getVirtualizer();a.configure({estimatedRowHeight:this.normalizedEstimatedRowHeight(),detailEstimate:160}),a.setRows(this.displayRows.map(c=>T(this.rowKey,c)),this.expandedSet());let s=t.align??"nearest",l=a.offsetForRow(e,s,this.geometryProvider.getViewportClientHeight(n),this.bodyScrollOffset(n,o));return l===void 0?!1:(this.isVirtualRenderingActive()&&(this.pendingScrollTarget={key:e,align:s}),this.writeBodyScrollOffset(n,o,l),this.updateVirtualWindow(),this.isVirtualRenderingActive()&&this.requestUpdate(),!0)}openColumnMenu(e,t="first"){if(this.menuLayer!==null)return;let r=this.effectiveColumns.filter(a=>a.hideable!==!1).map(a=>({id:a.id,label:a.label})),n=Gt().open({anchor:e,presentation:"popover",className:this.columnMenuPanelClass||void 0,trapFocus:!1,restoreFocus:!1}),o=document.createElement(bt);o.columns=r,o.hiddenColumns=[...this.effectiveHidden],o.initialFocus=t,o.addEventListener(ti,this.onColumnMenuCheck),o.addEventListener("mndwpaneldismiss",this.onColumnMenuDismiss),n.contentElement.appendChild(o),this.menuLayer=n,this.menuTrigger=e,this.columnMenuOpen=!0,o.updateComplete.then(()=>{this.menuLayer===n&&(n.reposition(),this.cancelMenuFocusRetry=bn(o,()=>o.focusInitialOption(),()=>this.menuLayer===n,()=>{}))}),n.closed.then(()=>{this.forgetColumnMenu()})}closeColumnMenu(){this.menuLayer?.close(),this.forgetColumnMenu()}forgetColumnMenu(){this.cancelMenuFocusRetry?.(),this.cancelMenuFocusRetry=null,this.menuLayer=null,this.menuTrigger=null,this.columnMenuOpen=!1}onColumnMenuCheck=e=>{let t=e.detail.hidden;if(this.hiddenColumns!==void 0){this.applyColumnVisibility(t);return}this.visibilityState.applyInternal(t),this.internalVisibilityNeedsReconcile=!0,this.requestUpdate(),this.applyColumnVisibility(t)};onColumnMenuDismiss=e=>{let t=e.detail,r=this.menuLayer;if(t.defer&&r){let o=this.menuTrigger,a=o===null?null:this.tabDestination(o,t.tabDirection??"forward");window.setTimeout(()=>{this.menuLayer===r&&(this.closeColumnMenu(),a!==null&&r.closed.then(()=>{a.isConnected&&a.focus()}))},0);return}let n=this.menuTrigger;this.closeColumnMenu(),t.restoreFocus&&n?.focus()};tabDestination(e,t){let r=me(document.body),n=r.indexOf(e);if(n<0||r.length<2)return null;let a=(n+(t==="forward"?1:-1)+r.length)%r.length;return r[a]??null}};function Pa(){function i(e){return e}return i}var Da=[[Er,ze],[kr,Ge],[Pr,qe],[Vt,We],[Or,je],[Fr,Ye],[Ar,Be],[Je,Xe],[qr,rt],[et,Qe],[Gr,tt],[Le,it],[jr,ot],[Rr,Ue],[Xr,at],[Lr,Ke],[Jr,st],[ke,lt],[G,dt],[Zr,ct],[Qr,ut],[Xt,pt],[ft,vt],[bt,mt]];function Yc(i){i?.initialLocale!==void 0&&Sr(i.initialLocale),i?.overlay&&yn(ln(i.overlay)),i?.iconSpriteUrl!==void 0&&Qi(i.iconSpriteUrl);for(let[e,t]of Da)customElements.get(e)||customElements.define(e,t)}export{W as DETAIL_COL_ID,L as LocaleController,Er as MNDW_BAR_CHART_TAG,kr as MNDW_BUTTON_TAG,Pr as MNDW_CHECKBOX_TAG,bt as MNDW_COLUMN_MENU_TAG,ni as MNDW_COLUMN_VISIBILITY_CHANGE_EVENT,oi as MNDW_ERROR_EVENT,Vt as MNDW_FIELD_TAG,Rr as MNDW_HEAT_STRIP_TAG,ji as MNDW_ICON_NAMES,Or as MNDW_ICON_TAG,Fr as MNDW_INPUT_TAG,an as MNDW_INPUT_TYPES,Ht as MNDW_LABEL_CHANGE_EVENT,Ar as MNDW_LINE_CHART_TAG,Ze as MNDW_OPTION_CHANGE_EVENT,Je as MNDW_OPTION_TAG,ai as MNDW_ROW_EXPAND_EVENT,ii as MNDW_ROW_REORDER_EVENT,qr as MNDW_SCROLL_AREA_TAG,jr as MNDW_SEGMENTED_TAG,nt as MNDW_SEGMENT_CHANGE_EVENT,Le as MNDW_SEGMENT_TAG,Jt as MNDW_SELECTION_CHANGE_EVENT,et as MNDW_SELECT_PANEL_TAG,Gr as MNDW_SELECT_TAG,Xr as MNDW_SLIDER_TAG,ri as MNDW_SORT_CHANGE_EVENT,Lr as MNDW_SPARKLINE_TAG,Jr as MNDW_SWITCH_TAG,ft as MNDW_TABLE_TAG,Zr as MNDW_TABS_TAG,ke as MNDW_TAB_PANEL_TAG,G as MNDW_TAB_TAG,Qr as MNDW_TEXTAREA_TAG,Xt as MNDW_TOOLTIP_TAG,zo as MOBILE_OVERLAY_MAX_WIDTH,ze as MndwBarChart,Ge as MndwButton,qe as MndwCheckbox,mt as MndwColumnMenu,We as MndwField,Ue as MndwHeatStrip,je as MndwIcon,Ye as MndwInput,Be as MndwLineChart,Xe as MndwOption,rt as MndwScrollArea,it as MndwSegment,ot as MndwSegmented,tt as MndwSelect,Qe as MndwSelectPanel,at as MndwSlider,Ke as MndwSparkline,st as MndwSwitch,dt as MndwTab,lt as MndwTabPanel,vt as MndwTable,ct as MndwTabs,ut as MndwTextarea,pt as MndwTooltip,Uo as POPOVER_ANCHOR_GAP,Bt as POPOVER_FLIP_ORDER,Go as SELECT_ANCHOR_GAP,Ko as SELECT_MOBILE_MAX_WIDTH,Hr as SELECT_VIEWPORT_PADDING,Bo as VIEWPORT_PADDING,Br as availablePopoverHeight,Yo as coercePlacement,Pa as column,pe as composedContains,Vr as computePopoverCoords,zr as computeTooltipCoords,Kt as createFocusTrap,X as createGeneratedAttribute,O as createLocalizedProperty,J as deepActiveElement,Yc as defineMndwUi,vo as formatSpeed,xr as getMndwUiLocale,y as getMndwUiText,go as getSpeedUpperLimit,jo as isMobileSheet,en as mndwIconHref,Zo as resolveSizing,Ur as selectPresentation,Sr as setMndwUiLocale,Nr as subscribeMndwIconSprite,Cr as subscribeMndwUiLocale,me as tabbableElements};
1757
+ /*! Bundled license information:
1758
+
1759
+ @lit/reactive-element/css-tag.js:
1760
+ (**
1761
+ * @license
1762
+ * Copyright 2019 Google LLC
1763
+ * SPDX-License-Identifier: BSD-3-Clause
1764
+ *)
1765
+
1766
+ @lit/reactive-element/reactive-element.js:
1767
+ lit-html/lit-html.js:
1768
+ lit-element/lit-element.js:
1769
+ lit-html/directive.js:
1770
+ lit-html/directives/repeat.js:
1771
+ (**
1772
+ * @license
1773
+ * Copyright 2017 Google LLC
1774
+ * SPDX-License-Identifier: BSD-3-Clause
1775
+ *)
1776
+
1777
+ lit-html/is-server.js:
1778
+ (**
1779
+ * @license
1780
+ * Copyright 2022 Google LLC
1781
+ * SPDX-License-Identifier: BSD-3-Clause
1782
+ *)
1783
+
1784
+ lit-html/directive-helpers.js:
1785
+ (**
1786
+ * @license
1787
+ * Copyright 2020 Google LLC
1788
+ * SPDX-License-Identifier: BSD-3-Clause
1789
+ *)
1790
+ */