1import{a as F,f as j}from"./chunk-ASTXUBF3.js";import{i as a,k as P,ya as T}from"./chunk-XNTCN5LM.js";import{B as w,Ca as I,G as g,Lc as v,Ma as S,Oa as x,Y as L,_ as H,aa as r,ga as y,gd as R,ha as l,id as A,la as E,ma as b,pb as k,qa as D,r as h,wb as $,y as C}from"./chunk-5LGYDGR4.js";import{a as c,b as _}from"./chunk-HIUAR4UN.js";var p=new H("live helper chat config");var o=class{};var d=(()=>{class e extends o{constructor(){super(),this._document=r(y),this.platformId=r(b),this.livehelperchatConfig=r(p),this.authService=r(F,{optional:!0}),this._toastService=r(T),this.matomo=r(j),this.isInjected=!1,this._window=this._document.defaultView,this.widgetClosed=E(!1),this.destroyRef=r(l)}waitForLHC$(){return C(300).pipe(w(()=>!!this._window.$_LHC?.loaded),g(1),h(()=>{}))}generateScript(i=!1){if(this.isInjected||!this.livehelperchatConfig.url||!v(this.platformId))return;this._window.lhc_var=this._window.lhc_var??{login:"",guid_rdx:"",player_class:""},this._window.LHC_API=this._window.LHC_API??{args:{}},this._window.LHC_API.args=c(_(c(c({},this._window.LHC_API.args),this.livehelperchatConfig.args),{domain:this._window.location.hostname,lhc_base_url:"//"+new URL(this.livehelperchatConfig.url).hostname+"/index.php/",fscreen:i}),!i&&{mode:"widget"}),this.authService?(this.authService.user$.pipe(a(this.destroyRef)).subscribe(n=>{if(n){let m=n.viplevel??"";this._window.lhc_var.player_class=m,this._window.lhc_var.login=n.display_name??"",this._window.$_LHC?.attributes.userSession.updateChatStatus({action:"user_logged"}),this.matomo._push_mtm({playerClass:m});let f=this._window;f._paq=f._paq||[],f._paq.push(["trackEvent","[CRO] PlayerClass",m])}else this._window.lhc_var.login="",this._window.lhc_var.player_class=""}),this.authService.accessToken$.pipe(a(this.destroyRef)).subscribe(n=>{this._window.lhc_var.guid_rdx=n??""})):this._window.lhc_var.guid_rdx="";let t=this._document.createElement("script");t.type="text/javascript",t.async=!0;let s=new Date;t.src=`${this.livehelperchatConfig.url}?${s.getFullYear()}${s.getMonth()}${s.getDate()}${Date.now()}`;let u=this._document.getElementsByTagName("script")[0];u.parentNode?.insertBefore(t,u),this.isInjected=!0}ngOnDestroy(){this._window.$_LHC?.eventListener.emitEvent("endChat")}startChat(){if(v(this.platformId)){if(!this._window.$_LHC){this._toastService.warn("Sorry, but it looks like live chat is not available on this site.","Live Chat"),console.warn("lh_inst undefined, could be that LHC scripts have not been loaded");return}this._window.$_LHC.eventListener.emitEvent("showWidget")}}closeChat(){this._window.$_LHC?.eventListener.emitEvent("closeWidget")}scheduleCall(){this._window.$_LHC?.eventListener.emitEvent("sendChildExtEvent",[{cmd:"cbscheduler",arg:{}}]),this._window.$_LHC?.eventListener.emitEvent("showWidget")}listenForClose(){["closeWidget","openPopup"].forEach(i=>this._window.$_LHC?.eventListener.on(i,()=>this.widgetClosed.set(!0)))}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275prov=L({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})();var se=(()=>{class e{constructor(){this.chat=r(o,{optional:!0})}onClick(i){if(!this.chat)return;let t=i.target;if(t.nodeName==="A"&&!t.getAttribute("target")){let s=t.getAttribute("class");if(s?.includes("chat")){this.chat.startChat(),i.preventDefault();return}if(s?.includes("schedule")){this.chat.scheduleCall(),i.preventDefault();return}}}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275dir=x({type:e,selectors:[["","fxLHCLinkCapture",""]],hostBindings:function(t,s){t&1&&$("click",function(n){return s.onClick(n)})}})}}return e})();var ue=(()=>{class e{constructor(){this.service=r(d),this.router=r(A),this.destroyRef=r(l),this.route=r(R),this.isCallback=P(this.route.queryParamMap.pipe(h(i=>i.get("callback")==="true")),{requireSync:!0}),I(()=>{this.service.generateScript(!0),this.service.waitForLHC$().pipe(a(this.destroyRef)).subscribe(()=>{if(this.service.listenForClose(),this.isCallback()){this.service.scheduleCall();return}this.service.startChat()})}),D(()=>{this.service.widgetClosed()&&this.close()})}close(){this.router.navigate(["/"],{replaceUrl:!0})}static{this.\u0275fac=function(t){return new(t||e)}}static{this.\u0275cmp=S({type:e,selectors:[["fx-chat-launcher"]],decls:1,vars:0,consts:[["id","lhc-chat-container"]],template:function(t,s){t&1&&k(0,"div",0)},encapsulation:2,changeDetection:1})}}return e})();
1var Ce=e=>[{provide:o,useClass:d},{provide:p,useValue:e}];export{o as a,se as b,ue as c,Ce as d};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.