import {ScanditHTMLElement,html,safeCancelAnimation,safeAwaitAnimation,defineCustomElements,css}from'@scandit/web-datacapture-core/build/js/private/utils/index.js';var e=class e extends ScanditHTMLElement{constructor(){super();this._show=false;this._pulseAnimation=null;let t=this.attachShadow({mode:"open"});t.innerHTML=html`<div class="wrapper"><div class="animation-container"><div class="border"></div><div class="scan-line scan-line-top"></div><div class="scan-line scan-line-bottom"></div></div></div>`,t.append(e.createStyleElement().cloneNode(true));}get show(){return this._show}set show(t){this._show=t,this.toggleAttribute("show",t);}static get observedAttributes(){return ["show"]}connectedCallback(){var t;this._borderElement=(t=this.shadowRoot)==null?void 0:t.querySelector(".border");}disconnectedCallback(){safeCancelAnimation(this._pulseAnimation),this._pulseAnimation=null;}async attributeChangedCallback(t,y,u){var a;if(t==="show"){this._show=u!==null;let n=getComputedStyle(this),i=n.getPropertyValue("--glow-color").trim(),s=n.getPropertyValue("--glow-color-peak").trim(),o=n.getPropertyValue("--animation-curve").trim(),l=250;if(this._show){safeCancelAnimation(this._pulseAnimation),this._pulseAnimation=null;let r=this._borderElement.animate([{boxShadow:`inset 0 0 0px ${i}`},{boxShadow:`inset 0 0 10px ${i}`}],{duration:l,easing:o,fill:"forwards"});await safeAwaitAnimation(r),this._pulseAnimation=this._borderElement.animate([{boxShadow:`inset 0 0 10px ${i}`,filter:"blur(0px)"},{boxShadow:`inset 0 0 100px ${s}`,filter:"blur(0.5px)"},{boxShadow:`inset 0 0 10px ${i}`,filter:"blur(0px)"}],{duration:4e3,easing:o,iterations:1/0,direction:"alternate"});}else {(a=this._pulseAnimation)==null||a.pause();let b=getComputedStyle(this._borderElement).boxShadow||`inset 0 0 100px ${s}`,c=this._borderElement.animate([{boxShadow:b},{boxShadow:`inset 0 0 0px ${i}`}],{duration:l,easing:o,fill:"forwards"}),d=()=>{this._pulseAnimation=null;};c.addEventListener("finish",d,{once:true}),c.addEventListener("cancel",d,{once:true});}}}static create(){return document.createElement(e.tag)}static register(){defineCustomElements({[e.tag]:e});}static createStyleElement(){return css`:host{--glow-color:#0ff;--glow-color-peak:#00ffff80;--animation-curve:cubic-bezier(.42,0,.58,1);align-items:center;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute;z-index:1}.animation-container,.wrapper{height:100%;width:100%}.animation-container{overflow:hidden;position:relative}.border{backdrop-filter:blur(0);-webkit-backdrop-filter:blur(0);border-radius:10px;box-shadow:inset 0 0 0 var(--glow-color);filter:blur(0);inset:0;position:absolute}:host(:not([show])) .scan-line{animation:none;opacity:0}.scan-line{background:#fff;box-shadow:0 0 12px #fffc;height:3px;left:0;position:absolute;width:100%}.scan-line-top{animation:scan-line-top 2s var(--animation-curve) infinite;top:50%}.scan-line-bottom{animation:scan-line-bottom 2s var(--animation-curve) infinite;top:50%}@keyframes scan-line-top{0%{opacity:1;transform:translateY(-50%)}to{opacity:0;transform:translateY(calc(-50% - 50vh))}}@keyframes scan-line-bottom{0%{opacity:1;transform:translateY(-50%)}to{opacity:0;transform:translateY(calc(-50% + 50vh))}}`}};e.tag="scandit-adaptive-recognition-overlay";var m=e;export{m as a};