UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

26 lines 25 kB
/*! For license information please see 73476.970b1455f7be9bed.js.LICENSE.txt */ export const __rspack_esm_id=73476;export const __rspack_esm_ids=[73476];export const __webpack_modules__={57673(e,t,o){o.d(t,{z:()=>r});const r=e=>{if(void 0===e)return;if("object"!=typeof e){if("string"==typeof e||isNaN(e)){const t=e?.toString().split(":")||[];if(1===t.length)return{seconds:Number(t[0])};if(t.length>3)return;const o=Number(t[2])||0,r=Math.floor(o);return{hours:Number(t[0])||0,minutes:Number(t[1])||0,seconds:r,milliseconds:Math.floor(1e3*Number((o-r).toFixed(4)))}}return{seconds:e}}if(!("days"in e))return e;const{days:t,minutes:o,seconds:r,milliseconds:a}=e;let i=e.hours||0;return i=(i||0)+24*(t||0),{hours:i,minutes:o,seconds:r,milliseconds:a}}},9503(e,t,o){var r=o(62826),a=o(97577),i=o(5124),s=o(22441);class n extends a.A{get value(){return this._value??null}set value(e){this._value=e}static get styles(){return[a.A.styles,i.AH`:host{--wa-form-control-toggle-size:var(--ha-checkbox-size, 20px);--wa-form-control-border-color:var( --ha-checkbox-border-color, var(--ha-color-border-neutral-normal) );--wa-form-control-background-color:var( --ha-checkbox-background-color, var(--wa-form-control-background-color) );--checked-icon-color:var( --ha-checkbox-checked-icon-color, var(--wa-color-brand-on-loud) );--wa-form-control-activated-color:var( --ha-checkbox-checked-background-color, var(--ha-color-fill-primary-loud-resting) );-webkit-tap-highlight-color:transparent;--checked-icon-scale:var(--ha-checkbox-checked-icon-scale, 0.9);--wa-form-control-required-content:var( --ha-checkbox-required-marker, var(--ha-input-required-marker, "*") );--wa-form-control-required-content-offset:var( --ha-checkbox-required-marker-offset, 0.1rem )}[part~=base]{align-items:center;gap:var(--ha-space-2)}[part~=control]{border-radius:var(--ha-checkbox-border-radius,var(--ha-border-radius-sm));border-width:var(--ha-checkbox-border-width,var(--ha-border-width-md));margin-inline-end:0}[part~=label]{line-height:1}#hint{font-size:var(--ha-font-size-xs);color:var(--ha-color-text-secondary)}label:has(input:not(:disabled)):hover{--wa-form-control-border-color:var( --ha-checkbox-border-color-hover, var(--ha-checkbox-border-color, var(--ha-color-border-neutral-loud)) )}label:has(input:not(:disabled)):hover [part~=control]{background-color:var(--ha-checkbox-background-color-hover,var(--ha-color-form-background-hover))}label:has(input:checked:not(:disabled)):hover [part~=control],label:has(input:indeterminate:not(:disabled)):hover [part~=control]{background-color:var(--ha-checkbox-checked-background-color-hover,var(--ha-color-fill-primary-loud-hover));border-color:var(--ha-checkbox-checked-background-color-hover,var(--ha-color-fill-primary-loud-hover))}`]}}n=(0,r.Cg)([(0,s.EM)("ha-checkbox")],n)},70947(e,t,o){var r=o(62826),a=o(50759),i=(o(38625),o(5124)),s=o(22441);o(67094);class n extends a.A{renderCheckboxIcon(){return i.qy` <ha-svg-icon id="check" part="checkmark" .path="${this.checked?"M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z":"M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z"}"></ha-svg-icon> `}static get styles(){return[a.A.styles,i.AH`:host{min-height:var(--ha-space-10)}#check{visibility:visible;flex-shrink:0}#icon ::slotted(*){color:var(--ha-color-on-neutral-normal)}:host([variant=danger]) #icon ::slotted(*){color:var(--ha-color-on-danger-quiet)}:host([selected]){font-weight:var(--ha-font-weight-medium);color:var(--primary-color);background-color:var(--ha-color-fill-primary-quiet-resting);--icon-primary-color:var(--primary-color)}:host([selected]:hover){background-color:var(--ha-color-fill-primary-quiet-hover)}`]}constructor(...e){super(...e),this.selected=!1}}(0,r.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],n.prototype,"selected",void 0),n=(0,r.Cg)([(0,s.EM)("ha-dropdown-item")],n)},29823(e,t,o){o.a(e,async function(e,t){try{var r=o(62826),a=o(52254),i=o(5124),s=o(22441),n=e([a]);a=(n.then?(await n)():n)[0];class l extends a.A{get anchorElement(){return this.popup?.anchor}set anchorElement(e){this.popup&&(this.popup.anchor&&"ha-icon-button"===this.popup.anchor.localName&&(this.popup.anchor.selected=!1),this.popup.anchor=e)}getTrigger(){return this.anchorElement?this.anchorElement:super.getTrigger()}async showMenu(){await super.showMenu();const e=this.getTrigger();e&&"ha-icon-button"===e.localName&&(e.selected=!0)}async hideMenu(){const e=this.getTrigger();e&&"ha-icon-button"===e.localName&&(e.selected=!1),await super.hideMenu()}static get styles(){return[a.A.styles,i.AH`:host{font-size:var(--ha-dropdown-font-size, var(--ha-font-size-m));--wa-color-surface-raised:var( --card-background-color, var(--ha-dialog-surface-background, var(--mdc-theme-surface, #fff)), )}#menu{padding:var(--ha-space-1)}wa-popup::part(popup){z-index:200}`]}constructor(...e){super(...e),this.dropdownTag="ha-dropdown",this.dropdownItemTag="ha-dropdown-item"}}(0,r.Cg)([(0,s.MZ)({attribute:!1})],l.prototype,"dropdownTag",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],l.prototype,"dropdownItemTag",void 0),l=(0,r.Cg)([(0,s.EM)("ha-dropdown")],l),t()}catch(e){t(e)}})},64138(e,t,o){o.a(e,async function(e,r){try{o.r(t),o.d(t,{HaIconPicker:()=>f});o(74423),o(44114),o(18111),o(22489),o(7588),o(61701),o(13579);var a=o(62826),i=o(5124),s=o(22441),n=o(22786),l=o(1087),c=o(700),d=(o(75064),o(38508)),h=(o(47680),e([d]));d=(h.then?(await h)():h)[0];let u=[],p=!1;const v=(e,t)=>{const o=`${t}:${e.name}`,r=e.name,a=r.split("-"),i=e.keywords??[],s={iconName:r};return a.forEach((e,t)=>{s[`part${t}`]=e}),i.forEach((e,t)=>{s[`keyword${t}`]=e}),{id:o,primary:o,icon:o,search_labels:s,sorting_label:o}},b=async()=>{p=!0;const e=await o.e(81340).then(o.t.bind(o,25143,19));u=e.default.map(e=>v(e,"mdi"));const t=[];Object.keys(c.y).forEach(e=>{t.push(g(e))}),(await Promise.all(t)).forEach(e=>{u.push(...e)})},g=async e=>{try{const t=c.y[e].getIconList;if("function"!=typeof t)return[];return(await t()).map(t=>v(t,e))}catch(t){return console.warn(`Unable to load icon list for ${e} iconset`),[]}},m=e=>i.qy` <ha-combo-box-item type="button"> <ha-icon .icon="${e.id}" slot="start"></ha-icon> ${e.id} </ha-combo-box-item> `;class f extends i.WF{render(){return i.qy` <ha-generic-picker allow-custom-value .getItems="${this._getIconPickerItems}" .helper="${this.helper}" .disabled="${this.disabled}" .required="${this.required}" .errorMessage="${this.errorMessage}" .invalid="${this.invalid}" .rowRenderer="${m}" .icon="${this._icon}" .label="${this.label}" .value="${this._value}" .searchFn="${this._filterIcons}" @value-changed="${this._valueChanged}"> <slot name="start"></slot> </ha-generic-picker> `}firstUpdated(){p||b().then(()=>{this._getIconPickerItems=()=>u,this.requestUpdate()})}_valueChanged(e){e.stopPropagation(),this._setValue(e.detail.value)}_setValue(e){this.value=e,(0,l.r)(this,"value-changed",{value:this._value},{bubbles:!1,composed:!1})}get _icon(){return this.value?.length?this.value:this.placeholder}get _value(){return this.value||""}constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.invalid=!1,this._getIconPickerItems=()=>u,this._filterIcons=(0,n.A)((e,t,o)=>{const r=e.toLowerCase().replace(/\s+/g,"-"),a=o?.length?o:t;if(!r.length)return a;const i=[];for(const e of a){const t=(e.id.split(":")[1]||e.id).toLowerCase().split("-"),o=e.search_labels?Object.values(e.search_labels).filter(e=>null!==e).map(e=>e.toLowerCase()):[],a=e.id.toLowerCase();t.includes(r)?i.push({item:e,rank:1}):o.includes(r)?i.push({item:e,rank:2}):a.includes(r)?i.push({item:e,rank:3}):o.some(e=>e.includes(r))&&i.push({item:e,rank:4})}return i.sort((e,t)=>e.rank-t.rank).map(e=>e.item)})}}f.styles=i.AH`ha-generic-picker{width:100%;display:block}`,(0,a.Cg)([(0,s.MZ)()],f.prototype,"value",void 0),(0,a.Cg)([(0,s.MZ)()],f.prototype,"label",void 0),(0,a.Cg)([(0,s.MZ)()],f.prototype,"helper",void 0),(0,a.Cg)([(0,s.MZ)()],f.prototype,"placeholder",void 0),(0,a.Cg)([(0,s.MZ)({attribute:"error-message"})],f.prototype,"errorMessage",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],f.prototype,"disabled",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],f.prototype,"required",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],f.prototype,"invalid",void 0),f=(0,a.Cg)([(0,s.EM)("ha-icon-picker")],f),r()}catch(e){r(e)}})},606(e,t,o){o.a(e,async function(e,t){try{o(74423),o(18111),o(61701);var r=o(62826),a=o(5124),i=o(22441),s=o(63672),n=o(22786),l=o(1087),c=o(29823),d=(o(70947),o(3449),o(88285)),h=(o(67094),e([c,d]));[c,d]=h.then?(await h)():h;class u extends a.WF{render(){return this.disabled?a.qy`${this._renderField()}${this._renderHelper()}`:a.qy` <ha-dropdown placement="bottom" @wa-select="${this._handleSelect}" @wa-show="${this._handleShow}" @wa-hide="${this._handleHide}"> ${this._renderField()} ${this.options?this.options.map(e=>{const t=["string","number"].includes(typeof e);return a.qy` <ha-dropdown-item .value="${t?e:e.value}" .disabled="${!t&&(e.disabled??!1)}" .selected="${this.value===(t?e:e.value)}"> ${e.iconPath?a.qy`<ha-svg-icon slot="icon" .path="${e.iconPath}"></ha-svg-icon>`:a.s6} <div class="content"> ${t?e:e.label||e.value} ${e.secondary?a.qy`<div class="secondary">${e.secondary}</div>`:a.s6} </div> </ha-dropdown-item> `}):a.qy`<slot></slot>`} </ha-dropdown> ${this._renderHelper()} `}_renderField(){const e=this._getValueLabel(this.options,this.value);return a.qy` <ha-picker-field slot="trigger" type="button" class="${this._opened?"opened":""}" compact="compact" aria-label="${(0,s.J)(this.label)}" @clear="${this._clearValue}" .label="${this.label}" .value="${e}" .required="${this.required}" .disabled="${this.disabled}" .hideClearIcon="${!this.clearable||this.required||this.disabled||!String(this.value)}"> </ha-picker-field> `}_renderHelper(){return this.helper?a.qy`<ha-input-helper-text .disabled="${this.disabled}">${this.helper}</ha-input-helper-text>`:a.s6}_handleSelect(e){e.stopPropagation();const t=e.detail.item.value;t!==this.value&&(0,l.r)(this,"selected",{value:t})}_clearValue(){!this.disabled&&this.value&&(0,l.r)(this,"selected",{value:void 0})}_handleShow(){this.style.setProperty("--select-menu-width",`${this._triggerField.offsetWidth}px`),this._opened=!0}_handleHide(){this._opened=!1}constructor(...e){super(...e),this.clearable=!1,this.required=!1,this.disabled=!1,this._opened=!1,this._getValueLabel=(0,n.A)((e,t)=>{const o=void 0!==t?String(t):void 0;if(!e||!o)return o;for(const t of e){const e=["string","number"].includes(typeof t);if(e&&t===o||!e&&String(t.value)===o)return e?t:t.label||t.value}return o})}}u.styles=a.AH`:host{position:relative}ha-picker-field.opened{--mdc-text-field-idle-line-color:var(--primary-color)}ha-dropdown-item .content{display:flex;gap:var(--ha-space-1);flex-direction:column}ha-dropdown-item .secondary{font-size:var(--ha-font-size-s);color:var(--ha-color-text-secondary)}ha-dropdown::part(menu){min-width:var(--select-menu-width)}ha-input-helper-text{display:block;margin:var(--ha-space-2) 0 0}`,(0,r.Cg)([(0,i.MZ)({type:Boolean})],u.prototype,"clearable",void 0),(0,r.Cg)([(0,i.MZ)({attribute:!1})],u.prototype,"options",void 0),(0,r.Cg)([(0,i.MZ)()],u.prototype,"label",void 0),(0,r.Cg)([(0,i.MZ)()],u.prototype,"helper",void 0),(0,r.Cg)([(0,i.MZ)()],u.prototype,"value",void 0),(0,r.Cg)([(0,i.MZ)({type:Boolean})],u.prototype,"required",void 0),(0,r.Cg)([(0,i.MZ)({type:Boolean})],u.prototype,"disabled",void 0),(0,r.Cg)([(0,i.wk)()],u.prototype,"_opened",void 0),(0,r.Cg)([(0,i.P)("ha-picker-field")],u.prototype,"_triggerField",void 0),u=(0,r.Cg)([(0,i.EM)("ha-select")],u),t()}catch(e){t(e)}})},14872(e,t,o){o.a(e,async function(e,r){try{o.r(t);var a=o(62826),i=o(5124),s=o(22441),n=o(57673),l=o(1087),c=(o(9503),o(39927)),d=o(64138),h=o(91485),u=o(14503),p=e([c,d,h]);[c,d,h]=p.then?(await p)():p;class v extends i.WF{set item(e){this._item=e,e?(this._name=e.name||"",this._icon=e.icon||"",this._duration=e.duration||"00:00:00",this._restore=e.restore||!1):(this._name="",this._icon="",this._duration="00:00:00",this._restore=!1),this._setDurationData()}focus(){this.updateComplete.then(()=>this._focusElement?.focus())}render(){return this.hass?i.qy` <div class="form"> <ha-input .value="${this._name}" .configValue="${"name"}" @input="${this._valueChanged}" .label="${this.hass.localize("ui.dialogs.helper_settings.generic.name")}" auto-validate required .validationMessage="${this.hass.localize("ui.dialogs.helper_settings.required_error_msg")}" dialogInitialFocus .disabled="${this.disabled}"></ha-input> <ha-icon-picker .hass="${this.hass}" .value="${this._icon}" .configValue="${"icon"}" @value-changed="${this._valueChanged}" .label="${this.hass.localize("ui.dialogs.helper_settings.generic.icon")}" .disabled="${this.disabled}"></ha-icon-picker> <ha-duration-input .configValue="${"duration"}" .data="${this._duration_data}" @value-changed="${this._valueChanged}" .disabled="${this.disabled}"></ha-duration-input> <ha-checkbox .configValue="${"restore"}" .checked="${this._restore}" @change="${this._toggleRestore}" .disabled="${this.disabled}"> ${this.hass.localize("ui.dialogs.helper_settings.timer.restore")} </ha-checkbox> </div> `:i.s6}_valueChanged(e){if(!this.new&&!this._item)return;e.stopPropagation();const t=e.target.configValue,o=e.detail?.value||e.target.value;if(this[`_${t}`]===o)return;const r={...this._item};o?r[t]=o:delete r[t],(0,l.r)(this,"value-changed",{value:r})}_toggleRestore(e){this._restore=e.target.checked,(0,l.r)(this,"value-changed",{value:{...this._item,restore:this._restore}})}_setDurationData(){let e;if("object"==typeof this._duration&&null!==this._duration){const t=this._duration;e={hours:"string"==typeof t.hours?parseFloat(t.hours):t.hours,minutes:"string"==typeof t.minutes?parseFloat(t.minutes):t.minutes,seconds:"string"==typeof t.seconds?parseFloat(t.seconds):t.seconds}}else e=this._duration;this._duration_data=(0,n.z)(e)}static get styles(){return[u.RF,i.AH`.form{color:var(--primary-text-color)}ha-duration-input{display:block;margin:8px 0}ha-checkbox{min-height:40px;justify-content:center}`]}constructor(...e){super(...e),this.new=!1,this.disabled=!1}}(0,a.Cg)([(0,s.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"new",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],v.prototype,"disabled",void 0),(0,a.Cg)([(0,s.wk)()],v.prototype,"_name",void 0),(0,a.Cg)([(0,s.wk)()],v.prototype,"_icon",void 0),(0,a.Cg)([(0,s.wk)()],v.prototype,"_duration",void 0),(0,a.Cg)([(0,s.wk)()],v.prototype,"_duration_data",void 0),(0,a.Cg)([(0,s.wk)()],v.prototype,"_restore",void 0),(0,a.Cg)([(0,s.P)("[dialogInitialFocus]")],v.prototype,"_focusElement",void 0),v=(0,a.Cg)([(0,s.EM)("ha-timer-form")],v),r()}catch(e){r(e)}})},22395(e,t,o){var r=o(5124),a=o(22441),i=o(717),s=r.AH`:host{display:inline-flex}.button-group{display:flex;position:relative;isolation:isolate;flex-wrap:wrap}@media (hover:hover){.button-group::slotted(:hover),.button-group>:hover{z-index:1}}.button-group::slotted(:focus),.button-group::slotted([aria-checked=true]),.button-group::slotted([checked]),.button-group>:focus,.button-group>[aria-checked=true],.button-group>[checked]{z-index:2!important}:host([orientation=horizontal]) .button-group{flex-direction:row}:host([orientation=vertical]) .button-group{flex-direction:column}:host([orientation=horizontal]){--_button-horizontal-indent:var(--wa-form-control-border-width);--_button-horizontal-indent-outlined:calc(var(--wa-form-control-border-width) * -1)}:host([orientation=vertical]){--_button-vertical-indent:var(--wa-form-control-border-width);--_button-vertical-indent-outlined:calc(var(--wa-form-control-border-width) * -1)}::slotted(:not(:first-child):not(:last-child)){--_button-start-start-radius:0;--_button-start-end-radius:0;--_button-end-start-radius:0;--_button-end-end-radius:0}:host([orientation=horizontal]) ::slotted(:first-child:not(:last-child)){--_button-start-end-radius:0;--_button-end-end-radius:0}:host([orientation=horizontal]) ::slotted(:last-child:not(:first-child)){--_button-start-start-radius:0;--_button-end-start-radius:0}:host([orientation=vertical]) ::slotted(:first-child:not(:last-child)){--_button-end-start-radius:0;--_button-end-end-radius:0}:host([orientation=vertical]) ::slotted(:last-child:not(:first-child)){--_button-start-start-radius:0;--_button-start-end-radius:0}`,n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=(e,t,o,r)=>{for(var a,i=r>1?void 0:r?l(t,o):t,s=e.length-1;s>=0;s--)(a=e[s])&&(i=(r?a(t,o,i):a(i))||i);return r&&i&&n(t,o,i),i};let d=class extends i.A{updated(e){super.updated(e),e.has("orientation")&&this.setAttribute("aria-orientation",this.orientation)}handleFocus(e){const t=h(e.target,this.childSelector);t?.classList.add("button-focus")}handleBlur(e){const t=h(e.target,this.childSelector);t?.classList.remove("button-focus")}handleMouseOver(e){const t=h(e.target,this.childSelector);t?.classList.add("button-hover")}handleMouseOut(e){const t=h(e.target,this.childSelector);t?.classList.remove("button-hover")}render(){return r.qy` <slot part="base" class="button-group" role="${this.disableRole?"presentation":"group"}" aria-label="${this.label}" aria-orientation="${this.orientation}" @focusout="${this.handleBlur}" @focusin="${this.handleFocus}" @mouseover="${this.handleMouseOver}" @mouseout="${this.handleMouseOut}"></slot> `}constructor(){super(...arguments),this.disableRole=!1,this.hasOutlined=!1,this.label="",this.orientation="horizontal",this.childSelector="wa-button, wa-radio-button"}};function h(e,t){return e.closest(t)??e.querySelector(t)}d.css=[s],c([(0,a.P)("slot")],d.prototype,"defaultSlot",2),c([(0,a.wk)()],d.prototype,"disableRole",2),c([(0,a.wk)()],d.prototype,"hasOutlined",2),c([(0,a.MZ)()],d.prototype,"label",2),c([(0,a.MZ)({reflect:!0})],d.prototype,"orientation",2),c([(0,a.MZ)()],d.prototype,"childSelector",2),d=c([(0,a.EM)("wa-button-group")],d)},97577(e,t,o){o.d(t,{A:()=>y});var r=o(5124),a=o(22441),i=o(6412),s=o(63672),n=o(34514),l=o(40991),c=o(92070),d=o(49546),h=o(9395),u=o(62676),p=o(15477),v=o(31896),b=(o(38625),r.AH`:host{--checked-icon-color:var(--wa-color-brand-on-loud);--checked-icon-scale:0.8;display:inline-flex;color:var(--wa-form-control-value-color);font-family:inherit;font-weight:var(--wa-form-control-value-font-weight);line-height:var(--wa-form-control-value-line-height);user-select:none;-webkit-user-select:none}[part~=control]{display:inline-flex;flex:0 0 auto;position:relative;align-items:center;justify-content:center;width:var(--wa-form-control-toggle-size);height:var(--wa-form-control-toggle-size);border-color:var(--wa-form-control-border-color);border-radius:min(calc(var(--wa-form-control-toggle-size) * .375),var(--wa-border-radius-s));border-style:var(--wa-border-style);border-width:var(--wa-form-control-border-width);background-color:var(--wa-form-control-background-color);transition:background var(--wa-transition-normal),border-color var(--wa-transition-fast),box-shadow var(--wa-transition-fast),color var(--wa-transition-fast);transition-timing-function:var(--wa-transition-easing);margin-inline-end:.5em}[part~=base]{display:flex;align-items:flex-start;position:relative;color:currentColor;vertical-align:middle;cursor:pointer}[part~=label]{display:inline}[part~=control]:has(:checked,:indeterminate){color:var(--checked-icon-color);border-color:var(--wa-form-control-activated-color);background-color:var(--wa-form-control-activated-color)}[part~=control]:has(> input:focus-visible:not(:disabled)){outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}:host [part~=base]:has(input:disabled){opacity:.5;cursor:not-allowed}input{position:absolute;padding:0;margin:0;height:100%;width:100%;opacity:0;pointer-events:none}[part~=icon]{display:flex;scale:var(--checked-icon-scale)}[part~=icon]::part(svg){translate:0.0009765625em}input:not(:checked,:indeterminate)+[part~=icon]{visibility:hidden}:host([required]) [part~=label]::after{content:var(--wa-form-control-required-content);color:var(--wa-form-control-required-content-color);margin-inline-start:var(--wa-form-control-required-content-offset)}`),g=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=(e,t,o,r)=>{for(var a,i=r>1?void 0:r?m(t,o):t,s=e.length-1;s>=0;s--)(a=e[s])&&(i=(r?a(t,o,i):a(i))||i);return r&&i&&g(t,o,i),i};let y=class extends u.q{static get validators(){const e=r.S$?[]:[(0,d.Y)({validationProperty:"checked",validationElement:Object.assign(document.createElement("input"),{type:"checkbox",required:!0})})];return[...super.validators,...e]}get value(){return this._value??"on"}set value(e){this._value=e}handleSizeChange(){(0,l.b)(this.localName,this.size)}get checked(){return this.valueHasChanged?Boolean(this._checked):this._checked??this.defaultChecked}set checked(e){this._checked=Boolean(e),this.valueHasChanged=!0}handleClick(){this.hasInteracted=!0,this.checked=!this.checked,this.indeterminate=!1,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})}connectedCallback(){super.connectedCallback(),this.handleDefaultCheckedChange()}handleDefaultCheckedChange(){this.handleValueOrCheckedChange()}handleValueOrCheckedChange(){this.setValue(this.checked?this.value:null,this._value),this.updateValidity()}handleStateChange(){this.hasUpdated&&(this.input.checked=this.checked,this.input.indeterminate=this.indeterminate),this.customStates.set("checked",this.checked),this.customStates.set("indeterminate",this.indeterminate),this.updateValidity()}handleDisabledChange(){this.customStates.set("disabled",this.disabled)}willUpdate(e){super.willUpdate(e),(e.has("value")||e.has("checked")||e.has("defaultChecked"))&&this.handleValueOrCheckedChange()}formResetCallback(){this._checked=null,super.formResetCallback(),this.handleValueOrCheckedChange()}click(){this.input.click()}focus(e){this.input.focus(e)}blur(){this.input.blur()}render(){const e=!!r.S$||this.hasSlotController.test("hint"),t=!!this.hint||!!e,o=!this.checked&&this.indeterminate,a=o?"indeterminate":"check",l=o?"indeterminate":"check";return r.qy` <label part="base"> <span part="control"> <input class="input" type="checkbox" title="${this.title}" name="${(0,s.J)(this.name)}" value="${(0,s.J)(this._value)}" .indeterminate="${(0,n.V)(this.indeterminate)}" .checked="${(0,n.V)(this.checked)}" .disabled="${this.disabled}" .required="${this.required}" aria-checked="${this.indeterminate?"mixed":this.checked?"true":"false"}" aria-describedby="hint" @click="${this.handleClick}"> <wa-icon part="${l}-icon icon" library="system" name="${a}"></wa-icon> </span> <slot part="label"></slot> </label> <slot id="hint" part="hint" name="hint" aria-hidden="${t?"false":"true"}" class="${(0,i.H)({"has-slotted":t})}"> ${this.hint} </slot> `}constructor(){super(...arguments),this.hasSlotController=new c.X(this,"hint"),this.title="",this.name=null,this._value=this.getAttribute("value")??null,this.size="m",this.disabled=!1,this.indeterminate=!1,this._checked=null,this.defaultChecked=this.hasAttribute("checked"),this.required=!1,this.hint=""}};y.css=[p.A,v.A,b],y.shadowRootOptions={...u.q.shadowRootOptions,delegatesFocus:!0},f([(0,a.P)('input[type="checkbox"]')],y.prototype,"input",2),f([(0,a.MZ)()],y.prototype,"title",2),f([(0,a.MZ)({reflect:!0})],y.prototype,"name",2),f([(0,a.MZ)({reflect:!0})],y.prototype,"value",1),f([(0,a.MZ)({reflect:!0})],y.prototype,"size",2),f([(0,h.w)("size")],y.prototype,"handleSizeChange",1),f([(0,a.MZ)({type:Boolean})],y.prototype,"disabled",2),f([(0,a.MZ)({type:Boolean,reflect:!0})],y.prototype,"indeterminate",2),f([(0,a.MZ)({type:Boolean,attribute:!1})],y.prototype,"checked",1),f([(0,a.MZ)({type:Boolean,reflect:!0,attribute:"checked"})],y.prototype,"defaultChecked",2),f([(0,a.MZ)({type:Boolean,reflect:!0})],y.prototype,"required",2),f([(0,a.MZ)()],y.prototype,"hint",2),f([(0,h.w)(["checked","defaultChecked"])],y.prototype,"handleDefaultCheckedChange",1),f([(0,h.w)(["checked","indeterminate"])],y.prototype,"handleStateChange",1),f([(0,h.w)("disabled")],y.prototype,"handleDisabledChange",1),y=f([(0,a.EM)("wa-checkbox")],y),y.disableWarning?.("change-in-update")},49546(e,t,o){o.d(t,{Y:()=>r});o(44114);const r=(e={})=>{let{validationElement:t,validationProperty:o}=e;t||(t=Object.assign(document.createElement("input"),{required:!0})),o||(o="value");const r={observedAttributes:["required"],message:t.validationMessage,checkValidity(e){const t={message:"",isValid:!0,invalidKeys:[]};if(!(e.required??e.hasAttribute("required")))return t;return!e[o]&&(t.message="function"==typeof r.message?r.message(e):r.message||"",t.isValid=!1,t.invalidKeys.push("valueMissing")),t}};return r}}};