tasmota-esp-web-tools 12.2.0 → 12.2.2
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.
- package/README.md +32 -0
- package/dist/const.d.ts +7 -0
- package/dist/flash.d.ts +29 -1
- package/dist/flash.js +94 -22
- package/dist/install-dialog.d.ts +7 -0
- package/dist/install-dialog.js +54 -6
- package/dist/web/install-button.js +1 -1
- package/dist/web/{install-dialog-B3AVqM93.js → install-dialog-HBW3T1yn.js} +45 -43
- package/js/modules/install-button.js +1 -1
- package/js/modules/{install-dialog-B3AVqM93.js → install-dialog-HBW3T1yn.js} +45 -43
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h,A as p,h as u,j as f,k as g,s as m,o as v,D as b,E as y,t as
|
|
1
|
+
import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h,A as p,h as u,j as f,k as g,s as m,o as v,D as b,E as y,t as _,l as x,p as w,q as k,u as S,v as $,w as C,x as R,y as E,z as I}from"./styles-D4zXLz1s.js";import{C as T,a as F,b as L,c as O,d as A,e as z,f as P,g as B,h as D,i as U,j as M,k as W}from"./install-button.js";let H;const V=Symbol("createValidator"),N=Symbol("getValidityAnchor"),q=Symbol("privateValidator"),G=Symbol("privateSyncValidity"),j=Symbol("privateCustomValidationMessage");function K(e){var i;class r extends e{constructor(){super(...arguments),this[i]=""}get validity(){return this[G](),this[t].validity}get validationMessage(){return this[G](),this[t].validationMessage}get willValidate(){return this[G](),this[t].willValidate}checkValidity(){return this[G](),this[t].checkValidity()}reportValidity(){return this[G](),this[t].reportValidity()}setCustomValidity(e){this[j]=e,this[G]()}requestUpdate(e,t,i){super.requestUpdate(e,t,i),this[G]()}firstUpdated(e){super.firstUpdated(e),this[G]()}[(i=j,G)](){this[q]||(this[q]=this[V]());const{validity:e,validationMessage:i}=this[q].getValidity(),r=!!this[j],o=this[j]||i;this[t].setValidity({...e,customError:r},o,this[N]()??void 0)}[V](){throw new Error("Implement [createValidator]")}[N](){throw new Error("Implement [getValidityAnchor]")}}return r}const J=Symbol("getFormValue"),Z=Symbol("getFormState");function Y(e){class o extends e{get form(){return this[t].form}get labels(){return this[t].labels}get name(){return this.getAttribute("name")??""}set name(e){this.setAttribute("name",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}attributeChangedCallback(e,t,i){if("name"===e||"disabled"===e){const i="disabled"===e?null!==t:t;return void this.requestUpdate(e,i)}super.attributeChangedCallback(e,t,i)}requestUpdate(e,i,r){super.requestUpdate(e,i,r),this[t].setFormValue(this[J](),this[Z]())}[J](){throw new Error("Implement [getFormValue]")}[Z](){return this[J]()}formDisabledCallback(e){this.disabled=e}}return o.formAssociated=!0,i([r({noAccessor:!0})],o.prototype,"name",null),i([r({type:Boolean,noAccessor:!0})],o.prototype,"disabled",null),o}class X{constructor(e){this.getCurrentState=e,this.currentValidity={validity:{},validationMessage:""}}getValidity(){const e=this.getCurrentState();if(!(!this.prevState||!this.equals(this.prevState,e)))return this.currentValidity;const{validity:t,validationMessage:i}=this.computeValidity(e);return this.prevState=this.copy(e),this.currentValidity={validationMessage:i,validity:{badInput:t.badInput,customError:t.customError,patternMismatch:t.patternMismatch,rangeOverflow:t.rangeOverflow,rangeUnderflow:t.rangeUnderflow,stepMismatch:t.stepMismatch,tooLong:t.tooLong,tooShort:t.tooShort,typeMismatch:t.typeMismatch,valueMissing:t.valueMissing}},this.currentValidity}}class Q extends X{computeValidity(e){return this.checkboxControl||(this.checkboxControl=document.createElement("input"),this.checkboxControl.type="checkbox"),this.checkboxControl.checked=e.checked,this.checkboxControl.required=e.required,{validity:this.checkboxControl.validity,validationMessage:this.checkboxControl.validationMessage}}equals(e,t){return e.checked===t.checked&&e.required===t.required}copy({checked:e,required:t}){return{checked:e,required:t}}}const ee=o(K(Y(s(a))));class te extends ee{constructor(){super(),this.checked=!1,this.indeterminate=!1,this.required=!1,this.value="on",this.prevChecked=!1,this.prevDisabled=!1,this.prevIndeterminate=!1,this.addEventListener("click",e=>{d(e)&&this.input&&(this.focus(),c(this.input))})}update(e){(e.has("checked")||e.has("disabled")||e.has("indeterminate"))&&(this.prevChecked=e.get("checked")??this.checked,this.prevDisabled=e.get("disabled")??this.disabled,this.prevIndeterminate=e.get("indeterminate")??this.indeterminate),super.update(e)}render(){const e=!this.prevChecked&&!this.prevIndeterminate,t=this.prevChecked&&!this.prevIndeterminate,i=this.prevIndeterminate,r=this.checked&&!this.indeterminate,o=this.indeterminate,s=h({disabled:this.disabled,selected:r||o,unselected:!r&&!o,checked:r,indeterminate:o,"prev-unselected":e,"prev-checked":t,"prev-indeterminate":i,"prev-disabled":this.prevDisabled}),{ariaLabel:a,ariaInvalid:l}=this;return u`
|
|
2
2
|
<div class="container ${s}">
|
|
3
3
|
<input
|
|
4
4
|
type="checkbox"
|
|
@@ -23,7 +23,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
23
23
|
</svg>
|
|
24
24
|
</div>
|
|
25
25
|
`}handleInput(e){const t=e.target;this.checked=t.checked,this.indeterminate=t.indeterminate}handleChange(e){f(this,e)}[J](){return!this.checked||this.indeterminate?null:this.value}[Z](){return String(this.checked)}formResetCallback(){this.checked=this.hasAttribute("checked")}formStateRestoreCallback(e){this.checked="true"===e}[V](){return new Q(()=>this)}[N](){return this.input}}te.shadowRootOptions={...a.shadowRootOptions,delegatesFocus:!0},i([r({type:Boolean})],te.prototype,"checked",void 0),i([r({type:Boolean})],te.prototype,"indeterminate",void 0),i([r({type:Boolean})],te.prototype,"required",void 0),i([r()],te.prototype,"value",void 0),i([l()],te.prototype,"prevChecked",void 0),i([l()],te.prototype,"prevDisabled",void 0),i([l()],te.prototype,"prevIndeterminate",void 0),i([n("input")],te.prototype,"input",void 0);const ie=g`:host{border-start-start-radius:var(--md-checkbox-container-shape-start-start, var(--md-checkbox-container-shape, 2px));border-start-end-radius:var(--md-checkbox-container-shape-start-end, var(--md-checkbox-container-shape, 2px));border-end-end-radius:var(--md-checkbox-container-shape-end-end, var(--md-checkbox-container-shape, 2px));border-end-start-radius:var(--md-checkbox-container-shape-end-start, var(--md-checkbox-container-shape, 2px));display:inline-flex;height:var(--md-checkbox-container-size, 18px);position:relative;vertical-align:top;width:var(--md-checkbox-container-size, 18px);-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer}:host([disabled]){cursor:default}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--md-checkbox-container-size, 18px))/2)}md-focus-ring{height:44px;inset:unset;width:44px}input{appearance:none;height:48px;margin:0;opacity:0;outline:none;position:absolute;width:48px;z-index:1;cursor:inherit}:host([touch-target=none]) input{height:100%;width:100%}.container{border-radius:inherit;display:flex;height:100%;place-content:center;place-items:center;position:relative;width:100%}.outline,.background,.icon{inset:0;position:absolute}.outline,.background{border-radius:inherit}.outline{border-color:var(--md-checkbox-outline-color, var(--md-sys-color-on-surface-variant, #49454f));border-style:solid;border-width:var(--md-checkbox-outline-width, 2px);box-sizing:border-box}.background{background-color:var(--md-checkbox-selected-container-color, var(--md-sys-color-primary, #6750a4))}.background,.icon{opacity:0;transition-duration:150ms,50ms;transition-property:transform,opacity;transition-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15),linear;transform:scale(0.6)}:where(.selected) :is(.background,.icon){opacity:1;transition-duration:350ms,50ms;transition-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1),linear;transform:scale(1)}md-ripple{border-radius:var(--md-checkbox-state-layer-shape, var(--md-sys-shape-corner-full, 9999px));height:var(--md-checkbox-state-layer-size, 40px);inset:unset;width:var(--md-checkbox-state-layer-size, 40px);--md-ripple-hover-color: var(--md-checkbox-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-checkbox-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-checkbox-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-pressed-opacity: var(--md-checkbox-pressed-state-layer-opacity, 0.12)}.selected md-ripple{--md-ripple-hover-color: var(--md-checkbox-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--md-ripple-hover-opacity: var(--md-checkbox-selected-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-checkbox-selected-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-checkbox-selected-pressed-state-layer-opacity, 0.12)}.icon{fill:var(--md-checkbox-selected-icon-color, var(--md-sys-color-on-primary, #fff));height:var(--md-checkbox-icon-size, 18px);width:var(--md-checkbox-icon-size, 18px)}.mark.short{height:2px;transition-property:transform,height;width:2px}.mark.long{height:2px;transition-property:transform,width;width:10px}.mark{animation-duration:150ms;animation-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15);transition-duration:150ms;transition-timing-function:cubic-bezier(0.3, 0, 0.8, 0.15)}.selected .mark{animation-duration:350ms;animation-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1);transition-duration:350ms;transition-timing-function:cubic-bezier(0.05, 0.7, 0.1, 1)}.checked .mark,.prev-checked.unselected .mark{transform:scaleY(-1) translate(7px, -14px) rotate(45deg)}.checked .mark.short,.prev-checked.unselected .mark.short{height:5.6568542495px}.checked .mark.long,.prev-checked.unselected .mark.long{width:11.313708499px}.indeterminate .mark,.prev-indeterminate.unselected .mark{transform:scaleY(-1) translate(4px, -10px) rotate(0deg)}.prev-unselected .mark{transition-property:none}.prev-unselected.checked .mark.long{animation-name:prev-unselected-to-checked}@keyframes prev-unselected-to-checked{from{width:0}}:where(:hover) .outline{border-color:var(--md-checkbox-hover-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-hover-outline-width, 2px)}:where(:hover) .background{background:var(--md-checkbox-selected-hover-container-color, var(--md-sys-color-primary, #6750a4))}:where(:hover) .icon{fill:var(--md-checkbox-selected-hover-icon-color, var(--md-sys-color-on-primary, #fff))}:where(:focus-within) .outline{border-color:var(--md-checkbox-focus-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-focus-outline-width, 2px)}:where(:focus-within) .background{background:var(--md-checkbox-selected-focus-container-color, var(--md-sys-color-primary, #6750a4))}:where(:focus-within) .icon{fill:var(--md-checkbox-selected-focus-icon-color, var(--md-sys-color-on-primary, #fff))}:where(:active) .outline{border-color:var(--md-checkbox-pressed-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-pressed-outline-width, 2px)}:where(:active) .background{background:var(--md-checkbox-selected-pressed-container-color, var(--md-sys-color-primary, #6750a4))}:where(:active) .icon{fill:var(--md-checkbox-selected-pressed-icon-color, var(--md-sys-color-on-primary, #fff))}:where(.disabled,.prev-disabled) :is(.background,.icon,.mark){animation-duration:0s;transition-duration:0s}:where(.disabled) .outline{border-color:var(--md-checkbox-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));border-width:var(--md-checkbox-disabled-outline-width, 2px);opacity:var(--md-checkbox-disabled-container-opacity, 0.38)}:where(.selected.disabled) .outline{visibility:hidden}:where(.selected.disabled) .background{background:var(--md-checkbox-selected-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));opacity:var(--md-checkbox-selected-disabled-container-opacity, 0.38)}:where(.disabled) .icon{fill:var(--md-checkbox-selected-disabled-icon-color, var(--md-sys-color-surface, #fef7ff))}@media(forced-colors: active){.background{background-color:CanvasText}.selected.disabled .background{background-color:GrayText;opacity:1}.outline{border-color:CanvasText}.disabled .outline{border-color:GrayText;opacity:1}.icon{fill:Canvas}}
|
|
26
|
-
`;class re extends te{}re.styles=[ie],customElements.define("ew-checkbox",re);const oe=(()=>{const e=[];e[0]="rgb(0,0,0)",e[1]="rgb(128,0,0)",e[2]="rgb(0,128,0)",e[3]="rgb(128,128,0)",e[4]="rgb(0,0,128)",e[5]="rgb(128,0,128)",e[6]="rgb(0,128,128)",e[7]="rgb(192,192,192)",e[8]="rgb(128,128,128)",e[9]="rgb(255,0,0)",e[10]="rgb(0,255,0)",e[11]="rgb(255,255,0)",e[12]="rgb(99,153,255)",e[13]="rgb(255,0,255)",e[14]="rgb(0,255,255)",e[15]="rgb(255,255,255)";for(let t=0;t<216;t++){const i=Math.floor(t/36),r=Math.floor(t%36/6),o=t%6;e[16+t]="rgb("+(i?40*i+55:0)+","+(r?40*r+55:0)+","+(o?40*o+55:0)+")"}for(let t=0;t<24;t++){const i=10*t+8;e[232+t]="rgb("+i+","+i+","+i+")"}return e})(),se=["black","red","green","yellow","blue","magenta","cyan","white"];class ae{constructor(e){this.targetElement=e,this.state={bold:!1,italic:!1,underline:!1,strikethrough:!1,foregroundColor:null,backgroundColor:null,fgRgb:null,bgRgb:null,dim:!1,reverse:!1,carriageReturn:!1,lines:[],secret:!1,blink:!1,rapidBlink:!1},this._destroyed=!1,this._rafId=0,this._timeoutId=0,this._atBottom=!0,this._sentinel=null,this._exportLines=[],this._redactedLines=[],this._visibilityHandler=null;const t=document.createElement("div");t.style.height="1px",this._sentinel=t,e.appendChild(t),this._intersectionObserver=new IntersectionObserver(e=>{this._atBottom=e[0].isIntersecting},{root:e,threshold:0}),this._intersectionObserver.observe(t),this._visibilityHandler=()=>{document.hidden&&this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=0,this._timeoutId||(this._timeoutId=window.setTimeout(()=>this.processLines(),50)))},document.addEventListener("visibilitychange",this._visibilityHandler)}logs(){return this._redactedLines.join("")}_redactLine(e){const t=/(?:\x1B|\\x1B)(?:\[(.*?)[@-~]|\].*?(?:\x07|\x1B\\))/g;let i=0,r=!1,o="";for(;;){const s=t.exec(e);if(null===s)break;const a=s.index,l=e.substring(i,a);if(l&&(o+=r?"[redacted]":l),i=a+s[0].length,void 0!==s[1])for(const e of s[1].split(";"))switch(parseInt(e)){case 0:case 28:r=!1;break;case 8:r=!0}}const s=e.substring(i);return s&&(o+=r?"[redacted]":s),o}destroy(){var e;this._destroyed=!0,this.state.carriageReturn=!1,this.state.lines=[],null===(e=this._intersectionObserver)||void 0===e||e.disconnect(),this._visibilityHandler&&(document.removeEventListener("visibilitychange",this._visibilityHandler),this._visibilityHandler=null),this._sentinel&&(this._sentinel.remove(),this._sentinel=null),this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=0),this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=0)}processLine(e){const t=/(?:\x1B|\\x1B)(?:\[(.*?)([@-~])|\].*?(?:\x07|\x1B\\))/g;let i=0;const r=document.createElement("span");r.classList.add("line");const o=e=>{if(""===e)return;if(this.state.secret){const e=document.createElement("span");return e.classList.add("log-secret-redacted"),e.appendChild(document.createTextNode("[redacted]")),void r.appendChild(e)}const t=document.createElement("span");this.state.bold&&t.classList.add("log-bold"),this.state.dim&&t.classList.add("log-dim"),this.state.italic&&t.classList.add("log-italic"),this.state.underline&&t.classList.add("log-underline"),this.state.strikethrough&&t.classList.add("log-strikethrough"),this.state.blink&&t.classList.add("log-blink"),this.state.rapidBlink&&t.classList.add("log-rapid-blink");let i=this.state.fgRgb,o=this.state.bgRgb,s=this.state.foregroundColor,a=this.state.backgroundColor;this.state.reverse&&(i=this.state.bgRgb,o=this.state.fgRgb,s=this.state.backgroundColor,a=this.state.foregroundColor,i||s||o||a?(i||s||(i="rgb(28,28,28)"),o||a||(o="rgb(221,221,221)")):t.classList.add("log-reverse")),i?t.style.color=i:null!==s&&t.classList.add(`log-fg-${s}`),o?t.style.backgroundColor=o:null!==a&&t.classList.add(`log-bg-${a}`),t.appendChild(document.createTextNode(e)),r.appendChild(t)};for(;;){const r=t.exec(e);if(null===r)break;const s=r.index;if(o(e.substring(i,s)),i=s+r[0].length,void 0===r[1]||"m"!==r[2])continue;const a=""===r[1]?[""]:r[1].split(";"),l=[];let n=!1;for(const e of a)if(""!==e){if(!/^\d+$/.test(e)){n=!0;break}l.push(Number(e))}else l.push(0);if(!n)for(let e=0;e<l.length;e++){switch(l[e]){case 0:this.state.bold=!1,this.state.dim=!1,this.state.italic=!1,this.state.underline=!1,this.state.strikethrough=!1,this.state.foregroundColor=null,this.state.backgroundColor=null,this.state.fgRgb=null,this.state.bgRgb=null,this.state.reverse=!1,this.state.secret=!1,this.state.blink=!1,this.state.rapidBlink=!1;break;case 1:this.state.bold=!0;break;case 2:this.state.dim=!0;break;case 3:this.state.italic=!0;break;case 4:this.state.underline=!0;break;case 5:this.state.blink=!0,this.state.rapidBlink=!1;break;case 6:this.state.rapidBlink=!0,this.state.blink=!1;break;case 7:this.state.reverse=!0;break;case 8:this.state.secret=!0;break;case 9:this.state.strikethrough=!0;break;case 22:this.state.bold=!1,this.state.dim=!1;break;case 23:this.state.italic=!1;break;case 24:this.state.underline=!1;break;case 25:this.state.blink=!1,this.state.rapidBlink=!1;break;case 27:this.state.reverse=!1;break;case 28:this.state.secret=!1;break;case 29:this.state.strikethrough=!1;break;case 30:this.state.foregroundColor="black",this.state.fgRgb=null;break;case 31:this.state.foregroundColor="red",this.state.fgRgb=null;break;case 32:this.state.foregroundColor="green",this.state.fgRgb=null;break;case 33:this.state.foregroundColor="yellow",this.state.fgRgb=null;break;case 34:this.state.foregroundColor="blue",this.state.fgRgb=null;break;case 35:this.state.foregroundColor="magenta",this.state.fgRgb=null;break;case 36:this.state.foregroundColor="cyan",this.state.fgRgb=null;break;case 37:this.state.foregroundColor="white",this.state.fgRgb=null;break;case 38:if(e+1<l.length)if(5===l[e+1])if(e+2<l.length){const t=l[e+2];t>=0&&t<=7&&se[t]?(this.state.foregroundColor=se[t],this.state.fgRgb=null):t>=0&&t<=255&&oe[t]&&(this.state.foregroundColor=null,this.state.fgRgb=oe[t]),e+=2}else e+=1;else if(2===l[e+1])if(e+4<l.length){this.state.foregroundColor=null;const t=Math.max(0,Math.min(255,l[e+2])),i=Math.max(0,Math.min(255,l[e+3])),r=Math.max(0,Math.min(255,l[e+4]));this.state.fgRgb="rgb("+t+","+i+","+r+")",e+=4}else e=l.length-1;break;case 39:this.state.foregroundColor=null,this.state.fgRgb=null;break;case 40:this.state.backgroundColor="black",this.state.bgRgb=null;break;case 41:this.state.backgroundColor="red",this.state.bgRgb=null;break;case 42:this.state.backgroundColor="green",this.state.bgRgb=null;break;case 43:this.state.backgroundColor="yellow",this.state.bgRgb=null;break;case 44:this.state.backgroundColor="blue",this.state.bgRgb=null;break;case 45:this.state.backgroundColor="magenta",this.state.bgRgb=null;break;case 46:this.state.backgroundColor="cyan",this.state.bgRgb=null;break;case 47:this.state.backgroundColor="white",this.state.bgRgb=null;break;case 48:if(e+1<l.length)if(5===l[e+1])if(e+2<l.length){const t=l[e+2];t>=0&&t<=7&&se[t]?(this.state.backgroundColor=se[t],this.state.bgRgb=null):t>=0&&t<=255&&oe[t]&&(this.state.backgroundColor=null,this.state.bgRgb=oe[t]),e+=2}else e+=1;else if(2===l[e+1])if(e+4<l.length){this.state.backgroundColor=null;const t=Math.max(0,Math.min(255,l[e+2])),i=Math.max(0,Math.min(255,l[e+3])),r=Math.max(0,Math.min(255,l[e+4]));this.state.bgRgb="rgb("+t+","+i+","+r+")",e+=4}else e=l.length-1;break;case 49:this.state.backgroundColor=null,this.state.bgRgb=null;break;case 90:this.state.foregroundColor=null,this.state.fgRgb=oe[8];break;case 91:this.state.foregroundColor=null,this.state.fgRgb=oe[9];break;case 92:this.state.foregroundColor=null,this.state.fgRgb=oe[10];break;case 93:this.state.foregroundColor=null,this.state.fgRgb=oe[11];break;case 94:this.state.foregroundColor=null,this.state.fgRgb=oe[12];break;case 95:this.state.foregroundColor=null,this.state.fgRgb=oe[13];break;case 96:this.state.foregroundColor=null,this.state.fgRgb=oe[14];break;case 97:this.state.foregroundColor=null,this.state.fgRgb=oe[15];break;case 100:this.state.backgroundColor=null,this.state.bgRgb=oe[8];break;case 101:this.state.backgroundColor=null,this.state.bgRgb=oe[9];break;case 102:this.state.backgroundColor=null,this.state.bgRgb=oe[10];break;case 103:this.state.backgroundColor=null,this.state.bgRgb=oe[11];break;case 104:this.state.backgroundColor=null,this.state.bgRgb=oe[12];break;case 105:this.state.backgroundColor=null,this.state.bgRgb=oe[13];break;case 106:this.state.backgroundColor=null,this.state.bgRgb=oe[14];break;case 107:this.state.backgroundColor=null,this.state.bgRgb=oe[15]}}}return o(e.substring(i)),r}processLines(){if(this._rafId=0,this._timeoutId=0,this._destroyed||0===this.state.lines.length)return;const e=this.state.carriageReturn,t=document.createDocumentFragment();for(const e of this.state.lines){this.state.carriageReturn&&"\n"!==e&&t.childElementCount&&t.removeChild(t.lastChild);const i=e.endsWith("\r");t.appendChild(this.processLine(e.replace(/\r/g,""))),this.state.carriageReturn=i}const i=this._sentinel;if(!i)return void(this.state.lines=[]);e&&"\n"!==this.state.lines[0]&&i.previousSibling?this.targetElement.replaceChild(t,i.previousSibling):this.targetElement.insertBefore(t,i),this.state.lines=[];const r=this.targetElement.children,o=r.length-1-2e3;if(o>0)if(this._atBottom)for(let e=0;e<o;e++)this.targetElement.removeChild(r[0]);else{let e=0;for(let t=0;t<o;t++)e+=r[t].getBoundingClientRect().height;for(let e=0;e<o;e++)this.targetElement.removeChild(r[0]);this.targetElement.scrollTop-=e}this._atBottom&&(this.targetElement.scrollTop=this.targetElement.scrollHeight)}addLine(e){this._destroyed||(this._exportLines.push(e),this._redactedLines.push(this._redactLine(e)),this.state.lines.push(e),this._rafId||this._timeoutId||(document.hidden?this._timeoutId=window.setTimeout(()=>this.processLines(),50):this._rafId=requestAnimationFrame(()=>this.processLines())))}}const le=e=>new Promise(t=>setTimeout(t,e));class ne{constructor(){this.chunks=""}transform(e,t){this.chunks+=e;const i=/\r\n|\r|\n/g;let r,o=0;for(;null!==(r=i.exec(this.chunks))&&("\r"!==r[0]||r.index!==this.chunks.length-1);){const e=this.chunks.substring(o,r.index),s="\r"===r[0]?"\r":"\n";t.enqueue(e+s),o=i.lastIndex}this.chunks=this.chunks.substring(o)}flush(e){e.enqueue(this.chunks)}}const de=/^\s*(?:\[\d{2}:\d{2}:\d{2}(?:\.\d+)?\]|(?:\d{2}:){2}\d{2}\.\d)/,ce=/^(\x1b\[(?:\d+;)*\d*m)+/;class he{constructor(){this.deviceHasTimestamps=!1}transform(e,t){if(""===e||"\n"===e||"\r"===e)return void t.enqueue(e);if(!this.deviceHasTimestamps&&de.test(e)&&(this.deviceHasTimestamps=!0),this.deviceHasTimestamps)return void t.enqueue(e);const i=e.match(ce),r=i?i[0]:"",o=r?e.slice(r.length):e,s=new Date,a=`[${s.getHours().toString().padStart(2,"0")}:${s.getMinutes().toString().padStart(2,"0")}:${s.getSeconds().toString().padStart(2,"0")}]`,l=o.split(/(\r?\n)/);let n="";for(const e of l)"\n"===e||"\r\n"===e?n+=e:""!==e&&(n+=r+a+" "+e);t.enqueue(n)}reset(){this.deviceHasTimestamps=!1}}class pe extends HTMLElement{constructor(){super(...arguments),this.allowInput=!0,this._commandHistory=[],this._historyIndex=-1,this._currentInput=""}logs(){var e;return(null===(e=this._console)||void 0===e?void 0:e.logs())||""}connectedCallback(){var e;if(this._console)return;if((null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow({mode:"open"})).innerHTML=`\n <style>\n :host, input {\n background-color: #1c1c1c;\n color: #ddd;\n font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,\n monospace;\n line-height: 1.45;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n form {\n display: flex;\n align-items: center;\n padding: 0 8px 0 16px;\n flex-shrink: 0;\n }\n input {\n flex: 1;\n padding: 4px;\n margin: 0 8px;\n border: 0;\n outline: none;\n }\n \n .log {\n flex: 1;\n background-color: #1c1c1c;\n font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,\n monospace;\n font-size: 12px;\n padding: 16px;\n overflow: auto;\n line-height: 1.45;\n border-radius: 3px;\n white-space: pre-wrap;\n overflow-wrap: break-word;\n color: #ddd;\n }\n\n .log-bold { font-weight: bold; }\n .log-dim { opacity: 0.5; }\n .log-italic { font-style: italic; }\n .log-underline { text-decoration: underline; }\n .log-strikethrough { text-decoration: line-through; }\n .log-underline.log-strikethrough { text-decoration: underline line-through; }\n .log-blink { animation: blink 1s step-end infinite; }\n .log-rapid-blink { animation: blink 0.4s step-end infinite; }\n @keyframes blink { 50% { opacity: 0; } }\n .log-secret {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n .log-secret-redacted { opacity: 0; width: 1px; font-size: 1px; }\n .log-reverse { background: #ddd; color: #1c1c1c; }\n .log-fg-black { color: rgb(128, 128, 128); }\n .log-fg-red { color: rgb(255, 0, 0); }\n .log-fg-green { color: rgb(0, 255, 0); }\n .log-fg-yellow { color: rgb(255, 255, 0); }\n .log-fg-blue { color: rgb(0, 0, 255); }\n .log-fg-magenta { color: rgb(255, 0, 255); }\n .log-fg-cyan { color: rgb(0, 255, 255); }\n .log-fg-white { color: rgb(187, 187, 187); }\n .log-bg-black { background-color: rgb(0, 0, 0); }\n .log-bg-red { background-color: rgb(255, 0, 0); }\n .log-bg-green { background-color: rgb(0, 255, 0); }\n .log-bg-yellow { background-color: rgb(255, 255, 0); }\n .log-bg-blue { background-color: rgb(0, 0, 255); }\n .log-bg-magenta { background-color: rgb(255, 0, 255); }\n .log-bg-cyan { background-color: rgb(0, 255, 255); }\n .log-bg-white { background-color: rgb(255, 255, 255); }\n\n </style>\n <div class="log"></div>\n ${this.allowInput?'<form>\n <span aria-hidden="true">></span>\n <input aria-label="Serial command" autofocus>\n </form>\n ':""}\n `,this._console=new ae(this.shadowRoot.querySelector("div")),this.allowInput){const e=this.shadowRoot.querySelector("input");this._clickHandler=()=>{var t;""===(null===(t=getSelection())||void 0===t?void 0:t.toString())&&e.focus()},this.addEventListener("click",this._clickHandler),e.addEventListener("keydown",t=>{"Enter"===t.key?(t.preventDefault(),t.stopPropagation(),this._sendCommand()):"ArrowUp"===t.key?(t.preventDefault(),this._navigateHistory(e,1)):"ArrowDown"===t.key?(t.preventDefault(),this._navigateHistory(e,-1)):this._historyIndex=-1})}const t=new AbortController,i=this._connect(t.signal);this._cancelConnection=()=>(t.abort(),i)}async _connect(e){this.logger.debug("Starting console read loop");const t=this._console;if(!this.port.readable)return null==t||t.addLine(""),null==t||t.addLine(""),null==t||t.addLine("Terminal disconnected: Port readable stream not available"),void this.logger.error("Port readable stream not available - port may need to be reopened at correct baudrate");try{await this.port.readable.pipeThrough(new TextDecoderStream,{signal:e}).pipeThrough(new TransformStream(new ne)).pipeThrough(new TransformStream(new he)).pipeTo(new WritableStream({write:e=>{null==t||t.addLine(e)}})),e.aborted||(null==t||t.addLine(""),null==t||t.addLine(""),null==t||t.addLine("Terminal disconnected"))}catch(i){e.aborted||(null==t||t.addLine(""),null==t||t.addLine(""),null==t||t.addLine(`Terminal disconnected: ${i}`))}finally{await le(100),this.logger.debug("Finished console read loop")}}_navigateHistory(e,t){if(0===this._commandHistory.length)return;-1===this._historyIndex&&(this._currentInput=e.value);const i=this._historyIndex+t;i<0?(this._historyIndex=-1,e.value=this._currentInput):i<this._commandHistory.length&&(this._historyIndex=i,e.value=this._commandHistory[this._historyIndex]);const r=e.value.length;e.setSelectionRange(r,r)}async _sendCommand(){var e,t;const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("input");if(!i||!this.port.writable)return;const r=i.value,o=this.port.writable.getWriter();try{await o.write((new TextEncoder).encode(`${r}\r\n`)),null===(t=this._console)||void 0===t||t.addLine(`> ${r}\r\n`),i.isConnected&&(r&&r!==this._commandHistory[0]&&(this._commandHistory.unshift(r),this._commandHistory.length>100&&this._commandHistory.pop()),this._historyIndex=-1,this._currentInput="",i.value="",i.focus())}finally{try{o.releaseLock()}catch(e){this.logger.error("Ignoring release lock error",e)}}}async disconnect(){var e;this._clickHandler&&(this.removeEventListener("click",this._clickHandler),this._clickHandler=void 0),this._cancelConnection&&(await this._cancelConnection(),this._cancelConnection=void 0),null===(e=this._console)||void 0===e||e.destroy(),this._console=void 0}disconnectedCallback(){var e;this._clickHandler&&(this.removeEventListener("click",this._clickHandler),this._clickHandler=void 0),this._cancelConnection&&(this._cancelConnection(),this._cancelConnection=void 0),null===(e=this._console)||void 0===e||e.destroy(),this._console=void 0}async reset(){if(this.logger.debug("Triggering reset."),this.onReset)try{await this.onReset()}catch(e){this.logger.error("Reset callback failed:",e)}await le(1e3)}}customElements.define("ew-console",pe);const ue=Symbol.for(""),fe=e=>{if(e?.r===ue)return e?._$litStatic$},ge=(e,...t)=>({_$litStatic$:t.reduce((t,i,r)=>t+(e=>{if(void 0!==e._$litStatic$)return e._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${e}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(i)+e[r+1],e[0]),r:ue}),me=new Map,ve=(e=>(t,...i)=>{const r=i.length;let o,s;const a=[],l=[];let n,d=0,c=!1;for(;d<r;){for(n=t[d];d<r&&void 0!==(s=i[d],o=fe(s));)n+=o+t[++d],c=!0;d!==r&&l.push(s),a.push(n),d++}if(d===r&&a.push(t[r]),c){const e=a.join("$$lit$$");void 0===(t=me.get(e))&&(a.raw=a,me.set(e,t=a)),i=l}return e(t,...i)})(u);function be(e,t=!0){return t&&"rtl"===getComputedStyle(e).getPropertyValue("direction").trim()}const ye=o(s(a));class xe extends ye{get name(){return this.getAttribute("name")??""}set name(e){this.setAttribute("name",e)}get form(){return this[t].form}get labels(){return this[t].labels}constructor(){super(),this.disabled=!1,this.softDisabled=!1,this.flipIconInRtl=!1,this.href="",this.target="",this.ariaLabelSelected="",this.toggle=!1,this.selected=!1,this.type="submit",this.value="",this.flipIcon=be(this,this.flipIconInRtl),this.addEventListener("click",this.handleClick.bind(this))}willUpdate(){this.href&&(this.disabled=!1,this.softDisabled=!1)}render(){const e=this.href?ge`div`:ge`button`,{ariaLabel:t,ariaHasPopup:i,ariaExpanded:r}=this,o=t&&this.ariaLabelSelected,s=this.toggle?this.selected:p;let a=p;return this.href||(a=o&&this.selected?this.ariaLabelSelected:t),ve`<${e}
|
|
26
|
+
`;class re extends te{}re.styles=[ie],customElements.define("ew-checkbox",re);const oe=(()=>{const e=[];e[0]="rgb(0,0,0)",e[1]="rgb(128,0,0)",e[2]="rgb(0,128,0)",e[3]="rgb(128,128,0)",e[4]="rgb(0,0,128)",e[5]="rgb(128,0,128)",e[6]="rgb(0,128,128)",e[7]="rgb(192,192,192)",e[8]="rgb(128,128,128)",e[9]="rgb(255,0,0)",e[10]="rgb(0,255,0)",e[11]="rgb(255,255,0)",e[12]="rgb(99,153,255)",e[13]="rgb(255,0,255)",e[14]="rgb(0,255,255)",e[15]="rgb(255,255,255)";for(let t=0;t<216;t++){const i=Math.floor(t/36),r=Math.floor(t%36/6),o=t%6;e[16+t]="rgb("+(i?40*i+55:0)+","+(r?40*r+55:0)+","+(o?40*o+55:0)+")"}for(let t=0;t<24;t++){const i=10*t+8;e[232+t]="rgb("+i+","+i+","+i+")"}return e})(),se=["black","red","green","yellow","blue","magenta","cyan","white"];class ae{constructor(e){this.targetElement=e,this.state={bold:!1,italic:!1,underline:!1,strikethrough:!1,foregroundColor:null,backgroundColor:null,fgRgb:null,bgRgb:null,dim:!1,reverse:!1,carriageReturn:!1,lines:[],secret:!1,blink:!1,rapidBlink:!1},this._destroyed=!1,this._rafId=0,this._timeoutId=0,this._atBottom=!0,this._sentinel=null,this._exportLines=[],this._redactedLines=[],this._visibilityHandler=null;const t=document.createElement("div");t.style.height="1px",this._sentinel=t,e.appendChild(t),this._intersectionObserver=new IntersectionObserver(e=>{this._atBottom=e[0].isIntersecting},{root:e,threshold:0}),this._intersectionObserver.observe(t),this._visibilityHandler=()=>{document.hidden&&this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=0,this._timeoutId||(this._timeoutId=window.setTimeout(()=>this.processLines(),50)))},document.addEventListener("visibilitychange",this._visibilityHandler)}logs(){return this._redactedLines.join("")}_redactLine(e){const t=/(?:\x1B|\\x1B)(?:\[(.*?)[@-~]|\].*?(?:\x07|\x1B\\))/g;let i=0,r=!1,o="";for(;;){const s=t.exec(e);if(null===s)break;const a=s.index,l=e.substring(i,a);if(l&&(o+=r?"[redacted]":l),i=a+s[0].length,void 0!==s[1])for(const e of s[1].split(";"))switch(parseInt(e)){case 0:case 28:r=!1;break;case 8:r=!0}}const s=e.substring(i);return s&&(o+=r?"[redacted]":s),o}destroy(){var e;this._destroyed=!0,this.state.carriageReturn=!1,this.state.lines=[],null===(e=this._intersectionObserver)||void 0===e||e.disconnect(),this._visibilityHandler&&(document.removeEventListener("visibilitychange",this._visibilityHandler),this._visibilityHandler=null),this._sentinel&&(this._sentinel.remove(),this._sentinel=null),this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=0),this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=0)}processLine(e){const t=/(?:\x1B|\\x1B)(?:\[(.*?)([@-~])|\].*?(?:\x07|\x1B\\))/g;let i=0;const r=document.createElement("span");r.classList.add("line");const o=e=>{if(""===e)return;if(this.state.secret){const e=document.createElement("span");return e.classList.add("log-secret-redacted"),e.appendChild(document.createTextNode("[redacted]")),void r.appendChild(e)}const t=document.createElement("span");this.state.bold&&t.classList.add("log-bold"),this.state.dim&&t.classList.add("log-dim"),this.state.italic&&t.classList.add("log-italic"),this.state.underline&&t.classList.add("log-underline"),this.state.strikethrough&&t.classList.add("log-strikethrough"),this.state.blink&&t.classList.add("log-blink"),this.state.rapidBlink&&t.classList.add("log-rapid-blink");let i=this.state.fgRgb,o=this.state.bgRgb,s=this.state.foregroundColor,a=this.state.backgroundColor;this.state.reverse&&(i=this.state.bgRgb,o=this.state.fgRgb,s=this.state.backgroundColor,a=this.state.foregroundColor,i||s||o||a?(i||s||(i="rgb(28,28,28)"),o||a||(o="rgb(221,221,221)")):t.classList.add("log-reverse")),i?t.style.color=i:null!==s&&t.classList.add(`log-fg-${s}`),o?t.style.backgroundColor=o:null!==a&&t.classList.add(`log-bg-${a}`),t.appendChild(document.createTextNode(e)),r.appendChild(t)};for(;;){const r=t.exec(e);if(null===r)break;const s=r.index;if(o(e.substring(i,s)),i=s+r[0].length,void 0===r[1]||"m"!==r[2])continue;const a=""===r[1]?[""]:r[1].split(";"),l=[];let n=!1;for(const e of a)if(""!==e){if(!/^\d+$/.test(e)){n=!0;break}l.push(Number(e))}else l.push(0);if(!n)for(let e=0;e<l.length;e++){switch(l[e]){case 0:this.state.bold=!1,this.state.dim=!1,this.state.italic=!1,this.state.underline=!1,this.state.strikethrough=!1,this.state.foregroundColor=null,this.state.backgroundColor=null,this.state.fgRgb=null,this.state.bgRgb=null,this.state.reverse=!1,this.state.secret=!1,this.state.blink=!1,this.state.rapidBlink=!1;break;case 1:this.state.bold=!0;break;case 2:this.state.dim=!0;break;case 3:this.state.italic=!0;break;case 4:this.state.underline=!0;break;case 5:this.state.blink=!0,this.state.rapidBlink=!1;break;case 6:this.state.rapidBlink=!0,this.state.blink=!1;break;case 7:this.state.reverse=!0;break;case 8:this.state.secret=!0;break;case 9:this.state.strikethrough=!0;break;case 22:this.state.bold=!1,this.state.dim=!1;break;case 23:this.state.italic=!1;break;case 24:this.state.underline=!1;break;case 25:this.state.blink=!1,this.state.rapidBlink=!1;break;case 27:this.state.reverse=!1;break;case 28:this.state.secret=!1;break;case 29:this.state.strikethrough=!1;break;case 30:this.state.foregroundColor="black",this.state.fgRgb=null;break;case 31:this.state.foregroundColor="red",this.state.fgRgb=null;break;case 32:this.state.foregroundColor="green",this.state.fgRgb=null;break;case 33:this.state.foregroundColor="yellow",this.state.fgRgb=null;break;case 34:this.state.foregroundColor="blue",this.state.fgRgb=null;break;case 35:this.state.foregroundColor="magenta",this.state.fgRgb=null;break;case 36:this.state.foregroundColor="cyan",this.state.fgRgb=null;break;case 37:this.state.foregroundColor="white",this.state.fgRgb=null;break;case 38:if(e+1<l.length)if(5===l[e+1])if(e+2<l.length){const t=l[e+2];t>=0&&t<=7&&se[t]?(this.state.foregroundColor=se[t],this.state.fgRgb=null):t>=0&&t<=255&&oe[t]&&(this.state.foregroundColor=null,this.state.fgRgb=oe[t]),e+=2}else e+=1;else if(2===l[e+1])if(e+4<l.length){this.state.foregroundColor=null;const t=Math.max(0,Math.min(255,l[e+2])),i=Math.max(0,Math.min(255,l[e+3])),r=Math.max(0,Math.min(255,l[e+4]));this.state.fgRgb="rgb("+t+","+i+","+r+")",e+=4}else e=l.length-1;break;case 39:this.state.foregroundColor=null,this.state.fgRgb=null;break;case 40:this.state.backgroundColor="black",this.state.bgRgb=null;break;case 41:this.state.backgroundColor="red",this.state.bgRgb=null;break;case 42:this.state.backgroundColor="green",this.state.bgRgb=null;break;case 43:this.state.backgroundColor="yellow",this.state.bgRgb=null;break;case 44:this.state.backgroundColor="blue",this.state.bgRgb=null;break;case 45:this.state.backgroundColor="magenta",this.state.bgRgb=null;break;case 46:this.state.backgroundColor="cyan",this.state.bgRgb=null;break;case 47:this.state.backgroundColor="white",this.state.bgRgb=null;break;case 48:if(e+1<l.length)if(5===l[e+1])if(e+2<l.length){const t=l[e+2];t>=0&&t<=7&&se[t]?(this.state.backgroundColor=se[t],this.state.bgRgb=null):t>=0&&t<=255&&oe[t]&&(this.state.backgroundColor=null,this.state.bgRgb=oe[t]),e+=2}else e+=1;else if(2===l[e+1])if(e+4<l.length){this.state.backgroundColor=null;const t=Math.max(0,Math.min(255,l[e+2])),i=Math.max(0,Math.min(255,l[e+3])),r=Math.max(0,Math.min(255,l[e+4]));this.state.bgRgb="rgb("+t+","+i+","+r+")",e+=4}else e=l.length-1;break;case 49:this.state.backgroundColor=null,this.state.bgRgb=null;break;case 90:this.state.foregroundColor=null,this.state.fgRgb=oe[8];break;case 91:this.state.foregroundColor=null,this.state.fgRgb=oe[9];break;case 92:this.state.foregroundColor=null,this.state.fgRgb=oe[10];break;case 93:this.state.foregroundColor=null,this.state.fgRgb=oe[11];break;case 94:this.state.foregroundColor=null,this.state.fgRgb=oe[12];break;case 95:this.state.foregroundColor=null,this.state.fgRgb=oe[13];break;case 96:this.state.foregroundColor=null,this.state.fgRgb=oe[14];break;case 97:this.state.foregroundColor=null,this.state.fgRgb=oe[15];break;case 100:this.state.backgroundColor=null,this.state.bgRgb=oe[8];break;case 101:this.state.backgroundColor=null,this.state.bgRgb=oe[9];break;case 102:this.state.backgroundColor=null,this.state.bgRgb=oe[10];break;case 103:this.state.backgroundColor=null,this.state.bgRgb=oe[11];break;case 104:this.state.backgroundColor=null,this.state.bgRgb=oe[12];break;case 105:this.state.backgroundColor=null,this.state.bgRgb=oe[13];break;case 106:this.state.backgroundColor=null,this.state.bgRgb=oe[14];break;case 107:this.state.backgroundColor=null,this.state.bgRgb=oe[15]}}}return o(e.substring(i)),r}processLines(){if(this._rafId=0,this._timeoutId=0,this._destroyed||0===this.state.lines.length)return;const e=this.state.carriageReturn,t=document.createDocumentFragment();for(const e of this.state.lines){this.state.carriageReturn&&"\n"!==e&&t.childElementCount&&t.removeChild(t.lastChild);const i=e.endsWith("\r");t.appendChild(this.processLine(e.replace(/\r/g,""))),this.state.carriageReturn=i}const i=this._sentinel;if(!i)return void(this.state.lines=[]);e&&"\n"!==this.state.lines[0]&&i.previousSibling?this.targetElement.replaceChild(t,i.previousSibling):this.targetElement.insertBefore(t,i),this.state.lines=[];const r=this.targetElement.children,o=r.length-1-2e3;if(o>0)if(this._atBottom)for(let e=0;e<o;e++)this.targetElement.removeChild(r[0]);else{let e=0;for(let t=0;t<o;t++)e+=r[t].getBoundingClientRect().height;for(let e=0;e<o;e++)this.targetElement.removeChild(r[0]);this.targetElement.scrollTop-=e}this._atBottom&&(this.targetElement.scrollTop=this.targetElement.scrollHeight)}addLine(e){this._destroyed||(this._exportLines.push(e),this._redactedLines.push(this._redactLine(e)),this.state.lines.push(e),this._rafId||this._timeoutId||(document.hidden?this._timeoutId=window.setTimeout(()=>this.processLines(),50):this._rafId=requestAnimationFrame(()=>this.processLines())))}}const le=e=>new Promise(t=>setTimeout(t,e));class ne{constructor(){this.chunks=""}transform(e,t){this.chunks+=e;const i=/\r\n|\r|\n/g;let r,o=0;for(;null!==(r=i.exec(this.chunks))&&("\r"!==r[0]||r.index!==this.chunks.length-1);){const e=this.chunks.substring(o,r.index),s="\r"===r[0]?"\r":"\n";t.enqueue(e+s),o=i.lastIndex}this.chunks=this.chunks.substring(o)}flush(e){e.enqueue(this.chunks)}}const de=/^\s*(?:\[\d{2}:\d{2}:\d{2}(?:\.\d+)?\]|(?:\d{2}:){2}\d{2}\.\d)/,ce=/^(\x1b\[(?:\d+;)*\d*m)+/;class he{constructor(){this.deviceHasTimestamps=!1}transform(e,t){if(""===e||"\n"===e||"\r"===e)return void t.enqueue(e);if(!this.deviceHasTimestamps&&de.test(e)&&(this.deviceHasTimestamps=!0),this.deviceHasTimestamps)return void t.enqueue(e);const i=e.match(ce),r=i?i[0]:"",o=r?e.slice(r.length):e,s=new Date,a=`[${s.getHours().toString().padStart(2,"0")}:${s.getMinutes().toString().padStart(2,"0")}:${s.getSeconds().toString().padStart(2,"0")}]`,l=o.split(/(\r?\n)/);let n="";for(const e of l)"\n"===e||"\r\n"===e?n+=e:""!==e&&(n+=r+a+" "+e);t.enqueue(n)}reset(){this.deviceHasTimestamps=!1}}class pe extends HTMLElement{constructor(){super(...arguments),this.allowInput=!0,this._commandHistory=[],this._historyIndex=-1,this._currentInput=""}logs(){var e;return(null===(e=this._console)||void 0===e?void 0:e.logs())||""}connectedCallback(){var e;if(this._console)return;if((null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow({mode:"open"})).innerHTML=`\n <style>\n :host, input {\n background-color: #1c1c1c;\n color: #ddd;\n font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,\n monospace;\n line-height: 1.45;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n form {\n display: flex;\n align-items: center;\n padding: 0 8px 0 16px;\n flex-shrink: 0;\n }\n input {\n flex: 1;\n padding: 4px;\n margin: 0 8px;\n border: 0;\n outline: none;\n }\n \n .log {\n flex: 1;\n background-color: #1c1c1c;\n font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,\n monospace;\n font-size: 12px;\n padding: 16px;\n overflow: auto;\n line-height: 1.45;\n border-radius: 3px;\n white-space: pre-wrap;\n overflow-wrap: break-word;\n color: #ddd;\n }\n\n .log-bold { font-weight: bold; }\n .log-dim { opacity: 0.5; }\n .log-italic { font-style: italic; }\n .log-underline { text-decoration: underline; }\n .log-strikethrough { text-decoration: line-through; }\n .log-underline.log-strikethrough { text-decoration: underline line-through; }\n .log-blink { animation: blink 1s step-end infinite; }\n .log-rapid-blink { animation: blink 0.4s step-end infinite; }\n @keyframes blink { 50% { opacity: 0; } }\n .log-secret {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n .log-secret-redacted { opacity: 0; width: 1px; font-size: 1px; }\n .log-reverse { background: #ddd; color: #1c1c1c; }\n .log-fg-black { color: rgb(128, 128, 128); }\n .log-fg-red { color: rgb(255, 0, 0); }\n .log-fg-green { color: rgb(0, 255, 0); }\n .log-fg-yellow { color: rgb(255, 255, 0); }\n .log-fg-blue { color: rgb(0, 0, 255); }\n .log-fg-magenta { color: rgb(255, 0, 255); }\n .log-fg-cyan { color: rgb(0, 255, 255); }\n .log-fg-white { color: rgb(187, 187, 187); }\n .log-bg-black { background-color: rgb(0, 0, 0); }\n .log-bg-red { background-color: rgb(255, 0, 0); }\n .log-bg-green { background-color: rgb(0, 255, 0); }\n .log-bg-yellow { background-color: rgb(255, 255, 0); }\n .log-bg-blue { background-color: rgb(0, 0, 255); }\n .log-bg-magenta { background-color: rgb(255, 0, 255); }\n .log-bg-cyan { background-color: rgb(0, 255, 255); }\n .log-bg-white { background-color: rgb(255, 255, 255); }\n\n </style>\n <div class="log"></div>\n ${this.allowInput?'<form>\n <span aria-hidden="true">></span>\n <input aria-label="Serial command" autofocus>\n </form>\n ':""}\n `,this._console=new ae(this.shadowRoot.querySelector("div")),this.allowInput){const e=this.shadowRoot.querySelector("input");this._clickHandler=()=>{var t;""===(null===(t=getSelection())||void 0===t?void 0:t.toString())&&e.focus()},this.addEventListener("click",this._clickHandler),e.addEventListener("keydown",t=>{"Enter"===t.key?(t.preventDefault(),t.stopPropagation(),this._sendCommand()):"ArrowUp"===t.key?(t.preventDefault(),this._navigateHistory(e,1)):"ArrowDown"===t.key?(t.preventDefault(),this._navigateHistory(e,-1)):this._historyIndex=-1})}const t=new AbortController,i=this._connect(t.signal);this._cancelConnection=()=>(t.abort(),i)}async _connect(e){this.logger.debug("Starting console read loop");const t=this._console;if(!this.port.readable)return null==t||t.addLine(""),null==t||t.addLine(""),null==t||t.addLine("Terminal disconnected: Port readable stream not available"),void this.logger.error("Port readable stream not available - port may need to be reopened at correct baudrate");try{await this.port.readable.pipeThrough(new TextDecoderStream,{signal:e}).pipeThrough(new TransformStream(new ne)).pipeThrough(new TransformStream(new he)).pipeTo(new WritableStream({write:e=>{null==t||t.addLine(e)}})),e.aborted||(null==t||t.addLine(""),null==t||t.addLine(""),null==t||t.addLine("Terminal disconnected"))}catch(i){e.aborted||(null==t||t.addLine(""),null==t||t.addLine(""),null==t||t.addLine(`Terminal disconnected: ${i}`))}finally{await le(100),this.logger.debug("Finished console read loop")}}_navigateHistory(e,t){if(0===this._commandHistory.length)return;-1===this._historyIndex&&(this._currentInput=e.value);const i=this._historyIndex+t;i<0?(this._historyIndex=-1,e.value=this._currentInput):i<this._commandHistory.length&&(this._historyIndex=i,e.value=this._commandHistory[this._historyIndex]);const r=e.value.length;e.setSelectionRange(r,r)}async _sendCommand(){var e,t;const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("input");if(!i||!this.port.writable)return;const r=i.value,o=this.port.writable.getWriter();try{await o.write((new TextEncoder).encode(`${r}\r\n`)),null===(t=this._console)||void 0===t||t.addLine(`> ${r}\r\n`),i.isConnected&&(r&&r!==this._commandHistory[0]&&(this._commandHistory.unshift(r),this._commandHistory.length>100&&this._commandHistory.pop()),this._historyIndex=-1,this._currentInput="",i.value="",i.focus())}finally{try{o.releaseLock()}catch(e){this.logger.error("Ignoring release lock error",e)}}}async disconnect(){var e;this._clickHandler&&(this.removeEventListener("click",this._clickHandler),this._clickHandler=void 0),this._cancelConnection&&(await this._cancelConnection(),this._cancelConnection=void 0),null===(e=this._console)||void 0===e||e.destroy(),this._console=void 0}disconnectedCallback(){var e;this._clickHandler&&(this.removeEventListener("click",this._clickHandler),this._clickHandler=void 0),this._cancelConnection&&(this._cancelConnection(),this._cancelConnection=void 0),null===(e=this._console)||void 0===e||e.destroy(),this._console=void 0}async reset(){if(this.logger.debug("Triggering reset."),this.onReset)try{await this.onReset()}catch(e){this.logger.error("Reset callback failed:",e)}await le(1e3)}}customElements.define("ew-console",pe);const ue=Symbol.for(""),fe=e=>{if(e?.r===ue)return e?._$litStatic$},ge=(e,...t)=>({_$litStatic$:t.reduce((t,i,r)=>t+(e=>{if(void 0!==e._$litStatic$)return e._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${e}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(i)+e[r+1],e[0]),r:ue}),me=new Map,ve=(e=>(t,...i)=>{const r=i.length;let o,s;const a=[],l=[];let n,d=0,c=!1;for(;d<r;){for(n=t[d];d<r&&void 0!==(s=i[d],o=fe(s));)n+=o+t[++d],c=!0;d!==r&&l.push(s),a.push(n),d++}if(d===r&&a.push(t[r]),c){const e=a.join("$$lit$$");void 0===(t=me.get(e))&&(a.raw=a,me.set(e,t=a)),i=l}return e(t,...i)})(u);function be(e,t=!0){return t&&"rtl"===getComputedStyle(e).getPropertyValue("direction").trim()}const ye=o(s(a));class _e extends ye{get name(){return this.getAttribute("name")??""}set name(e){this.setAttribute("name",e)}get form(){return this[t].form}get labels(){return this[t].labels}constructor(){super(),this.disabled=!1,this.softDisabled=!1,this.flipIconInRtl=!1,this.href="",this.target="",this.ariaLabelSelected="",this.toggle=!1,this.selected=!1,this.type="submit",this.value="",this.flipIcon=be(this,this.flipIconInRtl),this.addEventListener("click",this.handleClick.bind(this))}willUpdate(){this.href&&(this.disabled=!1,this.softDisabled=!1)}render(){const e=this.href?ge`div`:ge`button`,{ariaLabel:t,ariaHasPopup:i,ariaExpanded:r}=this,o=t&&this.ariaLabelSelected,s=this.toggle?this.selected:p;let a=p;return this.href||(a=o&&this.selected?this.ariaLabelSelected:t),ve`<${e}
|
|
27
27
|
class="icon-button ${h(this.getRenderClasses())}"
|
|
28
28
|
id="button"
|
|
29
29
|
aria-label="${a||p}"
|
|
@@ -52,9 +52,9 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
52
52
|
part="focus-ring"
|
|
53
53
|
for=${this.href?"link":"button"}></md-focus-ring>`}renderRipple(){const e=!this.href&&(this.disabled||this.softDisabled);return u`<md-ripple
|
|
54
54
|
for=${this.href?"link":p}
|
|
55
|
-
?disabled="${e}"></md-ripple>`}connectedCallback(){this.flipIcon=be(this,this.flipIconInRtl),super.connectedCallback()}handleClick(e){if(!this.href&&this.softDisabled)return e.stopImmediatePropagation(),void e.preventDefault()}async handleClickOnChild(e){await 0,!this.toggle||this.disabled||this.softDisabled||e.defaultPrevented||(this.selected=!this.selected,this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0})))}}m(
|
|
55
|
+
?disabled="${e}"></md-ripple>`}connectedCallback(){this.flipIcon=be(this,this.flipIconInRtl),super.connectedCallback()}handleClick(e){if(!this.href&&this.softDisabled)return e.stopImmediatePropagation(),void e.preventDefault()}async handleClickOnChild(e){await 0,!this.toggle||this.disabled||this.softDisabled||e.defaultPrevented||(this.selected=!this.selected,this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0})))}}m(_e),_e.formAssociated=!0,_e.shadowRootOptions={mode:"open",delegatesFocus:!0},i([r({type:Boolean,reflect:!0})],_e.prototype,"disabled",void 0),i([r({type:Boolean,attribute:"soft-disabled",reflect:!0})],_e.prototype,"softDisabled",void 0),i([r({type:Boolean,attribute:"flip-icon-in-rtl"})],_e.prototype,"flipIconInRtl",void 0),i([r()],_e.prototype,"href",void 0),i([r()],_e.prototype,"target",void 0),i([r({attribute:"aria-label-selected"})],_e.prototype,"ariaLabelSelected",void 0),i([r({type:Boolean})],_e.prototype,"toggle",void 0),i([r({type:Boolean,reflect:!0})],_e.prototype,"selected",void 0),i([r()],_e.prototype,"type",void 0),i([r({reflect:!0})],_e.prototype,"value",void 0),i([l()],_e.prototype,"flipIcon",void 0);const xe=g`:host{display:inline-flex;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0);height:var(--_container-height);width:var(--_container-width);justify-content:center}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--_container-height))/2) max(0px,(48px - var(--_container-width))/2)}md-focus-ring{--md-focus-ring-shape-start-start: var(--_container-shape-start-start);--md-focus-ring-shape-start-end: var(--_container-shape-start-end);--md-focus-ring-shape-end-end: var(--_container-shape-end-end);--md-focus-ring-shape-end-start: var(--_container-shape-end-start)}:host(:is([disabled],[soft-disabled])){pointer-events:none}.icon-button{place-items:center;background:none;border:none;box-sizing:border-box;cursor:pointer;display:flex;place-content:center;outline:none;padding:0;position:relative;text-decoration:none;user-select:none;z-index:0;flex:1;border-start-start-radius:var(--_container-shape-start-start);border-start-end-radius:var(--_container-shape-start-end);border-end-start-radius:var(--_container-shape-end-start);border-end-end-radius:var(--_container-shape-end-end)}.icon ::slotted(*){font-size:var(--_icon-size);height:var(--_icon-size);width:var(--_icon-size);font-weight:inherit}md-ripple{z-index:-1;border-start-start-radius:var(--_container-shape-start-start);border-start-end-radius:var(--_container-shape-start-end);border-end-start-radius:var(--_container-shape-end-start);border-end-end-radius:var(--_container-shape-end-end)}.flip-icon .icon{transform:scaleX(-1)}.icon{display:inline-flex}.link{height:100%;outline:none;position:absolute;width:100%}.touch{position:absolute;height:max(48px,100%);width:max(48px,100%)}:host([touch-target=none]) .touch{display:none}@media(forced-colors: active){:host(:is([disabled],[soft-disabled])){--_disabled-icon-color: GrayText;--_disabled-icon-opacity: 1}}
|
|
56
56
|
`,we=g`:host{--_disabled-icon-color: var(--md-icon-button-disabled-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-icon-opacity: var(--md-icon-button-disabled-icon-opacity, 0.38);--_icon-size: var(--md-icon-button-icon-size, 24px);--_selected-focus-icon-color: var(--md-icon-button-selected-focus-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-icon-color: var(--md-icon-button-selected-hover-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-state-layer-color: var(--md-icon-button-selected-hover-state-layer-color, var(--md-sys-color-primary, #6750a4));--_selected-hover-state-layer-opacity: var(--md-icon-button-selected-hover-state-layer-opacity, 0.08);--_selected-icon-color: var(--md-icon-button-selected-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-icon-color: var(--md-icon-button-selected-pressed-icon-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-state-layer-color: var(--md-icon-button-selected-pressed-state-layer-color, var(--md-sys-color-primary, #6750a4));--_selected-pressed-state-layer-opacity: var(--md-icon-button-selected-pressed-state-layer-opacity, 0.12);--_state-layer-height: var(--md-icon-button-state-layer-height, 40px);--_state-layer-shape: var(--md-icon-button-state-layer-shape, var(--md-sys-shape-corner-full, 9999px));--_state-layer-width: var(--md-icon-button-state-layer-width, 40px);--_focus-icon-color: var(--md-icon-button-focus-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-icon-color: var(--md-icon-button-hover-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-state-layer-color: var(--md-icon-button-hover-state-layer-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-state-layer-opacity: var(--md-icon-button-hover-state-layer-opacity, 0.08);--_icon-color: var(--md-icon-button-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_pressed-icon-color: var(--md-icon-button-pressed-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_pressed-state-layer-color: var(--md-icon-button-pressed-state-layer-color, var(--md-sys-color-on-surface-variant, #49454f));--_pressed-state-layer-opacity: var(--md-icon-button-pressed-state-layer-opacity, 0.12);--_container-shape-start-start: 0;--_container-shape-start-end: 0;--_container-shape-end-end: 0;--_container-shape-end-start: 0;--_container-height: 0;--_container-width: 0;height:var(--_state-layer-height);width:var(--_state-layer-width)}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--_state-layer-height))/2) max(0px,(48px - var(--_state-layer-width))/2)}md-focus-ring{--md-focus-ring-shape-start-start: var(--_state-layer-shape);--md-focus-ring-shape-start-end: var(--_state-layer-shape);--md-focus-ring-shape-end-end: var(--_state-layer-shape);--md-focus-ring-shape-end-start: var(--_state-layer-shape)}.standard{background-color:rgba(0,0,0,0);color:var(--_icon-color);--md-ripple-hover-color: var(--_hover-state-layer-color);--md-ripple-hover-opacity: var(--_hover-state-layer-opacity);--md-ripple-pressed-color: var(--_pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_pressed-state-layer-opacity)}.standard:hover{color:var(--_hover-icon-color)}.standard:focus{color:var(--_focus-icon-color)}.standard:active{color:var(--_pressed-icon-color)}.standard:is(:disabled,[aria-disabled=true]){color:var(--_disabled-icon-color)}md-ripple{border-radius:var(--_state-layer-shape)}.standard:is(:disabled,[aria-disabled=true]){opacity:var(--_disabled-icon-opacity)}.selected{--md-ripple-hover-color: var(--_selected-hover-state-layer-color);--md-ripple-hover-opacity: var(--_selected-hover-state-layer-opacity);--md-ripple-pressed-color: var(--_selected-pressed-state-layer-color);--md-ripple-pressed-opacity: var(--_selected-pressed-state-layer-opacity)}.selected:not(:disabled,[aria-disabled=true]){color:var(--_selected-icon-color)}.selected:not(:disabled,[aria-disabled=true]):hover{color:var(--_selected-hover-icon-color)}.selected:not(:disabled,[aria-disabled=true]):focus{color:var(--_selected-focus-icon-color)}.selected:not(:disabled,[aria-disabled=true]):active{color:var(--_selected-pressed-icon-color)}
|
|
57
|
-
`;class ke extends xe{}ke.styles=[_e,we],customElements.define("ew-icon-button",ke);const Se=g`:host{--_active-indicator-color: var(--md-filled-text-field-active-indicator-color, var(--md-sys-color-on-surface-variant, #49454f));--_active-indicator-height: var(--md-filled-text-field-active-indicator-height, 1px);--_caret-color: var(--md-filled-text-field-caret-color, var(--md-sys-color-primary, #6750a4));--_container-color: var(--md-filled-text-field-container-color, var(--md-sys-color-surface-container-highest, #e6e0e9));--_disabled-active-indicator-color: var(--md-filled-text-field-disabled-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-active-indicator-height: var(--md-filled-text-field-disabled-active-indicator-height, 1px);--_disabled-active-indicator-opacity: var(--md-filled-text-field-disabled-active-indicator-opacity, 0.38);--_disabled-container-color: var(--md-filled-text-field-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-container-opacity: var(--md-filled-text-field-disabled-container-opacity, 0.04);--_disabled-input-text-color: var(--md-filled-text-field-disabled-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-input-text-opacity: var(--md-filled-text-field-disabled-input-text-opacity, 0.38);--_disabled-label-text-color: var(--md-filled-text-field-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-opacity: var(--md-filled-text-field-disabled-label-text-opacity, 0.38);--_disabled-leading-icon-color: var(--md-filled-text-field-disabled-leading-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-leading-icon-opacity: var(--md-filled-text-field-disabled-leading-icon-opacity, 0.38);--_disabled-supporting-text-color: var(--md-filled-text-field-disabled-supporting-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-supporting-text-opacity: var(--md-filled-text-field-disabled-supporting-text-opacity, 0.38);--_disabled-trailing-icon-color: var(--md-filled-text-field-disabled-trailing-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-trailing-icon-opacity: var(--md-filled-text-field-disabled-trailing-icon-opacity, 0.38);--_error-active-indicator-color: var(--md-filled-text-field-error-active-indicator-color, var(--md-sys-color-error, #b3261e));--_error-focus-active-indicator-color: var(--md-filled-text-field-error-focus-active-indicator-color, var(--md-sys-color-error, #b3261e));--_error-focus-caret-color: var(--md-filled-text-field-error-focus-caret-color, var(--md-sys-color-error, #b3261e));--_error-focus-input-text-color: var(--md-filled-text-field-error-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_error-focus-label-text-color: var(--md-filled-text-field-error-focus-label-text-color, var(--md-sys-color-error, #b3261e));--_error-focus-leading-icon-color: var(--md-filled-text-field-error-focus-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-focus-supporting-text-color: var(--md-filled-text-field-error-focus-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-focus-trailing-icon-color: var(--md-filled-text-field-error-focus-trailing-icon-color, var(--md-sys-color-error, #b3261e));--_error-hover-active-indicator-color: var(--md-filled-text-field-error-hover-active-indicator-color, var(--md-sys-color-on-error-container, #410e0b));--_error-hover-input-text-color: var(--md-filled-text-field-error-hover-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_error-hover-label-text-color: var(--md-filled-text-field-error-hover-label-text-color, var(--md-sys-color-on-error-container, #410e0b));--_error-hover-leading-icon-color: var(--md-filled-text-field-error-hover-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-hover-state-layer-color: var(--md-filled-text-field-error-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_error-hover-state-layer-opacity: var(--md-filled-text-field-error-hover-state-layer-opacity, 0.08);--_error-hover-supporting-text-color: var(--md-filled-text-field-error-hover-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-hover-trailing-icon-color: var(--md-filled-text-field-error-hover-trailing-icon-color, var(--md-sys-color-on-error-container, #410e0b));--_error-input-text-color: var(--md-filled-text-field-error-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_error-label-text-color: var(--md-filled-text-field-error-label-text-color, var(--md-sys-color-error, #b3261e));--_error-leading-icon-color: var(--md-filled-text-field-error-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-supporting-text-color: var(--md-filled-text-field-error-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-trailing-icon-color: var(--md-filled-text-field-error-trailing-icon-color, var(--md-sys-color-error, #b3261e));--_focus-active-indicator-color: var(--md-filled-text-field-focus-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_focus-active-indicator-height: var(--md-filled-text-field-focus-active-indicator-height, 3px);--_focus-input-text-color: var(--md-filled-text-field-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_focus-label-text-color: var(--md-filled-text-field-focus-label-text-color, var(--md-sys-color-primary, #6750a4));--_focus-leading-icon-color: var(--md-filled-text-field-focus-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-supporting-text-color: var(--md-filled-text-field-focus-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-trailing-icon-color: var(--md-filled-text-field-focus-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-active-indicator-color: var(--md-filled-text-field-hover-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-active-indicator-height: var(--md-filled-text-field-hover-active-indicator-height, 1px);--_hover-input-text-color: var(--md-filled-text-field-hover-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-label-text-color: var(--md-filled-text-field-hover-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-leading-icon-color: var(--md-filled-text-field-hover-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-state-layer-color: var(--md-filled-text-field-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity: var(--md-filled-text-field-hover-state-layer-opacity, 0.08);--_hover-supporting-text-color: var(--md-filled-text-field-hover-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-trailing-icon-color: var(--md-filled-text-field-hover-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-color: var(--md-filled-text-field-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_input-text-font: var(--md-filled-text-field-input-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_input-text-line-height: var(--md-filled-text-field-input-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_input-text-placeholder-color: var(--md-filled-text-field-input-text-placeholder-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-prefix-color: var(--md-filled-text-field-input-text-prefix-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-size: var(--md-filled-text-field-input-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_input-text-suffix-color: var(--md-filled-text-field-input-text-suffix-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-weight: var(--md-filled-text-field-input-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_label-text-color: var(--md-filled-text-field-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_label-text-font: var(--md-filled-text-field-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_label-text-line-height: var(--md-filled-text-field-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_label-text-populated-line-height: var(--md-filled-text-field-label-text-populated-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_label-text-populated-size: var(--md-filled-text-field-label-text-populated-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_label-text-size: var(--md-filled-text-field-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_label-text-weight: var(--md-filled-text-field-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_leading-icon-color: var(--md-filled-text-field-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_leading-icon-size: var(--md-filled-text-field-leading-icon-size, 24px);--_supporting-text-color: var(--md-filled-text-field-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_supporting-text-font: var(--md-filled-text-field-supporting-text-font, var(--md-sys-typescale-body-small-font, var(--md-ref-typeface-plain, Roboto)));--_supporting-text-line-height: var(--md-filled-text-field-supporting-text-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_supporting-text-size: var(--md-filled-text-field-supporting-text-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_supporting-text-weight: var(--md-filled-text-field-supporting-text-weight, var(--md-sys-typescale-body-small-weight, var(--md-ref-typeface-weight-regular, 400)));--_trailing-icon-color: var(--md-filled-text-field-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_trailing-icon-size: var(--md-filled-text-field-trailing-icon-size, 24px);--_container-shape-start-start: var(--md-filled-text-field-container-shape-start-start, var(--md-filled-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-start-end: var(--md-filled-text-field-container-shape-start-end, var(--md-filled-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-end-end: var(--md-filled-text-field-container-shape-end-end, var(--md-filled-text-field-container-shape, var(--md-sys-shape-corner-none, 0px)));--_container-shape-end-start: var(--md-filled-text-field-container-shape-end-start, var(--md-filled-text-field-container-shape, var(--md-sys-shape-corner-none, 0px)));--_icon-input-space: var(--md-filled-text-field-icon-input-space, 16px);--_leading-space: var(--md-filled-text-field-leading-space, 16px);--_trailing-space: var(--md-filled-text-field-trailing-space, 16px);--_top-space: var(--md-filled-text-field-top-space, 16px);--_bottom-space: var(--md-filled-text-field-bottom-space, 16px);--_input-text-prefix-trailing-space: var(--md-filled-text-field-input-text-prefix-trailing-space, 2px);--_input-text-suffix-leading-space: var(--md-filled-text-field-input-text-suffix-leading-space, 2px);--_with-label-top-space: var(--md-filled-text-field-with-label-top-space, 8px);--_with-label-bottom-space: var(--md-filled-text-field-with-label-bottom-space, 8px);--_focus-caret-color: var(--md-filled-text-field-focus-caret-color, var(--md-sys-color-primary, #6750a4));--_with-leading-icon-leading-space: var(--md-filled-text-field-with-leading-icon-leading-space, 12px);--_with-trailing-icon-trailing-space: var(--md-filled-text-field-with-trailing-icon-trailing-space, 12px);--md-filled-field-active-indicator-color: var(--_active-indicator-color);--md-filled-field-active-indicator-height: var(--_active-indicator-height);--md-filled-field-bottom-space: var(--_bottom-space);--md-filled-field-container-color: var(--_container-color);--md-filled-field-container-shape-end-end: var(--_container-shape-end-end);--md-filled-field-container-shape-end-start: var(--_container-shape-end-start);--md-filled-field-container-shape-start-end: var(--_container-shape-start-end);--md-filled-field-container-shape-start-start: var(--_container-shape-start-start);--md-filled-field-content-color: var(--_input-text-color);--md-filled-field-content-font: var(--_input-text-font);--md-filled-field-content-line-height: var(--_input-text-line-height);--md-filled-field-content-size: var(--_input-text-size);--md-filled-field-content-space: var(--_icon-input-space);--md-filled-field-content-weight: var(--_input-text-weight);--md-filled-field-disabled-active-indicator-color: var(--_disabled-active-indicator-color);--md-filled-field-disabled-active-indicator-height: var(--_disabled-active-indicator-height);--md-filled-field-disabled-active-indicator-opacity: var(--_disabled-active-indicator-opacity);--md-filled-field-disabled-container-color: var(--_disabled-container-color);--md-filled-field-disabled-container-opacity: var(--_disabled-container-opacity);--md-filled-field-disabled-content-color: var(--_disabled-input-text-color);--md-filled-field-disabled-content-opacity: var(--_disabled-input-text-opacity);--md-filled-field-disabled-label-text-color: var(--_disabled-label-text-color);--md-filled-field-disabled-label-text-opacity: var(--_disabled-label-text-opacity);--md-filled-field-disabled-leading-content-color: var(--_disabled-leading-icon-color);--md-filled-field-disabled-leading-content-opacity: var(--_disabled-leading-icon-opacity);--md-filled-field-disabled-supporting-text-color: var(--_disabled-supporting-text-color);--md-filled-field-disabled-supporting-text-opacity: var(--_disabled-supporting-text-opacity);--md-filled-field-disabled-trailing-content-color: var(--_disabled-trailing-icon-color);--md-filled-field-disabled-trailing-content-opacity: var(--_disabled-trailing-icon-opacity);--md-filled-field-error-active-indicator-color: var(--_error-active-indicator-color);--md-filled-field-error-content-color: var(--_error-input-text-color);--md-filled-field-error-focus-active-indicator-color: var(--_error-focus-active-indicator-color);--md-filled-field-error-focus-content-color: var(--_error-focus-input-text-color);--md-filled-field-error-focus-label-text-color: var(--_error-focus-label-text-color);--md-filled-field-error-focus-leading-content-color: var(--_error-focus-leading-icon-color);--md-filled-field-error-focus-supporting-text-color: var(--_error-focus-supporting-text-color);--md-filled-field-error-focus-trailing-content-color: var(--_error-focus-trailing-icon-color);--md-filled-field-error-hover-active-indicator-color: var(--_error-hover-active-indicator-color);--md-filled-field-error-hover-content-color: var(--_error-hover-input-text-color);--md-filled-field-error-hover-label-text-color: var(--_error-hover-label-text-color);--md-filled-field-error-hover-leading-content-color: var(--_error-hover-leading-icon-color);--md-filled-field-error-hover-state-layer-color: var(--_error-hover-state-layer-color);--md-filled-field-error-hover-state-layer-opacity: var(--_error-hover-state-layer-opacity);--md-filled-field-error-hover-supporting-text-color: var(--_error-hover-supporting-text-color);--md-filled-field-error-hover-trailing-content-color: var(--_error-hover-trailing-icon-color);--md-filled-field-error-label-text-color: var(--_error-label-text-color);--md-filled-field-error-leading-content-color: var(--_error-leading-icon-color);--md-filled-field-error-supporting-text-color: var(--_error-supporting-text-color);--md-filled-field-error-trailing-content-color: var(--_error-trailing-icon-color);--md-filled-field-focus-active-indicator-color: var(--_focus-active-indicator-color);--md-filled-field-focus-active-indicator-height: var(--_focus-active-indicator-height);--md-filled-field-focus-content-color: var(--_focus-input-text-color);--md-filled-field-focus-label-text-color: var(--_focus-label-text-color);--md-filled-field-focus-leading-content-color: var(--_focus-leading-icon-color);--md-filled-field-focus-supporting-text-color: var(--_focus-supporting-text-color);--md-filled-field-focus-trailing-content-color: var(--_focus-trailing-icon-color);--md-filled-field-hover-active-indicator-color: var(--_hover-active-indicator-color);--md-filled-field-hover-active-indicator-height: var(--_hover-active-indicator-height);--md-filled-field-hover-content-color: var(--_hover-input-text-color);--md-filled-field-hover-label-text-color: var(--_hover-label-text-color);--md-filled-field-hover-leading-content-color: var(--_hover-leading-icon-color);--md-filled-field-hover-state-layer-color: var(--_hover-state-layer-color);--md-filled-field-hover-state-layer-opacity: var(--_hover-state-layer-opacity);--md-filled-field-hover-supporting-text-color: var(--_hover-supporting-text-color);--md-filled-field-hover-trailing-content-color: var(--_hover-trailing-icon-color);--md-filled-field-label-text-color: var(--_label-text-color);--md-filled-field-label-text-font: var(--_label-text-font);--md-filled-field-label-text-line-height: var(--_label-text-line-height);--md-filled-field-label-text-populated-line-height: var(--_label-text-populated-line-height);--md-filled-field-label-text-populated-size: var(--_label-text-populated-size);--md-filled-field-label-text-size: var(--_label-text-size);--md-filled-field-label-text-weight: var(--_label-text-weight);--md-filled-field-leading-content-color: var(--_leading-icon-color);--md-filled-field-leading-space: var(--_leading-space);--md-filled-field-supporting-text-color: var(--_supporting-text-color);--md-filled-field-supporting-text-font: var(--_supporting-text-font);--md-filled-field-supporting-text-line-height: var(--_supporting-text-line-height);--md-filled-field-supporting-text-size: var(--_supporting-text-size);--md-filled-field-supporting-text-weight: var(--_supporting-text-weight);--md-filled-field-top-space: var(--_top-space);--md-filled-field-trailing-content-color: var(--_trailing-icon-color);--md-filled-field-trailing-space: var(--_trailing-space);--md-filled-field-with-label-bottom-space: var(--_with-label-bottom-space);--md-filled-field-with-label-top-space: var(--_with-label-top-space);--md-filled-field-with-leading-content-leading-space: var(--_with-leading-icon-leading-space);--md-filled-field-with-trailing-content-trailing-space: var(--_with-trailing-icon-trailing-space)}
|
|
57
|
+
`;class ke extends _e{}ke.styles=[xe,we],customElements.define("ew-icon-button",ke);const Se=g`:host{--_active-indicator-color: var(--md-filled-text-field-active-indicator-color, var(--md-sys-color-on-surface-variant, #49454f));--_active-indicator-height: var(--md-filled-text-field-active-indicator-height, 1px);--_caret-color: var(--md-filled-text-field-caret-color, var(--md-sys-color-primary, #6750a4));--_container-color: var(--md-filled-text-field-container-color, var(--md-sys-color-surface-container-highest, #e6e0e9));--_disabled-active-indicator-color: var(--md-filled-text-field-disabled-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-active-indicator-height: var(--md-filled-text-field-disabled-active-indicator-height, 1px);--_disabled-active-indicator-opacity: var(--md-filled-text-field-disabled-active-indicator-opacity, 0.38);--_disabled-container-color: var(--md-filled-text-field-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-container-opacity: var(--md-filled-text-field-disabled-container-opacity, 0.04);--_disabled-input-text-color: var(--md-filled-text-field-disabled-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-input-text-opacity: var(--md-filled-text-field-disabled-input-text-opacity, 0.38);--_disabled-label-text-color: var(--md-filled-text-field-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-opacity: var(--md-filled-text-field-disabled-label-text-opacity, 0.38);--_disabled-leading-icon-color: var(--md-filled-text-field-disabled-leading-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-leading-icon-opacity: var(--md-filled-text-field-disabled-leading-icon-opacity, 0.38);--_disabled-supporting-text-color: var(--md-filled-text-field-disabled-supporting-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-supporting-text-opacity: var(--md-filled-text-field-disabled-supporting-text-opacity, 0.38);--_disabled-trailing-icon-color: var(--md-filled-text-field-disabled-trailing-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-trailing-icon-opacity: var(--md-filled-text-field-disabled-trailing-icon-opacity, 0.38);--_error-active-indicator-color: var(--md-filled-text-field-error-active-indicator-color, var(--md-sys-color-error, #b3261e));--_error-focus-active-indicator-color: var(--md-filled-text-field-error-focus-active-indicator-color, var(--md-sys-color-error, #b3261e));--_error-focus-caret-color: var(--md-filled-text-field-error-focus-caret-color, var(--md-sys-color-error, #b3261e));--_error-focus-input-text-color: var(--md-filled-text-field-error-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_error-focus-label-text-color: var(--md-filled-text-field-error-focus-label-text-color, var(--md-sys-color-error, #b3261e));--_error-focus-leading-icon-color: var(--md-filled-text-field-error-focus-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-focus-supporting-text-color: var(--md-filled-text-field-error-focus-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-focus-trailing-icon-color: var(--md-filled-text-field-error-focus-trailing-icon-color, var(--md-sys-color-error, #b3261e));--_error-hover-active-indicator-color: var(--md-filled-text-field-error-hover-active-indicator-color, var(--md-sys-color-on-error-container, #410e0b));--_error-hover-input-text-color: var(--md-filled-text-field-error-hover-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_error-hover-label-text-color: var(--md-filled-text-field-error-hover-label-text-color, var(--md-sys-color-on-error-container, #410e0b));--_error-hover-leading-icon-color: var(--md-filled-text-field-error-hover-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-hover-state-layer-color: var(--md-filled-text-field-error-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_error-hover-state-layer-opacity: var(--md-filled-text-field-error-hover-state-layer-opacity, 0.08);--_error-hover-supporting-text-color: var(--md-filled-text-field-error-hover-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-hover-trailing-icon-color: var(--md-filled-text-field-error-hover-trailing-icon-color, var(--md-sys-color-on-error-container, #410e0b));--_error-input-text-color: var(--md-filled-text-field-error-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_error-label-text-color: var(--md-filled-text-field-error-label-text-color, var(--md-sys-color-error, #b3261e));--_error-leading-icon-color: var(--md-filled-text-field-error-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-supporting-text-color: var(--md-filled-text-field-error-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-trailing-icon-color: var(--md-filled-text-field-error-trailing-icon-color, var(--md-sys-color-error, #b3261e));--_focus-active-indicator-color: var(--md-filled-text-field-focus-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_focus-active-indicator-height: var(--md-filled-text-field-focus-active-indicator-height, 3px);--_focus-input-text-color: var(--md-filled-text-field-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_focus-label-text-color: var(--md-filled-text-field-focus-label-text-color, var(--md-sys-color-primary, #6750a4));--_focus-leading-icon-color: var(--md-filled-text-field-focus-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-supporting-text-color: var(--md-filled-text-field-focus-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-trailing-icon-color: var(--md-filled-text-field-focus-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-active-indicator-color: var(--md-filled-text-field-hover-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-active-indicator-height: var(--md-filled-text-field-hover-active-indicator-height, 1px);--_hover-input-text-color: var(--md-filled-text-field-hover-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-label-text-color: var(--md-filled-text-field-hover-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-leading-icon-color: var(--md-filled-text-field-hover-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-state-layer-color: var(--md-filled-text-field-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity: var(--md-filled-text-field-hover-state-layer-opacity, 0.08);--_hover-supporting-text-color: var(--md-filled-text-field-hover-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-trailing-icon-color: var(--md-filled-text-field-hover-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-color: var(--md-filled-text-field-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_input-text-font: var(--md-filled-text-field-input-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_input-text-line-height: var(--md-filled-text-field-input-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_input-text-placeholder-color: var(--md-filled-text-field-input-text-placeholder-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-prefix-color: var(--md-filled-text-field-input-text-prefix-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-size: var(--md-filled-text-field-input-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_input-text-suffix-color: var(--md-filled-text-field-input-text-suffix-color, var(--md-sys-color-on-surface-variant, #49454f));--_input-text-weight: var(--md-filled-text-field-input-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_label-text-color: var(--md-filled-text-field-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_label-text-font: var(--md-filled-text-field-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_label-text-line-height: var(--md-filled-text-field-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_label-text-populated-line-height: var(--md-filled-text-field-label-text-populated-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_label-text-populated-size: var(--md-filled-text-field-label-text-populated-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_label-text-size: var(--md-filled-text-field-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_label-text-weight: var(--md-filled-text-field-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_leading-icon-color: var(--md-filled-text-field-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_leading-icon-size: var(--md-filled-text-field-leading-icon-size, 24px);--_supporting-text-color: var(--md-filled-text-field-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_supporting-text-font: var(--md-filled-text-field-supporting-text-font, var(--md-sys-typescale-body-small-font, var(--md-ref-typeface-plain, Roboto)));--_supporting-text-line-height: var(--md-filled-text-field-supporting-text-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_supporting-text-size: var(--md-filled-text-field-supporting-text-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_supporting-text-weight: var(--md-filled-text-field-supporting-text-weight, var(--md-sys-typescale-body-small-weight, var(--md-ref-typeface-weight-regular, 400)));--_trailing-icon-color: var(--md-filled-text-field-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_trailing-icon-size: var(--md-filled-text-field-trailing-icon-size, 24px);--_container-shape-start-start: var(--md-filled-text-field-container-shape-start-start, var(--md-filled-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-start-end: var(--md-filled-text-field-container-shape-start-end, var(--md-filled-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-end-end: var(--md-filled-text-field-container-shape-end-end, var(--md-filled-text-field-container-shape, var(--md-sys-shape-corner-none, 0px)));--_container-shape-end-start: var(--md-filled-text-field-container-shape-end-start, var(--md-filled-text-field-container-shape, var(--md-sys-shape-corner-none, 0px)));--_icon-input-space: var(--md-filled-text-field-icon-input-space, 16px);--_leading-space: var(--md-filled-text-field-leading-space, 16px);--_trailing-space: var(--md-filled-text-field-trailing-space, 16px);--_top-space: var(--md-filled-text-field-top-space, 16px);--_bottom-space: var(--md-filled-text-field-bottom-space, 16px);--_input-text-prefix-trailing-space: var(--md-filled-text-field-input-text-prefix-trailing-space, 2px);--_input-text-suffix-leading-space: var(--md-filled-text-field-input-text-suffix-leading-space, 2px);--_with-label-top-space: var(--md-filled-text-field-with-label-top-space, 8px);--_with-label-bottom-space: var(--md-filled-text-field-with-label-bottom-space, 8px);--_focus-caret-color: var(--md-filled-text-field-focus-caret-color, var(--md-sys-color-primary, #6750a4));--_with-leading-icon-leading-space: var(--md-filled-text-field-with-leading-icon-leading-space, 12px);--_with-trailing-icon-trailing-space: var(--md-filled-text-field-with-trailing-icon-trailing-space, 12px);--md-filled-field-active-indicator-color: var(--_active-indicator-color);--md-filled-field-active-indicator-height: var(--_active-indicator-height);--md-filled-field-bottom-space: var(--_bottom-space);--md-filled-field-container-color: var(--_container-color);--md-filled-field-container-shape-end-end: var(--_container-shape-end-end);--md-filled-field-container-shape-end-start: var(--_container-shape-end-start);--md-filled-field-container-shape-start-end: var(--_container-shape-start-end);--md-filled-field-container-shape-start-start: var(--_container-shape-start-start);--md-filled-field-content-color: var(--_input-text-color);--md-filled-field-content-font: var(--_input-text-font);--md-filled-field-content-line-height: var(--_input-text-line-height);--md-filled-field-content-size: var(--_input-text-size);--md-filled-field-content-space: var(--_icon-input-space);--md-filled-field-content-weight: var(--_input-text-weight);--md-filled-field-disabled-active-indicator-color: var(--_disabled-active-indicator-color);--md-filled-field-disabled-active-indicator-height: var(--_disabled-active-indicator-height);--md-filled-field-disabled-active-indicator-opacity: var(--_disabled-active-indicator-opacity);--md-filled-field-disabled-container-color: var(--_disabled-container-color);--md-filled-field-disabled-container-opacity: var(--_disabled-container-opacity);--md-filled-field-disabled-content-color: var(--_disabled-input-text-color);--md-filled-field-disabled-content-opacity: var(--_disabled-input-text-opacity);--md-filled-field-disabled-label-text-color: var(--_disabled-label-text-color);--md-filled-field-disabled-label-text-opacity: var(--_disabled-label-text-opacity);--md-filled-field-disabled-leading-content-color: var(--_disabled-leading-icon-color);--md-filled-field-disabled-leading-content-opacity: var(--_disabled-leading-icon-opacity);--md-filled-field-disabled-supporting-text-color: var(--_disabled-supporting-text-color);--md-filled-field-disabled-supporting-text-opacity: var(--_disabled-supporting-text-opacity);--md-filled-field-disabled-trailing-content-color: var(--_disabled-trailing-icon-color);--md-filled-field-disabled-trailing-content-opacity: var(--_disabled-trailing-icon-opacity);--md-filled-field-error-active-indicator-color: var(--_error-active-indicator-color);--md-filled-field-error-content-color: var(--_error-input-text-color);--md-filled-field-error-focus-active-indicator-color: var(--_error-focus-active-indicator-color);--md-filled-field-error-focus-content-color: var(--_error-focus-input-text-color);--md-filled-field-error-focus-label-text-color: var(--_error-focus-label-text-color);--md-filled-field-error-focus-leading-content-color: var(--_error-focus-leading-icon-color);--md-filled-field-error-focus-supporting-text-color: var(--_error-focus-supporting-text-color);--md-filled-field-error-focus-trailing-content-color: var(--_error-focus-trailing-icon-color);--md-filled-field-error-hover-active-indicator-color: var(--_error-hover-active-indicator-color);--md-filled-field-error-hover-content-color: var(--_error-hover-input-text-color);--md-filled-field-error-hover-label-text-color: var(--_error-hover-label-text-color);--md-filled-field-error-hover-leading-content-color: var(--_error-hover-leading-icon-color);--md-filled-field-error-hover-state-layer-color: var(--_error-hover-state-layer-color);--md-filled-field-error-hover-state-layer-opacity: var(--_error-hover-state-layer-opacity);--md-filled-field-error-hover-supporting-text-color: var(--_error-hover-supporting-text-color);--md-filled-field-error-hover-trailing-content-color: var(--_error-hover-trailing-icon-color);--md-filled-field-error-label-text-color: var(--_error-label-text-color);--md-filled-field-error-leading-content-color: var(--_error-leading-icon-color);--md-filled-field-error-supporting-text-color: var(--_error-supporting-text-color);--md-filled-field-error-trailing-content-color: var(--_error-trailing-icon-color);--md-filled-field-focus-active-indicator-color: var(--_focus-active-indicator-color);--md-filled-field-focus-active-indicator-height: var(--_focus-active-indicator-height);--md-filled-field-focus-content-color: var(--_focus-input-text-color);--md-filled-field-focus-label-text-color: var(--_focus-label-text-color);--md-filled-field-focus-leading-content-color: var(--_focus-leading-icon-color);--md-filled-field-focus-supporting-text-color: var(--_focus-supporting-text-color);--md-filled-field-focus-trailing-content-color: var(--_focus-trailing-icon-color);--md-filled-field-hover-active-indicator-color: var(--_hover-active-indicator-color);--md-filled-field-hover-active-indicator-height: var(--_hover-active-indicator-height);--md-filled-field-hover-content-color: var(--_hover-input-text-color);--md-filled-field-hover-label-text-color: var(--_hover-label-text-color);--md-filled-field-hover-leading-content-color: var(--_hover-leading-icon-color);--md-filled-field-hover-state-layer-color: var(--_hover-state-layer-color);--md-filled-field-hover-state-layer-opacity: var(--_hover-state-layer-opacity);--md-filled-field-hover-supporting-text-color: var(--_hover-supporting-text-color);--md-filled-field-hover-trailing-content-color: var(--_hover-trailing-icon-color);--md-filled-field-label-text-color: var(--_label-text-color);--md-filled-field-label-text-font: var(--_label-text-font);--md-filled-field-label-text-line-height: var(--_label-text-line-height);--md-filled-field-label-text-populated-line-height: var(--_label-text-populated-line-height);--md-filled-field-label-text-populated-size: var(--_label-text-populated-size);--md-filled-field-label-text-size: var(--_label-text-size);--md-filled-field-label-text-weight: var(--_label-text-weight);--md-filled-field-leading-content-color: var(--_leading-icon-color);--md-filled-field-leading-space: var(--_leading-space);--md-filled-field-supporting-text-color: var(--_supporting-text-color);--md-filled-field-supporting-text-font: var(--_supporting-text-font);--md-filled-field-supporting-text-line-height: var(--_supporting-text-line-height);--md-filled-field-supporting-text-size: var(--_supporting-text-size);--md-filled-field-supporting-text-weight: var(--_supporting-text-weight);--md-filled-field-top-space: var(--_top-space);--md-filled-field-trailing-content-color: var(--_trailing-icon-color);--md-filled-field-trailing-space: var(--_trailing-space);--md-filled-field-with-label-bottom-space: var(--_with-label-bottom-space);--md-filled-field-with-label-top-space: var(--_with-label-top-space);--md-filled-field-with-leading-content-leading-space: var(--_with-leading-icon-leading-space);--md-filled-field-with-trailing-content-trailing-space: var(--_with-trailing-icon-trailing-space)}
|
|
58
58
|
`;class $e extends a{constructor(){super(...arguments),this.disabled=!1,this.error=!1,this.focused=!1,this.label="",this.noAsterisk=!1,this.populated=!1,this.required=!1,this.resizable=!1,this.supportingText="",this.errorText="",this.count=-1,this.max=-1,this.hasStart=!1,this.hasEnd=!1,this.isAnimating=!1,this.refreshErrorAlert=!1,this.disableTransitions=!1}get counterText(){const e=this.count??-1,t=this.max??-1;return e<0||t<=0?"":`${e} / ${t}`}get supportingOrErrorText(){return this.error&&this.errorText?this.errorText:this.supportingText}reannounceError(){this.refreshErrorAlert=!0}update(e){e.has("disabled")&&void 0!==e.get("disabled")&&(this.disableTransitions=!0),this.disabled&&this.focused&&(e.set("focused",!0),this.focused=!1),this.animateLabelIfNeeded({wasFocused:e.get("focused"),wasPopulated:e.get("populated")}),super.update(e)}render(){const e=this.renderLabel(!0),t=this.renderLabel(!1),i=this.renderOutline?.(e),r={disabled:this.disabled,"disable-transitions":this.disableTransitions,error:this.error&&!this.disabled,focused:this.focused,"with-start":this.hasStart,"with-end":this.hasEnd,populated:this.populated,resizable:this.resizable,required:this.required,"no-label":!this.label};return u`
|
|
59
59
|
<div class="field ${h(r)}">
|
|
60
60
|
<div class="container-overflow">
|
|
@@ -89,9 +89,9 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
89
89
|
<span class="label ${h(i)}" aria-hidden=${!t}
|
|
90
90
|
>${r}</span
|
|
91
91
|
>
|
|
92
|
-
`}animateLabelIfNeeded({wasFocused:e,wasPopulated:t}){if(!this.label)return;e??=this.focused,t??=this.populated;(e||t)!==(this.focused||this.populated)&&(this.isAnimating=!0,this.labelAnimation?.cancel(),this.labelAnimation=this.floatingLabelEl?.animate(this.getLabelKeyframes(),{duration:150,easing:y.STANDARD}),this.labelAnimation?.addEventListener("finish",()=>{this.isAnimating=!1}))}getLabelKeyframes(){const{floatingLabelEl:e,restingLabelEl:t}=this;if(!e||!t)return[];const{x:i,y:r,height:o}=e.getBoundingClientRect(),{x:s,y:a,height:l}=t.getBoundingClientRect(),n=e.scrollWidth,d=t.scrollWidth,c=d/n,h=`translateX(${s-i}px) translateY(${a-r+Math.round((l-o*c)/2)}px) scale(${c})`,p="translateX(0) translateY(0) scale(1)",u=t.clientWidth,f=d>u?u/c+"px":"";return this.focused||this.populated?[{transform:h,width:f},{transform:p,width:f}]:[{transform:p,width:f},{transform:h,width:f}]}getSurfacePositionClientRect(){return this.containerEl.getBoundingClientRect()}}i([r({type:Boolean})],$e.prototype,"disabled",void 0),i([r({type:Boolean})],$e.prototype,"error",void 0),i([r({type:Boolean})],$e.prototype,"focused",void 0),i([r()],$e.prototype,"label",void 0),i([r({type:Boolean,attribute:"no-asterisk"})],$e.prototype,"noAsterisk",void 0),i([r({type:Boolean})],$e.prototype,"populated",void 0),i([r({type:Boolean})],$e.prototype,"required",void 0),i([r({type:Boolean})],$e.prototype,"resizable",void 0),i([r({attribute:"supporting-text"})],$e.prototype,"supportingText",void 0),i([r({attribute:"error-text"})],$e.prototype,"errorText",void 0),i([r({type:Number})],$e.prototype,"count",void 0),i([r({type:Number})],$e.prototype,"max",void 0),i([r({type:Boolean,attribute:"has-start"})],$e.prototype,"hasStart",void 0),i([r({type:Boolean,attribute:"has-end"})],$e.prototype,"hasEnd",void 0),i([v({slot:"aria-describedby"})],$e.prototype,"slottedAriaDescribedBy",void 0),i([l()],$e.prototype,"isAnimating",void 0),i([l()],$e.prototype,"refreshErrorAlert",void 0),i([l()],$e.prototype,"disableTransitions",void 0),i([n(".label.floating")],$e.prototype,"floatingLabelEl",void 0),i([n(".label.resting")],$e.prototype,"restingLabelEl",void 0),i([n(".container")],$e.prototype,"containerEl",void 0);class Re extends $e{renderBackground(){return u` <div class="background"></div> `}renderStateLayer(){return u` <div class="state-layer"></div> `}renderIndicator(){return u`<div class="active-indicator"></div>`}}const Ce=g`@layer styles{:host{--_active-indicator-color: var(--md-filled-field-active-indicator-color, var(--md-sys-color-on-surface-variant, #49454f));--_active-indicator-height: var(--md-filled-field-active-indicator-height, 1px);--_bottom-space: var(--md-filled-field-bottom-space, 16px);--_container-color: var(--md-filled-field-container-color, var(--md-sys-color-surface-container-highest, #e6e0e9));--_content-color: var(--md-filled-field-content-color, var(--md-sys-color-on-surface, #1d1b20));--_content-font: var(--md-filled-field-content-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_content-line-height: var(--md-filled-field-content-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_content-size: var(--md-filled-field-content-size, var(--md-sys-typescale-body-large-size, 1rem));--_content-space: var(--md-filled-field-content-space, 16px);--_content-weight: var(--md-filled-field-content-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_disabled-active-indicator-color: var(--md-filled-field-disabled-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-active-indicator-height: var(--md-filled-field-disabled-active-indicator-height, 1px);--_disabled-active-indicator-opacity: var(--md-filled-field-disabled-active-indicator-opacity, 0.38);--_disabled-container-color: var(--md-filled-field-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-container-opacity: var(--md-filled-field-disabled-container-opacity, 0.04);--_disabled-content-color: var(--md-filled-field-disabled-content-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-content-opacity: var(--md-filled-field-disabled-content-opacity, 0.38);--_disabled-label-text-color: var(--md-filled-field-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-opacity: var(--md-filled-field-disabled-label-text-opacity, 0.38);--_disabled-leading-content-color: var(--md-filled-field-disabled-leading-content-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-leading-content-opacity: var(--md-filled-field-disabled-leading-content-opacity, 0.38);--_disabled-supporting-text-color: var(--md-filled-field-disabled-supporting-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-supporting-text-opacity: var(--md-filled-field-disabled-supporting-text-opacity, 0.38);--_disabled-trailing-content-color: var(--md-filled-field-disabled-trailing-content-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-trailing-content-opacity: var(--md-filled-field-disabled-trailing-content-opacity, 0.38);--_error-active-indicator-color: var(--md-filled-field-error-active-indicator-color, var(--md-sys-color-error, #b3261e));--_error-content-color: var(--md-filled-field-error-content-color, var(--md-sys-color-on-surface, #1d1b20));--_error-focus-active-indicator-color: var(--md-filled-field-error-focus-active-indicator-color, var(--md-sys-color-error, #b3261e));--_error-focus-content-color: var(--md-filled-field-error-focus-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-focus-label-text-color: var(--md-filled-field-error-focus-label-text-color, var(--md-sys-color-error, #b3261e));--_error-focus-leading-content-color: var(--md-filled-field-error-focus-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-focus-supporting-text-color: var(--md-filled-field-error-focus-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-focus-trailing-content-color: var(--md-filled-field-error-focus-trailing-content-color, var(--md-sys-color-error, #b3261e));--_error-hover-active-indicator-color: var(--md-filled-field-error-hover-active-indicator-color, var(--md-sys-color-on-error-container, #410e0b));--_error-hover-content-color: var(--md-filled-field-error-hover-content-color, var(--md-sys-color-on-surface, #1d1b20));--_error-hover-label-text-color: var(--md-filled-field-error-hover-label-text-color, var(--md-sys-color-on-error-container, #410e0b));--_error-hover-leading-content-color: var(--md-filled-field-error-hover-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-hover-state-layer-color: var(--md-filled-field-error-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_error-hover-state-layer-opacity: var(--md-filled-field-error-hover-state-layer-opacity, 0.08);--_error-hover-supporting-text-color: var(--md-filled-field-error-hover-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-hover-trailing-content-color: var(--md-filled-field-error-hover-trailing-content-color, var(--md-sys-color-on-error-container, #410e0b));--_error-label-text-color: var(--md-filled-field-error-label-text-color, var(--md-sys-color-error, #b3261e));--_error-leading-content-color: var(--md-filled-field-error-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-supporting-text-color: var(--md-filled-field-error-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-trailing-content-color: var(--md-filled-field-error-trailing-content-color, var(--md-sys-color-error, #b3261e));--_focus-active-indicator-color: var(--md-filled-field-focus-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_focus-active-indicator-height: var(--md-filled-field-focus-active-indicator-height, 3px);--_focus-content-color: var(--md-filled-field-focus-content-color, var(--md-sys-color-on-surface, #1d1b20));--_focus-label-text-color: var(--md-filled-field-focus-label-text-color, var(--md-sys-color-primary, #6750a4));--_focus-leading-content-color: var(--md-filled-field-focus-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-supporting-text-color: var(--md-filled-field-focus-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-trailing-content-color: var(--md-filled-field-focus-trailing-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-active-indicator-color: var(--md-filled-field-hover-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-active-indicator-height: var(--md-filled-field-hover-active-indicator-height, 1px);--_hover-content-color: var(--md-filled-field-hover-content-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-label-text-color: var(--md-filled-field-hover-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-leading-content-color: var(--md-filled-field-hover-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-state-layer-color: var(--md-filled-field-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity: var(--md-filled-field-hover-state-layer-opacity, 0.08);--_hover-supporting-text-color: var(--md-filled-field-hover-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-trailing-content-color: var(--md-filled-field-hover-trailing-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_label-text-color: var(--md-filled-field-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_label-text-font: var(--md-filled-field-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_label-text-line-height: var(--md-filled-field-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_label-text-populated-line-height: var(--md-filled-field-label-text-populated-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_label-text-populated-size: var(--md-filled-field-label-text-populated-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_label-text-size: var(--md-filled-field-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_label-text-weight: var(--md-filled-field-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_leading-content-color: var(--md-filled-field-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_leading-space: var(--md-filled-field-leading-space, 16px);--_supporting-text-color: var(--md-filled-field-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_supporting-text-font: var(--md-filled-field-supporting-text-font, var(--md-sys-typescale-body-small-font, var(--md-ref-typeface-plain, Roboto)));--_supporting-text-leading-space: var(--md-filled-field-supporting-text-leading-space, 16px);--_supporting-text-line-height: var(--md-filled-field-supporting-text-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_supporting-text-size: var(--md-filled-field-supporting-text-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_supporting-text-top-space: var(--md-filled-field-supporting-text-top-space, 4px);--_supporting-text-trailing-space: var(--md-filled-field-supporting-text-trailing-space, 16px);--_supporting-text-weight: var(--md-filled-field-supporting-text-weight, var(--md-sys-typescale-body-small-weight, var(--md-ref-typeface-weight-regular, 400)));--_top-space: var(--md-filled-field-top-space, 16px);--_trailing-content-color: var(--md-filled-field-trailing-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_trailing-space: var(--md-filled-field-trailing-space, 16px);--_with-label-bottom-space: var(--md-filled-field-with-label-bottom-space, 8px);--_with-label-top-space: var(--md-filled-field-with-label-top-space, 8px);--_with-leading-content-leading-space: var(--md-filled-field-with-leading-content-leading-space, 12px);--_with-trailing-content-trailing-space: var(--md-filled-field-with-trailing-content-trailing-space, 12px);--_container-shape-start-start: var(--md-filled-field-container-shape-start-start, var(--md-filled-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-start-end: var(--md-filled-field-container-shape-start-end, var(--md-filled-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-end-end: var(--md-filled-field-container-shape-end-end, var(--md-filled-field-container-shape, var(--md-sys-shape-corner-none, 0px)));--_container-shape-end-start: var(--md-filled-field-container-shape-end-start, var(--md-filled-field-container-shape, var(--md-sys-shape-corner-none, 0px)))}.background,.state-layer{border-radius:inherit;inset:0;pointer-events:none;position:absolute}.background{background:var(--_container-color)}.state-layer{visibility:hidden}.field:not(.disabled):hover .state-layer{visibility:visible}.label.floating{position:absolute;top:var(--_with-label-top-space)}.field:not(.with-start) .label-wrapper{margin-inline-start:var(--_leading-space)}.field:not(.with-end) .label-wrapper{margin-inline-end:var(--_trailing-space)}.active-indicator{inset:auto 0 0 0;pointer-events:none;position:absolute;width:100%;z-index:1}.active-indicator::before,.active-indicator::after{border-bottom:var(--_active-indicator-height) solid var(--_active-indicator-color);inset:auto 0 0 0;content:"";position:absolute;width:100%}.active-indicator::after{opacity:0;transition:opacity 150ms cubic-bezier(0.2, 0, 0, 1)}.focused .active-indicator::after{opacity:1}.field:not(.with-start) .content ::slotted(*){padding-inline-start:var(--_leading-space)}.field:not(.with-end) .content ::slotted(*){padding-inline-end:var(--_trailing-space)}.field:not(.no-label) .content ::slotted(:not(textarea)){padding-bottom:var(--_with-label-bottom-space);padding-top:calc(var(--_with-label-top-space) + var(--_label-text-populated-line-height))}.field:not(.no-label) .content ::slotted(textarea){margin-bottom:var(--_with-label-bottom-space);margin-top:calc(var(--_with-label-top-space) + var(--_label-text-populated-line-height))}:hover .active-indicator::before{border-bottom-color:var(--_hover-active-indicator-color);border-bottom-width:var(--_hover-active-indicator-height)}.active-indicator::after{border-bottom-color:var(--_focus-active-indicator-color);border-bottom-width:var(--_focus-active-indicator-height)}:hover .state-layer{background:var(--_hover-state-layer-color);opacity:var(--_hover-state-layer-opacity)}.disabled .active-indicator::before{border-bottom-color:var(--_disabled-active-indicator-color);border-bottom-width:var(--_disabled-active-indicator-height);opacity:var(--_disabled-active-indicator-opacity)}.disabled .background{background:var(--_disabled-container-color);opacity:var(--_disabled-container-opacity)}.error .active-indicator::before{border-bottom-color:var(--_error-active-indicator-color)}.error:hover .active-indicator::before{border-bottom-color:var(--_error-hover-active-indicator-color)}.error:hover .state-layer{background:var(--_error-hover-state-layer-color);opacity:var(--_error-hover-state-layer-opacity)}.error .active-indicator::after{border-bottom-color:var(--_error-focus-active-indicator-color)}.resizable .container{bottom:var(--_focus-active-indicator-height);clip-path:inset(var(--_focus-active-indicator-height) 0 0 0)}.resizable .container>*{top:var(--_focus-active-indicator-height)}}@layer hcm{@media(forced-colors: active){.disabled .active-indicator::before{border-color:GrayText;opacity:1}}}
|
|
92
|
+
`}animateLabelIfNeeded({wasFocused:e,wasPopulated:t}){if(!this.label)return;e??=this.focused,t??=this.populated;(e||t)!==(this.focused||this.populated)&&(this.isAnimating=!0,this.labelAnimation?.cancel(),this.labelAnimation=this.floatingLabelEl?.animate(this.getLabelKeyframes(),{duration:150,easing:y.STANDARD}),this.labelAnimation?.addEventListener("finish",()=>{this.isAnimating=!1}))}getLabelKeyframes(){const{floatingLabelEl:e,restingLabelEl:t}=this;if(!e||!t)return[];const{x:i,y:r,height:o}=e.getBoundingClientRect(),{x:s,y:a,height:l}=t.getBoundingClientRect(),n=e.scrollWidth,d=t.scrollWidth,c=d/n,h=`translateX(${s-i}px) translateY(${a-r+Math.round((l-o*c)/2)}px) scale(${c})`,p="translateX(0) translateY(0) scale(1)",u=t.clientWidth,f=d>u?u/c+"px":"";return this.focused||this.populated?[{transform:h,width:f},{transform:p,width:f}]:[{transform:p,width:f},{transform:h,width:f}]}getSurfacePositionClientRect(){return this.containerEl.getBoundingClientRect()}}i([r({type:Boolean})],$e.prototype,"disabled",void 0),i([r({type:Boolean})],$e.prototype,"error",void 0),i([r({type:Boolean})],$e.prototype,"focused",void 0),i([r()],$e.prototype,"label",void 0),i([r({type:Boolean,attribute:"no-asterisk"})],$e.prototype,"noAsterisk",void 0),i([r({type:Boolean})],$e.prototype,"populated",void 0),i([r({type:Boolean})],$e.prototype,"required",void 0),i([r({type:Boolean})],$e.prototype,"resizable",void 0),i([r({attribute:"supporting-text"})],$e.prototype,"supportingText",void 0),i([r({attribute:"error-text"})],$e.prototype,"errorText",void 0),i([r({type:Number})],$e.prototype,"count",void 0),i([r({type:Number})],$e.prototype,"max",void 0),i([r({type:Boolean,attribute:"has-start"})],$e.prototype,"hasStart",void 0),i([r({type:Boolean,attribute:"has-end"})],$e.prototype,"hasEnd",void 0),i([v({slot:"aria-describedby"})],$e.prototype,"slottedAriaDescribedBy",void 0),i([l()],$e.prototype,"isAnimating",void 0),i([l()],$e.prototype,"refreshErrorAlert",void 0),i([l()],$e.prototype,"disableTransitions",void 0),i([n(".label.floating")],$e.prototype,"floatingLabelEl",void 0),i([n(".label.resting")],$e.prototype,"restingLabelEl",void 0),i([n(".container")],$e.prototype,"containerEl",void 0);class Ce extends $e{renderBackground(){return u` <div class="background"></div> `}renderStateLayer(){return u` <div class="state-layer"></div> `}renderIndicator(){return u`<div class="active-indicator"></div>`}}const Re=g`@layer styles{:host{--_active-indicator-color: var(--md-filled-field-active-indicator-color, var(--md-sys-color-on-surface-variant, #49454f));--_active-indicator-height: var(--md-filled-field-active-indicator-height, 1px);--_bottom-space: var(--md-filled-field-bottom-space, 16px);--_container-color: var(--md-filled-field-container-color, var(--md-sys-color-surface-container-highest, #e6e0e9));--_content-color: var(--md-filled-field-content-color, var(--md-sys-color-on-surface, #1d1b20));--_content-font: var(--md-filled-field-content-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_content-line-height: var(--md-filled-field-content-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_content-size: var(--md-filled-field-content-size, var(--md-sys-typescale-body-large-size, 1rem));--_content-space: var(--md-filled-field-content-space, 16px);--_content-weight: var(--md-filled-field-content-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_disabled-active-indicator-color: var(--md-filled-field-disabled-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-active-indicator-height: var(--md-filled-field-disabled-active-indicator-height, 1px);--_disabled-active-indicator-opacity: var(--md-filled-field-disabled-active-indicator-opacity, 0.38);--_disabled-container-color: var(--md-filled-field-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-container-opacity: var(--md-filled-field-disabled-container-opacity, 0.04);--_disabled-content-color: var(--md-filled-field-disabled-content-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-content-opacity: var(--md-filled-field-disabled-content-opacity, 0.38);--_disabled-label-text-color: var(--md-filled-field-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-opacity: var(--md-filled-field-disabled-label-text-opacity, 0.38);--_disabled-leading-content-color: var(--md-filled-field-disabled-leading-content-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-leading-content-opacity: var(--md-filled-field-disabled-leading-content-opacity, 0.38);--_disabled-supporting-text-color: var(--md-filled-field-disabled-supporting-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-supporting-text-opacity: var(--md-filled-field-disabled-supporting-text-opacity, 0.38);--_disabled-trailing-content-color: var(--md-filled-field-disabled-trailing-content-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-trailing-content-opacity: var(--md-filled-field-disabled-trailing-content-opacity, 0.38);--_error-active-indicator-color: var(--md-filled-field-error-active-indicator-color, var(--md-sys-color-error, #b3261e));--_error-content-color: var(--md-filled-field-error-content-color, var(--md-sys-color-on-surface, #1d1b20));--_error-focus-active-indicator-color: var(--md-filled-field-error-focus-active-indicator-color, var(--md-sys-color-error, #b3261e));--_error-focus-content-color: var(--md-filled-field-error-focus-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-focus-label-text-color: var(--md-filled-field-error-focus-label-text-color, var(--md-sys-color-error, #b3261e));--_error-focus-leading-content-color: var(--md-filled-field-error-focus-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-focus-supporting-text-color: var(--md-filled-field-error-focus-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-focus-trailing-content-color: var(--md-filled-field-error-focus-trailing-content-color, var(--md-sys-color-error, #b3261e));--_error-hover-active-indicator-color: var(--md-filled-field-error-hover-active-indicator-color, var(--md-sys-color-on-error-container, #410e0b));--_error-hover-content-color: var(--md-filled-field-error-hover-content-color, var(--md-sys-color-on-surface, #1d1b20));--_error-hover-label-text-color: var(--md-filled-field-error-hover-label-text-color, var(--md-sys-color-on-error-container, #410e0b));--_error-hover-leading-content-color: var(--md-filled-field-error-hover-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-hover-state-layer-color: var(--md-filled-field-error-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_error-hover-state-layer-opacity: var(--md-filled-field-error-hover-state-layer-opacity, 0.08);--_error-hover-supporting-text-color: var(--md-filled-field-error-hover-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-hover-trailing-content-color: var(--md-filled-field-error-hover-trailing-content-color, var(--md-sys-color-on-error-container, #410e0b));--_error-label-text-color: var(--md-filled-field-error-label-text-color, var(--md-sys-color-error, #b3261e));--_error-leading-content-color: var(--md-filled-field-error-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_error-supporting-text-color: var(--md-filled-field-error-supporting-text-color, var(--md-sys-color-error, #b3261e));--_error-trailing-content-color: var(--md-filled-field-error-trailing-content-color, var(--md-sys-color-error, #b3261e));--_focus-active-indicator-color: var(--md-filled-field-focus-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_focus-active-indicator-height: var(--md-filled-field-focus-active-indicator-height, 3px);--_focus-content-color: var(--md-filled-field-focus-content-color, var(--md-sys-color-on-surface, #1d1b20));--_focus-label-text-color: var(--md-filled-field-focus-label-text-color, var(--md-sys-color-primary, #6750a4));--_focus-leading-content-color: var(--md-filled-field-focus-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-supporting-text-color: var(--md-filled-field-focus-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_focus-trailing-content-color: var(--md-filled-field-focus-trailing-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-active-indicator-color: var(--md-filled-field-hover-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-active-indicator-height: var(--md-filled-field-hover-active-indicator-height, 1px);--_hover-content-color: var(--md-filled-field-hover-content-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-label-text-color: var(--md-filled-field-hover-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-leading-content-color: var(--md-filled-field-hover-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-state-layer-color: var(--md-filled-field-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity: var(--md-filled-field-hover-state-layer-opacity, 0.08);--_hover-supporting-text-color: var(--md-filled-field-hover-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_hover-trailing-content-color: var(--md-filled-field-hover-trailing-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_label-text-color: var(--md-filled-field-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_label-text-font: var(--md-filled-field-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_label-text-line-height: var(--md-filled-field-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_label-text-populated-line-height: var(--md-filled-field-label-text-populated-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_label-text-populated-size: var(--md-filled-field-label-text-populated-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_label-text-size: var(--md-filled-field-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_label-text-weight: var(--md-filled-field-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_leading-content-color: var(--md-filled-field-leading-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_leading-space: var(--md-filled-field-leading-space, 16px);--_supporting-text-color: var(--md-filled-field-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_supporting-text-font: var(--md-filled-field-supporting-text-font, var(--md-sys-typescale-body-small-font, var(--md-ref-typeface-plain, Roboto)));--_supporting-text-leading-space: var(--md-filled-field-supporting-text-leading-space, 16px);--_supporting-text-line-height: var(--md-filled-field-supporting-text-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_supporting-text-size: var(--md-filled-field-supporting-text-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_supporting-text-top-space: var(--md-filled-field-supporting-text-top-space, 4px);--_supporting-text-trailing-space: var(--md-filled-field-supporting-text-trailing-space, 16px);--_supporting-text-weight: var(--md-filled-field-supporting-text-weight, var(--md-sys-typescale-body-small-weight, var(--md-ref-typeface-weight-regular, 400)));--_top-space: var(--md-filled-field-top-space, 16px);--_trailing-content-color: var(--md-filled-field-trailing-content-color, var(--md-sys-color-on-surface-variant, #49454f));--_trailing-space: var(--md-filled-field-trailing-space, 16px);--_with-label-bottom-space: var(--md-filled-field-with-label-bottom-space, 8px);--_with-label-top-space: var(--md-filled-field-with-label-top-space, 8px);--_with-leading-content-leading-space: var(--md-filled-field-with-leading-content-leading-space, 12px);--_with-trailing-content-trailing-space: var(--md-filled-field-with-trailing-content-trailing-space, 12px);--_container-shape-start-start: var(--md-filled-field-container-shape-start-start, var(--md-filled-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-start-end: var(--md-filled-field-container-shape-start-end, var(--md-filled-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_container-shape-end-end: var(--md-filled-field-container-shape-end-end, var(--md-filled-field-container-shape, var(--md-sys-shape-corner-none, 0px)));--_container-shape-end-start: var(--md-filled-field-container-shape-end-start, var(--md-filled-field-container-shape, var(--md-sys-shape-corner-none, 0px)))}.background,.state-layer{border-radius:inherit;inset:0;pointer-events:none;position:absolute}.background{background:var(--_container-color)}.state-layer{visibility:hidden}.field:not(.disabled):hover .state-layer{visibility:visible}.label.floating{position:absolute;top:var(--_with-label-top-space)}.field:not(.with-start) .label-wrapper{margin-inline-start:var(--_leading-space)}.field:not(.with-end) .label-wrapper{margin-inline-end:var(--_trailing-space)}.active-indicator{inset:auto 0 0 0;pointer-events:none;position:absolute;width:100%;z-index:1}.active-indicator::before,.active-indicator::after{border-bottom:var(--_active-indicator-height) solid var(--_active-indicator-color);inset:auto 0 0 0;content:"";position:absolute;width:100%}.active-indicator::after{opacity:0;transition:opacity 150ms cubic-bezier(0.2, 0, 0, 1)}.focused .active-indicator::after{opacity:1}.field:not(.with-start) .content ::slotted(*){padding-inline-start:var(--_leading-space)}.field:not(.with-end) .content ::slotted(*){padding-inline-end:var(--_trailing-space)}.field:not(.no-label) .content ::slotted(:not(textarea)){padding-bottom:var(--_with-label-bottom-space);padding-top:calc(var(--_with-label-top-space) + var(--_label-text-populated-line-height))}.field:not(.no-label) .content ::slotted(textarea){margin-bottom:var(--_with-label-bottom-space);margin-top:calc(var(--_with-label-top-space) + var(--_label-text-populated-line-height))}:hover .active-indicator::before{border-bottom-color:var(--_hover-active-indicator-color);border-bottom-width:var(--_hover-active-indicator-height)}.active-indicator::after{border-bottom-color:var(--_focus-active-indicator-color);border-bottom-width:var(--_focus-active-indicator-height)}:hover .state-layer{background:var(--_hover-state-layer-color);opacity:var(--_hover-state-layer-opacity)}.disabled .active-indicator::before{border-bottom-color:var(--_disabled-active-indicator-color);border-bottom-width:var(--_disabled-active-indicator-height);opacity:var(--_disabled-active-indicator-opacity)}.disabled .background{background:var(--_disabled-container-color);opacity:var(--_disabled-container-opacity)}.error .active-indicator::before{border-bottom-color:var(--_error-active-indicator-color)}.error:hover .active-indicator::before{border-bottom-color:var(--_error-hover-active-indicator-color)}.error:hover .state-layer{background:var(--_error-hover-state-layer-color);opacity:var(--_error-hover-state-layer-opacity)}.error .active-indicator::after{border-bottom-color:var(--_error-focus-active-indicator-color)}.resizable .container{bottom:var(--_focus-active-indicator-height);clip-path:inset(var(--_focus-active-indicator-height) 0 0 0)}.resizable .container>*{top:var(--_focus-active-indicator-height)}}@layer hcm{@media(forced-colors: active){.disabled .active-indicator::before{border-color:GrayText;opacity:1}}}
|
|
93
93
|
`,Ee=g`:host{display:inline-flex;resize:both}.field{display:flex;flex:1;flex-direction:column;writing-mode:horizontal-tb;max-width:100%}.container-overflow{border-start-start-radius:var(--_container-shape-start-start);border-start-end-radius:var(--_container-shape-start-end);border-end-end-radius:var(--_container-shape-end-end);border-end-start-radius:var(--_container-shape-end-start);display:flex;height:100%;position:relative}.container{align-items:center;border-radius:inherit;display:flex;flex:1;max-height:100%;min-height:100%;min-width:min-content;position:relative}.field,.container-overflow{resize:inherit}.resizable:not(.disabled) .container{resize:inherit;overflow:hidden}.disabled{pointer-events:none}slot[name=container]{border-radius:inherit}slot[name=container]::slotted(*){border-radius:inherit;inset:0;pointer-events:none;position:absolute}@layer styles{.start,.middle,.end{display:flex;box-sizing:border-box;height:100%;position:relative}.start{color:var(--_leading-content-color)}.end{color:var(--_trailing-content-color)}.start,.end{align-items:center;justify-content:center}.with-start .start{margin-inline:var(--_with-leading-content-leading-space) var(--_content-space)}.with-end .end{margin-inline:var(--_content-space) var(--_with-trailing-content-trailing-space)}.middle{align-items:stretch;align-self:baseline;flex:1}.content{color:var(--_content-color);display:flex;flex:1;opacity:0;transition:opacity 83ms cubic-bezier(0.2, 0, 0, 1)}.no-label .content,.focused .content,.populated .content{opacity:1;transition-delay:67ms}:is(.disabled,.disable-transitions) .content{transition:none}.content ::slotted(*){all:unset;color:currentColor;font-family:var(--_content-font);font-size:var(--_content-size);line-height:var(--_content-line-height);font-weight:var(--_content-weight);width:100%;overflow-wrap:revert;white-space:revert}.content ::slotted(:not(textarea)){padding-top:var(--_top-space);padding-bottom:var(--_bottom-space)}.content ::slotted(textarea){margin-top:var(--_top-space);margin-bottom:var(--_bottom-space)}:hover .content{color:var(--_hover-content-color)}:hover .start{color:var(--_hover-leading-content-color)}:hover .end{color:var(--_hover-trailing-content-color)}.focused .content{color:var(--_focus-content-color)}.focused .start{color:var(--_focus-leading-content-color)}.focused .end{color:var(--_focus-trailing-content-color)}.disabled .content{color:var(--_disabled-content-color)}.disabled.no-label .content,.disabled.focused .content,.disabled.populated .content{opacity:var(--_disabled-content-opacity)}.disabled .start{color:var(--_disabled-leading-content-color);opacity:var(--_disabled-leading-content-opacity)}.disabled .end{color:var(--_disabled-trailing-content-color);opacity:var(--_disabled-trailing-content-opacity)}.error .content{color:var(--_error-content-color)}.error .start{color:var(--_error-leading-content-color)}.error .end{color:var(--_error-trailing-content-color)}.error:hover .content{color:var(--_error-hover-content-color)}.error:hover .start{color:var(--_error-hover-leading-content-color)}.error:hover .end{color:var(--_error-hover-trailing-content-color)}.error.focused .content{color:var(--_error-focus-content-color)}.error.focused .start{color:var(--_error-focus-leading-content-color)}.error.focused .end{color:var(--_error-focus-trailing-content-color)}}@layer hcm{@media(forced-colors: active){.disabled :is(.start,.content,.end){color:GrayText;opacity:1}}}@layer styles{.label{box-sizing:border-box;color:var(--_label-text-color);overflow:hidden;max-width:100%;text-overflow:ellipsis;white-space:nowrap;z-index:1;font-family:var(--_label-text-font);font-size:var(--_label-text-size);line-height:var(--_label-text-line-height);font-weight:var(--_label-text-weight);width:min-content}.label-wrapper{inset:0;pointer-events:none;position:absolute}.label.resting{position:absolute;top:var(--_top-space)}.label.floating{font-size:var(--_label-text-populated-size);line-height:var(--_label-text-populated-line-height);transform-origin:top left}.label.hidden{opacity:0}.no-label .label{display:none}.label-wrapper{inset:0;position:absolute;text-align:initial}:hover .label{color:var(--_hover-label-text-color)}.focused .label{color:var(--_focus-label-text-color)}.disabled .label{color:var(--_disabled-label-text-color)}.disabled .label:not(.hidden){opacity:var(--_disabled-label-text-opacity)}.error .label{color:var(--_error-label-text-color)}.error:hover .label{color:var(--_error-hover-label-text-color)}.error.focused .label{color:var(--_error-focus-label-text-color)}}@layer hcm{@media(forced-colors: active){.disabled .label:not(.hidden){color:GrayText;opacity:1}}}@layer styles{.supporting-text{color:var(--_supporting-text-color);display:flex;font-family:var(--_supporting-text-font);font-size:var(--_supporting-text-size);line-height:var(--_supporting-text-line-height);font-weight:var(--_supporting-text-weight);gap:16px;justify-content:space-between;padding-inline-start:var(--_supporting-text-leading-space);padding-inline-end:var(--_supporting-text-trailing-space);padding-top:var(--_supporting-text-top-space)}.supporting-text :nth-child(2){flex-shrink:0}:hover .supporting-text{color:var(--_hover-supporting-text-color)}.focus .supporting-text{color:var(--_focus-supporting-text-color)}.disabled .supporting-text{color:var(--_disabled-supporting-text-color);opacity:var(--_disabled-supporting-text-opacity)}.error .supporting-text{color:var(--_error-supporting-text-color)}.error:hover .supporting-text{color:var(--_error-hover-supporting-text-color)}.error.focus .supporting-text{color:var(--_error-focus-supporting-text-color)}}@layer hcm{@media(forced-colors: active){.disabled .supporting-text{color:GrayText;opacity:1}}}
|
|
94
|
-
`;let Ie=class extends
|
|
94
|
+
`;let Ie=class extends Ce{};Ie.styles=[Ee,Re],Ie=i([_("md-filled-field")],Ie);const Te={},Fe=x(class extends w{constructor(e){if(super(e),e.type!==k.PROPERTY&&e.type!==k.ATTRIBUTE&&e.type!==k.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!(e=>void 0===e.strings)(e))throw Error("`live` bindings can only contain a single expression")}render(e){return e}update(e,[t]){if(t===S||t===p)return t;const i=e.element,r=e.name;if(e.type===k.PROPERTY){if(t===i[r])return S}else if(e.type===k.BOOLEAN_ATTRIBUTE){if(!!t===i.hasAttribute(r))return S}else if(e.type===k.ATTRIBUTE&&i.getAttribute(r)===t+"")return S;return((e,t=Te)=>{e._$AH=t})(e),t}}),Le="important",Oe=" !"+Le,Ae=x(class extends w{constructor(e){if(super(e),e.type!==k.ATTRIBUTE||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,i)=>{const r=e[i];return null==r?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const r=t[e];if(null!=r){this.ft.add(e);const t="string"==typeof r&&r.endsWith(Oe);e.includes("-")||t?i.setProperty(e,t?r.slice(0,-11):r,t?Le:""):i[e]=r}}return S}}),ze={fromAttribute:e=>e??"",toAttribute:e=>e||null},Pe=Symbol("onReportValidity"),Be=Symbol("privateCleanupFormListeners"),De=Symbol("privateDoNotReportInvalid"),Ue=Symbol("privateIsSelfReportingValidity"),Me=Symbol("privateCallOnReportValidity");function We(e){var i,r,o;class s extends e{constructor(...e){super(...e),this[i]=new AbortController,this[r]=!1,this[o]=!1,this.addEventListener("invalid",e=>{!this[De]&&e.isTrusted&&this.addEventListener("invalid",()=>{this[Me](e)},{once:!0})},{capture:!0})}checkValidity(){this[De]=!0;const e=super.checkValidity();return this[De]=!1,e}reportValidity(){this[Ue]=!0;const e=super.reportValidity();return e&&this[Me](null),this[Ue]=!1,e}[(i=Be,r=De,o=Ue,Me)](e){const i=e?.defaultPrevented;if(i)return;this[Pe](e);!i&&e?.defaultPrevented&&(this[Ue]||function(e,t){if(!e)return!0;let i;for(const t of e.elements)if(t.matches(":invalid")){i=t;break}return i===t}(this[t].form,this))&&this.focus()}[Pe](e){throw new Error("Implement [onReportValidity]")}formAssociatedCallback(e){super.formAssociatedCallback&&super.formAssociatedCallback(e),this[Be].abort(),e&&(this[Be]=new AbortController,function(e,t,i,r){const o=function(e){if(!He.has(e)){const t=new EventTarget;He.set(e,t);for(const i of["reportValidity","requestSubmit"]){const r=e[i];e[i]=function(){t.dispatchEvent(new Event("before"));const e=Reflect.apply(r,this,arguments);return t.dispatchEvent(new Event("after")),e}}}return He.get(e)}(t);let s,a=!1,l=!1;o.addEventListener("before",()=>{l=!0,s=new AbortController,a=!1,e.addEventListener("invalid",()=>{a=!0},{signal:s.signal})},{signal:r}),o.addEventListener("after",()=>{l=!1,s?.abort(),a||i()},{signal:r}),t.addEventListener("submit",()=>{l||i()},{signal:r})}(this,e,()=>{this[Me](null)},this[Be].signal))}}return s}const He=new WeakMap;class Ve extends X{computeValidity({state:e,renderedControl:t}){let i=t;Ne(e)&&!i?(i=this.inputControl||document.createElement("input"),this.inputControl=i):i||(i=this.textAreaControl||document.createElement("textarea"),this.textAreaControl=i);const r=Ne(e)?i:null;if(r&&(r.type=e.type),i.value!==e.value&&(i.value=e.value),i.required=e.required,r){const t=e;t.pattern?r.pattern=t.pattern:r.removeAttribute("pattern"),t.min?r.min=t.min:r.removeAttribute("min"),t.max?r.max=t.max:r.removeAttribute("max"),t.step?r.step=t.step:r.removeAttribute("step")}return(e.minLength??-1)>-1?i.setAttribute("minlength",String(e.minLength)):i.removeAttribute("minlength"),(e.maxLength??-1)>-1?i.setAttribute("maxlength",String(e.maxLength)):i.removeAttribute("maxlength"),{validity:i.validity,validationMessage:i.validationMessage}}equals({state:e},{state:t}){const i=e.type===t.type&&e.value===t.value&&e.required===t.required&&e.minLength===t.minLength&&e.maxLength===t.maxLength;return Ne(e)&&Ne(t)?i&&e.pattern===t.pattern&&e.min===t.min&&e.max===t.max&&e.step===t.step:i}copy({state:e}){return{state:Ne(e)?this.copyInput(e):this.copyTextArea(e),renderedControl:null}}copyInput(e){const{type:t,pattern:i,min:r,max:o,step:s}=e;return{...this.copySharedState(e),type:t,pattern:i,min:r,max:o,step:s}}copyTextArea(e){return{...this.copySharedState(e),type:e.type}}copySharedState({value:e,required:t,minLength:i,maxLength:r}){return{value:e,required:t,minLength:i,maxLength:r}}}function Ne(e){return"textarea"!==e.type}const qe=o(We(K(Y(s(a)))));class Ge extends qe{constructor(){super(...arguments),this.error=!1,this.errorText="",this.label="",this.noAsterisk=!1,this.required=!1,this.value="",this.prefixText="",this.suffixText="",this.hasLeadingIcon=!1,this.hasTrailingIcon=!1,this.supportingText="",this.textDirection="",this.rows=2,this.cols=20,this.inputMode="",this.max="",this.maxLength=-1,this.min="",this.minLength=-1,this.noSpinner=!1,this.pattern="",this.placeholder="",this.readOnly=!1,this.multiple=!1,this.step="",this.type="text",this.autocomplete="",this.dirty=!1,this.focused=!1,this.nativeError=!1,this.nativeErrorText=""}get selectionDirection(){return this.getInputOrTextarea().selectionDirection}set selectionDirection(e){this.getInputOrTextarea().selectionDirection=e}get selectionEnd(){return this.getInputOrTextarea().selectionEnd}set selectionEnd(e){this.getInputOrTextarea().selectionEnd=e}get selectionStart(){return this.getInputOrTextarea().selectionStart}set selectionStart(e){this.getInputOrTextarea().selectionStart=e}get valueAsNumber(){const e=this.getInput();return e?e.valueAsNumber:NaN}set valueAsNumber(e){const t=this.getInput();t&&(t.valueAsNumber=e,this.value=t.value)}get valueAsDate(){const e=this.getInput();return e?e.valueAsDate:null}set valueAsDate(e){const t=this.getInput();t&&(t.valueAsDate=e,this.value=t.value)}get hasError(){return this.error||this.nativeError}select(){this.getInputOrTextarea().select()}setRangeText(...e){this.getInputOrTextarea().setRangeText(...e),this.value=this.getInputOrTextarea().value}setSelectionRange(e,t,i){this.getInputOrTextarea().setSelectionRange(e,t,i)}stepDown(e){const t=this.getInput();t&&(t.stepDown(e),this.value=t.value)}stepUp(e){const t=this.getInput();t&&(t.stepUp(e),this.value=t.value)}reset(){this.dirty=!1,this.value=this.getAttribute("value")??"",this.nativeError=!1,this.nativeErrorText=""}attributeChangedCallback(e,t,i){"value"===e&&this.dirty||super.attributeChangedCallback(e,t,i)}render(){const e={disabled:this.disabled,error:!this.disabled&&this.hasError,textarea:"textarea"===this.type,"no-spinner":this.noSpinner};return u`
|
|
95
95
|
<span class="text-field ${h(e)}">
|
|
96
96
|
${this.renderField()}
|
|
97
97
|
</span>
|
|
@@ -180,9 +180,9 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
180
180
|
@select=${this.redispatchEvent} />
|
|
181
181
|
${a}
|
|
182
182
|
</div>
|
|
183
|
-
`}renderPrefix(){return this.renderAffix(this.prefixText,!1)}renderSuffix(){return this.renderAffix(this.suffixText,!0)}renderAffix(e,t){if(!e)return p;return u`<span class="${h({suffix:t,prefix:!t})}">${e}</span>`}getErrorText(){return this.error?this.errorText:this.nativeErrorText}handleFocusChange(){this.focused=this.inputOrTextarea?.matches(":focus")??!1}handleInput(e){this.dirty=!0,this.value=e.target.value}redispatchEvent(e){f(this,e)}getInputOrTextarea(){return this.inputOrTextarea||(this.connectedCallback(),this.scheduleUpdate()),this.isUpdatePending&&this.scheduleUpdate(),this.inputOrTextarea}getInput(){return"textarea"===this.type?null:this.getInputOrTextarea()}handleIconChange(){this.hasLeadingIcon=this.leadingIcons.length>0,this.hasTrailingIcon=this.trailingIcons.length>0}[J](){return this.value}formResetCallback(){this.reset()}formStateRestoreCallback(e){this.value=e}focus(){this.getInputOrTextarea().focus()}[V](){return new Ve(()=>({state:this,renderedControl:this.inputOrTextarea}))}[N](){return this.inputOrTextarea}[
|
|
183
|
+
`}renderPrefix(){return this.renderAffix(this.prefixText,!1)}renderSuffix(){return this.renderAffix(this.suffixText,!0)}renderAffix(e,t){if(!e)return p;return u`<span class="${h({suffix:t,prefix:!t})}">${e}</span>`}getErrorText(){return this.error?this.errorText:this.nativeErrorText}handleFocusChange(){this.focused=this.inputOrTextarea?.matches(":focus")??!1}handleInput(e){this.dirty=!0,this.value=e.target.value}redispatchEvent(e){f(this,e)}getInputOrTextarea(){return this.inputOrTextarea||(this.connectedCallback(),this.scheduleUpdate()),this.isUpdatePending&&this.scheduleUpdate(),this.inputOrTextarea}getInput(){return"textarea"===this.type?null:this.getInputOrTextarea()}handleIconChange(){this.hasLeadingIcon=this.leadingIcons.length>0,this.hasTrailingIcon=this.trailingIcons.length>0}[J](){return this.value}formResetCallback(){this.reset()}formStateRestoreCallback(e){this.value=e}focus(){this.getInputOrTextarea().focus()}[V](){return new Ve(()=>({state:this,renderedControl:this.inputOrTextarea}))}[N](){return this.inputOrTextarea}[Pe](e){e?.preventDefault();const t=this.getErrorText();this.nativeError=!!e,this.nativeErrorText=this.validationMessage,t===this.getErrorText()&&this.field?.reannounceError()}}Ge.shadowRootOptions={...a.shadowRootOptions,delegatesFocus:!0},i([r({type:Boolean,reflect:!0})],Ge.prototype,"error",void 0),i([r({attribute:"error-text"})],Ge.prototype,"errorText",void 0),i([r()],Ge.prototype,"label",void 0),i([r({type:Boolean,attribute:"no-asterisk"})],Ge.prototype,"noAsterisk",void 0),i([r({type:Boolean,reflect:!0})],Ge.prototype,"required",void 0),i([r()],Ge.prototype,"value",void 0),i([r({attribute:"prefix-text"})],Ge.prototype,"prefixText",void 0),i([r({attribute:"suffix-text"})],Ge.prototype,"suffixText",void 0),i([r({type:Boolean,attribute:"has-leading-icon"})],Ge.prototype,"hasLeadingIcon",void 0),i([r({type:Boolean,attribute:"has-trailing-icon"})],Ge.prototype,"hasTrailingIcon",void 0),i([r({attribute:"supporting-text"})],Ge.prototype,"supportingText",void 0),i([r({attribute:"text-direction"})],Ge.prototype,"textDirection",void 0),i([r({type:Number})],Ge.prototype,"rows",void 0),i([r({type:Number})],Ge.prototype,"cols",void 0),i([r({reflect:!0})],Ge.prototype,"inputMode",void 0),i([r()],Ge.prototype,"max",void 0),i([r({type:Number})],Ge.prototype,"maxLength",void 0),i([r()],Ge.prototype,"min",void 0),i([r({type:Number})],Ge.prototype,"minLength",void 0),i([r({type:Boolean,attribute:"no-spinner"})],Ge.prototype,"noSpinner",void 0),i([r()],Ge.prototype,"pattern",void 0),i([r({reflect:!0,converter:ze})],Ge.prototype,"placeholder",void 0),i([r({type:Boolean,reflect:!0})],Ge.prototype,"readOnly",void 0),i([r({type:Boolean,reflect:!0})],Ge.prototype,"multiple",void 0),i([r()],Ge.prototype,"step",void 0),i([r({reflect:!0})],Ge.prototype,"type",void 0),i([r({reflect:!0})],Ge.prototype,"autocomplete",void 0),i([l()],Ge.prototype,"dirty",void 0),i([l()],Ge.prototype,"focused",void 0),i([l()],Ge.prototype,"nativeError",void 0),i([l()],Ge.prototype,"nativeErrorText",void 0),i([n(".input")],Ge.prototype,"inputOrTextarea",void 0),i([n(".field")],Ge.prototype,"field",void 0),i([v({slot:"leading-icon"})],Ge.prototype,"leadingIcons",void 0),i([v({slot:"trailing-icon"})],Ge.prototype,"trailingIcons",void 0);class je extends Ge{constructor(){super(...arguments),this.fieldTag=ge`md-filled-field`}}const Ke=g`:host{display:inline-flex;outline:none;resize:both;text-align:start;-webkit-tap-highlight-color:rgba(0,0,0,0)}.text-field,.field{width:100%}.text-field{display:inline-flex}.field{cursor:text}.disabled .field{cursor:default}.text-field,.textarea .field{resize:inherit}slot[name=container]{border-radius:inherit}.icon{color:currentColor;display:flex;align-items:center;justify-content:center;fill:currentColor;position:relative}.icon ::slotted(*){display:flex;position:absolute}[has-start] .icon.leading{font-size:var(--_leading-icon-size);height:var(--_leading-icon-size);width:var(--_leading-icon-size)}[has-end] .icon.trailing{font-size:var(--_trailing-icon-size);height:var(--_trailing-icon-size);width:var(--_trailing-icon-size)}.input-wrapper{display:flex}.input-wrapper>*{all:inherit;padding:0}.input{caret-color:var(--_caret-color);overflow-x:hidden;text-align:inherit}.input::placeholder{color:currentColor;opacity:1}.input::-webkit-calendar-picker-indicator{display:none}.input::-webkit-search-decoration,.input::-webkit-search-cancel-button{display:none}@media(forced-colors: active){.input{background:none}}.no-spinner .input::-webkit-inner-spin-button,.no-spinner .input::-webkit-outer-spin-button{display:none}.no-spinner .input[type=number]{-moz-appearance:textfield}:focus-within .input{caret-color:var(--_focus-caret-color)}.error:focus-within .input{caret-color:var(--_error-focus-caret-color)}.text-field:not(.disabled) .prefix{color:var(--_input-text-prefix-color)}.text-field:not(.disabled) .suffix{color:var(--_input-text-suffix-color)}.text-field:not(.disabled) .input::placeholder{color:var(--_input-text-placeholder-color)}.prefix,.suffix{text-wrap:nowrap;width:min-content}.prefix{padding-inline-end:var(--_input-text-prefix-trailing-space)}.suffix{padding-inline-start:var(--_input-text-suffix-leading-space)}
|
|
184
184
|
`;class Je extends je{constructor(){super(...arguments),this.fieldTag=ge`md-filled-field`}}Je.styles=[Ke,Se],customElements.define("ew-filled-text-field",Je);class Ze extends a{connectedCallback(){super.connectedCallback(),this.setAttribute("aria-hidden","true")}render(){return u`<span class="shadow"></span>`}}const Ye=g`:host,.shadow,.shadow::before,.shadow::after{border-radius:inherit;inset:0;position:absolute;transition-duration:inherit;transition-property:inherit;transition-timing-function:inherit}:host{display:flex;pointer-events:none;transition-property:box-shadow,opacity}.shadow::before,.shadow::after{content:"";transition-property:box-shadow,opacity;--_level: var(--md-elevation-level, 0);--_shadow-color: var(--md-elevation-shadow-color, var(--md-sys-color-shadow, #000))}.shadow::before{box-shadow:0px calc(1px*(clamp(0,var(--_level),1) + clamp(0,var(--_level) - 3,1) + 2*clamp(0,var(--_level) - 4,1))) calc(1px*(2*clamp(0,var(--_level),1) + clamp(0,var(--_level) - 2,1) + clamp(0,var(--_level) - 4,1))) 0px var(--_shadow-color);opacity:.3}.shadow::after{box-shadow:0px calc(1px*(clamp(0,var(--_level),1) + clamp(0,var(--_level) - 1,1) + 2*clamp(0,var(--_level) - 2,3))) calc(1px*(3*clamp(0,var(--_level),2) + 2*clamp(0,var(--_level) - 2,3))) calc(1px*(clamp(0,var(--_level),4) + 2*clamp(0,var(--_level) - 4,1))) var(--_shadow-color);opacity:.15}
|
|
185
|
-
`;let Xe=class extends Ze{};function Qe(e,t=at){const i=it(e,t);return i&&(i.tabIndex=0,i.focus()),i}function et(e,t=at){const i=rt(e,t);return i&&(i.tabIndex=0,i.focus()),i}function tt(e,t=at){for(let i=0;i<e.length;i++){const r=e[i];if(0===r.tabIndex&&t(r))return{item:r,index:i}}return null}function it(e,t=at){for(const i of e)if(t(i))return i;return null}function rt(e,t=at){for(let i=e.length-1;i>=0;i--){const r=e[i];if(t(r))return r}return null}function ot(e,t,i=at,r=!0){if(t){const o=function(e,t,i=at,r=!0){for(let o=1;o<e.length;o++){const s=(o+t)%e.length;if(s<t&&!r)return null;const a=e[s];if(i(a))return a}return e[t]?e[t]:null}(e,t.index,i,r);return o&&(o.tabIndex=0,o.focus()),o}return Qe(e,i)}function st(e,t,i=at,r=!0){if(t){const o=function(e,t,i=at,r=!0){for(let o=1;o<e.length;o++){const s=(t-o+e.length)%e.length;if(s>t&&!r)return null;const a=e[s];if(i(a))return a}return e[t]?e[t]:null}(e,t.index,i,r);return o&&(o.tabIndex=0,o.focus()),o}return et(e,i)}function at(e){return!e.disabled}Xe.styles=[Ye],Xe=i([x("md-elevation")],Xe);const lt={ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",Home:"Home",End:"End"};class nt{constructor(e){this.handleKeydown=e=>{const t=e.key;if(e.defaultPrevented||!this.isNavigableKey(t))return;const i=this.items;if(!i.length)return;const r=tt(i,this.isActivatable);e.preventDefault();const o=this.isRtl();let s=null;switch(t){case lt.ArrowDown:case o?lt.ArrowLeft:lt.ArrowRight:s=ot(i,r,this.isActivatable,this.wrapNavigation());break;case lt.ArrowUp:case o?lt.ArrowRight:lt.ArrowLeft:s=st(i,r,this.isActivatable,this.wrapNavigation());break;case lt.Home:s=Qe(i,this.isActivatable);break;case lt.End:s=et(i,this.isActivatable)}s&&r&&r.item!==s&&(r.item.tabIndex=-1)},this.onDeactivateItems=()=>{const e=this.items;for(const t of e)this.deactivateItem(t)},this.onRequestActivation=e=>{this.onDeactivateItems();const t=e.target;this.activateItem(t),t.focus()},this.onSlotchange=()=>{const e=this.items;let t=!1;for(const i of e){!(!i.disabled&&i.tabIndex>-1)||t?i.tabIndex=-1:(t=!0,i.tabIndex=0)}if(t)return;const i=it(e,this.isActivatable);i&&(i.tabIndex=0)};const{isItem:t,getPossibleItems:i,isRtl:r,deactivateItem:o,activateItem:s,isNavigableKey:a,isActivatable:l,wrapNavigation:n}=e;this.isItem=t,this.getPossibleItems=i,this.isRtl=r,this.deactivateItem=o,this.activateItem=s,this.isNavigableKey=a,this.isActivatable=l,this.wrapNavigation=n??(()=>!0)}get items(){const e=this.getPossibleItems(),t=[];for(const i of e){if(this.isItem(i)){t.push(i);continue}const e=i.item;e&&this.isItem(e)&&t.push(e)}return t}activateNextItem(){const e=this.items,t=tt(e,this.isActivatable);return t&&(t.item.tabIndex=-1),ot(e,t,this.isActivatable,this.wrapNavigation())}activatePreviousItem(){const e=this.items,t=tt(e,this.isActivatable);return t&&(t.item.tabIndex=-1),st(e,t,this.isActivatable,this.wrapNavigation())}}const dt=function(e,t){return new CustomEvent("close-menu",{bubbles:!0,composed:!0,detail:{initiator:e,reason:t,itemPath:[e]}})},ct={SPACE:"Space",ENTER:"Enter"},ht="click-selection",pt="keydown",ut={ESCAPE:"Escape",SPACE:ct.SPACE,ENTER:ct.ENTER};function ft(e){return Object.values(ut).some(t=>t===e)}function gt(e,t){const i=new Event("md-contains",{bubbles:!0,composed:!0});let r=[];const o=e=>{r=e.composedPath()};t.addEventListener("md-contains",o),e.dispatchEvent(i),t.removeEventListener("md-contains",o);return r.length>0}const mt="none",vt="list-root",bt="first-item",yt="last-item",xt="end-start",_t="start-start";class wt{constructor(e,t){this.host=e,this.getProperties=t,this.surfaceStylesInternal={display:"none"},this.lastValues={isOpen:!1},this.host.addController(this)}get surfaceStyles(){return this.surfaceStylesInternal}async position(){const{surfaceEl:e,anchorEl:t,anchorCorner:i,surfaceCorner:r,positioning:o,xOffset:s,yOffset:a,disableBlockFlip:l,disableInlineFlip:n,repositionStrategy:d}=this.getProperties(),c=i.toLowerCase().trim(),h=r.toLowerCase().trim();if(!e||!t)return;const p=window.innerWidth,u=window.innerHeight,f=document.createElement("div");f.style.opacity="0",f.style.position="fixed",f.style.display="block",f.style.inset="0",document.body.appendChild(f);const g=f.getBoundingClientRect();f.remove();const m=window.innerHeight-g.bottom,v=window.innerWidth-g.right;this.surfaceStylesInternal={display:"block",opacity:"0"},this.host.requestUpdate(),await this.host.updateComplete,e.popover&&e.isConnected&&e.showPopover();const b=e.getSurfacePositionClientRect?e.getSurfacePositionClientRect():e.getBoundingClientRect(),y=t.getSurfacePositionClientRect?t.getSurfacePositionClientRect():t.getBoundingClientRect(),[x,_]=h.split("-"),[w,k]=c.split("-"),S="ltr"===getComputedStyle(e).direction;let{blockInset:$,blockOutOfBoundsCorrection:R,surfaceBlockProperty:C}=this.calculateBlock({surfaceRect:b,anchorRect:y,anchorBlock:w,surfaceBlock:x,yOffset:a,positioning:o,windowInnerHeight:u,blockScrollbarHeight:m});if(R&&!l){const e="start"===x?"end":"start",t="start"===w?"end":"start",i=this.calculateBlock({surfaceRect:b,anchorRect:y,anchorBlock:t,surfaceBlock:e,yOffset:a,positioning:o,windowInnerHeight:u,blockScrollbarHeight:m});R>i.blockOutOfBoundsCorrection&&($=i.blockInset,R=i.blockOutOfBoundsCorrection,C=i.surfaceBlockProperty)}let{inlineInset:E,inlineOutOfBoundsCorrection:I,surfaceInlineProperty:T}=this.calculateInline({surfaceRect:b,anchorRect:y,anchorInline:k,surfaceInline:_,xOffset:s,positioning:o,isLTR:S,windowInnerWidth:p,inlineScrollbarWidth:v});if(I&&!n){const e="start"===_?"end":"start",t="start"===k?"end":"start",i=this.calculateInline({surfaceRect:b,anchorRect:y,anchorInline:t,surfaceInline:e,xOffset:s,positioning:o,isLTR:S,windowInnerWidth:p,inlineScrollbarWidth:v});Math.abs(I)>Math.abs(i.inlineOutOfBoundsCorrection)&&(E=i.inlineInset,I=i.inlineOutOfBoundsCorrection,T=i.surfaceInlineProperty)}"move"===d&&($-=R,E-=I),this.surfaceStylesInternal={display:"block",opacity:"1",[C]:`${$}px`,[T]:`${E}px`},"resize"===d&&(R&&(this.surfaceStylesInternal.height=b.height-R+"px"),I&&(this.surfaceStylesInternal.width=b.width-I+"px")),this.host.requestUpdate()}calculateBlock(e){const{surfaceRect:t,anchorRect:i,anchorBlock:r,surfaceBlock:o,yOffset:s,positioning:a,windowInnerHeight:l,blockScrollbarHeight:n}=e,d="fixed"===a||"document"===a?1:0,c="document"===a?1:0,h="start"===o?1:0,p="end"===o?1:0,u=(r!==o?1:0)*i.height+s,f=h*i.top+p*(l-i.bottom-n);return{blockInset:d*f+c*(h*window.scrollY-p*window.scrollY)+u,blockOutOfBoundsCorrection:Math.abs(Math.min(0,l-f-u-t.height)),surfaceBlockProperty:"start"===o?"inset-block-start":"inset-block-end"}}calculateInline(e){const{isLTR:t,surfaceInline:i,anchorInline:r,anchorRect:o,surfaceRect:s,xOffset:a,positioning:l,windowInnerWidth:n,inlineScrollbarWidth:d}=e,c="fixed"===l||"document"===l?1:0,h="document"===l?1:0,p=t?1:0,u=t?0:1,f="start"===i?1:0,g="end"===i?1:0,m=(r!==i?1:0)*o.width+a,v=p*(f*o.left+g*(n-o.right-d))+u*(f*(n-o.right-d)+g*o.left);let b="start"===i?"inset-inline-start":"inset-inline-end";return"document"!==l&&"fixed"!==l||(b="start"===i&&t||"end"===i&&!t?"left":"right"),{inlineInset:c*v+m+h*(p*(f*window.scrollX-g*window.scrollX)+u*(g*window.scrollX-f*window.scrollX)),inlineOutOfBoundsCorrection:Math.abs(Math.min(0,n-v-m-s.width)),surfaceInlineProperty:b}}hostUpdate(){this.onUpdate()}hostUpdated(){this.onUpdate()}async onUpdate(){const e=this.getProperties();let t=!1;for(const[i,r]of Object.entries(e))if(t=t||r!==this.lastValues[i],t)break;const i=this.lastValues.isOpen!==e.isOpen,r=!!e.anchorEl,o=!!e.surfaceEl;t&&r&&o&&(this.lastValues.isOpen=e.isOpen,e.isOpen?(this.lastValues=e,await this.position(),e.onOpen()):i&&(await e.beforeClose(),this.close(),e.onClose()))}close(){this.surfaceStylesInternal={display:"none"},this.host.requestUpdate();const e=this.getProperties().surfaceEl;e?.popover&&e?.isConnected&&e.hidePopover()}}const kt=0,St=1,$t=2;class Rt{constructor(e){this.getProperties=e,this.typeaheadRecords=[],this.typaheadBuffer="",this.cancelTypeaheadTimeout=0,this.isTypingAhead=!1,this.lastActiveRecord=null,this.onKeydown=e=>{this.isTypingAhead?this.typeahead(e):this.beginTypeahead(e)},this.endTypeahead=()=>{this.isTypingAhead=!1,this.typaheadBuffer="",this.typeaheadRecords=[]}}get items(){return this.getProperties().getItems()}get active(){return this.getProperties().active}beginTypeahead(e){this.active&&("Space"===e.code||"Enter"===e.code||e.code.startsWith("Arrow")||"Escape"===e.code||(this.isTypingAhead=!0,this.typeaheadRecords=this.items.map((e,t)=>[t,e,e.typeaheadText.trim().toLowerCase()]),this.lastActiveRecord=this.typeaheadRecords.find(e=>0===e[St].tabIndex)??null,this.lastActiveRecord&&(this.lastActiveRecord[St].tabIndex=-1),this.typeahead(e)))}typeahead(e){if(e.defaultPrevented)return;if(clearTimeout(this.cancelTypeaheadTimeout),"Enter"===e.code||e.code.startsWith("Arrow")||"Escape"===e.code)return this.endTypeahead(),void(this.lastActiveRecord&&(this.lastActiveRecord[St].tabIndex=-1));"Space"===e.code&&e.preventDefault(),this.cancelTypeaheadTimeout=setTimeout(this.endTypeahead,this.getProperties().typeaheadBufferTime),this.typaheadBuffer+=e.key.toLowerCase();const t=this.lastActiveRecord?this.lastActiveRecord[kt]:-1,i=this.typeaheadRecords.length,r=e=>(e[kt]+i-t)%i,o=this.typeaheadRecords.filter(e=>!e[St].disabled&&e[$t].startsWith(this.typaheadBuffer)).sort((e,t)=>r(e)-r(t));if(0===o.length)return clearTimeout(this.cancelTypeaheadTimeout),this.lastActiveRecord&&(this.lastActiveRecord[St].tabIndex=-1),void this.endTypeahead();const s=1===this.typaheadBuffer.length;let a;a=this.lastActiveRecord===o[0]&&s?o[1]??o[0]:o[0],this.lastActiveRecord&&(this.lastActiveRecord[St].tabIndex=-1),this.lastActiveRecord=a,a[St].tabIndex=0,a[St].focus()}}const Ct=new Set([lt.ArrowDown,lt.ArrowUp,lt.Home,lt.End]),Et=new Set([lt.ArrowLeft,lt.ArrowRight,...Ct]);class It extends a{get openDirection(){return"start"===this.menuCorner.split("-")[0]?"DOWN":"UP"}get anchorElement(){return this.anchor?this.getRootNode().querySelector(`#${this.anchor}`):this.currentAnchorElement}set anchorElement(e){this.currentAnchorElement=e,this.requestUpdate("anchorElement")}constructor(){super(),this.anchor="",this.positioning="absolute",this.quick=!1,this.hasOverflow=!1,this.open=!1,this.xOffset=0,this.yOffset=0,this.noHorizontalFlip=!1,this.noVerticalFlip=!1,this.typeaheadDelay=200,this.anchorCorner=xt,this.menuCorner=_t,this.stayOpenOnOutsideClick=!1,this.stayOpenOnFocusout=!1,this.skipRestoreFocus=!1,this.defaultFocus=bt,this.noNavigationWrap=!1,this.typeaheadActive=!0,this.isSubmenu=!1,this.pointerPath=[],this.isRepositioning=!1,this.openCloseAnimationSignal=$(),this.listController=new nt({isItem:e=>e.hasAttribute("md-menu-item"),getPossibleItems:()=>this.slotItems,isRtl:()=>"rtl"===getComputedStyle(this).direction,deactivateItem:e=>{e.selected=!1,e.tabIndex=-1},activateItem:e=>{e.selected=!0,e.tabIndex=0},isNavigableKey:e=>{if(!this.isSubmenu)return Et.has(e);return e===("rtl"===getComputedStyle(this).direction?lt.ArrowLeft:lt.ArrowRight)||Ct.has(e)},wrapNavigation:()=>!this.noNavigationWrap}),this.lastFocusedElement=null,this.typeaheadController=new Rt(()=>({getItems:()=>this.items,typeaheadBufferTime:this.typeaheadDelay,active:this.typeaheadActive})),this.currentAnchorElement=null,this.internals=this.attachInternals(),this.menuPositionController=new wt(this,()=>({anchorCorner:this.anchorCorner,surfaceCorner:this.menuCorner,surfaceEl:this.surfaceEl,anchorEl:this.anchorElement,positioning:"popover"===this.positioning?"document":this.positioning,isOpen:this.open,xOffset:this.xOffset,yOffset:this.yOffset,disableBlockFlip:this.noVerticalFlip,disableInlineFlip:this.noHorizontalFlip,onOpen:this.onOpened,beforeClose:this.beforeClose,onClose:this.onClosed,repositionStrategy:this.hasOverflow&&"popover"!==this.positioning?"move":"resize"})),this.onWindowResize=()=>{this.isRepositioning||"document"!==this.positioning&&"fixed"!==this.positioning&&"popover"!==this.positioning||(this.isRepositioning=!0,this.reposition(),this.isRepositioning=!1)},this.handleFocusout=async e=>{const t=this.anchorElement;if(this.stayOpenOnFocusout||!this.open||this.pointerPath.includes(t))return;if(e.relatedTarget){if(gt(e.relatedTarget,this)||0!==this.pointerPath.length&>(e.relatedTarget,t))return}else if(this.pointerPath.includes(this))return;const i=this.skipRestoreFocus;this.skipRestoreFocus=!0,this.close(),await this.updateComplete,this.skipRestoreFocus=i},this.onOpened=async()=>{this.lastFocusedElement=function(e=document){let t=e.activeElement;for(;t&&t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}();const e=this.items,t=tt(e);t&&this.defaultFocus!==mt&&(t.item.tabIndex=-1);let i=!this.quick;switch(this.quick?this.dispatchEvent(new Event("opening")):i=!!await this.animateOpen(),this.defaultFocus){case bt:const t=it(e);t&&(t.tabIndex=0,t.focus(),await t.updateComplete);break;case yt:const i=rt(e);i&&(i.tabIndex=0,i.focus(),await i.updateComplete);break;case vt:this.focus()}i||this.dispatchEvent(new Event("opened"))},this.beforeClose=async()=>{this.open=!1,this.skipRestoreFocus||this.lastFocusedElement?.focus?.(),this.quick||await this.animateClose()},this.onClosed=()=>{this.quick&&(this.dispatchEvent(new Event("closing")),this.dispatchEvent(new Event("closed")))},this.onWindowPointerdown=e=>{this.pointerPath=e.composedPath()},this.onDocumentClick=e=>{if(!this.open)return;const t=e.composedPath();this.stayOpenOnOutsideClick||t.includes(this)||t.includes(this.anchorElement)||(this.open=!1)},this.internals.role="menu",this.addEventListener("keydown",this.handleKeydown),this.addEventListener("keydown",this.captureKeydown,{capture:!0}),this.addEventListener("focusout",this.handleFocusout)}get items(){return this.listController.items}willUpdate(e){e.has("open")&&(this.open?this.removeAttribute("aria-hidden"):this.setAttribute("aria-hidden","true"))}update(e){e.has("open")&&(this.open?this.setUpGlobalEventListeners():this.cleanUpGlobalEventListeners()),e.has("positioning")&&"popover"===this.positioning&&!this.showPopover&&(this.positioning="fixed"),super.update(e)}connectedCallback(){super.connectedCallback(),this.open&&this.setUpGlobalEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this.cleanUpGlobalEventListeners()}getBoundingClientRect(){return this.surfaceEl?this.surfaceEl.getBoundingClientRect():super.getBoundingClientRect()}getClientRects(){return this.surfaceEl?this.surfaceEl.getClientRects():super.getClientRects()}render(){return this.renderSurface()}renderSurface(){return u`
|
|
185
|
+
`;let Xe=class extends Ze{};function Qe(e,t=at){const i=it(e,t);return i&&(i.tabIndex=0,i.focus()),i}function et(e,t=at){const i=rt(e,t);return i&&(i.tabIndex=0,i.focus()),i}function tt(e,t=at){for(let i=0;i<e.length;i++){const r=e[i];if(0===r.tabIndex&&t(r))return{item:r,index:i}}return null}function it(e,t=at){for(const i of e)if(t(i))return i;return null}function rt(e,t=at){for(let i=e.length-1;i>=0;i--){const r=e[i];if(t(r))return r}return null}function ot(e,t,i=at,r=!0){if(t){const o=function(e,t,i=at,r=!0){for(let o=1;o<e.length;o++){const s=(o+t)%e.length;if(s<t&&!r)return null;const a=e[s];if(i(a))return a}return e[t]?e[t]:null}(e,t.index,i,r);return o&&(o.tabIndex=0,o.focus()),o}return Qe(e,i)}function st(e,t,i=at,r=!0){if(t){const o=function(e,t,i=at,r=!0){for(let o=1;o<e.length;o++){const s=(t-o+e.length)%e.length;if(s>t&&!r)return null;const a=e[s];if(i(a))return a}return e[t]?e[t]:null}(e,t.index,i,r);return o&&(o.tabIndex=0,o.focus()),o}return et(e,i)}function at(e){return!e.disabled}Xe.styles=[Ye],Xe=i([_("md-elevation")],Xe);const lt={ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",Home:"Home",End:"End"};class nt{constructor(e){this.handleKeydown=e=>{const t=e.key;if(e.defaultPrevented||!this.isNavigableKey(t))return;const i=this.items;if(!i.length)return;const r=tt(i,this.isActivatable);e.preventDefault();const o=this.isRtl();let s=null;switch(t){case lt.ArrowDown:case o?lt.ArrowLeft:lt.ArrowRight:s=ot(i,r,this.isActivatable,this.wrapNavigation());break;case lt.ArrowUp:case o?lt.ArrowRight:lt.ArrowLeft:s=st(i,r,this.isActivatable,this.wrapNavigation());break;case lt.Home:s=Qe(i,this.isActivatable);break;case lt.End:s=et(i,this.isActivatable)}s&&r&&r.item!==s&&(r.item.tabIndex=-1)},this.onDeactivateItems=()=>{const e=this.items;for(const t of e)this.deactivateItem(t)},this.onRequestActivation=e=>{this.onDeactivateItems();const t=e.target;this.activateItem(t),t.focus()},this.onSlotchange=()=>{const e=this.items;let t=!1;for(const i of e){!(!i.disabled&&i.tabIndex>-1)||t?i.tabIndex=-1:(t=!0,i.tabIndex=0)}if(t)return;const i=it(e,this.isActivatable);i&&(i.tabIndex=0)};const{isItem:t,getPossibleItems:i,isRtl:r,deactivateItem:o,activateItem:s,isNavigableKey:a,isActivatable:l,wrapNavigation:n}=e;this.isItem=t,this.getPossibleItems=i,this.isRtl=r,this.deactivateItem=o,this.activateItem=s,this.isNavigableKey=a,this.isActivatable=l,this.wrapNavigation=n??(()=>!0)}get items(){const e=this.getPossibleItems(),t=[];for(const i of e){if(this.isItem(i)){t.push(i);continue}const e=i.item;e&&this.isItem(e)&&t.push(e)}return t}activateNextItem(){const e=this.items,t=tt(e,this.isActivatable);return t&&(t.item.tabIndex=-1),ot(e,t,this.isActivatable,this.wrapNavigation())}activatePreviousItem(){const e=this.items,t=tt(e,this.isActivatable);return t&&(t.item.tabIndex=-1),st(e,t,this.isActivatable,this.wrapNavigation())}}const dt=function(e,t){return new CustomEvent("close-menu",{bubbles:!0,composed:!0,detail:{initiator:e,reason:t,itemPath:[e]}})},ct={SPACE:"Space",ENTER:"Enter"},ht="click-selection",pt="keydown",ut={ESCAPE:"Escape",SPACE:ct.SPACE,ENTER:ct.ENTER};function ft(e){return Object.values(ut).some(t=>t===e)}function gt(e,t){const i=new Event("md-contains",{bubbles:!0,composed:!0});let r=[];const o=e=>{r=e.composedPath()};t.addEventListener("md-contains",o),e.dispatchEvent(i),t.removeEventListener("md-contains",o);return r.length>0}const mt="none",vt="list-root",bt="first-item",yt="last-item",_t="end-start",xt="start-start";class wt{constructor(e,t){this.host=e,this.getProperties=t,this.surfaceStylesInternal={display:"none"},this.lastValues={isOpen:!1},this.host.addController(this)}get surfaceStyles(){return this.surfaceStylesInternal}async position(){const{surfaceEl:e,anchorEl:t,anchorCorner:i,surfaceCorner:r,positioning:o,xOffset:s,yOffset:a,disableBlockFlip:l,disableInlineFlip:n,repositionStrategy:d}=this.getProperties(),c=i.toLowerCase().trim(),h=r.toLowerCase().trim();if(!e||!t)return;const p=window.innerWidth,u=window.innerHeight,f=document.createElement("div");f.style.opacity="0",f.style.position="fixed",f.style.display="block",f.style.inset="0",document.body.appendChild(f);const g=f.getBoundingClientRect();f.remove();const m=window.innerHeight-g.bottom,v=window.innerWidth-g.right;this.surfaceStylesInternal={display:"block",opacity:"0"},this.host.requestUpdate(),await this.host.updateComplete,e.popover&&e.isConnected&&e.showPopover();const b=e.getSurfacePositionClientRect?e.getSurfacePositionClientRect():e.getBoundingClientRect(),y=t.getSurfacePositionClientRect?t.getSurfacePositionClientRect():t.getBoundingClientRect(),[_,x]=h.split("-"),[w,k]=c.split("-"),S="ltr"===getComputedStyle(e).direction;let{blockInset:$,blockOutOfBoundsCorrection:C,surfaceBlockProperty:R}=this.calculateBlock({surfaceRect:b,anchorRect:y,anchorBlock:w,surfaceBlock:_,yOffset:a,positioning:o,windowInnerHeight:u,blockScrollbarHeight:m});if(C&&!l){const e="start"===_?"end":"start",t="start"===w?"end":"start",i=this.calculateBlock({surfaceRect:b,anchorRect:y,anchorBlock:t,surfaceBlock:e,yOffset:a,positioning:o,windowInnerHeight:u,blockScrollbarHeight:m});C>i.blockOutOfBoundsCorrection&&($=i.blockInset,C=i.blockOutOfBoundsCorrection,R=i.surfaceBlockProperty)}let{inlineInset:E,inlineOutOfBoundsCorrection:I,surfaceInlineProperty:T}=this.calculateInline({surfaceRect:b,anchorRect:y,anchorInline:k,surfaceInline:x,xOffset:s,positioning:o,isLTR:S,windowInnerWidth:p,inlineScrollbarWidth:v});if(I&&!n){const e="start"===x?"end":"start",t="start"===k?"end":"start",i=this.calculateInline({surfaceRect:b,anchorRect:y,anchorInline:t,surfaceInline:e,xOffset:s,positioning:o,isLTR:S,windowInnerWidth:p,inlineScrollbarWidth:v});Math.abs(I)>Math.abs(i.inlineOutOfBoundsCorrection)&&(E=i.inlineInset,I=i.inlineOutOfBoundsCorrection,T=i.surfaceInlineProperty)}"move"===d&&($-=C,E-=I),this.surfaceStylesInternal={display:"block",opacity:"1",[R]:`${$}px`,[T]:`${E}px`},"resize"===d&&(C&&(this.surfaceStylesInternal.height=b.height-C+"px"),I&&(this.surfaceStylesInternal.width=b.width-I+"px")),this.host.requestUpdate()}calculateBlock(e){const{surfaceRect:t,anchorRect:i,anchorBlock:r,surfaceBlock:o,yOffset:s,positioning:a,windowInnerHeight:l,blockScrollbarHeight:n}=e,d="fixed"===a||"document"===a?1:0,c="document"===a?1:0,h="start"===o?1:0,p="end"===o?1:0,u=(r!==o?1:0)*i.height+s,f=h*i.top+p*(l-i.bottom-n);return{blockInset:d*f+c*(h*window.scrollY-p*window.scrollY)+u,blockOutOfBoundsCorrection:Math.abs(Math.min(0,l-f-u-t.height)),surfaceBlockProperty:"start"===o?"inset-block-start":"inset-block-end"}}calculateInline(e){const{isLTR:t,surfaceInline:i,anchorInline:r,anchorRect:o,surfaceRect:s,xOffset:a,positioning:l,windowInnerWidth:n,inlineScrollbarWidth:d}=e,c="fixed"===l||"document"===l?1:0,h="document"===l?1:0,p=t?1:0,u=t?0:1,f="start"===i?1:0,g="end"===i?1:0,m=(r!==i?1:0)*o.width+a,v=p*(f*o.left+g*(n-o.right-d))+u*(f*(n-o.right-d)+g*o.left);let b="start"===i?"inset-inline-start":"inset-inline-end";return"document"!==l&&"fixed"!==l||(b="start"===i&&t||"end"===i&&!t?"left":"right"),{inlineInset:c*v+m+h*(p*(f*window.scrollX-g*window.scrollX)+u*(g*window.scrollX-f*window.scrollX)),inlineOutOfBoundsCorrection:Math.abs(Math.min(0,n-v-m-s.width)),surfaceInlineProperty:b}}hostUpdate(){this.onUpdate()}hostUpdated(){this.onUpdate()}async onUpdate(){const e=this.getProperties();let t=!1;for(const[i,r]of Object.entries(e))if(t=t||r!==this.lastValues[i],t)break;const i=this.lastValues.isOpen!==e.isOpen,r=!!e.anchorEl,o=!!e.surfaceEl;t&&r&&o&&(this.lastValues.isOpen=e.isOpen,e.isOpen?(this.lastValues=e,await this.position(),e.onOpen()):i&&(await e.beforeClose(),this.close(),e.onClose()))}close(){this.surfaceStylesInternal={display:"none"},this.host.requestUpdate();const e=this.getProperties().surfaceEl;e?.popover&&e?.isConnected&&e.hidePopover()}}const kt=0,St=1,$t=2;class Ct{constructor(e){this.getProperties=e,this.typeaheadRecords=[],this.typaheadBuffer="",this.cancelTypeaheadTimeout=0,this.isTypingAhead=!1,this.lastActiveRecord=null,this.onKeydown=e=>{this.isTypingAhead?this.typeahead(e):this.beginTypeahead(e)},this.endTypeahead=()=>{this.isTypingAhead=!1,this.typaheadBuffer="",this.typeaheadRecords=[]}}get items(){return this.getProperties().getItems()}get active(){return this.getProperties().active}beginTypeahead(e){this.active&&("Space"===e.code||"Enter"===e.code||e.code.startsWith("Arrow")||"Escape"===e.code||(this.isTypingAhead=!0,this.typeaheadRecords=this.items.map((e,t)=>[t,e,e.typeaheadText.trim().toLowerCase()]),this.lastActiveRecord=this.typeaheadRecords.find(e=>0===e[St].tabIndex)??null,this.lastActiveRecord&&(this.lastActiveRecord[St].tabIndex=-1),this.typeahead(e)))}typeahead(e){if(e.defaultPrevented)return;if(clearTimeout(this.cancelTypeaheadTimeout),"Enter"===e.code||e.code.startsWith("Arrow")||"Escape"===e.code)return this.endTypeahead(),void(this.lastActiveRecord&&(this.lastActiveRecord[St].tabIndex=-1));"Space"===e.code&&e.preventDefault(),this.cancelTypeaheadTimeout=setTimeout(this.endTypeahead,this.getProperties().typeaheadBufferTime),this.typaheadBuffer+=e.key.toLowerCase();const t=this.lastActiveRecord?this.lastActiveRecord[kt]:-1,i=this.typeaheadRecords.length,r=e=>(e[kt]+i-t)%i,o=this.typeaheadRecords.filter(e=>!e[St].disabled&&e[$t].startsWith(this.typaheadBuffer)).sort((e,t)=>r(e)-r(t));if(0===o.length)return clearTimeout(this.cancelTypeaheadTimeout),this.lastActiveRecord&&(this.lastActiveRecord[St].tabIndex=-1),void this.endTypeahead();const s=1===this.typaheadBuffer.length;let a;a=this.lastActiveRecord===o[0]&&s?o[1]??o[0]:o[0],this.lastActiveRecord&&(this.lastActiveRecord[St].tabIndex=-1),this.lastActiveRecord=a,a[St].tabIndex=0,a[St].focus()}}const Rt=new Set([lt.ArrowDown,lt.ArrowUp,lt.Home,lt.End]),Et=new Set([lt.ArrowLeft,lt.ArrowRight,...Rt]);class It extends a{get openDirection(){return"start"===this.menuCorner.split("-")[0]?"DOWN":"UP"}get anchorElement(){return this.anchor?this.getRootNode().querySelector(`#${this.anchor}`):this.currentAnchorElement}set anchorElement(e){this.currentAnchorElement=e,this.requestUpdate("anchorElement")}constructor(){super(),this.anchor="",this.positioning="absolute",this.quick=!1,this.hasOverflow=!1,this.open=!1,this.xOffset=0,this.yOffset=0,this.noHorizontalFlip=!1,this.noVerticalFlip=!1,this.typeaheadDelay=200,this.anchorCorner=_t,this.menuCorner=xt,this.stayOpenOnOutsideClick=!1,this.stayOpenOnFocusout=!1,this.skipRestoreFocus=!1,this.defaultFocus=bt,this.noNavigationWrap=!1,this.typeaheadActive=!0,this.isSubmenu=!1,this.pointerPath=[],this.isRepositioning=!1,this.openCloseAnimationSignal=$(),this.listController=new nt({isItem:e=>e.hasAttribute("md-menu-item"),getPossibleItems:()=>this.slotItems,isRtl:()=>"rtl"===getComputedStyle(this).direction,deactivateItem:e=>{e.selected=!1,e.tabIndex=-1},activateItem:e=>{e.selected=!0,e.tabIndex=0},isNavigableKey:e=>{if(!this.isSubmenu)return Et.has(e);return e===("rtl"===getComputedStyle(this).direction?lt.ArrowLeft:lt.ArrowRight)||Rt.has(e)},wrapNavigation:()=>!this.noNavigationWrap}),this.lastFocusedElement=null,this.typeaheadController=new Ct(()=>({getItems:()=>this.items,typeaheadBufferTime:this.typeaheadDelay,active:this.typeaheadActive})),this.currentAnchorElement=null,this.internals=this.attachInternals(),this.menuPositionController=new wt(this,()=>({anchorCorner:this.anchorCorner,surfaceCorner:this.menuCorner,surfaceEl:this.surfaceEl,anchorEl:this.anchorElement,positioning:"popover"===this.positioning?"document":this.positioning,isOpen:this.open,xOffset:this.xOffset,yOffset:this.yOffset,disableBlockFlip:this.noVerticalFlip,disableInlineFlip:this.noHorizontalFlip,onOpen:this.onOpened,beforeClose:this.beforeClose,onClose:this.onClosed,repositionStrategy:this.hasOverflow&&"popover"!==this.positioning?"move":"resize"})),this.onWindowResize=()=>{this.isRepositioning||"document"!==this.positioning&&"fixed"!==this.positioning&&"popover"!==this.positioning||(this.isRepositioning=!0,this.reposition(),this.isRepositioning=!1)},this.handleFocusout=async e=>{const t=this.anchorElement;if(this.stayOpenOnFocusout||!this.open||this.pointerPath.includes(t))return;if(e.relatedTarget){if(gt(e.relatedTarget,this)||0!==this.pointerPath.length&>(e.relatedTarget,t))return}else if(this.pointerPath.includes(this))return;const i=this.skipRestoreFocus;this.skipRestoreFocus=!0,this.close(),await this.updateComplete,this.skipRestoreFocus=i},this.onOpened=async()=>{this.lastFocusedElement=function(e=document){let t=e.activeElement;for(;t&&t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}();const e=this.items,t=tt(e);t&&this.defaultFocus!==mt&&(t.item.tabIndex=-1);let i=!this.quick;switch(this.quick?this.dispatchEvent(new Event("opening")):i=!!await this.animateOpen(),this.defaultFocus){case bt:const t=it(e);t&&(t.tabIndex=0,t.focus(),await t.updateComplete);break;case yt:const i=rt(e);i&&(i.tabIndex=0,i.focus(),await i.updateComplete);break;case vt:this.focus()}i||this.dispatchEvent(new Event("opened"))},this.beforeClose=async()=>{this.open=!1,this.skipRestoreFocus||this.lastFocusedElement?.focus?.(),this.quick||await this.animateClose()},this.onClosed=()=>{this.quick&&(this.dispatchEvent(new Event("closing")),this.dispatchEvent(new Event("closed")))},this.onWindowPointerdown=e=>{this.pointerPath=e.composedPath()},this.onDocumentClick=e=>{if(!this.open)return;const t=e.composedPath();this.stayOpenOnOutsideClick||t.includes(this)||t.includes(this.anchorElement)||(this.open=!1)},this.internals.role="menu",this.addEventListener("keydown",this.handleKeydown),this.addEventListener("keydown",this.captureKeydown,{capture:!0}),this.addEventListener("focusout",this.handleFocusout)}get items(){return this.listController.items}willUpdate(e){e.has("open")&&(this.open?this.removeAttribute("aria-hidden"):this.setAttribute("aria-hidden","true"))}update(e){e.has("open")&&(this.open?this.setUpGlobalEventListeners():this.cleanUpGlobalEventListeners()),e.has("positioning")&&"popover"===this.positioning&&!this.showPopover&&(this.positioning="fixed"),super.update(e)}connectedCallback(){super.connectedCallback(),this.open&&this.setUpGlobalEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this.cleanUpGlobalEventListeners()}getBoundingClientRect(){return this.surfaceEl?this.surfaceEl.getBoundingClientRect():super.getBoundingClientRect()}getClientRects(){return this.surfaceEl?this.surfaceEl.getClientRects():super.getClientRects()}render(){return this.renderSurface()}renderSurface(){return u`
|
|
186
186
|
<div
|
|
187
187
|
class="menu ${h(this.getSurfaceClasses())}"
|
|
188
188
|
style=${Ae(this.menuPositionController.surfaceStyles)}
|
|
@@ -201,7 +201,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
201
201
|
@stay-open-on-focusout=${this.handleStayOpenOnFocusout}
|
|
202
202
|
@close-on-focusout=${this.handleCloseOnFocusout}
|
|
203
203
|
@slotchange=${this.listController.onSlotchange}></slot>`}renderElevation(){return u`<md-elevation part="elevation"></md-elevation>`}getSurfaceClasses(){return{open:this.open,fixed:"fixed"===this.positioning,"has-overflow":this.hasOverflow}}captureKeydown(e){e.target===this&&!e.defaultPrevented&&ft(e.code)&&(e.preventDefault(),this.close()),this.typeaheadController.onKeydown(e)}async animateOpen(){const e=this.surfaceEl,t=this.slotEl;if(!e||!t)return!0;const i=this.openDirection;this.dispatchEvent(new Event("opening")),e.classList.toggle("animating",!0);const r=this.openCloseAnimationSignal.start(),o=e.offsetHeight,s="UP"===i,a=this.items,l=250/a.length,n=e.animate([{height:"0px"},{height:`${o}px`}],{duration:500,easing:y.EMPHASIZED}),d=t.animate([{transform:s?`translateY(-${o}px)`:""},{transform:""}],{duration:500,easing:y.EMPHASIZED}),c=e.animate([{opacity:0},{opacity:1}],50),h=[];for(let e=0;e<a.length;e++){const t=a[s?a.length-1-e:e],i=t.animate([{opacity:0},{opacity:1}],{duration:250,delay:l*e});t.classList.toggle("md-menu-hidden",!0),i.addEventListener("finish",()=>{t.classList.toggle("md-menu-hidden",!1)}),h.push([t,i])}let p=e=>{};const u=new Promise(e=>{p=e});return r.addEventListener("abort",()=>{n.cancel(),d.cancel(),c.cancel(),h.forEach(([e,t])=>{e.classList.toggle("md-menu-hidden",!1),t.cancel()}),p(!0)}),n.addEventListener("finish",()=>{e.classList.toggle("animating",!1),this.openCloseAnimationSignal.finish(),p(!1)}),await u}animateClose(){let e;const t=new Promise(t=>{e=t}),i=this.surfaceEl,r=this.slotEl;if(!i||!r)return e(!1),t;const o="UP"===this.openDirection;this.dispatchEvent(new Event("closing")),i.classList.toggle("animating",!0);const s=this.openCloseAnimationSignal.start(),a=i.offsetHeight,l=this.items,n=150,d=50/l.length,c=i.animate([{height:`${a}px`},{height:.35*a+"px"}],{duration:n,easing:y.EMPHASIZED_ACCELERATE}),h=r.animate([{transform:""},{transform:o?`translateY(-${.65*a}px)`:""}],{duration:n,easing:y.EMPHASIZED_ACCELERATE}),p=i.animate([{opacity:1},{opacity:0}],{duration:50,delay:100}),u=[];for(let e=0;e<l.length;e++){const t=l[o?e:l.length-1-e],i=t.animate([{opacity:1},{opacity:0}],{duration:50,delay:50+d*e});i.addEventListener("finish",()=>{t.classList.toggle("md-menu-hidden",!0)}),u.push([t,i])}return s.addEventListener("abort",()=>{c.cancel(),h.cancel(),p.cancel(),u.forEach(([e,t])=>{t.cancel(),e.classList.toggle("md-menu-hidden",!1)}),e(!1)}),c.addEventListener("finish",()=>{i.classList.toggle("animating",!1),u.forEach(([e])=>{e.classList.toggle("md-menu-hidden",!1)}),this.openCloseAnimationSignal.finish(),this.dispatchEvent(new Event("closed")),e(!0)}),t}handleKeydown(e){this.pointerPath=[],this.listController.handleKeydown(e)}setUpGlobalEventListeners(){document.addEventListener("click",this.onDocumentClick,{capture:!0}),window.addEventListener("pointerdown",this.onWindowPointerdown),document.addEventListener("resize",this.onWindowResize,{passive:!0}),window.addEventListener("resize",this.onWindowResize,{passive:!0})}cleanUpGlobalEventListeners(){document.removeEventListener("click",this.onDocumentClick,{capture:!0}),window.removeEventListener("pointerdown",this.onWindowPointerdown),document.removeEventListener("resize",this.onWindowResize),window.removeEventListener("resize",this.onWindowResize)}onCloseMenu(){this.close()}onDeactivateItems(e){e.stopPropagation(),this.listController.onDeactivateItems()}onRequestActivation(e){e.stopPropagation(),this.listController.onRequestActivation(e)}handleDeactivateTypeahead(e){e.stopPropagation(),this.typeaheadActive=!1}handleActivateTypeahead(e){e.stopPropagation(),this.typeaheadActive=!0}handleStayOpenOnFocusout(e){e.stopPropagation(),this.stayOpenOnFocusout=!0}handleCloseOnFocusout(e){e.stopPropagation(),this.stayOpenOnFocusout=!1}close(){this.open=!1;this.slotItems.forEach(e=>{e.close?.()})}show(){this.open=!0}activateNextItem(){return this.listController.activateNextItem()??null}activatePreviousItem(){return this.listController.activatePreviousItem()??null}reposition(){this.open&&this.menuPositionController.position()}}i([n(".menu")],It.prototype,"surfaceEl",void 0),i([n("slot")],It.prototype,"slotEl",void 0),i([r()],It.prototype,"anchor",void 0),i([r()],It.prototype,"positioning",void 0),i([r({type:Boolean})],It.prototype,"quick",void 0),i([r({type:Boolean,attribute:"has-overflow"})],It.prototype,"hasOverflow",void 0),i([r({type:Boolean,reflect:!0})],It.prototype,"open",void 0),i([r({type:Number,attribute:"x-offset"})],It.prototype,"xOffset",void 0),i([r({type:Number,attribute:"y-offset"})],It.prototype,"yOffset",void 0),i([r({type:Boolean,attribute:"no-horizontal-flip"})],It.prototype,"noHorizontalFlip",void 0),i([r({type:Boolean,attribute:"no-vertical-flip"})],It.prototype,"noVerticalFlip",void 0),i([r({type:Number,attribute:"typeahead-delay"})],It.prototype,"typeaheadDelay",void 0),i([r({attribute:"anchor-corner"})],It.prototype,"anchorCorner",void 0),i([r({attribute:"menu-corner"})],It.prototype,"menuCorner",void 0),i([r({type:Boolean,attribute:"stay-open-on-outside-click"})],It.prototype,"stayOpenOnOutsideClick",void 0),i([r({type:Boolean,attribute:"stay-open-on-focusout"})],It.prototype,"stayOpenOnFocusout",void 0),i([r({type:Boolean,attribute:"skip-restore-focus"})],It.prototype,"skipRestoreFocus",void 0),i([r({attribute:"default-focus"})],It.prototype,"defaultFocus",void 0),i([r({type:Boolean,attribute:"no-navigation-wrap"})],It.prototype,"noNavigationWrap",void 0),i([v({flatten:!0})],It.prototype,"slotItems",void 0),i([l()],It.prototype,"typeaheadActive",void 0);const Tt=g`:host{--md-elevation-level: var(--md-menu-container-elevation, 2);--md-elevation-shadow-color: var(--md-menu-container-shadow-color, var(--md-sys-color-shadow, #000));min-width:112px;color:unset;display:contents}md-focus-ring{--md-focus-ring-shape: var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px))}.menu{border-radius:var(--md-menu-container-shape, var(--md-sys-shape-corner-extra-small, 4px));display:none;inset:auto;border:none;padding:0px;overflow:visible;background-color:rgba(0,0,0,0);color:inherit;opacity:0;z-index:20;position:absolute;user-select:none;max-height:inherit;height:inherit;min-width:inherit;max-width:inherit;scrollbar-width:inherit}.menu::backdrop{display:none}.fixed{position:fixed}.items{display:block;list-style-type:none;margin:0;outline:none;box-sizing:border-box;background-color:var(--md-menu-container-color, var(--md-sys-color-surface-container, #f3edf7));height:inherit;max-height:inherit;overflow:auto;min-width:inherit;max-width:inherit;border-radius:inherit;scrollbar-width:inherit}.item-padding{padding-block:8px}.has-overflow:not([popover]) .items{overflow:visible}.has-overflow.animating .items,.animating .items{overflow:hidden}.has-overflow.animating .items{pointer-events:none}.animating ::slotted(.md-menu-hidden){opacity:0}slot{display:block;height:inherit;max-height:inherit}::slotted(:is(md-divider,[role=separator])){margin:8px 0}@media(forced-colors: active){.menu{border-style:solid;border-color:CanvasText;border-width:1px}}
|
|
204
|
-
`;let Ft=class extends It{};Ft.styles=[Tt],Ft=i([
|
|
204
|
+
`;let Ft=class extends It{};Ft.styles=[Tt],Ft=i([_("md-menu")],Ft);class Lt extends X{computeValidity(e){return this.selectControl||(this.selectControl=document.createElement("select")),b(u`<option value=${e.value}></option>`,this.selectControl),this.selectControl.value=e.value,this.selectControl.required=e.required,{validity:this.selectControl.validity,validationMessage:this.selectControl.validationMessage}}equals(e,t){return e.value===t.value&&e.required===t.required}copy({value:e,required:t}){return{value:e,required:t}}}var Ot;const At=Symbol("value"),zt=o(We(K(Y(s(a)))));class Pt extends zt{get value(){return this[At]}set value(e){this.lastUserSetValue=e,this.select(e)}get options(){return this.menu?.items??[]}get selectedIndex(){const[e,t]=(this.getSelectedOptions()??[])[0]??[];return t??-1}set selectedIndex(e){this.lastUserSetSelectedIndex=e,this.selectIndex(e)}get selectedOptions(){return(this.getSelectedOptions()??[]).map(([e])=>e)}get hasError(){return this.error||this.nativeError}constructor(){super(),this.quick=!1,this.required=!1,this.errorText="",this.label="",this.noAsterisk=!1,this.supportingText="",this.error=!1,this.menuPositioning="popover",this.clampMenuWidth=!1,this.typeaheadDelay=200,this.hasLeadingIcon=!1,this.displayText="",this.menuAlign="start",this[Ot]="",this.lastUserSetValue=null,this.lastUserSetSelectedIndex=null,this.lastSelectedOption=null,this.lastSelectedOptionRecords=[],this.nativeError=!1,this.nativeErrorText="",this.focused=!1,this.open=!1,this.defaultFocus=mt,this.prevOpen=this.open,this.selectWidth=0,this.addEventListener("focus",this.handleFocus.bind(this)),this.addEventListener("blur",this.handleBlur.bind(this))}select(e){const t=this.options.find(t=>t.value===e);t&&this.selectItem(t)}selectIndex(e){const t=this.options[e];t&&this.selectItem(t)}reset(){for(const e of this.options)e.selected=e.hasAttribute("selected");this.updateValueAndDisplayText(),this.nativeError=!1,this.nativeErrorText=""}[(Ot=At,Pe)](e){e?.preventDefault();const t=this.getErrorText();this.nativeError=!!e,this.nativeErrorText=this.validationMessage,t===this.getErrorText()&&this.field?.reannounceError()}update(e){if(this.hasUpdated||this.initUserSelection(),this.prevOpen!==this.open&&this.open){const e=this.getBoundingClientRect();this.selectWidth=e.width}this.prevOpen=this.open,super.update(e)}render(){return u`
|
|
205
205
|
<span
|
|
206
206
|
class="select ${h(this.getRenderClasses())}"
|
|
207
207
|
@focusout=${this.handleFocusout}>
|
|
@@ -283,7 +283,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
283
283
|
@request-deselection=${this.handleRequestDeselection}>
|
|
284
284
|
${this.renderMenuContent()}
|
|
285
285
|
</md-menu>
|
|
286
|
-
</div>`}renderMenuContent(){return u`<slot></slot>`}handleKeydown(e){if(this.open||this.disabled||!this.menu)return;const t=this.menu.typeaheadController,i="Space"===e.code||"ArrowDown"===e.code||"ArrowUp"===e.code||"End"===e.code||"Home"===e.code||"Enter"===e.code;if(!t.isTypingAhead&&i){switch(e.preventDefault(),this.open=!0,e.code){case"Space":case"ArrowDown":case"Enter":this.defaultFocus=mt;break;case"End":this.defaultFocus=yt;break;case"ArrowUp":case"Home":this.defaultFocus=bt}return}if(1===e.key.length){t.onKeydown(e),e.preventDefault();const{lastActiveRecord:i}=t;if(!i)return;this.labelEl?.setAttribute?.("aria-live","polite");this.selectItem(i[St])&&this.dispatchInteractionEvents()}}handleClick(){this.open=!this.open}handleFocus(){this.focused=!0}handleBlur(){this.focused=!1}handleFocusout(e){e.relatedTarget&>(e.relatedTarget,this)||(this.open=!1)}getSelectedOptions(){if(!this.menu)return this.lastSelectedOptionRecords=[],null;const e=this.menu.items;return this.lastSelectedOptionRecords=function(e){const t=[];for(let i=0;i<e.length;i++){const r=e[i];r.selected&&t.push([r,i])}return t}(e),this.lastSelectedOptionRecords}async getUpdateComplete(){return await(this.menu?.updateComplete),super.getUpdateComplete()}updateValueAndDisplayText(){const e=this.getSelectedOptions()??[];let t=!1;if(e.length){const[i]=e[0];t=this.lastSelectedOption!==i,this.lastSelectedOption=i,this[At]=i.value,this.displayText=i.displayText}else t=null!==this.lastSelectedOption,this.lastSelectedOption=null,this[At]="",this.displayText="";return t}async handleOpening(e){if(this.labelEl?.removeAttribute?.("aria-live"),this.redispatchEvent(e),this.defaultFocus!==mt)return;const t=this.menu.items,i=tt(t)?.item;let[r]=this.lastSelectedOptionRecords[0]??[null];i&&i!==r&&(i.tabIndex=-1),r=r??t[0],r&&(r.tabIndex=0,r.focus())}redispatchEvent(e){f(this,e)}handleClosed(e){this.open=!1,this.redispatchEvent(e)}handleCloseMenu(e){const t=e.detail.reason,i=e.detail.itemPath[0];this.open=!1;let r=!1;var o;"click-selection"===t.kind||"keydown"===t.kind&&(o=t.key,Object.values(ct).some(e=>e===o))?r=this.selectItem(i):(i.tabIndex=-1,i.blur()),r&&this.dispatchInteractionEvents()}selectItem(e){return(this.getSelectedOptions()??[]).forEach(([t])=>{e!==t&&(t.selected=!1)}),e.selected=!0,this.updateValueAndDisplayText()}handleRequestSelection(e){const t=e.target;this.lastSelectedOptionRecords.some(([e])=>e===t)||this.selectItem(t)}handleRequestDeselection(e){const t=e.target;this.lastSelectedOptionRecords.some(([e])=>e===t)&&this.updateValueAndDisplayText()}initUserSelection(){this.lastUserSetValue&&!this.lastSelectedOptionRecords.length?this.select(this.lastUserSetValue):null===this.lastUserSetSelectedIndex||this.lastSelectedOptionRecords.length?this.updateValueAndDisplayText():this.selectIndex(this.lastUserSetSelectedIndex)}handleIconChange(){this.hasLeadingIcon=this.leadingIcons.length>0}dispatchInteractionEvents(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0}))}getErrorText(){return this.error?this.errorText:this.nativeErrorText}[J](){return this.value}formResetCallback(){this.reset()}formStateRestoreCallback(e){this.value=e}click(){this.field?.click()}[V](){return new Lt(()=>this)}[N](){return this.field}}zt.shadowRootOptions={...a.shadowRootOptions,delegatesFocus:!0},i([r({type:Boolean})],zt.prototype,"quick",void 0),i([r({type:Boolean})],zt.prototype,"required",void 0),i([r({type:String,attribute:"error-text"})],zt.prototype,"errorText",void 0),i([r()],zt.prototype,"label",void 0),i([r({type:Boolean,attribute:"no-asterisk"})],zt.prototype,"noAsterisk",void 0),i([r({type:String,attribute:"supporting-text"})],zt.prototype,"supportingText",void 0),i([r({type:Boolean,reflect:!0})],zt.prototype,"error",void 0),i([r({attribute:"menu-positioning"})],zt.prototype,"menuPositioning",void 0),i([r({type:Boolean,attribute:"clamp-menu-width"})],zt.prototype,"clampMenuWidth",void 0),i([r({type:Number,attribute:"typeahead-delay"})],zt.prototype,"typeaheadDelay",void 0),i([r({type:Boolean,attribute:"has-leading-icon"})],zt.prototype,"hasLeadingIcon",void 0),i([r({attribute:"display-text"})],zt.prototype,"displayText",void 0),i([r({attribute:"menu-align"})],zt.prototype,"menuAlign",void 0),i([r()],zt.prototype,"value",null),i([r({type:Number,attribute:"selected-index"})],zt.prototype,"selectedIndex",null),i([l()],zt.prototype,"nativeError",void 0),i([l()],zt.prototype,"nativeErrorText",void 0),i([l()],zt.prototype,"focused",void 0),i([l()],zt.prototype,"open",void 0),i([l()],zt.prototype,"defaultFocus",void 0),i([n(".field")],zt.prototype,"field",void 0),i([n("md-menu")],zt.prototype,"menu",void 0),i([n("#label")],zt.prototype,"labelEl",void 0),i([v({slot:"leading-icon",flatten:!0})],zt.prototype,"leadingIcons",void 0);class Bt extends zt{constructor(){super(...arguments),this.fieldTag=ge`md-filled-field`}}const Dt=g`:host{--_text-field-active-indicator-color: var(--md-filled-select-text-field-active-indicator-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-active-indicator-height: var(--md-filled-select-text-field-active-indicator-height, 1px);--_text-field-container-color: var(--md-filled-select-text-field-container-color, var(--md-sys-color-surface-container-highest, #e6e0e9));--_text-field-disabled-active-indicator-color: var(--md-filled-select-text-field-disabled-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-active-indicator-height: var(--md-filled-select-text-field-disabled-active-indicator-height, 1px);--_text-field-disabled-active-indicator-opacity: var(--md-filled-select-text-field-disabled-active-indicator-opacity, 0.38);--_text-field-disabled-container-color: var(--md-filled-select-text-field-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-container-opacity: var(--md-filled-select-text-field-disabled-container-opacity, 0.04);--_text-field-disabled-input-text-color: var(--md-filled-select-text-field-disabled-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-input-text-opacity: var(--md-filled-select-text-field-disabled-input-text-opacity, 0.38);--_text-field-disabled-label-text-color: var(--md-filled-select-text-field-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-label-text-opacity: var(--md-filled-select-text-field-disabled-label-text-opacity, 0.38);--_text-field-disabled-leading-icon-color: var(--md-filled-select-text-field-disabled-leading-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-leading-icon-opacity: var(--md-filled-select-text-field-disabled-leading-icon-opacity, 0.38);--_text-field-disabled-supporting-text-color: var(--md-filled-select-text-field-disabled-supporting-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-supporting-text-opacity: var(--md-filled-select-text-field-disabled-supporting-text-opacity, 0.38);--_text-field-disabled-trailing-icon-color: var(--md-filled-select-text-field-disabled-trailing-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-trailing-icon-opacity: var(--md-filled-select-text-field-disabled-trailing-icon-opacity, 0.38);--_text-field-error-active-indicator-color: var(--md-filled-select-text-field-error-active-indicator-color, var(--md-sys-color-error, #b3261e));--_text-field-error-focus-active-indicator-color: var(--md-filled-select-text-field-error-focus-active-indicator-color, var(--md-sys-color-error, #b3261e));--_text-field-error-focus-input-text-color: var(--md-filled-select-text-field-error-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-error-focus-label-text-color: var(--md-filled-select-text-field-error-focus-label-text-color, var(--md-sys-color-error, #b3261e));--_text-field-error-focus-leading-icon-color: var(--md-filled-select-text-field-error-focus-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-error-focus-supporting-text-color: var(--md-filled-select-text-field-error-focus-supporting-text-color, var(--md-sys-color-error, #b3261e));--_text-field-error-focus-trailing-icon-color: var(--md-filled-select-text-field-error-focus-trailing-icon-color, var(--md-sys-color-error, #b3261e));--_text-field-error-hover-active-indicator-color: var(--md-filled-select-text-field-error-hover-active-indicator-color, var(--md-sys-color-on-error-container, #410e0b));--_text-field-error-hover-input-text-color: var(--md-filled-select-text-field-error-hover-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-error-hover-label-text-color: var(--md-filled-select-text-field-error-hover-label-text-color, var(--md-sys-color-on-error-container, #410e0b));--_text-field-error-hover-leading-icon-color: var(--md-filled-select-text-field-error-hover-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-error-hover-state-layer-color: var(--md-filled-select-text-field-error-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-error-hover-state-layer-opacity: var(--md-filled-select-text-field-error-hover-state-layer-opacity, 0.08);--_text-field-error-hover-supporting-text-color: var(--md-filled-select-text-field-error-hover-supporting-text-color, var(--md-sys-color-error, #b3261e));--_text-field-error-hover-trailing-icon-color: var(--md-filled-select-text-field-error-hover-trailing-icon-color, var(--md-sys-color-on-error-container, #410e0b));--_text-field-error-input-text-color: var(--md-filled-select-text-field-error-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-error-label-text-color: var(--md-filled-select-text-field-error-label-text-color, var(--md-sys-color-error, #b3261e));--_text-field-error-leading-icon-color: var(--md-filled-select-text-field-error-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-error-supporting-text-color: var(--md-filled-select-text-field-error-supporting-text-color, var(--md-sys-color-error, #b3261e));--_text-field-error-trailing-icon-color: var(--md-filled-select-text-field-error-trailing-icon-color, var(--md-sys-color-error, #b3261e));--_text-field-focus-active-indicator-color: var(--md-filled-select-text-field-focus-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_text-field-focus-active-indicator-height: var(--md-filled-select-text-field-focus-active-indicator-height, 3px);--_text-field-focus-input-text-color: var(--md-filled-select-text-field-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-focus-label-text-color: var(--md-filled-select-text-field-focus-label-text-color, var(--md-sys-color-primary, #6750a4));--_text-field-focus-leading-icon-color: var(--md-filled-select-text-field-focus-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-focus-supporting-text-color: var(--md-filled-select-text-field-focus-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-focus-trailing-icon-color: var(--md-filled-select-text-field-focus-trailing-icon-color, var(--md-sys-color-primary, #6750a4));--_text-field-hover-active-indicator-color: var(--md-filled-select-text-field-hover-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-hover-active-indicator-height: var(--md-filled-select-text-field-hover-active-indicator-height, 1px);--_text-field-hover-input-text-color: var(--md-filled-select-text-field-hover-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-hover-label-text-color: var(--md-filled-select-text-field-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-hover-leading-icon-color: var(--md-filled-select-text-field-hover-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-hover-state-layer-color: var(--md-filled-select-text-field-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-hover-state-layer-opacity: var(--md-filled-select-text-field-hover-state-layer-opacity, 0.08);--_text-field-hover-supporting-text-color: var(--md-filled-select-text-field-hover-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-hover-trailing-icon-color: var(--md-filled-select-text-field-hover-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-input-text-color: var(--md-filled-select-text-field-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-input-text-font: var(--md-filled-select-text-field-input-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_text-field-input-text-line-height: var(--md-filled-select-text-field-input-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_text-field-input-text-size: var(--md-filled-select-text-field-input-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_text-field-input-text-weight: var(--md-filled-select-text-field-input-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_text-field-label-text-color: var(--md-filled-select-text-field-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-label-text-font: var(--md-filled-select-text-field-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_text-field-label-text-line-height: var(--md-filled-select-text-field-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_text-field-label-text-populated-line-height: var(--md-filled-select-text-field-label-text-populated-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_text-field-label-text-populated-size: var(--md-filled-select-text-field-label-text-populated-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_text-field-label-text-size: var(--md-filled-select-text-field-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_text-field-label-text-weight: var(--md-filled-select-text-field-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_text-field-leading-icon-color: var(--md-filled-select-text-field-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-leading-icon-size: var(--md-filled-select-text-field-leading-icon-size, 24px);--_text-field-supporting-text-color: var(--md-filled-select-text-field-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-supporting-text-font: var(--md-filled-select-text-field-supporting-text-font, var(--md-sys-typescale-body-small-font, var(--md-ref-typeface-plain, Roboto)));--_text-field-supporting-text-line-height: var(--md-filled-select-text-field-supporting-text-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_text-field-supporting-text-size: var(--md-filled-select-text-field-supporting-text-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_text-field-supporting-text-weight: var(--md-filled-select-text-field-supporting-text-weight, var(--md-sys-typescale-body-small-weight, var(--md-ref-typeface-weight-regular, 400)));--_text-field-trailing-icon-color: var(--md-filled-select-text-field-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-trailing-icon-size: var(--md-filled-select-text-field-trailing-icon-size, 24px);--_text-field-container-shape-start-start: var(--md-filled-select-text-field-container-shape-start-start, var(--md-filled-select-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_text-field-container-shape-start-end: var(--md-filled-select-text-field-container-shape-start-end, var(--md-filled-select-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_text-field-container-shape-end-end: var(--md-filled-select-text-field-container-shape-end-end, var(--md-filled-select-text-field-container-shape, var(--md-sys-shape-corner-none, 0px)));--_text-field-container-shape-end-start: var(--md-filled-select-text-field-container-shape-end-start, var(--md-filled-select-text-field-container-shape, var(--md-sys-shape-corner-none, 0px)));--md-filled-field-active-indicator-color: var(--_text-field-active-indicator-color);--md-filled-field-active-indicator-height: var(--_text-field-active-indicator-height);--md-filled-field-container-color: var(--_text-field-container-color);--md-filled-field-container-shape-end-end: var(--_text-field-container-shape-end-end);--md-filled-field-container-shape-end-start: var(--_text-field-container-shape-end-start);--md-filled-field-container-shape-start-end: var(--_text-field-container-shape-start-end);--md-filled-field-container-shape-start-start: var(--_text-field-container-shape-start-start);--md-filled-field-content-color: var(--_text-field-input-text-color);--md-filled-field-content-font: var(--_text-field-input-text-font);--md-filled-field-content-line-height: var(--_text-field-input-text-line-height);--md-filled-field-content-size: var(--_text-field-input-text-size);--md-filled-field-content-weight: var(--_text-field-input-text-weight);--md-filled-field-disabled-active-indicator-color: var(--_text-field-disabled-active-indicator-color);--md-filled-field-disabled-active-indicator-height: var(--_text-field-disabled-active-indicator-height);--md-filled-field-disabled-active-indicator-opacity: var(--_text-field-disabled-active-indicator-opacity);--md-filled-field-disabled-container-color: var(--_text-field-disabled-container-color);--md-filled-field-disabled-container-opacity: var(--_text-field-disabled-container-opacity);--md-filled-field-disabled-content-color: var(--_text-field-disabled-input-text-color);--md-filled-field-disabled-content-opacity: var(--_text-field-disabled-input-text-opacity);--md-filled-field-disabled-label-text-color: var(--_text-field-disabled-label-text-color);--md-filled-field-disabled-label-text-opacity: var(--_text-field-disabled-label-text-opacity);--md-filled-field-disabled-leading-content-color: var(--_text-field-disabled-leading-icon-color);--md-filled-field-disabled-leading-content-opacity: var(--_text-field-disabled-leading-icon-opacity);--md-filled-field-disabled-supporting-text-color: var(--_text-field-disabled-supporting-text-color);--md-filled-field-disabled-supporting-text-opacity: var(--_text-field-disabled-supporting-text-opacity);--md-filled-field-disabled-trailing-content-color: var(--_text-field-disabled-trailing-icon-color);--md-filled-field-disabled-trailing-content-opacity: var(--_text-field-disabled-trailing-icon-opacity);--md-filled-field-error-active-indicator-color: var(--_text-field-error-active-indicator-color);--md-filled-field-error-content-color: var(--_text-field-error-input-text-color);--md-filled-field-error-focus-active-indicator-color: var(--_text-field-error-focus-active-indicator-color);--md-filled-field-error-focus-content-color: var(--_text-field-error-focus-input-text-color);--md-filled-field-error-focus-label-text-color: var(--_text-field-error-focus-label-text-color);--md-filled-field-error-focus-leading-content-color: var(--_text-field-error-focus-leading-icon-color);--md-filled-field-error-focus-supporting-text-color: var(--_text-field-error-focus-supporting-text-color);--md-filled-field-error-focus-trailing-content-color: var(--_text-field-error-focus-trailing-icon-color);--md-filled-field-error-hover-active-indicator-color: var(--_text-field-error-hover-active-indicator-color);--md-filled-field-error-hover-content-color: var(--_text-field-error-hover-input-text-color);--md-filled-field-error-hover-label-text-color: var(--_text-field-error-hover-label-text-color);--md-filled-field-error-hover-leading-content-color: var(--_text-field-error-hover-leading-icon-color);--md-filled-field-error-hover-state-layer-color: var(--_text-field-error-hover-state-layer-color);--md-filled-field-error-hover-state-layer-opacity: var(--_text-field-error-hover-state-layer-opacity);--md-filled-field-error-hover-supporting-text-color: var(--_text-field-error-hover-supporting-text-color);--md-filled-field-error-hover-trailing-content-color: var(--_text-field-error-hover-trailing-icon-color);--md-filled-field-error-label-text-color: var(--_text-field-error-label-text-color);--md-filled-field-error-leading-content-color: var(--_text-field-error-leading-icon-color);--md-filled-field-error-supporting-text-color: var(--_text-field-error-supporting-text-color);--md-filled-field-error-trailing-content-color: var(--_text-field-error-trailing-icon-color);--md-filled-field-focus-active-indicator-color: var(--_text-field-focus-active-indicator-color);--md-filled-field-focus-active-indicator-height: var(--_text-field-focus-active-indicator-height);--md-filled-field-focus-content-color: var(--_text-field-focus-input-text-color);--md-filled-field-focus-label-text-color: var(--_text-field-focus-label-text-color);--md-filled-field-focus-leading-content-color: var(--_text-field-focus-leading-icon-color);--md-filled-field-focus-supporting-text-color: var(--_text-field-focus-supporting-text-color);--md-filled-field-focus-trailing-content-color: var(--_text-field-focus-trailing-icon-color);--md-filled-field-hover-active-indicator-color: var(--_text-field-hover-active-indicator-color);--md-filled-field-hover-active-indicator-height: var(--_text-field-hover-active-indicator-height);--md-filled-field-hover-content-color: var(--_text-field-hover-input-text-color);--md-filled-field-hover-label-text-color: var(--_text-field-hover-label-text-color);--md-filled-field-hover-leading-content-color: var(--_text-field-hover-leading-icon-color);--md-filled-field-hover-state-layer-color: var(--_text-field-hover-state-layer-color);--md-filled-field-hover-state-layer-opacity: var(--_text-field-hover-state-layer-opacity);--md-filled-field-hover-supporting-text-color: var(--_text-field-hover-supporting-text-color);--md-filled-field-hover-trailing-content-color: var(--_text-field-hover-trailing-icon-color);--md-filled-field-label-text-color: var(--_text-field-label-text-color);--md-filled-field-label-text-font: var(--_text-field-label-text-font);--md-filled-field-label-text-line-height: var(--_text-field-label-text-line-height);--md-filled-field-label-text-populated-line-height: var(--_text-field-label-text-populated-line-height);--md-filled-field-label-text-populated-size: var(--_text-field-label-text-populated-size);--md-filled-field-label-text-size: var(--_text-field-label-text-size);--md-filled-field-label-text-weight: var(--_text-field-label-text-weight);--md-filled-field-leading-content-color: var(--_text-field-leading-icon-color);--md-filled-field-supporting-text-color: var(--_text-field-supporting-text-color);--md-filled-field-supporting-text-font: var(--_text-field-supporting-text-font);--md-filled-field-supporting-text-line-height: var(--_text-field-supporting-text-line-height);--md-filled-field-supporting-text-size: var(--_text-field-supporting-text-size);--md-filled-field-supporting-text-weight: var(--_text-field-supporting-text-weight);--md-filled-field-trailing-content-color: var(--_text-field-trailing-icon-color)}[has-start] .icon.leading{font-size:var(--_text-field-leading-icon-size);height:var(--_text-field-leading-icon-size);width:var(--_text-field-leading-icon-size)}.icon.trailing{font-size:var(--_text-field-trailing-icon-size);height:var(--_text-field-trailing-icon-size);width:var(--_text-field-trailing-icon-size)}
|
|
286
|
+
</div>`}renderMenuContent(){return u`<slot></slot>`}handleKeydown(e){if(this.open||this.disabled||!this.menu)return;const t=this.menu.typeaheadController,i="Space"===e.code||"ArrowDown"===e.code||"ArrowUp"===e.code||"End"===e.code||"Home"===e.code||"Enter"===e.code;if(!t.isTypingAhead&&i){switch(e.preventDefault(),this.open=!0,e.code){case"Space":case"ArrowDown":case"Enter":this.defaultFocus=mt;break;case"End":this.defaultFocus=yt;break;case"ArrowUp":case"Home":this.defaultFocus=bt}return}if(1===e.key.length){t.onKeydown(e),e.preventDefault();const{lastActiveRecord:i}=t;if(!i)return;this.labelEl?.setAttribute?.("aria-live","polite");this.selectItem(i[St])&&this.dispatchInteractionEvents()}}handleClick(){this.open=!this.open}handleFocus(){this.focused=!0}handleBlur(){this.focused=!1}handleFocusout(e){e.relatedTarget&>(e.relatedTarget,this)||(this.open=!1)}getSelectedOptions(){if(!this.menu)return this.lastSelectedOptionRecords=[],null;const e=this.menu.items;return this.lastSelectedOptionRecords=function(e){const t=[];for(let i=0;i<e.length;i++){const r=e[i];r.selected&&t.push([r,i])}return t}(e),this.lastSelectedOptionRecords}async getUpdateComplete(){return await(this.menu?.updateComplete),super.getUpdateComplete()}updateValueAndDisplayText(){const e=this.getSelectedOptions()??[];let t=!1;if(e.length){const[i]=e[0];t=this.lastSelectedOption!==i,this.lastSelectedOption=i,this[At]=i.value,this.displayText=i.displayText}else t=null!==this.lastSelectedOption,this.lastSelectedOption=null,this[At]="",this.displayText="";return t}async handleOpening(e){if(this.labelEl?.removeAttribute?.("aria-live"),this.redispatchEvent(e),this.defaultFocus!==mt)return;const t=this.menu.items,i=tt(t)?.item;let[r]=this.lastSelectedOptionRecords[0]??[null];i&&i!==r&&(i.tabIndex=-1),r=r??t[0],r&&(r.tabIndex=0,r.focus())}redispatchEvent(e){f(this,e)}handleClosed(e){this.open=!1,this.redispatchEvent(e)}handleCloseMenu(e){const t=e.detail.reason,i=e.detail.itemPath[0];this.open=!1;let r=!1;var o;"click-selection"===t.kind||"keydown"===t.kind&&(o=t.key,Object.values(ct).some(e=>e===o))?r=this.selectItem(i):(i.tabIndex=-1,i.blur()),r&&this.dispatchInteractionEvents()}selectItem(e){return(this.getSelectedOptions()??[]).forEach(([t])=>{e!==t&&(t.selected=!1)}),e.selected=!0,this.updateValueAndDisplayText()}handleRequestSelection(e){const t=e.target;this.lastSelectedOptionRecords.some(([e])=>e===t)||this.selectItem(t)}handleRequestDeselection(e){const t=e.target;this.lastSelectedOptionRecords.some(([e])=>e===t)&&this.updateValueAndDisplayText()}initUserSelection(){this.lastUserSetValue&&!this.lastSelectedOptionRecords.length?this.select(this.lastUserSetValue):null===this.lastUserSetSelectedIndex||this.lastSelectedOptionRecords.length?this.updateValueAndDisplayText():this.selectIndex(this.lastUserSetSelectedIndex)}handleIconChange(){this.hasLeadingIcon=this.leadingIcons.length>0}dispatchInteractionEvents(){this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0}))}getErrorText(){return this.error?this.errorText:this.nativeErrorText}[J](){return this.value}formResetCallback(){this.reset()}formStateRestoreCallback(e){this.value=e}click(){this.field?.click()}[V](){return new Lt(()=>this)}[N](){return this.field}}Pt.shadowRootOptions={...a.shadowRootOptions,delegatesFocus:!0},i([r({type:Boolean})],Pt.prototype,"quick",void 0),i([r({type:Boolean})],Pt.prototype,"required",void 0),i([r({type:String,attribute:"error-text"})],Pt.prototype,"errorText",void 0),i([r()],Pt.prototype,"label",void 0),i([r({type:Boolean,attribute:"no-asterisk"})],Pt.prototype,"noAsterisk",void 0),i([r({type:String,attribute:"supporting-text"})],Pt.prototype,"supportingText",void 0),i([r({type:Boolean,reflect:!0})],Pt.prototype,"error",void 0),i([r({attribute:"menu-positioning"})],Pt.prototype,"menuPositioning",void 0),i([r({type:Boolean,attribute:"clamp-menu-width"})],Pt.prototype,"clampMenuWidth",void 0),i([r({type:Number,attribute:"typeahead-delay"})],Pt.prototype,"typeaheadDelay",void 0),i([r({type:Boolean,attribute:"has-leading-icon"})],Pt.prototype,"hasLeadingIcon",void 0),i([r({attribute:"display-text"})],Pt.prototype,"displayText",void 0),i([r({attribute:"menu-align"})],Pt.prototype,"menuAlign",void 0),i([r()],Pt.prototype,"value",null),i([r({type:Number,attribute:"selected-index"})],Pt.prototype,"selectedIndex",null),i([l()],Pt.prototype,"nativeError",void 0),i([l()],Pt.prototype,"nativeErrorText",void 0),i([l()],Pt.prototype,"focused",void 0),i([l()],Pt.prototype,"open",void 0),i([l()],Pt.prototype,"defaultFocus",void 0),i([n(".field")],Pt.prototype,"field",void 0),i([n("md-menu")],Pt.prototype,"menu",void 0),i([n("#label")],Pt.prototype,"labelEl",void 0),i([v({slot:"leading-icon",flatten:!0})],Pt.prototype,"leadingIcons",void 0);class Bt extends Pt{constructor(){super(...arguments),this.fieldTag=ge`md-filled-field`}}const Dt=g`:host{--_text-field-active-indicator-color: var(--md-filled-select-text-field-active-indicator-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-active-indicator-height: var(--md-filled-select-text-field-active-indicator-height, 1px);--_text-field-container-color: var(--md-filled-select-text-field-container-color, var(--md-sys-color-surface-container-highest, #e6e0e9));--_text-field-disabled-active-indicator-color: var(--md-filled-select-text-field-disabled-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-active-indicator-height: var(--md-filled-select-text-field-disabled-active-indicator-height, 1px);--_text-field-disabled-active-indicator-opacity: var(--md-filled-select-text-field-disabled-active-indicator-opacity, 0.38);--_text-field-disabled-container-color: var(--md-filled-select-text-field-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-container-opacity: var(--md-filled-select-text-field-disabled-container-opacity, 0.04);--_text-field-disabled-input-text-color: var(--md-filled-select-text-field-disabled-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-input-text-opacity: var(--md-filled-select-text-field-disabled-input-text-opacity, 0.38);--_text-field-disabled-label-text-color: var(--md-filled-select-text-field-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-label-text-opacity: var(--md-filled-select-text-field-disabled-label-text-opacity, 0.38);--_text-field-disabled-leading-icon-color: var(--md-filled-select-text-field-disabled-leading-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-leading-icon-opacity: var(--md-filled-select-text-field-disabled-leading-icon-opacity, 0.38);--_text-field-disabled-supporting-text-color: var(--md-filled-select-text-field-disabled-supporting-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-supporting-text-opacity: var(--md-filled-select-text-field-disabled-supporting-text-opacity, 0.38);--_text-field-disabled-trailing-icon-color: var(--md-filled-select-text-field-disabled-trailing-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-disabled-trailing-icon-opacity: var(--md-filled-select-text-field-disabled-trailing-icon-opacity, 0.38);--_text-field-error-active-indicator-color: var(--md-filled-select-text-field-error-active-indicator-color, var(--md-sys-color-error, #b3261e));--_text-field-error-focus-active-indicator-color: var(--md-filled-select-text-field-error-focus-active-indicator-color, var(--md-sys-color-error, #b3261e));--_text-field-error-focus-input-text-color: var(--md-filled-select-text-field-error-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-error-focus-label-text-color: var(--md-filled-select-text-field-error-focus-label-text-color, var(--md-sys-color-error, #b3261e));--_text-field-error-focus-leading-icon-color: var(--md-filled-select-text-field-error-focus-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-error-focus-supporting-text-color: var(--md-filled-select-text-field-error-focus-supporting-text-color, var(--md-sys-color-error, #b3261e));--_text-field-error-focus-trailing-icon-color: var(--md-filled-select-text-field-error-focus-trailing-icon-color, var(--md-sys-color-error, #b3261e));--_text-field-error-hover-active-indicator-color: var(--md-filled-select-text-field-error-hover-active-indicator-color, var(--md-sys-color-on-error-container, #410e0b));--_text-field-error-hover-input-text-color: var(--md-filled-select-text-field-error-hover-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-error-hover-label-text-color: var(--md-filled-select-text-field-error-hover-label-text-color, var(--md-sys-color-on-error-container, #410e0b));--_text-field-error-hover-leading-icon-color: var(--md-filled-select-text-field-error-hover-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-error-hover-state-layer-color: var(--md-filled-select-text-field-error-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-error-hover-state-layer-opacity: var(--md-filled-select-text-field-error-hover-state-layer-opacity, 0.08);--_text-field-error-hover-supporting-text-color: var(--md-filled-select-text-field-error-hover-supporting-text-color, var(--md-sys-color-error, #b3261e));--_text-field-error-hover-trailing-icon-color: var(--md-filled-select-text-field-error-hover-trailing-icon-color, var(--md-sys-color-on-error-container, #410e0b));--_text-field-error-input-text-color: var(--md-filled-select-text-field-error-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-error-label-text-color: var(--md-filled-select-text-field-error-label-text-color, var(--md-sys-color-error, #b3261e));--_text-field-error-leading-icon-color: var(--md-filled-select-text-field-error-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-error-supporting-text-color: var(--md-filled-select-text-field-error-supporting-text-color, var(--md-sys-color-error, #b3261e));--_text-field-error-trailing-icon-color: var(--md-filled-select-text-field-error-trailing-icon-color, var(--md-sys-color-error, #b3261e));--_text-field-focus-active-indicator-color: var(--md-filled-select-text-field-focus-active-indicator-color, var(--md-sys-color-primary, #6750a4));--_text-field-focus-active-indicator-height: var(--md-filled-select-text-field-focus-active-indicator-height, 3px);--_text-field-focus-input-text-color: var(--md-filled-select-text-field-focus-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-focus-label-text-color: var(--md-filled-select-text-field-focus-label-text-color, var(--md-sys-color-primary, #6750a4));--_text-field-focus-leading-icon-color: var(--md-filled-select-text-field-focus-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-focus-supporting-text-color: var(--md-filled-select-text-field-focus-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-focus-trailing-icon-color: var(--md-filled-select-text-field-focus-trailing-icon-color, var(--md-sys-color-primary, #6750a4));--_text-field-hover-active-indicator-color: var(--md-filled-select-text-field-hover-active-indicator-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-hover-active-indicator-height: var(--md-filled-select-text-field-hover-active-indicator-height, 1px);--_text-field-hover-input-text-color: var(--md-filled-select-text-field-hover-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-hover-label-text-color: var(--md-filled-select-text-field-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-hover-leading-icon-color: var(--md-filled-select-text-field-hover-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-hover-state-layer-color: var(--md-filled-select-text-field-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-hover-state-layer-opacity: var(--md-filled-select-text-field-hover-state-layer-opacity, 0.08);--_text-field-hover-supporting-text-color: var(--md-filled-select-text-field-hover-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-hover-trailing-icon-color: var(--md-filled-select-text-field-hover-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-input-text-color: var(--md-filled-select-text-field-input-text-color, var(--md-sys-color-on-surface, #1d1b20));--_text-field-input-text-font: var(--md-filled-select-text-field-input-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_text-field-input-text-line-height: var(--md-filled-select-text-field-input-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_text-field-input-text-size: var(--md-filled-select-text-field-input-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_text-field-input-text-weight: var(--md-filled-select-text-field-input-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_text-field-label-text-color: var(--md-filled-select-text-field-label-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-label-text-font: var(--md-filled-select-text-field-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));--_text-field-label-text-line-height: var(--md-filled-select-text-field-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));--_text-field-label-text-populated-line-height: var(--md-filled-select-text-field-label-text-populated-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_text-field-label-text-populated-size: var(--md-filled-select-text-field-label-text-populated-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_text-field-label-text-size: var(--md-filled-select-text-field-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));--_text-field-label-text-weight: var(--md-filled-select-text-field-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));--_text-field-leading-icon-color: var(--md-filled-select-text-field-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-leading-icon-size: var(--md-filled-select-text-field-leading-icon-size, 24px);--_text-field-supporting-text-color: var(--md-filled-select-text-field-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-supporting-text-font: var(--md-filled-select-text-field-supporting-text-font, var(--md-sys-typescale-body-small-font, var(--md-ref-typeface-plain, Roboto)));--_text-field-supporting-text-line-height: var(--md-filled-select-text-field-supporting-text-line-height, var(--md-sys-typescale-body-small-line-height, 1rem));--_text-field-supporting-text-size: var(--md-filled-select-text-field-supporting-text-size, var(--md-sys-typescale-body-small-size, 0.75rem));--_text-field-supporting-text-weight: var(--md-filled-select-text-field-supporting-text-weight, var(--md-sys-typescale-body-small-weight, var(--md-ref-typeface-weight-regular, 400)));--_text-field-trailing-icon-color: var(--md-filled-select-text-field-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f));--_text-field-trailing-icon-size: var(--md-filled-select-text-field-trailing-icon-size, 24px);--_text-field-container-shape-start-start: var(--md-filled-select-text-field-container-shape-start-start, var(--md-filled-select-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_text-field-container-shape-start-end: var(--md-filled-select-text-field-container-shape-start-end, var(--md-filled-select-text-field-container-shape, var(--md-sys-shape-corner-extra-small, 4px)));--_text-field-container-shape-end-end: var(--md-filled-select-text-field-container-shape-end-end, var(--md-filled-select-text-field-container-shape, var(--md-sys-shape-corner-none, 0px)));--_text-field-container-shape-end-start: var(--md-filled-select-text-field-container-shape-end-start, var(--md-filled-select-text-field-container-shape, var(--md-sys-shape-corner-none, 0px)));--md-filled-field-active-indicator-color: var(--_text-field-active-indicator-color);--md-filled-field-active-indicator-height: var(--_text-field-active-indicator-height);--md-filled-field-container-color: var(--_text-field-container-color);--md-filled-field-container-shape-end-end: var(--_text-field-container-shape-end-end);--md-filled-field-container-shape-end-start: var(--_text-field-container-shape-end-start);--md-filled-field-container-shape-start-end: var(--_text-field-container-shape-start-end);--md-filled-field-container-shape-start-start: var(--_text-field-container-shape-start-start);--md-filled-field-content-color: var(--_text-field-input-text-color);--md-filled-field-content-font: var(--_text-field-input-text-font);--md-filled-field-content-line-height: var(--_text-field-input-text-line-height);--md-filled-field-content-size: var(--_text-field-input-text-size);--md-filled-field-content-weight: var(--_text-field-input-text-weight);--md-filled-field-disabled-active-indicator-color: var(--_text-field-disabled-active-indicator-color);--md-filled-field-disabled-active-indicator-height: var(--_text-field-disabled-active-indicator-height);--md-filled-field-disabled-active-indicator-opacity: var(--_text-field-disabled-active-indicator-opacity);--md-filled-field-disabled-container-color: var(--_text-field-disabled-container-color);--md-filled-field-disabled-container-opacity: var(--_text-field-disabled-container-opacity);--md-filled-field-disabled-content-color: var(--_text-field-disabled-input-text-color);--md-filled-field-disabled-content-opacity: var(--_text-field-disabled-input-text-opacity);--md-filled-field-disabled-label-text-color: var(--_text-field-disabled-label-text-color);--md-filled-field-disabled-label-text-opacity: var(--_text-field-disabled-label-text-opacity);--md-filled-field-disabled-leading-content-color: var(--_text-field-disabled-leading-icon-color);--md-filled-field-disabled-leading-content-opacity: var(--_text-field-disabled-leading-icon-opacity);--md-filled-field-disabled-supporting-text-color: var(--_text-field-disabled-supporting-text-color);--md-filled-field-disabled-supporting-text-opacity: var(--_text-field-disabled-supporting-text-opacity);--md-filled-field-disabled-trailing-content-color: var(--_text-field-disabled-trailing-icon-color);--md-filled-field-disabled-trailing-content-opacity: var(--_text-field-disabled-trailing-icon-opacity);--md-filled-field-error-active-indicator-color: var(--_text-field-error-active-indicator-color);--md-filled-field-error-content-color: var(--_text-field-error-input-text-color);--md-filled-field-error-focus-active-indicator-color: var(--_text-field-error-focus-active-indicator-color);--md-filled-field-error-focus-content-color: var(--_text-field-error-focus-input-text-color);--md-filled-field-error-focus-label-text-color: var(--_text-field-error-focus-label-text-color);--md-filled-field-error-focus-leading-content-color: var(--_text-field-error-focus-leading-icon-color);--md-filled-field-error-focus-supporting-text-color: var(--_text-field-error-focus-supporting-text-color);--md-filled-field-error-focus-trailing-content-color: var(--_text-field-error-focus-trailing-icon-color);--md-filled-field-error-hover-active-indicator-color: var(--_text-field-error-hover-active-indicator-color);--md-filled-field-error-hover-content-color: var(--_text-field-error-hover-input-text-color);--md-filled-field-error-hover-label-text-color: var(--_text-field-error-hover-label-text-color);--md-filled-field-error-hover-leading-content-color: var(--_text-field-error-hover-leading-icon-color);--md-filled-field-error-hover-state-layer-color: var(--_text-field-error-hover-state-layer-color);--md-filled-field-error-hover-state-layer-opacity: var(--_text-field-error-hover-state-layer-opacity);--md-filled-field-error-hover-supporting-text-color: var(--_text-field-error-hover-supporting-text-color);--md-filled-field-error-hover-trailing-content-color: var(--_text-field-error-hover-trailing-icon-color);--md-filled-field-error-label-text-color: var(--_text-field-error-label-text-color);--md-filled-field-error-leading-content-color: var(--_text-field-error-leading-icon-color);--md-filled-field-error-supporting-text-color: var(--_text-field-error-supporting-text-color);--md-filled-field-error-trailing-content-color: var(--_text-field-error-trailing-icon-color);--md-filled-field-focus-active-indicator-color: var(--_text-field-focus-active-indicator-color);--md-filled-field-focus-active-indicator-height: var(--_text-field-focus-active-indicator-height);--md-filled-field-focus-content-color: var(--_text-field-focus-input-text-color);--md-filled-field-focus-label-text-color: var(--_text-field-focus-label-text-color);--md-filled-field-focus-leading-content-color: var(--_text-field-focus-leading-icon-color);--md-filled-field-focus-supporting-text-color: var(--_text-field-focus-supporting-text-color);--md-filled-field-focus-trailing-content-color: var(--_text-field-focus-trailing-icon-color);--md-filled-field-hover-active-indicator-color: var(--_text-field-hover-active-indicator-color);--md-filled-field-hover-active-indicator-height: var(--_text-field-hover-active-indicator-height);--md-filled-field-hover-content-color: var(--_text-field-hover-input-text-color);--md-filled-field-hover-label-text-color: var(--_text-field-hover-label-text-color);--md-filled-field-hover-leading-content-color: var(--_text-field-hover-leading-icon-color);--md-filled-field-hover-state-layer-color: var(--_text-field-hover-state-layer-color);--md-filled-field-hover-state-layer-opacity: var(--_text-field-hover-state-layer-opacity);--md-filled-field-hover-supporting-text-color: var(--_text-field-hover-supporting-text-color);--md-filled-field-hover-trailing-content-color: var(--_text-field-hover-trailing-icon-color);--md-filled-field-label-text-color: var(--_text-field-label-text-color);--md-filled-field-label-text-font: var(--_text-field-label-text-font);--md-filled-field-label-text-line-height: var(--_text-field-label-text-line-height);--md-filled-field-label-text-populated-line-height: var(--_text-field-label-text-populated-line-height);--md-filled-field-label-text-populated-size: var(--_text-field-label-text-populated-size);--md-filled-field-label-text-size: var(--_text-field-label-text-size);--md-filled-field-label-text-weight: var(--_text-field-label-text-weight);--md-filled-field-leading-content-color: var(--_text-field-leading-icon-color);--md-filled-field-supporting-text-color: var(--_text-field-supporting-text-color);--md-filled-field-supporting-text-font: var(--_text-field-supporting-text-font);--md-filled-field-supporting-text-line-height: var(--_text-field-supporting-text-line-height);--md-filled-field-supporting-text-size: var(--_text-field-supporting-text-size);--md-filled-field-supporting-text-weight: var(--_text-field-supporting-text-weight);--md-filled-field-trailing-content-color: var(--_text-field-trailing-icon-color)}[has-start] .icon.leading{font-size:var(--_text-field-leading-icon-size);height:var(--_text-field-leading-icon-size);width:var(--_text-field-leading-icon-size)}.icon.trailing{font-size:var(--_text-field-trailing-icon-size);height:var(--_text-field-trailing-icon-size);width:var(--_text-field-trailing-icon-size)}
|
|
287
287
|
`,Ut=g`:host{color:unset;min-width:210px;display:flex}.field{cursor:default;outline:none}.select{position:relative;flex-direction:column}.icon.trailing svg,.icon ::slotted(*){fill:currentColor}.icon ::slotted(*){width:inherit;height:inherit;font-size:inherit}.icon slot{display:flex;height:100%;width:100%;align-items:center;justify-content:center}.icon.trailing :is(.up,.down){opacity:0;transition:opacity 75ms linear 75ms}.select:not(.open) .down,.select.open .up{opacity:1}.field,.select,md-menu{min-width:inherit;width:inherit;max-width:inherit;display:flex}md-menu{min-width:var(--__menu-min-width);max-width:var(--__menu-max-width, inherit)}.menu-wrapper{width:0px;height:0px;max-width:inherit}md-menu ::slotted(:not[disabled]){cursor:pointer}.field,.select{width:100%}:host{display:inline-flex}:host([disabled]){pointer-events:none}
|
|
288
288
|
`;class Mt extends Bt{}Mt.styles=[Ut,Dt],customElements.define("ew-filled-select",Mt);const Wt=g`:host{display:flex;--md-ripple-hover-color: var(--md-menu-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity: var(--md-menu-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color: var(--md-menu-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity: var(--md-menu-item-pressed-state-layer-opacity, 0.12)}:host([disabled]){opacity:var(--md-menu-item-disabled-opacity, 0.3);pointer-events:none}md-focus-ring{z-index:1;--md-focus-ring-shape: 8px}a,button,li{background:none;border:none;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.list-item:not(.disabled){cursor:pointer}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;color:var(--md-menu-item-label-text-color, var(--md-sys-color-on-surface, #1d1b20));font-family:var(--md-menu-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-menu-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-menu-item-label-text-weight, var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400)));min-height:var(--md-menu-item-one-line-container-height, 56px);padding-top:var(--md-menu-item-top-space, 12px);padding-bottom:var(--md-menu-item-bottom-space, 12px);padding-inline-start:var(--md-menu-item-leading-space, 16px);padding-inline-end:var(--md-menu-item-trailing-space, 16px)}md-item[multiline]{min-height:var(--md-menu-item-two-line-container-height, 72px)}[slot=supporting-text]{color:var(--md-menu-item-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-menu-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, 0.875rem));line-height:var(--md-menu-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-menu-item-supporting-text-weight, var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400)))}[slot=trailing-supporting-text]{color:var(--md-menu-item-trailing-supporting-text-color, var(--md-sys-color-on-surface-variant, #49454f));font-family:var(--md-menu-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-menu-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, 0.6875rem));line-height:var(--md-menu-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-menu-item-trailing-supporting-text-weight, var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-menu-item-leading-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}[slot=end]{color:var(--md-menu-item-trailing-icon-color, var(--md-sys-color-on-surface-variant, #49454f))}.list-item{background-color:var(--md-menu-item-container-color, transparent)}.list-item.selected{background-color:var(--md-menu-item-selected-container-color, var(--md-sys-color-secondary-container, #e8def8))}.selected:not(.disabled) ::slotted(*){color:var(--md-menu-item-selected-label-text-color, var(--md-sys-color-on-secondary-container, #1d192b))}@media(forced-colors: active){:host([disabled]),:host([disabled]) slot{color:GrayText;opacity:1}.list-item{position:relative}.list-item.selected::before{content:"";position:absolute;inset:0;box-sizing:border-box;border-radius:inherit;pointer-events:none;border:3px double CanvasText}}
|
|
289
289
|
`;class Ht extends a{constructor(){super(...arguments),this.multiline=!1}render(){return u`
|
|
@@ -302,7 +302,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
302
302
|
<slot class="non-text" name="trailing-supporting-text"></slot>
|
|
303
303
|
<slot class="non-text" name="end"></slot>
|
|
304
304
|
`}handleTextSlotChange(){let e=!1,t=0;for(const i of this.textSlots)if(Vt(i)&&(t+=1),t>1){e=!0;break}this.multiline=e}}function Vt(e){for(const t of e.assignedNodes({flatten:!0})){const e=t.nodeType===Node.ELEMENT_NODE,i=t.nodeType===Node.TEXT_NODE&&t.textContent?.match(/\S/);if(e||i)return!0}return!1}i([r({type:Boolean,reflect:!0})],Ht.prototype,"multiline",void 0),i([function(t){return(i,r)=>e(i,r,{get(){return(this.renderRoot??(H??=document.createDocumentFragment())).querySelectorAll(t)}})}(".text slot")],Ht.prototype,"textSlots",void 0);const Nt=g`:host{color:var(--md-sys-color-on-surface, #1d1b20);font-family:var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto));font-size:var(--md-sys-typescale-body-large-size, 1rem);font-weight:var(--md-sys-typescale-body-large-weight, var(--md-ref-typeface-weight-regular, 400));line-height:var(--md-sys-typescale-body-large-line-height, 1.5rem);align-items:center;box-sizing:border-box;display:flex;gap:16px;min-height:56px;overflow:hidden;padding:12px 16px;position:relative;text-overflow:ellipsis}:host([multiline]){min-height:72px}[name=overline]{color:var(--md-sys-color-on-surface-variant, #49454f);font-family:var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto));font-size:var(--md-sys-typescale-label-small-size, 0.6875rem);font-weight:var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500));line-height:var(--md-sys-typescale-label-small-line-height, 1rem)}[name=supporting-text]{color:var(--md-sys-color-on-surface-variant, #49454f);font-family:var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto));font-size:var(--md-sys-typescale-body-medium-size, 0.875rem);font-weight:var(--md-sys-typescale-body-medium-weight, var(--md-ref-typeface-weight-regular, 400));line-height:var(--md-sys-typescale-body-medium-line-height, 1.25rem)}[name=trailing-supporting-text]{color:var(--md-sys-color-on-surface-variant, #49454f);font-family:var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto));font-size:var(--md-sys-typescale-label-small-size, 0.6875rem);font-weight:var(--md-sys-typescale-label-small-weight, var(--md-ref-typeface-weight-medium, 500));line-height:var(--md-sys-typescale-label-small-line-height, 1rem)}[name=container]::slotted(*){inset:0;position:absolute}.default-slot{display:inline}.default-slot,.text ::slotted(*){overflow:hidden;text-overflow:ellipsis}.text{display:flex;flex:1;flex-direction:column;overflow:hidden}
|
|
305
|
-
`;let qt=class extends Ht{};qt.styles=[Nt],qt=i([
|
|
305
|
+
`;let qt=class extends Ht{};qt.styles=[Nt],qt=i([_("md-item")],qt);class Gt{constructor(e,t){this.host=e,this.internalTypeaheadText=null,this.onClick=()=>{this.host.keepOpen||this.host.dispatchEvent(dt(this.host,{kind:ht}))},this.onKeydown=e=>{if(this.host.href&&"Enter"===e.code){const e=this.getInteractiveElement();e instanceof HTMLAnchorElement&&e.click()}if(e.defaultPrevented)return;const t=e.code;this.host.keepOpen&&"Escape"!==t||ft(t)&&(e.preventDefault(),this.host.dispatchEvent(dt(this.host,{kind:pt,key:t})))},this.getHeadlineElements=t.getHeadlineElements,this.getSupportingTextElements=t.getSupportingTextElements,this.getDefaultElements=t.getDefaultElements,this.getInteractiveElement=t.getInteractiveElement,this.host.addController(this)}get typeaheadText(){if(null!==this.internalTypeaheadText)return this.internalTypeaheadText;const e=this.getHeadlineElements(),t=[];return e.forEach(e=>{e.textContent&&e.textContent.trim()&&t.push(e.textContent.trim())}),0===t.length&&this.getDefaultElements().forEach(e=>{e.textContent&&e.textContent.trim()&&t.push(e.textContent.trim())}),0===t.length&&this.getSupportingTextElements().forEach(e=>{e.textContent&&e.textContent.trim()&&t.push(e.textContent.trim())}),t.join(" ")}get tagName(){switch(this.host.type){case"link":return"a";case"button":return"button";default:return"li"}}get role(){return"option"===this.host.type?"option":"menuitem"}hostConnected(){this.host.toggleAttribute("md-menu-item",!0)}hostUpdate(){this.host.href&&(this.host.type="link")}setTypeaheadText(e){this.internalTypeaheadText=e}}class jt{get role(){return this.menuItemController.role}get typeaheadText(){return this.menuItemController.typeaheadText}setTypeaheadText(e){this.menuItemController.setTypeaheadText(e)}get displayText(){return null!==this.internalDisplayText?this.internalDisplayText:this.menuItemController.typeaheadText}setDisplayText(e){this.internalDisplayText=e}constructor(e,t){this.host=e,this.internalDisplayText=null,this.firstUpdate=!0,this.onClick=()=>{this.menuItemController.onClick()},this.onKeydown=e=>{this.menuItemController.onKeydown(e)},this.lastSelected=this.host.selected,this.menuItemController=new Gt(e,t),e.addController(this)}hostUpdate(){this.lastSelected!==this.host.selected&&(this.host.ariaSelected=this.host.selected?"true":"false")}hostUpdated(){this.lastSelected===this.host.selected||this.firstUpdate||(this.host.selected?this.host.dispatchEvent(new Event("request-selection",{bubbles:!0,composed:!0})):this.host.dispatchEvent(new Event("request-deselection",{bubbles:!0,composed:!0}))),this.lastSelected=this.host.selected,this.firstUpdate=!1}}const Kt=o(a);class Jt extends Kt{constructor(){super(...arguments),this.disabled=!1,this.isMenuItem=!0,this.selected=!1,this.value="",this.type="option",this.selectOptionController=new jt(this,{getHeadlineElements:()=>this.headlineElements,getSupportingTextElements:()=>this.supportingTextElements,getDefaultElements:()=>this.defaultElements,getInteractiveElement:()=>this.listItemRoot})}get typeaheadText(){return this.selectOptionController.typeaheadText}set typeaheadText(e){this.selectOptionController.setTypeaheadText(e)}get displayText(){return this.selectOptionController.displayText}set displayText(e){this.selectOptionController.setDisplayText(e)}render(){return this.renderListItem(u`
|
|
306
306
|
<md-item>
|
|
307
307
|
<div slot="container">
|
|
308
308
|
${this.renderRipple()} ${this.renderFocusRing()}
|
|
@@ -340,7 +340,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
340
340
|
<slot
|
|
341
341
|
name="trailing-supporting-text"
|
|
342
342
|
slot="trailing-supporting-text"></slot>
|
|
343
|
-
`}focus(){this.listItemRoot?.focus()}}Jt.shadowRootOptions={...a.shadowRootOptions,delegatesFocus:!0},i([r({type:Boolean,reflect:!0})],Jt.prototype,"disabled",void 0),i([r({type:Boolean,attribute:"md-menu-item",reflect:!0})],Jt.prototype,"isMenuItem",void 0),i([r({type:Boolean})],Jt.prototype,"selected",void 0),i([r()],Jt.prototype,"value",void 0),i([n(".list-item")],Jt.prototype,"listItemRoot",void 0),i([v({slot:"headline"})],Jt.prototype,"headlineElements",void 0),i([v({slot:"supporting-text"})],Jt.prototype,"supportingTextElements",void 0),i([function(t){return(i,r)=>{const{slot:o}=t??{},s="slot"+(o?`[name=${o}]`:":not([name])");return e(i,r,{get(){const e=this.renderRoot?.querySelector(s);return e?.assignedNodes(t)??[]}})}}({slot:""})],Jt.prototype,"defaultElements",void 0),i([r({attribute:"typeahead-text"})],Jt.prototype,"typeaheadText",null),i([r({attribute:"display-text"})],Jt.prototype,"displayText",null);class Zt extends Jt{}Zt.styles=[Wt],customElements.define("ew-select-option",Zt);class Yt extends
|
|
343
|
+
`}focus(){this.listItemRoot?.focus()}}Jt.shadowRootOptions={...a.shadowRootOptions,delegatesFocus:!0},i([r({type:Boolean,reflect:!0})],Jt.prototype,"disabled",void 0),i([r({type:Boolean,attribute:"md-menu-item",reflect:!0})],Jt.prototype,"isMenuItem",void 0),i([r({type:Boolean})],Jt.prototype,"selected",void 0),i([r()],Jt.prototype,"value",void 0),i([n(".list-item")],Jt.prototype,"listItemRoot",void 0),i([v({slot:"headline"})],Jt.prototype,"headlineElements",void 0),i([v({slot:"supporting-text"})],Jt.prototype,"supportingTextElements",void 0),i([function(t){return(i,r)=>{const{slot:o}=t??{},s="slot"+(o?`[name=${o}]`:":not([name])");return e(i,r,{get(){const e=this.renderRoot?.querySelector(s);return e?.assignedNodes(t)??[]}})}}({slot:""})],Jt.prototype,"defaultElements",void 0),i([r({attribute:"typeahead-text"})],Jt.prototype,"typeaheadText",null),i([r({attribute:"display-text"})],Jt.prototype,"displayText",null);class Zt extends Jt{}Zt.styles=[Wt],customElements.define("ew-select-option",Zt);class Yt extends R{}Yt.styles=[C],customElements.define("ew-divider",Yt);const Xt=new Set(Object.values(lt));class Qt extends a{get items(){return this.listController.items}constructor(){super(),this.listController=new nt({isItem:e=>e.hasAttribute("md-list-item"),getPossibleItems:()=>this.slotItems,isRtl:()=>"rtl"===getComputedStyle(this).direction,deactivateItem:e=>{e.tabIndex=-1},activateItem:e=>{e.tabIndex=0},isNavigableKey:e=>Xt.has(e),isActivatable:e=>!e.disabled&&"text"!==e.type}),this.internals=this.attachInternals(),this.internals.role="list",this.addEventListener("keydown",this.listController.handleKeydown)}render(){return u`
|
|
344
344
|
<slot
|
|
345
345
|
@deactivate-items=${this.listController.onDeactivateItems}
|
|
346
346
|
@request-activation=${this.listController.onRequestActivation}
|
|
@@ -738,7 +738,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
738
738
|
.danger {
|
|
739
739
|
--md-sys-color-primary: var(--danger-color, #db4437);
|
|
740
740
|
}
|
|
741
|
-
`,i([r({type:Object})],ni.prototype,"partition",void 0),i([r({type:Object})],ni.prototype,"espStub",void 0),i([r({type:Function})],ni.prototype,"logger",void 0),i([r({type:Function})],ni.prototype,"onClose",void 0),i([l()],ni.prototype,"_currentPath",void 0),i([l()],ni.prototype,"_files",void 0),i([l()],ni.prototype,"_fs",void 0),i([l()],ni.prototype,"_blockSize",void 0),i([l()],ni.prototype,"_usage",void 0),i([l()],ni.prototype,"_diskVersion",void 0),i([l()],ni.prototype,"_busy",void 0),i([l()],ni.prototype,"_selectedFile",void 0),i([l()],ni.prototype,"_flashProgress",void 0),i([l()],ni.prototype,"_isFlashing",void 0),i([l()],ni.prototype,"_flashOperation",void 0),ni=i([
|
|
741
|
+
`,i([r({type:Object})],ni.prototype,"partition",void 0),i([r({type:Object})],ni.prototype,"espStub",void 0),i([r({type:Function})],ni.prototype,"logger",void 0),i([r({type:Function})],ni.prototype,"onClose",void 0),i([l()],ni.prototype,"_currentPath",void 0),i([l()],ni.prototype,"_files",void 0),i([l()],ni.prototype,"_fs",void 0),i([l()],ni.prototype,"_blockSize",void 0),i([l()],ni.prototype,"_usage",void 0),i([l()],ni.prototype,"_diskVersion",void 0),i([l()],ni.prototype,"_busy",void 0),i([l()],ni.prototype,"_selectedFile",void 0),i([l()],ni.prototype,"_flashProgress",void 0),i([l()],ni.prototype,"_isFlashing",void 0),i([l()],ni.prototype,"_flashOperation",void 0),ni=i([_("ewt-littlefs-manager")],ni);const di=o(a);class ci extends di{constructor(){super(...arguments),this.value=0,this.max=1,this.indeterminate=!1,this.fourColor=!1}render(){const{ariaLabel:e}=this;return u`
|
|
742
742
|
<div
|
|
743
743
|
class="progress ${h(this.getRenderClasses())}"
|
|
744
744
|
role="progressbar"
|
|
@@ -844,14 +844,14 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
844
844
|
d="M12,21L15.6,16.2C14.6,15.45 13.35,15 12,15C10.65,15 9.4,15.45 8.4,16.2L12,21M12,3C7.95,3 4.21,4.34 1.2,6.6L3,9C5.5,7.12 8.62,6 12,6C15.38,6 18.5,7.12 21,9L22.8,6.6C19.79,4.34 16.05,3 12,3M12,9C9.3,9 6.81,9.89 4.8,11.4L6.6,13.8C8.1,12.67 9.97,12 12,12C14.03,12 15.9,12.67 17.4,13.8L19.2,11.4C17.19,9.89 14.7,9 12,9Z"
|
|
845
845
|
/>
|
|
846
846
|
</svg>
|
|
847
|
-
`,
|
|
847
|
+
`,_i=E`
|
|
848
848
|
<svg slot="start" viewBox="0 0 24 24">
|
|
849
849
|
<path
|
|
850
850
|
fill="currentColor"
|
|
851
851
|
d="M20,19V7H4V19H20M20,3A2,2 0 0,1 22,5V19A2,2 0 0,1 20,21H4A2,2 0 0,1 2,19V5C2,3.89 2.9,3 4,3H20M13,17V15H18V17H13M9.58,13L5.57,9H8.4L11.7,12.3C12.09,12.69 12.09,13.33 11.7,13.72L8.42,17H5.59L9.58,13Z"
|
|
852
852
|
/>
|
|
853
853
|
</svg>
|
|
854
|
-
`,
|
|
854
|
+
`,xi=E`
|
|
855
855
|
<svg slot="start" viewBox="0 0 24 24">
|
|
856
856
|
<path
|
|
857
857
|
fill="currentColor"
|
|
@@ -900,21 +900,21 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
900
900
|
d="M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"
|
|
901
901
|
/>
|
|
902
902
|
</svg>
|
|
903
|
-
`;const
|
|
903
|
+
`;const Ci=E`
|
|
904
904
|
<svg viewBox="0 0 24 24">
|
|
905
905
|
<path
|
|
906
906
|
fill="currentColor"
|
|
907
907
|
d="M13,14H11V10H13M13,18H11V16H13M1,21H23L12,2L1,21Z"
|
|
908
908
|
/>
|
|
909
909
|
</svg>
|
|
910
|
-
`,
|
|
910
|
+
`,Ri=E`
|
|
911
911
|
<svg viewBox="0 0 24 24">
|
|
912
912
|
<path
|
|
913
913
|
fill="currentColor"
|
|
914
914
|
d="M12,2C6.47,2 2,6.47 2,12C2,17.53 6.47,22 12,22C17.53,22 22,17.53 22,12C22,6.47 17.53,2 12,2M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8L10,17Z"
|
|
915
915
|
/>
|
|
916
916
|
</svg>
|
|
917
|
-
`,Ei=["I".charCodeAt(0),"M".charCodeAt(0),"P".charCodeAt(0),"R".charCodeAt(0),"O".charCodeAt(0),"V".charCodeAt(0),1];var Ii,Ti;!function(e){e[e.CURRENT_STATE=1]="CURRENT_STATE",e[e.ERROR_STATE=2]="ERROR_STATE",e[e.RPC=3]="RPC",e[e.RPC_RESULT=4]="RPC_RESULT"}(Ii||(Ii={})),function(e){e[e.READY=2]="READY",e[e.PROVISIONING=3]="PROVISIONING",e[e.PROVISIONED=4]="PROVISIONED"}(Ti||(Ti={}));const Fi={0:"NO_ERROR",1:"INVALID_RPC_PACKET",2:"UNKNOWN_RPC_COMMAND",3:"UNABLE_TO_CONNECT",254:"TIMEOUT",255:"UNKNOWN_ERROR"};class Li extends Error{constructor(){super("Port is not ready")}}const Oi=e=>"["+e.map(e=>((e,t=2)=>{let i=e.toString(16).toUpperCase();return i.startsWith("-")?"-0x"+i.substring(1).padStart(t,"0"):"0x"+i.padStart(t,"0")})(e)).join(", ")+"]";class Ai extends EventTarget{constructor(e,t){if(super(),this.port=e,this.logger=t,this.error=0,null===e.readable)throw new Error("Port is not readable");if(null===e.writable)throw new Error("Port is not writable")}async initialize(e=1e3){var t;if(this.logger.log("Initializing Improv Serial"),this._processInput(),await(t=1e3,new Promise(e=>setTimeout(e,t))),void 0===this._reader)throw new Li;try{await new Promise(async(t,i)=>{setTimeout(()=>i(new Error("Improv Wi-Fi Serial not detected")),e),await this.requestCurrentState(),t(void 0)}),await this.requestInfo()}catch(e){throw await this.close(),e}return this.info}async close(){this._reader&&await new Promise(e=>{this._reader.cancel(),this.addEventListener("disconnect",e,{once:!0})})}async requestCurrentState(){let e;try{await new Promise(async(t,i)=>{this.addEventListener("state-changed",t,{once:!0});e=this._sendRPCWithResponse(2,[]),e.catch(e=>{this.removeEventListener("state-changed",t),i(e)})})}catch(e){throw this._rpcFeedback=void 0,new Error(`Error fetching current state: ${e}`)}if(this.state!==Ti.PROVISIONED)return void(this._rpcFeedback=void 0);const t=await e;this.nextUrl=t[0]}async requestInfo(e){const t=await this._sendRPCWithResponse(3,[],e);this.info={firmware:t[0],version:t[1],name:t[3],chipFamily:t[2]}}async provision(e,t,i){const r=new TextEncoder,o=r.encode(e),s=r.encode(t),a=[o.length,...o,s.length,...s],l=await this._sendRPCWithResponse(1,a,i);this.nextUrl=l[0]}async scan(){const e=(await this._sendRPCWithMultipleResponses(4,[])).map(([e,t,i])=>({name:e,rssi:parseInt(t),secured:"YES"===i}));return e.sort((e,t)=>e.name.toLocaleLowerCase().localeCompare(t.name.toLocaleLowerCase())),e}_sendRPC(e,t){this.writePacketToStream(Ii.RPC,[e,t.length,...t])}async _sendRPCWithResponse(e,t,i){if(this._rpcFeedback)throw new Error("Only 1 RPC command that requires feedback can be active");return await this._awaitRPCResultWithTimeout(new Promise((i,r)=>{this._rpcFeedback={command:e,resolve:i,reject:r},this._sendRPC(e,t)}),i)}async _sendRPCWithMultipleResponses(e,t,i){if(this._rpcFeedback)throw new Error("Only 1 RPC command that requires feedback can be active");return await this._awaitRPCResultWithTimeout(new Promise((i,r)=>{this._rpcFeedback={command:e,resolve:i,reject:r,receivedData:[]},this._sendRPC(e,t)}),i)}async _awaitRPCResultWithTimeout(e,t){return t?await new Promise((i,r)=>{const o=setTimeout(()=>this._setError(254),t);e.finally(()=>clearTimeout(o)),e.then(i,r)}):await e}async _processInput(){this.logger.debug("Starting read loop"),this._reader=this.port.readable.getReader();try{let e,t=[],i=0;for(;;){const{value:r,done:o}=await this._reader.read();if(o)break;if(r&&0!==r.length)for(const o of r){if(!1===e){10===o&&(e=void 0);continue}if(!0===e){t.push(o),t.length===i&&(this._handleIncomingPacket(t),e=void 0,t=[]);continue}if(10===o){t=[];continue}if(t.push(o),9!==t.length)continue;if(e="IMPROV"===String.fromCharCode(...t.slice(0,6)),!e){t=[];continue}i=9+t[8]+1}}}catch(e){this.logger.error("Error while reading serial port",e)}finally{this._reader.releaseLock(),this._reader=void 0}this.logger.debug("Finished read loop"),this.dispatchEvent(new Event("disconnect"))}_handleIncomingPacket(e){const t=e.slice(6),i=t[0],r=t[1],o=t[2],s=t.slice(3,3+o);if(this.logger.debug("PROCESS",{version:i,packetType:r,packetLength:o,data:Oi(s)}),1!==i)return void this.logger.error("Received unsupported version",i);let a=t[3+o],l=0;for(let t=0;t<e.length-1;t++)l+=e[t];if(l&=255,l===a)if(r===Ii.CURRENT_STATE)this.state=s[0],this.dispatchEvent(new CustomEvent("state-changed",{detail:this.state}));else if(r===Ii.ERROR_STATE)this._setError(s[0]);else if(r===Ii.RPC_RESULT){if(!this._rpcFeedback)return void this.logger.error("Received result while not waiting for one");const e=s[0];if(e!==this._rpcFeedback.command)return void this.logger.error(`Received result for command ${e} but expected ${this._rpcFeedback.command}`);const t=[],i=s[1];let r=2;for(;r<2+i;)t.push(String.fromCodePoint(...s.slice(r+1,r+s[r]+1))),r+=s[r]+1;"receivedData"in this._rpcFeedback?t.length>0?this._rpcFeedback.receivedData.push(t):(this._rpcFeedback.resolve(this._rpcFeedback.receivedData),this._rpcFeedback=void 0):(this._rpcFeedback.resolve(t),this._rpcFeedback=void 0)}else this.logger.error("Unable to handle packet",t);else this.logger.error(`Received invalid checksum ${a}. Expected ${l}`)}async writePacketToStream(e,t){const i=new Uint8Array([...Ei,e,t.length,...t,0,0]);i[i.length-2]=255&i.reduce((e,t)=>e+t,0),i[i.length-1]=10,this.logger.debug("Writing to stream:",Oi(new Array(...i)));const r=this.port.writable.getWriter();await r.write(i);try{r.releaseLock()}catch(e){console.error("Ignoring release lock error",e)}}_setError(e){this.error=e,e>0&&this._rpcFeedback&&(this._rpcFeedback.reject(Fi[e]||`UNKNOWN_ERROR (${e})`),this._rpcFeedback=void 0),this.dispatchEvent(new CustomEvent("error-changed",{detail:this.error}))}}const Pi=e=>{switch(e.chipFamily){case M:return"ESP32";case U:return"ESP32-S2";case D:return"ESP32-S3";case B:return"ESP32-C2";case z:return"ESP32-C3";case P:return"ESP32-C5";case A:return"ESP32-C6";case O:return"ESP32-C61";case L:return"ESP32-H2";case F:return"ESP32-P4";case T:return"ESP8266";default:return"Unknown Chip"}};function zi(e,t){if(0===e.length)return;let i,r=-1/0;for(const o of e){let e=0;void 0!==o.flashSizeMB&&void 0!==t?o.flashSizeMB===t?e+=100:e-=1:void 0!==o.flashSizeMB&&(e-=1),e>r&&(r=e,i=o)}return r>=0?i:void 0}const Bi=async(e,t,i,r,o,s,a)=>{let l,n,d,c,h=null;const p=t=>e({...t,manifest:l,build:n,chipFamily:d,chipVariant:h,flashSize:c});let u=null,f="";try{u=JSON.parse(r)}catch{f=new URL(r,location.toString()).toString(),u=W(f).then(e=>e.json())}if(window.esploader=t,p({state:"initializing",message:"Initializing...",details:{done:!1}}),!t.chipFamily)try{await t.initialize()}catch(e){return i.error(e),p({state:"error",message:"Failed to initialize. Try resetting your device or holding the BOOT button while clicking INSTALL.",details:{error:"failed_initialize",details:e}}),void(t.connected&&await t.disconnect())}if(d=Pi(t),h=t.chipVariant,!t.flashSize&&t.detectFlashSize)try{await t.detectFlashSize()}catch(e){i.debug("Failed to detect flash size:",e)}c=t.flashSize;const g=c?function(e){if(!e)return;const t=e.match(/^(\d+)(MB|GB)$/);if(!t)return;const i=parseInt(t[1],10);return"GB"===t[2]?1024*i:i}(c):void 0;p({state:"initializing",message:`Initialized. Found ${d}${h?` (${h})`:""}${c?`, ${c}`:""}`,details:{done:!0}}),p({state:"manifest",message:"Fetching manifest...",details:{done:!1}});try{l=await u}catch(e){return p({state:"error",message:`Unable to fetch manifest: ${e}`,details:{error:"fetch_manifest_failed",details:e}}),void await t.disconnect()}const m=l.builds.filter(e=>e.chipFamily===d&&(!e.chipVariant||e.chipVariant===h)),v=m.filter(e=>void 0!==e.chipVariant&&e.chipVariant===h),b=m.filter(e=>void 0===e.chipVariant);if(n=zi(v,g),n||(n=zi(b,g)),!n)return p({state:"error",message:`Your ${d}${h?` (${h})`:""} is not supported by this firmware.`,details:{error:"not_supported",details:d}}),void await t.disconnect();p({state:"manifest",message:"Manifest fetched",details:{done:!0}}),p({state:"preparing",message:"Preparing installation...",details:{done:!1}});const y=t;if(!y.chipFamily)return i.error("Stub missing chipFamily - this should not happen!"),void p({state:"error",message:"Internal error: Stub not properly initialized",details:{error:"failed_initialize",details:"Missing chipFamily"}});const x=n.parts.map(async e=>{const t=new URL(e.path,f||location.toString()).toString(),i=await W(t);if(!i.ok)throw new Error(`Downlading firmware ${e.path} failed: ${i.status}`);return i.arrayBuffer()});s&&x.push(Promise.resolve(s.buffer));const _=[];let w=0;for(const e of x)try{const t=await e;_.push(t),w+=t.byteLength}catch(e){return p({state:"error",message:e.message,details:{error:"failed_firmware_download",details:e}}),void await t.disconnect()}if(p({state:"preparing",message:"Installation prepared",details:{done:!0}}),o){p({state:"erasing",message:"Erasing flash...",details:{done:!1}});try{i.log("Erasing flash memory. Please wait..."),await y.eraseFlash(),i.log("Flash erased successfully"),p({state:"erasing",message:"Flash erased",details:{done:!0}})}catch(e){return i.error(`Flash erase failed: ${e.message}`),p({state:"error",message:`Failed to erase flash: ${e.message}`,details:{error:"write_failed",details:e}}),void await t.disconnect()}}p({state:"writing",message:"Writing progress: 0 %",details:{bytesTotal:w,bytesWritten:0,percentage:0}});let k=0,S=0;try{for(let e=0;e<n.parts.length;e++){const t=n.parts[e],i=_[e];await y.flashData(i,(e,t)=>{const i=Math.floor((S+e)/w*100);i!==k&&(k=i,p({state:"writing",message:`Writing progress: ${i} %`,details:{bytesTotal:w,bytesWritten:S+e,percentage:i}}))},t.offset),S+=i.byteLength}}catch(e){return p({state:"error",message:e.message,details:{error:"write_failed",details:e}}),void await t.disconnect()}p({state:"writing",message:"Writing complete",details:{bytesTotal:w,bytesWritten:w,percentage:100}}),await le(100),p({state:"finished",message:"All done!"})},Di=(e,t="")=>{const i=new Blob([e],{type:"text/plain"}),r=URL.createObjectURL(i);((e,t="")=>{const i=document.createElement("a");i.target="_blank",i.href=e,i.download=t,document.body.appendChild(i),i.dispatchEvent(new MouseEvent("click")),document.body.removeChild(i)})(r,t),setTimeout(()=>URL.revokeObjectURL(r),0)},Ui={0:"app",1:"data"},Mi={0:"factory",16:"ota_0",17:"ota_1",18:"ota_2",19:"ota_3",20:"ota_4",21:"ota_5",22:"ota_6",23:"ota_7",24:"ota_8",25:"ota_9",26:"ota_10",27:"ota_11",28:"ota_12",29:"ota_13",30:"ota_14",31:"ota_15",32:"test"},Wi={0:"ota",1:"phy",2:"nvs",3:"coredump",4:"nvs_keys",5:"efuse",128:"esphttpd",129:"fat",130:"spiffs"};function Hi(e){if(e.length<32)return null;if(20650!==(65535&(e[0]|e[1]<<8)))return null;const t=e[2],i=e[3],r=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,o=e[8]|e[9]<<8|e[10]<<16|e[11]<<24;let s="";for(let t=12;t<28&&0!==e[t];t++)s+=String.fromCharCode(e[t]);const a=e[28]|e[29]<<8|e[30]<<16|e[31]<<24,l=Ui[t]||`unknown(0x${t.toString(16)})`;let n="";return n=0===t?Mi[i]||`unknown(0x${i.toString(16)})`:1===t?Wi[i]||`unknown(0x${i.toString(16)})`:`0x${i.toString(16)}`,{name:s,type:t,subtype:i,offset:r,size:o,flags:a,typeName:l,subtypeName:n}}const Vi=Ri,Ni=Ci;class qi extends a{constructor(){super(...arguments),this.logger=console,this._state="DASHBOARD",this._installErase=!1,this._installConfirmed=!1,this._provisionForce=!1,this._wasProvisioned=!1,this._busy=!0,this._selectedSsid=null,this._improvChecked=!1,this._consoleInitialized=!1,this._improvSupported=!1,this._isUsbJtagOrOtgDevice=!1,this._openConsoleAfterReconnect=!1,this._visitDeviceAfterReconnect=!1,this._addToHAAfterReconnect=!1,this._changeWiFiAfterReconnect=!1,this._handleDisconnect=()=>{this._state="ERROR",this._error="Disconnected",this._flashSize=void 0}}async _ensureStub(){if(this._espStub&&this._espStub.IS_STUB){if(this.logger.log(`Existing stub: IS_STUB=${this._espStub.IS_STUB}, chipFamily=${Pi(this._espStub)}`),this.baudRate&&this.baudRate>115200){const e=this._espStub.currentBaudRate||115200;if(e!==this.baudRate){this.logger.log(`Adjusting baudrate from ${e} to ${this.baudRate}...`);try{await this._espStub.setBaudrate(this.baudRate),this.logger.log(`Baudrate set to ${this.baudRate}`),this._espStub.currentBaudRate=this.baudRate}catch(e){this.logger.log(`Failed to set baudrate: ${e.message}, continuing with current`),this._espStub.currentBaudRate=this.baudRate}}else this.logger.log(`Baudrate already at ${this.baudRate}, skipping`)}return this._espStub}if(!this.esploader.chipFamily){this.logger.log("Initializing ESP loader...");for(let e=1;e<=2;e++)try{e>1&&(this.logger.log(`Retry attempt ${e}/2...`),await le(500)),await this.esploader.initialize(),this.logger.log(`Found ${Pi(this.esploader)}`);break}catch(t){if(this.logger.error(`Connection failed to stub (attempt ${e}/2): ${t.message}`),2===e)throw this._state="ERROR",this._error=`Failed to connect to ESP after 2 attempts: ${t.message}`,t}}this.logger.log("Running stub...");const e=await this.esploader.runStub();if(this.logger.log(`Stub created: IS_STUB=${e.IS_STUB}, chipFamily=${Pi(e)}`),this._espStub=e,await this._probeFlashSize(e),this.baudRate&&this.baudRate>115200){this.logger.log(`Setting baudrate to ${this.baudRate}...`);try{await e.setBaudrate(this.baudRate),this.logger.log(`Baudrate set to ${this.baudRate}`),e.currentBaudRate=this.baudRate}catch(e){this.logger.error(`[DEBUG] setBaudrate() threw error: ${e.message}`),this.logger.log(`Failed to set baudrate: ${e.message}, continuing with default`)}}return this.logger.log(`Returning stub: IS_STUB=${this._espStub.IS_STUB}, chipFamily=${Pi(this._espStub)}`),this._espStub}get _port(){return this.esploader.port}async _probeFlashSize(e){if(e.detectFlashSize&&!this._flashSize)try{await e.detectFlashSize(),this._flashSize=e.flashSize,this.logger.log(`Flash size detected: ${this._flashSize}`)}catch(e){this.logger.debug("Failed to detect flash size:",e)}}async _isUsbJtagOrOtg(){const e=await this.esploader.detectUsbConnectionType();return this.logger.log("USB-JTAG/OTG detection: "+(e?"YES":"NO")),e}async _isWebUsbWithExternalSerial(){if(!(this.esploader.isWebUSB&&this.esploader.isWebUSB()))return!1;const e=!await this._isUsbJtagOrOtg();return this.logger.log("WebUSB with external serial: "+(e?"YES":"NO")),e}async _releaseReaderWriter(){let e=this._espStub||this.esploader;if(e._parent&&(e=e._parent,this.logger.log("Using parent loader for reader/writer")),e._reader){const t=e._reader;try{await t.cancel(),this.logger.log("Reader cancelled on correct object")}catch(e){this.logger.log("Reader cancel failed:",e)}try{t.releaseLock(),this.logger.log("Reader released")}catch(e){this.logger.log("Reader releaseLock failed:",e)}e._reader=void 0}if(e._writer){const t=e._writer;e._writer=void 0;try{t.releaseLock(),this.logger.log("Writer lock released")}catch(e){this.logger.log("Writer releaseLock failed:",e)}}if(this.esploader.isWebUSB&&this.esploader.isWebUSB())try{this.logger.log("WebUSB detected - recreating streams"),await this._port.recreateStreams(),await le(200),this.logger.log("WebUSB streams recreated and ready")}catch(e){this.logger.log(`Failed to recreate WebUSB streams: ${e.message}`)}}async _resetBaudrateForConsole(){if(this._espStub&&115200!==this._espStub.currentBaudRate){this.logger.log(`Resetting baudrate from ${this._espStub.currentBaudRate} to 115200`);try{await this._espStub.setBaudrate(115200),this.logger.log("Baudrate set to 115200 for console")}catch(e){this.logger.log(`Failed to set baudrate to 115200: ${e.message}`)}}}async _prepareForFlashOperations(){await this._resetToBootloaderAndReleaseLocks(),await le(100),this._espStub=void 0,this.esploader.IS_STUB=!1,await this._ensureStub(),this.logger.log("ESP reset, stub loaded - ready for flash operations")}async _handleFlashComplete(){const e=await this._isUsbJtagOrOtg();if(this._isUsbJtagOrOtgDevice=e,e){this.logger.log("USB-JTAG/OTG device - resetting to firmware mode"),await this._releaseReaderWriter();try{await this._port.forget(),this.logger.log("Old port forgotten")}catch(e){this.logger.log(`Port forget failed: ${e.message}`)}try{await this.esploader.resetToFirmware(),this.logger.log("Device reset to firmware mode - port closed")}catch(e){this.logger.debug(`Reset to firmware error (expected): ${e.message}`)}return await le(100),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null,this._improvChecked=!1,this._client=null,this._improvSupported=!1,this.esploader._reader=void 0,this.logger.log("Flash complete - waiting for user to select new port"),this._state="REQUEST_PORT_SELECTION",this._error="",void this.requestUpdate()}await this._releaseReaderWriter(),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null,this._improvChecked=!1,this.esploader._reader=void 0,this.logger.log("ESP state reset for Improv test");try{this.logger.log("Reconnecting at 115200 baud for firmware reset...");try{await this.esploader.reconnectToBootloader(),this.logger.log("Port reconnected at 115200 baud")}catch(e){this.logger.log(`Reconnect failed: ${e.message}`)}this.logger.log("Performing hardware reset to start new firmware..."),await this._resetDeviceAndReleaseLocks()}catch(e){this.logger.log(`Hard reset failed: ${e.message}`)}await this._initialize(!0),this.requestUpdate()}async _resetDeviceAndReleaseLocks(){let e=this._espStub||this.esploader;e._parent&&(e=e._parent,this.logger.log("Using parent loader for reader/writer"));try{await this.esploader.hardReset(!1),this.logger.log("Device reset sent")}catch(e){this.logger.log("Reset error (expected):",e)}await le(500),await this._releaseReaderWriter(),this.logger.log("Device reset to firmware mode"),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null}async _resetToBootloaderAndReleaseLocks(){try{this.logger.log("Resetting ESP to bootloader mode..."),await this.esploader.reconnectToBootloader(),this.logger.log(`ESP in bootloader mode: ${Pi(this.esploader)}`)}catch(e){throw this.logger.error(`Failed to reset ESP to bootloader: ${e.message}`),e}this._espStub=void 0,this.esploader.IS_STUB=!1}render(){if(!this.esploader)return u``;if("DASHBOARD"===this._state&&!this._improvChecked)return u`
|
|
917
|
+
`,Ei=["I".charCodeAt(0),"M".charCodeAt(0),"P".charCodeAt(0),"R".charCodeAt(0),"O".charCodeAt(0),"V".charCodeAt(0),1];var Ii,Ti;!function(e){e[e.CURRENT_STATE=1]="CURRENT_STATE",e[e.ERROR_STATE=2]="ERROR_STATE",e[e.RPC=3]="RPC",e[e.RPC_RESULT=4]="RPC_RESULT"}(Ii||(Ii={})),function(e){e[e.READY=2]="READY",e[e.PROVISIONING=3]="PROVISIONING",e[e.PROVISIONED=4]="PROVISIONED"}(Ti||(Ti={}));const Fi={0:"NO_ERROR",1:"INVALID_RPC_PACKET",2:"UNKNOWN_RPC_COMMAND",3:"UNABLE_TO_CONNECT",254:"TIMEOUT",255:"UNKNOWN_ERROR"};class Li extends Error{constructor(){super("Port is not ready")}}const Oi=e=>"["+e.map(e=>((e,t=2)=>{let i=e.toString(16).toUpperCase();return i.startsWith("-")?"-0x"+i.substring(1).padStart(t,"0"):"0x"+i.padStart(t,"0")})(e)).join(", ")+"]";class Ai extends EventTarget{constructor(e,t){if(super(),this.port=e,this.logger=t,this.error=0,null===e.readable)throw new Error("Port is not readable");if(null===e.writable)throw new Error("Port is not writable")}async initialize(e=1e3){var t;if(this.logger.log("Initializing Improv Serial"),this._processInput(),await(t=1e3,new Promise(e=>setTimeout(e,t))),void 0===this._reader)throw new Li;try{await new Promise(async(t,i)=>{setTimeout(()=>i(new Error("Improv Wi-Fi Serial not detected")),e),await this.requestCurrentState(),t(void 0)}),await this.requestInfo()}catch(e){throw await this.close(),e}return this.info}async close(){this._reader&&await new Promise(e=>{this._reader.cancel(),this.addEventListener("disconnect",e,{once:!0})})}async requestCurrentState(){let e;try{await new Promise(async(t,i)=>{this.addEventListener("state-changed",t,{once:!0});e=this._sendRPCWithResponse(2,[]),e.catch(e=>{this.removeEventListener("state-changed",t),i(e)})})}catch(e){throw this._rpcFeedback=void 0,new Error(`Error fetching current state: ${e}`)}if(this.state!==Ti.PROVISIONED)return void(this._rpcFeedback=void 0);const t=await e;this.nextUrl=t[0]}async requestInfo(e){const t=await this._sendRPCWithResponse(3,[],e);this.info={firmware:t[0],version:t[1],name:t[3],chipFamily:t[2]}}async provision(e,t,i){const r=new TextEncoder,o=r.encode(e),s=r.encode(t),a=[o.length,...o,s.length,...s],l=await this._sendRPCWithResponse(1,a,i);this.nextUrl=l[0]}async scan(){const e=(await this._sendRPCWithMultipleResponses(4,[])).map(([e,t,i])=>({name:e,rssi:parseInt(t),secured:"YES"===i}));return e.sort((e,t)=>e.name.toLocaleLowerCase().localeCompare(t.name.toLocaleLowerCase())),e}_sendRPC(e,t){this.writePacketToStream(Ii.RPC,[e,t.length,...t])}async _sendRPCWithResponse(e,t,i){if(this._rpcFeedback)throw new Error("Only 1 RPC command that requires feedback can be active");return await this._awaitRPCResultWithTimeout(new Promise((i,r)=>{this._rpcFeedback={command:e,resolve:i,reject:r},this._sendRPC(e,t)}),i)}async _sendRPCWithMultipleResponses(e,t,i){if(this._rpcFeedback)throw new Error("Only 1 RPC command that requires feedback can be active");return await this._awaitRPCResultWithTimeout(new Promise((i,r)=>{this._rpcFeedback={command:e,resolve:i,reject:r,receivedData:[]},this._sendRPC(e,t)}),i)}async _awaitRPCResultWithTimeout(e,t){return t?await new Promise((i,r)=>{const o=setTimeout(()=>this._setError(254),t);e.finally(()=>clearTimeout(o)),e.then(i,r)}):await e}async _processInput(){this.logger.debug("Starting read loop"),this._reader=this.port.readable.getReader();try{let e,t=[],i=0;for(;;){const{value:r,done:o}=await this._reader.read();if(o)break;if(r&&0!==r.length)for(const o of r){if(!1===e){10===o&&(e=void 0);continue}if(!0===e){t.push(o),t.length===i&&(this._handleIncomingPacket(t),e=void 0,t=[]);continue}if(10===o){t=[];continue}if(t.push(o),9!==t.length)continue;if(e="IMPROV"===String.fromCharCode(...t.slice(0,6)),!e){t=[];continue}i=9+t[8]+1}}}catch(e){this.logger.error("Error while reading serial port",e)}finally{this._reader.releaseLock(),this._reader=void 0}this.logger.debug("Finished read loop"),this.dispatchEvent(new Event("disconnect"))}_handleIncomingPacket(e){const t=e.slice(6),i=t[0],r=t[1],o=t[2],s=t.slice(3,3+o);if(this.logger.debug("PROCESS",{version:i,packetType:r,packetLength:o,data:Oi(s)}),1!==i)return void this.logger.error("Received unsupported version",i);let a=t[3+o],l=0;for(let t=0;t<e.length-1;t++)l+=e[t];if(l&=255,l===a)if(r===Ii.CURRENT_STATE)this.state=s[0],this.dispatchEvent(new CustomEvent("state-changed",{detail:this.state}));else if(r===Ii.ERROR_STATE)this._setError(s[0]);else if(r===Ii.RPC_RESULT){if(!this._rpcFeedback)return void this.logger.error("Received result while not waiting for one");const e=s[0];if(e!==this._rpcFeedback.command)return void this.logger.error(`Received result for command ${e} but expected ${this._rpcFeedback.command}`);const t=[],i=s[1];let r=2;for(;r<2+i;)t.push(String.fromCodePoint(...s.slice(r+1,r+s[r]+1))),r+=s[r]+1;"receivedData"in this._rpcFeedback?t.length>0?this._rpcFeedback.receivedData.push(t):(this._rpcFeedback.resolve(this._rpcFeedback.receivedData),this._rpcFeedback=void 0):(this._rpcFeedback.resolve(t),this._rpcFeedback=void 0)}else this.logger.error("Unable to handle packet",t);else this.logger.error(`Received invalid checksum ${a}. Expected ${l}`)}async writePacketToStream(e,t){const i=new Uint8Array([...Ei,e,t.length,...t,0,0]);i[i.length-2]=255&i.reduce((e,t)=>e+t,0),i[i.length-1]=10,this.logger.debug("Writing to stream:",Oi(new Array(...i)));const r=this.port.writable.getWriter();await r.write(i);try{r.releaseLock()}catch(e){console.error("Ignoring release lock error",e)}}_setError(e){this.error=e,e>0&&this._rpcFeedback&&(this._rpcFeedback.reject(Fi[e]||`UNKNOWN_ERROR (${e})`),this._rpcFeedback=void 0),this.dispatchEvent(new CustomEvent("error-changed",{detail:this.error}))}}const zi=e=>{switch(e.chipFamily){case M:return"ESP32";case U:return"ESP32-S2";case D:return"ESP32-S3";case B:return"ESP32-C2";case P:return"ESP32-C3";case z:return"ESP32-C5";case A:return"ESP32-C6";case O:return"ESP32-C61";case L:return"ESP32-H2";case F:return"ESP32-P4";case T:return"ESP8266";default:return"Unknown Chip"}};function Pi(e){if(!e)return;const t=e.match(/^(\d+)(MB|GB)$/);if(!t)return;const i=parseInt(t[1],10);return"GB"===t[2]?1024*i:i}function Bi(e,t,i){if(0===e.length)return;let r,o=-1/0;for(const s of e){let e=0;if(void 0!==s.usbInterface){if(void 0===i||s.usbInterface!==i)continue;e+=1e3}void 0!==s.flashSizeMB&&void 0!==t?s.flashSizeMB===t?e+=100:e-=1:void 0!==s.flashSizeMB&&(e-=1),e>o&&(o=e,r=s)}return o>=0?r:void 0}function Di(e,t,i,r,o){const s=e.builds.filter(e=>e.chipFamily===t&&(!e.chipVariant||e.chipVariant===i)),a=s.filter(e=>void 0!==e.chipVariant&&e.chipVariant===i),l=s.filter(e=>void 0===e.chipVariant);return Bi(a,r,o)||Bi(l,r,o)}const Ui=async(e,t,i,r,o,s,a)=>{let l,n,d,c,h=null;const p=t=>e({...t,manifest:l,build:n,chipFamily:d,chipVariant:h,flashSize:c});let u=null,f="";try{u=JSON.parse(r)}catch{f=new URL(r,location.toString()).toString(),u=W(f).then(e=>e.json())}if(window.esploader=t,p({state:"initializing",message:"Initializing...",details:{done:!1}}),!t.chipFamily)try{await t.initialize()}catch(e){return i.error(e),p({state:"error",message:"Failed to initialize. Try resetting your device or holding the BOOT button while clicking INSTALL.",details:{error:"failed_initialize",details:e}}),void(t.connected&&await t.disconnect())}if(d=zi(t),h=t.chipVariant,!t.flashSize&&t.detectFlashSize)try{await t.detectFlashSize()}catch(e){i.debug("Failed to detect flash size:",e)}c=t.flashSize;const g=c?Pi(c):void 0;let m;if("function"==typeof t.detectUsbConnectionType)try{m=await t.detectUsbConnectionType()?"CDC":"UART",i.debug(`Detected USB interface: ${m}`)}catch(e){i.debug("Failed to detect USB connection type:",e)}p({state:"initializing",message:`Initialized. Found ${d}${h?` (${h})`:""}${c?`, ${c}`:""}`,details:{done:!0}}),p({state:"manifest",message:"Fetching manifest...",details:{done:!1}});try{l=await u}catch(e){return p({state:"error",message:`Unable to fetch manifest: ${e}`,details:{error:"fetch_manifest_failed",details:e}}),void await t.disconnect()}if(n=Di(l,d,h,g,m),!n)return p({state:"error",message:`Your ${d}${h?` (${h})`:""} is not supported by this firmware.`,details:{error:"not_supported",details:d}}),void await t.disconnect();p({state:"manifest",message:"Manifest fetched",details:{done:!0}}),p({state:"preparing",message:"Preparing installation...",details:{done:!1}});const v=t;if(!v.chipFamily)return i.error("Stub missing chipFamily - this should not happen!"),void p({state:"error",message:"Internal error: Stub not properly initialized",details:{error:"failed_initialize",details:"Missing chipFamily"}});const b=n.parts.map(async e=>{const t=new URL(e.path,f||location.toString()).toString(),i=await W(t);if(!i.ok)throw new Error(`Downlading firmware ${e.path} failed: ${i.status}`);return i.arrayBuffer()});s&&b.push(Promise.resolve(s.buffer));const y=[];let _=0;for(const e of b)try{const t=await e;y.push(t),_+=t.byteLength}catch(e){return p({state:"error",message:e.message,details:{error:"failed_firmware_download",details:e}}),void await t.disconnect()}if(p({state:"preparing",message:"Installation prepared",details:{done:!0}}),o){p({state:"erasing",message:"Erasing flash...",details:{done:!1}});try{i.log("Erasing flash memory. Please wait..."),await v.eraseFlash(),i.log("Flash erased successfully"),p({state:"erasing",message:"Flash erased",details:{done:!0}})}catch(e){return i.error(`Flash erase failed: ${e.message}`),p({state:"error",message:`Failed to erase flash: ${e.message}`,details:{error:"write_failed",details:e}}),void await t.disconnect()}}p({state:"writing",message:"Writing progress: 0 %",details:{bytesTotal:_,bytesWritten:0,percentage:0}});let x=0,w=0;try{for(let e=0;e<n.parts.length;e++){const t=n.parts[e],i=y[e];await v.flashData(i,(e,t)=>{const i=Math.floor((w+e)/_*100);i!==x&&(x=i,p({state:"writing",message:`Writing progress: ${i} %`,details:{bytesTotal:_,bytesWritten:w+e,percentage:i}}))},t.offset),w+=i.byteLength}}catch(e){return p({state:"error",message:e.message,details:{error:"write_failed",details:e}}),void await t.disconnect()}p({state:"writing",message:"Writing complete",details:{bytesTotal:_,bytesWritten:_,percentage:100}}),await le(100),p({state:"finished",message:"All done!"})},Mi=(e,t="")=>{const i=new Blob([e],{type:"text/plain"}),r=URL.createObjectURL(i);((e,t="")=>{const i=document.createElement("a");i.target="_blank",i.href=e,i.download=t,document.body.appendChild(i),i.dispatchEvent(new MouseEvent("click")),document.body.removeChild(i)})(r,t),setTimeout(()=>URL.revokeObjectURL(r),0)},Wi={0:"app",1:"data"},Hi={0:"factory",16:"ota_0",17:"ota_1",18:"ota_2",19:"ota_3",20:"ota_4",21:"ota_5",22:"ota_6",23:"ota_7",24:"ota_8",25:"ota_9",26:"ota_10",27:"ota_11",28:"ota_12",29:"ota_13",30:"ota_14",31:"ota_15",32:"test"},Vi={0:"ota",1:"phy",2:"nvs",3:"coredump",4:"nvs_keys",5:"efuse",128:"esphttpd",129:"fat",130:"spiffs"};function Ni(e){if(e.length<32)return null;if(20650!==(65535&(e[0]|e[1]<<8)))return null;const t=e[2],i=e[3],r=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,o=e[8]|e[9]<<8|e[10]<<16|e[11]<<24;let s="";for(let t=12;t<28&&0!==e[t];t++)s+=String.fromCharCode(e[t]);const a=e[28]|e[29]<<8|e[30]<<16|e[31]<<24,l=Wi[t]||`unknown(0x${t.toString(16)})`;let n="";return n=0===t?Hi[i]||`unknown(0x${i.toString(16)})`:1===t?Vi[i]||`unknown(0x${i.toString(16)})`:`0x${i.toString(16)}`,{name:s,type:t,subtype:i,offset:r,size:o,flags:a,typeName:l,subtypeName:n}}const qi=Ci,Gi=Ri;class ji extends a{constructor(){super(...arguments),this.logger=console,this._state="DASHBOARD",this._installErase=!1,this._installConfirmed=!1,this._provisionForce=!1,this._wasProvisioned=!1,this._busy=!0,this._selectedSsid=null,this._improvChecked=!1,this._consoleInitialized=!1,this._improvSupported=!1,this._isUsbJtagOrOtgDevice=!1,this._openConsoleAfterReconnect=!1,this._visitDeviceAfterReconnect=!1,this._addToHAAfterReconnect=!1,this._changeWiFiAfterReconnect=!1,this._handleDisconnect=()=>{this._state="ERROR",this._error="Disconnected",this._flashSize=void 0,this._detectedBuild=void 0}}async _ensureStub(){if(this._espStub&&this._espStub.IS_STUB){if(this.logger.log(`Existing stub: IS_STUB=${this._espStub.IS_STUB}, chipFamily=${zi(this._espStub)}`),this.baudRate&&this.baudRate>115200){const e=this._espStub.currentBaudRate||115200;if(e!==this.baudRate){this.logger.log(`Adjusting baudrate from ${e} to ${this.baudRate}...`);try{await this._espStub.setBaudrate(this.baudRate),this.logger.log(`Baudrate set to ${this.baudRate}`),this._espStub.currentBaudRate=this.baudRate}catch(e){this.logger.log(`Failed to set baudrate: ${e.message}, continuing with current`),this._espStub.currentBaudRate=this.baudRate}}else this.logger.log(`Baudrate already at ${this.baudRate}, skipping`)}return this._espStub}if(!this.esploader.chipFamily){this.logger.log("Initializing ESP loader...");for(let e=1;e<=2;e++)try{e>1&&(this.logger.log(`Retry attempt ${e}/2...`),await le(500)),await this.esploader.initialize(),this.logger.log(`Found ${zi(this.esploader)}`);break}catch(t){if(this.logger.error(`Connection failed to stub (attempt ${e}/2): ${t.message}`),2===e)throw this._state="ERROR",this._error=`Failed to connect to ESP after 2 attempts: ${t.message}`,t}}this.logger.log("Running stub...");const e=await this.esploader.runStub();if(this.logger.log(`Stub created: IS_STUB=${e.IS_STUB}, chipFamily=${zi(e)}`),this._espStub=e,await this._probeFlashSize(e),this.baudRate&&this.baudRate>115200){this.logger.log(`Setting baudrate to ${this.baudRate}...`);try{await e.setBaudrate(this.baudRate),this.logger.log(`Baudrate set to ${this.baudRate}`),e.currentBaudRate=this.baudRate}catch(e){this.logger.error(`[DEBUG] setBaudrate() threw error: ${e.message}`),this.logger.log(`Failed to set baudrate: ${e.message}, continuing with default`)}}return this.logger.log(`Returning stub: IS_STUB=${this._espStub.IS_STUB}, chipFamily=${zi(this._espStub)}`),this._espStub}get _port(){return this.esploader.port}async _probeFlashSize(e){var t;if(e.detectFlashSize&&!this._flashSize)try{await e.detectFlashSize(),this._flashSize=e.flashSize,this.logger.log(`Flash size detected: ${this._flashSize}`)}catch(e){this.logger.debug("Failed to detect flash size:",e)}this._detectedBuild=function(e,t,i,r,o){var s;const a=o||(t.chipFamily?zi(t):null);if(!a)return;return Di(e,a,null!==(s=t.chipVariant)&&void 0!==s?s:null,i?Pi(i):void 0,r?"CDC":"UART")}(this._manifest,e,this._flashSize,this._isUsbJtagOrOtgDevice,null===(t=this._info)||void 0===t?void 0:t.chipFamily)}async _isUsbJtagOrOtg(){const e=await this.esploader.detectUsbConnectionType();return this.logger.log("USB-JTAG/OTG detection: "+(e?"YES":"NO")),e}async _isWebUsbWithExternalSerial(){if(!(this.esploader.isWebUSB&&this.esploader.isWebUSB()))return!1;const e=!await this._isUsbJtagOrOtg();return this.logger.log("WebUSB with external serial: "+(e?"YES":"NO")),e}async _releaseReaderWriter(){let e=this._espStub||this.esploader;if(e._parent&&(e=e._parent,this.logger.log("Using parent loader for reader/writer")),e._reader){const t=e._reader;try{await t.cancel(),this.logger.log("Reader cancelled on correct object")}catch(e){this.logger.log("Reader cancel failed:",e)}try{t.releaseLock(),this.logger.log("Reader released")}catch(e){this.logger.log("Reader releaseLock failed:",e)}e._reader=void 0}if(e._writer){const t=e._writer;e._writer=void 0;try{t.releaseLock(),this.logger.log("Writer lock released")}catch(e){this.logger.log("Writer releaseLock failed:",e)}}if(this.esploader.isWebUSB&&this.esploader.isWebUSB())try{this.logger.log("WebUSB detected - recreating streams"),await this._port.recreateStreams(),await le(200),this.logger.log("WebUSB streams recreated and ready")}catch(e){this.logger.log(`Failed to recreate WebUSB streams: ${e.message}`)}}async _resetBaudrateForConsole(){if(this._espStub&&115200!==this._espStub.currentBaudRate){this.logger.log(`Resetting baudrate from ${this._espStub.currentBaudRate} to 115200`);try{await this._espStub.setBaudrate(115200),this.logger.log("Baudrate set to 115200 for console")}catch(e){this.logger.log(`Failed to set baudrate to 115200: ${e.message}`)}}}async _prepareForFlashOperations(){await this._resetToBootloaderAndReleaseLocks(),await le(100),this._espStub=void 0,this.esploader.IS_STUB=!1,await this._ensureStub(),this.logger.log("ESP reset, stub loaded - ready for flash operations")}async _handleFlashComplete(){const e=await this._isUsbJtagOrOtg();if(this._isUsbJtagOrOtgDevice=e,e){this.logger.log("USB-JTAG/OTG device - resetting to firmware mode"),await this._releaseReaderWriter();try{await this._port.forget(),this.logger.log("Old port forgotten")}catch(e){this.logger.log(`Port forget failed: ${e.message}`)}try{await this.esploader.resetToFirmware(),this.logger.log("Device reset to firmware mode - port closed")}catch(e){this.logger.debug(`Reset to firmware error (expected): ${e.message}`)}return await le(100),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null,this._improvChecked=!1,this._client=null,this._improvSupported=!1,this.esploader._reader=void 0,this.logger.log("Flash complete - waiting for user to select new port"),this._state="REQUEST_PORT_SELECTION",this._error="",void this.requestUpdate()}await this._releaseReaderWriter(),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null,this._improvChecked=!1,this.esploader._reader=void 0,this.logger.log("ESP state reset for Improv test");try{this.logger.log("Reconnecting at 115200 baud for firmware reset...");try{await this.esploader.reconnectToBootloader(),this.logger.log("Port reconnected at 115200 baud")}catch(e){this.logger.log(`Reconnect failed: ${e.message}`)}this.logger.log("Performing hardware reset to start new firmware..."),await this._resetDeviceAndReleaseLocks()}catch(e){this.logger.log(`Hard reset failed: ${e.message}`)}await this._initialize(!0),this.requestUpdate()}async _resetDeviceAndReleaseLocks(){let e=this._espStub||this.esploader;e._parent&&(e=e._parent,this.logger.log("Using parent loader for reader/writer"));try{await this.esploader.hardReset(!1),this.logger.log("Device reset sent")}catch(e){this.logger.log("Reset error (expected):",e)}await le(500),await this._releaseReaderWriter(),this.logger.log("Device reset to firmware mode"),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null}async _resetToBootloaderAndReleaseLocks(){try{this.logger.log("Resetting ESP to bootloader mode..."),await this.esploader.reconnectToBootloader(),this.logger.log(`ESP in bootloader mode: ${zi(this.esploader)}`)}catch(e){throw this.logger.error(`Failed to reset ESP to bootloader: ${e.message}`),e}this._espStub=void 0,this.esploader.IS_STUB=!1}render(){if(!this.esploader)return u``;if("DASHBOARD"===this._state&&!this._improvChecked)return u`
|
|
918
918
|
<ew-dialog open @cancel=${this._preventDefault}>
|
|
919
919
|
<div slot="headline">Connecting</div>
|
|
920
920
|
<div slot="content">${this._renderProgress("Initializing")}</div>
|
|
@@ -941,7 +941,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
941
941
|
.progress=${t}
|
|
942
942
|
></ewt-page-progress>
|
|
943
943
|
`}_renderError(e){return["Error",u`
|
|
944
|
-
<ewt-page-message .icon=${
|
|
944
|
+
<ewt-page-message .icon=${qi} .label=${e}></ewt-page-message>
|
|
945
945
|
<ew-text-button slot="actions" @click=${this._closeDialog}
|
|
946
946
|
>Close</ew-text-button
|
|
947
947
|
>
|
|
@@ -974,6 +974,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
974
974
|
<div slot="headline">
|
|
975
975
|
${this._isSameFirmware?`Update ${this._manifest.name}`:`Install ${this._manifest.name}`}
|
|
976
976
|
</div>
|
|
977
|
+
${(()=>{const e=this._detectedBuild?this._buildVariantLabel(this._detectedBuild):void 0;return e?u`<div slot="supporting-text">Variant: ${e}</div>`:""})()}
|
|
977
978
|
</ew-list-item>
|
|
978
979
|
`}
|
|
979
980
|
${this._client&&void 0!==this._client.nextUrl?u`
|
|
@@ -982,7 +983,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
982
983
|
?disabled=${this._busy}
|
|
983
984
|
@click=${async()=>{this._busy=!0;await this._switchToFirmwareMode("visit")||(this._client&&this._client.nextUrl&&window.open(this._client.nextUrl,"_blank","noopener,noreferrer"),this._busy=!1)}}
|
|
984
985
|
>
|
|
985
|
-
${
|
|
986
|
+
${xi}
|
|
986
987
|
<div slot="headline">Visit Device</div>
|
|
987
988
|
</ew-list-item>
|
|
988
989
|
`:""}
|
|
@@ -1014,7 +1015,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1014
1015
|
?disabled=${this._busy}
|
|
1015
1016
|
@click=${async()=>{if(this._busy=!0,this._client)try{await this._closeClientWithoutEvents(this._client)}catch(e){this.logger.log("Failed to close Improv client:",e)}await this._switchToFirmwareMode("console")||(this.logger.log("Opening console for USB-JTAG/OTG device (in firmware mode)"),this._state="LOGS",this._busy=!1)}}
|
|
1016
1017
|
>
|
|
1017
|
-
${
|
|
1018
|
+
${_i}
|
|
1018
1019
|
<div slot="headline">Open Console</div>
|
|
1019
1020
|
</ew-list-item>
|
|
1020
1021
|
`:""}
|
|
@@ -1024,7 +1025,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1024
1025
|
?disabled=${this._busy}
|
|
1025
1026
|
@click=${async()=>{const e=this._client;e&&await this._closeClientWithoutEvents(e),await this._switchToFirmwareMode("console"),this._state="LOGS"}}
|
|
1026
1027
|
>
|
|
1027
|
-
${
|
|
1028
|
+
${_i}
|
|
1028
1029
|
<div slot="headline">Logs & Console</div>
|
|
1029
1030
|
</ew-list-item>
|
|
1030
1031
|
`}
|
|
@@ -1058,7 +1059,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1058
1059
|
</ew-list-item>
|
|
1059
1060
|
`:""}
|
|
1060
1061
|
</ew-list>
|
|
1061
|
-
`;return[e,t,!0,!0]}_renderDashboardNoImprov(){const e=this.esploader.chipFamily?
|
|
1062
|
+
`;return[e,t,!0,!0]}_renderDashboardNoImprov(){const e=this.esploader.chipFamily?zi(this.esploader):null,t=e?`(${e}${this._flashSize?`, ${this._flashSize}`:""})`:null,i=u`
|
|
1062
1063
|
<ew-list>
|
|
1063
1064
|
${t?u`
|
|
1064
1065
|
<ew-list-item>
|
|
@@ -1073,6 +1074,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1073
1074
|
>
|
|
1074
1075
|
${bi}
|
|
1075
1076
|
<div slot="headline">Install ${this._manifest.name}</div>
|
|
1077
|
+
${(()=>{const e=this._detectedBuild?this._buildVariantLabel(this._detectedBuild):void 0;return e?u`<div slot="supporting-text">Variant: ${e}</div>`:""})()}
|
|
1076
1078
|
</ew-list-item>
|
|
1077
1079
|
|
|
1078
1080
|
${this._isUsbJtagOrOtgDevice?"":u`
|
|
@@ -1081,7 +1083,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1081
1083
|
?disabled=${this._busy}
|
|
1082
1084
|
@click=${async()=>{this._busy=!0;const e=this._client;e&&await this._closeClientWithoutEvents(e);await this._switchToFirmwareMode("console")||(this._state="LOGS",this._busy=!1)}}
|
|
1083
1085
|
>
|
|
1084
|
-
${
|
|
1086
|
+
${_i}
|
|
1085
1087
|
<div slot="headline">Logs & Console</div>
|
|
1086
1088
|
</ew-list-item>
|
|
1087
1089
|
`}
|
|
@@ -1091,7 +1093,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1091
1093
|
?disabled=${this._busy}
|
|
1092
1094
|
@click=${async()=>{if(this._busy=!0,this._client)try{await this._closeClientWithoutEvents(this._client)}catch(e){this.logger.log("Failed to close Improv client:",e)}await this._switchToFirmwareMode("console")||(this.logger.log("Opening console for USB-JTAG/OTG device (in firmware mode)"),this._state="LOGS",this._busy=!1)}}
|
|
1093
1095
|
>
|
|
1094
|
-
${
|
|
1096
|
+
${_i}
|
|
1095
1097
|
<div slot="headline">Open Console</div>
|
|
1096
1098
|
</ew-list-item>
|
|
1097
1099
|
`:""}
|
|
@@ -1156,7 +1158,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1156
1158
|
>
|
|
1157
1159
|
`}else{t=void 0;const r=!this._wasProvisioned&&(void 0!==this._client.nextUrl||"home_assistant_domain"in this._manifest);i=r,e=u`
|
|
1158
1160
|
<ewt-page-message
|
|
1159
|
-
.icon=${
|
|
1161
|
+
.icon=${Gi}
|
|
1160
1162
|
label="Device connected to the network!"
|
|
1161
1163
|
></ewt-page-message>
|
|
1162
1164
|
${r?u`
|
|
@@ -1218,7 +1220,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1218
1220
|
@click=${()=>{const e=this.shadowRoot.querySelector("ew-checkbox");this._startInstall(e.checked)}}
|
|
1219
1221
|
>Next</ew-text-button
|
|
1220
1222
|
>
|
|
1221
|
-
`]}_renderInstall(){var e,t,i;let
|
|
1223
|
+
`]}_renderInstall(){var e,t,i,r,o;let s,a,l=!1;const n=!this._installErase&&this._isSameFirmware;if(!this._installConfirmed&&this._isSameVersion)s="Erase User Data",a=u`
|
|
1222
1224
|
Do you want to reset your device and erase all user data from your
|
|
1223
1225
|
device?
|
|
1224
1226
|
<ew-text-button
|
|
@@ -1232,14 +1234,14 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1232
1234
|
@click=${this._confirmInstall}
|
|
1233
1235
|
>Erase User Data</ew-text-button
|
|
1234
1236
|
>
|
|
1235
|
-
`;else if(this._installConfirmed)if(this._installState&&"initializing"!==this._installState.state&&"manifest"!==this._installState.state&&"preparing"!==this._installState.state)if("erasing"===this._installState.state)
|
|
1237
|
+
`;else if(this._installConfirmed)if(this._installState&&"initializing"!==this._installState.state&&"manifest"!==this._installState.state&&"preparing"!==this._installState.state)if("erasing"===this._installState.state)s="Installing",a=this._renderProgress("Erasing"),l=!0;else if("writing"===this._installState.state||"finished"===this._installState.state&&void 0===this._client&&!this._isUsbJtagOrOtgDevice){let e,t;s="Installing","finished"===this._installState.state?t="Wrapping up":this._installState.details.percentage<4?t="Installing":e=this._installState.details.percentage,a=this._renderProgress(u`
|
|
1236
1238
|
${t?u`${t}<br />`:""}
|
|
1237
1239
|
<br />
|
|
1238
1240
|
This will take a minute.<br />
|
|
1239
1241
|
Keep this page visible until installation is complete.
|
|
1240
|
-
`,e),
|
|
1242
|
+
`,e),l=!0}else if("finished"!==this._installState.state||this._isUsbJtagOrOtgDevice)"error"===this._installState.state&&(s="Installation failed",a=u`
|
|
1241
1243
|
<ewt-page-message
|
|
1242
|
-
.icon=${
|
|
1244
|
+
.icon=${qi}
|
|
1243
1245
|
.label=${this._installState.message}
|
|
1244
1246
|
></ewt-page-message>
|
|
1245
1247
|
<ew-text-button
|
|
@@ -1247,9 +1249,9 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1247
1249
|
@click=${async()=>{this._improvChecked=!1,await this._initialize(),this._state="DASHBOARD"}}
|
|
1248
1250
|
>Back</ew-text-button
|
|
1249
1251
|
>
|
|
1250
|
-
`);else{
|
|
1252
|
+
`);else{s=void 0;const e=null!==this._client;a=u`
|
|
1251
1253
|
<ewt-page-message
|
|
1252
|
-
.icon=${
|
|
1254
|
+
.icon=${Gi}
|
|
1253
1255
|
label="Installation complete!"
|
|
1254
1256
|
></ewt-page-message>
|
|
1255
1257
|
<ew-text-button
|
|
@@ -1257,11 +1259,11 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1257
1259
|
@click=${()=>{this._state=e&&this._installErase?"PROVISION":"DASHBOARD"}}
|
|
1258
1260
|
>Next</ew-text-button
|
|
1259
1261
|
>
|
|
1260
|
-
`}else{
|
|
1261
|
-
${
|
|
1262
|
-
${this._info.firmware} ${this._info.version}${
|
|
1263
|
-
Do you want to ${
|
|
1264
|
-
${this._manifest.name} ${this._manifest.version}?
|
|
1262
|
+
`}else{s="Installing";const e=(null===(o=this._installState)||void 0===o?void 0:o.flashSize)?`Preparing installation (${this._installState.flashSize})`:"Preparing installation";a=this._renderProgress(e),l=!0}else{s="Confirm Installation";const o=n?"update to":"install",l=this._flashSize?u` (${(null===(e=this._info)||void 0===e?void 0:e.chipFamily)||""}${(null===(t=this._info)||void 0===t?void 0:t.chipFamily)?`, ${this._flashSize}`:this._flashSize})`:"",d=null!==(r=null===(i=this._installState)||void 0===i?void 0:i.build)&&void 0!==r?r:this._detectedBuild,c=d?this._buildVariantLabel(d):void 0;a=u`
|
|
1263
|
+
${n?u`Your device is running
|
|
1264
|
+
${this._info.firmware} ${this._info.version}${l}.<br /><br />`:l?u`Device detected: ${l}<br /><br />`:""}
|
|
1265
|
+
Do you want to ${o}
|
|
1266
|
+
${this._manifest.name} ${this._manifest.version}${c?u` <em>(${c})</em>`:""}?
|
|
1265
1267
|
${this._installErase?u`<br /><br />All data on the device will be erased.`:""}
|
|
1266
1268
|
<ew-text-button
|
|
1267
1269
|
slot="actions"
|
|
@@ -1271,7 +1273,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1271
1273
|
<ew-text-button slot="actions" @click=${this._confirmInstall}
|
|
1272
1274
|
>Install</ew-text-button
|
|
1273
1275
|
>
|
|
1274
|
-
`}return[
|
|
1276
|
+
`}return[s,a,l,!1]}_renderLogs(){return["Logs",u`
|
|
1275
1277
|
<ew-console
|
|
1276
1278
|
.port=${this._port}
|
|
1277
1279
|
.logger=${this.logger}
|
|
@@ -1284,7 +1286,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1284
1286
|
>
|
|
1285
1287
|
<ew-text-button
|
|
1286
1288
|
slot="actions"
|
|
1287
|
-
@click=${()=>{
|
|
1289
|
+
@click=${()=>{Mi(this.shadowRoot.querySelector("ew-console").logs(),"esp-web-tools-logs.txt"),this.shadowRoot.querySelector("ew-console").reset()}}
|
|
1288
1290
|
>${$i} Download Logs</ew-text-button
|
|
1289
1291
|
>
|
|
1290
1292
|
<ew-text-button
|
|
@@ -1292,7 +1294,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1292
1294
|
@click=${async()=>{await this.shadowRoot.querySelector("ew-console").reset()}}
|
|
1293
1295
|
>Reset Device</ew-text-button
|
|
1294
1296
|
>
|
|
1295
|
-
`,!1]}_renderPartitions(){let e;if(this._busy)e=this._renderProgress("Reading partition table...");else if(this._partitions&&0!==this._partitions.length){const t=this.esploader.chipFamily?
|
|
1297
|
+
`,!1]}_renderPartitions(){let e;if(this._busy)e=this._renderProgress("Reading partition table...");else if(this._partitions&&0!==this._partitions.length){const t=this.esploader.chipFamily?zi(this.esploader):null,i=t?`${t}${this._flashSize?`, ${this._flashSize}`:""}`:null;e=u`
|
|
1296
1298
|
${i?u`<div
|
|
1297
1299
|
class="device-info"
|
|
1298
1300
|
style="margin-bottom: 16px; font-size: 14px; color: var(--md-sys-color-on-surface-variant, #666);"
|
|
@@ -1339,7 +1341,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1339
1341
|
>
|
|
1340
1342
|
`}else e=u`
|
|
1341
1343
|
<ewt-page-message
|
|
1342
|
-
.icon=${
|
|
1344
|
+
.icon=${qi}
|
|
1343
1345
|
label="No partitions found"
|
|
1344
1346
|
></ewt-page-message>
|
|
1345
1347
|
<ew-text-button
|
|
@@ -1354,7 +1356,7 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1354
1356
|
.logger=${this.logger}
|
|
1355
1357
|
.onClose=${()=>{this._state="PARTITIONS"}}
|
|
1356
1358
|
></ewt-littlefs-manager>
|
|
1357
|
-
`,!0,!0]}async _readPartitionTable(){this._busy=!0,this._partitions=void 0;try{this.logger.log("Reading partition table from 0x8000...");const e=await this._ensureStub();await le(100),this.logger.log("Reading flash data...");const t=function(e){const t=[];for(let i=0;i<e.length;i+=32){const r=Hi(e.slice(i,i+32));if(null===r)break;t.push(r)}return t}(await e.readFlash(32768,4096));0===t.length?(this.logger.log("No valid partition table found"),this._partitions=[]):(this.logger.log(`Found ${t.length} partition(s)`),this._partitions=t)}catch(e){this.logger.error(`Failed to read partition table: ${e.message||e}`),"Port selection cancelled"===e.message?(await this._releaseReaderWriter(),this._error="Port selection cancelled",this._state="ERROR"):e.message&&e.message.includes("Failed to connect")?(await this._releaseReaderWriter(),this._error=e.message,this._state="ERROR"):(this.logger.log("Returning to partition view with no partitions"),this._partitions=[])}finally{this._busy=!1}}async _openFilesystem(e){try{if(this._busy=!0,this.logger.log(`Detecting filesystem type for partition "${e.name}"...`),!this._espStub)throw new Error("ESP stub not available. Please reconnect.");const t=await async function(e,t,i,r=console){try{const o=Math.min(8192,i),s=await e.readFlash(t,o);if(s.length<32)return r.log("Partition too small, assuming SPIFFS"),"spiffs";if(new TextDecoder("ascii",{fatal:!1}).decode(s).includes("littlefs"))return r.log('✓ LittleFS detected: Found "littlefs" signature'),"littlefs";const a=new DataView(s.buffer,s.byteOffset,s.byteLength),l=[4096,2048,1024,512];for(const e of l)if(s.length>=2*e)try{for(let t=0;t<Math.min(e,s.length-4);t+=4){const e=a.getUint32(t,!0),i=1023&e;if((e>>20&4095)<=2047&&i>0&&i<=1022&&t+i+4<=s.length)return r.log("✓ LittleFS detected: Found valid metadata structure"),"littlefs"}}catch(e){}for(let e=0;e<Math.min(4096,s.length-4);e+=4){const t=a.getUint32(e,!0);if(538182953===t||538314025===t)return r.log("✓ SPIFFS detected: Found SPIFFS magic number"),"spiffs"}return r.log("⚠ No clear filesystem signature found, assuming SPIFFS"),"spiffs"}catch(e){return r.error(`Failed to detect filesystem type: ${e.message||e}`),"spiffs"}}(this._espStub,e.offset,e.size,this.logger);this.logger.log(`Detected filesystem: ${t}`),"littlefs"===t?(this._selectedPartition=e,this._state="LITTLEFS"):"spiffs"===t?(this.logger.error("SPIFFS support not yet implemented. Use LittleFS partitions."),this._error="SPIFFS support not yet implemented",this._state="ERROR"):(this.logger.error("Unknown filesystem type. Cannot open partition."),this._error="Unknown filesystem type",this._state="ERROR")}catch(e){this.logger.error(`Failed to open filesystem: ${e.message||e}`),this._error=`Failed to open filesystem: ${e.message||e}`,this._state="ERROR"}finally{this._busy=!1}}_formatSize(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(2)} KB`:`${(e/1048576).toFixed(2)} MB`}willUpdate(e){e.has("_state")&&("ERROR"!==this._state&&(this._error=void 0),"PROVISION"===this._state?this._updateSsids():this._provisionForce=!1,"INSTALL"===this._state&&(this._installConfirmed=!1,this._installState=void 0))}async _updateSsids(e=0){let t;this._ssids=void 0,this._busy=!0;try{t=await this._client.scan()}catch(e){return void 0===this._ssids&&(this._ssids=null,this._selectedSsid=null),void(this._busy=!1)}if(0===t.length&&e<3)return this.logger.log(`SSID scan returned empty, scheduling retry ${e+1}/3`),void setTimeout(()=>{"PROVISION"===this._state&&this._updateSsids(e+1)},2e3);this._ssids=t,this._selectedSsid=t.length?t[0].name:null,this._busy=!1}firstUpdated(e){super.firstUpdated(e),this._bodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden";const t=this.logger;this.logger={log:(e,...i)=>{t.log(e,...i)},error:(e,...i)=>{t.error(e,...i)},debug:(e,...i)=>{t.debug&&t.debug(e,...i)}},this.esploader.logger=this.logger,this._initialize()}updated(e){super.updated(e),e.has("_state")&&this.setAttribute("state",this._state),"PROVISION"===this._state&&(e.has("_selectedSsid")&&null===this._selectedSsid?this._focusFormElement("ew-filled-text-field[name=ssid]"):e.has("_ssids")&&this._focusFormElement())}_focusFormElement(e="ew-filled-text-field, ew-filled-select"){const t=this.shadowRoot.querySelector(e);t&&t.updateComplete.then(()=>setTimeout(()=>t.focus(),100))}async _initialize(e=!1,t=!1){if(null===this._port.readable||null===this._port.writable)return this._state="ERROR",void(this._error="Serial port is not readable/writable. Close any other application using it and try again.");this._busy=!0,this.requestUpdate();try{this._manifest=JSON.parse(this.manifestPath)}catch{try{this._manifest=await(async e=>{const t=new URL(e,location.toString()).toString(),i=await W(t);if(!i.ok)throw new Error(`Failed to fetch manifest: ${i.status}`);const r=await i.json();return"new_install_skip_erase"in r&&(console.warn('Manifest option "new_install_skip_erase" is deprecated. Use "new_install_prompt_erase" instead.'),r.new_install_skip_erase&&(r.new_install_prompt_erase=!0)),r})(this.manifestPath)}catch(e){return this._state="ERROR",this._error="Failed to download manifest",void(this._busy=!1)}}if(t)return this.logger.log("Skipping Improv test (not needed for this operation)"),this._client=null,this._improvChecked=!0,void(this._busy=!1);if(0===this._manifest.new_install_improv_wait_time)return this._client=null,this._improvSupported=!1,this._improvChecked=!0,void(this._busy=!1);if(this._improvChecked)return this.logger.log(`Improv already checked - ${this._improvSupported?"supported":"not supported"}, skipping re-test`),this._improvSupported||(this._client=null),this._busy=!1,void this.requestUpdate();if(this._client)return this.logger.log("Improv client already active, skipping initialization"),this._improvSupported=!0,this._improvChecked=!0,void(this._busy=!1);const i=await this._isUsbJtagOrOtg();this._isUsbJtagOrOtgDevice=i;if(null!==this.esploader.chipFamily){if(this.logger.log("Device is in BOOTLOADER mode - switching to FIRMWARE mode for Improv test"),i){this.logger.log("USB-JTAG/OTG device - need to switch to firmware mode");try{this.esploader.chipFamily||(this.logger.log("Detecting chip type..."),await this.esploader.initialize(),this.logger.log(`Chip detected: ${this.esploader.chipFamily}`)),this._espStub||(this.logger.log("Creating stub for firmware mode switch..."),this._espStub=await this.esploader.runStub(),this.logger.log(`Stub created: IS_STUB=${this._espStub.IS_STUB}`)),await this._probeFlashSize(this._espStub);const e=this._espStub._parent||this._espStub;this._savedLoaderBeforeConsole=e,await this._releaseReaderWriter();try{await this._port.forget(),this.logger.log("Old port forgotten")}catch(e){this.logger.log(`Port forget failed: ${e.message}`)}await this.esploader.resetToFirmware(),this.logger.log("Device reset to firmware mode - port closed")}catch(e){this.logger.debug(`Reset to firmware error (expected): ${e.message}`)}return await le(100),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null,this._improvChecked=!1,this._client=void 0,this._improvSupported=!1,this.esploader._reader=void 0,this.logger.log("Waiting for user to select new port"),this._state="REQUEST_PORT_SELECTION",this._error="",void(this._busy=!1)}this.logger.log("External serial chip - resetting to firmware mode");try{await this._resetDeviceAndReleaseLocks(),await le(500)}catch(e){this.logger.log(`Reset to firmware failed: ${e.message}`)}}else this.logger.log("Device is already in FIRMWARE mode - ready for Improv test");try{await this._releaseReaderWriter(),await le(200),this.logger.log("Streams ready for Improv test")}catch(e){this.logger.log(`Failed to prepare streams: ${e.message}`)}this.logger.log("Testing Improv (device is in firmware mode)");const r=e&&void 0!==this._manifest.new_install_improv_wait_time?1e3*this._manifest.new_install_improv_wait_time:1e4;await this._testImprov(r,!0)}async _switchToFirmwareMode(e=null){if(!(null!==this.esploader.chipFamily)){if(this.logger.log("Device already in firmware mode"),"console"===e&&!this._consoleInitialized){this.logger.log("First console open - resetting device..."),this._consoleInitialized=!0;try{await this.esploader.hardReset(!1),this.logger.log("Device reset completed")}catch(e){this.logger.log(`Reset error (expected): ${e.message}`)}}return await this._releaseReaderWriter(),!1}this.logger.log(`Device is in bootloader mode - switching to firmware for ${e||"operation"}`),this.esploader.chipFamily||(this.logger.log("Detecting chip type..."),await this.esploader.initialize(),this.logger.log(`Chip detected: ${this.esploader.chipFamily}`)),this._espStub||(this.logger.log("Creating stub for firmware mode switch..."),this._espStub=await this.esploader.runStub(),this.logger.log(`Stub created: IS_STUB=${this._espStub.IS_STUB}`)),await this._resetBaudrateForConsole();const t=this._espStub._parent||this._espStub;this._savedLoaderBeforeSwitch=t;if(await this._isUsbJtagOrOtg()){this.logger.log("Releasing reader/writer..."),await this._releaseReaderWriter();try{try{await this._port.forget(),this.logger.log("Old port forgotten")}catch(e){this.logger.log(`Port forget failed: ${e.message}`)}await this.esploader.resetToFirmware(),this.logger.log("Device reset to firmware mode - port closed")}catch(e){this.logger.debug(`Reset to firmware error (expected): ${e.message}`)}return await le(100),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null,this._improvChecked=!1,this._client=null,this._improvSupported=!1,this.esploader._reader=void 0,"console"===e?this._openConsoleAfterReconnect=!0:"visit"===e?this._visitDeviceAfterReconnect=!0:"homeassistant"===e?this._addToHAAfterReconnect=!0:"wifi"===e&&(this._changeWiFiAfterReconnect=!0),this.logger.log("Waiting for user to select new port"),this._state="REQUEST_PORT_SELECTION",this._error="",this._busy=!1,!0}this.logger.log("External serial chip - resetting to firmware mode");try{await this.esploader.hardReset(!1),this.logger.log("Device reset to firmware mode")}catch(e){this.logger.log(`Reset worked. Expected slip Timeout read error: ${e.message}`)}await le(500),this.logger.log("Releasing reader/writer after reset..."),await this._releaseReaderWriter(),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null;try{await this.esploader.hardReset(!1),this.logger.log("Device in firmware mode, start firmware with reset")}catch(e){this.logger.log(`Reset error: ${e.message}`)}return!1}_startInstall(e){this._state="INSTALL",this._installErase=e,this._installConfirmed=!1}async _confirmInstall(){this._installConfirmed=!0,this._installState=void 0,this._client&&await this._closeClientWithoutEvents(this._client),this._client=void 0,this.logger.log("Preparing device for flash operations (switching to bootloader mode)...");try{await this._prepareForFlashOperations()}catch(e){return this.logger.log(`Failed to prepare for flash: ${e.message}`),this._state="ERROR",void(this._error=`Failed to enter bootloader mode: ${e.message}`)}try{await this._ensureStub()}catch(e){return this._state="ERROR",void(this._error=e.message)}const e=this._espStub;null!=this.firmwareFile?new Blob([this.firmwareFile]).arrayBuffer().then(e=>this._flashFilebuffer(new Uint8Array(e))):Bi(async e=>{if(this._installState=e,"finished"===e.state){await this._isUsbJtagOrOtg()?(this._isUsbJtagOrOtgDevice=!0,await this._handleFlashComplete().catch(e=>{this.logger.error(`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`),this._state="ERROR",this._error=`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`})):this._handleFlashComplete().catch(e=>{this.logger.error(`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`),this._state="ERROR",this._error=`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`})}},e,this.logger,this.manifestPath,this._installErase,new Uint8Array(0),this.baudRate).catch(e=>{this.logger.error(`Flash error: ${e.message||e}`),this._state="ERROR",this._error=`Flash failed: ${e.message||e}`,this._busy=!1})}async _flashFilebuffer(e){const t=this._espStub;Bi(e=>{this._installState=e,"finished"===e.state&&this._handleFlashComplete().catch(e=>{this.logger.error(`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`),this._state="ERROR",this._error=`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`})},t,this.logger,this.manifestPath,this._installErase,e,this.baudRate).catch(e=>{this.logger.error(`Flash error: ${e.message||e}`),this._state="ERROR",this._error=`Flash failed: ${e.message||e}`,this._busy=!1})}async _doProvision(){this._busy=!0,this._wasProvisioned=this._client.state===Ti.PROVISIONED;const e=null===this._selectedSsid?this.shadowRoot.querySelector("ew-filled-text-field[name=ssid]").value:this._selectedSsid,t=this.shadowRoot.querySelector("ew-filled-text-field[name=password]").value;try{await this._client.provision(e,t)}catch(e){return}finally{this._busy=!1,this._provisionForce=!1}}async _handleSelectNewPort(){if(this._busy)return void this.logger.log("Already processing port selection, ignoring duplicate click");let e;this._busy=!0,this.logger.log("User clicked 'Select Port' button - requesting new port..."),this.logger.log("Dialog in DOM at start: "+(this.parentNode?"yes":"no")),this._state="DASHBOARD",this._improvChecked=!1,this.requestUpdate(),this.parentNode||(document.body.appendChild(this),this.logger.log("Dialog re-added to DOM before port selection"));try{globalThis.requestSerialPort?(this.logger.log("Using WebUSB port selection (Android)"),e=await globalThis.requestSerialPort(e=>this.logger.log("[WebUSB]",e))):(this.logger.log("Using Web Serial port selection (Desktop)"),e=await navigator.serial.requestPort()),await new Promise(e=>setTimeout(e,50)),this.logger.log("Port selected by user"),this.parentNode||(document.body.appendChild(this),this.logger.log("Dialog re-added to DOM after port selection"))}catch(e){return this.logger.error("Port selection error:",e),"NotFoundError"===e.name?(this.logger.log("Port selection cancelled by user"),this._busy=!1,this._state="ERROR",void(this._error="Port selection cancelled")):(this._busy=!1,this._state="ERROR",void(this._error=`Port selection failed: ${e.message}`))}if(!e)return this.logger.error("newPort is null/undefined"),this._busy=!1,this._state="ERROR",void(this._error="Failed to select port");if(this.logger.log("Opening port at 115200 baud for firmware mode..."),this.logger.log("Dialog in DOM before opening port: "+(this.parentNode?"yes":"no")),null!==e.readable||null!==e.writable){this.logger.log("WARNING: Port appears to be open, closing it first...");try{await e.close(),await le(200),this.logger.log("Port closed successfully")}catch(e){this.logger.log(`Port close failed: ${e.message}`)}}try{await e.open({baudRate:115200}),this.logger.log("Port opened successfully at 115200 baud"),this.logger.log("Dialog in DOM after opening port: "+(this.parentNode?"yes":"no"))}catch(e){return this.logger.error("Port open error:",e),this._busy=!1,this._state="ERROR",void(this._error=`Failed to open port: ${e.message}`)}this.logger.log("Updating existing ESPLoader with new port for firmware mode..."),this.logger.log("Updating base loader port"),this.esploader.port=e,this.esploader.connected=!0,this._espStub&&(this.logger.log("Updating STUB port"),this._espStub.port=e,this._espStub.connected=!0,this._espStub._parent&&(this.logger.log("Updating parent loader port"),this._espStub._parent.port=e)),this._savedLoaderBeforeConsole&&(this.logger.log("Updating saved loader port"),this._savedLoaderBeforeConsole.port=e),this.logger.log("ESPLoader port updated for firmware mode (no bootloader sync)"),this.logger.log("Waiting 700ms for device to fully boot and port to be ready..."),await le(700),this.logger.log(`Port state check: readable=${null!==this._port.readable}, writable=${null!==this._port.writable}`),this.logger.log(`Checking for locks: reader=${this.esploader._reader?"LOCKED":"free"}, writer=${this.esploader._writer?"LOCKED":"free"}`),(this.esploader._reader||this.esploader._writer)&&(this.logger.log("WARNING: Port has active locks! Releasing them before Improv test..."),await this._releaseReaderWriter(),this.logger.log("Locks released")),this.logger.log("Device should be ready now"),this.logger.log("Testing Improv at 115200 baud..."),this._state="DASHBOARD",this.requestUpdate(),await this._testImprov(1e3,!1)}async _testImprov(e=1e3,t=!1){var i,r;let o;this._improvChecked=!0;try{this.logger.log(`Port for Improv: readable=${null!==this._port.readable}, writable=${null!==this._port.writable}`);const s=this._port.getInfo();if(this.logger.log(`Port info: VID=0x${null===(i=s.usbVendorId)||void 0===i?void 0:i.toString(16).padStart(4,"0")}, PID=0x${null===(r=s.usbProductId)||void 0===r?void 0:r.toString(16).padStart(4,"0")}`),!t){this.logger.log("Resetting device for Improv detection...");try{await this._releaseReaderWriter(),await this.esploader.hardReset(!1),this.logger.log("Device reset sent, device is rebooting..."),await this._releaseReaderWriter(),this.logger.log("Streams recreated after reset"),this.logger.log("Waiting for firmware running to be ready for Improv test..."),await le(500)}catch(e){this.logger.log(`Failed to reset device: ${e.message}`)}}this.logger.log("Flushing serial buffer before Improv init..."),await this._releaseReaderWriter(),await le(100),o=new Ai(this._port,this.logger),o.addEventListener("state-changed",()=>{this.requestUpdate()}),o.addEventListener("error-changed",()=>this.requestUpdate()),this.logger.log("Calling improvSerial.initialize()...");const a=await o.initialize(e);this.logger.log("Waiting for firmware to get valid IP address (checking every 500ms, max 10 seconds)...");const l=Date.now(),n=1e4;let d=!1;for(;Date.now()-l<n;){try{await o.requestCurrentState();const e=o.nextUrl;if(e&&!e.includes("0.0.0.0")){this.logger.log(`Valid IP found: ${e}`),d=!0;break}}catch(e){this.logger.log(`Failed to request current state: ${e.message}`)}await le(500)}d||this.logger.log(`Timeout after ${n/1e3} seconds - continuing with current URL: ${o.nextUrl||"undefined"}`),this._client=o,this._info=a,this._improvSupported=!0,o.addEventListener("disconnect",this._handleDisconnect),this.logger.log("Improv Wi-Fi Serial detected"),this.logger.log(`Improv state: ${o.state}, nextUrl: ${o.nextUrl||"undefined"}`)}catch(e){if(this.logger.log(`Improv Wi-Fi Serial not detected: ${e.message}`),this._client=null,this._info=void 0,this._improvSupported=!1,this.logger.log(`State after Improv failure: _client=${this._client}, _info=${this._info}, _improvSupported=${this._improvSupported}, _improvChecked=${this._improvChecked}`),o)try{this.logger.log("Closing failed Improv client..."),await o.close(),this.logger.log("Failed Improv client closed"),await le(200)}catch(e){this.logger.log(`Failed to close Improv client: ${e.message}`)}try{await this._releaseReaderWriter(),this.logger.log("Streams recreated after Improv failure")}catch(e){this.logger.log(`Failed to recreate streams: ${e.message}`)}}if(this._busy=!1,this._openConsoleAfterReconnect){if(this.logger.log("Opening console as requested by user"),this._openConsoleAfterReconnect=!1,this._client){try{await this._closeClientWithoutEvents(this._client),this.logger.log("Improv client closed before opening console")}catch(e){this.logger.log("Failed to close Improv client:",e)}this._client=void 0,await le(200)}await this._releaseReaderWriter(),this._state="LOGS"}else if(this._visitDeviceAfterReconnect)this.logger.log("Opening Visit Device URL as requested by user"),this._visitDeviceAfterReconnect=!1,this._client&&this._client.nextUrl&&window.open(this._client.nextUrl,"_blank","noopener,noreferrer"),this._state="DASHBOARD";else if(this._addToHAAfterReconnect)this.logger.log("Opening Home Assistant URL as requested by user"),this._addToHAAfterReconnect=!1,this._manifest.home_assistant_domain&&window.open(`https://my.home-assistant.io/redirect/config_flow_start/?domain=${this._manifest.home_assistant_domain}`,"_blank","noopener,noreferrer"),this._state="DASHBOARD";else if(this._changeWiFiAfterReconnect){if(this.logger.log("Opening Wi-Fi provisioning as requested by user"),this._changeWiFiAfterReconnect=!1,this._client){try{await this._closeClientWithoutEvents(this._client)}catch(e){this.logger.log("Failed to close Improv client:",e)}this._client=void 0,await le(200)}const e=await this._isWebUsbWithExternalSerial();if(this.esploader.isWebUSB&&this.esploader.isWebUSB()&&!e){this.logger.log("WebUSB CDC: Resetting device for Wi-Fi setup...");try{await this.esploader.hardReset(!1),this.logger.log("Device reset completed")}catch(e){this.logger.log(`Reset error: ${e.message}`)}await this._releaseReaderWriter(),await le(200)}else e?this.logger.log("WebUSB external serial: Preparing port for Wi-Fi setup..."):this.logger.log("WebSerial: Preparing port for Wi-Fi setup..."),await this._releaseReaderWriter(),await le(200);this.logger.log("Port ready for Wi-Fi setup"),this.logger.log("Flushing serial buffer before Improv init..."),await this._releaseReaderWriter(),await le(100),this.logger.log("Re-initializing Improv Serial for Wi-Fi setup");const t=new Ai(this._port,this.logger);t.addEventListener("state-changed",()=>{this.requestUpdate()}),t.addEventListener("error-changed",()=>this.requestUpdate());try{this._info=await t.initialize(1e4),this._client=t,t.addEventListener("disconnect",this._handleDisconnect),this.logger.log("Improv client ready for Wi-Fi provisioning"),this._state="PROVISION",this._provisionForce=!0}catch(e){try{await this._closeClientWithoutEvents(t)}catch(e){this.logger.log("Failed to close Improv client after init error:",e)}this.logger.log(`Improv initialization failed: ${e.message}`),this._error=`Improv initialization failed: ${e.message}`,this._state="ERROR"}}else this._state="DASHBOARD";this.parentNode||(document.body.appendChild(this),this.logger.log("Dialog re-added to DOM")),this.requestUpdate(),await new Promise(e=>setTimeout(e,100))}_preventDefault(e){e.preventDefault()}_closeDialog(){this._handleClose()}async _handleClose(){var e;this._client&&await this._closeClientWithoutEvents(this._client),document.body.style.overflow=null!==(e=this._bodyOverflow)&&void 0!==e?e:"",this._flashSize=void 0,((e,t,i,r)=>{r=r||{};const o=new CustomEvent(t,{bubbles:void 0===r.bubbles||r.bubbles,cancelable:Boolean(r.cancelable),composed:void 0===r.composed||r.composed,detail:i});e.dispatchEvent(o)})(this,"closed"),this.parentNode.removeChild(this)}get _isSameFirmware(){var e;return!!this._info&&((null===(e=this.overrides)||void 0===e?void 0:e.checkSameFirmware)?this.overrides.checkSameFirmware(this._manifest,this._info):this._info.firmware===this._manifest.name)}get _isSameVersion(){return this._isSameFirmware&&this._info.version===this._manifest.version}async _closeClientWithoutEvents(e){e.removeEventListener("disconnect",this._handleDisconnect),await e.close()}}qi.styles=[I,g`
|
|
1359
|
+
`,!0,!0]}async _readPartitionTable(){this._busy=!0,this._partitions=void 0;try{this.logger.log("Reading partition table from 0x8000...");const e=await this._ensureStub();await le(100),this.logger.log("Reading flash data...");const t=function(e){const t=[];for(let i=0;i<e.length;i+=32){const r=Ni(e.slice(i,i+32));if(null===r)break;t.push(r)}return t}(await e.readFlash(32768,4096));0===t.length?(this.logger.log("No valid partition table found"),this._partitions=[]):(this.logger.log(`Found ${t.length} partition(s)`),this._partitions=t)}catch(e){this.logger.error(`Failed to read partition table: ${e.message||e}`),"Port selection cancelled"===e.message?(await this._releaseReaderWriter(),this._error="Port selection cancelled",this._state="ERROR"):e.message&&e.message.includes("Failed to connect")?(await this._releaseReaderWriter(),this._error=e.message,this._state="ERROR"):(this.logger.log("Returning to partition view with no partitions"),this._partitions=[])}finally{this._busy=!1}}async _openFilesystem(e){try{if(this._busy=!0,this.logger.log(`Detecting filesystem type for partition "${e.name}"...`),!this._espStub)throw new Error("ESP stub not available. Please reconnect.");const t=await async function(e,t,i,r=console){try{const o=Math.min(8192,i),s=await e.readFlash(t,o);if(s.length<32)return r.log("Partition too small, assuming SPIFFS"),"spiffs";if(new TextDecoder("ascii",{fatal:!1}).decode(s).includes("littlefs"))return r.log('✓ LittleFS detected: Found "littlefs" signature'),"littlefs";const a=new DataView(s.buffer,s.byteOffset,s.byteLength),l=[4096,2048,1024,512];for(const e of l)if(s.length>=2*e)try{for(let t=0;t<Math.min(e,s.length-4);t+=4){const e=a.getUint32(t,!0),i=1023&e;if((e>>20&4095)<=2047&&i>0&&i<=1022&&t+i+4<=s.length)return r.log("✓ LittleFS detected: Found valid metadata structure"),"littlefs"}}catch(e){}for(let e=0;e<Math.min(4096,s.length-4);e+=4){const t=a.getUint32(e,!0);if(538182953===t||538314025===t)return r.log("✓ SPIFFS detected: Found SPIFFS magic number"),"spiffs"}return r.log("⚠ No clear filesystem signature found, assuming SPIFFS"),"spiffs"}catch(e){return r.error(`Failed to detect filesystem type: ${e.message||e}`),"spiffs"}}(this._espStub,e.offset,e.size,this.logger);this.logger.log(`Detected filesystem: ${t}`),"littlefs"===t?(this._selectedPartition=e,this._state="LITTLEFS"):"spiffs"===t?(this.logger.error("SPIFFS support not yet implemented. Use LittleFS partitions."),this._error="SPIFFS support not yet implemented",this._state="ERROR"):(this.logger.error("Unknown filesystem type. Cannot open partition."),this._error="Unknown filesystem type",this._state="ERROR")}catch(e){this.logger.error(`Failed to open filesystem: ${e.message||e}`),this._error=`Failed to open filesystem: ${e.message||e}`,this._state="ERROR"}finally{this._busy=!1}}_formatSize(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(2)} KB`:`${(e/1048576).toFixed(2)} MB`}willUpdate(e){e.has("_state")&&("ERROR"!==this._state&&(this._error=void 0),"PROVISION"===this._state?this._updateSsids():this._provisionForce=!1,"INSTALL"===this._state&&(this._installConfirmed=!1,this._installState=void 0))}async _updateSsids(e=0){let t;this._ssids=void 0,this._busy=!0;try{t=await this._client.scan()}catch(e){return void 0===this._ssids&&(this._ssids=null,this._selectedSsid=null),void(this._busy=!1)}if(0===t.length&&e<3)return this.logger.log(`SSID scan returned empty, scheduling retry ${e+1}/3`),void setTimeout(()=>{"PROVISION"===this._state&&this._updateSsids(e+1)},2e3);this._ssids=t,this._selectedSsid=t.length?t[0].name:null,this._busy=!1}firstUpdated(e){super.firstUpdated(e),this._bodyOverflow=document.body.style.overflow,document.body.style.overflow="hidden";const t=this.logger;this.logger={log:(e,...i)=>{t.log(e,...i)},error:(e,...i)=>{t.error(e,...i)},debug:(e,...i)=>{t.debug&&t.debug(e,...i)}},this.esploader.logger=this.logger,this._initialize()}updated(e){super.updated(e),e.has("_state")&&this.setAttribute("state",this._state),"PROVISION"===this._state&&(e.has("_selectedSsid")&&null===this._selectedSsid?this._focusFormElement("ew-filled-text-field[name=ssid]"):e.has("_ssids")&&this._focusFormElement())}_focusFormElement(e="ew-filled-text-field, ew-filled-select"){const t=this.shadowRoot.querySelector(e);t&&t.updateComplete.then(()=>setTimeout(()=>t.focus(),100))}async _initialize(e=!1,t=!1){if(null===this._port.readable||null===this._port.writable)return this._state="ERROR",void(this._error="Serial port is not readable/writable. Close any other application using it and try again.");this._busy=!0,this.requestUpdate();try{this._manifest=JSON.parse(this.manifestPath)}catch{try{this._manifest=await(async e=>{const t=new URL(e,location.toString()).toString(),i=await W(t);if(!i.ok)throw new Error(`Failed to fetch manifest: ${i.status}`);const r=await i.json();return"new_install_skip_erase"in r&&(console.warn('Manifest option "new_install_skip_erase" is deprecated. Use "new_install_prompt_erase" instead.'),r.new_install_skip_erase&&(r.new_install_prompt_erase=!0)),r})(this.manifestPath)}catch(e){return this._state="ERROR",this._error="Failed to download manifest",void(this._busy=!1)}}if(t)return this.logger.log("Skipping Improv test (not needed for this operation)"),this._client=null,this._improvChecked=!0,void(this._busy=!1);if(0===this._manifest.new_install_improv_wait_time)return this._client=null,this._improvSupported=!1,this._improvChecked=!0,void(this._busy=!1);if(this._improvChecked)return this.logger.log(`Improv already checked - ${this._improvSupported?"supported":"not supported"}, skipping re-test`),this._improvSupported||(this._client=null),this._busy=!1,void this.requestUpdate();if(this._client)return this.logger.log("Improv client already active, skipping initialization"),this._improvSupported=!0,this._improvChecked=!0,void(this._busy=!1);const i=await this._isUsbJtagOrOtg();this._isUsbJtagOrOtgDevice=i;if(null!==this.esploader.chipFamily){if(this.logger.log("Device is in BOOTLOADER mode - switching to FIRMWARE mode for Improv test"),i){this.logger.log("USB-JTAG/OTG device - need to switch to firmware mode");try{this.esploader.chipFamily||(this.logger.log("Detecting chip type..."),await this.esploader.initialize(),this.logger.log(`Chip detected: ${this.esploader.chipFamily}`)),this._espStub||(this.logger.log("Creating stub for firmware mode switch..."),this._espStub=await this.esploader.runStub(),this.logger.log(`Stub created: IS_STUB=${this._espStub.IS_STUB}`)),await this._probeFlashSize(this._espStub);const e=this._espStub._parent||this._espStub;this._savedLoaderBeforeConsole=e,await this._releaseReaderWriter();try{await this._port.forget(),this.logger.log("Old port forgotten")}catch(e){this.logger.log(`Port forget failed: ${e.message}`)}await this.esploader.resetToFirmware(),this.logger.log("Device reset to firmware mode - port closed")}catch(e){this.logger.debug(`Reset to firmware error (expected): ${e.message}`)}return await le(100),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null,this._improvChecked=!1,this._client=void 0,this._improvSupported=!1,this.esploader._reader=void 0,this.logger.log("Waiting for user to select new port"),this._state="REQUEST_PORT_SELECTION",this._error="",void(this._busy=!1)}this.logger.log("External serial chip - resetting to firmware mode");try{await this._resetDeviceAndReleaseLocks(),await le(500)}catch(e){this.logger.log(`Reset to firmware failed: ${e.message}`)}}else this.logger.log("Device is already in FIRMWARE mode - ready for Improv test");try{await this._releaseReaderWriter(),await le(200),this.logger.log("Streams ready for Improv test")}catch(e){this.logger.log(`Failed to prepare streams: ${e.message}`)}this.logger.log("Testing Improv (device is in firmware mode)");const r=e&&void 0!==this._manifest.new_install_improv_wait_time?1e3*this._manifest.new_install_improv_wait_time:1e4;await this._testImprov(r,!0)}async _switchToFirmwareMode(e=null){if(!(null!==this.esploader.chipFamily)){if(this.logger.log("Device already in firmware mode"),"console"===e&&!this._consoleInitialized){this.logger.log("First console open - resetting device..."),this._consoleInitialized=!0;try{await this.esploader.hardReset(!1),this.logger.log("Device reset completed")}catch(e){this.logger.log(`Reset error (expected): ${e.message}`)}}return await this._releaseReaderWriter(),!1}this.logger.log(`Device is in bootloader mode - switching to firmware for ${e||"operation"}`),this.esploader.chipFamily||(this.logger.log("Detecting chip type..."),await this.esploader.initialize(),this.logger.log(`Chip detected: ${this.esploader.chipFamily}`)),this._espStub||(this.logger.log("Creating stub for firmware mode switch..."),this._espStub=await this.esploader.runStub(),this.logger.log(`Stub created: IS_STUB=${this._espStub.IS_STUB}`)),await this._resetBaudrateForConsole();const t=this._espStub._parent||this._espStub;this._savedLoaderBeforeSwitch=t;if(await this._isUsbJtagOrOtg()){this.logger.log("Releasing reader/writer..."),await this._releaseReaderWriter();try{try{await this._port.forget(),this.logger.log("Old port forgotten")}catch(e){this.logger.log(`Port forget failed: ${e.message}`)}await this.esploader.resetToFirmware(),this.logger.log("Device reset to firmware mode - port closed")}catch(e){this.logger.debug(`Reset to firmware error (expected): ${e.message}`)}return await le(100),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null,this._improvChecked=!1,this._client=null,this._improvSupported=!1,this.esploader._reader=void 0,"console"===e?this._openConsoleAfterReconnect=!0:"visit"===e?this._visitDeviceAfterReconnect=!0:"homeassistant"===e?this._addToHAAfterReconnect=!0:"wifi"===e&&(this._changeWiFiAfterReconnect=!0),this.logger.log("Waiting for user to select new port"),this._state="REQUEST_PORT_SELECTION",this._error="",this._busy=!1,!0}this.logger.log("External serial chip - resetting to firmware mode");try{await this.esploader.hardReset(!1),this.logger.log("Device reset to firmware mode")}catch(e){this.logger.log(`Reset worked. Expected slip Timeout read error: ${e.message}`)}await le(500),this.logger.log("Releasing reader/writer after reset..."),await this._releaseReaderWriter(),this._espStub=void 0,this.esploader.IS_STUB=!1,this.esploader.chipFamily=null;try{await this.esploader.hardReset(!1),this.logger.log("Device in firmware mode, start firmware with reset")}catch(e){this.logger.log(`Reset error: ${e.message}`)}return!1}_startInstall(e){this._state="INSTALL",this._installErase=e,this._installConfirmed=!1}async _confirmInstall(){this._installConfirmed=!0,this._installState=void 0,this._client&&await this._closeClientWithoutEvents(this._client),this._client=void 0,this.logger.log("Preparing device for flash operations (switching to bootloader mode)...");try{await this._prepareForFlashOperations()}catch(e){return this.logger.log(`Failed to prepare for flash: ${e.message}`),this._state="ERROR",void(this._error=`Failed to enter bootloader mode: ${e.message}`)}try{await this._ensureStub()}catch(e){return this._state="ERROR",void(this._error=e.message)}const e=this._espStub;null!=this.firmwareFile?new Blob([this.firmwareFile]).arrayBuffer().then(e=>this._flashFilebuffer(new Uint8Array(e))):Ui(async e=>{if(this._installState=e,"finished"===e.state){await this._isUsbJtagOrOtg()?(this._isUsbJtagOrOtgDevice=!0,await this._handleFlashComplete().catch(e=>{this.logger.error(`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`),this._state="ERROR",this._error=`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`})):this._handleFlashComplete().catch(e=>{this.logger.error(`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`),this._state="ERROR",this._error=`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`})}},e,this.logger,this.manifestPath,this._installErase,new Uint8Array(0),this.baudRate).catch(e=>{this.logger.error(`Flash error: ${e.message||e}`),this._state="ERROR",this._error=`Flash failed: ${e.message||e}`,this._busy=!1})}async _flashFilebuffer(e){const t=this._espStub;Ui(e=>{this._installState=e,"finished"===e.state&&this._handleFlashComplete().catch(e=>{this.logger.error(`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`),this._state="ERROR",this._error=`Post-flash cleanup failed: ${(null==e?void 0:e.message)||e}`})},t,this.logger,this.manifestPath,this._installErase,e,this.baudRate).catch(e=>{this.logger.error(`Flash error: ${e.message||e}`),this._state="ERROR",this._error=`Flash failed: ${e.message||e}`,this._busy=!1})}async _doProvision(){this._busy=!0,this._wasProvisioned=this._client.state===Ti.PROVISIONED;const e=null===this._selectedSsid?this.shadowRoot.querySelector("ew-filled-text-field[name=ssid]").value:this._selectedSsid,t=this.shadowRoot.querySelector("ew-filled-text-field[name=password]").value;try{await this._client.provision(e,t)}catch(e){return}finally{this._busy=!1,this._provisionForce=!1}}async _handleSelectNewPort(){if(this._busy)return void this.logger.log("Already processing port selection, ignoring duplicate click");let e;this._busy=!0,this.logger.log("User clicked 'Select Port' button - requesting new port..."),this.logger.log("Dialog in DOM at start: "+(this.parentNode?"yes":"no")),this._state="DASHBOARD",this._improvChecked=!1,this.requestUpdate(),this.parentNode||(document.body.appendChild(this),this.logger.log("Dialog re-added to DOM before port selection"));try{globalThis.requestSerialPort?(this.logger.log("Using WebUSB port selection (Android)"),e=await globalThis.requestSerialPort(e=>this.logger.log("[WebUSB]",e))):(this.logger.log("Using Web Serial port selection (Desktop)"),e=await navigator.serial.requestPort()),await new Promise(e=>setTimeout(e,50)),this.logger.log("Port selected by user"),this.parentNode||(document.body.appendChild(this),this.logger.log("Dialog re-added to DOM after port selection"))}catch(e){return this.logger.error("Port selection error:",e),"NotFoundError"===e.name?(this.logger.log("Port selection cancelled by user"),this._busy=!1,this._state="ERROR",void(this._error="Port selection cancelled")):(this._busy=!1,this._state="ERROR",void(this._error=`Port selection failed: ${e.message}`))}if(!e)return this.logger.error("newPort is null/undefined"),this._busy=!1,this._state="ERROR",void(this._error="Failed to select port");if(this.logger.log("Opening port at 115200 baud for firmware mode..."),this.logger.log("Dialog in DOM before opening port: "+(this.parentNode?"yes":"no")),null!==e.readable||null!==e.writable){this.logger.log("WARNING: Port appears to be open, closing it first...");try{await e.close(),await le(200),this.logger.log("Port closed successfully")}catch(e){this.logger.log(`Port close failed: ${e.message}`)}}try{await e.open({baudRate:115200}),this.logger.log("Port opened successfully at 115200 baud"),this.logger.log("Dialog in DOM after opening port: "+(this.parentNode?"yes":"no"))}catch(e){return this.logger.error("Port open error:",e),this._busy=!1,this._state="ERROR",void(this._error=`Failed to open port: ${e.message}`)}this.logger.log("Updating existing ESPLoader with new port for firmware mode..."),this.logger.log("Updating base loader port"),this.esploader.port=e,this.esploader.connected=!0,this._espStub&&(this.logger.log("Updating STUB port"),this._espStub.port=e,this._espStub.connected=!0,this._espStub._parent&&(this.logger.log("Updating parent loader port"),this._espStub._parent.port=e)),this._savedLoaderBeforeConsole&&(this.logger.log("Updating saved loader port"),this._savedLoaderBeforeConsole.port=e),this.logger.log("ESPLoader port updated for firmware mode (no bootloader sync)"),this.logger.log("Waiting 700ms for device to fully boot and port to be ready..."),await le(700),this.logger.log(`Port state check: readable=${null!==this._port.readable}, writable=${null!==this._port.writable}`),this.logger.log(`Checking for locks: reader=${this.esploader._reader?"LOCKED":"free"}, writer=${this.esploader._writer?"LOCKED":"free"}`),(this.esploader._reader||this.esploader._writer)&&(this.logger.log("WARNING: Port has active locks! Releasing them before Improv test..."),await this._releaseReaderWriter(),this.logger.log("Locks released")),this.logger.log("Device should be ready now"),this.logger.log("Testing Improv at 115200 baud..."),this._state="DASHBOARD",this.requestUpdate(),await this._testImprov(1e3,!1)}async _testImprov(e=1e3,t=!1){var i,r;let o;this._improvChecked=!0;try{this.logger.log(`Port for Improv: readable=${null!==this._port.readable}, writable=${null!==this._port.writable}`);const s=this._port.getInfo();if(this.logger.log(`Port info: VID=0x${null===(i=s.usbVendorId)||void 0===i?void 0:i.toString(16).padStart(4,"0")}, PID=0x${null===(r=s.usbProductId)||void 0===r?void 0:r.toString(16).padStart(4,"0")}`),!t){this.logger.log("Resetting device for Improv detection...");try{await this._releaseReaderWriter(),await this.esploader.hardReset(!1),this.logger.log("Device reset sent, device is rebooting..."),await this._releaseReaderWriter(),this.logger.log("Streams recreated after reset"),this.logger.log("Waiting for firmware running to be ready for Improv test..."),await le(500)}catch(e){this.logger.log(`Failed to reset device: ${e.message}`)}}this.logger.log("Flushing serial buffer before Improv init..."),await this._releaseReaderWriter(),await le(100),o=new Ai(this._port,this.logger),o.addEventListener("state-changed",()=>{this.requestUpdate()}),o.addEventListener("error-changed",()=>this.requestUpdate()),this.logger.log("Calling improvSerial.initialize()...");const a=await o.initialize(e);this.logger.log("Waiting for firmware to get valid IP address (checking every 500ms, max 10 seconds)...");const l=Date.now(),n=1e4;let d=!1;for(;Date.now()-l<n;){try{await o.requestCurrentState();const e=o.nextUrl;if(e&&!e.includes("0.0.0.0")){this.logger.log(`Valid IP found: ${e}`),d=!0;break}}catch(e){this.logger.log(`Failed to request current state: ${e.message}`)}await le(500)}d||this.logger.log(`Timeout after ${n/1e3} seconds - continuing with current URL: ${o.nextUrl||"undefined"}`),this._client=o,this._info=a,this._improvSupported=!0,o.addEventListener("disconnect",this._handleDisconnect),this.logger.log("Improv Wi-Fi Serial detected"),this.logger.log(`Improv state: ${o.state}, nextUrl: ${o.nextUrl||"undefined"}`)}catch(e){if(this.logger.log(`Improv Wi-Fi Serial not detected: ${e.message}`),this._client=null,this._info=void 0,this._improvSupported=!1,this.logger.log(`State after Improv failure: _client=${this._client}, _info=${this._info}, _improvSupported=${this._improvSupported}, _improvChecked=${this._improvChecked}`),o)try{this.logger.log("Closing failed Improv client..."),await o.close(),this.logger.log("Failed Improv client closed"),await le(200)}catch(e){this.logger.log(`Failed to close Improv client: ${e.message}`)}try{await this._releaseReaderWriter(),this.logger.log("Streams recreated after Improv failure")}catch(e){this.logger.log(`Failed to recreate streams: ${e.message}`)}}if(this._busy=!1,this._openConsoleAfterReconnect){if(this.logger.log("Opening console as requested by user"),this._openConsoleAfterReconnect=!1,this._client){try{await this._closeClientWithoutEvents(this._client),this.logger.log("Improv client closed before opening console")}catch(e){this.logger.log("Failed to close Improv client:",e)}this._client=void 0,await le(200)}await this._releaseReaderWriter(),this._state="LOGS"}else if(this._visitDeviceAfterReconnect)this.logger.log("Opening Visit Device URL as requested by user"),this._visitDeviceAfterReconnect=!1,this._client&&this._client.nextUrl&&window.open(this._client.nextUrl,"_blank","noopener,noreferrer"),this._state="DASHBOARD";else if(this._addToHAAfterReconnect)this.logger.log("Opening Home Assistant URL as requested by user"),this._addToHAAfterReconnect=!1,this._manifest.home_assistant_domain&&window.open(`https://my.home-assistant.io/redirect/config_flow_start/?domain=${this._manifest.home_assistant_domain}`,"_blank","noopener,noreferrer"),this._state="DASHBOARD";else if(this._changeWiFiAfterReconnect){if(this.logger.log("Opening Wi-Fi provisioning as requested by user"),this._changeWiFiAfterReconnect=!1,this._client){try{await this._closeClientWithoutEvents(this._client)}catch(e){this.logger.log("Failed to close Improv client:",e)}this._client=void 0,await le(200)}const e=await this._isWebUsbWithExternalSerial();if(this.esploader.isWebUSB&&this.esploader.isWebUSB()&&!e){this.logger.log("WebUSB CDC: Resetting device for Wi-Fi setup...");try{await this.esploader.hardReset(!1),this.logger.log("Device reset completed")}catch(e){this.logger.log(`Reset error: ${e.message}`)}await this._releaseReaderWriter(),await le(200)}else e?this.logger.log("WebUSB external serial: Preparing port for Wi-Fi setup..."):this.logger.log("WebSerial: Preparing port for Wi-Fi setup..."),await this._releaseReaderWriter(),await le(200);this.logger.log("Port ready for Wi-Fi setup"),this.logger.log("Flushing serial buffer before Improv init..."),await this._releaseReaderWriter(),await le(100),this.logger.log("Re-initializing Improv Serial for Wi-Fi setup");const t=new Ai(this._port,this.logger);t.addEventListener("state-changed",()=>{this.requestUpdate()}),t.addEventListener("error-changed",()=>this.requestUpdate());try{this._info=await t.initialize(1e4),this._client=t,t.addEventListener("disconnect",this._handleDisconnect),this.logger.log("Improv client ready for Wi-Fi provisioning"),this._state="PROVISION",this._provisionForce=!0}catch(e){try{await this._closeClientWithoutEvents(t)}catch(e){this.logger.log("Failed to close Improv client after init error:",e)}this.logger.log(`Improv initialization failed: ${e.message}`),this._error=`Improv initialization failed: ${e.message}`,this._state="ERROR"}}else this._state="DASHBOARD";this.parentNode||(document.body.appendChild(this),this.logger.log("Dialog re-added to DOM")),this.requestUpdate(),await new Promise(e=>setTimeout(e,100))}_preventDefault(e){e.preventDefault()}_closeDialog(){this._handleClose()}async _handleClose(){var e;this._client&&await this._closeClientWithoutEvents(this._client),document.body.style.overflow=null!==(e=this._bodyOverflow)&&void 0!==e?e:"",this._flashSize=void 0,this._detectedBuild=void 0,((e,t,i,r)=>{r=r||{};const o=new CustomEvent(t,{bubbles:void 0===r.bubbles||r.bubbles,cancelable:Boolean(r.cancelable),composed:void 0===r.composed||r.composed,detail:i});e.dispatchEvent(o)})(this,"closed"),this.parentNode.removeChild(this)}_buildVariantLabel(e){const t=function(e){const t=e.parts.map(e=>e.path).filter(e=>{const t=e.toLowerCase();return!t.includes("bootloader")&&!t.includes("partition")});if(0===t.length)return;const i=t.find(e=>e.toLowerCase().includes("factory"));return(null!=i?i:t[0]).split("/").pop().split("\\").pop()}(e);if(t)return t;const i=[];return e.chipVariant&&i.push(e.chipVariant),e.flashSizeMB&&i.push(`${e.flashSizeMB} MB`),e.usbInterface&&i.push(e.usbInterface),i.length>0?i.join(", "):void 0}get _isSameFirmware(){var e;return!!this._info&&((null===(e=this.overrides)||void 0===e?void 0:e.checkSameFirmware)?this.overrides.checkSameFirmware(this._manifest,this._info):this._info.firmware===this._manifest.name)}get _isSameVersion(){return this._isSameFirmware&&this._info.version===this._manifest.version}async _closeClientWithoutEvents(e){e.removeEventListener("disconnect",this._handleDisconnect),await e.close()}}ji.styles=[I,g`
|
|
1358
1360
|
ew-icon-button {
|
|
1359
1361
|
position: absolute;
|
|
1360
1362
|
right: 4px;
|
|
@@ -1469,4 +1471,4 @@ import{e,i as t,_ as i,n as r,m as o,a as s,b as a,r as l,c as n,d,f as c,g as h
|
|
|
1469
1471
|
.partition-table tbody tr:hover {
|
|
1470
1472
|
background-color: rgba(3, 169, 244, 0.1);
|
|
1471
1473
|
}
|
|
1472
|
-
`],i([l()],
|
|
1474
|
+
`],i([l()],ji.prototype,"_client",void 0),i([l()],ji.prototype,"_state",void 0),i([l()],ji.prototype,"_installErase",void 0),i([l()],ji.prototype,"_installConfirmed",void 0),i([l()],ji.prototype,"_installState",void 0),i([l()],ji.prototype,"_provisionForce",void 0),i([l()],ji.prototype,"_error",void 0),i([l()],ji.prototype,"_busy",void 0),i([l()],ji.prototype,"_ssids",void 0),i([l()],ji.prototype,"_selectedSsid",void 0),i([l()],ji.prototype,"_partitions",void 0),i([l()],ji.prototype,"_selectedPartition",void 0),i([l()],ji.prototype,"_espStub",void 0),i([l()],ji.prototype,"_isUsbJtagOrOtgDevice",void 0),i([l()],ji.prototype,"_flashSize",void 0),i([l()],ji.prototype,"_detectedBuild",void 0),customElements.define("ewt-install-dialog",ji);export{ji as EwtInstallDialog};
|