import{U as o}from"./chunk-F5MSX4O5.js";import{a as n}from"./chunk-BB6QMODA.js";import{Hb as r,J as h,M as l,e as c}from"./chunk-VEXJN5D7.js";var p=(()=>{let t=class t{constructor(e,i){this.http=e,this.authRefService=i,this.onlineCheckInitialized=!1,this.checkingOnlineStatus=!0,this.online=new c(!1),this.checkOnlineStatus(!0)}setOnlineStatus(e){this.online.next(e)}scheduleNextOnlineCheck(){this.onlineTimer=window.setTimeout(()=>{this.checkOnlineStatus()},2500)}checkOnlineStatus(e=!1){if(!this.checkingOnlineStatus||e){window.clearTimeout(this.onlineTimer),this.checkingOnlineStatus=!0;let i=`${n.API_URL}/helpers/talk-to-me-goose`;this.http.get(i).subscribe({next:()=>{this.checkingOnlineStatus=!1,this.setOnlineStatus(!0),this.scheduleNextOnlineCheck()},error:a=>{this.checkingOnlineStatus=!1,a.message.includes("NG0200")||this.setOnlineStatus(!1),this.scheduleNextOnlineCheck()}})}}stopOnlineCheck(){window.clearTimeout(this.onlineTimer),this.onlineCheckInitialized=!1}initOnlineCheck(){this.onlineCheckInitialized||(this.checkOnlineStatus(),this.onlineCheckInitialized=!0)}get apiUrl(){return n.API_URL}getContentUrl(e){let i=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return`${n.CONTENT_URL}/${i}`}ngOnDestroy(){window.clearTimeout(this.onlineTimer)}};t.\u0275fac=function(i){return new(i||t)(l(r),l(o))},t.\u0275prov=h({token:t,factory:t.\u0275fac});let s=t;return s})();export{p as a};
