/*! For license information please see OES9VICR.js.LICENSE.txt */
export const id=8262;export const ids=[8262];export const modules={8262:(e,t,i)=>{i.r(t),i.d(t,{DialogDataTableSettings:()=>u});var n=i(5461),a=(i(9805),i(8597)),o=i(196),r=i(9760),s=i(6580),l=i(5081),d=i(3799),c=i(8762),h=(i(9484),i(9154),i(6494),i(3167));let u=(0,n.A)([(0,o.EM)("dialog-data-table-settings")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.MZ)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.wk)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,o.wk)()],key:"_columnOrder",value:void 0},{kind:"field",decorators:[(0,o.wk)()],key:"_hiddenColumns",value:void 0},{kind:"method",key:"showDialog",value:function(e){this._params=e,this._columnOrder=e.columnOrder,this._hiddenColumns=e.hiddenColumns}},{kind:"method",key:"closeDialog",value:function(){this._params=void 0,(0,h.r)(this,"dialog-closed",{dialog:this.localName})}},{kind:"field",key:"_sortedColumns",value(){return(0,l.A)(((e,t,i)=>Object.keys(e).filter((t=>!e[t].hidden)).sort(((n,a)=>{const o=t?.indexOf(n)??-1,r=t?.indexOf(a)??-1,s=i?.includes(n)??Boolean(e[n].defaultHidden);if(s!==(i?.includes(a)??Boolean(e[a].defaultHidden)))return s?1:-1;if(o!==r){if(-1===o)return 1;if(-1===r)return-1}return o-r})).reduce(((t,i)=>(t.push({key:i,...e[i]}),t)),[])))}},{kind:"method",key:"render",value:function(){if(!this._params)return a.s6;const e=this._params.localizeFunc||this.hass.localize,t=this._sortedColumns(this._params.columns,this._columnOrder,this._hiddenColumns);return a.qy`
      <ha-dialog
        open
        @closed=${this.closeDialog}
        .heading=${(0,c.l)(this.hass,e("ui.components.data-table.settings.header"))}
      >
        <ha-sortable
          @item-moved=${this._columnMoved}
          draggable-selector=".draggable"
          handle-selector=".handle"
        >
          <mwc-list>
            ${(0,s.u)(t,(e=>e.key),((e,t)=>{const i=!e.main&&!1!==e.moveable,n=!e.main&&!1!==e.hideable,o=!(this._columnOrder&&this._columnOrder.includes(e.key)?this._hiddenColumns?.includes(e.key)??e.defaultHidden:e.defaultHidden);return a.qy`<ha-list-item
                  hasMeta
                  class=${(0,r.H)({hidden:!o,draggable:i&&o})}
                  graphic="icon"
                  noninteractive
                  >${e.title||e.label||e.key}
                  ${i&&o?a.qy`<ha-svg-icon
                        class="handle"
                        .path=${"M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z"}
                        slot="graphic"
                      ></ha-svg-icon>`:a.s6}
                  <ha-icon-button
                    tabindex="0"
                    class="action"
                    .disabled=${!n}
                    .hidden=${!o}
                    .path=${o?"M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z":"M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z"}
                    slot="meta"
                    .label=${this.hass.localize("ui.components.data-table.settings."+(o?"hide":"show"),{title:"string"==typeof e.title?e.title:""})}
                    .column=${e.key}
                    @click=${this._toggle}
                  ></ha-icon-button>
                </ha-list-item>`}))}
          </mwc-list>
        </ha-sortable>
        <ha-button slot="secondaryAction" @click=${this._reset}
          >${e("ui.components.data-table.settings.restore")}</ha-button
        >
        <ha-button slot="primaryAction" @click=${this.closeDialog}>
          ${e("ui.components.data-table.settings.done")}
        </ha-button>
      </ha-dialog>
    `}},{kind:"method",key:"_columnMoved",value:function(e){if(e.stopPropagation(),!this._params)return;const{oldIndex:t,newIndex:i}=e.detail,n=this._sortedColumns(this._params.columns,this._columnOrder,this._hiddenColumns).map((e=>e.key)),a=n.splice(t,1)[0];n.splice(i,0,a),this._columnOrder=n,this._params.onUpdate(this._columnOrder,this._hiddenColumns)}},{kind:"method",key:"_toggle",value:function(e){if(!this._params)return;const t=e.target.column,i=e.target.hidden,n=[...this._hiddenColumns??Object.entries(this._params.columns).filter((([e,t])=>t.defaultHidden)).map((([e])=>e))];i&&n.includes(t)?n.splice(n.indexOf(t),1):i||n.push(t);const a=this._sortedColumns(this._params.columns,this._columnOrder,n);if(this._columnOrder){const e=this._columnOrder.filter((e=>e!==t));let i=((e,t)=>{for(let i=e.length-1;i>=0;i--)if(t(e[i],i,e))return i;return-1})(e,(e=>e!==t&&!n.includes(e)&&!this._params.columns[e].main&&!1!==this._params.columns[e].moveable));-1===i&&(i=e.length-1),a.forEach((a=>{e.includes(a.key)||(!1===a.moveable?e.unshift(a.key):e.splice(i+1,0,a.key),a.key!==t&&a.defaultHidden&&!n.includes(a.key)&&n.push(a.key))})),this._columnOrder=e}else this._columnOrder=a.map((e=>e.key));this._hiddenColumns=n,this._params.onUpdate(this._columnOrder,this._hiddenColumns)}},{kind:"method",key:"_reset",value:function(){this._columnOrder=void 0,this._hiddenColumns=void 0,this._params.onUpdate(this._columnOrder,this._hiddenColumns),this.closeDialog()}},{kind:"get",static:!0,key:"styles",value:function(){return[d.nA,a.AH`
        ha-dialog {
          --mdc-dialog-max-width: 500px;
          --dialog-z-index: 10;
          --dialog-content-padding: 0 8px;
        }
        @media all and (max-width: 451px) {
          ha-dialog {
            --vertical-align-dialog: flex-start;
            --dialog-surface-margin-top: 250px;
            --ha-dialog-border-radius: 28px 28px 0 0;
            --mdc-dialog-min-height: calc(100% - 250px);
            --mdc-dialog-max-height: calc(100% - 250px);
          }
        }
        ha-list-item {
          --mdc-list-side-padding: 12px;
          overflow: visible;
        }
        .hidden {
          color: var(--disabled-text-color);
        }
        .handle {
          cursor: move; /* fallback if grab cursor is unsupported */
          cursor: grab;
        }
        .actions {
          display: flex;
          flex-direction: row;
        }
        ha-icon-button {
          display: block;
          margin: -12px;
        }
      `]}}]}}),a.WF)},6494:(e,t,i)=>{var n=i(5461),a=i(8068),o=i(8597),r=i(196),s=i(5538);(0,n.A)([(0,r.EM)("ha-button")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",static:!0,key:"styles",value(){return[s.R,o.AH`
      ::slotted([slot="icon"]) {
        margin-inline-start: 0px;
        margin-inline-end: 8px;
        direction: var(--direction);
        display: block;
      }
      .mdc-button {
        height: var(--button-height, 36px);
      }
      .trailing-icon {
        display: flex;
      }
      .slot-container {
        overflow: var(--button-slot-container-overflow, visible);
      }
    `]}}]}}),a.$)},9484:(e,t,i)=>{var n=i(5461),a=i(9534),o=i(6175),r=i(5592),s=i(8597),l=i(196);(0,n.A)([(0,l.EM)("ha-list-item")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"method",key:"renderRipple",value:function(){return this.noninteractive?"":(0,a.A)(i,"renderRipple",this,3)([])}},{kind:"get",static:!0,key:"styles",value:function(){return[r.R,s.AH`
        :host {
          padding-left: var(
            --mdc-list-side-padding-left,
            var(--mdc-list-side-padding, 20px)
          );
          padding-inline-start: var(
            --mdc-list-side-padding-left,
            var(--mdc-list-side-padding, 20px)
          );
          padding-right: var(
            --mdc-list-side-padding-right,
            var(--mdc-list-side-padding, 20px)
          );
          padding-inline-end: var(
            --mdc-list-side-padding-right,
            var(--mdc-list-side-padding, 20px)
          );
        }
        :host([graphic="avatar"]:not([twoLine])),
        :host([graphic="icon"]:not([twoLine])) {
          height: 48px;
        }
        span.material-icons:first-of-type {
          margin-inline-start: 0px !important;
          margin-inline-end: var(
            --mdc-list-item-graphic-margin,
            16px
          ) !important;
          direction: var(--direction) !important;
        }
        span.material-icons:last-of-type {
          margin-inline-start: auto !important;
          margin-inline-end: 0px !important;
          direction: var(--direction) !important;
        }
        .mdc-deprecated-list-item__meta {
          display: var(--mdc-list-item-meta-display);
          align-items: center;
          flex-shrink: 0;
        }
        :host([graphic="icon"]:not([twoline]))
          .mdc-deprecated-list-item__graphic {
          margin-inline-end: var(
            --mdc-list-item-graphic-margin,
            20px
          ) !important;
        }
        :host([multiline-secondary]) {
          height: auto;
        }
        :host([multiline-secondary]) .mdc-deprecated-list-item__text {
          padding: 8px 0;
        }
        :host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text {
          text-overflow: initial;
          white-space: normal;
          overflow: auto;
          display: inline-block;
          margin-top: 10px;
        }
        :host([multiline-secondary]) .mdc-deprecated-list-item__primary-text {
          margin-top: 10px;
        }
        :host([multiline-secondary])
          .mdc-deprecated-list-item__secondary-text::before {
          display: none;
        }
        :host([multiline-secondary])
          .mdc-deprecated-list-item__primary-text::before {
          display: none;
        }
        :host([disabled]) {
          color: var(--disabled-text-color);
        }
        :host([noninteractive]) {
          pointer-events: unset;
        }
      `,"rtl"===document.dir?s.AH`
            span.material-icons:first-of-type,
            span.material-icons:last-of-type {
              direction: rtl !important;
              --direction: rtl;
            }
          `:s.AH``]}}]}}),o.J)},9154:(e,t,i)=>{var n=i(5461),a=i(9534),o=i(8597),r=i(196),s=i(3167);(0,n.A)([(0,r.EM)("ha-sortable")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",key:"_sortable",value:void 0},{kind:"field",decorators:[(0,r.MZ)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,r.MZ)({type:Array})],key:"path",value:void 0},{kind:"field",decorators:[(0,r.MZ)({type:Boolean,attribute:"no-style"})],key:"noStyle",value(){return!1}},{kind:"field",decorators:[(0,r.MZ)({type:String,attribute:"draggable-selector"})],key:"draggableSelector",value:void 0},{kind:"field",decorators:[(0,r.MZ)({type:String,attribute:"handle-selector"})],key:"handleSelector",value:void 0},{kind:"field",decorators:[(0,r.MZ)({type:String})],key:"group",value:void 0},{kind:"field",decorators:[(0,r.MZ)({type:Boolean,attribute:"invert-swap"})],key:"invertSwap",value(){return!1}},{kind:"field",decorators:[(0,r.MZ)({attribute:!1})],key:"options",value:void 0},{kind:"field",decorators:[(0,r.MZ)({type:Boolean})],key:"rollback",value(){return!0}},{kind:"method",key:"updated",value:function(e){e.has("disabled")&&(this.disabled?this._destroySortable():this._createSortable())}},{kind:"field",key:"_shouldBeDestroy",value(){return!1}},{kind:"method",key:"disconnectedCallback",value:function(){(0,a.A)(n,"disconnectedCallback",this,3)([]),this._shouldBeDestroy=!0,setTimeout((()=>{this._shouldBeDestroy&&(this._destroySortable(),this._shouldBeDestroy=!1)}),1)}},{kind:"method",key:"connectedCallback",value:function(){(0,a.A)(n,"connectedCallback",this,3)([]),this._shouldBeDestroy=!1,this.hasUpdated&&!this.disabled&&this._createSortable()}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"render",value:function(){return this.noStyle?o.s6:o.qy`
      <style>
        .sortable-fallback {
          display: none !important;
        }

        .sortable-ghost {
          box-shadow: 0 0 0 2px var(--primary-color);
          background: rgba(var(--rgb-primary-color), 0.25);
          border-radius: 4px;
          opacity: 0.4;
        }

        .sortable-drag {
          border-radius: 4px;
          opacity: 1;
          background: var(--card-background-color);
          box-shadow: 0px 4px 8px 3px #00000026;
          cursor: grabbing;
        }
      </style>
    `}},{kind:"method",key:"_createSortable",value:async function(){if(this._sortable)return;const e=this.children[0];if(!e)return;const t=(await Promise.all([i.e(8681),i.e(2617)]).then(i.bind(i,2617))).default,n={animation:150,...this.options,onChoose:this._handleChoose,onStart:this._handleStart,onEnd:this._handleEnd};this.draggableSelector&&(n.draggable=this.draggableSelector),this.handleSelector&&(n.handle=this.handleSelector),void 0!==this.invertSwap&&(n.invertSwap=this.invertSwap),this.group&&(n.group=this.group),this._sortable=new t(e,n)}},{kind:"field",key:"_handleEnd",value(){return async e=>{(0,s.r)(this,"drag-end"),this.rollback&&e.item.placeholder&&(e.item.placeholder.replaceWith(e.item),delete e.item.placeholder);const t=e.oldIndex,i=e.from.parentElement.path,n=e.newIndex,a=e.to.parentElement.path;void 0===t||void 0===n||t===n&&i?.join(".")===a?.join(".")||(0,s.r)(this,"item-moved",{oldIndex:t,newIndex:n,oldPath:i,newPath:a})}}},{kind:"field",key:"_handleStart",value(){return()=>{(0,s.r)(this,"drag-start")}}},{kind:"field",key:"_handleChoose",value(){return e=>{this.rollback&&(e.item.placeholder=document.createComment("sort-placeholder"),e.item.after(e.item.placeholder))}}},{kind:"method",key:"_destroySortable",value:function(){this._sortable&&(this._sortable.destroy(),this._sortable=void 0)}}]}}),o.WF)},6580:(e,t,i)=>{i.d(t,{u:()=>s});var n=i(4078),a=i(2154),o=i(3982);const r=(e,t,i)=>{const n=new Map;for(let a=t;a<=i;a++)n.set(e[a],a);return n},s=(0,a.u$)(class extends a.WL{constructor(e){if(super(e),e.type!==a.OA.CHILD)throw Error("repeat() can only be used in text expressions")}ct(e,t,i){let n;void 0===i?i=t:void 0!==t&&(n=t);const a=[],o=[];let r=0;for(const s of e)a[r]=n?n(s,r):r,o[r]=i(s,r),r++;return{values:o,keys:a}}render(e,t,i){return this.ct(e,t,i).values}update(e,[t,i,a]){var s;const l=(0,o.cN)(e),{values:d,keys:c}=this.ct(t,i,a);if(!Array.isArray(l))return this.ut=c,d;const h=null!==(s=this.ut)&&void 0!==s?s:this.ut=[],u=[];let m,p,g=0,y=l.length-1,v=0,f=d.length-1;for(;g<=y&&v<=f;)if(null===l[g])g++;else if(null===l[y])y--;else if(h[g]===c[v])u[v]=(0,o.lx)(l[g],d[v]),g++,v++;else if(h[y]===c[f])u[f]=(0,o.lx)(l[y],d[f]),y--,f--;else if(h[g]===c[f])u[f]=(0,o.lx)(l[g],d[f]),(0,o.Dx)(e,u[f+1],l[g]),g++,f--;else if(h[y]===c[v])u[v]=(0,o.lx)(l[y],d[v]),(0,o.Dx)(e,l[g],l[y]),y--,v++;else if(void 0===m&&(m=r(c,v,f),p=r(h,g,y)),m.has(h[g]))if(m.has(h[y])){const t=p.get(c[v]),i=void 0!==t?l[t]:null;if(null===i){const t=(0,o.Dx)(e,l[g]);(0,o.lx)(t,d[v]),u[v]=t}else u[v]=(0,o.lx)(i,d[v]),(0,o.Dx)(e,l[g],i),l[t]=null;v++}else(0,o.KO)(l[y]),y--;else(0,o.KO)(l[g]),g++;for(;v<=f;){const t=(0,o.Dx)(e,u[f+1]);(0,o.lx)(t,d[v]),u[v++]=t}for(;g<=y;){const e=l[g++];null!==e&&(0,o.KO)(e)}return this.ut=c,(0,o.mY)(e,u),n.c0}})}};
//# sourceMappingURL=OES9VICR.js.map