import{L as e,H as r,f as t,Q as i,K as s,M as n,N as a,O as o}from"./p-DGWPFpP6.js";import{_ as c,a as l}from"./p-dfXERft2.js";import{B as h}from"./p-ByiN-QjD.js";import{L as d}from"./p-B2jfbp7x.js";const p=class{constructor(e){r(this,e),this.animated=t.animated,this.inverted=!1,this.deactivated=!1,this.color="blue",this.small=!1,this.variation="logo",this.animate=async()=>{this.animated?(await this.load(),void 0!==this.currentRaf&&cancelAnimationFrame(this.currentRaf),this.shouldAnimate()&&(this.destroy(),this.currentRaf=i((async()=>{this.animationFunction&&this.animationFunction(this.el,this.getColor())})))):this.destroy()},this.destroy=()=>{this.animationItem&&this.animationItem.destroy&&this.animationItem.destroy(),this.el.innerHTML=""},this.shouldAnimate=()=>"logo"===this.variation&&"undefined"!=typeof window&&void 0!==this.animationFunction&&!this.deactivated,this.load=async()=>new Promise(((e,r)=>{if(this.animationFunction)return e();s((async()=>{import("./p-BHFw3KrT.js").then((r=>{this.animationFunction=r.animate,e()})).catch(r)}))}))}createLogger(e){this.log=e}deactivatedWatcher(e,r){e!==r&&(this.deactivated?this.destroy():this.animate())}variationWatcher(e,r){e!==r&&("circle"===this.variation?this.destroy():this.animate())}componentDidLoad(){"logo"===this.variation?this.animate():this.destroy()}disconnectedCallback(){this.el&&!this.el.isConnected&&this.destroy()}configChanged(e){this.animated=e.animated,!1===e.animated&&this.destroy()}getColor(){return this.inverted||"white"===this.color?"#ffffff":"#151f6d"}render(){const e=h.block("spinner");return n(a,{key:"6986ffee4141e4096ad7e62a704697c8dfb31c18",class:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e.class()),e.modifier("circle").class("circle"===this.variation)),e.modifier("small").class(this.small)),e.modifier("animated").class(this.animated)),e.modifier(`color-${this.color}`).class("circle"===this.variation)),role:"progressbar","aria-hidden":"true"})}get el(){return o(this)}static get watchers(){return{deactivated:["deactivatedWatcher"],variation:["variationWatcher"]}}};c([e("bal-spinner"),l("design:type",Function),l("design:paramtypes",[Function]),l("design:returntype",void 0)],p.prototype,"createLogger",null),c([d(),l("design:type",Function),l("design:paramtypes",[Object]),l("design:returntype",void 0)],p.prototype,"configChanged",null),p.style=":root{--bal-spinner-circle-background:var(--bal-color-grey);--bal-spinner-circle-progress:var(--bal-color-primary);--bal-spinner-circle-background-inverted:var(--bal-color-white);--bal-spinner-circle-progress-inverted:var(--bal-color-primary)}bal-spinner,.bal-spinner{text-align:center;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-line-pack:center;align-content:center;width:4rem}bal-spinner svg,.bal-spinner svg{-webkit-transform:unset !important;transform:unset !important}.bal-spinner--small{width:2rem}.bal-spinner--circle{margin:auto;border-width:.25rem;border-style:solid;border-color:var(--bal-spinner-circle-background);border-radius:50%;border-top-color:var(--bal-spinner-circle-progress);width:1.5rem;height:1.5rem}.bal-spinner--circle.bal-spinner--small{width:1.125rem;height:1.125rem;border-width:.2rem}.bal-spinner--circle.bal-spinner--animated{-webkit-animation:spinner 1.6s linear infinite;animation:spinner 1.6s linear infinite}.bal-spinner--circle.bal-spinner--color-white{border-color:var(--bal-spinner-circle-background-inverted);border-top-color:var(--bal-spinner-circle-progress-inverted)}@-webkit-keyframes spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spinner{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}";export{p as bal_spinner}