import*as t from"luxon";var e,r,a={7540(t,e,r){r.d(e,{h:()=>h,o:()=>m}),r(5983),r(1821),r(9613);var a=r(9609),o=r(4084),i=r(2927),s=r(8899),n=r(4955),d=r(9642),p=r(513),l=function(t,e,r,a){var o,i=arguments.length,s=i<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,a);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s};const c="hh:mm:ss";var m,h;!function(t){t.DEFAULT="default",t.ACTIVE="active",t.INACTIVE="inactive"}(m||(m={})),function(t){let e=class extends i.LitElement{constructor(){super(...arguments),this.state=m.DEFAULT,this.identifier=void 0,this.header=void 0,this.info=void 0,this.data=void 0,this.createdTime=0,this.active=!1,this.expandable=!1,this.expandAriaLabel="Expand for more details",this.renderedData=""}connectedCallback(){super.connectedCallback(),this.checkForExtraInfoSlot()}disconnectedCallback(){super.disconnectedCallback(),this.clearInterval()}clearInterval(){this.interval&&(clearInterval(this.interval),this.interval=void 0)}static get styles(){return[o.A,p.A]}get isCardActive(){return this.state===m.ACTIVE}willUpdate(t){super.willUpdate(t),(t.has("active")||t.has("data")||t.has("createdTime"))&&this.calculateRenderedData()}expandCardToggled(){var t;this.state=this.isCardActive?m.DEFAULT:m.ACTIVE,this.dispatchEvent(new CustomEvent("expand-card-toggled",{detail:{identifier:null!==(t=this.identifier)&&void 0!==t?t:"",active:this.isCardActive},bubbles:!0,composed:!0}))}checkForExtraInfoSlot(){var t;(null===(t=this.extraInfoSlot)||void 0===t?void 0:t.assignedNodes().length)>0?this.setAttribute("has-extra-info",""):this.removeAttribute("has-extra-info")}handleExtraInfoSlotChange(t){this.checkForExtraInfoSlot()}get cardClassMap(){return{"md-card-v2":!0,[`md-card--${this.state}`]:!0}}get contentClassMap(){return{"md-card-v2-content":!0,inactive:this.state===m.INACTIVE}}get footerExpandClassMap(){return{"md-card-v2-footer-expand":!0,hidden:!this.expandable}}get expandCardHandler(){return this.expandable?this.expandCardToggled:null}renderHeader(){return i.html`
        <div class="md-card-v2-header-title">
          <h3>${this.header}</h3>
          ${this.info?i.html`
                <md-tooltip message="${this.info}" placement="top">
                  <md-button ariaLabel="${this.header}, ${this.data}, ${this.info}" size="20" variant="ghost" circle>
                    <md-icon slot="icon" name="info-badge-filled" iconSet="momentumDesign"></md-icon>
                  </md-button>
                </md-tooltip>
              `:i.nothing}
        </div>
      `}renderExpandButton(){return i.html`
        <div class="${(0,n.classMap)(this.footerExpandClassMap)}">
          <md-button ariaLabel="${this.expandAriaLabel}" circle size="28">
            <md-icon
              slot="icon"
              iconSet="momentumDesign"
              name=${this.isCardActive?"arrow-circle-up-bold":"arrow-circle-down-bold"}
              size="18"
            ></md-icon>
          </md-button>
        </div>
      `}renderFooter(){return i.html`
        <div class="md-card-v2-footer">
          <div class="md-card-v2-footer-content">
            <slot name="card-footer-content"></slot>
          </div>
          ${this.renderExpandButton()}
        </div>
      `}calculateRenderedData(){this.clearInterval(),!this.active&&this.data?this.renderedData=this.data:this.active&&this.createdTime>0&&(this.renderedData=d.Duration.fromMillis(Date.now()-this.createdTime).toFormat(c),this.interval=window.setInterval(()=>{this.renderedData=d.Duration.fromMillis(Date.now()-this.createdTime).toFormat(c)},1e3))}render(){return i.html`
        <div class="${(0,n.classMap)(this.cardClassMap)}" @click=${this.expandCardHandler}>
          <div class="md-card-v2-header">${this.renderHeader()}</div>
          <div class="${(0,n.classMap)(this.contentClassMap)}">
            <h2>${this.renderedData}</h2>
            <div class="md-card-v2-content-extra-info">
              <slot name="card-extra-info" @slotchange=${this.handleExtraInfoSlotChange}></slot>
            </div>
          </div>
          ${this.renderFooter()}
        </div>
      `}};l([(0,s.property)({type:String})],e.prototype,"state",void 0),l([(0,s.property)({type:String})],e.prototype,"identifier",void 0),l([(0,s.property)({type:String})],e.prototype,"header",void 0),l([(0,s.property)({type:String})],e.prototype,"info",void 0),l([(0,s.property)({type:String})],e.prototype,"data",void 0),l([(0,s.property)({type:Number})],e.prototype,"createdTime",void 0),l([(0,s.property)({type:Boolean})],e.prototype,"active",void 0),l([(0,s.property)({type:Boolean,reflect:!0})],e.prototype,"expandable",void 0),l([(0,s.property)({type:String,attribute:"expand-aria-label"})],e.prototype,"expandAriaLabel",void 0),l([(0,s.query)('slot[name="card-extra-info"]')],e.prototype,"extraInfoSlot",void 0),l([(0,s.state)()],e.prototype,"interval",void 0),l([(0,s.state)()],e.prototype,"renderedData",void 0),e=l([(0,a.w)("md-card-v2")],e),t.ELEMENT=e}(h||(h={}))},9642(e,r,a){var o,i;e.exports=(o={Duration:()=>t.Duration},i={},a.d(i,o),i)}},o={};function i(t){var e=o[t];if(void 0!==e)return e.exports;var r=o[t]={exports:{}};return a[t](r,r.exports,i),r.exports}i.m=a,e=[],i.O=(t,r,a,o)=>{if(!r){var s=1/0;for(l=0;l<e.length;l++){for(var[r,a,o]=e[l],n=!0,d=0;d<r.length;d++)(!1&o||s>=o)&&Object.keys(i.O).every(t=>i.O[t](r[d]))?r.splice(d--,1):(n=!1,o<s&&(s=o));if(n){e.splice(l--,1);var p=a();void 0!==p&&(t=p)}}return t}o=o||0;for(var l=e.length;l>0&&e[l-1][2]>o;l--)e[l]=e[l-1];e[l]=[r,a,o]},i.d=(t,e)=>{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);export{i as __webpack_require__};r={1521:0,9642:0},i.C=t=>{var e,a,{__webpack_esm_ids__:o,__webpack_esm_modules__:s,__webpack_esm_runtime__:n}=t,d=0;for(e in s)i.o(s,e)&&(i.m[e]=s[e]);for(n&&n(i);d<o.length;d++)a=o[d],i.o(r,a)&&r[a]&&r[a][0](),r[o[d]]=0;i.O()},i.O.j=t=>0===r[t];import*as s from"../9609.js";i.C(s);import*as n from"../4084.js";i.C(n);import*as d from"../4955.js";i.C(d);import*as p from"../3517.js";i.C(p);import*as l from"../1156.js";i.C(l);import*as c from"../3305.js";i.C(c);import*as m from"../4739.js";i.C(m);import*as h from"../7154.js";i.C(h);import*as v from"../9773.js";i.C(v);import*as f from"../5983.js";i.C(f);import*as C from"../7755.js";i.C(C);import*as u from"../1821.js";i.C(u);import*as y from"../2364.js";i.C(y);import*as x from"../4980.js";i.C(x);import*as b from"../5308.js";i.C(b);import*as g from"../9938.js";i.C(g);import*as j from"../9500.js";i.C(j);import*as E from"../4781.js";i.C(E);import*as D from"../5584.js";i.C(D);import*as A from"../8227.js";i.C(A);import*as I from"../2900.js";i.C(I);import*as $ from"../2050.js";i.C($);import*as _ from"../1280.js";i.C(_);import*as T from"../6343.js";i.C(T);import*as w from"../7582.js";i.C(w);import*as S from"../9613.js";i.C(S);import*as O from"../5323.js";i.C(O);import*as k from"../513.js";i.C(k);var M=i.O(void 0,[9609,4084,4955,3517,1156,3305,4739,7154,9773,5983,7755,1821,2364,4980,5308,9938,9500,4781,5584,8227,2900,2050,1280,6343,7582,9613,5323,513],()=>i(7540));const F=(M=i.O(M)).o,L=M.h;export{F as CardState,L as CardV2};