restreamer-ui-v2/public/_player/videojs/dist/videojs-chromecast.min.js
2024-09-06 09:51:00 +02:00

2 lines
53 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! @silvermine/videojs-chromecast 2024-09-06 v1.5.0-7-g0f83898 */
!function n(i,o,s){function a(t,e){if(!o[t]){if(!i[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(c)return c(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}r=o[t]={exports:{}},i[t][0].call(r.exports,function(e){return a(i[t][1][e]||e)},r,r.exports,n,i,o,s)}return o[t].exports}for(var c="function"==typeof require&&require,e=0;e<s.length;e++)a(s[e]);return a}({1:[function(R,j,H){window.WebComponents=window.WebComponents||{flags:{}};var q=document.querySelector('script[src*="webcomponents-lite.js"]'),r={};if(!r.noOpts){if(location.search.slice(1).split("&").forEach(function(e){var t,e=e.split("=");e[0]&&(t=e[0].match(/wc-(.+)/))&&(r[t[1]]=e[1]||!0)}),q)for(var e,U=0;e=q.attributes[U];U++)"src"!==e.name&&(r[e.name]=e.value||!0);r.log&&r.log.split?(T=r.log.split(","),r.log={},T.forEach(function(e){r.log[e]=!0})):r.log={}}r.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=r.register),WebComponents.flags=r;var v,g,w,y,F,t,B,V,a,n,i,G,o,s,W,l,d,z,c,h,J,Y,u,K,m,p,Z,X,f,_,$,b,C,E,Q,ee,S,T=self,L=!1;if(!T.forceJURL)try{var M=new URL("b","http://a");M.pathname="c%20d",L="http://a/c%20d"===M.href}catch(e){}function te(e){return void 0!==v[e]}function N(){ie.call(this),this._isInvalid=!0}function re(e){return""==e&&N.call(this),e.toLowerCase()}function ne(e){var t=e.charCodeAt(0);return 32<t&&t<127&&-1==[34,35,60,62,63,96].indexOf(t)?e:encodeURIComponent(e)}function D(e,t,r){function n(e){h.push(e)}var i,o,s=t||"scheme start",a=0,c="",l=!1,d=!1,h=[];e:for(;(e[a-1]!=w||0==a)&&!this._isInvalid;){var u=e[a];switch(s){case"scheme start":if(!u||!y.test(u)){if(t){n("Invalid scheme.");break e}c="",s="no scheme";continue}c+=u.toLowerCase(),s="scheme";break;case"scheme":if(u&&F.test(u))c+=u.toLowerCase();else{if(":"!=u){if(t){if(w==u)break e;n("Code point not allowed in scheme: "+u);break e}c="",a=0,s="no scheme";continue}if(this._scheme=c,c="",t)break e;te(this._scheme)&&(this._isRelative=!0),s="file"==this._scheme?"relative":this._isRelative&&r&&r._scheme==this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"==u?(this._query="?",s="query"):"#"==u?(this._fragment="#",s="fragment"):w!=u&&"\t"!=u&&"\n"!=u&&"\r"!=u&&(this._schemeData+=ne(u));break;case"no scheme":if(r&&te(r._scheme)){s="relative";continue}n("Missing scheme."),N.call(this);break;case"relative or authority":if("/"!=u||"/"!=e[a+1]){n("Expected /, got: "+u),s="relative";continue}s="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!=this._scheme&&(this._scheme=r._scheme),w==u){this._host=r._host,this._port=r._port,this._path=r._path.slice(),this._query=r._query,this._username=r._username,this._password=r._password;break e}if("/"==u||"\\"==u)"\\"==u&&n("\\ is an invalid code point."),s="relative slash";else if("?"==u)this._host=r._host,this._port=r._port,this._path=r._path.slice(),this._query="?",this._username=r._username,this._password=r._password,s="query";else{if("#"!=u){var m=e[a+1],p=e[a+2];("file"!=this._scheme||!y.test(u)||":"!=m&&"|"!=m||w!=p&&"/"!=p&&"\\"!=p&&"?"!=p&&"#"!=p)&&(this._host=r._host,this._port=r._port,this._username=r._username,this._password=r._password,this._path=r._path.slice(),this._path.pop()),s="relative path";continue}this._host=r._host,this._port=r._port,this._path=r._path.slice(),this._query=r._query,this._fragment="#",this._username=r._username,this._password=r._password,s="fragment"}break;case"relative slash":if("/"!=u&&"\\"!=u){"file"!=this._scheme&&(this._host=r._host,this._port=r._port,this._username=r._username,this._password=r._password),s="relative path";continue}"\\"==u&&n("\\ is an invalid code point."),s="file"==this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!=u){n("Expected '/', got: "+u),s="authority ignore slashes";continue}s="authority second slash";break;case"authority second slash":if(s="authority ignore slashes","/"==u)break;n("Expected '/', got: "+u);continue;case"authority ignore slashes":if("/"!=u&&"\\"!=u){s="authority";continue}n("Expected authority, got: "+u);break;case"authority":if("@"==u){l&&(n("@ already seen."),c+="%40");for(var l=!0,f=0;f<c.length;f++){var _=c[f];"\t"==_||"\n"==_||"\r"==_?n("Invalid whitespace in authority."):":"==_&&null===this._password?this._password="":(_=ne(_),null!==this._password?this._password+=_:this._username+=_)}c=""}else{if(w==u||"/"==u||"\\"==u||"?"==u||"#"==u){a-=c.length,c="",s="host";continue}c+=u}break;case"file host":if(w==u||"/"==u||"\\"==u||"?"==u||"#"==u){s=2!=c.length||!y.test(c[0])||":"!=c[1]&&"|"!=c[1]?(0==c.length||(this._host=re.call(this,c),c=""),"relative path start"):"relative path";continue}"\t"==u||"\n"==u||"\r"==u?n("Invalid whitespace in file host."):c+=u;break;case"host":case"hostname":if(":"!=u||d){if(w==u||"/"==u||"\\"==u||"?"==u||"#"==u){if(this._host=re.call(this,c),c="",s="relative path start",t)break e;continue}"\t"!=u&&"\n"!=u&&"\r"!=u?("["==u?d=!0:"]"==u&&(d=!1),c+=u):n("Invalid code point in host/hostname: "+u)}else if(this._host=re.call(this,c),c="",s="port","hostname"==t)break e;break;case"port":if(/[0-9]/.test(u))c+=u;else{if(w==u||"/"==u||"\\"==u||"?"==u||"#"==u||t){if(""!=c&&((m=parseInt(c,10))!=v[this._scheme]&&(this._port=m+""),c=""),t)break e;s="relative path start";continue}"\t"==u||"\n"==u||"\r"==u?n("Invalid code point in port: "+u):N.call(this)}break;case"relative path start":if("\\"==u&&n("'\\' not allowed in path."),s="relative path","/"!=u&&"\\"!=u)continue;break;case"relative path":w!=u&&"/"!=u&&"\\"!=u&&(t||"?"!=u&&"#"!=u)?"\t"!=u&&"\n"!=u&&"\r"!=u&&(c+=ne(u)):("\\"==u&&n("\\ not allowed in relative path."),".."==(c=(p=g[c.toLowerCase()])?p:c)?(this._path.pop(),"/"!=u&&"\\"!=u&&this._path.push("")):"."==c&&"/"!=u&&"\\"!=u?this._path.push(""):"."!=c&&("file"==this._scheme&&0==this._path.length&&2==c.length&&y.test(c[0])&&"|"==c[1]&&(c=c[0]+":"),this._path.push(c)),c="","?"==u?(this._query="?",s="query"):"#"==u&&(this._fragment="#",s="fragment"));break;case"query":t||"#"!=u?w!=u&&"\t"!=u&&"\n"!=u&&"\r"!=u&&(this._query+=(o=void 0,32<(o=(i=u).charCodeAt(0))&&o<127&&-1==[34,35,60,62,96].indexOf(o)?i:encodeURIComponent(i))):(this._fragment="#",s="fragment");break;case"fragment":w!=u&&"\t"!=u&&"\n"!=u&&"\r"!=u&&(this._fragment+=u)}a++}}function ie(){this._scheme="",this._schemeData="",this._username="",this._password=null,this._host="",this._port="",this._path=[],this._query="",this._fragment="",this._isInvalid=!1,this._isRelative=!1}function P(e,t){void 0===t||t instanceof P||(t=new P(String(t))),this._url=e,ie.call(this);e=e.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,"");D.call(this,e,null,t)}function oe(){this.name="__st"+(1e9*Math.random()>>>0)+V+++"__"}function se(){o=!1;var e=s,n=(s=[],e.sort(function(e,t){return e.uid_-t.uid_}),!1);e.forEach(function(e){var t,r=e.takeRecords();(t=e).nodes_.forEach(function(e){e=a.get(e);e&&e.forEach(function(e){e.observer===t&&e.removeTransientObservers()})}),r.length&&(e.callback_(r,e),n=!0)}),n&&se()}function ae(e,t){for(var r=e;r;r=r.parentNode){var n=a.get(r);if(n)for(var i=0;i<n.length;i++){var o=n[i],s=o.options;(r===e||s.subtree)&&(s=t(s))&&o.enqueue(s)}}}function ce(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++W}function le(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function de(e,t){return l=new le(e,t)}function he(e){var t,r;return d||((r=new le((t=l).type,t.target)).addedNodes=t.addedNodes.slice(),r.removedNodes=t.removedNodes.slice(),r.previousSibling=t.previousSibling,r.nextSibling=t.nextSibling,r.attributeName=t.attributeName,r.attributeNamespace=t.attributeNamespace,r.oldValue=t.oldValue,(d=r).oldValue=e),d}function ue(e,t){return e===t?e:!d||(t=e)!==d&&t!==l?null:d}function me(e,t,r){this.observer=e,this.target=t,this.options=r,this.transientObservedNodes=[]}function I(){}function pe(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case" ":return"&nbsp;"}}L||((v=Object.create(null)).ftp=21,v.file=0,v.gopher=70,v.http=80,v.https=443,v.ws=80,v.wss=443,(g=Object.create(null))["%2e"]=".",g[".%2e"]="..",g["%2e."]="..",w=void(g["%2e%2e"]=".."),y=/[a-zA-Z]/,F=/[a-zA-Z0-9\+\-\.]/,P.prototype={toString:function(){return this.href},get href(){var e;return this._isInvalid?this._url:((e="")==this._username&&null==this._password||(e=this._username+(null!=this._password?":"+this._password:"")+"@"),this.protocol+(this._isRelative?"//"+e+this.host:"")+this.pathname+this._query+this._fragment)},set href(e){ie.call(this),D.call(this,e)},get protocol(){return this._scheme+":"},set protocol(e){this._isInvalid||D.call(this,e+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(e){!this._isInvalid&&this._isRelative&&D.call(this,e,"host")},get hostname(){return this._host},set hostname(e){!this._isInvalid&&this._isRelative&&D.call(this,e,"hostname")},get port(){return this._port},set port(e){!this._isInvalid&&this._isRelative&&D.call(this,e,"port")},get pathname(){return this._isInvalid?"":this._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(e){!this._isInvalid&&this._isRelative&&(this._path=[],D.call(this,e,"relative path start"))},get search(){return this._isInvalid||!this._query||"?"==this._query?"":this._query},set search(e){!this._isInvalid&&this._isRelative&&((this._query="?")==e[0]&&(e=e.slice(1)),D.call(this,e,"query"))},get hash(){return this._isInvalid||!this._fragment||"#"==this._fragment?"":this._fragment},set hash(e){this._isInvalid||((this._fragment="#")==e[0]&&(e=e.slice(1)),D.call(this,e,"fragment"))},get origin(){var e;if(this._isInvalid||!this._scheme)return"";switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null"}return(e=this.host)?this._scheme+"://"+e:""}},(t=T.URL)&&(P.createObjectURL=function(e){return t.createObjectURL.apply(t,arguments)},P.revokeObjectURL=function(e){t.revokeObjectURL(e)}),T.URL=P),"undefined"==typeof WeakMap&&(B=Object.defineProperty,V=Date.now()%1e9,oe.prototype={set:function(e,t){var r=e[this.name];return r&&r[0]===e?r[1]=t:B(e,this.name,{value:[e,t],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},delete:function(e){var t=e[this.name];return!(!t||t[0]!==e||(t[0]=t[1]=void 0))},has:function(e){var t=e[this.name];return!!t&&t[0]===e}},window.WeakMap=oe),(M=self).JsMutationObserver||(a=new WeakMap,G=/Trident|Edge/.test(navigator.userAgent)?setTimeout:window.setImmediate||(n=[],i=String(Math.random()),window.addEventListener("message",function(e){e.data===i&&(e=n,n=[],e.forEach(function(e){e()}))}),function(e){n.push(e),window.postMessage(i,"*")}),o=!1,s=[],W=0,ce.prototype={observe:function(e,t){var r;if(r=e,e=window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(r)||r,!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var n,i=a.get(e);i||a.set(e,i=[]);for(var o=0;o<i.length;o++)if(i[o].observer===this){(n=i[o]).removeListeners(),n.options=t;break}n||(n=new me(this,e,t),i.push(n),this.nodes_.push(e)),n.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=a.get(e),r=0;r<t.length;r++){var n=t[r];if(n.observer===this){n.removeListeners(),t.splice(r,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}},me.prototype={enqueue:function(e){var t=this.observer.records_,r=t.length;if(0<t.length){var n=ue(t[r-1],e);if(n)return void(t[r-1]=n)}else n=this.observer,s.push(n),o||(o=!0,G(se));t[r]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){var t;e!==this.target&&(this.addListeners_(e),this.transientObservedNodes.push(e),(t=a.get(e))||a.set(e,t=[]),t.push(this))},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=a.get(e),r=0;r<t.length;r++)if(t[r]===this){t.splice(r,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,r=e.relatedNode.namespaceURI,n=((i=new de("attributes",s=e.target)).attributeName=t,i.attributeNamespace=r,e.attrChange===MutationEvent.ADDITION?null:e.prevValue);ae(s,function(e){if(e.attributes&&(!e.attributeFilter||!e.attributeFilter.length||-1!==e.attributeFilter.indexOf(t)||-1!==e.attributeFilter.indexOf(r)))return e.attributeOldValue?he(n):i});break;case"DOMCharacterDataModified":var i=de("characterData",s=e.target),n=e.prevValue;ae(s,function(e){if(e.characterData)return e.characterDataOldValue?he(n):i});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var o,s=e.target,a="DOMNodeInserted"===e.type?(o=[s],[]):(o=[],[s]),c=s.previousSibling,s=s.nextSibling;(i=de("childList",e.target.parentNode)).addedNodes=o,i.removedNodes=a,i.previousSibling=c,i.nextSibling=s,ae(e.relatedNode,function(e){if(e.childList)return i})}l=d=void 0}},M.JsMutationObserver=ce,M.MutationObserver)||((M.MutationObserver=ce)._isPolyfilled=!0),m="undefined"==typeof HTMLTemplateElement,/Trident/.test(navigator.userAgent)&&(z=document.importNode,document.importNode=function(){var e,t=z.apply(document,arguments);return t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?((e=document.createDocumentFragment()).appendChild(t),e):t}),L=(()=>{var e,t;if(!m)return e=document.createElement("template"),(t=document.createElement("template")).content.appendChild(document.createElement("div")),e.content.appendChild(t),0===(t=e.cloneNode(!0)).content.childNodes.length||0===t.content.firstChild.content.childNodes.length})(),p="template",m&&(c=document.implementation.createHTMLDocument("template"),h=!0,(O=document.createElement("style")).textContent=p+"{display:none;}",(k=document.head).insertBefore(O,k.firstElementChild),I.prototype=Object.create(HTMLElement.prototype),I.decorate=function(e){if(!e.content){var t;for(e.content=c.createDocumentFragment();t=e.firstChild;)e.content.appendChild(t);if(e.cloneNode=function(e){return I.cloneNode(this,e)},h)try{Object.defineProperty(e,"innerHTML",{get:function(){for(var e="",t=this.content.firstChild;t;t=t.nextSibling)e+=t.outerHTML||t.data.replace(Y,pe);return e},set:function(e){for(c.body.innerHTML=e,I.bootstrap(c);this.content.firstChild;)this.content.removeChild(this.content.firstChild);for(;c.body.firstChild;)this.content.appendChild(c.body.firstChild)},configurable:!0})}catch(e){h=!1}I.bootstrap(e.content)}},I.bootstrap=function(e){for(var t,r=e.querySelectorAll(p),n=0,i=r.length;n<i&&(t=r[n]);n++)I.decorate(t)},document.addEventListener("DOMContentLoaded",function(){I.bootstrap(document)}),J=document.createElement,document.createElement=function(){var e=J.apply(document,arguments);return"template"===e.localName&&I.decorate(e),e},Y=/[&\u00A0<>]/g),(m||L)&&(u=Node.prototype.cloneNode,I.cloneNode=function(e,t){var r=u.call(e,!1);return this.decorate&&this.decorate(r),t&&(r.content.appendChild(u.call(e.content,!0)),this.fixClonedDom(r.content,e.content)),r},I.fixClonedDom=function(e,t){if(t.querySelectorAll)for(var r,n,i=t.querySelectorAll(p),o=e.querySelectorAll(p),s=0,a=o.length;s<a;s++)n=i[s],r=o[s],this.decorate&&this.decorate(n),r.parentNode.replaceChild(n.cloneNode(!0),r)},K=document.importNode,Node.prototype.cloneNode=function(e){var t=u.call(this,e);return e&&I.fixClonedDom(t,this),t},document.importNode=function(e,t){var r;return e.localName===p?I.cloneNode(e,t):(r=K.call(document,e,t),t&&I.fixClonedDom(r,e),r)},L)&&(HTMLTemplateElement.prototype.cloneNode=function(e){return I.cloneNode(this,e)}),m&&(window.HTMLTemplateElement=I),window.WebComponents,window.performance&&window.performance.now||(Z=Date.now(),window.performance={now:function(){return Date.now()-Z}}),window.requestAnimationFrame||(window.requestAnimationFrame=(X=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame)?function(e){return X(function(){e(performance.now())})}:function(e){return window.setTimeout(e,1e3/60)}),window.cancelAnimationFrame||(window.cancelAnimationFrame=window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}),(O=document.createEvent("Event")).initEvent("foo",!0,!0),O.preventDefault(),O.defaultPrevented||(fe=Event.prototype.preventDefault,Event.prototype.preventDefault=function(){this.cancelable&&(fe.call(this),Object.defineProperty(this,"defaultPrevented",{get:function(){return!0},configurable:!0}))});var fe,O=/Trident/.test(navigator.userAgent),k=((!window.CustomEvent||O&&"function"!=typeof window.CustomEvent)&&(window.CustomEvent=function(e,t){t=t||{};var r=document.createEvent("CustomEvent");return r.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),r},window.CustomEvent.prototype=window.Event.prototype),(!window.Event||O&&"function"!=typeof window.Event)&&(O=window.Event,window.Event=function(e,t){t=t||{};var r=document.createEvent("Event");return r.initEvent(e,Boolean(t.bubbles),Boolean(t.cancelable)),r},window.Event.prototype=O.prototype),window.HTMLImports=window.HTMLImports||{flags:{}},window.HTMLImports);function _e(e){return ge?window.ShadowDOMPolyfill.wrapIfNeeded(e):e}var ve=Boolean("import"in document.createElement("link")),ge=Boolean(window.ShadowDOMPolyfill),x=_e(document),L={get:function(){var e=window.HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return _e(e)},configurable:!0};function we(e,t){!function e(t,r){{var n;Ce(r)?t&&t():(n=function(){"complete"!==r.readyState&&r.readyState!==ye||(r.removeEventListener(be,n),e(t,r))},r.addEventListener(be,n))}}(function(){!function(e,t){var r=t.querySelectorAll("link[rel=import]"),n=0,i=r.length,o=[],s=[];function a(){n==i&&e&&e({allImports:r,loadedImports:o,errorImports:s})}function c(e){A(e),o.push(this),n++,a()}function l(e){s.push(this),n++,a()}if(i)for(var d,h=0;h<i&&(d=r[h]);h++)(e=>ve?e.__loaded||e.import&&"loading"!==e.import.readyState:e.__importParsed)(d)?(o.push(this),n++,a()):(d.addEventListener("load",c),d.addEventListener("error",l));else a()}(e,t)},t=t||x)}Object.defineProperty(document,"_currentScript",L),Object.defineProperty(x,"_currentScript",L);var ye=(L=/Trident/.test(navigator.userAgent))?"complete":"interactive",be="readystatechange";function Ce(e){return"complete"===e.readyState||e.readyState===ye}function A(e){e.target.__loaded=!0}if(ve){function Ee(e){e.import?A({target:e}):(e.addEventListener("load",A),e.addEventListener("error",A))}if(new MutationObserver(function(e){for(var t,r=0,n=e.length;r<n&&(t=e[r]);r++)if(t.addedNodes){i=a=s=o=void 0;for(var i,o=t.addedNodes,s=0,a=o.length;s<a&&(i=o[s]);s++)(e=>"link"===e.localName&&"import"===e.rel)(i)&&Ee(i)}}).observe(document.head,{childList:!0}),"loading"===document.readyState)for(var Se,Te=document.querySelectorAll("link[rel=import]"),Le=0,Me=Te.length;Le<Me&&(Se=Te[Le]);Le++)Ee(Se)}function Ne(){window.HTMLImports.importer.bootDocument($)}function De(){Q(window.wrap(document)),window.CustomElements.ready=!0,(window.requestAnimationFrame||function(e){setTimeout(e,16)})(function(){setTimeout(function(){window.CustomElements.readyTime=Date.now(),window.HTMLImports&&(window.CustomElements.elapsed=window.CustomElements.readyTime-window.HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})})}we(function(e){window.HTMLImports.ready=!0,window.HTMLImports.readyTime=(new Date).getTime();var t=x.createEvent("CustomEvent");t.initCustomEvent("HTMLImportsLoaded",!0,!0,e),x.dispatchEvent(t)}),k.IMPORT_LINK_TYPE="import",k.useNative=ve,k.rootDocument=x,k.whenReady=we,k.isIE=L,f=window.HTMLImports,_=[],f.addModule=function(e){_.push(e)},f.initializeModules=function(){_.forEach(function(e){e(f)})},window.HTMLImports.addModule(function(e){var n=/(url\()([^)]*)(\))/g,i=/(@import[\s]+(?!url\())([^;]*)(;)/g;e.path={resolveUrlsInStyle:function(e,t){var r=e.ownerDocument.createElement("a");return e.textContent=this.resolveUrlsInCssText(e.textContent,t,r),e},resolveUrlsInCssText:function(e,t,r){e=this.replaceUrls(e,r,t,n);return this.replaceUrls(e,r,t,i)},replaceUrls:function(e,i,o,t){return e.replace(t,function(e,t,r,n){r=r.replace(/["']/g,"");return o&&(r=new URL(r,o).href),i.href=r,t+"'"+(r=i.href)+"'"+n})}}}),window.HTMLImports.addModule(function(t){var s={async:!0,ok:function(e){return 200<=e.status&&e.status<300||304===e.status||0===e.status},load:function(e,n,i){var o=new XMLHttpRequest;return(t.flags.debug||t.flags.bust)&&(e+="?"+Math.random()),o.open("GET",e,s.async),o.addEventListener("readystatechange",function(e){if(4===o.readyState){var t=null;try{var r=o.getResponseHeader("Location");r&&(t="/"===r.substr(0,1)?location.origin+r:r)}catch(e){console.error(e.message)}n.call(i,!s.ok(o)&&o,o.response||o.responseText,t)}}),o.send(),o},loadDocument:function(e,t,r){this.load(e,t,r).responseType="document"}};t.xhr=s}),window.HTMLImports.addModule(function(e){function t(e,t){this.cache={},this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={}}var o=e.xhr,s=e.flags;t.prototype={addNodes:function(e){this.inflight+=e.length;for(var t,r=0,n=e.length;r<n&&(t=e[r]);r++)this.require(t);this.checkDone()},addNode:function(e){this.inflight++,this.require(e),this.checkDone()},require:function(e){var t=e.src||e.href;this.dedupe(e.__nodeUrl=t,e)||this.fetch(t,e)},dedupe:function(e,t){return this.pending[e]?(this.pending[e].push(t),!0):this.cache[e]?(this.onload(e,t,this.cache[e]),this.tail(),!0):!(this.pending[e]=[t])},fetch:function(n,i){var e,t,r;s.load&&console.log("fetch",n,i),n?n.match(/^data:/)?(e=(r=n.split(","))[0],t=r[1],t=(-1<e.indexOf(";base64")?atob:decodeURIComponent)(t),setTimeout(function(){this.receive(n,i,null,t)}.bind(this),0)):(r=function(e,t,r){this.receive(n,i,e,t,r)}.bind(this),o.load(n,r)):setTimeout(function(){this.receive(n,i,{error:"href must be specified"},null)}.bind(this),0)},receive:function(e,t,r,n,i){this.cache[e]=n;for(var o,s=this.pending[e],a=0,c=s.length;a<c&&(o=s[a]);a++)this.onload(e,o,n,r,i),this.tail();this.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},e.Loader=t}),window.HTMLImports.addModule(function(e){function t(e){this.addCallback=e,this.mo=new MutationObserver(this.handler.bind(this))}t.prototype={handler:function(e){for(var t,r=0,n=e.length;r<n&&(t=e[r]);r++)"childList"===t.type&&t.addedNodes.length&&this.addedNodes(t.addedNodes)},addedNodes:function(e){this.addCallback&&this.addCallback(e);for(var t,r=0,n=e.length;r<n&&(t=e[r]);r++)t.children&&t.children.length&&this.addedNodes(t.children)},observe:function(e){this.mo.observe(e,{childList:!0,subtree:!0})}},e.Observer=t}),window.HTMLImports.addModule(function(r){var i=r.path,t=r.rootDocument,n=r.flags,l=r.isIE,o=r.IMPORT_LINK_TYPE,e="link[rel="+o+"]",s={documentSelectors:e,importsSelectors:[e,"link[rel=stylesheet]:not([type])","style:not([type])","script:not([type])",'script[type="application/javascript"]','script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var e=this.nextToParse();e&&this.parse(e)},parse:function(e){var t;this.isParsed(e)?n.parse&&console.log("[%s] is already parsed",e.localName):(t=this[this.map[e.localName]])&&(this.markParsing(e),t.call(this,e))},parseDynamic:function(e,t){this.dynamicElements.push(e),t||this.parseNext()},markParsing:function(e){n.parse&&console.log("parsing",e),this.parsingElement=e},markParsingComplete:function(e){e.__importParsed=!0,this.markDynamicParsingComplete(e),e.__importElement&&(e.__importElement.__importParsed=!0,this.markDynamicParsingComplete(e.__importElement)),this.parsingElement=null,n.parse&&console.log("completed",e)},markDynamicParsingComplete:function(e){e=this.dynamicElements.indexOf(e);0<=e&&this.dynamicElements.splice(e,1)},parseImport:function(e){if(e.import=e.__doc,window.HTMLImports.__importsParsingHook&&window.HTMLImports.__importsParsingHook(e),e.import&&(e.import.__importParsed=!0),this.markParsingComplete(e),e.__resource&&!e.__error?e.dispatchEvent(new CustomEvent("load",{bubbles:!1})):e.dispatchEvent(new CustomEvent("error",{bubbles:!1})),e.__pending)for(var t;e.__pending.length;)(t=e.__pending.shift())&&t({target:e});this.parseNext()},parseLink:function(e){a(e)?this.parseImport(e):(e.href=e.href,this.parseGeneric(e))},parseStyle:function(e){var t,r,n=e;(r=(t=e).ownerDocument.createElement("style")).textContent=t.textContent,i.resolveUrlsInStyle(r),e=r,(n.__appliedElement=e).__importElement=n,this.parseGeneric(e)},parseGeneric:function(e){this.trackElement(e),this.addElementToDocument(e)},rootImportForElement:function(e){for(var t=e;t.ownerDocument.__importLink;)t=t.ownerDocument.__importLink;return t},addElementToDocument:function(e){var t=this.rootImportForElement(e.__importElement||e);t.parentNode.insertBefore(e,t)},trackElement:function(t,r){function n(e){t.removeEventListener("load",n),t.removeEventListener("error",n),r&&r(e),i.markParsingComplete(t),i.parseNext()}var i=this;if(t.addEventListener("load",n),t.addEventListener("error",n),l&&"style"===t.localName){var e=!1;if(-1==t.textContent.indexOf("@import"))e=!0;else if(t.sheet)for(var o,e=!0,s=t.sheet.cssRules,a=s?s.length:0,c=0;c<a&&(o=s[c]);c++)o.type===CSSRule.IMPORT_RULE&&(e=e&&Boolean(o.styleSheet));e&&setTimeout(function(){t.dispatchEvent(new CustomEvent("load",{bubbles:!1}))})}},parseScript:function(e){var t=document.createElement("script");t.__importElement=e,t.src=e.src||(e=>(e=(e=>e.textContent+(e=>{var t=e.ownerDocument,e=(t.__importedScripts=t.__importedScripts||0,e.ownerDocument.baseURI),r=t.__importedScripts?"-"+t.__importedScripts:"";return t.__importedScripts++,"\n//# sourceURL="+e+r+".js\n"})(e))(e),"data:text/javascript;charset=utf-8,"+encodeURIComponent(e)))(e),r.currentScript=e,this.trackElement(t,function(e){t.parentNode&&t.parentNode.removeChild(t),r.currentScript=null}),this.addElementToDocument(t)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(t)||this.nextToParseDynamic())},nextToParseInDoc:function(e,t){if(e&&this._mayParse.indexOf(e)<0){this._mayParse.push(e);for(var r,n=e.querySelectorAll(this.parseSelectorsForNode(e)),i=0,o=n.length;i<o&&(r=n[i]);i++)if(!this.isParsed(r))return this.hasResource(r)?a(r)?this.nextToParseInDoc(r.__doc,r):r:void 0}return t},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(e){return(e.ownerDocument||e)===t?this.documentSelectors:this.importsSelectors},isParsed:function(e){return e.__importParsed},needsDynamicParsing:function(e){return 0<=this.dynamicElements.indexOf(e)},hasResource:function(e){return!a(e)||void 0!==e.__doc}};function a(e){return"link"===e.localName&&e.rel===o}r.parser=s,r.IMPORT_SELECTOR=e}),window.HTMLImports.addModule(function(e){var s=e.flags,a=e.IMPORT_LINK_TYPE,t=e.IMPORT_SELECTOR,r=e.rootDocument,n=e.Loader,i=e.Observer,c=e.parser,t={documents:{},documentPreloadSelectors:t,importsPreloadSelectors:[t].join(","),loadNode:function(e){o.addNode(e)},loadSubtree:function(e){e=this.marshalNodes(e);o.addNodes(e)},marshalNodes:function(e){return e.querySelectorAll(this.loadSelectorsForNode(e))},loadSelectorsForNode:function(e){return(e.ownerDocument||e)===r?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(e,t,r,n,i){var o;s.load&&console.log("loaded",e,t),t.__resource=r,t.__error=n,((e,t)=>"link"===e.localName&&e.getAttribute("rel")===t)(t,a)&&(void 0===(o=this.documents[e])&&((o=n?null:((e,t)=>{var r=document.implementation.createHTMLDocument(a),n=(r._URL=t,r.createElement("base"));return n.setAttribute("href",t),r.baseURI||(e=>Object.getOwnPropertyDescriptor(e,"baseURI"))(r)||Object.defineProperty(r,"baseURI",{value:t}),(t=r.createElement("meta")).setAttribute("charset","utf-8"),r.head.appendChild(t),r.head.appendChild(n),r.body.innerHTML=e,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(r),r})(r,i||e))&&(o.__importLink=t,this.bootDocument(o)),this.documents[e]=o),t.__doc=o),c.parseNext()},bootDocument:function(e){this.loadSubtree(e),this.observer.observe(e),c.parseNext()},loadedAll:function(){c.parseNext()}},o=new n(t.loaded.bind(t),t.loadedAll.bind(t));t.observer=new i,document.baseURI||(n={get:function(){var e=document.querySelector("base");return(e||window.location).href},configurable:!0},Object.defineProperty(document,"baseURI",n),Object.defineProperty(r,"baseURI",n)),e.importer=t,e.importLoader=o}),window.HTMLImports.addModule(function(e){var a=e.parser,c=e.importer,e={added:function(e){for(var t,r,n,i,o=0,s=e.length;o<s&&(i=e[o]);o++)t||(t=i.ownerDocument,r=a.isParsed(t)),(n=this.shouldLoadNode(i))&&c.loadNode(i),this.shouldParseNode(i)&&r&&a.parseDynamic(i,n)},shouldLoadNode:function(e){return 1===e.nodeType&&t.call(e,c.loadSelectorsForNode(e))},shouldParseNode:function(e){return 1===e.nodeType&&t.call(e,a.parseSelectorsForNode(e))}},t=(c.observer.addCallback=e.added.bind(e),HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector)}),L=window.HTMLImports,E=L.initializeModules,L.useNative||(E(),$=L.rootDocument,"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?Ne():document.addEventListener("DOMContentLoaded",Ne)),window.CustomElements=window.CustomElements||{flags:{}},E=(b=window.CustomElements).flags,C=[],b.addModule=function(e){C.push(e)},b.initializeModules=function(){C.forEach(function(e){e(b)})},b.hasNative=Boolean(document.registerElement),b.isIE=/Trident/.test(navigator.userAgent),b.useNative=!E.register&&b.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||window.HTMLImports.useNative),window.CustomElements.addModule(function(e){var c=window.HTMLImports?window.HTMLImports.IMPORT_LINK_TYPE:"none";function n(e,t){!function e(t,r,n){var i=t.firstElementChild;if(!i)for(i=t.firstChild;i&&i.nodeType!==Node.ELEMENT_NODE;)i=i.nextSibling;for(;i;)!0!==r(i,n)&&e(i,r,n),i=i.nextElementSibling;return null}(e,function(e){if(t(e))return!0;r(e,t)}),r(e,t)}function r(e,t){for(var r=e.shadowRoot;r;)n(r,t),r=r.olderShadowRoot}e.forDocumentTree=function(e,t){!function e(t,r,n){t=window.wrap(t);if(0<=n.indexOf(t))return;n.push(t);var i=t.querySelectorAll("link[rel="+c+"]");for(var o,s=0,a=i.length;s<a&&(o=i[s]);s++)o.import&&e(o.import,r,n);r(t)}(e,t,[])},e.forSubtree=n}),window.CustomElements.addModule(function(r){var s=r.flags,a=r.forSubtree,t=r.forDocumentTree;function c(e,t){return n(e,t)||i(e,t)}function n(e,t){if(r.upgrade(e,t))return!0;t&&m(e)}function i(e,t){a(e,function(e){if(n(e,t))return!0})}var o=window.MutationObserver._isPolyfilled&&s["throttle-attached"],l=(r.hasPolyfillMutations=o,r.hasThrottledAttached=o,!1),d=[];function h(e){d.push(e),l||(l=!0,setTimeout(u))}function u(){l=!1;for(var e,t=d,r=0,n=t.length;r<n&&(e=t[r]);r++)e();d=[]}function m(e){o?h(function(){p(e)}):p(e)}function p(e){e.__upgraded__&&!e.__attached&&(e.__attached=!0,e.attachedCallback)&&e.attachedCallback()}function f(e){o?h(function(){_(e)}):_(e)}function _(e){e.__upgraded__&&e.__attached&&(e.__attached=!1,e.detachedCallback)&&e.detachedCallback()}function v(e,t){if(s.dom){var r=t[0];if(r&&"childList"===r.type&&r.addedNodes){for(var n=r.addedNodes[0];n&&n!==document&&!n.host;)n=n.parentNode;var i=(i=n&&(n.URL||n._URL||n.host&&n.host.localName)||"").split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",t.length,i||"")}var o=(e=>{for(var t=e,r=window.wrap(document);t;){if(t==r)return!0;t=t.parentNode||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host}})(e);t.forEach(function(e){"childList"===e.type&&(g(e.addedNodes,function(e){e.localName&&c(e,o)}),g(e.removedNodes,function(e){e.localName&&(f(e=e),a(e,function(e){f(e)}))}))}),s.dom&&console.groupEnd()}var g=Array.prototype.forEach.call.bind(Array.prototype.forEach);function w(e){var t;e.__observer||((t=new MutationObserver(v.bind(this,e))).observe(e,{childList:!0,subtree:!0}),e.__observer=t)}function y(e){e=window.wrap(e),s.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop()),c(e,e===window.wrap(document)),w(e),s.dom&&console.groupEnd()}var b=Element.prototype.createShadowRoot;b&&(Element.prototype.createShadowRoot=function(){var e=b.call(this);return window.CustomElements.watchShadow(this),e}),r.watchShadow=function(e){if(e.shadowRoot&&!e.shadowRoot.__watched){s.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)w(t),t=t.olderShadowRoot}},r.upgradeDocumentTree=function(e){t(e,y)},r.upgradeDocument=y,r.upgradeSubtree=i,r.upgradeAll=c,r.attached=m,r.takeRecords=function(e){for(e=(e=window.wrap(e))||window.wrap(document);e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(v(e,t.takeRecords()),u())}}),window.CustomElements.addModule(function(i){var n=i.flags;function o(e,t,r){return n.upgrade&&console.group("upgrade:",e.localName),t.is&&e.setAttribute("is",t.is),s(e,t),e.__upgraded__=!0,(t=e).createdCallback&&t.createdCallback(),r&&i.attached(e),i.upgradeSubtree(e,r),n.upgrade&&console.groupEnd(),e}function s(e,t){if(!Object.__proto__)for(var r=e,n=t.prototype,i=t.native,o={},s=n;s!==i&&s!==HTMLElement.prototype;){for(var a,c=Object.getOwnPropertyNames(s),l=0;a=c[l];l++)o[a]||(Object.defineProperty(r,a,Object.getOwnPropertyDescriptor(s,a)),o[a]=1);s=Object.getPrototypeOf(s)}e.__proto__=t.prototype}i.upgrade=function(e,t){if("template"===e.localName&&window.HTMLTemplateElement&&HTMLTemplateElement.decorate&&HTMLTemplateElement.decorate(e),!e.__upgraded__&&e.nodeType===Node.ELEMENT_NODE){var r=e.getAttribute("is"),n=i.getRegisteredDefinition(e.localName)||i.getRegisteredDefinition(r);if(n&&(r&&n.tag==e.localName||!r&&!n.extends))return o(e,n,t)}},i.upgradeWithDefinition=o,i.implementPrototype=s}),window.CustomElements.addModule(function(p){p.isIE;var f=p.upgradeDocumentTree,n=p.upgradeAll,_=p.upgradeWithDefinition,i=p.implementPrototype,e=p.useNative;function v(e,t,r){e=e.toLowerCase();var n=this.getAttribute(e),r=(r.apply(this,arguments),this.getAttribute(e));this.attributeChangedCallback&&r!==n&&this.attributeChangedCallback(e,n,r)}var g=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"];var w={};function y(e){if(e)return w[e.toLowerCase()]}function o(e,t){e=e&&e.toLowerCase();var r,n=y((t=t&&t.toLowerCase())||e);if(n){if(e==n.tag&&t==n.is)return new n.ctor;if(!t&&!n.is)return new n.ctor}return t?(r=o(e)).setAttribute("is",t):(r=b(e),0<=e.indexOf("-")&&i(r,HTMLElement)),r}var b=document.createElement.bind(document),s=document.createElementNS.bind(document);function t(e,t){var r=e[t];e[t]=function(){var e=r.apply(this,arguments);return n(e),e}}e=Object.__proto__||e?function(e,t){return e instanceof t}:function(e,t){if(e instanceof t)return!0;for(var r=e;r;){if(r===t.prototype)return!0;r=r.__proto__}return!1},t(Node.prototype,"cloneNode"),t(document,"importNode"),document.registerElement=function(e,t){var r,n,i,t=t||{};if(!e)throw new Error("document.registerElement: first argument `name` must not be empty");if(e.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(e)+"'.");if((e=>{for(var t=0;t<g.length;t++)if(e===g[t])return 1})(e))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(e)+"'. The type name is invalid.");if(y(e))throw new Error("DuplicateDefinitionError: a type with name '"+String(e)+"' is already registered");t.prototype||(t.prototype=Object.create(HTMLElement.prototype)),t.__name=e.toLowerCase(),t.extends&&(t.extends=t.extends.toLowerCase()),t.lifecycle=t.lifecycle||{},t.ancestry=function e(t){t=y(t);if(t)return e(t.extends).concat([t]);return[]}(t.extends);for(var o,s=t,a=s.extends,c=0;o=s.ancestry[c];c++)a=o.is&&o.tag;s.tag=a||s.__name,a&&(s.is=s.__name);var e=t;if(!Object.__proto__){for(var l,d,h=HTMLElement.prototype,u=(e.is&&(l=document.createElement(e.tag),h=Object.getPrototypeOf(l)),e.prototype),m=!1;u;)u==h&&(m=!0),(d=Object.getPrototypeOf(u))&&(u.__proto__=d),u=d;m||console.warn(e.tag+" prototype not found in prototype chain for "+e.is),e.native=h}return(l=t.prototype).setAttribute._polyfilled||(r=l.setAttribute,l.setAttribute=function(e,t){v.call(this,e,t,r)},n=l.removeAttribute,l.removeAttribute=function(e){v.call(this,e,null,n)},l.setAttribute._polyfilled=!0),e=t.__name,(w[e]=t).ctor=(i=t,function(){return _(b((e=i).tag),e);var e}),t.ctor.prototype=t.prototype,t.prototype.constructor=t.ctor,p.ready&&f(document),t.ctor},document.createElement=o,document.createElementNS=function(e,t,r){return"http://www.w3.org/1999/xhtml"===e?o(t,r):s(e,t)},p.registry=w,p.instanceof=e,p.reservedTagList=g,p.getRegisteredDefinition=y,document.register=document.registerElement}),L=window.CustomElements,E=L.useNative,S=L.initializeModules,E?(L.watchShadow=E=function(){},L.upgrade=E,L.upgradeAll=E,L.upgradeDocumentTree=E,L.upgradeSubtree=E,L.takeRecords=E,L.instanceof=function(e,t){return e instanceof t}):S(),Q=L.upgradeDocumentTree,ee=L.upgradeDocument,window.wrap||(window.ShadowDOMPolyfill?(window.wrap=window.ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=window.ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),window.HTMLImports&&(window.HTMLImports.__importsParsingHook=function(e){e.import&&ee(wrap(e.import))}),"complete"!==document.readyState&&!L.flags.eager&&("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready)?(E=window.HTMLImports&&!window.HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded",window.addEventListener(E,De)):De(),(S=document.createElement("style")).textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n",(L=document.querySelector("head")).insertBefore(S,L.firstChild)},{}],2:[function(e,t,r){class n{constructor(e){this.player=e,this._sessionListener=this._onSessionStateChange.bind(this),this._castListener=this._onCastStateChange.bind(this),this._addCastContextEventListeners(),this.player.on("dispose",this._removeCastContextEventListeners.bind(this)),this._notifyPlayerOfDevicesAvailabilityChange(this.getCastContext().getCastState()),this.remotePlayer=new cast.framework.RemotePlayer,this.remotePlayerController=new cast.framework.RemotePlayerController(this.remotePlayer)}_addCastContextEventListeners(){var e=cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t=cast.framework.CastContextEventType.CAST_STATE_CHANGED;this.getCastContext().addEventListener(e,this._sessionListener),this.getCastContext().addEventListener(t,this._castListener)}_removeCastContextEventListeners(){var e=cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t=cast.framework.CastContextEventType.CAST_STATE_CHANGED;this.getCastContext().removeEventListener(e,this._sessionListener),this.getCastContext().removeEventListener(t,this._castListener)}_onSessionStateChange(e){e.sessionState===cast.framework.SessionState.SESSION_ENDED&&(this.player.trigger("chromecastDisconnected"),this._reloadTech())}_onCastStateChange(e){this._notifyPlayerOfDevicesAvailabilityChange(e.castState)}_notifyPlayerOfDevicesAvailabilityChange(e){this.hasAvailableDevices(e)?this.player.trigger("chromecastDevicesAvailable"):this.player.trigger("chromecastDevicesUnavailable")}hasAvailableDevices(e){return(e=e||this.getCastContext().getCastState())===cast.framework.CastState.NOT_CONNECTED||e===cast.framework.CastState.CONNECTING||e===cast.framework.CastState.CONNECTED}openCastMenu(){var e;this.player.currentSource()&&(e=function(){n.hasConnected=!0,this.player.trigger("chromecastConnected"),this._reloadTech()}.bind(this),this.getCastContext().requestSession().then(e,function(){}))}_reloadTech(){var e=this.player,t=e.currentTime(),r=e.paused(),n=e.currentSources();e.src(n),e.ready(function(){r?e.pause():e.play(),e.currentTime(t||0)})}getCastContext(){return cast.framework.CastContext.getInstance()}getRemotePlayer(){return this.remotePlayer}getRemotePlayerController(){return this.remotePlayerController}static isChromecastAPIAvailable(){return window.chrome&&window.chrome.cast&&window.cast}static isChromecastConnected(){return n.isChromecastAPIAvailable()&&cast.framework.CastContext.getInstance().getCastState()===cast.framework.CastState.CONNECTED&&n.hasConnected}}var i,o,s;i=n,s=!(o="hasConnected"),(o=(e=>"symbol"==typeof(e=((e,t)=>{if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0===r)return("string"===t?String:Number)(e);if("object"!=typeof(r=r.call(e,t||"default")))return r;throw new TypeError("@@toPrimitive must return a primitive value.")})(e,"string"))?e:e+"")(o))in i?Object.defineProperty(i,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[o]=s,t.exports=n},{}],3:[function(e,t,r){t.exports=function(e){let t=e.getComponent("Button");class r extends t{constructor(e,t){super(e,t),e.on("chromecastConnected",this._onChromecastConnected.bind(this)),e.on("chromecastDisconnected",this._onChromecastDisconnected.bind(this)),e.on("chromecastDevicesAvailable",this._onChromecastDevicesAvailable.bind(this)),e.on("chromecastDevicesUnavailable",this._onChromecastDevicesUnavailable.bind(this)),e.chromecastSessionManager&&e.chromecastSessionManager.hasAvailableDevices()?this._onChromecastDevicesAvailable():this._onChromecastDevicesUnavailable(),t.addCastLabelToButton?(this.el().classList.add("vjs-chromecast-button-lg"),this._labelEl=document.createElement("span"),this._labelEl.classList.add("vjs-chromecast-button-label"),this._updateCastLabelText(),this.el().appendChild(this._labelEl)):this.controlText("Open Chromecast menu")}buildCSSClass(){return"vjs-chromecast-button "+(this._isChromecastConnected?"vjs-chromecast-casting-state ":"")+(this.options_.addCastLabelToButton?"vjs-chromecast-button-lg ":"")+t.prototype.buildCSSClass()}handleClick(){this.player().trigger("chromecastRequested")}_onChromecastConnected(){this._isChromecastConnected=!0,this._reloadCSSClasses(),this._updateCastLabelText()}_onChromecastDisconnected(){this._isChromecastConnected=!1,this._reloadCSSClasses(),this._updateCastLabelText()}_onChromecastDevicesAvailable(){this.show()}_onChromecastDevicesUnavailable(){this.hide()}_reloadCSSClasses(){this.el_&&(this.el_.className=this.buildCSSClass())}_updateCastLabelText(){this._labelEl&&(this._labelEl.textContent=this._isChromecastConnected?this.localize("Disconnect Cast"):this.localize("Cast"))}}e.registerComponent("chromecastButton",r)}},{}],4:[function(e,t,r){var o=e("./chromecast/ChromecastSessionManager");function n(e,t){var r;t.addButtonToControlBar&&!e.controlBar.getChild("chromecastButton")&&(r=e.controlBar.children().length,void 0!==t.buttonPositionIndex&&(r=0<=t.buttonPositionIndex?t.buttonPositionIndex:e.controlBar.children().length+t.buttonPositionIndex),e.controlBar.addChild("chromecastButton",t,r)),e.on("chromecastRequested",function(e){e.chromecastSessionManager.openCastMenu()}.bind(null,e))}function s(e,t){var r;r=t,cast.framework.CastContext.getInstance().setOptions({receiverApplicationId:r.receiverAppID||chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),(r=e).chromecastSessionManager||(r.chromecastSessionManager=new o(r)),n(e,t)}t.exports=function(e){e.registerPlugin("chromecast",function(e){var i=Object.assign({addButtonToControlBar:!0},e||{});this.ready(function(){var e,t,r,n;this.controlBar&&(o.isChromecastAPIAvailable()?s(this,i):(e=this,t=i,r=1,n=setInterval(function(){30<r?clearInterval(n):(o.isChromecastAPIAvailable()&&(clearInterval(n),s(e,t)),r+=1)},1e3)))}.bind(this))})}},{"./chromecast/ChromecastSessionManager":2}],5:[function(e,t,r){var n=e("./preloadWebComponents"),i=e("./components/ChromecastButton"),o=e("./tech/ChromecastTech"),s=e("./enableChromecast");t.exports=function(e,t){Object.assign({preloadWebComponents:!1},t).preloadWebComponents&&n(),e=e||window.videojs,i(e),o(e),s(e)}},{"./components/ChromecastButton":3,"./enableChromecast":4,"./preloadWebComponents":6,"./tech/ChromecastTech":8}],6:[function(r,e,t){function n(e){return"string"==typeof window.navigator.userAgent&&0<=window.navigator.userAgent.indexOf(e)}e.exports=function(){var e=!document.registerElement,t=n("CriOS");(n("Android")&&n("Chrome/")&&window.navigator.presentation||t)&&e&&r("webcomponents.js/webcomponents-lite.js")}},{"webcomponents.js/webcomponents-lite.js":1}],7:[function(e,t,r){e("./index")(void 0,window.SILVERMINE_VIDEOJS_CHROMECAST_CONFIG)},{"./index":5}],8:[function(e,t,r){var n=e("../chromecast/ChromecastSessionManager"),i=e("./ChromecastTechUI");t.exports=function(t){var e=t.getComponent("Tech");class r extends e{constructor(e){super(e),this.featuresVolumeControl=!0,this.featuresPlaybackRate=!1,this.movingMediaElementInDOM=!1,this.featuresFullscreenResize=!0,this.featuresTimeupdateEvents=!0,this.featuresProgressEvents=!1,this.featuresNativeTextTracks=!1,this.featuresNativeAudioTracks=!1,this.featuresNativeVideoTracks=!1,this.videojs=t,this._eventListeners=[],this.videojsPlayer=this.videojs(e.playerId),this._chromecastSessionManager=this.videojsPlayer.chromecastSessionManager,this._ui.updatePoster(this.videojsPlayer.poster()),this._remotePlayer=this._chromecastSessionManager.getRemotePlayer(),this._remotePlayerController=this._chromecastSessionManager.getRemotePlayerController(),this._listenToPlayerControllerEvents(),this.on("dispose",this._removeAllEventListeners.bind(this)),this._hasPlayedAnyItem=!1,this._requestTitle=e.requestTitleFn||function(){},this._requestSubtitle=e.requestSubtitleFn||function(){},this._requestCustomData=e.requestCustomDataFn||function(){},this._modifyLoadRequestFn=e.modifyLoadRequestFn||function(e){return e},this._initialStartTime=e.startTime||0,this._playSource(e.source,this._initialStartTime),this.ready(function(){this.setMuted(e.muted)}.bind(this))}createEl(){return this._ui=this._ui||new i,this._ui.getDOMElement()}play(){this.paused()&&(this.ended()&&!this._isMediaLoading?this._playSource({src:this.videojsPlayer.src()},0):this._remotePlayerController.playOrPause())}pause(){!this.paused()&&this._remotePlayer.canPause&&this._remotePlayerController.playOrPause()}paused(){return this._remotePlayer.isPaused||this.ended()||null===this._remotePlayer.playerState}setSource(e){this._currentSource&&this._currentSource.src===e.src&&this._currentSource.type===e.type||(this._currentSource=e,this._playSource(e,0))}_playSource(e,t){var r=this._getCastSession(),n=new chrome.cast.media.MediaInfo(e.src,e.type),i=this._requestTitle(e),o=this._requestSubtitle(e),s=this.poster(),e=this._requestCustomData(e);this.trigger("waiting"),this._clearSessionTimeout(),n.metadata=new chrome.cast.media.GenericMediaMetadata,n.metadata.metadataType=chrome.cast.media.MetadataType.GENERIC,n.metadata.title=i,n.metadata.subtitle=o,n.streamType=this.videojsPlayer.liveTracker&&this.videojsPlayer.liveTracker.isLive()?chrome.cast.media.StreamType.LIVE:chrome.cast.media.StreamType.BUFFERED,s&&(n.metadata.images=[{url:s}]),e&&(n.customData=e),this._ui.updateTitle(i),this._ui.updateSubtitle(o),(s=new chrome.cast.media.LoadRequest(n)).autoplay=!0,s.currentTime=t,s=this._modifyLoadRequestFn(s),this._isMediaLoading=!0,this._hasPlayedCurrentItem=!1,r.loadMedia(s).then(function(){this._clearSessionTimeout(),this._hasPlayedAnyItem||this.triggerReady(),this.trigger("loadstart"),this.trigger("loadeddata"),this.trigger("play"),this.trigger("playing"),this._hasPlayedAnyItem=!0,this._isMediaLoading=!1,this._getMediaSession().addUpdateListener(this._onMediaSessionStatusChanged.bind(this))}.bind(this),this._triggerErrorEvent.bind(this))}setCurrentTime(e){var t=this.duration();t<e||!this._remotePlayer.canSeek||(this._remotePlayer.currentTime=Math.min(t-1,e),this._remotePlayerController.seek(),this._triggerTimeUpdateEvent())}currentTime(){return this._hasPlayedAnyItem?this._remotePlayer.currentTime:this._initialStartTime}duration(){return this._hasPlayedAnyItem?this._remotePlayer.duration:this.videojsPlayer.duration()}ended(){var e=this._getMediaSession();return!(e||!this._hasMediaSessionEnded)||!!e&&e.idleReason===chrome.cast.media.IdleReason.FINISHED}volume(){return this._remotePlayer.volumeLevel}setVolume(e){this._remotePlayer.volumeLevel=e,this._remotePlayerController.setVolumeLevel(),this._triggerVolumeChangeEvent()}muted(){return this._remotePlayer.isMuted}setMuted(e){(this._remotePlayer.isMuted&&!e||!this._remotePlayer.isMuted&&e)&&this._remotePlayerController.muteOrUnmute()}poster(){return this._ui.getPoster()}setPoster(e){this._ui.updatePoster(e)}buffered(){}seekable(){return this.videojs.createTimeRange(0,this.duration())}controls(){return!1}playsinline(){return!0}supportsFullScreen(){return!0}setAutoplay(){}playbackRate(){var e=this._getMediaSession();return e?e.playbackRate:1}setPlaybackRate(){}preload(){}load(){}readyState(){return"IDLE"===this._remotePlayer.playerState||"BUFFERING"===this._remotePlayer.playerState?0:4}_listenToPlayerControllerEvents(){var e=cast.framework.RemotePlayerEventType;this._addEventListener(this._remotePlayerController,e.PLAYER_STATE_CHANGED,this._onPlayerStateChanged,this),this._addEventListener(this._remotePlayerController,e.VOLUME_LEVEL_CHANGED,this._triggerVolumeChangeEvent,this),this._addEventListener(this._remotePlayerController,e.IS_MUTED_CHANGED,this._triggerVolumeChangeEvent,this),this._addEventListener(this._remotePlayerController,e.CURRENT_TIME_CHANGED,this._triggerTimeUpdateEvent,this),this._addEventListener(this._remotePlayerController,e.DURATION_CHANGED,this._triggerDurationChangeEvent,this)}_addEventListener(e,t,r,n){r={target:e,type:t,callback:r,context:n,listener:r.bind(n)};e.addEventListener(t,r.listener),this._eventListeners.push(r)}_removeAllEventListeners(){for(;0<this._eventListeners.length;)this._removeEventListener(this._eventListeners[0]);this._eventListeners=[]}_removeEventListener(e){var t,r=-1;for(e.target.removeEventListener(e.type,e.listener),t=0;t<this._eventListeners.length;t++)if(this._eventListeners[t].target===e.target&&this._eventListeners[t].type===e.type&&this._eventListeners[t].callback===e.callback&&this._eventListeners[t].context===e.context){r=t;break}-1!==r&&this._eventListeners.splice(r,1)}_onPlayerStateChanged(){var e=chrome.cast.media.PlayerState,t=this._remotePlayer.playerState;t===e.PLAYING?(this._hasPlayedCurrentItem=!0,this.trigger("play"),this.trigger("playing")):t===e.PAUSED?this.trigger("pause"):t===e.IDLE&&this.ended()||null===t&&this._hasPlayedCurrentItem?(this._hasPlayedCurrentItem=!1,this._closeSessionOnTimeout(),this.trigger("ended"),this._triggerTimeUpdateEvent()):t===e.BUFFERING&&this.trigger("waiting")}_onMediaSessionStatusChanged(e){this._hasMediaSessionEnded=!!e}_closeSessionOnTimeout(){this._clearSessionTimeout(),this._sessionTimeoutID=setTimeout(function(){var e=this._getCastSession();e&&e.endSession(!0),this._clearSessionTimeout()}.bind(this),1e4)}_clearSessionTimeout(){this._sessionTimeoutID&&(clearTimeout(this._sessionTimeoutID),this._sessionTimeoutID=!1)}_getCastContext(){return this._chromecastSessionManager.getCastContext()}_getCastSession(){return this._getCastContext().getCurrentSession()}_getMediaSession(){var e=this._getCastSession();return e?e.getMediaSession():null}_triggerVolumeChangeEvent(){this.trigger("volumechange")}_triggerTimeUpdateEvent(){this.trigger("timeupdate")}_triggerDurationChangeEvent(){this.trigger("durationchange")}_triggerErrorEvent(){this.trigger("error")}}r.canPlaySource=()=>n.isChromecastConnected(),r.isSupported=()=>n.isChromecastConnected(),t.registerTech("chromecast",r)}},{"../chromecast/ChromecastSessionManager":2,"./ChromecastTechUI":9}],9:[function(e,t,r){t.exports=class{constructor(){this._el=this._createDOMElement()}_createDOMElement(){var e=this._createElement("div","vjs-tech vjs-tech-chromecast"),t=this._createElement("div","vjs-tech-chromecast-poster"),r=this._createElement("img","vjs-tech-chromecast-poster-img"),n=this._createElement("div","vjs-tech-chromecast-title"),i=this._createElement("div","vjs-tech-chromecast-subtitle"),o=this._createElement("div","vjs-tech-chromecast-title-container");return t.appendChild(r),o.appendChild(n),o.appendChild(i),e.appendChild(o),e.appendChild(t),e}_createElement(e,t){e=document.createElement(e);return e.className=t,e}getDOMElement(){return this._el}_findPosterEl(){return this._el.querySelector(".vjs-tech-chromecast-poster")}_findPosterImageEl(){return this._el.querySelector(".vjs-tech-chromecast-poster-img")}_findTitleEl(){return this._el.querySelector(".vjs-tech-chromecast-title")}_findSubtitleEl(){return this._el.querySelector(".vjs-tech-chromecast-subtitle")}updatePoster(e){var t=this._findPosterImageEl();this._poster=e||null,e?(t.setAttribute("src",e),t.classList.remove("vjs-tech-chromecast-poster-img-empty")):(t.removeAttribute("src"),t.classList.add("vjs-tech-chromecast-poster-img-empty"))}getPoster(){return this._poster}updateTitle(e){var t=this._findTitleEl();(this._title=e)?(t.innerHTML=e,t.classList.remove("vjs-tech-chromecast-title-empty")):t.classList.add("vjs-tech-chromecast-title-empty")}updateSubtitle(e){var t=this._findSubtitleEl();(this._subtitle=e)?(t.innerHTML=e,t.classList.remove("vjs-tech-chromecast-subtitle-empty")):t.classList.add("vjs-tech-chromecast-subtitle-empty")}}},{}]},{},[7]);