@openplayerjs/ads 3.4.2 → 3.4.3
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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.js +722 -346
- package/dist/index.js.map +1 -1
- package/dist/openplayer-ads.js +1 -1
- package/dist/openplayer-ads.js.map +1 -1
- package/package.json +2 -2
package/dist/openplayer-ads.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@openplayerjs/core")):"function"==typeof define&&define.amd?define(["@openplayerjs/core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).OpenPlayerJS)}(this,function(e){"use strict";function t(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)}function r(e){return(new DOMParser).parseFromString(String(e||""),"text/xml")}async function i(e){if("xml"===e.kind){if("string"==typeof e.value)return e.value;try{return(new XMLSerializer).serializeToString(e.value)}catch{return String(e.value)}}const t=await fetch(e.value);if(!t.ok)throw new Error(`VAST request failed: ${t.status}`);return t.text()}function n(e,t){if(!e)return;const r=e.trim();if(!r)return;if(r.endsWith("%")){const e=Number(r.slice(0,-1));return Number.isFinite(e)&&e>=0&&e<=100&&Number.isFinite(t)&&t>0?e/100*t:void 0}const i=function(e){const t=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(String(e).trim());if(!t)return null;const r=Number(t[1]),i=Number(t[2]),n=Number(t[3]);return[r,i,n].every(e=>Number.isFinite(e))?3600*r+60*i+n:null}(r);if(null!=i)return i;const n=Number(r);return Number.isFinite(n)&&n>=0?n:void 0}function s(e,t){if(!Array.isArray(e)||0===e.length)return null;const r=e.map(e=>({type:String(e?.mimeType||e?.type||""),fileURL:String(e?.fileURL||e?.url||e?.src||""),bitrate:Number(e?.bitrate||e?.bitRate||0),width:Number(e?.width||0),height:Number(e?.height||0),raw:e})).filter(e=>Boolean(e.fileURL));if(0===r.length)return null;for(const e of t){const t=r.filter(t=>(t.type||"").toLowerCase()===e.toLowerCase());if(t.length)return t.sort((e,t)=>(t.bitrate||0)-(e.bitrate||0))[0]}return r.sort((e,t)=>(t.bitrate||0)-(e.bitrate||0))[0]}function a(e){const t=e?.linear||e?.Linear||e,r=t?.skipDelay??t?.skipdelay;if("number"==typeof r&&Number.isFinite(r)&&r>=0)return String(r);const i=[t?.skipOffset,t?.skipoffset,t?.attributes?.skipOffset,t?.attributes?.skipoffset,t?.attributes?.skipOffset?.value,t?.attributes?.skipoffset?.value,t?.attributes?.skipOffset?.["#text"],t?.attributes?.skipoffset?.["#text"]];if(t&&"object"==typeof t)for(const e of["skipOffset","skipoffset","skipDelay","skipdelay"])i.push(t[e]),i.push(t?.attributes?.[e]);const n=e=>{if("number"==typeof e&&Number.isFinite(e)&&e>=0)return String(e);if("string"==typeof e){const t=e.trim();return t||void 0}if(e&&"object"==typeof e){const t=e,r=t.value??t["#text"]??t.text;if("string"==typeof r){const e=r.trim();return e||void 0}}};for(const e of i){const t=n(e);if(t)return t}}function o(e,t){const r=[...e?.mediaFiles||e?.MediaFiles||e?.linear?.mediaFiles||e?.linear?.MediaFiles||[],...e?.interactiveCreativeFiles||e?.linear?.interactiveCreativeFiles||e?.linear?.InteractiveCreativeFiles||[e?.interactiveCreativeFile]||[e?.InteractiveCreativeFile]||[]];for(const e of r){if("simid"===String(e?.apiFramework||e?.APIFramework||"").toLowerCase()){const t=String(e?.fileURL||e?.url||e?.src||"").trim();if(t)return t}}if(t)for(const e of["InteractiveCreativeFile","MediaFile"]){const r=Array.from(t.getElementsByTagName(e));for(const e of r){if("simid"===(e.getAttribute("apiFramework")||"").toLowerCase()){const t=(e.textContent||"").trim();if(t)return t}}}}function l(e){const t=e?.ads||e?.vastResponse?.ads;if(Array.isArray(t)&&t.length)return t;const r=e?.adPods||e?.vastResponse?.adPods||e?.vastResponse?.adpods;if(Array.isArray(r)&&r.length){const e=[];for(const t of r){const r=t?.ads||t?.Ads;Array.isArray(r)&&e.push(...r)}if(e.length)return e}const i=e?.adPod||e?.vastResponse?.adPod||e?.vastResponse?.adpod,n=i?.ads||i?.Ads;return Array.isArray(n)&&n.length?n:[]}function c(e,t){const r=l(e),i=[];for(const e of r){const r=e?.creatives||e?.Creatives||[],n=e?.sequence||e?.attributes?.sequence||void 0,o=null!=n?Number(n):void 0;for(let n=0;n<r.length;n++){const l=r[n],c=s(l?.mediaFiles||l?.MediaFiles||l?.linear?.mediaFiles||l?.Linear?.mediaFiles||l?.linear?.MediaFiles||l?.linear?.mediafiles||[],t);if(!c)continue;const u=a(l),d=l?.companionAds?.companions||l?.companions||void 0,h=l?.nonLinearAds?.nonLinears||l?.nonLinears||void 0;i.push({ad:e,creative:l,mediaFile:c,sequence:Number.isFinite(o)?o:void 0,creativeIndex:n,skipOffset:u,companions:Array.isArray(d)?d:void 0,nonLinears:Array.isArray(h)?h:void 0})}}return i.sort((e,t)=>{const r=e.sequence??Number.MAX_SAFE_INTEGER,i=t.sequence??Number.MAX_SAFE_INTEGER;return r!==i?r-i:(e.creativeIndex??0)-(t.creativeIndex??0)})}function u(e){const t=l(e),r=[];for(const e of t){const t=e?.creatives||e?.Creatives||[];for(const i of t){const t=i?.variations??i?.nonLinearAds?.nonLinears??i?.nonLinearAds?.nonLinear??i?.NonLinearAds?.NonLinear??i?.nonLinears??i?.NonLinears??void 0;if(t===i?.variations&&"nonlinear"!==i?.type)continue;const n=Array.isArray(t)?t:t?[t]:[];if(0===n.length)continue;const s=e?.sequence||e?.attributes?.sequence||void 0,a=null!=s?Number(s):void 0;for(const t of n)r.push({ad:e,creative:i,nonLinear:t,sequence:Number.isFinite(a)?a:void 0})}}return r.sort((e,t)=>null==e.sequence&&null==t.sequence?0:null==e.sequence?1:null==t.sequence?-1:e.sequence-t.sequence)}function d(e){const t=[],r=(e,t)=>{try{if(e.getElementsByTagNameNS){const r=e.getElementsByTagNameNS("*",t),i=Array.from(r);if(i.length)return i}}catch{}try{return Array.from(e.getElementsByTagName(t))}catch{return[]}},i=(e,t)=>{const i=r(e,t);return n=i[0]??null,(n?.textContent||"").trim();var n},n=[];try{const t=r(e,"Companion");for(const e of t){const t=Number(e.getAttribute("width")||0),r=Number(e.getAttribute("height")||0),s=i(e,"StaticResource"),a=i(e,"CompanionClickThrough");s&&n.push({width:t||void 0,height:r||void 0,staticResource:{value:s},clickThrough:a||void 0})}}catch{}const s=r(e,"NonLinear");for(const e of s){const r=Number(e.getAttribute("width")||0),s=Number(e.getAttribute("height")||0),a=e.getAttribute("minSuggestedDuration")||void 0,o=i(e,"StaticResource"),l=i(e,"IFrameResource"),c=i(e,"HTMLResource"),u={width:r||void 0,height:s||void 0,minSuggestedDuration:a,staticResource:o?{value:o}:void 0,iFrameResource:l?{value:l}:void 0,htmlResource:c?{value:c}:void 0,nonLinearClickThrough:i(e,"NonLinearClickThrough")||void 0};t.push({nonLinear:u,companions:n.length?n:void 0})}return t}function h(e){const t=function(e){if(!e)return[];const t=e.closedCaptionFiles??e.ClosedCaptionFiles??e.closedCaptionFile??e.ClosedCaptionFile??null;return(Array.isArray(t)?t:Array.isArray(t?.closedCaptionFiles)?t.closedCaptionFiles:Array.isArray(t?.ClosedCaptionFile)?t.ClosedCaptionFile:Array.isArray(t?.closedCaptionFile)?t.closedCaptionFile:[]).map(e=>({type:e?.type??e?.mimeType??e?.mime_type,language:e?.language??e?.lang,fileURL:e?.fileURL??e?.url??e?.src})).filter(e=>"string"==typeof e.fileURL&&e.fileURL.length>0)}(e);return t.map((e,t)=>{const r=e.language?String(e.language):"",i=e.type?String(e.type):"";return{src:String(e.fileURL),kind:"captions",srclang:r||void 0,label:r?r.toUpperCase():`CC ${t+1}`,type:i||void 0}}).filter(e=>!!e.src)}class p{constructor(e,t,r,i,n){Object.defineProperty(this,"overlay",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cfg",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"getAdVideo",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"getTracker",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"onSkipCallback",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"skipWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipBtn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipOffsetRaw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipAtSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"companionWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nonLinearWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedNonLinearContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedCompanionContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sessionUnsubs",{enumerable:!0,configurable:!0,writable:!0,value:[]})}addSessionUnsub(e){this.sessionUnsubs.push(e)}clearSession(){for(const e of this.sessionUnsubs)e();this.sessionUnsubs=[],this.clearAdOverlays()}resolveContainer(e,t){if(e&&1===e.nodeType)return e;if(t){const e=document.querySelector(t);if(e instanceof HTMLElement)return e}}getNonLinearContainer(){return this.resolvedNonLinearContainer||(this.resolvedNonLinearContainer=this.resolveContainer(this.cfg.nonLinearContainer,this.cfg.nonLinearSelector)),this.resolvedNonLinearContainer}getCompanionContainer(){return this.resolvedCompanionContainer||(this.resolvedCompanionContainer=this.resolveContainer(this.cfg.companionContainer,this.cfg.companionSelector)),this.resolvedCompanionContainer}resolveMount(e){if(this.cfg.mountEl)return this.cfg.mountEl;if(this.cfg.mountSelector){const e=document.querySelector(this.cfg.mountSelector);if(e)return e}return e.closest(".op-player")||e.parentElement||document.body}ensureOverlayMounted(e){const t=this.resolveMount(e);if(t instanceof HTMLElement){const e=window.getComputedStyle(t);e.position&&"static"!==e.position||(t.style.position="relative")}this.overlay.style.position="absolute",this.overlay.style.inset="0",this.overlay.style.width="100%",this.overlay.style.height="100%",this.overlay.style.zIndex=this.overlay.style.zIndex||"3",this.overlay.style.pointerEvents="auto",this.overlay.parentElement!==t&&t.appendChild(this.overlay)}setSafeHTML(e,t){const r=document.createElement("template");r.innerHTML=String(t||"");const i=new Set(["SCRIPT","IFRAME","OBJECT","EMBED","LINK","STYLE","SVG","MATH","FORM","INPUT","TEXTAREA","SELECT","OPTION","META","BASE"]),n=document.createTreeWalker(r.content,NodeFilter.SHOW_ELEMENT),s=[];for(;n.nextNode();){const e=n.currentNode;i.has(e.tagName)?s.push(e):Array.from(e.attributes).forEach(t=>{const r=t.name.toLowerCase(),i=(t.value||"").trim();if(r.startsWith("on")&&e.removeAttribute(t.name),"href"===r||"src"===r||"xlink:href"===r){const r=i.toLowerCase(),n=r.startsWith("javascript:"),s=r.startsWith("vbscript:"),a=r.startsWith("data:"),o=r.startsWith("http://")||r.startsWith("https://")||r.startsWith("/")||r.startsWith("./"),l=a&&/^data:image\/(png|gif|jpe?g|webp|svg\+xml);/i.test(i);(n||s||!o&&!l)&&e.removeAttribute(t.name)}"srcdoc"===r&&e.removeAttribute(t.name)})}s.forEach(e=>e.remove()),e.replaceChildren(r.content.cloneNode(!0))}safeWindowOpen(e){try{const t=new URL(e,window.location.href);if("http:"!==t.protocol&&"https:"!==t.protocol)return;window.open(t.toString(),"_blank","noopener,noreferrer")}catch{}}ensureSkipDom(){if(this.skipWrap&&this.skipBtn)return;const t=document.createElement("div");t.className="op-ads__skip";const r=document.createElement("button");r.type="button",r.className="op-ads__skip-btn",r.textContent=this.cfg.labels?.skip||"Skip Ad",t.appendChild(r),this.overlay.appendChild(t);const i=e=>{this.onSkipCallback(),e.preventDefault(),e.stopPropagation()};r.addEventListener("click",i,e.EVENT_OPTIONS),this.skipWrap=t,this.skipBtn=r,this.sessionUnsubs.push(()=>r.removeEventListener("click",i)),this.sessionUnsubs.push(()=>t.remove())}hideSkipUi(){this.skipWrap&&(this.skipWrap.style.display="none"),this.skipOffsetRaw=void 0,this.skipAtSeconds=void 0}setupSkipUIForPodItem(e,t){this.hideSkipUi();const r=this.getAdVideo();if(!r)return;const i=e.skipOffset??a(e.creative);if(!i)return void t("creative not skippable (no skipOffset/skipDelay)",{sequence:e.sequence});t("creative skippable",i),this.skipOffsetRaw=i,this.ensureSkipDom();const s=()=>{const e=r.duration,t=n(i,e);if(null==t)return;this.skipAtSeconds=t;const s=r.currentTime||0,a=Math.max(0,t-s);this.skipWrap&&(this.skipWrap.style.display="block"),this.skipBtn&&(this.skipBtn.textContent=a<=.05?this.cfg.labels?.skip||"Skip Ad":Math.ceil(a).toString(),this.skipBtn.style.pointerEvents=a<=.05?"auto":"none")};r.addEventListener("timeupdate",s),r.addEventListener("loadedmetadata",s),s(),this.sessionUnsubs.push(()=>r.removeEventListener("timeupdate",s)),this.sessionUnsubs.push(()=>r.removeEventListener("loadedmetadata",s))}requestSkip(e,t,r,i,n){if(this.skipOffsetRaw&&null!=this.skipAtSeconds&&t){const r=t.currentTime||0;if(r+.01<this.skipAtSeconds)return void n("skip requested too early",{cur:r,skipAt:this.skipAtSeconds,reason:e})}try{this.getTracker()?.trackSkip?.()}catch{}i({break:r?{kind:r.kind,id:r.breakId}:null,reason:e});const s=t;if(s)try{Number.isFinite(s.duration)&&s.duration>0&&(s.currentTime=Math.max(0,s.duration-.001)),s.dispatchEvent(new Event("ended"))}catch{}}clearAdOverlays(){this.hideSkipUi(),this.skipWrap?.remove(),this.skipWrap=void 0,this.skipBtn=void 0,this.companionWrap?.remove(),this.nonLinearWrap?.remove(),this.companionWrap=void 0,this.nonLinearWrap=void 0}mountCompanions(e){const t=this.getCompanionContainer();if(!t)return;const r=("companion"===e?.type?e?.variations:void 0)||e?.companionAds?.companions||e?.companions;if(!Array.isArray(r)||0===r.length)return;const i=document.createElement("div");i.className="op-ads__companions",i.style.zIndex="2",i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.maxWidth="40%",i.style.pointerEvents="auto";for(const e of r){const t=this.renderCompanion(e);t&&i.appendChild(t)}i.childElementCount&&(t.appendChild(i),this.companionWrap=i,this.sessionUnsubs.push(()=>i.remove()))}renderCompanion(e){const t=e?.companionClickThroughURLTemplate||e?.clickThroughURLTemplate||e?.companionClickThrough||e?.clickThrough,r=document.createElement("div");r.className="op-ads__companion",r.style.position="relative",r.style.cursor=t?"pointer":"default";const i=e?.staticResource||e?.StaticResource||e?.staticResources?.[0]||e?.StaticResources?.[0],n=e?.iFrameResource||e?.IFrameResource||e?.iFrameResources?.[0]||e?.IFrameResources?.[0],s=e?.htmlResource||e?.HTMLResource||e?.htmlResources?.[0]||e?.HTMLResources?.[0];let a=null;if(i){const e=document.createElement("img");e.src=String(i?.url||i?.uri||i?.value||i),e.style.maxWidth="100%",e.style.height="auto",a=e}else if(n){const e=document.createElement("iframe");e.src=String(n?.url||n?.uri||n?.value||n),e.style.border="0",e.style.width="100%",e.style.height="100%",a=e}else if(s){const e=document.createElement("div");this.setSafeHTML(e,String(s?.value||s)),a=e}if(!a)return null;if(r.appendChild(a),t){const e=e=>{const r="string"==typeof t?t:t.url;this.safeWindowOpen(r);try{this.getTracker()?.trackClick?.(),this.getTracker()?.trackClickThrough?.()}catch{}e.preventDefault(),e.stopPropagation()};r.addEventListener("click",e),this.sessionUnsubs.push(()=>r.removeEventListener("click",e))}return r}nonLinearSuggestedDurationSeconds(e){const t=e?.minSuggestedDuration??e?.minSuggestedDurationSeconds??e?.attributes?.minSuggestedDuration??void 0;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;if("string"==typeof t){const e=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(t.trim());if(e){const t=3600*Number(e[1])+60*Number(e[2])+Number(e[3]);if(Number.isFinite(t)&&t>0)return t}const r=Number(t);if(Number.isFinite(r)&&r>0)return r}return 10}ensureNonLinearDom(){if(this.nonLinearWrap)return;const e=document.createElement("div");e.className="op-ads__nonlinear",e.style.position="absolute",e.style.left="12px",e.style.right="12px",e.style.bottom="12px",e.style.zIndex="2",e.style.display="flex",e.style.justifyContent="center",e.style.pointerEvents="auto";(this.getNonLinearContainer()||this.getAdVideo()?.parentElement||this.overlay).appendChild(e),this.nonLinearWrap=e,this.sessionUnsubs.push(()=>e.remove())}renderNonLinear(e){const t=e?.nonlinearClickThroughURLTemplate||e?.nonLinearClickThroughURLTemplate||e?.clickThroughURLTemplate||e?.nonLinearClickThrough||e?.clickThrough,r=document.createElement("div");r.className="op-ads__nonlinear-item",r.style.position="relative",r.style.maxWidth="100%",r.style.cursor=t?"pointer":"default";const i=e=>Array.isArray(e)?e[0]:e,n=i(e?.staticResource??e?.StaticResource??e?.staticResources??e?.StaticResources),s=i(e?.iFrameResource??e?.IFrameResource??e?.iFrameResources??e?.IFrameResources),a=i(e?.htmlResource??e?.HTMLResource??e?.htmlResources??e?.HTMLResources);let o=null;if(n){const e=document.createElement("img");e.src=String(n?.url||n?.uri||n?.value||n),e.style.maxWidth="100%",e.style.height="auto",o=e}else if(s){const e=document.createElement("iframe");e.src=String(s?.url||s?.uri||s?.value||s),e.style.border="0",e.style.width="100%",e.style.height="100%",o=e}else if(a){const e=document.createElement("div");this.setSafeHTML(e,String(a?.value||a)),o=e}if(!o)return null;if(r.appendChild(o),t){const e=e=>{if("BUTTON"===e.target?.tagName)return;const r="string"==typeof t?t:t.url;this.safeWindowOpen(r);try{this.getTracker()?.trackClick?.(),this.getTracker()?.trackClickThrough?.()}catch{}e.preventDefault(),e.stopPropagation()};r.addEventListener("click",e),this.sessionUnsubs.push(()=>r.removeEventListener("click",e))}return r}mountNonLinear(e){const t=("nonlinear"===e?.type?e?.variations:void 0)??e?.nonLinearAds?.nonLinears??e?.nonLinearAds?.nonLinear??e?.NonLinearAds?.NonLinear??e?.nonLinears??e?.NonLinears??void 0,r=Array.isArray(t)?t:t?[t]:[];if(0!==r.length){this.ensureNonLinearDom();for(const e of r){const t=this.renderNonLinear(e);t&&this.nonLinearWrap.appendChild(t)}}}mountSimidIframe(e){let t=this.overlay.querySelector(".op-ads__simid");t?t.innerHTML="":(t=document.createElement("div"),t.className="op-ads__simid",t.style.position="absolute",t.style.inset="0",t.style.pointerEvents="auto",this.overlay.appendChild(t));const r=document.createElement("iframe");return r.src=e,r.setAttribute("title","SIMID"),r.setAttribute("loading","lazy"),r.setAttribute("referrerpolicy","no-referrer"),r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-popups"),r.style.width="100%",r.style.height="100%",r.style.border="0",t.appendChild(r),r}}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var g=f(function e(t){for(var r in m(this,e),this.id=t.getAttribute("id"),this.allowMultipleAds=t.getAttribute("allowMultipleAds"),this.followRedirects=t.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null,t.childNodes){var i=t.childNodes[r];switch(i.localName){case"AdTagURI":this.adTagURI={templateType:i.getAttribute("templateType"),uri:(i.textContent||i.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=i.firstChild;this.vastAdData&&1!==this.vastAdData.nodeType;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=i}}});function v(e,t){var r=[];for(var i in e.childNodes){var n=e.childNodes[i];n.nodeName!==t&&t!=="vmap:".concat(n.nodeName)&&n.nodeName!=="vmap:".concat(t)||r.push(n)}return r}function b(e){var t={attributes:{},children:{},value:{}};t.value=function(e){if(!e||!e.childNodes)return{};var t=e.childNodes,r=[];for(var i in t){var n=t[i];"#cdata-section"===n.nodeName&&r.push(n)}if(r&&r.length>0)try{return JSON.parse(r[0].data)}catch(e){}var s="";for(var a in t){var o=t[a];switch(o.nodeName){case"#text":s+=o.textContent.trim();break;case"#cdata-section":s+=o.data}}return s}(e);var r=e.attributes;if(r)for(var i in r){var n=r[i];n.nodeName&&void 0!==n.nodeValue&&null!==n.nodeValue&&(t.attributes[n.nodeName]=n.nodeValue)}var s=e.childNodes;if(s)for(var a in s){var o=s[a];o.nodeName&&"#"!==o.nodeName.substring(0,1)&&(t.children[o.nodeName]=b(o))}return t}var y=function(){function e(t){for(var r in m(this,e),this.timeOffset=t.getAttribute("timeOffset"),this.breakType=t.getAttribute("breakType"),this.breakId=t.getAttribute("breakId"),this.repeatAfter=t.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[],t.childNodes){var i=t.childNodes[r];switch(i.localName){case"AdSource":this.adSource=new g(i);break;case"TrackingEvents":for(var n in i.childNodes){var s=i.childNodes[n];"Tracking"===s.localName&&this.trackingEvents.push({event:s.getAttribute("event"),uri:(s.textContent||s.text||"").trim()})}break;case"Extensions":this.extensions=v(i,"Extension").map(function(e){return b(e)})}}}return f(e,[{key:"track",value:function(e,t){for(var r in this.trackingEvents){var i=this.trackingEvents[r];if(i.event===e){var n=i.uri;"error"===i.event&&(n=n.replace("[ERRORCODE]",t)),this.tracker(n)}}}},{key:"tracker",value:function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)}}]),e}(),E=f(function e(t){if(m(this,e),!t||!t.documentElement||"VMAP"!==t.documentElement.localName)throw new Error("Not a VMAP document");for(var r in this.version=t.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[],t.documentElement.childNodes){var i=t.documentElement.childNodes[r];switch(i.localName){case"AdBreak":this.adBreaks.push(new y(i));break;case"Extensions":this.extensions=v(i,"Extension").map(function(e){return b(e)})}}});function T(e){const t=e=>e.trim().startsWith("<");if(e.source&&"string"==typeof e.source.src&&e.source.src.trim()){const r=e.source.src.trim(),i=e.source.type;return t(r)?{input:{kind:"xml",value:r},sourceType:i}:{input:{kind:"url",value:r},sourceType:i}}const r=Array.isArray(e.sources)?e.sources[0]:void 0;if(r&&"string"==typeof r.src&&r.src.trim()){const e=r.src.trim(),i=r.type;return t(e)?{input:{kind:"xml",value:e},sourceType:i}:{input:{kind:"url",value:e},sourceType:i}}return{input:void 0,sourceType:void 0}}function k(e){if(e.id)return e.id;const{input:t,sourceType:r}=T(e),i="url"===t?.kind?t.value:"xml";return`${String(e.at)}:${r||"VAST"}:${i}`}class N{constructor(e,t,r,i){Object.defineProperty(this,"cfg",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"warn",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"onVmapError",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"resolvedBreaks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pendingPercentBreaks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"playedBreaks",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"vmapPending",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"vmapLoadPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pendingVmapSrc",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}isXmlString(e){return e.trim().startsWith("<")}getSource(e){return(this.cfg.sources||[]).find(t=>t.type===e&&"string"==typeof t.src&&t.src.trim())}getPrimaryVastLikeSource(){return this.getSource("VAST")||this.getSource("NONLINEAR")}inferSourceTypeForUrl(e){const t=this.cfg.sources||[],r=t.find(t=>t.src===e);return"NONLINEAR"===r?.type||t.length>0&&t.every(e=>"NONLINEAR"===e.type)?"NONLINEAR":void 0}getVastInputFromBreak(e){if(e.source&&"string"==typeof e.source.src&&e.source.src.trim()){const t=e.source.src.trim(),r=e.source.type;return this.isXmlString(t)?{input:{kind:"xml",value:t},sourceType:r}:{input:{kind:"url",value:t},sourceType:r}}const t=Array.isArray(e.sources)?e.sources[0]:void 0;if(t&&"string"==typeof t.src&&t.src.trim()){const e=t.src.trim(),r=t.type;return this.isXmlString(e)?{input:{kind:"xml",value:e},sourceType:r}:{input:{kind:"url",value:e},sourceType:r}}return{input:void 0,sourceType:void 0}}getBreakId(e){if(e.id)return e.id;const{input:t,sourceType:r}=this.getVastInputFromBreak(e),i="url"===t?.kind?t.value:"xml";return`${String(e.at)}:${r||"VAST"}:${i}`}getPrerollBreak(){for(const e of this.resolvedBreaks){if("preroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!1===e.once||!this.playedBreaks.has(t))return e}for(const e of this.cfg.breaks){if("preroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!1===e.once||!this.playedBreaks.has(t))return e}const e=this.cfg.breaks.some(e=>"preroll"===e.at);if(!e){const e=this.getPrimaryVastLikeSource();if(e?.src){const t={at:"preroll",source:{type:e.type,src:e.src},once:!0},r=this.getBreakId(t);if(!this.playedBreaks.has(r))return t}}}getPostrollBreak(){for(const e of this.resolvedBreaks){if("postroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!1===e.once||!this.playedBreaks.has(t))return e}}getDueMidrollBreaks(e){const t=this.ctx.core.media;if(Number.isFinite(t.duration)&&t.duration>0&&this.pendingPercentBreaks.length){const e=t.duration,r=[];for(const t of this.pendingPercentBreaks){const i=e*t.percent;r.push({id:t.id,at:i,once:t.once,source:t.source})}this.pendingPercentBreaks=[],this.resolvedBreaks.push(...r)}const r=[];for(const t of this.resolvedBreaks){if("number"!=typeof t.at)continue;if(!this.getVastInputFromBreak(t).input)continue;const i=this.getBreakId(t);!1!==t.once&&this.playedBreaks.has(i)||e+(this.cfg.breakTolerance??.25)>=t.at&&r.push(t)}return r.sort((e,t)=>e.at-t.at),r}getDueMidrollBreak(e){return this.getDueMidrollBreaks(e)[0]}rebuild(){const e=[...this.cfg.breaks||[]];if(0===e.length){const t=this.cfg.sources.filter(e=>("VAST"===e.type||"NONLINEAR"===e.type)&&e.src?.trim());if(t.length>0)if("playlist"===this.cfg.adSourcesMode)for(const r of t)e.push({at:"preroll",source:{type:r.type,src:r.src},once:!0});else t.length>1?e.push({at:"preroll",source:t[0],sources:t,once:!0}):e.push({at:"preroll",source:t[0],once:!0})}const t=this.getSource("VMAP");if(t?.src){const r=this.ctx?.core?.media;"none"===(r?(r.getAttribute("preload")||r.preload||"").toLowerCase():"")?this.pendingVmapSrc=t.src:(this.vmapPending=!0,this.vmapLoadPromise=this.loadVmapAndMerge(e,t.src))}this.resolvedBreaks=e}normalizeVmapAdSource(e){if(e)return Array.isArray(e)?e.find(e=>e?.adTagURI||e?.vastAdData)||e[0]:e}extractVastTagUri(e){if(e){if("string"==typeof e)return e.trim()||void 0;if("object"==typeof e){const t=e.uri||e.URI||e.value||e.text||e["#text"];if("string"==typeof t&&t.trim())return t.trim()}}}parseVmapTimeOffset(e){const t=String(e||"").trim();if(!t||"start"===t)return{at:"preroll"};if("end"===t)return{at:"postroll"};if(t.endsWith("%")){const e=Number(t.slice(0,-1));if(Number.isFinite(e)&&e>=0&&e<=100)return{at:0,pendingPercent:e/100}}const r=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(t);if(r){const e=Number(r[1]),t=Number(r[2]),i=Number(r[3]);if([e,t,i].every(e=>Number.isFinite(e)))return{at:3600*e+60*t+i}}const i=Number(t);return Number.isFinite(i)&&i>=0?{at:i}:{at:"preroll"}}async loadVmapAndMerge(e,t){try{const r=(t||this.getSource("VMAP")?.src||"").trim();if(!r)return;const i=this.isXmlString(r)?r:await fetch(r).then(e=>{if(!e.ok)throw new Error(`VMAP request failed: ${e.status}`);return e.text()}),n=(new DOMParser).parseFromString(i,"text/xml"),s=new E(n),a=[],o=s.adBreaks||[],l=this.pendingPercentBreaks.length,c=(()=>{try{const e=n.getElementsByTagNameNS("*","AdBreak");if(e&&e.length)return e.length}catch{}try{return n.getElementsByTagName("AdBreak").length}catch{return 0}})();for(let e=0;e<o.length;e++){const t=o[e],r=String(t?.breakType||"").toLowerCase();if(r&&"linear"!==r&&"nonlinear"!==r&&"non-linear"!==r)continue;const i=String(t?.timeOffset||"").trim(),n=`${t?.breakId||"vmap"}:${i||"start"}:${e}`,{at:s,pendingPercent:l}=this.parseVmapTimeOffset(i),c=this.normalizeVmapAdSource(t?.adSource),u=c?.vastAdData,d=c?.adTagURI,h=this.extractVastTagUri(d);let p;if(u&&("string"==typeof u?p=u:u?.nodeType&&(p=(new XMLSerializer).serializeToString(u))),!h&&!p)continue;const m={type:"nonlinear"===r||"non-linear"===r?"NONLINEAR":"VAST",src:h||p};null==l?a.push({id:n,at:s,once:!0,timeOffset:i||("postroll"===s?"end":"start"),source:m}):this.pendingPercentBreaks.push({id:n,percent:l,once:!0,source:m})}const u=a.length+(this.pendingPercentBreaks.length-l);c>0&&u<c&&(a.length=0,this.pendingPercentBreaks.splice(l)),0===a.length&&this.pendingPercentBreaks.length===l&&this.parseVmapFallback(n,a,l),this.resolvedBreaks=[...e,...a]}catch(e){this.warn("VMAP load/parse failed",e),this.onVmapError(e)}finally{this.vmapPending=!1}}parseVmapFallback(e,t,r){const i=(e,t)=>{try{const r=e.getElementsByTagNameNS?.("*",t);if(r&&r.length)return Array.from(r)}catch{}try{return Array.from(e.getElementsByTagName(t))}catch{return[]}},n=i(e,"AdBreak");for(let e=0;e<n.length;e++){const r=n[e],s=String(r.getAttribute("breakType")||"").toLowerCase();if(s&&"linear"!==s&&"nonlinear"!==s&&"non-linear"!==s)continue;const a=String(r.getAttribute("timeOffset")||"").trim(),o=`${r.getAttribute("breakId")||r.getAttribute("id")||"vmap-fb"}:${a||"start"}:${e}`,{at:l,pendingPercent:c}=this.parseVmapTimeOffset(a),u=i(r,"AdSource")[0];let d,h;if(u){const e=i(u,"AdTagURI");if(e.length&&(d=(e[0].textContent||"").trim()||void 0),!d){const e=i(u,"VASTAdData");e.length&&(h=(e[0].textContent||"").trim()||void 0)}}if(!d&&!h)continue;const p={type:"nonlinear"===s||"non-linear"===s?"NONLINEAR":"VAST",src:d||h};null==c?t.push({id:o,at:l,once:!0,timeOffset:a||("postroll"===l?"end":"start"),source:p}):this.pendingPercentBreaks.push({id:o,percent:c,once:!0,source:p})}}reset(){this.playedBreaks.clear(),this.vmapLoadPromise=null,this.vmapPending=!1,this.pendingVmapSrc=void 0,this.pendingPercentBreaks=[],this.resolvedBreaks=[]}}function A(){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:[]}}const w=["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 S(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=I(e);!t.ERRORCODE||r.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=M(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING;for(const e in t)t[e]=O(t[e]);for(const e in n){const r=n[e];"string"==typeof r&&i.push(C(r,t))}return i}function C(e,t){const r=(e=R(e,t)).match(/[^[\]]+(?=])/g);if(!r)return e;let i=r.filter(e=>w.indexOf(e)>-1);return 0===i.length?e:(i=i.reduce((e,t)=>(e[t]=-1,e),{}),R(e,i))}function R(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 I(e){return Array.isArray(e)?e.map(e=>e&&e.hasOwnProperty("url")?e.url:e):e}function L(e){return/^(https?:\/\/|\/\/)/.test(e)}function x(e,t){for(let r=0;r<t.length;r++)if(D(t[r],e))return!0;return!1}function D(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 O(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function M(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}const P={track:function(e,t,r){S(e,t,r).forEach(e=>{"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:S,extractURLsFromTemplates:I,filterUrlTemplates:function(e){return e.reduce((e,t)=>{const r=t.url||t;return L(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:x,isTemplateObjectEqual:D,encodeURIComponentRFC3986:O,replaceUrlMacros:C,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)=>(x(t,e)||e.push(t),e),[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:M,isValidUrl:L,isBrowserEnvironment:function(){return"undefined"!=typeof window},formatMacrosValues:function(e){return"object"!=typeof e?e:JSON.stringify(e)}};function U(e){return["true","TRUE","True","1"].includes(e)}const _={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:U,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:function(e){if(null==e)return-1;if(P.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]),s=parseInt(60*t[0]*60);return isNaN(s)||isNaN(n)||isNaN(i)||n>3600||i>60?-1:s+n+i},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=U(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=>{P.containsTemplateObject(t,e)||e.push(t)})}),e),[]);e.creatives=i.concat(e.creatives);const s=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,a=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&&(s&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),a&&(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=P.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 B(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}=A(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=_.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:{}}}(_.parseAttributes(e));t.htmlResources=_.childrenByName(e,"HTMLResource").reduce((e,t)=>{const r=_.parseNodeText(t);return r?e.concat(r):e},[]),t.iframeResources=_.childrenByName(e,"IFrameResource").reduce((e,t)=>{const r=_.parseNodeText(t);return r?e.concat(r):e},[]),t.staticResources=_.childrenByName(e,"StaticResource").reduce((e,t)=>{const r=_.parseNodeText(t);return r?e.concat({url:r,creativeType:t.getAttribute("creativeType")||null}):e},[]),t.altText=_.parseNodeText(_.childByName(e,"AltText"))||null;const r=_.childByName(e,"TrackingEvents");r&&_.childrenByName(r,"Tracking").forEach(e=>{const r=e.getAttribute("event"),i=_.parseNodeText(e);r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))}),t.companionClickTrackingURLTemplates=_.childrenByName(e,"CompanionClickTracking").map(e=>({id:e.getAttribute("id")||null,url:_.parseNodeText(e)})),t.companionClickThroughURLTemplate=_.parseNodeText(_.childByName(e,"CompanionClickThrough"))||null;const i=_.childByName(e,"AdParameters");return i&&(t.adParameters={value:_.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t}),r}function V(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}=A(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=_.parseDuration(_.parseNodeText(_.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=_.parseDuration(n);const s=_.childByName(e,"VideoClicks");if(s){const e=_.childByName(s,"ClickThrough");i.videoClickThroughURLTemplate=e?{id:e.getAttribute("id")||null,url:_.parseNodeText(e)}:null,_.childrenByName(s,"ClickTracking").forEach(e=>{i.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:_.parseNodeText(e)})}),_.childrenByName(s,"CustomClick").forEach(e=>{i.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:_.parseNodeText(e)})})}const a=_.childByName(e,"AdParameters");a&&(i.adParameters={value:_.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),_.childrenByName(e,"TrackingEvents").forEach(e=>{_.childrenByName(e,"Tracking").forEach(e=>{let t=e.getAttribute("event");const n=_.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(_.parseDuration(r))}Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(n)}})}),_.childrenByName(e,"MediaFiles").forEach(e=>{_.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=_.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=_.parseBoolean(r));const i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=_.parseBoolean(i)),t}(e))});const t=_.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:_.parseBoolean(e.variableDuration),fileURL:null}}(_.parseAttributes(e));return t.fileURL=_.parseNodeText(e),t}(t));const r=_.childByName(e,"ClosedCaptionFiles");r&&_.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}}(_.parseAttributes(e));t.fileURL=_.parseNodeText(e),i.closedCaptionFiles.push(t)});const n=_.childByName(e,"Mezzanine"),s=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(s){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=_.parseNodeText(n),e.delivery=s.delivery,e.codec=n.getAttribute("codec"),e.type=s.type,e.width=parseInt(s.width,10),e.height=parseInt(s.height,10),e.fileSize=parseInt(n.getAttribute("fileSize"),10),e.mediaType=n.getAttribute("mediaType")||"2D",i.mezzanine=e}});const o=_.childByName(e,"Icons");return o&&_.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=_.parseDuration(e.getAttribute("offset")),t.duration=_.parseDuration(e.getAttribute("duration")),t.altText=e.getAttribute("altText"),t.hoverText=e.getAttribute("hoverText"),_.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=_.parseNodeText(e)}),_.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=_.parseNodeText(e)}),_.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=_.parseNodeText(e)});const r=_.childByName(e,"IconClicks");if(r){t.iconClickThroughURLTemplate=_.parseNodeText(_.childByName(r,"IconClickThrough")),_.childrenByName(r,"IconClickTracking").forEach(e=>{t.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:_.parseNodeText(e)})});const e=_.childByName(r,"IconClickFallbackImages");e&&_.childrenByName(e,"IconClickFallbackImage").forEach(e=>{t.iconClickFallbackImages.push({url:_.parseNodeText(e)||null,width:e.getAttribute("width")||null,height:e.getAttribute("height")||null})})}return t.iconViewTrackingURLTemplate=_.parseNodeText(_.childByName(e,"IconViewTracking")),t}(e))}),i}function F(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}=A(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return _.childrenByName(e,"TrackingEvents").forEach(e=>{let t,i;_.childrenByName(e,"Tracking").forEach(e=>{t=e.getAttribute("event"),i=_.parseNodeText(e),t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))})}),_.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=_.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=_.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=_.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),_.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=_.parseNodeText(e)}),_.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=_.parseNodeText(e)}),_.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=_.parseNodeText(e)});const i=_.childByName(e,"AdParameters");i&&(t.adParameters={value:_.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t.nonlinearClickThroughURLTemplate=_.parseNodeText(_.childByName(e,"NonLinearClickThrough")),_.childrenByName(e,"NonLinearClickTracking").forEach(e=>{t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:_.parseNodeText(e)})}),r.variations.push(t)}),r}function q(e){const t=[];return e.forEach(e=>{const r=j(e);r&&t.push(r)}),t}function j(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=j(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=_.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 H(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}const W={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 G(e,t){if(!W[e.nodeName]||!W[e.nodeName].attributes)return;const r=W[e.nodeName].attributes.filter(t=>!e.getAttribute(t));r.length>0&&Y({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:r},t)}function X(e,t,r){const i=W[e.nodeName],n=!r&&"Wrapper"!==e.nodeName;if(i&&!n){if(i.subElements){const r=i.subElements.filter(t=>!_.childByName(e,t));r.length>0&&Y({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:r},t)}r&&i.oneOfinLineResources&&(i.oneOfinLineResources.some(t=>_.childByName(e,t))||Y({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}function z(e){return e.children&&0!==e.children.length}function Y(e,t){let{name:r,parentName:i,attributes:n,subElements:s,oneOfResources:a}=e,o="Element '".concat(r,"'");o+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):s?" missing required sub element(s) '".concat(s.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",t("VAST-warning",{message:o,parentElement:i,specVersion:4.1})}const Q=function e(t,r,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),G(t,r),z(t)){X(t,r,i);for(let n=0;n<t.children.length;n++)e(t.children[n],r,i)}else 0===_.parseNodeText(t).length&&Y({name:t.nodeName,parentName:t.parentNode.nodeName},r)};function K(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(_.copyNodeAttribute("id",e,i),_.copyNodeAttribute("sequence",e,i),_.copyNodeAttribute("adType",e,i),"Wrapper"===i.nodeName)return{ad:Z(i,t),type:"WRAPPER"};if("InLine"===i.nodeName)return{ad:$(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 $(e,t){let{allowMultipleAds:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return!1===r&&e.getAttribute("sequence")?null:J(e,t)}function J(e,t){let r=[];t&&Q(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}}(_.parseAttributes(e));return i.forEach(e=>{switch(e.nodeName){case"Error":n.errorURLTemplates.push(_.parseNodeText(e));break;case"Impression":n.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:_.parseNodeText(e)});break;case"Creatives":n.creatives=function(e){const t=[];return e.forEach(e=>{const r={id:e.getAttribute("id")||null,adId:H(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},i=[];let n;_.childrenByName(e,"UniversalAdId").forEach(e=>{const t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:_.parseNodeText(e)};i.push(t)});const s=_.childByName(e,"CreativeExtensions");s&&(n=q(_.childrenByName(s,"CreativeExtension")));for(const s in e.childNodes){const a=e.childNodes[s];let o;switch(a.nodeName){case"Linear":o=V(a,r);break;case"NonLinearAds":o=F(a,r);break;case"CompanionAds":o=B(a,r)}o&&(i&&(o.universalAdIds=i),n&&(o.creativeExtensions=n),t.push(o))}}),t}(_.childrenByName(e,"Creative"));break;case"Extensions":{const t=_.childrenByName(e,"Extension");n.extensions=q(t),n.adVerifications.length||(r=function(e){let t=null,r=[];return e.some(e=>t=_.childByName(e,"AdVerifications")),t&&(r=ee(_.childrenByName(t,"Verification"))),r}(t));break}case"AdVerifications":n.adVerifications=ee(_.childrenByName(e,"Verification"));break;case"AdSystem":n.system={value:_.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":n.title=_.parseNodeText(e);break;case"AdServingId":n.adServingId=_.parseNodeText(e);break;case"Category":n.categories.push({authority:e.getAttribute("authority")||null,value:_.parseNodeText(e)});break;case"Expires":n.expires=parseInt(_.parseNodeText(e),10);break;case"ViewableImpression":n.viewableImpression.push(function(e){const t=(e,t)=>{const r=_.parseNodeText(t);return r&&e.push(r),e};return{id:e.getAttribute("id")||null,viewable:_.childrenByName(e,"Viewable").reduce(t,[]),notViewable:_.childrenByName(e,"NotViewable").reduce(t,[]),viewUndetermined:_.childrenByName(e,"ViewUndetermined").reduce(t,[])}}(e));break;case"Description":n.description=_.parseNodeText(e);break;case"Advertiser":n.advertiser={id:e.getAttribute("id")||null,value:_.parseNodeText(e)};break;case"Pricing":n.pricing={value:_.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":n.survey={value:_.parseNodeText(e),type:e.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:_.parseNodeText(e)})}}),r.length&&(n.adVerifications=n.adVerifications.concat(r)),n}function Z(e,t){const r=J(e,t),i=e.getAttribute("followAdditionalWrappers"),n=e.getAttribute("allowMultipleAds"),s=e.getAttribute("fallbackOnNoAd");r.followAdditionalWrappers=!i||_.parseBoolean(i),r.allowMultipleAds=!!n&&_.parseBoolean(n),r.fallbackOnNoAd=s?_.parseBoolean(s):null;let a=_.childByName(e,"VASTAdTagURI");if(a?r.nextWrapperURL=_.parseNodeText(a):(a=_.childByName(e,"VASTAdTagURL"),a&&(r.nextWrapperURL=_.parseNodeText(_.childByName(a,"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 ee(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);_.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(),_.assignAttributes(n,r);break;case"VerificationParameters":r.parameters=i.trim()}});const n=_.childByName(e,"TrackingEvents");n&&_.childrenByName(n,"Tracking").forEach(e=>{const t=e.getAttribute("event"),i=_.parseNodeText(e);t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))}),t.push(r)}),t}class te{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 re=0,ie=0;const ne=(e,t)=>{!e||!t||e<=0||t<=0||(ie=(ie*re+8*e/t)/++re)},se={ERRORCODE:900,extensions:[]},ae="VAST response version not supported";class oe extends te{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({},se,t,...i)),P.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return ie}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(),ne(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:s,followAdditionalWrappers:a,wrapperChainId:o=0}=t;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName){var l;this.emit("VAST-ad-parsed",{type:"ERROR",url:i,wrapperDepth:n,wrapperChainId:o});const t="VideoAdServingTemplate"===(null==e||null===(l=e.documentElement)||void 0===l?void 0:l.nodeName);throw new Error(t?ae:"Invalid VAST XMLDocument")}const c=[],u=e.documentElement.childNodes,d=e.documentElement.getAttribute("version");r&&d&&(this.vastVersion=d);for(const e in u){const t=u[e];if("Error"===t.nodeName){const e=_.parseNodeText(t);r?this.rootErrorURLTemplates.push(e):this.errorURLTemplates.push(e)}else if("Ad"===t.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)s=!0;else if(!1===s&&c.length>1)break;const e=K(t,this.emit.bind(this),{allowMultipleAds:s,followAdditionalWrappers:a});e.ad?(c.push(e.ad),this.emit("VAST-ad-parsed",{type:e.type,url:i,wrapperDepth:n,adIndex:c.length-1,vastVersion:d,wrapperChainId:o})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return c}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:i=null,previousUrl:n=null,wrapperDepth:s=0,isRootVAST:a=!1,followAdditionalWrappers:o,allowMultipleAds:l,wrapperChainId:c=0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&a&&(l=!0);try{u=this.parseVastXml(e,{isRootVAST:a,url:t,wrapperDepth:s,allowMultipleAds:l,followAdditionalWrappers:o,wrapperChainId:c})}catch(e){return Promise.reject(e)}if(1===u.length&&null!=i&&(u[0].sequence=i),!1===r){const e=_.getSortedAdPods(u),t=_.getStandAloneAds(u);e.length?u=e:t.length&&(u=[t.shift()]),this.remainingAds=t}return this.resolveAds(u,{wrapperDepth:s,previousUrl:n,url:t,wrapperChainId:c})}resolveAds(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:i,wrapperChainId:n=0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=[];return r=i,e.forEach(e=>{const i=this.resolveWrappers(e,t,r,n);s.push(i),0===t&&n++}),Promise.all(s).then(e=>P.flatten(e))}resolveWrappers(e,t,r,i){const n={...e};return new Promise(e=>{var s;if(t++,!n.nextWrapperURL)return delete n.nextWrapperURL,e(n);if(!this.fetcher)return n.VASTAdTagURI=n.nextWrapperURL,delete n.nextWrapperURL,e(n);if(t>=this.maxWrapperDepth)return n.errorCode=302,delete n.nextWrapperURL,e(n);n.nextWrapperURL=_.resolveVastAdTagURI(n.nextWrapperURL,r);const a=null!==(s=this.parsingOptions.allowMultipleAds)&&void 0!==s?s:n.allowMultipleAds,o=n.sequence;this.fetcher.fetchVAST({url:n.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth,wrapperDepth:t,previousUrl:r,wrapperAd:n,wrapperChainId:i}).then(s=>this.parse(s,{url:n.nextWrapperURL,previousUrl:r,wrapperSequence:o,wrapperDepth:t,followAdditionalWrappers:n.followAdditionalWrappers,allowMultipleAds:a,wrapperChainId:i}).then(t=>{if(delete n.nextWrapperURL,0===t.length)return n.creatives=[],e(n);t.forEach(e=>{e&&_.mergeWrapperAdData(e,n)}),e(t)})).catch(t=>{n.errorCode=t.message===ae?102:301,n.errorMessage=t.message,e(n)})})}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 le=null;const ce={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 ue{constructor(){this.storage=this.initStorage()}initStorage(){if(le)return le;try{le="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){le=null}return le&&!this.isStorageDisabled(le)||(le=ce,le.clear()),le}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 de=12e4,he={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||de," ms (408)"))},t.timeout||de),n=await fetch(e,{...t,signal:r.signal,credentials:t.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(i)}),s=function(e){return P.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 s?{error:new Error(s),statusCode:n.status}:async function(e){const t=await e.text();let r;return r=P.isBrowserEnvironment()?new DOMParser:new((await Promise.resolve().then(function(){return qt})).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 pe{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||he,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||de,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:s=0,previousUrl:a=null,wrapperAd:o=null,wrapperChainId:l=0}=e;const c=Date.now();this.URLTemplateFilters.forEach(e=>{r=e(r)}),n("VAST-resolving",{url:r,previousUrl:a,wrapperDepth:s,maxWrapperDepth:i,timeout:this.fetchingOptions.timeout,wrapperAd:o,wrapperChainId:l});const u=await this.urlHandler.get(r,this.fetchingOptions),d=Math.round(Date.now()-c);if(n("VAST-resolved",{url:r,previousUrl:a,wrapperDepth:s,error:(null==u?void 0:u.error)||null,duration:d,statusCode:(null==u?void 0:u.statusCode)||null,wrapperChainId:l,...null==u?void 0:u.details}),ne(null==u||null===(t=u.details)||void 0===t?void 0:t.byteLength,d),u.error)throw new Error(u.error);return u.xml}}class me{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 ue;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new pe,this.vastParser=new oe({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 s=r-this.lastSuccessfulAd;if(s<0)this.lastSuccessfulAd=0;else if(s<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))})}}class fe extends te{constructor(e,t,r){var i;let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=s,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){P.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(!P.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(P.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(P.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(P.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(P.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(P.formatMacrosValues(t))})}setSkipDelay(e){P.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(P.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),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):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(P.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(P.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(P.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=P.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:s}=P.filterUrlTemplates(e);s.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(s)});const a={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(a.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(a.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(t=t.universalAdIds)&&void 0!==t&&t.length&&(a.UNIVERSALADID=this.creative.universalAdIds.map(e=>e.idRegistry.concat(" ",e.value)).join(",")),this.ad&&(this.ad.sequence&&(a.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(a.ADTYPE=this.ad.adType),this.ad.adServingId&&(a.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(a.ADCATEGORIES=this.ad.categories.map(e=>e.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(a.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(e=>e.value).join(","))),P.track(n,a,i)}convertToTimecode(e){if(!P.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),i=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),s=Math.floor(t%1e3);return"".concat(P.addLeadingZeros(r,2),":").concat(P.addLeadingZeros(i,2),":").concat(P.addLeadingZeros(n,2),".").concat(P.addLeadingZeros(s,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}class ge{constructor(){Object.defineProperty(this,"adTrackEls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"prevActiveCaptionSig",{enumerable:!0,configurable:!0,writable:!0,value:null})}captionsSignature(e){return`${String(e?.kind??"")}|${String((e?.language??e?.srclang??"")||"")}|${String((e?.label??"")||"")}`}listCaptionTracks(e){const t=e?.textTracks;if(!t||"number"!=typeof t.length)return[];const r=[];for(let e=0;e<Number(t.length);e++){const i=t[e]??("function"==typeof t.item?t.item(e):null);if(!i)continue;const n=String(i.kind||"");"captions"!==n&&"subtitles"!==n||r.push(i)}return r}captureActiveCaptionTrack(e){if(this.prevActiveCaptionSig)return;const t=this.listCaptionTracks(e).find(e=>"showing"===String(e.mode));t&&(this.prevActiveCaptionSig=this.captionsSignature(t))}restoreActiveTextTrack(e){const t=this.prevActiveCaptionSig;if(this.prevActiveCaptionSig=null,!t||!e)return;const r=this.listCaptionTracks(e);if(!r.length)return;for(const e of r)e.mode="disabled";const i=r.find(e=>this.captionsSignature(e)===t);i&&(i.mode="showing")}ensureRawCaptions(e,t){if(e&&Array.isArray(e.captions))return e.captions;if(t){const e=t?.linear||t?.Linear||t,r=e?.closedCaptionFiles||e?.ClosedCaptionFiles;if(Array.isArray(r)&&r.length>0)return r.map(e=>({src:e.fileURL||e.url||"",kind:"captions",srclang:e.language||e.fileLanguage||"",label:e.fileLanguage||e.language||"",type:e.fileType||""})).filter(e=>!!e.src)}if(!e)return[];const r=h(e);return e.captions=r,r}attachAdCaptionTracks(e,t,r){const i=this.ensureRawCaptions(t,r).filter(e=>(e.type||"").toLowerCase().includes("vtt")||e.src.toLowerCase().endsWith(".vtt")),n=[];for(const t of i){const r=document.createElement("track");r.kind=t.kind,r.src=t.src,t.srclang&&(r.srclang=t.srclang),t.label&&(r.label=t.label),r.default=!1,e.appendChild(r),r.track&&(r.track.mode="hidden"),n.push(r)}return this.adTrackEls=n,n}clearAdTracks(){for(const e of this.adTrackEls)e.remove();this.adTrackEls=[]}removeAdCaptions(){for(const e of this.adTrackEls)try{e.remove()}catch{}this.adTrackEls=[]}}function ve(){return window.OmidSessionClient??null}class be{static isAvailable(){return null!==ve()}static injectVerificationScript(e,t){const r=document.createElement("script");return r.src=e,r.async=!0,t&&r.setAttribute("data-omid-verification-parameters",t),document.head.appendChild(r),r}constructor(e,t,r="limited"){Object.defineProperty(this,"adSession",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"videoEvents",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"adEvents",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1});const i=ve();if(i)try{const n=new i.Partner("OpenPlayerJS","3.0.0"),s=t.map(e=>new i.VerificationScriptResource(e.scriptUrl,e.vendor||void 0,e.params||void 0)),a="domain"===r?i.AccessMode?.DOMAIN??"domain":i.AccessMode?.LIMITED??"limited",o=new i.Context(n,s);"function"==typeof o.setVideoElement&&o.setVideoElement(e),"function"==typeof o.setAccessMode&&o.setAccessMode(a),this.adSession=new i.AdSession(o),this.videoEvents=new i.VideoEvents(this.adSession),this.adEvents=new i.AdEvents(this.adSession),this.adSession.start()}catch(e){this.adSession=null,this.videoEvents=null,this.adEvents=null}}impression(){if(this.adSession&&!this.destroyed)try{"function"==typeof this.adSession.triggerSessionStart?this.adSession.triggerSessionStart?.():this.adSession.start?.(),this.adEvents?.impressionOccurred?.()}catch{}}loaded(e=!1,t=0,r=!1,i="preroll"){if(this.videoEvents&&!this.destroyed)try{const n=ve();if(!n)return;const s=new n.VastProperties(e,t,r,i);this.videoEvents.loaded(s)}catch{}}start(e,t){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.start(e,t)}catch{}}firstQuartile(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.firstQuartile()}catch{}}midpoint(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.midpoint()}catch{}}thirdQuartile(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.thirdQuartile()}catch{}}complete(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.complete()}catch{}}pause(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.pause()}catch{}}resume(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.resume()}catch{}}skipped(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.skipped()}catch{}}volumeChange(e){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.volumeChange(e)}catch{}}playerStateChange(e){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.playerStateChange(e)}catch{}}adUserInteraction(e){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.adUserInteraction(e)}catch{}}bufferStart(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.bufferStart()}catch{}}bufferFinish(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.bufferFinish()}catch{}}destroy(){if(!this.destroyed){this.destroyed=!0;try{this.adSession?.finish?.()}catch{}this.adSession=null,this.videoEvents=null,this.adEvents=null}}}const ye="SIMID:Player:init",Ee="SIMID:Player:startCreative",Te="SIMID:Player:adProgress",ke="SIMID:Player:adPaused",Ne="SIMID:Player:adPlaying",Ae="SIMID:Player:adStopped",we="SIMID:Player:adSkipped",Se="SIMID:Player:adVolume",Ce="SIMID:Player:adDurationChange",Re="SIMID:Player:resize",Ie="SIMID:Player:fatal",Le="SIMID:Player:appBackgrounded",xe="SIMID:Player:appForegrounded",De="resolve",Oe="reject",Me="SIMID:Media:durationchange",Pe="SIMID:Media:ended",Ue="SIMID:Media:error",_e="SIMID:Media:pause",Be="SIMID:Media:play",Ve="SIMID:Media:playing",Fe="SIMID:Media:seeked",qe="SIMID:Media:seeking",je="SIMID:Media:stalled",He="SIMID:Media:timeupdate",We="SIMID:Media:volumechange",Ge="SIMID:Creative:ready",Xe="SIMID:Creative:getMediaState",ze="SIMID:Creative:resolve",Ye="SIMID:Creative:reject",Qe="SIMID:Creative:requestFullscreen",Ke="SIMID:Creative:requestResize",$e="SIMID:Creative:clickThrough",Je="SIMID:Creative:reportTracking",Ze="SIMID:Creative:requestSkip",et="SIMID:Creative:requestStop",tt="SIMID:Creative:requestPause",rt="SIMID:Creative:requestPlay",it="SIMID:Creative:requestChangeAdDuration",nt="SIMID:Creative:fatal",st="SIMID:Creative:log";class at{constructor(e,t,r,i){Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"adVideo",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"creativeInfo",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"msgCounter",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pending",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"messageListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sessionId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"initSent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"initPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"mediaListeners",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visibilityHandler",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"outgoingFormat",{enumerable:!0,configurable:!0,writable:!0,value:"plain"}),Object.defineProperty(this,"_targetOrigin",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"creativeWindow",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.messageListener=this.handleMessage.bind(this),window.addEventListener("message",this.messageListener),this.bindMediaEvents()}nextMsgId(){return++this.msgCounter}getTargetOrigin(){if(null!==this._targetOrigin)return this._targetOrigin;try{const e=new URL(this.iframe.src,window.location.href).origin;return"null"===e?"*":e}catch{return"*"}}postMsg(e){const t=this.creativeWindow??this.iframe.contentWindow;if(!t)return;const r="json-string"===this.outgoingFormat?JSON.stringify(e):e;t.postMessage(r,this.getTargetOrigin())}send(e,t){const r=this.nextMsgId(),i={type:e,messageId:r,sessionId:this.sessionId||void 0,timestamp:Date.now(),args:t??{}};return new Promise((e,t)=>{this.pending.set(r,{resolve:e,reject:t});try{this.postMsg(i)}catch(e){this.pending.delete(r),t(e)}})}sendResolve(e,t){try{this.postMsg({type:De,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{messageId:e,value:t??{}}})}catch{}}sendReject(e,t,r){try{this.postMsg({type:Oe,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{messageId:e,value:{errorCode:t,message:r}}})}catch{}}parseMessageData(e){if("string"==typeof e){let t;try{t=JSON.parse(e)}catch{return null}return t?.type?("plain"===this.outgoingFormat&&(this.outgoingFormat="json-string"),t):null}return e&&"object"==typeof e?e:null}handleMessage(e){if(this.destroyed)return;const t=this.parseMessageData(e.data);if(!t||!t.type)return;null===this.creativeWindow&&e.source instanceof Window&&(this.creativeWindow=e.source),null===this._targetOrigin&&e.origin&&"null"!==e.origin&&(this._targetOrigin=e.origin);const r=t.messageId??t.msgId??0;switch(t.type){case"createSession":this.onCreateSession(r,t.sessionId||"");break;case Xe:this.sendResolve(r,this.getMediaState());break;case Ge:this.onCreativeReady();break;case"resolve":case ze:{const e=t.resolves??t.args?.messageId,r=null!=e?this.pending.get(e):void 0;r&&(this.pending.delete(e),r.resolve(t.args?.value??t.args));break}case"reject":case Ye:{const e=t.rejects??t.args?.messageId,r=null!=e?this.pending.get(e):void 0;r&&(this.pending.delete(e),r.reject({errorCode:t.errorCode??t.args?.value?.errorCode,reason:t.reason??t.args?.value?.message}));break}case Ze:this.callbacks.onSkip();break;case et:this.callbacks.onStop();break;case tt:this.callbacks.onPause();break;case rt:this.callbacks.onPlay();break;case $e:{const e=String(t.args?.url||t.args?.clickThroughUrl||"");e&&this.callbacks.onClickThrough(e);break}case Je:{const e=String(t.args?.event||t.args?.trackingEvent||"");this.callbacks.onTrackingEvent(e,t.args);break}case Qe:{const e=this.iframe.closest(".op-ads")??this.iframe.parentElement;e?.requestFullscreen?e.requestFullscreen().catch(()=>this.sendReject(r,403,"Fullscreen denied")):this.sendReject(r,403,"Fullscreen not supported");break}case Ke:this.resize(this.iframe.offsetWidth||window.innerWidth,this.iframe.offsetHeight||window.innerHeight);break;case it:{const e=Number(t.args?.durationChange??t.args?.duration??0);this.callbacks.onRequestChangeAdDuration?this.callbacks.onRequestChangeAdDuration(e,()=>this.sendResolve(r,{}),(e,t)=>this.sendReject(r,e,t)):this.sendReject(r,403,"requestChangeAdDuration not supported");break}case nt:this.callbacks.onFatal(t.errorCode??901,t.reason??"Creative fatal error");break;case st:this.callbacks.onLog?.(t.args)}}onCreateSession(e,t){t&&(this.sessionId=t),this.sendResolve(e),this.initSent||(this.initSent=!0,this.initPromise=this.send(ye,{creativeData:this.buildCreativeData(),environmentData:this.buildEnvironmentData()}).then(()=>{if(!this.started&&!this.destroyed)return this.started=!0,this.send(Ee).catch(()=>{})}).catch(()=>{}))}async onCreativeReady(){if(!this.started){this.started=!0;try{this.initSent?this.initPromise&&await this.initPromise:(this.initSent=!0,await this.send(ye,{creativeData:this.buildCreativeData(),environmentData:this.buildEnvironmentData()})),await this.send(Ee)}catch{}}}buildEnvironmentData(){const e=this.adVideo,t=this.iframe.getBoundingClientRect(),r=e.getBoundingClientRect(),i=Math.round(t.width)||e.offsetWidth||640,n=Math.round(t.height)||e.offsetHeight||360,s=Math.round(r.width)||i,a=Math.round(r.height)||n,o=e.muted?0:Number.isFinite(e.volume)?e.volume:1;return{videoDimensions:{x:Math.round(r.left),y:Math.round(r.top),width:s,height:a},creativeDimensions:{x:Math.round(t.left),y:Math.round(t.top),width:i,height:n},fullscreen:!!document.fullscreenElement,fullscreenAllowed:!0,variableDurationAllowed:"function"==typeof this.callbacks.onRequestChangeAdDuration,skippableState:"notSkippable",version:"1.2",siteUrl:"undefined"!=typeof window?window.location.href:"",muted:e.muted,volume:o,playerWidth:i,playerHeight:n,videoDuration:Number.isFinite(e.duration)?e.duration:0,videoVolume:o}}buildCreativeData(){return{adParameters:this.creativeInfo?.adParameters??"",clickThruUrl:this.creativeInfo?.clickThruUri??"",clickThruUri:this.creativeInfo?.clickThruUri??""}}getMediaState(){const e=this.adVideo;return{currentSrc:e.currentSrc||e.src||"",currentTime:e.currentTime,duration:Number.isFinite(e.duration)?e.duration:0,ended:e.ended,muted:e.muted,paused:e.paused,volume:e.volume,fullscreen:!!document.fullscreenElement}}init(e,t){return this.send(ye,{creativeData:e,environmentData:t})}start(){return this.send(Ee)}progress(e,t){if(!this.destroyed)try{this.postMsg({type:Te,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{currentTime:e,duration:t,remainingTime:Math.max(0,t-e)}})}catch{}}pause(){if(!this.destroyed)try{this.postMsg({type:ke,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{}})}catch{}}resume(){if(!this.destroyed)try{this.postMsg({type:Ne,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{}})}catch{}}stop(){return this.destroyed?Promise.resolve():this.send(Ae).catch(()=>{})}skip(){if(!this.destroyed)try{this.postMsg({type:we,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{}})}catch{}}volumeChange(e,t){if(!this.destroyed)try{this.postMsg({type:Se,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{volume:e,muted:t}})}catch{}}adDurationChange(e){if(!this.destroyed)try{this.postMsg({type:Ce,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{duration:e}})}catch{}}resize(e,t){return this.send(Re,{width:e,height:t})}fatal(e,t){if(!this.destroyed)try{this.postMsg({type:Ie,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{errorCode:e,reason:t}})}catch{}}bindMediaEvents(){const e=this.adVideo,t=[["durationchange",Me],["ended",Pe],["error",Ue],["pause",_e],["play",Be],["playing",Ve],["seeked",Fe],["seeking",qe],["stalled",je],["timeupdate",He],["volumechange",We]];for(const[r,i]of t){const t=()=>{if(!this.destroyed&&this.sessionId)try{this.postMsg({type:i,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:this.getMediaState()})}catch{}};e.addEventListener(r,t),this.mediaListeners.push({event:r,handler:t})}this.visibilityHandler=()=>{if(this.destroyed||!this.sessionId)return;const e=document.hidden?Le:xe;try{this.postMsg({type:e,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{}})}catch{}},document.addEventListener("visibilitychange",this.visibilityHandler)}destroy(){if(!this.destroyed){this.destroyed=!0,window.removeEventListener("message",this.messageListener);for(const{event:e,handler:t}of this.mediaListeners)this.adVideo.removeEventListener(e,t);this.mediaListeners=[],this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null);for(const[,e]of this.pending)e.reject({errorCode:900,reason:"SimidSession destroyed"});this.pending.clear()}}}class ot{constructor(e){Object.defineProperty(this,"bus",{enumerable:!0,configurable:!0,writable:!0,value:e})}on(e,t){return this.bus.on(e,t)}emit(e,...t){this.bus.emit(e,...t)}}function lt(e){const t={...e,...e.csai},r=function(e){const t=[];return(e.sources?Array.isArray(e.sources)?e.sources:[e.sources]:[]).forEach(e=>{if(!e||"string"!=typeof e.src)return;const r=e.src.trim();if(!r)return;const i=e.type;"VAST"!==i&&"VMAP"!==i&&"NONLINEAR"!==i||t.push({type:i,src:r})}),t}(t),i=t.breaks??[],n=i.some(e=>"preroll"===e.at&&(e.source?.src||Array.isArray(e.sources)&&e.sources.some(e=>e?.src))),s=r.some(e=>"VAST"===e.type||"VMAP"===e.type||"NONLINEAR"===e.type);return{allowNativeControls:t.allowNativeControls??!1,resumeContent:t.resumeContent??!0,preferredMediaTypes:t.preferredMediaTypes||["video/mp4","video/webm","application/vnd.apple.mpegurl","application/x-mpegURL"],debug:e.debug??!1,breakTolerance:t.breakTolerance??.25,sources:r,breaks:i,interceptPlayForPreroll:t.interceptPlayForPreroll??(Boolean(n)||s),autoPlayOnReady:t.autoPlayOnReady||!1,mountEl:t.mountEl,mountSelector:t.mountSelector,nonLinearContainer:t.nonLinearContainer,nonLinearSelector:t.nonLinearSelector,companionContainer:t.companionContainer,companionSelector:t.companionSelector,adSourcesMode:t.adSourcesMode??"waterfall",omid:t.omid??{},labels:t.labels??{},adDelivery:e.adDelivery??"csai",requestInterceptor:t.requestInterceptor,eventSink:t.eventSink,scteSource:e.hybrid?.scteSource,resolveScteUrl:e.hybrid?.resolveScteUrl}}class ct{constructor(){Object.defineProperty(this,"mode",{enumerable:!0,configurable:!0,writable:!0,value:"csai"}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cfg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"scheduler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"captionMgr",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"overlayId",{enumerable:!0,configurable:!0,writable:!0,value:"ads"}),Object.defineProperty(this,"overlay",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"adVideo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"adEndPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"adEngineDetach",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentBreakMeta",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"vastClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_lastCreative",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"globalUnsubs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sessionUnsubs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"resumeAfter",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"contentMedia",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentHadControls",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startingBreak",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"userPlayIntent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"forcedMuteUntilInteraction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"syncingVolume",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dispatchStartBreak",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchStartBreakGroup",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchPlayBreakFromVast",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchGetVastXmlText",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchBuildParsedForNonLinear",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchMountAdVideo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchStartAdPlayback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"simidSession",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"omidSession",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}init(t,r){this.ctx=t,this.cfg=lt(r),this.bus=new ot(t.events),this.vastClient=new me,this.overlay=document.createElement("div"),this.overlay.className="op-ads",this.overlay.style.display="none",this.scheduler=new N(this.cfg,t,this.warn.bind(this),e=>{this.bus.emit("ads:error",{reason:"vmap_parse_failed",error:e}),t.events.emit("ads.error",{reason:"vmap_parse_failed",error:e})}),this.captionMgr=new ge,this.dom=new p(this.overlay,this.cfg,()=>this.adVideo,()=>this.tracker,()=>this.requestSkip("button")),this.globalUnsubs.push(t.events.on("source:set",()=>{this.scheduler.reset(),this.startingBreak=!1,this.clearSession(),this.active=!1,this.contentMedia=void 0,this.contentHadControls=!1,this.overlay.style.display="none",this.ctx.leases.release("playback","ads");try{e.getOverlayManager(this.ctx.core).deactivate(this.overlayId)}catch{}this.userPlayIntent=!1,this.scheduler.rebuild()})),this._dispatchStartBreak=(e,t,r)=>this.startBreak(e,t,r),this._dispatchStartBreakGroup=(e,t)=>this.startBreakGroup(e,t),this._dispatchPlayBreakFromVast=(e,t,r)=>this.playBreakFromVast(e,t,r),this._dispatchGetVastXmlText=e=>Promise.resolve(this.getVastXmlText(e)),this._dispatchBuildParsedForNonLinear=e=>this.buildParsedForNonLinearFromXml(e),this._dispatchMountAdVideo=(e,t,r)=>this.mountAdVideo(e,t,r),this._dispatchStartAdPlayback=()=>this.startAdPlayback(),this.scheduler.rebuild(),this.bindBreakScheduler(),this.cfg.interceptPlayForPreroll&&this.bindPrerollInterceptors(),this.globalUnsubs.push(t.events.on("player:interacted",()=>{if(this.forcedMuteUntilInteraction=!1,this.active&&this.adVideo)try{this.adVideo.muted=t.core.muted,this.adVideo.volume=t.core.volume}catch{}}))}destroy(){this.finish({resume:!1});for(const e of this.globalUnsubs)e();this.globalUnsubs=[],this.overlay?.remove()}async playAds(e){const t=this.scheduler.inferSourceTypeForUrl(e);return this.playBreakFromVast({kind:"url",value:e},{kind:"manual",id:"manual",sourceType:t})}async playAdsFromXml(e){return this.playBreakFromVast({kind:"xml",value:e},{kind:"manual",id:"manual"})}getDueMidrollBreaks(e){return this.scheduler.getDueMidrollBreaks(e)}getDueMidrollBreak(e){return this.scheduler.getDueMidrollBreak(e)}requestSkip(e="api"){this.dom.requestSkip(e,this.adVideo,this.currentBreakMeta,e=>{this.bus.emit("ads:skip",e),this.ctx.events.emit("ads.skipped",e),this.ctx.events.emit("adsskipped",e),this.omidSession?.skipped(),this.simidSession?.skip()},this.log.bind(this))}get dom(){if(!this._dom){const e=document.createElement("div");this._dom=new p(e,this.cfg,()=>this.adVideo,()=>this.tracker,()=>{})}return this._dom}set dom(e){this._dom=e}bindPrerollInterceptors(){const{events:e,core:t}=this.ctx,r=t.media,i=()=>{if(this.scheduler.pendingVmapSrc&&!this.scheduler.vmapLoadPromise){this.scheduler.vmapPending=!0;const e=this.scheduler.pendingVmapSrc;this.scheduler.pendingVmapSrc=void 0,this.scheduler.vmapLoadPromise=this.scheduler.loadVmapAndMerge([...this.scheduler.resolvedBreaks],e)}};this.globalUnsubs.push(e.on("cmd:play",()=>{i();const n=this.scheduler.vmapPending,s=this.shouldInterceptPreroll();if(s||n&&!this.active&&!this.startingBreak)try{r.pause()}catch{}(async()=>{if(this.scheduler.vmapLoadPromise&&await this.scheduler.vmapLoadPromise.catch(()=>{}),!this.shouldInterceptPreroll())return void(!n||s||this.active||this.startingBreak||e.emit("cmd:play"));this.userPlayIntent=!!t.userInteracted;let r=0;for(;r++<10;){const e=this.scheduler.getPrerollBreak();if(!e)break;await this._dispatchStartBreak(e,"preroll")}})()}));const n=()=>{i();const n=this.scheduler.vmapPending,s=this.shouldInterceptPreroll();if(s||n&&!this.active&&!this.startingBreak)try{r.pause()}catch{}(async()=>{if(this.scheduler.vmapLoadPromise&&await this.scheduler.vmapLoadPromise.catch(()=>{}),!this.shouldInterceptPreroll())return void(!n||s||this.active||this.startingBreak||e.emit("cmd:play"));this.userPlayIntent=!!t.userInteracted;let r=0;for(;r++<10;){const e=this.scheduler.getPrerollBreak();if(!e)break;await this._dispatchStartBreak(e,"preroll")}})()};r.addEventListener("play",n,{capture:!0}),this.globalUnsubs.push(()=>r.removeEventListener("play",n,{capture:!0}))}shouldInterceptPreroll(){const e=this.scheduler.getPrerollBreak();if(!e)return!1;if(this.active||this.startingBreak)return!1;const t=this.ctx.core.media;if((t?.currentTime??0)>.25)return!1;const r=this.scheduler.getBreakId(e);return(!1===e.once||!this.scheduler.playedBreaks.has(r))&&"ended"!==this.ctx.state.current}bindBreakScheduler(){const e=this.ctx.core.media;if(!e)return;const t=()=>{if(this.active||this.startingBreak)return;const t=e.currentTime||0,r=this.scheduler.getDueMidrollBreaks(t);if(!r.length)return;const i=r[0],n=i.at,s=i.timeOffset,a=this.cfg.breakTolerance??.25,o=s?this.scheduler.resolvedBreaks.filter(e=>"number"==typeof e.at&&!this.scheduler.playedBreaks.has(this.scheduler.getBreakId(e))&&e.timeOffset===s&&Math.abs(e.at-n)<=Math.max(1,a)):r.filter(e=>Math.abs(e.at-n)<=a);o.length&&(1===o.length?this._dispatchStartBreak(o[0],"midroll"):this._dispatchStartBreakGroup(o,"midroll"))};e.addEventListener("timeupdate",t),this.globalUnsubs.push(()=>e.removeEventListener("timeupdate",t));const r=()=>{this.active||this.startingBreak||(async()=>{for(this.scheduler.vmapLoadPromise&&await this.scheduler.vmapLoadPromise.catch(()=>{});!this.active&&!this.startingBreak;){const e=this.scheduler.getPostrollBreak();if(!e)break;this.ctx.events.emit("ads.mediaended",{break:{kind:"postroll",id:this.scheduler.getBreakId(e)},at:e.at}),await this._dispatchStartBreak(e,"postroll")}})()};e.addEventListener("ended",r),this.globalUnsubs.push(()=>e.removeEventListener("ended",r))}async startBreak(e,t,r){if(this.active||this.startingBreak)return;const i=this.scheduler.getBreakId(e),n=!1!==e.once;if(n&&this.scheduler.playedBreaks.has(i))return;const s=e.sources;if(s&&s.length>1){n&&this.scheduler.playedBreaks.add(i),this.startingBreak=!0,this.bus.emit("ads:break:start",{id:i,kind:t,at:e.at});try{for(let e=0;e<s.length;e++){const n=s[e],a=e===s.length-1,o=this.scheduler.isXmlString(n.src)?{kind:"xml",value:n.src}:{kind:"url",value:n.src};if(await this._dispatchPlayBreakFromVast(o,{kind:t,id:i,sourceType:n.type},{suppressResumeOnError:!a,suppressResumeOnSuccess:r?.suppressResume}))break}}finally{this.startingBreak=!1,this.bus.emit("ads:break:end",{id:i,kind:t,at:e.at})}return}const{input:a,sourceType:o}=this.scheduler.getVastInputFromBreak(e);if(a){n&&this.scheduler.playedBreaks.add(i),this.startingBreak=!0,this.bus.emit("ads:break:start",{id:i,kind:t,at:e.at});try{await this._dispatchPlayBreakFromVast(a,{kind:t,id:i,sourceType:o},{suppressResumeOnSuccess:r?.suppressResume})}finally{this.startingBreak=!1,this.bus.emit("ads:break:end",{id:i,kind:t,at:e.at})}}}async startBreakGroup(e,t){let r=!1;const i=[];for(const n of e){if("midroll"===t){const{input:e}=this.scheduler.getVastInputFromBreak(n),t="url"===e?.kind?e.value:"",i=/bumper/i.test(t)||/bumper/i.test(n.id||"");if(i&&r){this.scheduler.playedBreaks.add(this.scheduler.getBreakId(n));continue}i||(r=!0)}i.push(n)}for(let e=0;e<i.length;e++)await this._dispatchStartBreak(i[e],t,{suppressResume:e<i.length-1})}async playBreakFromVast(e,t,i){if(this.active)return!1;this.dom.ensureOverlayMounted(this.ctx.core.media);const{events:n,leases:a,core:{media:h}}=this.ctx,p="url"===e.kind?e.value:"[xml]";this.bus.emit("ads:requested",p),this.log("requested",p,t),this.resumeAfter=!1!==this.cfg.resumeContent&&"postroll"!==t.kind;const m=()=>{try{h.pause()}catch{}return n.emit("cmd:pause"),!!a.acquire("playback","ads")||(this.bus.emit("ads:error",{reason:"playback lease already owned",owner:a.owner("playback")}),this.ctx.events.emit("ads.error",{reason:"playback lease already owned",owner:a.owner("playback")}),!1)};let f=null;const g=async()=>{if(!f)try{f=this._dispatchBuildParsedForNonLinear(await this._dispatchGetVastXmlText(e))}catch{f=null}};try{let n;if("url"===e.kind)try{n=await this.vastClient.get(e.value)}catch(e){if(await g(),!f)throw e;n=await this.vastClient.parseVAST(f)}else{const t="string"==typeof e.value?r(e.value):e.value instanceof XMLDocument?e.value:r((new XMLSerializer).serializeToString(e.value));f=t,n=await this.vastClient.parseVAST(t)}this.log("vast parsed",{ads:n?.ads?.length??0,version:n?.version});const a=e=>{this.bus.emit("ads:loaded",{break:t,count:e}),this.ctx.events.emit("ads.loaded",{break:t,count:e})};if("NONLINEAR"===t.sourceType){const e=u(n);if(e.length)return a(e.length),await this.playNonLinearOnlyBreak(n,t),!0;if(await g(),f){const e=d(f);if(e.length)return a(e.length),await this.playNonLinearOnlyBreakFromXml(e,t),!0}}let p=c(n,this.cfg.preferredMediaTypes);if(this.log("linear pod items",p.length),!p.length){const e=u(n);if(e.length)return a(e.length),await this.playNonLinearOnlyBreak(n,t),!0;if(await g(),f&&(p=function(e,t){if(!e)return[];const r=Array.from(e.getElementsByTagName("Ad")),i=[];for(const e of r){const r=e.getAttribute("sequence"),n=null!=r?Number(r):void 0,a=Array.from(e.getElementsByTagName("Creative"));for(let r=0;r<a.length;r++){const o=a[r],l=o.getElementsByTagName("Linear")?.[0];if(!l)continue;const c=l.getAttribute("skipoffset")||l.getAttribute("skipOffset")||void 0,u=l.getElementsByTagName("MediaFiles")?.[0];if(!u)continue;const d=Array.from(u.getElementsByTagName("MediaFile")).map(e=>({type:e.getAttribute("type")||"",mimeType:e.getAttribute("type")||"",bitrate:Number(e.getAttribute("bitrate")||0),bitRate:Number(e.getAttribute("bitRate")||0),width:Number(e.getAttribute("width")||0),height:Number(e.getAttribute("height")||0),fileURL:(e.textContent||"").trim(),url:(e.textContent||"").trim(),rawEl:e})),h=s(d,t);h&&i.push({ad:{id:e.getAttribute("id")||void 0},creative:{linear:{MediaFiles:d}},mediaFile:h,sequence:Number.isFinite(n)?n:void 0,creativeIndex:r,skipOffset:c||void 0})}}return i.sort((e,t)=>{const r=e.sequence??Number.MAX_SAFE_INTEGER,i=t.sequence??Number.MAX_SAFE_INTEGER;return r!==i?r-i:(e.creativeIndex??0)-(t.creativeIndex??0)})}(f,this.cfg.preferredMediaTypes),this.log("linear pod items (xml fallback)",p.length),!p.length)){const e=d(f);if(e.length)return a(e.length),await this.playNonLinearOnlyBreakFromXml(e,t),!0}}if(!p.length)throw this.warn("no playable ads found in VAST response"),new Error("No playable ads found in VAST response");if(a(p.length),!m())return!1;this.active=!0;const v=function(e,t){const r=[],i=l(e);for(const e of i){const t=e?.adVerifications||e?.AdVerifications||[];for(const e of t){const t=String(e?.vendor||e?.Vendor||""),i=e?.resource||e?.resources||e?.JavaScriptResource||e?.javaScriptResource||(e?.javascriptResource?[e.javascriptResource]:[]),n=Array.isArray(i)?i:[i];for(const i of n){const n=String(i?.uri||i?.url||i?.browserOptional?.value||i?.value||i||"").trim();if(!n)continue;const s=String(e?.verificationParameters?.value||e?.parameters||e?.params||"");r.push({vendor:t,scriptUrl:n,params:s})}}}if(r.length>0)return r;if(t){const e=(e,t)=>{try{return Array.from(e.getElementsByTagNameNS("*",t))}catch{}try{return Array.from(e.getElementsByTagName(t))}catch{return[]}},i=e(t,"Verification");for(const t of i){const i=t.getAttribute("vendor")||"",n=e(t,"JavaScriptResource");for(const e of n){const n=(e.textContent||"").trim();if(!n)continue;const s=t.querySelector("VerificationParameters"),a=(s?.textContent||"").trim();r.push({vendor:i,scriptUrl:n,params:a})}}}return r}(n,f);be.isAvailable()&&v.length&&(v.forEach(e=>{e.scriptUrl&&be.injectVerificationScript(e.scriptUrl,e.params)}),this.omidSession=new be(h,v,this.cfg.omid?.accessMode));for(let e=0;e<p.length;e++){const r=p[e];this.bus.emit("ads:ad:start",{break:t,index:e,sequence:r.sequence}),this.clearSession(),this.tracker=new fe(this.vastClient,r.ad,r.creative),this._lastCreative=r.creative,this.log("mount ad video",{url:r.mediaFile?.fileURL,type:r.mediaFile?.type,skipOffset:r.skipOffset}),this._dispatchMountAdVideo(h,r.mediaFile,r.creative);const i=this.waitForAdEnd();this.dom.setupSkipUIForPodItem(r,this.log.bind(this)),this.log("skip ui",{raw:this.dom.skipOffsetRaw,at:this.dom.skipAtSeconds}),this.dom.mountCompanions(r.creative),this.dom.mountNonLinear(r.creative);const n=o(r.creative,f);if(n&&this.adVideo){const e=this.dom.mountSimidIframe(n),i=r.creative?.videoClickThroughURLTemplate?.url??r.creative?.videoClickThroughURLTemplate??r.creative?.videoClicks?.clickThrough??"",s={adParameters:String(r.creative?.linear?.adParameters?.value??r.creative?.adParameters?.value??""),clickThruUri:"string"==typeof i?i:String(i||"")};this.simidSession=new at(e,this.adVideo,{onSkip:()=>this.requestSkip("api"),onStop:()=>{const e=this.adVideo;if(e)try{e.dispatchEvent(new Event("ended"))}catch{}},onPause:()=>this.ctx.events.emit("cmd:pause"),onPlay:()=>this.ctx.events.emit("cmd:play"),onClickThrough:e=>{this.dom.safeWindowOpen(e);try{this.tracker?.trackClick?.()}catch{}this.bus.emit("ads:clickthrough",{break:t,url:e}),this.ctx.events.emit("ads.click",{break:t,url:e})},onTrackingEvent:(e,r)=>{this.bus.emit("ads:impression",{break:t,event:e})},onFatal:(e,t)=>{this.simidSession?.destroy(),this.simidSession=void 0},onRequestChangeAdDuration:(e,t,r)=>{t();const i=this.adVideo;i&&Number.isFinite(i.duration)&&this.simidSession?.adDurationChange(i.duration+e)}},s),this.sessionUnsubs.push(()=>{this.simidSession?.destroy(),this.simidSession=void 0})}this.cfg.allowNativeControls||this.bindAdSurfaceCommands(),this.tracker?.trackImpression?.(),this.omidSession?.impression(),this.bus.emit("ads:impression",{break:t,index:e}),this.bindTrackerAndTelemetry({kind:t.kind,breakId:t.id}),this._dispatchStartAdPlayback(),await i,this.bus.emit("ads:ad:end",{break:t,index:e,sequence:r.sequence})}this.bus.emit("ads:allAdsCompleted",{break:t}),this.ctx.events.emit("ads.allAdsCompleted",{break:t});const b=this.overlay&&this.overlay.querySelector(".op-ads__sr-announcer");return b&&(b.textContent=this.cfg.labels?.adEnded||"Advertisement ended"),this.finish({resume:"postroll"!==t.kind&&(this.userPlayIntent||this.resumeAfter),suppressResume:i?.suppressResumeOnSuccess}),!0}catch(e){return this.bus.emit("ads:error",e),this.ctx.events.emit("ads.error",{err:e}),this.finish({resume:"postroll"!==t.kind&&(this.userPlayIntent||this.resumeAfter),suppressResume:i?.suppressResumeOnError}),!1}}async playNonLinearOnlyBreak(e,t){if(this.dom.ensureOverlayMounted(this.ctx.core.media),this.overlay.replaceChildren(),this.overlay.style.display="block",!this.overlay.querySelector(".op-ads__sr-announcer")){const e=document.createElement("div");e.className="op-ads__sr-announcer op-player__sr-only",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.textContent="Advertisement",this.overlay.appendChild(e)}if(this.active=!0,!this.overlay.querySelector(".op-ads__sr-announcer")){const e=document.createElement("div");e.className="op-ads__sr-announcer op-player__sr-only",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.textContent=this.cfg.labels?.advertisement||"Advertisement",this.overlay.appendChild(e)}const r=u(e);if(!r.length)return;let i=0;for(let e=0;e<r.length;e++){const n=r[e];try{this.tracker=new fe(this.vastClient,n.ad,n.creative)}catch{this.tracker=void 0}this._lastCreative=n.creative;const s=n.ad?.creatives?.find(e=>"companion"===e?.type)??n.creative;this.dom.mountCompanions(s),this.dom.ensureNonLinearDom();const a=this.dom.renderNonLinear(n.nonLinear);a&&this.dom.nonLinearWrap.appendChild(a);try{this.tracker?.trackImpression?.(),this.tracker?.trackCreativeView?.()}catch{}this.bus.emit("ads:impression",{break:t,index:e}),this.bus.emit("ads:ad:start",{break:t,index:e,sequence:n.sequence}),i=Math.max(i,this.dom.nonLinearSuggestedDurationSeconds(n.nonLinear))}this.active=!1,this.ctx.events.emit("cmd:play"),this.dismissNonLinear(r,t,i)}async playNonLinearOnlyBreakFromXml(e,t){this.dom.ensureOverlayMounted(this.ctx.core.media),this.dom.clearAdOverlays(),this.overlay.replaceChildren(),this.overlay.style.display="block",this.active=!0;let r=0;for(let i=0;i<e.length;i++){const n=e[i];n.companions?.length&&this.dom.mountCompanions({companions:n.companions,companionAds:{companions:n.companions}}),this.dom.ensureNonLinearDom();const s=this.dom.renderNonLinear(n.nonLinear);s&&this.dom.nonLinearWrap.appendChild(s),r=Math.max(r,this.dom.nonLinearSuggestedDurationSeconds(n.nonLinear)),this.bus.emit("ads:impression",{break:t,index:i}),this.bus.emit("ads:ad:start",{break:t,index:i})}this.active=!1,this.ctx.events.emit("cmd:play"),this.dismissNonLinear(e,t,r)}async dismissNonLinear(e,t,r){const i=Date.now();await new Promise(e=>{const t=()=>{const n=(Date.now()-i)/1e3;!this.dom.nonLinearWrap?.querySelector(".op-ads__nonlinear-item")||n>=r?e():setTimeout(t,50)};t()});for(let r=0;r<e.length;r++)this.bus.emit("ads:ad:end",{break:t,index:r});this.clearSession(),this.overlay.style.display="none",this.overlay.replaceChildren(),this.currentBreakMeta=void 0}mountAdVideo(t,r,i){this.dom.ensureOverlayMounted(t);const n=this.overlay.parentElement;this.overlay.replaceChildren(),this.overlay.style.display="block",this.contentMedia=t,this.captionMgr.captureActiveCaptionTrack(t);const s=document.createElement("video");s.className="op-ads__media",s.playsInline=!0;const a=(t.getAttribute("preload")||t.preload||"").toLowerCase(),o=!!t.autoplay&&!this.ctx.core.userInteracted;s.preload="none"===a?"metadata":"auto",s.controls=this.cfg.allowNativeControls,s.style.width="100%",s.style.height="100%";const l=this.ctx.core.getPlugin?.("hls-engine");if(l?.canPlay({src:r.fileURL})&&l.attachMedia)this.adEngineDetach=l.attachMedia(s,r.fileURL);else{s.src=r.fileURL;try{s.load()}catch{}}const c=!!o||this.ctx.core.muted,u=o?0:this.ctx.core.volume;s.muted=c,s.defaultMuted=c,Number.isFinite(u)&&(s.volume=Math.max(0,Math.min(1,u))),this.adEndPromise=new Promise(e=>{const t=()=>{if(this.adVideo===s){try{s.pause()}catch{}s.remove(),this.adVideo=void 0}else s.remove()},r=()=>{this.ctx.events.emit("ended"),t(),e()},i=()=>{t(),e()};s.addEventListener("ended",r,{once:!0}),s.addEventListener("error",i,{once:!0}),this.sessionUnsubs.push(()=>s.removeEventListener("ended",r)),this.sessionUnsubs.push(()=>s.removeEventListener("error",i))}),this.overlay.appendChild(s),this.adVideo=s;const d=()=>{if("visible"!==document.visibilityState)return;const e=this.adVideo;if(e&&e.paused&&!e.ended)try{const t=e.play?.();t&&"function"==typeof t.catch&&t.catch(()=>{})}catch{}};document.addEventListener("visibilitychange",d),this.sessionUnsubs.push(()=>document.removeEventListener("visibilitychange",d));const h=this.captionMgr.attachAdCaptionTracks(s,r.raw,i);this.sessionUnsubs.push(()=>{h.forEach(e=>e.remove())});let p=null;try{p=e.getOverlayManager(this.ctx.core),p.activate({id:"ads",priority:100,mode:"countdown",canSeek:!1,duration:0,value:0,label:"Ad",fullscreenEl:n,fullscreenVideoEl:s})}catch{}const m=()=>{if(!p)return;const e=s.duration,t=s.currentTime;!Number.isFinite(e)||e<=0||!Number.isFinite(t)||p.update(this.overlayId,{duration:e,value:Math.max(0,e-t),mode:"countdown",canSeek:!1,fullscreenEl:n,fullscreenVideoEl:s})};s.addEventListener("loadedmetadata",m),s.addEventListener("timeupdate",m),this.sessionUnsubs.push(()=>s.removeEventListener("loadedmetadata",m)),this.sessionUnsubs.push(()=>s.removeEventListener("timeupdate",m))}bindAdSurfaceCommands(){const{events:e}=this.ctx,t=()=>this.adVideo;this.sessionUnsubs.push(e.on("cmd:play",()=>{const e=Boolean(this.contentMedia?.autoplay);if(!this.userPlayIntent&&e&&!this.ctx.core.userInteracted){this.forcedMuteUntilInteraction=!0;try{t()&&(t().muted=!0,t().volume=0)}catch{}}else{this.forcedMuteUntilInteraction=!1;try{t()&&(t().muted=this.ctx.core.muted,t().volume=this.ctx.core.volume)}catch{}}t()?.play().catch(()=>{})})),this.sessionUnsubs.push(e.on("cmd:pause",()=>t()?.pause())),this.sessionUnsubs.push(e.on("cmd:setVolume",e=>{const r=Number(e);Number.isFinite(r)&&t()&&!this.syncingVolume&&!this.forcedMuteUntilInteraction&&(t().volume=r)})),this.sessionUnsubs.push(e.on("cmd:setMuted",e=>{if(t()&&!this.syncingVolume)return this.forcedMuteUntilInteraction&&!this.ctx.core.userInteracted?(t().muted=!0,void(t().volume=0)):void(t().muted=Boolean(e))}))}bindTrackerAndTelemetry(e){this.currentBreakMeta=e;const t=this.adVideo;let r=!1,i=t.muted||0===t.volume,n=t.paused,s=!1,a=!1,o=!1,l=!1;const c=()=>{const r=t.duration;Number.isFinite(r)&&r>0&&(this.bus.emit("ads:duration",{break:e,duration:r}),this.ctx.events.emit("ads.durationChange",{duration:r,break:e}))},u=t=>{this.bus.emit("ads:quartile",{break:e,quartile:t}),25===t&&(this.ctx.events.emit("ads.firstQuartile",{break:e}),this.omidSession?.firstQuartile()),50===t&&(this.ctx.events.emit("ads.midpoint",{break:e}),this.omidSession?.midpoint()),75===t&&(this.ctx.events.emit("ads.thirdQuartile",{break:e}),this.omidSession?.thirdQuartile()),100===t&&(this.ctx.events.emit("ads.complete",{break:e}),this.omidSession?.complete())},d=()=>{if(r)n&&(this.tracker?.trackResume?.(),this.bus.emit("ads:resume",{break:e}),this.ctx.events.emit("ads.resume",{break:e}),this.omidSession?.resume(),this.simidSession?.resume());else{r=!0,this.tracker?.trackStart?.(),this.ctx.events.emit("play"),this.ctx.events.emit("ads.start",{break:e}),u(0),c();const i=t.duration,n=t.muted?0:Number.isFinite(t.volume)?t.volume:1;this.omidSession?.loaded(),this.omidSession?.start(Number.isFinite(i)?i:0,n),this.simidSession?.progress(t.currentTime,Number.isFinite(i)?i:0)}this.ctx.events.emit("playing"),n=!1},h=()=>{r&&(this.tracker?.trackPause?.(),this.omidSession?.pause(),this.simidSession?.pause()),n=!0,this.bus.emit("ads:pause",{break:e}),this.ctx.events.emit("pause"),this.ctx.events.emit("ads.pause",{break:e})},p=()=>{const r=t.duration,i=t.currentTime;if(!Number.isFinite(r)||r<=0||!Number.isFinite(i))return;c();const n=Math.max(0,r-i);this.bus.emit("ads:timeupdate",{break:e,currentTime:i,remainingTime:n,duration:r}),this.ctx.events.emit("ads.adProgress",{currentTime:i,duration:r,break:e}),this.tracker?.setDuration?.(r),this.tracker?.setProgress?.(i),this.simidSession?.progress(i,r);const d=i/r;!s&&d>=.25&&(s=!0,this.tracker?.trackFirstQuartile?.(),u(25)),!a&&d>=.5&&(a=!0,this.tracker?.trackMidpoint?.(),u(50)),!o&&d>=.75&&(o=!0,this.tracker?.trackThirdQuartile?.(),u(75)),!l&&d>=.999&&(l=!0,this.tracker?.trackComplete?.(),u(100))},m=()=>{const r=t.volume,n=t.muted||0===t.volume;if(this.bus.emit("ads:volumeChange",{break:e,volume:r,muted:n}),this.ctx.events.emit("ads.volumeChange",{volume:r,muted:n,break:e}),this.omidSession?.volumeChange(n?0:r),this.simidSession?.volumeChange(r,n),n!==i&&(i=n,n?(this.tracker?.trackMute?.(),this.bus.emit("ads:mute",{break:e})):(this.tracker?.trackUnmute?.(),this.bus.emit("ads:unmute",{break:e}))),(!this.forcedMuteUntilInteraction||this.ctx.core.userInteracted)&&!this.syncingVolume)try{this.syncingVolume=!0,this.ctx.core.muted=n,Number.isFinite(r)&&(this.ctx.core.volume=Math.max(0,Math.min(1,r)))}catch{}finally{this.syncingVolume=!1}},f=t=>{if(t.defaultPrevented)return;const r=this._lastCreative,i=r?.videoClickThroughURLTemplate||r?.videoClicks?.clickThrough||r?.videoClicks?.clickThroughURLTemplate;if(!i)return;const n="string"==typeof i?i:i.url;this.dom.safeWindowOpen(n),this.tracker?.trackClick?.(),this.tracker?.trackClickThrough?.(),this.bus.emit("ads:clickthrough",{break:e,url:i}),this.ctx.events.emit("ads.click",{break:e,url:i})};t.addEventListener("playing",d),t.addEventListener("pause",h),t.addEventListener("timeupdate",p),t.addEventListener("volumechange",m),t.addEventListener("click",f),t.addEventListener("loadedmetadata",c),this.sessionUnsubs.push(()=>t.removeEventListener("playing",d)),this.sessionUnsubs.push(()=>t.removeEventListener("pause",h)),this.sessionUnsubs.push(()=>t.removeEventListener("timeupdate",p)),this.sessionUnsubs.push(()=>t.removeEventListener("volumechange",m)),this.sessionUnsubs.push(()=>t.removeEventListener("click",f)),this.sessionUnsubs.push(()=>t.removeEventListener("loadedmetadata",c))}startAdPlayback(){const e=this.adVideo;if(this.ctx.events.emit("play"),!e)return;const t=t=>{try{t&&(e.muted=!0,e.volume=0,this.forcedMuteUntilInteraction=!0);const r=e.play?.();return r&&"function"==typeof r.then?r:void 0}catch{return}},r=t(!1);r&&r.catch(()=>{const e=t(!0);e&&e.catch(()=>{})})}waitForAdEnd(){return this.adEndPromise||Promise.resolve()}clearSession(){this.dom.clearSession();for(const e of this.sessionUnsubs)e();if(this.sessionUnsubs=[],this.tracker=void 0,this.adEngineDetach&&(this.adEngineDetach(),this.adEngineDetach=void 0),this.adVideo){try{this.adVideo.pause()}catch{}this.adVideo.remove(),this.adVideo=void 0}try{this.overlay.querySelectorAll("video.op-ads__media").forEach(e=>e?.parentNode?.removeChild?.(e)??e.remove?.())}catch{}this.adEndPromise=null,this.captionMgr.removeAdCaptions(),this.overlay.replaceChildren()}finish(t){const{events:r,leases:i}=this.ctx;this.clearSession(),this.contentMedia&&this.contentHadControls&&this.contentMedia.setAttribute("controls",""),this.contentMedia=void 0,this.contentHadControls=!1,this.overlay.style.display="none",this.overlay.replaceChildren(),i.release("playback","ads"),this.active=!1;const n=!!(t.resume||this.userPlayIntent||this.resumeAfter);this.userPlayIntent=!1,this.captionMgr.restoreActiveTextTrack(this.ctx?.core?.media);try{e.getOverlayManager(this.ctx.core).deactivate(this.overlayId)}catch{}this.omidSession?.destroy(),this.omidSession=void 0,t.suppressResume||(n?r.emit("cmd:play"):r.emit("cmd:pause"))}log(...e){this.cfg?.debug&&console.debug("[player][ads]",...e)}warn(...e){this.cfg?.debug&&console.warn("[player][ads]",...e)}getVastXmlText(e){return i(e)}buildParsedForNonLinearFromXml(e){return r(e)}computeSkipAtSecondsDelegate(e,t){return n(e,t)}collectPodAdsDelegate(e){return c(e,this.cfg?.preferredMediaTypes)}getPrerollBreak(){return this.scheduler.getPrerollBreak()}getBreakId(e){return this.scheduler?this.scheduler.getBreakId(e):k(e)}async loadVmapAndMerge(e,t){return this.scheduler.loadVmapAndMerge(e,t)}get resolvedBreaks(){return this.scheduler?.resolvedBreaks}set resolvedBreaks(e){this.scheduler&&(this.scheduler.resolvedBreaks=e)}get pendingPercentBreaks(){return this.scheduler?.pendingPercentBreaks}set pendingPercentBreaks(e){this.scheduler&&(this.scheduler.pendingPercentBreaks=e)}get playedBreaks(){return this.scheduler?.playedBreaks}get vmapPending(){return this.scheduler?.vmapPending}get vmapLoadPromise(){return this.scheduler?.vmapLoadPromise}get pendingVmapSrc(){return this.scheduler?.pendingVmapSrc}isXmlString(e){return this.scheduler?.isXmlString(e)}ensureOverlayMounted(){return this.dom.ensureOverlayMounted(this.ctx.core.media)}mountCompanions(e){return this.dom.mountCompanions(e)}renderCompanion(e){return this.dom.renderCompanion(e)}renderNonLinear(e){return this.dom.renderNonLinear(e)}ensureRawCaptions(e,t){return this.captionMgr.ensureRawCaptions(e,t)}attachAdCaptionTracks(e,t,r){return this.captionMgr.attachAdCaptionTracks(e,t,r)}}class ut extends ct{constructor(){super(...arguments),Object.defineProperty(this,"mode",{enumerable:!0,configurable:!0,writable:!0,value:"hybrid"})}}function dt(e){let t;if("string"==typeof e){const r=e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e;try{const e=atob(r);t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r)}catch{return null}}else t=e instanceof Uint8Array?e:new Uint8Array(e);let r=0;for(;r<t.length&&252!==t[r];)r++;if(r+14>t.length)return null;const i=t[r+13];if(5===i){if(r+15>t.length)return null;const e=t[r+14],i=!!(128&e);if(!!!(2&e))return{type:"splice_insert",outOfNetwork:i,durationSecs:null,autoReturn:!1};if(r+24>t.length)return null;const n=t[r+19],s=!!(128&n);return{type:"splice_insert",outOfNetwork:i,durationSecs:((1&n)*2**32+t[r+20]*2**24+65536*t[r+21]+256*t[r+22]+t[r+23])/9e4,autoReturn:s}}return 6===i?{type:"time_signal"}:{type:"unknown",commandType:i}}class ht{constructor(){Object.defineProperty(this,"mode",{enumerable:!0,configurable:!0,writable:!0,value:"ssai"}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sink",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"boundTracks",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"activeBreaks",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"cleanups",{enumerable:!0,configurable:!0,writable:!0,value:[]})}init(e,t){this.ctx=e,this.sink=t.ssai?.eventSink??t.eventSink??(()=>{});const{media:r}=e.core;this.scanTracks(r);const i=e=>{const t=e.track;"metadata"===t?.kind&&this.bindTrack(t)};r.textTracks.addEventListener("addtrack",i),this.cleanups.push(()=>r.textTracks.removeEventListener("addtrack",i));const n=e.on("texttrack:listchange",()=>this.scanTracks(r));this.cleanups.push(n);const s=()=>this.checkQuartiles(r.currentTime);r.addEventListener("timeupdate",s),this.cleanups.push(()=>r.removeEventListener("timeupdate",s))}destroy(){for(const e of this.cleanups)e();this.cleanups=[],this.boundTracks.clear(),this.activeBreaks.clear()}scanTracks(e){for(const t of e.textTracks)"metadata"===t.kind&&this.bindTrack(t)}bindTrack(e){if(this.boundTracks.has(e))return;this.boundTracks.add(e),e.mode="hidden";const t=()=>this.handleActiveCues(e);e.addEventListener("cuechange",t),this.cleanups.push(()=>e.removeEventListener("cuechange",t))}handleActiveCues(e){const t=e.activeCues;if(t)for(const e of t)this.processCue(e)}processCue(e){const t=e,r=e.id||String(e.startTime);if(t.data instanceof ArrayBuffer){const i=dt(t.data);if(!i||"splice_insert"!==i.type)return;return void(i.outOfNetwork?this.startBreak(r,i.durationSecs,e.startTime):this.endBreak(r))}const i=t.value;if("SCTE35-OUT"===i?.key&&i.data instanceof ArrayBuffer){const t=dt(i.data);if(!t||"splice_insert"!==t.type||!t.outOfNetwork)return;const n=isFinite(e.endTime)&&e.endTime>e.startTime?e.endTime-e.startTime:t.durationSecs;return void this.startBreak(r,n,e.startTime)}if("SCTE35-IN"===i?.key){const e=this.activeBreaks.has(r)?r:r.endsWith("-in")?r.slice(0,-3):r;return void this.endBreak(e)}const n=null!=t.scte35Out||null!=t.attr?.["SCTE35-OUT"],s=null!=t.scte35In||null!=t.attr?.["SCTE35-IN"];if(n){const t=isFinite(e.endTime)&&e.endTime>e.startTime?e.endTime-e.startTime:null;return void this.startBreak(r,t,e.startTime)}if(s){const e=this.activeBreaks.has(r)?r:r.endsWith("-in")?r.slice(0,-3):r;return void this.endBreak(e)}const a=t.value;if(a instanceof ArrayBuffer||a instanceof Uint8Array||"string"==typeof a){const t=dt(a);if(!t||"splice_insert"!==t.type)return;if(t.outOfNetwork){const i=isFinite(e.endTime)&&e.endTime>e.startTime?e.endTime-e.startTime:t.durationSecs;this.startBreak(r,i,e.startTime)}else{const e=this.activeBreaks.has(r)?r:r.endsWith("-in")?r.slice(0,-3):r;this.endBreak(e)}}}startBreak(e,t,r){if(this.activeBreaks.has(e))return;const i={id:e,startTimeSec:r,durationSec:t,firedQuartiles:new Set};this.activeBreaks.set(e,i),this.ctx.events.emit("ads:break:start",{id:e,kind:"ssai"}),this.sink({type:"impression",breakId:e,contentSrc:this.ctx.core.media?.src})}endBreak(e){this.activeBreaks.get(e)&&(this.activeBreaks.delete(e),this.ctx.events.emit("ads:break:end",{id:e,kind:"ssai"}),this.sink({type:"complete",breakId:e}))}checkQuartiles(e){for(const t of this.activeBreaks.values()){if(null===t.durationSec||t.durationSec<=0)continue;const r=e-t.startTimeSec,i=r/t.durationSec*100;for(const e of[25,50,75,100])i>=e&&!t.firedQuartiles.has(e)&&(t.firedQuartiles.add(e),this.ctx.events.emit("ads:quartile",{breakId:t.id,quartile:e}),this.sink({type:"quartile",breakId:t.id,elapsedSec:r,metadata:{quartile:e}}));i>=100&&this.endBreak(t.id)}}}class pt{constructor(e={}){Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ads"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"1.0.0"}),Object.defineProperty(this,"capabilities",{enumerable:!0,configurable:!0,writable:!0,value:["ads"]}),Object.defineProperty(this,"rawConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"strategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"scteUnsub",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_lazyDom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.rawConfig=e}setup(e){const t=this.rawConfig,r=!!(t.hybrid?.scteSource??t.scteSource),i=t.adDelivery??(r?"hybrid":"csai");if(this.strategy="ssai"===i?new ht:"hybrid"===i?new ut:new ct,this.strategy.init(e,t),this.csai&&(this.csai._dispatchStartBreak=(e,t,r)=>this.startBreak(e,t,r),this.csai._dispatchStartBreakGroup=(e,t)=>this.startBreakGroup(e,t),this.csai._dispatchPlayBreakFromVast=(...e)=>this.playBreakFromVast(...e),this.csai._dispatchGetVastXmlText=(...e)=>Promise.resolve(this.getVastXmlText(...e)),this.csai._dispatchBuildParsedForNonLinear=(...e)=>this.buildParsedForNonLinearFromXml(...e),this.csai._dispatchMountAdVideo=(...e)=>this.mountAdVideo(...e),this.csai._dispatchStartAdPlayback=()=>this.startAdPlayback()),"ssai"!==i){const e=t.hybrid?.scteSource??t.scteSource,r=t.hybrid?.resolveScteUrl??t.resolveScteUrl;e&&r&&this.bindScteSource(e,r)}}async playAds(e){const t=this.csai?.scheduler?.inferSourceTypeForUrl(e);return this.playBreakFromVast({kind:"url",value:e},{kind:"manual",id:"manual",sourceType:t})}async playAdsFromXml(e){return this.playBreakFromVast({kind:"xml",value:e},{kind:"manual",id:"manual"})}getDueMidrollBreaks(e){return this.strategy?.getDueMidrollBreaks?.(e)??[]}getDueMidrollBreak(e){return this.strategy?.getDueMidrollBreak?.(e)}requestSkip(e="api"){this.strategy?.requestSkip?.(e)}destroy(){this.scteUnsub?.(),this.scteUnsub=void 0,this.strategy?.destroy(),this.strategy=void 0}bindScteSource(e,t){const r=e.onCue;e.onCue=e=>{r?.(e),Promise.resolve(t(e)).then(e=>{e&&this.playAds(e)})},this.scteUnsub=()=>{e.onCue=r}}get csai(){return this.strategy instanceof ct?this.strategy:void 0}get lazyDom(){if(!this._lazyDom){const e=document.createElement("div");this._lazyDom=new p(e,this.rawConfig,()=>{},()=>{},()=>{})}return this._lazyDom}get bus(){return this.csai?.bus}get tracker(){return this.csai?.tracker}get active(){return this.csai?.active}set active(e){this.csai&&void 0!==e&&(this.csai.active=e)}get overlay(){return this.csai?.overlay}get ctx(){return this.csai?.ctx}get sessionUnsubs(){return this.csai?.sessionUnsubs}set sessionUnsubs(e){this.csai&&void 0!==e&&(this.csai.sessionUnsubs=e)}get resumeAfter(){return this.csai?.resumeAfter}get globalUnsubs(){return this.csai?.globalUnsubs??[]}get adVideo(){return this.csai?.adVideo}set adVideo(e){this.csai&&(this.csai.adVideo=e)}get forcedMuteUntilInteraction(){return this.csai?.forcedMuteUntilInteraction??!1}set forcedMuteUntilInteraction(e){this.csai&&(this.csai.forcedMuteUntilInteraction=e)}clearSession(){return this.csai?.clearSession()}startAdPlayback(){return this.csai?.startAdPlayback()}mountAdVideo(...e){return this.csai?.mountAdVideo(...e)}get vastClient(){return this.csai?.vastClient}set vastClient(e){this.csai&&(this.csai.vastClient=e)}shouldInterceptPreroll(){return this.csai?.shouldInterceptPreroll()}startBreak(...e){return this.csai?.startBreak(...e)}startBreakGroup(...e){return this.csai?.startBreakGroup(...e)}async playBreakFromVast(...e){return!!this.csai&&await this.csai.playBreakFromVast(...e)}getVastXmlText(e){return i(e)}normalizeVmapAdSource(e){return function(e){if(e)return Array.isArray(e)?e.find(e=>e?.adTagURI||e?.vastAdData)||e[0]:e}(e)}extractVastTagUri(e){return function(e){if(e){if("string"==typeof e)return e.trim()||void 0;if("object"==typeof e){const t=e.uri||e.URI||e.value||e.text||e["#text"];if("string"==typeof t&&t.trim())return t.trim()}}}(e)}parseVmapTimeOffset(e){return function(e){const t=String(e||"").trim();if(!t||"start"===t)return{at:"preroll"};if("end"===t)return{at:"postroll"};if(t.endsWith("%")){const e=Number(t.slice(0,-1));if(Number.isFinite(e)&&e>=0&&e<=100)return{at:0,pendingPercent:e/100}}const r=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(t);if(r){const e=Number(r[1]),t=Number(r[2]),i=Number(r[3]);if([e,t,i].every(e=>Number.isFinite(e)))return{at:3600*e+60*t+i}}const i=Number(t);return Number.isFinite(i)&&i>=0?{at:i}:{at:"preroll"}}(e)}getVastInputFromBreak(e){return T(e)}setSafeHTML(e,t){return function(e,t){const r=document.createElement("template");r.innerHTML=String(t||"");const i=new Set(["SCRIPT","IFRAME","OBJECT","EMBED","LINK","STYLE","SVG","MATH","FORM","INPUT","TEXTAREA","SELECT","OPTION","META","BASE"]),n=document.createTreeWalker(r.content,NodeFilter.SHOW_ELEMENT),s=[];for(;n.nextNode();){const e=n.currentNode;i.has(e.tagName)?s.push(e):Array.from(e.attributes).forEach(t=>{const r=t.name.toLowerCase(),i=(t.value||"").trim();if(r.startsWith("on")&&e.removeAttribute(t.name),"href"===r||"src"===r||"xlink:href"===r){const r=i.toLowerCase(),n=r.startsWith("javascript:"),s=r.startsWith("vbscript:"),a=r.startsWith("data:"),o=r.startsWith("http://")||r.startsWith("https://")||r.startsWith("/")||r.startsWith("./"),l=a&&/^data:image\/(png|gif|jpe?g|webp|svg\+xml);/i.test(i);(n||s||!o&&!l)&&e.removeAttribute(t.name)}"srcdoc"===r&&e.removeAttribute(t.name)})}s.forEach(e=>e.remove()),e.replaceChildren(r.content.cloneNode(!0))}(e,t)}collectNonLinearCreatives(e){return u(e)}collectNonLinearFromXml(e){return d(e)}buildParsedForNonLinearFromXml(e){return r(e)}computeSkipAtSeconds(e,t){return n(e,t)}collectPodAds(e){return c(e,this.csai?.cfg?.preferredMediaTypes??[])}getPrerollBreak(){return this.csai?.getPrerollBreak()}getBreakId(e){return this.csai?.getBreakId(e)??k(e)}async loadVmapAndMerge(e,t){return this.csai?.loadVmapAndMerge(e,t)}get resolvedBreaks(){return this.csai?.resolvedBreaks}set resolvedBreaks(e){this.csai&&void 0!==e&&(this.csai.resolvedBreaks=e)}get pendingPercentBreaks(){return this.csai?.pendingPercentBreaks}set pendingPercentBreaks(e){this.csai&&void 0!==e&&(this.csai.pendingPercentBreaks=e)}get playedBreaks(){return this.csai?.playedBreaks}get vmapPending(){return this.csai?.vmapPending}get vmapLoadPromise(){return this.csai?.vmapLoadPromise}get pendingVmapSrc(){return this.csai?.pendingVmapSrc}isXmlString(e){return this.csai?.isXmlString(e)}ensureOverlayMounted(){return this.csai?.ensureOverlayMounted()}mountCompanions(e){return(this.csai?.dom??this.lazyDom).mountCompanions(e)}renderCompanion(e){return(this.csai?.dom??this.lazyDom).renderCompanion(e)}renderNonLinear(e){return(this.csai?.dom??this.lazyDom).renderNonLinear(e)}ensureRawCaptions(e,t){return this.csai?.ensureRawCaptions(e,t)}attachAdCaptionTracks(e,t,r){return this.csai?.attachAdCaptionTracks(e,t,r)}}var mt;function ft(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(mt=window).OpenPlayerPlugins=mt.OpenPlayerPlugins||{},mt.OpenPlayerPlugins.ads={name:"ads",kind:"plugin",factory:e=>new pt({...e||{},allowNativeControls:!1}),install:e=>function(e){e&&e.prototype&&(Object.getOwnPropertyDescriptor(e.prototype,"ads")||Object.defineProperty(e.prototype,"ads",{configurable:!0,enumerable:!1,get(){return this.getPlugin?.("ads")}}),"function"!=typeof e.prototype.playAds&&Object.defineProperty(e.prototype,"playAds",{configurable:!0,enumerable:!1,value:function(e){const t=this.getPlugin?.("ads")||this.ads;if(!t)throw new Error("Ads plugin not installed; cannot playAds()");const r=String(e??"").trim();if(!r)throw new Error("playAds(input) requires a non-empty URL or VAST XML string");if(r.startsWith("<")){if("function"!=typeof t.playAdsFromXml)throw new Error("Ads plugin does not support XML input (playAdsFromXml missing)");return t.playAdsFromXml(r)}return t.playAds(r)}}))}(e),extend:(e,t)=>function(e,t){e&&("function"==typeof e.extend?e.extend({ads:t}):void 0===e.ads&&(e.ads=t))}(e,t)},function(e){var t;(t=e.OpenPlayerJS)&&!t.prototype.playAds&&(t.prototype.playAds=function(e){const t="function"==typeof this.getCore?this.getCore():null;if(!t)throw new Error("Call player.init() before player.playAds()");const r="function"==typeof t.getPlugin?t.getPlugin("ads"):null;if(!r)throw new Error("Ads plugin not installed");const i=String(e??"").trim();if(!i)throw new Error("playAds(input) requires a non-empty URL or VAST XML string");return i.startsWith("<")?r.playAdsFromXml(i):r.playAds(i)})}(window);var gt,vt={},bt={};function yt(){if(gt)return bt;function e(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.getOwnPropertyDescriptors&&(e=t.create(null,t.getOwnPropertyDescriptors(e))),t&&"function"==typeof t.freeze?t.freeze(e):e}function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}gt=1;var r=e({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});var i=e({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});var n=e({script:!1,style:!1,textarea:!0,title:!0});function s(e){return e===a.HTML}var a=e({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),o=Object.keys(a).map(function(e){return a[e]});var l=e({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return bt.assign=function(e,r){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var i in r)t(r,i)&&(e[i]=r[i]);return e},bt.find=function(e,r,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,r);for(var n=0;n<e.length;n++)if(t(e,n)){var s=e[n];if(r.call(void 0,s,n,e))return s}},bt.freeze=e,bt.HTML_BOOLEAN_ATTRIBUTES=r,bt.HTML_RAW_TEXT_ELEMENTS=n,bt.HTML_VOID_ELEMENTS=i,bt.hasDefaultHTMLNamespace=function(e){return s(e)||e===a.XML_XHTML_APPLICATION},bt.hasOwn=t,bt.isHTMLBooleanAttribute=function(e){return t(r,e.toLowerCase())},bt.isHTMLRawTextElement=function(e){var r=e.toLowerCase();return t(n,r)&&!n[r]},bt.isHTMLEscapableRawTextElement=function(e){var r=e.toLowerCase();return t(n,r)&&n[r]},bt.isHTMLMimeType=s,bt.isHTMLVoidElement=function(e){return t(i,e.toLowerCase())},bt.isValidMimeType=function(e){return o.indexOf(e)>-1},bt.MIME_TYPE=a,bt.NAMESPACE=l,bt}var Et,Tt={};function kt(){if(Et)return Tt;function e(e,t){e.prototype=Object.create(Error.prototype,{constructor:{value:e},name:{value:e.name,enumerable:!0,writable:t}})}Et=1;var t=yt().freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),r=Object.keys(t);function i(e){return"number"==typeof e&&e>=1&&e<=25}function n(e,s){var a;i(e)?(this.name=r[e],this.message=s||""):(this.message=e,this.name="string"==typeof(a=s)&&a.substring(a.length-t.Error.length)===t.Error?s:t.Error),Error.captureStackTrace&&Error.captureStackTrace(this,n)}e(n,!0),Object.defineProperties(n.prototype,{code:{enumerable:!0,get:function(){var e=r.indexOf(this.name);return i(e)?e:0}}});for(var s={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},a=Object.entries(s),o=0;o<a.length;o++){n[a[o][0]]=a[o][1]}function l(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,l)}return e(l),Tt.DOMException=n,Tt.DOMExceptionName=t,Tt.ExceptionCode=s,Tt.ParseError=l,Tt}var Nt,At,wt={},St={};function Ct(){if(Nt)return St;function e(e){try{"function"!=typeof e&&(e=RegExp);var t=new e("𝌆","u").exec("𝌆");return!!t&&2===t[0].length}catch(e){}return!1}Nt=1;var t=e();function r(e){if("["!==e.source[0])throw new Error(e+" can not be used with chars");return e.source.slice(1,e.source.lastIndexOf("]"))}function i(e,r){if("["!==e.source[0])throw new Error("/"+e.source+"/ can not be used with chars_without");if(!r||"string"!=typeof r)throw new Error(JSON.stringify(r)+" is not a valid search");if(-1===e.source.indexOf(r))throw new Error('"'+r+'" is not is /'+e.source+"/");if("-"===r&&1!==e.source.indexOf(r))throw new Error('"'+r+'" is not at the first postion of /'+e.source+"/");return new RegExp(e.source.replace(r,""),t?"u":"")}function n(e){var r=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(e){var t="string"==typeof e;if(t&&void 0===r&&"|"===e)throw new Error("use regg instead of reg to wrap expressions with `|`!");return t?e:e.source}).join(""),t?"mu":"m")}function s(e){if(0===arguments.length)throw new Error("no parameters provided");return n.apply(s,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var a=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;t&&(a=n("[",r(a),"\\u{10000}-\\u{10FFFF}","]"));var o=/[\x20\x09\x0D\x0A]/,l=r(o),c=n(o,"+"),u=n(o,"*"),d=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;t&&(d=n("[",r(d),"\\u{10000}-\\u{10FFFF}","]"));var h=n("[",r(d),r(/[-.0-9\xB7]/),r(/[\u0300-\u036F\u203F-\u2040]/),"]"),p=n(d,h,"*"),m=n(h,"+"),f=n("&",p,";"),g=s(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),v=s(f,"|",g),b=n("%",p,";"),y=s(n('"',s(/[^%&"]/,"|",b,"|",v),"*",'"'),"|",n("'",s(/[^%&']/,"|",b,"|",v),"*","'")),E=s('"',s(/[^<&"]/,"|",v),"*",'"',"|","'",s(/[^<&']/,"|",v),"*","'"),T=n(i(d,":"),i(h,":"),"*"),k=n(T,s(":",T),"?"),N=n("^",k,"$"),A=n("(",k,")"),w=s(/"[^"]*"|'[^']*'/),S=n(/^<\?/,"(",p,")",s(c,"(",a,"*?)"),"?",/\?>/),C=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,R=s('"',C,'*"',"|","'",i(C,"'"),"*'"),I="\x3c!--",L=n(I,s(i(a,"-"),"|",n("-",i(a,"-"))),"*","--\x3e"),x="#PCDATA",D=s(n(/\(/,u,x,s(u,/\|/,u,k),"*",u,/\)\*/),"|",n(/\(/,u,x,u,/\)/)),O=s("EMPTY","|","ANY","|",D,"|",n(/\([^>]+\)/,/[?*+]?/)),M=n("<!ELEMENT",c,s(k,"|",b),c,s(O,"|",b),u,">"),P=n("NOTATION",c,/\(/,u,p,s(u,/\|/,u,p),"*",u,/\)/),U=n(/\(/,u,m,s(u,/\|/,u,m),"*",u,/\)/),_=s(P,"|",U),B=s(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",_),V=s(/#REQUIRED|#IMPLIED/,"|",s(s("#FIXED",c),"?",E)),F=n("<!ATTLIST",c,p,s(c,p,c,B,c,V),"*",u,">"),q="about:legacy-compat",j=s('"'+q+'"',"|","'"+q+"'"),H="SYSTEM",W="PUBLIC",G=s(s(H,c,w),"|",s(W,c,R,c,w)),X=n("^",s(s(H,c,"(?<SystemLiteralOnly>",w,")"),"|",s(W,c,"(?<PubidLiteral>",R,")",c,"(?<SystemLiteral>",w,")"))),z=s(c,"NDATA",c,p),Y="<!ENTITY",Q=n(Y,c,p,c,s(y,"|",s(G,z,"?")),u,">"),K=s(y,"|",G),$=s(Q,"|",n(Y,c,"%",c,p,c,K,u,">")),J=n(W,c,R),Z=n("<!NOTATION",c,p,c,s(G,"|",J),u,">"),ee=n(u,"=",u),te=/1[.]\d+/,re=n(c,"version",ee,s("'",te,"'","|",'"',te,'"')),ie=/[A-Za-z][-A-Za-z0-9._]*/,ne=n(/^<\?xml/,re,s(c,"encoding",ee,s('"',ie,'"',"|","'",ie,"'")),"?",s(c,"standalone",ee,s("'",s("yes","|","no"),"'","|",'"',s("yes","|","no"),'"')),"?",u,/\?>/),se=n(a,"*?",/\]\]>/),ae=n(/<!\[CDATA\[/,se);return St.chars=r,St.chars_without=i,St.detectUnicodeSupport=e,St.reg=n,St.regg=s,St.ABOUT_LEGACY_COMPAT=q,St.ABOUT_LEGACY_COMPAT_SystemLiteral=j,St.AttlistDecl=F,St.CDATA_START="<![CDATA[",St.CDATA_END="]]>",St.CDSect=ae,St.Char=a,St.Comment=L,St.COMMENT_START=I,St.COMMENT_END="--\x3e",St.DOCTYPE_DECL_START="<!DOCTYPE",St.elementdecl=M,St.EntityDecl=$,St.EntityValue=y,St.ExternalID=G,St.ExternalID_match=X,St.Name=p,St.NotationDecl=Z,St.Reference=v,St.PEReference=b,St.PI=S,St.PUBLIC=W,St.PubidLiteral=R,St.QName=k,St.QName_exact=N,St.QName_group=A,St.S=c,St.SChar_s=l,St.S_OPT=u,St.SYSTEM=H,St.SystemLiteral=w,St.UNICODE_REPLACEMENT_CHARACTER="�",St.UNICODE_SUPPORT=t,St.XMLDecl=ne,St}function Rt(){if(At)return wt;At=1;var e=yt(),t=e.find,r=e.hasDefaultHTMLNamespace,i=e.hasOwn,n=e.isHTMLMimeType,s=e.isHTMLRawTextElement,a=e.isHTMLVoidElement,o=e.MIME_TYPE,l=e.NAMESPACE,c=Symbol(),u=kt(),d=u.DOMException,h=u.DOMExceptionName,p=Ct();function m(e){if(e!==c)throw new TypeError("Illegal constructor")}function f(e){return""!==e}function g(e,t){return i(e,t)||(e[t]=!0),e}function v(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(f):[]}(e);return Object.keys(t.reduce(g,{}))}function b(e){if(!p.QName_exact.test(e))throw new d(d.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+e+'"')}function y(t,r){b(r),t=t||null;var i=null,n=r;if(r.indexOf(":")>=0){var s=r.split(":");i=s[0],n=s[1]}if(null!==i&&null===t)throw new d(d.NAMESPACE_ERR,"prefix is non-null and namespace is null");if("xml"===i&&t!==e.NAMESPACE.XML)throw new d(d.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if(("xmlns"===i||"xmlns"===r)&&t!==e.NAMESPACE.XMLNS)throw new d(d.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(t===e.NAMESPACE.XMLNS&&"xmlns"!==i&&"xmlns"!==r)throw new d(d.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[t,i,n]}function E(e,t){for(var r in e)i(e,r)&&(t[r]=e[r])}function T(e,t){var r=e.prototype;if(!(r instanceof t)){function i(){}i.prototype=t.prototype,E(r,i=new i),e.prototype=r=i}r.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),r.constructor=e)}var k={},N=k.ELEMENT_NODE=1,A=k.ATTRIBUTE_NODE=2,w=k.TEXT_NODE=3,S=k.CDATA_SECTION_NODE=4,C=k.ENTITY_REFERENCE_NODE=5,R=k.ENTITY_NODE=6,I=k.PROCESSING_INSTRUCTION_NODE=7,L=k.COMMENT_NODE=8,x=k.DOCUMENT_NODE=9,D=k.DOCUMENT_TYPE_NODE=10,O=k.DOCUMENT_FRAGMENT_NODE=11,M=k.NOTATION_NODE=12,P=e.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function U(e,t){if(t.length<e.length)return U(t,e);var r=null;for(var i in e){if(e[i]!==t[i])return r;r=e[i]}return r}function _(e){return e.guid||(e.guid=Math.random()),e.guid}function B(){}function V(e,t){this._node=e,this._refresh=t,F(this)}function F(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(Ce(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)i(e,n)&&delete e[n];E(r,e),e._inc=t}}function q(){}function j(e,t){for(var r=0;r<e.length;){if(e[r]===t)return r;r++}}function H(e,t,r,i){if(i?t[j(t,i)]=r:(t[t.length]=r,t.length++),e){r.ownerElement=e;var n=e.ownerDocument;n&&(i&&K(n,e,i),function(e,t,r){e&&e._inc++;var i=r.namespaceURI;i===l.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}(n,e,r))}}function W(e,t,r){var i=j(t,r);if(i>=0){for(var n=t.length-1;i<=n;)t[i]=t[++i];if(t.length=n,e){var s=e.ownerDocument;s&&K(s,e,r),r.ownerElement=null}}}function G(){}function X(e){m(e)}function z(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function Y(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(Y(e,t))return!0}while(e=e.nextSibling)}function Q(e,t){m(e);var r=t||{};this.ownerDocument=this,this.contentType=r.contentType||o.XML_APPLICATION,this.type=n(this.contentType)?"html":"xml"}function K(e,t,r,i){e&&e._inc++,r.namespaceURI===l.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function $(e,t,r){if(e&&e._inc){e._inc++;var i=t.childNodes;if(r&&!r.nextSibling)i[i.length++]=r;else{for(var n=t.firstChild,s=0;n;)i[s++]=n,n=n.nextSibling;i.length=s,delete i[i.length]}}}function J(e,t){if(e!==t.parentNode)throw new d(d.NOT_FOUND_ERR,"child's parent is not parent");var r=t.previousSibling,i=t.nextSibling;return r?r.nextSibling=i:e.firstChild=i,i?i.previousSibling=r:e.lastChild=r,$(e.ownerDocument,e),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function Z(e){return e&&e.nodeType===X.DOCUMENT_TYPE_NODE}function ee(e){return e&&e.nodeType===X.ELEMENT_NODE}function te(e){return e&&e.nodeType===X.TEXT_NODE}function re(e,r){var i=e.childNodes||[];if(t(i,ee)||Z(r))return!1;var n=t(i,Z);return!(r&&n&&i.indexOf(n)>i.indexOf(r))}function ie(e,r){var i=e.childNodes||[];if(t(i,function(e){return ee(e)&&e!==r}))return!1;var n=t(i,Z);return!(r&&n&&i.indexOf(n)>i.indexOf(r))}function ne(e,t,r){if(!function(e){return e&&(e.nodeType===X.DOCUMENT_NODE||e.nodeType===X.DOCUMENT_FRAGMENT_NODE||e.nodeType===X.ELEMENT_NODE)}(e))throw new d(d.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new d(d.NOT_FOUND_ERR,"child not in parent");if(!function(e){return e&&(e.nodeType===X.CDATA_SECTION_NODE||e.nodeType===X.COMMENT_NODE||e.nodeType===X.DOCUMENT_FRAGMENT_NODE||e.nodeType===X.DOCUMENT_TYPE_NODE||e.nodeType===X.ELEMENT_NODE||e.nodeType===X.PROCESSING_INSTRUCTION_NODE||e.nodeType===X.TEXT_NODE)}(t)||Z(t)&&e.nodeType!==X.DOCUMENT_NODE)throw new d(d.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function se(e,r,i){var n=e.childNodes||[],s=r.childNodes||[];if(r.nodeType===X.DOCUMENT_FRAGMENT_NODE){var a=s.filter(ee);if(a.length>1||t(s,te))throw new d(d.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===a.length&&!re(e,i))throw new d(d.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ee(r)&&!re(e,i))throw new d(d.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Z(r)){if(t(n,Z))throw new d(d.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=t(n,ee);if(i&&n.indexOf(o)<n.indexOf(i))throw new d(d.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!i&&o)throw new d(d.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function ae(e,r,i){var n=e.childNodes||[],s=r.childNodes||[];if(r.nodeType===X.DOCUMENT_FRAGMENT_NODE){var a=s.filter(ee);if(a.length>1||t(s,te))throw new d(d.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===a.length&&!ie(e,i))throw new d(d.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ee(r)&&!ie(e,i))throw new d(d.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Z(r)){function l(e){return Z(e)&&e!==i}if(t(n,l))throw new d(d.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=t(n,ee);if(i&&n.indexOf(o)<n.indexOf(i))throw new d(d.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function oe(e,t,r,i){ne(e,t,r),e.nodeType===X.DOCUMENT_NODE&&(i||se)(e,t,r);var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===O){var s=t.firstChild;if(null==s)return t;var a=t.lastChild}else s=a=t;var o=r?r.previousSibling:e.lastChild;s.previousSibling=o,a.nextSibling=r,o?o.nextSibling=s:e.firstChild=s,null==r?e.lastChild=a:r.previousSibling=a;do{s.parentNode=e}while(s!==a&&(s=s.nextSibling));return $(e.ownerDocument||e,e,t),t.nodeType==O&&(t.firstChild=t.lastChild=null),t}function le(e){m(e),this._nsMap=Object.create(null)}function ce(e){m(e),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}function ue(e){m(e)}function de(e){m(e)}function he(e){m(e)}function pe(e){m(e)}function me(e){m(e)}function fe(e){m(e)}function ge(e){m(e)}function ve(e){m(e)}function be(e){m(e)}function ye(e){m(e)}function Ee(){}function Te(e){var t=[],r=this.nodeType===x&&this.documentElement||this,i=r.prefix,n=r.namespaceURI;if(n&&null==i&&null==(i=r.lookupPrefix(n)))var s=[{namespace:n,prefix:null}];return Ae(this,t,e,s),t.join("")}function ke(e,t,r){var i=e.prefix||"",n=e.namespaceURI;if(!n)return!1;if("xml"===i&&n===l.XML||n===l.XMLNS)return!1;for(var s=r.length;s--;){var a=r[s];if(a.prefix===i)return a.namespace!==n}return!0}function Ne(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,z),'"')}function Ae(e,t,r,i){i||(i=[]);var n="html"===(e.nodeType===x?e:e.ownerDocument).type;if(r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case N:var o=e.attributes,c=o.length,u=e.firstChild,d=e.tagName,h=d;if(!n&&!e.prefix&&e.namespaceURI){for(var m,f=0;f<o.length;f++)if("xmlns"===o.item(f).name){m=o.item(f).value;break}if(!m)for(var g=i.length-1;g>=0;g--){if(""===(v=i[g]).prefix&&v.namespace===e.namespaceURI){m=v.namespace;break}}if(m!==e.namespaceURI)for(g=i.length-1;g>=0;g--){var v;if((v=i[g]).namespace===e.namespaceURI){v.prefix&&(h=v.prefix+":"+d);break}}}t.push("<",h);for(var b=0;b<c;b++){"xmlns"==(y=o.item(b)).prefix?i.push({prefix:y.localName,namespace:y.value}):"xmlns"==y.nodeName&&i.push({prefix:"",namespace:y.value})}for(b=0;b<c;b++){var y,E,T;if(ke(y=o.item(b),0,i))Ne(t,(E=y.prefix||"")?"xmlns:"+E:"xmlns",T=y.namespaceURI),i.push({prefix:E,namespace:T});Ae(y,t,r,i)}if(d===h&&ke(e,0,i))Ne(t,(E=e.prefix||"")?"xmlns:"+E:"xmlns",T=e.namespaceURI),i.push({prefix:E,namespace:T});var k=!u;if(k&&(n||e.namespaceURI===l.HTML)&&(k=a(d)),k)t.push("/>");else{if(t.push(">"),n&&s(d))for(;u;)u.data?t.push(u.data):Ae(u,t,r,i.slice()),u=u.nextSibling;else for(;u;)Ae(u,t,r,i.slice()),u=u.nextSibling;t.push("</",h,">")}return;case x:case O:for(u=e.firstChild;u;)Ae(u,t,r,i.slice()),u=u.nextSibling;return;case A:return Ne(t,e.name,e.value);case w:return t.push(e.data.replace(/[<&>]/g,z));case S:return t.push(p.CDATA_START,e.data.replace(/]]>/g,"]]]]><![CDATA[>"),p.CDATA_END);case L:return t.push(p.COMMENT_START,e.data,p.COMMENT_END);case D:var R=e.publicId,M=e.systemId;return t.push(p.DOCTYPE_DECL_START," ",e.name),R?(t.push(" ",p.PUBLIC," ",R),M&&"."!==M&&t.push(" ",M)):M&&"."!==M&&t.push(" ",p.SYSTEM," ",M),e.internalSubset&&t.push(" [",e.internalSubset,"]"),void t.push(">");case I:return t.push("<?",e.target," ",e.data,"?>");case C:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function we(e,t,r){var i;switch(t.nodeType){case N:(i=t.cloneNode(!1)).ownerDocument=e;case O:break;case A:r=!0}if(i||(i=t.cloneNode(!1)),i.ownerDocument=e,i.parentNode=null,r)for(var n=t.firstChild;n;)i.appendChild(we(e,n,r)),n=n.nextSibling;return i}function Se(e,t,r){var n=new t.constructor(c);for(var s in t)if(i(t,s)){var a=t[s];"object"!=typeof a&&a!=n[s]&&(n[s]=a)}switch(t.childNodes&&(n.childNodes=new B),n.ownerDocument=e,n.nodeType){case N:var o=t.attributes,l=n.attributes=new q,u=o.length;l._ownerElement=n;for(var d=0;d<u;d++)n.setAttributeNode(Se(e,o.item(d),!0));break;case A:r=!0}if(r)for(var h=t.firstChild;h;)n.appendChild(Se(e,h,r)),h=h.nextSibling;return n}function Ce(e,t,r){e[t]=r}function Re(e){for(var t=[],r=e.firstChild;r;)r.nodeType===N&&t.push(r),r=r.nextSibling;return t}B.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e){for(var t=[],r=0;r<this.length;r++)Ae(this[r],t,e);return t.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},B.prototype[Symbol.iterator]=function(){var e=this,t=0;return{next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},V.prototype.item=function(e){return F(this),this[e]||null},T(V,B),q.prototype={length:0,item:B.prototype.item,getNamedItem:function(e){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());for(var t=0;t<this.length;){var r=this[t];if(r.nodeName===e)return r;t++}return null},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!==this._ownerElement)throw new d(d.INUSE_ATTRIBUTE_ERR);var r=this.getNamedItemNS(e.namespaceURI,e.localName);return r===e?e:(H(this._ownerElement,this,e,r),r)},setNamedItemNS:function(e){return this.setNamedItem(e)},removeNamedItem:function(e){var t=this.getNamedItem(e);if(!t)throw new d(d.NOT_FOUND_ERR,e);return W(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);if(!r)throw new d(d.NOT_FOUND_ERR,e?e+" : "+t:t);return W(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){e||(e=null);for(var r=0;r<this.length;){var i=this[r];if(i.localName===t&&i.namespaceURI===e)return i;r++}return null}},q.prototype[Symbol.iterator]=function(){var e=this,t=0;return{next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},G.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var i=o.XML_APPLICATION;e===l.HTML?i=o.XML_XHTML_APPLICATION:e===l.SVG&&(i=o.XML_SVG_IMAGE);var n=new Q(c,{contentType:i});if(n.implementation=this,n.childNodes=new B,n.doctype=r||null,r&&n.appendChild(r),t){var s=n.createElementNS(e,t);n.appendChild(s)}return n},createDocumentType:function(e,t,r,i){b(e);var n=new me(c);return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n.internalSubset=i||"",n.childNodes=new B,n},createHTMLDocument:function(e){var t=new Q(c,{contentType:o.HTML});if(t.implementation=this,t.childNodes=new B,!1!==e){t.doctype=this.createDocumentType("html"),t.doctype.ownerDocument=t,t.appendChild(t.doctype);var r=t.createElement("html");t.appendChild(r);var i=t.createElement("head");if(r.appendChild(i),"string"==typeof e){var n=t.createElement("title");n.appendChild(t.createTextNode(e)),i.appendChild(n)}r.appendChild(t.createElement("body"))}return t}},X.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var e=this.getRootNode();return e&&e.nodeType===e.DOCUMENT_NODE},contains:function(e){if(!e)return!1;var t=e;do{if(this===t)return!0;t=t.parentNode}while(t);return!1},getRootNode:function(e){var t=this;do{if(!t.parentNode)return t;t=t.parentNode}while(t)},isEqualNode:function(e){if(!e)return!1;if(this.nodeType!==e.nodeType)return!1;switch(this.nodeType){case this.DOCUMENT_TYPE_NODE:if(this.name!==e.name)return!1;if(this.publicId!==e.publicId)return!1;if(this.systemId!==e.systemId)return!1;break;case this.ELEMENT_NODE:if(this.namespaceURI!==e.namespaceURI)return!1;if(this.prefix!==e.prefix)return!1;if(this.localName!==e.localName)return!1;if(this.attributes.length!==e.attributes.length)return!1;for(var t=0;t<this.attributes.length;t++){var r=this.attributes.item(t);if(!r.isEqualNode(e.getAttributeNodeNS(r.namespaceURI,r.localName)))return!1}break;case this.ATTRIBUTE_NODE:if(this.namespaceURI!==e.namespaceURI)return!1;if(this.localName!==e.localName)return!1;if(this.value!==e.value)return!1;break;case this.PROCESSING_INSTRUCTION_NODE:if(this.target!==e.target||this.data!==e.data)return!1;break;case this.TEXT_NODE:case this.COMMENT_NODE:if(this.data!==e.data)return!1}if(this.childNodes.length!==e.childNodes.length)return!1;for(t=0;t<this.childNodes.length;t++)if(!this.childNodes[t].isEqualNode(e.childNodes[t]))return!1;return!0},isSameNode:function(e){return this===e},insertBefore:function(e,t){return oe(this,e,t)},replaceChild:function(e,t){oe(this,e,t,ae),t&&this.removeChild(t)},removeChild:function(e){return J(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return Se(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==w&&e.nodeType==w?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var n in r)if(i(r,n)&&r[n]===e)return n;t=t.nodeType==A?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&i(r,e))return r[e];t=t.nodeType==A?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)},compareDocumentPosition:function(e){if(this===e)return 0;var t=e,r=this,i=null,n=null;if(t instanceof ce&&(t=(i=t).ownerElement),r instanceof ce&&(r=(n=r).ownerElement,i&&t&&r===t))for(var s,a=0;s=r.attributes[a];a++){if(s===i)return P.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+P.DOCUMENT_POSITION_PRECEDING;if(s===n)return P.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+P.DOCUMENT_POSITION_FOLLOWING}if(!t||!r||r.ownerDocument!==t.ownerDocument)return P.DOCUMENT_POSITION_DISCONNECTED+P.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(_(r.ownerDocument)>_(t.ownerDocument)?P.DOCUMENT_POSITION_FOLLOWING:P.DOCUMENT_POSITION_PRECEDING);if(n&&t===r)return P.DOCUMENT_POSITION_CONTAINS+P.DOCUMENT_POSITION_PRECEDING;if(i&&t===r)return P.DOCUMENT_POSITION_CONTAINED_BY+P.DOCUMENT_POSITION_FOLLOWING;for(var o=[],l=t.parentNode;l;){if(!n&&l===r)return P.DOCUMENT_POSITION_CONTAINED_BY+P.DOCUMENT_POSITION_FOLLOWING;o.push(l),l=l.parentNode}o.reverse();for(var c=[],u=r.parentNode;u;){if(!i&&u===t)return P.DOCUMENT_POSITION_CONTAINS+P.DOCUMENT_POSITION_PRECEDING;c.push(u),u=u.parentNode}c.reverse();var d=U(o,c);for(var h in d.childNodes){var p=d.childNodes[h];if(p===r)return P.DOCUMENT_POSITION_FOLLOWING;if(p===t)return P.DOCUMENT_POSITION_PRECEDING;if(c.indexOf(p)>=0)return P.DOCUMENT_POSITION_FOLLOWING;if(o.indexOf(p)>=0)return P.DOCUMENT_POSITION_PRECEDING}return 0}},E(k,X),E(k,X.prototype),E(P,X),E(P,X.prototype),Q.prototype={implementation:null,nodeName:"#document",nodeType:x,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType===O){for(var r=e.firstChild;r;){var i=r.nextSibling;this.insertBefore(r,t),r=i}return e}return oe(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===N&&(this.documentElement=e),e},removeChild:function(e){var t=J(this,e);return t===this.documentElement&&(this.documentElement=null),t},replaceChild:function(e,t){oe(this,e,t,ae),e.ownerDocument=this,t&&this.removeChild(t),ee(e)&&(this.documentElement=e)},importNode:function(e,t){return we(this,e,t)},getElementById:function(e){var t=null;return Y(this.documentElement,function(r){if(r.nodeType==N&&r.getAttribute("id")==e)return t=r,!0}),t},createElement:function(e){var t=new le(c);return t.ownerDocument=this,"html"===this.type&&(e=e.toLowerCase()),r(this.contentType)&&(t.namespaceURI=l.HTML),t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new B,(t.attributes=new q)._ownerElement=t,t},createDocumentFragment:function(){var e=new be(c);return e.ownerDocument=this,e.childNodes=new B,e},createTextNode:function(e){var t=new de(c);return t.ownerDocument=this,t.childNodes=new B,t.appendData(e),t},createComment:function(e){var t=new he(c);return t.ownerDocument=this,t.childNodes=new B,t.appendData(e),t},createCDATASection:function(e){if(-1!==e.indexOf("]]>"))throw new d(d.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new pe(c);return t.ownerDocument=this,t.childNodes=new B,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new ye(c);return r.ownerDocument=this,r.childNodes=new B,r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){if(!p.QName_exact.test(e))throw new d(d.INVALID_CHARACTER_ERR,'invalid character in name "'+e+'"');return"html"===this.type&&(e=e.toLowerCase()),this._createAttribute(e)},_createAttribute:function(e){var t=new ce(c);return t.ownerDocument=this,t.childNodes=new B,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){if(!p.Name.test(e))throw new d(d.INVALID_CHARACTER_ERR,'not a valid xml name "'+e+'"');if("html"===this.type)throw new d("document is an html document",h.NotSupportedError);var t=new ve(c);return t.ownerDocument=this,t.childNodes=new B,t.nodeName=e,t},createElementNS:function(e,t){var r=y(e,t),i=new le(c),n=i.attributes=new q;return i.childNodes=new B,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=r[0],i.prefix=r[1],i.localName=r[2],n._ownerElement=i,i},createAttributeNS:function(e,t){var r=y(e,t),i=new ce(c);return i.ownerDocument=this,i.childNodes=new B,i.nodeName=t,i.name=t,i.specified=!0,i.namespaceURI=r[0],i.prefix=r[1],i.localName=r[2],i}},T(Q,X),le.prototype={nodeType:N,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return"html"===this.ownerDocument.type&&this.namespaceURI===l.HTML},hasAttributes:function(){return!(!this.attributes||!this.attributes.length)},hasAttribute:function(e){return!!this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t?t.value:null},getAttributeNode:function(e){return this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase()),this.attributes.getNamedItem(e)},setAttribute:function(e,t){this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());var r=this.getAttributeNode(e);r?r.value=r.nodeValue=""+t:((r=this.ownerDocument._createAttribute(e)).value=r.nodeValue=""+t,this.setAttributeNode(r))},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},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:null},setAttributeNS:function(e,t,r){var i=y(e,t)[2],n=this.getAttributeNodeNS(e,i);n?n.value=n.nodeValue=""+r:((n=this.ownerDocument.createAttributeNS(e,t)).value=n.nodeValue=""+r,this.setAttributeNode(n))},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByClassName:function(e){var t=v(e);return new V(this,function(r){var i=[];return t.length>0&&Y(r,function(n){if(n!==r&&n.nodeType===N){var s=n.getAttribute("class");if(s){var a=e===s;if(!a){var o=v(s);a=t.every((l=o,function(e){return l&&-1!==l.indexOf(e)}))}a&&i.push(n)}}var l}),i})},getElementsByTagName:function(e){var t="html"===(this.nodeType===x?this:this.ownerDocument).type,r=e.toLowerCase();return new V(this,function(i){var n=[];return Y(i,function(s){s!==i&&s.nodeType===N&&(("*"===e||s.getQualifiedName()===(t&&s.namespaceURI===l.HTML?r:e))&&n.push(s))}),n})},getElementsByTagNameNS:function(e,t){return new V(this,function(r){var i=[];return Y(r,function(n){n===r||n.nodeType!==N||"*"!==e&&n.namespaceURI!==e||"*"!==t&&n.localName!=t||i.push(n)}),i})}},Q.prototype.getElementsByClassName=le.prototype.getElementsByClassName,Q.prototype.getElementsByTagName=le.prototype.getElementsByTagName,Q.prototype.getElementsByTagNameNS=le.prototype.getElementsByTagNameNS,T(le,X),ce.prototype.nodeType=A,T(ce,X),ue.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)},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}},T(ue,X),de.prototype={nodeName:"#text",nodeType:w,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}},T(de,ue),he.prototype={nodeName:"#comment",nodeType:L},T(he,ue),pe.prototype={nodeName:"#cdata-section",nodeType:S},T(pe,de),me.prototype.nodeType=D,T(me,X),fe.prototype.nodeType=M,T(fe,X),ge.prototype.nodeType=R,T(ge,X),ve.prototype.nodeType=C,T(ve,X),be.prototype.nodeName="#document-fragment",be.prototype.nodeType=O,T(be,X),ye.prototype.nodeType=I,T(ye,ue),Ee.prototype.serializeToString=function(e,t){return Te.call(e,t)},X.prototype.toString=Te;try{if(Object.defineProperty){function Ie(e){switch(e.nodeType){case N:case O:var t=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&t.push(Ie(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}}Object.defineProperty(V.prototype,"length",{get:function(){return F(this),this.$$length}}),Object.defineProperty(X.prototype,"textContent",{get:function(){return Ie(this)},set:function(e){switch(this.nodeType){case N:case O: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}}}),Object.defineProperty(le.prototype,"children",{get:function(){return new V(this,Re)}}),Object.defineProperty(Q.prototype,"children",{get:function(){return new V(this,Re)}}),Object.defineProperty(be.prototype,"children",{get:function(){return new V(this,Re)}}),Ce=function(e,t,r){e["$$"+t]=r}}}catch(Le){}return wt._updateLiveList=F,wt.Attr=ce,wt.CDATASection=pe,wt.CharacterData=ue,wt.Comment=he,wt.Document=Q,wt.DocumentFragment=be,wt.DocumentType=me,wt.DOMImplementation=G,wt.Element=le,wt.Entity=ge,wt.EntityReference=ve,wt.LiveNodeList=V,wt.NamedNodeMap=q,wt.Node=X,wt.NodeList=B,wt.Notation=fe,wt.Text=de,wt.ProcessingInstruction=ye,wt.XMLSerializer=Ee,wt}var It,Lt={},xt={};function Dt(){return It||(It=1,e=xt,t=yt().freeze,e.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=t({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:""}),e.entityMap=e.HTML_ENTITIES),xt;var e,t}var Ot,Mt,Pt,Ut={};function _t(){if(Ot)return Ut;Ot=1;var e=yt(),t=Ct(),r=kt(),i=e.isHTMLEscapableRawTextElement,n=e.isHTMLMimeType,s=e.isHTMLRawTextElement,a=e.hasOwn,o=e.NAMESPACE,l=r.ParseError,c=r.DOMException;function u(){}u.prototype={parse:function(r,i,s){var o=this.domBuilder;o.startDocument(),g(i,i=Object.create(null)),function(r,i,s,o,u){var g=n(o.mimeType);r.indexOf(t.UNICODE_REPLACEMENT_CHARACTER)>=0&&u.warning("Unicode replacement character detected, source encoding issues?");function v(e){if(e>65535){var t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}function T(e){var r=";"===e[e.length-1]?e:e+";";if(!g&&r!==e)return u.error("EntityRef: expecting ;"),e;var i=t.Reference.exec(r);if(!i||i[0].length!==r.length)return u.error("entity not matching Reference production: "+e),e;var n=r.slice(1,-1);return a(s,n)?s[n]:"#"===n.charAt(0)?v(parseInt(n.substring(1).replace("x","0x"))):(u.error("entity not found:"+e),e)}function k(e){if(e>L){var t=r.substring(L,e).replace(d,T);S&&C(L),o.characters(t,0,e-L),L=e}}var N=0,A=0,w=/\r\n?|\n|$/g,S=o.locator;function C(e,t){for(;e>=A&&(t=w.exec(r));)N=A,A=t.index+t[0].length,S.lineNumber++;S.columnNumber=e-N+1}var R=[{currentNSMap:i}],I=[],L=0;for(;;){try{var x=r.indexOf("<",L);if(x<0){if(!g&&I.length>0)return u.fatalError("unclosed xml tag(s): "+I.join(", "));if(!r.substring(L).match(/^\s*$/)){var D=o.doc,O=D.createTextNode(r.substring(L));if(D.documentElement)return u.error("Extra content at the end of the document");D.appendChild(O),o.currentElement=O}return}if(x>L){var M=r.substring(L,x);g||0!==I.length||(M=M.replace(new RegExp(t.S_OPT.source,"g"),""))&&u.error("Unexpected content outside root element: '"+M+"'"),k(x)}switch(r.charAt(x+1)){case"/":var P=r.indexOf(">",x+2),U=r.substring(x+2,P>0?P:void 0);if(!U)return u.fatalError("end tag name missing");var _=P>0&&t.reg("^",t.QName_group,t.S_OPT,"$").exec(U);if(!_)return u.fatalError('end tag name contains invalid characters: "'+U+'"');if(!o.currentElement&&!o.doc.documentElement)return;var B=I[I.length-1]||o.currentElement.tagName||o.doc.documentElement.tagName||"";if(B!==_[1]){var V=_[1].toLowerCase();if(!g||B.toLowerCase()!==V)return u.fatalError('Opening and ending tag mismatch: "'+B+'" != "'+U+'"')}var F=R.pop();I.pop();var q=F.localNSMap;if(o.endElement(F.uri,F.localName,B),q)for(var j in q)a(q,j)&&o.endPrefixMapping(j);P++;break;case"?":S&&C(x),P=y(r,x,o,u);break;case"!":S&&C(x),P=b(r,x,o,u,g);break;default:S&&C(x);var H=new E,W=R[R.length-1].currentNSMap,G=(P=p(r,x,H,W,T,u,g),H.length);if(H.closed||(g&&e.isHTMLVoidElement(H.tagName)?H.closed=!0:I.push(H.tagName)),S&&G){for(var X=h(S,{}),z=0;z<G;z++){var Y=H[z];C(Y.offset),Y.locator=h(S,{})}o.locator=X,m(H,o,W)&&R.push(H),o.locator=S}else m(H,o,W)&&R.push(H);g&&!H.closed?P=f(r,P,H.tagName,T,o):P++}}catch(e){if(e instanceof l)throw e;if(e instanceof c)throw new l(e.name+": "+e.message,o.locator,e);u.error("element parse error: "+e),P=-1}P>L?L=P:k(Math.max(x,L)+1)}}(r,i,s,o,this.errorHandler),o.endDocument()}};var d=/&#?\w+;?/g;function h(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function p(e,t,r,i,n,s,o){function l(e,t,i){return a(r.attributeNames,e)?s.fatalError("Attribute "+e+" redefined"):!o&&t.indexOf("<")>=0?s.fatalError("Unescaped '<' not allowed in attributes values"):void r.addValue(e,t.replace(/[\t\n\r]/g," ").replace(d,n),i)}for(var c,u=++t,h=0;;){var p=e.charAt(u);switch(p){case"=":if(1===h)c=e.slice(t,u),h=3;else{if(2!==h)throw new Error("attribute equal must after attrName");h=3}break;case"'":case'"':if(3===h||1===h){if(1===h&&(s.warning('attribute value must after "="'),c=e.slice(t,u)),t=u+1,!((u=e.indexOf(p,t))>0))throw new Error("attribute value no end '"+p+"' match");l(c,m=e.slice(t,u),t-1),h=5}else{if(4!=h)throw new Error('attribute value must after "="');l(c,m=e.slice(t,u),t),s.warning('attribute "'+c+'" missed start quot('+p+")!!"),t=u+1,h=5}break;case"/":switch(h){case 0:r.setTagName(e.slice(t,u));case 5:case 6:case 7:h=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 s.error("unexpected end of input"),0==h&&r.setTagName(e.slice(t,u)),u;case">":switch(h){case 0:r.setTagName(e.slice(t,u));case 5:case 6:case 7:break;case 4:case 1:"/"===(m=e.slice(t,u)).slice(-1)&&(r.closed=!0,m=m.slice(0,-1));case 2:2===h&&(m=c),4==h?(s.warning('attribute "'+m+'" missed quot(")!'),l(c,m,t)):(o||s.warning('attribute "'+m+'" missed value!! "'+m+'" instead!!'),l(m,m,t));break;case 3:if(!o)return s.fatalError("AttValue: ' or \" expected")}return u;case"":p=" ";default:if(p<=" ")switch(h){case 0:r.setTagName(e.slice(t,u)),h=6;break;case 1:c=e.slice(t,u),h=2;break;case 4:var m=e.slice(t,u);s.warning('attribute "'+m+'" missed quot(")!!'),l(c,m,t);case 5:h=6}else switch(h){case 2:o||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=u,h=1;break;case 5:s.warning('attribute space is required"'+c+'"!!');case 6:h=1,t=u;break;case 3:h=4,t=u;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function m(e,t,r){for(var i=e.tagName,n=null,s=e.length;s--;){var l=e[s],c=l.qName,u=l.value;if((m=c.indexOf(":"))>0)var d=l.prefix=c.slice(0,m),h=c.slice(m+1),p="xmlns"===d&&h;else h=c,d=null,p="xmlns"===c&&"";l.localName=h,!1!==p&&(null==n&&(n=Object.create(null),g(r,r=Object.create(null))),r[p]=n[p]=u,l.uri=o.XMLNS,t.startPrefixMapping(p,u))}for(s=e.length;s--;)(l=e[s]).prefix&&("xml"===l.prefix&&(l.uri=o.XML),"xmlns"!==l.prefix&&(l.uri=r[l.prefix]));var m;(m=i.indexOf(":"))>0?(d=e.prefix=i.slice(0,m),h=e.localName=i.slice(m+1)):(d=null,h=e.localName=i);var f=e.uri=r[d||""];if(t.startElement(f,h,i,e),!e.closed)return e.currentNSMap=r,e.localNSMap=n,!0;if(t.endElement(f,h,i),n)for(d in n)a(n,d)&&t.endPrefixMapping(d)}function f(e,t,r,n,a){var o=i(r);if(o||s(r)){var l=e.indexOf("</"+r+">",t),c=e.substring(t+1,l);return o&&(c=c.replace(d,n)),a.characters(c,0,c.length),l}return t+1}function g(e,t){for(var r in e)a(e,r)&&(t[r]=e[r])}function v(e,r){var i=r;function n(t){return t=t||0,e.charAt(i+t)}function s(e){i+=e=e||1}function a(){return e.substring(i)}return{char:n,getIndex:function(){return i},getMatch:function(e){var r=t.reg("^",e).exec(a());return r?(s(r[0].length),r[0]):null},getSource:function(){return e},skip:s,skipBlanks:function(){for(var t=0;i<e.length;){var r=n();if(" "!==r&&"\n"!==r&&"\t"!==r&&"\r"!==r)return t;t++,s()}return-1},substringFromIndex:a,substringStartsWith:function(t){return e.substring(i,i+t.length)===t},substringStartsWithCaseInsensitive:function(t){return e.substring(i,i+t.length).toUpperCase()===t.toUpperCase()}}}function b(e,r,i,n,s){var a=v(e,r);switch(s?a.char(2).toUpperCase():a.char(2)){case"-":var o=a.getMatch(t.Comment);return o?(i.comment(o,t.COMMENT_START.length,o.length-t.COMMENT_START.length-t.COMMENT_END.length),a.getIndex()):n.fatalError("comment is not well-formed at position "+a.getIndex());case"[":var l=a.getMatch(t.CDSect);return l?s||i.currentElement?(i.startCDATA(),i.characters(l,t.CDATA_START.length,l.length-t.CDATA_START.length-t.CDATA_END.length),i.endCDATA(),a.getIndex()):n.fatalError("CDATA outside of element"):n.fatalError("Invalid CDATA starting at position "+r);case"D":if(i.doc&&i.doc.documentElement)return n.fatalError("Doctype not allowed inside or after documentElement at position "+a.getIndex());if(s?!a.substringStartsWithCaseInsensitive(t.DOCTYPE_DECL_START):!a.substringStartsWith(t.DOCTYPE_DECL_START))return n.fatalError("Expected "+t.DOCTYPE_DECL_START+" at position "+a.getIndex());if(a.skip(t.DOCTYPE_DECL_START.length),a.skipBlanks()<1)return n.fatalError("Expected whitespace after "+t.DOCTYPE_DECL_START+" at position "+a.getIndex());var c={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(c.name=a.getMatch(t.Name),!c.name)return n.fatalError("doctype name missing or contains unexpected characters at position "+a.getIndex());if(s&&"html"!==c.name.toLowerCase()&&n.warning("Unexpected DOCTYPE in HTML document at position "+a.getIndex()),a.skipBlanks(),a.substringStartsWith(t.PUBLIC)||a.substringStartsWith(t.SYSTEM)){var u=t.ExternalID_match.exec(a.substringFromIndex());if(!u)return n.fatalError("doctype external id is not well-formed at position "+a.getIndex());void 0!==u.groups.SystemLiteralOnly?c.systemId=u.groups.SystemLiteralOnly:(c.systemId=u.groups.SystemLiteral,c.publicId=u.groups.PubidLiteral),a.skip(u[0].length)}else if(s&&a.substringStartsWithCaseInsensitive(t.SYSTEM)){if(a.skip(t.SYSTEM.length),a.skipBlanks()<1)return n.fatalError("Expected whitespace after "+t.SYSTEM+" at position "+a.getIndex());if(c.systemId=a.getMatch(t.ABOUT_LEGACY_COMPAT_SystemLiteral),!c.systemId)return n.fatalError("Expected "+t.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+t.SYSTEM+" at position "+a.getIndex())}return s&&c.systemId&&!t.ABOUT_LEGACY_COMPAT_SystemLiteral.test(c.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+a.getIndex()),s||(a.skipBlanks(),c.internalSubset=function(e,r){function i(e,r){var i=t.PI.exec(e.substringFromIndex());return i?"xml"===i[1].toLowerCase()?r.fatalError("xml declaration is only allowed at the start of the document, but found at position "+e.getIndex()):(e.skip(i[0].length),i[0]):r.fatalError("processing instruction is not well-formed at position "+e.getIndex())}var n=e.getSource();if("["===e.char()){e.skip(1);for(var s=e.getIndex();e.getIndex()<n.length;){if(e.skipBlanks(),"]"===e.char()){var a=n.substring(s,e.getIndex());return e.skip(1),a}var o=null;if("<"===e.char()&&"!"===e.char(1))switch(e.char(2)){case"E":"L"===e.char(3)?o=e.getMatch(t.elementdecl):"N"===e.char(3)&&(o=e.getMatch(t.EntityDecl));break;case"A":o=e.getMatch(t.AttlistDecl);break;case"N":o=e.getMatch(t.NotationDecl);break;case"-":o=e.getMatch(t.Comment)}else if("<"===e.char()&&"?"===e.char(1))o=i(e,r);else{if("%"!==e.char())return r.fatalError("Error detected in Markup declaration");o=e.getMatch(t.PEReference)}if(!o)return r.fatalError("Error in internal subset at position "+e.getIndex())}return r.fatalError("doctype internal subset is not well-formed, missing ]")}}(a,n)),a.skipBlanks(),">"!==a.char()?n.fatalError("doctype not terminated with > at position "+a.getIndex()):(a.skip(1),i.startDTD(c.name,c.publicId,c.systemId,c.internalSubset),i.endDTD(),a.getIndex());default:return n.fatalError('Not well-formed XML starting with "<!" at position '+r)}}function y(e,r,i,n){var s=e.substring(r).match(t.PI);if(!s)return n.fatalError("Invalid processing instruction starting at position "+r);if("xml"===s[1].toLowerCase()){if(r>0)return n.fatalError("processing instruction at position "+r+" is an xml declaration which is only at the start of the document");if(!t.XMLDecl.test(e.substring(r)))return n.fatalError("xml declaration is not well-formed")}return i.processingInstruction(s[1],s[2]),r+s[0].length}function E(){this.attributeNames=Object.create(null)}return E.prototype={setTagName:function(e){if(!t.QName_exact.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,r,i){if(!t.QName_exact.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:r,offset:i}},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}},Ut.XMLReader=u,Ut.parseUtils=v,Ut.parseDoctypeCommentOrCData=b,Ut}function Bt(){if(Mt)return Lt;Mt=1;var e=yt(),t=Rt(),r=kt(),i=Dt(),n=_t(),s=t.DOMImplementation,a=e.hasDefaultHTMLNamespace,o=e.isHTMLMimeType,l=e.isValidMimeType,c=e.MIME_TYPE,u=e.NAMESPACE,d=r.ParseError,h=n.XMLReader;function p(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028\u2029]/g,"\n")}function m(t){if(void 0===(t=t||{}).locator&&(t.locator=!0),this.assign=t.assign||e.assign,this.domHandler=t.domHandler||f,this.onError=t.onError||t.errorHandler,t.errorHandler&&"function"!=typeof t.errorHandler)throw new TypeError("errorHandler object is no longer supported, switch to onError!");t.errorHandler&&t.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=t.normalizeLineEndings||p,this.locator=!!t.locator,this.xmlns=this.assign(Object.create(null),t.xmlns)}function f(e){var t=e||{};this.mimeType=t.mimeType||c.XML_APPLICATION,this.defaultNamespace=t.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=t.onError}function g(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function v(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 b(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}return m.prototype.parseFromString=function(t,r){if(!l(r))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+r+'" is not valid.');var n=this.assign(Object.create(null),this.xmlns),s=i.XML_ENTITIES,o=n[""]||null;a(r)?(s=i.HTML_ENTITIES,o=u.HTML):r===c.XML_SVG_IMAGE&&(o=u.SVG),n[""]=o,n.xml=n.xml||u.XML;var d=new this.domHandler({mimeType:r,defaultNamespace:o,onError:this.onError}),p=this.locator?{}:void 0;this.locator&&d.setDocumentLocator(p);var m=new h;return m.errorHandler=d,m.domBuilder=d,!e.isHTMLMimeType(r)&&"string"!=typeof t&&m.errorHandler.fatalError("source is not a string"),m.parse(this.normalizeLineEndings(String(t)),n,s),d.doc.documentElement||m.errorHandler.fatalError("missing root element"),d.doc},f.prototype={startDocument:function(){var e=new s;this.doc=o(this.mimeType)?e.createHTMLDocument(!1):e.createDocument(this.defaultNamespace,"")},startElement:function(e,t,r,i){var n=this.doc,s=n.createElementNS(e,r||t),a=i.length;b(this,s),this.currentElement=s,this.locator&&g(this.locator,s);for(var o=0;o<a;o++){e=i.getURI(o);var l=i.getValue(o),c=(r=i.getQName(o),n.createAttributeNS(e,r));this.locator&&g(i.getLocator(o),c),c.value=c.nodeValue=l,s.setAttributeNode(c)}},endElement:function(e,t,r){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&g(this.locator,r),b(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=v.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&&g(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){e&&(e.lineNumber=0),this.locator=e},comment:function(e,t,r){e=v.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&g(this.locator,i),b(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(e,t,r,i);this.locator&&g(this.locator,s),b(this,s),this.doc.doctype=s}},reportError:function(e,t){if("function"==typeof this.onError)try{this.onError(e,t,this)}catch(r){throw new d("Reporting "+e+' "'+t+'" caused '+r,this.locator)}else console.error("[xmldom "+e+"]\t"+t,function(e){if(e)return"\n@#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(this.locator))},warning:function(e){this.reportError("warning",e)},error:function(e){this.reportError("error",e)},fatalError:function(e){throw this.reportError("fatalError",e),new d(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){f.prototype[e]=function(){return null}}),Lt.__DOMHandler=f,Lt.DOMParser=m,Lt.normalizeLineEndings=p,Lt.onErrorStopParsing=function(e){if("error"===e)throw"onErrorStopParsing"},Lt.onWarningStopParsing=function(){throw"onWarningStopParsing"},Lt}function Vt(){if(Pt)return vt;Pt=1;var e=yt();vt.assign=e.assign,vt.hasDefaultHTMLNamespace=e.hasDefaultHTMLNamespace,vt.isHTMLMimeType=e.isHTMLMimeType,vt.isValidMimeType=e.isValidMimeType,vt.MIME_TYPE=e.MIME_TYPE,vt.NAMESPACE=e.NAMESPACE;var t=kt();vt.DOMException=t.DOMException,vt.DOMExceptionName=t.DOMExceptionName,vt.ExceptionCode=t.ExceptionCode,vt.ParseError=t.ParseError;var r=Rt();vt.Attr=r.Attr,vt.CDATASection=r.CDATASection,vt.CharacterData=r.CharacterData,vt.Comment=r.Comment,vt.Document=r.Document,vt.DocumentFragment=r.DocumentFragment,vt.DocumentType=r.DocumentType,vt.DOMImplementation=r.DOMImplementation,vt.Element=r.Element,vt.Entity=r.Entity,vt.EntityReference=r.EntityReference,vt.LiveNodeList=r.LiveNodeList,vt.NamedNodeMap=r.NamedNodeMap,vt.Node=r.Node,vt.NodeList=r.NodeList,vt.Notation=r.Notation,vt.ProcessingInstruction=r.ProcessingInstruction,vt.Text=r.Text,vt.XMLSerializer=r.XMLSerializer;var i=Bt();return vt.DOMParser=i.DOMParser,vt.normalizeLineEndings=i.normalizeLineEndings,vt.onErrorStopParsing=i.onErrorStopParsing,vt.onWarningStopParsing=i.onWarningStopParsing,vt}var Ft=Vt(),qt=t({__proto__:null,default:ft(Ft)},[Ft])});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@openplayerjs/core")):"function"==typeof define&&define.amd?define(["@openplayerjs/core"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).OpenPlayerJS)}(this,function(e){"use strict";function t(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)}function r(e){return(new DOMParser).parseFromString(String(e||""),"text/xml")}async function i(e){if("xml"===e.kind){if("string"==typeof e.value)return e.value;try{return(new XMLSerializer).serializeToString(e.value)}catch{return String(e.value)}}const t=await fetch(e.value);if(!t.ok)throw new Error(`VAST request failed: ${t.status}`);return t.text()}function n(e,t){if(!e)return;const r=e.trim();if(!r)return;if(r.endsWith("%")){const e=Number(r.slice(0,-1));return Number.isFinite(e)&&e>=0&&e<=100&&Number.isFinite(t)&&t>0?e/100*t:void 0}const i=function(e){const t=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(String(e).trim());if(!t)return null;const r=Number(t[1]),i=Number(t[2]),n=Number(t[3]);return[r,i,n].every(e=>Number.isFinite(e))?3600*r+60*i+n:null}(r);if(null!=i)return i;const n=Number(r);return Number.isFinite(n)&&n>=0?n:void 0}function s(e,t){if(!Array.isArray(e)||0===e.length)return null;const r=e.map(e=>({type:String(e?.mimeType||e?.type||""),fileURL:String(e?.fileURL||e?.url||e?.src||""),bitrate:Number(e?.bitrate||e?.bitRate||0),width:Number(e?.width||0),height:Number(e?.height||0),raw:e})).filter(e=>Boolean(e.fileURL));if(0===r.length)return null;for(const e of t){const t=r.filter(t=>(t.type||"").toLowerCase()===e.toLowerCase());if(t.length)return t.sort((e,t)=>(t.bitrate||0)-(e.bitrate||0))[0]}return r.sort((e,t)=>(t.bitrate||0)-(e.bitrate||0))[0]}function a(e){const t=e?.linear||e?.Linear||e,r=t?.skipDelay??t?.skipdelay;if("number"==typeof r&&Number.isFinite(r)&&r>=0)return String(r);const i=[t?.skipOffset,t?.skipoffset,t?.attributes?.skipOffset,t?.attributes?.skipoffset,t?.attributes?.skipOffset?.value,t?.attributes?.skipoffset?.value,t?.attributes?.skipOffset?.["#text"],t?.attributes?.skipoffset?.["#text"]];if(t&&"object"==typeof t)for(const e of["skipOffset","skipoffset","skipDelay","skipdelay"])i.push(t[e]),i.push(t?.attributes?.[e]);const n=e=>{if("number"==typeof e&&Number.isFinite(e)&&e>=0)return String(e);if("string"==typeof e){const t=e.trim();return t||void 0}if(e&&"object"==typeof e){const t=e,r=t.value??t["#text"]??t.text;if("string"==typeof r){const e=r.trim();return e||void 0}}};for(const e of i){const t=n(e);if(t)return t}}function o(e,t){const r=[...e?.mediaFiles||e?.MediaFiles||e?.linear?.mediaFiles||e?.linear?.MediaFiles||[],...e?.interactiveCreativeFiles||e?.linear?.interactiveCreativeFiles||e?.linear?.InteractiveCreativeFiles||[e?.interactiveCreativeFile]||[e?.InteractiveCreativeFile]||[]];for(const e of r){if("simid"===String(e?.apiFramework||e?.APIFramework||"").toLowerCase()){const t=String(e?.fileURL||e?.url||e?.src||"").trim();if(t)return t}}if(t)for(const e of["InteractiveCreativeFile","MediaFile"]){const r=Array.from(t.getElementsByTagName(e));for(const e of r){if("simid"===(e.getAttribute("apiFramework")||"").toLowerCase()){const t=(e.textContent||"").trim();if(t)return t}}}}function l(e){const t=e?.ads||e?.vastResponse?.ads;if(Array.isArray(t)&&t.length)return t;const r=e?.adPods||e?.vastResponse?.adPods||e?.vastResponse?.adpods;if(Array.isArray(r)&&r.length){const e=[];for(const t of r){const r=t?.ads||t?.Ads;Array.isArray(r)&&e.push(...r)}if(e.length)return e}const i=e?.adPod||e?.vastResponse?.adPod||e?.vastResponse?.adpod,n=i?.ads||i?.Ads;return Array.isArray(n)&&n.length?n:[]}function c(e,t){const r=l(e),i=[];for(const e of r){const r=e?.creatives||e?.Creatives||[],n=e?.sequence||e?.attributes?.sequence||void 0,o=null!=n?Number(n):void 0;for(let n=0;n<r.length;n++){const l=r[n],c=s(l?.mediaFiles||l?.MediaFiles||l?.linear?.mediaFiles||l?.Linear?.mediaFiles||l?.linear?.MediaFiles||l?.linear?.mediafiles||[],t);if(!c)continue;const u=a(l),d=l?.companionAds?.companions||l?.companions||void 0,h=l?.nonLinearAds?.nonLinears||l?.nonLinears||void 0;i.push({ad:e,creative:l,mediaFile:c,sequence:Number.isFinite(o)?o:void 0,creativeIndex:n,skipOffset:u,companions:Array.isArray(d)?d:void 0,nonLinears:Array.isArray(h)?h:void 0})}}return i.sort((e,t)=>{const r=e.sequence??Number.MAX_SAFE_INTEGER,i=t.sequence??Number.MAX_SAFE_INTEGER;return r!==i?r-i:(e.creativeIndex??0)-(t.creativeIndex??0)})}function u(e){const t=l(e),r=[];for(const e of t){const t=e?.creatives||e?.Creatives||[];for(const i of t){const t=i?.variations??i?.nonLinearAds?.nonLinears??i?.nonLinearAds?.nonLinear??i?.NonLinearAds?.NonLinear??i?.nonLinears??i?.NonLinears??void 0;if(t===i?.variations&&"nonlinear"!==i?.type)continue;const n=Array.isArray(t)?t:t?[t]:[];if(0===n.length)continue;const s=e?.sequence||e?.attributes?.sequence||void 0,a=null!=s?Number(s):void 0;for(const t of n)r.push({ad:e,creative:i,nonLinear:t,sequence:Number.isFinite(a)?a:void 0})}}return r.sort((e,t)=>null==e.sequence&&null==t.sequence?0:null==e.sequence?1:null==t.sequence?-1:e.sequence-t.sequence)}function d(e){const t=[],r=(e,t)=>{try{if(e.getElementsByTagNameNS){const r=e.getElementsByTagNameNS("*",t),i=Array.from(r);if(i.length)return i}}catch{}try{return Array.from(e.getElementsByTagName(t))}catch{return[]}},i=(e,t)=>{const i=r(e,t);return n=i[0]??null,(n?.textContent||"").trim();var n},n=[];try{const t=r(e,"Companion");for(const e of t){const t=Number(e.getAttribute("width")||0),r=Number(e.getAttribute("height")||0),s=i(e,"StaticResource"),a=i(e,"CompanionClickThrough");s&&n.push({width:t||void 0,height:r||void 0,staticResource:{value:s},clickThrough:a||void 0})}}catch{}const s=r(e,"NonLinear");for(const e of s){const r=Number(e.getAttribute("width")||0),s=Number(e.getAttribute("height")||0),a=e.getAttribute("minSuggestedDuration")||void 0,o=i(e,"StaticResource"),l=i(e,"IFrameResource"),c=i(e,"HTMLResource"),u={width:r||void 0,height:s||void 0,minSuggestedDuration:a,staticResource:o?{value:o}:void 0,iFrameResource:l?{value:l}:void 0,htmlResource:c?{value:c}:void 0,nonLinearClickThrough:i(e,"NonLinearClickThrough")||void 0};t.push({nonLinear:u,companions:n.length?n:void 0})}return t}function h(e){const t=function(e){if(!e)return[];const t=e.closedCaptionFiles??e.ClosedCaptionFiles??e.closedCaptionFile??e.ClosedCaptionFile??null;return(Array.isArray(t)?t:Array.isArray(t?.closedCaptionFiles)?t.closedCaptionFiles:Array.isArray(t?.ClosedCaptionFile)?t.ClosedCaptionFile:Array.isArray(t?.closedCaptionFile)?t.closedCaptionFile:[]).map(e=>({type:e?.type??e?.mimeType??e?.mime_type,language:e?.language??e?.lang,fileURL:e?.fileURL??e?.url??e?.src})).filter(e=>"string"==typeof e.fileURL&&e.fileURL.length>0)}(e);return t.map((e,t)=>{const r=e.language?String(e.language):"",i=e.type?String(e.type):"";return{src:String(e.fileURL),kind:"captions",srclang:r||void 0,label:r?r.toUpperCase():`CC ${t+1}`,type:i||void 0}}).filter(e=>!!e.src)}class p{constructor(e,t,r,i,n){Object.defineProperty(this,"overlay",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"cfg",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"getAdVideo",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"getTracker",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"onSkipCallback",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"skipWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipBtn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipOffsetRaw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"skipAtSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"companionWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nonLinearWrap",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedNonLinearContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedCompanionContainer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sessionUnsubs",{enumerable:!0,configurable:!0,writable:!0,value:[]})}addSessionUnsub(e){this.sessionUnsubs.push(e)}clearSession(){for(const e of this.sessionUnsubs)e();this.sessionUnsubs=[],this.clearAdOverlays()}resolveContainer(e,t){if(e&&1===e.nodeType)return e;if(t){const e=document.querySelector(t);if(e instanceof HTMLElement)return e}}getNonLinearContainer(){return this.resolvedNonLinearContainer||(this.resolvedNonLinearContainer=this.resolveContainer(this.cfg.nonLinearContainer,this.cfg.nonLinearSelector)),this.resolvedNonLinearContainer}getCompanionContainer(){return this.resolvedCompanionContainer||(this.resolvedCompanionContainer=this.resolveContainer(this.cfg.companionContainer,this.cfg.companionSelector)),this.resolvedCompanionContainer}resolveMount(e){if(this.cfg.mountEl)return this.cfg.mountEl;if(this.cfg.mountSelector){const e=document.querySelector(this.cfg.mountSelector);if(e)return e}return e.closest(".op-player")||e.parentElement||document.body}ensureOverlayMounted(e){const t=this.resolveMount(e);if(t instanceof HTMLElement){const e=window.getComputedStyle(t);e.position&&"static"!==e.position||(t.style.position="relative")}this.overlay.style.position="absolute",this.overlay.style.inset="0",this.overlay.style.width="100%",this.overlay.style.height="100%",this.overlay.style.zIndex=this.overlay.style.zIndex||"3",this.overlay.style.pointerEvents="auto",this.overlay.parentElement!==t&&t.appendChild(this.overlay)}setSafeHTML(e,t){const r=document.createElement("template");r.innerHTML=String(t||"");const i=new Set(["SCRIPT","IFRAME","OBJECT","EMBED","LINK","STYLE","SVG","MATH","FORM","INPUT","TEXTAREA","SELECT","OPTION","META","BASE"]),n=document.createTreeWalker(r.content,NodeFilter.SHOW_ELEMENT),s=[];for(;n.nextNode();){const e=n.currentNode;i.has(e.tagName)?s.push(e):Array.from(e.attributes).forEach(t=>{const r=t.name.toLowerCase(),i=(t.value||"").trim();if(r.startsWith("on")&&e.removeAttribute(t.name),"href"===r||"src"===r||"xlink:href"===r){const r=i.toLowerCase(),n=r.startsWith("javascript:"),s=r.startsWith("vbscript:"),a=r.startsWith("data:"),o=r.startsWith("http://")||r.startsWith("https://")||r.startsWith("/")||r.startsWith("./"),l=a&&/^data:image\/(png|gif|jpe?g|webp|svg\+xml);/i.test(i);(n||s||!o&&!l)&&e.removeAttribute(t.name)}"srcdoc"===r&&e.removeAttribute(t.name)})}s.forEach(e=>e.remove()),e.replaceChildren(r.content.cloneNode(!0))}safeWindowOpen(e){try{const t=new URL(e,window.location.href);if("http:"!==t.protocol&&"https:"!==t.protocol)return;window.open(t.toString(),"_blank","noopener,noreferrer")}catch{}}ensureSkipDom(){if(this.skipWrap&&this.skipBtn)return;const t=document.createElement("div");t.className="op-ads__skip";const r=document.createElement("button");r.type="button",r.className="op-ads__skip-btn",r.textContent=this.cfg.labels?.skip||"Skip Ad",t.appendChild(r),this.overlay.appendChild(t);const i=e=>{this.onSkipCallback(),e.preventDefault(),e.stopPropagation()};r.addEventListener("click",i,e.EVENT_OPTIONS),this.skipWrap=t,this.skipBtn=r,this.sessionUnsubs.push(()=>r.removeEventListener("click",i)),this.sessionUnsubs.push(()=>t.remove())}hideSkipUi(){this.skipWrap&&(this.skipWrap.style.display="none"),this.skipOffsetRaw=void 0,this.skipAtSeconds=void 0}setupSkipUIForPodItem(e,t){this.hideSkipUi();const r=this.getAdVideo();if(!r)return;const i=e.skipOffset??a(e.creative);if(!i)return void t("creative not skippable (no skipOffset/skipDelay)",{sequence:e.sequence});t("creative skippable",i),this.skipOffsetRaw=i,this.ensureSkipDom();const s=()=>{const e=r.duration,t=n(i,e);if(null==t)return;this.skipAtSeconds=t;const s=r.currentTime||0,a=Math.max(0,t-s);this.skipWrap&&(this.skipWrap.style.display="block"),this.skipBtn&&(this.skipBtn.textContent=a<=.05?this.cfg.labels?.skip||"Skip Ad":Math.ceil(a).toString(),this.skipBtn.style.pointerEvents=a<=.05?"auto":"none")};r.addEventListener("timeupdate",s),r.addEventListener("loadedmetadata",s),s(),this.sessionUnsubs.push(()=>r.removeEventListener("timeupdate",s)),this.sessionUnsubs.push(()=>r.removeEventListener("loadedmetadata",s))}requestSkip(e,t,r,i,n){if(this.skipOffsetRaw&&null!=this.skipAtSeconds&&t){const r=t.currentTime||0;if(r+.01<this.skipAtSeconds)return void n("skip requested too early",{cur:r,skipAt:this.skipAtSeconds,reason:e})}try{this.getTracker()?.trackSkip?.()}catch{}i({break:r?{kind:r.kind,id:r.breakId}:null,reason:e});const s=t;if(s)try{Number.isFinite(s.duration)&&s.duration>0&&(s.currentTime=Math.max(0,s.duration-.001)),s.dispatchEvent(new Event("ended"))}catch{}}clearAdOverlays(){this.hideSkipUi(),this.skipWrap?.remove(),this.skipWrap=void 0,this.skipBtn=void 0,this.companionWrap?.remove(),this.nonLinearWrap?.remove(),this.companionWrap=void 0,this.nonLinearWrap=void 0}mountCompanions(e){const t=this.getCompanionContainer();if(!t)return;const r=("companion"===e?.type?e?.variations:void 0)||e?.companionAds?.companions||e?.companions;if(!Array.isArray(r)||0===r.length)return;const i=document.createElement("div");i.className="op-ads__companions",i.style.zIndex="2",i.style.display="flex",i.style.flexDirection="column",i.style.gap="8px",i.style.maxWidth="40%",i.style.pointerEvents="auto";for(const e of r){const t=this.renderCompanion(e);t&&i.appendChild(t)}i.childElementCount&&(t.appendChild(i),this.companionWrap=i,this.sessionUnsubs.push(()=>i.remove()))}renderCompanion(e){const t=e?.companionClickThroughURLTemplate||e?.clickThroughURLTemplate||e?.companionClickThrough||e?.clickThrough,r=document.createElement("div");r.className="op-ads__companion",r.style.position="relative",r.style.cursor=t?"pointer":"default";const i=e?.staticResource||e?.StaticResource||e?.staticResources?.[0]||e?.StaticResources?.[0],n=e?.iFrameResource||e?.IFrameResource||e?.iFrameResources?.[0]||e?.IFrameResources?.[0],s=e?.htmlResource||e?.HTMLResource||e?.htmlResources?.[0]||e?.HTMLResources?.[0];let a=null;if(i){const e=document.createElement("img");e.src=String(i?.url||i?.uri||i?.value||i),e.style.maxWidth="100%",e.style.height="auto",a=e}else if(n){const e=document.createElement("iframe");e.src=String(n?.url||n?.uri||n?.value||n),e.style.border="0",e.style.width="100%",e.style.height="100%",a=e}else if(s){const e=document.createElement("div");this.setSafeHTML(e,String(s?.value||s)),a=e}if(!a)return null;if(r.appendChild(a),t){const e=e=>{const r="string"==typeof t?t:t.url;this.safeWindowOpen(r);try{this.getTracker()?.trackClick?.(),this.getTracker()?.trackClickThrough?.()}catch{}e.preventDefault(),e.stopPropagation()};r.addEventListener("click",e),this.sessionUnsubs.push(()=>r.removeEventListener("click",e))}return r}nonLinearSuggestedDurationSeconds(e){const t=e?.minSuggestedDuration??e?.minSuggestedDurationSeconds??e?.attributes?.minSuggestedDuration??void 0;if("number"==typeof t&&Number.isFinite(t)&&t>0)return t;if("string"==typeof t){const e=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(t.trim());if(e){const t=3600*Number(e[1])+60*Number(e[2])+Number(e[3]);if(Number.isFinite(t)&&t>0)return t}const r=Number(t);if(Number.isFinite(r)&&r>0)return r}return 10}ensureNonLinearDom(){if(this.nonLinearWrap)return;const e=document.createElement("div");e.className="op-ads__nonlinear",e.style.position="absolute",e.style.left="12px",e.style.right="12px",e.style.bottom="12px",e.style.zIndex="2",e.style.display="flex",e.style.justifyContent="center",e.style.pointerEvents="auto";(this.getNonLinearContainer()||this.getAdVideo()?.parentElement||this.overlay).appendChild(e),this.nonLinearWrap=e,this.sessionUnsubs.push(()=>e.remove())}renderNonLinear(e){const t=e?.nonlinearClickThroughURLTemplate||e?.nonLinearClickThroughURLTemplate||e?.clickThroughURLTemplate||e?.nonLinearClickThrough||e?.clickThrough,r=document.createElement("div");r.className="op-ads__nonlinear-item",r.style.position="relative",r.style.maxWidth="100%",r.style.cursor=t?"pointer":"default";const i=e=>Array.isArray(e)?e[0]:e,n=i(e?.staticResource??e?.StaticResource??e?.staticResources??e?.StaticResources),s=i(e?.iFrameResource??e?.IFrameResource??e?.iFrameResources??e?.IFrameResources),a=i(e?.htmlResource??e?.HTMLResource??e?.htmlResources??e?.HTMLResources);let o=null;if(n){const e=document.createElement("img");e.src=String(n?.url||n?.uri||n?.value||n),e.style.maxWidth="100%",e.style.height="auto",o=e}else if(s){const e=document.createElement("iframe");e.src=String(s?.url||s?.uri||s?.value||s),e.style.border="0",e.style.width="100%",e.style.height="100%",o=e}else if(a){const e=document.createElement("div");this.setSafeHTML(e,String(a?.value||a)),o=e}if(!o)return null;if(r.appendChild(o),t){const e=e=>{if("BUTTON"===e.target?.tagName)return;const r="string"==typeof t?t:t.url;this.safeWindowOpen(r);try{this.getTracker()?.trackClick?.(),this.getTracker()?.trackClickThrough?.()}catch{}e.preventDefault(),e.stopPropagation()};r.addEventListener("click",e),this.sessionUnsubs.push(()=>r.removeEventListener("click",e))}return r}mountNonLinear(e){const t=("nonlinear"===e?.type?e?.variations:void 0)??e?.nonLinearAds?.nonLinears??e?.nonLinearAds?.nonLinear??e?.NonLinearAds?.NonLinear??e?.nonLinears??e?.NonLinears??void 0,r=Array.isArray(t)?t:t?[t]:[];if(0!==r.length){this.ensureNonLinearDom();for(const e of r){const t=this.renderNonLinear(e);t&&this.nonLinearWrap.appendChild(t)}}}mountSimidIframe(e){let t=this.overlay.querySelector(".op-ads__simid");t?t.innerHTML="":(t=document.createElement("div"),t.className="op-ads__simid",t.style.position="absolute",t.style.inset="0",t.style.pointerEvents="auto",this.overlay.appendChild(t));const r=document.createElement("iframe");return r.src=e,r.setAttribute("title","SIMID"),r.setAttribute("loading","lazy"),r.setAttribute("referrerpolicy","no-referrer"),r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-popups"),r.style.width="100%",r.style.height="100%",r.style.border="0",t.appendChild(r),r}}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var g=f(function e(t){for(var r in m(this,e),this.id=t.getAttribute("id"),this.allowMultipleAds=t.getAttribute("allowMultipleAds"),this.followRedirects=t.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null,t.childNodes){var i=t.childNodes[r];switch(i.localName){case"AdTagURI":this.adTagURI={templateType:i.getAttribute("templateType"),uri:(i.textContent||i.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=i.firstChild;this.vastAdData&&1!==this.vastAdData.nodeType;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=i}}});function v(e,t){var r=[];for(var i in e.childNodes){var n=e.childNodes[i];n.nodeName!==t&&t!=="vmap:".concat(n.nodeName)&&n.nodeName!=="vmap:".concat(t)||r.push(n)}return r}function b(e){var t={attributes:{},children:{},value:{}};t.value=function(e){if(!e||!e.childNodes)return{};var t=e.childNodes,r=[];for(var i in t){var n=t[i];"#cdata-section"===n.nodeName&&r.push(n)}if(r&&r.length>0)try{return JSON.parse(r[0].data)}catch(e){}var s="";for(var a in t){var o=t[a];switch(o.nodeName){case"#text":s+=o.textContent.trim();break;case"#cdata-section":s+=o.data}}return s}(e);var r=e.attributes;if(r)for(var i in r){var n=r[i];n.nodeName&&void 0!==n.nodeValue&&null!==n.nodeValue&&(t.attributes[n.nodeName]=n.nodeValue)}var s=e.childNodes;if(s)for(var a in s){var o=s[a];o.nodeName&&"#"!==o.nodeName.substring(0,1)&&(t.children[o.nodeName]=b(o))}return t}var y=function(){function e(t){for(var r in m(this,e),this.timeOffset=t.getAttribute("timeOffset"),this.breakType=t.getAttribute("breakType"),this.breakId=t.getAttribute("breakId"),this.repeatAfter=t.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[],t.childNodes){var i=t.childNodes[r];switch(i.localName){case"AdSource":this.adSource=new g(i);break;case"TrackingEvents":for(var n in i.childNodes){var s=i.childNodes[n];"Tracking"===s.localName&&this.trackingEvents.push({event:s.getAttribute("event"),uri:(s.textContent||s.text||"").trim()})}break;case"Extensions":this.extensions=v(i,"Extension").map(function(e){return b(e)})}}}return f(e,[{key:"track",value:function(e,t){for(var r in this.trackingEvents){var i=this.trackingEvents[r];if(i.event===e){var n=i.uri;"error"===i.event&&(n=n.replace("[ERRORCODE]",t)),this.tracker(n)}}}},{key:"tracker",value:function(e){"undefined"!=typeof window&&null!==window&&((new Image).src=e)}}]),e}(),E=f(function e(t){if(m(this,e),!t||!t.documentElement||"VMAP"!==t.documentElement.localName)throw new Error("Not a VMAP document");for(var r in this.version=t.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[],t.documentElement.childNodes){var i=t.documentElement.childNodes[r];switch(i.localName){case"AdBreak":this.adBreaks.push(new y(i));break;case"Extensions":this.extensions=v(i,"Extension").map(function(e){return b(e)})}}});function T(e){const t=e=>e.trim().startsWith("<");if(e.source&&"string"==typeof e.source.src&&e.source.src.trim()){const r=e.source.src.trim(),i=e.source.type;return t(r)?{input:{kind:"xml",value:r},sourceType:i}:{input:{kind:"url",value:r},sourceType:i}}const r=Array.isArray(e.sources)?e.sources[0]:void 0;if(r&&"string"==typeof r.src&&r.src.trim()){const e=r.src.trim(),i=r.type;return t(e)?{input:{kind:"xml",value:e},sourceType:i}:{input:{kind:"url",value:e},sourceType:i}}return{input:void 0,sourceType:void 0}}function k(e){if(e.id)return e.id;const{input:t,sourceType:r}=T(e),i="url"===t?.kind?t.value:"xml";return`${String(e.at)}:${r||"VAST"}:${i}`}class A{constructor(e,t,r,i){Object.defineProperty(this,"cfg",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"warn",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"onVmapError",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"resolvedBreaks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"pendingPercentBreaks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"playedBreaks",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"vmapPending",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"vmapLoadPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"pendingVmapSrc",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}isXmlString(e){return e.trim().startsWith("<")}getSource(e){return(this.cfg.sources||[]).find(t=>t.type===e&&"string"==typeof t.src&&t.src.trim())}getPrimaryVastLikeSource(){return this.getSource("VAST")||this.getSource("NONLINEAR")}inferSourceTypeForUrl(e){const t=this.cfg.sources||[],r=t.find(t=>t.src===e);return"NONLINEAR"===r?.type||t.length>0&&t.every(e=>"NONLINEAR"===e.type)?"NONLINEAR":void 0}getVastInputFromBreak(e){if(e.source&&"string"==typeof e.source.src&&e.source.src.trim()){const t=e.source.src.trim(),r=e.source.type;return this.isXmlString(t)?{input:{kind:"xml",value:t},sourceType:r}:{input:{kind:"url",value:t},sourceType:r}}const t=Array.isArray(e.sources)?e.sources[0]:void 0;if(t&&"string"==typeof t.src&&t.src.trim()){const e=t.src.trim(),r=t.type;return this.isXmlString(e)?{input:{kind:"xml",value:e},sourceType:r}:{input:{kind:"url",value:e},sourceType:r}}return{input:void 0,sourceType:void 0}}getBreakId(e){if(e.id)return e.id;const{input:t,sourceType:r}=this.getVastInputFromBreak(e),i="url"===t?.kind?t.value:"xml";return`${String(e.at)}:${r||"VAST"}:${i}`}getPrerollBreak(){for(const e of this.resolvedBreaks){if("preroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!1===e.once||!this.playedBreaks.has(t))return e}for(const e of this.cfg.breaks){if("preroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!1===e.once||!this.playedBreaks.has(t))return e}const e=this.cfg.breaks.some(e=>"preroll"===e.at);if(!e){const e=this.getPrimaryVastLikeSource();if(e?.src){const t={at:"preroll",source:{type:e.type,src:e.src},once:!0},r=this.getBreakId(t);if(!this.playedBreaks.has(r))return t}}}getPostrollBreak(){for(const e of this.resolvedBreaks){if("postroll"!==e.at)continue;if(!this.getVastInputFromBreak(e).input)continue;const t=this.getBreakId(e);if(!1===e.once||!this.playedBreaks.has(t))return e}}getDueMidrollBreaks(e){const t=this.ctx.core.media;if(Number.isFinite(t.duration)&&t.duration>0&&this.pendingPercentBreaks.length){const e=t.duration,r=[];for(const t of this.pendingPercentBreaks){const i=e*t.percent;r.push({id:t.id,at:i,once:t.once,source:t.source})}this.pendingPercentBreaks=[],this.resolvedBreaks.push(...r)}const r=[];for(const t of this.resolvedBreaks){if("number"!=typeof t.at)continue;if(!this.getVastInputFromBreak(t).input)continue;const i=this.getBreakId(t);!1!==t.once&&this.playedBreaks.has(i)||e+(this.cfg.breakTolerance??.25)>=t.at&&r.push(t)}return r.sort((e,t)=>e.at-t.at),r}getDueMidrollBreak(e){return this.getDueMidrollBreaks(e)[0]}rebuild(){const e=[...this.cfg.breaks||[]];if(0===e.length){const t=this.cfg.sources.filter(e=>("VAST"===e.type||"NONLINEAR"===e.type)&&e.src?.trim());if(t.length>0)if("playlist"===this.cfg.adSourcesMode)for(const r of t)e.push({at:"preroll",source:{type:r.type,src:r.src},once:!0});else t.length>1?e.push({at:"preroll",source:t[0],sources:t,once:!0}):e.push({at:"preroll",source:t[0],once:!0})}const t=this.getSource("VMAP");if(t?.src){const r=this.ctx?.core?.media;"none"===(r?(r.getAttribute("preload")||r.preload||"").toLowerCase():"")?this.pendingVmapSrc=t.src:(this.vmapPending=!0,this.vmapLoadPromise=this.loadVmapAndMerge(e,t.src))}this.resolvedBreaks=e}normalizeVmapAdSource(e){if(e)return Array.isArray(e)?e.find(e=>e?.adTagURI||e?.vastAdData)||e[0]:e}extractVastTagUri(e){if(e){if("string"==typeof e)return e.trim()||void 0;if("object"==typeof e){const t=e.uri||e.URI||e.value||e.text||e["#text"];if("string"==typeof t&&t.trim())return t.trim()}}}parseVmapTimeOffset(e){const t=String(e||"").trim();if(!t||"start"===t)return{at:"preroll"};if("end"===t)return{at:"postroll"};if(t.endsWith("%")){const e=Number(t.slice(0,-1));if(Number.isFinite(e)&&e>=0&&e<=100)return{at:0,pendingPercent:e/100}}const r=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(t);if(r){const e=Number(r[1]),t=Number(r[2]),i=Number(r[3]);if([e,t,i].every(e=>Number.isFinite(e)))return{at:3600*e+60*t+i}}const i=Number(t);return Number.isFinite(i)&&i>=0?{at:i}:{at:"preroll"}}async loadVmapAndMerge(e,t){try{const r=(t||this.getSource("VMAP")?.src||"").trim();if(!r)return;const i=this.isXmlString(r)?r:await fetch(r).then(e=>{if(!e.ok)throw new Error(`VMAP request failed: ${e.status}`);return e.text()}),n=(new DOMParser).parseFromString(i,"text/xml"),s=new E(n),a=[],o=s.adBreaks||[],l=this.pendingPercentBreaks.length,c=(()=>{try{const e=n.getElementsByTagNameNS("*","AdBreak");if(e&&e.length)return e.length}catch{}try{return n.getElementsByTagName("AdBreak").length}catch{return 0}})();for(let e=0;e<o.length;e++){const t=o[e],r=String(t?.breakType||"").toLowerCase();if(r&&"linear"!==r&&"nonlinear"!==r&&"non-linear"!==r)continue;const i=String(t?.timeOffset||"").trim(),n=`${t?.breakId||"vmap"}:${i||"start"}:${e}`,{at:s,pendingPercent:l}=this.parseVmapTimeOffset(i),c=this.normalizeVmapAdSource(t?.adSource),u=c?.vastAdData,d=c?.adTagURI,h=this.extractVastTagUri(d);let p;if(u&&("string"==typeof u?p=u:u?.nodeType&&(p=(new XMLSerializer).serializeToString(u))),!h&&!p)continue;const m={type:"nonlinear"===r||"non-linear"===r?"NONLINEAR":"VAST",src:h||p};null==l?a.push({id:n,at:s,once:!0,timeOffset:i||("postroll"===s?"end":"start"),source:m}):this.pendingPercentBreaks.push({id:n,percent:l,once:!0,source:m})}const u=a.length+(this.pendingPercentBreaks.length-l);c>0&&u<c&&(a.length=0,this.pendingPercentBreaks.splice(l)),0===a.length&&this.pendingPercentBreaks.length===l&&this.parseVmapFallback(n,a,l),this.resolvedBreaks=[...e,...a]}catch(e){this.warn("VMAP load/parse failed",e),this.onVmapError(e)}finally{this.vmapPending=!1}}parseVmapFallback(e,t,r){const i=(e,t)=>{try{const r=e.getElementsByTagNameNS?.("*",t);if(r&&r.length)return Array.from(r)}catch{}try{return Array.from(e.getElementsByTagName(t))}catch{return[]}},n=i(e,"AdBreak");for(let e=0;e<n.length;e++){const r=n[e],s=String(r.getAttribute("breakType")||"").toLowerCase();if(s&&"linear"!==s&&"nonlinear"!==s&&"non-linear"!==s)continue;const a=String(r.getAttribute("timeOffset")||"").trim(),o=`${r.getAttribute("breakId")||r.getAttribute("id")||"vmap-fb"}:${a||"start"}:${e}`,{at:l,pendingPercent:c}=this.parseVmapTimeOffset(a),u=i(r,"AdSource")[0];let d,h;if(u){const e=i(u,"AdTagURI");if(e.length&&(d=(e[0].textContent||"").trim()||void 0),!d){const e=i(u,"VASTAdData");e.length&&(h=(e[0].textContent||"").trim()||void 0)}}if(!d&&!h)continue;const p={type:"nonlinear"===s||"non-linear"===s?"NONLINEAR":"VAST",src:d||h};null==c?t.push({id:o,at:l,once:!0,timeOffset:a||("postroll"===l?"end":"start"),source:p}):this.pendingPercentBreaks.push({id:o,percent:c,once:!0,source:p})}}reset(){this.playedBreaks.clear(),this.vmapLoadPromise=null,this.vmapPending=!1,this.pendingVmapSrc=void 0,this.pendingPercentBreaks=[],this.resolvedBreaks=[]}}function N(){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:[]}}const w=["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 S(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=R(e);!t.ERRORCODE||r.isCustomCode||/^[0-9]{3}$/.test(t.ERRORCODE)||(t.ERRORCODE=900),t.CACHEBUSTING=M(Math.round(1e8*Math.random())),t.TIMESTAMP=(new Date).toISOString(),t.RANDOM=t.random=t.CACHEBUSTING;for(const e in t)t[e]=O(t[e]);for(const e in n){const r=n[e];"string"==typeof r&&i.push(C(r,t))}return i}function C(e,t){const r=(e=I(e,t)).match(/[^[\]]+(?=])/g);if(!r)return e;let i=r.filter(e=>w.indexOf(e)>-1);return 0===i.length?e:(i=i.reduce((e,t)=>(e[t]=-1,e),{}),I(e,i))}function I(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 R(e){return Array.isArray(e)?e.map(e=>e&&e.hasOwnProperty("url")?e.url:e):e}function L(e){return/^(https?:\/\/|\/\/)/.test(e)}function D(e,t){for(let r=0;r<t.length;r++)if(x(t[r],e))return!0;return!1}function x(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 O(e){return encodeURIComponent(e).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function M(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return e.toString().padStart(t,"0")}const P={track:function(e,t,r){S(e,t,r).forEach(e=>{"undefined"!=typeof window&&null!==window&&((new Image).src=e)})},resolveURLTemplates:S,extractURLsFromTemplates:R,filterUrlTemplates:function(e){return e.reduce((e,t)=>{const r=t.url||t;return L(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:D,isTemplateObjectEqual:x,encodeURIComponentRFC3986:O,replaceUrlMacros:C,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)=>(D(t,e)||e.push(t),e),[])},isValidTimeValue:function(e){return Number.isFinite(e)&&e>=-2},addLeadingZeros:M,isValidUrl:L,isBrowserEnvironment:function(){return"undefined"!=typeof window},formatMacrosValues:function(e){return"object"!=typeof e?e:JSON.stringify(e)}};function U(e){return["true","TRUE","True","1"].includes(e)}const _={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:U,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:function(e){if(null==e)return-1;if(P.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]),s=parseInt(60*t[0]*60);return isNaN(s)||isNaN(n)||isNaN(i)||n>3600||i>60?-1:s+n+i},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=U(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=>{P.containsTemplateObject(t,e)||e.push(t)})}),e),[]);e.creatives=i.concat(e.creatives);const s=t.videoClickTrackingURLTemplates&&t.videoClickTrackingURLTemplates.length,a=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&&(s&&(e.videoClickTrackingURLTemplates=e.videoClickTrackingURLTemplates.concat(t.videoClickTrackingURLTemplates)),a&&(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=P.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 B(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}=N(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=_.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:{}}}(_.parseAttributes(e));t.htmlResources=_.childrenByName(e,"HTMLResource").reduce((e,t)=>{const r=_.parseNodeText(t);return r?e.concat(r):e},[]),t.iframeResources=_.childrenByName(e,"IFrameResource").reduce((e,t)=>{const r=_.parseNodeText(t);return r?e.concat(r):e},[]),t.staticResources=_.childrenByName(e,"StaticResource").reduce((e,t)=>{const r=_.parseNodeText(t);return r?e.concat({url:r,creativeType:t.getAttribute("creativeType")||null}):e},[]),t.altText=_.parseNodeText(_.childByName(e,"AltText"))||null;const r=_.childByName(e,"TrackingEvents");r&&_.childrenByName(r,"Tracking").forEach(e=>{const r=e.getAttribute("event"),i=_.parseNodeText(e);r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))}),t.companionClickTrackingURLTemplates=_.childrenByName(e,"CompanionClickTracking").map(e=>({id:e.getAttribute("id")||null,url:_.parseNodeText(e)})),t.companionClickThroughURLTemplate=_.parseNodeText(_.childByName(e,"CompanionClickThrough"))||null;const i=_.childByName(e,"AdParameters");return i&&(t.adParameters={value:_.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t}),r}function V(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}=N(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=_.parseDuration(_.parseNodeText(_.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=_.parseDuration(n);const s=_.childByName(e,"VideoClicks");if(s){const e=_.childByName(s,"ClickThrough");i.videoClickThroughURLTemplate=e?{id:e.getAttribute("id")||null,url:_.parseNodeText(e)}:null,_.childrenByName(s,"ClickTracking").forEach(e=>{i.videoClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:_.parseNodeText(e)})}),_.childrenByName(s,"CustomClick").forEach(e=>{i.videoCustomClickURLTemplates.push({id:e.getAttribute("id")||null,url:_.parseNodeText(e)})})}const a=_.childByName(e,"AdParameters");a&&(i.adParameters={value:_.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),_.childrenByName(e,"TrackingEvents").forEach(e=>{_.childrenByName(e,"Tracking").forEach(e=>{let t=e.getAttribute("event");const n=_.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(_.parseDuration(r))}Array.isArray(i.trackingEvents[t])||(i.trackingEvents[t]=[]),i.trackingEvents[t].push(n)}})}),_.childrenByName(e,"MediaFiles").forEach(e=>{_.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=_.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=_.parseBoolean(r));const i=e.getAttribute("maintainAspectRatio");return i&&"string"==typeof i&&(t.maintainAspectRatio=_.parseBoolean(i)),t}(e))});const t=_.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:_.parseBoolean(e.variableDuration),fileURL:null}}(_.parseAttributes(e));return t.fileURL=_.parseNodeText(e),t}(t));const r=_.childByName(e,"ClosedCaptionFiles");r&&_.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}}(_.parseAttributes(e));t.fileURL=_.parseNodeText(e),i.closedCaptionFiles.push(t)});const n=_.childByName(e,"Mezzanine"),s=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(s){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=_.parseNodeText(n),e.delivery=s.delivery,e.codec=n.getAttribute("codec"),e.type=s.type,e.width=parseInt(s.width,10),e.height=parseInt(s.height,10),e.fileSize=parseInt(n.getAttribute("fileSize"),10),e.mediaType=n.getAttribute("mediaType")||"2D",i.mezzanine=e}});const o=_.childByName(e,"Icons");return o&&_.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=_.parseDuration(e.getAttribute("offset")),t.duration=_.parseDuration(e.getAttribute("duration")),t.altText=e.getAttribute("altText"),t.hoverText=e.getAttribute("hoverText"),_.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=_.parseNodeText(e)}),_.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=_.parseNodeText(e)}),_.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=_.parseNodeText(e)});const r=_.childByName(e,"IconClicks");if(r){t.iconClickThroughURLTemplate=_.parseNodeText(_.childByName(r,"IconClickThrough")),_.childrenByName(r,"IconClickTracking").forEach(e=>{t.iconClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:_.parseNodeText(e)})});const e=_.childByName(r,"IconClickFallbackImages");e&&_.childrenByName(e,"IconClickFallbackImage").forEach(e=>{t.iconClickFallbackImages.push({url:_.parseNodeText(e)||null,width:e.getAttribute("width")||null,height:e.getAttribute("height")||null})})}return t.iconViewTrackingURLTemplate=_.parseNodeText(_.childByName(e,"IconViewTracking")),t}(e))}),i}function F(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}=N(e);return{id:t,adId:r,sequence:i,apiFramework:n,type:"nonlinear",variations:[],trackingEvents:{}}}(t);return _.childrenByName(e,"TrackingEvents").forEach(e=>{let t,i;_.childrenByName(e,"Tracking").forEach(e=>{t=e.getAttribute("event"),i=_.parseNodeText(e),t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))})}),_.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=_.parseBoolean(e.getAttribute("scalable")),t.maintainAspectRatio=_.parseBoolean(e.getAttribute("maintainAspectRatio")),t.minSuggestedDuration=_.parseDuration(e.getAttribute("minSuggestedDuration")),t.apiFramework=e.getAttribute("apiFramework"),_.childrenByName(e,"HTMLResource").forEach(e=>{t.type=e.getAttribute("creativeType")||"text/html",t.htmlResource=_.parseNodeText(e)}),_.childrenByName(e,"IFrameResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.iframeResource=_.parseNodeText(e)}),_.childrenByName(e,"StaticResource").forEach(e=>{t.type=e.getAttribute("creativeType")||0,t.staticResource=_.parseNodeText(e)});const i=_.childByName(e,"AdParameters");i&&(t.adParameters={value:_.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),t.nonlinearClickThroughURLTemplate=_.parseNodeText(_.childByName(e,"NonLinearClickThrough")),_.childrenByName(e,"NonLinearClickTracking").forEach(e=>{t.nonlinearClickTrackingURLTemplates.push({id:e.getAttribute("id")||null,url:_.parseNodeText(e)})}),r.variations.push(t)}),r}function q(e){const t=[];return e.forEach(e=>{const r=j(e);r&&t.push(r)}),t}function j(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=j(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=_.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 H(e){return e.getAttribute("AdID")||e.getAttribute("adID")||e.getAttribute("adId")||null}const W={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 G(e,t){if(!W[e.nodeName]||!W[e.nodeName].attributes)return;const r=W[e.nodeName].attributes.filter(t=>!e.getAttribute(t));r.length>0&&Y({name:e.nodeName,parentName:e.parentNode.nodeName,attributes:r},t)}function X(e,t,r){const i=W[e.nodeName],n=!r&&"Wrapper"!==e.nodeName;if(i&&!n){if(i.subElements){const r=i.subElements.filter(t=>!_.childByName(e,t));r.length>0&&Y({name:e.nodeName,parentName:e.parentNode.nodeName,subElements:r},t)}r&&i.oneOfinLineResources&&(i.oneOfinLineResources.some(t=>_.childByName(e,t))||Y({name:e.nodeName,parentName:e.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},t))}}function z(e){return e.children&&0!==e.children.length}function Y(e,t){let{name:r,parentName:i,attributes:n,subElements:s,oneOfResources:a}=e,o="Element '".concat(r,"'");o+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):s?" missing required sub element(s) '".concat(s.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",t("VAST-warning",{message:o,parentElement:i,specVersion:4.1})}const Q=function e(t,r,i){if(t&&t.nodeName)if("InLine"===t.nodeName&&(i=!0),G(t,r),z(t)){X(t,r,i);for(let n=0;n<t.children.length;n++)e(t.children[n],r,i)}else 0===_.parseNodeText(t).length&&Y({name:t.nodeName,parentName:t.parentNode.nodeName},r)};function K(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(_.copyNodeAttribute("id",e,i),_.copyNodeAttribute("sequence",e,i),_.copyNodeAttribute("adType",e,i),"Wrapper"===i.nodeName)return{ad:Z(i,t),type:"WRAPPER"};if("InLine"===i.nodeName)return{ad:$(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 $(e,t){let{allowMultipleAds:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return!1===r&&e.getAttribute("sequence")?null:J(e,t)}function J(e,t){let r=[];t&&Q(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}}(_.parseAttributes(e));return i.forEach(e=>{switch(e.nodeName){case"Error":n.errorURLTemplates.push(_.parseNodeText(e));break;case"Impression":n.impressionURLTemplates.push({id:e.getAttribute("id")||null,url:_.parseNodeText(e)});break;case"Creatives":n.creatives=function(e){const t=[];return e.forEach(e=>{const r={id:e.getAttribute("id")||null,adId:H(e),sequence:e.getAttribute("sequence")||null,apiFramework:e.getAttribute("apiFramework")||null},i=[];let n;_.childrenByName(e,"UniversalAdId").forEach(e=>{const t={idRegistry:e.getAttribute("idRegistry")||"unknown",value:_.parseNodeText(e)};i.push(t)});const s=_.childByName(e,"CreativeExtensions");s&&(n=q(_.childrenByName(s,"CreativeExtension")));for(const s in e.childNodes){const a=e.childNodes[s];let o;switch(a.nodeName){case"Linear":o=V(a,r);break;case"NonLinearAds":o=F(a,r);break;case"CompanionAds":o=B(a,r)}o&&(i&&(o.universalAdIds=i),n&&(o.creativeExtensions=n),t.push(o))}}),t}(_.childrenByName(e,"Creative"));break;case"Extensions":{const t=_.childrenByName(e,"Extension");n.extensions=q(t),n.adVerifications.length||(r=function(e){let t=null,r=[];return e.some(e=>t=_.childByName(e,"AdVerifications")),t&&(r=ee(_.childrenByName(t,"Verification"))),r}(t));break}case"AdVerifications":n.adVerifications=ee(_.childrenByName(e,"Verification"));break;case"AdSystem":n.system={value:_.parseNodeText(e),version:e.getAttribute("version")||null};break;case"AdTitle":n.title=_.parseNodeText(e);break;case"AdServingId":n.adServingId=_.parseNodeText(e);break;case"Category":n.categories.push({authority:e.getAttribute("authority")||null,value:_.parseNodeText(e)});break;case"Expires":n.expires=parseInt(_.parseNodeText(e),10);break;case"ViewableImpression":n.viewableImpression.push(function(e){const t=(e,t)=>{const r=_.parseNodeText(t);return r&&e.push(r),e};return{id:e.getAttribute("id")||null,viewable:_.childrenByName(e,"Viewable").reduce(t,[]),notViewable:_.childrenByName(e,"NotViewable").reduce(t,[]),viewUndetermined:_.childrenByName(e,"ViewUndetermined").reduce(t,[])}}(e));break;case"Description":n.description=_.parseNodeText(e);break;case"Advertiser":n.advertiser={id:e.getAttribute("id")||null,value:_.parseNodeText(e)};break;case"Pricing":n.pricing={value:_.parseNodeText(e),model:e.getAttribute("model")||null,currency:e.getAttribute("currency")||null};break;case"Survey":n.survey={value:_.parseNodeText(e),type:e.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:e.getAttribute("authority")||null,value:_.parseNodeText(e)})}}),r.length&&(n.adVerifications=n.adVerifications.concat(r)),n}function Z(e,t){const r=J(e,t),i=e.getAttribute("followAdditionalWrappers"),n=e.getAttribute("allowMultipleAds"),s=e.getAttribute("fallbackOnNoAd");r.followAdditionalWrappers=!i||_.parseBoolean(i),r.allowMultipleAds=!!n&&_.parseBoolean(n),r.fallbackOnNoAd=s?_.parseBoolean(s):null;let a=_.childByName(e,"VASTAdTagURI");if(a?r.nextWrapperURL=_.parseNodeText(a):(a=_.childByName(e,"VASTAdTagURL"),a&&(r.nextWrapperURL=_.parseNodeText(_.childByName(a,"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 ee(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);_.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(),_.assignAttributes(n,r);break;case"VerificationParameters":r.parameters=i.trim()}});const n=_.childByName(e,"TrackingEvents");n&&_.childrenByName(n,"Tracking").forEach(e=>{const t=e.getAttribute("event"),i=_.parseNodeText(e);t&&i&&(Array.isArray(r.trackingEvents[t])||(r.trackingEvents[t]=[]),r.trackingEvents[t].push(i))}),t.push(r)}),t}class te{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 re=0,ie=0;const ne=(e,t)=>{!e||!t||e<=0||t<=0||(ie=(ie*re+8*e/t)/++re)},se={ERRORCODE:900,extensions:[]},ae="VAST response version not supported";class oe extends te{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({},se,t,...i)),P.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return ie}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(),ne(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:s,followAdditionalWrappers:a,wrapperChainId:o=0}=t;if(!e||!e.documentElement||"VAST"!==e.documentElement.nodeName){var l;this.emit("VAST-ad-parsed",{type:"ERROR",url:i,wrapperDepth:n,wrapperChainId:o});const t="VideoAdServingTemplate"===(null==e||null===(l=e.documentElement)||void 0===l?void 0:l.nodeName);throw new Error(t?ae:"Invalid VAST XMLDocument")}const c=[],u=e.documentElement.childNodes,d=e.documentElement.getAttribute("version");r&&d&&(this.vastVersion=d);for(const e in u){const t=u[e];if("Error"===t.nodeName){const e=_.parseNodeText(t);r?this.rootErrorURLTemplates.push(e):this.errorURLTemplates.push(e)}else if("Ad"===t.nodeName){if(this.vastVersion&&parseFloat(this.vastVersion)<3)s=!0;else if(!1===s&&c.length>1)break;const e=K(t,this.emit.bind(this),{allowMultipleAds:s,followAdditionalWrappers:a});e.ad?(c.push(e.ad),this.emit("VAST-ad-parsed",{type:e.type,url:i,wrapperDepth:n,adIndex:c.length-1,vastVersion:d,wrapperChainId:o})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return c}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:i=null,previousUrl:n=null,wrapperDepth:s=0,isRootVAST:a=!1,followAdditionalWrappers:o,allowMultipleAds:l,wrapperChainId:c=0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&a&&(l=!0);try{u=this.parseVastXml(e,{isRootVAST:a,url:t,wrapperDepth:s,allowMultipleAds:l,followAdditionalWrappers:o,wrapperChainId:c})}catch(e){return Promise.reject(e)}if(1===u.length&&null!=i&&(u[0].sequence=i),!1===r){const e=_.getSortedAdPods(u),t=_.getStandAloneAds(u);e.length?u=e:t.length&&(u=[t.shift()]),this.remainingAds=t}return this.resolveAds(u,{wrapperDepth:s,previousUrl:n,url:t,wrapperChainId:c})}resolveAds(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:i,wrapperChainId:n=0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=[];return r=i,e.forEach(e=>{const i=this.resolveWrappers(e,t,r,n);s.push(i),0===t&&n++}),Promise.all(s).then(e=>P.flatten(e))}resolveWrappers(e,t,r,i){const n={...e};return new Promise(e=>{var s;if(t++,!n.nextWrapperURL)return delete n.nextWrapperURL,e(n);if(!this.fetcher)return n.VASTAdTagURI=n.nextWrapperURL,delete n.nextWrapperURL,e(n);if(t>=this.maxWrapperDepth)return n.errorCode=302,delete n.nextWrapperURL,e(n);n.nextWrapperURL=_.resolveVastAdTagURI(n.nextWrapperURL,r);const a=null!==(s=this.parsingOptions.allowMultipleAds)&&void 0!==s?s:n.allowMultipleAds,o=n.sequence;this.fetcher.fetchVAST({url:n.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth,wrapperDepth:t,previousUrl:r,wrapperAd:n,wrapperChainId:i}).then(s=>this.parse(s,{url:n.nextWrapperURL,previousUrl:r,wrapperSequence:o,wrapperDepth:t,followAdditionalWrappers:n.followAdditionalWrappers,allowMultipleAds:a,wrapperChainId:i}).then(t=>{if(delete n.nextWrapperURL,0===t.length)return n.creatives=[],e(n);t.forEach(e=>{e&&_.mergeWrapperAdData(e,n)}),e(t)})).catch(t=>{n.errorCode=t.message===ae?102:301,n.errorMessage=t.message,e(n)})})}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 le=null;const ce={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 ue{constructor(){this.storage=this.initStorage()}initStorage(){if(le)return le;try{le="undefined"!=typeof window&&null!==window?window.localStorage||window.sessionStorage:null}catch(e){le=null}return le&&!this.isStorageDisabled(le)||(le=ce,le.clear()),le}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 de=12e4,he={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||de," ms (408)"))},t.timeout||de),n=await fetch(e,{...t,signal:r.signal,credentials:t.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(i)}),s=function(e){return P.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 s?{error:new Error(s),statusCode:n.status}:async function(e){const t=await e.text();let r;return r=P.isBrowserEnvironment()?new DOMParser:new((await Promise.resolve().then(function(){return qt})).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 pe{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||he,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||de,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:s=0,previousUrl:a=null,wrapperAd:o=null,wrapperChainId:l=0}=e;const c=Date.now();this.URLTemplateFilters.forEach(e=>{r=e(r)}),n("VAST-resolving",{url:r,previousUrl:a,wrapperDepth:s,maxWrapperDepth:i,timeout:this.fetchingOptions.timeout,wrapperAd:o,wrapperChainId:l});const u=await this.urlHandler.get(r,this.fetchingOptions),d=Math.round(Date.now()-c);if(n("VAST-resolved",{url:r,previousUrl:a,wrapperDepth:s,error:(null==u?void 0:u.error)||null,duration:d,statusCode:(null==u?void 0:u.statusCode)||null,wrapperChainId:l,...null==u?void 0:u.details}),ne(null==u||null===(t=u.details)||void 0===t?void 0:t.byteLength,d),u.error)throw new Error(u.error);return u.xml}}class me{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 ue;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new pe,this.vastParser=new oe({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 s=r-this.lastSuccessfulAd;if(s<0)this.lastSuccessfulAd=0;else if(s<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))})}}class fe extends te{constructor(e,t,r){var i;let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=s,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){P.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(!P.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(P.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(P.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(P.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(P.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(P.formatMacrosValues(t))})}setSkipDelay(e){P.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(P.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),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):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(P.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(P.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(P.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=P.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:s}=P.filterUrlTemplates(e);s.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(s)});const a={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(a.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(a.ADPLAYHEAD=this.progressFormatted())),null!==(t=this.creative)&&void 0!==t&&null!==(t=t.universalAdIds)&&void 0!==t&&t.length&&(a.UNIVERSALADID=this.creative.universalAdIds.map(e=>e.idRegistry.concat(" ",e.value)).join(",")),this.ad&&(this.ad.sequence&&(a.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(a.ADTYPE=this.ad.adType),this.ad.adServingId&&(a.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(a.ADCATEGORIES=this.ad.categories.map(e=>e.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(a.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(e=>e.value).join(","))),P.track(n,a,i)}convertToTimecode(e){if(!P.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),i=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),s=Math.floor(t%1e3);return"".concat(P.addLeadingZeros(r,2),":").concat(P.addLeadingZeros(i,2),":").concat(P.addLeadingZeros(n,2),".").concat(P.addLeadingZeros(s,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}class ge{constructor(){Object.defineProperty(this,"adTrackEls",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"prevActiveCaptionSig",{enumerable:!0,configurable:!0,writable:!0,value:null})}captionsSignature(e){return`${String(e?.kind??"")}|${String((e?.language??e?.srclang??"")||"")}|${String((e?.label??"")||"")}`}listCaptionTracks(e){const t=e?.textTracks;if(!t||"number"!=typeof t.length)return[];const r=[];for(let e=0;e<Number(t.length);e++){const i=t[e]??("function"==typeof t.item?t.item(e):null);if(!i)continue;const n=String(i.kind||"");"captions"!==n&&"subtitles"!==n||r.push(i)}return r}captureActiveCaptionTrack(e){if(this.prevActiveCaptionSig)return;const t=this.listCaptionTracks(e).find(e=>"showing"===String(e.mode));t&&(this.prevActiveCaptionSig=this.captionsSignature(t))}restoreActiveTextTrack(e){const t=this.prevActiveCaptionSig;if(this.prevActiveCaptionSig=null,!t||!e)return;const r=this.listCaptionTracks(e);if(!r.length)return;for(const e of r)e.mode="disabled";const i=r.find(e=>this.captionsSignature(e)===t);i&&(i.mode="showing")}ensureRawCaptions(e,t){if(e&&Array.isArray(e.captions))return e.captions;if(t){const e=t?.linear||t?.Linear||t,r=e?.closedCaptionFiles||e?.ClosedCaptionFiles;if(Array.isArray(r)&&r.length>0)return r.map(e=>({src:e.fileURL||e.url||"",kind:"captions",srclang:e.language||e.fileLanguage||"",label:e.fileLanguage||e.language||"",type:e.fileType||""})).filter(e=>!!e.src)}if(!e)return[];const r=h(e);return e.captions=r,r}attachAdCaptionTracks(e,t,r){const i=this.ensureRawCaptions(t,r).filter(e=>(e.type||"").toLowerCase().includes("vtt")||e.src.toLowerCase().endsWith(".vtt")),n=[];for(const t of i){const r=document.createElement("track");r.kind=t.kind,r.src=t.src,t.srclang&&(r.srclang=t.srclang),t.label&&(r.label=t.label),r.default=!1,e.appendChild(r),r.track&&(r.track.mode="hidden"),n.push(r)}return this.adTrackEls=n,n}clearAdTracks(){for(const e of this.adTrackEls)e.remove();this.adTrackEls=[]}removeAdCaptions(){for(const e of this.adTrackEls)try{e.remove()}catch{}this.adTrackEls=[]}}function ve(){return window.OmidSessionClient??null}class be{static isAvailable(){return null!==ve()}static injectVerificationScript(e,t){const r=document.createElement("script");return r.src=e,r.async=!0,t&&r.setAttribute("data-omid-verification-parameters",t),document.head.appendChild(r),r}constructor(e,t,r="limited"){Object.defineProperty(this,"adSession",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"videoEvents",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"adEvents",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1});const i=ve();if(i)try{const n=new i.Partner("OpenPlayerJS","3.0.0"),s=t.map(e=>new i.VerificationScriptResource(e.scriptUrl,e.vendor||void 0,e.params||void 0)),a="domain"===r?i.AccessMode?.DOMAIN??"domain":i.AccessMode?.LIMITED??"limited",o=new i.Context(n,s);"function"==typeof o.setVideoElement&&o.setVideoElement(e),"function"==typeof o.setAccessMode&&o.setAccessMode(a),this.adSession=new i.AdSession(o),this.videoEvents=new i.VideoEvents(this.adSession),this.adEvents=new i.AdEvents(this.adSession),this.adSession.start()}catch(e){this.adSession=null,this.videoEvents=null,this.adEvents=null}}impression(){if(this.adSession&&!this.destroyed)try{"function"==typeof this.adSession.triggerSessionStart?this.adSession.triggerSessionStart?.():this.adSession.start?.(),this.adEvents?.impressionOccurred?.()}catch{}}loaded(e=!1,t=0,r=!1,i="preroll"){if(this.videoEvents&&!this.destroyed)try{const n=ve();if(!n)return;const s=new n.VastProperties(e,t,r,i);this.videoEvents.loaded(s)}catch{}}start(e,t){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.start(e,t)}catch{}}firstQuartile(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.firstQuartile()}catch{}}midpoint(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.midpoint()}catch{}}thirdQuartile(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.thirdQuartile()}catch{}}complete(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.complete()}catch{}}pause(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.pause()}catch{}}resume(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.resume()}catch{}}skipped(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.skipped()}catch{}}volumeChange(e){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.volumeChange(e)}catch{}}playerStateChange(e){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.playerStateChange(e)}catch{}}adUserInteraction(e){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.adUserInteraction(e)}catch{}}bufferStart(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.bufferStart()}catch{}}bufferFinish(){if(this.videoEvents&&!this.destroyed)try{this.videoEvents.bufferFinish()}catch{}}destroy(){if(!this.destroyed){this.destroyed=!0;try{this.adSession?.finish?.()}catch{}this.adSession=null,this.videoEvents=null,this.adEvents=null}}}const ye="SIMID:Player:init",Ee="SIMID:Player:startCreative",Te="SIMID:Player:adProgress",ke="SIMID:Player:adPaused",Ae="SIMID:Player:adPlaying",Ne="SIMID:Player:adStopped",we="SIMID:Player:adSkipped",Se="SIMID:Player:adVolume",Ce="SIMID:Player:adDurationChange",Ie="SIMID:Player:resize",Re="SIMID:Player:fatal",Le="SIMID:Player:appBackgrounded",De="SIMID:Player:appForegrounded",xe="resolve",Oe="reject",Me="SIMID:Media:durationchange",Pe="SIMID:Media:ended",Ue="SIMID:Media:error",_e="SIMID:Media:pause",Be="SIMID:Media:play",Ve="SIMID:Media:playing",Fe="SIMID:Media:seeked",qe="SIMID:Media:seeking",je="SIMID:Media:stalled",He="SIMID:Media:timeupdate",We="SIMID:Media:volumechange",Ge="SIMID:Creative:ready",Xe="SIMID:Creative:getMediaState",ze="SIMID:Creative:resolve",Ye="SIMID:Creative:reject",Qe="SIMID:Creative:requestFullscreen",Ke="SIMID:Creative:requestResize",$e="SIMID:Creative:clickThrough",Je="SIMID:Creative:reportTracking",Ze="SIMID:Creative:requestSkip",et="SIMID:Creative:requestStop",tt="SIMID:Creative:requestPause",rt="SIMID:Creative:requestPlay",it="SIMID:Creative:requestChangeAdDuration",nt="SIMID:Creative:fatal",st="SIMID:Creative:log";class at{constructor(e,t,r,i){Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"adVideo",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"callbacks",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"creativeInfo",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"msgCounter",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"pending",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"messageListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sessionId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"initSent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"initPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"mediaListeners",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"visibilityHandler",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"outgoingFormat",{enumerable:!0,configurable:!0,writable:!0,value:"plain"}),Object.defineProperty(this,"_targetOrigin",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"creativeWindow",{enumerable:!0,configurable:!0,writable:!0,value:null}),this.messageListener=this.handleMessage.bind(this),window.addEventListener("message",this.messageListener),this.bindMediaEvents()}nextMsgId(){return++this.msgCounter}getTargetOrigin(){if(null!==this._targetOrigin)return this._targetOrigin;try{const e=new URL(this.iframe.src,window.location.href).origin;return"null"===e?"*":e}catch{return"*"}}postMsg(e){const t=this.creativeWindow??this.iframe.contentWindow;if(!t)return;const r="json-string"===this.outgoingFormat?JSON.stringify(e):e;t.postMessage(r,this.getTargetOrigin())}send(e,t){const r=this.nextMsgId(),i={type:e,messageId:r,sessionId:this.sessionId||void 0,timestamp:Date.now(),args:t??{}};return new Promise((e,t)=>{this.pending.set(r,{resolve:e,reject:t});try{this.postMsg(i)}catch(e){this.pending.delete(r),t(e)}})}sendResolve(e,t){try{this.postMsg({type:xe,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{messageId:e,value:t??{}}})}catch{}}sendReject(e,t,r){try{this.postMsg({type:Oe,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{messageId:e,value:{errorCode:t,message:r}}})}catch{}}parseMessageData(e){if("string"==typeof e){let t;try{t=JSON.parse(e)}catch{return null}return t?.type?("plain"===this.outgoingFormat&&(this.outgoingFormat="json-string"),t):null}return e&&"object"==typeof e?e:null}handleMessage(e){if(this.destroyed)return;const t=this.parseMessageData(e.data);if(!t||!t.type)return;null===this.creativeWindow&&e.source instanceof Window&&(this.creativeWindow=e.source),null===this._targetOrigin&&e.origin&&"null"!==e.origin&&(this._targetOrigin=e.origin);const r=t.messageId??t.msgId??0;switch(t.type){case"createSession":this.onCreateSession(r,t.sessionId||"");break;case Xe:this.sendResolve(r,this.getMediaState());break;case Ge:this.onCreativeReady();break;case"resolve":case ze:{const e=t.resolves??t.args?.messageId,r=null!=e?this.pending.get(e):void 0;r&&(this.pending.delete(e),r.resolve(t.args?.value??t.args));break}case"reject":case Ye:{const e=t.rejects??t.args?.messageId,r=null!=e?this.pending.get(e):void 0;r&&(this.pending.delete(e),r.reject({errorCode:t.errorCode??t.args?.value?.errorCode,reason:t.reason??t.args?.value?.message}));break}case Ze:this.callbacks.onSkip();break;case et:this.callbacks.onStop();break;case tt:this.callbacks.onPause();break;case rt:this.callbacks.onPlay();break;case $e:{const e=String(t.args?.url||t.args?.clickThroughUrl||"");e&&this.callbacks.onClickThrough(e);break}case Je:{const e=String(t.args?.event||t.args?.trackingEvent||"");this.callbacks.onTrackingEvent(e,t.args);break}case Qe:{const e=this.iframe.closest(".op-ads")??this.iframe.parentElement;e?.requestFullscreen?e.requestFullscreen().catch(()=>this.sendReject(r,403,"Fullscreen denied")):this.sendReject(r,403,"Fullscreen not supported");break}case Ke:this.resize(this.iframe.offsetWidth||window.innerWidth,this.iframe.offsetHeight||window.innerHeight);break;case it:{const e=Number(t.args?.durationChange??t.args?.duration??0);this.callbacks.onRequestChangeAdDuration?this.callbacks.onRequestChangeAdDuration(e,()=>this.sendResolve(r,{}),(e,t)=>this.sendReject(r,e,t)):this.sendReject(r,403,"requestChangeAdDuration not supported");break}case nt:this.callbacks.onFatal(t.errorCode??901,t.reason??"Creative fatal error");break;case st:this.callbacks.onLog?.(t.args)}}onCreateSession(e,t){t&&(this.sessionId=t),this.sendResolve(e),this.initSent||(this.initSent=!0,this.initPromise=this.send(ye,{creativeData:this.buildCreativeData(),environmentData:this.buildEnvironmentData()}).then(()=>{if(!this.started&&!this.destroyed)return this.started=!0,this.send(Ee).catch(()=>{})}).catch(()=>{}))}async onCreativeReady(){if(!this.started){this.started=!0;try{this.initSent?this.initPromise&&await this.initPromise:(this.initSent=!0,await this.send(ye,{creativeData:this.buildCreativeData(),environmentData:this.buildEnvironmentData()})),await this.send(Ee)}catch{}}}buildEnvironmentData(){const e=this.adVideo,t=this.iframe.getBoundingClientRect(),r=e.getBoundingClientRect(),i=Math.round(t.width)||e.offsetWidth||640,n=Math.round(t.height)||e.offsetHeight||360,s=Math.round(r.width)||i,a=Math.round(r.height)||n,o=e.muted?0:Number.isFinite(e.volume)?e.volume:1;return{videoDimensions:{x:Math.round(r.left),y:Math.round(r.top),width:s,height:a},creativeDimensions:{x:Math.round(t.left),y:Math.round(t.top),width:i,height:n},fullscreen:!!document.fullscreenElement,fullscreenAllowed:!0,variableDurationAllowed:"function"==typeof this.callbacks.onRequestChangeAdDuration,skippableState:"notSkippable",version:"1.2",siteUrl:"undefined"!=typeof window?window.location.href:"",muted:e.muted,volume:o,playerWidth:i,playerHeight:n,videoDuration:Number.isFinite(e.duration)?e.duration:0,videoVolume:o}}buildCreativeData(){return{adParameters:this.creativeInfo?.adParameters??"",clickThruUrl:this.creativeInfo?.clickThruUri??"",clickThruUri:this.creativeInfo?.clickThruUri??""}}getMediaState(){const e=this.adVideo;return{currentSrc:e.currentSrc||e.src||"",currentTime:e.currentTime,duration:Number.isFinite(e.duration)?e.duration:0,ended:e.ended,muted:e.muted,paused:e.paused,volume:e.volume,fullscreen:!!document.fullscreenElement}}init(e,t){return this.send(ye,{creativeData:e,environmentData:t})}start(){return this.send(Ee)}progress(e,t){if(!this.destroyed)try{this.postMsg({type:Te,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{currentTime:e,duration:t,remainingTime:Math.max(0,t-e)}})}catch{}}pause(){if(!this.destroyed)try{this.postMsg({type:ke,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{}})}catch{}}resume(){if(!this.destroyed)try{this.postMsg({type:Ae,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{}})}catch{}}stop(){return this.destroyed?Promise.resolve():this.send(Ne).catch(()=>{})}skip(){if(!this.destroyed)try{this.postMsg({type:we,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{}})}catch{}}volumeChange(e,t){if(!this.destroyed)try{this.postMsg({type:Se,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{volume:e,muted:t}})}catch{}}adDurationChange(e){if(!this.destroyed)try{this.postMsg({type:Ce,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{duration:e}})}catch{}}resize(e,t){return this.send(Ie,{width:e,height:t})}fatal(e,t){if(!this.destroyed)try{this.postMsg({type:Re,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{errorCode:e,reason:t}})}catch{}}bindMediaEvents(){const e=this.adVideo,t=[["durationchange",Me],["ended",Pe],["error",Ue],["pause",_e],["play",Be],["playing",Ve],["seeked",Fe],["seeking",qe],["stalled",je],["timeupdate",He],["volumechange",We]];for(const[r,i]of t){const t=()=>{if(!this.destroyed&&this.sessionId)try{this.postMsg({type:i,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:this.getMediaState()})}catch{}};e.addEventListener(r,t),this.mediaListeners.push({event:r,handler:t})}this.visibilityHandler=()=>{if(this.destroyed||!this.sessionId)return;const e=document.hidden?Le:De;try{this.postMsg({type:e,messageId:this.nextMsgId(),sessionId:this.sessionId||void 0,timestamp:Date.now(),args:{}})}catch{}},document.addEventListener("visibilitychange",this.visibilityHandler)}destroy(){if(!this.destroyed){this.destroyed=!0,window.removeEventListener("message",this.messageListener);for(const{event:e,handler:t}of this.mediaListeners)this.adVideo.removeEventListener(e,t);this.mediaListeners=[],this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null);for(const[,e]of this.pending)e.reject({errorCode:900,reason:"SimidSession destroyed"});this.pending.clear()}}}class ot{constructor(e){Object.defineProperty(this,"bus",{enumerable:!0,configurable:!0,writable:!0,value:e})}on(e,t){return this.bus.on(e,t)}emit(e,...t){this.bus.emit(e,...t)}}function lt(e){const t={...e,...e.csai},r=function(e){const t=[];return(e.sources?Array.isArray(e.sources)?e.sources:[e.sources]:[]).forEach(e=>{if(!e||"string"!=typeof e.src)return;const r=e.src.trim();if(!r)return;const i=e.type;"VAST"!==i&&"VMAP"!==i&&"NONLINEAR"!==i||t.push({type:i,src:r})}),t}(t),i=t.breaks??[],n=i.some(e=>"preroll"===e.at&&(e.source?.src||Array.isArray(e.sources)&&e.sources.some(e=>e?.src))),s=r.some(e=>"VAST"===e.type||"VMAP"===e.type||"NONLINEAR"===e.type);return{allowNativeControls:t.allowNativeControls??!1,resumeContent:t.resumeContent??!0,preferredMediaTypes:t.preferredMediaTypes||["video/mp4","video/webm","application/vnd.apple.mpegurl","application/x-mpegURL"],debug:e.debug??!1,breakTolerance:t.breakTolerance??.25,sources:r,breaks:i,interceptPlayForPreroll:t.interceptPlayForPreroll??(Boolean(n)||s),autoPlayOnReady:t.autoPlayOnReady||!1,mountEl:t.mountEl,mountSelector:t.mountSelector,nonLinearContainer:t.nonLinearContainer,nonLinearSelector:t.nonLinearSelector,companionContainer:t.companionContainer,companionSelector:t.companionSelector,adSourcesMode:t.adSourcesMode??"waterfall",omid:t.omid??{},labels:t.labels??{},adDelivery:e.adDelivery??"csai",requestInterceptor:t.requestInterceptor,eventSink:t.eventSink,scteSource:e.hybrid?.scteSource,resolveScteUrl:e.hybrid?.resolveScteUrl}}class ct{constructor(){Object.defineProperty(this,"mode",{enumerable:!0,configurable:!0,writable:!0,value:"csai"}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cfg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"scheduler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"captionMgr",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"overlayId",{enumerable:!0,configurable:!0,writable:!0,value:"ads"}),Object.defineProperty(this,"overlay",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"adVideo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"adEndPromise",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"adEngineDetach",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"currentBreakMeta",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"vastClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_lastCreative",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"globalUnsubs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sessionUnsubs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"active",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"resumeAfter",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"contentMedia",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentHadControls",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startingBreak",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"userPlayIntent",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"forcedMuteUntilInteraction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"syncingVolume",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_dispatchStartBreak",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchStartBreakGroup",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchPlayBreakFromVast",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchGetVastXmlText",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchBuildParsedForNonLinear",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchMountAdVideo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_dispatchStartAdPlayback",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"simidSession",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"omidSession",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}init(t,r){this.ctx=t,this.cfg=lt(r),this.bus=new ot(t.events),this.vastClient=new me,this.overlay=document.createElement("div"),this.overlay.className="op-ads",this.overlay.style.display="none",this.scheduler=new A(this.cfg,t,this.warn.bind(this),e=>{this.bus.emit("ads:error",{reason:"vmap_parse_failed",error:e}),t.events.emit("ads.error",{reason:"vmap_parse_failed",error:e})}),this.captionMgr=new ge,this.dom=new p(this.overlay,this.cfg,()=>this.adVideo,()=>this.tracker,()=>this.requestSkip("button")),this.globalUnsubs.push(t.events.on("source:set",()=>{this.scheduler.reset(),this.startingBreak=!1,this.clearSession(),this.active=!1,this.contentMedia=void 0,this.contentHadControls=!1,this.overlay.style.display="none",this.ctx.leases.release("playback","ads");try{e.getOverlayManager(this.ctx.core).deactivate(this.overlayId)}catch{}this.userPlayIntent=!1,this.scheduler.rebuild()})),this._dispatchStartBreak=(e,t,r)=>this.startBreak(e,t,r),this._dispatchStartBreakGroup=(e,t)=>this.startBreakGroup(e,t),this._dispatchPlayBreakFromVast=(e,t,r)=>this.playBreakFromVast(e,t,r),this._dispatchGetVastXmlText=e=>Promise.resolve(this.getVastXmlText(e)),this._dispatchBuildParsedForNonLinear=e=>this.buildParsedForNonLinearFromXml(e),this._dispatchMountAdVideo=(e,t,r)=>this.mountAdVideo(e,t,r),this._dispatchStartAdPlayback=()=>this.startAdPlayback(),this.scheduler.rebuild(),this.bindBreakScheduler(),this.cfg.interceptPlayForPreroll&&this.bindPrerollInterceptors(),this.globalUnsubs.push(t.events.on("player:interacted",()=>{if(this.forcedMuteUntilInteraction=!1,this.active&&this.adVideo)try{this.adVideo.muted=t.core.muted,this.adVideo.volume=t.core.volume}catch{}}))}destroy(){this.finish({resume:!1});for(const e of this.globalUnsubs)e();this.globalUnsubs=[],this.overlay?.remove()}async playAds(e){const t=this.scheduler.inferSourceTypeForUrl(e);return this.playBreakFromVast({kind:"url",value:e},{kind:"manual",id:"manual",sourceType:t})}async playAdsFromXml(e){return this.playBreakFromVast({kind:"xml",value:e},{kind:"manual",id:"manual"})}getDueMidrollBreaks(e){return this.scheduler.getDueMidrollBreaks(e)}getDueMidrollBreak(e){return this.scheduler.getDueMidrollBreak(e)}requestSkip(e="api"){this.dom.requestSkip(e,this.adVideo,this.currentBreakMeta,e=>{this.bus.emit("ads:skip",e),this.ctx.events.emit("ads.skipped",e),this.ctx.events.emit("adsskipped",e),this.omidSession?.skipped(),this.simidSession?.skip()},this.log.bind(this))}get dom(){if(!this._dom){const e=document.createElement("div");this._dom=new p(e,this.cfg,()=>this.adVideo,()=>this.tracker,()=>{})}return this._dom}set dom(e){this._dom=e}bindPrerollInterceptors(){const{events:e,core:t}=this.ctx,r=t.media,i=()=>{if(this.scheduler.pendingVmapSrc&&!this.scheduler.vmapLoadPromise){this.scheduler.vmapPending=!0;const e=this.scheduler.pendingVmapSrc;this.scheduler.pendingVmapSrc=void 0,this.scheduler.vmapLoadPromise=this.scheduler.loadVmapAndMerge([...this.scheduler.resolvedBreaks],e)}};this.globalUnsubs.push(e.on("cmd:play",()=>{i();const n=this.scheduler.vmapPending,s=this.shouldInterceptPreroll();if(s||n&&!this.active&&!this.startingBreak)try{r.pause()}catch{}(async()=>{if(this.scheduler.vmapLoadPromise&&await this.scheduler.vmapLoadPromise.catch(()=>{}),!this.shouldInterceptPreroll())return void(!n||s||this.active||this.startingBreak||e.emit("cmd:play"));this.userPlayIntent=!!t.userInteracted;let r=0;for(;r++<10;){const e=this.scheduler.getPrerollBreak();if(!e)break;await this._dispatchStartBreak(e,"preroll")}})()}));const n=()=>{i();const n=this.scheduler.vmapPending,s=this.shouldInterceptPreroll();if(s||n&&!this.active&&!this.startingBreak)try{r.pause()}catch{}(async()=>{if(this.scheduler.vmapLoadPromise&&await this.scheduler.vmapLoadPromise.catch(()=>{}),!this.shouldInterceptPreroll())return void(!n||s||this.active||this.startingBreak||e.emit("cmd:play"));this.userPlayIntent=!!t.userInteracted;let r=0;for(;r++<10;){const e=this.scheduler.getPrerollBreak();if(!e)break;await this._dispatchStartBreak(e,"preroll")}})()};r.addEventListener("play",n,{capture:!0}),this.globalUnsubs.push(()=>r.removeEventListener("play",n,{capture:!0}))}shouldInterceptPreroll(){const e=this.scheduler.getPrerollBreak();if(!e)return!1;if(this.active||this.startingBreak)return!1;const t=this.ctx.core.media;if((t?.currentTime??0)>.25)return!1;const r=this.scheduler.getBreakId(e);return(!1===e.once||!this.scheduler.playedBreaks.has(r))&&"ended"!==this.ctx.state.current}bindBreakScheduler(){const e=this.ctx.core.media;if(!e)return;const t=()=>{if(this.active||this.startingBreak)return;const t=e.currentTime||0,r=this.scheduler.getDueMidrollBreaks(t);if(!r.length)return;const i=r[0],n=i.at,s=i.timeOffset,a=this.cfg.breakTolerance??.25,o=s?this.scheduler.resolvedBreaks.filter(e=>"number"==typeof e.at&&!this.scheduler.playedBreaks.has(this.scheduler.getBreakId(e))&&e.timeOffset===s&&Math.abs(e.at-n)<=Math.max(1,a)):r.filter(e=>Math.abs(e.at-n)<=a);o.length&&(1===o.length?this._dispatchStartBreak(o[0],"midroll"):this._dispatchStartBreakGroup(o,"midroll"))};e.addEventListener("timeupdate",t),this.globalUnsubs.push(()=>e.removeEventListener("timeupdate",t));const r=()=>{this.active||this.startingBreak||(async()=>{for(this.scheduler.vmapLoadPromise&&await this.scheduler.vmapLoadPromise.catch(()=>{});!this.active&&!this.startingBreak;){const e=this.scheduler.getPostrollBreak();if(!e)break;this.ctx.events.emit("ads.mediaended",{break:{kind:"postroll",id:this.scheduler.getBreakId(e)},at:e.at}),await this._dispatchStartBreak(e,"postroll")}})()};e.addEventListener("ended",r),this.globalUnsubs.push(()=>e.removeEventListener("ended",r))}async startBreak(e,t,r){if(this.active||this.startingBreak)return;const i=this.scheduler.getBreakId(e),n=!1!==e.once;if(n&&this.scheduler.playedBreaks.has(i))return;const s=e.sources;if(s&&s.length>1){n&&this.scheduler.playedBreaks.add(i),this.startingBreak=!0,this.bus.emit("ads:break:start",{id:i,kind:t,at:e.at});try{for(let e=0;e<s.length;e++){const n=s[e],a=e===s.length-1,o=this.scheduler.isXmlString(n.src)?{kind:"xml",value:n.src}:{kind:"url",value:n.src};if(await this._dispatchPlayBreakFromVast(o,{kind:t,id:i,sourceType:n.type},{suppressResumeOnError:!a,suppressResumeOnSuccess:r?.suppressResume}))break}}finally{this.startingBreak=!1,this.bus.emit("ads:break:end",{id:i,kind:t,at:e.at})}return}const{input:a,sourceType:o}=this.scheduler.getVastInputFromBreak(e);if(a){n&&this.scheduler.playedBreaks.add(i),this.startingBreak=!0,this.bus.emit("ads:break:start",{id:i,kind:t,at:e.at});try{await this._dispatchPlayBreakFromVast(a,{kind:t,id:i,sourceType:o},{suppressResumeOnSuccess:r?.suppressResume})}finally{this.startingBreak=!1,this.bus.emit("ads:break:end",{id:i,kind:t,at:e.at})}}}async startBreakGroup(e,t){let r=!1;const i=[];for(const n of e){if("midroll"===t){const{input:e}=this.scheduler.getVastInputFromBreak(n),t="url"===e?.kind?e.value:"",i=/bumper/i.test(t)||/bumper/i.test(n.id||"");if(i&&r){this.scheduler.playedBreaks.add(this.scheduler.getBreakId(n));continue}i||(r=!0)}i.push(n)}for(let e=0;e<i.length;e++)await this._dispatchStartBreak(i[e],t,{suppressResume:e<i.length-1})}async playBreakFromVast(e,t,i){if(this.active)return!1;this.dom.ensureOverlayMounted(this.ctx.core.media);const{events:n,leases:a,core:{media:h}}=this.ctx,p="url"===e.kind?e.value:"[xml]";this.bus.emit("ads:requested",p),this.log("requested",p,t),this.resumeAfter=!1!==this.cfg.resumeContent&&"postroll"!==t.kind;const m=()=>{try{h.pause()}catch{}return n.emit("cmd:pause"),!!a.acquire("playback","ads")||(this.bus.emit("ads:error",{reason:"playback lease already owned",owner:a.owner("playback")}),this.ctx.events.emit("ads.error",{reason:"playback lease already owned",owner:a.owner("playback")}),!1)};let f=null;const g=async()=>{if(!f)try{f=this._dispatchBuildParsedForNonLinear(await this._dispatchGetVastXmlText(e))}catch{f=null}};try{let n;if("url"===e.kind)try{n=await this.vastClient.get(e.value)}catch(e){if(await g(),!f)throw e;n=await this.vastClient.parseVAST(f)}else{const t="string"==typeof e.value?r(e.value):e.value instanceof XMLDocument?e.value:r((new XMLSerializer).serializeToString(e.value));f=t,n=await this.vastClient.parseVAST(t)}this.log("vast parsed",{ads:n?.ads?.length??0,version:n?.version});const a=e=>{this.bus.emit("ads:loaded",{break:t,count:e}),this.ctx.events.emit("ads.loaded",{break:t,count:e})};if("NONLINEAR"===t.sourceType){const e=u(n);if(e.length)return a(e.length),await this.playNonLinearOnlyBreak(n,t),!0;if(await g(),f){const e=d(f);if(e.length)return a(e.length),await this.playNonLinearOnlyBreakFromXml(e,t),!0}}let p=c(n,this.cfg.preferredMediaTypes);if(this.log("linear pod items",p.length),!p.length){const e=u(n);if(e.length)return a(e.length),await this.playNonLinearOnlyBreak(n,t),!0;if(await g(),f&&(p=function(e,t){if(!e)return[];const r=Array.from(e.getElementsByTagName("Ad")),i=[];for(const e of r){const r=e.getAttribute("sequence"),n=null!=r?Number(r):void 0,a=Array.from(e.getElementsByTagName("Creative"));for(let r=0;r<a.length;r++){const o=a[r],l=o.getElementsByTagName("Linear")?.[0];if(!l)continue;const c=l.getAttribute("skipoffset")||l.getAttribute("skipOffset")||void 0,u=l.getElementsByTagName("MediaFiles")?.[0];if(!u)continue;const d=Array.from(u.getElementsByTagName("MediaFile")).map(e=>({type:e.getAttribute("type")||"",mimeType:e.getAttribute("type")||"",bitrate:Number(e.getAttribute("bitrate")||0),bitRate:Number(e.getAttribute("bitRate")||0),width:Number(e.getAttribute("width")||0),height:Number(e.getAttribute("height")||0),fileURL:(e.textContent||"").trim(),url:(e.textContent||"").trim(),rawEl:e})),h=s(d,t);h&&i.push({ad:{id:e.getAttribute("id")||void 0},creative:{linear:{MediaFiles:d}},mediaFile:h,sequence:Number.isFinite(n)?n:void 0,creativeIndex:r,skipOffset:c||void 0})}}return i.sort((e,t)=>{const r=e.sequence??Number.MAX_SAFE_INTEGER,i=t.sequence??Number.MAX_SAFE_INTEGER;return r!==i?r-i:(e.creativeIndex??0)-(t.creativeIndex??0)})}(f,this.cfg.preferredMediaTypes),this.log("linear pod items (xml fallback)",p.length),!p.length)){const e=d(f);if(e.length)return a(e.length),await this.playNonLinearOnlyBreakFromXml(e,t),!0}}if(!p.length)throw this.warn("no playable ads found in VAST response"),new Error("No playable ads found in VAST response");if(a(p.length),!m())return!1;this.active=!0;const v=function(e,t){const r=[],i=l(e);for(const e of i){const t=e?.adVerifications||e?.AdVerifications||[];for(const e of t){const t=String(e?.vendor||e?.Vendor||""),i=e?.resource||e?.resources||e?.JavaScriptResource||e?.javaScriptResource||(e?.javascriptResource?[e.javascriptResource]:[]),n=Array.isArray(i)?i:[i];for(const i of n){const n=String(i?.uri||i?.url||i?.browserOptional?.value||i?.value||i||"").trim();if(!n)continue;const s=String(e?.verificationParameters?.value||e?.parameters||e?.params||"");r.push({vendor:t,scriptUrl:n,params:s})}}}if(r.length>0)return r;if(t){const e=(e,t)=>{try{return Array.from(e.getElementsByTagNameNS("*",t))}catch{}try{return Array.from(e.getElementsByTagName(t))}catch{return[]}},i=e(t,"Verification");for(const t of i){const i=t.getAttribute("vendor")||"",n=e(t,"JavaScriptResource");for(const e of n){const n=(e.textContent||"").trim();if(!n)continue;const s=t.querySelector("VerificationParameters"),a=(s?.textContent||"").trim();r.push({vendor:i,scriptUrl:n,params:a})}}}return r}(n,f);be.isAvailable()&&v.length&&(v.forEach(e=>{e.scriptUrl&&be.injectVerificationScript(e.scriptUrl,e.params)}),this.omidSession=new be(h,v,this.cfg.omid?.accessMode));for(let e=0;e<p.length;e++){const r=p[e];this.bus.emit("ads:ad:start",{break:t,index:e,sequence:r.sequence}),this.clearSession(),this.tracker=new fe(this.vastClient,r.ad,r.creative),this._lastCreative=r.creative,this.log("mount ad video",{url:r.mediaFile?.fileURL,type:r.mediaFile?.type,skipOffset:r.skipOffset}),this._dispatchMountAdVideo(h,r.mediaFile,r.creative);const i=this.waitForAdEnd();this.dom.setupSkipUIForPodItem(r,this.log.bind(this)),this.log("skip ui",{raw:this.dom.skipOffsetRaw,at:this.dom.skipAtSeconds}),this.dom.mountCompanions(r.creative),this.dom.mountNonLinear(r.creative);const n=o(r.creative,f);if(n&&this.adVideo){const e=this.dom.mountSimidIframe(n),i=r.creative?.videoClickThroughURLTemplate?.url??r.creative?.videoClickThroughURLTemplate??r.creative?.videoClicks?.clickThrough??"",s={adParameters:String(r.creative?.linear?.adParameters?.value??r.creative?.adParameters?.value??""),clickThruUri:"string"==typeof i?i:String(i||"")};this.simidSession=new at(e,this.adVideo,{onSkip:()=>this.requestSkip("api"),onStop:()=>{const e=this.adVideo;if(e)try{e.dispatchEvent(new Event("ended"))}catch{}},onPause:()=>this.ctx.events.emit("cmd:pause"),onPlay:()=>this.ctx.events.emit("cmd:play"),onClickThrough:e=>{this.dom.safeWindowOpen(e);try{this.tracker?.trackClick?.()}catch{}this.bus.emit("ads:clickthrough",{break:t,url:e}),this.ctx.events.emit("ads.click",{break:t,url:e})},onTrackingEvent:(e,r)=>{this.bus.emit("ads:impression",{break:t,event:e})},onFatal:(e,t)=>{this.simidSession?.destroy(),this.simidSession=void 0},onRequestChangeAdDuration:(e,t,r)=>{t();const i=this.adVideo;i&&Number.isFinite(i.duration)&&this.simidSession?.adDurationChange(i.duration+e)}},s),this.sessionUnsubs.push(()=>{this.simidSession?.destroy(),this.simidSession=void 0})}this.cfg.allowNativeControls||this.bindAdSurfaceCommands(),this.tracker?.trackImpression?.(),this.omidSession?.impression(),this.bus.emit("ads:impression",{break:t,index:e}),this.bindTrackerAndTelemetry({kind:t.kind,breakId:t.id}),this._dispatchStartAdPlayback(),await i,this.bus.emit("ads:ad:end",{break:t,index:e,sequence:r.sequence})}this.bus.emit("ads:allAdsCompleted",{break:t}),this.ctx.events.emit("ads.allAdsCompleted",{break:t});const b=this.overlay&&this.overlay.querySelector(".op-ads__sr-announcer");return b&&(b.textContent=this.cfg.labels?.adEnded||"Advertisement ended"),this.finish({resume:"postroll"!==t.kind&&(this.userPlayIntent||this.resumeAfter),suppressResume:i?.suppressResumeOnSuccess}),!0}catch(e){return this.bus.emit("ads:error",e),this.ctx.events.emit("ads.error",{err:e}),this.finish({resume:"postroll"!==t.kind&&(this.userPlayIntent||this.resumeAfter),suppressResume:i?.suppressResumeOnError}),!1}}async playNonLinearOnlyBreak(e,t){if(this.dom.ensureOverlayMounted(this.ctx.core.media),this.overlay.replaceChildren(),this.overlay.style.display="block",!this.overlay.querySelector(".op-ads__sr-announcer")){const e=document.createElement("div");e.className="op-ads__sr-announcer op-player__sr-only",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.textContent="Advertisement",this.overlay.appendChild(e)}if(this.active=!0,!this.overlay.querySelector(".op-ads__sr-announcer")){const e=document.createElement("div");e.className="op-ads__sr-announcer op-player__sr-only",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-atomic","true"),e.textContent=this.cfg.labels?.advertisement||"Advertisement",this.overlay.appendChild(e)}const r=u(e);if(!r.length)return;let i=0;for(let e=0;e<r.length;e++){const n=r[e];try{this.tracker=new fe(this.vastClient,n.ad,n.creative)}catch{this.tracker=void 0}this._lastCreative=n.creative;const s=n.ad?.creatives?.find(e=>"companion"===e?.type)??n.creative;this.dom.mountCompanions(s),this.dom.ensureNonLinearDom();const a=this.dom.renderNonLinear(n.nonLinear);a&&this.dom.nonLinearWrap.appendChild(a);try{this.tracker?.trackImpression?.(),this.tracker?.trackCreativeView?.()}catch{}this.bus.emit("ads:impression",{break:t,index:e}),this.bus.emit("ads:ad:start",{break:t,index:e,sequence:n.sequence}),i=Math.max(i,this.dom.nonLinearSuggestedDurationSeconds(n.nonLinear))}this.active=!1,this.ctx.events.emit("cmd:play"),this.dismissNonLinear(r,t,i)}async playNonLinearOnlyBreakFromXml(e,t){this.dom.ensureOverlayMounted(this.ctx.core.media),this.dom.clearAdOverlays(),this.overlay.replaceChildren(),this.overlay.style.display="block",this.active=!0;let r=0;for(let i=0;i<e.length;i++){const n=e[i];n.companions?.length&&this.dom.mountCompanions({companions:n.companions,companionAds:{companions:n.companions}}),this.dom.ensureNonLinearDom();const s=this.dom.renderNonLinear(n.nonLinear);s&&this.dom.nonLinearWrap.appendChild(s),r=Math.max(r,this.dom.nonLinearSuggestedDurationSeconds(n.nonLinear)),this.bus.emit("ads:impression",{break:t,index:i}),this.bus.emit("ads:ad:start",{break:t,index:i})}this.active=!1,this.ctx.events.emit("cmd:play"),this.dismissNonLinear(e,t,r)}async dismissNonLinear(e,t,r){const i=Date.now();await new Promise(e=>{const t=()=>{const n=(Date.now()-i)/1e3;!this.dom.nonLinearWrap?.querySelector(".op-ads__nonlinear-item")||n>=r?e():setTimeout(t,50)};t()});for(let r=0;r<e.length;r++)this.bus.emit("ads:ad:end",{break:t,index:r});this.clearSession(),this.overlay.style.display="none",this.overlay.replaceChildren(),this.currentBreakMeta=void 0}mountAdVideo(t,r,i){this.dom.ensureOverlayMounted(t);const n=this.overlay.parentElement;this.overlay.replaceChildren(),this.overlay.style.display="block",this.contentMedia=t,this.captionMgr.captureActiveCaptionTrack(t);const s=document.createElement("video");s.className="op-ads__media",s.playsInline=!0;const a=(t.getAttribute("preload")||t.preload||"").toLowerCase(),o=!!t.autoplay&&!this.ctx.core.userInteracted;s.preload="none"===a?"metadata":"auto",s.controls=this.cfg.allowNativeControls,s.style.width="100%",s.style.height="100%";const l=this.ctx.core.getPlugin?.("hls-engine");if(l?.canPlay({src:r.fileURL})&&l.attachMedia)this.adEngineDetach=l.attachMedia(s,r.fileURL);else{s.src=r.fileURL;try{s.load()}catch{}}const c=!!o||this.ctx.core.muted,u=o?0:this.ctx.core.volume;s.muted=c,s.defaultMuted=c,Number.isFinite(u)&&(s.volume=Math.max(0,Math.min(1,u))),this.adEndPromise=new Promise(e=>{const t=()=>{if(this.adVideo===s){try{s.pause()}catch{}s.remove(),this.adVideo=void 0}else s.remove()},r=()=>{this.ctx.events.emit("ended"),t(),e()},i=()=>{t(),e()};s.addEventListener("ended",r,{once:!0}),s.addEventListener("error",i,{once:!0}),this.sessionUnsubs.push(()=>s.removeEventListener("ended",r)),this.sessionUnsubs.push(()=>s.removeEventListener("error",i))}),this.overlay.appendChild(s),this.adVideo=s;const d=()=>{if("visible"!==document.visibilityState)return;const e=this.adVideo;if(e&&e.paused&&!e.ended)try{const t=e.play?.();t&&"function"==typeof t.catch&&t.catch(()=>{})}catch{}};document.addEventListener("visibilitychange",d),this.sessionUnsubs.push(()=>document.removeEventListener("visibilitychange",d));const h=this.captionMgr.attachAdCaptionTracks(s,r.raw,i);this.sessionUnsubs.push(()=>{h.forEach(e=>e.remove())});let p=null;try{p=e.getOverlayManager(this.ctx.core),p.activate({id:"ads",priority:100,mode:"countdown",canSeek:!1,duration:0,value:0,label:"Ad",fullscreenEl:n,fullscreenVideoEl:s})}catch{}const m=()=>{if(!p)return;const e=s.duration,t=s.currentTime;!Number.isFinite(e)||e<=0||!Number.isFinite(t)||p.update(this.overlayId,{duration:e,value:Math.max(0,e-t),mode:"countdown",canSeek:!1,fullscreenEl:n,fullscreenVideoEl:s})};s.addEventListener("loadedmetadata",m),s.addEventListener("timeupdate",m),this.sessionUnsubs.push(()=>s.removeEventListener("loadedmetadata",m)),this.sessionUnsubs.push(()=>s.removeEventListener("timeupdate",m))}bindAdSurfaceCommands(){const{events:e}=this.ctx,t=()=>this.adVideo;this.sessionUnsubs.push(e.on("cmd:play",()=>{const e=Boolean(this.contentMedia?.autoplay);if(!this.userPlayIntent&&e&&!this.ctx.core.userInteracted){this.forcedMuteUntilInteraction=!0;try{t()&&(t().muted=!0,t().volume=0)}catch{}}else{this.forcedMuteUntilInteraction=!1;try{t()&&(t().muted=this.ctx.core.muted,t().volume=this.ctx.core.volume)}catch{}}t()?.play().catch(()=>{})})),this.sessionUnsubs.push(e.on("cmd:pause",()=>t()?.pause())),this.sessionUnsubs.push(e.on("cmd:setVolume",e=>{const r=Number(e);Number.isFinite(r)&&t()&&!this.syncingVolume&&!this.forcedMuteUntilInteraction&&(t().volume=r)})),this.sessionUnsubs.push(e.on("cmd:setMuted",e=>{if(t()&&!this.syncingVolume)return this.forcedMuteUntilInteraction&&!this.ctx.core.userInteracted?(t().muted=!0,void(t().volume=0)):void(t().muted=Boolean(e))}))}bindTrackerAndTelemetry(e){this.currentBreakMeta=e;const t=this.adVideo;let r=!1,i=t.muted||0===t.volume,n=t.paused,s=!1,a=!1,o=!1,l=!1;const c=()=>{const r=t.duration;Number.isFinite(r)&&r>0&&(this.bus.emit("ads:duration",{break:e,duration:r}),this.ctx.events.emit("ads.durationChange",{duration:r,break:e}))},u=t=>{this.bus.emit("ads:quartile",{break:e,quartile:t}),25===t&&(this.ctx.events.emit("ads.firstQuartile",{break:e}),this.omidSession?.firstQuartile()),50===t&&(this.ctx.events.emit("ads.midpoint",{break:e}),this.omidSession?.midpoint()),75===t&&(this.ctx.events.emit("ads.thirdQuartile",{break:e}),this.omidSession?.thirdQuartile()),100===t&&(this.ctx.events.emit("ads.complete",{break:e}),this.omidSession?.complete())},d=()=>{if(r)n&&(this.tracker?.trackResume?.(),this.bus.emit("ads:resume",{break:e}),this.ctx.events.emit("ads.resume",{break:e}),this.omidSession?.resume(),this.simidSession?.resume());else{r=!0,this.tracker?.trackStart?.(),this.ctx.events.emit("play"),this.ctx.events.emit("ads.start",{break:e}),u(0),c();const i=t.duration,n=t.muted?0:Number.isFinite(t.volume)?t.volume:1;this.omidSession?.loaded(),this.omidSession?.start(Number.isFinite(i)?i:0,n),this.simidSession?.progress(t.currentTime,Number.isFinite(i)?i:0)}this.ctx.events.emit("playing"),n=!1},h=()=>{r&&(this.tracker?.trackPause?.(),this.omidSession?.pause(),this.simidSession?.pause()),n=!0,this.bus.emit("ads:pause",{break:e}),this.ctx.events.emit("pause"),this.ctx.events.emit("ads.pause",{break:e})},p=()=>{const r=t.duration,i=t.currentTime;if(!Number.isFinite(r)||r<=0||!Number.isFinite(i))return;c();const n=Math.max(0,r-i);this.bus.emit("ads:timeupdate",{break:e,currentTime:i,remainingTime:n,duration:r}),this.ctx.events.emit("ads.adProgress",{currentTime:i,duration:r,break:e}),this.tracker?.setDuration?.(r),this.tracker?.setProgress?.(i),this.simidSession?.progress(i,r);const d=i/r;!s&&d>=.25&&(s=!0,this.tracker?.trackFirstQuartile?.(),u(25)),!a&&d>=.5&&(a=!0,this.tracker?.trackMidpoint?.(),u(50)),!o&&d>=.75&&(o=!0,this.tracker?.trackThirdQuartile?.(),u(75)),!l&&d>=.999&&(l=!0,this.tracker?.trackComplete?.(),u(100))},m=()=>{const r=t.volume,n=t.muted||0===t.volume;if(this.bus.emit("ads:volumeChange",{break:e,volume:r,muted:n}),this.ctx.events.emit("ads.volumeChange",{volume:r,muted:n,break:e}),this.omidSession?.volumeChange(n?0:r),this.simidSession?.volumeChange(r,n),n!==i&&(i=n,n?(this.tracker?.trackMute?.(),this.bus.emit("ads:mute",{break:e})):(this.tracker?.trackUnmute?.(),this.bus.emit("ads:unmute",{break:e}))),(!this.forcedMuteUntilInteraction||this.ctx.core.userInteracted)&&!this.syncingVolume)try{this.syncingVolume=!0,this.ctx.core.muted=n,Number.isFinite(r)&&(this.ctx.core.volume=Math.max(0,Math.min(1,r)))}catch{}finally{this.syncingVolume=!1}},f=t=>{if(t.defaultPrevented)return;const r=this._lastCreative,i=r?.videoClickThroughURLTemplate||r?.videoClicks?.clickThrough||r?.videoClicks?.clickThroughURLTemplate;if(!i)return;const n="string"==typeof i?i:i.url;this.dom.safeWindowOpen(n),this.tracker?.trackClick?.(),this.tracker?.trackClickThrough?.(),this.bus.emit("ads:clickthrough",{break:e,url:i}),this.ctx.events.emit("ads.click",{break:e,url:i})};t.addEventListener("playing",d),t.addEventListener("pause",h),t.addEventListener("timeupdate",p),t.addEventListener("volumechange",m),t.addEventListener("click",f),t.addEventListener("loadedmetadata",c),this.sessionUnsubs.push(()=>t.removeEventListener("playing",d)),this.sessionUnsubs.push(()=>t.removeEventListener("pause",h)),this.sessionUnsubs.push(()=>t.removeEventListener("timeupdate",p)),this.sessionUnsubs.push(()=>t.removeEventListener("volumechange",m)),this.sessionUnsubs.push(()=>t.removeEventListener("click",f)),this.sessionUnsubs.push(()=>t.removeEventListener("loadedmetadata",c))}startAdPlayback(){const e=this.adVideo;if(this.ctx.events.emit("play"),!e)return;const t=t=>{try{t&&(e.muted=!0,e.volume=0,this.forcedMuteUntilInteraction=!0);const r=e.play?.();return r&&"function"==typeof r.then?r:void 0}catch{return}},r=t(!1);r&&r.catch(()=>{const e=t(!0);e&&e.catch(()=>{})})}waitForAdEnd(){return this.adEndPromise||Promise.resolve()}clearSession(){this.dom.clearSession();for(const e of this.sessionUnsubs)e();if(this.sessionUnsubs=[],this.tracker=void 0,this.adEngineDetach&&(this.adEngineDetach(),this.adEngineDetach=void 0),this.adVideo){try{this.adVideo.pause()}catch{}this.adVideo.remove(),this.adVideo=void 0}try{this.overlay.querySelectorAll("video.op-ads__media").forEach(e=>e?.parentNode?.removeChild?.(e)??e.remove?.())}catch{}this.adEndPromise=null,this.captionMgr.removeAdCaptions(),this.overlay.replaceChildren()}finish(t){const{events:r,leases:i}=this.ctx;this.clearSession(),this.contentMedia&&this.contentHadControls&&this.contentMedia.setAttribute("controls",""),this.contentMedia=void 0,this.contentHadControls=!1,this.overlay.style.display="none",this.overlay.replaceChildren(),i.release("playback","ads"),this.active=!1;const n=!!(t.resume||this.userPlayIntent||this.resumeAfter);this.userPlayIntent=!1,this.captionMgr.restoreActiveTextTrack(this.ctx?.core?.media);try{e.getOverlayManager(this.ctx.core).deactivate(this.overlayId)}catch{}this.omidSession?.destroy(),this.omidSession=void 0,t.suppressResume||(n?r.emit("cmd:play"):r.emit("cmd:pause"))}log(...e){this.cfg?.debug&&console.debug("[player][ads]",...e)}warn(...e){this.cfg?.debug&&console.warn("[player][ads]",...e)}getVastXmlText(e){return i(e)}buildParsedForNonLinearFromXml(e){return r(e)}computeSkipAtSecondsDelegate(e,t){return n(e,t)}collectPodAdsDelegate(e){return c(e,this.cfg?.preferredMediaTypes)}getPrerollBreak(){return this.scheduler.getPrerollBreak()}getBreakId(e){return this.scheduler?this.scheduler.getBreakId(e):k(e)}async loadVmapAndMerge(e,t){return this.scheduler.loadVmapAndMerge(e,t)}get resolvedBreaks(){return this.scheduler?.resolvedBreaks}set resolvedBreaks(e){this.scheduler&&(this.scheduler.resolvedBreaks=e)}get pendingPercentBreaks(){return this.scheduler?.pendingPercentBreaks}set pendingPercentBreaks(e){this.scheduler&&(this.scheduler.pendingPercentBreaks=e)}get playedBreaks(){return this.scheduler?.playedBreaks}get vmapPending(){return this.scheduler?.vmapPending}get vmapLoadPromise(){return this.scheduler?.vmapLoadPromise}get pendingVmapSrc(){return this.scheduler?.pendingVmapSrc}isXmlString(e){return this.scheduler?.isXmlString(e)}ensureOverlayMounted(){return this.dom.ensureOverlayMounted(this.ctx.core.media)}mountCompanions(e){return this.dom.mountCompanions(e)}renderCompanion(e){return this.dom.renderCompanion(e)}renderNonLinear(e){return this.dom.renderNonLinear(e)}ensureRawCaptions(e,t){return this.captionMgr.ensureRawCaptions(e,t)}attachAdCaptionTracks(e,t,r){return this.captionMgr.attachAdCaptionTracks(e,t,r)}}class ut extends ct{constructor(){super(...arguments),Object.defineProperty(this,"mode",{enumerable:!0,configurable:!0,writable:!0,value:"hybrid"})}}function dt(e){let t;if("string"==typeof e){const r=e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e;try{const e=atob(r);t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r)}catch{return null}}else t=e instanceof Uint8Array?e:new Uint8Array(e);let r=0;for(;r<t.length&&252!==t[r];)r++;if(r+14>t.length)return null;const i=t[r+13];if(5===i){if(r+15>t.length)return null;const e=t[r+14],i=!!(128&e);if(!!!(2&e))return{type:"splice_insert",outOfNetwork:i,durationSecs:null,autoReturn:!1};if(r+24>t.length)return null;const n=t[r+19],s=!!(128&n);return{type:"splice_insert",outOfNetwork:i,durationSecs:((1&n)*2**32+t[r+20]*2**24+65536*t[r+21]+256*t[r+22]+t[r+23])/9e4,autoReturn:s}}return 6===i?{type:"time_signal"}:{type:"unknown",commandType:i}}class ht{constructor(){Object.defineProperty(this,"mode",{enumerable:!0,configurable:!0,writable:!0,value:"ssai"}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sink",{enumerable:!0,configurable:!0,writable:!0,value:()=>{}}),Object.defineProperty(this,"boundTracks",{enumerable:!0,configurable:!0,writable:!0,value:new Set}),Object.defineProperty(this,"activeBreaks",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"cleanups",{enumerable:!0,configurable:!0,writable:!0,value:[]})}init(e,t){this.ctx=e,this.sink=t.ssai?.eventSink??t.eventSink??(()=>{});const{media:r}=e.core;this.scanTracks(r);const i=e=>{const t=e.track;"metadata"===t?.kind&&this.bindTrack(t)};r.textTracks.addEventListener("addtrack",i),this.cleanups.push(()=>r.textTracks.removeEventListener("addtrack",i));const n=e.on("texttrack:listchange",()=>this.scanTracks(r));this.cleanups.push(n);const s=()=>this.checkQuartiles(r.currentTime);r.addEventListener("timeupdate",s),this.cleanups.push(()=>r.removeEventListener("timeupdate",s))}destroy(){for(const e of this.cleanups)e();this.cleanups=[],this.boundTracks.clear(),this.activeBreaks.clear()}scanTracks(e){for(const t of e.textTracks)"metadata"===t.kind&&this.bindTrack(t)}bindTrack(e){if(this.boundTracks.has(e))return;this.boundTracks.add(e),e.mode="hidden";const t=()=>this.handleActiveCues(e);e.addEventListener("cuechange",t),this.cleanups.push(()=>e.removeEventListener("cuechange",t))}handleActiveCues(e){const t=e.activeCues;if(t)for(const e of t)this.processCue(e)}processCue(e){const t=e,r=e.id||String(e.startTime);if(t.data instanceof ArrayBuffer){const i=dt(t.data);if(!i||"splice_insert"!==i.type)return;return void(i.outOfNetwork?this.startBreak(r,i.durationSecs,e.startTime):this.endBreak(r))}const i=t.value;if("SCTE35-OUT"===i?.key&&i.data instanceof ArrayBuffer){const t=dt(i.data);if(!t||"splice_insert"!==t.type||!t.outOfNetwork)return;const n=isFinite(e.endTime)&&e.endTime>e.startTime?e.endTime-e.startTime:t.durationSecs;return void this.startBreak(r,n,e.startTime)}if("SCTE35-IN"===i?.key){const e=this.activeBreaks.has(r)?r:r.endsWith("-in")?r.slice(0,-3):r;return void this.endBreak(e)}const n=null!=t.scte35Out||null!=t.attr?.["SCTE35-OUT"],s=null!=t.scte35In||null!=t.attr?.["SCTE35-IN"];if(n){const t=isFinite(e.endTime)&&e.endTime>e.startTime?e.endTime-e.startTime:null;return void this.startBreak(r,t,e.startTime)}if(s){const e=this.activeBreaks.has(r)?r:r.endsWith("-in")?r.slice(0,-3):r;return void this.endBreak(e)}const a=t.value;if(a instanceof ArrayBuffer||a instanceof Uint8Array||"string"==typeof a){const t=dt(a);if(!t||"splice_insert"!==t.type)return;if(t.outOfNetwork){const i=isFinite(e.endTime)&&e.endTime>e.startTime?e.endTime-e.startTime:t.durationSecs;this.startBreak(r,i,e.startTime)}else{const e=this.activeBreaks.has(r)?r:r.endsWith("-in")?r.slice(0,-3):r;this.endBreak(e)}}}startBreak(e,t,r){if(this.activeBreaks.has(e))return;const i={id:e,startTimeSec:r,durationSec:t,firedQuartiles:new Set};this.activeBreaks.set(e,i),this.ctx.events.emit("ads:break:start",{id:e,kind:"ssai"}),this.sink({type:"impression",breakId:e,contentSrc:this.ctx.core.media?.src})}endBreak(e){this.activeBreaks.get(e)&&(this.activeBreaks.delete(e),this.ctx.events.emit("ads:break:end",{id:e,kind:"ssai"}),this.sink({type:"complete",breakId:e}))}checkQuartiles(e){for(const t of this.activeBreaks.values()){if(null===t.durationSec||t.durationSec<=0)continue;const r=e-t.startTimeSec,i=r/t.durationSec*100;for(const e of[25,50,75,100])i>=e&&!t.firedQuartiles.has(e)&&(t.firedQuartiles.add(e),this.ctx.events.emit("ads:quartile",{breakId:t.id,quartile:e}),this.sink({type:"quartile",breakId:t.id,elapsedSec:r,metadata:{quartile:e}}));i>=100&&this.endBreak(t.id)}}}class pt{constructor(e={}){Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ads"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"1.0.0"}),Object.defineProperty(this,"capabilities",{enumerable:!0,configurable:!0,writable:!0,value:["ads"]}),Object.defineProperty(this,"rawConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"strategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"scteUnsub",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_lazyDom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.rawConfig=e}setup(e){const t=this.rawConfig,r=!!(t.hybrid?.scteSource??t.scteSource),i=t.adDelivery??(r?"hybrid":"csai");if(this.strategy="ssai"===i?new ht:"hybrid"===i?new ut:new ct,this.strategy.init(e,t),this.csai&&(this.csai._dispatchStartBreak=(e,t,r)=>this.startBreak(e,t,r),this.csai._dispatchStartBreakGroup=(e,t)=>this.startBreakGroup(e,t),this.csai._dispatchPlayBreakFromVast=(...e)=>this.playBreakFromVast(...e),this.csai._dispatchGetVastXmlText=(...e)=>Promise.resolve(this.getVastXmlText(...e)),this.csai._dispatchBuildParsedForNonLinear=(...e)=>this.buildParsedForNonLinearFromXml(...e),this.csai._dispatchMountAdVideo=(...e)=>this.mountAdVideo(...e),this.csai._dispatchStartAdPlayback=()=>this.startAdPlayback()),"ssai"!==i){const e=t.hybrid?.scteSource??t.scteSource,r=t.hybrid?.resolveScteUrl??t.resolveScteUrl;e&&r&&this.bindScteSource(e,r)}}async playAds(e){const t=this.csai?.scheduler?.inferSourceTypeForUrl(e);return this.playBreakFromVast({kind:"url",value:e},{kind:"manual",id:"manual",sourceType:t})}async playAdsFromXml(e){return this.playBreakFromVast({kind:"xml",value:e},{kind:"manual",id:"manual"})}getDueMidrollBreaks(e){return this.strategy?.getDueMidrollBreaks?.(e)??[]}getDueMidrollBreak(e){return this.strategy?.getDueMidrollBreak?.(e)}requestSkip(e="api"){this.strategy?.requestSkip?.(e)}destroy(){this.scteUnsub?.(),this.scteUnsub=void 0,this.strategy?.destroy(),this.strategy=void 0}bindScteSource(e,t){const r=e.onCue;e.onCue=e=>{r?.(e),Promise.resolve(t(e)).then(e=>{e&&this.playAds(e)})},this.scteUnsub=()=>{e.onCue=r}}get csai(){return this.strategy instanceof ct?this.strategy:void 0}get lazyDom(){if(!this._lazyDom){const e=document.createElement("div");this._lazyDom=new p(e,this.rawConfig,()=>{},()=>{},()=>{})}return this._lazyDom}get bus(){return this.csai?.bus}get tracker(){return this.csai?.tracker}get active(){return this.csai?.active}set active(e){this.csai&&void 0!==e&&(this.csai.active=e)}get overlay(){return this.csai?.overlay}get ctx(){return this.csai?.ctx}get sessionUnsubs(){return this.csai?.sessionUnsubs}set sessionUnsubs(e){this.csai&&void 0!==e&&(this.csai.sessionUnsubs=e)}get resumeAfter(){return this.csai?.resumeAfter}get globalUnsubs(){return this.csai?.globalUnsubs??[]}get adVideo(){return this.csai?.adVideo}set adVideo(e){this.csai&&(this.csai.adVideo=e)}get forcedMuteUntilInteraction(){return this.csai?.forcedMuteUntilInteraction??!1}set forcedMuteUntilInteraction(e){this.csai&&(this.csai.forcedMuteUntilInteraction=e)}clearSession(){return this.csai?.clearSession()}startAdPlayback(){return this.csai?.startAdPlayback()}mountAdVideo(...e){return this.csai?.mountAdVideo(...e)}get vastClient(){return this.csai?.vastClient}set vastClient(e){this.csai&&(this.csai.vastClient=e)}shouldInterceptPreroll(){return this.csai?.shouldInterceptPreroll()}startBreak(...e){return this.csai?.startBreak(...e)}startBreakGroup(...e){return this.csai?.startBreakGroup(...e)}async playBreakFromVast(...e){return!!this.csai&&await this.csai.playBreakFromVast(...e)}getVastXmlText(e){return i(e)}normalizeVmapAdSource(e){return function(e){if(e)return Array.isArray(e)?e.find(e=>e?.adTagURI||e?.vastAdData)||e[0]:e}(e)}extractVastTagUri(e){return function(e){if(e){if("string"==typeof e)return e.trim()||void 0;if("object"==typeof e){const t=e.uri||e.URI||e.value||e.text||e["#text"];if("string"==typeof t&&t.trim())return t.trim()}}}(e)}parseVmapTimeOffset(e){return function(e){const t=String(e||"").trim();if(!t||"start"===t)return{at:"preroll"};if("end"===t)return{at:"postroll"};if(t.endsWith("%")){const e=Number(t.slice(0,-1));if(Number.isFinite(e)&&e>=0&&e<=100)return{at:0,pendingPercent:e/100}}const r=/^(\d+):(\d+):(\d+(?:\.\d+)?)$/.exec(t);if(r){const e=Number(r[1]),t=Number(r[2]),i=Number(r[3]);if([e,t,i].every(e=>Number.isFinite(e)))return{at:3600*e+60*t+i}}const i=Number(t);return Number.isFinite(i)&&i>=0?{at:i}:{at:"preroll"}}(e)}getVastInputFromBreak(e){return T(e)}setSafeHTML(e,t){return function(e,t){const r=document.createElement("template");r.innerHTML=String(t||"");const i=new Set(["SCRIPT","IFRAME","OBJECT","EMBED","LINK","STYLE","SVG","MATH","FORM","INPUT","TEXTAREA","SELECT","OPTION","META","BASE"]),n=document.createTreeWalker(r.content,NodeFilter.SHOW_ELEMENT),s=[];for(;n.nextNode();){const e=n.currentNode;i.has(e.tagName)?s.push(e):Array.from(e.attributes).forEach(t=>{const r=t.name.toLowerCase(),i=(t.value||"").trim();if(r.startsWith("on")&&e.removeAttribute(t.name),"href"===r||"src"===r||"xlink:href"===r){const r=i.toLowerCase(),n=r.startsWith("javascript:"),s=r.startsWith("vbscript:"),a=r.startsWith("data:"),o=r.startsWith("http://")||r.startsWith("https://")||r.startsWith("/")||r.startsWith("./"),l=a&&/^data:image\/(png|gif|jpe?g|webp|svg\+xml);/i.test(i);(n||s||!o&&!l)&&e.removeAttribute(t.name)}"srcdoc"===r&&e.removeAttribute(t.name)})}s.forEach(e=>e.remove()),e.replaceChildren(r.content.cloneNode(!0))}(e,t)}collectNonLinearCreatives(e){return u(e)}collectNonLinearFromXml(e){return d(e)}buildParsedForNonLinearFromXml(e){return r(e)}computeSkipAtSeconds(e,t){return n(e,t)}collectPodAds(e){return c(e,this.csai?.cfg?.preferredMediaTypes??[])}getPrerollBreak(){return this.csai?.getPrerollBreak()}getBreakId(e){return this.csai?.getBreakId(e)??k(e)}async loadVmapAndMerge(e,t){return this.csai?.loadVmapAndMerge(e,t)}get resolvedBreaks(){return this.csai?.resolvedBreaks}set resolvedBreaks(e){this.csai&&void 0!==e&&(this.csai.resolvedBreaks=e)}get pendingPercentBreaks(){return this.csai?.pendingPercentBreaks}set pendingPercentBreaks(e){this.csai&&void 0!==e&&(this.csai.pendingPercentBreaks=e)}get playedBreaks(){return this.csai?.playedBreaks}get vmapPending(){return this.csai?.vmapPending}get vmapLoadPromise(){return this.csai?.vmapLoadPromise}get pendingVmapSrc(){return this.csai?.pendingVmapSrc}isXmlString(e){return this.csai?.isXmlString(e)}ensureOverlayMounted(){return this.csai?.ensureOverlayMounted()}mountCompanions(e){return(this.csai?.dom??this.lazyDom).mountCompanions(e)}renderCompanion(e){return(this.csai?.dom??this.lazyDom).renderCompanion(e)}renderNonLinear(e){return(this.csai?.dom??this.lazyDom).renderNonLinear(e)}ensureRawCaptions(e,t){return this.csai?.ensureRawCaptions(e,t)}attachAdCaptionTracks(e,t,r){return this.csai?.attachAdCaptionTracks(e,t,r)}}var mt;function ft(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(mt=window).OpenPlayerPlugins=mt.OpenPlayerPlugins||{},mt.OpenPlayerPlugins.ads={name:"ads",kind:"plugin",factory:e=>new pt({...e||{},allowNativeControls:!1}),install:e=>function(e){e&&e.prototype&&(Object.getOwnPropertyDescriptor(e.prototype,"ads")||Object.defineProperty(e.prototype,"ads",{configurable:!0,enumerable:!1,get(){return this.getPlugin?.("ads")}}),"function"!=typeof e.prototype.playAds&&Object.defineProperty(e.prototype,"playAds",{configurable:!0,enumerable:!1,value:function(e){const t=this.getPlugin?.("ads")||this.ads;if(!t)throw new Error("Ads plugin not installed; cannot playAds()");const r=String(e??"").trim();if(!r)throw new Error("playAds(input) requires a non-empty URL or VAST XML string");if(r.startsWith("<")){if("function"!=typeof t.playAdsFromXml)throw new Error("Ads plugin does not support XML input (playAdsFromXml missing)");return t.playAdsFromXml(r)}return t.playAds(r)}}))}(e),extend:(e,t)=>function(e,t){e&&("function"==typeof e.extend?e.extend({ads:t}):void 0===e.ads&&(e.ads=t))}(e,t)},function(e){var t;(t=e.OpenPlayerJS)&&!t.prototype.playAds&&(t.prototype.playAds=function(e){const t="function"==typeof this.getCore?this.getCore():null;if(!t)throw new Error("Call player.init() before player.playAds()");const r="function"==typeof t.getPlugin?t.getPlugin("ads"):null;if(!r)throw new Error("Ads plugin not installed");const i=String(e??"").trim();if(!i)throw new Error("playAds(input) requires a non-empty URL or VAST XML string");return i.startsWith("<")?r.playAdsFromXml(i):r.playAds(i)})}(window);var gt,vt={},bt={};function yt(){if(gt)return bt;function e(e,t){return void 0===t&&(t=Object),t&&"function"==typeof t.getOwnPropertyDescriptors&&(e=t.create(null,t.getOwnPropertyDescriptors(e))),t&&"function"==typeof t.freeze?t.freeze(e):e}function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}gt=1;var r=e({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});var i=e({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});var n=e({script:!1,style:!1,textarea:!0,title:!0});function s(e){return e===a.HTML}var a=e({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),o=Object.keys(a).map(function(e){return a[e]});var l=e({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return bt.assign=function(e,r){if(null===e||"object"!=typeof e)throw new TypeError("target is not an object");for(var i in r)t(r,i)&&(e[i]=r[i]);return e},bt.find=function(e,r,i){if(void 0===i&&(i=Array.prototype),e&&"function"==typeof i.find)return i.find.call(e,r);for(var n=0;n<e.length;n++)if(t(e,n)){var s=e[n];if(r.call(void 0,s,n,e))return s}},bt.freeze=e,bt.HTML_BOOLEAN_ATTRIBUTES=r,bt.HTML_RAW_TEXT_ELEMENTS=n,bt.HTML_VOID_ELEMENTS=i,bt.hasDefaultHTMLNamespace=function(e){return s(e)||e===a.XML_XHTML_APPLICATION},bt.hasOwn=t,bt.isHTMLBooleanAttribute=function(e){return t(r,e.toLowerCase())},bt.isHTMLRawTextElement=function(e){var r=e.toLowerCase();return t(n,r)&&!n[r]},bt.isHTMLEscapableRawTextElement=function(e){var r=e.toLowerCase();return t(n,r)&&n[r]},bt.isHTMLMimeType=s,bt.isHTMLVoidElement=function(e){return t(i,e.toLowerCase())},bt.isValidMimeType=function(e){return o.indexOf(e)>-1},bt.MIME_TYPE=a,bt.NAMESPACE=l,bt}var Et,Tt={};function kt(){if(Et)return Tt;function e(e,t){e.prototype=Object.create(Error.prototype,{constructor:{value:e},name:{value:e.name,enumerable:!0,writable:t}})}Et=1;var t=yt().freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),r=Object.keys(t);function i(e){return"number"==typeof e&&e>=1&&e<=25}function n(e,s){var a;i(e)?(this.name=r[e],this.message=s||""):(this.message=e,this.name="string"==typeof(a=s)&&a.substring(a.length-t.Error.length)===t.Error?s:t.Error),Error.captureStackTrace&&Error.captureStackTrace(this,n)}e(n,!0),Object.defineProperties(n.prototype,{code:{enumerable:!0,get:function(){var e=r.indexOf(this.name);return i(e)?e:0}}});for(var s={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},a=Object.entries(s),o=0;o<a.length;o++){n[a[o][0]]=a[o][1]}function l(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,l)}return e(l),Tt.DOMException=n,Tt.DOMExceptionName=t,Tt.ExceptionCode=s,Tt.ParseError=l,Tt}var At,Nt,wt={},St={};function Ct(){if(At)return St;function e(e){try{"function"!=typeof e&&(e=RegExp);var t=new e("𝌆","u").exec("𝌆");return!!t&&2===t[0].length}catch(e){}return!1}At=1;var t=e();function r(e){if("["!==e.source[0])throw new Error(e+" can not be used with chars");return e.source.slice(1,e.source.lastIndexOf("]"))}function i(e,r){if("["!==e.source[0])throw new Error("/"+e.source+"/ can not be used with chars_without");if(!r||"string"!=typeof r)throw new Error(JSON.stringify(r)+" is not a valid search");if(-1===e.source.indexOf(r))throw new Error('"'+r+'" is not is /'+e.source+"/");if("-"===r&&1!==e.source.indexOf(r))throw new Error('"'+r+'" is not at the first postion of /'+e.source+"/");return new RegExp(e.source.replace(r,""),t?"u":"")}function n(e){var r=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(e){var t="string"==typeof e;if(t&&void 0===r&&"|"===e)throw new Error("use regg instead of reg to wrap expressions with `|`!");return t?e:e.source}).join(""),t?"mu":"m")}function s(e){if(0===arguments.length)throw new Error("no parameters provided");return n.apply(s,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var a=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;t&&(a=n("[",r(a),"\\u{10000}-\\u{10FFFF}","]"));var o=new RegExp("[^"+r(a)+"]",t?"u":""),l=/[\x20\x09\x0D\x0A]/,c=r(l),u=n(l,"+"),d=n(l,"*"),h=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;t&&(h=n("[",r(h),"\\u{10000}-\\u{10FFFF}","]"));var p=n("[",r(h),r(/[-.0-9\xB7]/),r(/[\u0300-\u036F\u203F-\u2040]/),"]"),m=n(h,p,"*"),f=n(p,"+"),g=n("&",m,";"),v=s(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),b=s(g,"|",v),y=n("%",m,";"),E=s(n('"',s(/[^%&"]/,"|",y,"|",b),"*",'"'),"|",n("'",s(/[^%&']/,"|",y,"|",b),"*","'")),T=s('"',s(/[^<&"]/,"|",b),"*",'"',"|","'",s(/[^<&']/,"|",b),"*","'"),k=n(i(h,":"),i(p,":"),"*"),A=n(k,s(":",k),"?"),N=n("^",A,"$"),w=n("(",A,")"),S=s(/"[^"]*"|'[^']*'/),C=n(/^<\?/,"(",m,")",s(u,"(",a,"*?)"),"?",/\?>/),I=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,R=s('"',I,'*"',"|","'",i(I,"'"),"*'"),L="\x3c!--",D=n(L,s(i(a,"-"),"|",n("-",i(a,"-"))),"*","--\x3e"),x="#PCDATA",O=s(n(/\(/,d,x,s(d,/\|/,d,A),"*",d,/\)\*/),"|",n(/\(/,d,x,d,/\)/)),M=s("EMPTY","|","ANY","|",O,"|",n(/\([^>]+\)/,/[?*+]?/)),P=n("<!ELEMENT",u,s(A,"|",y),u,s(M,"|",y),d,">"),U=n("NOTATION",u,/\(/,d,m,s(d,/\|/,d,m),"*",d,/\)/),_=n(/\(/,d,f,s(d,/\|/,d,f),"*",d,/\)/),B=s(U,"|",_),V=s(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",B),F=s(/#REQUIRED|#IMPLIED/,"|",s(s("#FIXED",u),"?",T)),q=n("<!ATTLIST",u,m,s(u,m,u,V,u,F),"*",d,">"),j="about:legacy-compat",H=s('"'+j+'"',"|","'"+j+"'"),W="SYSTEM",G="PUBLIC",X=s(s(W,u,S),"|",s(G,u,R,u,S)),z=n("^",s(s(W,u,"(?<SystemLiteralOnly>",S,")"),"|",s(G,u,"(?<PubidLiteral>",R,")",u,"(?<SystemLiteral>",S,")"))),Y=n("^",R,"$"),Q=n("^",S,"$"),K=s(u,"NDATA",u,m),$="<!ENTITY",J=n($,u,m,u,s(E,"|",s(X,K,"?")),d,">"),Z=s(E,"|",X),ee=s(J,"|",n($,u,"%",u,m,u,Z,d,">")),te=n(G,u,R),re=n("<!NOTATION",u,m,u,s(X,"|",te),d,">"),ie=n(d,"=",d),ne=/1[.]\d+/,se=n(u,"version",ie,s("'",ne,"'","|",'"',ne,'"')),ae=/[A-Za-z][-A-Za-z0-9._]*/,oe=n(/^<\?xml/,se,s(u,"encoding",ie,s('"',ae,'"',"|","'",ae,"'")),"?",s(u,"standalone",ie,s("'",s("yes","|","no"),"'","|",'"',s("yes","|","no"),'"')),"?",d,/\?>/),le=n(a,"*?",/\]\]>/),ce=n(/<!\[CDATA\[/,le);return St.chars=r,St.chars_without=i,St.detectUnicodeSupport=e,St.reg=n,St.regg=s,St.ABOUT_LEGACY_COMPAT=j,St.ABOUT_LEGACY_COMPAT_SystemLiteral=H,St.AttlistDecl=q,St.CDATA_START="<![CDATA[",St.CDATA_END="]]>",St.CDSect=ce,St.Char=a,St.Comment=D,St.COMMENT_START=L,St.COMMENT_END="--\x3e",St.DOCTYPE_DECL_START="<!DOCTYPE",St.elementdecl=P,St.EntityDecl=ee,St.EntityValue=E,St.ExternalID=X,St.ExternalID_match=z,St.Name=m,St.NotationDecl=re,St.Reference=b,St.PEReference=y,St.PI=C,St.PUBLIC=G,St.PubidLiteral=R,St.PubidLiteral_match=Y,St.QName=A,St.QName_exact=N,St.QName_group=w,St.S=u,St.SChar_s=c,St.S_OPT=d,St.SYSTEM=W,St.SystemLiteral=S,St.SystemLiteral_match=Q,St.InvalidChar=o,St.UNICODE_REPLACEMENT_CHARACTER="�",St.UNICODE_SUPPORT=t,St.XMLDecl=oe,St}function It(){if(Nt)return wt;Nt=1;var e=yt(),t=e.find,r=e.hasDefaultHTMLNamespace,i=e.hasOwn,n=e.isHTMLMimeType,s=e.isHTMLRawTextElement,a=e.isHTMLVoidElement,o=e.MIME_TYPE,l=e.NAMESPACE,c=Symbol(),u=kt(),d=u.DOMException,h=u.DOMExceptionName,p=Ct();function m(e){if(e!==c)throw new TypeError("Illegal constructor")}function f(e){return""!==e}function g(e,t){return i(e,t)||(e[t]=!0),e}function v(e){if(!e)return[];var t=function(e){return e?e.split(/[\t\n\f\r ]+/).filter(f):[]}(e);return Object.keys(t.reduce(g,{}))}function b(e){if(!p.QName_exact.test(e))throw new d(d.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+e+'"')}function y(t,r){b(r),t=t||null;var i=null,n=r;if(r.indexOf(":")>=0){var s=r.split(":");i=s[0],n=s[1]}if(null!==i&&null===t)throw new d(d.NAMESPACE_ERR,"prefix is non-null and namespace is null");if("xml"===i&&t!==e.NAMESPACE.XML)throw new d(d.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if(("xmlns"===i||"xmlns"===r)&&t!==e.NAMESPACE.XMLNS)throw new d(d.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(t===e.NAMESPACE.XMLNS&&"xmlns"!==i&&"xmlns"!==r)throw new d(d.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[t,i,n]}function E(e,t){for(var r in e)i(e,r)&&(t[r]=e[r])}function T(e,t){var r=e.prototype;if(!(r instanceof t)){function i(){}i.prototype=t.prototype,E(r,i=new i),e.prototype=r=i}r.constructor!=e&&("function"!=typeof e&&console.error("unknown Class:"+e),r.constructor=e)}var k={},A=k.ELEMENT_NODE=1,N=k.ATTRIBUTE_NODE=2,w=k.TEXT_NODE=3,S=k.CDATA_SECTION_NODE=4,C=k.ENTITY_REFERENCE_NODE=5,I=k.ENTITY_NODE=6,R=k.PROCESSING_INSTRUCTION_NODE=7,L=k.COMMENT_NODE=8,D=k.DOCUMENT_NODE=9,x=k.DOCUMENT_TYPE_NODE=10,O=k.DOCUMENT_FRAGMENT_NODE=11,M=k.NOTATION_NODE=12,P=e.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function U(e,t){if(t.length<e.length)return U(t,e);var r=null;for(var i in e){if(e[i]!==t[i])return r;r=e[i]}return r}function _(e){return e.guid||(e.guid=Math.random()),e.guid}function B(){}function V(e,t){this._node=e,this._refresh=t,F(this)}function F(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!==t){var r=e._refresh(e._node);if(Ce(e,"length",r.length),!e.$$length||r.length<e.$$length)for(var n=r.length;n in e;n++)i(e,n)&&delete e[n];E(r,e),e._inc=t}}function q(){}function j(e,t){for(var r=0;r<e.length;){if(e[r]===t)return r;r++}}function H(e,t,r,i){if(i?t[j(t,i)]=r:(t[t.length]=r,t.length++),e){r.ownerElement=e;var n=e.ownerDocument;n&&(i&&$(n,e,i),function(e,t,r){e&&e._inc++;var i=r.namespaceURI;i===l.XMLNS&&(t._nsMap[r.prefix?r.localName:""]=r.value)}(n,e,r))}}function W(e,t,r){var i=j(t,r);if(i>=0){for(var n=t.length-1;i<=n;)t[i]=t[++i];if(t.length=n,e){var s=e.ownerDocument;s&&$(s,e,r),r.ownerElement=null}}}function G(){}function X(e){m(e)}function z(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function Y(e,t){Q(e,null,{enter:function(e){return!t(e)||Q.STOP}})}function Q(e,t,r){for(var i=[{node:e,context:t,phase:Q.ENTER}];i.length>0;){var n=i.pop();if(n.phase===Q.ENTER){var s=r.enter(n.node,n.context);if(s===Q.STOP)return Q.STOP;if(i.push({node:n.node,context:s,phase:Q.EXIT}),null==s)continue;for(var a=n.node.lastChild;a;)i.push({node:a,context:s,phase:Q.ENTER}),a=a.previousSibling}else r.exit&&r.exit(n.node,n.context)}}function K(e,t){m(e);var r=t||{};this.ownerDocument=this,this.contentType=r.contentType||o.XML_APPLICATION,this.type=n(this.contentType)?"html":"xml"}function $(e,t,r,i){e&&e._inc++,r.namespaceURI===l.XMLNS&&delete t._nsMap[r.prefix?r.localName:""]}function J(e,t,r){if(e&&e._inc){e._inc++;var i=t.childNodes;if(r&&!r.nextSibling)i[i.length++]=r;else{for(var n=t.firstChild,s=0;n;)i[s++]=n,n=n.nextSibling;i.length=s,delete i[i.length]}}}function Z(e,t){if(e!==t.parentNode)throw new d(d.NOT_FOUND_ERR,"child's parent is not parent");var r=t.previousSibling,i=t.nextSibling;return r?r.nextSibling=i:e.firstChild=i,i?i.previousSibling=r:e.lastChild=r,J(e.ownerDocument,e),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function ee(e){return e&&e.nodeType===X.DOCUMENT_TYPE_NODE}function te(e){return e&&e.nodeType===X.ELEMENT_NODE}function re(e){return e&&e.nodeType===X.TEXT_NODE}function ie(e,r){var i=e.childNodes||[];if(t(i,te)||ee(r))return!1;var n=t(i,ee);return!(r&&n&&i.indexOf(n)>i.indexOf(r))}function ne(e,r){var i=e.childNodes||[];if(t(i,function(e){return te(e)&&e!==r}))return!1;var n=t(i,ee);return!(r&&n&&i.indexOf(n)>i.indexOf(r))}function se(e,t,r){if(!function(e){return e&&(e.nodeType===X.DOCUMENT_NODE||e.nodeType===X.DOCUMENT_FRAGMENT_NODE||e.nodeType===X.ELEMENT_NODE)}(e))throw new d(d.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+e.nodeType);if(r&&r.parentNode!==e)throw new d(d.NOT_FOUND_ERR,"child not in parent");if(!function(e){return e&&(e.nodeType===X.CDATA_SECTION_NODE||e.nodeType===X.COMMENT_NODE||e.nodeType===X.DOCUMENT_FRAGMENT_NODE||e.nodeType===X.DOCUMENT_TYPE_NODE||e.nodeType===X.ELEMENT_NODE||e.nodeType===X.PROCESSING_INSTRUCTION_NODE||e.nodeType===X.TEXT_NODE)}(t)||ee(t)&&e.nodeType!==X.DOCUMENT_NODE)throw new d(d.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function ae(e,r,i){var n=e.childNodes||[],s=r.childNodes||[];if(r.nodeType===X.DOCUMENT_FRAGMENT_NODE){var a=s.filter(te);if(a.length>1||t(s,re))throw new d(d.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===a.length&&!ie(e,i))throw new d(d.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(te(r)&&!ie(e,i))throw new d(d.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(ee(r)){if(t(n,ee))throw new d(d.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=t(n,te);if(i&&n.indexOf(o)<n.indexOf(i))throw new d(d.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!i&&o)throw new d(d.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function oe(e,r,i){var n=e.childNodes||[],s=r.childNodes||[];if(r.nodeType===X.DOCUMENT_FRAGMENT_NODE){var a=s.filter(te);if(a.length>1||t(s,re))throw new d(d.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(1===a.length&&!ne(e,i))throw new d(d.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(te(r)&&!ne(e,i))throw new d(d.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(ee(r)){function l(e){return ee(e)&&e!==i}if(t(n,l))throw new d(d.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=t(n,te);if(i&&n.indexOf(o)<n.indexOf(i))throw new d(d.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function le(e,t,r,i){se(e,t,r),e.nodeType===X.DOCUMENT_NODE&&(i||ae)(e,t,r);var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===O){var s=t.firstChild;if(null==s)return t;var a=t.lastChild}else s=a=t;var o=r?r.previousSibling:e.lastChild;s.previousSibling=o,a.nextSibling=r,o?o.nextSibling=s:e.firstChild=s,null==r?e.lastChild=a:r.previousSibling=a;do{s.parentNode=e}while(s!==a&&(s=s.nextSibling));return J(e.ownerDocument||e,e,t),t.nodeType==O&&(t.firstChild=t.lastChild=null),t}function ce(e){m(e),this._nsMap=Object.create(null)}function ue(e){m(e),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}function de(e){m(e)}function he(e){m(e)}function pe(e){m(e)}function me(e){m(e)}function fe(e){m(e)}function ge(e){m(e)}function ve(e){m(e)}function be(e){m(e)}function ye(e){m(e)}function Ee(e){m(e)}function Te(){}function ke(e){var t;t="function"==typeof e?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:e}:null!=e?{requireWellFormed:!!e.requireWellFormed,splitCDATASections:!1!==e.splitCDATASections,nodeFilter:e.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var r=[],i=this.nodeType===D&&this.documentElement||this,n=i.prefix,s=i.namespaceURI;if(s&&null==n&&null==(n=i.lookupPrefix(s)))var a=[{namespace:s,prefix:null}];return we(this,r,a,t),r.join("")}function Ae(e,t,r){var i=e.prefix||"",n=e.namespaceURI;if(!n)return!1;if("xml"===i&&n===l.XML||n===l.XMLNS)return!1;for(var s=r.length;s--;){var a=r[s];if(a.prefix===i)return a.namespace!==n}return!0}function Ne(e,t,r){e.push(" ",t,'="',r.replace(/[<>&"\t\n\r]/g,z),'"')}function we(e,t,r,i){r||(r=[]);var n=i.nodeFilter,o=i.requireWellFormed,c=i.splitCDATASections,u="html"===(e.nodeType===D?e:e.ownerDocument).type;Q(e,{ns:r},{enter:function(e,r){var m=r.ns;if(n){if(!(e=n(e)))return null;if("string"==typeof e)return t.push(e),null}switch(e.nodeType){case A:var f=e.attributes,g=f.length,v=e.tagName,b=v;if(!u&&!e.prefix&&e.namespaceURI){for(var y,E=0;E<f.length;E++)if("xmlns"===f.item(E).name){y=f.item(E).value;break}if(!y)for(var T=m.length-1;T>=0;T--){if(""===(k=m[T]).prefix&&k.namespace===e.namespaceURI){y=k.namespace;break}}if(y!==e.namespaceURI)for(T=m.length-1;T>=0;T--){var k;if((k=m[T]).namespace===e.namespaceURI){k.prefix&&(b=k.prefix+":"+v);break}}}t.push("<",b);for(var I=m.slice(),M=0;M<g;M++){"xmlns"==(P=f.item(M)).prefix?I.push({prefix:P.localName,namespace:P.value}):"xmlns"==P.nodeName&&I.push({prefix:"",namespace:P.value})}for(M=0;M<g;M++){var P;if(Ae(P=f.item(M),0,I)){var U=P.prefix||"",_=P.namespaceURI;Ne(t,U?"xmlns:"+U:"xmlns",_),I.push({prefix:U,namespace:_})}var B=n?n(P):P;B&&("string"==typeof B?t.push(B):Ne(t,B.name,B.value))}if(v===b&&Ae(e,0,I)){var V=e.prefix||"";_=e.namespaceURI;Ne(t,V?"xmlns:"+V:"xmlns",_),I.push({prefix:V,namespace:_})}var F=!e.firstChild;if(F&&(u||e.namespaceURI===l.HTML)&&(F=a(v)),F)return t.push("/>"),null;if(t.push(">"),u&&s(v)){for(var q=e.firstChild;q;)q.data?t.push(q.data):we(q,t,I.slice(),i),q=q.nextSibling;return t.push("</",b,">"),null}return{ns:I,tag:b};case D:case O:if(o&&e.nodeType===D&&null==e.documentElement)throw new d("The Document has no documentElement",h.InvalidStateError);return{ns:m};case N:return Ne(t,e.name,e.value),null;case w:if(o&&p.InvalidChar.test(e.data))throw new d("The Text node data contains characters outside the XML Char production",h.InvalidStateError);return t.push(e.data.replace(/[<&>]/g,z)),null;case S:if(o&&-1!==e.data.indexOf("]]>"))throw new d('The CDATASection data contains "]]>"',h.InvalidStateError);return c?t.push(p.CDATA_START,e.data.replace(/]]>/g,"]]]]><![CDATA[>"),p.CDATA_END):t.push(p.CDATA_START,e.data,p.CDATA_END),null;case L:if(o){if(p.InvalidChar.test(e.data))throw new d("The comment node data contains characters outside the XML Char production",h.InvalidStateError);if(-1!==e.data.indexOf("--")||"-"===e.data[e.data.length-1])throw new d('The comment node data contains "--" or ends with "-"',h.InvalidStateError)}return t.push(p.COMMENT_START,e.data,p.COMMENT_END),null;case x:var j=e.publicId,H=e.systemId;if(o){if(j&&!p.PubidLiteral_match.test(j))throw new d("DocumentType publicId is not a valid PubidLiteral",h.InvalidStateError);if(H&&"."!==H&&!p.SystemLiteral_match.test(H))throw new d("DocumentType systemId is not a valid SystemLiteral",h.InvalidStateError);if(e.internalSubset&&-1!==e.internalSubset.indexOf("]>"))throw new d('DocumentType internalSubset contains "]>"',h.InvalidStateError)}return t.push(p.DOCTYPE_DECL_START," ",e.name),j?(t.push(" ",p.PUBLIC," ",j),H&&"."!==H&&t.push(" ",H)):H&&"."!==H&&t.push(" ",p.SYSTEM," ",H),e.internalSubset&&t.push(" [",e.internalSubset,"]"),t.push(">"),null;case R:if(o){if(-1!==e.target.indexOf(":")||"xml"===e.target.toLowerCase())throw new d("The ProcessingInstruction target is not well-formed",h.InvalidStateError);if(p.InvalidChar.test(e.data))throw new d("The ProcessingInstruction data contains characters outside the XML Char production",h.InvalidStateError);if(-1!==e.data.indexOf("?>"))throw new d('The ProcessingInstruction data contains "?>"',h.InvalidStateError)}return t.push("<?",e.target," ",e.data,"?>"),null;case C:return t.push("&",e.nodeName,";"),null;default:return t.push("??",e.nodeName),null}},exit:function(e,r){r&&r.tag&&t.push("</",r.tag,">")}})}function Se(e,t,r){var n;return Q(t,null,{enter:function(t,s){var a=new t.constructor(c);for(var o in t)if(i(t,o)){var l=t[o];"object"!=typeof l&&l!=a[o]&&(a[o]=l)}t.childNodes&&(a.childNodes=new B),a.ownerDocument=e;var u=r;switch(a.nodeType){case A:var d=t.attributes,h=a.attributes=new q,p=d.length;h._ownerElement=a;for(var m=0;m<p;m++)a.setAttributeNode(Se(e,d.item(m),!0));break;case N:u=!0}return null!==s?s.appendChild(a):n=a,u?a:null}}),n}function Ce(e,t,r){e[t]=r}function Ie(e){for(var t=[],r=e.firstChild;r;)r.nodeType===A&&t.push(r),r=r.nextSibling;return t}B.prototype={length:0,item:function(e){return e>=0&&e<this.length?this[e]:null},toString:function(e){var t;t="function"==typeof e?{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:e}:e?{requireWellFormed:!!e.requireWellFormed,splitCDATASections:!1!==e.splitCDATASections,nodeFilter:e.nodeFilter||null}:{requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var r=[],i=0;i<this.length;i++)we(this[i],r,null,t);return r.join("")},filter:function(e){return Array.prototype.filter.call(this,e)},indexOf:function(e){return Array.prototype.indexOf.call(this,e)}},B.prototype[Symbol.iterator]=function(){var e=this,t=0;return{next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},V.prototype.item=function(e){return F(this),this[e]||null},T(V,B),q.prototype={length:0,item:B.prototype.item,getNamedItem:function(e){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());for(var t=0;t<this.length;){var r=this[t];if(r.nodeName===e)return r;t++}return null},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!==this._ownerElement)throw new d(d.INUSE_ATTRIBUTE_ERR);var r=this.getNamedItemNS(e.namespaceURI,e.localName);return r===e?e:(H(this._ownerElement,this,e,r),r)},setNamedItemNS:function(e){return this.setNamedItem(e)},removeNamedItem:function(e){var t=this.getNamedItem(e);if(!t)throw new d(d.NOT_FOUND_ERR,e);return W(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var r=this.getNamedItemNS(e,t);if(!r)throw new d(d.NOT_FOUND_ERR,e?e+" : "+t:t);return W(this._ownerElement,this,r),r},getNamedItemNS:function(e,t){e||(e=null);for(var r=0;r<this.length;){var i=this[r];if(i.localName===t&&i.namespaceURI===e)return i;r++}return null}},q.prototype[Symbol.iterator]=function(){var e=this,t=0;return{next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}},G.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,r){var i=o.XML_APPLICATION;e===l.HTML?i=o.XML_XHTML_APPLICATION:e===l.SVG&&(i=o.XML_SVG_IMAGE);var n=new K(c,{contentType:i});if(n.implementation=this,n.childNodes=new B,n.doctype=r||null,r&&n.appendChild(r),t){var s=n.createElementNS(e,t);n.appendChild(s)}return n},createDocumentType:function(e,t,r,i){b(e);var n=new fe(c);return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=r||"",n.internalSubset=i||"",n.childNodes=new B,n},createHTMLDocument:function(e){var t=new K(c,{contentType:o.HTML});if(t.implementation=this,t.childNodes=new B,!1!==e){t.doctype=this.createDocumentType("html"),t.doctype.ownerDocument=t,t.appendChild(t.doctype);var r=t.createElement("html");t.appendChild(r);var i=t.createElement("head");if(r.appendChild(i),"string"==typeof e){var n=t.createElement("title");n.appendChild(t.createTextNode(e)),i.appendChild(n)}r.appendChild(t.createElement("body"))}return t}},X.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var e=this.getRootNode();return e&&e.nodeType===e.DOCUMENT_NODE},contains:function(e){if(!e)return!1;var t=e;do{if(this===t)return!0;t=t.parentNode}while(t);return!1},getRootNode:function(e){var t=this;do{if(!t.parentNode)return t;t=t.parentNode}while(t)},isEqualNode:function(e){if(!e)return!1;for(var t=[{node:this,other:e}];t.length>0;){var r=t.pop(),i=r.node,n=r.other;if(i.nodeType!==n.nodeType)return!1;switch(i.nodeType){case i.DOCUMENT_TYPE_NODE:if(i.name!==n.name)return!1;if(i.publicId!==n.publicId)return!1;if(i.systemId!==n.systemId)return!1;break;case i.ELEMENT_NODE:if(i.namespaceURI!==n.namespaceURI)return!1;if(i.prefix!==n.prefix)return!1;if(i.localName!==n.localName)return!1;if(i.attributes.length!==n.attributes.length)return!1;for(var s=0;s<i.attributes.length;s++){var a=i.attributes.item(s),o=n.getAttributeNodeNS(a.namespaceURI,a.localName);if(!o)return!1;t.push({node:a,other:o})}break;case i.ATTRIBUTE_NODE:if(i.namespaceURI!==n.namespaceURI)return!1;if(i.localName!==n.localName)return!1;if(i.value!==n.value)return!1;break;case i.PROCESSING_INSTRUCTION_NODE:if(i.target!==n.target||i.data!==n.data)return!1;break;case i.TEXT_NODE:case i.CDATA_SECTION_NODE:case i.COMMENT_NODE:if(i.data!==n.data)return!1}if(i.childNodes.length!==n.childNodes.length)return!1;for(s=i.childNodes.length-1;s>=0;s--)t.push({node:i.childNodes[s],other:n.childNodes[s]})}return!0},isSameNode:function(e){return this===e},insertBefore:function(e,t){return le(this,e,t)},replaceChild:function(e,t){le(this,e,t,oe),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 Se(this.ownerDocument||this,this,e)},normalize:function(){Q(this,null,{enter:function(e){for(var t=e.firstChild;t;){var r=t.nextSibling;null!==r&&r.nodeType===w&&t.nodeType===w?(e.removeChild(r),t.appendData(r.data)):t=r}return!0}})},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},lookupPrefix:function(e){for(var t=this;t;){var r=t._nsMap;if(r)for(var n in r)if(i(r,n)&&r[n]===e)return n;t=t.nodeType==N?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var r=t._nsMap;if(r&&i(r,e))return r[e];t=t.nodeType==N?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)},compareDocumentPosition:function(e){if(this===e)return 0;var t=e,r=this,i=null,n=null;if(t instanceof ue&&(t=(i=t).ownerElement),r instanceof ue&&(r=(n=r).ownerElement,i&&t&&r===t))for(var s,a=0;s=r.attributes[a];a++){if(s===i)return P.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+P.DOCUMENT_POSITION_PRECEDING;if(s===n)return P.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+P.DOCUMENT_POSITION_FOLLOWING}if(!t||!r||r.ownerDocument!==t.ownerDocument)return P.DOCUMENT_POSITION_DISCONNECTED+P.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(_(r.ownerDocument)>_(t.ownerDocument)?P.DOCUMENT_POSITION_FOLLOWING:P.DOCUMENT_POSITION_PRECEDING);if(n&&t===r)return P.DOCUMENT_POSITION_CONTAINS+P.DOCUMENT_POSITION_PRECEDING;if(i&&t===r)return P.DOCUMENT_POSITION_CONTAINED_BY+P.DOCUMENT_POSITION_FOLLOWING;for(var o=[],l=t.parentNode;l;){if(!n&&l===r)return P.DOCUMENT_POSITION_CONTAINED_BY+P.DOCUMENT_POSITION_FOLLOWING;o.push(l),l=l.parentNode}o.reverse();for(var c=[],u=r.parentNode;u;){if(!i&&u===t)return P.DOCUMENT_POSITION_CONTAINS+P.DOCUMENT_POSITION_PRECEDING;c.push(u),u=u.parentNode}c.reverse();var d=U(o,c);for(var h in d.childNodes){var p=d.childNodes[h];if(p===r)return P.DOCUMENT_POSITION_FOLLOWING;if(p===t)return P.DOCUMENT_POSITION_PRECEDING;if(c.indexOf(p)>=0)return P.DOCUMENT_POSITION_FOLLOWING;if(o.indexOf(p)>=0)return P.DOCUMENT_POSITION_PRECEDING}return 0}},E(k,X),E(k,X.prototype),E(P,X),E(P,X.prototype),Q.STOP=Symbol("walkDOM.STOP"),Q.ENTER=0,Q.EXIT=1,K.prototype={implementation:null,nodeName:"#document",nodeType:D,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType===O){for(var r=e.firstChild;r;){var i=r.nextSibling;this.insertBefore(r,t),r=i}return e}return le(this,e,t),e.ownerDocument=this,null===this.documentElement&&e.nodeType===A&&(this.documentElement=e),e},removeChild:function(e){var t=Z(this,e);return t===this.documentElement&&(this.documentElement=null),t},replaceChild:function(e,t){le(this,e,t,oe),e.ownerDocument=this,t&&this.removeChild(t),te(e)&&(this.documentElement=e)},importNode:function(e,t){return function(e,t,r){var i;return Q(t,null,{enter:function(t,n){var s=t.cloneNode(!1);return s.ownerDocument=e,s.parentNode=null,null===n?i=s:n.appendChild(s),t.nodeType===N||r?s:null}}),i}(this,e,t)},getElementById:function(e){var t=null;return Y(this.documentElement,function(r){if(r.nodeType==A&&r.getAttribute("id")==e)return t=r,!0}),t},createElement:function(e){var t=new ce(c);return t.ownerDocument=this,"html"===this.type&&(e=e.toLowerCase()),r(this.contentType)&&(t.namespaceURI=l.HTML),t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new B,(t.attributes=new q)._ownerElement=t,t},createDocumentFragment:function(){var e=new ye(c);return e.ownerDocument=this,e.childNodes=new B,e},createTextNode:function(e){var t=new he(c);return t.ownerDocument=this,t.childNodes=new B,t.appendData(e),t},createComment:function(e){var t=new pe(c);return t.ownerDocument=this,t.childNodes=new B,t.appendData(e),t},createCDATASection:function(e){if(-1!==e.indexOf("]]>"))throw new d(d.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new me(c);return t.ownerDocument=this,t.childNodes=new B,t.appendData(e),t},createProcessingInstruction:function(e,t){var r=new Ee(c);return r.ownerDocument=this,r.childNodes=new B,r.nodeName=r.target=e,r.nodeValue=r.data=t,r},createAttribute:function(e){if(!p.QName_exact.test(e))throw new d(d.INVALID_CHARACTER_ERR,'invalid character in name "'+e+'"');return"html"===this.type&&(e=e.toLowerCase()),this._createAttribute(e)},_createAttribute:function(e){var t=new ue(c);return t.ownerDocument=this,t.childNodes=new B,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){if(!p.Name.test(e))throw new d(d.INVALID_CHARACTER_ERR,'not a valid xml name "'+e+'"');if("html"===this.type)throw new d("document is an html document",h.NotSupportedError);var t=new be(c);return t.ownerDocument=this,t.childNodes=new B,t.nodeName=e,t},createElementNS:function(e,t){var r=y(e,t),i=new ce(c),n=i.attributes=new q;return i.childNodes=new B,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=r[0],i.prefix=r[1],i.localName=r[2],n._ownerElement=i,i},createAttributeNS:function(e,t){var r=y(e,t),i=new ue(c);return i.ownerDocument=this,i.childNodes=new B,i.nodeName=t,i.name=t,i.specified=!0,i.namespaceURI=r[0],i.prefix=r[1],i.localName=r[2],i}},T(K,X),ce.prototype={nodeType:A,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return"html"===this.ownerDocument.type&&this.namespaceURI===l.HTML},hasAttributes:function(){return!(!this.attributes||!this.attributes.length)},hasAttribute:function(e){return!!this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t?t.value:null},getAttributeNode:function(e){return this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase()),this.attributes.getNamedItem(e)},setAttribute:function(e,t){this._isInHTMLDocumentAndNamespace()&&(e=e.toLowerCase());var r=this.getAttributeNode(e);r?r.value=r.nodeValue=""+t:((r=this.ownerDocument._createAttribute(e)).value=r.nodeValue=""+t,this.setAttributeNode(r))},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},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:null},setAttributeNS:function(e,t,r){var i=y(e,t)[2],n=this.getAttributeNodeNS(e,i);n?n.value=n.nodeValue=""+r:((n=this.ownerDocument.createAttributeNS(e,t)).value=n.nodeValue=""+r,this.setAttributeNode(n))},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByClassName:function(e){var t=v(e);return new V(this,function(r){var i=[];return t.length>0&&Y(r,function(n){if(n!==r&&n.nodeType===A){var s=n.getAttribute("class");if(s){var a=e===s;if(!a){var o=v(s);a=t.every((l=o,function(e){return l&&-1!==l.indexOf(e)}))}a&&i.push(n)}}var l}),i})},getElementsByTagName:function(e){var t="html"===(this.nodeType===D?this:this.ownerDocument).type,r=e.toLowerCase();return new V(this,function(i){var n=[];return Y(i,function(s){s!==i&&s.nodeType===A&&(("*"===e||s.getQualifiedName()===(t&&s.namespaceURI===l.HTML?r:e))&&n.push(s))}),n})},getElementsByTagNameNS:function(e,t){return new V(this,function(r){var i=[];return Y(r,function(n){n===r||n.nodeType!==A||"*"!==e&&n.namespaceURI!==e||"*"!==t&&n.localName!=t||i.push(n)}),i})}},K.prototype.getElementsByClassName=ce.prototype.getElementsByClassName,K.prototype.getElementsByTagName=ce.prototype.getElementsByTagName,K.prototype.getElementsByTagNameNS=ce.prototype.getElementsByTagNameNS,T(ce,X),ue.prototype.nodeType=N,T(ue,X),de.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)},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}},T(de,X),he.prototype={nodeName:"#text",nodeType:w,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}},T(he,de),pe.prototype={nodeName:"#comment",nodeType:L},T(pe,de),me.prototype={nodeName:"#cdata-section",nodeType:S},T(me,he),fe.prototype.nodeType=x,T(fe,X),ge.prototype.nodeType=M,T(ge,X),ve.prototype.nodeType=I,T(ve,X),be.prototype.nodeType=C,T(be,X),ye.prototype.nodeName="#document-fragment",ye.prototype.nodeType=O,T(ye,X),Ee.prototype.nodeType=R,T(Ee,de),Te.prototype.serializeToString=function(e,t){return ke.call(e,t)},X.prototype.toString=ke;try{Object.defineProperty&&(Object.defineProperty(V.prototype,"length",{get:function(){return F(this),this.$$length}}),Object.defineProperty(X.prototype,"textContent",{get:function(){if(this.nodeType===A||this.nodeType===O){var e=[];return Q(this,null,{enter:function(t){return t.nodeType===A||t.nodeType===O||(t.nodeType===R||t.nodeType===L?null:void e.push(t.nodeValue))}}),e.join("")}return this.nodeValue},set:function(e){switch(this.nodeType){case A:case O: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}}}),Object.defineProperty(ce.prototype,"children",{get:function(){return new V(this,Ie)}}),Object.defineProperty(K.prototype,"children",{get:function(){return new V(this,Ie)}}),Object.defineProperty(ye.prototype,"children",{get:function(){return new V(this,Ie)}}),Ce=function(e,t,r){e["$$"+t]=r})}catch(e){}return wt._updateLiveList=F,wt.Attr=ue,wt.CDATASection=me,wt.CharacterData=de,wt.Comment=pe,wt.Document=K,wt.DocumentFragment=ye,wt.DocumentType=fe,wt.DOMImplementation=G,wt.Element=ce,wt.Entity=ve,wt.EntityReference=be,wt.LiveNodeList=V,wt.NamedNodeMap=q,wt.Node=X,wt.NodeList=B,wt.Notation=ge,wt.Text=he,wt.ProcessingInstruction=Ee,wt.walkDOM=Q,wt.XMLSerializer=Te,wt}var Rt,Lt={},Dt={};function xt(){return Rt||(Rt=1,function(e){var t=yt().freeze;e.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),e.HTML_ENTITIES=t({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:""}),e.entityMap=e.HTML_ENTITIES}(Dt)),Dt}var Ot,Mt,Pt,Ut={};function _t(){if(Ot)return Ut;Ot=1;var e=yt(),t=Ct(),r=kt(),i=e.isHTMLEscapableRawTextElement,n=e.isHTMLMimeType,s=e.isHTMLRawTextElement,a=e.hasOwn,o=e.NAMESPACE,l=r.ParseError,c=r.DOMException;function u(){}u.prototype={parse:function(r,i,s){var o=this.domBuilder;o.startDocument(),g(i,i=Object.create(null)),function(r,i,s,o,u){var g=n(o.mimeType);r.indexOf(t.UNICODE_REPLACEMENT_CHARACTER)>=0&&u.warning("Unicode replacement character detected, source encoding issues?");function v(e){if(e>65535){var t=55296+((e-=65536)>>10),r=56320+(1023&e);return String.fromCharCode(t,r)}return String.fromCharCode(e)}function T(e){var r=";"===e[e.length-1]?e:e+";";if(!g&&r!==e)return u.error("EntityRef: expecting ;"),e;var i=t.Reference.exec(r);if(!i||i[0].length!==r.length)return u.error("entity not matching Reference production: "+e),e;var n=r.slice(1,-1);return a(s,n)?s[n]:"#"===n.charAt(0)?v(parseInt(n.substring(1).replace("x","0x"))):(u.error("entity not found:"+e),e)}function k(e){if(e>L){var t=r.substring(L,e).replace(d,T);S&&C(L),o.characters(t,0,e-L),L=e}}var A=0,N=0,w=/\r\n?|\n|$/g,S=o.locator;function C(e,t){for(;e>=N&&(t=w.exec(r));)A=N,N=t.index+t[0].length,S.lineNumber++;S.columnNumber=e-A+1}var I=[{currentNSMap:i}],R=[],L=0;for(;;){try{var D=r.indexOf("<",L);if(D<0){if(!g&&R.length>0)return u.fatalError("unclosed xml tag(s): "+R.join(", "));if(!r.substring(L).match(/^\s*$/)){var x=o.doc,O=x.createTextNode(r.substring(L));if(x.documentElement)return u.error("Extra content at the end of the document");x.appendChild(O),o.currentElement=O}return}if(D>L){var M=r.substring(L,D);g||0!==R.length||(M=M.replace(new RegExp(t.S_OPT.source,"g"),""))&&u.error("Unexpected content outside root element: '"+M+"'"),k(D)}switch(r.charAt(D+1)){case"/":var P=r.indexOf(">",D+2),U=r.substring(D+2,P>0?P:void 0);if(!U)return u.fatalError("end tag name missing");var _=P>0&&t.reg("^",t.QName_group,t.S_OPT,"$").exec(U);if(!_)return u.fatalError('end tag name contains invalid characters: "'+U+'"');if(!o.currentElement&&!o.doc.documentElement)return;var B=R[R.length-1]||o.currentElement.tagName||o.doc.documentElement.tagName||"";if(B!==_[1]){var V=_[1].toLowerCase();if(!g||B.toLowerCase()!==V)return u.fatalError('Opening and ending tag mismatch: "'+B+'" != "'+U+'"')}var F=I.pop();R.pop();var q=F.localNSMap;if(o.endElement(F.uri,F.localName,B),q)for(var j in q)a(q,j)&&o.endPrefixMapping(j);P++;break;case"?":S&&C(D),P=y(r,D,o,u);break;case"!":S&&C(D),P=b(r,D,o,u,g);break;default:S&&C(D);var H=new E,W=I[I.length-1].currentNSMap,G=(P=p(r,D,H,W,T,u,g),H.length);if(H.closed||(g&&e.isHTMLVoidElement(H.tagName)?H.closed=!0:R.push(H.tagName)),S&&G){for(var X=h(S,{}),z=0;z<G;z++){var Y=H[z];C(Y.offset),Y.locator=h(S,{})}o.locator=X,m(H,o,W)&&I.push(H),o.locator=S}else m(H,o,W)&&I.push(H);g&&!H.closed?P=f(r,P,H.tagName,T,o):P++}}catch(e){if(e instanceof l)throw e;if(e instanceof c)throw new l(e.name+": "+e.message,o.locator,e);u.error("element parse error: "+e),P=-1}P>L?L=P:k(Math.max(D,L)+1)}}(r,i,s,o,this.errorHandler),o.endDocument()}};var d=/&#?\w+;?/g;function h(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function p(e,t,r,i,n,s,o){function l(e,t,i){return a(r.attributeNames,e)?s.fatalError("Attribute "+e+" redefined"):!o&&t.indexOf("<")>=0?s.fatalError("Unescaped '<' not allowed in attributes values"):void r.addValue(e,t.replace(/[\t\n\r]/g," ").replace(d,n),i)}for(var c,u=++t,h=0;;){var p=e.charAt(u);switch(p){case"=":if(1===h)c=e.slice(t,u),h=3;else{if(2!==h)throw new Error("attribute equal must after attrName");h=3}break;case"'":case'"':if(3===h||1===h){if(1===h&&(s.warning('attribute value must after "="'),c=e.slice(t,u)),t=u+1,!((u=e.indexOf(p,t))>0))throw new Error("attribute value no end '"+p+"' match");l(c,m=e.slice(t,u),t-1),h=5}else{if(4!=h)throw new Error('attribute value must after "="');l(c,m=e.slice(t,u),t),s.warning('attribute "'+c+'" missed start quot('+p+")!!"),t=u+1,h=5}break;case"/":switch(h){case 0:r.setTagName(e.slice(t,u));case 5:case 6:case 7:h=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 s.error("unexpected end of input"),0==h&&r.setTagName(e.slice(t,u)),u;case">":switch(h){case 0:r.setTagName(e.slice(t,u));case 5:case 6:case 7:break;case 4:case 1:"/"===(m=e.slice(t,u)).slice(-1)&&(r.closed=!0,m=m.slice(0,-1));case 2:2===h&&(m=c),4==h?(s.warning('attribute "'+m+'" missed quot(")!'),l(c,m,t)):(o||s.warning('attribute "'+m+'" missed value!! "'+m+'" instead!!'),l(m,m,t));break;case 3:if(!o)return s.fatalError("AttValue: ' or \" expected")}return u;case"":p=" ";default:if(p<=" ")switch(h){case 0:r.setTagName(e.slice(t,u)),h=6;break;case 1:c=e.slice(t,u),h=2;break;case 4:var m=e.slice(t,u);s.warning('attribute "'+m+'" missed quot(")!!'),l(c,m,t);case 5:h=6}else switch(h){case 2:o||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=u,h=1;break;case 5:s.warning('attribute space is required"'+c+'"!!');case 6:h=1,t=u;break;case 3:h=4,t=u;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function m(e,t,r){for(var i=e.tagName,n=null,s=e.length;s--;){var l=e[s],c=l.qName,u=l.value;if((m=c.indexOf(":"))>0)var d=l.prefix=c.slice(0,m),h=c.slice(m+1),p="xmlns"===d&&h;else h=c,d=null,p="xmlns"===c&&"";l.localName=h,!1!==p&&(null==n&&(n=Object.create(null),g(r,r=Object.create(null))),r[p]=n[p]=u,l.uri=o.XMLNS,t.startPrefixMapping(p,u))}for(s=e.length;s--;)(l=e[s]).prefix&&("xml"===l.prefix&&(l.uri=o.XML),"xmlns"!==l.prefix&&(l.uri=r[l.prefix]));var m;(m=i.indexOf(":"))>0?(d=e.prefix=i.slice(0,m),h=e.localName=i.slice(m+1)):(d=null,h=e.localName=i);var f=e.uri=r[d||""];if(t.startElement(f,h,i,e),!e.closed)return e.currentNSMap=r,e.localNSMap=n,!0;if(t.endElement(f,h,i),n)for(d in n)a(n,d)&&t.endPrefixMapping(d)}function f(e,t,r,n,a){var o=i(r);if(o||s(r)){var l=e.indexOf("</"+r+">",t),c=e.substring(t+1,l);return o&&(c=c.replace(d,n)),a.characters(c,0,c.length),l}return t+1}function g(e,t){for(var r in e)a(e,r)&&(t[r]=e[r])}function v(e,r){var i=r;function n(t){return t=t||0,e.charAt(i+t)}function s(e){i+=e=e||1}function a(){return e.substring(i)}return{char:n,getIndex:function(){return i},getMatch:function(e){var r=t.reg("^",e).exec(a());return r?(s(r[0].length),r[0]):null},getSource:function(){return e},skip:s,skipBlanks:function(){for(var t=0;i<e.length;){var r=n();if(" "!==r&&"\n"!==r&&"\t"!==r&&"\r"!==r)return t;t++,s()}return-1},substringFromIndex:a,substringStartsWith:function(t){return e.substring(i,i+t.length)===t},substringStartsWithCaseInsensitive:function(t){return e.substring(i,i+t.length).toUpperCase()===t.toUpperCase()}}}function b(e,r,i,n,s){var a=v(e,r);switch(s?a.char(2).toUpperCase():a.char(2)){case"-":var o=a.getMatch(t.Comment);return o?(i.comment(o,t.COMMENT_START.length,o.length-t.COMMENT_START.length-t.COMMENT_END.length),a.getIndex()):n.fatalError("comment is not well-formed at position "+a.getIndex());case"[":var l=a.getMatch(t.CDSect);return l?s||i.currentElement?(i.startCDATA(),i.characters(l,t.CDATA_START.length,l.length-t.CDATA_START.length-t.CDATA_END.length),i.endCDATA(),a.getIndex()):n.fatalError("CDATA outside of element"):n.fatalError("Invalid CDATA starting at position "+r);case"D":if(i.doc&&i.doc.documentElement)return n.fatalError("Doctype not allowed inside or after documentElement at position "+a.getIndex());if(s?!a.substringStartsWithCaseInsensitive(t.DOCTYPE_DECL_START):!a.substringStartsWith(t.DOCTYPE_DECL_START))return n.fatalError("Expected "+t.DOCTYPE_DECL_START+" at position "+a.getIndex());if(a.skip(t.DOCTYPE_DECL_START.length),a.skipBlanks()<1)return n.fatalError("Expected whitespace after "+t.DOCTYPE_DECL_START+" at position "+a.getIndex());var c={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(c.name=a.getMatch(t.Name),!c.name)return n.fatalError("doctype name missing or contains unexpected characters at position "+a.getIndex());if(s&&"html"!==c.name.toLowerCase()&&n.warning("Unexpected DOCTYPE in HTML document at position "+a.getIndex()),a.skipBlanks(),a.substringStartsWith(t.PUBLIC)||a.substringStartsWith(t.SYSTEM)){var u=t.ExternalID_match.exec(a.substringFromIndex());if(!u)return n.fatalError("doctype external id is not well-formed at position "+a.getIndex());void 0!==u.groups.SystemLiteralOnly?c.systemId=u.groups.SystemLiteralOnly:(c.systemId=u.groups.SystemLiteral,c.publicId=u.groups.PubidLiteral),a.skip(u[0].length)}else if(s&&a.substringStartsWithCaseInsensitive(t.SYSTEM)){if(a.skip(t.SYSTEM.length),a.skipBlanks()<1)return n.fatalError("Expected whitespace after "+t.SYSTEM+" at position "+a.getIndex());if(c.systemId=a.getMatch(t.ABOUT_LEGACY_COMPAT_SystemLiteral),!c.systemId)return n.fatalError("Expected "+t.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+t.SYSTEM+" at position "+a.getIndex())}return s&&c.systemId&&!t.ABOUT_LEGACY_COMPAT_SystemLiteral.test(c.systemId)&&n.warning("Unexpected doctype.systemId in HTML document at position "+a.getIndex()),s||(a.skipBlanks(),c.internalSubset=function(e,r){function i(e,r){var i=t.PI.exec(e.substringFromIndex());return i?"xml"===i[1].toLowerCase()?r.fatalError("xml declaration is only allowed at the start of the document, but found at position "+e.getIndex()):(e.skip(i[0].length),i[0]):r.fatalError("processing instruction is not well-formed at position "+e.getIndex())}var n=e.getSource();if("["===e.char()){e.skip(1);for(var s=e.getIndex();e.getIndex()<n.length;){if(e.skipBlanks(),"]"===e.char()){var a=n.substring(s,e.getIndex());return e.skip(1),a}var o=null;if("<"===e.char()&&"!"===e.char(1))switch(e.char(2)){case"E":"L"===e.char(3)?o=e.getMatch(t.elementdecl):"N"===e.char(3)&&(o=e.getMatch(t.EntityDecl));break;case"A":o=e.getMatch(t.AttlistDecl);break;case"N":o=e.getMatch(t.NotationDecl);break;case"-":o=e.getMatch(t.Comment)}else if("<"===e.char()&&"?"===e.char(1))o=i(e,r);else{if("%"!==e.char())return r.fatalError("Error detected in Markup declaration");o=e.getMatch(t.PEReference)}if(!o)return r.fatalError("Error in internal subset at position "+e.getIndex())}return r.fatalError("doctype internal subset is not well-formed, missing ]")}}(a,n)),a.skipBlanks(),">"!==a.char()?n.fatalError("doctype not terminated with > at position "+a.getIndex()):(a.skip(1),i.startDTD(c.name,c.publicId,c.systemId,c.internalSubset),i.endDTD(),a.getIndex());default:return n.fatalError('Not well-formed XML starting with "<!" at position '+r)}}function y(e,r,i,n){var s=e.substring(r).match(t.PI);if(!s)return n.fatalError("Invalid processing instruction starting at position "+r);if("xml"===s[1].toLowerCase()){if(r>0)return n.fatalError("processing instruction at position "+r+" is an xml declaration which is only at the start of the document");if(!t.XMLDecl.test(e.substring(r)))return n.fatalError("xml declaration is not well-formed")}return i.processingInstruction(s[1],s[2]),r+s[0].length}function E(){this.attributeNames=Object.create(null)}return E.prototype={setTagName:function(e){if(!t.QName_exact.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,r,i){if(!t.QName_exact.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:r,offset:i}},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}},Ut.XMLReader=u,Ut.parseUtils=v,Ut.parseDoctypeCommentOrCData=b,Ut}function Bt(){if(Mt)return Lt;Mt=1;var e=yt(),t=It(),r=kt(),i=xt(),n=_t(),s=t.DOMImplementation,a=e.hasDefaultHTMLNamespace,o=e.isHTMLMimeType,l=e.isValidMimeType,c=e.MIME_TYPE,u=e.NAMESPACE,d=r.ParseError,h=n.XMLReader;function p(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028\u2029]/g,"\n")}function m(t){if(void 0===(t=t||{}).locator&&(t.locator=!0),this.assign=t.assign||e.assign,this.domHandler=t.domHandler||f,this.onError=t.onError||t.errorHandler,t.errorHandler&&"function"!=typeof t.errorHandler)throw new TypeError("errorHandler object is no longer supported, switch to onError!");t.errorHandler&&t.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=t.normalizeLineEndings||p,this.locator=!!t.locator,this.xmlns=this.assign(Object.create(null),t.xmlns)}function f(e){var t=e||{};this.mimeType=t.mimeType||c.XML_APPLICATION,this.defaultNamespace=t.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=t.onError}function g(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function v(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 b(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}return m.prototype.parseFromString=function(t,r){if(!l(r))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+r+'" is not valid.');var n=this.assign(Object.create(null),this.xmlns),s=i.XML_ENTITIES,o=n[""]||null;a(r)?(s=i.HTML_ENTITIES,o=u.HTML):r===c.XML_SVG_IMAGE&&(o=u.SVG),n[""]=o,n.xml=n.xml||u.XML;var d=new this.domHandler({mimeType:r,defaultNamespace:o,onError:this.onError}),p=this.locator?{}:void 0;this.locator&&d.setDocumentLocator(p);var m=new h;return m.errorHandler=d,m.domBuilder=d,!e.isHTMLMimeType(r)&&"string"!=typeof t&&m.errorHandler.fatalError("source is not a string"),m.parse(this.normalizeLineEndings(String(t)),n,s),d.doc.documentElement||m.errorHandler.fatalError("missing root element"),d.doc},f.prototype={startDocument:function(){var e=new s;this.doc=o(this.mimeType)?e.createHTMLDocument(!1):e.createDocument(this.defaultNamespace,"")},startElement:function(e,t,r,i){var n=this.doc,s=n.createElementNS(e,r||t),a=i.length;b(this,s),this.currentElement=s,this.locator&&g(this.locator,s);for(var o=0;o<a;o++){e=i.getURI(o);var l=i.getValue(o),c=(r=i.getQName(o),n.createAttributeNS(e,r));this.locator&&g(i.getLocator(o),c),c.value=c.nodeValue=l,s.setAttributeNode(c)}},endElement:function(e,t,r){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var r=this.doc.createProcessingInstruction(e,t);this.locator&&g(this.locator,r),b(this,r)},ignorableWhitespace:function(e,t,r){},characters:function(e,t,r){if(e=v.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&&g(this.locator,i)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){e&&(e.lineNumber=0),this.locator=e},comment:function(e,t,r){e=v.apply(this,arguments);var i=this.doc.createComment(e);this.locator&&g(this.locator,i),b(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,r,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(e,t,r,i);this.locator&&g(this.locator,s),b(this,s),this.doc.doctype=s}},reportError:function(e,t){if("function"==typeof this.onError)try{this.onError(e,t,this)}catch(r){throw new d("Reporting "+e+' "'+t+'" caused '+r,this.locator)}else console.error("[xmldom "+e+"]\t"+t,function(e){if(e)return"\n@#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}(this.locator))},warning:function(e){this.reportError("warning",e)},error:function(e){this.reportError("error",e)},fatalError:function(e){throw this.reportError("fatalError",e),new d(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){f.prototype[e]=function(){return null}}),Lt.__DOMHandler=f,Lt.DOMParser=m,Lt.normalizeLineEndings=p,Lt.onErrorStopParsing=function(e){if("error"===e)throw"onErrorStopParsing"},Lt.onWarningStopParsing=function(){throw"onWarningStopParsing"},Lt}function Vt(){if(Pt)return vt;Pt=1;var e=yt();vt.assign=e.assign,vt.hasDefaultHTMLNamespace=e.hasDefaultHTMLNamespace,vt.isHTMLMimeType=e.isHTMLMimeType,vt.isValidMimeType=e.isValidMimeType,vt.MIME_TYPE=e.MIME_TYPE,vt.NAMESPACE=e.NAMESPACE;var t=kt();vt.DOMException=t.DOMException,vt.DOMExceptionName=t.DOMExceptionName,vt.ExceptionCode=t.ExceptionCode,vt.ParseError=t.ParseError;var r=It();vt.Attr=r.Attr,vt.CDATASection=r.CDATASection,vt.CharacterData=r.CharacterData,vt.Comment=r.Comment,vt.Document=r.Document,vt.DocumentFragment=r.DocumentFragment,vt.DocumentType=r.DocumentType,vt.DOMImplementation=r.DOMImplementation,vt.Element=r.Element,vt.Entity=r.Entity,vt.EntityReference=r.EntityReference,vt.LiveNodeList=r.LiveNodeList,vt.NamedNodeMap=r.NamedNodeMap,vt.Node=r.Node,vt.NodeList=r.NodeList,vt.Notation=r.Notation,vt.ProcessingInstruction=r.ProcessingInstruction,vt.Text=r.Text,vt.XMLSerializer=r.XMLSerializer;var i=Bt();return vt.DOMParser=i.DOMParser,vt.normalizeLineEndings=i.normalizeLineEndings,vt.onErrorStopParsing=i.onErrorStopParsing,vt.onWarningStopParsing=i.onWarningStopParsing,vt}var Ft=Vt(),qt=t({__proto__:null,default:ft(Ft)},[Ft])});
|
|
2
2
|
//# sourceMappingURL=openplayer-ads.js.map
|