import{r as t,h as i,g as e}from"./p-3b76effa.js";class s{constructor(i){t(this,i),this.events={flipEvents:[],flipBackEvents:[]}}componentWillLoad(){this.init()}componentDidLoad(){const t=this.flipDuration||400,i=this.flipTimingFunction||"ease-in";["front","back"].forEach(e=>{this.element.querySelector(`.ema-flip__${e}`).style.transition=`all ${t/1e3}s ${i}`})}componentWillUpdate(){void 0!==this.isFlipped&&(this.flipState=this.isFlipped)}init(){if(void 0!==this.isFlipped)this.flipState=this.isFlipped;else if(void 0!==this.flipEvents){["flipEvents","flipBackEvents"].forEach(t=>{this.events[t]=this[t]?this[t].split(","):[]});const t=[...this.events.flipEvents,...this.events.flipBackEvents];t.filter((i,e)=>t.indexOf(i)===e).forEach(t=>this.element.addEventListener(t,t=>this.processFlip(t))),this.flipState=!1}}processFlip(t){const i=t.type;this.flipState&&-1!==this.events.flipBackEvents.indexOf(i)?this.flipState=!this.flipState:this.flipState||-1===this.events.flipEvents.indexOf(i)||(this.flipState=!this.flipState)}async flip(){this.flipState=!this.flipState}render(){return i("div",{class:`ema-flip ${this.flipState?"ema-flip--flipped":""}`},i("div",{class:"ema-flip__front"},i("slot",{name:"front"})),i("div",{class:"ema-flip__back"},i("slot",{name:"back"})))}get element(){return e(this)}static get style(){return":root{--ema-color:#343a40;--ema-primary:#007bff;--ema-secondary:#6c757d;--ema-success:#28a745;--ema-info:#17a2b8;--ema-warning:#ffc107;--ema-danger:#dc3545;--ema-light:#f8f9fa;--ema-dark:#343a40;--ema-background:#fff;--ema-background-diap:rgba(29,29,29,0.97);--ema-border-color:#c5c9cd;--ema-border:1px solid #c5c9cd;--ema-border-radius:3px 3px 3px 3px;--ema-box-shadow:1px 1px 10px 1px #ccc;--ema-margin:0.25rem;--ema-margin-sm:0.5rem;--ema-margin-md:1rem;--ema-margin-lg:1.5rem;--ema-margin-xl:2rem;--ema-padding:0.25rem;--ema-padding-sm:0.5rem;--ema-padding-md:1rem;--ema-padding-lg:1.5rem;--ema-padding-xl:2rem;--ema-gray-100:#f8f9fa;--ema-gray-200:#e9ecef;--ema-gray-300:#dee2e6;--ema-gray-400:#ced4da;--ema-gray-500:#adb5bd;--ema-gray-600:#868e96;--ema-gray-700:#495057;--ema-gray-800:#343a40;--ema-gray-900:#212529}.ema-flip{-webkit-perspective:1000px;perspective:1000px;text-align:center}.ema-flip__back,.ema-flip__front{position:absolute;width:inherit;height:inherit;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-backface-visibility:hidden;backface-visibility:hidden}.ema-flip__front{z-index:900;-webkit-transform:rotate3d(0,0,0,0deg);transform:rotate3d(0,0,0,0deg)}.ema-flip--flipped .ema-flip__front{z-index:900;-webkit-transform:rotateY(180deg);transform:rotateY(180deg);-ms-transform:rotateY(180deg)}.ema-flip__back{z-index:800;-webkit-transform:rotateY(-180deg);transform:rotateY(-180deg)}.ema-flip--flipped .ema-flip__back{z-index:1000;-webkit-transform:rotate3d(0,0,0,0deg);transform:rotate3d(0,0,0,0deg)}"}}export{s as ema_flip};