@akross/artemis-ads-sdk 3.7.8 → 3.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- var e=function(e){"use strict";class t{static applyDefaults(e){return{timeout:5e3,debug:!1,proxyExternalScripts:!1,enableGPTPpid:!1,...e}}static hasBaseUrl(e){return!!(e.baseUrl&&e.baseUrl.trim().length>0)}static hasArtemisAppId(e){return!!(e.artemisAdsAppId&&e.artemisAdsAppId.trim().length>0)}static getArtemisAppId(e,t){return e.artemisAdsAppId||t||""}static isValid(e){return this.hasBaseUrl(e)&&this.hasArtemisAppId(e)}static getPrimaryColor(e,t="#007bff"){return e.primaryColor||t}static isValidColor(e){return!!e&&/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)}static getLuminaToken(e,t="QQDCYMdFh2AJqwP"){return e.luminaToken||t}}class r{constructor(e){this.userId=e.userId,this.advertisingId=e.advertisingId,Object.keys(e||{}).forEach(t=>{t in this||(this[t]=e[t])})}hasAdvertisingId(){return!!(this.advertisingId&&this.advertisingId.trim().length>0)}getAdvertisingId(e){return this.advertisingId||e||""}setAdvertisingId(e){this.advertisingId=e}clearAdvertisingId(){this.advertisingId=null}isValid(){return!!(this.userId&&this.userId.trim().length>0)}getUserId(e){return this.userId||e||""}hasCompleteData(){return this.isValid()&&this.hasAdvertisingId()}}function i(){if("undefined"==typeof navigator)return!1;const e=navigator.platform||"",t=navigator.userAgent||"";return/iPhone|iPad|iPod/i.test(e)||/iPhone|iPad|iPod/i.test(t)}function n(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent||"",t=navigator.platform||"",r=/iPad/i.test(t)||/Macintosh/i.test(e)&&"undefined"!=typeof document&&"ontouchend"in document,i=/Android/i.test(e)&&!/Mobile/i.test(e);return r||i}function a(){if("undefined"==typeof navigator)return!1;if(n())return!1;const e=navigator.userAgent||"",t=navigator.platform||"",r=/iPhone|iPod/i.test(t)||/iPhone|iPod/i.test(e),i=/Android/i.test(e)&&/Mobile/i.test(e);return r||i}function s(){if("undefined"==typeof navigator)return!1;if(a()||n())return!1;const e=navigator.userAgent||"",t=navigator.platform||"",r=/Win/i.test(t)||/Windows/i.test(e),s=/Mac/i.test(t)&&!i(),o=/Linux/i.test(t)&&!/Android/i.test(e);return r||s||o}class o{constructor(e){this.params=e.params,this.type=e.type,Object.keys(e).forEach(t=>{"params"!==t&&"type"!==t&&(this[t]=e[t])})}findParamByKey(e){return this.params?.find(t=>t.key===e)?.value}findAdUnitId(){return i()?this.findParamByKey("adUnitIdiOS")??this.findParamByKey("adUnitId")??"":this.findParamByKey("adUnitId")??""}findVastTag(){return this.findParamByKey("tag")??""}findEventSuffix(){return this.findParamByKey("eventSuffix")??""}findTimeout(){const e=this.findParamByKey("timeout");return e?parseInt(e,10):void 0}}var l,c,d;e.AACampaignResponseStatus=void 0,(l=e.AACampaignResponseStatus||(e.AACampaignResponseStatus={})).SUCCESS="SUCCESS",l.ERROR="ERROR",l.EMPTY="EMPTY",e.AAMediaTypes=void 0,(c=e.AAMediaTypes||(e.AAMediaTypes={})).BANNER="image",c.VIDEO_V2="video_v2",c.PROGRAMMATIC_V2="programatica_v2",c.SURVEY_V2="survey_v2",c.EXTERNAL_REDIRECT="external_redirect",c.TYPE_GOOGLE_RV="GAM_RV",c.TYPE_GOOGLE_RI="GAM_RI",c.TYPE_MAX_RV="MAX_RV",c.TYPE_KWAI_RV="KWAI_RV",c.TYPE_FALLBACK="fallback",c.PROGRAMMATIC="programatica",c.PROGRAMMATIC_ADMOB_RB="google-admob-rv",c.PROGRAMMATIC_MAX_RV="max-rv",c.UNKNOWN="",e.AAMediaPlayResult=void 0,(d=e.AAMediaPlayResult||(e.AAMediaPlayResult={}))[d.REWARDED=11]="REWARDED",d[d.REWARDED_REDIRECTED=12]="REWARDED_REDIRECTED",d[d.MEDIA_WATCHED=13]="MEDIA_WATCHED",d[d.SKIPPED=20]="SKIPPED",d[d.ERROR=21]="ERROR",d[d.CONNECTION_ERROR=22]="CONNECTION_ERROR",d[d.NO_FILL=23]="NO_FILL",d[d.CANCELED=24]="CANCELED",d[d.POLL_WRONG_ANSWER=25]="POLL_WRONG_ANSWER",d[d.EXTERNAL_REDIRECT=26]="EXTERNAL_REDIRECT",d[d.BANNER_CLICK=27]="BANNER_CLICK";class u{constructor(e,t){this.description=e,this.cause=t}}class h{constructor(e){this.type=e.type,this.url=e.url,this.originalContent=e.originalContent,this.proxy=e.proxy,this.skipEnabled=e.skipEnabled,this.skipSeconds=e.skipSeconds,this.videoId=e.videoId,this.eventSuffix=e.eventSuffix}hasUrl(){return!(!this.url||!this.url.trim())}hasType(){return!(!this.type||!this.type.trim())}isSupportedType(){return["IN_HOUSE","VAST","VPAID"].includes(this.type?.toUpperCase())}}class g{constructor(e){this.waterfall=e.waterfall?e.waterfall.map(e=>new o(e)):void 0}hasWaterfall(){return!!(this.waterfall&&this.waterfall.length>0)}getInfo(){return this.hasWaterfall()?`Waterfall com ${this.waterfall.length} anúncios`:"Conteúdo programático vazio"}}class p{constructor(e){this.url=e.url,this.adBlock=e.adBlock}hasUrl(){return!(!this.url||!this.url.trim())}hasAdBlock(){return!(!this.adBlock||!this.adBlock.trim())}}let m=class{constructor(e){this.infoPrimary=e.infoPrimary,this.infoSecondary=e.infoSecondary,this.actionButtonLabel=e.actionButtonLabel,this.link=e.link,this.thumbnail=e.thumbnail}hasLink(){return!(!this.link||!this.link.trim())}hasThumbnail(){return!(!this.thumbnail||!this.thumbnail.trim())}hasInfoPrimary(){return!(!this.infoPrimary||!this.infoPrimary.trim())}hasInfoSecondary(){return!(!this.infoSecondary||!this.infoSecondary.trim())}hasActionButtonLabel(){return!(!this.actionButtonLabel||!this.actionButtonLabel.trim())}};class f{constructor(e){this.url=e.url,this.programmatic=e.programmatic?new g(e.programmatic):void 0,this.video=e.video?new h(e.video):void 0,this.infoPrimary=e.infoPrimary,this.infoSecondary=e.infoSecondary,this.survey=e.survey?new p(e.survey):void 0,this.externalRedirect=e.externalRedirect?new m(e.externalRedirect):void 0,!this.externalRedirect&&(e.link||e.actionButtonLabel||e.thumbnail)&&(this.externalRedirect=new m({infoPrimary:e.infoPrimary,infoSecondary:e.infoSecondary,actionButtonLabel:e.actionButtonLabel,link:e.link,thumbnail:e.thumbnail}))}hasUrl(){return!(!this.url||!this.url.trim())}isProgrammatic(){return!(!this.programmatic||!this.programmatic.hasWaterfall())}isSurvey(){return!(!this.survey||!this.survey.hasUrl())}isExternalRedirect(){return!(!this.externalRedirect||!this.externalRedirect.hasLink())}getInfo(){return this.hasUrl()?`URL: ${this.url}`:this.isProgrammatic()?this.programmatic.getInfo():this.isSurvey()?`Survey: ${this.survey.url}`:this.isExternalRedirect()?`External Redirect: ${this.externalRedirect.link}`:"Conteúdo vazio"}}class v{constructor(e){this.type=e.type,this.title=e.title,this.description=e.description,this.buttons=e.buttons||[],this.url=e.url,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isExternal(){return"EXTERNAL"===this.type}hasUrl(){return!(!this.url||!this.url.trim())}hasButtons(){return this.buttons.length>0}getInfo(){return`${this.title}: ${this.description}`}}class E{constructor(e){this.media=e.media,this.result=e.result,this.error=e.error,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isSuccess(){return this.result===e.AAMediaPlayResult.REWARDED||this.result===e.AAMediaPlayResult.REWARDED_REDIRECTED||this.result===e.AAMediaPlayResult.EXTERNAL_REDIRECT||this.result===e.AAMediaPlayResult.BANNER_CLICK}isSkipped(){return this.result===e.AAMediaPlayResult.SKIPPED}hasError(){return this.result===e.AAMediaPlayResult.ERROR||!!this.error}getErrorMessage(){return this.error?this.error.description||this.error.cause||"Erro desconhecido":"Sem erro"}getInfo(){return this.isSuccess()?"Anúncio visualizado com sucesso":this.isSkipped()?"Anúncio pulado":this.hasError()?`Erro: ${this.getErrorMessage()}`:"Resultado desconhecido"}}class y{constructor(e=!1){this.debugMode=e}debug(e,...t){this.debugMode}info(e,...t){}warn(e,...t){}error(e,...t){}}class A{constructor(){}interceptRequest(e){const t=St.getCustomHeaders();if(t){const r=new Headers(e.headers);Object.entries(t).forEach(([e,t])=>{r.set(e,t)}),e.headers=r}const r=new Headers(e.headers);return r.set("Content-Type","application/json"),r.set("Accept","application/json"),e.headers=r,e}interceptResponse(e){return e}}class w{constructor(e){this.fetchConfig=e}async fetchWithConfig(e,t={}){const{baseUrl:r,restInterceptor:i}=this.fetchConfig;i&&(t=i.interceptRequest(t));const n=new URL(e,r).toString();return fetch(n,{...t})}async requestCampaign(e,t,r,i){const n=`campaign/v3/${e}?size=${r}${i?`&t=${i}`:""}`,a=await this.fetchWithConfig(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(`Failed to request campaign: ${a.statusText}`);return 204==a.status?{}:a.json()}async sendTracking(e,t,r,i,n,a){const s=`tracker?e=${e}&c=${t??""}&u=${r}&requestId=${i}${n?`&m=${n}`:""}${a?`&s=${a}`:""}`,o=await this.fetchWithConfig(s,{method:"POST",keepalive:!0});if(!o.ok)throw new Error(`Failed to send tracking: ${o.statusText}`)}async checkConnectivity(e="https://access-network.akross.com.br"){const t=Math.round(1e4*Math.random()),r=await this.fetchWithConfig(`${e}?rand=${t}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to check connectivity: ${r.statusText}`);return r}async sendParsedVastTrackingEvent(e){const t=await this.fetchWithConfig(e,{method:"GET",keepalive:!0});if(!t.ok)throw new Error(`Failed to send parsed VAST tracking event: ${t.statusText}`)}}class b{constructor(){}createFetchConfig(e,t,r=!1,i=!0){return{baseUrl:e,timeout:t,debugMode:r,restInterceptor:i?new A:null}}init(e="",t=5,r=!1,i=!0){let n=e;if(""===n){const e=St.getConfig();n=e?.baseUrl||"https://internal-artemis-837746407.us-east-1.elb.amazonaws.com/adserver/"}return this.createFetchConfig(n,t,r,i)}getArtemisAdsService(e=30,t=!1,r=!0){const i=this.init("",e,t,r);return new w(i)}}const R="impression",T="success_impression",k="complete",I="campaign-click",S="prog-wtfl-start",C="prog-conn-error",D="prog-fallback-req",L="prog-ad-error",N="prog-ad-no-fill",M="prog-skipped",x="ad-error",O="start",P="firstQuartile",U="midpoint",V="thirdQuartile",_="skipped";class q{constructor(){this.logger=new y(St.getDebugMode()),this.apiFactory=new b}async sendEvent(e,t,r,i,n){await this.requestEvent(e,t,r,i,n)}async requestEvent(e,t,r,i,n){const a=St.getUserData(),s=a?.userId;if(s)try{const a=St.getDebugMode(),o=this.apiFactory.getArtemisAdsService(3,a);await o.sendTracking(e,t,s,r,i,n),this.logger.debug(`Event sent successfully: ${e} for campaign ${t}`)}catch(e){this.logger.warn("Error sending tracking event:",e)}else this.logger.error("Error sending tracking event: User id is null")}async sendMediaClickEvent(e,t,r){await this.sendEvent("media-click",e,t,r)}async sendCampaignClickEvent(e,t){await this.sendEvent(I,e,t)}async sendCampaignsImpressionEvent(e,t){for(const r of t)await this.sendEvent(R,r.campaignUuid,e)}async sendImpressedEvent(e,t,r){await this.sendEvent(R,e,t,r)}async sendSuccessImpressionEvent(e,t,r){await this.sendEvent(T,e,t,r)}async sendCompleteEvent(e,t,r,i){await this.sendEvent(k,e,t,r,i)}async sendAllAdsCompletedEvent(e,t,r,i){await this.sendEvent("all-ads-completed"+(i?`${i}`:""),e,t,r)}async sendAdCompletedEvent(e,t,r){await this.sendEvent("ad-completed",e,t,r)}async sendEventFromUrl(e){try{const t=St.getDebugMode(),r=this.apiFactory.getArtemisAdsService(3,t);await r.sendParsedVastTrackingEvent(e),this.logger.debug("Parsed VAST tracking event sent successfully")}catch(e){this.logger.warn("Error sending tracking event from URL:",e)}}async sendVpaidStartEvent(e,t,r){await this.sendEvent(O,e,t,r)}async sendFirstQuartileEvent(e,t,r){await this.sendEvent(P,e,t,r)}async sendMidpointEvent(e,t,r){await this.sendEvent(U,e,t,r)}async sendThirdQuartileEvent(e,t,r){await this.sendEvent(V,e,t,r)}async sendSkippedEvent(e,t,r){await this.sendEvent(_,e,t,r)}async sendAdErrorEvent(e,t,r){await this.sendEvent(x,e,t,r)}async sendAdNoFillEvent(e,t,r){await this.sendEvent(N,e,t,r)}async sendWaterfallStartEvent(e,t,r){await this.sendEvent(S,e,t,r)}async sendProgConnectionError(e,t,r){await this.sendEvent(C,e,t,r)}async sendProgFallbackReq(e,t,r){await this.sendEvent(D,e,t,r)}async sendProgError(e,t,r){await this.sendEvent(L,e,t,r)}async sendProgSkipped(e,t,r){await this.sendEvent(M,e,t,r)}async sendClickThroughEvent(e,t,r){await this.sendEvent("clickthrough",e,t,r)}async sendParsedVastTrackingEvent(e){await this.sendEventFromUrl(e)}}function F(){return new q}const B=q,H=F,W={REWARDED:"Benefício adiquirido com sucesso",NOT_REWARDED:"Você precisa assistir o anúncio até o fim para obter o benefício",REDIRECT_ERROR:"Você não tem nenhum aplicativo instalado para abrir uma página na web",ERROR:"Ocorreu um erro ao exibir o anúncio. Por favor, tente novamente",CONNECTION_ERROR:"Ocorreu um erro ao exibir o anúncio. Por favor, verifique sua conexão e tente novamente",NO_FILL:"Não foi possível encontrar uma publicidade no momento. Por favor, tente novamente",VAST_BACK:"Para obter o prêmio é necessário assistir o vídeo até o final"};var z;e.AAVastTrackingEvents=void 0,(z=e.AAVastTrackingEvents||(e.AAVastTrackingEvents={})).IMPRESSION="IMPRESSION",z.CLICKTHROUGH="CLICKTHROUGH",z.VAST_IMPRESSION="VAST_IMPRESSION",z.START="START",z.FIRST_QUARTILE="FIRST_QUARTILE",z.MIDPOINT="MIDPOINT",z.THIRD_QUARTILE="THIRD_QUARTILE",z.COMPLETE="COMPLETE",z.ERROR="ERROR",z.SKIPPED="SKIPPED",z.NO_FILL="NO_FILL",z.PROGRAMMATIC_ERROR="PROGRAMMATIC_ERROR",z.PROGRAMMATIC_SKIPPED="PROGRAMMATIC_SKIPPED",z.PROGRAMMATIC_WATERFALL_START="PROGRAMMATIC_WATERFALL_START",z.PROGRAMMATIC_CONNECTION_ERROR="PROGRAMMATIC_CONNECTION_ERROR",z.PROGRAMMATIC_FALLBACK_REQ="PROGRAMMATIC_FALLBACK_REQ",z.AD_COMPLETED="AD_COMPLETED",z.ALL_ADS_COMPLETED="ALL_ADS_COMPLETED";class K{constructor(e){this.sentEvents=new Set,this.config=e,this.logger=new y(St.getDebugMode()),this.eventsHelper=new q}sendEventCallback(t,r){if(this.sentEvents.has(t))this.logger.debug(`Event ${t} already sent, skipping`);else switch(this.sentEvents.add(t),this.logger.debug(`Sending event: ${t} for media: ${r.title}`),t){case e.AAVastTrackingEvents.IMPRESSION:this.onAdImpression(r);break;case e.AAVastTrackingEvents.START:this.onAdStarted(r);break;case e.AAVastTrackingEvents.FIRST_QUARTILE:this.onFirstQuartile(r);break;case e.AAVastTrackingEvents.MIDPOINT:this.onMidpoint(r);break;case e.AAVastTrackingEvents.THIRD_QUARTILE:this.onThirdQuartile(r);break;case e.AAVastTrackingEvents.COMPLETE:this.onAdComplete(r);break;case e.AAVastTrackingEvents.ERROR:this.onAdError(r);break;case e.AAVastTrackingEvents.SKIPPED:this.onAdSkipped(r);break;case e.AAVastTrackingEvents.NO_FILL:this.onProgrammaticNoFill(r);break;case e.AAVastTrackingEvents.PROGRAMMATIC_ERROR:this.onProgrammaticAdError(r);break;case e.AAVastTrackingEvents.PROGRAMMATIC_SKIPPED:this.onProgrammaticSkipped(r);break;case e.AAVastTrackingEvents.PROGRAMMATIC_WATERFALL_START:this.onProgrammaticStart(r);break;case e.AAVastTrackingEvents.PROGRAMMATIC_CONNECTION_ERROR:this.onProgrammaticConnectionError(r);break;case e.AAVastTrackingEvents.PROGRAMMATIC_FALLBACK_REQ:this.onProgrammaticFallbackReq(r);break;case e.AAVastTrackingEvents.CLICKTHROUGH:this.onClickThrough(r);break;case e.AAVastTrackingEvents.AD_COMPLETED:this.onAdCompleted(r);break;case e.AAVastTrackingEvents.ALL_ADS_COMPLETED:this.onAllAdsCompleted(r);break;default:this.logger.warn(`Unknown event: ${t}`)}}finishWithResult(t,r,i){const n=new E({media:t,result:r});switch(r){case e.AAMediaPlayResult.REWARDED:if(this.logger.debug(`Checking mediasLeft: ${t.mediasLeft} (type: ${typeof t.mediasLeft})`),(t.mediasLeft||0)>1)this.logger.debug(`Setting result to MEDIA_WATCHED because mediasLeft (${t.mediasLeft}) > 1`),n.result=e.AAMediaPlayResult.MEDIA_WATCHED;else if(this.logger.debug(`Keeping result as REWARDED because mediasLeft (${t.mediasLeft}) <= 1`),"EXTERNAL"===t.success?.type)try{t.success.url&&(window.open(t.success.url,"_blank"),n.result=e.AAMediaPlayResult.REWARDED_REDIRECTED)}catch(t){n.error=new u(W.REDIRECT_ERROR),n.result=e.AAMediaPlayResult.ERROR}break;case e.AAMediaPlayResult.ERROR:n.error=new u(W.ERROR,i);break;case e.AAMediaPlayResult.NO_FILL:n.error=new u(W.NO_FILL,"NO_FILL");break;case e.AAMediaPlayResult.CONNECTION_ERROR:n.error=new u(W.CONNECTION_ERROR,"CONNECTION_ERROR");break;case e.AAMediaPlayResult.CANCELED:n.error=new u(W.NOT_REWARDED);break;case e.AAMediaPlayResult.REWARDED_REDIRECTED:case e.AAMediaPlayResult.EXTERNAL_REDIRECT:break;default:this.logger.warn(`Unknown result: ${r}`)}return n}onAdImpression(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendImpressedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdClickThrough(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendClickThroughEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdStarted(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendVpaidStartEvent(e.campaignId||"",e.requestId||"",e.uuid)}onFirstQuartile(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendFirstQuartileEvent(e.campaignId||"",e.requestId||"",e.uuid)}onMidpoint(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendMidpointEvent(e.campaignId||"",e.requestId||"",e.uuid)}onThirdQuartile(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendThirdQuartileEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdComplete(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendCompleteEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdCompleted(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendAdCompletedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAllAdsCompleted(e){this.eventsHelper.sendAllAdsCompletedEvent(e.campaignId||"",e.requestId||"",e.uuid,e.content?.video?.eventSuffix)}onAdSkipped(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendSkippedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdError(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendAdErrorEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticNoFill(e){this.eventsHelper.sendAdNoFillEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticStart(e){this.eventsHelper.sendWaterfallStartEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticConnectionError(e,t){this.eventsHelper.sendProgConnectionError(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticFallbackReq(e){this.eventsHelper.sendProgFallbackReq(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticAdError(e,t){this.eventsHelper.sendProgError(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticSkipped(e){this.eventsHelper.sendProgSkipped(e.campaignId||"",e.requestId||"",e.uuid)}onClickThrough(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendClickThroughEvent(e.campaignId||"",e.requestId||"",e.uuid)}canSendLocalEvents(t){if(t.type===e.AAMediaTypes.VIDEO_V2){const e=t.content?.video?.type?.toUpperCase();return"VAST"===e||"VPAID"===e}return!0}clearSentEvents(){this.sentEvents.clear()}hasEventBeenSent(e){return this.sentEvents.has(e)}}const G=1e3;function j(e=!1){return new Promise((t,r)=>{if(window.googletag)t();else if(document.getElementById("gpt-script"))setTimeout(()=>{window.googletag?t():r(new Error("GPT script exists but not loaded"))},G);else{const i="https://www.googletagservices.com/tag/js/gpt.js",n=document.createElement("script");n.src=Q("gpt.js",i,e),n.id="gpt-script",n.async=!0,n.onload=()=>{setTimeout(()=>{window.googletag?t():r(new Error("GPT script failed to initialize"))},G)},n.onerror=e=>{r(e)},document.head.appendChild(n)}})}function $(e=!1){return new Promise((t,r)=>{if(window.google&&window.google.ima)t();else if(document.getElementById("ima-script"))setTimeout(()=>{window.google&&window.google.ima?t():r(new Error("IMA SDK script exists but not loaded"))},G);else{const i="https://imasdk.googleapis.com/js/sdkloader/ima3.js",n=document.createElement("script");n.src=Q("ima3.js",i,e),n.id="ima-script",n.async=!0,n.onload=()=>{setTimeout(()=>{window.google&&window.google.ima?t():r(new Error("IMA SDK failed to initialize"))},G)},n.onerror=e=>{r(e)},document.head.appendChild(n)}})}function Y(e,t=!1){return new Promise((r,i)=>{if(window.adsbylumina&&window.__luminaBasecodeReady__)r();else if(document.getElementById("lumina-script"))setTimeout(()=>{window.adsbylumina&&window.__luminaBasecodeReady__?r():i(new Error("Lumina SDK script exists but not loaded"))},G);else{const n="https://s16-ad.ap4r.com/kos/s101/nlav11187/lumina/lumina-install.js",a=new URLSearchParams;e.token&&a.append("token",e.token),void 0!==e.debug&&a.append("debug",e.debug.toString());const s=`${n}?${a.toString()}`,o=document.createElement("script");o.src=Q("lumina-install.js",s,t),o.id="lumina-script",o.async=!0,o.onload=()=>{setTimeout(()=>{window.adsbylumina&&window.__luminaBasecodeReady__?r():i(new Error("Lumina SDK failed to initialize"))},G)},o.onerror=e=>{i(new Error("Failed to load Lumina SDK script"))},document.head.appendChild(o)}})}function Q(e,t,r=!1){if(!r)return t;const i=St.getConfig()?.cdnBaseUrl;return i?`${i}/static/js/${e}`:t}class X{constructor(e){this.modalElement=null,this.videoElement=null,this.videoContainer=null,this.closeButton=null,this.fallbackOverlay=null,this.fallbackTimerEl=null,this.fallbackSaibaMaisBtn=null,this.logger=e}createModal(){try{if(this.cleanup(),this.modalElement=document.createElement("div"),this.modalElement.innerHTML='\n <style>\n .aa-vast-modal {\n display: flex;\n flex-direction: column;\n position: fixed;\n inset: 0;\n width: 100vw;\n height: 100vh;\n background-color: #000;\n z-index: 2147483647;\n overflow: hidden;\n }\n\n .aa-vast-header {\n flex-shrink: 0;\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n padding: 0 8px;\n background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));\n z-index: 10;\n }\n\n .aa-vast-modal-dialog {\n flex: 1;\n min-height: 0;\n position: relative;\n overflow: hidden;\n }\n\n .content-video-vast {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .aa-vast-close-btn {\n position: relative;\n width: 44px;\n height: 44px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.5);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background-color 0.2s ease, transform 0.15s ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n .aa-vast-close-btn:hover {\n background-color: rgba(0, 0, 0, 0.8);\n }\n\n .aa-vast-close-btn:active {\n transform: scale(0.95);\n }\n\n .aa-vast-close-btn::before,\n .aa-vast-close-btn::after {\n content: \'\';\n position: absolute;\n width: 22px;\n height: 2px;\n background-color: #fff;\n border-radius: 1px;\n }\n\n .aa-vast-close-btn::before {\n transform: rotate(45deg);\n }\n\n .aa-vast-close-btn::after {\n transform: rotate(-45deg);\n }\n\n .ima-ad-container {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 2;\n }\n\n .ima-ad-container > * {\n pointer-events: auto;\n }\n\n .ima-video-element {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: contain;\n cursor: pointer;\n z-index: 1;\n }\n\n .ima-video-element:focus {\n outline: none;\n }\n\n .aa-vast-fallback-overlay {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 5;\n display: none;\n align-items: flex-end;\n justify-content: flex-end;\n padding: 24px 16px 16px;\n background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));\n pointer-events: none;\n }\n\n .aa-vast-fallback-overlay.is-visible {\n display: flex;\n pointer-events: auto;\n }\n\n .aa-vast-fallback-overlay > * {\n pointer-events: auto;\n }\n\n .aa-vast-fallback-timer {\n position: absolute;\n left: 0;\n bottom: 0;\n color: #fff;\n display: inline-block;\n font-family: Arial, sans-serif;\n font-weight: normal;\n font-size: 11px;\n line-height: normal;\n padding: 5px;\n padding-right: 10px;\n pointer-events: auto;\n text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);\n cursor: default;\n }\n\n .aa-vast-fallback-saiba-mais {\n padding: 8px 16px;\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n background-color: rgba(255, 255, 255, 0.25);\n border: 1px solid rgba(255, 255, 255, 0.5);\n border-radius: 4px;\n cursor: pointer;\n text-decoration: none;\n transition: background-color 0.2s ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n .aa-vast-fallback-saiba-mais:hover {\n background-color: rgba(255, 255, 255, 0.35);\n }\n </style>\n <div id="modal" class="aa-vast-modal">\n <header class="aa-vast-header">\n <button type="button" class="aa-vast-close-btn" id="close-modal" aria-label="Fechar anúncio"></button>\n </header>\n <div class="aa-vast-modal-dialog">\n <div id="content-video-vast" class="content-video-vast">\n <video id="ima-video-element" class="ima-video-element" autoplay playsinline></video>\n <div id="ima-ad-container" class="ima-ad-container"></div>\n </div>\n <div id="aa-vast-fallback-overlay" class="aa-vast-fallback-overlay" aria-hidden="true">\n <span id="aa-vast-fallback-timer" class="aa-vast-fallback-timer">Anúncio 0:00</span>\n <button type="button" id="aa-vast-fallback-saiba-mais" class="aa-vast-fallback-saiba-mais">Saiba mais</button>\n </div>\n </div>\n </div>\n ',document.body.appendChild(this.modalElement),this.videoElement=this.modalElement.querySelector("#ima-video-element"),this.videoContainer=this.modalElement.querySelector(".content-video-vast"),this.closeButton=this.modalElement.querySelector("#close-modal"),this.fallbackOverlay=this.modalElement.querySelector("#aa-vast-fallback-overlay"),this.fallbackTimerEl=this.modalElement.querySelector("#aa-vast-fallback-timer"),this.fallbackSaibaMaisBtn=this.modalElement.querySelector("#aa-vast-fallback-saiba-mais"),!this.videoElement)throw new Error("Video element not found");return this.logger.debug("Modal created successfully"),this.videoElement}catch(e){throw this.logger.error("Error creating modal:",e),e}}getVideoElement(){return this.videoElement}getVideoContainer(){return this.videoContainer}getAdContainer(){return this.modalElement?this.modalElement.querySelector("#ima-ad-container"):null}setCloseCallback(e){this.closeButton&&this.closeButton.addEventListener("click",e)}showFallbackOverlay(e){this.fallbackOverlay&&(this.fallbackOverlay.classList.add("is-visible"),this.fallbackOverlay.setAttribute("aria-hidden","false"),this.fallbackSaibaMaisBtn&&(this.fallbackSaibaMaisBtn.style.display=e?"":"none"),this.logger.debug("Fallback overlay shown"))}hideFallbackOverlay(){this.fallbackOverlay&&(this.fallbackOverlay.classList.remove("is-visible"),this.fallbackOverlay.setAttribute("aria-hidden","true"),this.logger.debug("Fallback overlay hidden"))}updateFallbackTimer(e,t){if(!this.fallbackTimerEl)return;const r=Math.max(0,Math.floor((t||0)-e)),i=Math.floor(r/60),n=r%60;this.fallbackTimerEl.textContent=`Anúncio ${i}:${n.toString().padStart(2,"0")}`}setFallbackSaibaMaisClick(e){this.fallbackSaibaMaisBtn&&this.fallbackSaibaMaisBtn.addEventListener("click",e)}close(){this.modalElement&&(this.modalElement.style.display="none")}hide(){this.modalElement&&(this.modalElement.style.display="none",this.modalElement.style.visibility="hidden",this.logger.debug("Modal hidden (not removed)"))}remove(){this.modalElement&&(document.body.removeChild(this.modalElement),this.modalElement=null)}showVideo(){this.videoElement&&(this.videoElement.style.display="block",this.videoElement.style.visibility="visible",this.logger.debug("Video made visible"))}cleanup(){try{this.closeButton&&(this.closeButton.remove(),this.closeButton=null),this.fallbackOverlay=null,this.fallbackTimerEl=null,this.fallbackSaibaMaisBtn=null,this.videoElement&&(this.videoElement=null),this.videoContainer&&(this.videoContainer.remove(),this.videoContainer=null),this.modalElement&&(this.modalElement.remove(),this.modalElement=null),this.logger.debug("UI cleaned up successfully")}catch(e){this.logger.error("Error cleaning up UI:",e)}}}class J{static show(){if(this.isVisible)return;const e=St.getConfig(),t=e?.primaryColor||"#007bff",r=document.createElement("div");r.id=this.OVERLAY_ID,r.innerHTML=`\n <style>\n #${this.OVERLAY_ID} {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.8);\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n margin: 0;\n padding: 0;\n }\n \n #${this.OVERLAY_ID} .loading-content {\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n #${this.OVERLAY_ID} .spinner {\n width: 40px;\n height: 40px;\n border: 4px solid rgba(255, 255, 255, 0.3);\n border-top: 4px solid ${t};\n border-radius: 50%;\n animation: spin 1s linear infinite;\n margin-bottom: 16px;\n flex-shrink: 0;\n }\n \n #${this.OVERLAY_ID} .loading-text {\n font-size: 16px;\n font-weight: 500;\n margin: 0;\n line-height: 1.2;\n }\n \n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n </style>\n <div class="loading-content">\n <div class="spinner"></div>\n <p class="loading-text">Carregando Publicidade</p>\n </div>\n `,document.body.appendChild(r),this.isVisible=!0}static hide(){const e=document.getElementById(this.OVERLAY_ID);e&&(e.remove(),this.isVisible=!1)}static isShowing(){return this.isVisible}static forceHide(){const e=document.getElementById(this.OVERLAY_ID);e&&e.remove(),this.isVisible=!1}}function Z(){return!0===St.getConfig()?.enableGPTPpid}function ee(e){if(!e||"string"!=typeof e)return!1;const t=e.trim();return t.length>=1&&t.length<=150}function te(e){if(!Z())return;if(!ee(e))return;if("undefined"==typeof window)return;const t=e.trim();window.googletag=window.googletag||{cmd:[]},window.googletag.cmd.push(()=>{try{"function"==typeof window.googletag?.pubads&&window.googletag.pubads().setPublisherProvidedId(t)}catch{}})}function re(){if(!Z())return;if("undefined"==typeof window||"function"!=typeof window.googletag?.pubads)return;const e=St.getUserData()?.userId;if(e&&ee(e))try{window.googletag.pubads().setPublisherProvidedId(e.trim())}catch{}}function ie(){if("undefined"!=typeof __VERSION__)return __VERSION__;if("undefined"!=typeof process&&process.env?.npm_package_version)return process.env.npm_package_version;try{return"3.7.8"}catch(e){return"unknown"}}function ne(){const e=ie(),t="undefined"!=typeof process&&process.env;return{version:e,isDevelopment:!!t&&"development"===process.env.NODE_ENV,isProduction:!t||"production"===process.env.NODE_ENV,buildTime:(new Date).toISOString()}}J.OVERLAY_ID="akross-loading-overlay",J.isVisible=!1;const ae=ie(),se=ne();class oe{constructor(e){this.overlayElement=null,this.iframeElement=null,this.loadingElement=null,this.errorElement=null,this.retryButton=null,this.closeButton=null,this.isSurveyCompleted=!1,this.isSurveyClosed=!1,this.media=e;const t=St.getDebugMode();this.logger=new y(t),this.mediaResultHelper=new K({userId:St.getUserData()?.userId||"",debug:t})}async start(){try{return this.logger.debug("Starting survey overlay for media:",this.media.title),"survey_v2"!==this.media.type&&"video_v2"!==this.media.type?(this.logger.error("Unsupported media type:",this.media.type),new E({media:this.media,result:e.AAMediaPlayResult.ERROR,error:new u("Unsupported media type")})):this.media.content?.survey?.url?(this.createOverlay(),this.setupEventListeners(),this.loadSurvey(),new Promise(e=>{this.onResultCallback=t=>{let r=this.mediaResultHelper.finishWithResult(t.media,t.result);e(r)}})):(this.logger.error("Survey URL not found"),new E({media:this.media,result:e.AAMediaPlayResult.ERROR,error:new u("Survey URL not found")}))}catch(t){return this.logger.error("Error starting survey overlay:",t),new E({media:this.media,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}createOverlay(){this.overlayElement=document.createElement("div"),this.overlayElement.innerHTML=`\n <style>${oe.OVERLAY_CSS}</style>\n <div class="aa-survey-overlay">\n <div class="aa-survey-dialog">\n <div class="aa-survey-content">\n <iframe class="aa-survey-iframe"></iframe>\n <div class="aa-survey-loading" style="display: none;">\n <div style="width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid #007bff; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 16px;"></div>\n <div style="color: #666; font-size: 14px;">Carregando pesquisa...</div>\n </div>\n <div class="aa-survey-error" style="display: none;">\n <div style="font-size: 48px; margin-bottom: 16px;">⚠️</div>\n <div class="aa-survey-error-message" style="font-size: 16px; color: #666; margin-bottom: 24px;"></div>\n <button style="background-color: #007bff; color: white; border: none; padding: 12px 24px; border-radius: 4px; cursor: pointer; font-size: 14px; transition: background-color 0.2s ease;">Tentar Novamente</button>\n </div>\n </div>\n <button type="button" class="closeButton"></button>\n </div>\n </div>\n `,document.body.appendChild(this.overlayElement),this.iframeElement=this.overlayElement.querySelector(".aa-survey-iframe"),this.loadingElement=this.overlayElement.querySelector(".aa-survey-loading"),this.errorElement=this.overlayElement.querySelector(".aa-survey-error"),this.retryButton=this.overlayElement.querySelector('button[style*="Tentar Novamente"]'),this.closeButton=this.overlayElement.querySelector(".closeButton"),this.applyPrimaryColor(),this.logger.debug("Survey overlay created")}applyPrimaryColor(){const e=St.getConfig(),r=e?t.getPrimaryColor(e,"#007bff"):"#007bff";if(this.loadingElement){const e=this.loadingElement.querySelector('div[style*="border-top"]');e&&(e.style.borderTop=`4px solid ${r}`)}this.retryButton&&(this.retryButton.style.backgroundColor=r,this.retryButton.addEventListener("mouseenter",()=>{this.retryButton.style.backgroundColor=this.darkenColor(r,10)}),this.retryButton.addEventListener("mouseleave",()=>{this.retryButton.style.backgroundColor=r}))}setupEventListeners(){this.retryButton&&this.retryButton.addEventListener("click",()=>{this.hideErrorInterface(),this.loadSurvey()}),this.closeButton&&this.closeButton.addEventListener("click",()=>{this.executeBackButtonLogic()}),document.addEventListener("keydown",e=>{"Escape"===e.key&&this.executeBackButtonLogic()}),this.overlayElement&&this.overlayElement.addEventListener("click",e=>{e.target===this.overlayElement&&this.executeBackButtonLogic()})}loadSurvey(){this.iframeElement&&this.media.content?.survey?.url?(this.logger.debug("Loading survey from URL:",this.media.content.survey.url),this.hideErrorInterface(),this.showLoading(),this.iframeElement.src=this.media.content.survey.url,this.iframeElement.onload=()=>{this.hideLoading(),setTimeout(()=>{this.injectSurveyBridge()},100)},this.iframeElement.onerror=()=>{this.hideLoading(),this.showErrorInterface("Erro ao carregar a pesquisa")}):this.showErrorInterface("URL da pesquisa não encontrada")}injectSurveyBridge(){try{this.setupMessageListener(),this.attemptScriptInjection()}catch(e){this.logger.error("Error setting up survey bridge:",e)}}setupMessageListener(){const e=e=>{const{data:t}=e;t&&"akross-survey"===t.source&&(this.logger.debug("Survey message received from iframe:",t),this.handleSurveyMessage(t))};window.addEventListener("message",e),this._messageHandler=e}attemptScriptInjection(){const e=this.createSurveyBridgeScript(),t=()=>{try{if(!this.iframeElement?.contentWindow)return!1;const t=this.iframeElement.contentDocument||this.iframeElement.contentWindow.document;if(t&&"complete"===t.readyState){const r=t.createElement("script");return r.textContent=e,t.head.appendChild(r),!0}return"function"==typeof this.iframeElement.contentWindow.eval&&(this.iframeElement.contentWindow.eval(e),!0)}catch(e){return!1}};t()||setTimeout(()=>{t()||setTimeout(()=>{t()||setTimeout(()=>{t()},1e3)},500)},200)}createSurveyBridgeScript(){return"\n (function() {\n // Função notifyHost para compatibilidade com SurveyJS\n window.notifyHost = function(eventName, payload) {\n const message = {\n source: 'akross-survey',\n type: eventName,\n payload,\n ts: Date.now()\n };\n\n // 1) iOS WKWebView\n try {\n if (window.webkit?.messageHandlers?.surveyBridge) {\n window.webkit.messageHandlers.surveyBridge.postMessage(message);\n return;\n }\n } catch (error) {\n console.error('❌ NotifyHost: Erro iOS WKWebView:', error);\n }\n\n // 2) Android WebView (via addJavascriptInterface)\n try {\n if (window.AndroidSurveyBridge?.postMessage) {\n // Em Android é comum aceitar string; envie JSON serializado\n window.AndroidSurveyBridge.postMessage(JSON.stringify(message));\n return;\n }\n } catch (error) {\n console.error('❌ NotifyHost: Erro Android WebView:', error);\n }\n\n // 3) Web (iFrame → janela hospedeira)\n if (window.parent && window.parent !== window) {\n window.parent.postMessage(message, '*');\n }\n };\n })();\n "}getSurveyBridgeScript(){return this.createSurveyBridgeScript()}testCommunication(){if(this.logger.debug("Testing communication with iframe"),this.iframeElement?.contentWindow){const e={source:"akross-survey-test",type:"communication_test",payload:{timestamp:Date.now()}};this.iframeElement.contentWindow.postMessage(e,"*")}}handleSurveyMessage(e){try{switch(this.logger.debug("Survey message received:",e),e.type){case"survey_complete":this.handleSurveyComplete(e.payload);break;case"survey_save":this.handleSurveySave(e.payload);break;case"survey_closed":this.handleSurveyClose();break;case"survey_started":this.handleSurveyStarted(e.payload);break;case"survey_progress":this.handleSurveyProgress(e.payload);break;default:this.logger.warn("Unknown message type:",e.type)}}catch(e){this.logger.error("Error processing survey message:",e)}}processPayload(e,t,r){if(this.logger.debug(`${t} with payload:`,e),e){const i=r(e);this.logger.debug(`${t} data:`,i)}}handleSurveyComplete(e){this.processPayload(e,"🎉 Survey Complete Handler",e=>({answers:e.answers,timeSpent:e.timeSpent,completed:e.completed})),this.isSurveyCompleted=!0}handleSurveySave(e){this.processPayload(e,"💾 Survey Save Handler",e=>({progress:e.progress,answers:e.answers,timestamp:(new Date).toISOString()}))}handleSurveyClose(){this.logger.debug("Survey close requested. Completed:",this.isSurveyCompleted),this.isSurveyClosed=!0,this.executeBackButtonLogic()}handleSurveyStarted(e){this.processPayload(e,"🚀 Survey Started Handler",e=>({surveyId:e.surveyId,timestamp:(new Date).toISOString(),userAgent:navigator.userAgent}))}handleSurveyProgress(e){this.processPayload(e,"📊 Survey Progress Handler",e=>({progress:e.progress,currentPage:e.currentPage,totalPages:e.totalPages,timestamp:(new Date).toISOString()}))}executeBackButtonLogic(){this.isSurveyCompleted?this.finishWithResult(e.AAMediaPlayResult.REWARDED):this.finishWithResult(e.AAMediaPlayResult.CANCELED)}finishWithResult(e){if(this.logger.debug("Finishing survey overlay with result:",e),this.cleanup(),this.onResultCallback){const t=new E({media:this.media,result:e});this.onResultCallback(t)}}setElementVisibility(e,t,r="block"){e&&(e.style.display=t?r:"none")}showErrorInterface(e="Erro ao carregar a pesquisa"){if(this.errorElement){const t=this.errorElement.querySelector(".aa-survey-error-message");t&&(t.textContent=e),this.setElementVisibility(this.errorElement,!0,"flex")}this.setElementVisibility(this.iframeElement,!1),this.hideLoading()}hideErrorInterface(){this.setElementVisibility(this.errorElement,!1),this.setElementVisibility(this.iframeElement,!0)}showLoading(){this.setElementVisibility(this.loadingElement,!0)}hideLoading(){this.setElementVisibility(this.loadingElement,!1)}darkenColor(e,t){const r=parseInt(e.replace("#",""),16),i=Math.round(2.55*t),n=(r>>16)-i,a=(r>>8&255)-i,s=(255&r)-i;return"#"+(16777216+65536*(n<255?n<1?0:n:255)+256*(a<255?a<1?0:a:255)+(s<255?s<1?0:s:255)).toString(16).slice(1)}cleanup(){this._messageHandler&&(window.removeEventListener("message",this._messageHandler),this._messageHandler=null),this.overlayElement&&this.overlayElement.parentNode&&this.overlayElement.parentNode.removeChild(this.overlayElement),this.overlayElement=null,this.iframeElement=null,this.loadingElement=null,this.errorElement=null,this.retryButton=null,this.closeButton=null}}oe.OVERLAY_CSS="\n .aa-survey-overlay {\n display: block;\n position: fixed;\n z-index: 1;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .aa-survey-dialog {\n background-color: white;\n border-radius: 8px;\n position: relative;\n width: 100%;\n max-width: 95vw;\n height: 95vh;\n overflow: hidden;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n }\n\n .aa-survey-content {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n }\n\n .aa-survey-iframe {\n width: 100%;\n height: 100%;\n border: none;\n }\n\n .aa-survey-loading {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n z-index: 10;\n }\n\n .aa-survey-error {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: white;\n display: none;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding: 20px;\n }\n\n .closeButton {\n display: flex;\n position: absolute;\n top: 10px;\n right: 10px;\n background-color: rgba(0, 0, 0, 0.8);\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-radius: 50%;\n width: 40px;\n height: 40px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n font-size: 0;\n transition: all 0.2s ease;\n z-index: 10;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);\n }\n\n .closeButton::before,\n .closeButton::after {\n content: '';\n position: absolute;\n width: 20px;\n height: 2px;\n background-color: white;\n border-radius: 1px;\n }\n\n .closeButton::before {\n transform: rotate(45deg);\n }\n\n .closeButton::after {\n transform: rotate(-45deg);\n }\n\n .closeButton:hover {\n background-color: rgba(0, 0, 0, 0.9);\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ";var le,ce,de,ue={},he={};function ge(){if(le)return he;function e(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}le=1;var t=e({HTML:"text/html",isHTML:function(e){return e===t.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),i={find:function(e,t,r){if(void 0===r&&(r=Array.prototype),e&&"function"==typeof r.find)return r.find.call(e,t);for(var i=0;i<e.length;i++)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];if(t.call(void 0,n,i,e))return n}},freeze:e,NAMESPACE:r},n=i.find,a=i.NAMESPACE;function s(e){return""!==e}function o(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function l(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(s):[]}(e);return Object.keys(t.reduce(o,{}))}function c(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function d(e,t){var r=e.prototype;if(!(r instanceof t)){function i(){}i.prototype=t.prototype,c(r,i=new i),e.prototype=r=i}r.constructor!=e&&(r.constructor=e)}var u={},h=u.ELEMENT_NODE=1,g=u.ATTRIBUTE_NODE=2,p=u.TEXT_NODE=3,m=u.CDATA_SECTION_NODE=4,f=u.ENTITY_REFERENCE_NODE=5,v=u.ENTITY_NODE=6,E=u.PROCESSING_INSTRUCTION_NODE=7,y=u.COMMENT_NODE=8,A=u.DOCUMENT_NODE=9,w=u.DOCUMENT_TYPE_NODE=10,b=u.DOCUMENT_FRAGMENT_NODE=11,R=u.NOTATION_NODE=12,T={},k={};T.INDEX_SIZE_ERR=(k[1]="Index size error",1),T.DOMSTRING_SIZE_ERR=(k[2]="DOMString size error",2);var I=T.HIERARCHY_REQUEST_ERR=(k[3]="Hierarchy request error",3);T.WRONG_DOCUMENT_ERR=(k[4]="Wrong document",4),T.INVALID_CHARACTER_ERR=(k[5]="Invalid character",5),T.NO_DATA_ALLOWED_ERR=(k[6]="No data allowed",6),T.NO_MODIFICATION_ALLOWED_ERR=(k[7]="No modification allowed",7);var S=T.NOT_FOUND_ERR=(k[8]="Not found",8);T.NOT_SUPPORTED_ERR=(k[9]="Not supported",9);var C=T.INUSE_ATTRIBUTE_ERR=(k[10]="Attribute in use",10);function D(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,k[e]),this.message=k[e],Error.captureStackTrace&&Error.captureStackTrace(this,D);return r.code=e,t&&(this.message=this.message+": "+t),r}function L(){}function N(e,t){this._node=e,this._refresh=t,M(this)}function M(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(Ae(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var i=r.length;i in e;i++)Object.prototype.hasOwnProperty.call(e,i)&&delete e[i];c(r,e),e._inc=t}}function x(){}function O(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function P(e,t,r,i){if(i?t[O(t,i)]=r:t[t.length++]=r,e){r.ownerElement=e;var n=e.ownerDocument;n&&(i&&H(n,e,i),function(e,t,r){e&&e._inc++,r.namespaceURI===a.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}(n,e,r))}}function U(e,t,r){var i=O(t,r);if(!(i>=0))throw new D(S,new Error(e.tagName+"@"+r));for(var n=t.length-1;i<n;)t[i]=t[++i];if(t.length=n,e){var a=e.ownerDocument;a&&(H(a,e,r),r.ownerElement=null)}}function V(){}function _(){}function q(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function F(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(F(e,t))return!0}while(e=e.nextSibling)}function B(){this.ownerDocument=this}function H(e,t,r,i){e&&e._inc++,r.namespaceURI===a.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function W(e,t,r){if(e&&e._inc){e._inc++;var i=t.childNodes;if(r)i[i.length++]=r;else{for(var n=t.firstChild,a=0;n;)i[a++]=n,n=n.nextSibling;i.length=a,delete i[i.length]}}}function z(e,t){var r=t.previousSibling,i=t.nextSibling;return r?r.nextSibling=i:e.firstChild=i,i?i.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,W(e.ownerDocument,e),t}function K(e){return e&&e.nodeType===_.DOCUMENT_TYPE_NODE}function G(e){return e&&e.nodeType===_.ELEMENT_NODE}function j(e){return e&&e.nodeType===_.TEXT_NODE}function $(e,t){var r=e.childNodes||[];if(n(r,G)||K(t))return!1;var i=n(r,K);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Y(e,t){var r=e.childNodes||[];if(n(r,function(e){return G(e)&&e!==t}))return!1;var i=n(r,K);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Q(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===_.DOCUMENT_FRAGMENT_NODE){var s=a.filter(G);if(s.length>1||n(a,j))throw new D(I,"More than one element or text in fragment");if(1===s.length&&!$(e,r))throw new D(I,"Element in fragment can not be inserted before doctype")}if(G(t)&&!$(e,r))throw new D(I,"Only one element can be added and only after doctype");if(K(t)){if(n(i,K))throw new D(I,"Only one doctype is allowed");var o=n(i,G);if(r&&i.indexOf(o)<i.indexOf(r))throw new D(I,"Doctype can only be inserted before an element");if(!r&&o)throw new D(I,"Doctype can not be appended since element is present")}}function X(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===_.DOCUMENT_FRAGMENT_NODE){var s=a.filter(G);if(s.length>1||n(a,j))throw new D(I,"More than one element or text in fragment");if(1===s.length&&!Y(e,r))throw new D(I,"Element in fragment can not be inserted before doctype")}if(G(t)&&!Y(e,r))throw new D(I,"Only one element can be added and only after doctype");if(K(t)){function l(e){return K(e)&&e!==r}if(n(i,l))throw new D(I,"Only one doctype is allowed");var o=n(i,G);if(r&&i.indexOf(o)<i.indexOf(r))throw new D(I,"Doctype can only be inserted before an element")}}function J(e,t,r,i){(function(e,t,r){if(!function(e){return e&&(e.nodeType===_.DOCUMENT_NODE||e.nodeType===_.DOCUMENT_FRAGMENT_NODE||e.nodeType===_.ELEMENT_NODE)}(e))throw new D(I,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new D(S,"child not in parent");if(!function(e){return e&&(G(e)||j(e)||K(e)||e.nodeType===_.DOCUMENT_FRAGMENT_NODE||e.nodeType===_.COMMENT_NODE||e.nodeType===_.PROCESSING_INSTRUCTION_NODE)}(t)||K(t)&&e.nodeType!==_.DOCUMENT_NODE)throw new D(I,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)})(e,t,r),e.nodeType===_.DOCUMENT_NODE&&(i||Q)(e,t,r);var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===b){var a=t.firstChild;if(null==a)return t;var s=t.lastChild}else a=s=t;var o=r?r.previousSibling:e.lastChild;a.previousSibling=o,s.nextSibling=r,o?o.nextSibling=a:e.firstChild=a,null==r?e.lastChild=s:r.previousSibling=s;do{a.parentNode=e}while(a!==s&&(a=a.nextSibling));return W(e.ownerDocument||e,e),t.nodeType==b&&(t.firstChild=t.lastChild=null),t}function Z(){this._nsMap={}}function ee(){}function te(){}function re(){}function ie(){}function ne(){}function ae(){}function se(){}function oe(){}function ce(){}function de(){}function ue(){}function ge(){}function pe(e,t){var r=[],i=9==this.nodeType&&this.documentElement||this,n=i.prefix,a=i.namespaceURI;if(a&&null==n&&null==(n=i.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return ve(this,r,e,t,s),r.join("")}function me(e,t,r){var i=e.prefix||"",n=e.namespaceURI;if(!n)return!1;if("xml"===i&&n===a.XML||n===a.XMLNS)return!1;for(var s=r.length;s--;){var o=r[s];if(o.prefix===i)return o.namespace!==n}return!0}function fe(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,q),'"')}function ve(e,t,r,i,n){if(n||(n=[]),i){if(!(e=i(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case h:var s=e.attributes,o=s.length,l=e.firstChild,c=e.tagName,d=c;if(!(r=a.isHTML(e.namespaceURI)||r)&&!e.prefix&&e.namespaceURI){for(var u,v=0;v<s.length;v++)if("xmlns"===s.item(v).name){u=s.item(v).value;break}if(!u)for(var R=n.length-1;R>=0;R--)if(""===(T=n[R]).prefix&&T.namespace===e.namespaceURI){u=T.namespace;break}if(u!==e.namespaceURI)for(R=n.length-1;R>=0;R--){var T;if((T=n[R]).namespace===e.namespaceURI){T.prefix&&(d=T.prefix+":"+c);break}}}t.push("<",d);for(var k=0;k<o;k++)"xmlns"==(I=s.item(k)).prefix?n.push({prefix:I.localName,namespace:I.value}):"xmlns"==I.nodeName&&n.push({prefix:"",namespace:I.value});for(k=0;k<o;k++){var I,S,C;me(I=s.item(k),0,n)&&(fe(t,(S=I.prefix||"")?"xmlns:"+S:"xmlns",C=I.namespaceURI),n.push({prefix:S,namespace:C})),ve(I,t,r,i,n)}if(c===d&&me(e,0,n)&&(fe(t,(S=e.prefix||"")?"xmlns:"+S:"xmlns",C=e.namespaceURI),n.push({prefix:S,namespace:C})),l||r&&!/^(?:meta|link|img|br|hr|input)$/i.test(c)){if(t.push(">"),r&&/^script$/i.test(c))for(;l;)l.data?t.push(l.data):ve(l,t,r,i,n.slice()),l=l.nextSibling;else for(;l;)ve(l,t,r,i,n.slice()),l=l.nextSibling;t.push("</",d,">")}else t.push("/>");return;case A:case b:for(l=e.firstChild;l;)ve(l,t,r,i,n.slice()),l=l.nextSibling;return;case g:return fe(t,e.name,e.value);case p:return t.push(e.data.replace(/[<&>]/g,q));case m:return t.push("<![CDATA[",e.data,"]]>");case y:return t.push("\x3c!--",e.data,"--\x3e");case w:var D=e.publicId,L=e.systemId;if(t.push("<!DOCTYPE ",e.name),D)t.push(" PUBLIC ",D),L&&"."!=L&&t.push(" ",L),t.push(">");else if(L&&"."!=L)t.push(" SYSTEM ",L,">");else{var N=e.internalSubset;N&&t.push(" [",N,"]"),t.push(">")}return;case E:return t.push("<?",e.target," ",e.data,"?>");case f:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Ee(e,t,r){var i;switch(t.nodeType){case h:(i=t.cloneNode(!1)).ownerDocument=e;case b:break;case g:r=!0}if(i||(i=t.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,r)for(var n=t.firstChild;n;)i.appendChild(Ee(e,n,r)),n=n.nextSibling;return i}function ye(e,t,r){var i=new t.constructor;for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var a=t[n];"object"!=typeof a&&a!=i[n]&&(i[n]=a)}switch(t.childNodes&&(i.childNodes=new L),i.ownerDocument=e,i.nodeType){case h:var s=t.attributes,o=i.attributes=new x,l=s.length;o._ownerElement=i;for(var c=0;c<l;c++)i.setAttributeNode(ye(e,s.item(c),!0));break;case g:r=!0}if(r)for(var d=t.firstChild;d;)i.appendChild(ye(e,d,r)),d=d.nextSibling;return i}function Ae(e,t,r){e[t]=r}T.INVALID_STATE_ERR=(k[11]="Invalid state",11),T.SYNTAX_ERR=(k[12]="Syntax error",12),T.INVALID_MODIFICATION_ERR=(k[13]="Invalid modification",13),T.NAMESPACE_ERR=(k[14]="Invalid namespace",14),T.INVALID_ACCESS_ERR=(k[15]="Invalid access",15),D.prototype=Error.prototype,c(T,D),L.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t){for(var r=[],i=0;i<this.length;i++)ve(this[i],r,e,t);return r.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},N.prototype.item=function(e){return M(this),this[e]||null},d(N,L),x.prototype={length:0,item:L.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new D(C);var r=this.getNamedItem(e.nodeName);return P(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t,r=e.ownerElement;if(r&&r!=this._ownerElement)throw new D(C);return t=this.getNamedItemNS(e.namespaceURI,e.localName),P(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return U(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return U(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var i=this[r];if(i.localName==t&&i.namespaceURI==e)return i}return null}},V.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var i=new B;if(i.implementation=this,i.childNodes=new L,i.doctype=r||null,r&&i.appendChild(r),t){var n=i.createElementNS(e,t);i.appendChild(n)}return i},createDocumentType:function(e,t,r){var i=new ae;return i.name=e,i.nodeName=e,i.publicId=t||"",i.systemId=r||"",i}},_.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return J(this,e,t)},replaceChild:function(e,t){J(this,e,t,X),t&&this.removeChild(t)},removeChild:function(e){return z(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ye(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==p&&e.nodeType==p?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&r[i]===e)return i;t=t.nodeType==g?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==g?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},c(u,_),c(u,_.prototype),B.prototype={nodeName:"#document",nodeType:A,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==b){for(var r=e.firstChild;r;){var i=r.nextSibling;this.insertBefore(r,t),r=i}return e}return J(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===h&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),z(this,e)},replaceChild:function(e,t){J(this,e,t,X),e.ownerDocument=this,t&&this.removeChild(t),G(e)&&(this.documentElement=e)},importNode:function(e,t){return Ee(this,e,t)},getElementById:function(e){var t=null;return F(this.documentElement,function(r){if(r.nodeType==h&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=l(e);return new N(this,function(r){var i=[];return t.length>0&&F(r.documentElement,function(n){if(n!==r&&n.nodeType===h){var a=n.getAttribute("class");if(a){var s=e===a;if(!s){var o=l(a);s=t.every((c=o,function(e){return c&&-1!==c.indexOf(e)}))}s&&i.push(n)}}var c}),i})},createElement:function(e){var t=new Z;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new L,(t.attributes=new x)._ownerElement=t,t},createDocumentFragment:function(){var e=new de;return e.ownerDocument=this,e.childNodes=new L,e},createTextNode:function(e){var t=new re;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new ie;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ne;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new ue;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new ee;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new ce;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Z,i=t.split(":"),n=r.attributes=new x;return r.childNodes=new L,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,n._ownerElement=r,r},createAttributeNS:function(e,t){var r=new ee,i=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,r}},d(B,_),Z.prototype={nodeType:h,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===b?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,W(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var i=this.ownerDocument.createAttributeNS(e,t);i.value=i.nodeValue=""+r,this.setAttributeNode(i)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new N(this,function(t){var r=[];return F(t,function(i){i===t||i.nodeType!=h||"*"!==e&&i.tagName!=e||r.push(i)}),r})},getElementsByTagNameNS:function(e,t){return new N(this,function(r){var i=[];return F(r,function(n){n===r||n.nodeType!==h||"*"!==e&&n.namespaceURI!==e||"*"!==t&&n.localName!=t||i.push(n)}),i})}},B.prototype.getElementsByTagName=Z.prototype.getElementsByTagName,B.prototype.getElementsByTagNameNS=Z.prototype.getElementsByTagNameNS,d(Z,_),ee.prototype.nodeType=g,d(ee,_),te.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(k[I])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){r=this.data.substring(0,e)+r+this.data.substring(e+t),this.nodeValue=this.data=r,this.length=r.length}},d(te,_),re.prototype={nodeName:"#text",nodeType:p,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},d(re,te),ie.prototype={nodeName:"#comment",nodeType:y},d(ie,te),ne.prototype={nodeName:"#cdata-section",nodeType:m},d(ne,te),ae.prototype.nodeType=w,d(ae,_),se.prototype.nodeType=R,d(se,_),oe.prototype.nodeType=v,d(oe,_),ce.prototype.nodeType=f,d(ce,_),de.prototype.nodeName="#document-fragment",de.prototype.nodeType=b,d(de,_),ue.prototype.nodeType=E,d(ue,_),ge.prototype.serializeToString=function(e,t,r){return pe.call(e,t,r)},_.prototype.toString=pe;try{if(Object.defineProperty){function et(e){switch(e.nodeType){case h:case b:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(et(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(N.prototype,"length",{get:function(){return M(this),this.$$length}}),Object.defineProperty(_.prototype,"textContent",{get:function(){return et(this)},set:function(e){switch(this.nodeType){case h:case b:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),Ae=function(e,t,r){e["$$"+t]=r}}}catch(tt){}var we,be,Re=V,Te=ge,ke=(we=function(e,t){var r=i.freeze;t.XML_ENTITIES=r({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES},we(be={path:void 0,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&be.path)}},be.exports),be.exports),Ie=i.NAMESPACE,Se=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Ce=new RegExp("[\\-\\.0-9"+Se.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),De=new RegExp("^"+Se.source+Ce.source+"*(?::"+Se.source+Ce.source+"*)?$");function Le(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Le)}function Ne(){}function Me(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function xe(e,t,r,i,n,a){function s(e,t,i){r.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),r.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,n),i)}for(var o,l=++t,c=0;;){var d=e.charAt(l);switch(d){case"=":if(1===c)o=e.slice(t,l),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(a.warning('attribute value must after "="'),o=e.slice(t,l)),t=l+1,!((l=e.indexOf(d,t))>0))throw new Error("attribute value no end '"+d+"' match");s(o,u=e.slice(t,l),t-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');s(o,u=e.slice(t,l),t),a.warning('attribute "'+o+'" missed start quot('+d+")!!"),t=l+1,c=5}break;case"/":switch(c){case 0:r.setTagName(e.slice(t,l));case 5:case 6:case 7:c=7,r.closed=!0;case 4:case 1:break;case 2:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==c&&r.setTagName(e.slice(t,l)),l;case">":switch(c){case 0:r.setTagName(e.slice(t,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(u=e.slice(t,l)).slice(-1)&&(r.closed=!0,u=u.slice(0,-1));case 2:2===c&&(u=o),4==c?(a.warning('attribute "'+u+'" missed quot(")!'),s(o,u,t)):(Ie.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),s(u,u,t));break;case 3:throw new Error("attribute value missed!!")}return l;case"€":d=" ";default:if(d<=" ")switch(c){case 0:r.setTagName(e.slice(t,l)),c=6;break;case 1:o=e.slice(t,l),c=2;break;case 4:var u=e.slice(t,l);a.warning('attribute "'+u+'" missed quot(")!!'),s(o,u,t);case 5:c=6}else switch(c){case 2:r.tagName,Ie.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=l,c=1;break;case 5:a.warning('attribute space is required"'+o+'"!!');case 6:c=1,t=l;break;case 3:c=4,t=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function Oe(e,t,r){for(var i=e.tagName,n=null,a=e.length;a--;){var s=e[a],o=s.qName,l=s.value;if((h=o.indexOf(":"))>0)var c=s.prefix=o.slice(0,h),d=o.slice(h+1),u="xmlns"===c&&d;else d=o,c=null,u="xmlns"===o&&"";s.localName=d,!1!==u&&(null==n&&(n={},Ve(r,r={})),r[u]=n[u]=l,s.uri=Ie.XMLNS,t.startPrefixMapping(u,l))}for(a=e.length;a--;)(c=(s=e[a]).prefix)&&("xml"===c&&(s.uri=Ie.XML),"xmlns"!==c&&(s.uri=r[c||""]));var h;(h=i.indexOf(":"))>0?(c=e.prefix=i.slice(0,h),d=e.localName=i.slice(h+1)):(c=null,d=e.localName=i);var g=e.uri=r[c||""];if(t.startElement(g,d,i,e),!e.closed)return e.currentNSMap=r,e.localNSMap=n,!0;if(t.endElement(g,d,i),n)for(c in n)Object.prototype.hasOwnProperty.call(n,c)&&t.endPrefixMapping(c)}function Pe(e,t,r,i,n){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(r)?(n.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,i),n.characters(s,0,s.length),a)}return t+1}function Ue(e,t,r,i){var n=i[r];return null==n&&((n=e.lastIndexOf("</"+r+">"))<t&&(n=e.lastIndexOf("</"+r)),i[r]=n),n<t}function Ve(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function _e(e,t,r,i){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4))>t?(r.comment(e,t+4,n-t-4),n+3):(i.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var n=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,n-t-9),r.endCDATA(),n+3}var a=function(e,t){var r,i=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(n.lastIndex=t,n.exec(e);r=n.exec(e);)if(i.push(r),r[1])return i}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],l=!1,c=!1;s>3&&(/^public$/i.test(a[2][0])?(l=a[3][0],c=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(c=a[3][0]));var d=a[s-1];return r.startDTD(o,l,c),r.endDTD(),d.index+d[0].length}return-1}function qe(e,t,r){var i=e.indexOf("?>",t);if(i){var n=e.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(n[0].length,r.processingInstruction(n[1],n[2]),i+2):-1}return-1}function Fe(){this.attributeNames={}}Le.prototype=new Error,Le.prototype.name=Le.name,Ne.prototype={parse:function(e,t,r){var i=this.domBuilder;i.startDocument(),Ve(t,t={}),function(e,t,r,i,n){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(r,t)?r[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(n.error("entity not found:"+e),e)}function s(t){if(t>p){var r=e.substring(p,t).replace(/&#?\w+;/g,a);u&&o(p),i.characters(r,0,t-p),p=t}}function o(t,r){for(;t>=c&&(r=d.exec(e));)l=r.index,c=l+r[0].length,u.lineNumber++;u.columnNumber=t-l+1}for(var l=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,u=i.locator,h=[{currentNSMap:t}],g={},p=0;;){try{var m=e.indexOf("<",p);if(m<0){if(!e.substr(p).match(/^\s*$/)){var f=i.doc,v=f.createTextNode(e.substr(p));f.appendChild(v),i.currentElement=v}return}switch(m>p&&s(m),e.charAt(m+1)){case"/":var E=e.indexOf(">",m+3),y=e.substring(m+2,E).replace(/[ \t\n\r]+$/g,""),A=h.pop();E<0?(y=e.substring(m+2).replace(/[\s<].*/,""),n.error("end tag name: "+y+" is not complete:"+A.tagName),E=m+1+y.length):y.match(/\s</)&&(y=y.replace(/[\s<].*/,""),n.error("end tag name: "+y+" maybe not complete"),E=m+1+y.length);var w=A.localNSMap,b=A.tagName==y;if(b||A.tagName&&A.tagName.toLowerCase()==y.toLowerCase()){if(i.endElement(A.uri,A.localName,y),w)for(var R in w)Object.prototype.hasOwnProperty.call(w,R)&&i.endPrefixMapping(R);b||n.fatalError("end tag name: "+y+" is not match the current start tagName:"+A.tagName)}else h.push(A);E++;break;case"?":u&&o(m),E=qe(e,m,i);break;case"!":u&&o(m),E=_e(e,m,i,n);break;default:u&&o(m);var T=new Fe,k=h[h.length-1].currentNSMap,I=(E=xe(e,m,T,k,a,n),T.length);if(!T.closed&&Ue(e,E,T.tagName,g)&&(T.closed=!0,r.nbsp||n.warning("unclosed xml attribute")),u&&I){for(var S=Me(u,{}),C=0;C<I;C++){var D=T[C];o(D.offset),D.locator=Me(u,{})}i.locator=S,Oe(T,i,k)&&h.push(T),i.locator=u}else Oe(T,i,k)&&h.push(T);Ie.isHTML(T.uri)&&!T.closed?E=Pe(e,E,T.tagName,a,i):E++}}catch(e){if(e instanceof Le)throw e;n.error("element parse error: "+e),E=-1}E>p?p=E:s(Math.max(m,p)+1)}}(e,t,r,i,this.errorHandler),i.endDocument()}},Fe.prototype={setTagName:function(e){if(!De.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!De.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};var Be=Re,He=i.NAMESPACE,We=Le,ze=Ne;function Ke(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function Ge(e){this.options=e||{locator:{}}}function je(){this.cdata=!1}function $e(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Ye(e,t,r){return"string"==typeof e?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}function Qe(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Ge.prototype.parseFromString=function(e,t){var r=this.options,i=new ze,n=r.domBuilder||new je,a=r.errorHandler,s=r.locator,o=r.xmlns||{},l=/\/x?html?$/.test(t),c=l?ke.HTML_ENTITIES:ke.XML_ENTITIES;s&&n.setDocumentLocator(s),i.errorHandler=function(e,t,r){if(!e){if(t instanceof je)return t;e=t}var i={},n=e instanceof Function;function a(t){var a=e[t];!a&&n&&(a=2==e.length?function(r){e(t,r)}:e),i[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+function(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(r))}||function(){}}return r=r||{},a("warning"),a("error"),a("fatalError"),i}(a,n,s),i.domBuilder=r.domBuilder||n,l&&(o[""]=He.HTML),o.xml=o.xml||He.XML;var d=r.normalizeLineEndings||Ke;return e&&"string"==typeof e?i.parse(d(e),o,c):i.errorHandler.error("invalid doc source"),n.doc},je.prototype={startDocument:function(){this.doc=(new Be).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,i){var n=this.doc,a=n.createElementNS(e,r||t),s=i.length;Qe(this,a),this.currentElement=a,this.locator&&$e(this.locator,a);for(var o=0;o<s;o++){e=i.getURI(o);var l=i.getValue(o),c=(r=i.getQName(o),n.createAttributeNS(e,r));this.locator&&$e(i.getLocator(o),c),c.value=c.nodeValue=l,a.setAttributeNode(c)}},endElement:function(e,t,r){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&$e(this.locator,r),Qe(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=Ye.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(e);else i=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(e)&&this.doc.appendChild(i),this.locator&&$e(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=Ye.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&$e(this.locator,i),Qe(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var i=this.doc.implementation;if(i&&i.createDocumentType){var n=i.createDocumentType(e,t,r);this.locator&&$e(this.locator,n),Qe(this,n),this.doc.doctype=n}},warning:function(e){},error:function(e){},fatalError:function(e){throw new We(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){je.prototype[e]=function(){return null}});var Xe={DOMParser:Ge}.DOMParser,Je={DOMImplementation:Re,XMLSerializer:Te,DOMParser:Xe},Ze=function(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}({__proto__:null,default:Je,DOMImplementation:Re,XMLSerializer:Te,DOMParser:Xe},[Je]);return he.index=Ze,he}function pe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}Object.defineProperty(ue,"__esModule",{value:!0});const me=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function fe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=[],n=ye(e);!t.ERRORCODE||r.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=Te(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING;for(const e in t)t[e]=Re(t[e]);for(const e in n){const r=n[e];"string"==typeof r&&i.push(ve(r,t))}return i}function ve(e,t){const r=(e=Ee(e,t)).match(/[^[\]]+(?=])/g);if(!r)return e;let i=r.filter(e=>me.indexOf(e)>-1);return 0===i.length?e:(i=i.reduce((e,t)=>(e[t]=-1,e),{}),Ee(e,i))}function Ee(e,t){let r=e;for(const e in t){const i=t[e];r=r.replace(new RegExp("(?:\\[|%%)(".concat(e,")(?:\\]|%%)"),"g"),i)}return r}function ye(e){return Array.isArray(e)?e.map(e=>e&&e.hasOwnProperty("url")?e.url:e):e}function Ae(e){return/^(https?:\/\/|\/\/)/.test(e)}function we(e,t){for(let r=0;r<t.length;r++)if(be(t[r],e))return!0;return!1}function be(e,t){if(e&&t){const r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);return r.length===i.length&&e.id===t.id&&e.url===t.url}return!1}function Re(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function Te(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}const ke={track:function(e,t,r){fe(e,t,r).forEach(e=>{"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:fe,extractURLsFromTemplates:ye,filterUrlTemplates:function(e){return e.reduce((e,t)=>{const r=t.url||t;return Ae(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:we,isTemplateObjectEqual:be,encodeURIComponentRFC3986:Re,replaceUrlMacros:ve,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce((t,r)=>t.concat(Array.isArray(r)?e(r):r),[])},joinArrayOfUniqueTemplateObjs:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];return r.concat(i).reduce((e,t)=>(we(t,e)||e.push(t),e),[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:Te,isValidUrl:Ae,isBrowserEnvironment:function(){return"undefined"!=typeof window},formatMacrosValues:function(e){return"object"!=typeof e?e:JSON.stringify(e)}};function Ie(e){return["true","TRUE","True","1"].includes(e)}function Se(e){if(null==e)return-1;if(ke.isNumeric(e))return parseInt(e);const t=e.split(":");if(3!==t.length)return-1;const r=t[2].split(".");let i=parseInt(r[0]);2===r.length&&(i+=parseFloat("0.".concat(r[1])));const n=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(n)||isNaN(i)||n>3600||i>60?-1:a+n+i}const Ce={childByName:function(e,t){return Array.from(e.childNodes).find(e=>e.nodeName===t)},childrenByName:function(e,t){return Array.from(e.childNodes).filter(e=>e.nodeName===t)},resolveVastAdTagURI:function(e,t){if(!t)return e;if(e.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(e)}if(!e.includes("://")){const r=t.slice(0,t.lastIndexOf("/"));return"".concat(r,"/").concat(e)}return e},parseBoolean:Ie,parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,r){const i=t.getAttribute(e);i&&r.setAttribute(e,i)},parseAttributes:function(e){return Array.from(e.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:Se,getStandAloneAds:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>!parseInt(e.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>parseInt(e.sequence,10)).sort((e,t)=>e.sequence-t.sequence)},assignAttributes:function(e,t){e&&Array.from(e).forEach(e=>{let{nodeName:r,nodeValue:i}=e;if(r&&i&&t.hasOwnProperty(r)){let e=i;"boolean"==typeof t[r]&&(e=Ie(e)),t[r]=e}})},mergeWrapperAdData:function(e,t){var r;e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),t.viewableImpression.length>0&&(e.viewableImpression=[...e.viewableImpression,...t.viewableImpression]),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;const i=(t.creatives||[]).filter(e=>e&&"companion"===e.type),n=i.reduce((e,t)=>((t.variations||[]).forEach(t=>{(t.companionClickTrackingURLTemplates||[]).forEach(t=>{ke.containsTemplateObject(t,e)||e.push(t)})}),e),[]);e.creatives=i.concat(e.creatives);const a=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,s=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;if(e.creatives.forEach(e=>{if(t.trackingEvents&&t.trackingEvents[e.type])for(const r in t.trackingEvents[e.type]){const i=t.trackingEvents[e.type][r];Array.isArray(e.trackingEvents[r])||(e.trackingEvents[r]=[]),e.trackingEvents[r]=e.trackingEvents[r].concat(i)}"linear"===e.type&&(a&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),s&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),"companion"===e.type&&n.length&&(e.variations||[]).forEach(e=>{e.companionClickTrackingURLTemplates=ke.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,n)})}),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories)),null!==(r=t.creatives)&&void 0!==r&&r.length){const r=t.creatives.filter(e=>{var t;return(null===(t=e.icons)||void 0===t?void 0:t.length)&&!e.mediaFiles.length});r.length&&(e.creatives=e.creatives.concat(r))}}};function De(e,t){const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=pe(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"companion",required:null,variations:[]}}(t);return r.required=e.getAttribute("required")||null,r.variations=Ce.childrenByName(e,"Companion").map(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adType:"companionAd",width:e.width||0,height:e.height||0,assetWidth:e.assetWidth||null,assetHeight:e.assetHeight||null,expandedWidth:e.expandedWidth||null,expandedHeight:e.expandedHeight||null,apiFramework:e.apiFramework||null,adSlotId:e.adSlotId||null,pxratio:e.pxratio||"1",renderingMode:e.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(Ce.parseAttributes(e));t.htmlResources=Ce.childrenByName(e,"HTMLResource").reduce((e,t)=>{const r=Ce.parseNodeText(t);return r?e.concat(r):e},[]),t.iframeResources=Ce.childrenByName(e,"IFrameResource").reduce((e,t)=>{const r=Ce.parseNodeText(t);return r?e.concat(r):e},[]),t.staticResources=Ce.childrenByName(e,"StaticResource").reduce((e,t)=>{const r=Ce.parseNodeText(t);return r?e.concat({url:r,creativeType:t.getAttribute("creativeType")||null}):e},[]),t.altText=Ce.parseNodeText(Ce.childByName(e,"AltText"))||null;const r=Ce.childByName(e,"TrackingEvents");r&&Ce.childrenByName(r,"Tracking").forEach(e=>{const r=e.getAttribute("event"),i=Ce.parseNodeText(e);r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))}),t.companionClickTrackingURLTemplates=Ce.childrenByName(e,"CompanionClickTracking").map(e=>({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)})),t.companionClickThroughURLTemplate=Ce.parseNodeText(Ce.childByName(e,"CompanionClickThrough"))||null;const i=Ce.childByName(e,"AdParameters");return i&&(t.adParameters={value:Ce.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t}),r}function Le(e,t){let r;const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=pe(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);i.duration=Ce.parseDuration(Ce.parseNodeText(Ce.childByName(e,"Duration")));const n=e.getAttribute("skipoffset");if(null==n)i.skipDelay=null;else if("%"===n.charAt(n.length-1)&&-1!==i.duration){const e=parseInt(n,10);i.skipDelay=i.duration*(e/100)}else i.skipDelay=Ce.parseDuration(n);const a=Ce.childByName(e,"VideoClicks");if(a){const e=Ce.childByName(a,"ClickThrough");i.videoClickThroughURLTemplate=e?{id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)}:null,Ce.childrenByName(a,"ClickTracking").forEach(e=>{i.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)})}),Ce.childrenByName(a,"CustomClick").forEach(e=>{i.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)})})}const s=Ce.childByName(e,"AdParameters");s&&(i.adParameters={value:Ce.parseNodeText(s),xmlEncoded:s.getAttribute("xmlEncoded")||null}),Ce.childrenByName(e,"TrackingEvents").forEach(e=>{Ce.childrenByName(e,"Tracking").forEach(e=>{let t=e.getAttribute("event");const n=Ce.parseNodeText(e);if(t&&n){if("progress"===t){if(r=e.getAttribute("offset"),!r)return;t="%"===r.charAt(r.length-1)?"progress-".concat(r):"progress-".concat(Ce.parseDuration(r))}Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(n)}})}),Ce.childrenByName(e,"MediaFiles").forEach(e=>{Ce.childrenByName(e,"MediaFile").forEach(e=>{i.mediaFiles.push(function(e){const t={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};t.id=e.getAttribute("id"),t.fileURL=Ce.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.mediaType=e.getAttribute("mediaType")||"2D",t.apiFramework=e.getAttribute("apiFramework"),t.fileSize=parseInt(e.getAttribute("fileSize")||0),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);const r=e.getAttribute("scalable");r&&"string"==typeof r&&(t.scalable=Ce.parseBoolean(r));const i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=Ce.parseBoolean(i)),t}(e))});const t=Ce.childByName(e,"InteractiveCreativeFile");t&&(i.interactiveCreativeFile=function(e){const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:Ce.parseBoolean(e.variableDuration),fileURL:null}}(Ce.parseAttributes(e));return t.fileURL=Ce.parseNodeText(e),t}(t));const r=Ce.childByName(e,"ClosedCaptionFiles");r&&Ce.childrenByName(r,"ClosedCaptionFile").forEach(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(Ce.parseAttributes(e));t.fileURL=Ce.parseNodeText(e),i.closedCaptionFiles.push(t)});const n=Ce.childByName(e,"Mezzanine"),a=function(e){const t={};let r=!1;return["delivery","type","width","height"].forEach(i=>{e&&e.getAttribute(i)?t[i]=e.getAttribute(i):r=!0}),r?null:t}(n);if(a){const e={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};e.id=n.getAttribute("id"),e.fileURL=Ce.parseNodeText(n),e.delivery=a.delivery,e.codec=n.getAttribute("codec"),e.type=a.type,e.width=parseInt(a.width,10),e.height=parseInt(a.height,10),e.fileSize=parseInt(n.getAttribute("fileSize"),10),e.mediaType=n.getAttribute("mediaType")||"2D",i.mezzanine=e}});const o=Ce.childByName(e,"Icons");return o&&Ce.childrenByName(o,"Icon").forEach(e=>{i.icons.push(function(e){const t={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[],altText:null,hoverText:null};t.program=e.getAttribute("program"),t.height=parseInt(e.getAttribute("height")||0),t.width=parseInt(e.getAttribute("width")||0),t.xPosition=function(e){return-1!==["left","right"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("xPosition")),t.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),t.apiFramework=e.getAttribute("apiFramework"),t.pxratio=e.getAttribute("pxratio")||"1",t.offset=Ce.parseDuration(e.getAttribute("offset")),t.duration=Ce.parseDuration(e.getAttribute("duration")),t.altText=e.getAttribute("altText"),t.hoverText=e.getAttribute("hoverText"),Ce.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=Ce.parseNodeText(e)}),Ce.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=Ce.parseNodeText(e)}),Ce.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=Ce.parseNodeText(e)});const r=Ce.childByName(e,"IconClicks");if(r){t.iconClickThroughURLTemplate=Ce.parseNodeText(Ce.childByName(r,"IconClickThrough")),Ce.childrenByName(r,"IconClickTracking").forEach(e=>{t.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)})});const e=Ce.childByName(r,"IconClickFallbackImages");e&&Ce.childrenByName(e,"IconClickFallbackImage").forEach(e=>{t.iconClickFallbackImages.push({url:Ce.parseNodeText(e)||null,width:e.getAttribute("width")||null,height:e.getAttribute("height")||null})})}return t.iconViewTrackingURLTemplate=Ce.parseNodeText(Ce.childByName(e,"IconViewTracking")),t}(e))}),i}function Ne(e,t){const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=pe(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return Ce.childrenByName(e,"TrackingEvents").forEach(e=>{let t,i;Ce.childrenByName(e,"Tracking").forEach(e=>{t=e.getAttribute("event"),i=Ce.parseNodeText(e),t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))})}),Ce.childrenByName(e,"NonLinear").forEach(e=>{const t={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.expandedWidth=e.getAttribute("expandedWidth"),t.expandedHeight=e.getAttribute("expandedHeight"),t.scalable=Ce.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=Ce.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=Ce.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),Ce.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=Ce.parseNodeText(e)}),Ce.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=Ce.parseNodeText(e)}),Ce.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=Ce.parseNodeText(e)});const i=Ce.childByName(e,"AdParameters");i&&(t.adParameters={value:Ce.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t.nonlinearClickThroughURLTemplate=Ce.parseNodeText(Ce.childByName(e,"NonLinearClickThrough")),Ce.childrenByName(e,"NonLinearClickTracking").forEach(e=>{t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)})}),r.variations.push(t)}),r}function Me(e){const t=[];return e.forEach(e=>{const r=xe(e);r&&t.push(r)}),t}function xe(e){if("#comment"===e.nodeName)return null;const t={name:null,value:null,attributes:{},children:[]},r=e.attributes,i=e.childNodes;if(t.name=e.nodeName,e.attributes)for(const e in r)if(r.hasOwnProperty(e)){const i=r[e];i.nodeName&&i.nodeValue&&(t.attributes[i.nodeName]=i.nodeValue)}for(const e in i)if(i.hasOwnProperty(e)){const r=xe(i[e]);r&&t.children.push(r)}if(0===t.children.length||1===t.children.length&&["#cdata-section","#text"].indexOf(t.children[0].name)>=0){const r=Ce.parseNodeText(e);""!==r&&(t.value=r),t.children=[]}return null===(n=t).value&&0===Object.keys(n.attributes).length&&0===n.children.length?null:t;var n}function Oe(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}const Pe={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function Ue(e,t){let{name:r,parentName:i,attributes:n,subElements:a,oneOfResources:s}=e,o="Element '".concat(r,"'");o+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):a?" missing required sub element(s) '".concat(a.join(", "),"' "):s?" must provide one of the following '".concat(s.join(", "),"' "):" is empty",t("VAST-warning",{message:o,parentElement:i,specVersion:4.1})}const Ve=function e(t,r,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),function(e,t){if(!Pe[e.nodeName]||!Pe[e.nodeName].attributes)return;const r=Pe[e.nodeName].attributes.filter(t=>!e.getAttribute(t));r.length>0&&Ue({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:r},t)}(t,r),function(e){return e.children&&0!==e.children.length}(t)){!function(e,t,r){const i=Pe[e.nodeName],n=!r&&"Wrapper"!==e.nodeName;if(i&&!n){if(i.subElements){const r=i.subElements.filter(t=>!Ce.childByName(e,t));r.length>0&&Ue({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:r},t)}r&&i.oneOfinLineResources&&(i.oneOfinLineResources.some(t=>Ce.childByName(e,t))||Ue({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}(t,r,i);for(let n=0;n<t.children.length;n++)e(t.children[n],r,i)}else 0===Ce.parseNodeText(t).length&&Ue({name:t.nodeName,parentName:t.parentNode.nodeName},r)};function _e(e,t){let{allowMultipleAds:r,followAdditionalWrappers:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=Array.from(e.childNodes).filter(e=>{const t=e.nodeName.toLowerCase();return"inline"===t||!1!==i&&"wrapper"===t});for(const i of n){if(Ce.copyNodeAttribute("id",e,i),Ce.copyNodeAttribute("sequence",e,i),Ce.copyNodeAttribute("adType",e,i),"Wrapper"===i.nodeName)return{ad:Be(i,t),type:"WRAPPER"};if("InLine"===i.nodeName)return{ad:qe(i,t,{allowMultipleAds:r}),type:"INLINE"};const n=i.nodeName.toLowerCase();t("VAST-warning",{message:"<".concat(i.nodeName,"inline"===n?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:i})}}function qe(e,t){let{allowMultipleAds:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return!1===r&&e.getAttribute("sequence")?null:Fe(e,t)}function Fe(e,t){let r=[];t&&Ve(e,t);const i=Array.from(e.childNodes),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,sequence:e.sequence||null,adType:e.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(Ce.parseAttributes(e));return i.forEach(e=>{switch(e.nodeName){case"Error":n.errorURLTemplates.push(Ce.parseNodeText(e));break;case"Impression":n.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)});break;case"Creatives":n.creatives=function(e){const t=[];return e.forEach(e=>{const r={id:e.getAttribute("id")||null,adId:Oe(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},i=[];let n;Ce.childrenByName(e,"UniversalAdId").forEach(e=>{const t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:Ce.parseNodeText(e)};i.push(t)});const a=Ce.childByName(e,"CreativeExtensions");a&&(n=Me(Ce.childrenByName(a,"CreativeExtension")));for(const a in e.childNodes){const s=e.childNodes[a];let o;switch(s.nodeName){case"Linear":o=Le(s,r);break;case"NonLinearAds":o=Ne(s,r);break;case"CompanionAds":o=De(s,r)}o&&(i&&(o.universalAdIds=i),n&&(o.creativeExtensions=n),t.push(o))}}),t}(Ce.childrenByName(e,"Creative"));break;case"Extensions":{const t=Ce.childrenByName(e,"Extension");n.extensions=Me(t),n.adVerifications.length||(r=function(e){let t=null,r=[];return e.some(e=>t=Ce.childByName(e,"AdVerifications")),t&&(r=He(Ce.childrenByName(t,"Verification"))),r}(t));break}case"AdVerifications":n.adVerifications=He(Ce.childrenByName(e,"Verification"));break;case"AdSystem":n.system={value:Ce.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":n.title=Ce.parseNodeText(e);break;case"AdServingId":n.adServingId=Ce.parseNodeText(e);break;case"Category":n.categories.push({authority:e.getAttribute("authority")||null,value:Ce.parseNodeText(e)});break;case"Expires":n.expires=parseInt(Ce.parseNodeText(e),10);break;case"ViewableImpression":n.viewableImpression.push(function(e){const t=(e,t)=>{const r=Ce.parseNodeText(t);return r&&e.push(r),e};return{id:e.getAttribute("id")||null,viewable:Ce.childrenByName(e,"Viewable").reduce(t,[]),notViewable:Ce.childrenByName(e,"NotViewable").reduce(t,[]),viewUndetermined:Ce.childrenByName(e,"ViewUndetermined").reduce(t,[])}}(e));break;case"Description":n.description=Ce.parseNodeText(e);break;case"Advertiser":n.advertiser={id:e.getAttribute("id")||null,value:Ce.parseNodeText(e)};break;case"Pricing":n.pricing={value:Ce.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":n.survey={value:Ce.parseNodeText(e),type:e.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:Ce.parseNodeText(e)})}}),r.length&&(n.adVerifications=n.adVerifications.concat(r)),n}function Be(e,t){const r=Fe(e,t),i=e.getAttribute("followAdditionalWrappers"),n=e.getAttribute("allowMultipleAds"),a=e.getAttribute("fallbackOnNoAd");r.followAdditionalWrappers=!i||Ce.parseBoolean(i),r.allowMultipleAds=!!n&&Ce.parseBoolean(n),r.fallbackOnNoAd=a?Ce.parseBoolean(a):null;let s=Ce.childByName(e,"VASTAdTagURI");if(s?r.nextWrapperURL=Ce.parseNodeText(s):(s=Ce.childByName(e,"VASTAdTagURL"),s&&(r.nextWrapperURL=Ce.parseNodeText(Ce.childByName(s,"URL")))),r.creatives.forEach(e=>{if(["linear","nonlinear"].includes(e.type)){if(e.trackingEvents){r.trackingEvents||(r.trackingEvents={}),r.trackingEvents[e.type]||(r.trackingEvents[e.type]={});for(const t in e.trackingEvents){const i=e.trackingEvents[t];Array.isArray(r.trackingEvents[e.type][t])||(r.trackingEvents[e.type][t]=[]),i.forEach(i=>{r.trackingEvents[e.type][t].push(i)})}}e.videoClickTrackingURLTemplates&&(Array.isArray(r.videoClickTrackingURLTemplates)||(r.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach(e=>{r.videoClickTrackingURLTemplates.push(e)})),e.videoClickThroughURLTemplate&&(r.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(r.videoCustomClickURLTemplates)||(r.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach(e=>{r.videoCustomClickURLTemplates.push(e)}))}}),r.nextWrapperURL)return r}function He(e){const t=[];return e.forEach(e=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},i=Array.from(e.childNodes);Ce.assignAttributes(e.attributes,r),i.forEach(e=>{let{nodeName:t,textContent:i,attributes:n}=e;switch(t){case"JavaScriptResource":case"ExecutableResource":r.resource=i.trim(),Ce.assignAttributes(n,r);break;case"VerificationParameters":r.parameters=i.trim()}});const n=Ce.childByName(e,"TrackingEvents");n&&Ce.childrenByName(n,"Tracking").forEach(e=>{const t=e.getAttribute("event"),i=Ce.parseNodeText(e);t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))}),t.push(r)}),t}class We{constructor(){this._handlers=[]}on(e,t){if("function"!=typeof t)throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(e,t,r){const i={fired:!1,wrapFn:void 0};function n(){i.fired||(e.off(t,i.wrapFn),i.fired=!0,r.bind(e)(...arguments))}return i.wrapFn=n,n}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(r=>r.event!==e||r.handler!==t),this}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];let n=!1;return this._handlers.forEach(t=>{"*"===t.event&&(n=!0,t.handler(e,...r)),t.event===e&&(n=!0,t.handler(...r))}),n}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,r)=>(r.event===e&&t.push(r.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let ze=0,Ke=0;const Ge=(e,t)=>{!e||!t||e<=0||t<=0||(Ke=(Ke*ze+8*e/t)/++ze)},je={ERRORCODE:900,extensions:[]},$e="VAST response version not supported";class Ye extends We{constructor(){let{fetcher:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null,this.keepFailedAdPod=!1}trackVastError(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];this.emit("VAST-error",Object.assign({},je,t,...i)),ke.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return Ke}initParsingStatus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),Ge(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(e=>this.buildVASTResponse(e))}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(e=>this.buildVASTResponse(e))}buildVASTResponse(e){const t=function(e){let{ads:t,errorURLTemplates:r,version:i}=e;return{ads:t||[],errorURLTemplates:r||[],version:i||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:i=null,wrapperDepth:n=0,allowMultipleAds:a,followAdditionalWrappers:s}=t;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName){var o;this.emit("VAST-ad-parsed",{type:"ERROR",url:i,wrapperDepth:n});const t="VideoAdServingTemplate"===(null==e||null===(o=e.documentElement)||void 0===o?void 0:o.nodeName);throw new Error(t?$e:"Invalid VAST XMLDocument")}const l=[],c=e.documentElement.childNodes,d=e.documentElement.getAttribute("version");r&&d&&(this.vastVersion=d);for(const e in c){const t=c[e];if("Error"===t.nodeName){const e=Ce.parseNodeText(t);r?this.rootErrorURLTemplates.push(e):this.errorURLTemplates.push(e)}else if("Ad"===t.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(!1===a&&l.length>1)break;const e=_e(t,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:s});e.ad?(l.push(e.ad),this.emit("VAST-ad-parsed",{type:e.type,url:i,wrapperDepth:n,adIndex:l.length-1,vastVersion:d})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return l}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:i=null,previousUrl:n=null,wrapperDepth:a=0,isRootVAST:s=!1,followAdditionalWrappers:o,allowMultipleAds:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&s&&(l=!0);try{c=this.parseVastXml(e,{isRootVAST:s,url:t,wrapperDepth:a,allowMultipleAds:l,followAdditionalWrappers:o})}catch(e){return Promise.reject(e)}if(1===c.length&&null!=i&&(c[0].sequence=i),!1===r){const e=Ce.getSortedAdPods(c),t=Ce.getStandAloneAds(c);e.length?c=e:t.length&&(c=[t.shift()]),this.remainingAds=t}return this.resolveAds(c,{wrapperDepth:a,previousUrl:n,url:t})}resolveAds(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:i}=arguments.length>1?arguments[1]:void 0;const n=[];return r=i,e.forEach(e=>{const i=this.resolveWrappers(e,t,r);n.push(i)}),Promise.all(n).then(e=>ke.flatten(e))}resolveWrappers(e,t,r){const i={...e};return new Promise(e=>{var n;if(t++,!i.nextWrapperURL)return delete i.nextWrapperURL,e(i);if(!this.fetcher)return i.VASTAdTagURI=i.nextWrapperURL,delete i.nextWrapperURL,e(i);if(t>=this.maxWrapperDepth)return i.errorCode=302,delete i.nextWrapperURL,e(i);i.nextWrapperURL=Ce.resolveVastAdTagURI(i.nextWrapperURL,r);const a=null!==(n=this.parsingOptions.allowMultipleAds)&&void 0!==n?n:i.allowMultipleAds,s=i.sequence;this.fetcher.fetchVAST({url:i.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(n=>this.parse(n,{url:i.nextWrapperURL,previousUrl:r,wrapperSequence:s,wrapperDepth:t,followAdditionalWrappers:i.followAdditionalWrappers,allowMultipleAds:a}).then(t=>{if(delete i.nextWrapperURL,0===t.length)return i.creatives=[],e(i);t.forEach(e=>{e&&Ce.mergeWrapperAdData(e,i)}),e(t)})).catch(t=>{i.errorCode=t.message===$e?102:301,i.errorMessage=t.message,e(i)})})}completeWrapperResolving(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const r=e.ads[t],i=!r.creatives.some(e=>{var t,r;return(null===(t=e.mediaFiles)||void 0===t?void 0:t.length)>0||(null===(r=e.variations)||void 0===r?void 0:r.length)>0});!r.errorCode&&!i||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),this.keepFailedAdPod&&r.sequence?r.hasFailed=!0:e.ads.splice(t,1))}}}let Qe=null;const Xe={data:{},length:0,getItem(e){return this.data[e]},setItem(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem(e){delete this.data[e],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class Je{constructor(){this.storage=this.initStorage()}initStorage(){if(Qe)return Qe;try{Qe="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){Qe=null}return Qe&&!this.isStorageDisabled(Qe)||(Qe=Xe,Qe.clear()),Qe}isStorageDisabled(e){const t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch(e){return!0}return e.removeItem(t),!1}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const Ze=12e4,et={get:async function(e,t){try{const r=new AbortController,i=setTimeout(()=>{throw r.abort(),new Error("URLHandler: Request timed out after ".concat(t.timeout||Ze," ms (408)"))},t.timeout||Ze),n=await fetch(e,{...t,signal:r.signal,credentials:t.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(i)}),a=function(e){return ke.isBrowserEnvironment()&&"https:"===window.location.protocol&&e.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":200===e.status&&e.ok?null:"URLHandler: ".concat(e.statusText," (").concat(e.status,")")}(n);return a?{error:new Error(a),statusCode:n.status}:async function(e){const t=await e.text();let r;return r=ke.isBrowserEnvironment()?new DOMParser:new((await Promise.resolve().then(function(){return ge()}).then(function(e){return e.index})).DOMParser),{xml:r.parseFromString(t,"text/xml"),details:{byteLength:t.length,statusCode:e.status,rawXml:t}}}(n)}catch(e){return{error:e,statusCode:"AbortError"===e.name?408:null}}}};class tt{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||et,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||Ze,withCredentials:Boolean(e.withCredentials)}}addURLTemplateFilter(e){"function"==typeof e&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:r,maxWrapperDepth:i,emitter:n,wrapperDepth:a=0,previousUrl:s=null,wrapperAd:o=null}=e;const l=Date.now();this.URLTemplateFilters.forEach(e=>{r=e(r)}),n("VAST-resolving",{url:r,previousUrl:s,wrapperDepth:a,maxWrapperDepth:i,timeout:this.fetchingOptions.timeout,wrapperAd:o});const c=await this.urlHandler.get(r,this.fetchingOptions),d=Math.round(Date.now()-l);if(n("VAST-resolved",{url:r,previousUrl:s,wrapperDepth:a,error:(null==c?void 0:c.error)||null,duration:d,statusCode:(null==c?void 0:c.statusCode)||null,...null==c?void 0:c.details}),Ge(null==c||null===(t=c.details)||void 0===t?void 0:t.byteLength,d),c.error)throw new Error(c.error);return c.xml}}function rt(e){if(!e?.fileURL)return!1;if("vpaid"===(e.apiFramework||"").toLowerCase())return!1;const t=(e.mimeType||"").toLowerCase();return t.startsWith("video/")||""===t}de=ue.VASTClient=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Je;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new tt,this.vastParser=new Ye({fetcher:this.fetcher}),this.storage=r,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<r?(this.totalCalls=1,this.totalCallsTimeout=r+36e5):this.totalCalls++,new Promise((i,n)=>{if(this.cappingFreeLunch>=this.totalCalls)return n(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=r-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return n(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(r=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(r,t).then(e=>{const t=this.vastParser.buildVASTResponse(e);i(t)}))).catch(e=>n(e))})}},ue.VASTParser=Ye,ce=ue.VASTTracker=class extends We{constructor(e,t,r){var i;let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=a,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const e in this.creative.trackingEvents){const t=this.creative.trackingEvents[e];this.trackingEvents[e]=t.slice(0)}this.viewableImpressionTrackers=(null===(i=this.ad.viewableImpression)||void 0===i?void 0:i.reduce((e,t)=>(e.notViewable.push(...t.notViewable),e.viewUndetermined.push(...t.viewUndetermined),e.viewable.push(...t.viewable),e),{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(this.viewableImpressionTrackers).forEach(e=>{let[t,r]=e;r.length&&(this.trackingEvents[t]=r)}),function(e){return"linear"===e.type}(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}"nonLinearAd"===this.variation.adType?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return"companionAd"===e.adType}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){ke.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!ke.isValidTimeValue(e)||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))});const i=this.skipDelay||-1;if(-1===i||this.skippable||(i>e?this.emit("skip-countdown",i-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const i=Math.round(e/this.assetDuration*100),n=[];if(e>0){n.push("start");for(let e=this.lastPercentage;e<i;e++)n.push("progress-".concat(e+1,"%"));n.push("progress-".concat(e));for(const t in this.quartiles)this.isQuartileReached(t,this.quartiles[t],e)&&(n.push(t),this._alreadyTriggeredQuartiles[t]=!0);this.lastPercentage=i}n.forEach(e=>{this.track(e,{macros:t,once:r})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,r){let i=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(i=!0),i}setMuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))})}setSkipDelay(e){ke.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("notViewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewUndetermined",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e&&"boolean"==typeof t?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(ke.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"string"==typeof e&&"boolean"==typeof t?this.error({ERRORCODE:e},t):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))});if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");const r=this.ad.adVerifications.find(t=>t.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const i=r.trackingEvents;if(i&&i.verificationNotExecuted){const e=i.verificationNotExecuted;this.trackURLs(e,t),this.emit("verificationNotExecuted",{trackingURLTemplates:e})}}overlayViewDuration(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&"object"==typeof t?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))})}close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!==e&&"string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,i={...t};if(r){this.progress&&(i.ADPLAYHEAD=this.progressFormatted());const e=ke.resolveURLTemplates([r],i)[0];this.emit("clickthrough",e)}}trackProgressEvents(e,t,r){const i=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(e=>{let[t]=e;return t.startsWith("progress-")}).map(e=>{let[t,r]=e;return{name:t,time:parseFloat(t.split("-")[1]),urls:r}}).filter(e=>{let{time:t}=e;return t<=i&&t>this.progress}).forEach(e=>{let{name:i,urls:n}=e;!r&&this.trackedProgressEvents.includes(i)||(this.emit(i,{trackingURLTemplates:n}),this.trackURLs(n,t),r?delete this.trackingEvents[i]:this.trackedProgressEvents.push(i))})}track(e){let{macros:t={},once:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof t)return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,r);const i=this.trackingEvents[e],n=this.emitAlwaysEvents.indexOf(e)>-1;i?(this.emit(e,{trackingURLTemplates:i}),this.trackURLs(i,t)):n&&this.emit(e,null),r&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{validUrls:n,invalidUrls:a}=ke.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const s={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(s.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(s.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(t=t.universalAdIds)&&void 0!==t&&t.length&&(s.UNIVERSALADID=this.creative.universalAdIds.map(e=>e.idRegistry.concat(" ",e.value)).join(",")),this.ad&&(this.ad.sequence&&(s.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(s.ADTYPE=this.ad.adType),this.ad.adServingId&&(s.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(s.ADCATEGORIES=this.ad.categories.map(e=>e.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(s.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(e=>e.value).join(","))),ke.track(n,s,i)}convertToTimecode(e){if(!ke.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),i=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(ke.addLeadingZeros(r,2),":").concat(ke.addLeadingZeros(i,2),":").concat(ke.addLeadingZeros(n,2),".").concat(ke.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}},ue.parseDuration=Se;class it{constructor(e={}){this.resolvePlayerExecution=null,this.videoElement=null,this.adContainer=null,this.adDisplayContainer=null,this.adsLoader=null,this.adManager=null,this.usingVastFallback=!1,this.vastTracker=null,this.vastFallbackUnlisten=null,this.fallbackProgressEmitted=new Set,this.config=e,this.logger=new y(St.getDebugMode());const t=St.getUserData(),r=St.getDebugMode();this.mediaResultHelper=new K({userId:t?.userId||"",debug:r}),this.ui=new X(this.logger)}async start(t){this.logger.debug("Starting VAST player for media:",t.title),J.show();try{return this.currentMedia=t,await this.checkConnectivity()?(this.logger.debug("Connectivity OK, using IMA SDK for VAST"),await this.executeWithIMA()):this.isVpaidMedia()?(this.logger.debug("No connectivity and media is VPAID; fallback does not support VPAID, returning connection error"),this.finishWithResult(e.AAMediaPlayResult.CONNECTION_ERROR)):(this.logger.debug("No connectivity, using VAST fallback (vast-client)"),await this.executeWithVastFallback())}catch(t){this.logger.error("Error starting VAST player:",t);const r=t instanceof Error?t.message:"Unknown error";return this.finishWithResult(e.AAMediaPlayResult.ERROR,r)}}async checkConnectivity(){try{const e=St.getDebugMode(),t=(new b).getArtemisAdsService(5,e);return await t.checkConnectivity(),!0}catch{return!1}}isVpaidMedia(){const e=this.currentMedia?.content?.video?.type;return"string"==typeof e&&"VPAID"===e.toUpperCase()}async executeWithIMA(){try{if(this.logger.debug("Executing VAST with IMA SDK:",this.currentMedia.title),!window.google||!window.google.ima||!window.google.ima.AdsLoader){this.logger.debug("IMA SDK not available, loading...");try{const e=St.getConfig()?.proxyExternalScripts||!1;await $(e),this.logger.debug("IMA SDK loaded successfully")}catch(t){return this.logger.error("Failed to load IMA SDK (e.g. no connectivity):",t),this.isVpaidMedia()?(this.logger.debug("Media is VPAID; fallback does not support VPAID, returning connection error"),this.finishWithResult(e.AAMediaPlayResult.CONNECTION_ERROR)):await this.executeWithVastFallback()}}const t=this.config.imaConfig||{locale:"pt-BR",vastLoadTimeout:1e4,vpaidMode:window.google.ima.ImaSdkSettings.VpaidMode.ENABLED,continuousPlayback:!0};window.google.ima.settings.setVpaidMode(t.vpaidMode),window.google.ima.settings.setLocale(t.locale),this.logger.debug("IMA SDK configured successfully"),this.createModal(),await this.setupIMA();const r=this.prepareAdTagUrl();return await this.requestAds(r),this.logger.debug("VAST ad executed successfully with IMA SDK"),await this.waitForAdResult()}catch(t){return this.logger.error("Error executing with IMA SDK:",t),this.finishWithResult(e.AAMediaPlayResult.ERROR)}}async executeWithVastFallback(){this.usingVastFallback=!0;try{this.logger.debug("Executing VAST with fallback (vast-client):",this.currentMedia.title),this.createModal(),this.ui.showVideo();const i=this.prepareAdTagUrl(),n=function(e){if(!e?.ads?.length)return null;for(const t of e.ads){if(!t.creatives?.length)continue;const e=t.creatives.find(e=>"linear"===e.type&&e.mediaFiles?.length);if(!e?.mediaFiles?.length)continue;const r=e.mediaFiles.find(e=>rt(e));if(r?.fileURL)return{ad:t,creative:e,mediaUrl:r.fileURL,clickThroughUrl:e.videoClickThroughURLTemplate||null}}return null}(await async function(e){const t=new de;return await t.get(e)}(i));if(!n)return this.logger.error("VAST fallback: no linear creative with media found"),this.finishWithResult(e.AAMediaPlayResult.ERROR);if(this.vastTracker=(t=n.ad,r=n.creative,new ce(null,t,r)),!this.videoElement)return this.finishWithResult(e.AAMediaPlayResult.ERROR);const a=this.videoElement;a.src=n.mediaUrl,a.load(),this.ui.setFallbackSaibaMaisClick(()=>{this.vastTracker&&(this.vastTracker.once?.("clickthrough",e=>{e&&window.open(e,"_blank")}),this.vastTracker.click(null,{}),this.sendClickThroughEvent())});const s=()=>{this.vastTracker?.trackImpression(),this.vastTracker?.load?.(),J.hide(),this.ui.showFallbackOverlay(!!n.clickThroughUrl),this.ui.updateFallbackTimer(0,n.creative.duration??0),this.logger.debug("VAST fallback: ad loaded")},o=()=>{this.vastTracker&&this.vastTracker.setProgress(a.currentTime),this.emitFallbackProgressEvents(a.currentTime,n.creative.duration??0),this.ui.updateFallbackTimer(a.currentTime,n.creative.duration??0)},l=async()=>{this.vastTracker?.complete?.(),this.sendCompleteEvent(),this.sendAllAdsCompletedEvent(),this.logger.debug("VAST fallback: ad completed"),this.ui.hideFallbackOverlay(),this.ui.hide();const t=this.currentMedia.content?.survey?.hasUrl();if(t)try{const e=new oe(this.currentMedia),t=await e.start();this.resolvePlayerExecution&&(this.resolvePlayerExecution(t),this.resolvePlayerExecution=null)}catch(t){this.logger.error("Error executing survey after video:",t),this.finishWithResult(e.AAMediaPlayResult.REWARDED)}else this.finishWithResult(e.AAMediaPlayResult.REWARDED);this.removeVastFallbackListeners(),setTimeout(()=>{this.ui.cleanup(),this.cleanupResources()},1e3)},c=()=>{this.logger.error("VAST fallback: video error"),this.vastTracker?.error?.(),this.sendAdErrorEvent(),this.finishWithResult(e.AAMediaPlayResult.ERROR),this.removeVastFallbackListeners()},d=e=>{this.vastTracker&&(this.vastTracker.once?.("clickthrough",e=>{e&&window.open(e,"_blank")}),this.vastTracker.click(null,{CLICKPOS:[e.clientX,e.clientY]}),this.sendClickThroughEvent())};return a.addEventListener("canplay",s,{once:!0}),a.addEventListener("timeupdate",o),a.addEventListener("ended",l,{once:!0}),a.addEventListener("error",c,{once:!0}),a.addEventListener("click",d),this.vastFallbackUnlisten=()=>{a.removeEventListener("canplay",s),a.removeEventListener("timeupdate",o),a.removeEventListener("ended",l),a.removeEventListener("error",c),a.removeEventListener("click",d)},await a.play().catch(e=>{this.logger.error("VAST fallback: play failed",e),c()}),await this.waitForAdResult()}catch(t){return this.logger.error("Error executing VAST fallback:",t),this.removeVastFallbackListeners(),this.finishWithResult(e.AAMediaPlayResult.ERROR)}var t,r}emitFallbackProgressEvents(e,t){if(t<=0)return;const r=e/t,i=[.001,.25,.5,.75];[{key:"start",send:()=>this.sendVpaidStartEvent()},{key:"firstQuartile",send:()=>this.sendFirstQuartileEvent()},{key:"midpoint",send:()=>this.sendMidpointEvent()},{key:"thirdQuartile",send:()=>this.sendThirdQuartileEvent()}].forEach((e,t)=>{r>=i[t]&&!this.fallbackProgressEmitted.has(e.key)&&(this.fallbackProgressEmitted.add(e.key),e.send())})}removeVastFallbackListeners(){this.vastFallbackUnlisten&&(this.vastFallbackUnlisten(),this.vastFallbackUnlisten=null),this.vastTracker=null,this.usingVastFallback=!1,this.fallbackProgressEmitted.clear()}async waitForAdResult(){return new Promise(e=>{this.resolvePlayerExecution=e})}finishWithResult(e,t){this.logger.debug("Finishing VAST player with result:",e),J.hide();const r=this.mediaResultHelper.finishWithResult(this.currentMedia,e,t);return this.resolvePlayerExecution&&(this.resolvePlayerExecution(r),this.resolvePlayerExecution=null),this.cleanup(),r}createModal(){try{this.videoElement=this.ui.createModal(),this.ui.setCloseCallback(()=>{this.finishWithResult(e.AAMediaPlayResult.CANCELED),this.destroyPlayerOnClose()})}catch(e){throw this.logger.error("Error creating modal:",e),e}}prepareAdTagUrl(){if("video_v2"===this.currentMedia.type){if(!this.currentMedia.content?.video?.url)throw this.logger.error("Video V2 URL not found"),new Error("Video V2 URL not found");return this.currentMedia.content.video.url}if(!this.currentMedia.content?.url)throw this.logger.error("Media content URL not found"),new Error("Media content URL not found");return this.currentMedia.content.url}async setupIMA(){try{if(!this.videoElement)throw new Error("Video element not found");if(this.adContainer=this.ui.getAdContainer(),!this.adContainer)throw new Error("Ad container not found");this.ui.showVideo(),this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoElement),this.adDisplayContainer.initialize(),this.adsLoader=new window.google.ima.AdsLoader(this.adDisplayContainer),this.setupIMAEvents(),this.logger.debug("IMA SDK setup completed")}catch(e){throw this.logger.error("Error setting up IMA SDK:",e),e}}setupIMAEvents(){this.adsLoader&&(this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e=>{if(this.logger.debug("AdsManager loaded"),this.adManager=e.getAdsManager(this.videoElement),this.adManager){const e=this.videoElement?.clientWidth||640,t=this.videoElement?.clientHeight||480;this.logger.debug(`Initializing ad with dimensions: ${e}x${t}`),this.setupAdManagerEvents(),this.adManager.init(e,t,window.google.ima.ViewMode.NORMAL),this.adManager.start(),this.logger.debug("Ad started successfully"),setTimeout(()=>{this.ui.showVideo()},100)}}),this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,t=>{this.logger.error("Ad error:",t.getError()),this.finishWithResult(e.AAMediaPlayResult.ERROR)}))}setupAdManagerEvents(){this.adManager&&(this.adManager.addEventListener(window.google.ima.AdEvent.Type.LOADED,()=>{this.logger.debug("Ad loaded"),J.hide()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.STARTED,()=>{this.logger.debug("Ad started"),this.sendVpaidStartEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.FIRST_QUARTILE,()=>{this.logger.debug("Ad first quartile"),this.sendFirstQuartileEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.MIDPOINT,()=>{this.logger.debug("Ad midpoint"),this.sendMidpointEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.THIRD_QUARTILE,()=>{this.logger.debug("Ad third quartile"),this.sendThirdQuartileEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,()=>{this.sendCompleteEvent(),this.logger.debug("Ad completed")}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,async()=>{this.logger.debug("All ads completed"),this.sendAllAdsCompletedEvent(),this.ui.hide();const t=this.currentMedia.content?.survey?.hasUrl();if(t){this.logger.debug("Video completed, executing survey");try{const e=new oe(this.currentMedia),t=await e.start();this.resolvePlayerExecution&&(this.resolvePlayerExecution(t),this.resolvePlayerExecution=null)}catch(t){this.logger.error("Error executing survey after video:",t),this.finishWithResult(e.AAMediaPlayResult.REWARDED)}}else this.finishWithResult(e.AAMediaPlayResult.REWARDED);setTimeout(()=>{this.ui.cleanup(),this.cleanupResources()},1e3)}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.CLICK,()=>{this.logger.debug("Ad click (clickthrough / Saiba mais)"),this.sendClickThroughEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.VIDEO_CLICKED,()=>{this.logger.debug("Video area clicked (pause/resume by IMA)")}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.SKIPPED,()=>{this.logger.debug("Ad skipped"),this.sendSkippedEvent()}))}async requestAds(e){try{if(!this.adsLoader)throw new Error("AdsLoader not initialized");const t=new window.google.ima.AdsRequest;t.adTagUrl=e,this.logger.debug("Requesting ads with URL:",e),this.adsLoader.requestAds(t),this.logger.debug("Ads requested successfully")}catch(e){throw this.logger.error("Error requesting ads:",e),e}}sendVpaidStartEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.START,this.currentMedia)}sendFirstQuartileEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.FIRST_QUARTILE,this.currentMedia)}sendMidpointEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.MIDPOINT,this.currentMedia)}sendThirdQuartileEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.THIRD_QUARTILE,this.currentMedia)}sendCompleteEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.AD_COMPLETED,this.currentMedia)}sendAllAdsCompletedEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.ALL_ADS_COMPLETED,this.currentMedia)}sendClickThroughEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.CLICKTHROUGH,this.currentMedia)}sendSkippedEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.SKIPPED,this.currentMedia)}sendAdErrorEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.ERROR,this.currentMedia)}destroyPlayerOnClose(){this.usingVastFallback&&this.removeVastFallbackListeners(),this.adManager&&(this.adManager.destroy(),this.adManager=null),this.adsLoader&&(this.adsLoader.destroy(),this.adsLoader=null),this.adDisplayContainer&&(this.adDisplayContainer.destroy(),this.adDisplayContainer=null),this.ui.cleanup(),this.adContainer=null,this.mediaResultHelper.clearSentEvents(),this.resolvePlayerExecution=null}cleanup(){this.logger.debug("Cleaning up VAST player"),this.ui.cleanup(),this.videoElement=null,this.adContainer=null}cleanupResources(){this.logger.debug("Cleaning up VAST player resources (UI already cleaned)"),this.mediaResultHelper.clearSentEvents(),this.resolvePlayerExecution=null,this.adContainer=null,this.videoElement=null}destroy(){this.logger.debug("Destroying VAST player"),this.cleanup()}}var nt;e.StepResult=void 0,(nt=e.StepResult||(e.StepResult={})).NO_FILL="NO_FILL",nt.CONNECTION_ERROR="CONNECTION_ERROR",nt.AD_FAILED="AD_FAILED",nt.REWARDED="REWARDED",nt.SKIPPED="SKIPPED";class at{constructor(){this.steps=[]}addStep(e,t){this.steps.push({result:e,errorMessage:t})}getWaterfallSummary(){return this.steps.map(e=>`${e.result}`).join(", ")||"No results"}getDetailedWaterfallSummary(){return this.steps.map(t=>{switch(t.result){case e.StepResult.AD_FAILED:return"AD_FAILED"+(t.errorMessage?`(${t.errorMessage})`:"");case e.StepResult.NO_FILL:return"NO_FILL";case e.StepResult.CONNECTION_ERROR:return"CONNECTION_ERROR";case e.StepResult.REWARDED:return"REWARDED";case e.StepResult.SKIPPED:return"SKIPPED";default:return t.result}}).join(" | ")}findMainResult(){return this.steps.some(t=>t.result===e.StepResult.REWARDED)?e.StepResult.REWARDED:this.steps.some(t=>t.result===e.StepResult.SKIPPED)?e.StepResult.SKIPPED:this.steps.some(t=>t.result===e.StepResult.NO_FILL)?e.StepResult.NO_FILL:this.steps.some(t=>t.result===e.StepResult.AD_FAILED)?e.StepResult.AD_FAILED:e.StepResult.CONNECTION_ERROR}clear(){this.steps=[]}getSteps(){return[...this.steps]}getStepCount(){return this.steps.length}}class st{constructor(e){this.isLoaded=!1,this.isDestroyed=!1,this.loadTimeout=null,this.rewardedSlot=null,this.rewardPayload=null,this.resolvePromise=null,this.eventListeners={rewardedSlotReady:null,rewardedSlotClosed:null,rewardedSlotGranted:null,slotRenderEnded:null},this.config=e,this.logger=new y(St.getDebugMode())}async loadAd(){return this.isDestroyed?(this.logger.warn("Wrapper already destroyed"),{result:e.StepResult.AD_FAILED,errorMessage:"Wrapper destroyed"}):(this.logger.debug("Loading GAM Rewarded Video:",this.config.adUnitId),new Promise(t=>{this.resolvePromise=t,this.initGooglePublisherTag().then(()=>{if(!this.isDestroyed)return this.renderRewardedAd();t({result:e.StepResult.AD_FAILED,errorMessage:"Wrapper destroyed"})}).catch(r=>{this.logger.error("Error loading GAM RV:",r),t({result:e.StepResult.AD_FAILED,errorMessage:r instanceof Error?r.message:"Unknown error"})})}))}async initGooglePublisherTag(){if("undefined"==typeof window)throw new Error("Window object not available");if(!window.googletag){window.googletag=window.googletag||{cmd:[]};try{await j(),this.logger.debug("GPT script ready")}catch(e){throw this.logger.error("Failed to load GPT script:",e),new Error(`Failed to load Google Publisher Tag: ${e instanceof Error?e.message:"Unknown error"}`)}}}async renderRewardedAd(){return new Promise((t,r)=>{this.loadTimeout=setTimeout(()=>{this.isDestroyed||(this.logger.error("GAM RV load timeout"),this.resolvePromise?.({result:e.StepResult.CONNECTION_ERROR,errorMessage:"Load timeout"}),this.removeEventListeners(),r(new Error("Load timeout")))},this.config.timeout);try{window.googletag.cmd.push(()=>{this.isDestroyed||(re(),this.rewardedSlot=window.googletag.defineOutOfPageSlot(this.config.adUnitId,window.googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot?(this.rewardedSlot.addService(window.googletag.pubads()),this.addCampaignParams(),this.addEventListeners(),window.googletag.enableServices(),window.googletag.display(this.rewardedSlot),t()):(this.logger.error("Rewarded ads are not supported on this page"),this.resolvePromise?.({result:e.StepResult.AD_FAILED,errorMessage:"Rewarded ads not supported"}),this.removeEventListeners(),r(new Error("Rewarded ads not supported"))))})}catch(t){this.logger.error("Error in renderRewardedAd:",t),this.resolvePromise?.({result:e.StepResult.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"}),this.removeEventListeners(),r(t)}})}addCampaignParams(){this.rewardedSlot&&this.config.campaignParams&&(this.config.campaignParams.mediaId&&this.rewardedSlot.setTargeting("a_media_id",this.config.campaignParams.mediaId),this.config.campaignParams.campaignId&&this.rewardedSlot.setTargeting("a_campaign_id",this.config.campaignParams.campaignId),this.config.campaignParams.zoneId&&this.rewardedSlot.setTargeting("a_zone_id",this.config.campaignParams.zoneId),this.config.campaignParams.requestId&&this.rewardedSlot.setTargeting("a_request_id",this.config.campaignParams.requestId))}addEventListeners(){this.logger.debug("Adding GAM RV event listeners"),this.eventListeners.rewardedSlotReady||(this.eventListeners.rewardedSlotReady=e=>{this.isDestroyed||(this.logger.debug("Rewarded ad slot is ready"),history.pushState(null,"Google Rewarded Video","#goog_rewarded"),J.hide(),e.makeRewardedVisible(),this.logger.debug("Rewarded ad is active"))},window.googletag.pubads().addEventListener("rewardedSlotReady",this.eventListeners.rewardedSlotReady)),this.eventListeners.rewardedSlotClosed||(this.eventListeners.rewardedSlotClosed=()=>{this.isDestroyed||(this.logger.debug("Rewarded ad closed"),this.resolvePromise?.({result:e.StepResult.SKIPPED,errorMessage:void 0}),this.dismissRewardedAd())},window.googletag.pubads().addEventListener("rewardedSlotClosed",this.eventListeners.rewardedSlotClosed)),this.eventListeners.rewardedSlotGranted||(this.eventListeners.rewardedSlotGranted=t=>{this.isDestroyed||(this.logger.debug("User rewarded"),this.resolvePromise?.({result:e.StepResult.REWARDED,errorMessage:void 0}),this.dismissRewardedAd())},window.googletag.pubads().addEventListener("rewardedSlotGranted",this.eventListeners.rewardedSlotGranted)),this.eventListeners.slotRenderEnded||(this.eventListeners.slotRenderEnded=t=>{this.isDestroyed||(this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),t.slot===this.rewardedSlot&&t.isEmpty&&(this.logger.debug("No ad returned for rewarded ad slot"),this.resolvePromise?.({result:e.StepResult.NO_FILL,errorMessage:"No ad returned"}),this.dismissRewardedAd()))},window.googletag.pubads().addEventListener("slotRenderEnded",this.eventListeners.slotRenderEnded))}removeEventListeners(){this.logger.debug("Removing GAM RV event listeners"),this.eventListeners.rewardedSlotReady&&(window.googletag.pubads().removeEventListener("rewardedSlotReady",this.eventListeners.rewardedSlotReady),this.eventListeners.rewardedSlotReady=null),this.eventListeners.rewardedSlotClosed&&(window.googletag.pubads().removeEventListener("rewardedSlotClosed",this.eventListeners.rewardedSlotClosed),this.eventListeners.rewardedSlotClosed=null),this.eventListeners.rewardedSlotGranted&&(window.googletag.pubads().removeEventListener("rewardedSlotGranted",this.eventListeners.rewardedSlotGranted),this.eventListeners.rewardedSlotGranted=null),this.eventListeners.slotRenderEnded&&(window.googletag.pubads().removeEventListener("slotRenderEnded",this.eventListeners.slotRenderEnded),this.eventListeners.slotRenderEnded=null)}dismissRewardedAd(){this.rewardPayload&&(this.rewardPayload=null),this.logger.debug("Rewarded ad has been closed"),this.rewardedSlot&&window.googletag.destroySlots([this.rewardedSlot]),this.removeEventListeners()}destroy(){this.isDestroyed||(this.logger.debug("Destroying GAM RV wrapper"),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.removeEventListeners(),this.rewardedSlot&&window.googletag&&window.googletag.destroySlots([this.rewardedSlot]),this.isDestroyed=!0,this.isLoaded=!1,this.rewardedSlot=null,this.rewardPayload=null)}isAdLoaded(){return this.isLoaded}}class ot{constructor(e){this.isDestroyed=!1,this.loadTimeout=null,this.resolvePromise=null,this.adInstance=null,this.adContainer=null,this.adElement=null,this.mediaResultHelper=null,this.config=e,this.logger=new y(St.getDebugMode()),this.mediaResultHelper=e.mediaResultHelper||null}async loadAd(){if(this.isDestroyed)return this.logger.warn("Wrapper already destroyed"),{result:e.StepResult.AD_FAILED,errorMessage:"Wrapper destroyed"};const t=St.getConfig()?.luminaToken;return t&&0!==t.trim().length?(this.logger.debug("Loading Lumina Rewarded Video:",this.config.tagId),new Promise(t=>{this.resolvePromise=t,this.initLuminaSDK().then(()=>{if(!this.isDestroyed)return this.renderRewardedAd();t({result:e.StepResult.AD_FAILED,errorMessage:"Wrapper destroyed"})}).catch(r=>{this.logger.error("Error loading Lumina RV:",r),t({result:e.StepResult.AD_FAILED,errorMessage:r instanceof Error?r.message:"Unknown error"})})})):(this.logger.warn("Lumina token not configured, skipping Lumina RV step"),{result:e.StepResult.AD_FAILED,errorMessage:"Lumina token not configured"})}async initLuminaSDK(){if("undefined"==typeof window)throw new Error("Window object not available");try{const e=this.config.debug||!1,t=St.getConfig()?.luminaToken,r=St.getConfig()?.proxyExternalScripts||!1;await Y({token:t,debug:e},r),this.logger.debug("Lumina SDK script ready")}catch(e){throw this.logger.error("Failed to load Lumina SDK script:",e),new Error(`Failed to load Lumina SDK: ${e instanceof Error?e.message:"Unknown error"}`)}}createAdContainer(){this.adContainer=document.createElement("div"),this.adContainer.id=`lumina-ad-container-${Date.now()}`,this.adContainer.style.display="block",this.adContainer.style.width="100%",this.adContainer.style.height="100vh",this.adContainer.style.position="fixed",this.adContainer.style.top="0",this.adContainer.style.left="0",this.adContainer.style.zIndex="9999",this.adElement=document.createElement("ins"),this.adElement.className="adsbylumina",this.adElement.style.display="block",this.adElement.style.width="100%",this.adElement.style.height="100%";const e=this.config.media?.uuid||`lumina-${Date.now()}`;this.adElement.setAttribute("data-ad-type","fluid"),this.adElement.setAttribute("data-ad-client","ug"),this.adElement.setAttribute("data-ad-tagId",this.config.tagId),this.adElement.setAttribute("data-ad-slot","close"),this.adElement.setAttribute("data-ad-luminaAdToken",e),this.adElement.setAttribute("data-ad-mute","false"),this.adContainer.appendChild(this.adElement),document.body.appendChild(this.adContainer),this.logger.debug("Lumina ad container created")}async renderRewardedAd(){return new Promise((t,r)=>{if(this.loadTimeout=setTimeout(()=>{this.isDestroyed||(this.logger.error("Lumina RV load timeout"),this.resolvePromise?.({result:e.StepResult.CONNECTION_ERROR,errorMessage:"Load timeout"}),this.removeAdContainer(),r(new Error("Load timeout")))},this.config.timeout),this.createAdContainer(),!window.adsbylumina)return void r(new Error("Lumina SDK not available"));window.adsbylumina=window.adsbylumina||[];const i={luminaAdToken:this.config.media?.uuid||`lumina-${Date.now()}`,tagId:this.config.tagId,bidfloor:0,onAdRequestSuccess:i=>{if(!this.isDestroyed){this.logger.debug("Ad request succeeded, price:",i.price),this.adInstance=i,this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.adContainer&&(this.adContainer.style.display="block");try{i.renderAd(),this.logger.debug("Ad rendered successfully"),J.hide(),t()}catch(t){this.logger.error("renderAd() failed:",t);const i=t instanceof Error?t.message:"Ad render failed";this.removeAdContainer(),this.resolvePromise?.({result:e.StepResult.AD_FAILED,errorMessage:i}),r(new Error(i))}}},onAdRequestFailed:t=>{if(this.isDestroyed)return;this.logger.error("Ad request failed:",t),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.removeAdContainer();const i=t.error??"Unknown error",n=i.toLowerCase().includes("no ad"),a=n?e.StepResult.NO_FILL:e.StepResult.AD_FAILED;this.logger.debug("Error classified as: "+(n?"NO_FILL":"AD_FAILED")),this.resolvePromise?.({result:a,errorMessage:i}),r(new Error(i))},onAdComplete:t=>{this.isDestroyed||(this.logger.debug("Ad completed",t),this.logger.debug("User rewarded"),this.resolvePromise?.({result:e.StepResult.REWARDED,errorMessage:void 0}),this.removeAdContainer())},onAdClick:t=>{this.isDestroyed||(this.logger.debug("Ad clicked",t),this.mediaResultHelper&&this.config.media&&this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.CLICKTHROUGH,this.config.media))},onTemplateClose:()=>{this.isDestroyed||(this.logger.debug("Rewarded ad closed"),this.resolvePromise?.({result:e.StepResult.SKIPPED,errorMessage:void 0}),this.removeAdContainer())}};window.adsbylumina.push(i)})}removeAdContainer(){this.adContainer&&this.adContainer.parentNode&&(this.adContainer.parentNode.removeChild(this.adContainer),this.adContainer=null,this.adElement=null,this.logger.debug("Lumina ad container removed"))}destroy(){this.isDestroyed||(this.logger.debug("Destroying Lumina RV wrapper"),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.adInstance=null,this.removeAdContainer(),this.isDestroyed=!0)}}class lt{constructor(e={}){this.currentMedia=null,this.config=e,this.logger=new y(St.getDebugMode());const t=St.getUserData(),r=St.getDebugMode();this.mediaResultHelper=new K({userId:t?.userId||"",debug:r}),this.waterfallTracker=new at}async start(t){this.logger.debug("Starting programmatic player for media:",t.title),J.show();try{this.currentMedia=t,this.waterfallTracker.clear(),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_WATERFALL_START,t);const r=t.content?.programmatic?.waterfall;return r&&0!==r.length?await this.executeWaterfall(r):(this.logger.error("Empty or null waterfall"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_ERROR,t),J.hide(),this.createErrorResult("Empty or null waterfall"))}catch(e){throw this.logger.error("Error in start method:",e),J.hide(),e}}async executeWaterfall(t){this.logger.debug("Executing waterfall with",t.length,"steps");for(let r=0;r<t.length;r++){const i=t[r];this.logger.debug(`Loading ad ${r+1} of ${t.length}: ${i.type}`);try{const t=await this.loadAd(i,r);if(t instanceof E)return this.logger.debug("Fallback executed, returning result directly"),t;if(t.result===e.StepResult.REWARDED)return this.logger.debug("Ad rewarded successfully"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.COMPLETE,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.REWARDED);if(t.result===e.StepResult.SKIPPED)return this.logger.debug("Ad skipped"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_SKIPPED,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.SKIPPED);this.waterfallTracker.addStep(t.result,t.errorMessage),this.logger.debug(`Ad ${r+1} failed: ${t.result} - ${t.errorMessage}, trying next`)}catch(t){this.logger.error(`Error loading ad ${r+1}:`,t),this.waterfallTracker.addStep(e.StepResult.AD_FAILED,t instanceof Error?t.message:"Unknown error")}}return this.logger.debug("No more ads to load in waterfall. Summary:",this.waterfallTracker.getDetailedWaterfallSummary()),J.hide(),await this.sendProgResultEvent()}async loadAd(t,r){const i=t.type,n=t.findTimeout()||this.config.loadTimeout||1e4;switch(this.logger.debug(`Loading ad type: ${i}`),i){case e.AAMediaTypes.TYPE_GOOGLE_RV:return await this.loadGAMRewardedVideo(t.findAdUnitId(),n);case e.AAMediaTypes.TYPE_KWAI_RV:return await this.loadLuminaRewardedVideo(t.findAdUnitId(),n);case e.AAMediaTypes.TYPE_FALLBACK:return await this.loadVideoFallback(t.findVastTag(),t.findEventSuffix());default:return this.logger.warn(`Ad type ${i} not supported in web`),{result:e.StepResult.AD_FAILED,errorMessage:`Ad type ${i} not supported`}}}async loadGAMRewardedVideo(t,r){try{if(this.logger.debug("Loading GAM Rewarded Video"),!t)return this.logger.error("Ad unit ID not found for GAM RV"),{result:e.StepResult.AD_FAILED,errorMessage:"Ad unit ID not found"};const i=this.buildCampaignParams(),n=St.getDebugMode(),a=new st({adUnitId:t,timeout:r,campaignParams:i,debug:n});return await this.loadGAMRewardedVideoWithWrapper(a)}catch(t){return this.logger.error("Error loading GAM RV:",t),{result:e.StepResult.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"}}}async loadLuminaRewardedVideo(t,r){try{if(this.logger.debug("Loading Lumina Rewarded Video"),!t)return this.logger.error("TagId not found for Lumina RV"),{result:e.StepResult.AD_FAILED,errorMessage:"TagId not found"};const i=this.buildCampaignParams(),n=St.getDebugMode(),a=new ot({tagId:t,timeout:r,campaignParams:i,debug:n,mediaResultHelper:this.mediaResultHelper,media:this.currentMedia||void 0});return await this.loadLuminaRewardedVideoWithWrapper(a)}catch(t){return this.logger.error("Error loading Lumina RV:",t),{result:e.StepResult.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"}}}async loadLuminaRewardedVideoWithWrapper(t){try{const e=await t.loadAd();return this.logger.debug("Lumina RV result:",e.result),e}catch(t){return this.logger.error("Error loading Lumina RV:",t),{result:e.StepResult.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"}}}async loadGAMRewardedVideoWithWrapper(t){try{const e=await t.loadAd();return this.logger.debug("GAM RV result:",e.result),e}catch(t){return this.logger.error("Error loading GAM RV:",t),{result:e.StepResult.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"}}}async loadVideoFallback(t,r){try{this.logger.debug("Loading fallback VIDEO_V2"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_FALLBACK_REQ,this.currentMedia),this.sendProgResultEvent();const i=JSON.parse(JSON.stringify(this.currentMedia));i.type=e.AAMediaTypes.VIDEO_V2,i.content={video:{type:"IN_HOUSE",url:t,proxy:!1,eventSuffix:r}};const n=new ut(i);return await n.click(!1)}catch(t){return this.logger.error("Error loading fallback:",t),new E({media:this.currentMedia,result:e.AAMediaPlayResult.ERROR,error:new u(W.ERROR,t instanceof Error?t.message:"Unknown error")})}}createErrorResult(t){return new E({media:this.currentMedia,result:e.AAMediaPlayResult.ERROR,error:new u(W.ERROR,t instanceof Error?t.message:"Unknown error")})}async sendProgResultEvent(){switch(this.waterfallTracker.findMainResult()){case e.StepResult.NO_FILL:return this.logger.debug("Waterfall completed with NO_FILL"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.NO_FILL,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.NO_FILL);case e.StepResult.AD_FAILED:const t=`Waterfall failed: ${this.waterfallTracker.getDetailedWaterfallSummary()}`;return this.logger.error("Waterfall",t),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_ERROR,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.ERROR,t);case e.StepResult.CONNECTION_ERROR:return this.logger.debug("Waterfall completed with CONNECTION_ERROR"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_CONNECTION_ERROR,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.CONNECTION_ERROR,"Connection Error");case e.StepResult.REWARDED:return this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.REWARDED);case e.StepResult.SKIPPED:return this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.SKIPPED)}}buildCampaignParams(){const e={};return this.currentMedia?.uuid&&(e.mediaId=this.currentMedia.uuid),this.currentMedia?.campaignId&&(e.campaignId=this.currentMedia.campaignId),this.currentMedia?.zoneId&&(e.zoneId=this.currentMedia.zoneId),this.currentMedia?.requestId&&(e.requestId=this.currentMedia.requestId),e}destroy(){this.logger.debug("Destroying AARewardedVideo"),J.hide(),this.currentMedia=null,this.waterfallTracker.clear()}}class ct{constructor(e){this.media=e;const t=St.getDebugMode();this.logger=new y(t),this.mediaResultHelper=new K({userId:St.getUserData()?.userId||"",debug:t})}async start(){try{return this.getRedirectUrl()?new E({media:this.media,result:e.AAMediaPlayResult.EXTERNAL_REDIRECT}):(this.logger.error("URL de redirecionamento não encontrada"),this.mediaResultHelper.finishWithResult(this.media,e.AAMediaPlayResult.ERROR,"URL de redirecionamento não encontrada"))}catch(t){return this.logger.error("Erro ao executar redirecionamento externo:",t),this.mediaResultHelper.finishWithResult(this.media,e.AAMediaPlayResult.ERROR,t instanceof Error?t.message:"Erro desconhecido")}}getRedirectUrl(){if(this.media.content?.externalRedirect?.link)return this.media.content.externalRedirect.link;const e=this.media._rawContent;return e&&e.link?e.link:this.media.content?.url?this.media.content.url:this.media.externalUrl?.url?this.media.externalUrl.url:this.media.success?.url?this.media.success.url:null}}class dt{constructor(e){this.media=e;const t=St.getDebugMode();this.logger=new y(t),this.mediaResultHelper=new K({userId:St.getUserData()?.userId||"",debug:t})}async start(){try{return this.getClickUrl()?(this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.CLICKTHROUGH,this.media),new E({media:this.media,result:e.AAMediaPlayResult.BANNER_CLICK})):(this.logger.error("URL de clique do banner não encontrada"),this.mediaResultHelper.finishWithResult(this.media,e.AAMediaPlayResult.ERROR,"URL de clique do banner não encontrada"))}catch(t){return this.logger.error("Erro ao executar clique do banner:",t),this.mediaResultHelper.finishWithResult(this.media,e.AAMediaPlayResult.ERROR,t instanceof Error?t.message:"Erro desconhecido")}}getClickUrl(){return this.media.externalUrl?.url??null}}class ut{constructor(e){this.uuid=e.uuid,this.type=e.type,this.title=e.title,this.viewed=e.viewed,this.campaignId=e.campaignId,this.campaignName=e.campaignName,this.requestId=e.requestId,this.zoneId=e.zoneId,this.mediasLeft=e.mediasLeft,this.layout=e.layout,this.partnerEventUuid=e.partnerEventUuid,e.content&&(this.content=new f(e.content)),e.success&&(this.success=new v(e.success)),Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.content&&!this._rawContent&&(this._rawContent=e.content)}getPostbackBenefits(){return this.partnerEvent?.benefits}async click(t=!0){const r=St.getDebugMode(),i=new y(r);try{const r=St.getUserData();if(!r?.userId)return i.error("Error executing media click: user id is null"),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u("User ID is required")});switch(t&&(new q).sendMediaClickEvent(this.campaignId||"",this.requestId||"",this.uuid).catch(e=>i.warn("Error sending click event:",e)),this.type){case e.AAMediaTypes.VIDEO_V2:return await this.executeVideoV2Media(r.userId);case e.AAMediaTypes.PROGRAMMATIC_V2:return await this.executeProgrammaticV2Media(r.userId);case e.AAMediaTypes.SURVEY_V2:return await this.executeSurveyV2Media(r.userId);case e.AAMediaTypes.EXTERNAL_REDIRECT:return await this.executeExternalRedirectMedia(r.userId);case e.AAMediaTypes.BANNER:return await this.executeBannerMedia(r.userId);default:return i.warn(`Unsupported media type: ${this.type}`),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(`Unsupported media type: ${this.type}`)})}return new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u("Media execution failed")})}catch(t){return i.error("Error executing media click:",t),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}async executeProgrammaticV2Media(e){const t=St.getDebugMode();new y(t).debug("Executing Programmatic V2 media:",this.title);const r=new lt,i=await r.start(this);return new E(i)}async executeVideoV2Media(t){const r=St.getDebugMode(),i=new y(r);i.debug("Executing Video V2 media:",this.title);try{const e=new it,t=await e.start(this);return i.debug("Video V2 execution completed:",t.result),t}catch(t){return i.error("Error in executeVideoV2Media:",t),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}async executeSurveyV2Media(t){const r=St.getDebugMode(),i=new y(r);i.debug("Executing Survey V2 media:",this.title);try{const e=new oe(this),t=await e.start();return i.debug("Survey V2 execution completed:",t.result),t}catch(t){return i.error("Error in executeSurveyV2Media:",t),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}async executeExternalRedirectMedia(t){const r=St.getDebugMode(),i=new y(r);i.debug("Executing External Redirect media:",this.title);try{const e=new ct(this),t=await e.start();return i.debug("External Redirect execution completed:",t.result),t}catch(t){return i.error("Error in executeExternalRedirectMedia:",t),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}async executeBannerMedia(t){const r=St.getDebugMode(),i=new y(r);i.debug("Executing Banner media:",this.title);try{const e=new dt(this),t=await e.start();return i.debug("Banner execution completed:",t.result),t}catch(t){return i.error("Error in executeBannerMedia:",t),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}}class ht{constructor(e){this.image=e.image,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}hasValidImage(){return!!(this.image&&this.image.trim().length>0)}getImageUrl(e){return this.hasValidImage()?this.image:e||""}isAbsoluteUrl(){return this.image.startsWith("http://")||this.image.startsWith("https://")}}class gt{constructor(e){this.primaryColor=e.primaryColor,this.secondaryColor=e.secondaryColor,this.title=e.title,this.primaryInformation=e.primaryInformation,this.secondaryInformation=e.secondaryInformation,this.enableCountdown=e.enableCountdown||!1,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.header&&(this.header=new ht(e.header))}getPrimaryColorHex(){return this.primaryColor.startsWith("#")?this.primaryColor:`#${this.primaryColor}`}getSecondaryColorHex(){return this.secondaryColor.startsWith("#")?this.secondaryColor:`#${this.secondaryColor}`}isValid(){return!!(this.primaryColor&&this.secondaryColor&&this.title&&this.header)}}class pt{constructor(e){this.success=e.success,this.media=e.media||[],Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.layout&&(this.layout=new gt(e.layout)),this.media=this.media.map(e=>new ut(e))}getUnviewedMedia(){return this.media.filter(e=>!e.viewed)}getMediaByType(e){return this.media.filter(t=>t.type===e)}hasAvailableMedia(){return this.getUnviewedMedia().length>0}getMediaCount(){return this.media.length}}class mt{constructor(e){this.name=e.name,this.description=e.description,this.value=e.value,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}hasDescription(){return!(!this.description||!this.description.trim())}hasValue(){return!!this.value}getInfo(){return this.hasDescription()?`${this.name}: ${this.description}`:this.name}}class ft{constructor(e){this.quantity=e.quantity,this.unit=e.unit}}class vt{constructor(e){this.uuid=e.uuid,this.label=e.label,this.description=e.description,this.benefits=(e.benefits||[]).map(e=>new ft(e))}}class Et{constructor(e){this.event=new vt(e.event)}}class yt{constructor(e){this.campaignUuid=e.campaignUuid,this.campaignName=e.campaignName,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.mainData&&(this.mainData=new pt(e.mainData)),this.benefitOffers=(e.benefitOffers||[]).map(e=>new mt(e)),this.events=e.events?e.events.map(e=>new Et(e)):void 0}getUnviewedMedia(){return this.mainData?.media?.filter(e=>!e.viewed)||[]}getMediaByType(e){return this.mainData?.media?.filter(t=>t.type===e)||[]}hasAvailableMedia(){return this.getUnviewedMedia().length>0}}class At{constructor(e){this.uuid=e.uuid,this.name=e.name,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isValid(){return!(!this.uuid||!this.name)}getInfo(){return`${this.name} (${this.uuid})`}}class wt{constructor(e){this.requestId=e.requestId,this.campaigns=e.campaigns||[],Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.zone&&(this.zone=new At(e.zone)),this.campaigns=this.campaigns.map(e=>new yt(e))}getCampaignsWithAvailableMedia(){return this.campaigns.filter(e=>e.hasAvailableMedia())}getAllMedia(){return this.campaigns.flatMap(e=>e.mainData?.media||[])}getMediaByType(e){return this.campaigns.flatMap(t=>t.getMediaByType(e))}}class bt{constructor(e){this.responseStatus=e.responseStatus,this.error=e.error,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.campaignResponse&&(this.campaignResponse=new wt(e.campaignResponse))}isSuccess(){return this.responseStatus===e.AACampaignResponseStatus.SUCCESS}isEmpty(){return this.responseStatus===e.AACampaignResponseStatus.EMPTY}hasError(){return this.responseStatus===e.AACampaignResponseStatus.ERROR}getCampaigns(){return this.campaignResponse?.campaigns||[]}getAllMedia(){return this.campaignResponse?.getAllMedia()||[]}}class Rt{constructor(e){this.userId=e.userId,this.context=e.context,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}addContext(e,t){this.context||(this.context={}),this.context[e]=t}getContext(e){return this.context?.[e]}hasContext(){return!!(this.context&&Object.keys(this.context).length>0)}}const Tt="@AkrossAds:SDK_CONFIG",kt="@Dataads:USER_DATA",It="@Dataads:CUSTOM_HEADERS";class St{static saveConfig(e){localStorage.setItem(Tt,JSON.stringify(e))}static getConfig(){const e=localStorage.getItem(Tt);return e?JSON.parse(e):null}static updateConfig(e){const t=this.getConfig();if(t){const r={...t,...e};this.saveConfig(r)}}static deleteConfig(){localStorage.removeItem(Tt)}static saveUserData(e,t=null){const i=new r({userId:e,advertisingId:t});localStorage.setItem(kt,JSON.stringify(i))}static getUserData(){const e=localStorage.getItem(kt);return e?JSON.parse(e):null}static removeUserData(){localStorage.removeItem(kt)}static getDebugMode(){const e=this.getConfig();return e?.debug||!1}static setDebugMode(e){this.updateConfig({debug:e})}static getCustomHeaders(){const e=localStorage.getItem(It);return e?JSON.parse(e):null}static saveCustomHeaders(e){localStorage.setItem(It,JSON.stringify(e))}static removeCustomHeaders(){localStorage.removeItem(It)}static clearAll(){localStorage.removeItem(Tt),localStorage.removeItem(kt),localStorage.removeItem(It)}}class Ct{constructor(){this.isInitialized=!1,this.config=null,this.logger=new y(St.getDebugMode())}getIsInitialized(){return this.isInitialized}async initialize(e){return new Promise(async(r,i)=>{try{if(this.isInitialized)return this.logger.warn("SDK já foi inicializado"),r();this.logger=new y(St.getDebugMode()),this.config=t.applyDefaults(e),this.logger.info("Inicializando SDK..."),St.saveConfig(e),await this.preloadScripts(),this.isInitialized=!0,this.logger.info("SDK inicializado com sucesso!"),r()}catch(e){this.logger.error("Erro ao inicializar SDK:",e),i(e)}})}async setUserId(e,t){return new Promise(async(r,i)=>{if(!this.isInitialized)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));try{this.logger.debug("Definindo userId:",e),St.saveUserData(e,t),te(e),this.logger.info("UserId definido com sucesso"),r()}catch(e){this.logger.error("Erro ao definir userId:",e),i(e)}})}async getUserId(){return new Promise(async(e,t)=>{if(!this.isInitialized)return this.logger.error("SDK não foi inicializado"),t(new Error("SDK não foi inicializado"));try{const t=St.getUserData();e(t?.userId||"")}catch(e){this.logger.error("Erro ao obter userId:",e),t(e)}})}async getUserData(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{return St.getUserData()}catch(e){throw this.logger.error("Erro ao obter dados do usuário:",e),e}}async setCustomHeaders(e){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{St.saveCustomHeaders(e),this.logger.info("Headers customizados definidos com sucesso")}catch(e){throw this.logger.error("Erro ao definir headers customizados:",e),e}}async removeCustomHeaders(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{St.removeCustomHeaders(),this.logger.info("Headers customizados removidos com sucesso")}catch(e){throw this.logger.error("Erro ao remover headers customizados:",e),e}}async getCustomHeaders(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{return St.getCustomHeaders()}catch(e){throw this.logger.error("Erro ao obter headers customizados:",e),e}}getConfig(){return this.config}async clearAll(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{St.clearAll(),this.isInitialized=!1,this.config=null,this.logger.info("Todas as configurações foram limpas")}catch(e){throw this.logger.error("Erro ao limpar configurações:",e),e}}async preloadScripts(){try{if(window.google&&window.google.ima&&window.google.ima.AdsLoader||await $(this.config?.proxyExternalScripts||!1),window.googletag||await j(this.config?.proxyExternalScripts||!1),this.config?.luminaToken&&this.config.luminaToken.trim().length>0&&(!window.adsbylumina||!window.__luminaBasecodeReady__)){const e=t.getLuminaToken(this.config);await Y({token:e,debug:St.getDebugMode()},this.config?.proxyExternalScripts||!1)}}catch(e){this.logger.warn("Erro ao pré-carregar scripts (não crítico):",e)}}getDebugInfo(){return{isInitialized:this.isInitialized,debugMode:St.getDebugMode(),config:this.config,userData:St.getUserData(),customHeaders:St.getCustomHeaders(),scriptsLoaded:{ima:!!(window.google&&window.google.ima&&window.google.ima.AdsLoader),gpt:!!window.googletag,lumina:!(!window.adsbylumina||!window.__luminaBasecodeReady__)},version:ne()}}}class Dt{constructor(){this.cachedDeviceInfo=null,this.logger=new y(St.getDebugMode())}async getDeviceContext(){if(this.cachedDeviceInfo)return this.cachedDeviceInfo;try{const e={},t=St.getConfig();t?.appId&&(e.appId=t.appId),t?.appVersion&&(e.appVersion=t.appVersion),e.deviceId=this.getDeviceId(),e.sdkVersion=this.getSdkVersion(),e.brand=this.getBrowserBrand(),e.hardware=this.getHardwareInfo(),e.manufacturer=this.getManufacturer(),e.model=this.getModel(),e.product=this.getProduct(),e.osVersion=this.getOSVersion(),e.os="WEB",e.eventDate=Date.now().toString(),e.userAgent=navigator.userAgent,e.language=navigator.language,e.platform=navigator.platform,e.screenWidth=screen.width.toString(),e.screenHeight=screen.height.toString(),e.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone;const[r,i]=await Promise.allSettled([this.getLocation(),this.getAdId()]);return"fulfilled"===r.status&&r.value&&(e.lat=r.value.latitude.toString(),e.long=r.value.longitude.toString()),"fulfilled"===i.status&&i.value&&(e.adId=i.value),this.cachedDeviceInfo=e,e}catch(e){return this.logger.error("Error getting device context:",e),this.getFallbackContext()}}getSdkVersion(){return ie()}clearCache(){this.cachedDeviceInfo=null}getBrowserInfo(){return{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,cookieEnabled:navigator.cookieEnabled.toString(),onLine:navigator.onLine.toString()}}getScreenInfo(){return{screenWidth:screen.width.toString(),screenHeight:screen.height.toString(),screenColorDepth:screen.colorDepth.toString(),screenPixelDepth:screen.pixelDepth.toString(),availWidth:screen.availWidth.toString(),availHeight:screen.availHeight.toString()}}getFallbackContext(){return{deviceId:"unknown",sdkVersion:this.getSdkVersion(),os:"WEB",eventDate:Date.now().toString()}}getDeviceId(){const e="akross_device_id";let t=localStorage.getItem(e);return t||(t=this.generateDeviceFingerprint(),localStorage.setItem(e,t)),t}generateDeviceFingerprint(){const e=document.createElement("canvas"),t=e.getContext("2d");t&&(t.textBaseline="top",t.font="14px Arial",t.fillText("Akross Device ID",2,2));const r=[navigator.userAgent,navigator.language,screen.width+"x"+screen.height,(new Date).getTimezoneOffset(),e.toDataURL()].join("|");return btoa(r).substring(0,16)}getBrowserBrand(){const e=navigator.userAgent;return e.includes("Chrome")?"Google":e.includes("Firefox")?"Mozilla":e.includes("Safari")?"Apple":e.includes("Edge")?"Microsoft":"Unknown"}getHardwareInfo(){return navigator.hardwareConcurrency?`CPU Cores: ${navigator.hardwareConcurrency}`:"Unknown"}getManufacturer(){const e=navigator.userAgent;return e.includes("Windows")?"Microsoft":e.includes("Mac")?"Apple":e.includes("Linux")?"Linux":"Unknown"}getModel(){const e=navigator.userAgent;return e.includes("Mobile")?"Mobile Device":e.includes("Tablet")?"Tablet":"Desktop"}getProduct(){return navigator.platform||"Unknown"}getOSVersion(){const e=navigator.userAgent.match(/(Windows|Mac|Linux|Android|iOS)\s+([\d.]+)/);return e?e[2]:"Unknown"}async getLocation(){return new Promise(e=>{navigator.geolocation?navigator.permissions?.query({name:"geolocation"}).then(t=>{"granted"===t.state?navigator.geolocation.getCurrentPosition(t=>{e({latitude:t.coords.latitude,longitude:t.coords.longitude})},()=>e(null),{timeout:5e3,enableHighAccuracy:!1}):e(null)}).catch(()=>{e(null)}):e(null)})}async getAdId(){return null}}let Lt=null;class Nt{constructor(e,t,r=!1){this.logger=new y(St.getDebugMode()),this.eventsHelper=new q}async requestCampaign(t,r=1,i,n){const a=new bt({responseStatus:e.AACampaignResponseStatus.ERROR});if("undefined"==typeof window||!window.AkrossAds)return this.logger.warn("SDK não foi inicializado"),a;{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.warn("SDK não foi inicializado"),a}const s=St.getUserData();if(!s?.userId)return this.logger.error("Erro ao obter campanha: userId está vazio"),a;try{const o=(Lt||(Lt=new Dt),Lt),l={...await o.getDeviceContext(),...i},c=new Rt({userId:s.userId,context:l}),d=(new b).getArtemisAdsService(30,!1,!0),u=await d.requestCampaign(t,c,r,n);if(u&&u.campaigns&&u.campaigns.length>0){u.campaigns.forEach(e=>{const t=e.mainData.media.filter(e=>!e.viewed).length;e.mainData.media.forEach(r=>{if(r.campaignId=e.campaignUuid,r.campaignName=e.campaignName,r.requestId=u.requestId,r.zoneId=u.zone.uuid,r.success=e.mainData.success,r.mediasLeft=t,r.layout=e.mainData.layout,r.partnerEventUuid&&e.events){const t=e.events.find(e=>e.event?.uuid===r.partnerEventUuid);t&&(r.partnerEvent=t.event)}})});const t=new wt({...u,campaigns:u.campaigns});a.campaignResponse=t,a.responseStatus=e.AACampaignResponseStatus.SUCCESS}else a.responseStatus=e.AACampaignResponseStatus.EMPTY}catch(t){a.error=t instanceof Error?t:new Error("Erro desconhecido"),a.responseStatus=e.AACampaignResponseStatus.ERROR,this.logger.error("Erro ao obter campanha:",t)}return a}async bannerClick(e,t,r,i){try{const n=St.getUserData();if(!n?.userId)return void this.logger.error("Erro ao abrir URL: userId está vazio");const a=new URL(e);a.searchParams.has("userId")||a.searchParams.set("userId",n.userId),a.searchParams.has("campaignId")||a.searchParams.set("campaignId",t);const s=(new b).getArtemisAdsService(30,!1,!0);await s.sendTracking("click",t,n.userId,r,i,"banner"),window.open(a.toString(),"_blank")}catch(e){this.logger.error("Erro ao abrir URL:",e)}}async sendEvent(e,t,r,i,n){return new Promise(async(a,s)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),s(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),s(new Error("SDK não foi inicializado"))}const o=St.getUserData();if(!o?.userId)return this.logger.error("UserId não encontrado"),s(new Error("UserId não encontrado"));this.logger.debug("Enviando evento:",{event:e,campaignId:t,trackingId:r,mediaId:i,source:n}),await this.eventsHelper.sendEvent(e,t,r,i,n),this.logger.info("Evento enviado com sucesso"),a()}catch(e){this.logger.error("Erro ao enviar evento:",e),s(e)}})}async sendCampaignsImpressionEvent(e,t){return new Promise(async(r,i)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"))}const n=St.getUserData();if(!n?.userId)return this.logger.error("UserId não encontrado"),i(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de impressão para campanhas:",{trackingId:e,campaignsCount:t.length}),await this.eventsHelper.sendCampaignsImpressionEvent(e,t),this.logger.info("Eventos de impressão enviados com sucesso"),r()}catch(e){this.logger.error("Erro ao enviar eventos de impressão:",e),i(e)}})}async sendCampaignClickEvent(e,t){return new Promise(async(r,i)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"))}const n=St.getUserData();if(!n?.userId)return this.logger.error("UserId não encontrado"),i(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de clique na campanha:",{campaignId:e,trackingId:t}),await this.eventsHelper.sendCampaignClickEvent(e,t),this.logger.info("Evento de clique na campanha enviado com sucesso"),r()}catch(e){this.logger.error("Erro ao enviar evento de clique na campanha:",e),i(e)}})}async sendSuccessImpressionEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=St.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento success_impression:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendSuccessImpressionEvent(e,t,r),this.logger.info("Evento success_impression enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento success_impression:",e),n(e)}})}async sendMediaClickEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=St.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de clique na mídia:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendMediaClickEvent(e,t,r),this.logger.info("Evento de clique na mídia enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento de clique na mídia:",e),n(e)}})}async sendClickThroughEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=St.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento clickthrough:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendClickThroughEvent(e,t,r),this.logger.info("Evento clickthrough enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento clickthrough:",e),n(e)}})}static getSdkVersion(){return ie()}}class Mt{constructor(e){if(this.logger=new y(St.getDebugMode()),"string"==typeof e){const t=document.querySelector(e);if(!t)throw new Error(`Elemento não encontrado: ${e}`);this.containerElement=t}else this.containerElement=e;this.imageElement=document.createElement("img"),this.imageElement.style.display="block",this.containerElement.innerHTML=""}setClickListener(e){this.clickListener=e}setMediaClickHandler(e){this.mediaClickHandler=e}setSuccessListener(e){this.successListener=e}setErrorListener(e){this.errorListener=e}async loadZone(t,r){try{const i=St.getUserData();if(!i?.userId)return this.logger.error("Erro ao carregar banner: userId está vazio"),void this.errorListener?.onError();const n=new Nt,a=await n.requestCampaign(t,1,void 0,r);if(!a.campaignResponse?.campaigns?.length)return this.logger.error("Nenhuma campanha encontrada para a zona:",t),void this.errorListener?.onError();const s=a.campaignResponse.campaigns[0].mainData.media[0];if(s.type!==e.AAMediaTypes.BANNER)return this.logger.error("Tipo de mídia não suportado para banner:",s.type),void this.errorListener?.onError();this.containerElement.appendChild(this.imageElement),await this.loadBanner(s)}catch(e){this.logger.error("Erro ao carregar banner:",e),this.errorListener?.onError()}}async loadBanner(e){try{if(!e.content?.url)return this.logger.error("Erro ao carregar banner: URL da imagem não encontrada"),void this.errorListener?.onError();this.containerElement.appendChild(this.imageElement),await this.loadImage(e.content.url,e)}catch(e){this.logger.error("Erro ao carregar banner:",e),this.errorListener?.onError()}}async loadImage(e,t){try{const r=St.getUserData();if(!r?.userId)return this.logger.error("Erro ao carregar banner: userId não encontrado nas preferences"),this.removeImageFromDOM(),void this.errorListener?.onError();const i=r.userId,n=await fetch(e,{method:"GET",mode:"cors",cache:"default"});if(!n.ok)return this.logger.error(`Erro ao carregar imagem: ${n.status} ${n.statusText}`),this.removeImageFromDOM(),void this.errorListener?.onError();const a=await n.blob(),s=URL.createObjectURL(a);this.imageElement.src=s,this.imageElement.alt=t.title||"Banner",this.imageElement.onload=()=>{this.applyOptimizedFit()},this.imageElement.onerror=()=>{this.logger.error("Erro ao carregar imagem: falha no carregamento da imagem"),this.removeImageFromDOM(),this.errorListener?.onError()},(new q).sendImpressedEvent(t.campaignId,t.requestId,t.uuid),this.successListener?.onSuccess(t.analytics?.impression),this.setupClickHandler(t,i)}catch(e){this.logger.error("Erro ao carregar imagem:",e),this.removeImageFromDOM(),this.errorListener?.onError()}}removeImageFromDOM(){try{this.imageElement&&this.imageElement.parentNode&&this.imageElement.parentNode.removeChild(this.imageElement)}catch(e){this.logger.error("Erro ao remover imagem do DOM:",e)}}applyOptimizedFit(){try{this.containerElement.style.display="flex",this.containerElement.style.alignItems="center",this.containerElement.style.justifyContent="center",this.imageElement.style.maxWidth="100%",this.imageElement.style.maxHeight="100%",this.imageElement.style.objectFit="contain",this.imageElement.style.objectPosition="center",this.logger.debug("Fit simples aplicado com flexbox")}catch(e){this.logger.error("Erro ao aplicar fit simples:",e),this.imageElement.style.width="100%",this.imageElement.style.height="auto",this.imageElement.style.objectFit="contain"}}setupClickHandler(e,t){const r=e.externalUrl?.url||e.success?.url,i=!!this.mediaClickHandler;(i||r)&&(this.imageElement.style.cursor="pointer",this.imageElement.addEventListener("click",()=>{if(this.clickListener?.onClick(e.analytics?.click),i){const t=new ut(e);return void Promise.resolve(this.mediaClickHandler(t)).catch(e=>this.logger.error("Erro no mediaClickHandler do banner:",e))}this.executeBannerClick(r,e,t)}))}async executeBannerClick(e,t,r){try{const r=t.campaignId||t.campaignUuid;if(!r)return void this.logger.error("Erro ao executar clique: campaignId não encontrado na mídia");const i=new q;i.sendMediaClickEvent(r,t.requestId,t.uuid),i.sendClickThroughEvent(r,t.requestId,t.uuid),window.open(e,"_blank","noopener,noreferrer")}catch(e){this.logger.error("Erro ao executar clique do banner:",e)}}destroy(){this.campaignCall&&(this.campaignCall=void 0),this.imageElement.removeEventListener("click",()=>{}),this.containerElement&&(this.containerElement.innerHTML="")}}class xt{constructor(e){this.config={timeout:1e4,debug:!1,...e},this.logger=new y(this.config.debug),this.sdkManager=new Ct,this.adsManager=new Nt(this.config.appId,this.config.appVersion,this.config.debug),St.setDebugMode(this.config.debug||!1),this.logger.debug("Debug mode salvo via PreferencesUtil:",this.config.debug||!1),this.logger.info("SDK Akross Artemis Ads criado"),this.logger.debug("Configuração:",this.config)}async initialize(){return this.sdkManager.initialize(this.config)}isInitialized(){return this.sdkManager.getIsInitialized()}async setUserId(e,t){return this.sdkManager.setUserId(e,t)}async getUserId(){return this.sdkManager.getUserId()}async getUserData(){return this.sdkManager.getUserData()}async setCustomHeaders(e){return this.sdkManager.setCustomHeaders(e)}async removeCustomHeaders(){return this.sdkManager.removeCustomHeaders()}async getCustomHeaders(){return this.sdkManager.getCustomHeaders()}getConfig(){return this.sdkManager.getConfig()}async clearAll(){return this.sdkManager.clearAll()}getDebugInfo(){return this.sdkManager.getDebugInfo()}getVersion(){return ie()}getVersionInfo(){return ne()}async sendEvent(e,t,r,i,n){return this.adsManager.sendEvent(e,t,r,i,n)}async sendCampaignsImpressionEvent(e,t){return this.adsManager.sendCampaignsImpressionEvent(e,t)}async sendCampaignClickEvent(e,t){return this.adsManager.sendCampaignClickEvent(e,t)}async sendSuccessImpressionEvent(e,t,r){return this.adsManager.sendSuccessImpressionEvent(e,t,r)}async sendMediaClickEvent(e,t,r){return this.adsManager.sendMediaClickEvent(e,t,r)}async sendClickThroughEvent(e,t,r){return this.adsManager.sendClickThroughEvent(e,t,r)}async requestCampaign(e,t,r,i){return this.logger.debug("Solicitando campanhas para zona:",e),this.adsManager.requestCampaign(e,t||1,r,i)}async bannerClick(e,t,r,i){return this.logger.debug("Processando clique em banner:",{campaignId:t,mediaId:i}),this.adsManager.bannerClick(e,t,r,i)}}let Ot=null;async function Pt(e){return Ot||(Ot=new xt(e),await Ot.initialize(),Ot)}function Ut(){return Ot}function Vt(){Ot&&(Ot.clearAll(),Ot=null,"undefined"!=typeof window&&delete window.AkrossAds)}return"undefined"!=typeof window&&(window.AkrossAds={init:Pt,getInstance:Ut,destroy:Vt,SDK:xt,AAManager:Ct,AdsManager:Nt,VERSION:ae,VERSION_INFO:se,getVersion:ie,getVersionInfo:ne,AAMedia:ut,AACampaign:yt,AACampaignResponse:wt,AACampaignResult:bt,AAZone:At,AAMainData:pt,AAContent:f,AASuccess:v,AABenefitOffer:mt,AAAdWatchResult:E,AAVastPlayer:it,AARewardedVideoHandler:lt,AAEventsCallbackHelper:q,AARvEventsCallbackHelper:B,AAMediaResultHelper:K,PreferencesUtil:St,GlobalLoadingOverlay:J,ArtemisAdsBannerLoader:Mt}),e.AAAdWatchResult=E,e.AABanner=dt,e.AABenefitOffer=mt,e.AACampaign=yt,e.AACampaignConfig=o,e.AACampaignRequest=Rt,e.AACampaignResponse=wt,e.AACampaignResult=bt,e.AAContent=f,e.AAError=u,e.AAEvent=Et,e.AAEventBenefit=ft,e.AAEventDetail=vt,e.AAEventsCallbackHelper=q,e.AAHeader=ht,e.AALayout=gt,e.AAMainData=pt,e.AAManager=Ct,e.AAMedia=ut,e.AAMediaResultHelper=K,e.AAProgrammatic=g,e.AARewardedVideo=lt,e.AARvEventsCallbackHelper=B,e.AASuccess=v,e.AASurveyV2=p,e.AAVastPlayer=it,e.AAZone=At,e.AdsManager=Nt,e.AkrossAdsSDK=xt,e.ArtemisAdsBannerLoader=Mt,e.CAMPAIGN_CLICK_EVENT=I,e.CLICK_EVENT="click",e.ConfigUtils=t,e.ERROR_EVENT=x,e.ERROR_MESSAGES=W,e.GAMRewardedVideoWrapper=st,e.IMPRESSION_EVENT=R,e.Logger=y,e.LuminaRewardedVideoWrapper=ot,e.NO_FILL_EVENT=N,e.PROGRAMMATIC_ERROR=L,e.PROGRAMMATIC_FALLBACK_REQ=D,e.PROGRAMMATIC_SKIPPED=M,e.PROG_CONN_ERROR_EVENT=C,e.PreferencesUtil=St,e.SUCCESS_IMPRESSION_EVENT=T,e.UserDataCache=r,e.VERSION=ae,e.VERSION_INFO=se,e.VPAID_COMPLETE_EVENT=k,e.VPAID_FIRST_QUARTILE_EVENT=P,e.VPAID_MIDPOINT_EVENT=U,e.VPAID_SKIPPED_EVENT=_,e.VPAID_START_EVENT=O,e.VPAID_THIRD_QUARTILE_EVENT=V,e.WATERFALL_START_EVENT=S,e.WaterfallResultHelper=at,e.applyGPTPpidIfEnabled=re,e.createAAEventsCallbackHelper=F,e.createAAMediaResultHelper=function(e){return new K(e)},e.createAARewardedVideoHandler=function(e){return new lt(e)},e.createAARvEventsCallbackHelper=H,e.createAAVastPlayer=function(e){return new it(e)},e.createGAMRewardedVideoWrapper=function(e){return new st(e)},e.createLuminaRewardedVideoWrapper=function(e){return new ot(e)},e.createWaterfallResultHelper=function(){return new at},e.destroy=Vt,e.getDeviceType=function(){return a()?"mobile":n()?"tablet":s()?"desktop":"unknown"},e.getInstance=Ut,e.getVersion=ie,e.getVersionInfo=ne,e.init=Pt,e.isAndroid=function(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent||"";return/Android/i.test(e)},e.isDesktop=s,e.isGPTPpidEnabled=Z,e.isIOS=i,e.isMediaTypeSupported=function(t){return[e.AAMediaTypes.BANNER,e.AAMediaTypes.VIDEO_V2,e.AAMediaTypes.PROGRAMMATIC_V2,e.AAMediaTypes.SURVEY_V2,e.AAMediaTypes.EXTERNAL_REDIRECT,e.AAMediaTypes.TYPE_GOOGLE_RV,e.AAMediaTypes.TYPE_GOOGLE_RI,e.AAMediaTypes.TYPE_MAX_RV,e.AAMediaTypes.TYPE_KWAI_RV,e.AAMediaTypes.TYPE_FALLBACK].includes(t)},e.isMobile=a,e.isTablet=n,e.isValidPPID=ee,e.loadGPTScript=j,e.loadIMAScript=$,e.loadLuminaScript=Y,e.setGPTPublisherProvidedId=te,e}({});
1
+ var e=function(e){"use strict";class t{static applyDefaults(e){return{timeout:5e3,debug:!1,proxyExternalScripts:!1,enableGPTPpid:!1,...e}}static hasBaseUrl(e){return!!(e.baseUrl&&e.baseUrl.trim().length>0)}static hasArtemisAppId(e){return!!(e.artemisAdsAppId&&e.artemisAdsAppId.trim().length>0)}static getArtemisAppId(e,t){return e.artemisAdsAppId||t||""}static isValid(e){return this.hasBaseUrl(e)&&this.hasArtemisAppId(e)}static getPrimaryColor(e,t="#007bff"){return e.primaryColor||t}static isValidColor(e){return!!e&&/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)}static getLuminaToken(e,t="QQDCYMdFh2AJqwP"){return e.luminaToken||t}}class r{constructor(e){this.userId=e.userId,this.advertisingId=e.advertisingId,Object.keys(e||{}).forEach(t=>{t in this||(this[t]=e[t])})}hasAdvertisingId(){return!!(this.advertisingId&&this.advertisingId.trim().length>0)}getAdvertisingId(e){return this.advertisingId||e||""}setAdvertisingId(e){this.advertisingId=e}clearAdvertisingId(){this.advertisingId=null}isValid(){return!!(this.userId&&this.userId.trim().length>0)}getUserId(e){return this.userId||e||""}hasCompleteData(){return this.isValid()&&this.hasAdvertisingId()}}function i(){if("undefined"==typeof navigator)return!1;const e=navigator.platform||"",t=navigator.userAgent||"";return/iPhone|iPad|iPod/i.test(e)||/iPhone|iPad|iPod/i.test(t)}function n(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent||"",t=navigator.platform||"",r=/iPad/i.test(t)||/Macintosh/i.test(e)&&"undefined"!=typeof document&&"ontouchend"in document,i=/Android/i.test(e)&&!/Mobile/i.test(e);return r||i}function a(){if("undefined"==typeof navigator)return!1;if(n())return!1;const e=navigator.userAgent||"",t=navigator.platform||"",r=/iPhone|iPod/i.test(t)||/iPhone|iPod/i.test(e),i=/Android/i.test(e)&&/Mobile/i.test(e);return r||i}function s(){if("undefined"==typeof navigator)return!1;if(a()||n())return!1;const e=navigator.userAgent||"",t=navigator.platform||"",r=/Win/i.test(t)||/Windows/i.test(e),s=/Mac/i.test(t)&&!i(),o=/Linux/i.test(t)&&!/Android/i.test(e);return r||s||o}class o{constructor(e){this.params=e.params,this.type=e.type,Object.keys(e).forEach(t=>{"params"!==t&&"type"!==t&&(this[t]=e[t])})}findParamByKey(e){return this.params?.find(t=>t.key===e)?.value}findAdUnitId(){return i()?this.findParamByKey("adUnitIdiOS")??this.findParamByKey("adUnitId")??"":this.findParamByKey("adUnitId")??""}findVastTag(){return this.findParamByKey("tag")??""}findEventSuffix(){return this.findParamByKey("eventSuffix")??""}findTimeout(){const e=this.findParamByKey("timeout");return e?parseInt(e,10):void 0}}var l,c,d;e.AACampaignResponseStatus=void 0,(l=e.AACampaignResponseStatus||(e.AACampaignResponseStatus={})).SUCCESS="SUCCESS",l.ERROR="ERROR",l.EMPTY="EMPTY",e.AAMediaTypes=void 0,(c=e.AAMediaTypes||(e.AAMediaTypes={})).BANNER="image",c.VIDEO_V2="video_v2",c.PROGRAMMATIC_V2="programatica_v2",c.SURVEY_V2="survey_v2",c.EXTERNAL_REDIRECT="external_redirect",c.TYPE_GOOGLE_RV="GAM_RV",c.TYPE_GOOGLE_RI="GAM_RI",c.TYPE_MAX_RV="MAX_RV",c.TYPE_KWAI_RV="KWAI_RV",c.TYPE_FALLBACK="fallback",c.PROGRAMMATIC="programatica",c.PROGRAMMATIC_ADMOB_RB="google-admob-rv",c.PROGRAMMATIC_MAX_RV="max-rv",c.UNKNOWN="",e.AAMediaPlayResult=void 0,(d=e.AAMediaPlayResult||(e.AAMediaPlayResult={}))[d.REWARDED=11]="REWARDED",d[d.REWARDED_REDIRECTED=12]="REWARDED_REDIRECTED",d[d.MEDIA_WATCHED=13]="MEDIA_WATCHED",d[d.SKIPPED=20]="SKIPPED",d[d.ERROR=21]="ERROR",d[d.CONNECTION_ERROR=22]="CONNECTION_ERROR",d[d.NO_FILL=23]="NO_FILL",d[d.CANCELED=24]="CANCELED",d[d.POLL_WRONG_ANSWER=25]="POLL_WRONG_ANSWER",d[d.EXTERNAL_REDIRECT=26]="EXTERNAL_REDIRECT",d[d.BANNER_CLICK=27]="BANNER_CLICK";class u{constructor(e,t){this.description=e,this.cause=t}}class h{constructor(e){this.type=e.type,this.url=e.url,this.originalContent=e.originalContent,this.proxy=e.proxy,this.skipEnabled=e.skipEnabled,this.skipSeconds=e.skipSeconds,this.videoId=e.videoId,this.eventSuffix=e.eventSuffix}hasUrl(){return!(!this.url||!this.url.trim())}hasType(){return!(!this.type||!this.type.trim())}isSupportedType(){return["IN_HOUSE","VAST","VPAID"].includes(this.type?.toUpperCase())}}class g{constructor(e){this.waterfall=e.waterfall?e.waterfall.map(e=>new o(e)):void 0}hasWaterfall(){return!!(this.waterfall&&this.waterfall.length>0)}getInfo(){return this.hasWaterfall()?`Waterfall com ${this.waterfall.length} anúncios`:"Conteúdo programático vazio"}}class p{constructor(e){this.url=e.url,this.adBlock=e.adBlock}hasUrl(){return!(!this.url||!this.url.trim())}hasAdBlock(){return!(!this.adBlock||!this.adBlock.trim())}}let m=class{constructor(e){this.infoPrimary=e.infoPrimary,this.infoSecondary=e.infoSecondary,this.actionButtonLabel=e.actionButtonLabel,this.link=e.link,this.thumbnail=e.thumbnail}hasLink(){return!(!this.link||!this.link.trim())}hasThumbnail(){return!(!this.thumbnail||!this.thumbnail.trim())}hasInfoPrimary(){return!(!this.infoPrimary||!this.infoPrimary.trim())}hasInfoSecondary(){return!(!this.infoSecondary||!this.infoSecondary.trim())}hasActionButtonLabel(){return!(!this.actionButtonLabel||!this.actionButtonLabel.trim())}};class f{constructor(e){this.url=e.url,this.programmatic=e.programmatic?new g(e.programmatic):void 0,this.video=e.video?new h(e.video):void 0,this.infoPrimary=e.infoPrimary,this.infoSecondary=e.infoSecondary,this.survey=e.survey?new p(e.survey):void 0,this.externalRedirect=e.externalRedirect?new m(e.externalRedirect):void 0,!this.externalRedirect&&(e.link||e.actionButtonLabel||e.thumbnail)&&(this.externalRedirect=new m({infoPrimary:e.infoPrimary,infoSecondary:e.infoSecondary,actionButtonLabel:e.actionButtonLabel,link:e.link,thumbnail:e.thumbnail}))}hasUrl(){return!(!this.url||!this.url.trim())}isProgrammatic(){return!(!this.programmatic||!this.programmatic.hasWaterfall())}isSurvey(){return!(!this.survey||!this.survey.hasUrl())}isExternalRedirect(){return!(!this.externalRedirect||!this.externalRedirect.hasLink())}getInfo(){return this.hasUrl()?`URL: ${this.url}`:this.isProgrammatic()?this.programmatic.getInfo():this.isSurvey()?`Survey: ${this.survey.url}`:this.isExternalRedirect()?`External Redirect: ${this.externalRedirect.link}`:"Conteúdo vazio"}}class v{constructor(e){this.type=e.type,this.title=e.title,this.description=e.description,this.buttons=e.buttons||[],this.url=e.url,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isExternal(){return"EXTERNAL"===this.type}hasUrl(){return!(!this.url||!this.url.trim())}hasButtons(){return this.buttons.length>0}getInfo(){return`${this.title}: ${this.description}`}}class E{constructor(e){this.media=e.media,this.result=e.result,this.error=e.error,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isSuccess(){return this.result===e.AAMediaPlayResult.REWARDED||this.result===e.AAMediaPlayResult.REWARDED_REDIRECTED||this.result===e.AAMediaPlayResult.EXTERNAL_REDIRECT||this.result===e.AAMediaPlayResult.BANNER_CLICK}isSkipped(){return this.result===e.AAMediaPlayResult.SKIPPED}hasError(){return this.result===e.AAMediaPlayResult.ERROR||!!this.error}getErrorMessage(){return this.error?this.error.description||this.error.cause||"Erro desconhecido":"Sem erro"}getInfo(){return this.isSuccess()?"Anúncio visualizado com sucesso":this.isSkipped()?"Anúncio pulado":this.hasError()?`Erro: ${this.getErrorMessage()}`:"Resultado desconhecido"}}class y{constructor(e=!1){this.debugMode=e}debug(e,...t){this.debugMode}info(e,...t){}warn(e,...t){}error(e,...t){}}class A{constructor(){}interceptRequest(e){const t=St.getCustomHeaders();if(t){const r=new Headers(e.headers);Object.entries(t).forEach(([e,t])=>{r.set(e,t)}),e.headers=r}const r=new Headers(e.headers);return r.set("Content-Type","application/json"),r.set("Accept","application/json"),e.headers=r,e}interceptResponse(e){return e}}class w{constructor(e){this.fetchConfig=e}async fetchWithConfig(e,t={}){const{baseUrl:r,restInterceptor:i}=this.fetchConfig;i&&(t=i.interceptRequest(t));const n=new URL(e,r).toString();return fetch(n,{...t})}async requestCampaign(e,t,r,i){const n=`campaign/v3/${e}?size=${r}${i?`&t=${i}`:""}`,a=await this.fetchWithConfig(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!a.ok)throw new Error(`Failed to request campaign: ${a.statusText}`);return 204==a.status?{}:a.json()}async sendTracking(e,t,r,i,n,a){const s=`tracker?e=${e}&c=${t??""}&u=${r}&requestId=${i}${n?`&m=${n}`:""}${a?`&s=${a}`:""}`,o=await this.fetchWithConfig(s,{method:"POST",keepalive:!0});if(!o.ok)throw new Error(`Failed to send tracking: ${o.statusText}`)}async checkConnectivity(e="https://access-network.akross.com.br"){const t=Math.round(1e4*Math.random()),r=await this.fetchWithConfig(`${e}?rand=${t}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to check connectivity: ${r.statusText}`);return r}async sendParsedVastTrackingEvent(e){const t=await this.fetchWithConfig(e,{method:"GET",keepalive:!0});if(!t.ok)throw new Error(`Failed to send parsed VAST tracking event: ${t.statusText}`)}}class b{constructor(){}createFetchConfig(e,t,r=!1,i=!0){return{baseUrl:e,timeout:t,debugMode:r,restInterceptor:i?new A:null}}init(e="",t=5,r=!1,i=!0){let n=e;if(""===n){const e=St.getConfig();n=e?.baseUrl||"https://internal-artemis-837746407.us-east-1.elb.amazonaws.com/adserver/"}return this.createFetchConfig(n,t,r,i)}getArtemisAdsService(e=30,t=!1,r=!0){const i=this.init("",e,t,r);return new w(i)}}const R="impression",T="success_impression",k="complete",I="campaign-click",S="prog-wtfl-start",C="prog-conn-error",D="prog-fallback-req",L="prog-ad-error",N="prog-ad-no-fill",M="prog-skipped",x="ad-error",O="start",P="firstQuartile",U="midpoint",V="thirdQuartile",_="skipped";class q{constructor(){this.logger=new y(St.getDebugMode()),this.apiFactory=new b}async sendEvent(e,t,r,i,n){await this.requestEvent(e,t,r,i,n)}async requestEvent(e,t,r,i,n){const a=St.getUserData(),s=a?.userId;if(s)try{const a=St.getDebugMode(),o=this.apiFactory.getArtemisAdsService(3,a);await o.sendTracking(e,t,s,r,i,n),this.logger.debug(`Event sent successfully: ${e} for campaign ${t}`)}catch(e){this.logger.warn("Error sending tracking event:",e)}else this.logger.error("Error sending tracking event: User id is null")}async sendMediaClickEvent(e,t,r){await this.sendEvent("media-click",e,t,r)}async sendCampaignClickEvent(e,t){await this.sendEvent(I,e,t)}async sendCampaignsImpressionEvent(e,t){for(const r of t)await this.sendEvent(R,r.campaignUuid,e)}async sendImpressedEvent(e,t,r){await this.sendEvent(R,e,t,r)}async sendSuccessImpressionEvent(e,t,r){await this.sendEvent(T,e,t,r)}async sendCompleteEvent(e,t,r,i){await this.sendEvent(k,e,t,r,i)}async sendAllAdsCompletedEvent(e,t,r,i){await this.sendEvent("all-ads-completed"+(i?`${i}`:""),e,t,r)}async sendAdCompletedEvent(e,t,r){await this.sendEvent("ad-completed",e,t,r)}async sendEventFromUrl(e){try{const t=St.getDebugMode(),r=this.apiFactory.getArtemisAdsService(3,t);await r.sendParsedVastTrackingEvent(e),this.logger.debug("Parsed VAST tracking event sent successfully")}catch(e){this.logger.warn("Error sending tracking event from URL:",e)}}async sendVpaidStartEvent(e,t,r){await this.sendEvent(O,e,t,r)}async sendFirstQuartileEvent(e,t,r){await this.sendEvent(P,e,t,r)}async sendMidpointEvent(e,t,r){await this.sendEvent(U,e,t,r)}async sendThirdQuartileEvent(e,t,r){await this.sendEvent(V,e,t,r)}async sendSkippedEvent(e,t,r){await this.sendEvent(_,e,t,r)}async sendAdErrorEvent(e,t,r){await this.sendEvent(x,e,t,r)}async sendAdNoFillEvent(e,t,r){await this.sendEvent(N,e,t,r)}async sendWaterfallStartEvent(e,t,r){await this.sendEvent(S,e,t,r)}async sendProgConnectionError(e,t,r){await this.sendEvent(C,e,t,r)}async sendProgFallbackReq(e,t,r){await this.sendEvent(D,e,t,r)}async sendProgError(e,t,r){await this.sendEvent(L,e,t,r)}async sendProgSkipped(e,t,r){await this.sendEvent(M,e,t,r)}async sendClickThroughEvent(e,t,r){await this.sendEvent("clickthrough",e,t,r)}async sendParsedVastTrackingEvent(e){await this.sendEventFromUrl(e)}}function F(){return new q}const B=q,H=F,W={REWARDED:"Benefício adiquirido com sucesso",NOT_REWARDED:"Você precisa assistir o anúncio até o fim para obter o benefício",REDIRECT_ERROR:"Você não tem nenhum aplicativo instalado para abrir uma página na web",ERROR:"Ocorreu um erro ao exibir o anúncio. Por favor, tente novamente",CONNECTION_ERROR:"Ocorreu um erro ao exibir o anúncio. Por favor, verifique sua conexão e tente novamente",NO_FILL:"Não foi possível encontrar uma publicidade no momento. Por favor, tente novamente",VAST_BACK:"Para obter o prêmio é necessário assistir o vídeo até o final"};var z;e.AAVastTrackingEvents=void 0,(z=e.AAVastTrackingEvents||(e.AAVastTrackingEvents={})).IMPRESSION="IMPRESSION",z.CLICKTHROUGH="CLICKTHROUGH",z.VAST_IMPRESSION="VAST_IMPRESSION",z.START="START",z.FIRST_QUARTILE="FIRST_QUARTILE",z.MIDPOINT="MIDPOINT",z.THIRD_QUARTILE="THIRD_QUARTILE",z.COMPLETE="COMPLETE",z.ERROR="ERROR",z.SKIPPED="SKIPPED",z.NO_FILL="NO_FILL",z.PROGRAMMATIC_ERROR="PROGRAMMATIC_ERROR",z.PROGRAMMATIC_SKIPPED="PROGRAMMATIC_SKIPPED",z.PROGRAMMATIC_WATERFALL_START="PROGRAMMATIC_WATERFALL_START",z.PROGRAMMATIC_CONNECTION_ERROR="PROGRAMMATIC_CONNECTION_ERROR",z.PROGRAMMATIC_FALLBACK_REQ="PROGRAMMATIC_FALLBACK_REQ",z.AD_COMPLETED="AD_COMPLETED",z.ALL_ADS_COMPLETED="ALL_ADS_COMPLETED";class K{constructor(e){this.sentEvents=new Set,this.config=e,this.logger=new y(St.getDebugMode()),this.eventsHelper=new q}sendEventCallback(t,r){if(this.sentEvents.has(t))this.logger.debug(`Event ${t} already sent, skipping`);else switch(this.sentEvents.add(t),this.logger.debug(`Sending event: ${t} for media: ${r.title}`),t){case e.AAVastTrackingEvents.IMPRESSION:this.onAdImpression(r);break;case e.AAVastTrackingEvents.START:this.onAdStarted(r);break;case e.AAVastTrackingEvents.FIRST_QUARTILE:this.onFirstQuartile(r);break;case e.AAVastTrackingEvents.MIDPOINT:this.onMidpoint(r);break;case e.AAVastTrackingEvents.THIRD_QUARTILE:this.onThirdQuartile(r);break;case e.AAVastTrackingEvents.COMPLETE:this.onAdComplete(r);break;case e.AAVastTrackingEvents.ERROR:this.onAdError(r);break;case e.AAVastTrackingEvents.SKIPPED:this.onAdSkipped(r);break;case e.AAVastTrackingEvents.NO_FILL:this.onProgrammaticNoFill(r);break;case e.AAVastTrackingEvents.PROGRAMMATIC_ERROR:this.onProgrammaticAdError(r);break;case e.AAVastTrackingEvents.PROGRAMMATIC_SKIPPED:this.onProgrammaticSkipped(r);break;case e.AAVastTrackingEvents.PROGRAMMATIC_WATERFALL_START:this.onProgrammaticStart(r);break;case e.AAVastTrackingEvents.PROGRAMMATIC_CONNECTION_ERROR:this.onProgrammaticConnectionError(r);break;case e.AAVastTrackingEvents.PROGRAMMATIC_FALLBACK_REQ:this.onProgrammaticFallbackReq(r);break;case e.AAVastTrackingEvents.CLICKTHROUGH:this.onClickThrough(r);break;case e.AAVastTrackingEvents.AD_COMPLETED:this.onAdCompleted(r);break;case e.AAVastTrackingEvents.ALL_ADS_COMPLETED:this.onAllAdsCompleted(r);break;default:this.logger.warn(`Unknown event: ${t}`)}}finishWithResult(t,r,i){const n=new E({media:t,result:r});switch(r){case e.AAMediaPlayResult.REWARDED:if(this.logger.debug(`Checking mediasLeft: ${t.mediasLeft} (type: ${typeof t.mediasLeft})`),(t.mediasLeft||0)>1)this.logger.debug(`Setting result to MEDIA_WATCHED because mediasLeft (${t.mediasLeft}) > 1`),n.result=e.AAMediaPlayResult.MEDIA_WATCHED;else if(this.logger.debug(`Keeping result as REWARDED because mediasLeft (${t.mediasLeft}) <= 1`),"EXTERNAL"===t.success?.type)try{t.success.url&&(window.open(t.success.url,"_blank"),n.result=e.AAMediaPlayResult.REWARDED_REDIRECTED)}catch(t){n.error=new u(W.REDIRECT_ERROR),n.result=e.AAMediaPlayResult.ERROR}break;case e.AAMediaPlayResult.ERROR:n.error=new u(W.ERROR,i);break;case e.AAMediaPlayResult.NO_FILL:n.error=new u(W.NO_FILL,"NO_FILL");break;case e.AAMediaPlayResult.CONNECTION_ERROR:n.error=new u(W.CONNECTION_ERROR,"CONNECTION_ERROR");break;case e.AAMediaPlayResult.CANCELED:n.error=new u(W.NOT_REWARDED);break;case e.AAMediaPlayResult.REWARDED_REDIRECTED:case e.AAMediaPlayResult.EXTERNAL_REDIRECT:break;default:this.logger.warn(`Unknown result: ${r}`)}return n}onAdImpression(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendImpressedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdClickThrough(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendClickThroughEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdStarted(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendVpaidStartEvent(e.campaignId||"",e.requestId||"",e.uuid)}onFirstQuartile(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendFirstQuartileEvent(e.campaignId||"",e.requestId||"",e.uuid)}onMidpoint(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendMidpointEvent(e.campaignId||"",e.requestId||"",e.uuid)}onThirdQuartile(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendThirdQuartileEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdComplete(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendCompleteEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdCompleted(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendAdCompletedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAllAdsCompleted(e){this.eventsHelper.sendAllAdsCompletedEvent(e.campaignId||"",e.requestId||"",e.uuid,e.content?.video?.eventSuffix)}onAdSkipped(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendSkippedEvent(e.campaignId||"",e.requestId||"",e.uuid)}onAdError(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendAdErrorEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticNoFill(e){this.eventsHelper.sendAdNoFillEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticStart(e){this.eventsHelper.sendWaterfallStartEvent(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticConnectionError(e,t){this.eventsHelper.sendProgConnectionError(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticFallbackReq(e){this.eventsHelper.sendProgFallbackReq(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticAdError(e,t){this.eventsHelper.sendProgError(e.campaignId||"",e.requestId||"",e.uuid)}onProgrammaticSkipped(e){this.eventsHelper.sendProgSkipped(e.campaignId||"",e.requestId||"",e.uuid)}onClickThrough(e){this.canSendLocalEvents(e)&&this.eventsHelper.sendClickThroughEvent(e.campaignId||"",e.requestId||"",e.uuid)}canSendLocalEvents(t){if(t.type===e.AAMediaTypes.VIDEO_V2){const e=t.content?.video?.type?.toUpperCase();return"VAST"===e||"VPAID"===e}return!0}clearSentEvents(){this.sentEvents.clear()}hasEventBeenSent(e){return this.sentEvents.has(e)}}const G=1e3;function j(e=!1){return new Promise((t,r)=>{if(window.googletag)t();else if(document.getElementById("gpt-script"))setTimeout(()=>{window.googletag?t():r(new Error("GPT script exists but not loaded"))},G);else{const i="https://www.googletagservices.com/tag/js/gpt.js",n=document.createElement("script");n.src=Q("gpt.js",i,e),n.id="gpt-script",n.async=!0,n.onload=()=>{setTimeout(()=>{window.googletag?t():r(new Error("GPT script failed to initialize"))},G)},n.onerror=e=>{r(e)},document.head.appendChild(n)}})}function $(e=!1){return new Promise((t,r)=>{if(window.google&&window.google.ima)t();else if(document.getElementById("ima-script"))setTimeout(()=>{window.google&&window.google.ima?t():r(new Error("IMA SDK script exists but not loaded"))},G);else{const i="https://imasdk.googleapis.com/js/sdkloader/ima3.js",n=document.createElement("script");n.src=Q("ima3.js",i,e),n.id="ima-script",n.async=!0,n.onload=()=>{setTimeout(()=>{window.google&&window.google.ima?t():r(new Error("IMA SDK failed to initialize"))},G)},n.onerror=e=>{r(e)},document.head.appendChild(n)}})}function Y(e,t=!1){return new Promise((r,i)=>{if(window.adsbylumina&&window.__luminaBasecodeReady__)r();else if(document.getElementById("lumina-script"))setTimeout(()=>{window.adsbylumina&&window.__luminaBasecodeReady__?r():i(new Error("Lumina SDK script exists but not loaded"))},G);else{const n="https://s16-ad.ap4r.com/kos/s101/nlav11187/lumina/lumina-install.js",a=new URLSearchParams;e.token&&a.append("token",e.token),void 0!==e.debug&&a.append("debug",e.debug.toString());const s=`${n}?${a.toString()}`,o=document.createElement("script");o.src=Q("lumina-install.js",s,t),o.id="lumina-script",o.async=!0,o.onload=()=>{setTimeout(()=>{window.adsbylumina&&window.__luminaBasecodeReady__?r():i(new Error("Lumina SDK failed to initialize"))},G)},o.onerror=e=>{i(new Error("Failed to load Lumina SDK script"))},document.head.appendChild(o)}})}function Q(e,t,r=!1){if(!r)return t;const i=St.getConfig()?.cdnBaseUrl;return i?`${i}/static/js/${e}`:t}class X{constructor(e){this.modalElement=null,this.videoElement=null,this.videoContainer=null,this.closeButton=null,this.fallbackOverlay=null,this.fallbackTimerEl=null,this.fallbackSaibaMaisBtn=null,this.logger=e}createModal(){try{if(this.cleanup(),this.modalElement=document.createElement("div"),this.modalElement.innerHTML='\n <style>\n .aa-vast-modal {\n display: flex;\n flex-direction: column;\n position: fixed;\n inset: 0;\n width: 100vw;\n height: 100vh;\n background-color: #000;\n z-index: 2147483647;\n overflow: hidden;\n }\n\n .aa-vast-header {\n flex-shrink: 0;\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n padding: 0 8px;\n background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));\n z-index: 10;\n }\n\n .aa-vast-modal-dialog {\n flex: 1;\n min-height: 0;\n position: relative;\n overflow: hidden;\n }\n\n .content-video-vast {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .aa-vast-close-btn {\n position: relative;\n width: 44px;\n height: 44px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background-color: rgba(0, 0, 0, 0.5);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: background-color 0.2s ease, transform 0.15s ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n .aa-vast-close-btn:hover {\n background-color: rgba(0, 0, 0, 0.8);\n }\n\n .aa-vast-close-btn:active {\n transform: scale(0.95);\n }\n\n .aa-vast-close-btn::before,\n .aa-vast-close-btn::after {\n content: \'\';\n position: absolute;\n width: 22px;\n height: 2px;\n background-color: #fff;\n border-radius: 1px;\n }\n\n .aa-vast-close-btn::before {\n transform: rotate(45deg);\n }\n\n .aa-vast-close-btn::after {\n transform: rotate(-45deg);\n }\n\n .ima-ad-container {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 2;\n }\n\n .ima-ad-container > * {\n pointer-events: auto;\n }\n\n .ima-video-element {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n object-fit: contain;\n cursor: pointer;\n z-index: 1;\n }\n\n .ima-video-element:focus {\n outline: none;\n }\n\n .aa-vast-fallback-overlay {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 5;\n display: none;\n align-items: flex-end;\n justify-content: flex-end;\n padding: 24px 16px 16px;\n background: linear-gradient(to top, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0));\n pointer-events: none;\n }\n\n .aa-vast-fallback-overlay.is-visible {\n display: flex;\n pointer-events: auto;\n }\n\n .aa-vast-fallback-overlay > * {\n pointer-events: auto;\n }\n\n .aa-vast-fallback-timer {\n position: absolute;\n left: 0;\n bottom: 0;\n color: #fff;\n display: inline-block;\n font-family: Arial, sans-serif;\n font-weight: normal;\n font-size: 11px;\n line-height: normal;\n padding: 5px;\n padding-right: 10px;\n pointer-events: auto;\n text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);\n cursor: default;\n }\n\n .aa-vast-fallback-saiba-mais {\n padding: 8px 16px;\n font-size: 14px;\n font-weight: 500;\n color: #fff;\n background-color: rgba(255, 255, 255, 0.25);\n border: 1px solid rgba(255, 255, 255, 0.5);\n border-radius: 4px;\n cursor: pointer;\n text-decoration: none;\n transition: background-color 0.2s ease;\n -webkit-tap-highlight-color: transparent;\n }\n\n .aa-vast-fallback-saiba-mais:hover {\n background-color: rgba(255, 255, 255, 0.35);\n }\n </style>\n <div id="modal" class="aa-vast-modal">\n <header class="aa-vast-header">\n <button type="button" class="aa-vast-close-btn" id="close-modal" aria-label="Fechar anúncio"></button>\n </header>\n <div class="aa-vast-modal-dialog">\n <div id="content-video-vast" class="content-video-vast">\n <video id="ima-video-element" class="ima-video-element" autoplay playsinline></video>\n <div id="ima-ad-container" class="ima-ad-container"></div>\n </div>\n <div id="aa-vast-fallback-overlay" class="aa-vast-fallback-overlay" aria-hidden="true">\n <span id="aa-vast-fallback-timer" class="aa-vast-fallback-timer">Anúncio 0:00</span>\n <button type="button" id="aa-vast-fallback-saiba-mais" class="aa-vast-fallback-saiba-mais">Saiba mais</button>\n </div>\n </div>\n </div>\n ',document.body.appendChild(this.modalElement),this.videoElement=this.modalElement.querySelector("#ima-video-element"),this.videoContainer=this.modalElement.querySelector(".content-video-vast"),this.closeButton=this.modalElement.querySelector("#close-modal"),this.fallbackOverlay=this.modalElement.querySelector("#aa-vast-fallback-overlay"),this.fallbackTimerEl=this.modalElement.querySelector("#aa-vast-fallback-timer"),this.fallbackSaibaMaisBtn=this.modalElement.querySelector("#aa-vast-fallback-saiba-mais"),!this.videoElement)throw new Error("Video element not found");return this.logger.debug("Modal created successfully"),this.videoElement}catch(e){throw this.logger.error("Error creating modal:",e),e}}getVideoElement(){return this.videoElement}getVideoContainer(){return this.videoContainer}getAdContainer(){return this.modalElement?this.modalElement.querySelector("#ima-ad-container"):null}setCloseCallback(e){this.closeButton&&this.closeButton.addEventListener("click",e)}showFallbackOverlay(e){this.fallbackOverlay&&(this.fallbackOverlay.classList.add("is-visible"),this.fallbackOverlay.setAttribute("aria-hidden","false"),this.fallbackSaibaMaisBtn&&(this.fallbackSaibaMaisBtn.style.display=e?"":"none"),this.logger.debug("Fallback overlay shown"))}hideFallbackOverlay(){this.fallbackOverlay&&(this.fallbackOverlay.classList.remove("is-visible"),this.fallbackOverlay.setAttribute("aria-hidden","true"),this.logger.debug("Fallback overlay hidden"))}updateFallbackTimer(e,t){if(!this.fallbackTimerEl)return;const r=Math.max(0,Math.floor((t||0)-e)),i=Math.floor(r/60),n=r%60;this.fallbackTimerEl.textContent=`Anúncio ${i}:${n.toString().padStart(2,"0")}`}setFallbackSaibaMaisClick(e){this.fallbackSaibaMaisBtn&&this.fallbackSaibaMaisBtn.addEventListener("click",e)}close(){this.modalElement&&(this.modalElement.style.display="none")}hide(){this.modalElement&&(this.modalElement.style.display="none",this.modalElement.style.visibility="hidden",this.logger.debug("Modal hidden (not removed)"))}remove(){this.modalElement&&(document.body.removeChild(this.modalElement),this.modalElement=null)}showVideo(){this.videoElement&&(this.videoElement.style.display="block",this.videoElement.style.visibility="visible",this.logger.debug("Video made visible"))}cleanup(){try{this.closeButton&&(this.closeButton.remove(),this.closeButton=null),this.fallbackOverlay=null,this.fallbackTimerEl=null,this.fallbackSaibaMaisBtn=null,this.videoElement&&(this.videoElement=null),this.videoContainer&&(this.videoContainer.remove(),this.videoContainer=null),this.modalElement&&(this.modalElement.remove(),this.modalElement=null),this.logger.debug("UI cleaned up successfully")}catch(e){this.logger.error("Error cleaning up UI:",e)}}}class J{static show(){if(this.isVisible)return;const e=St.getConfig(),t=e?.primaryColor||"#007bff",r=document.createElement("div");r.id=this.OVERLAY_ID,r.innerHTML=`\n <style>\n #${this.OVERLAY_ID} {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.8);\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n margin: 0;\n padding: 0;\n }\n \n #${this.OVERLAY_ID} .loading-content {\n text-align: center;\n color: white;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n #${this.OVERLAY_ID} .spinner {\n width: 40px;\n height: 40px;\n border: 4px solid rgba(255, 255, 255, 0.3);\n border-top: 4px solid ${t};\n border-radius: 50%;\n animation: spin 1s linear infinite;\n margin-bottom: 16px;\n flex-shrink: 0;\n }\n \n #${this.OVERLAY_ID} .loading-text {\n font-size: 16px;\n font-weight: 500;\n margin: 0;\n line-height: 1.2;\n }\n \n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n </style>\n <div class="loading-content">\n <div class="spinner"></div>\n <p class="loading-text">Carregando Publicidade</p>\n </div>\n `,document.body.appendChild(r),this.isVisible=!0}static hide(){const e=document.getElementById(this.OVERLAY_ID);e&&(e.remove(),this.isVisible=!1)}static isShowing(){return this.isVisible}static forceHide(){const e=document.getElementById(this.OVERLAY_ID);e&&e.remove(),this.isVisible=!1}}function Z(){return!0===St.getConfig()?.enableGPTPpid}function ee(e){if(!e||"string"!=typeof e)return!1;const t=e.trim();return t.length>=1&&t.length<=150}function te(e){if(!Z())return;if(!ee(e))return;if("undefined"==typeof window)return;const t=e.trim();window.googletag=window.googletag||{cmd:[]},window.googletag.cmd.push(()=>{try{"function"==typeof window.googletag?.pubads&&window.googletag.pubads().setPublisherProvidedId(t)}catch{}})}function re(){if(!Z())return;if("undefined"==typeof window||"function"!=typeof window.googletag?.pubads)return;const e=St.getUserData()?.userId;if(e&&ee(e))try{window.googletag.pubads().setPublisherProvidedId(e.trim())}catch{}}function ie(){if("undefined"!=typeof __VERSION__)return __VERSION__;if("undefined"!=typeof process&&process.env?.npm_package_version)return process.env.npm_package_version;try{return"3.7.9"}catch(e){return"unknown"}}function ne(){const e=ie(),t="undefined"!=typeof process&&process.env;return{version:e,isDevelopment:!!t&&"development"===process.env.NODE_ENV,isProduction:!t||"production"===process.env.NODE_ENV,buildTime:(new Date).toISOString()}}J.OVERLAY_ID="akross-loading-overlay",J.isVisible=!1;const ae=ie(),se=ne();class oe{constructor(e){this.overlayElement=null,this.iframeElement=null,this.loadingElement=null,this.errorElement=null,this.retryButton=null,this.closeButton=null,this.isSurveyCompleted=!1,this.isSurveyClosed=!1,this.media=e;const t=St.getDebugMode();this.logger=new y(t),this.mediaResultHelper=new K({userId:St.getUserData()?.userId||"",debug:t})}async start(){try{return this.logger.debug("Starting survey overlay for media:",this.media.title),"survey_v2"!==this.media.type&&"video_v2"!==this.media.type?(this.logger.error("Unsupported media type:",this.media.type),new E({media:this.media,result:e.AAMediaPlayResult.ERROR,error:new u("Unsupported media type")})):this.media.content?.survey?.url?(this.createOverlay(),this.setupEventListeners(),this.loadSurvey(),new Promise(e=>{this.onResultCallback=t=>{let r=this.mediaResultHelper.finishWithResult(t.media,t.result);e(r)}})):(this.logger.error("Survey URL not found"),new E({media:this.media,result:e.AAMediaPlayResult.ERROR,error:new u("Survey URL not found")}))}catch(t){return this.logger.error("Error starting survey overlay:",t),new E({media:this.media,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}createOverlay(){this.overlayElement=document.createElement("div"),this.overlayElement.innerHTML=`\n <style>${oe.OVERLAY_CSS}</style>\n <div class="aa-survey-overlay">\n <div class="aa-survey-dialog">\n <div class="aa-survey-content">\n <iframe class="aa-survey-iframe"></iframe>\n <div class="aa-survey-loading" style="display: none;">\n <div style="width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid #007bff; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 16px;"></div>\n <div style="color: #666; font-size: 14px;">Carregando pesquisa...</div>\n </div>\n <div class="aa-survey-error" style="display: none;">\n <div style="font-size: 48px; margin-bottom: 16px;">⚠️</div>\n <div class="aa-survey-error-message" style="font-size: 16px; color: #666; margin-bottom: 24px;"></div>\n <button style="background-color: #007bff; color: white; border: none; padding: 12px 24px; border-radius: 4px; cursor: pointer; font-size: 14px; transition: background-color 0.2s ease;">Tentar Novamente</button>\n </div>\n </div>\n <button type="button" class="closeButton"></button>\n </div>\n </div>\n `,document.body.appendChild(this.overlayElement),this.iframeElement=this.overlayElement.querySelector(".aa-survey-iframe"),this.loadingElement=this.overlayElement.querySelector(".aa-survey-loading"),this.errorElement=this.overlayElement.querySelector(".aa-survey-error"),this.retryButton=this.overlayElement.querySelector('button[style*="Tentar Novamente"]'),this.closeButton=this.overlayElement.querySelector(".closeButton"),this.applyPrimaryColor(),this.logger.debug("Survey overlay created")}applyPrimaryColor(){const e=St.getConfig(),r=e?t.getPrimaryColor(e,"#007bff"):"#007bff";if(this.loadingElement){const e=this.loadingElement.querySelector('div[style*="border-top"]');e&&(e.style.borderTop=`4px solid ${r}`)}this.retryButton&&(this.retryButton.style.backgroundColor=r,this.retryButton.addEventListener("mouseenter",()=>{this.retryButton.style.backgroundColor=this.darkenColor(r,10)}),this.retryButton.addEventListener("mouseleave",()=>{this.retryButton.style.backgroundColor=r}))}setupEventListeners(){this.retryButton&&this.retryButton.addEventListener("click",()=>{this.hideErrorInterface(),this.loadSurvey()}),this.closeButton&&this.closeButton.addEventListener("click",()=>{this.executeBackButtonLogic()}),document.addEventListener("keydown",e=>{"Escape"===e.key&&this.executeBackButtonLogic()}),this.overlayElement&&this.overlayElement.addEventListener("click",e=>{e.target===this.overlayElement&&this.executeBackButtonLogic()})}loadSurvey(){this.iframeElement&&this.media.content?.survey?.url?(this.logger.debug("Loading survey from URL:",this.media.content.survey.url),this.hideErrorInterface(),this.showLoading(),this.iframeElement.src=this.media.content.survey.url,this.iframeElement.onload=()=>{this.hideLoading(),setTimeout(()=>{this.injectSurveyBridge()},100)},this.iframeElement.onerror=()=>{this.hideLoading(),this.showErrorInterface("Erro ao carregar a pesquisa")}):this.showErrorInterface("URL da pesquisa não encontrada")}injectSurveyBridge(){try{this.setupMessageListener(),this.attemptScriptInjection()}catch(e){this.logger.error("Error setting up survey bridge:",e)}}setupMessageListener(){const e=e=>{const{data:t}=e;t&&"akross-survey"===t.source&&(this.logger.debug("Survey message received from iframe:",t),this.handleSurveyMessage(t))};window.addEventListener("message",e),this._messageHandler=e}attemptScriptInjection(){const e=this.createSurveyBridgeScript(),t=()=>{try{if(!this.iframeElement?.contentWindow)return!1;const t=this.iframeElement.contentDocument||this.iframeElement.contentWindow.document;if(t&&"complete"===t.readyState){const r=t.createElement("script");return r.textContent=e,t.head.appendChild(r),!0}return"function"==typeof this.iframeElement.contentWindow.eval&&(this.iframeElement.contentWindow.eval(e),!0)}catch(e){return!1}};t()||setTimeout(()=>{t()||setTimeout(()=>{t()||setTimeout(()=>{t()},1e3)},500)},200)}createSurveyBridgeScript(){return"\n (function() {\n // Função notifyHost para compatibilidade com SurveyJS\n window.notifyHost = function(eventName, payload) {\n const message = {\n source: 'akross-survey',\n type: eventName,\n payload,\n ts: Date.now()\n };\n\n // 1) iOS WKWebView\n try {\n if (window.webkit?.messageHandlers?.surveyBridge) {\n window.webkit.messageHandlers.surveyBridge.postMessage(message);\n return;\n }\n } catch (error) {\n console.error('❌ NotifyHost: Erro iOS WKWebView:', error);\n }\n\n // 2) Android WebView (via addJavascriptInterface)\n try {\n if (window.AndroidSurveyBridge?.postMessage) {\n // Em Android é comum aceitar string; envie JSON serializado\n window.AndroidSurveyBridge.postMessage(JSON.stringify(message));\n return;\n }\n } catch (error) {\n console.error('❌ NotifyHost: Erro Android WebView:', error);\n }\n\n // 3) Web (iFrame → janela hospedeira)\n if (window.parent && window.parent !== window) {\n window.parent.postMessage(message, '*');\n }\n };\n })();\n "}getSurveyBridgeScript(){return this.createSurveyBridgeScript()}testCommunication(){if(this.logger.debug("Testing communication with iframe"),this.iframeElement?.contentWindow){const e={source:"akross-survey-test",type:"communication_test",payload:{timestamp:Date.now()}};this.iframeElement.contentWindow.postMessage(e,"*")}}handleSurveyMessage(e){try{switch(this.logger.debug("Survey message received:",e),e.type){case"survey_complete":this.handleSurveyComplete(e.payload);break;case"survey_save":this.handleSurveySave(e.payload);break;case"survey_closed":this.handleSurveyClose();break;case"survey_started":this.handleSurveyStarted(e.payload);break;case"survey_progress":this.handleSurveyProgress(e.payload);break;default:this.logger.warn("Unknown message type:",e.type)}}catch(e){this.logger.error("Error processing survey message:",e)}}processPayload(e,t,r){if(this.logger.debug(`${t} with payload:`,e),e){const i=r(e);this.logger.debug(`${t} data:`,i)}}handleSurveyComplete(e){this.processPayload(e,"🎉 Survey Complete Handler",e=>({answers:e.answers,timeSpent:e.timeSpent,completed:e.completed})),this.isSurveyCompleted=!0}handleSurveySave(e){this.processPayload(e,"💾 Survey Save Handler",e=>({progress:e.progress,answers:e.answers,timestamp:(new Date).toISOString()}))}handleSurveyClose(){this.logger.debug("Survey close requested. Completed:",this.isSurveyCompleted),this.isSurveyClosed=!0,this.executeBackButtonLogic()}handleSurveyStarted(e){this.processPayload(e,"🚀 Survey Started Handler",e=>({surveyId:e.surveyId,timestamp:(new Date).toISOString(),userAgent:navigator.userAgent}))}handleSurveyProgress(e){this.processPayload(e,"📊 Survey Progress Handler",e=>({progress:e.progress,currentPage:e.currentPage,totalPages:e.totalPages,timestamp:(new Date).toISOString()}))}executeBackButtonLogic(){this.isSurveyCompleted?this.finishWithResult(e.AAMediaPlayResult.REWARDED):this.finishWithResult(e.AAMediaPlayResult.CANCELED)}finishWithResult(e){if(this.logger.debug("Finishing survey overlay with result:",e),this.cleanup(),this.onResultCallback){const t=new E({media:this.media,result:e});this.onResultCallback(t)}}setElementVisibility(e,t,r="block"){e&&(e.style.display=t?r:"none")}showErrorInterface(e="Erro ao carregar a pesquisa"){if(this.errorElement){const t=this.errorElement.querySelector(".aa-survey-error-message");t&&(t.textContent=e),this.setElementVisibility(this.errorElement,!0,"flex")}this.setElementVisibility(this.iframeElement,!1),this.hideLoading()}hideErrorInterface(){this.setElementVisibility(this.errorElement,!1),this.setElementVisibility(this.iframeElement,!0)}showLoading(){this.setElementVisibility(this.loadingElement,!0)}hideLoading(){this.setElementVisibility(this.loadingElement,!1)}darkenColor(e,t){const r=parseInt(e.replace("#",""),16),i=Math.round(2.55*t),n=(r>>16)-i,a=(r>>8&255)-i,s=(255&r)-i;return"#"+(16777216+65536*(n<255?n<1?0:n:255)+256*(a<255?a<1?0:a:255)+(s<255?s<1?0:s:255)).toString(16).slice(1)}cleanup(){this._messageHandler&&(window.removeEventListener("message",this._messageHandler),this._messageHandler=null),this.overlayElement&&this.overlayElement.parentNode&&this.overlayElement.parentNode.removeChild(this.overlayElement),this.overlayElement=null,this.iframeElement=null,this.loadingElement=null,this.errorElement=null,this.retryButton=null,this.closeButton=null}}oe.OVERLAY_CSS="\n .aa-survey-overlay {\n display: block;\n position: fixed;\n z-index: 1;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .aa-survey-dialog {\n background-color: white;\n border-radius: 8px;\n position: relative;\n width: 100%;\n max-width: 95vw;\n height: 95vh;\n overflow: hidden;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n }\n\n .aa-survey-content {\n display: block;\n width: 100%;\n height: 100%;\n position: relative;\n }\n\n .aa-survey-iframe {\n width: 100%;\n height: 100%;\n border: none;\n }\n\n .aa-survey-loading {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n z-index: 10;\n }\n\n .aa-survey-error {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: white;\n display: none;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding: 20px;\n }\n\n .closeButton {\n display: flex;\n position: absolute;\n top: 10px;\n right: 10px;\n background-color: rgba(0, 0, 0, 0.8);\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-radius: 50%;\n width: 40px;\n height: 40px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n font-size: 0;\n transition: all 0.2s ease;\n z-index: 10;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);\n }\n\n .closeButton::before,\n .closeButton::after {\n content: '';\n position: absolute;\n width: 20px;\n height: 2px;\n background-color: white;\n border-radius: 1px;\n }\n\n .closeButton::before {\n transform: rotate(45deg);\n }\n\n .closeButton::after {\n transform: rotate(-45deg);\n }\n\n .closeButton:hover {\n background-color: rgba(0, 0, 0, 0.9);\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ";var le,ce,de,ue={},he={};function ge(){if(le)return he;function e(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.freeze?t.freeze(e):e}le=1;var t=e({HTML:"text/html",isHTML:function(e){return e===t.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),i={find:function(e,t,r){if(void 0===r&&(r=Array.prototype),e&&"function"==typeof r.find)return r.find.call(e,t);for(var i=0;i<e.length;i++)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];if(t.call(void 0,n,i,e))return n}},freeze:e,NAMESPACE:r},n=i.find,a=i.NAMESPACE;function s(e){return""!==e}function o(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function l(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(s):[]}(e);return Object.keys(t.reduce(o,{}))}function c(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function d(e,t){var r=e.prototype;if(!(r instanceof t)){function i(){}i.prototype=t.prototype,c(r,i=new i),e.prototype=r=i}r.constructor!=e&&(r.constructor=e)}var u={},h=u.ELEMENT_NODE=1,g=u.ATTRIBUTE_NODE=2,p=u.TEXT_NODE=3,m=u.CDATA_SECTION_NODE=4,f=u.ENTITY_REFERENCE_NODE=5,v=u.ENTITY_NODE=6,E=u.PROCESSING_INSTRUCTION_NODE=7,y=u.COMMENT_NODE=8,A=u.DOCUMENT_NODE=9,w=u.DOCUMENT_TYPE_NODE=10,b=u.DOCUMENT_FRAGMENT_NODE=11,R=u.NOTATION_NODE=12,T={},k={};T.INDEX_SIZE_ERR=(k[1]="Index size error",1),T.DOMSTRING_SIZE_ERR=(k[2]="DOMString size error",2);var I=T.HIERARCHY_REQUEST_ERR=(k[3]="Hierarchy request error",3);T.WRONG_DOCUMENT_ERR=(k[4]="Wrong document",4),T.INVALID_CHARACTER_ERR=(k[5]="Invalid character",5),T.NO_DATA_ALLOWED_ERR=(k[6]="No data allowed",6),T.NO_MODIFICATION_ALLOWED_ERR=(k[7]="No modification allowed",7);var S=T.NOT_FOUND_ERR=(k[8]="Not found",8);T.NOT_SUPPORTED_ERR=(k[9]="Not supported",9);var C=T.INUSE_ATTRIBUTE_ERR=(k[10]="Attribute in use",10);function D(e,t){if(t instanceof Error)var r=t;else r=this,Error.call(this,k[e]),this.message=k[e],Error.captureStackTrace&&Error.captureStackTrace(this,D);return r.code=e,t&&(this.message=this.message+": "+t),r}function L(){}function N(e,t){this._node=e,this._refresh=t,M(this)}function M(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(Ae(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var i=r.length;i in e;i++)Object.prototype.hasOwnProperty.call(e,i)&&delete e[i];c(r,e),e._inc=t}}function x(){}function O(e,t){for(var r=e.length;r--;)if(e[r]===t)return r}function P(e,t,r,i){if(i?t[O(t,i)]=r:t[t.length++]=r,e){r.ownerElement=e;var n=e.ownerDocument;n&&(i&&H(n,e,i),function(e,t,r){e&&e._inc++,r.namespaceURI===a.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}(n,e,r))}}function U(e,t,r){var i=O(t,r);if(!(i>=0))throw new D(S,new Error(e.tagName+"@"+r));for(var n=t.length-1;i<n;)t[i]=t[++i];if(t.length=n,e){var a=e.ownerDocument;a&&(H(a,e,r),r.ownerElement=null)}}function V(){}function _(){}function q(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function F(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(F(e,t))return!0}while(e=e.nextSibling)}function B(){this.ownerDocument=this}function H(e,t,r,i){e&&e._inc++,r.namespaceURI===a.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function W(e,t,r){if(e&&e._inc){e._inc++;var i=t.childNodes;if(r)i[i.length++]=r;else{for(var n=t.firstChild,a=0;n;)i[a++]=n,n=n.nextSibling;i.length=a,delete i[i.length]}}}function z(e,t){var r=t.previousSibling,i=t.nextSibling;return r?r.nextSibling=i:e.firstChild=i,i?i.previousSibling=r:e.lastChild=r,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,W(e.ownerDocument,e),t}function K(e){return e&&e.nodeType===_.DOCUMENT_TYPE_NODE}function G(e){return e&&e.nodeType===_.ELEMENT_NODE}function j(e){return e&&e.nodeType===_.TEXT_NODE}function $(e,t){var r=e.childNodes||[];if(n(r,G)||K(t))return!1;var i=n(r,K);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Y(e,t){var r=e.childNodes||[];if(n(r,function(e){return G(e)&&e!==t}))return!1;var i=n(r,K);return!(t&&i&&r.indexOf(i)>r.indexOf(t))}function Q(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===_.DOCUMENT_FRAGMENT_NODE){var s=a.filter(G);if(s.length>1||n(a,j))throw new D(I,"More than one element or text in fragment");if(1===s.length&&!$(e,r))throw new D(I,"Element in fragment can not be inserted before doctype")}if(G(t)&&!$(e,r))throw new D(I,"Only one element can be added and only after doctype");if(K(t)){if(n(i,K))throw new D(I,"Only one doctype is allowed");var o=n(i,G);if(r&&i.indexOf(o)<i.indexOf(r))throw new D(I,"Doctype can only be inserted before an element");if(!r&&o)throw new D(I,"Doctype can not be appended since element is present")}}function X(e,t,r){var i=e.childNodes||[],a=t.childNodes||[];if(t.nodeType===_.DOCUMENT_FRAGMENT_NODE){var s=a.filter(G);if(s.length>1||n(a,j))throw new D(I,"More than one element or text in fragment");if(1===s.length&&!Y(e,r))throw new D(I,"Element in fragment can not be inserted before doctype")}if(G(t)&&!Y(e,r))throw new D(I,"Only one element can be added and only after doctype");if(K(t)){function l(e){return K(e)&&e!==r}if(n(i,l))throw new D(I,"Only one doctype is allowed");var o=n(i,G);if(r&&i.indexOf(o)<i.indexOf(r))throw new D(I,"Doctype can only be inserted before an element")}}function J(e,t,r,i){(function(e,t,r){if(!function(e){return e&&(e.nodeType===_.DOCUMENT_NODE||e.nodeType===_.DOCUMENT_FRAGMENT_NODE||e.nodeType===_.ELEMENT_NODE)}(e))throw new D(I,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new D(S,"child not in parent");if(!function(e){return e&&(G(e)||j(e)||K(e)||e.nodeType===_.DOCUMENT_FRAGMENT_NODE||e.nodeType===_.COMMENT_NODE||e.nodeType===_.PROCESSING_INSTRUCTION_NODE)}(t)||K(t)&&e.nodeType!==_.DOCUMENT_NODE)throw new D(I,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)})(e,t,r),e.nodeType===_.DOCUMENT_NODE&&(i||Q)(e,t,r);var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===b){var a=t.firstChild;if(null==a)return t;var s=t.lastChild}else a=s=t;var o=r?r.previousSibling:e.lastChild;a.previousSibling=o,s.nextSibling=r,o?o.nextSibling=a:e.firstChild=a,null==r?e.lastChild=s:r.previousSibling=s;do{a.parentNode=e}while(a!==s&&(a=a.nextSibling));return W(e.ownerDocument||e,e),t.nodeType==b&&(t.firstChild=t.lastChild=null),t}function Z(){this._nsMap={}}function ee(){}function te(){}function re(){}function ie(){}function ne(){}function ae(){}function se(){}function oe(){}function ce(){}function de(){}function ue(){}function ge(){}function pe(e,t){var r=[],i=9==this.nodeType&&this.documentElement||this,n=i.prefix,a=i.namespaceURI;if(a&&null==n&&null==(n=i.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return ve(this,r,e,t,s),r.join("")}function me(e,t,r){var i=e.prefix||"",n=e.namespaceURI;if(!n)return!1;if("xml"===i&&n===a.XML||n===a.XMLNS)return!1;for(var s=r.length;s--;){var o=r[s];if(o.prefix===i)return o.namespace!==n}return!0}function fe(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,q),'"')}function ve(e,t,r,i,n){if(n||(n=[]),i){if(!(e=i(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case h:var s=e.attributes,o=s.length,l=e.firstChild,c=e.tagName,d=c;if(!(r=a.isHTML(e.namespaceURI)||r)&&!e.prefix&&e.namespaceURI){for(var u,v=0;v<s.length;v++)if("xmlns"===s.item(v).name){u=s.item(v).value;break}if(!u)for(var R=n.length-1;R>=0;R--)if(""===(T=n[R]).prefix&&T.namespace===e.namespaceURI){u=T.namespace;break}if(u!==e.namespaceURI)for(R=n.length-1;R>=0;R--){var T;if((T=n[R]).namespace===e.namespaceURI){T.prefix&&(d=T.prefix+":"+c);break}}}t.push("<",d);for(var k=0;k<o;k++)"xmlns"==(I=s.item(k)).prefix?n.push({prefix:I.localName,namespace:I.value}):"xmlns"==I.nodeName&&n.push({prefix:"",namespace:I.value});for(k=0;k<o;k++){var I,S,C;me(I=s.item(k),0,n)&&(fe(t,(S=I.prefix||"")?"xmlns:"+S:"xmlns",C=I.namespaceURI),n.push({prefix:S,namespace:C})),ve(I,t,r,i,n)}if(c===d&&me(e,0,n)&&(fe(t,(S=e.prefix||"")?"xmlns:"+S:"xmlns",C=e.namespaceURI),n.push({prefix:S,namespace:C})),l||r&&!/^(?:meta|link|img|br|hr|input)$/i.test(c)){if(t.push(">"),r&&/^script$/i.test(c))for(;l;)l.data?t.push(l.data):ve(l,t,r,i,n.slice()),l=l.nextSibling;else for(;l;)ve(l,t,r,i,n.slice()),l=l.nextSibling;t.push("</",d,">")}else t.push("/>");return;case A:case b:for(l=e.firstChild;l;)ve(l,t,r,i,n.slice()),l=l.nextSibling;return;case g:return fe(t,e.name,e.value);case p:return t.push(e.data.replace(/[<&>]/g,q));case m:return t.push("<![CDATA[",e.data,"]]>");case y:return t.push("\x3c!--",e.data,"--\x3e");case w:var D=e.publicId,L=e.systemId;if(t.push("<!DOCTYPE ",e.name),D)t.push(" PUBLIC ",D),L&&"."!=L&&t.push(" ",L),t.push(">");else if(L&&"."!=L)t.push(" SYSTEM ",L,">");else{var N=e.internalSubset;N&&t.push(" [",N,"]"),t.push(">")}return;case E:return t.push("<?",e.target," ",e.data,"?>");case f:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Ee(e,t,r){var i;switch(t.nodeType){case h:(i=t.cloneNode(!1)).ownerDocument=e;case b:break;case g:r=!0}if(i||(i=t.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,r)for(var n=t.firstChild;n;)i.appendChild(Ee(e,n,r)),n=n.nextSibling;return i}function ye(e,t,r){var i=new t.constructor;for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var a=t[n];"object"!=typeof a&&a!=i[n]&&(i[n]=a)}switch(t.childNodes&&(i.childNodes=new L),i.ownerDocument=e,i.nodeType){case h:var s=t.attributes,o=i.attributes=new x,l=s.length;o._ownerElement=i;for(var c=0;c<l;c++)i.setAttributeNode(ye(e,s.item(c),!0));break;case g:r=!0}if(r)for(var d=t.firstChild;d;)i.appendChild(ye(e,d,r)),d=d.nextSibling;return i}function Ae(e,t,r){e[t]=r}T.INVALID_STATE_ERR=(k[11]="Invalid state",11),T.SYNTAX_ERR=(k[12]="Syntax error",12),T.INVALID_MODIFICATION_ERR=(k[13]="Invalid modification",13),T.NAMESPACE_ERR=(k[14]="Invalid namespace",14),T.INVALID_ACCESS_ERR=(k[15]="Invalid access",15),D.prototype=Error.prototype,c(T,D),L.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e,t){for(var r=[],i=0;i<this.length;i++)ve(this[i],r,e,t);return r.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},N.prototype.item=function(e){return M(this),this[e]||null},d(N,L),x.prototype={length:0,item:L.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var r=this[t];if(r.nodeName==e)return r}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new D(C);var r=this.getNamedItem(e.nodeName);return P(this._ownerElement,this,e,r),r},setNamedItemNS:function(e){var t,r=e.ownerElement;if(r&&r!=this._ownerElement)throw new D(C);return t=this.getNamedItemNS(e.namespaceURI,e.localName),P(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return U(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);return U(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){for(var r=this.length;r--;){var i=this[r];if(i.localName==t&&i.namespaceURI==e)return i}return null}},V.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var i=new B;if(i.implementation=this,i.childNodes=new L,i.doctype=r||null,r&&i.appendChild(r),t){var n=i.createElementNS(e,t);i.appendChild(n)}return i},createDocumentType:function(e,t,r){var i=new ae;return i.name=e,i.nodeName=e,i.publicId=t||"",i.systemId=r||"",i}},_.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return J(this,e,t)},replaceChild:function(e,t){J(this,e,t,X),t&&this.removeChild(t)},removeChild:function(e){return z(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return ye(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==p&&e.nodeType==p?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)&&r[i]===e)return i;t=t.nodeType==g?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&Object.prototype.hasOwnProperty.call(r,e))return r[e];t=t.nodeType==g?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},c(u,_),c(u,_.prototype),B.prototype={nodeName:"#document",nodeType:A,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==b){for(var r=e.firstChild;r;){var i=r.nextSibling;this.insertBefore(r,t),r=i}return e}return J(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===h&&(this.documentElement=e),e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),z(this,e)},replaceChild:function(e,t){J(this,e,t,X),e.ownerDocument=this,t&&this.removeChild(t),G(e)&&(this.documentElement=e)},importNode:function(e,t){return Ee(this,e,t)},getElementById:function(e){var t=null;return F(this.documentElement,function(r){if(r.nodeType==h&&r.getAttribute("id")==e)return t=r,!0}),t},getElementsByClassName:function(e){var t=l(e);return new N(this,function(r){var i=[];return t.length>0&&F(r.documentElement,function(n){if(n!==r&&n.nodeType===h){var a=n.getAttribute("class");if(a){var s=e===a;if(!s){var o=l(a);s=t.every((c=o,function(e){return c&&-1!==c.indexOf(e)}))}s&&i.push(n)}}var c}),i})},createElement:function(e){var t=new Z;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new L,(t.attributes=new x)._ownerElement=t,t},createDocumentFragment:function(){var e=new de;return e.ownerDocument=this,e.childNodes=new L,e},createTextNode:function(e){var t=new re;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new ie;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new ne;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new ue;return r.ownerDocument=this,r.tagName=r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){var t=new ee;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new ce;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var r=new Z,i=t.split(":"),n=r.attributes=new x;return r.childNodes=new L,r.ownerDocument=this,r.nodeName=t,r.tagName=t,r.namespaceURI=e,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,n._ownerElement=r,r},createAttributeNS:function(e,t){var r=new ee,i=t.split(":");return r.ownerDocument=this,r.nodeName=t,r.name=t,r.namespaceURI=e,r.specified=!0,2==i.length?(r.prefix=i[0],r.localName=i[1]):r.localName=t,r}},d(B,_),Z.prototype={nodeType:h,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var r=this.ownerDocument.createAttribute(e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===b?this.insertBefore(e,null):function(e,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=e,t.previousSibling=e.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:e.firstChild=t,e.lastChild=t,W(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);r&&this.removeAttributeNode(r)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var r=this.getAttributeNodeNS(e,t);return r&&r.value||""},setAttributeNS:function(e,t,r){var i=this.ownerDocument.createAttributeNS(e,t);i.value=i.nodeValue=""+r,this.setAttributeNode(i)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new N(this,function(t){var r=[];return F(t,function(i){i===t||i.nodeType!=h||"*"!==e&&i.tagName!=e||r.push(i)}),r})},getElementsByTagNameNS:function(e,t){return new N(this,function(r){var i=[];return F(r,function(n){n===r||n.nodeType!==h||"*"!==e&&n.namespaceURI!==e||"*"!==t&&n.localName!=t||i.push(n)}),i})}},B.prototype.getElementsByTagName=Z.prototype.getElementsByTagName,B.prototype.getElementsByTagNameNS=Z.prototype.getElementsByTagNameNS,d(Z,_),ee.prototype.nodeType=g,d(ee,_),te.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(k[I])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,r){r=this.data.substring(0,e)+r+this.data.substring(e+t),this.nodeValue=this.data=r,this.length=r.length}},d(te,_),re.prototype={nodeName:"#text",nodeType:p,splitText:function(e){var t=this.data,r=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(r);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},d(re,te),ie.prototype={nodeName:"#comment",nodeType:y},d(ie,te),ne.prototype={nodeName:"#cdata-section",nodeType:m},d(ne,te),ae.prototype.nodeType=w,d(ae,_),se.prototype.nodeType=R,d(se,_),oe.prototype.nodeType=v,d(oe,_),ce.prototype.nodeType=f,d(ce,_),de.prototype.nodeName="#document-fragment",de.prototype.nodeType=b,d(de,_),ue.prototype.nodeType=E,d(ue,_),ge.prototype.serializeToString=function(e,t,r){return pe.call(e,t,r)},_.prototype.toString=pe;try{if(Object.defineProperty){function et(e){switch(e.nodeType){case h:case b:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(et(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(N.prototype,"length",{get:function(){return M(this),this.$$length}}),Object.defineProperty(_.prototype,"textContent",{get:function(){return et(this)},set:function(e){switch(this.nodeType){case h:case b:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),Ae=function(e,t,r){e["$$"+t]=r}}}catch(tt){}var we,be,Re=V,Te=ge,ke=(we=function(e,t){var r=i.freeze;t.XML_ENTITIES=r({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=r({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES},we(be={path:void 0,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&be.path)}},be.exports),be.exports),Ie=i.NAMESPACE,Se=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Ce=new RegExp("[\\-\\.0-9"+Se.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),De=new RegExp("^"+Se.source+Ce.source+"*(?::"+Se.source+Ce.source+"*)?$");function Le(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Le)}function Ne(){}function Me(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function xe(e,t,r,i,n,a){function s(e,t,i){r.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),r.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,n),i)}for(var o,l=++t,c=0;;){var d=e.charAt(l);switch(d){case"=":if(1===c)o=e.slice(t,l),c=3;else{if(2!==c)throw new Error("attribute equal must after attrName");c=3}break;case"'":case'"':if(3===c||1===c){if(1===c&&(a.warning('attribute value must after "="'),o=e.slice(t,l)),t=l+1,!((l=e.indexOf(d,t))>0))throw new Error("attribute value no end '"+d+"' match");s(o,u=e.slice(t,l),t-1),c=5}else{if(4!=c)throw new Error('attribute value must after "="');s(o,u=e.slice(t,l),t),a.warning('attribute "'+o+'" missed start quot('+d+")!!"),t=l+1,c=5}break;case"/":switch(c){case 0:r.setTagName(e.slice(t,l));case 5:case 6:case 7:c=7,r.closed=!0;case 4:case 1:break;case 2:r.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==c&&r.setTagName(e.slice(t,l)),l;case">":switch(c){case 0:r.setTagName(e.slice(t,l));case 5:case 6:case 7:break;case 4:case 1:"/"===(u=e.slice(t,l)).slice(-1)&&(r.closed=!0,u=u.slice(0,-1));case 2:2===c&&(u=o),4==c?(a.warning('attribute "'+u+'" missed quot(")!'),s(o,u,t)):(Ie.isHTML(i[""])&&u.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),s(u,u,t));break;case 3:throw new Error("attribute value missed!!")}return l;case"€":d=" ";default:if(d<=" ")switch(c){case 0:r.setTagName(e.slice(t,l)),c=6;break;case 1:o=e.slice(t,l),c=2;break;case 4:var u=e.slice(t,l);a.warning('attribute "'+u+'" missed quot(")!!'),s(o,u,t);case 5:c=6}else switch(c){case 2:r.tagName,Ie.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=l,c=1;break;case 5:a.warning('attribute space is required"'+o+'"!!');case 6:c=1,t=l;break;case 3:c=4,t=l;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function Oe(e,t,r){for(var i=e.tagName,n=null,a=e.length;a--;){var s=e[a],o=s.qName,l=s.value;if((h=o.indexOf(":"))>0)var c=s.prefix=o.slice(0,h),d=o.slice(h+1),u="xmlns"===c&&d;else d=o,c=null,u="xmlns"===o&&"";s.localName=d,!1!==u&&(null==n&&(n={},Ve(r,r={})),r[u]=n[u]=l,s.uri=Ie.XMLNS,t.startPrefixMapping(u,l))}for(a=e.length;a--;)(c=(s=e[a]).prefix)&&("xml"===c&&(s.uri=Ie.XML),"xmlns"!==c&&(s.uri=r[c||""]));var h;(h=i.indexOf(":"))>0?(c=e.prefix=i.slice(0,h),d=e.localName=i.slice(h+1)):(c=null,d=e.localName=i);var g=e.uri=r[c||""];if(t.startElement(g,d,i,e),!e.closed)return e.currentNSMap=r,e.localNSMap=n,!0;if(t.endElement(g,d,i),n)for(c in n)Object.prototype.hasOwnProperty.call(n,c)&&t.endPrefixMapping(c)}function Pe(e,t,r,i,n){if(/^(?:script|textarea)$/i.test(r)){var a=e.indexOf("</"+r+">",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(r)?(n.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,i),n.characters(s,0,s.length),a)}return t+1}function Ue(e,t,r,i){var n=i[r];return null==n&&((n=e.lastIndexOf("</"+r+">"))<t&&(n=e.lastIndexOf("</"+r)),i[r]=n),n<t}function Ve(e,t){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}function _e(e,t,r,i){if("-"===e.charAt(t+2))return"-"===e.charAt(t+3)?(n=e.indexOf("--\x3e",t+4))>t?(r.comment(e,t+4,n-t-4),n+3):(i.error("Unclosed comment"),-1):-1;if("CDATA["==e.substr(t+3,6)){var n=e.indexOf("]]>",t+9);return r.startCDATA(),r.characters(e,t+9,n-t-9),r.endCDATA(),n+3}var a=function(e,t){var r,i=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(n.lastIndex=t,n.exec(e);r=n.exec(e);)if(i.push(r),r[1])return i}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],l=!1,c=!1;s>3&&(/^public$/i.test(a[2][0])?(l=a[3][0],c=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(c=a[3][0]));var d=a[s-1];return r.startDTD(o,l,c),r.endDTD(),d.index+d[0].length}return-1}function qe(e,t,r){var i=e.indexOf("?>",t);if(i){var n=e.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(n[0].length,r.processingInstruction(n[1],n[2]),i+2):-1}return-1}function Fe(){this.attributeNames={}}Le.prototype=new Error,Le.prototype.name=Le.name,Ne.prototype={parse:function(e,t,r){var i=this.domBuilder;i.startDocument(),Ve(t,t={}),function(e,t,r,i,n){function a(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(r,t)?r[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(n.error("entity not found:"+e),e)}function s(t){if(t>p){var r=e.substring(p,t).replace(/&#?\w+;/g,a);u&&o(p),i.characters(r,0,t-p),p=t}}function o(t,r){for(;t>=c&&(r=d.exec(e));)l=r.index,c=l+r[0].length,u.lineNumber++;u.columnNumber=t-l+1}for(var l=0,c=0,d=/.*(?:\r\n?|\n)|.*$/g,u=i.locator,h=[{currentNSMap:t}],g={},p=0;;){try{var m=e.indexOf("<",p);if(m<0){if(!e.substr(p).match(/^\s*$/)){var f=i.doc,v=f.createTextNode(e.substr(p));f.appendChild(v),i.currentElement=v}return}switch(m>p&&s(m),e.charAt(m+1)){case"/":var E=e.indexOf(">",m+3),y=e.substring(m+2,E).replace(/[ \t\n\r]+$/g,""),A=h.pop();E<0?(y=e.substring(m+2).replace(/[\s<].*/,""),n.error("end tag name: "+y+" is not complete:"+A.tagName),E=m+1+y.length):y.match(/\s</)&&(y=y.replace(/[\s<].*/,""),n.error("end tag name: "+y+" maybe not complete"),E=m+1+y.length);var w=A.localNSMap,b=A.tagName==y;if(b||A.tagName&&A.tagName.toLowerCase()==y.toLowerCase()){if(i.endElement(A.uri,A.localName,y),w)for(var R in w)Object.prototype.hasOwnProperty.call(w,R)&&i.endPrefixMapping(R);b||n.fatalError("end tag name: "+y+" is not match the current start tagName:"+A.tagName)}else h.push(A);E++;break;case"?":u&&o(m),E=qe(e,m,i);break;case"!":u&&o(m),E=_e(e,m,i,n);break;default:u&&o(m);var T=new Fe,k=h[h.length-1].currentNSMap,I=(E=xe(e,m,T,k,a,n),T.length);if(!T.closed&&Ue(e,E,T.tagName,g)&&(T.closed=!0,r.nbsp||n.warning("unclosed xml attribute")),u&&I){for(var S=Me(u,{}),C=0;C<I;C++){var D=T[C];o(D.offset),D.locator=Me(u,{})}i.locator=S,Oe(T,i,k)&&h.push(T),i.locator=u}else Oe(T,i,k)&&h.push(T);Ie.isHTML(T.uri)&&!T.closed?E=Pe(e,E,T.tagName,a,i):E++}}catch(e){if(e instanceof Le)throw e;n.error("element parse error: "+e),E=-1}E>p?p=E:s(Math.max(m,p)+1)}}(e,t,r,i,this.errorHandler),i.endDocument()}},Fe.prototype={setTagName:function(e){if(!De.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,r){if(!De.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:r}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};var Be=Re,He=i.NAMESPACE,We=Le,ze=Ne;function Ke(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function Ge(e){this.options=e||{locator:{}}}function je(){this.cdata=!1}function $e(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Ye(e,t,r){return"string"==typeof e?e.substr(t,r):e.length>=t+r||t?new java.lang.String(e,t,r)+"":e}function Qe(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}Ge.prototype.parseFromString=function(e,t){var r=this.options,i=new ze,n=r.domBuilder||new je,a=r.errorHandler,s=r.locator,o=r.xmlns||{},l=/\/x?html?$/.test(t),c=l?ke.HTML_ENTITIES:ke.XML_ENTITIES;s&&n.setDocumentLocator(s),i.errorHandler=function(e,t,r){if(!e){if(t instanceof je)return t;e=t}var i={},n=e instanceof Function;function a(t){var a=e[t];!a&&n&&(a=2==e.length?function(r){e(t,r)}:e),i[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+function(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(r))}||function(){}}return r=r||{},a("warning"),a("error"),a("fatalError"),i}(a,n,s),i.domBuilder=r.domBuilder||n,l&&(o[""]=He.HTML),o.xml=o.xml||He.XML;var d=r.normalizeLineEndings||Ke;return e&&"string"==typeof e?i.parse(d(e),o,c):i.errorHandler.error("invalid doc source"),n.doc},je.prototype={startDocument:function(){this.doc=(new Be).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,r,i){var n=this.doc,a=n.createElementNS(e,r||t),s=i.length;Qe(this,a),this.currentElement=a,this.locator&&$e(this.locator,a);for(var o=0;o<s;o++){e=i.getURI(o);var l=i.getValue(o),c=(r=i.getQName(o),n.createAttributeNS(e,r));this.locator&&$e(i.getLocator(o),c),c.value=c.nodeValue=l,a.setAttributeNode(c)}},endElement:function(e,t,r){var i=this.currentElement;i.tagName,this.currentElement=i.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&$e(this.locator,r),Qe(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=Ye.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(e);else i=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(e)&&this.doc.appendChild(i),this.locator&&$e(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,r){e=Ye.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&$e(this.locator,i),Qe(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r){var i=this.doc.implementation;if(i&&i.createDocumentType){var n=i.createDocumentType(e,t,r);this.locator&&$e(this.locator,n),Qe(this,n),this.doc.doctype=n}},warning:function(e){},error:function(e){},fatalError:function(e){throw new We(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){je.prototype[e]=function(){return null}});var Xe={DOMParser:Ge}.DOMParser,Je={DOMImplementation:Re,XMLSerializer:Te,DOMParser:Xe},Ze=function(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}({__proto__:null,default:Je,DOMImplementation:Re,XMLSerializer:Te,DOMParser:Xe},[Je]);return he.index=Ze,he}function pe(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adId:e.adId||null,sequence:e.sequence||null,apiFramework:e.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}Object.defineProperty(ue,"__esModule",{value:!0});const me=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function fe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=[],n=ye(e);!t.ERRORCODE||r.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=Te(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING;for(const e in t)t[e]=Re(t[e]);for(const e in n){const r=n[e];"string"==typeof r&&i.push(ve(r,t))}return i}function ve(e,t){const r=(e=Ee(e,t)).match(/[^[\]]+(?=])/g);if(!r)return e;let i=r.filter(e=>me.indexOf(e)>-1);return 0===i.length?e:(i=i.reduce((e,t)=>(e[t]=-1,e),{}),Ee(e,i))}function Ee(e,t){let r=e;for(const e in t){const i=t[e];r=r.replace(new RegExp("(?:\\[|%%)(".concat(e,")(?:\\]|%%)"),"g"),i)}return r}function ye(e){return Array.isArray(e)?e.map(e=>e&&e.hasOwnProperty("url")?e.url:e):e}function Ae(e){return/^(https?:\/\/|\/\/)/.test(e)}function we(e,t){for(let r=0;r<t.length;r++)if(be(t[r],e))return!0;return!1}function be(e,t){if(e&&t){const r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);return r.length===i.length&&e.id===t.id&&e.url===t.url}return!1}function Re(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function Te(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}const ke={track:function(e,t,r){fe(e,t,r).forEach(e=>{"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:fe,extractURLsFromTemplates:ye,filterUrlTemplates:function(e){return e.reduce((e,t)=>{const r=t.url||t;return Ae(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:we,isTemplateObjectEqual:be,encodeURIComponentRFC3986:Re,replaceUrlMacros:ve,isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},flatten:function e(t){return t.reduce((t,r)=>t.concat(Array.isArray(r)?e(r):r),[])},joinArrayOfUniqueTemplateObjs:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=Array.isArray(e)?e:[],i=Array.isArray(t)?t:[];return r.concat(i).reduce((e,t)=>(we(t,e)||e.push(t),e),[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:Te,isValidUrl:Ae,isBrowserEnvironment:function(){return"undefined"!=typeof window},formatMacrosValues:function(e){return"object"!=typeof e?e:JSON.stringify(e)}};function Ie(e){return["true","TRUE","True","1"].includes(e)}function Se(e){if(null==e)return-1;if(ke.isNumeric(e))return parseInt(e);const t=e.split(":");if(3!==t.length)return-1;const r=t[2].split(".");let i=parseInt(r[0]);2===r.length&&(i+=parseFloat("0.".concat(r[1])));const n=parseInt(60*t[1]),a=parseInt(60*t[0]*60);return isNaN(a)||isNaN(n)||isNaN(i)||n>3600||i>60?-1:a+n+i}const Ce={childByName:function(e,t){return Array.from(e.childNodes).find(e=>e.nodeName===t)},childrenByName:function(e,t){return Array.from(e.childNodes).filter(e=>e.nodeName===t)},resolveVastAdTagURI:function(e,t){if(!t)return e;if(e.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(e)}if(!e.includes("://")){const r=t.slice(0,t.lastIndexOf("/"));return"".concat(r,"/").concat(e)}return e},parseBoolean:Ie,parseNodeText:function(e){return e&&(e.textContent||e.text||"").trim()},copyNodeAttribute:function(e,t,r){const i=t.getAttribute(e);i&&r.setAttribute(e,i)},parseAttributes:function(e){return Array.from(e.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:Se,getStandAloneAds:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>!parseInt(e.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>parseInt(e.sequence,10)).sort((e,t)=>e.sequence-t.sequence)},assignAttributes:function(e,t){e&&Array.from(e).forEach(e=>{let{nodeName:r,nodeValue:i}=e;if(r&&i&&t.hasOwnProperty(r)){let e=i;"boolean"==typeof t[r]&&(e=Ie(e)),t[r]=e}})},mergeWrapperAdData:function(e,t){var r;e.errorURLTemplates=t.errorURLTemplates.concat(e.errorURLTemplates),e.impressionURLTemplates=t.impressionURLTemplates.concat(e.impressionURLTemplates),e.extensions=t.extensions.concat(e.extensions),t.viewableImpression.length>0&&(e.viewableImpression=[...e.viewableImpression,...t.viewableImpression]),e.followAdditionalWrappers=t.followAdditionalWrappers,e.allowMultipleAds=t.allowMultipleAds,e.fallbackOnNoAd=t.fallbackOnNoAd;const i=(t.creatives||[]).filter(e=>e&&"companion"===e.type),n=i.reduce((e,t)=>((t.variations||[]).forEach(t=>{(t.companionClickTrackingURLTemplates||[]).forEach(t=>{ke.containsTemplateObject(t,e)||e.push(t)})}),e),[]);e.creatives=i.concat(e.creatives);const a=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,s=t.videoCustomClickURLTemplates&&t.videoCustomClickURLTemplates.length;if(e.creatives.forEach(e=>{if(t.trackingEvents&&t.trackingEvents[e.type])for(const r in t.trackingEvents[e.type]){const i=t.trackingEvents[e.type][r];Array.isArray(e.trackingEvents[r])||(e.trackingEvents[r]=[]),e.trackingEvents[r]=e.trackingEvents[r].concat(i)}"linear"===e.type&&(a&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),s&&(e.videoCustomClickURLTemplates=e.videoCustomClickURLTemplates.concat(t.videoCustomClickURLTemplates)),!t.videoClickThroughURLTemplate||null!==e.videoClickThroughURLTemplate&&void 0!==e.videoClickThroughURLTemplate||(e.videoClickThroughURLTemplate=t.videoClickThroughURLTemplate)),"companion"===e.type&&n.length&&(e.variations||[]).forEach(e=>{e.companionClickTrackingURLTemplates=ke.joinArrayOfUniqueTemplateObjs(e.companionClickTrackingURLTemplates,n)})}),t.adVerifications&&(e.adVerifications=e.adVerifications.concat(t.adVerifications)),t.blockedAdCategories&&(e.blockedAdCategories=e.blockedAdCategories.concat(t.blockedAdCategories)),null!==(r=t.creatives)&&void 0!==r&&r.length){const r=t.creatives.filter(e=>{var t;return(null===(t=e.icons)||void 0===t?void 0:t.length)&&!e.mediaFiles.length});r.length&&(e.creatives=e.creatives.concat(r))}}};function De(e,t){const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=pe(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"companion",required:null,variations:[]}}(t);return r.required=e.getAttribute("required")||null,r.variations=Ce.childrenByName(e,"Companion").map(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,adType:"companionAd",width:e.width||0,height:e.height||0,assetWidth:e.assetWidth||null,assetHeight:e.assetHeight||null,expandedWidth:e.expandedWidth||null,expandedHeight:e.expandedHeight||null,apiFramework:e.apiFramework||null,adSlotId:e.adSlotId||null,pxratio:e.pxratio||"1",renderingMode:e.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(Ce.parseAttributes(e));t.htmlResources=Ce.childrenByName(e,"HTMLResource").reduce((e,t)=>{const r=Ce.parseNodeText(t);return r?e.concat(r):e},[]),t.iframeResources=Ce.childrenByName(e,"IFrameResource").reduce((e,t)=>{const r=Ce.parseNodeText(t);return r?e.concat(r):e},[]),t.staticResources=Ce.childrenByName(e,"StaticResource").reduce((e,t)=>{const r=Ce.parseNodeText(t);return r?e.concat({url:r,creativeType:t.getAttribute("creativeType")||null}):e},[]),t.altText=Ce.parseNodeText(Ce.childByName(e,"AltText"))||null;const r=Ce.childByName(e,"TrackingEvents");r&&Ce.childrenByName(r,"Tracking").forEach(e=>{const r=e.getAttribute("event"),i=Ce.parseNodeText(e);r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))}),t.companionClickTrackingURLTemplates=Ce.childrenByName(e,"CompanionClickTracking").map(e=>({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)})),t.companionClickThroughURLTemplate=Ce.parseNodeText(Ce.childByName(e,"CompanionClickThrough"))||null;const i=Ce.childByName(e,"AdParameters");return i&&(t.adParameters={value:Ce.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t}),r}function Le(e,t){let r;const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=pe(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(t);i.duration=Ce.parseDuration(Ce.parseNodeText(Ce.childByName(e,"Duration")));const n=e.getAttribute("skipoffset");if(null==n)i.skipDelay=null;else if("%"===n.charAt(n.length-1)&&-1!==i.duration){const e=parseInt(n,10);i.skipDelay=i.duration*(e/100)}else i.skipDelay=Ce.parseDuration(n);const a=Ce.childByName(e,"VideoClicks");if(a){const e=Ce.childByName(a,"ClickThrough");i.videoClickThroughURLTemplate=e?{id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)}:null,Ce.childrenByName(a,"ClickTracking").forEach(e=>{i.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)})}),Ce.childrenByName(a,"CustomClick").forEach(e=>{i.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)})})}const s=Ce.childByName(e,"AdParameters");s&&(i.adParameters={value:Ce.parseNodeText(s),xmlEncoded:s.getAttribute("xmlEncoded")||null}),Ce.childrenByName(e,"TrackingEvents").forEach(e=>{Ce.childrenByName(e,"Tracking").forEach(e=>{let t=e.getAttribute("event");const n=Ce.parseNodeText(e);if(t&&n){if("progress"===t){if(r=e.getAttribute("offset"),!r)return;t="%"===r.charAt(r.length-1)?"progress-".concat(r):"progress-".concat(Ce.parseDuration(r))}Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(n)}})}),Ce.childrenByName(e,"MediaFiles").forEach(e=>{Ce.childrenByName(e,"MediaFile").forEach(e=>{i.mediaFiles.push(function(e){const t={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};t.id=e.getAttribute("id"),t.fileURL=Ce.parseNodeText(e),t.deliveryType=e.getAttribute("delivery"),t.codec=e.getAttribute("codec"),t.mimeType=e.getAttribute("type"),t.mediaType=e.getAttribute("mediaType")||"2D",t.apiFramework=e.getAttribute("apiFramework"),t.fileSize=parseInt(e.getAttribute("fileSize")||0),t.bitrate=parseInt(e.getAttribute("bitrate")||0),t.minBitrate=parseInt(e.getAttribute("minBitrate")||0),t.maxBitrate=parseInt(e.getAttribute("maxBitrate")||0),t.width=parseInt(e.getAttribute("width")||0),t.height=parseInt(e.getAttribute("height")||0);const r=e.getAttribute("scalable");r&&"string"==typeof r&&(t.scalable=Ce.parseBoolean(r));const i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=Ce.parseBoolean(i)),t}(e))});const t=Ce.childByName(e,"InteractiveCreativeFile");t&&(i.interactiveCreativeFile=function(e){const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,apiFramework:e.apiFramework||null,variableDuration:Ce.parseBoolean(e.variableDuration),fileURL:null}}(Ce.parseAttributes(e));return t.fileURL=Ce.parseNodeText(e),t}(t));const r=Ce.childByName(e,"ClosedCaptionFiles");r&&Ce.childrenByName(r,"ClosedCaptionFile").forEach(e=>{const t=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:e.type||null,language:e.language||null,fileURL:null}}(Ce.parseAttributes(e));t.fileURL=Ce.parseNodeText(e),i.closedCaptionFiles.push(t)});const n=Ce.childByName(e,"Mezzanine"),a=function(e){const t={};let r=!1;return["delivery","type","width","height"].forEach(i=>{e&&e.getAttribute(i)?t[i]=e.getAttribute(i):r=!0}),r?null:t}(n);if(a){const e={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};e.id=n.getAttribute("id"),e.fileURL=Ce.parseNodeText(n),e.delivery=a.delivery,e.codec=n.getAttribute("codec"),e.type=a.type,e.width=parseInt(a.width,10),e.height=parseInt(a.height,10),e.fileSize=parseInt(n.getAttribute("fileSize"),10),e.mediaType=n.getAttribute("mediaType")||"2D",i.mezzanine=e}});const o=Ce.childByName(e,"Icons");return o&&Ce.childrenByName(o,"Icon").forEach(e=>{i.icons.push(function(e){const t={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[],altText:null,hoverText:null};t.program=e.getAttribute("program"),t.height=parseInt(e.getAttribute("height")||0),t.width=parseInt(e.getAttribute("width")||0),t.xPosition=function(e){return-1!==["left","right"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("xPosition")),t.yPosition=function(e){return-1!==["top","bottom"].indexOf(e)?e:parseInt(e||0)}(e.getAttribute("yPosition")),t.apiFramework=e.getAttribute("apiFramework"),t.pxratio=e.getAttribute("pxratio")||"1",t.offset=Ce.parseDuration(e.getAttribute("offset")),t.duration=Ce.parseDuration(e.getAttribute("duration")),t.altText=e.getAttribute("altText"),t.hoverText=e.getAttribute("hoverText"),Ce.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=Ce.parseNodeText(e)}),Ce.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=Ce.parseNodeText(e)}),Ce.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=Ce.parseNodeText(e)});const r=Ce.childByName(e,"IconClicks");if(r){t.iconClickThroughURLTemplate=Ce.parseNodeText(Ce.childByName(r,"IconClickThrough")),Ce.childrenByName(r,"IconClickTracking").forEach(e=>{t.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)})});const e=Ce.childByName(r,"IconClickFallbackImages");e&&Ce.childrenByName(e,"IconClickFallbackImage").forEach(e=>{t.iconClickFallbackImages.push({url:Ce.parseNodeText(e)||null,width:e.getAttribute("width")||null,height:e.getAttribute("height")||null})})}return t.iconViewTrackingURLTemplate=Ce.parseNodeText(Ce.childByName(e,"IconViewTracking")),t}(e))}),i}function Ne(e,t){const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{id:t,adId:r,sequence:i,apiFramework:n}=pe(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return Ce.childrenByName(e,"TrackingEvents").forEach(e=>{let t,i;Ce.childrenByName(e,"Tracking").forEach(e=>{t=e.getAttribute("event"),i=Ce.parseNodeText(e),t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))})}),Ce.childrenByName(e,"NonLinear").forEach(e=>{const t={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};t.id=e.getAttribute("id")||null,t.width=e.getAttribute("width"),t.height=e.getAttribute("height"),t.expandedWidth=e.getAttribute("expandedWidth"),t.expandedHeight=e.getAttribute("expandedHeight"),t.scalable=Ce.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=Ce.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=Ce.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),Ce.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=Ce.parseNodeText(e)}),Ce.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=Ce.parseNodeText(e)}),Ce.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=Ce.parseNodeText(e)});const i=Ce.childByName(e,"AdParameters");i&&(t.adParameters={value:Ce.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t.nonlinearClickThroughURLTemplate=Ce.parseNodeText(Ce.childByName(e,"NonLinearClickThrough")),Ce.childrenByName(e,"NonLinearClickTracking").forEach(e=>{t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)})}),r.variations.push(t)}),r}function Me(e){const t=[];return e.forEach(e=>{const r=xe(e);r&&t.push(r)}),t}function xe(e){if("#comment"===e.nodeName)return null;const t={name:null,value:null,attributes:{},children:[]},r=e.attributes,i=e.childNodes;if(t.name=e.nodeName,e.attributes)for(const e in r)if(r.hasOwnProperty(e)){const i=r[e];i.nodeName&&i.nodeValue&&(t.attributes[i.nodeName]=i.nodeValue)}for(const e in i)if(i.hasOwnProperty(e)){const r=xe(i[e]);r&&t.children.push(r)}if(0===t.children.length||1===t.children.length&&["#cdata-section","#text"].indexOf(t.children[0].name)>=0){const r=Ce.parseNodeText(e);""!==r&&(t.value=r),t.children=[]}return null===(n=t).value&&0===Object.keys(n.attributes).length&&0===n.children.length?null:t;var n}function Oe(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}const Pe={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function Ue(e,t){let{name:r,parentName:i,attributes:n,subElements:a,oneOfResources:s}=e,o="Element '".concat(r,"'");o+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):a?" missing required sub element(s) '".concat(a.join(", "),"' "):s?" must provide one of the following '".concat(s.join(", "),"' "):" is empty",t("VAST-warning",{message:o,parentElement:i,specVersion:4.1})}const Ve=function e(t,r,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),function(e,t){if(!Pe[e.nodeName]||!Pe[e.nodeName].attributes)return;const r=Pe[e.nodeName].attributes.filter(t=>!e.getAttribute(t));r.length>0&&Ue({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:r},t)}(t,r),function(e){return e.children&&0!==e.children.length}(t)){!function(e,t,r){const i=Pe[e.nodeName],n=!r&&"Wrapper"!==e.nodeName;if(i&&!n){if(i.subElements){const r=i.subElements.filter(t=>!Ce.childByName(e,t));r.length>0&&Ue({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:r},t)}r&&i.oneOfinLineResources&&(i.oneOfinLineResources.some(t=>Ce.childByName(e,t))||Ue({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}(t,r,i);for(let n=0;n<t.children.length;n++)e(t.children[n],r,i)}else 0===Ce.parseNodeText(t).length&&Ue({name:t.nodeName,parentName:t.parentNode.nodeName},r)};function _e(e,t){let{allowMultipleAds:r,followAdditionalWrappers:i}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const n=Array.from(e.childNodes).filter(e=>{const t=e.nodeName.toLowerCase();return"inline"===t||!1!==i&&"wrapper"===t});for(const i of n){if(Ce.copyNodeAttribute("id",e,i),Ce.copyNodeAttribute("sequence",e,i),Ce.copyNodeAttribute("adType",e,i),"Wrapper"===i.nodeName)return{ad:Be(i,t),type:"WRAPPER"};if("InLine"===i.nodeName)return{ad:qe(i,t,{allowMultipleAds:r}),type:"INLINE"};const n=i.nodeName.toLowerCase();t("VAST-warning",{message:"<".concat(i.nodeName,"inline"===n?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:i})}}function qe(e,t){let{allowMultipleAds:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return!1===r&&e.getAttribute("sequence")?null:Fe(e,t)}function Fe(e,t){let r=[];t&&Ve(e,t);const i=Array.from(e.childNodes),n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{id:e.id||null,sequence:e.sequence||null,adType:e.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(Ce.parseAttributes(e));return i.forEach(e=>{switch(e.nodeName){case"Error":n.errorURLTemplates.push(Ce.parseNodeText(e));break;case"Impression":n.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:Ce.parseNodeText(e)});break;case"Creatives":n.creatives=function(e){const t=[];return e.forEach(e=>{const r={id:e.getAttribute("id")||null,adId:Oe(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},i=[];let n;Ce.childrenByName(e,"UniversalAdId").forEach(e=>{const t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:Ce.parseNodeText(e)};i.push(t)});const a=Ce.childByName(e,"CreativeExtensions");a&&(n=Me(Ce.childrenByName(a,"CreativeExtension")));for(const a in e.childNodes){const s=e.childNodes[a];let o;switch(s.nodeName){case"Linear":o=Le(s,r);break;case"NonLinearAds":o=Ne(s,r);break;case"CompanionAds":o=De(s,r)}o&&(i&&(o.universalAdIds=i),n&&(o.creativeExtensions=n),t.push(o))}}),t}(Ce.childrenByName(e,"Creative"));break;case"Extensions":{const t=Ce.childrenByName(e,"Extension");n.extensions=Me(t),n.adVerifications.length||(r=function(e){let t=null,r=[];return e.some(e=>t=Ce.childByName(e,"AdVerifications")),t&&(r=He(Ce.childrenByName(t,"Verification"))),r}(t));break}case"AdVerifications":n.adVerifications=He(Ce.childrenByName(e,"Verification"));break;case"AdSystem":n.system={value:Ce.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":n.title=Ce.parseNodeText(e);break;case"AdServingId":n.adServingId=Ce.parseNodeText(e);break;case"Category":n.categories.push({authority:e.getAttribute("authority")||null,value:Ce.parseNodeText(e)});break;case"Expires":n.expires=parseInt(Ce.parseNodeText(e),10);break;case"ViewableImpression":n.viewableImpression.push(function(e){const t=(e,t)=>{const r=Ce.parseNodeText(t);return r&&e.push(r),e};return{id:e.getAttribute("id")||null,viewable:Ce.childrenByName(e,"Viewable").reduce(t,[]),notViewable:Ce.childrenByName(e,"NotViewable").reduce(t,[]),viewUndetermined:Ce.childrenByName(e,"ViewUndetermined").reduce(t,[])}}(e));break;case"Description":n.description=Ce.parseNodeText(e);break;case"Advertiser":n.advertiser={id:e.getAttribute("id")||null,value:Ce.parseNodeText(e)};break;case"Pricing":n.pricing={value:Ce.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":n.survey={value:Ce.parseNodeText(e),type:e.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:Ce.parseNodeText(e)})}}),r.length&&(n.adVerifications=n.adVerifications.concat(r)),n}function Be(e,t){const r=Fe(e,t),i=e.getAttribute("followAdditionalWrappers"),n=e.getAttribute("allowMultipleAds"),a=e.getAttribute("fallbackOnNoAd");r.followAdditionalWrappers=!i||Ce.parseBoolean(i),r.allowMultipleAds=!!n&&Ce.parseBoolean(n),r.fallbackOnNoAd=a?Ce.parseBoolean(a):null;let s=Ce.childByName(e,"VASTAdTagURI");if(s?r.nextWrapperURL=Ce.parseNodeText(s):(s=Ce.childByName(e,"VASTAdTagURL"),s&&(r.nextWrapperURL=Ce.parseNodeText(Ce.childByName(s,"URL")))),r.creatives.forEach(e=>{if(["linear","nonlinear"].includes(e.type)){if(e.trackingEvents){r.trackingEvents||(r.trackingEvents={}),r.trackingEvents[e.type]||(r.trackingEvents[e.type]={});for(const t in e.trackingEvents){const i=e.trackingEvents[t];Array.isArray(r.trackingEvents[e.type][t])||(r.trackingEvents[e.type][t]=[]),i.forEach(i=>{r.trackingEvents[e.type][t].push(i)})}}e.videoClickTrackingURLTemplates&&(Array.isArray(r.videoClickTrackingURLTemplates)||(r.videoClickTrackingURLTemplates=[]),e.videoClickTrackingURLTemplates.forEach(e=>{r.videoClickTrackingURLTemplates.push(e)})),e.videoClickThroughURLTemplate&&(r.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate),e.videoCustomClickURLTemplates&&(Array.isArray(r.videoCustomClickURLTemplates)||(r.videoCustomClickURLTemplates=[]),e.videoCustomClickURLTemplates.forEach(e=>{r.videoCustomClickURLTemplates.push(e)}))}}),r.nextWrapperURL)return r}function He(e){const t=[];return e.forEach(e=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},i=Array.from(e.childNodes);Ce.assignAttributes(e.attributes,r),i.forEach(e=>{let{nodeName:t,textContent:i,attributes:n}=e;switch(t){case"JavaScriptResource":case"ExecutableResource":r.resource=i.trim(),Ce.assignAttributes(n,r);break;case"VerificationParameters":r.parameters=i.trim()}});const n=Ce.childByName(e,"TrackingEvents");n&&Ce.childrenByName(n,"Tracking").forEach(e=>{const t=e.getAttribute("event"),i=Ce.parseNodeText(e);t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))}),t.push(r)}),t}class We{constructor(){this._handlers=[]}on(e,t){if("function"!=typeof t)throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(e,t,r){const i={fired:!1,wrapFn:void 0};function n(){i.fired||(e.off(t,i.wrapFn),i.fired=!0,r.bind(e)(...arguments))}return i.wrapFn=n,n}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(r=>r.event!==e||r.handler!==t),this}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];let n=!1;return this._handlers.forEach(t=>{"*"===t.event&&(n=!0,t.handler(e,...r)),t.event===e&&(n=!0,t.handler(...r))}),n}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,r)=>(r.event===e&&t.push(r.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let ze=0,Ke=0;const Ge=(e,t)=>{!e||!t||e<=0||t<=0||(Ke=(Ke*ze+8*e/t)/++ze)},je={ERRORCODE:900,extensions:[]},$e="VAST response version not supported";class Ye extends We{constructor(){let{fetcher:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null,this.keepFailedAdPod=!1}trackVastError(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];this.emit("VAST-error",Object.assign({},je,t,...i)),ke.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return Ke}initParsingStatus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),Ge(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(0===this.remainingAds.length)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(e=>this.buildVASTResponse(e))}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(e=>this.buildVASTResponse(e))}buildVASTResponse(e){const t=function(e){let{ads:t,errorURLTemplates:r,version:i}=e;return{ads:t||[],errorURLTemplates:r||[],version:i||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:i=null,wrapperDepth:n=0,allowMultipleAds:a,followAdditionalWrappers:s}=t;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName){var o;this.emit("VAST-ad-parsed",{type:"ERROR",url:i,wrapperDepth:n});const t="VideoAdServingTemplate"===(null==e||null===(o=e.documentElement)||void 0===o?void 0:o.nodeName);throw new Error(t?$e:"Invalid VAST XMLDocument")}const l=[],c=e.documentElement.childNodes,d=e.documentElement.getAttribute("version");r&&d&&(this.vastVersion=d);for(const e in c){const t=c[e];if("Error"===t.nodeName){const e=Ce.parseNodeText(t);r?this.rootErrorURLTemplates.push(e):this.errorURLTemplates.push(e)}else if("Ad"===t.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(!1===a&&l.length>1)break;const e=_e(t,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:s});e.ad?(l.push(e.ad),this.emit("VAST-ad-parsed",{type:e.type,url:i,wrapperDepth:n,adIndex:l.length-1,vastVersion:d})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return l}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:i=null,previousUrl:n=null,wrapperDepth:a=0,isRootVAST:s=!1,followAdditionalWrappers:o,allowMultipleAds:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&s&&(l=!0);try{c=this.parseVastXml(e,{isRootVAST:s,url:t,wrapperDepth:a,allowMultipleAds:l,followAdditionalWrappers:o})}catch(e){return Promise.reject(e)}if(1===c.length&&null!=i&&(c[0].sequence=i),!1===r){const e=Ce.getSortedAdPods(c),t=Ce.getStandAloneAds(c);e.length?c=e:t.length&&(c=[t.shift()]),this.remainingAds=t}return this.resolveAds(c,{wrapperDepth:a,previousUrl:n,url:t})}resolveAds(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:i}=arguments.length>1?arguments[1]:void 0;const n=[];return r=i,e.forEach(e=>{const i=this.resolveWrappers(e,t,r);n.push(i)}),Promise.all(n).then(e=>ke.flatten(e))}resolveWrappers(e,t,r){const i={...e};return new Promise(e=>{var n;if(t++,!i.nextWrapperURL)return delete i.nextWrapperURL,e(i);if(!this.fetcher)return i.VASTAdTagURI=i.nextWrapperURL,delete i.nextWrapperURL,e(i);if(t>=this.maxWrapperDepth)return i.errorCode=302,delete i.nextWrapperURL,e(i);i.nextWrapperURL=Ce.resolveVastAdTagURI(i.nextWrapperURL,r);const a=null!==(n=this.parsingOptions.allowMultipleAds)&&void 0!==n?n:i.allowMultipleAds,s=i.sequence;this.fetcher.fetchVAST({url:i.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(n=>this.parse(n,{url:i.nextWrapperURL,previousUrl:r,wrapperSequence:s,wrapperDepth:t,followAdditionalWrappers:i.followAdditionalWrappers,allowMultipleAds:a}).then(t=>{if(delete i.nextWrapperURL,0===t.length)return i.creatives=[],e(i);t.forEach(e=>{e&&Ce.mergeWrapperAdData(e,i)}),e(t)})).catch(t=>{i.errorCode=t.message===$e?102:301,i.errorMessage=t.message,e(i)})})}completeWrapperResolving(e){if(0===e.ads.length)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const r=e.ads[t],i=!r.creatives.some(e=>{var t,r;return(null===(t=e.mediaFiles)||void 0===t?void 0:t.length)>0||(null===(r=e.variations)||void 0===r?void 0:r.length)>0});!r.errorCode&&!i||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),this.keepFailedAdPod&&r.sequence?r.hasFailed=!0:e.ads.splice(t,1))}}}let Qe=null;const Xe={data:{},length:0,getItem(e){return this.data[e]},setItem(e,t){this.data[e]=t,this.length=Object.keys(this.data).length},removeItem(e){delete this.data[e],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class Je{constructor(){this.storage=this.initStorage()}initStorage(){if(Qe)return Qe;try{Qe="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){Qe=null}return Qe&&!this.isStorageDisabled(Qe)||(Qe=Xe,Qe.clear()),Qe}isStorageDisabled(e){const t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch(e){return!0}return e.removeItem(t),!1}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const Ze=12e4,et={get:async function(e,t){try{const r=new AbortController,i=setTimeout(()=>{throw r.abort(),new Error("URLHandler: Request timed out after ".concat(t.timeout||Ze," ms (408)"))},t.timeout||Ze),n=await fetch(e,{...t,signal:r.signal,credentials:t.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(i)}),a=function(e){return ke.isBrowserEnvironment()&&"https:"===window.location.protocol&&e.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":200===e.status&&e.ok?null:"URLHandler: ".concat(e.statusText," (").concat(e.status,")")}(n);return a?{error:new Error(a),statusCode:n.status}:async function(e){const t=await e.text();let r;return r=ke.isBrowserEnvironment()?new DOMParser:new((await Promise.resolve().then(function(){return ge()}).then(function(e){return e.index})).DOMParser),{xml:r.parseFromString(t,"text/xml"),details:{byteLength:t.length,statusCode:e.status,rawXml:t}}}(n)}catch(e){return{error:e,statusCode:"AbortError"===e.name?408:null}}}};class tt{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||et,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||Ze,withCredentials:Boolean(e.withCredentials)}}addURLTemplateFilter(e){"function"==typeof e&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:r,maxWrapperDepth:i,emitter:n,wrapperDepth:a=0,previousUrl:s=null,wrapperAd:o=null}=e;const l=Date.now();this.URLTemplateFilters.forEach(e=>{r=e(r)}),n("VAST-resolving",{url:r,previousUrl:s,wrapperDepth:a,maxWrapperDepth:i,timeout:this.fetchingOptions.timeout,wrapperAd:o});const c=await this.urlHandler.get(r,this.fetchingOptions),d=Math.round(Date.now()-l);if(n("VAST-resolved",{url:r,previousUrl:s,wrapperDepth:a,error:(null==c?void 0:c.error)||null,duration:d,statusCode:(null==c?void 0:c.statusCode)||null,...null==c?void 0:c.details}),Ge(null==c||null===(t=c.details)||void 0===t?void 0:t.byteLength,d),c.error)throw new Error(c.error);return c.xml}}function rt(e){if(!e?.fileURL)return!1;if("vpaid"===(e.apiFramework||"").toLowerCase())return!1;const t=(e.mimeType||"").toLowerCase();return t.startsWith("video/")||""===t}de=ue.VASTClient=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Je;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new tt,this.vastParser=new Ye({fetcher:this.fetcher}),this.storage=r,void 0===this.lastSuccessfulAd&&(this.lastSuccessfulAd=0),void 0===this.totalCalls&&(this.totalCalls=0),void 0===this.totalCallsTimeout&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<r?(this.totalCalls=1,this.totalCallsTimeout=r+36e5):this.totalCalls++,new Promise((i,n)=>{if(this.cappingFreeLunch>=this.totalCalls)return n(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=r-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return n(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(r=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(r,t).then(e=>{const t=this.vastParser.buildVASTResponse(e);i(t)}))).catch(e=>n(e))})}},ue.VASTParser=Ye,ce=ue.VASTTracker=class extends We{constructor(e,t,r){var i;let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=a,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const e in this.creative.trackingEvents){const t=this.creative.trackingEvents[e];this.trackingEvents[e]=t.slice(0)}this.viewableImpressionTrackers=(null===(i=this.ad.viewableImpression)||void 0===i?void 0:i.reduce((e,t)=>(e.notViewable.push(...t.notViewable),e.viewUndetermined.push(...t.viewUndetermined),e.viewable.push(...t.viewable),e),{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(this.viewableImpressionTrackers).forEach(e=>{let[t,r]=e;r.length&&(this.trackingEvents[t]=r)}),function(e){return"linear"===e.type}(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}"nonLinearAd"===this.variation.adType?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return"companionAd"===e.adType}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){ke.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!ke.isValidTimeValue(e)||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))});const i=this.skipDelay||-1;if(-1===i||this.skippable||(i>e?this.emit("skip-countdown",i-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const i=Math.round(e/this.assetDuration*100),n=[];if(e>0){n.push("start");for(let e=this.lastPercentage;e<i;e++)n.push("progress-".concat(e+1,"%"));n.push("progress-".concat(e));for(const t in this.quartiles)this.isQuartileReached(t,this.quartiles[t],e)&&(n.push(t),this._alreadyTriggeredQuartiles[t]=!0);this.lastPercentage=i}n.forEach(e=>{this.track(e,{macros:t,once:r})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,r){let i=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(i=!0),i}setMuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"boolean"==typeof e&&"object"==typeof t?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))})}setSkipDelay(e){ke.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("notViewable",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e?this.track("viewUndetermined",{macros:e,once:t}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof e&&"boolean"==typeof t?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(ke.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"string"==typeof e&&"boolean"==typeof t?this.error({ERRORCODE:e},t):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))});if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");const r=this.ad.adVerifications.find(t=>t.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const i=r.trackingEvents;if(i&&i.verificationNotExecuted){const e=i.verificationNotExecuted;this.trackURLs(e,t),this.emit("verificationNotExecuted",{trackingURLTemplates:e})}}overlayViewDuration(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"==typeof e&&"object"==typeof t?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))})}close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"object"==typeof e?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!==e&&"string"!=typeof e||"object"!=typeof t)return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(ke.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,i={...t};if(r){this.progress&&(i.ADPLAYHEAD=this.progressFormatted());const e=ke.resolveURLTemplates([r],i)[0];this.emit("clickthrough",e)}}trackProgressEvents(e,t,r){const i=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(e=>{let[t]=e;return t.startsWith("progress-")}).map(e=>{let[t,r]=e;return{name:t,time:parseFloat(t.split("-")[1]),urls:r}}).filter(e=>{let{time:t}=e;return t<=i&&t>this.progress}).forEach(e=>{let{name:i,urls:n}=e;!r&&this.trackedProgressEvents.includes(i)||(this.emit(i,{trackingURLTemplates:n}),this.trackURLs(n,t),r?delete this.trackingEvents[i]:this.trackedProgressEvents.push(i))})}track(e){let{macros:t={},once:r=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"!=typeof t)return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});"closeLinear"===e&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,r);const i=this.trackingEvents[e],n=this.emitAlwaysEvents.indexOf(e)>-1;i?(this.emit(e,{trackingURLTemplates:i}),this.trackURLs(i,t)):n&&this.emit(e,null),r&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{validUrls:n,invalidUrls:a}=ke.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const s={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(s.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(s.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(t=t.universalAdIds)&&void 0!==t&&t.length&&(s.UNIVERSALADID=this.creative.universalAdIds.map(e=>e.idRegistry.concat(" ",e.value)).join(",")),this.ad&&(this.ad.sequence&&(s.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(s.ADTYPE=this.ad.adType),this.ad.adServingId&&(s.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(s.ADCATEGORIES=this.ad.categories.map(e=>e.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(s.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(e=>e.value).join(","))),ke.track(n,s,i)}convertToTimecode(e){if(!ke.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),i=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(ke.addLeadingZeros(r,2),":").concat(ke.addLeadingZeros(i,2),":").concat(ke.addLeadingZeros(n,2),".").concat(ke.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}},ue.parseDuration=Se;class it{constructor(e={}){this.resolvePlayerExecution=null,this.videoElement=null,this.adContainer=null,this.adDisplayContainer=null,this.adsLoader=null,this.adManager=null,this.usingVastFallback=!1,this.vastTracker=null,this.vastFallbackUnlisten=null,this.fallbackProgressEmitted=new Set,this.config=e,this.logger=new y(St.getDebugMode());const t=St.getUserData(),r=St.getDebugMode();this.mediaResultHelper=new K({userId:t?.userId||"",debug:r}),this.ui=new X(this.logger)}async start(t){this.logger.debug("Starting VAST player for media:",t.title),J.show();try{return this.currentMedia=t,await this.checkConnectivity()?(this.logger.debug("Connectivity OK, using IMA SDK for VAST"),await this.executeWithIMA()):this.isVpaidMedia()?(this.logger.debug("No connectivity and media is VPAID; fallback does not support VPAID, returning connection error"),this.finishWithResult(e.AAMediaPlayResult.CONNECTION_ERROR)):(this.logger.debug("No connectivity, using VAST fallback (vast-client)"),await this.executeWithVastFallback())}catch(t){this.logger.error("Error starting VAST player:",t);const r=t instanceof Error?t.message:"Unknown error";return this.finishWithResult(e.AAMediaPlayResult.ERROR,r)}}async checkConnectivity(){try{const e=St.getDebugMode(),t=(new b).getArtemisAdsService(5,e);return await t.checkConnectivity(),!0}catch{return!1}}isVpaidMedia(){const e=this.currentMedia?.content?.video?.type;return"string"==typeof e&&"VPAID"===e.toUpperCase()}async executeWithIMA(){try{if(this.logger.debug("Executing VAST with IMA SDK:",this.currentMedia.title),!window.google||!window.google.ima||!window.google.ima.AdsLoader){this.logger.debug("IMA SDK not available, loading...");try{const e=St.getConfig()?.proxyExternalScripts||!1;await $(e),this.logger.debug("IMA SDK loaded successfully")}catch(t){return this.logger.error("Failed to load IMA SDK (e.g. no connectivity):",t),this.isVpaidMedia()?(this.logger.debug("Media is VPAID; fallback does not support VPAID, returning connection error"),this.finishWithResult(e.AAMediaPlayResult.CONNECTION_ERROR)):await this.executeWithVastFallback()}}const t=this.config.imaConfig||{locale:"pt-BR",vastLoadTimeout:1e4,vpaidMode:window.google.ima.ImaSdkSettings.VpaidMode.ENABLED,continuousPlayback:!0};window.google.ima.settings.setVpaidMode(t.vpaidMode),window.google.ima.settings.setLocale(t.locale),this.logger.debug("IMA SDK configured successfully"),this.createModal(),await this.setupIMA();const r=this.prepareAdTagUrl();return await this.requestAds(r),this.logger.debug("VAST ad executed successfully with IMA SDK"),await this.waitForAdResult()}catch(t){return this.logger.error("Error executing with IMA SDK:",t),this.cleanup(),this.finishWithResult(e.AAMediaPlayResult.ERROR)}}async executeWithVastFallback(){this.usingVastFallback=!0;try{this.logger.debug("Executing VAST with fallback (vast-client):",this.currentMedia.title),this.createModal(),this.ui.showVideo();const i=this.prepareAdTagUrl(),n=function(e){if(!e?.ads?.length)return null;for(const t of e.ads){if(!t.creatives?.length)continue;const e=t.creatives.find(e=>"linear"===e.type&&e.mediaFiles?.length);if(!e?.mediaFiles?.length)continue;const r=e.mediaFiles.find(e=>rt(e));if(r?.fileURL)return{ad:t,creative:e,mediaUrl:r.fileURL,clickThroughUrl:e.videoClickThroughURLTemplate||null}}return null}(await async function(e){const t=new de;return await t.get(e)}(i));if(!n)return this.logger.error("VAST fallback: no linear creative with media found"),this.cleanup(),this.finishWithResult(e.AAMediaPlayResult.ERROR);if(this.vastTracker=(t=n.ad,r=n.creative,new ce(null,t,r)),!this.videoElement)return this.cleanup(),this.finishWithResult(e.AAMediaPlayResult.ERROR);const a=this.videoElement;a.src=n.mediaUrl,a.load(),this.ui.setFallbackSaibaMaisClick(()=>{this.vastTracker&&(this.vastTracker.once?.("clickthrough",e=>{e&&window.open(e,"_blank")}),this.vastTracker.click(null,{}),this.sendClickThroughEvent())});const s=()=>{this.vastTracker?.trackImpression(),this.vastTracker?.load?.(),J.hide(),this.ui.showFallbackOverlay(!!n.clickThroughUrl),this.ui.updateFallbackTimer(0,n.creative.duration??0),this.logger.debug("VAST fallback: ad loaded")},o=()=>{this.vastTracker&&this.vastTracker.setProgress(a.currentTime),this.emitFallbackProgressEvents(a.currentTime,n.creative.duration??0),this.ui.updateFallbackTimer(a.currentTime,n.creative.duration??0)},l=async()=>{this.vastTracker?.complete?.(),this.sendCompleteEvent(),this.sendAllAdsCompletedEvent(),this.logger.debug("VAST fallback: ad completed"),this.ui.hideFallbackOverlay(),this.ui.hide();const t=this.currentMedia.content?.survey?.hasUrl();if(t)try{const e=new oe(this.currentMedia),t=await e.start();this.resolvePlayerExecution&&(this.resolvePlayerExecution(t),this.resolvePlayerExecution=null)}catch(t){this.logger.error("Error executing survey after video:",t),J.hide();const r=this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.REWARDED);this.resolvePlayerExecution&&(this.resolvePlayerExecution(r),this.resolvePlayerExecution=null)}else{J.hide();const t=this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.REWARDED);this.resolvePlayerExecution&&(this.resolvePlayerExecution(t),this.resolvePlayerExecution=null)}this.removeVastFallbackListeners(),setTimeout(()=>{this.ui.cleanup(),this.cleanupResources()},1e3)},c=()=>{this.logger.error("VAST fallback: video error"),this.vastTracker?.error?.(),this.sendAdErrorEvent(),this.cleanup(),this.finishWithResult(e.AAMediaPlayResult.ERROR),this.removeVastFallbackListeners()},d=e=>{this.vastTracker&&(this.vastTracker.once?.("clickthrough",e=>{e&&window.open(e,"_blank")}),this.vastTracker.click(null,{CLICKPOS:[e.clientX,e.clientY]}),this.sendClickThroughEvent())};return a.addEventListener("canplay",s,{once:!0}),a.addEventListener("timeupdate",o),a.addEventListener("ended",l,{once:!0}),a.addEventListener("error",c,{once:!0}),a.addEventListener("click",d),this.vastFallbackUnlisten=()=>{a.removeEventListener("canplay",s),a.removeEventListener("timeupdate",o),a.removeEventListener("ended",l),a.removeEventListener("error",c),a.removeEventListener("click",d)},await a.play().catch(e=>{this.logger.error("VAST fallback: play failed",e),c()}),await this.waitForAdResult()}catch(t){return this.logger.error("Error executing VAST fallback:",t),this.removeVastFallbackListeners(),this.cleanup(),this.finishWithResult(e.AAMediaPlayResult.ERROR)}var t,r}emitFallbackProgressEvents(e,t){if(t<=0)return;const r=e/t,i=[.001,.25,.5,.75];[{key:"start",send:()=>this.sendVpaidStartEvent()},{key:"firstQuartile",send:()=>this.sendFirstQuartileEvent()},{key:"midpoint",send:()=>this.sendMidpointEvent()},{key:"thirdQuartile",send:()=>this.sendThirdQuartileEvent()}].forEach((e,t)=>{r>=i[t]&&!this.fallbackProgressEmitted.has(e.key)&&(this.fallbackProgressEmitted.add(e.key),e.send())})}removeVastFallbackListeners(){this.vastFallbackUnlisten&&(this.vastFallbackUnlisten(),this.vastFallbackUnlisten=null),this.vastTracker=null,this.usingVastFallback=!1,this.fallbackProgressEmitted.clear()}async waitForAdResult(){return new Promise(e=>{this.resolvePlayerExecution=e})}finishWithResult(e,t){this.logger.debug("Finishing VAST player with result:",e),J.hide();const r=this.mediaResultHelper.finishWithResult(this.currentMedia,e,t);return this.resolvePlayerExecution&&(this.resolvePlayerExecution(r),this.resolvePlayerExecution=null),r}createModal(){try{this.videoElement=this.ui.createModal(),this.ui.setCloseCallback(()=>{this.finishWithResult(e.AAMediaPlayResult.CANCELED),this.destroyPlayerOnClose()})}catch(e){throw this.logger.error("Error creating modal:",e),e}}prepareAdTagUrl(){if("video_v2"===this.currentMedia.type){if(!this.currentMedia.content?.video?.url)throw this.logger.error("Video V2 URL not found"),new Error("Video V2 URL not found");return this.currentMedia.content.video.url}if(!this.currentMedia.content?.url)throw this.logger.error("Media content URL not found"),new Error("Media content URL not found");return this.currentMedia.content.url}async setupIMA(){try{if(!this.videoElement)throw new Error("Video element not found");if(this.adContainer=this.ui.getAdContainer(),!this.adContainer)throw new Error("Ad container not found");this.ui.showVideo(),this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoElement),this.adDisplayContainer.initialize(),this.adsLoader=new window.google.ima.AdsLoader(this.adDisplayContainer),this.setupIMAEvents(),this.logger.debug("IMA SDK setup completed")}catch(e){throw this.logger.error("Error setting up IMA SDK:",e),e}}setupIMAEvents(){this.adsLoader&&(this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,e=>{if(this.logger.debug("AdsManager loaded"),this.adManager=e.getAdsManager(this.videoElement),this.adManager){const e=this.videoElement?.clientWidth||640,t=this.videoElement?.clientHeight||480;this.logger.debug(`Initializing ad with dimensions: ${e}x${t}`),this.setupAdManagerEvents(),this.adManager.init(e,t,window.google.ima.ViewMode.NORMAL),this.adManager.start(),this.logger.debug("Ad started successfully"),setTimeout(()=>{this.ui.showVideo()},100)}}),this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,t=>{this.logger.error("Ad error:",t.getError()),this.cleanup(),this.finishWithResult(e.AAMediaPlayResult.ERROR)}))}setupAdManagerEvents(){this.adManager&&(this.adManager.addEventListener(window.google.ima.AdEvent.Type.LOADED,()=>{this.logger.debug("Ad loaded"),J.hide()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.STARTED,()=>{this.logger.debug("Ad started"),this.sendVpaidStartEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.FIRST_QUARTILE,()=>{this.logger.debug("Ad first quartile"),this.sendFirstQuartileEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.MIDPOINT,()=>{this.logger.debug("Ad midpoint"),this.sendMidpointEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.THIRD_QUARTILE,()=>{this.logger.debug("Ad third quartile"),this.sendThirdQuartileEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,()=>{this.sendCompleteEvent(),this.logger.debug("Ad completed")}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,async()=>{this.logger.debug("All ads completed"),this.sendAllAdsCompletedEvent(),this.ui.hide();const t=this.currentMedia.content?.survey?.hasUrl();if(t){this.logger.debug("Video completed, executing survey");try{const e=new oe(this.currentMedia),t=await e.start();this.resolvePlayerExecution&&(this.resolvePlayerExecution(t),this.resolvePlayerExecution=null)}catch(t){this.logger.error("Error executing survey after video:",t),this.finishWithResult(e.AAMediaPlayResult.REWARDED)}}else{J.hide();const t=this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.REWARDED);this.resolvePlayerExecution&&(this.resolvePlayerExecution(t),this.resolvePlayerExecution=null)}setTimeout(()=>{this.ui.cleanup(),this.cleanupResources()},1e3)}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.CLICK,()=>{this.logger.debug("Ad click (clickthrough / Saiba mais)"),this.sendClickThroughEvent()}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.VIDEO_CLICKED,()=>{this.logger.debug("Video area clicked (pause/resume by IMA)")}),this.adManager.addEventListener(window.google.ima.AdEvent.Type.SKIPPED,()=>{this.logger.debug("Ad skipped"),this.sendSkippedEvent()}))}async requestAds(e){try{if(!this.adsLoader)throw new Error("AdsLoader not initialized");const t=new window.google.ima.AdsRequest;t.adTagUrl=e,this.logger.debug("Requesting ads with URL:",e),this.adsLoader.requestAds(t),this.logger.debug("Ads requested successfully")}catch(e){throw this.logger.error("Error requesting ads:",e),e}}sendVpaidStartEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.START,this.currentMedia)}sendFirstQuartileEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.FIRST_QUARTILE,this.currentMedia)}sendMidpointEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.MIDPOINT,this.currentMedia)}sendThirdQuartileEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.THIRD_QUARTILE,this.currentMedia)}sendCompleteEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.AD_COMPLETED,this.currentMedia)}sendAllAdsCompletedEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.ALL_ADS_COMPLETED,this.currentMedia)}sendClickThroughEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.CLICKTHROUGH,this.currentMedia)}sendSkippedEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.SKIPPED,this.currentMedia)}sendAdErrorEvent(){this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.ERROR,this.currentMedia)}destroyPlayerOnClose(){this.usingVastFallback&&this.removeVastFallbackListeners(),this.adManager&&(this.adManager.destroy(),this.adManager=null),this.adsLoader&&(this.adsLoader.destroy(),this.adsLoader=null),this.adDisplayContainer&&(this.adDisplayContainer.destroy(),this.adDisplayContainer=null),this.ui.cleanup(),this.adContainer=null,this.mediaResultHelper.clearSentEvents(),this.resolvePlayerExecution=null}cleanup(){this.logger.debug("Cleaning up VAST player"),this.ui.cleanup(),this.videoElement=null,this.adContainer=null}cleanupResources(){this.logger.debug("Cleaning up VAST player resources (UI already cleaned)"),this.mediaResultHelper.clearSentEvents(),this.resolvePlayerExecution=null,this.adContainer=null,this.videoElement=null}destroy(){this.logger.debug("Destroying VAST player"),this.cleanup()}}var nt;e.StepResult=void 0,(nt=e.StepResult||(e.StepResult={})).NO_FILL="NO_FILL",nt.CONNECTION_ERROR="CONNECTION_ERROR",nt.AD_FAILED="AD_FAILED",nt.REWARDED="REWARDED",nt.SKIPPED="SKIPPED";class at{constructor(){this.steps=[]}addStep(e,t){this.steps.push({result:e,errorMessage:t})}getWaterfallSummary(){return this.steps.map(e=>`${e.result}`).join(", ")||"No results"}getDetailedWaterfallSummary(){return this.steps.map(t=>{switch(t.result){case e.StepResult.AD_FAILED:return"AD_FAILED"+(t.errorMessage?`(${t.errorMessage})`:"");case e.StepResult.NO_FILL:return"NO_FILL";case e.StepResult.CONNECTION_ERROR:return"CONNECTION_ERROR";case e.StepResult.REWARDED:return"REWARDED";case e.StepResult.SKIPPED:return"SKIPPED";default:return t.result}}).join(" | ")}findMainResult(){return this.steps.some(t=>t.result===e.StepResult.REWARDED)?e.StepResult.REWARDED:this.steps.some(t=>t.result===e.StepResult.SKIPPED)?e.StepResult.SKIPPED:this.steps.some(t=>t.result===e.StepResult.NO_FILL)?e.StepResult.NO_FILL:this.steps.some(t=>t.result===e.StepResult.AD_FAILED)?e.StepResult.AD_FAILED:e.StepResult.CONNECTION_ERROR}clear(){this.steps=[]}getSteps(){return[...this.steps]}getStepCount(){return this.steps.length}}class st{constructor(e){this.isLoaded=!1,this.isDestroyed=!1,this.loadTimeout=null,this.rewardedSlot=null,this.rewardPayload=null,this.resolvePromise=null,this.eventListeners={rewardedSlotReady:null,rewardedSlotClosed:null,rewardedSlotGranted:null,slotRenderEnded:null},this.config=e,this.logger=new y(St.getDebugMode())}async loadAd(){return this.isDestroyed?(this.logger.warn("Wrapper already destroyed"),{result:e.StepResult.AD_FAILED,errorMessage:"Wrapper destroyed"}):(this.logger.debug("Loading GAM Rewarded Video:",this.config.adUnitId),new Promise(t=>{this.resolvePromise=t,this.initGooglePublisherTag().then(()=>{if(!this.isDestroyed)return this.renderRewardedAd();t({result:e.StepResult.AD_FAILED,errorMessage:"Wrapper destroyed"})}).catch(r=>{this.logger.error("Error loading GAM RV:",r),t({result:e.StepResult.AD_FAILED,errorMessage:r instanceof Error?r.message:"Unknown error"})})}))}async initGooglePublisherTag(){if("undefined"==typeof window)throw new Error("Window object not available");if(!window.googletag){window.googletag=window.googletag||{cmd:[]};try{await j(),this.logger.debug("GPT script ready")}catch(e){throw this.logger.error("Failed to load GPT script:",e),new Error(`Failed to load Google Publisher Tag: ${e instanceof Error?e.message:"Unknown error"}`)}}}async renderRewardedAd(){return new Promise((t,r)=>{this.loadTimeout=setTimeout(()=>{this.isDestroyed||(this.logger.error("GAM RV load timeout"),this.resolvePromise?.({result:e.StepResult.CONNECTION_ERROR,errorMessage:"Load timeout"}),this.removeEventListeners(),r(new Error("Load timeout")))},this.config.timeout);try{window.googletag.cmd.push(()=>{this.isDestroyed||(re(),this.rewardedSlot=window.googletag.defineOutOfPageSlot(this.config.adUnitId,window.googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot?(this.rewardedSlot.addService(window.googletag.pubads()),this.addCampaignParams(),this.addEventListeners(),window.googletag.enableServices(),window.googletag.display(this.rewardedSlot),t()):(this.logger.error("Rewarded ads are not supported on this page"),this.resolvePromise?.({result:e.StepResult.AD_FAILED,errorMessage:"Rewarded ads not supported"}),this.removeEventListeners(),r(new Error("Rewarded ads not supported"))))})}catch(t){this.logger.error("Error in renderRewardedAd:",t),this.resolvePromise?.({result:e.StepResult.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"}),this.removeEventListeners(),r(t)}})}addCampaignParams(){this.rewardedSlot&&this.config.campaignParams&&(this.config.campaignParams.mediaId&&this.rewardedSlot.setTargeting("a_media_id",this.config.campaignParams.mediaId),this.config.campaignParams.campaignId&&this.rewardedSlot.setTargeting("a_campaign_id",this.config.campaignParams.campaignId),this.config.campaignParams.zoneId&&this.rewardedSlot.setTargeting("a_zone_id",this.config.campaignParams.zoneId),this.config.campaignParams.requestId&&this.rewardedSlot.setTargeting("a_request_id",this.config.campaignParams.requestId))}addEventListeners(){this.logger.debug("Adding GAM RV event listeners"),this.eventListeners.rewardedSlotReady||(this.eventListeners.rewardedSlotReady=e=>{this.isDestroyed||(this.logger.debug("Rewarded ad slot is ready"),history.pushState(null,"Google Rewarded Video","#goog_rewarded"),J.hide(),e.makeRewardedVisible(),this.logger.debug("Rewarded ad is active"))},window.googletag.pubads().addEventListener("rewardedSlotReady",this.eventListeners.rewardedSlotReady)),this.eventListeners.rewardedSlotClosed||(this.eventListeners.rewardedSlotClosed=()=>{this.isDestroyed||(this.logger.debug("Rewarded ad closed"),this.resolvePromise?.({result:e.StepResult.SKIPPED,errorMessage:void 0}),this.dismissRewardedAd())},window.googletag.pubads().addEventListener("rewardedSlotClosed",this.eventListeners.rewardedSlotClosed)),this.eventListeners.rewardedSlotGranted||(this.eventListeners.rewardedSlotGranted=t=>{this.isDestroyed||(this.logger.debug("User rewarded"),this.resolvePromise?.({result:e.StepResult.REWARDED,errorMessage:void 0}),this.dismissRewardedAd())},window.googletag.pubads().addEventListener("rewardedSlotGranted",this.eventListeners.rewardedSlotGranted)),this.eventListeners.slotRenderEnded||(this.eventListeners.slotRenderEnded=t=>{this.isDestroyed||(this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),t.slot===this.rewardedSlot&&t.isEmpty&&(this.logger.debug("No ad returned for rewarded ad slot"),this.resolvePromise?.({result:e.StepResult.NO_FILL,errorMessage:"No ad returned"}),this.dismissRewardedAd()))},window.googletag.pubads().addEventListener("slotRenderEnded",this.eventListeners.slotRenderEnded))}removeEventListeners(){this.logger.debug("Removing GAM RV event listeners"),this.eventListeners.rewardedSlotReady&&(window.googletag.pubads().removeEventListener("rewardedSlotReady",this.eventListeners.rewardedSlotReady),this.eventListeners.rewardedSlotReady=null),this.eventListeners.rewardedSlotClosed&&(window.googletag.pubads().removeEventListener("rewardedSlotClosed",this.eventListeners.rewardedSlotClosed),this.eventListeners.rewardedSlotClosed=null),this.eventListeners.rewardedSlotGranted&&(window.googletag.pubads().removeEventListener("rewardedSlotGranted",this.eventListeners.rewardedSlotGranted),this.eventListeners.rewardedSlotGranted=null),this.eventListeners.slotRenderEnded&&(window.googletag.pubads().removeEventListener("slotRenderEnded",this.eventListeners.slotRenderEnded),this.eventListeners.slotRenderEnded=null)}dismissRewardedAd(){this.rewardPayload&&(this.rewardPayload=null),this.logger.debug("Rewarded ad has been closed"),this.rewardedSlot&&window.googletag.destroySlots([this.rewardedSlot]),this.removeEventListeners()}destroy(){this.isDestroyed||(this.logger.debug("Destroying GAM RV wrapper"),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.removeEventListeners(),this.rewardedSlot&&window.googletag&&window.googletag.destroySlots([this.rewardedSlot]),this.isDestroyed=!0,this.isLoaded=!1,this.rewardedSlot=null,this.rewardPayload=null)}isAdLoaded(){return this.isLoaded}}class ot{constructor(e){this.isDestroyed=!1,this.loadTimeout=null,this.resolvePromise=null,this.adInstance=null,this.adContainer=null,this.adElement=null,this.mediaResultHelper=null,this.config=e,this.logger=new y(St.getDebugMode()),this.mediaResultHelper=e.mediaResultHelper||null}async loadAd(){if(this.isDestroyed)return this.logger.warn("Wrapper already destroyed"),{result:e.StepResult.AD_FAILED,errorMessage:"Wrapper destroyed"};const t=St.getConfig()?.luminaToken;return t&&0!==t.trim().length?(this.logger.debug("Loading Lumina Rewarded Video:",this.config.tagId),new Promise(t=>{this.resolvePromise=t,this.initLuminaSDK().then(()=>{if(!this.isDestroyed)return this.renderRewardedAd();t({result:e.StepResult.AD_FAILED,errorMessage:"Wrapper destroyed"})}).catch(r=>{this.logger.error("Error loading Lumina RV:",r),t({result:e.StepResult.AD_FAILED,errorMessage:r instanceof Error?r.message:"Unknown error"})})})):(this.logger.warn("Lumina token not configured, skipping Lumina RV step"),{result:e.StepResult.AD_FAILED,errorMessage:"Lumina token not configured"})}async initLuminaSDK(){if("undefined"==typeof window)throw new Error("Window object not available");try{const e=this.config.debug||!1,t=St.getConfig()?.luminaToken,r=St.getConfig()?.proxyExternalScripts||!1;await Y({token:t,debug:e},r),this.logger.debug("Lumina SDK script ready")}catch(e){throw this.logger.error("Failed to load Lumina SDK script:",e),new Error(`Failed to load Lumina SDK: ${e instanceof Error?e.message:"Unknown error"}`)}}createAdContainer(){this.adContainer=document.createElement("div"),this.adContainer.id=`lumina-ad-container-${Date.now()}`,this.adContainer.style.display="block",this.adContainer.style.width="100%",this.adContainer.style.height="100vh",this.adContainer.style.position="fixed",this.adContainer.style.top="0",this.adContainer.style.left="0",this.adContainer.style.zIndex="9999",this.adElement=document.createElement("ins"),this.adElement.className="adsbylumina",this.adElement.style.display="block",this.adElement.style.width="100%",this.adElement.style.height="100%";const e=this.config.media?.uuid||`lumina-${Date.now()}`;this.adElement.setAttribute("data-ad-type","fluid"),this.adElement.setAttribute("data-ad-client","ug"),this.adElement.setAttribute("data-ad-tagId",this.config.tagId),this.adElement.setAttribute("data-ad-slot","close"),this.adElement.setAttribute("data-ad-luminaAdToken",e),this.adElement.setAttribute("data-ad-mute","false"),this.adContainer.appendChild(this.adElement),document.body.appendChild(this.adContainer),this.logger.debug("Lumina ad container created")}async renderRewardedAd(){return new Promise((t,r)=>{if(this.loadTimeout=setTimeout(()=>{this.isDestroyed||(this.logger.error("Lumina RV load timeout"),this.resolvePromise?.({result:e.StepResult.CONNECTION_ERROR,errorMessage:"Load timeout"}),this.removeAdContainer(),r(new Error("Load timeout")))},this.config.timeout),this.createAdContainer(),!window.adsbylumina)return void r(new Error("Lumina SDK not available"));window.adsbylumina=window.adsbylumina||[];const i={luminaAdToken:this.config.media?.uuid||`lumina-${Date.now()}`,tagId:this.config.tagId,bidfloor:0,onAdRequestSuccess:i=>{if(!this.isDestroyed){this.logger.debug("Ad request succeeded, price:",i.price),this.adInstance=i,this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.adContainer&&(this.adContainer.style.display="block");try{i.renderAd(),this.logger.debug("Ad rendered successfully"),J.hide(),t()}catch(t){this.logger.error("renderAd() failed:",t);const i=t instanceof Error?t.message:"Ad render failed";this.removeAdContainer(),this.resolvePromise?.({result:e.StepResult.AD_FAILED,errorMessage:i}),r(new Error(i))}}},onAdRequestFailed:t=>{if(this.isDestroyed)return;this.logger.error("Ad request failed:",t),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.removeAdContainer();const i=t.error??"Unknown error",n=i.toLowerCase().includes("no ad"),a=n?e.StepResult.NO_FILL:e.StepResult.AD_FAILED;this.logger.debug("Error classified as: "+(n?"NO_FILL":"AD_FAILED")),this.resolvePromise?.({result:a,errorMessage:i}),r(new Error(i))},onAdComplete:t=>{this.isDestroyed||(this.logger.debug("Ad completed",t),this.logger.debug("User rewarded"),this.resolvePromise?.({result:e.StepResult.REWARDED,errorMessage:void 0}),this.removeAdContainer())},onAdClick:t=>{this.isDestroyed||(this.logger.debug("Ad clicked",t),this.mediaResultHelper&&this.config.media&&this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.CLICKTHROUGH,this.config.media))},onTemplateClose:()=>{this.isDestroyed||(this.logger.debug("Rewarded ad closed"),this.resolvePromise?.({result:e.StepResult.SKIPPED,errorMessage:void 0}),this.removeAdContainer())}};window.adsbylumina.push(i)})}removeAdContainer(){this.adContainer&&this.adContainer.parentNode&&(this.adContainer.parentNode.removeChild(this.adContainer),this.adContainer=null,this.adElement=null,this.logger.debug("Lumina ad container removed"))}destroy(){this.isDestroyed||(this.logger.debug("Destroying Lumina RV wrapper"),this.loadTimeout&&(clearTimeout(this.loadTimeout),this.loadTimeout=null),this.adInstance=null,this.removeAdContainer(),this.isDestroyed=!0)}}class lt{constructor(e={}){this.currentMedia=null,this.config=e,this.logger=new y(St.getDebugMode());const t=St.getUserData(),r=St.getDebugMode();this.mediaResultHelper=new K({userId:t?.userId||"",debug:r}),this.waterfallTracker=new at}async start(t){this.logger.debug("Starting programmatic player for media:",t.title),J.show();try{this.currentMedia=t,this.waterfallTracker.clear(),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_WATERFALL_START,t);const r=t.content?.programmatic?.waterfall;return r&&0!==r.length?await this.executeWaterfall(r):(this.logger.error("Empty or null waterfall"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_ERROR,t),J.hide(),this.createErrorResult("Empty or null waterfall"))}catch(e){throw this.logger.error("Error in start method:",e),J.hide(),e}}async executeWaterfall(t){this.logger.debug("Executing waterfall with",t.length,"steps");for(let r=0;r<t.length;r++){const i=t[r];this.logger.debug(`Loading ad ${r+1} of ${t.length}: ${i.type}`);try{const t=await this.loadAd(i,r);if(t instanceof E)return this.logger.debug("Fallback executed, returning result directly"),t;if(t.result===e.StepResult.REWARDED)return this.logger.debug("Ad rewarded successfully"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.COMPLETE,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.REWARDED);if(t.result===e.StepResult.SKIPPED)return this.logger.debug("Ad skipped"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_SKIPPED,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.SKIPPED);this.waterfallTracker.addStep(t.result,t.errorMessage),this.logger.debug(`Ad ${r+1} failed: ${t.result} - ${t.errorMessage}, trying next`)}catch(t){this.logger.error(`Error loading ad ${r+1}:`,t),this.waterfallTracker.addStep(e.StepResult.AD_FAILED,t instanceof Error?t.message:"Unknown error")}}return this.logger.debug("No more ads to load in waterfall. Summary:",this.waterfallTracker.getDetailedWaterfallSummary()),J.hide(),await this.sendProgResultEvent()}async loadAd(t,r){const i=t.type,n=t.findTimeout()||this.config.loadTimeout||1e4;switch(this.logger.debug(`Loading ad type: ${i}`),i){case e.AAMediaTypes.TYPE_GOOGLE_RV:return await this.loadGAMRewardedVideo(t.findAdUnitId(),n);case e.AAMediaTypes.TYPE_KWAI_RV:return await this.loadLuminaRewardedVideo(t.findAdUnitId(),n);case e.AAMediaTypes.TYPE_FALLBACK:return await this.loadVideoFallback(t.findVastTag(),t.findEventSuffix());default:return this.logger.warn(`Ad type ${i} not supported in web`),{result:e.StepResult.AD_FAILED,errorMessage:`Ad type ${i} not supported`}}}async loadGAMRewardedVideo(t,r){try{if(this.logger.debug("Loading GAM Rewarded Video"),!t)return this.logger.error("Ad unit ID not found for GAM RV"),{result:e.StepResult.AD_FAILED,errorMessage:"Ad unit ID not found"};const i=this.buildCampaignParams(),n=St.getDebugMode(),a=new st({adUnitId:t,timeout:r,campaignParams:i,debug:n});return await this.loadGAMRewardedVideoWithWrapper(a)}catch(t){return this.logger.error("Error loading GAM RV:",t),{result:e.StepResult.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"}}}async loadLuminaRewardedVideo(t,r){try{if(this.logger.debug("Loading Lumina Rewarded Video"),!t)return this.logger.error("TagId not found for Lumina RV"),{result:e.StepResult.AD_FAILED,errorMessage:"TagId not found"};const i=this.buildCampaignParams(),n=St.getDebugMode(),a=new ot({tagId:t,timeout:r,campaignParams:i,debug:n,mediaResultHelper:this.mediaResultHelper,media:this.currentMedia||void 0});return await this.loadLuminaRewardedVideoWithWrapper(a)}catch(t){return this.logger.error("Error loading Lumina RV:",t),{result:e.StepResult.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"}}}async loadLuminaRewardedVideoWithWrapper(t){try{const e=await t.loadAd();return this.logger.debug("Lumina RV result:",e.result),e}catch(t){return this.logger.error("Error loading Lumina RV:",t),{result:e.StepResult.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"}}}async loadGAMRewardedVideoWithWrapper(t){try{const e=await t.loadAd();return this.logger.debug("GAM RV result:",e.result),e}catch(t){return this.logger.error("Error loading GAM RV:",t),{result:e.StepResult.AD_FAILED,errorMessage:t instanceof Error?t.message:"Unknown error"}}}async loadVideoFallback(t,r){try{this.logger.debug("Loading fallback VIDEO_V2"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_FALLBACK_REQ,this.currentMedia),this.sendProgResultEvent();const i=JSON.parse(JSON.stringify(this.currentMedia));i.type=e.AAMediaTypes.VIDEO_V2,i.content={video:{type:"IN_HOUSE",url:t,proxy:!1,eventSuffix:r}};const n=new ut(i);return await n.click(!1)}catch(t){return this.logger.error("Error loading fallback:",t),new E({media:this.currentMedia,result:e.AAMediaPlayResult.ERROR,error:new u(W.ERROR,t instanceof Error?t.message:"Unknown error")})}}createErrorResult(t){return new E({media:this.currentMedia,result:e.AAMediaPlayResult.ERROR,error:new u(W.ERROR,t instanceof Error?t.message:"Unknown error")})}async sendProgResultEvent(){switch(this.waterfallTracker.findMainResult()){case e.StepResult.NO_FILL:return this.logger.debug("Waterfall completed with NO_FILL"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.NO_FILL,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.NO_FILL);case e.StepResult.AD_FAILED:const t=`Waterfall failed: ${this.waterfallTracker.getDetailedWaterfallSummary()}`;return this.logger.error("Waterfall",t),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_ERROR,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.ERROR,t);case e.StepResult.CONNECTION_ERROR:return this.logger.debug("Waterfall completed with CONNECTION_ERROR"),this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.PROGRAMMATIC_CONNECTION_ERROR,this.currentMedia),this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.CONNECTION_ERROR,"Connection Error");case e.StepResult.REWARDED:return this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.REWARDED);case e.StepResult.SKIPPED:return this.mediaResultHelper.finishWithResult(this.currentMedia,e.AAMediaPlayResult.SKIPPED)}}buildCampaignParams(){const e={};return this.currentMedia?.uuid&&(e.mediaId=this.currentMedia.uuid),this.currentMedia?.campaignId&&(e.campaignId=this.currentMedia.campaignId),this.currentMedia?.zoneId&&(e.zoneId=this.currentMedia.zoneId),this.currentMedia?.requestId&&(e.requestId=this.currentMedia.requestId),e}destroy(){this.logger.debug("Destroying AARewardedVideo"),J.hide(),this.currentMedia=null,this.waterfallTracker.clear()}}class ct{constructor(e){this.media=e;const t=St.getDebugMode();this.logger=new y(t),this.mediaResultHelper=new K({userId:St.getUserData()?.userId||"",debug:t})}async start(){try{return this.getRedirectUrl()?new E({media:this.media,result:e.AAMediaPlayResult.EXTERNAL_REDIRECT}):(this.logger.error("URL de redirecionamento não encontrada"),this.mediaResultHelper.finishWithResult(this.media,e.AAMediaPlayResult.ERROR,"URL de redirecionamento não encontrada"))}catch(t){return this.logger.error("Erro ao executar redirecionamento externo:",t),this.mediaResultHelper.finishWithResult(this.media,e.AAMediaPlayResult.ERROR,t instanceof Error?t.message:"Erro desconhecido")}}getRedirectUrl(){if(this.media.content?.externalRedirect?.link)return this.media.content.externalRedirect.link;const e=this.media._rawContent;return e&&e.link?e.link:this.media.content?.url?this.media.content.url:this.media.externalUrl?.url?this.media.externalUrl.url:this.media.success?.url?this.media.success.url:null}}class dt{constructor(e){this.media=e;const t=St.getDebugMode();this.logger=new y(t),this.mediaResultHelper=new K({userId:St.getUserData()?.userId||"",debug:t})}async start(){try{return this.getClickUrl()?(this.mediaResultHelper.sendEventCallback(e.AAVastTrackingEvents.CLICKTHROUGH,this.media),new E({media:this.media,result:e.AAMediaPlayResult.BANNER_CLICK})):(this.logger.error("URL de clique do banner não encontrada"),this.mediaResultHelper.finishWithResult(this.media,e.AAMediaPlayResult.ERROR,"URL de clique do banner não encontrada"))}catch(t){return this.logger.error("Erro ao executar clique do banner:",t),this.mediaResultHelper.finishWithResult(this.media,e.AAMediaPlayResult.ERROR,t instanceof Error?t.message:"Erro desconhecido")}}getClickUrl(){return this.media.externalUrl?.url??null}}class ut{constructor(e){this.uuid=e.uuid,this.type=e.type,this.title=e.title,this.viewed=e.viewed,this.campaignId=e.campaignId,this.campaignName=e.campaignName,this.requestId=e.requestId,this.zoneId=e.zoneId,this.mediasLeft=e.mediasLeft,this.layout=e.layout,this.partnerEventUuid=e.partnerEventUuid,e.content&&(this.content=new f(e.content)),e.success&&(this.success=new v(e.success)),Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.content&&!this._rawContent&&(this._rawContent=e.content)}getPostbackBenefits(){return this.partnerEvent?.benefits}async click(t=!0){const r=St.getDebugMode(),i=new y(r);try{const r=St.getUserData();if(!r?.userId)return i.error("Error executing media click: user id is null"),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u("User ID is required")});switch(t&&(new q).sendMediaClickEvent(this.campaignId||"",this.requestId||"",this.uuid).catch(e=>i.warn("Error sending click event:",e)),this.type){case e.AAMediaTypes.VIDEO_V2:return await this.executeVideoV2Media(r.userId);case e.AAMediaTypes.PROGRAMMATIC_V2:return await this.executeProgrammaticV2Media(r.userId);case e.AAMediaTypes.SURVEY_V2:return await this.executeSurveyV2Media(r.userId);case e.AAMediaTypes.EXTERNAL_REDIRECT:return await this.executeExternalRedirectMedia(r.userId);case e.AAMediaTypes.BANNER:return await this.executeBannerMedia(r.userId);default:return i.warn(`Unsupported media type: ${this.type}`),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(`Unsupported media type: ${this.type}`)})}return new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u("Media execution failed")})}catch(t){return i.error("Error executing media click:",t),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}async executeProgrammaticV2Media(e){const t=St.getDebugMode();new y(t).debug("Executing Programmatic V2 media:",this.title);const r=new lt,i=await r.start(this);return new E(i)}async executeVideoV2Media(t){const r=St.getDebugMode(),i=new y(r);i.debug("Executing Video V2 media:",this.title);try{const e=new it,t=await e.start(this);return i.debug("Video V2 execution completed:",t.result),t}catch(t){return i.error("Error in executeVideoV2Media:",t),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}async executeSurveyV2Media(t){const r=St.getDebugMode(),i=new y(r);i.debug("Executing Survey V2 media:",this.title);try{const e=new oe(this),t=await e.start();return i.debug("Survey V2 execution completed:",t.result),t}catch(t){return i.error("Error in executeSurveyV2Media:",t),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}async executeExternalRedirectMedia(t){const r=St.getDebugMode(),i=new y(r);i.debug("Executing External Redirect media:",this.title);try{const e=new ct(this),t=await e.start();return i.debug("External Redirect execution completed:",t.result),t}catch(t){return i.error("Error in executeExternalRedirectMedia:",t),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}async executeBannerMedia(t){const r=St.getDebugMode(),i=new y(r);i.debug("Executing Banner media:",this.title);try{const e=new dt(this),t=await e.start();return i.debug("Banner execution completed:",t.result),t}catch(t){return i.error("Error in executeBannerMedia:",t),new E({media:this,result:e.AAMediaPlayResult.ERROR,error:new u(t instanceof Error?t.message:"Unknown error")})}}}class ht{constructor(e){this.image=e.image,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}hasValidImage(){return!!(this.image&&this.image.trim().length>0)}getImageUrl(e){return this.hasValidImage()?this.image:e||""}isAbsoluteUrl(){return this.image.startsWith("http://")||this.image.startsWith("https://")}}class gt{constructor(e){this.primaryColor=e.primaryColor,this.secondaryColor=e.secondaryColor,this.title=e.title,this.primaryInformation=e.primaryInformation,this.secondaryInformation=e.secondaryInformation,this.enableCountdown=e.enableCountdown||!1,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.header&&(this.header=new ht(e.header))}getPrimaryColorHex(){return this.primaryColor.startsWith("#")?this.primaryColor:`#${this.primaryColor}`}getSecondaryColorHex(){return this.secondaryColor.startsWith("#")?this.secondaryColor:`#${this.secondaryColor}`}isValid(){return!!(this.primaryColor&&this.secondaryColor&&this.title&&this.header)}}class pt{constructor(e){this.success=e.success,this.media=e.media||[],Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.layout&&(this.layout=new gt(e.layout)),this.media=this.media.map(e=>new ut(e))}getUnviewedMedia(){return this.media.filter(e=>!e.viewed)}getMediaByType(e){return this.media.filter(t=>t.type===e)}hasAvailableMedia(){return this.getUnviewedMedia().length>0}getMediaCount(){return this.media.length}}class mt{constructor(e){this.name=e.name,this.description=e.description,this.value=e.value,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}hasDescription(){return!(!this.description||!this.description.trim())}hasValue(){return!!this.value}getInfo(){return this.hasDescription()?`${this.name}: ${this.description}`:this.name}}class ft{constructor(e){this.quantity=e.quantity,this.unit=e.unit}}class vt{constructor(e){this.uuid=e.uuid,this.label=e.label,this.description=e.description,this.benefits=(e.benefits||[]).map(e=>new ft(e))}}class Et{constructor(e){this.event=new vt(e.event)}}class yt{constructor(e){this.campaignUuid=e.campaignUuid,this.campaignName=e.campaignName,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.mainData&&(this.mainData=new pt(e.mainData)),this.benefitOffers=(e.benefitOffers||[]).map(e=>new mt(e)),this.events=e.events?e.events.map(e=>new Et(e)):void 0}getUnviewedMedia(){return this.mainData?.media?.filter(e=>!e.viewed)||[]}getMediaByType(e){return this.mainData?.media?.filter(t=>t.type===e)||[]}hasAvailableMedia(){return this.getUnviewedMedia().length>0}}class At{constructor(e){this.uuid=e.uuid,this.name=e.name,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}isValid(){return!(!this.uuid||!this.name)}getInfo(){return`${this.name} (${this.uuid})`}}class wt{constructor(e){this.requestId=e.requestId,this.campaigns=e.campaigns||[],Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.zone&&(this.zone=new At(e.zone)),this.campaigns=this.campaigns.map(e=>new yt(e))}getCampaignsWithAvailableMedia(){return this.campaigns.filter(e=>e.hasAvailableMedia())}getAllMedia(){return this.campaigns.flatMap(e=>e.mainData?.media||[])}getMediaByType(e){return this.campaigns.flatMap(t=>t.getMediaByType(e))}}class bt{constructor(e){this.responseStatus=e.responseStatus,this.error=e.error,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])}),e.campaignResponse&&(this.campaignResponse=new wt(e.campaignResponse))}isSuccess(){return this.responseStatus===e.AACampaignResponseStatus.SUCCESS}isEmpty(){return this.responseStatus===e.AACampaignResponseStatus.EMPTY}hasError(){return this.responseStatus===e.AACampaignResponseStatus.ERROR}getCampaigns(){return this.campaignResponse?.campaigns||[]}getAllMedia(){return this.campaignResponse?.getAllMedia()||[]}}class Rt{constructor(e){this.userId=e.userId,this.context=e.context,Object.keys(e).forEach(t=>{t in this||(this[t]=e[t])})}addContext(e,t){this.context||(this.context={}),this.context[e]=t}getContext(e){return this.context?.[e]}hasContext(){return!!(this.context&&Object.keys(this.context).length>0)}}const Tt="@AkrossAds:SDK_CONFIG",kt="@Dataads:USER_DATA",It="@Dataads:CUSTOM_HEADERS";class St{static saveConfig(e){localStorage.setItem(Tt,JSON.stringify(e))}static getConfig(){const e=localStorage.getItem(Tt);return e?JSON.parse(e):null}static updateConfig(e){const t=this.getConfig();if(t){const r={...t,...e};this.saveConfig(r)}}static deleteConfig(){localStorage.removeItem(Tt)}static saveUserData(e,t=null){const i=new r({userId:e,advertisingId:t});localStorage.setItem(kt,JSON.stringify(i))}static getUserData(){const e=localStorage.getItem(kt);return e?JSON.parse(e):null}static removeUserData(){localStorage.removeItem(kt)}static getDebugMode(){const e=this.getConfig();return e?.debug||!1}static setDebugMode(e){this.updateConfig({debug:e})}static getCustomHeaders(){const e=localStorage.getItem(It);return e?JSON.parse(e):null}static saveCustomHeaders(e){localStorage.setItem(It,JSON.stringify(e))}static removeCustomHeaders(){localStorage.removeItem(It)}static clearAll(){localStorage.removeItem(Tt),localStorage.removeItem(kt),localStorage.removeItem(It)}}class Ct{constructor(){this.isInitialized=!1,this.config=null,this.logger=new y(St.getDebugMode())}getIsInitialized(){return this.isInitialized}async initialize(e){return new Promise(async(r,i)=>{try{if(this.isInitialized)return this.logger.warn("SDK já foi inicializado"),r();this.logger=new y(St.getDebugMode()),this.config=t.applyDefaults(e),this.logger.info("Inicializando SDK..."),St.saveConfig(e),await this.preloadScripts(),this.isInitialized=!0,this.logger.info("SDK inicializado com sucesso!"),r()}catch(e){this.logger.error("Erro ao inicializar SDK:",e),i(e)}})}async setUserId(e,t){return new Promise(async(r,i)=>{if(!this.isInitialized)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));try{this.logger.debug("Definindo userId:",e),St.saveUserData(e,t),te(e),this.logger.info("UserId definido com sucesso"),r()}catch(e){this.logger.error("Erro ao definir userId:",e),i(e)}})}async getUserId(){return new Promise(async(e,t)=>{if(!this.isInitialized)return this.logger.error("SDK não foi inicializado"),t(new Error("SDK não foi inicializado"));try{const t=St.getUserData();e(t?.userId||"")}catch(e){this.logger.error("Erro ao obter userId:",e),t(e)}})}async getUserData(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{return St.getUserData()}catch(e){throw this.logger.error("Erro ao obter dados do usuário:",e),e}}async setCustomHeaders(e){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{St.saveCustomHeaders(e),this.logger.info("Headers customizados definidos com sucesso")}catch(e){throw this.logger.error("Erro ao definir headers customizados:",e),e}}async removeCustomHeaders(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{St.removeCustomHeaders(),this.logger.info("Headers customizados removidos com sucesso")}catch(e){throw this.logger.error("Erro ao remover headers customizados:",e),e}}async getCustomHeaders(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{return St.getCustomHeaders()}catch(e){throw this.logger.error("Erro ao obter headers customizados:",e),e}}getConfig(){return this.config}async clearAll(){if(!this.isInitialized)throw this.logger.error("SDK não foi inicializado"),new Error("SDK não foi inicializado");try{St.clearAll(),this.isInitialized=!1,this.config=null,this.logger.info("Todas as configurações foram limpas")}catch(e){throw this.logger.error("Erro ao limpar configurações:",e),e}}async preloadScripts(){try{if(window.google&&window.google.ima&&window.google.ima.AdsLoader||await $(this.config?.proxyExternalScripts||!1),window.googletag||await j(this.config?.proxyExternalScripts||!1),this.config?.luminaToken&&this.config.luminaToken.trim().length>0&&(!window.adsbylumina||!window.__luminaBasecodeReady__)){const e=t.getLuminaToken(this.config);await Y({token:e,debug:St.getDebugMode()},this.config?.proxyExternalScripts||!1)}}catch(e){this.logger.warn("Erro ao pré-carregar scripts (não crítico):",e)}}getDebugInfo(){return{isInitialized:this.isInitialized,debugMode:St.getDebugMode(),config:this.config,userData:St.getUserData(),customHeaders:St.getCustomHeaders(),scriptsLoaded:{ima:!!(window.google&&window.google.ima&&window.google.ima.AdsLoader),gpt:!!window.googletag,lumina:!(!window.adsbylumina||!window.__luminaBasecodeReady__)},version:ne()}}}class Dt{constructor(){this.cachedDeviceInfo=null,this.logger=new y(St.getDebugMode())}async getDeviceContext(){if(this.cachedDeviceInfo)return this.cachedDeviceInfo;try{const e={},t=St.getConfig();t?.appId&&(e.appId=t.appId),t?.appVersion&&(e.appVersion=t.appVersion),e.deviceId=this.getDeviceId(),e.sdkVersion=this.getSdkVersion(),e.brand=this.getBrowserBrand(),e.hardware=this.getHardwareInfo(),e.manufacturer=this.getManufacturer(),e.model=this.getModel(),e.product=this.getProduct(),e.osVersion=this.getOSVersion(),e.os="WEB",e.eventDate=Date.now().toString(),e.userAgent=navigator.userAgent,e.language=navigator.language,e.platform=navigator.platform,e.screenWidth=screen.width.toString(),e.screenHeight=screen.height.toString(),e.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone;const[r,i]=await Promise.allSettled([this.getLocation(),this.getAdId()]);return"fulfilled"===r.status&&r.value&&(e.lat=r.value.latitude.toString(),e.long=r.value.longitude.toString()),"fulfilled"===i.status&&i.value&&(e.adId=i.value),this.cachedDeviceInfo=e,e}catch(e){return this.logger.error("Error getting device context:",e),this.getFallbackContext()}}getSdkVersion(){return ie()}clearCache(){this.cachedDeviceInfo=null}getBrowserInfo(){return{userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,cookieEnabled:navigator.cookieEnabled.toString(),onLine:navigator.onLine.toString()}}getScreenInfo(){return{screenWidth:screen.width.toString(),screenHeight:screen.height.toString(),screenColorDepth:screen.colorDepth.toString(),screenPixelDepth:screen.pixelDepth.toString(),availWidth:screen.availWidth.toString(),availHeight:screen.availHeight.toString()}}getFallbackContext(){return{deviceId:"unknown",sdkVersion:this.getSdkVersion(),os:"WEB",eventDate:Date.now().toString()}}getDeviceId(){const e="akross_device_id";let t=localStorage.getItem(e);return t||(t=this.generateDeviceFingerprint(),localStorage.setItem(e,t)),t}generateDeviceFingerprint(){const e=document.createElement("canvas"),t=e.getContext("2d");t&&(t.textBaseline="top",t.font="14px Arial",t.fillText("Akross Device ID",2,2));const r=[navigator.userAgent,navigator.language,screen.width+"x"+screen.height,(new Date).getTimezoneOffset(),e.toDataURL()].join("|");return btoa(r).substring(0,16)}getBrowserBrand(){const e=navigator.userAgent;return e.includes("Chrome")?"Google":e.includes("Firefox")?"Mozilla":e.includes("Safari")?"Apple":e.includes("Edge")?"Microsoft":"Unknown"}getHardwareInfo(){return navigator.hardwareConcurrency?`CPU Cores: ${navigator.hardwareConcurrency}`:"Unknown"}getManufacturer(){const e=navigator.userAgent;return e.includes("Windows")?"Microsoft":e.includes("Mac")?"Apple":e.includes("Linux")?"Linux":"Unknown"}getModel(){const e=navigator.userAgent;return e.includes("Mobile")?"Mobile Device":e.includes("Tablet")?"Tablet":"Desktop"}getProduct(){return navigator.platform||"Unknown"}getOSVersion(){const e=navigator.userAgent.match(/(Windows|Mac|Linux|Android|iOS)\s+([\d.]+)/);return e?e[2]:"Unknown"}async getLocation(){return new Promise(e=>{navigator.geolocation?navigator.permissions?.query({name:"geolocation"}).then(t=>{"granted"===t.state?navigator.geolocation.getCurrentPosition(t=>{e({latitude:t.coords.latitude,longitude:t.coords.longitude})},()=>e(null),{timeout:5e3,enableHighAccuracy:!1}):e(null)}).catch(()=>{e(null)}):e(null)})}async getAdId(){return null}}let Lt=null;class Nt{constructor(e,t,r=!1){this.logger=new y(St.getDebugMode()),this.eventsHelper=new q}async requestCampaign(t,r=1,i,n){const a=new bt({responseStatus:e.AACampaignResponseStatus.ERROR});if("undefined"==typeof window||!window.AkrossAds)return this.logger.warn("SDK não foi inicializado"),a;{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.warn("SDK não foi inicializado"),a}const s=St.getUserData();if(!s?.userId)return this.logger.error("Erro ao obter campanha: userId está vazio"),a;try{const o=(Lt||(Lt=new Dt),Lt),l={...await o.getDeviceContext(),...i},c=new Rt({userId:s.userId,context:l}),d=(new b).getArtemisAdsService(30,!1,!0),u=await d.requestCampaign(t,c,r,n);if(u&&u.campaigns&&u.campaigns.length>0){u.campaigns.forEach(e=>{const t=e.mainData.media.filter(e=>!e.viewed).length;e.mainData.media.forEach(r=>{if(r.campaignId=e.campaignUuid,r.campaignName=e.campaignName,r.requestId=u.requestId,r.zoneId=u.zone.uuid,r.success=e.mainData.success,r.mediasLeft=t,r.layout=e.mainData.layout,r.partnerEventUuid&&e.events){const t=e.events.find(e=>e.event?.uuid===r.partnerEventUuid);t&&(r.partnerEvent=t.event)}})});const t=new wt({...u,campaigns:u.campaigns});a.campaignResponse=t,a.responseStatus=e.AACampaignResponseStatus.SUCCESS}else a.responseStatus=e.AACampaignResponseStatus.EMPTY}catch(t){a.error=t instanceof Error?t:new Error("Erro desconhecido"),a.responseStatus=e.AACampaignResponseStatus.ERROR,this.logger.error("Erro ao obter campanha:",t)}return a}async bannerClick(e,t,r,i){try{const n=St.getUserData();if(!n?.userId)return void this.logger.error("Erro ao abrir URL: userId está vazio");const a=new URL(e);a.searchParams.has("userId")||a.searchParams.set("userId",n.userId),a.searchParams.has("campaignId")||a.searchParams.set("campaignId",t);const s=(new b).getArtemisAdsService(30,!1,!0);await s.sendTracking("click",t,n.userId,r,i,"banner"),window.open(a.toString(),"_blank")}catch(e){this.logger.error("Erro ao abrir URL:",e)}}async sendEvent(e,t,r,i,n){return new Promise(async(a,s)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),s(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),s(new Error("SDK não foi inicializado"))}const o=St.getUserData();if(!o?.userId)return this.logger.error("UserId não encontrado"),s(new Error("UserId não encontrado"));this.logger.debug("Enviando evento:",{event:e,campaignId:t,trackingId:r,mediaId:i,source:n}),await this.eventsHelper.sendEvent(e,t,r,i,n),this.logger.info("Evento enviado com sucesso"),a()}catch(e){this.logger.error("Erro ao enviar evento:",e),s(e)}})}async sendCampaignsImpressionEvent(e,t){return new Promise(async(r,i)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"))}const n=St.getUserData();if(!n?.userId)return this.logger.error("UserId não encontrado"),i(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de impressão para campanhas:",{trackingId:e,campaignsCount:t.length}),await this.eventsHelper.sendCampaignsImpressionEvent(e,t),this.logger.info("Eventos de impressão enviados com sucesso"),r()}catch(e){this.logger.error("Erro ao enviar eventos de impressão:",e),i(e)}})}async sendCampaignClickEvent(e,t){return new Promise(async(r,i)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),i(new Error("SDK não foi inicializado"))}const n=St.getUserData();if(!n?.userId)return this.logger.error("UserId não encontrado"),i(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de clique na campanha:",{campaignId:e,trackingId:t}),await this.eventsHelper.sendCampaignClickEvent(e,t),this.logger.info("Evento de clique na campanha enviado com sucesso"),r()}catch(e){this.logger.error("Erro ao enviar evento de clique na campanha:",e),i(e)}})}async sendSuccessImpressionEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=St.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento success_impression:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendSuccessImpressionEvent(e,t,r),this.logger.info("Evento success_impression enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento success_impression:",e),n(e)}})}async sendMediaClickEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=St.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento de clique na mídia:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendMediaClickEvent(e,t,r),this.logger.info("Evento de clique na mídia enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento de clique na mídia:",e),n(e)}})}async sendClickThroughEvent(e,t,r){return new Promise(async(i,n)=>{try{if("undefined"==typeof window||!window.AkrossAds)return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"));{const e=window.AkrossAds.getInstance();if(!e||!e.isInitialized())return this.logger.error("SDK não foi inicializado"),n(new Error("SDK não foi inicializado"))}const a=St.getUserData();if(!a?.userId)return this.logger.error("UserId não encontrado"),n(new Error("UserId não encontrado"));this.logger.debug("Enviando evento clickthrough:",{campaignId:e,trackingId:t,mediaId:r}),await this.eventsHelper.sendClickThroughEvent(e,t,r),this.logger.info("Evento clickthrough enviado com sucesso"),i()}catch(e){this.logger.error("Erro ao enviar evento clickthrough:",e),n(e)}})}static getSdkVersion(){return ie()}}class Mt{constructor(e){if(this.logger=new y(St.getDebugMode()),"string"==typeof e){const t=document.querySelector(e);if(!t)throw new Error(`Elemento não encontrado: ${e}`);this.containerElement=t}else this.containerElement=e;this.imageElement=document.createElement("img"),this.imageElement.style.display="block",this.containerElement.innerHTML=""}setClickListener(e){this.clickListener=e}setMediaClickHandler(e){this.mediaClickHandler=e}setSuccessListener(e){this.successListener=e}setErrorListener(e){this.errorListener=e}async loadZone(t,r){try{const i=St.getUserData();if(!i?.userId)return this.logger.error("Erro ao carregar banner: userId está vazio"),void this.errorListener?.onError();const n=new Nt,a=await n.requestCampaign(t,1,void 0,r);if(!a.campaignResponse?.campaigns?.length)return this.logger.error("Nenhuma campanha encontrada para a zona:",t),void this.errorListener?.onError();const s=a.campaignResponse.campaigns[0].mainData.media[0];if(s.type!==e.AAMediaTypes.BANNER)return this.logger.error("Tipo de mídia não suportado para banner:",s.type),void this.errorListener?.onError();this.containerElement.appendChild(this.imageElement),await this.loadBanner(s)}catch(e){this.logger.error("Erro ao carregar banner:",e),this.errorListener?.onError()}}async loadBanner(e){try{if(!e.content?.url)return this.logger.error("Erro ao carregar banner: URL da imagem não encontrada"),void this.errorListener?.onError();this.containerElement.appendChild(this.imageElement),await this.loadImage(e.content.url,e)}catch(e){this.logger.error("Erro ao carregar banner:",e),this.errorListener?.onError()}}async loadImage(e,t){try{const r=St.getUserData();if(!r?.userId)return this.logger.error("Erro ao carregar banner: userId não encontrado nas preferences"),this.removeImageFromDOM(),void this.errorListener?.onError();const i=r.userId,n=await fetch(e,{method:"GET",mode:"cors",cache:"default"});if(!n.ok)return this.logger.error(`Erro ao carregar imagem: ${n.status} ${n.statusText}`),this.removeImageFromDOM(),void this.errorListener?.onError();const a=await n.blob(),s=URL.createObjectURL(a);this.imageElement.src=s,this.imageElement.alt=t.title||"Banner",this.imageElement.onload=()=>{this.applyOptimizedFit()},this.imageElement.onerror=()=>{this.logger.error("Erro ao carregar imagem: falha no carregamento da imagem"),this.removeImageFromDOM(),this.errorListener?.onError()},(new q).sendImpressedEvent(t.campaignId,t.requestId,t.uuid),this.successListener?.onSuccess(t.analytics?.impression),this.setupClickHandler(t,i)}catch(e){this.logger.error("Erro ao carregar imagem:",e),this.removeImageFromDOM(),this.errorListener?.onError()}}removeImageFromDOM(){try{this.imageElement&&this.imageElement.parentNode&&this.imageElement.parentNode.removeChild(this.imageElement)}catch(e){this.logger.error("Erro ao remover imagem do DOM:",e)}}applyOptimizedFit(){try{this.containerElement.style.display="flex",this.containerElement.style.alignItems="center",this.containerElement.style.justifyContent="center",this.imageElement.style.maxWidth="100%",this.imageElement.style.maxHeight="100%",this.imageElement.style.objectFit="contain",this.imageElement.style.objectPosition="center",this.logger.debug("Fit simples aplicado com flexbox")}catch(e){this.logger.error("Erro ao aplicar fit simples:",e),this.imageElement.style.width="100%",this.imageElement.style.height="auto",this.imageElement.style.objectFit="contain"}}setupClickHandler(e,t){const r=e.externalUrl?.url||e.success?.url,i=!!this.mediaClickHandler;(i||r)&&(this.imageElement.style.cursor="pointer",this.imageElement.addEventListener("click",()=>{if(this.clickListener?.onClick(e.analytics?.click),i){const t=new ut(e);return void Promise.resolve(this.mediaClickHandler(t)).catch(e=>this.logger.error("Erro no mediaClickHandler do banner:",e))}this.executeBannerClick(r,e,t)}))}async executeBannerClick(e,t,r){try{const r=t.campaignId||t.campaignUuid;if(!r)return void this.logger.error("Erro ao executar clique: campaignId não encontrado na mídia");const i=new q;i.sendMediaClickEvent(r,t.requestId,t.uuid),i.sendClickThroughEvent(r,t.requestId,t.uuid),window.open(e,"_blank","noopener,noreferrer")}catch(e){this.logger.error("Erro ao executar clique do banner:",e)}}destroy(){this.campaignCall&&(this.campaignCall=void 0),this.imageElement.removeEventListener("click",()=>{}),this.containerElement&&(this.containerElement.innerHTML="")}}class xt{constructor(e){this.config={timeout:1e4,debug:!1,...e},this.logger=new y(this.config.debug),this.sdkManager=new Ct,this.adsManager=new Nt(this.config.appId,this.config.appVersion,this.config.debug),St.setDebugMode(this.config.debug||!1),this.logger.debug("Debug mode salvo via PreferencesUtil:",this.config.debug||!1),this.logger.info("SDK Akross Artemis Ads criado"),this.logger.debug("Configuração:",this.config)}async initialize(){return this.sdkManager.initialize(this.config)}isInitialized(){return this.sdkManager.getIsInitialized()}async setUserId(e,t){return this.sdkManager.setUserId(e,t)}async getUserId(){return this.sdkManager.getUserId()}async getUserData(){return this.sdkManager.getUserData()}async setCustomHeaders(e){return this.sdkManager.setCustomHeaders(e)}async removeCustomHeaders(){return this.sdkManager.removeCustomHeaders()}async getCustomHeaders(){return this.sdkManager.getCustomHeaders()}getConfig(){return this.sdkManager.getConfig()}async clearAll(){return this.sdkManager.clearAll()}getDebugInfo(){return this.sdkManager.getDebugInfo()}getVersion(){return ie()}getVersionInfo(){return ne()}async sendEvent(e,t,r,i,n){return this.adsManager.sendEvent(e,t,r,i,n)}async sendCampaignsImpressionEvent(e,t){return this.adsManager.sendCampaignsImpressionEvent(e,t)}async sendCampaignClickEvent(e,t){return this.adsManager.sendCampaignClickEvent(e,t)}async sendSuccessImpressionEvent(e,t,r){return this.adsManager.sendSuccessImpressionEvent(e,t,r)}async sendMediaClickEvent(e,t,r){return this.adsManager.sendMediaClickEvent(e,t,r)}async sendClickThroughEvent(e,t,r){return this.adsManager.sendClickThroughEvent(e,t,r)}async requestCampaign(e,t,r,i){return this.logger.debug("Solicitando campanhas para zona:",e),this.adsManager.requestCampaign(e,t||1,r,i)}async bannerClick(e,t,r,i){return this.logger.debug("Processando clique em banner:",{campaignId:t,mediaId:i}),this.adsManager.bannerClick(e,t,r,i)}}let Ot=null;async function Pt(e){return Ot||(Ot=new xt(e),await Ot.initialize(),Ot)}function Ut(){return Ot}function Vt(){Ot&&(Ot.clearAll(),Ot=null,"undefined"!=typeof window&&delete window.AkrossAds)}return"undefined"!=typeof window&&(window.AkrossAds={init:Pt,getInstance:Ut,destroy:Vt,SDK:xt,AAManager:Ct,AdsManager:Nt,VERSION:ae,VERSION_INFO:se,getVersion:ie,getVersionInfo:ne,AAMedia:ut,AACampaign:yt,AACampaignResponse:wt,AACampaignResult:bt,AAZone:At,AAMainData:pt,AAContent:f,AASuccess:v,AABenefitOffer:mt,AAAdWatchResult:E,AAVastPlayer:it,AARewardedVideoHandler:lt,AAEventsCallbackHelper:q,AARvEventsCallbackHelper:B,AAMediaResultHelper:K,PreferencesUtil:St,GlobalLoadingOverlay:J,ArtemisAdsBannerLoader:Mt}),e.AAAdWatchResult=E,e.AABanner=dt,e.AABenefitOffer=mt,e.AACampaign=yt,e.AACampaignConfig=o,e.AACampaignRequest=Rt,e.AACampaignResponse=wt,e.AACampaignResult=bt,e.AAContent=f,e.AAError=u,e.AAEvent=Et,e.AAEventBenefit=ft,e.AAEventDetail=vt,e.AAEventsCallbackHelper=q,e.AAHeader=ht,e.AALayout=gt,e.AAMainData=pt,e.AAManager=Ct,e.AAMedia=ut,e.AAMediaResultHelper=K,e.AAProgrammatic=g,e.AARewardedVideo=lt,e.AARvEventsCallbackHelper=B,e.AASuccess=v,e.AASurveyV2=p,e.AAVastPlayer=it,e.AAZone=At,e.AdsManager=Nt,e.AkrossAdsSDK=xt,e.ArtemisAdsBannerLoader=Mt,e.CAMPAIGN_CLICK_EVENT=I,e.CLICK_EVENT="click",e.ConfigUtils=t,e.ERROR_EVENT=x,e.ERROR_MESSAGES=W,e.GAMRewardedVideoWrapper=st,e.IMPRESSION_EVENT=R,e.Logger=y,e.LuminaRewardedVideoWrapper=ot,e.NO_FILL_EVENT=N,e.PROGRAMMATIC_ERROR=L,e.PROGRAMMATIC_FALLBACK_REQ=D,e.PROGRAMMATIC_SKIPPED=M,e.PROG_CONN_ERROR_EVENT=C,e.PreferencesUtil=St,e.SUCCESS_IMPRESSION_EVENT=T,e.UserDataCache=r,e.VERSION=ae,e.VERSION_INFO=se,e.VPAID_COMPLETE_EVENT=k,e.VPAID_FIRST_QUARTILE_EVENT=P,e.VPAID_MIDPOINT_EVENT=U,e.VPAID_SKIPPED_EVENT=_,e.VPAID_START_EVENT=O,e.VPAID_THIRD_QUARTILE_EVENT=V,e.WATERFALL_START_EVENT=S,e.WaterfallResultHelper=at,e.applyGPTPpidIfEnabled=re,e.createAAEventsCallbackHelper=F,e.createAAMediaResultHelper=function(e){return new K(e)},e.createAARewardedVideoHandler=function(e){return new lt(e)},e.createAARvEventsCallbackHelper=H,e.createAAVastPlayer=function(e){return new it(e)},e.createGAMRewardedVideoWrapper=function(e){return new st(e)},e.createLuminaRewardedVideoWrapper=function(e){return new ot(e)},e.createWaterfallResultHelper=function(){return new at},e.destroy=Vt,e.getDeviceType=function(){return a()?"mobile":n()?"tablet":s()?"desktop":"unknown"},e.getInstance=Ut,e.getVersion=ie,e.getVersionInfo=ne,e.init=Pt,e.isAndroid=function(){if("undefined"==typeof navigator)return!1;const e=navigator.userAgent||"";return/Android/i.test(e)},e.isDesktop=s,e.isGPTPpidEnabled=Z,e.isIOS=i,e.isMediaTypeSupported=function(t){return[e.AAMediaTypes.BANNER,e.AAMediaTypes.VIDEO_V2,e.AAMediaTypes.PROGRAMMATIC_V2,e.AAMediaTypes.SURVEY_V2,e.AAMediaTypes.EXTERNAL_REDIRECT,e.AAMediaTypes.TYPE_GOOGLE_RV,e.AAMediaTypes.TYPE_GOOGLE_RI,e.AAMediaTypes.TYPE_MAX_RV,e.AAMediaTypes.TYPE_KWAI_RV,e.AAMediaTypes.TYPE_FALLBACK].includes(t)},e.isMobile=a,e.isTablet=n,e.isValidPPID=ee,e.loadGPTScript=j,e.loadIMAScript=$,e.loadLuminaScript=Y,e.setGPTPublisherProvidedId=te,e}({});