"))})};E.hacks={};E.hacks.hide_source_change=function(video,facade_src,surrogate_src){E.polyfill.video_source_access(video);var src_hook_cb=function(e){if(hooks.src.original_handlers.get()!=surrogate_src)return;e.set_handled();return facade_src};var attr_hook_cb=function(e,args){if(args[0]!="src")return;var attr_src=hooks.attr.original_handlers.exec("src");if(util.absolute_uri(attr_src,true)!=surrogate_src)return;e.set_handled();return facade_src};var hola_src_hook_cb=function(e,args){e.set_handled();return hooks.src.original_handlers.get()};var hooks={src:util.inject_hook(video,"src",{get:src_hook_cb}),csrc:util.inject_hook(video,"currentSrc",{get:src_hook_cb}),attr:util.inject_hook(video,"getAttribute",{exec:attr_hook_cb}),hsrc:util.inject_hook(video,"hola_src",{get:hola_src_hook_cb})};E.hacks.lock_no_source_ns(video);return function(){Object.keys(hooks).forEach(function(name){hooks[name].remove()});if(!hooks.hsrc.count())delete video.hola_src}};E.hacks.on_source_change=function(video,cb){E.polyfill.video_source_access(video);var src_hook_cb=function(e,args){cb(E.get_hola_video_source(video),args[0],util.stack_to_pprint((new Error).stack))};var attr_hook_cb=function(e,args){if(args[0]!="src")return;cb(E.get_hola_video_source(video),args[1],util.stack_to_pprint((new Error).stack))};var hooks={src:util.inject_hook(video,"src",{set:src_hook_cb}),attr:util.inject_hook(video,"setAttribute",{exec:attr_hook_cb})};return function(){Object.keys(hooks).forEach(function(name){hooks[name].remove()})}};E.hacks.lock_reload_request=function(video,log){return E.hacks.on_reload_request(video,function(e,args){if(args[0]&&args[0].hola_force)return;e.set_handled();log.info("video.load() call intercepted/ignored, call stack: "+(new Error).stack)})};E.hacks.on_reload_request=function(video,cb){var lock_url=E.get_hola_video_source(video);var hook=util.inject_hook(video,"load",function(e,args){if(E.get_hola_video_source(video)==lock_url)cb(e,args)});return hook.remove.bind(hook)};E.hacks.lock_no_source_ns=function(video){if(CG("loader.html5.disable_ns_lock"))return;var hook=util.inject_hook(video,"networkState",{get:function(e){e.set_handled();var ns=hook.original_handlers.get();return ns==video.NETWORK_NO_SOURCE?video.NETWORK_LOADING:ns}});setTimeout(hook.remove.bind(hook))};E.hacks.seek_jump_workaround=function(player){var video=player.html5,last_seeking_pos,last_fixup_pos;if(!(util.is_safari&&video&&video.hasAttribute("controls"))||CG("loader.html5.disable_seek_jump_fix")){return}function seek_start(){last_seeking_pos=video.currentTime}function seek_complete(){if(last_seeking_pos==last_fixup_pos)return last_seeking_pos=last_fixup_pos=undefined;var pos=player.get_pos();var buf_now=player.get_current_buffer(pos);var buf_seek=player.get_current_buffer(last_seeking_pos);if(buf_now.from==buf_seek.from)return last_seeking_pos=last_fixup_pos=undefined;player.log.info("pos jump detected: "+last_seeking_pos+"["+buf_seek.from+";"+buf_seek.to+"] > "+pos+"["+buf_now.from+";"+buf_now.to+"], reseek now");video.currentTime=last_fixup_pos=buf_seek.from}html5_on(video,"seeking",seek_start);html5_on(video,"seeked",seek_complete);return function(){html5_off(video,"seeking",seek_start);html5_off(video,"seeked",seek_complete)}};E.polyfill={};E.polyfill.video_source_access=function(video){var pd=Object.getOwnPropertyDescriptor(video,"src");if(pd&&!pd.configurable)return false;if(!util.is_safari||util.gconf_get("loader.html5.disable_video_src_polyfill")){return true}var proto=video;while(!proto.hasOwnProperty("src")&&(proto=Object.getPrototypeOf(proto)));if(!proto||!(pd=Object.getOwnPropertyDescriptor(proto,"src"))||pd.get||pd.hasOwnProperty("value")){return true}var orig_set_attr=video.setAttribute,orig_get_attr=video.getAttribute;Object.defineProperty(video,"src",{configurable:true,enumerable:true,set:function(value){orig_set_attr.call(this,"src",value)},get:function(){var src=orig_get_attr.call(this,"src");return src!=null?util.absolute_uri(src,true):""}});perr({id:"html5_source_polyfill"});return true};function get_conf_custom_ops(player_type,instance){var ops_fn;if(!(ops_fn=CG("loader.autodetect."+player_type+".custom_ops")))return;try{if(typeof ops_fn=="string")ops_fn=new Function("instance","$","util",ops_fn);return ops_fn(instance,$,util)}catch(e){}}E.get_handler=function(Player,log,autodetect){return{rels:{shaka:"mod",dashjs:"mod"},ext_handlers:[],get_instances:function(elements){var custom_elements_fn,custom_elements;if(custom_elements_fn=CG("loader.autodetect.custom_video_elements")){custom_elements=custom_elements_fn()}var ext_elements=[];this.ext_handlers.forEach(function(get_instances_fn){ext_elements=ext_elements.concat(get_instances_fn().filter(function(el){return!elements.includes(el)}))});return util.array_unique(elements.filter(function(el){return el.tagName=="VIDEO"}).concat(custom_elements||[]).concat(ext_elements))},validate:function(el){var ignore=CG("loader.autodetect.ignore");var ignore_sel=CG("loader.autodetect.html5.ignore_selector");if(CG("loader.autodetect.theoplayer")){ignore_sel=ignore_sel||"";var theoplayer=autodetect.player_handlers.theoplayer;if(theoplayer)ignore_sel+=", "+theoplayer.sel}return el.src!==undefined&&!(el.src&&el.src.startsWith("data:"))&&(!ignore||!RegExp(ignore).test(el.src))&&(!ignore_sel||!dom_util.matches(el,ignore_sel))&&!el.className.includes("hola_video_preview")&&!el.className.includes("hola_autoplay_muted_overlay")&&!el.className.includes("spark_newsreel_video")},normalize:function(instance){var _this=this;var custom_ops=get_conf_custom_ops("html5",instance);return new Player({setup:function(){if(this.is_ready())return;var __this=this;var cb=function(){if(__this._remove_ready_listeners&&__this.is_ready()){__this._remove_ready_listeners();__this.emit("ready")}};if(custom_ops&&custom_ops.on_ready){this._remove_ready_listeners=custom_ops.on_ready(cb);return}instance.addEventListener("loadstart",cb);instance.addEventListener("play",cb);var off;if(CG("loader.autodetect.html5.attach_no_source")){off=dom_util.dom_listen(instance.parentElement||instance,cb)}this._remove_ready_listeners=function(){instance.removeEventListener("loadstart",cb);instance.removeEventListener("play",cb);if(off)off();delete __this._remove_ready_listeners}},get_element:function(){return instance},is_ready:function(){if(custom_ops&&custom_ops.is_ready)return custom_ops.is_ready();if(instance.className.includes("video-js")||!_this.validate(instance)){return false}if(instance.hola_hls)return true;if(!CG("loader.autodetect.html5.ignore_preload")&&instance.preload=="none"&&!instance.autoplay&&instance.paused){return!!(E.get_video_source(instance)&&(instance.readyState||instance.networkState==2||instance.initNetworkState_==2))}var sel=CG("loader.autodetect.html5.attach_no_source");return!!(E.get_video_source(instance)||sel&&sel(instance,$))},get_opt:function(){var opt={html5:instance};if(custom_ops){opt.custom=get_conf_custom_ops("html5",instance)}return opt},destroy:function(){if(this._remove_ready_listeners)this._remove_ready_listeners()}})}}};return E});
define("/svc/cdn/pub/mode.js",["/svc/cdn/pub/log.js","/svc/cdn/pub/util.js","/svc/cdn/pub/cdn_util.js","/svc/cdn/pub/storage.js"],function(_log,util,cdn_util,storage){var E={};var log=_log.set_module("mode");var formats={mp4:"mp4",m4p:"mp4",m3u8:"hls",mpd:"dash",m4v:"mp4",f4m:"hds",flv:"flv",webm:"webm"};var matrix=function(){var mp4_holavjs_jw={windows:{"*":{chrome:{"*":"*"},opera:{"*":"*"},firefox:function(p){if(p.os_version=="xp")return"";return p.browser_version>=42?"*":"fl"},edge:{"*":"*"},ie:function(p){var bv=p.browser_version;return bv>=11&&p.os_version>=8?"*":bv>=10?"fl":""}}},linux:{"*":{chrome:{"*":"*"},opera:{"*":"fl"},firefox:{"*":"fl"}}},macos:{"*":{chrome:{"*":"*"},opera:{"*":"fl"},firefox:{"*":"fl"},safari:{"*":"*"}}},android:{"*":{chrome:{"*":"h5"}}}};var flv_holavjs_jw=function(p){return p.browser=="ie"&&(p.browser_version==9||p.browser_version==10&&p.os_version==8)?"":"fl"};var h5_if_ms=function(){return window.MediaSource?"h5":""};return{mp4:{hola_vjs:mp4_holavjs_jw,hola_vjs5:mp4_holavjs_jw,vjs6:mp4_holavjs_jw,flowplayer6:mp4_holavjs_jw,flowplayer7:mp4_holavjs_jw,clappr:mp4_holavjs_jw,kaltura:mp4_holavjs_jw,vjs:function(p){return p.browser=="firefox"||p.browser=="ie"||p.os=="linux"&&p.browser=="opera"?"":"h5"},jw:mp4_holavjs_jw,html5:function(p){if(p.browser=="firefox"&&p.os_version=="xp")return"";return h5_if_ms()},byteark:function(p){if(p.browser=="firefox"&&p.os_version=="xp")return"";return h5_if_ms()}},flv:{hola_vjs:flv_holavjs_jw,hola_vjs5:flv_holavjs_jw,jw:flv_holavjs_jw},hds:{hola_vjs:flv_holavjs_jw,hola_vjs5:flv_holavjs_jw},hls:{hola_vjs:function(p){return p.browser=="ie"&&p.browser_version==9?"":"fl"},hola_vjs5:function(p){return p.browser=="ie"&&p.browser_version==9?"":"*"},vjs4:function(p){return p.browser=="ie"&&p.browser_version==9?"":"*"},flowplayer6:function(){return"*"},flowplayer7:function(){return"*"},clappr:function(p){return p.browser=="ie"&&p.browser_version==9?"":"h5"},jw:function(p){return p.browser=="ie"&&p.browser_version==9||p.os=="windows"&&(p.os_version=="8"||p.os_version=="8.1")&&p.browser=="firefox"?"":"*"},dailymotion:function(p){return p.browser=="ie"&&p.browser_version==9?"":"h5"},byteark:function(p){return p.browser=="ie"&&p.browser_version==9?"":"h5"},kaltura:function(p){return p.browser=="ie"&&p.browser_version==9?"":"h5"}},dash:{dashjs:h5_if_ms,shaka:h5_if_ms,hola_vjs5:h5_if_ms,flowplayer6:h5_if_ms,flowplayer7:h5_if_ms},webm:{"*":function(p){return p.browser=="chrome"?"h5":""}}}}();function check_obj_path(obj,path,order){var part=path[order.shift()];if((obj=obj[part]||obj["*"])===undefined)return false;return order.length?typeof obj=="function"?obj(path):check_obj_path(obj,path,order):obj}function get_format(url){var ext=/(?:\.([^.\/?#]+))?([?#].*)?$/.exec(url)[1];return ext?formats[ext]:url}E.get_available_tech_by_env=function(path,order){return check_obj_path(matrix,path,order)};E.get_available_tech=function(url,player){function is_flash_enabled(){try{return!!new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){var mime="application/x-shockwave-flash";return!!(navigator.mimeTypes&&navigator.mimeTypes[mime]&&navigator.mimeTypes[mime].enabledPlugin)}}var guess=util.guess;var browser=util.browser;var path={format:get_format(url),player:player,os:guess.os,os_version:guess.version,browser:browser.opera?"opera":browser.browser,browser_version:browser.version};var order=["format","player","os","os_version","browser","browser_version"];var tech=E.get_available_tech_by_env(path,order.slice());log.notice("Available tech for ["+order.map(function(o){return path[o]}).join(", ")+"] is "+tech);switch(tech){case"fl":return{flash:is_flash_enabled(),html5:false};case"h5":return{flash:false,html5:true};case"*":return{flash:is_flash_enabled(),html5:true};default:return{flash:false,html5:false}}};E.is_ip_blacklisted=function(opt){var blacklist=opt.CG("loader.ip_blacklist")||[];if(util.geoip&&util.geoip.ip&&blacklist.includes(util.geoip.ip))return true};E.is_browser_supported=function(){var version=util.browser.version;if(!util.is_android&&!util.is_windows&&!util.is_linux&&!util.is_ios&&!util.is_mac&&!util.is_webos){return false}if(util.is_android&&util.guess.version<4.4)return false;if(util.is_webos&&util.cmp_version(version,"38")<0)return false;if(util.is_edge)return true;if(util.is_ie&&version>=(util.is_mobile?11:8))return true;if(util.is_chrome&&version>=(util.is_mobile?30:23))return true;if(util.is_firefox&&version>=(util.is_mobile?68:37))return true;if(util.is_opera&&version>=(util.is_mobile?30:15))return true;if(typeof version=="string")version=version.replace(/_/g,".");if(!util.is_safari)return false;return util.is_ios_sdk||util.cmp_version(version,"10")>=0};E.select_mode=function(opt){function storage_mode(){try{return storage.session_db.get("hola_mode")||storage.db.get("hola_mode")}catch(e){}}function debug_compatible_mode(){var debug_compatible;try{debug_compatible=storage.db.get("hola_debug_compatible_browser")}catch(e){}if(debug_compatible!=undefined)debug_compatible=debug_compatible||"disabled";return debug_compatible}function browser_rule_mode(r){if(r.browser&&r.browser!=util.browser_rule_s||r.os&&r.os!=util.guess.os&&r.os!="*"){return false}var rand=cdn_util.get_random("mode");var p=r.cdn||0;if(rand=0}function is_vjs5(){return util.cmp_version(vjs_version,"5.0")>=0}function is_vjs5_new_hls(){return util.cmp_version(vjs_version,"5.9.2")>=0}E.Player=function(opt){var videojs=window.videojs||opt.html5&&opt.html5.constructor;vjs_version=videojs&&(videojs.VERSION||videojs.CDN_VERSION);util.call_super(E,this,null,opt);var _this=this;var hola_version=/-\d+$/.test(vjs_version)||videojs&&videojs.HOLA_VERSION;this.player_id=opt.player_id||1;this.vjs=this.video=opt.vjs;if(opt.html5)this.html5=opt.html5;this.vjs_adapter=is_vjs6()?E.adapters.v6(this.vjs,this.html5):is_vjs5()?E.adapters.v5(this.vjs,this.html5):E.adapters.v4(this.vjs,this.html5);this.video_url=opt.video_url;this.tech=E.vjs_getTech(opt.vjs)||"html5";this.name=hola_version?"hola":"vjs";this.backward_seek_bug=this.tech=="html5"&&util.is_chrome&&util.browser.version>=55&&vjs_version&&(hola_version?strverscmp(vjs_version,"5.10.2-22")<0:strverscmp(vjs_version,"5.16.0")<0);this.is_vjs5_new_hls=is_vjs5_new_hls();this.is_brightcove=vjs_is_brightcove(this.vjs);this.log=player_util.log(opt.log,"vjs");this.on("wrapper_attached",function(){_this.vjs.trigger("hola.wrapper_attached")});this.on("wrapper_detached",function(){_this.vjs.trigger("hola.wrapper_detached")});this.swf=this.vjs&&this.vjs.osmf&&this.vjs.osmf.el_;this.media_src_api=this.tech=="html5"&&window.MediaSource?window:videojs;this.blob2url={};this.position=0;this.vjs_handlers={};this.vjs_tech_handlers={};this.config={disable_ended_fallback:CG("loader.player.disable_ended_fallback"),disable_src_change_hiding:CG("loader.player.disable_src_change_hiding"),skip_caching:CG("loader.player.vjs.skip_caching"),cache_field:CG("loader.player.vjs.cache_field"),ext_control_logs:CG("loader.player.html5.ext_control_logs",util.debug_mode),tech_events:CG("loader.player.vjs.tech_events"),ima_ad_status:CG("loader.player.vjs.ima_ad_status"),skip_contrib_admode:CG("loader.player.vjs.skip_contrib_admode")};if(this.config.ext_control_logs&&this.html5){html5.on_ext_control(this,this.html5,function(log){_this.log.info(log+" state "+_this.state+" src "+(_this.html5.src||"")+" stack "+util.stack_to_pprint((new Error).stack))})}var is_shaka=E.vjs_getTechName(this.vjs).toLowerCase()=="shaka";this.module_handlers={shaka:function(){var is_shaka_env=function(){var adaptive=_this.get_video_type_name();return adaptive=="dash"&&is_shaka};if(!is_shaka_env())return;util.assert_enabled(shaka,"shaka module is required but disabled");var vjs_shaka_get=function(vjs){return vjs.tech_.shakaPlayer||vjs.tech_.shakaPlayer_};var shaka_obj=vjs_shaka_get(_this.vjs);_this.module=new shaka.Module({html5:opt.html5||vjs_getElement(_this.vjs),log:_this.log,shaka:shaka_obj});return{changed:function(){return!is_shaka_env()||shaka_obj!=vjs_shaka_get(_this.vjs)},uninit:function(){_this.module.uninit();_this.module=undefined}}},dashjs:function(){var is_dashjs_env=function(){var adaptive=_this.get_video_type_name();return util.is_enabled(dash)&&adaptive=="dash"&&videojs&&videojs.Html5DashJS};if(!is_dashjs_env())return;var vjs_dashjs_get=function(vjs){return vjs.tech_.sourceHandler_.mediaPlayer_};var dash_obj=vjs_dashjs_get(_this.vjs);dash.patch_dashjs(dash_obj);_this.module=new dash.Module({html5:opt.html5||vjs_getElement(_this.vjs),log:_this.log,dashjs:dash_obj,vjs:_this.vjs});_this.module.on("missing_idr",_this.dash_missing_idr=function(e){_this.emit("missing_idr",e)});return{changed:function(){return!is_dashjs_env()||dash_obj!=vjs_dashjs_get(_this.vjs)},uninit:function(){_this.module.off("missing_idr",_this.dash_missing_idr);_this.module.uninit();_this.module=_this.dash_missing_idr=undefined}}},hls_dm:function(){var vjs_hola_dm_get=function(vjs){return vjs.tech_.hls_obj};var vjs_orig_dm_get=function(vjs){return E.vjs_getTechObj(vjs).hls_};var vjs_dm_get=function(vjs){return vjs_hola_dm_get(vjs)||vjs_orig_dm_get(vjs)};var is_hls_dm_env=function(vjs){var adaptive=_this.get_video_type_name();return adaptive=="hls"&&((videojs||{}).HolaProviderHLS&&vjs_hola_dm_get(vjs)||window.Hls&&vjs_orig_dm_get(vjs))};if(!is_hls_dm_env(_this.vjs))return;util.assert_enabled(dailymotion,"dailymotion module is required but disabled");var hls_obj=vjs_dm_get(_this.vjs);_this.module=new dailymotion.Module({html5:opt.html5||vjs_getElement(_this.vjs),log:_this.log,dailymotion:hls_obj,vjs:_this.vjs,player:_this,state:_this.state});_this.rm_forwarding_emit=util.create_forwarding_emit(_this);_this.module.on("manifest_loaded",_this.hls_manifest_loaded=function(){_this.emit("manifest_loaded")});_this.module.on("level_loaded",_this.hls_level_loaded=function(lvl){_this.emit("level_loaded",lvl)});_this.module.on("level_updated",_this.hls_level_updated=function(lvl){_this.emit("level_updated",lvl)});_this.module.on("seg_stats",_this.hls_seg_stats=function(lvl){_this.emit("seg_stats",lvl)});_this.module.on("buf_stats",_this.hls_buf_stats=function(lvl){_this.emit("buf_stats",lvl)});_this.module.on("frag_load_stats",_this.hls_frag_load_stats=function(lvl){_this.emit("frag_load_stats",lvl)});_this.module.on("error",_this.hls_error=function(lvl){_this.emit("error",lvl)});return{changed:function(){return!is_hls_dm_env(_this.vjs)||hls_obj!=vjs_dm_get(_this.vjs)},uninit:function(){if(!_this.module)return;if(_this.rm_forwarding_emit)_this.rm_forwarding_emit=_this.rm_forwarding_emit();_this.module.off("manifest_loaded",_this.hls_manifest_loaded);_this.module.off("level_updated",_this.hls_level_updated);_this.module.off("seg_stats",_this.hls_seg_stats);_this.module.off("buf_stats",_this.hls_buf_stats);_this.module.off("frag_load_stats",_this.hls_frag_load_stats);_this.module.uninit();_this.module=_this.hls_level_loaded=undefined;_this.hls_seg_stats=_this.hls_buf_stats=undefined;_this.hls_frag_load_stats=undefined;_this.hls_manifest_loaded=undefined;_this.hls_level_updated=undefined},is_err_allowed:function(err){return err.code==-2&&hls_obj.streamController&&!hls_obj.streamController.media}}},hls_contrib:function(){var vjs_contrib_hls_get=function(vjs){return vjs.tech_.hls};var is_contrib_hls_env=function(){var adaptive=_this.get_video_type_name();return adaptive=="hls"&&videojs&&!videojs.HolaProviderHLS&&_this.vjs.tech_&&!_this.vjs.tech_.hls_obj&&vjs_contrib_hls_get(_this.vjs)};if(!is_contrib_hls_env())return;var hls_obj=vjs_contrib_hls_get(_this.vjs);return{changed:function(){return false},uninit:function(){},is_err_allowed:function(err){return err.code==-2&&hls_obj.mediaSource&&hls_obj.mediaSource.readyState=="closed"}}},hls_native_no_play:function(){if(!_this.is_native_hls())return;var on_check_skip_video=function(e){if(["bwsaver","cdn"].includes(e.mode))e.skip="native hls is used"};_this.on("wrapper.check_skip_video",on_check_skip_video);return{changed:function(){return!_this.is_native_hls()},uninit:function(){_this.off("wrapper.check_skip_video",on_check_skip_video)}}}};this.on("pre-started",this.module_reconf=function(){if(_this.module_ops){if(!_this.module_ops.changed())return;_this.module_ops.uninit()}Object.keys(_this.module_handlers).find(function(h){return _this.module_ops=_this.module_handlers[h]()})});this.module_reconf();this.change_state=function(state,reason){if(state.detect)state=_this.vjs.paused()?"PAUSED":"PLAYING";if(this.state==state)return;var prev_state=this.state;this.state=state;if(prev_state=="IDLE")this.emit("started");else if(reason=="ended")this.emit(reason);this.emit("state",this.state)};this.align_state=function(){if(this.is_paused()&&!this.vjs.paused())this.change_state("PLAYING");if(this.is_playing()&&this.vjs.paused())this.change_state("PAUSED")};player_set_initial_state(this);this.src_hook=util.inject_hook(this.vjs,"src",{log:this.log,exec:function(e,args){var src=args[0];if(!src)return;if(typeof src!="string")src=Array.isArray(src)?src[0].src:src.src;if(_this.blob2url[src]||src==_this.get_url())return;perr({id:"source_change"});_this.emit("src_change",{from:_this.get_url(),to:src});if(!_this.is_idle()){_this.emit("interrupted");_this.seeking=_this.pending_sourceopen=false;_this.change_state("IDLE")}_this.source_change_in_progress=true;_this.src_hook.original_handlers.exec.apply(this,args);e.set_handled();_this.refresh_buffered();_this.vjs.ready(function(){_this.change_state({detect:true})},true)}});this.on_vjs=function(events,handler){var wrapper=function(e){if(this.ready)handler.call(this,e)}.bind(this);events=typeof events=="string"?[events]:events;events.forEach(function(event){_this.vjs_handlers[event]=[].concat(_this.vjs_handlers[event]||[],wrapper);_this.vjs.on(event,wrapper)})};this.on_vjs_tech=function(event,handler){if(!this.config.tech_events||typeof this.vjs.tech!="function")return;this.vjs.tech().on(event,handler);this.vjs_tech_handlers[event]=(this.vjs_tech_handlers[event]||[]).push(handler)};this.rm_vjs_tech_handlers=function(){if(!this.config.tech_events||typeof this.vjs.tech!="function")return;var handlers,vjs_tech=this.vjs.tech();for(var event in this.vjs_tech_handlers){handlers=this.vjs_tech_handlers[event];for(var i=0;i4){this.log.err("detected a bad seek: "+this.prev_position+" -> "+this.seek_position+" current: "+this.vjs.currentTime());var backward_seek_bug=this.backward_seek_bug&&this.prev_position>this.seek_position;if(backward_seek_bug){this.log.notice("correcting bad seek to "+this.seek_position);this.vjs.currentTime(this.seek_position)}else{perr({id:"vjs_bad_seek",add_log:true,throttle:1,info:"previous: "+this.prev_position+" current: "+this.vjs.currentTime()+" seek position: "+this.seek_position})}}this.seeking=false;this.emit("seeked");this.align_state();if(this.schedule_end_of_stream_check)this.schedule_end_of_stream_check()});this.on_vjs("ended",function(a){if(this.is_ad_active())return;this.change_state("IDLE","ended")});this.on_vjs("loadstart",function(){this.source_change_in_progress=false});this.on_vjs("abort",function(){if(this.pending_sourceopen||this.source_change_in_progress){this.align_state();return this.log.info("vjs abort - ignored ("+(this.pending_sourceopen?"mse restart":"source change")+")")}this.log.info("vjs abort");this.change_state("IDLE")});this.on_vjs("seeking",function(a){this.seeking=true;this.prev_position=this.position;this.seek_position=this.position=this.vjs.currentTime();if(this.prev_position==this.position)this.prev_position=this.vjs_prev_position;this.emit("seeking",this.prev_position,this.position);if(this.end_of_stream_timer)this.end_of_stream_timer=clearTimeout(this.end_of_stream_timer)});this.play_during_ad=false;this.on_vjs("pause",function(a){this.log.info("vjs pause state "+this.state+" seeking "+!!this.seeking+" ad_playback "+this.is_ad_active());if(this.seeking)return;if(this.is_idle())return;this.play_during_ad=false;this.change_state("PAUSED");this.emit("pause")});this.on_vjs("play",function(a){this.log.info("vjs play state "+this.state+" seeking "+!!this.seeking);if(this.seeking&&!this.is_idle())return;if(this.play_during_ad=this.is_ad_active())return;if(this.is_idle())this.seeking=false;if(this.adjust_pos&&this.html5&&this.html5.currentTime)this.html5.currentTime+=.1;this.change_state("PLAYING");this.emit("play")});this.on_vjs("waiting",function(a){this.emit("waiting")});this.on_vjs("error",function(a){var err;if(err=vjs_get_error(this,a))this.emit("error",err)});this.on_vjs("timeupdate",function(a){if(this.is_ad_active()){this.emit("ad_time",{duration:this.vjs.duration(),position:this.vjs.currentTime()})}else{this.buffered=E.vjs_getBuffered(this.vjs,this.html5);var pos=this.vjs.currentTime();if(pos>this.position&&!this.vjs.paused()&&!this.is_playing()){this.change_state("PLAYING");perr({id:"vjs_missing_play_event",add_log:true,throttle:1})}this.vjs_prev_position=this.position;this.position=pos;this.emit("timeupdate",pos)}});this.on_vjs("progress",function(){this.buffered=undefined});this.on_vjs("mediachange",function(a){this.emit("quality_level")});this.on_vjs("beforeresolutionchange",function(e){this.emit("beforeresolutionchange")});this.on_vjs("resolutionchange",function(){this.emit("resolutionchange")});this.on_vjs("volumechange",function(){this.emit("volumechange")});this.on_vjs("problem_report",function(e){this.emit("problem_report",e&&e.data?{data:e.data}:undefined)});this.on_vjs("save_logs",function(e){this.emit("save_logs",e&&e.data?{data:e.data}:undefined)});this.on_vjs("durationchange",function(){this.emit("duration_changed")});this.vjs.hola_logs=function(){var bws=window.hola_cdn&&window.hola_cdn.video_ctx_latest&&window.hola_cdn.video_ctx_latest.attached_bws;return bws?bws.get_logs():_this.log.get_logs()};this.on("wrapper.check_skip_video",function(e){if(videojs&&videojs.HolaProviderHLS&&e.method=="hls"&&e.mode!="stats")return e.skip="method hls is not allowed, when hap_hls loaded";var is_adaptive=util.is_adaptive(_this.get_video_type_name());if(is_adaptive&&e.mode=="cdn"&&!_this.module_ops)return e.skip="adaptive video, but no handler can handle"});this.is_enc_key=function(url){this.get_levels(true);return this.enc_keys&&this.enc_keys[url]};this.ad_handler=player_util.select_ad_handler(this,E.ad_handlers,{vjs:_this.vjs})};zutil.inherits(E.Player,player_util.Player);E.Player.prototype.uninit=function(){if(this.module_ops)this.module_ops=this.module_ops.uninit();if(this.ad_handler)this.ad_handler=this.ad_handler.uninit();this.events.removeAllListeners();this.rm_vjs_tech_handlers();for(var event in this.vjs_handlers){for(var i=0;i=0)this.vjs.textTracks()[track].mode="showing"};function process_osmf_levels(levels){var ret={};if(!levels||!levels.length)return ret;for(var i=0;i1&&sources[0].type=="video/mp4")return sources.map(function(s){return s.src});var _this=this;function to_playlist(p){if(!p)return;var bitrate=0;var _p={playlist:p.uri,url:p.uri,attributes:{}};if(p.attributes){for(var a in p.attributes)_p.attributes[a.toLowerCase()]=p.attributes[a];bitrate=_p.bitrate=p.attributes.BANDWIDTH}_p.bitrate=bitrate;if(p.segments&&p.segments.length){_p.segments=[];p.segments.forEach(function(seg,i){var _url=seg.resolvedUri||resolve_url(base_url,p.uri,seg.uri);var _seg={playlist_url:p.uri,url:_url,duration:seg.duration,media_index:i+(p.mediaSequence||0),bitrate:bitrate};if(seg.key){_seg.key=seg.key.resolvedUri||resolve_url(base_url,p.uri,seg.key.uri);_this.enc_keys=_this.enc_keys||{};_this.enc_keys[_seg.key]=true}_p.segments.push(_seg)})}return _p}var base_url=this.get_url(),ret=[],playlists,_playlists;var vjs=this.vjs,hls_obj=get_hls_object(vjs),media,state;if(!hls_obj)return;if(!vjs.currentSrc()||!(playlists=hls_obj.playlists))return;if((state=playlists.state)=="HAVE_NOTHING"||!(media=playlists.media())||!media.segments){return}if(state=="SWITCHING_MEDIA")return;if(!playlists.master||!(_playlists=playlists.master.playlists))return;_playlists.forEach(function(p){ret.push(to_playlist(p))});ret.sort(function(a,b){return Math.sign(a.bitrate-b.bitrate)});return ret});util.module_fn(E,function get_current_playlist(){});util.module_fn(E,function get_segment_info(url){var info,levels;if(levels=this.get_levels(true)){for(var l in levels){if(info=levels[l].segments.find(function(s){return s.url==url})){return info}}}perr({id:"vjs_no_segment_info",info:{url:url},add_log:true})});util.module_fn(E,function is_native_hls(){return this.tech=="html5"&&this.get_video_type_name()=="hls"&&!util.is_blob_url(html5.get_video_source(this.html5))});function get_hls_object(vjs){var hls_obj=vjs.tech_&&vjs.tech_.vhs||vjs.tech_&&vjs.tech_.hls||vjs.hls;if(hls_obj&&!hls_obj.playlists)hls_obj=undefined;return hls_obj}function get_bitrate_byteark(vjs){try{return vjs.getLevelIndex()>0?vjs.getLevels()[vjs.getLevelIndex()-1].bitrate:0}catch(e){return 0}}util.module_fn(E,function get_bitrate(){var hls_obj=get_hls_object(this.vjs);if(!hls_obj){if(this.vjs.getLevels)return get_bitrate_byteark(this.vjs);return 0}var curr=hls_obj.playlists.media();return curr?(curr.attributes||{}).BANDWIDTH||0:0});util.module_fn(E,function get_current_fragment(){});util.module_fn(E,function get_current_level(){if(zutil.is_mocha())return 0;if(this.vjs.osmf&&this.vjs.osmf.currentLevel)return this.vjs.osmf.currentLevel();var hls_obj=get_hls_object(this.vjs);if(!hls_obj)return 0;var curr=hls_obj.playlists.media();return curr&&curr.uri});E.Player.prototype.get_bandwidth=function(){var hls_obj=get_hls_object(this.vjs);return(hls_obj||{}).bandwidth||0};E.Player.prototype.init_adaptive=function(adaptive){var _this=this,tech=E.vjs_getTechObj(this.vjs),hls;if(this.module)return this.module.init_adaptive&&this.module.init_adaptive(adaptive);if(hls=get_hls_object(this.vjs)){hls.playlists.on("loadedmetadata",function(){_this.emit("manifest_loaded")});hls.playlists.on("loadedplaylist",function(){_this.levels_stale=true;_this.emit("manifest_loaded")});if(tech){tech.on("levelloading",function(e,url){if(_this.is_live_stream())_this.emit("live_manifest",{url:url,format:"m3u8"})});tech.on("manifestparsed",function(){_this.emit("manifest_parsed")})}}var videojs=this.vjs.constructor;var xhr_cont=this.is_vjs5_new_hls?hls:videojs.Hls||videojs;var hook=util.inject_hook(xhr_cont,"xhr",adaptive.fallback_wrapper(function(e,args){var opt=args[0],callback=args[1];if(!opt||opt.responseType!="arraybuffer")return;var url=opt.uri||opt.url;if(hook.count()>1&&!_this.get_segment_info(url))return;if(_this.is_enc_key(url))return void _this.log.info("skip key file "+url);e.set_handled();if(typeof callback!="function")callback=function(){};var fake_xhr={abort:function(){if(!this.req||this.req.error===ERR.aborted)return;this.req.abort();adaptive.remove_segment(segment);_this.log.notice("req aborted",this.req)},requestTime:Date.now(),addEventListener:function(){if(!this.req||!this.req.xhr)return _this.log.warn("addEventListener: not exposed xhr");this.req.xhr.addEventListener.apply(this.req.xhr,arguments)},removeEventListener:function(){if(!this.req||!this.req.xhr){return _this.log.warn("removeEventListener: not exposed "+"xhr")}this.req.xhr.removeEventListener.apply(this.req.xhr,arguments)}};var segment={callback:callback,url:url,fake_xhr:fake_xhr,playlist_id:"def",dur:10,streaming:false&&opt.streaming};adaptive.init_segment(segment);return fake_xhr}));adaptive.on("uninit",hook.remove.bind(hook));if(adaptive.adaptive=="hls"){adaptive.on("seg_complete",function(req){if(req.error||!req.opt.streaming||!req.served)return;var segment=req.info.segment,fake_xhr=segment.fake_xhr;fake_xhr.status=200;fake_xhr.response=null;fake_xhr.responseTime=Date.now();fake_xhr.roundTripTime=fake_xhr.responseTime-fake_xhr.requestTime;fake_xhr.bytesReceived=req.res.size;var bw=Math.floor(fake_xhr.bytesReceived/fake_xhr.roundTripTime*8*1e3);if(adaptive.bw_src&&adaptive.bw_src.bw>bw)bw=adaptive.bw_src.bw;fake_xhr.bandwidth=bw;fake_xhr.type="final";segment.callback.call(fake_xhr,undefined,is_vjs5()?fake_xhr:segment.url)})}};E.Player.prototype.ondata_adaptive=function(chunk,adaptive){if(this.module){if(this.module.ondata_adaptive)this.module.ondata_adaptive(chunk,adaptive);return}var segment=chunk.req.info.segment;var callback=segment.callback,url=segment.url;var fake_xhr=segment.fake_xhr;if(!chunk.data||chunk.req.error){return void callback.call(fake_xhr,chunk.req.error||true,is_vjs5()?fake_xhr:url)}adaptive.indexer[segment.playlist_id].completed=segment.index;fake_xhr.status=200;fake_xhr.response=chunk.data;fake_xhr.responseTime=Date.now();fake_xhr.roundTripTime=fake_xhr.responseTime-fake_xhr.requestTime;fake_xhr.bytesReceived=fake_xhr.response.byteLength||fake_xhr.response.length;var bw=Math.floor(fake_xhr.bytesReceived/fake_xhr.roundTripTime*8*1e3);if(adaptive.bw_src&&adaptive.bw_src.bw>bw)bw=adaptive.bw_src.bw;fake_xhr.bandwidth=bw;if(chunk.req.opt.streaming)fake_xhr.type="progress";return callback.call(fake_xhr,false,is_vjs5()?fake_xhr:url)};util.module_fn(E,function get_decoded_frames(){if(this.vjs_adapter.is_changing_src())return 0;var el=vjs_getElement(this.vjs);if(!el)return 0;if(is_video_element(el)){util.assert_enabled(html5,"html5 module is required but disabled");return html5.get_decoded_frames(el)}return el.vjs_getProperty&&el.vjs_getProperty("decodedFrames")});util.module_fn(E,function get_dropped_frames(){if(this.vjs_adapter.is_changing_src())return 0;var el=vjs_getElement(this.vjs);if(!el)return 0;if(is_video_element(el)){util.assert_enabled(html5,"html5 module is required but disabled");return html5.get_dropped_frames(el)}return el.vjs_getProperty&&el.vjs_getProperty("droppedFrames")});E.Player.prototype.get_caps=function(){return player_util.Player.prototype.get_caps({save_context:["progressive","hls","hap_hls"],hap_provider_loaded:this.name=="hola"||!!(window.hola_videojs_hls||util.dom_query("script[src*=hola_videojs_hls]"))})};E.Player.prototype.get_est_bytes=function(){var hls=get_hls_object(this.vjs);if(hls&&hls.stats)return{bytes:hls.stats.mediaBytesTransferred,src:"vjs_hls"};var res=null;var el=vjs_getElement(this.vjs);if(is_video_element(el)){util.assert_enabled(html5,"html5 module is required but disabled");res=html5.est_bytes_from_tag(el)}return res};E.Player.prototype.get_current_error=function(){return vjs_get_error(this)};E.Player.prototype.check_buffer=function(opt){
var el=vjs_getElement(this.vjs);if(is_video_element(el)){util.assert_enabled(html5,"html5 module is required but disabled");html5.check_buffer.call(this,el,opt)}};E.Player.prototype.play_src=function(src,idx){var t,vjs=this.vjs;src=src[idx||0];vjs.reset();if(src.poster)vjs.poster(src.poster);if(vjs.dock&&vjs.mediainfo){if(t=src.title||src.description)vjs.mediainfo.name=t;vjs.mediainfo.description=src.description&&t!=src.description?src.description:""}vjs.src([{type:src.type,src:src.file||src.url}]);vjs.load();vjs.play()};E.Player.prototype.muted=function(v){if(this.is_ad_active()&&this.vjs.ima3&&this.vjs.ima3.adPlayer)return this.vjs.ima3.adPlayer.muted(v);return this.vjs.muted(v)};E.Player.prototype.volume=function(v){if(this.is_ad_active()&&this.vjs.ima3&&this.vjs.ima3.adPlayer)return this.vjs.ima3.adPlayer.volume(v);return this.vjs.volume(v)};E.Player.prototype.fullscreen=function(v){if(v===undefined)return this.vjs.isFullscreen();if(v==true)this.vjs.requestFullscreen();else this.vjs.exitFullscreen()};E.Player.prototype.has_started=function(){return!this.is_idle()&&this.vjs.hasStarted()};E.Player.prototype.scrubbing=function(is_scrubbing){return this.vjs.scrubbing&&this.vjs.scrubbing(is_scrubbing)};E.Player.prototype.get_title=function(){return this.vjs.mediainfo&&this.vjs.mediainfo.name};E.Player.prototype.get_description=function(){return this.vjs.mediainfo&&this.vjs.mediainfo.description};E.Player.prototype.set_controlbar_visible=function(is_visible){is_visible=is_visible===undefined?true:is_visible;if(this._is_controlbar_visible===is_visible||!this.vjs.userActive)return;var cb=$(this.get_ui().control_bar);this._is_controlbar_visible=is_visible;if(this.activity_to)this.activity_to=clearInterval(this.activity_to);if(this.cb_style!==undefined)this.cb_style=void cb.attr("style",this.cb_style);if(is_visible)return;this.activity_to=setInterval(function(){this.vjs.userActive(false)}.bind(this),250);this.cb_style=cb.attr("style")||"";cb[0].style.setProperty("display","none","important");this.vjs.userActive(false)};E.Player.prototype.get_versions=function(){var ver={vjs:vjs_version};if(this.module&&this.module.get_versions)assign(ver,this.module.get_versions());return ver};function map_ad_events(vjs,player,map){Object.keys(map).forEach(function(ad_event){if(typeof map[ad_event]!="function"){var player_event=map[ad_event];map[ad_event]=function(){player.emit(player_event)}}vjs.on(ad_event,map[ad_event])});return function(){Object.keys(map).forEach(function(ad_event){vjs.off(ad_event,map[ad_event])})}}E.ad_handlers={};E.ad_handlers.Contrib=Contrib;E.ad_handlers.VastVpaid=VastVpaid;function Contrib(player){this.ad_flag_re=/(^|\s)vjs-ad-(loading|playing)/;this.player=player;this.is_googima=!!this.get_ad_scheme().match("googima");this.log=player.log.set_module(this.is_googima?"googima":"adother");this.init()}Contrib.is_enabled=function(opt){return opt.vjs.ads};Contrib.prototype.get_ad_class=function(){var m,cls=this.player.get_ui().container.className;return(m=cls.match(this.ad_flag_re))&&m[0].trim()};Contrib.prototype.get_ad_scheme=function(){var vjs=this.player.vjs;return vjs.ima||vjs.ima3||vjs.ads._googleIma?"contrib/googima":"contrib/other"};Contrib.prototype.init=function(){var _this=this,player=this.player,vjs=player.vjs;if(typeof vjs.ads=="function"){this.adinit_hook=util.inject_hook(vjs,"ads",{post_set:function(e,args){_this.adinit_hook=_this.adinit_hook.remove();_this.init()}});return this.log.info("contrib-ads awaiting plugin setup")}this.log.info("contrib-ads init state "+vjs.ads.state+" class "+(this.get_ad_class()||""));var ad_info={};var vjs_contrib_ads_map={"contrib/googima":{adstart:function(){ad_info={};player.emit("ad_start");player.emit("ad_play");_this.update_state()},adtimeupdate:"ad_time",adtimeout:"ad_timeout","ads-first-quartile":"ad_time","ads-midpoint":"ad_time","ads-third-quartile":"ad_time","ima3-resumed":"ad_play","ima3-paused":"ad_pause","ima3-skipped":function(){ad_info.skipped=true},adserror:"ad_error",adend:function(){player.emit(ad_info.skipped?"ad_skipped":"ad_complete")}},"contrib/other":{}};this.contrib_ad_map_uninit=map_ad_events(vjs,player,vjs_contrib_ads_map[this.get_ad_scheme()]);this.ad_state=this.calc_state();if(this.is_ad_active())this.ima_fix_state("PAUSED");this.adcls_unwatch=dom_util.attr_watch(player.get_ui().container,{attr:"class",toggle_pattern:this.ad_flag_re,watch_fn:function(from,to){if(to){_this.log.info("ad mode started: "+to.trim()+" detected");_this.update_state()}else{_this.log.info("ad mode finished: "+from.trim()+" removed");_this.update_state()}}});this.adstat_hook=util.inject_hook(vjs.ads,"state",{set:function(e,args){_this.log.info("contrib-ads state changed: "+vjs.ads.state+" >> "+args[0]);_this.adstat_hook.original_handlers.set(args[0]);_this.update_state();e.set_handled()}})};Contrib.prototype.ima_fix_state=function(target_state){var player=this.player;if(player.state==target_state)return;player.log.info("vjs ima_fix_state state "+player.state+">>"+target_state+" ad_state "+player.vjs.ads.state);player.state=target_state;player.emit("state",player.state);player.emit(target_state=="PAUSED"?"pause":"play")};Contrib.prototype.calc_state=function(){var player=this.player,plugin_state=player.vjs.ads.state;if(this.is_ima_ad_playing())return"PLAYING";if(!plugin_state||plugin_state.match(/^content-(playback|resuming)/)||!this.ad_flag_re.test(player.get_ui().container.className)){return"IDLE"}return plugin_state=="ad-playback"?"PLAYING":"LOADING"};Contrib.prototype.update_state=function(){var from=this.ad_state,to=this.ad_state=this.calc_state();if(from==to)return;var player=this.player;if(from=="IDLE"){this.ima_fix_state("PAUSED");player.emit("ad_suspend")}else if(to=="IDLE"){player.emit("ad_restore",{ad_empty:from=="LOADING"});if(player.play_during_ad){player.play_during_ad=false;player.emit("play");player.change_state("PLAYING")}else if(!player.vjs.ended()){this.ima_fix_state("PLAYING")}}};Contrib.prototype.is_ad_source=function(){return false};Contrib.prototype.is_ad_active=function(){var player=this.player,ad_active=false;var ads=player.vjs&&player.vjs.ads;if(!player.skip_contrib_admode&&ads){ad_active=ads.isInAdMode&&ads.isInAdMode()&&ads.inAdBreak&&ads.inAdBreak()}return this.ad_state=="LOADING"||this.ad_state=="PLAYING"||ad_active};Contrib.prototype.is_ad_loading=function(){return this.ad_state=="LOADING"};Contrib.prototype.is_ima_ad_playing=function(){var player=this.player,ima;if(!player.config.ima_ad_status||!(ima=player.vjs.ima)||!ima.controller||!ima.controller.sdkImpl||typeof ima.controller.sdkImpl.isAdPlaying!="function"){return}return ima.controller.sdkImpl.isAdPlaying()};Contrib.prototype.is_ad_playing=function(){if(!this.is_ad_active())return false;var vjs=this.player.vjs;if(vjs.ima3)return vjs.ima3.adPlayer&&!vjs.ima3.adPlayer.paused();var is_ad_playing;if(vjs.ima&&(is_ad_playing=this.is_ima_ad_playing())!==undefined)return is_ad_playing;if(vjs.ima)return vjs.ima.adPlaying;return false};Contrib.prototype.is_ad_paused=function(){if(!this.is_ad_active())return false;var vjs=this.player.vjs;if(vjs.ima3)return vjs.ima3.adPlayer&&vjs.ima3.adPlayer.paused();var is_ad_playing;if(vjs.ima&&(is_ad_playing=this.is_ima_ad_playing())!==undefined)return!is_ad_playing;if(vjs.ima)return!vjs.ima.adPlaying;return false};Contrib.prototype.ad_play=function(){if(!this.is_ad_active())return;var vjs=this.player.vjs;if(vjs.ima3&&vjs.ima3.adPlayer)return void vjs.ima3.adPlayer.play();if(vjs.ima&&vjs.ima.adsManager){vjs.ima.adsManager.resume();vjs.ima.adPlaying=true}};Contrib.prototype.ad_pause=function(){if(!this.is_ad_active())return;var vjs=this.player.vjs;if(vjs.ima3&&vjs.ima3.adPlayer)return void vjs.ima3.adPlayer.pause();if(vjs.ima&&vjs.ima.adsManager){vjs.ima.adsManager.pause();vjs.ima.adPlaying=false}};Contrib.prototype.uninit=function(){if(this.contrib_ad_map_uninit)this.contrib_ad_map_uninit();if(this.adcls_unwatch)this.adcls_unwatch();if(this.adstat_hook)this.adstat_hook.remove();if(this.adinit_hook)this.adinit_hook.remove()};function VastVpaid(player){this.player=player;this.init()}VastVpaid.is_enabled=function(opt){return opt.vjs.vast};VastVpaid.prototype.get_ad_scheme=function(){return"vast"};VastVpaid.prototype.init=function(){var _this=this,player=this.player,vjs=player.vjs;var ad_info=null;this.detect_ad_inplace=function(e){if(vjs.vast.adUnit){_this.ad_attached=vjs.vast.adUnit&&(vjs.vast.adUnit.getSrc()||{}).src==e.to;return}if(vjs.vastTracker){var m=zutil.get(vjs.vastTracker,"creative.mediaFiles",[]);_this.ad_attached=!!m.find(function(_m){return _m.fileURL==e.to});return}_this.ad_attached=false};this.is_vast_active=function(){if(!vjs.vastClient)return false;var ads_label=vjs.controlBar.getChild("AdsLabel");return!!(ads_label&&ads_label.el_&&dom_util.is_el_in_page(ads_label.el_))};this.vast_ad_start=function(){if(ad_info)return ad_info.skipped=false;ad_info={};player.emit("ad_start");player.emit("ad_play")};this.vast_ad_error=function(e){if(!ad_info)return;ad_info=null;player.emit("ad_error",e&&e.error&&e.error.message||"Unknown error")};this.vast_ad_skip=function(){if(ad_info)ad_info.skipped=true};this.vast_ad_complete=function(){player.log.notice("vjs vast.adEnd/vast.adCancel ad_info "+!!ad_info);if(!ad_info)return;player.emit(ad_info.skipped?"ad_skipped":"ad_complete");ad_info=null};this.vast_ad_map_uninit=map_ad_events(vjs,player,{"vast.adStart":this.vast_ad_start,"vast.adSkip":this.vast_ad_skip,"vast.adError":this.vast_ad_error,"vast.adEnd":this.vast_ad_complete,"vast.adsCancel":this.vast_ad_complete,"vpaid.AdImpression":"ad_impression","vpaid.AdSkipped":this.vast_ad_skip,"vpaid.pauseAd":"ad_pause","vpaid.resumeAd":"ad_play","hola.adConfigReqSending":"ad_config","hola.adDownload":"ad_download"});player.on("src_change",this.detect_ad_inplace);this.detect_ad_inplace({to:player.get_url()})};VastVpaid.prototype.is_ad_source=function(){return this.ad_attached};VastVpaid.prototype.is_ad_active=function(){return!this.ad_attached&&this.is_vast_active()};VastVpaid.prototype.is_ad_loading=function(){return false};VastVpaid.prototype.is_ad_playing=function(){return false};VastVpaid.prototype.is_ad_paused=function(){return false};VastVpaid.prototype.ad_play=function(){return false};VastVpaid.prototype.ad_pause=function(){return false};VastVpaid.prototype.uninit=function(){var player=this.player;player.off("src_change",this.detect_ad_inplace);this.vast_ad_map_uninit()};E.ad_handlers.ArtiMedia=clone_class(ad_handlers.ArtiMedia);E.ad_handlers.ArtiMedia.is_enabled=function(opt){return opt.vjs.artimedia};function resolve_url(src_url,playlist_url,segment_url){if(playlist_url==src_url)return util.resolve_url(src_url,segment_url);return util.resolve_url(util.resolve_url(src_url,playlist_url||""),segment_url)}function player_set_initial_state(player){var vjs=player.vjs;player.state="IDLE";player.ready=false;player.is_late_attach=function(){return player.is_playing()||player.is_ad_active()||!vjs_atInitPosition(vjs)};vjs.ready(function ready_cb(){if(!player.get_url()){if(!ready_cb.exec_count)player.log.info("waiting for videojs source setup");ready_cb.exec_count=(ready_cb.exec_count||0)+1;if(player.is_brightcove)setTimeout(ready_cb,100);else if(!vjs_getOptions(vjs,"sources.length")){player.ready=true}return}player.ready=true;player.change_state({detect:true})},true)}function vjs_change_src(vjs,src){var was_playing=!vjs.paused();vjs.src(src);if(was_playing)vjs.ready(vjs.play.bind(vjs))}E.vjs_getTechObj=function(vjs){return vjs.tech_||vjs.tech};E.vjs_getTechName=function(vjs){var t;if(t=vjs.techName||vjs.techName_)return t;var el;if(!(el=vjs_getElement(vjs)))return"";return(t=el.id&&el.id.match(/_([a-zA-Z0-9]+)_api$/))&&t[1]||""};E.vjs_getTech=function(vjs){var t=E.vjs_getTechName(vjs).toLowerCase();if(t=="flash"||t=="html5")return t;var el=vjs_getElement(vjs);var tag=el&&el.tagName&&el.tagName.toLowerCase();return tag=="video"?"html5":tag=="object"?"flash":""};E.vjs_getBuffered=function(vjs,_html5){return _html5&&!vjs_version?_html5.buffered:vjs.buffered()};function vjs_is_brightcove(vjs){return/(^|\s)bc-player/.test(vjs.el().className)}function vjs_get_html5(vjs){var el=vjs_getElement(vjs);return is_video_element(el)?el:undefined}function vjs_get_error(player,a){var err_map={1:{message:"download was cancelled",reason:"other"},2:{message:"network error",reason:"media_load"},3:{message:"decode error",reason:"media_decode"},4:{message:"source not supported",reason:"media_support"},5:{message:"encryption error",reason:"media_decode"},unknown:{message:"unknown",reason:"other"},"-1":{message:"no video was loaded",reason:"other"},"-2":{message:"timeout",reason:"media_load"}};var code,msg;if(player.vjs.error){var ops,error=player.vjs.error();if(!error)return;code=error.code;msg=error.message;if((ops=player.module_ops)&&ops.is_err_allowed&&ops.is_err_allowed(error)){return}}code=code||a.target&&a.target.error&&a.target.error.code||a.code;var info=err_map[code]||err_map.unknown;msg=msg||a.message||info.message;return{code:code,reason:info.reason,message:msg}}function vjs_atInitPosition(vjs){var el;if(!(el=vjs_get_html5(vjs)))return!vjs.currentTime();return html5.at_init_position(el)}E.vjs_getElement=vjs_getElement;function vjs_getElement(vjs){var tech=E.vjs_getTechObj(vjs),el=tech&&(tech.el_||tech.el);if(!el&&typeof vjs.el=="function")el=vjs.el().getElementsByClassName("vjs-tech")[0];return typeof el=="function"&&!(el instanceof Node)?el.call(tech):el}function is_video_element(el){return el&&el.tagName&&el.tagName.toLowerCase()=="video"}function vjs_getOptions(vjs,path){return path?zutil.get(vjs.options(),path):vjs.options()}E.hacks={};E.hacks.hide_source_change=function(vjs,facade_src,surrogate_src){var proxy_fn=function(e,args,based_on){if(args[0]!==undefined)return;var real_src=based_on.original_handlers.exec();if(real_src!=surrogate_src)return;e.set_handled();return facade_src};var hooks={src:util.inject_hook(vjs,"src",function(e,args){return proxy_fn(e,args,hooks.src)}),csrc:util.inject_hook(vjs,"currentSrc",function(e,args){return proxy_fn(e,args,hooks.csrc)})};return function(){Object.keys(hooks).forEach(function(name){hooks[name].remove()})}};E.adapters={};E.adapters.v6=function(vjs,_html5){function register_mw(){var videojs=window.videojs||vjs.constructor;if(!videojs||register_mw.attached)return;videojs.use("video/mp4",function(){return{setSource:function(src,next){if(src.hola_media_src_gen)src.src=src.hola_media_src_gen();next(null,src)}}});register_mw.attached=true}return assign(E.adapters.v5(vjs,_html5),{replace_src:function(src,create_cb){register_mw();vjs_change_src(vjs,{src:src,type:"video/mp4",hola_media_src_gen:create_cb})},src_from_cache:function(cache){return vjs.changingSrc_?cache.source.src:cache.src},is_changing_src:function(){return vjs.changingSrc_}})};E.adapters.v5=function(vjs){return assign(E.adapters.v4(vjs),{seek:function(pos){vjs.currentTime(pos)}})};E.adapters.v4=function(vjs,_html5){return{replace_src:function(src,create_cb){vjs_change_src(vjs,{src:create_cb(),type:"video/mp4"})},src_from_cache:function(cache){return cache.src},is_changing_src:function(){},seek:function(pos){var _this=this;if(_html5&&_html5.readyState<_html5.HAVE_METADATA){return _html5.addEventListener("loadedmetadata",function cb(){_html5.removeEventListener("loadedmetadata",cb);_this.seek(pos)})}vjs.currentTime(pos)},ready_state:function(){if(vjs.readyState)try{return vjs.readyState()}catch(e){}if(_html5)return _html5.readyState;return-1},using_native_controls:function(){if(vjs.usingNativeControls)return vjs.usingNativeControls()}}};return E});
define("/svc/cdn/pub/android.js",["/svc/cdn/pub/util.js","/util/util.js","/svc/cdn/pub/player_util.js","/util/events.js","/svc/cdn/pub/perr.js"],function(util,zutil,player_util,events,perr){var E={};var player_map={};var need_hash=["get_duration","get_pos","get_url","seek","is_live_stream","is_prepared","get_app_label","js_attach_ready","is_ad_playing","get_poster","get_title","playlist_cb","module_cb","get_buffered_pos","is_scrubbing","is_seeking","is_fullscreen"];function PlayerProxy(hash,proxy){var _this=this;this.hash=hash;Object.keys(proxy).forEach(function(key){if(key=="get_player_ids")return;_this[key]=function(){var args=[].slice.call(arguments);if(need_hash.includes(key))args.push(hash);return proxy[key].apply(proxy,args)}})}E.get_player=function(){var proxy=window.hola_java_proxy,ids;if(!proxy)return[];if(!proxy.get_player_ids)return[proxy];if(!(ids=proxy.get_player_ids()))return[];var id_list=ids.split(",");for(var i=0;i-1){var ws=new util.ws("127.0.0.1:"+ws_socket,{path:"mp",protocol:"ws"});ws.on("message",hola_cdn.android_message)}}hola_cdn.android_messenger.on("message",attach_handler);if(instance.js_attach_ready)instance.js_attach_ready()},get_element:function(){return instance},is_ready:function(){return this.ready},get_opt:function(){return{android:instance}}})}}};E.t={mocha_setup:function(opt){perr=opt.perr||perr}};return E});
define("/svc/cdn/pub/youtube.js",["cash","/svc/cdn/pub/util.js","/util/util.js","/svc/cdn/pub/html5.js","/svc/cdn/pub/player_util.js"],function($,util,zutil,html5,player_util){var E={};E.detected=function(){return!!E.get_player()};E.get_player=function(){var yt=$(".html5-video-player");return yt&&yt.getUpdatedConfigurationData?yt:null};var YT=E.YT={PlayerState:{UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3,CUED:5}};E.Player=function(opt){util.call_super(E,this,null,opt);var _this=this;this.name="youtube";var yt=this.yt=opt.yt;var html5=this.html5=yt.querySelector("video");if(!this.html5)throw new Error("youtube flash unsupported");else util.assert_enabled(html5,"html5 module is required but disabled");this.yt_on=function(event,handler){handler=handler.bind(_this);yt.addEventListener(event,handler);_this.on("uninit",function(){yt.removeEventListener(event,handler)})};this.html5_on=function(event,handler){handler=handler.bind(_this);html5.addEventListener(event,handler);_this.on("uninit",function(){html5.removeEventListener(event,handler)})};this.yt_set_state=function(s){var prev=_this.state;if(s==YT.PlayerState.BUFFERING)_this.state=prev||"PLAYING";else if(s==YT.PlayerState.PLAYING)_this.state="PLAYING";else if(s==YT.PlayerState.PAUSED)_this.state="PAUSED";else _this.state="IDLE";if(!prev||prev==_this.state)return;if(prev=="IDLE")_this.emit("started",_this.get_url());else if(s==YT.PlayerState.ENDED)_this.emit("ended");_this.emit("state",_this.state);if(_this.is_paused())_this.emit("pause");else if(_this.is_playing())_this.emit("play")};this.yt_set_ad_state=function(s){var prev=_this.ad_state;if(s==YT.PlayerState.BUFFERING)_this.ad_state=prev||"PLAYING";else if(s==YT.PlayerState.PLAYING)_this.ad_state="PLAYING";else if(s==YT.PlayerState.PAUSED)_this.ad_state="PAUSED";else _this.ad_state="IDLE";if(_this.state=="IDLE"&&_this.ad_state!="IDLE")_this.yt_set_state(YT.PlayerState.PLAYING);if(!prev||prev==_this.ad_state)return;if(prev=="IDLE")_this.emit("ad_start");else if(s==YT.PlayerState.ENDED)_this.emit("ad_complete");else if(_this.ad_state=="IDLE")_this.emit("ad_skipped");if(_this.ad_state=="PAUSED")_this.emit("ad_pause");else if(_this.ad_stats=="PLAYING")_this.emit("ad_play")};this.yt_set_state(yt.getPlayerState());this.yt_set_ad_state(yt.getAdState());this.html5_on("timeupdate",function(e){if(this.is_ad_active()){this.emit("ad_time",{duration:html5.duration,position:html5.currentTime})}else this.emit("timeupdate",this.get_pos())});this.yt_on("onStateChange",function(e){this.yt_set_state(e)});this.yt_on("onAdStateChange",function(e){this.yt_set_ad_state(e)});this.yt_on("onPlaybackQualityChange",function(e){this.emit("quality_level")});this.yt_on("onError",function(e){_this.emit("error",{reason:"other",msg:"unknown"})});this.html5_on("seeking",function(e){this.emit("seeking")});this.html5_on("seeked",function(e){this.emit("seeked")});if(0){this.yt_on("beginseeking",function(e){console.log("beginseeking")});this.yt_on("endseeking",function(e){console.log("endseeking")});yt.addEventListener("onStateChange",function(e){console.log("XXX state %s duration %s src %s",e,_this.html5.duration,_this.html5.currentSrc)});yt.addEventListener("onAdStateChange",function(e){console.log("XXX adState %s duration %s src %s",e,_this.html5.duration,_this.html5.currentSrc)});yt.addEventListener("onApiChange",function(e){console.log("XXX onApiChange",e,"time",yt.getCurrentTime(),"state",yt.getPlayerState(),yt.getAdState())});yt.addEventListener("onStateChange",function(e){console.log("XXX onStateChange",e,"time",yt.getCurrentTime(),"state",yt.getPlayerState(),"ad",yt.getAdState())});yt.addEventListener("onAdStart",function(e){console.log("XXX onAdStart",e,"time",yt.getCurrentTime(),"state",yt.getPlayerState(),yt.getAdState())});yt.addEventListener("onAdAnnounce",function(e){console.log("XXX onAdAnnounce",e,"time",yt.getCurrentTime(),"state",yt.getPlayerState(),yt.getAdState())});yt.addEventListener("onError",function(e){console.log("XXX onError",e,"time",yt.getCurrentTime(),"state",yt.getPlayerState(),yt.getAdState())});yt.addEventListener("onReady",function(e){console.log("XXX onReady",e,"time",yt.getCurrentTime(),"state",yt.getPlayerState(),yt.getAdState())});yt.addEventListener("onAdStateChange",function(e){console.log("XXX onAdStateChange",e,"time",yt.getCurrentTime(),"state",yt.getPlayerState(),yt.getAdState())});yt.addEventListener("onAdMetadataAvailable",function(e){console.log("XXX onAdMetadataAvailable",e,"time",yt.getCurrentTime(),"state",yt.getPlayerState(),yt.getAdState())});yt.addEventListener("onAdInfoChange",function(e){console.log("XXX onAdInfoChange",e,"time",yt.getCurrentTime(),"state",yt.getPlayerState(),yt.getAdState())})}};zutil.inherits(E.Player,player_util.Player);E.Player.prototype.uninit=function(){this.emit("uninit")};E.Player.prototype.get_url=function(){return this.yt.getVideoUrl()};E.Player.prototype.get_pos=function(){return this.yt.getCurrentTime()};E.Player.prototype.get_state=function(){return this.state};E.Player.prototype.is_playing=function(){return this.state=="PLAYING"};E.Player.prototype.is_paused=function(){return this.state=="PAUSED"};E.Player.prototype.is_idle=function(){return this.state=="IDLE"};E.Player.prototype.is_live_stream=function(){return false};E.Player.prototype.get_duration=function(){return this.yt.getDuration()};E.Player.prototype.refresh_buffered=function(){};E.Player.prototype.get_buffered=function(){if(!this.is_ad_active()){var b=this.html5.buffered;var a=[];for(var i=0;i0){var buffer_len=buf.to-this.player.get_pos();this.state=buffer_len>=this.config.buffer_threshold?"buffer_full":buffer_len<=this.config.buffer_threshold-5?"buffer_low":last_state=="buffer_full"?"buffer_full":"buffer_low"}else this.state="buffer_loaded";if(this.state!=last_state)this.player.emit("buffer_monitor",this.state)});this.on_player_state=this.try_wrapper(function(){this.run(!this.player.is_idle())});this.run=function(run){if(!(run^this.running))return;this.state=undefined;this.running=run;if(run){this.buffer_poll_interval=setInterval(this.buffer_poll,this.config.poll_period);this.buffer_poll()}else{this.buffer_poll_interval=clearInterval(this.buffer_poll_interval)}}};E.PlayerExtension.prototype.enable=function(){if(this.enabled++)return;this.player.on("state",this.on_player_state);if(!this.player.is_idle())this.run(true)};E.PlayerExtension.prototype.disable=function(force_close){if(!force_close&&(!this.enabled||--this.enabled))return;this.run(false);this.player.off("state",this.on_player_state)};E.PlayerExtension.prototype.try_wrapper=function(func){return perr.try_wrapper({prefix:"buffer_monitor"},func.bind(this))};E.PlayerExtension.prototype.uninit=function(){this.disable(true)};return E});
define("/svc/cdn/pub/airplay.js",["/svc/cdn/pub/util.js","/svc/cdn/pub/perr.js"],function(util,perr){var E={};var CG=util.gconf_get,assign=Object.assign;var fake_airplay=util.get_spark_uri("hola_fake_airplay");E.api={events:{avail_changed:"webkitplaybacktargetavailabilitychanged",target_changed:"webkitcurrentplaybacktargetiswirelesschanged"},is_available:function(){return fake_airplay||!!window.WebKitPlaybackTargetAvailabilityEvent},show_menu:function(video){if(fake_airplay)return;video.webkitShowPlaybackTargetPicker()},is_disabled:function(video){return video.webkitWirelessVideoPlaybackDisabled||util.is_blob_url(video.currentSrc||video.src)},is_casting:function(video){return!!video.webkitCurrentPlaybackTargetIsWireless}};E.PlayerExtension=function(player){if(!(this instanceof E.PlayerExtension))return new E.PlayerExtension(player);this.player=player;this.config=CG("loader.player.extension.airplay",{});this.shutdown=!E.api.is_available()||!player.html5||this.config.disabled;this.enabled_count=0};E.PlayerExtension.prototype.enable=function(){if(this.shutdown||this.enabled_count++)return;var player=this.player,video=this.player.html5;player.airplay={available:false,casting:false,show_menu:E.api.show_menu.bind(E.api,video)};this.avail_changed_cb=this.try_wrapper(function(e){var now_available=e.availability=="available";if(now_available==player.airplay.available)return;player.airplay.available=now_available;player.emit("airplay.availability",assign({},player.airplay))});this.casting_changed_cb=this.try_wrapper(function(){var now_casting=E.api.is_casting(video);if(now_casting==player.airplay.casting)return;player.airplay.casting=now_casting;player.emit("airplay.casting",assign({},player.airplay))});this.init_timer=setTimeout(this.try_wrapper(function(){this.init_timer=undefined;video.addEventListener(E.api.events.avail_changed,this.avail_changed_cb);video.addEventListener(E.api.events.target_changed,this.casting_changed_cb);this.casting_changed_cb();if(fake_airplay)this.avail_changed_cb({availability:"available"})}),0)};E.PlayerExtension.prototype.disable=function(force_close){if(this.shutdown||!force_close&&--this.enabled_count)return;this.enabled_count=0;if(this.init_timer)return this.init_timer=clearTimeout(this.init_timer);var video=this.player.html5;video.removeEventListener(E.api.events.avail_changed,this.avail_changed_cb);video.removeEventListener(E.api.events.target_changed,this.casting_changed_cb)};E.PlayerExtension.prototype.try_wrapper=function(func){return perr.try_wrapper({prefix:"airplay"},func.bind(this))};E.PlayerExtension.prototype.uninit=function(){this.disable(true);this.shutdown=true};return E});
define("/svc/cdn/pub/ooyala.js",{__stub:1});
define("/svc/cdn/pub/akamai.js",{__stub:1});
define("/svc/cdn/pub/custom_player.js",["cash","/svc/cdn/pub/util.js","/util/util.js","/svc/cdn/pub/html5.js","/svc/cdn/pub/player_util.js"],function($,util,zutil,html5,player_util){var E={};var CG=util.gconf_get;var assign=Object.assign;E.Player=function(opt){util.call_super(E,this,undefined,opt);this.custom_player=custom_player_polyfill(opt.custom);this.name="custom";this.tech="unknown";this.log=player_util.log(opt.log,"custom_player");this.custom_events=["ad_suspend","ad_start","ad_play","ad_restore","ready"];this.custom_events.forEach(function(e){this["on_"+e]=this.emit.bind(this,e);this.custom_player.on(e,this["on_"+e])},this);this._reconf(opt);if(opt.reconf_notifier)opt.reconf_notifier.on("update",this._reconf.bind(this));this.custom_player.init(this)};zutil.inherits(E.Player,player_util.Player);Object.keys(html5.Player.prototype).forEach(function(m){E.Player.prototype[m]=function(){if(this.engine)return this.engine[m].apply(this.engine,arguments);return util.call_super(E,this,m)}});["is_ready","is_autostart","is_idle","is_playing","is_paused","is_live_stream","is_interrupted","is_seeking","is_ad_active","is_ad_loading","is_ad_playing","is_ad_paused","is_controlbar_visible","is_bitrate_supported","play","pause","seek","muted","volume","ad_play","ad_pause","play_url","play_src","check_seekable","fullscreen","captions_supported","enable_context_menu","disable_context_menu","set_controlbar_visible","set_captions_track","get_state","get_pos","get_duration","get_media_type","get_media_size","get_caps","get_player","get_poster","get_ad_scheme","get_captions_track","get_playlist_url","get_title","get_description","get_decoded_frames","get_dropped_frames","get_current_error","get_buffered","get_resolution","get_bandwidth","get_est_bytes"].forEach(function(m){E.Player.prototype[m]=function(){if(this.custom_player[m])return this.custom_player[m].apply(this.custom_player,arguments);if(this.engine)return this.engine[m].apply(this.engine,arguments);return util.call_super(E,this,m)}});E.Player.prototype.uninit=function(){this.custom_events.forEach(function(e){this.custom_player.off(e,this["on_"+e])},this);this.custom_player.uninit();this._reconf()};E.Player.prototype.get_versions=function(){var versions=assign({},this.custom_player.get_versions());if(this.engine)assign(versions,this.engine.get_versions());return versions};E.Player.prototype.get_url=function(){var src;if(this.engine&&(src=this.engine.get_url())&&!util.is_blob_url(src))return src;if(src=this.custom_player.get_url())return src;return util.call_super(E,this,"get_url")};E.Player.prototype.get_ui=function(){var ui={};if(this.engine)assign(ui,this.engine.get_ui());assign(ui,this.custom_player.get_ui());return ui};E.Player.prototype.scrubbing=function(is_scrubbing){if(is_scrubbing===undefined)return this._is_scrubbing||this.custom_player.is_scrubbing();this._is_scrubbing=is_scrubbing;if(this.engine&&typeof this.engine.is_scrubbing=="function")this.engine.is_scrubbing(is_scrubbing)};E.Player.prototype.is_ad_source=function(url){return this.custom_player.is_ad_source(url)||util.call_super(E,this,"is_ad_source",url)};E.Player.prototype._reconf=function(opt){opt=opt||{};if(this._reconf_delayed){this.off("ready",this._reconf_delayed);this._reconf_delayed=undefined}if(this.engine){this.engine_events_uninit();this.engine.uninit();this.engine=this.html5=undefined;this.tech="unknown"}if(!this.is_ready()){this._reconf_delayed=this._reconf.bind(this,opt);return this.on("ready",this._reconf_delayed)}if(opt.html5){this.engine=new Html5Engine(opt);this.engine_events_uninit=this._bind_events_to(this.engine);this.tech="html5";this.html5=opt.html5;if(!this.engine.is_idle())this.emit("started")}this.emit("reconf")};E.Player.prototype._bind_events_to=function(engine){var _this=this;var events=["started","state","seeking","seeked","waiting","timeupdate","duration_changed","pause","play","error","interrupted","ended"];if(engine.module){(engine.module.event_list||[]).forEach(function(e){if(!events.includes(e))events.push(e)})}var handlers=events.map(function(e){return{event:e,cb:_this.emit.bind(_this,e)}});handlers.forEach(function(h){engine.on(h.event,h.cb)});return function(){handlers.forEach(function(h){engine.off(h.event,h.cb)})}};zutil.inherits(Html5Engine,html5.Player);function Html5Engine(opt){this.custom_player=opt.custom||{};util.call_super(Html5Engine,this,undefined,zutil.omit(opt,"custom"))}function custom_player_polyfill(player){var always_true=function(){return true},noop=function(){};var defaults={is_ready:always_true,get_versions:noop,get_ui:noop,is_scrubbing:noop,is_ad_source:noop,on:noop,off:noop,init:noop,uninit:noop};Object.keys(defaults).forEach(function(key){if(!player[key])player[key]=defaults[key]});return player}E.get_handler=function(Player){return{get_instances:function(){var get;if(get=CG("loader.autodetect.custom_player.get_instances"))return get($,util)},normalize:function(instance){var get_opt=CG("loader.autodetect.custom_player.get_opt")||function(){};var get_opt_all=CG("loader.autodetect.custom_player.get_opt_all");return new Player({get_element:function(){return document.body.contains(instance)&&instance},get_opt:function(){if(get_opt_all)return get_opt_all(instance,$,util);return{custom:assign({custom_player:true},get_opt(instance,$,util))}}})}}};return E});
define("/svc/cdn/pub/wrapper.js",["/util/es6_shim.js","/util/util.js","/svc/cdn/pub/util.js","/svc/cdn/pub/zjwplayer3.js","/svc/cdn/pub/vjs.js","/svc/cdn/pub/html5.js","/svc/cdn/pub/android.js","/svc/cdn/pub/youtube.js","/util/events.js","filesaver","/svc/cdn/pub/flowplayer.js","/svc/cdn/pub/load_perf.js","/svc/cdn/pub/ios.js","/svc/cdn/pub/hola_vjs.js","/svc/cdn/pub/buffer_monitor.js","/svc/cdn/pub/airplay.js","/svc/cdn/pub/ooyala.js","/svc/cdn/pub/akamai.js","/svc/cdn/pub/custom_player.js","/svc/cdn/pub/perr.js"],function(shim,zutil,util,zjwplayer,vjs,html5,android,youtube,events,filesaver,flowplayer,load_perf,ios,hola_vjs,buffer_monitor,airplay,ooyala,akamai,custom_player,perr){var CG=util.gconf_get;var try_wrapper_n=0,try_wrapper_err;function try_wrapper(opt,func,ctx){opt=opt||{};if(typeof opt=="function"){ctx=func;func=opt;opt={}}var perr_id="wrapper_typeerror";var _this=ctx||this;var wrapped_func=function(){try{try_wrapper_n++;return func.apply(this,arguments)}catch(e){try{var need_perr=!try_wrapper_err&&!e.try_wrapper;try_wrapper_err=true;if(need_perr){perr({id:perr_id,err:""+e.message,bt:e.stack,use_beacon:true,add_log:CG("loader.wrapper.report_typeerror")});this.log.err("detach, wrapper typeerror "+(e.stack||e));if(this.attached)this.detach({err:"typeerror"});e.try_wrapper=true}}catch(e2){console.error("try_wrapper first err",e);console.error("try_wrapper second err",e2);perr({id:"wrapper_try_"+perr_id,err:""+e2.message,bt:e2.stack})}if(opt.can_throw)throw e}finally{try_wrapper_n--;if(!try_wrapper_n)try_wrapper_err=false}};return opt.method?wrapped_func:wrapped_func.bind(_this)}function define_ext(name,obj){if(!obj||require.specified(name))return;this.log.info("reusing external library "+name);define(name,function(){return obj})}zutil.inherits(Wrapper,events.EventEmitter);Wrapper.prototype.new_context=function(){var _this=this;var video_ctx=this.video_ctx=new util.events;video_ctx.video_url=this.video_url;video_ctx.video_type=this.video_type;video_ctx.safe_env=function(cb){var stash_predicate=function(_s){return _s.video_ctx==video_ctx};var s;if(!(s=_this.stash.find(stash_predicate)))return cb();var restore_env=_this.replace_env(s);cb();restore_env()};this.last_video_ctx=undefined;this.video_init();this.log.info("creating video context for "+video_ctx.video_url);this.emit("context_created",video_ctx)};Wrapper.prototype.remove_context=function(video_ctx){if(video_ctx&&this.video_ctx!=video_ctx)return;this.last_video_ctx=this.video_ctx;this.video_ctx=undefined};Wrapper.prototype.uninit_prev=function(opt){opt=opt||{};opt.video_ctx=opt.video_ctx||this.video_ctx;if(!opt.video_ctx)return;this.log.info("closing video context for "+opt.video_ctx.video_url);opt.video_ctx.emit("shutdown",{err:opt.err});this.remove_context(opt.video_ctx)};Wrapper.prototype.verify_attached=function(is_attached){if(!!this.attached!=!!is_attached)return false;var s=is_attached?"already":"not";this.log.info("wrapper.js "+s+" attached to player");perr({id:"wrapper_"+s+"_attached"});return-1};Wrapper.prototype.check_skip_video=function(video_url){var skip_reasons={};if(util.is_blob_url(video_url||this.video_url)){this.log.err("media source url found instead of real video url: "+"probably html5 module not detected");skip_reasons.missing_url="video url not detected"}if(util.get_spark_uri("hola_skip"))skip_reasons.forced_by_uri="skip enforced from page uri";return skip_reasons};Wrapper.prototype.video_init=function(){var video_ctx=this.video_ctx;var video_type=this.player.get_video_type_name(this.video_url);this.adaptive=video_ctx.adaptive=util.get_adaptive_by_type(video_type);this.method=video_ctx.method=util.is_progressive(video_type)?"progressive":this.adaptive=="hls"&&this.player.hap_enabled()?"hap_hls":util.get_method_type(video_type);this.video_check_n=(this.video_check_n||0)+1;if(this.video_check_n>1)this.log.reset_logs();var page_url=util.page2cache(util.get_top_url());if(page_url!=this.page_url){this.page_url=page_url;this.video_seq_n=0;this.video_seq_url=undefined}if(!this.player.is_ad_source()&&this.video_url!=this.video_seq_url){this.video_seq_n++;this.video_seq_url=this.video_url}};Wrapper.prototype.save_context=function(){var supported=this.player.get_caps().save_context;if(!this.video_url||this.player.is_ad_source()||this.player.tech!="html5"||!supported.includes(this.method)){return}this.log.notice("saving interrupted context for "+this.video_url);this.video_ctx.emit("suspend");this.stash.push({video_url:this.video_url,video_check_n:this.video_check_n,video_ctx:this.video_ctx,player_restore:this.player.stash&&this.player.stash(),log_restore:this.log.stash()});this.remove_context()};Wrapper.prototype.restore_context=function(opt){var stash,url=this.video_url;if(!(stash=this.stash.find(function(s){return s.video_url==url})))return;this.stash.splice(this.stash.indexOf(stash),1);if(stash.video_check_n .vjs-tech > div > video",_sel:"video[preload=metadata]",get_instances:function(elements){if(!CG("loader.autodetect.theoplayer"))return;var hls_elts=$(elements).filter(this.sel).filter(this._sel);if(hls_elts.length==2)return hls_elts.parent().get(0)},validate:function(instance){return $(instance).find(this._sel).filter(function(v){return v.src}).length},normalize:function(instance){var container=$(instance).closest(".theoplayer, .video-js").get(0);var player_api=container&&container.player;var get_opt=function(){if(!player_api)return{};var _this=this;return{custom:{name:"theo_player_hls",init:function(player){var started=function(){if(_this.started)return;_this.started=true;player.emit("started")};var play=function(){player.emit("play");started()};var timeupdate=function(){if(!player_api.paused()&&!player_api.ended())started();player.emit("timeupdate",player.get_pos())};var pause=function(){player.emit("pause")};var ended=function(){if(!_this.started)return;_this.started=false;player.emit("ended")};_this.listeners={play:play,timeupdate:timeupdate,pause:pause,ended:ended};for(var key in _this.listeners)player_api.on(key,_this.listeners[key])},uninit:function(){if(!_this.listeners)return;for(var key in _this.listeners)player_api.off(key,_this.listeners[key]);_this.listeners=null},is_idle:function(){return!this.started},play:function(){return player_api.play()},pause:function(){return player_api.pause()},muted:function(mute){return player_api.muted(mute)},volume:function(volume){return player_api.volume(volume)},get_duration:function(){return player_api.duration()},get_pos:function(){return player_api.currentTime()},get_ui:function(){var cont=container||instance;var control_bar=$(cont).find(".vjs-control-bar:not(.theo-top-controlbar)");var progress_bar=$(cont).find(".vjs-progress-control");return{container:cont,fullscreen:cont,media:instance,control_bar:control_bar,progress_bar:progress_bar}},get_url:function(){return player_api.currentSrc()},get_buffered:function(){return player_api.buffered()},play_src:function(src){try{player_api.src([{src:src}]);player_api.load();player_api.play()}catch(e){}},is_ad_active:function(){return container&&container.className.indexOf("fave-ad-playing")>-1},is_paused:function(){return player_api.paused()},is_playing:function(){return!player_api.paused()&&!player_api.ended()&&!player_api.seeking()},is_seeking:function(){return player_api.seeking()}}}};return new Player({get_element:function(){return instance},get_opt:get_opt})}}};return E});
define("/svc/cdn/pub/powa.js",["cash","/util/util.js","/svc/cdn/pub/util.js","/svc/cdn/pub/dom_util.js"],function($,zutil,util,dom_util){var assign=Object.assign;var E={};var CG=util.gconf_get;function get_conf_custom_ops(player_type,instance){var ops_fn;if(!(ops_fn=CG("loader.autodetect."+player_type+".custom_ops")))return;try{if(typeof ops_fn=="string")ops_fn=new Function("instance","$","util",ops_fn);return ops_fn(instance,$,util)}catch(e){}}E.get_handler=function(Player){return{rels:{html5:"anc",dailymotion:"mod",dash:"mod",shaka:"mod"},get_instances:function(){if(!window.PoWaSettings||!window.powas)return;return Object.values(window.powas).map(function(p){return p.powa}).filter(function(p){return!!p})},validate:function(el){var ignore_sel=CG("loader.autodetect.powa.ignore_selector");var container=el.getElement&&el.getElement();return!ignore_sel||!container||!dom_util.matches(container,ignore_sel)},normalize:function(instance){return new Player({setup:function(){var _this=this;this._powa_events=new util.events;this._pending_ready=!this.is_ready();this._powa_ads_on=instance.getStatus().adRunning;this._powa_ads_toggle=function(){var new_ad_status=instance.getStatus().adRunning;if(!zutil.xor(_this._powa_ads_on,new_ad_status))return;_this._powa_ads_on=new_ad_status;_this._powa_events.emit(_this._powa_ads_on?"ad_suspend":"ad_restore")};instance.on("start",this._powa_ads_toggle);instance.on("adStart",this._powa_ads_toggle);instance.on("adEnd",this._powa_ads_toggle);var instance_ready=function(){if(_this._pending_ready)_this._pending_ready=_this.emit("ready");_this._powa_events.emit("ready")};instance.on("ready",instance_ready);var powa_ready=function(ev){if(ev.detail.powa!=instance)return;window.removeEventListener("powaReady",powa_ready);instance_ready()};window.addEventListener("powaReady",powa_ready);this._off_powa_ready=function(){instance.off("ready",instance_ready);window.removeEventListener("powaReady",powa_ready)}},destroy:function(){instance.off("start",this._powa_ads_toggle);instance.off("adStart",this._powa_ads_toggle);instance.off("adEnd",this._powa_ads_toggle);if(this._off_powa_ready)this._off_powa_ready=void this._off_powa_ready()},get_element:function(){return $("video#"+instance.getID().replace("powa-","powa-player-"))[0]},is_ready:function(){if(!this.get_element())return true;return!!instance.getStatus().state},get_opt:function(){return{custom:assign({name:"powa",powa:instance,get_url:function(){return instance.getStatus().stream},get_versions:function(){return{powa:zutil.get(instance,"videoData.version")}},play:function(){instance.play()},pause:function(){instance.pause()},muted:function(mute){if(mute===undefined)return instance.getStatus().muted;instance.mute(mute)},volume:function(volume){if(volume===undefined)return instance.getStatus().volume;instance.volume(volume)},get_ui:function(){return{container:instance.getElement()}},is_ready:this.is_ready.bind(this),is_autostart:function(){return instance.getElement().getAttribute("data-autoplay")=="true"},is_ad_active:function(){return instance.getStatus().adRunning},on:this._powa_events.on.bind(this._powa_events),off:this._powa_events.off.bind(this._powa_events)},get_conf_custom_ops("powa",instance))}},get_caps:function(){return{init_on_master_ready:true,reconf_by_wrapper:true}}})}}};return E});
define("/svc/cdn/pub/bluebillywig.js",["/util/util.js"],function(zutil){var E={};E.get_handler=function(Player){return{rels:{html5:"anc",dailymotion:"mod"},get_instances:function(){var predicate=function(p){return p.getWrapper&&p.getWrapper()&&p.getWrapper().querySelector("video")};return window.bluebillywig&&window.bluebillywig.players&&window.bluebillywig.players.filter(predicate)},normalize:function(instance){return new Player({setup:function(){var _this=this;function emit_ready(){_this.emit("ready");instance.off(emit_ready)}if(!instance.isReady())instance.on("ready",emit_ready)},is_ready:function(){return instance.isReady()},get_element:function(){return instance.getWrapper().querySelector("video")},get_opt:function(){var dm,opt={bluebillywig:instance};var dm_path="_internal.Main._programController"+"._headController._heads.Html5HLS_video._hlsHelper._hls";if(dm=zutil.get(instance,dm_path))opt.dailymotion=dm;return opt}})}}};return E});
define("/svc/cdn/pub/kaltura.js",["cash","/util/util.js","/svc/cdn/pub/util.js","/svc/cdn/pub/player_util.js"],function($,zutil,util,player_util){var assign=Object.assign;var E={};var CG=util.gconf_get;var CS=util.gconf_set;function get_conf_custom_ops(player_type,instance){var ops_fn;if(!(ops_fn=CG("loader.autodetect."+player_type+".custom_ops")))return;try{if(typeof ops_fn=="string")ops_fn=new Function("instance","$","util",ops_fn);return ops_fn(instance,$,util)}catch(e){}}function set_conf_default(path,def){CS(path,CG(path,def))}E.get_handler=function(Player){return{rels:{html5:"anc",dailymotion:"mod"},init:function(ctrl){set_conf_default("loader.player.kaltura.lock_reload_request",true);set_conf_default("loader.player.kaltura.continue_on_reload",true)},get_instances:function(elements){if(!window.kalturaIframePackageData)return;var pid=window.kalturaIframePackageData.playerId;var sel='[id="'+pid+'"].mwEmbedPlayer';var player=document.querySelector(sel);return player&&player.getPlayerElement()?player:null},normalize:function(instance){return new Player({setup:function(){if(CG("loader.autodetect.kaltura.destroy_on_swap_media")){var _this=this;window.$(instance).on("onChangeMediaDone",function(){_this.emit("reload","reloaded")})}},get_element:function(){return instance.getPlayerElement()},get_opt:function(){var hls,opt={};opt.custom=assign({name:"kaltura",is_autostart:function(){return instance.autoplay},play:function(){instance.play()},muted:function(mute){if(mute===undefined)return instance.isMuted();if(instance.isMuted()==!!mute)return;instance.toggleMute()},volume:function(volume){if(volume===undefined)return instance.volume;instance.setVolume(volume)},get_ui:function(){var container=instance.getInterface()[0];return player_util.build_ui(container,{control_bar:".controlBarContainer",progress_bar:".scrubber",fullscreen:container})}},get_conf_custom_ops("kaltura",instance));if(hls=zutil.get(instance,"plugins.hlsjs.hls"))opt.dailymotion=hls;return opt},get_caps:function(){return{init_on_master_ready:CG("loader.autodetect.kaltura.init_on_master",true)}}})}}};return E});
define("/svc/cdn/pub/delightvr.js",["cash","/svc/cdn/pub/util.js"],function($,util){var assign=Object.assign;var E={};var CG=util.gconf_get;function get_conf_custom_ops(player_type,instance){var ops_fn;if(!(ops_fn=CG("loader.autodetect."+player_type+".custom_ops")))return;try{if(typeof ops_fn=="string")ops_fn=new Function("instance","$","util",ops_fn);return ops_fn(instance,$,util)}catch(e){}}E.get_handler=function(Player){return{rels:{html5:"anc"},get_instances:function(){var instances=Array.from($("dl8-video"));if(window.__dl8__delightVrApp){window.__dl8__delightVrApp._store.getState().data.contents.forEach(function(p){if(!instances.includes(p.domElement))instances.push(p.domElement)})}return instances},normalize:function(instance){return new Player({setup:function(){var _this=this;if(this.is_ready())return;document.addEventListener("x-dl8-evt-start",this._on_start=function(e){if(e.detail.element!=instance)return;_this._removeListeners();_this.emit("ready")})},get_element:function(){return instance.contentElement},is_ready:function(){return $(instance).hasClass("dl8-active")||$(".dl8-loading-overlay",instance).length},get_opt:function(){var src=$('script[src*="cdn.delight-vr.com"]').attr("src");var vm=src&&src.match(/\.com\/(.+)\/.*dl8-/);return{html5:this.get_element(),custom:assign({name:"delightvr",get_versions:function(){return{delightvr:vm?vm[1]:null}},get_ui:function(){var c=$(instance).closest("dl8-video");return{container:c[0],fullscreen:c.find("#dl8-content-container")[0],control_bar:c.find("[class^=PlayerHudView_bottomBar]")[0],progress_bar:c.find("[class^=SeekingView_"+"bar]")[0]}}},get_conf_custom_ops("delightvr",instance))}},destroy:function(){this._removeListeners()},_removeListeners:function(){if(!this._on_start)return;document.removeEventListener("x-dl8-evt-start",this._on_start)}})}}};return E});
define("/svc/cdn/pub/panolens.js",["/svc/cdn/pub/util.js"],function(util){var E={};E.get_handler=function(Player){return{rels:{html5:"anc"},get_instances:function(){return window.PANOLENS&&(window.panorama||typeof(window.player||{}).panorama=="function"&&window.player.panorama()||{}).videoElement},normalize:function(instance){return new Player({get_element:function(){return instance},get_opt:function(){return{html5:instance}}})}}};return E});
define("/svc/cdn/pub/autodetect.js",["cash","/svc/cdn/pub/log.js","/svc/cdn/pub/util.js","/util/util.js","/util/events.js","/svc/cdn/pub/zjwplayer3.js","/svc/cdn/pub/flowplayer.js","/svc/cdn/pub/youtube.js","/svc/cdn/pub/android.js","/svc/cdn/pub/dash.js","/svc/cdn/pub/dailymotion.js","/svc/cdn/pub/html5.js","/svc/cdn/pub/ios.js","/svc/cdn/pub/videojs.js","/svc/cdn/pub/dom_util.js","/svc/cdn/pub/ooyala.js","/svc/cdn/pub/akamai.js","/svc/cdn/pub/clappr.js","/svc/cdn/pub/custom_player.js","/svc/cdn/pub/theoplayer.js","/svc/cdn/pub/powa.js","/svc/cdn/pub/bluebillywig.js","/svc/cdn/pub/shaka.js","/svc/cdn/pub/kaltura.js","/svc/cdn/pub/delightvr.js","/svc/cdn/pub/panolens.js","/svc/cdn/pub/perr.js"],function($,_log,util,zutil,events,zjwplayer,flowplayer,youtube,android,dash,dailymotion,html5,ios,videojs,dom_util,ooyala,akamai,clappr,custom_player,theoplayer,powa,bluebillywig,shaka,kaltura,delightvr,panolens,perr){var E={};var assign=Object.assign;var CG=util.gconf_get;var log=_log.set_module("autodetect");var ad_ctrl,wrapper_fn;function Player(opt){var default_opt={setup:function(){},is_ready:function(){return true},get_container:function(){return},get_footprint:function(){return{}},get_caps:function(){return{}},destroy:function(){}};assign(this,default_opt,opt);this.setup()}zutil.inherits(Player,events.EventEmitter);var _players={akamai:akamai,android:android,bluebillywig:bluebillywig,clappr:clappr,custom_player:custom_player,dailymotion:dailymotion,dashjs:dash,delightvr:delightvr,flowplayer:flowplayer,html5:html5,ios:ios,jwplayer:zjwplayer,kaltura:kaltura,ooyala:ooyala,panolens:panolens,powa:powa,shaka:shaka,theoplayer:theoplayer,youtube:youtube,videojs:videojs};E.player_handlers={};for(var _player in _players){var module=_players[_player];if(util.is_enabled(module))E.player_handlers[_player]=module.get_handler(Player,log,E)}function Sequence(ctrl){this.ctrl=ctrl;this.ctrl.once("uninit",this.uninit.bind(this));this.init()}Sequence.prototype.init=function(){var _this=this;if(this.inited)return;this.inited=true;this.footprints={};this.on_domupdate=function(arg){if(!arg||!dom_util.dom_listen.using_observer)return;var pid_control=[],retry_attempts=0;do{for(var i=arg.length-1;i>=0;i--){var mutation=arg[i];for(var j=0;j(ps.right-ps.left)*.3&&h>(ps.bottom-ps.top)*.5}function cache_get(store,link){return store[link.url||link]||store[link.cache_url||E.spark.page2cache(link.url||link)]}function clear_duplicates(links){var posters={},descriptions={};var set=function(obj,key){obj[key]=key?(obj[key]||0)+1:0};links.forEach(function(l){set(posters,l.poster);set(descriptions,l.description);if(l.img.length&&!l.by_spark)set(l.img[0],"hola-links-used")});links.forEach(function(l){if(posters[l.poster]>NUM_DUPLICATES){delete l.poster;delete l.nat_size}if(descriptions[l.description]>NUM_DUPLICATES)delete l.description});var dup_images=[];return links.filter(function(l){if(!l.img.length)return true;if(l.img[0]["hola-links-used"]>1)dup_images.push(l.img[0]);delete l.img[0]["hola-links-used"];if(l.by_spark||!dup_images.includes(l.img[0]))return true;l.img=$();return is_link_allowed(l)})}function clear_scan(){scan_timeout=clearTimeout(scan_timeout)}function api_get_links_info(ctx,items,opt,cb,cb_err){E.last_sent_update_db=Date.now();E.stats.set_ms_since("first_sent_info_req_ms","first_scan_ms",3e4);var process_cb=process_responses_db.bind(null,ctx);var _opt={cdns:E.conf.cdns||E.conf.cdn,full:opt.full,url:opt.url};var modal_box=E.conf.modal_box;if(modal_box&&modal_box.enable&&modal_box.use_frame_url)_opt.debug_key="frame_url";api.get_links_info(items,_opt,process_cb,cb,cb_err)}function fetch_from_endpoint(url,ctx,items,opt,cb,cb_err){var disable_fallback=E.spark.get_conf("general.get_links_info.disable_fallback");var data={customer:E.spark.customer,items:items};var page_info;if(page_info=get_page_info())data.page_info=page_info;fetch_from_endpoint.last_sent_url=E.spark.top_url;if(!E.spark.get_orig_conf("general.get_links_info.origin")){data.origin=E.spark.get_conf("general.get_links_info.origin")||api.get_any_map_cdn(items[0])}var _cb=function(res){var _data=res&&{res:res};if(!_data){if(!disable_fallback)return api_get_links_info(ctx,items,opt,cb,cb_err);_data={res:[]}}var item,preview_url;for(var i=0;i0){sent_links[l.url]=l.size||"0x0"}});var count=E.stats.start(cmd);if([5,10,20,50].indexOf(count)>-1)E.stats.inc_d(cmd+"_over_"+count+"_n");E.stats.inc_d(cmd+"_url_n",items.length);var ctx={items:items,items_data:items_data,links:links};var _ret;var response_handler=function(){try{var ret=ctx.ret||{};var missing={};items.forEach(function(i){if(!(i.url in ret))missing[i.url]=null});if(Object.keys(missing).length)process_responses(ctx,missing);_ret={res:ret}}catch(e){cb_err()}_finally()};var cb_err=function(){E.stats.inc_d(cmd+"_fail_n");if(db_fail_cnt++playlist_preload.ratio){inc("ratio_off");return void cb()}inc("ratio_on");links=links.filter(function(item){return item.by_spark=="playlist_preload"});if(!links.length){inc("no_links");return void cb()}if(get_links_info_page_force_res)return void cb(get_links_info_page_force_res);var parsed_url=zurl.parse(E.spark.top_url);var route={customer:E.spark.customer,url:parsed_url.protocol+parsed_url.hostname+"/spark_playlist_preload"};inc("req");var cb_success=function(res){if(!res||!res.links||!Object.keys(res.links).length){inc("empty_res");return void cb()}get_links_info_page_force_res=res;inc("got_res");var ret={};links.forEach(function(link){var key=E.spark.page2cache(link.url);if(res.links[key])ret[link.url]=assign({},link,res.links[key])});assign(links_info_page,res.links);cb(ret)};var cb_err=function(){inc("error");cb()};api.get_from_cdn_host(conf.host||"player.h-cdn.com",conf.cmd||"api/get_links_info_page",{qs:route,timeout:conf.timeout||10*ms_sec},cb_success,cb_err)}function get_links_info_route(url){var route={customer:E.spark.customer,url:url||E.spark.top_url};var modal_box=E.conf.modal_box;if(modal_box&&modal_box.enable&&modal_box.use_frame_url)route.debug_key="frame_url";return route}function get_opt(opt){return assign({url:E.spark.top_url},E.conf,opt)}function get_page_info(){if(!util.is_top)return;var data=dom_util.get_page_info();var fn;if(fn=E.spark.get_conf("general.get_links_info.get_page_info_fn"))data=util.custom_fn(fn,"data")(data);if(!data)return;data.was_sent=fetch_from_endpoint.last_sent_url==E.spark.top_url;var tags;if(fn=E.spark.get_conf("general.get_links_info.get_page_tags_fn"))tags=util.custom_fn(fn,"util")(util);if(Array.isArray(tags)&&tags.length)data.tags=tags;return data}function handle_get_links_info_page(links){if(!E.get_links_info_pages_enabled)return links;var unhandled=[],items=[],items_map={};var conf=util.get(E.spark.conf,"general.get_links_info_pages");links.forEach(function(link){var url=link.url;var cache_url=link.cache_url||E.spark.page2cache(url),info;if(!(info=links_info_page[url]||links_info_page[cache_url]))return void unhandled.push(link);items.push(link);info.from_page_links=true;items_map[url]=info;if(info.preview||conf.mark_sent)sent_links[url]=info.size||"0x0";else unhandled.push(link)});var ctx={items:items,items_data:{},links:items};process_responses(ctx,items_map);if(conf.fallback_ratio&&Math.random()>conf.fallback_ratio)return[];return unhandled}function init_links_info_pages(_cb){var conf=E.spark.get_conf("general.get_links_info_pages");var url=E.spark.top_url;if(E.conf.enable===false||E.conf.disable||!conf||!conf.enable||conf.urls&&!util.check_url(url,conf.urls&&!conf.check_urls_on_scan)){return void _cb()}log.info("links_info_pages is active");E.get_links_info_pages_enabled=true;if(conf.transform_url)url=conf.transform_url(url);E.stats.inc("get_links_info_page_n");var opt={qs:get_links_info_route(url),timeout:conf.timeout||3*ms_sec};var cb=function(ret){if(ret&&ret.links&&Object.keys(ret.links).length){E.stats.inc("get_links_info_page_success_n");links_info_page=ret.links}_cb()};var cb_err=function(err){if(err&&err.status_text=="timeout")E.stats.inc("get_links_info_page_timeout_n");else E.stats.inc("get_links_info_page_failed_n");_cb()};api.get_from_cdn_host(conf.host||"player.h-cdn.com",conf.cmd||"api/get_links_info_page",opt,cb,cb_err)}function init_scan_on_scroll(){if(!E.conf.scan_on_scroll)return;E.stats.inc_d("scroll_scan_init_n");var size=document.body&&document.body.innerHTML.length,scroll_timeout;$(window).on("scroll",function(){clearTimeout(scroll_timeout);scroll_timeout=setTimeout(function(){var new_size=document.body&&document.body.innerHTML.length;if(new_size==size)return void E.stats.inc_d("scroll_no_scan_n");size=new_size;E.stats.inc_d("scroll_scan_n");var new_links;if(!(new_links=E.scan()))return;E.stats.inc_d("scroll_scan_found_n");E.stats.inc_d("scroll_scan_found_links_n",new_links)},200)})}function is_link_allowed(l){if(E.conf.is_link_allowed&&!E.conf.is_link_allowed({$:$,E:E,link_info:l})){return false}return!!(l.img.length||l.text_link)}function is_link_parent_allowed(el){return E.conf.disable_reject_check||!$(el).closest(rejected_containers).length}function is_link_url_allowed(url){if(!E.spark.is_video_url_allowed(url))return false;return E.conf.disable_reject_check||!rejected_origins.find(function(o){return o.test(url)})}function is_live_video(a){return!!$(a).attr("spark_ve_preview_live")}function is_playlist_link(a){return $(a).attr("data-spark_feature")=="playlist"}function is_visible(el){var allow=E.conf.allow_hidden;if(allow===true||allow&&typeof allow=="string"&&$(el).parents(allow).length){return true}return dom_util.is_visible(el)}function listen_href_updates(links,opt){var href_prop="hola-links-href";links.forEach(function(l){var link=l.link,$link=$(link);if($link.prop(href_prop))return;$link.prop(href_prop,l.url);dom_util.dom_listen(link,function(){var new_href=E.get_href(link,opt);if($link.prop(href_prop)==new_href)return;$link.prop(href_prop,new_href);E.emit("detach",[link]);scanned(link,0);E.scan()})})}function overwrite_data(data){if(!data)return;if(data.poster&&!E.is_poster_allowed(data.poster))delete data.poster;if(data.video_poster&&!E.is_poster_allowed(data.video_poster))delete data.video_poster;if(data.description&&!E.is_text_allowed(data.description))delete data.description;if(data.video_title&&!E.is_text_allowed(data.video_title))delete data.video_title;if(E.conf.use_video_poster&&E.conf.use_video_poster(data))data.poster=data.video_poster||data.poster;if(E.conf.use_video_title&&E.conf.use_video_title(data))data.description=data.video_title||data.description}function process_responses(ctx,data){var ret={},dom=["link","links","img","unite"];var update_db=function(item,db_data){var url=item.url,info;if(!(info=cache_get(links_info,item)))info=links_info[url]={db:{}};overwrite_data(db_data);ret[url]=util.defaults({},ctx.items_data[url],db_data||info.db);util.extend_deep(info,ret[url]);for(var i=0;i400){E.stats.inc_d("nat_size_ok");poster=img_src;nat_size=E.size_util.serialize(natural_size)}else E.stats.inc_d("nat_size_small")}var text_links=opt.text_links||[];return{link:a,links:links,unite:unite,url:link_url,page_url:page_url,cache_url:cache_v_url||cache_url,type:video_url?"video":"page",img:img,poster:poster,size:size,nat_size:nat_size,description:get_link_text(a,links,img,opt),video_url:cache_v_url,adaptive:adaptive,root:/.*\/\/[^\/]*\/$/.test(url),self:cache_url==E.spark.cache_top_url,by_spark:by_spark,force_video:allow_video&&!!v_url,no_video:!allow_video,text_link:text_links.includes(a),live:is_live_video(a),playlist:is_playlist_link(a)}};E.get_img_size_el=function(img,opt,overlay){var img_size;var selector=overlay?opt.img_size_for_overlay||opt.img_size:opt.img_size;var func=opt.img_size_func;if(selector)img_size=img.closest(selector);if(func)img_size=func(img,{img_size:img_size,overlay:overlay,E:E});if(!img_size||!img_size.length)img_size=img;return img_size};E.get_img_src=function(img,opt){if(img.length)img=img[0];var src;if(src=img.getAttribute("data-spark_preview_img_src"))return src;if(opt.get_img_src&&(src=opt.get_img_src($(img))))return src;if((src=img.src||img.currentSrc)&&!/^data:/.test(src))return src;src=img.getAttribute("data-original")||img.getAttribute("data-src")||img.getAttribute("srcset")||img.getAttribute("data-srcset")||img.getAttribute("data-spark-src");return src||get_img_style(img)};E.get_page_db=function(){return cache_get(links_info,E.spark.top_url)};E.get_video_url=function(a,opt){var v_url=a.getAttribute("data-spark_preview_video_url")||a.getAttribute("spark_ve_preview")||a.getAttribute("data-spark-ve-preview")||a.getAttribute("hola_ve_preview");return v_url||opt.get_video_url&&opt.get_video_url(a,$)||""};E.is_poster_allowed=function(p,opt){opt=opt||E.conf;return p&&util.is_poster_allowed(p)&&!(opt.skip_poster&&opt.skip_poster(p))};E.is_text_allowed=function(t){var m;return t&&t.length>3&&(m=t.match(/[^0-9\s]/g))&&m.length/t.length>.4&&!(E.conf.skip_text&&E.conf.skip_text(t))};E.scan=function(opt){try{if(top===self){var url=top.location.href;if(E.conf.urls&&!util.check_url(url,E.conf.urls))return}}catch(err){console.error("spark error %o",err)}if(opt&&opt.allow_hidden!==undefined)E.conf.allow_hidden=opt.allow_hidden;E.stats.set_ms_since_d("first_scan_ms",6e4);E.stats.start("scan");E.first_scan=E.first_scan||Date.now();clear_scan();var detached=[],all=[];var contains=function(doc,l){return doc.body&&doc.body.contains(l)};all_links.forEach(function(l){if(contains(document,l)||is_playlist_link(l)&&$("div.hola_playlist").get().find(function(i){return i.contains(l)})){return void all.push(l)}detached.push(l);scanned(l,0)});all_links=all;if(detached.length)E.emit("detach",detached);var s;var links=E.get({filter:function(a){return!(s=scanned(a))||s=="error"||s=="update"}});if(E.conf.dynamic_links){listen_href_updates(links.filter(function(l){return $(l.link).is(E.conf.dynamic_links)}),E.conf)}E.stats.stop("scan");if(!cache_get(links_info,E.spark.top_url)&&!cache_get(sent_links,E.spark.top_url)&&(links.length||E.spark.is_feature_enabled("video_previews")||E.conf.scan_top_url||util.is_mocha())){links.push({url:E.spark.top_url,type:"page",current:true})}if(!links.length)return void submit_scan();var new_links=links.filter(function(l){return l.current||!scanned(l.link)});links.forEach(function(l){if(!l.current){scanned(l.link,1);if(!all_links.includes(l.link))all_links.push(l.link)}if(cache_get(sent_links,l)&&!cache_get(links_info,l))pending_update_db.push(l)});links=E.filter(links.filter(function(l){if(!cache_get(sent_links,l.url))return true;if(!l.size||E.size_util.compare(l.size,cache_get(sent_links,l))<=0){return false}E.stats.inc_d("rescan_bigger_n");return true}));if(new_links.length){E.stats.inc_d("found_links_n",new_links.length);E.stats.inc_d("found_n");E.emit("update",new_links)}var overrides=[];links.forEach(function(l){if(l.type!="video")return;E.stats.inc_d("type_video_n");if(!l.page_url||l.url==l.page_url)return;E.stats.inc_d("type_video_override_n");overrides.push(assign({},l,{type:"page",url:l.page_url}))});var unhandled_links=handle_get_links_info_page(links.concat(overrides));log.info("get_links_db count: "+unhandled_links.length);get_links_db(unhandled_links,E.conf,submit_scan)};E.init=function(spark,links_conf){E.spark=spark;log=E.spark.spark_log.fork(id);log.info("inited");spark.links=E;var preview_conf=util.get_platform_conf(E.spark.conf.video_previews);E.conf=assign({},def_opt,preview_conf,links_conf);if(!E.conf.allow_taboola)rejected_containers+=', div[id^="trc_wrapper"]';stats_init();E.msg=new _msg(id,{handlers:[{type:"top",name:"get_top_url_db",func:function(idx,cb){if(E.last_update_page_db)return cb(E.get_page_db());E.once("update_page_db",function(){cb(E.get_page_db())})},opt:{exec_on_self:true,async:true}}]});E.msg.get_top_url_db_cb(function(info){if(info)set_page_info(info)});if(util.is_mocha())init_links_info_pages(activate_scan);else setTimeout(function(){init_links_info_pages(activate_scan)},10)};if(util.is_mocha())E.t={uninit:uninit};return E});
define("/svc/cdn/pub/spark_layout.js",["cash","/util/events.js","/util/util.js","/svc/cdn/pub/util.js","/svc/cdn/pub/dom_util.js"],function($,events,zutil,util,dom_util){var E={layouts:[]},assign=Object.assign,log={},id="layout";function Item(layout,dom,opt){this.layout=layout;this.dom=dom;this.opt=opt;this.margin=assign({},this.opt.margin);this.autohide=this.opt.force_show||opt.show_policy=="auto";this.autohide_events_bound=false;this.hidden=true;this.show_fn=this.show.bind(this);this.hide_fn=this.hide.bind(this);this.rebind_dom_fn=this.rebind_dom.bind(this);this.rebind_dom();this.layout.on("rebind_container",this.rebind_dom_fn);if(this.autohide)this.bind_autohide_events()}Item.prototype.rebind_dom=function(){if(this.layout.inject_policy=="inside")$(this.layout.container).append(this.dom);else $(this.layout.container).after(this.dom);this.update_position()};Item.prototype.autohide_enable=function(){this.autohide=true;this.bind_autohide_events()};Item.prototype.autohide_disable=function(force){if(!force&&this.opt.force_show)return;this.autohide=false;this.unbind_autohide_events()};Item.prototype.bind_autohide_events=function(){if(this.autohide_events_bound)return;this.autohide_events_bound=true;this.layout.on("show",this.show_fn);this.layout.on("hide",this.hide_fn)};Item.prototype.unbind_autohide_events=function(){if(!this.autohide_events_bound)return;this.autohide_events_bound=false;this.layout.off("show",this.show_fn);this.layout.off("hide",this.hide_fn)};Item.prototype.detach=function(){log.debug_spark("item detach");this.layout.off("rebind_container",this.rebind_dom_fn);if(this.layout.in_dom(this.dom))$(this.dom).remove();this.unbind_autohide_events()};Item.prototype.hide=function(force){if(!this.layout.masked&&!this.layout.player.controls.is_any_ad_mode()&&!this.layout.player.is_floating()&&!force&&this.opt.force_show){return}$(this.dom).css("display","none");if(this.hidden)return;this.hidden=true;this.layout.recalc()};Item.prototype.show=function(){if(this.layout.masked||this.layout.player.is_floating())return;$(this.dom).css("display","block");if(!this.hidden)return;this.hidden=false;this.layout.recalc();this.layout.report_move()};Item.prototype.update_position=function(){var css={};var bounds=this.layout.bounds;if(this.layout.inject_policy=="inside"){var sides={t:"top",b:"bottom",r:"right",l:"left"};css[sides[this.opt.position[0]]]=this.margin.y+"px";css[sides[this.opt.position[1]]]=this.margin.x+"px";return void $(this.dom).css(css)}if(this.opt.position=="tr"){assign(css,{top:bounds.top+this.margin.y+"px",left:bounds.left+bounds.width-this.opt.width-this.margin.x+"px"})}else if(this.opt.position=="br"){assign(css,{top:bounds.top+bounds.height-this.opt.height-this.margin.y+"px",left:bounds.left+bounds.width-this.opt.width-this.margin.x+"px"})}else if(this.opt.position=="tl"){assign(css,{top:bounds.top+this.margin.y+"px",left:bounds.left+this.margin.x+"px"})}else if(this.opt.position=="bl"){assign(css,{top:bounds.top+bounds.height-this.opt.height-this.margin.y+"px",left:bounds.left+this.margin.x+"px"})}$(this.dom).css(css)};zutil.inherits(Layout,events.EventEmitter);function Layout(player){this.player=player;this.items=[];this.native_dims=[];this.overlap_props=E.overlap_policy=="horizontal"?{m:"x",d:"width"}:{m:"y",d:"height"};this.update_container();this.player_container=this.player.controls.get_ui().container;this.media_container=this.player.controls.get_ui().media;this.control_bar=player.control_bar;this.last_move=0;this.attached=true;this.masked=false;this.def_margin={x:0,y:0};this.bounds={left:0,top:0,width:0,height:0};this.detach_fn=this.detach.bind(this);this.show_fn=this.show.bind(this);this.hide_fn=this.hide.bind(this);this.mousemove_fn=this.mousemove.bind(this);this._is_extra_ui_allowed=this.player.is_extra_ui_allowed.bind(this.player,{feature:"spark_layout"});this.init_places();player.once("remove",this.detach_fn);player.controls.on("suspend",this.hide_fn);player.controls.on("ad_suspend",this.hide_fn);player.controls.on("persistent.start_floating",this.hide_fn);player.controls.on("restore",this.show_fn);player.controls.on("user_active",this.show_fn);player.controls.on("ad_restore",this.show_fn);player.controls.on("play",this.show_fn);player.controls.on("pause",this.show_fn);player.controls.on("pre-ended",this.show_fn);player.controls.on("persistent.end_floating",this.show_fn);this._on_player_state=this.update_positions.bind(this);player.on_state(this._on_player_state,[player.states.WN_PANEL_ANIMATION]);this.update_bounds();this.monitor_playback()}Layout.prototype.update_container=function(){var ui=this.player.controls.get_ui();var container=ui.fullscreen;if(!container)container=ui.container;if(container!=this.container)this.rebind_container(container)};Layout.prototype.rebind_container=function(container){this.body=$(container).parents("body").get(0)||document.body;$(this.container).off("mousemove",this.mousemove_fn);$(container).on("mousemove",this.mousemove_fn);this.inject_policy=$(container).is("video")?"outside":zutil.get(E.spark.conf,"general.button_inject_policy","outside");this.container=container;this.emit("rebind_container")};Layout.prototype.in_dom=function(node){return this.body.contains($(node).get(0))};Layout.prototype.init_places=function(){this.places={tr:[],tl:[],br:[],bl:[]};this.margins={tr:{x:0,y:0},tl:{x:0,y:0},br:{x:0,y:0},bl:{x:0,y:0}};if(this.player.controls.jwplayer)this.get_native_place(".jw-sharing-dock-btn>.jw-icon");else if(this.player.controls.flowplayer){this.get_native_place(".fp-fullscreen");this.get_native_place(".fp-embed")}else if(this.player.controls.name=="hola"&&util.is_mobile){this.get_native_place(".vjs-fullscreen-control");this.get_native_place(".vjs-volume-menu-button")}};Layout.prototype.report_move=function(){this.last_move=Date.now()};Layout.prototype.hide=function(){this.emit("hide")};Layout.prototype.show=function(){if(!this._is_extra_ui_allowed()||this.player.controls.is_any_ad_mode())return this.hide();this.report_move();this.emit("show")};Layout.prototype.mousemove=function(){this.show()};Layout.prototype.update_margins=function(item){var opt=item.opt;var mp=this.overlap_props.m,d=this.overlap_props.d;item.margin=assign({},opt.margin);if(!this.margins[opt.position][mp])this.def_margin[mp]=opt.margin[mp]opt.margin[mp]){var p_min=opt.margin[mp];var p_max=p_min+opt[d];var overlap=false;this.places[opt.position].forEach(function(place){var place_min=place.margin[mp];var place_max=place_min+place[d];if(p_maxplace_max)return;overlap=true});if(overlap){item.margin[mp]=this.margins[opt.position][mp]+this.def_margin[mp];log.debug_spark("reposition, item margin: "+item.margin[mp])}}this.margins[opt.position][mp]=item.margin[mp]+opt[d]};Layout.prototype.monitor_playback=function(){if(!this.attached)return;this.update_container();if(this.container&&this.in_dom(this.container))this.update_positions();this.monitor_playback_id=setTimeout(this.monitor_playback.bind(this),500)};Layout.prototype.update_bounds=function(){if(!this.container)return;var pos_elem=E.pos_by_media?this.media_container:this.container;var container=this.container;if(!this.in_dom(pos_elem)||$(this.player_container).hasClass("hola_playlist_active_ptile")||$(this.player_container).find(".hola_playlist_active_ptile").length){this.masked=true;this.hide_items();return}this.masked=false;if($(pos_elem).css("transform")!="none")pos_elem=$(pos_elem).parent();var pos=dom_util.get_position(container);var dpos={left:$(pos_elem).offset().left-$(container).offset().left,top:$(pos_elem).offset().top-$(container).offset().top};var rect_elem=this.media_container;if(!rect_elem)rect_elem=pos_elem;this.bounds={left:pos.left+dpos.left,top:pos.top+dpos.top,width:$(rect_elem).width(),height:$(rect_elem).height()};if(this.inject_policy=="inside"&&$(pos_elem).css("position")!="static"){this.bounds.left=0;this.bounds.right=0}};Layout.prototype.hide_items=function(){this.items.forEach(function(item){item.hide()})};Layout.prototype.update_positions=function(){this.update_bounds();this.items.forEach(function(item){item.update_position()});if(!this.control_bar)return;var c=$(this.control_bar);if(this.player.controls.is_playing()&&(!c.length||c.css("display")=="none"||c.css("opacity")=="0"||c.css("visibility")=="hidden"||Date.now()-this.last_move>3e3)){if(Date.now()-this.last_move>3e3)this.hide()}if(this.player.controls.is_any_ad_mode())this.hide();if(!this._is_extra_ui_allowed())this.hide();this.recalc()};Layout.prototype.add_place=function(position,margin,width,height){this.places[position].push({margin:margin,width:width,height:height})};Layout.prototype.get_native_place=function(selector){var btn=$(this.container).find(selector);if(!btn.length||btn.css("display")=="none"||btn.css("opacity")==0||btn.css("visibility")=="hidden"){return}var dims=this.native_dims[selector];if(!dims){var w=btn.width();var h=btn.height();var x=btn.offset().left-$(this.container).offset().left;var y=btn.offset().top-$(this.container).offset().top;var cw=$(this.container).width();var ch=$(this.container).height();var pos;if(y<=ch/2)pos=x>=cw/2?"tr":"tl";else pos=x>=cw/2?"br":"bl";var mx=x>=cw/2?cw-w-x:x;var my=y<=ch/2?y:ch-h-y;dims=this.native_dims[selector]={position:pos,margin:{x:mx,y:my},width:w,height:h}}this.update_margins({opt:dims});this.add_place(dims.position,dims.margin,dims.width,dims.height)};Layout.prototype.recalc=util.throttle(function(){this.init_places();var _this=this;this.items.forEach(function(item){if(item.hidden)return;_this.update_margins(item);_this.add_place(item.opt.position,item.margin,item.opt.width,item.opt.height);item.update_position()})},50);Layout.prototype.add=function(dom,opt){var o={show_policy:opt.show_policy||"manual",position:opt.position,margin:assign({},opt.margin),width:opt.width,height:opt.height,force_show:opt.force_show};var item=new Item(this,dom,o);this.items.push(item);if(!this.player.controls.is_any_ad_mode())item.show();return item};Layout.prototype.detach=function(){this.attached=false;log.debug_spark("layout detach");this.player.off("remove",this.detach_fn);this.player.controls.off("suspend",this.hide_fn);this.player.controls.off("ad_suspend",this.hide_fn);this.player.controls.off("persistent.start_floating",this.hide_fn);this.player.controls.off("restore",this.show_fn);this.player.controls.off("user_active",this.show_fn);this.player.controls.off("ad_restore",this.show_fn);this.player.controls.off("play",this.show_fn);this.player.controls.off("pause",this.show_fn);this.player.controls.off("pre-ended",this.show_fn);this.player.controls.off("persistent.end_floating",this.show_fn);this.player.off_state(this._on_player_state);this.items.forEach(function(item){item.detach()});var index=E.layouts.indexOf(this);if(index>=0)E.layouts.splice(index,1)};function get_layout(player){var l=E.layouts.find(function(layout){return layout.player==player});if(!l){l=new Layout(player);E.layouts.push(l)}return l}E.add=function(player,dom,opt){var layout=get_layout(player);return layout.add(dom,opt)};E.init=function(spark){E.spark=spark;log=E.spark.log(id);E.overlap_policy=zutil.get(spark.conf,"general.button_overlap_policy","horizontal");E.pos_by_media=zutil.get(spark.conf,"general.player.pos_by_media");log.debug_spark("inited")};return E});
define("/svc/cdn/pub/l10n.js",["/util/util.js","/svc/cdn/pub/log.js"],function(zutil,_log){var id="l10n";var E={};var log=_log?_log.set_type(id):{warn:function(){},info:function(){}};var ms={SEC:1e3,MIN:60*1e3,HOUR:60*60*1e3,DAY:24*60*60*1e3,WEEK:7*24*60*60*1e3,MONTH:30*24*60*60*1e3,YEAR:365*24*60*60*1e3};var locales="af,ak,am,ar,az,be,bg,bn,bs,ca,cs,cy,da,de,dv,dz,el,en,es,et,eu,"+"fa,fi,fo,fr,ga,gl,gn,gu,he,hi,hr,ht,hu,hy,id,is,it,ja,ka,kk,km,kn,ko,ky,lb,"+"lo,lt,lv,mg,mk,mn,mr,ms,mt,my,ne,nl,no,pa,pl,ps,pt,pt_br,ro,ru,rw,sd,si,sk,"+"sl,so,sq,sr,ss,st,sv,sw,ta,te,tg,th,ti,tk,tl,tn,to,tr,uk,ur,uz,vi,za,zh_cn,"+"zh_tw".split(",");var get_browser_locale=function(lang){var navlang=(lang||navigator.language||"").replace("-","_").toLowerCase();var choices=[navlang,navlang.substr(0,navlang.indexOf("_"))];for(var i=0;i0){return cb(false)}player._is_mapping_allowed(cb)};_is_mapping_allowed(function(allowed){if(!allowed)no_mapping=info.no_mapping=true;info.view_type=no_mapping&&!util.is_app?"background":util.is_mobile||!is_autostart?"manual":"autoplay";spark.set_unique_view_info("video",info);spark.stats.update_perr_info(player);assign(info,spark.stats.perr_info);if(!spark.get_conf("general.perr.disable_video_view")){var ab_test2_group=spark.get_ab_test2_group();if(ab_test2_group)info.ab_test2_group=ab_test2_group;perr({id:"spark_video_view",url:url,info:info,delay:false})}if(spark.google_analytics)spark.google_analytics.report_metric("video_view_n",1);if(!spark.links)return;var db=spark.links.get_page_db();data=data||player;url=data.url_key;if(db)assign(db,db.db);var item=!no_mapping&&db&&(db.video_url==url||!spark.get_conf("general.main_video_only")&&(db.videos||[]).find(function(v){return v.url==url}))?db:null;spark.stats.inc(["views",url,"view"],1);spark.stats.if_not_set(["views",url,"view_sec"],[]);info=assign({page_url:db?db.url:spark.top_url,video_url:data.url,dur:data.dur||data.get_duration&&data.get_duration()||0},zutil.pick(info,"video_type","category","lang"));if(s=player&&player.controls&&player.controls.is_live_stream())info.is_live=!!s;if(s=item&&item.poster)info.poster=s;if(s=item&&item.description)info.description=s.replace(/^\d\d:\d\d(\S*)? ?/,"")||s;if(s=item&&item.video_title)info.title=s;if(util.is_app)info.is_app=true;spark.stats.assign(["views",url],info);if(no_mapping)handle_player_info();else if(data!=player||data.video_info)handle_player_info(data);else if(player)player.get_player_info_cb(handle_player_info);else handle_player_info()})}function get_og_image(){var meta_img,url;if(spark.get_conf("general.player.disable_og_image"))return;var w=window,pw=window.top||window;while(1){try{var meta=$(w.document).find('meta[property="og:image"]').get(0);if((url=meta&&meta.content)&&/^https?:\/\//.test(url))meta_img=meta}catch(e){return}if(meta_img||w==pw)break;w=w.parent}if(meta_img&&is_poster_allowed(meta_img.content))return meta_img.content}function report_view(frame_idx,customer,data){if(!data||!spark.links||customer==spark.customer)return;var url=data.manifest_url||data.video_url;var url_key=spark.video2cache(url,!!data.manifest_url);set_view(undefined,{description:data.title,poster:data.poster,dur:data.duration,url:url,url_key:url_key});if(customer!="veedi")return void send_map_video_page(undefined,data);if(!util.is_enabled(api))return;api.has_veedi_game_info(data.video_title||data.title,function(has_info){if(has_info)send_map_video_page(undefined,data)})}function on_view_1sec(player,video_ctx){if(video_ctx.ad_src)return player.ad_mark_by_view(video_ctx);if(video_ctx.attached_spark.on_view_1sec_reported)return;if(!util.is_top){player._get_map_info(function(data){msg.report_view(spark.customer,data)})}set_view(player);video_ctx.attached_spark.on_view_1sec_reported=true}function run_player_conf_func(fn,val,info){if(!(fn=spark.get_conf("general.player."+fn)))return;try{fn=typeof fn=="string"?new Function("$","val","info",fn):fn;return fn($,val,info)}catch(e){log.err("invalid conf_func function: "+(e&&e.toString())||"JS Error")}}function get_ad_mark_event(){return spark.get_conf("general.ad_mark_event","ad_play")}function get_page_info(){return{title:run_player_conf_func("extract_top_title_func")||document.title,description:run_player_conf_func("extract_description_func"),og_img:get_og_image()}}function get_init_data(){var url,adaptive;if(this.controls.is_ad_source()||!(url=this.controls.get_url()))url=this.controls.get_playlist_url();url=util.absolute_uri(url);if(!url||!spark.is_allowed(this.check_skip_video(url)))return{};adaptive=util.get_adaptive_by_type(this.controls.get_video_type_name(url));return{url:url,adaptive:adaptive,url_key:spark.video2cache(url,adaptive)}}function get_view_cb_id(id){var m1=id.match(/^view_([0-9]+)sec$/);var m2=id.match(/^view_last_([0-9]+)sec$/);var m3=id.match(/^buffer_([0-9]+)sec$/);var m4=id.match(/^view_every_([0-9]+)sec$/);var sec=m1&&+m1[1]||m2&&+m2[1]||m3&&+m3[1]||m4&&+m4[1];var s=m1?"v"+sec:m3?"b"+sec:m2?"l"+sec:m4?"e"+sec:"";return s}function on_ended(){var ctx=this.attached||this.detached;if(ctx&&ctx.attached_spark)ctx.attached_spark.ended=true}function on_seeking(pos,seek_pos){var ctx=this.attached.attached_spark;if(!ctx)return;this.set_view_stats(ctx,ctx.last_pushed);ctx.last_viewed=ctx.view_every=ctx.last_pushed=seek_pos;this.update_view_sec("seek");this.ad_summary("on_seeking")}function send_map_video_page(player,data){if(spark&&spark.page_expires)return;if(!util.is_enabled(api))return log.warn("api is disabled; map request is not sent");if(send_map_video_page.was_sent)return;send_map_video_page.was_sent=true;var handle_map_info=function(d){if(d.no_mapping)return;var skip;if((skip=E.conf.skip_map_video_page)&&skip(d,player))return;api.send_map(d,E.conf.cdns||E.conf.cdn)};if(player)player._get_map_info(handle_map_info);else handle_map_info(data)}function is_poster_allowed(p){return spark.links?spark.links.is_poster_allowed(p):util.is_poster_allowed(p)}function is_title_allowed(t){return!spark.links||spark.links.is_text_allowed(t)}function is_description_allowed(t){return!E.conf.skip_text||!E.conf.skip_text(t)}function is_player_allowed_by_css(player,filter){var container=player.get_ui().container;return dom_util.is_el_allowed_by_css(container,filter)}function is_player_allowed_by_func(player,func){if(!func)return true;try{var container=player.get_ui().container;return func({$:$,container:container})}catch(err){console.error("is_player_allowed_by_func %s",err);return true}}function on_wrapper_attached(cb){spark.loader.on("wrapper_attached",function(wrapper){if(is_player_allowed_by_css(wrapper.player,spark.get_conf("general.player.filter_by_css")||spark.get_conf("general.filter.player_by_css"))&&is_player_allowed_by_func(wrapper.player,spark.get_conf("general.filter.player_by_func"))){cb(wrapper)}})}function on_wrapper_detached(cb){spark.loader.on("wrapper_detached",cb)}function StateManager(initial_state){this._state=initial_state||{};this.__cbs=[]}StateManager.prototype.destroy=function(){this._state=this.__cbs=undefined;this.get=this.set=this.on=this.off=function(){};this.DESTROYED=true};StateManager.prototype.get=function(prop){if(!prop)return this._state;return this._state[prop]};StateManager.prototype.set=function(changes){var old_state=this._state;var new_state=assign({},this._state);var changed_props=[];for(var prop in changes){if(old_state[prop]!==changes[prop]){new_state[prop]=changes[prop];changed_props.push(prop)}}if(!changed_props.length)return;this._state=new_state;this._on_changed(old_state,new_state,changed_props)};StateManager.prototype.on=function(cb,props){if(!props||!props.length)return void this.__cbs.push([cb]);var props_obj={};for(var i=0;i=0;i--){if(this.__cbs[i][0]==cb)this.__cbs.splice(i,1)}};StateManager.prototype._on_changed=function(old_state,new_state,props){var arr_cb;for(var i=0;i=sec){this.view_cbs[i]="del";this.emit("view_"+sec+"sec")}else if(type=="e"&&ctx.pos-ctx.view_every>=sec-1&&!(Math.round(ctx.pos)%sec)){ctx.view_every=ctx.pos;this.emit("view_every_"+sec+"sec")}else if(type=="b"&&this.sec_in_buffer()>=sec){this.view_cbs[i]="del";this.emit("buffer_"+sec+"sec")}},this);this.view_cbs=this.view_cbs.filter(function(s){return s!="del"});if(spark.report_frame_video_progress)msg.report_video_progress(ctx.pos)};Player.prototype.update_view_sec=function(type){if(!this.attached)return;var ctx=this.attached.attached_spark;ctx.dur=ctx.dur||this.get_duration();ctx.pos=this.controls.get_pos()||0;ctx.total_viewed+=ctx.pos-ctx.last_viewed;ctx.unique_view_sec.update(ctx.last_viewed,ctx.pos);ctx.last_viewed=ctx.pos;ctx.is_live=this.controls.is_live_stream();ctx.full_view=ctx.dur&&ctx.unique_view_sec.sum>=ctx.dur-5;var conf=spark.get_conf("general.stats",{});var diff=ctx.pos>(conf.view_from||0)&&conf.view_diff||20;if(ctx.pos-ctx.last_pushed<2||!type&&ctx.pos-ctx.last_pushed=ctx.dur;if(end||ctx.ended)spark.stats.set(["views",this.url_key,"ended"],1);if(ctx.full_view)spark.stats.set(["views",this.url_key,"full_view"],1);var min_total=Math.min(conf.view_sec_min_total||10,ctx.dur*.2||10);if(ctx.unique_view_sec.sumnow-margin&&poscw/2&&h>ch/2}).map(function(_el){return _el.src})}catch(e){}if(flowplayer_playing)$container.addClass(fp_class);if(!urls||!urls.length)return;if(css_srcs[urls[0]]&&!sent_poster_css_perr){perr({id:"spark_video_poster_from_css",info:css_srcs[urls[0]]});sent_poster_css_perr=true}return urls[0]};Player.prototype._get_title=function(){var fn;if(fn=spark.get_conf("general.player.extract_title_func")){try{if(typeof fn=="string")fn=new Function("$",fn);return fn($)}catch(e){log.err("invalid extract_title_func function: "+(e&&e.toString())||"JS Error")}}var title;if(title=this.get_title()){perr({id:"spark_player_title",info:{title:title}});return title}};Player.prototype.get_player_info_cb=function(cb){var _this=this;msg.get_page_info_cb(function(info){info=info||{};var title=_this._get_title();if(!title){title=info.title;if(!title)try{title=window.top.document.title}catch(e){}}var description=info.description;var og_img=info.og_img;var data={};if(title&&is_title_allowed(title))data.title=title;if(description&&is_description_allowed(description))data.description=description;if(!og_img&&!util.is_top)og_img=get_og_image();data.img=og_img;var poster=_this.get_poster();var custom_poster=run_player_conf_func("get_poster",{poster:poster,og_img:og_img,container:_this.container});data.poster=custom_poster||poster||og_img||_this.get_assoc_img();cb(_this.video_info=data)})};Player.prototype.is_floating=function(){var persistent=spark.get_feature_if_inited("persistent");return persistent&&persistent.is_player_floating(this)};Player.prototype.is_playlist_active=function(){var _playlist=spark.get_feature_if_inited("playlist");return _playlist&&_playlist.is_playlist_active(this)};Player.prototype.is_autoplayed=function(){var _autoplay=spark.get_feature_if_inited("autoplay");return _autoplay&&_autoplay.is_autoplayed(this)};Player.prototype.is_wn_played_inline=function(){var _playlist=spark.get_feature_if_inited("playlist");return _playlist&&_playlist.was_played_inline(this)};Player.prototype.is_small=function(){var size=this.get_size().container_size||{};return size.width<=520||size.height<=292};Player.prototype.uninit=function(){if(this.attached)this.detach(this.attached,"uninit");this.ad_summary("uninit");this.wrapper.off("context_created",this.on_new_context);util.off("beforeunload",this.before_unload);this.emit("remove")};Player.prototype.get_main_video_player=function(){if(this.ad_video_ctx)return this.ad_video_ctx;spark.players.forEach(function(p){if(!p.attached&&!p.detached||(p.attached||p.detached||{}).ad_src)return;if(p.detached&&this.ad_video_ctx&&this.ad_video_ctx.attached)return;if(p.detached&&this.ad_video_ctx&&p.detach_ts=buffered.start(i+1))end=buffered.end(++i);if(zutil.range(pos,start,end))bsec+=end-pos}return Math.round(bsec)};Player.prototype.save_position=function(){this.saved_position=Math.floor(this.get_pos());spark.storage.set_and_sync("spark_seek",{url_key:this.url_key,position:this.saved_position})};Player.prototype.get_saved_position=function(){var spark_seek=spark.storage.get("spark_seek")||{};if(spark_seek.url_key!=this.url_key)return;this.saved_position=spark_seek.position;spark.storage.unset_and_sync("spark_seek");return this.saved_position};Player.prototype.detach=function(video_ctx,reason){if(!this.attached)return;if(this._resize_observer)this._resize_observer=void this._resize_observer.disconnect();this.update_view_sec("detach");this.detached=this.attached;this.detach_ts=new Date;this.pos=this.dur=this.attached=undefined;this.off("view_1sec",video_ctx.attached_spark.on_view_1sec_cb);this.controls.off("seeking",video_ctx.attached_spark.on_seeking_cb);this.controls.off("ended",video_ctx.attached_spark.on_ended_cb);this._state.destroy();if(reason!="suspend"&&this.view)spark.stats.inc("vstats",{view_sec:this.view,init_n:1});if(this.monitor){this.monitor=clearInterval(this.monitor);this.view=this.pos=this.duration=undefined}if(!spark.players.get_attached()){spark.players.attach_timeout=setTimeout(spark.players.ad_summary.bind(spark.players),1e4)}log.info("detach from "+this.id);this.emit("detach"+(this.detached.ad_src?"_ad":""),video_ctx,reason);spark.players.emit("detach"+(this.detached.ad_src?"_ad":""),this,video_ctx,reason)};Player.prototype._is_autostart=function(){return this.controls&&this.controls.is_autostart&&this.controls.is_autostart();
};Player.prototype.is_video_ignored=function(){if(!this._is_autostart())return;var filter=spark.get_conf("general.filter.small_video",{});var minw=filter.width||300,minh=filter.height||300;var allow=!util.is_mobile||filter.allow_mobile;var size=this.get_size().container_size||{};if(!filter.disable&&allow&&size.width<=minw&&size.height<=minh)return true};Player.prototype.is_extra_ui_allowed=function(opt){if(opt.feature=="spark_layout"&&this._state.get(player_states.WN_PANEL_ANIMATION)){return false}if(!this.__is_extra_ui_allowed){var fn=spark.get_conf("general.player.is_extra_ui_allowed_fn");this.__is_extra_ui_allowed=fn?util.custom_fn(fn,"player, opt"):function(){return true}}return this.__is_extra_ui_allowed(this,opt)};Player.prototype.set_state=function(state){this._state.set(state)};Player.prototype.on_state=function(cb,props){this._state.on(cb,props)};Player.prototype.off_state=function(cb){this._state.off(cb)};function get_play_seq(){if(get_play_seq.last_top_url!=spark.top_url){get_play_seq.last_top_url=spark.top_url;get_play_seq.play_seq_n=0}return++get_play_seq.play_seq_n}function serialize(size){return size&&Math.round(Math.min(size.width||0,9999))+"x"+Math.round(Math.min(size.height||0,9999))}Player.prototype._get_map_info=function(cb){var controls=this.controls;var res=controls.get_resolution();var dims=controls.get_media_size();var data={size:res?serialize(res):null,nat_size:dims?serialize(dims):null};var duration;if(controls.is_live_stream())data.live=true;else if((duration=controls.get_duration())&&isFinite(duration))data.duration=duration;if(this.adaptive)data.manifest_url=this.url;else{var playlists=controls.get_playlists();data.video_url=this.url;if(playlists&&playlists.length>1)data.sources=playlists.map(function(p){return p.url})}if(util.is_mobile)data.is_mobile=1;var container=controls.get_ui().container;var sel=container&&dom_util.get_elm_selector_path(container);if(sel&&sel.length>250){sel=dom_util.get_elm_selector_path(container,true);if(sel&&sel.length>250)sel=sel.substr(sel.length-250)}data.user_meta={top_url:spark.top_url,frame_url:spark.frame_url,ua:navigator&&navigator.userAgent&&navigator.userAgent.substr(0,150),tag:spark.version,ext:util.has_ext,sel:sel};var _this=this;spark.verify_top_url_cb(function(top_url){if(!top_url)perr({id:"failed_verify_top_url"});_this._is_mapping_allowed(function(allowed){if(!allowed)data.no_mapping=true;_this.get_player_info_cb(function(ld){data.play_seq_n=get_play_seq();data.title=ld.title;data.description=ld.description;data.poster=ld.poster;cb(data)})})})};Player.prototype._is_mapping_allowed=function(cb){if(util.is_blob_url(this.url))return void cb(false);if(!this._is_mapping_allowed_by_env())return cb(false);if(!E.conf.filter_frame_for_mapping)return cb(true);if(this.frame_allowed_for_mapping!==undefined)return cb(this.frame_allowed_for_mapping);var _this=this;spark.msg.check_frame_css_cb(E.conf.filter_frame_for_mapping,function(allowed){_this.frame_allowed_for_mapping=allowed;cb(allowed)})};Player.prototype._is_mapping_allowed_base=function(){if(util.is_blob_url(this.url))return false;if(!this._is_mapping_allowed_by_env())return false;if(E.conf.filter_frame_for_mapping&&this.frame_allowed_for_mapping!==undefined){return this.frame_allowed_for_mapping}return true};Player.prototype._is_mapping_allowed_by_env=function(){if(!spark.is_spark_site&&spark.is_site_root&&!zurl.parse(spark.top_url).query||spark.top_url_modified||spark.content_modified){return false}var pages={exclude:E.conf.exclude_page_for_mapping||[]};if(!util.check_url(spark.top_url,pages))return false;if(!spark.is_video_url_allowed(this.url,E.conf))return false;if(this.is_video_ignored())return false;var container;if(container=this.controls&&this.controls.get_ui().container){if($(container).parents(".floating-migrated-players,"+".spark_injected_player").length){return false}var sel=E.conf.exclude_container_for_mapping;if(sel&&$(container).closest(sel).length)return false;sel=E.conf.include_container_for_mapping;if(sel&&!$(container).closest(sel).length)return false}if(util.is_samsung)return false;var fn;if((fn=E.conf.is_mapping_allowed)&&!fn($,this))return false;if(E.conf.browsers_for_mapping){var browser=util.browser&&util.browser.browser;if(!E.conf.browsers_for_mapping.includes(browser))return false}return true};E.init=function(_spark,_log){spark=_spark;var test_group=spark.get_ab_test2_group();if(test_group)console.log("spark test %s",test_group);log=_log;E.conf=util.get_platform_conf(spark.conf.video_previews);init_msg();E.players=new Players;E.players.on("attach",function(player){if(!spark.links){if(test_group&&player._is_mapping_allowed_base())player.once("detach",detach_ab_test2);return}if(!player._is_mapping_allowed_base())return;var map_event="view_10sec";var off=function(){player.off(map_event,on_view);player.off("view_last_3sec",on_view)};var on_view=function(){off();spark.verify_top_url_cb(function(){player._is_mapping_allowed(function(allowed){if(allowed)send_map_video_page(player)})})};player.once(map_event,on_view);player.once("view_last_3sec",on_view);player.once("detach",off);if(test_group)player.once("detach",detach_ab_test2)});return E.players};return E});
define("/svc/cdn/pub/editor.js",["/svc/cdn/pub/util.js"],function(util){var E={};var api_url="//holaspark.com/api.html";function show_error(){if(!util.is_top)return;var div=document.createElement("div");div.innerHTML="SPARK EDITOR: API isn't available."+"
Make sure you are logged into "+'the Control Panel';Object.assign(div.style,{backgroundColor:"#fdb804",borderRadius:"5px",color:"#333",padding:"10px",position:"fixed",right:0,textAlign:"center",top:0,zIndex:2147483647});document.body.appendChild(div);setTimeout(function(){div.parentNode.removeChild(div)},5e3)}function get_api_key(customer,cb){var iframe=document.createElement("iframe");var cbs={};var msg_id=1;document.body.appendChild(iframe);var _finally=function(_msg_id,data){if(!_msg_id)return;if(timeout)timeout=clearTimeout(timeout);var _cb;if(_cb=cbs[_msg_id])_cb(data);destroy()};var timeout=setTimeout(_finally.bind(null,msg_id,{err:"timeout"}),2e3);cbs[msg_id]=cb;var magic="sparkapi";var decode=function(msg){try{if(typeof msg!="string"||msg.indexOf(magic)!=0)return;msg=msg.slice(magic.length);msg=atob(msg);msg=JSON.parse(msg);return msg}catch(e){}};var encode=function(msg){try{msg=JSON.stringify(msg);msg=btoa(msg);msg=magic+msg;return msg}catch(e){}};var onmessage=function(msg){try{if(!msg.data)return;var data=decode(msg.data);if(!data)return;_finally(data.msg_id,data.payload)}catch(e){}};var destroy=function(){window.removeEventListener("message",onmessage);iframe.parentNode.removeChild(iframe)};iframe.onload=function(){var win=iframe.contentWindow;window.addEventListener("message",onmessage);win.postMessage(encode({msg_id:msg_id++,action:"get_api_key",payload:{customer:customer}}),"*")};iframe.src=api_url}E.init=function(spark,cb){if(util.conf.ext_api_key)return void cb();get_api_key(spark.customer,function(data){if(data.api_key)util.conf.ext_api_key=data.api_key;else show_error();cb(!!data.api_key)})};return E});
define("/svc/cdn/pub/feature/persistent/index.js",["cash","/svc/cdn/pub/util.js","/svc/cdn/pub/dom_util.js","/svc/cdn/pub/msg.js","/svc/cdn/pub/storage.js"],function($,util,dom_util,_msg,storage){var E={},assign=Object.assign,id="persistent_video",log;var is_touch=typeof document!="undefined"&&"ontouchstart"in document;var _window=typeof window!="undefined"&&window.top;var _document;try{_document=_window.document}catch(e){}var TOP_RIGHT_CORNER=0;var BOTTOM_RIGHT_CORNER=1;var BOTTOM_LEFT_CORNER=2;var TOP_LEFT_CORNER=3;var SINGLE_SWITCHING=0;var SINGLE_PERSISTENT=1;var MULTIPLE_PERSISTENT=2;var HOLDER_STYLES=["display","width","height","top","left","right","bottom","position","margin","marginTop","marginLeft","marginRight","marginBottom","minWidth"];E.default_conf={params:{y_percentage:.5,corner:is_touch?BOTTOM_RIGHT_CORNER:TOP_RIGHT_CORNER,margin_top:5,margin_right:10,margin_bottom:5,margin_left:10,height:"inherit",z_index:2147483547,paused:false,draggable:true,draggable_head:true,pause_on_close:true,sync_frame_size:false,infinite_scroll_aware:false,ad_persistent:true,over_navigation:false,multiple_policy:SINGLE_SWITCHING,clone_frame:false,preserve_aspect_ratio:false,hide_controlbar:false,threshold_selector:null,prevent_size_change:false,allow_off_screen:false,width:util.is_mobile?"200px":"250px"}};E.watermark_conf={delay:function(dur,pos){return dur-pos-Math.min(dur/2,30)}};function add_style_string(str,doc){doc=doc||_document;var node;try{node=doc.createElement("style");node.innerHTML=str;doc.head.appendChild(node)}catch(e){return false}return node}function add_to_floating_list(player){if(!E.floating_head)return E.floating_head=player;var cur=E.floating_head;while(cur.next_floating)cur=cur.next_floating;cur.next_floating=player;player.prev_floating=cur}function animate_player(player,keyframes,done,on_frame_update){if(player.is_animating){if(!player.animation_stack)player.animation_stack=[];player.animation_stack.push({keyframes:keyframes,done:done});return}function done_wrapper(e){done(e);player.fix_ima_size(true);player.is_animating=false;if(player.animation_stack&&player.animation_stack.length){var a=player.animation_stack.shift();animate_player(player,a.keyframes,a.done)}}player.is_animating=true;var dur=.3;if(player.has_googima()&&!player.has_googima_api()){log.debug("Google IMA is active, doing immediate transition");dur=0}if(E.conf.params.disable_animation)dur=0;var start_time=(new Date).getTime();var end_time=dur*1e3;requestAnimationFrame(function frame_update(){if(on_frame_update)on_frame_update();var frame_time=((new Date).getTime()-start_time)/end_time;var animation_end=false;if(frame_time>=1){frame_time=1;animation_end=true}for(var k in keyframes[0]){var val=relative_css_val(keyframes[0][k],keyframes[1][k],frame_time);if(val)set_property(player.container,k,val)}player.fix_ima_size();if(!animation_end)return void requestAnimationFrame(frame_update);done_wrapper()})}function border_radius_hack(style){if(util.is_ie&&style.overflow=="hidden"&&(style.borderTopLeftRadius||style.borderTopRightRadius||style.borderBottomLeftRadius||style.borderBottomRightRadius)){return{"border-radius":"0"}}}function calc_baseline(player){var prev=player.prev_floating;if(!prev)return 0;var c=parseInt(E.conf.params.corner);var m=c==BOTTOM_RIGHT_CORNER||c==BOTTOM_LEFT_CORNER?E.conf.params.margin_bottom:E.conf.params.margin_top;return util.is_mobile?prev.baseline+10*m:prev.baseline+prev.height+m}function calc_floating_size(player){var a=$("
");a.css({visibility:"hidden",position:"fixed"});$(_document.body).append(a);player.width=a.width();a.remove();var ms=!E.conf.params.preserve_aspect_ratio&&player.get_media_size();var ratio=ms?ms.height/ms.width:$(player.container).height()/$(player.container).width();player.height=Math.round(player.width*ratio);if(E.conf.params.modify_size_fn){try{var modify_size_fn=E.conf.params.modify_size_fn;if(typeof modify_size_fn=="string")modify_size_fn=new Function("player",modify_size_fn);modify_size_fn(player)}catch(e){log.err("invalid modify_size_fn function")}}}function check_threshold(p){var threshold=$(E.conf.params.threshold_selector)[0];if(!threshold)return;var thr_offset=$(threshold).offset();var pl_offset=$(p.container).offset();var pl_height=$(p.container).height();if(pl_offset.top+pl_height>thr_offset.top){var parent_offset=dom_util.offset_parent(p.container);var top=thr_offset.top-parent_offset.top-pl_height;var left=pl_offset.left-parent_offset.left;set_property(p.container,"position","absolute");set_property(p.container,"top",top+"px");set_property(p.container,"left",left+"px");set_property(p.container,"bottom","auto");set_property(p.container,"right","auto");p.absolute_top=top;p.absolute_left=left;p.translate_x=p.translate_y=0;update_video_control(p);return}if(p.container.style.position!="absolute")return;var vp=dom_util.visual_viewport();if(p.is_playing()&&p.container.getBoundingClientRect().bottombottom_edge){p.translate_x=p.translate_y=0;init_floating_position(p);update_video_control(p)}}function close_video_control(player){if(E.conf.params.draggable)disable_draggable(player);if(player.video_control)_document.body.removeChild(player.video_control);if(E.spark_modules.watermark&&player.watermark_overlay){_document.body.removeChild(player.watermark_overlay);E.spark_modules.watermark.remove(player.watermark_overlay)}}function disable_draggable(player){if(!player.video_control)return;log.debug("disable dragging");player.draggable_fns.mouseup();$(player.video_control).off("mousedown",player.draggable_fns.mousedown);$(_document.body).off("mousemove",player.draggable_fns.mousemove);$(_document.body).off("mouseup",player.draggable_fns.mouseup)}function disable_floating(player){if(E.conf.params.pause_on_close||player.migrated)player.pause();end_floating(player,function(){if(!player.migrated){if(!E.conf.params.pause_on_close)E.players.player_remove(player.player);player.was_visible=false;player.was_closed=true;return}if(player.origin_page_url==E.spark.get_top_url()){var original_player=E.players.players.find(function(p){return p!=player&&p.get_url()==player.get_url()});if(original_player){if(player.is_playing())original_player.play();E.players.player_remove(original_player.player)}}E.players.remove_migrated(player.container)})}function disable_touch_gestures(player){if(!player.touch_fns)return;log.debug("disable_touch_gestures");["touchstart","touchmove","touchend"].forEach(function(e){player.container.removeEventListener(e,player.touch_fns[e],false)});if(player.touch_fns.click_uninit)player.touch_fns.click_uninit=player.touch_fns.click_uninit();if(player.click_overlay)player.click_overlay.remove();player.click_overlay=null;player.touch_gestures_enabled=false}function enable_draggable(player){log.debug("enable dragging");player.translate_x=player.translate_x||0;player.translate_y=player.translate_y||0;if(!player.draggable_fns){player.draggable_fns={mousedown:function(e){if(player.video_control!=e.target)return;player.draggable={start_x:e.x,start_y:e.y};player.container.classList.add("floating-video-dragging");e.preventDefault()},mousemove:function(e){if(!player.draggable)return;player.translate_x+=-e.x+player.draggable.start_x;player.translate_y+=e.y-player.draggable.start_y;update_floating_position(player);update_video_control(player);player.update_watermark();player.draggable.start_x=e.x;player.draggable.start_y=e.y;e.preventDefault()},mouseup:function(){player.container.classList.remove("floating-video-dragging");player.draggable=false}}}$(player.video_control).on("mousedown",player.draggable_fns.mousedown);$(_document.body).on("mousemove",player.draggable_fns.mousemove);$(_document.body).on("mouseup",player.draggable_fns.mouseup)}function enable_touch_gestures(player,is_slave){if(!is_slave&&E.conf.params.force_video_control)init_video_control(player);if(!player.is_floating&&!player.is_self_floating||player.ending_floating||player.touch_gestures_enabled){return}log.debug("enable touch gestures");if(!player.touch_fns){var ignore;player.touch_fns={touchstart:function(e){var t=e.touches[0];var top=function(el){return $(el).offset().top};if(ignore=E.conf.check_target&&top(t.target)-top(player.container)<-5){return}if(is_slave)E.msg.touch_start(t.screenX);else player.touch_fns.do_touchstart(t.screenX)},touchmove:function(e){if(ignore)return;e.preventDefault();var t=e.touches[0];if(is_slave)E.msg.touch_move(t.screenX);else player.touch_fns.do_touchmove(t.screenX)},touchend:function(e){if(ignore)return;if(is_slave)E.msg.touch_end();else player.touch_fns.do_touchend()},click:function(e){if(is_slave)E.msg.click();else player.touch_fns.do_click()}};if(!is_slave){var doc_width=_window.innerWidth||_document.documentElement.clientWidth||_document.body.clientWidth;var start_x=null,translate;var pixel_ratio=util.is_android&&util.is_chrome&&Math.abs(doc_width-980)<5&&_window.devicePixelRatio||1;player.touch_fns.do_touchstart=function(x){start_x=x};player.touch_fns.do_touchmove=function(x){if(start_x==null)start_x=x;translate=(start_x-x)*pixel_ratio;update_floating_position(player,translate);$(player.container).css({opacity:Math.max(0,1-Math.abs(translate/(doc_width/2)))})};player.touch_fns.do_touchend=function(){start_x=null;if(doc_width/2").css({position:"absolute",top:"0",left:"0",height:"100%",width:"100%","z-index":1e3,"pointer-events":"auto"}).appendTo(player.container)}}events.forEach(function(evt){dom_util.non_passive_listener(player.container,evt,player.touch_fns[evt])});player.touch_gestures_enabled=true}function end_floating(player,done,force){log.debug("player id "+player.get_id()+": floating -> normal");hide_video_control(player);if(is_touch)disable_touch_gestures(player);player.ending_floating=true;var np=remove_from_floating_list(player);if(player.container.style.position=="absolute")init_floating_position(player);var is_playing=player.is_playing();var on_end=function(){update_baselines(np);if(player.dom_transform){$(player.holder).before(player.container);if(is_playing){setTimeout(function(){if(_document.body.contains(player.container)&&!player.is_playing()){player.play()}},1)}}else fix_ancestors_styles(player,false);if(player.container.parentNode){player.container.parentNode.classList.remove("floating-video-parent")}if(player.container.nodeName=="IFRAME"){if(player.old_scrolling_attr){$(player.container).attr("scrolling",player.old_scrolling_attr)}else $(player.container).removeAttr("scrolling")}if(player.is_frame)player.sync_frame_size(false);player.container.classList.remove("floating-video");$(player.container).attr("style",player.container_styles);player.holder.classList.add("floating-video-hidden");player.is_self_floating=false;player.ending_floating=false;player.end_floating();player.prevent_size_change(false);if(done)done()};delete player.baseline;if(force||!_document.body.contains(player.container))return on_end();var keyframes=[keyframe_end(player),keyframe_start(player)];animate_player(player,keyframes,on_end,function keyframe_recalc(){assign(keyframes[1],keyframe_start(player))})}function ensure_styles(){if(!E.styles_el||!E.styles_el.parentNode)E.styles_el=generate_styles()}function fix_ancestors_styles(player,enable){var parent=player.container.parentNode;while(parent&&parent!=document.body){if(enable){var computed=window.getComputedStyle(parent);var s,new_style=transform_hack(computed);if(s=border_radius_hack(computed))new_style=assign(new_style||{},s);if(new_style){$(parent).data("spark-prev-style",$(parent).attr("style")||"");$(parent).css(new_style)}}else{var style=$(parent).data("spark-prev-style");if(style!==undefined)$(parent).attr("style",style)}parent=parent.parentNode}if(E.conf.params&&E.conf.params.fix_ancestors_styles){E.conf.params.fix_ancestors_styles({$:$,E:E,player:player,enable:enable})}}function fullscreen_change_handler(player,full_el){if(!player.is_self_floating)return;if(player.container==full_el){player.container.classList.remove("floating-video");player.container.removeAttribute("style");if(is_touch)disable_touch_gestures(player)}else{player.container.classList.add("floating-video");init_floating_position(player);if(is_touch)enable_touch_gestures(player)}if(player.is_pip())end_floating(player)}function generate_styles(){var color_first="#000000";var color_second="rgba(0,0,0,0.3)";var color_contrast="white";var sm_min="768px";var md_min="992px";var lg_min="1200px";var width=parseInt(E.conf.params.width)||200;var height=parseInt(E.conf.params.height);var z_index=E.conf.params.z_index;var css_classes={".floating-video":{width:width+"px !important",position:"fixed !important","z-index":z_index+" !important",border:"1px solid "+color_first,padding:"0 !important","box-shadow":"0 0 5px black","min-height":height?height+"px":undefined,"background-color":"black",transform:"none !important","box-sizing":"border-box"},".floating-video-holder":{display:"block"},".floating-video-hidden":{display:"none !important"},".floating-video-control":{position:"fixed","z-index":z_index+1,cursor:E.conf.params.draggable?"move":"auto","pointer-events":E.conf.params.draggable?"auto":"none","text-align":"left !important"},".floating-video-control .fv-close":{color:color_contrast,width:"20px","line-height":"20px",border:"none",background:"transparent",cursor:"pointer !important","pointer-events":"auto",padding:"0"},".floating-video-control .fv-close::after":{"font-size":"25px","font-family":"monospace",display:"block",transform:"translateY(-2px) rotate(45deg)",content:'"\\00ab"'},".floating-video-control.fv-migrated .fv-close::after":{transform:"none",content:'"\\00d7"'},".floating-video-control .fv-close:hover":{background:color_second},".floating-video-dragging":{"pointer-events":"none"},".floating-video *":{"min-height":"0px !important"},".floating-migrated-players":{width:"0",height:"0",overflow:"hidden"}};var styles=util.get_stylesheet(css_classes);styles+="@media (min-width: "+sm_min+") {"+util.get_stylesheet({".floating-video":{width:width*1.25+"px !important","min-height":height?height*1.25+"px":undefined}})+"}";styles+="@media (min-width: "+md_min+") {"+util.get_stylesheet({".floating-video":{width:width*1.5+"px !important","min-height":height?height*1.25+"px":undefined}})+"}";styles+="@media (min-width: "+lg_min+") {"+util.get_stylesheet({".floating-video":{width:width*1.5+"px !important","min-height":height?height*1.5+"px":undefined}})+"}";return add_style_string(styles)}function get_margins(baseline,translate_x,translate_y,ignore_threshold){var res={},params=E.conf.params;baseline=baseline||0;translate_x=translate_x||0;translate_y=translate_y||0;var thr_offset=ignore_threshold?0:threshold_offset();switch(parseInt(params.corner)){case BOTTOM_RIGHT_CORNER:res.right=params.margin_right+translate_x;res.bottom=baseline+Math.max(params.margin_bottom,thr_offset)-translate_y;break;case BOTTOM_LEFT_CORNER:res.bottom=baseline+Math.max(params.margin_bottom,thr_offset)-translate_y;res.left=params.margin_left-translate_x;break;case TOP_LEFT_CORNER:res.top=baseline+params.margin_top+translate_y;res.left=params.margin_left-translate_x;break;default:res.top=baseline+params.margin_top+translate_y;res.right=params.margin_right+translate_x}if(res.bottom&&util.is_ios&&util.is_safari&&!util.browser.chrome)res.bottom=Math.max(res.bottom,_window.innerHeight*.08||0);if(E.conf.params.modify_pos_fn){try{var modify_pos_fn=E.conf.params.modify_pos_fn;if(typeof modify_pos_fn=="string"){modify_pos_fn=new Function("res","params","spark",modify_pos_fn)}res=modify_pos_fn(res,params,E.spark)}catch(e){log.err("invalid modify_pos_fn function")}}return res}function hide_video_control(player){if(player.video_control)player.video_control.style.display="none";if(E.conf.params.draggable)disable_draggable(player)}function init_floating_position(player,keyframe){if(dom_util.get_fullscreen_element(_document))return;keyframe=keyframe||{};var position;if((position=$(player.container).css("position"))!=""&&position!="fixed"){$(player.container).css("position","fixed")}set_property(player.container,"min-width",player.width+"px");set_property(player.container,"width",keyframe.width||player.width+"px");set_property(player.container,"height",keyframe.height||player.height+"px");set_property(player.container,"min-height",player.height+"px");set_property(player.container,"top",keyframe.top||"auto");set_property(player.container,"right",keyframe.right||"auto");set_property(player.container,"bottom",keyframe.bottom||"auto");set_property(player.container,"left",keyframe.left||"auto");if(!keyframe.left&&!keyframe.right)update_floating_position(player)}function init_video_control(player){if(!player.video_control){player.video_control=_document.createElement("div");player.video_control.classList.add("floating-video-control");if(player.migrated)player.video_control.classList.add("fv-migrated");player.video_control.innerHTML="";if(E.conf.params.control_in_player&&player.container)player.container.appendChild(player.video_control);else _document.body.appendChild(player.video_control);$(player.video_control).find("button[class=fv-close]").on("click",function(){disable_floating(player)})}player.video_control.style.display="block";update_video_control(player);if(E.conf.params.draggable)enable_draggable(player)}function is_floating_playing(p){return E.conf.params.ad_persistent?p.is_playing()||p.is_ad_playing():p.is_playing()&&!p.is_ad_playing()}function is_there_master(){if(util.is_friendly_iframe){var win=window.top;try{return!!(win.hola_cdn||win.document.querySelector('script[src*=".h-cdn.com/loader.js"]'))}catch(e){}}return false}function keyframe_start(player){var m=get_margins(player.baseline,player.translate_x,player.translate_y);var el=player.is_self_floating?player.holder:player.container;var cr=el.getBoundingClientRect();var w=$(el).width()+"px";var h=$(el).height()+"px";return{width:w,height:h,"min-width":w,"min-height":h,top:m.top?cr.top+"px":"auto",right:m.right?_window.innerWidth-cr.right+"px":"auto",bottom:m.bottom?_window.innerHeight-cr.bottom+"px":"auto",left:m.left?cr.left+"px":"auto"}}function keyframe_end(player){var m=get_margins(player.baseline,player.translate_x,player.translate_y);var w=player.width+"px";var h=player.height+"px";return{width:w,height:h,"min-width":w,"min-height":h,top:m.top?m.top+"px":"auto",right:m.right?m.right+"px":"auto",bottom:m.bottom?m.bottom+"px":"auto",left:m.left?m.left+"px":"auto"}}function make_visible(pos,player){if(util.is_mobile||typeof E.conf.params.min_margin!="number"||player.width===undefined||player.height===undefined){return pos}var min_margin=E.conf.params.min_margin;var res={};var area_w=document.body.clientWidth||window.innerWidth;var area_h=window.innerHeight;var max_x=area_w-player.width-min_margin;var max_y=area_h-player.height-min_margin;var delta_x=0,delta_y=0;if(pos.left!==undefined){res.left=Math.max(Math.min(max_x,pos.left),min_margin);delta_x=res.left-pos.left}if(pos.right!==undefined){res.right=Math.max(Math.min(max_x,pos.right),min_margin);delta_x=res.right-pos.right}if(pos.top!==undefined){res.top=Math.max(Math.min(max_y,pos.top),min_margin);delta_y=res.top-pos.top}if(pos.bottom!==undefined){res.bottom=Math.max(Math.min(max_y,pos.bottom),min_margin);delta_y=res.bottom-pos.bottom}if(player.translate_x!==undefined)player.translate_x+=delta_x;if(player.translate_y!==undefined)player.translate_y+=delta_y;return res}function process_player_touch(frame_id,msg,x){var p=E.players.get_player_by_frame(frame_id);if(!p||!p.touch_fns)return;switch(msg){case"touch_start":p.touch_fns.do_touchstart(x);break;case"touch_move":p.touch_fns.do_touchmove(x);break;case"touch_end":p.touch_fns.do_touchend();break;case"click":p.touch_fns.do_click();break}}function relative_css_val(v1,v2,ratio){var a=parseFloat(v1);var b=parseFloat(v2);if(v1.endsWith("px")&&v2.endsWith("px"))return(b-a)*ratio+a+"px"}function remove_from_floating_list(player){if(player.prev_floating)player.prev_floating.next_floating=player.next_floating;if(E.floating_head==player)E.floating_head=player.next_floating;if(player.next_floating)player.next_floating.prev_floating=player.prev_floating;var np=player.next_floating;delete player.prev_floating;delete player.next_floating;return np}function replace_in_floating_list(p1,p2){p2.prev_floating=p1.prev_floating;p2.next_floating=p1.next_floating;if(p1.prev_floating)p1.prev_floating.next_floating=p2;if(E.floating_head==p1)E.floating_head=p2;if(p1.next_floating)p1.next_floating.prev_floating=p2;delete p1.prev_floating;delete p1.next_floating}function scroll_to(player,force){var sc,ty,el=player.holder;if(player.is_scrolling||!el)return;for(sc=el.parentNode;sc&&sc.scrollTop==0;sc=sc.parentNode)sc.scrollTop++;if(!sc)return;end_floating(player,undefined,force);var offset=Math.floor((window.screen.height-$(el).height())/2);for(ty=0;el&&el!=sc;el=el.offsetParent)ty+=el.offsetTop;ty-=offset;var it=0,total=10,start=sc.scrollTop,change=ty-sc.scrollTop;if(E.conf.params.disable_scroll_to)return void disable_floating(player);player.is_scrolling=true;requestAnimationFrame(function frame_update(){sc.scrollTop=change*(Math.pow(it/total-1,3)+1)+start;it++;if(it==total||change<0&&sc.scrollTop<=ty||change>0&&sc.scrollTop>=ty){if(it==total)sc.scrollTop=ty;return void(player.is_scrolling=false)}requestAnimationFrame(frame_update)})}function set_property(node,property,value){node.style.setProperty(property,value,"important")}function setup_msg_handlers(){E.msg.on("master_found",function(){E.msg.master_found=true;E.players.init();E.inited=true});E.msg.on("frame_removed",E.players.frame_remove.bind(E.players));E.msg.add_top_handler("player_found",E.players.frame_add.bind(E.players));E.msg.add_top_handler("player_detached",E.players.frame_remove.bind(E.players));E.msg.add_top_handler("player_state",function(frame_id,state){var p;if(p=E.players.get_player_by_frame(frame_id))p.set_state(state)});E.msg.add_top_handler("on_play",function(frame_id){var p;if(p=E.players.get_player_by_frame(frame_id))E.players.check_multiple(p);E.players.on_scroll()});E.msg.add_top_handler("touch_start",function(frame_id,x){process_player_touch(frame_id,"touch_start",x)});E.msg.add_top_handler("touch_move",function(frame_id,x){process_player_touch(frame_id,"touch_move",x)});E.msg.add_top_handler("touch_end",function(frame_id){process_player_touch(frame_id,"touch_end")});E.msg.add_top_handler("click",function(frame_id){process_player_touch(frame_id,"click")});E.msg.add_frame_handler("play",function(){return E.players.first().play()});E.msg.add_frame_handler("pause",function(){return E.players.first().pause()});E.msg.add_frame_handler("seek",function(pos){return E.players.first().seek(pos)});E.msg.add_frame_handler("init_watermark",function(){if(E.spark_modules.watermark)E.players.first().init_watermark()});E.msg.add_frame_handler("fix_ima_size",function(is_final_size){var p=E.players.first();if(p)p.fix_ima_size(is_final_size)});E.msg.add_frame_handler("sync_frame_size",function(is_floating,fdims){var p=E.players.first();if(p)p.sync_frame_size(is_floating,fdims)});E.msg.add_frame_handler("start_floating",function(){$("body").addClass("floating-video-iframe");E.players.first().start_floating();enable_touch_gestures(E.players.first(),true)});E.msg.add_frame_handler("end_floating",function(){$("body").removeClass("floating-video-iframe");var p=E.players.first();if(!p)return;disable_touch_gestures(p);p.end_floating()});E.msg.add_frame_handler("allow_autoplay",function(){var p=E.players.first();if(p.autoplay_allowed)return;var src=p.player.controls.html5.src;p.player.controls.html5.src="";p.player.controls.html5.play();p.player.controls.html5.src=src;p.autoplay_allowed=true})}function start_floating(player){ensure_styles();log.debug("player id "+player.get_id()+": normal -> floating");player.was_closed=false;player.start_floating();if(player.container.nodeName=="IFRAME"){player.old_scrolling_attr=$(player.container).attr("scrolling");$(player.container).attr("scrolling","no")}E.players.check_multiple(player);add_to_floating_list(player);player.baseline=calc_baseline(player);calc_floating_size(player);var keyframes=[keyframe_start(player),keyframe_end(player)];stats_start();if($(player.container).hasClass("hola_playlist_video"))$(player.container).attr("style",player.container.pl_orig_style||"");player.container_styles=$(player.container).attr("style")||"";if(!player.holder){player.holder=_document.createElement("div");$(player.container).after(player.holder);player.holder.setAttribute("class","floating-video-holder")}for(var i=0;isheight)swidth=sheight;return swidth<=util.get(E.conf.params,"screen_width",700)};PersistentPlayer.prototype.is_pip=function(){var api=this.player.controls;return api.html5&&api.html5.webkitPresentationMode=="picture-in-picture"};PersistentPlayer.prototype.is_playing=function(){return this.player.controls.is_playing()||this.player.container.hola_autoplay_playing_muted};PersistentPlayer.prototype.is_playing_autoplay_muted=function(){return!!this.player.container.hola_autoplay_playing_muted};PersistentPlayer.prototype.is_video_allowed=function(){if(this.infinite_scroll&&this.infinite_scroll.href!=window.location.href){return false}var alts=this.alternates||[];if(!alts.length||this.is_playing())return util.check_url(this.get_video_url(),E.conf.video_url);for(var i=0;i=viewport.top-delta&&rect.bottom<=viewport.bottom+delta};PersistentPlayer.prototype.pause=function(){if(this.player.controls.is_ad_active())this.player.controls.ad_pause();else this.player.controls.pause()};PersistentPlayer.prototype.play=function(){this.ignore_play=true;this.player.controls.play()};var orig_width_fn,orig_height_fn;PersistentPlayer.prototype.prevent_size_change=function(enable){var _this=this,vjs=this.player.controls.vjs;if(!E.conf.params.prevent_size_change||!vjs)return;orig_width_fn=orig_width_fn||vjs.width;orig_height_fn=orig_height_fn||vjs.height;if(enable){var replace_style=function(name,value){$(_this.holder).css(name,value);var s=_this.container_styles;if(!s)return;var re=new RegExp("^(.*;\\s*)?"+name+":[^;]*");_this.container_styles=s.replace(re,"$1"+name+":"+value)};vjs.width=function(v){replace_style("width",v)};vjs.height=function(v){replace_style("height",v)};return}vjs.width=orig_width_fn;vjs.height=orig_height_fn};PersistentPlayer.prototype.restore_state=function(opt,migrated){if(opt.pos&&!util.get(E.spark,"features.position_memory.inited"))this.seek(opt.pos);if(opt.playing)this.play();if(!migrated)return;this.origin_page_url=opt.origin_page_url;this.set_migrated(true);start_floating(this)};PersistentPlayer.prototype.save_state=function(){return{name:"hola",origin_page_url:this.origin_page_url||E.spark.get_top_url(),width:$(this.container).width(),height:$(this.container).height(),pos:this.get_pos(),volume:this.get_volume(),muted:this.get_muted(),playing:this.is_playing(),video_url:this.get_url()}};PersistentPlayer.prototype.seek=function(pos){var api=this.player.controls;if(!pos||api.is_live_stream())return;this.player.seek(pos)};PersistentPlayer.prototype.set_migrated=function(val){this.migrated=val;if(this.video_control)$(this.video_control).toggleClass("fv-migrated",val)};PersistentPlayer.prototype.should_float=function(){if(this.is_scrolling)return false;var alts=this.alternates||[];var playing=E.conf.paused||is_floating_playing(this);if(!alts.length)return playing;if(!this.player.controls.is_ad_active())return playing;for(var i=0;i=0}},{tag:"IFRAME",skip:function(tag){return tag.src.indexOf("//www.youtube.com/embed")>=0&&!_this.is_youtube}}];var container=this.get_base_container();for(var i=0;i=slide_pos_next;$el.toggleClass("hola_vt_slide_blur",need_blur)})};Widget.prototype.bind_events=function(){this._subscribe(this.container,"mousemove",this.show.bind(this));this._subscribe(this.container,"mouseleave",this.hide.bind(this));var _this=this;var repeat=function(){_this.blur_slides();setTimeout(check_reqs,500)};var check_reqs=function(){var c=_this.control_bar;if(c.css("display")=="none"||c.css("opacity")=="0"||c.css("visibility")=="hidden"){if(Date.now()-_this.last_move>3e3)_this.hide()}if(_this.get_width()!=_this.seekbar_width||_this.player.get_duration()!=_this.video_duration){return void _this.adjust(repeat)}repeat()};check_reqs()};Widget.prototype.get_width=function(){var seekbar_width=this.get_progress_bar().width();if(!seekbar_width)return 0;return E.conf.params.vt_seekbar_width?seekbar_width:this.control_bar.width()};Widget.prototype.adjust=function(cb){this.video_duration=this.player.get_duration();this.seekbar_width=this.get_width();this.max_count=Math.min(Math.floor(this.get_width()/75),this.thumbs_count);var _this=this;this.make_list(function(thumb_list){if(thumb_list){_this.thumb_list=thumb_list;_this.render();if(_this.shown)_this.show(true)}cb()})};Widget.prototype._subscribe=function(elem,name,fn){$(elem).on(name,fn);this.listeners.push({elem:elem,name:name,fn:fn})};Widget.prototype.detach=function(){this.hide();this.listeners.forEach(function(l){$(l.elem).off(l.name,l.fn)});this.listeners=[];if(this.tlwrap)dom_util.remove(this.tlwrap);if(this.check_reqs_timeout)this.check_reqs_timeout=window.clearTimeout(this.check_reqs_timeout)};Widget.prototype.format_time=function(sec){return format_sec(sec).slice(0,-4)};Widget.prototype.render=function(){var _this=this;if(this.tl){$(this.tl).find("div").get().forEach(function(elem){_this.listeners=_this.listeners.filter(function(ev){if(ev.elem==elem)$(elem).off(ev.name,ev.fn);return ev.elem!=elem})});dom_util.remove(this.tlwrap)}var tlwrap=document.createElement("div");$(tlwrap).addClass("hola_visual_timeline_holder");$(tlwrap).css({opacity:0,"background-image":"url("+this.strip_url+")","background-repeat":"no-repeat","background-size":"cover",position:"absolute",bottom:0,left:0,width:"100%"});var tl=document.createElement("div");$(tl).css({display:"flex",position:"absolute",height:100-this.strip_pad_percent*2+"%",top:this.strip_pad_percent+"%"});var thumb_size=this.get_thumb_size();this.thumb_list.forEach(function(item){var elem=document.createElement("div");var elem_dim=document.createElement("div");$(elem_dim).addClass("hola_vt_dim");var $elem=$(elem);$elem.addClass("hola_vt_slide");$elem.css({position:"relative",margin:"0 "+(_this.hor_margin_px+(thumb_size.m||0))+"px",display:"block",cursor:"pointer","justify-content":"flex-start","flex-basis":100/_this.max_count+"%","background-image":item["background-image"],"background-position":item["background-position"],"background-size":"500% 500%","background-repeat":"repeat","pointer-events":"auto"});$elem.attr("data-hola-vt-tooltip",_this.format_time(item.pos));$elem.data("hola-vt-pos",item.pos);$elem.data("hola-vt-pos-next",item.pos_next);_this._subscribe(elem,"click",function(event){event.mouse_time=item.pos;if(_this.on_timeline_click)_this.on_timeline_click(event);log.info("seek to "+item.pos);_this.spark_player.seek(item.pos)});$elem.append(elem_dim);$(tl).append(elem)});tlwrap.appendChild(tl);this.control_bar.after(tlwrap);this.tl=tl;this.tlwrap=tlwrap;this._subscribe(this.tlwrap,"mouseenter",this.timeline_hover.bind(this));this._subscribe(this.tlwrap,"mouseleave",this.timeline_unhover.bind(this))};Widget.prototype.get_thumb_size=function(){var width=this.get_width()/this.max_count-this.hor_margin_px*2;var height=width*(this.ratio>1?this.player_ratio:this.ratio);var _w=0,margin=0;if(this.ratio>1){_w=height/this.ratio;margin=width-_w;width=_w}return{w:width,h:height,m:margin/2}};Widget.prototype.show=function(force){var _this=this;if(Date.now()-this.last_move>200){setTimeout(function(){_this.control_bar.trigger("mousemove",{skip:true})},0)}this.last_move=Date.now();if(!this.thumbnails.is_allowed()||this.spark_player.is_floating()||this.spark_player.is_small()){this.hide();return}if(this.shown&&!force)return;this.shown=true;if(E.conf.params.on_timeline_show)E.conf.params.on_timeline_show({E:E,$:$,_this:this});var thumb_size=this.get_thumb_size();var dt=100*thumb_size.h/(100-this.strip_pad_percent*2);log.debug("show viewer w="+thumb_size.w+", h="+thumb_size.h+", dt="+dt);if(E.conf.params.translate_control_bar)this.control_bar.css({transform:"translateY(-"+dt+"px)"});else this.control_bar.css({bottom:dt+"px",position:"absolute"});$(this.player.get_ui().settings_menu).css({transform:"translateY(-"+dt+"px)"});var left=E.conf.params.vt_seekbar_width?this.get_progress_bar().offset().left-this.control_bar.offset().left:0;this.blur_slides();$(this.tlwrap).css({opacity:1,height:dt+"px"});$(this.tl).css({left:left+"px",width:this.get_width()+"px"});E.stats.inc_d("vtimeline_show_n")};Widget.prototype.hide=function(){if(!this.shown)return;this.shown=false;if(E.conf.params.on_timeline_hide)E.conf.params.on_timeline_hide({E:E,$:$,_this:this});log.info("hide viewer");$(this.tlwrap).css("opacity",0);if(E.conf.params.translate_control_bar)this.control_bar.css({transform:"translateY(0px)"});else{var bottom=E.conf.params.hide_bottom?E.conf.params.hide_bottom:"0px";this.control_bar.css({bottom:bottom,position:"absolute"})}$(this.player.get_ui().settings_menu).css({transform:"translateY(0)"});E.stats.inc_d("vtimeline_hide_n")};E.init=function(spark_modules,conf){log=spark_modules.log;E.stats=spark_modules.stats;E.conf=conf};return E});
define("/svc/cdn/pub/feature/thumbnails/index.js",["cash","/svc/cdn/pub/util.js","/svc/cdn/pub/dom_util.js","/svc/cdn/pub/html5.js","/svc/cdn/pub/feature/thumbnails/timeline.js"],function($,util,dom_util,html5,timeline){var E={};var assign=Object.assign;var id="thumbnails",log;var def_thumb_height=100;E.watermark_conf={corner:"top-left",delay:function(duration,pos){return 1e6}};var tooltip_bg_img="data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22htt"+"p%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3"+"Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate"+"%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0."+"000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594"+",0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E";var css=["[data-hola-vt-tooltip] {"," transition: all .18s ease-out .18s;"," position: relative;","}","[data-hola-vt-tooltip]:before,[data-hola-vt-tooltip]:after {"," opacity: 0;"," pointer-events: none;"," bottom: 100%;"," left: 50%;"," position: absolute;"," z-index: 2147483647;"," transform: translate(-50%, 10px);"," transform-origin: top;"," transition: all .18s ease-out .18s;","}","[data-hola-vt-tooltip]:after {"," background: rgba(17,17,17,0.9);"," border-radius: 4px;"," color: #fff;"," content: attr(data-hola-vt-tooltip);"," font-size: 12px;"," padding: .5em 1em;"," white-space: nowrap;"," margin-bottom: 11px;","}","[data-hola-vt-tooltip]:before {",' background: url("'+tooltip_bg_img+'") no-repeat;'," background-size: 100% auto;"," height: 6px;"," width: 18px;",' content: "";'," margin-bottom: 5px;","}","[data-hola-vt-tooltip]:hover:before,[data-hola-vt-tooltip]:hover:after {"," opacity: 1;"," pointer-events: auto;"," transform: translate(-50%, 0);","}",".hola_thumb_holder {"," height: 0!important;"," width: 0!important;"," overflow: visible!important;"," position: absolute!important;","}",".hola_thumb_img {"," position: absolute!important;"," left: 0;"," color: #fff!important;"," background-position: 0 0;"," background-repeat: no-repeat;"," background-attachment: scroll;"," background-origin: content-box;"," background-clip: content-box;"," background-color: rgba(0,0,0,0.7);"," border: 2px solid rgba(0,0,0,0.7)!important;"," border-radius: 3px;"," box-sizing: content-box;","}",".hola_thumb_img .hola_thumb_text_wrapper {"," display: block;"," position: absolute;"," line-height: normal;"," width: 100%;"," bottom: 0;"," text-align: center;","}",".hola_thumb_img .hola_thumb_text {"," padding: 2px 4px 0 4px;"," font-size: 12px;"," background: rgba(0,0,0,0.7);","}",".hola_thumb_msg {"," position: relative;"," width: 100%;"," text-align: center;"," font-size: 15px;","}",".hola_thumb_fullscreen {"," position: absolute;"," top: 0;"," bottom: 0;"," left: 0;"," right: 0;"," overflow: hidden;"," background: #000;","}",".hola_thumb_drag_handler {"," position: absolute;"," background: none!important;"," top: 0;"," bottom: 0;"," left: 0;"," right: 0;"," z-index: 2;","}",".hola_video_wrapper {"," padding: 0!important;"," border-box: content-box!important;","}",".hola_video_wrapper video {"," margin: 0!important;","}",".hola_vt_dim {"," position: absolute;"," top: 0;"," left: 0;"," display: block;"," width: 100%;"," height: 100%;"," background: #fff;"," opacity: 0;"," pointer-events: none;"," transition: opacity .3s ease-in-out;","}",".hola_vt_blur .hola_vt_slide_blur .hola_vt_dim {"," opacity: .4;","}"].join("\n");function get_event_point(event,offset){var obj={left:event.changedTouches?event.changedTouches[0].pageX:event.pageX,top:event.changedTouches?event.changedTouches[0].pageY:event.pageY};if(offset){obj.left=obj.left-offset.left;obj.top=obj.top-offset.top}return obj}function format_sec(sec){sec=Math.round(sec);var s=sec%60;var min=Math.floor(sec%3600/60);var hour=Math.floor(sec/3600);return(hour?pad(hour,2)+":":"")+pad(min,2)+":"+pad(s,2)+".000"}function on_player_attach(player,video_ctx,reason){var controls=player.controls;if(E.conf.is_player_allowed&&!E.conf.is_player_allowed({E:E,player:player,video_ctx:video_ctx})){return log.info("player is excluded")}if(!controls)return log.err("player.controls is undefined");var video_url=util.absolute_uri(player.controls.get_url());if(!util.check_url(video_url,E.conf.video_url))return log.info("video_url ("+video_url+") is excluded");var thumbnails=video_ctx.attached_thumbnails;if(!thumbnails){thumbnails=new Thumbnails(player,video_ctx);video_ctx.attached_thumbnails=thumbnails;thumbnails.on_float=thumbnails.hide.bind(thumbnails);thumbnails.on_float_end=thumbnails.show.bind(thumbnails);thumbnails.check_attached=thumbnails.check_attached.bind(thumbnails)}else if(reason=="restore"){if(!player.is_floating())thumbnails.show()}controls.on("persistent.start_floating",thumbnails.on_float);controls.on("persistent.end_floating",thumbnails.on_float_end);controls.on("play",thumbnails.check_attached);controls.on("pause",thumbnails.check_attached);player.once("detach",function(_video_ctx,_reason){controls.off("persistent.start_floating",thumbnails.on_float);controls.off("persistent.end_floating",thumbnails.on_float_end);controls.off("play",thumbnails.check_attached);controls.off("pause",thumbnails.check_attached);if(_reason=="suspend")return thumbnails.hide();thumbnails.detach();_video_ctx.attached_thumbnails=undefined})}function pad(num,size){return("000"+num).slice(-size)}function Viewer(thumbnails){this.listeners=[];this.thumbnails=thumbnails;this.player=thumbnails.player;this.spark_player=thumbnails.spark_player;this.container=this.get_container();if(!this.container||!this.container.length)return log.err("thumbnails - no container");this.el_container=this.container.length?this.container[0]:this.container;if(document.body.contains(this.el_container))dom_util.add_style("data-spark-thumbnails",css);else{dom_util.add_style("data-spark-thumbnails",css,this.el_container.parentNode)}this.inited=true;this.div=document.createElement("div");this.div.style.display="none";this.div.className="hola_thumb_holder hola_top_element";this.img=document.createElement("div");this.div.appendChild(this.img);this.img.className="hola_thumb_img";this.pending_msg=document.createElement("div");this.pending_msg.className="hola_thumb_msg";this.pending_msg.style.display="none";this.pending_msg.textContent="Refresh for thumbnails";this.img.appendChild(this.pending_msg);var text_wrapper=$("").appendTo($(this.img));this.text_el=$("").appendTo(text_wrapper);var colors=E.conf.params.colors;if(colors){assign(this.img.style,{"border-color":colors.bg,color:colors.text})}this.video_offset=util.player2offset(this.player);this.insert_after_video(this.div);this.add_styles();var on_move=this.on_move.bind(this);if(this.native_controls&&util.is_android&&util.is_chrome&&util.browser.version>66){var video=this.player.html5,_this=this;this.subscribe(video,null,"seeking",function(evt){var area;if(!(area=_this.get_hover_area()))return;var offset=_this.container.offset();evt.pageX=area.left+area.width*video.currentTime/video.duration+offset.left;evt.pageY=area.top-area.height/2+offset.top;on_move(evt)})}this.subscribe(this.container,null,["touchmove",util.is_ios?"touchstart":"mousemove"],on_move,true);this.subscribe(this.container,null,["mouseout","touchcancel","touchend"],this.move_cancel.bind(this),true)}Viewer.prototype.insert_after_video=function(elem){if(E.conf.params.insert_after_video_func){var fn=new Function("$","elem","video",E.conf.params.insert_after_video_func);return fn($,elem,this.player.html5)}var insert_after_sel=E.conf.params.insert_after_video_sel||".fp-waiting";var insert_after=this.container.find(insert_after_sel).first();if(!insert_after.length)insert_after=this.player.get_ui().media;return $(elem).css("z-index",$(insert_after).css("z-index")).insertAfter(insert_after)};Viewer.prototype.init_drag=function(event){if(this.native_controls||E.conf.params.disable_drag_area)return;var progress_bar=this.get_progress_bar();if(!progress_bar||!progress_bar.length){return log.debug("progress bar is required for full frame "+"thumbnails")}if(this.drag_inited){if(progress_bar.find(this.drag_handler).length)return;this.uninit_drag()}if(E.conf.params.full_frame_thumbnails)this.drag_enabled=true;this.drag_inited=true;this.drag_div=document.createElement("div");this.drag_div.style.display="none";this.drag_div.className="hola_thumb_fullscreen hola_top_element";this.drag_img=document.createElement("div");this.drag_pending_msg=document.createElement("div");this.drag_pending_msg.className="hola_thumb_msg";this.drag_pending_msg.style.display="none";this.drag_pending_msg.textContent="Refresh for thumbnails";this.drag_img.appendChild(this.drag_pending_msg);this.drag_div.appendChild(this.drag_img);this.drag_handler=document.createElement("div");this.drag_handler.className="hola_thumb_drag_handler";progress_bar.append(this.drag_handler);this.update_drag_handler();this.insert_after_video(this.drag_div);this.subscribe(window,null,["contextmenu"],this.disable_contextmenu.bind(this),true);this.subscribe(this.drag_handler,null,["mousedown","touchstart","pointerdown"],this.drag_start.bind(this),true);this.subscribe(this.div,null,["mousedown","touchstart","pointerdown"],this.drag_start.bind(this),true);this.subscribe(window,null,["mouseup","touchend","touchcancel","pointerup"],this.drag_end.bind(this),true);this.subscribe(document.body,null,["mousemove","touchmove"],this.on_drag.bind(this),true);if(util.is_mobile&&dom_util.pointer_within(this.drag_handler,event))this.drag_start(event)};Viewer.prototype.uninit_drag=function(){if(!this.drag_inited)return;this.drag_inited=false;this.unsubscribe(window);this.unsubscribe(this.drag_handler);this.unsubscribe(this.div);this.unsubscribe(document.body);dom_util.remove(this.drag_handler);dom_util.remove(this.drag_img);dom_util.remove(this.drag_div)};Viewer.prototype.disable_contextmenu=function(e){if(!this.dragging)return;e.stopPropagation();e.preventDefault()};Viewer.prototype.drag_start=function(event){var handler;if(!E.conf.params.pass_event||!(handler=E.conf.params.pass_event(event,this.get_progress_bar()))){event.stopPropagation()}else if(handler.length&&dom_util.pointer_within(handler,event))handler[0].dispatchEvent(util.clone_event(event));if(this.on_seeked)this.player.off("seeked",this.on_seeked);this.on_seeked=null;if(this.player.is_any_ad_mode()||this.dragging)return;if(this.off_scrubbing)this.off_scrubbing();this.player.scrubbing(this.dragging=true);if(!E.conf.params.disable_pause_on_drag){this.was_playing_before_drag=this.player.is_playing()||this.player.seeking;var vjs=this.player.vjs;if(this.was_playing_before_drag&&E.conf.params.hide_big_play_button&&vjs&&vjs.bigPlayButton){vjs.on("pause",function on_pause(){vjs.bigPlayButton.hide();vjs.off("pause",on_pause)})}this.player.pause()}setTimeout(this.on_drag.bind(this,event))};Viewer.prototype.on_drag=function(event){if(!this.dragging||this.player.is_any_ad_mode())return;this.on_move(event);this.update_play_progress(this.get_mouse_progress(event));if(this.drag_enabled)this.update_drag_image(event)};Viewer.prototype.drag_end=function(event){if(!this.dragging)return;this.display_drag_image(event);var player=this.player;if(this.was_playing_before_drag){var _this=this;player.once("seeked",this.on_seeked=function(){_this.on_seeked=null;player.play();if(player.is_playing()&&!player.is_paused())return void player.scrubbing(false);_this.off_scrubbing=function(){player.scrubbing(false);player.off("play",_this.off_scrubbing);delete _this.off_scrubbing};player.once("play",_this.off_scrubbing)})}this.spark_player.seek(this.get_mouse_time(event));if(!this.was_playing_before_drag)player.scrubbing(false);this.dragging=false;this.move_cancel()};Viewer.prototype.get_container=function(){if(E.conf.params.abs_container)return $(E.conf.params.abs_container);var container=$(this.player.get_ui().fullscreen);if(E.conf.params.container)return container.closest(E.conf.params.container);if(this.player.html5&&(this.player.html5.controls&&container[0]==this.player.html5||E.conf.params.native_controls)){this.native_controls=1;var wrapper=container.closest(".hola_video_wrapper");if(wrapper.length)return wrapper;log.info("wrap native html5 player");wrapper=$(document.createElement("div"));var position=container.css("position");wrapper.insertAfter(container).css({position:position=="static"?"relative":position,"z-index":container.css("z-index"),width:container.width()+"px",height:container.height()+"px",margin:container.css("margin")}).addClass("hola_video_wrapper");container.appendTo(wrapper);return wrapper}return container};Viewer.prototype.update_play_progress=function(progress){var sel;if(E.conf.params.play_progress)sel=E.conf.params.play_progress;else if(this.player.vjs)sel=".vjs-play-progress.vjs-slider-bar";this.container.find(sel).css("width",progress*100+"%")};Viewer.prototype.get_progress_bar=function(){if(E.conf.params.progress_bar)return this.container.find(E.conf.params.progress_bar);return $(this.player.get_ui().progress_bar)};Viewer.prototype.is_node_detached=function(){return this.div&&!document.body.contains(this.div)};Viewer.prototype.is_fullscreen_mode=function(){var fullscreen_sel;if(E.conf.params.fullscreen_sel)fullscreen_sel=E.conf.params.fullscreen_sel;else if(this.player.vjs)fullscreen_sel=".vjs-fullscreen";else if(this.player.jwplayer)fullscreen_sel=".jw-flag-fullscreen";else if(this.player.flowplayer)fullscreen_sel=".is-fullscreen";return fullscreen_sel&&(this.container.is(fullscreen_sel)||this.container.find(fullscreen_sel).length)};Viewer.prototype.get_mouse_progress=function(event){var area=this.get_hover_area();var cursor_x=event.changedTouches?event.changedTouches[0].pageX:event.pageX;var c_offset=this.container.offset();return Math.max(0,Math.min(1,(cursor_x-c_offset.left-area.left)/area.width))};Viewer.prototype.get_mouse_time=function(event){if(event.mouse_time)return event.mouse_time;if(event.type=="seeking")return this.player.get_pos();var progress=this.get_mouse_progress(event);var duration=this.player.get_duration();return Math.floor(progress*duration)};Viewer.prototype.update_drag_image=function(event){var real_time=this.get_mouse_time(event)+this.video_offset;var thumb;this.thumbnails.get(real_time,true,function(_thumb){thumb=_thumb});if(this.update_drag_et===undefined)this.update_drag_et=0;this.update_drag_et=(this.update_drag_et+1)%1e5;if(!thumb)return;if((this.has_thumb_url=this.has_thumb_url||thumb.url)&&E.conf.params.stop_drag_propagation&&/move$/.test(event.type)){event.stopPropagation()}this.drag_div.style.display="block";assign(this.drag_img.style,{"background-image":thumb.url?'url("'+thumb.url+'")':"none","background-position":"-"+thumb.img_x+"px -"+thumb.img_y+"px",width:thumb.width+"px",height:thumb.height+"px",margin:"0 auto","transform-origin":"top center",opacity:"0.9"});this.drag_img.style.transform="scale("+this.container.height()/thumb.height+")";if(E.conf.params.on_drag)E.conf.params.on_drag({E:E,$:$,_this:this,thumb:thumb});this.drag_pending_msg.style.display="none";if(thumb.is_fake){this.drag_pending_msg.style.top=thumb.height/2-7.5+"px";this.pending_msg.innerHTML=thumb.msg+"
Refresh for thumbnails";this.drag_pending_msg.style.display="block"}if(thumb.url)return;var _this=this;_this.thumbnails.get(real_time,false,function(update_drag_et,_thumb){if(_this.update_drag_et!=update_drag_et)return;if(_this.drag_enabled&&_thumb&&_thumb.url&&_this.drag_div.style.display=="block"){_this.update_drag_image(event)}}.bind(null,this.update_drag_et))};Viewer.prototype.display_drag_image=function(event){if(!this.drag_enabled)return;var _this=this;this.update_drag_image(event);this.player.once("seeked",function(){_this.drag_div.style.display="none"})};Viewer.prototype.add_styles=function(){var styles=[],container=this.container;if(this.player.name=="hola"){this.div.style.zIndex=1112;styles=[{selector:".vjs-mouse-display-tooltip",property:"display",value:"none"},{selector:".vjs-loading-spinner",property:"z-index",value:"1"},{selector:".vjs-settings-menu",property:"z-index",value:"1112"}]}else if(this.player.vjs){this.div.style.zIndex=1112;styles=[{selector:".vjs-mouse-display",property:"display",value:"none"},{selector:".vjs-control-bar",property:"z-index",value:"2"},{selector:".vjs-control-bar.fake_active .vjs-slider-bar:after",property:"display",value:"none"},{selector:".vjs-thumbnail-holder",property:"display",value:"none"}]}else if(this.player.jwplayer){styles=[{selector:".jw-tooltip-time",property:"display",value:"none"},{selector:".jw-controls",property:"z-index",value:"2"},{selector:".jw-controlbar-center-group",property:"position",value:"relative"}]}else if(this.player.flowplayer){styles=[{selector:".fp-timestamp, .fp-timeline-tooltip.fp-tooltip",property:"display",value:"none"}]}if(E.conf.params.styles)styles=styles.concat(E.conf.params.styles);var style=styles.map(function(s){var parent=container;if(s.parent_selector)parent=container.closest(s.parent_selector);parent.find(s.selector).css(s.property,s.value);var selector=(s.parent_selector||E.conf.params.abs_container||E.conf.params.container||"")+" "+s.selector;return selector+" {"+s.property+": "+s.value+" !important}"}).join("\n");if(E.style_injected[style])return;var style_el=document.createElement("style");style_el.textContent=style;document.head.appendChild(style_el);E.style_injected[style]=true};Viewer.prototype.subscribe=function(elem,sel,name,fn,use_capture){if(elem instanceof $)elem=elem[0];if(!elem)return;var _this=this;var _fn=function(ev){var is_sel_fn=typeof sel=="function";if(is_sel_fn&&sel().has(ev.target).length||!is_sel_fn&&(!sel||ev.target.matches(sel+", "+sel+" *"))){fn(ev)}};var names=Array.isArray(name)?name:[name];names.forEach(function(_name){elem.addEventListener(_name,_fn,use_capture);_this.listeners.push({elem:elem,name:_name,fn:_fn,use_capture:use_capture})})};Viewer.prototype.unsubscribe=function(elem){var listeners=this.listeners.filter(function(l){return l.elem});var left=[];if(elem){listeners=listeners.filter(function(l){if(l.elem==elem)return true;left.push(l)})}listeners.forEach(function(l){l.elem.removeEventListener(l.name,l.fn,l.use_capture)});this.listeners=left};Viewer.prototype.detach=function(){if(!this.inited)return;this.unsubscribe();dom_util.remove(this.img);dom_util.remove(this.div);this.uninit_drag()};Viewer.prototype.format_time=function(sec){return format_sec(sec).slice(0,-4)};Viewer.prototype.check_seeking=function(event){var now=Date.now();clearTimeout(this.seeking_timeout);if(event.type!="seeking"){this.last_move=now;return true}if(this.last_move&&now-this.last_move<500)return;var last_seeking=this.last_seeking;this.last_seeking=now;if(!last_seeking||now-last_seeking>500)return;this.seeking_timeout=setTimeout(this.move_cancel.bind(this),700);return true};Viewer.prototype.move_cancel=function(event){if(this.dragging||!this.visible)return;this.visible=false;this.div.style.display="none";if(this.hide_watermark)this.hide_watermark();if(E.conf.on_hide)E.conf.on_hide({$:$,_this:this,E:E});this.last_move=null;this.last_seeking=null;clearTimeout(this.seeking_timeout)};Viewer.prototype.on_move=function(event){var _this=this;if(E.conf.params.hide_timeout){clearTimeout(this.hide_timer);this.hide_timer=setTimeout(function(){if(_this.thumbnails.vtimeline)_this.thumbnails.vtimeline.hide()},E.conf.params.hide_timeout)}if(event.data&&event.data.skip)return;if(this.thumbnails.spark_player.container.hola_autoplay_playing_muted)return;if(!this.thumbnails.is_allowed())return void this.move_cancel();if(this.on_move_et===undefined)this.on_move_et=0;this.on_move_et=(this.on_move_et+1)%1e6;if(!this.check_seeking(event))return;this.init_drag(event);if(this.drag_inited)this.update_drag_handler();var area=this.get_hover_area();if(!area)return;if(!this.dragging&&!this.check_hover_area(event))return void this.move_cancel();var mouse_time=this.get_mouse_time(event);var real_time=mouse_time+this.video_offset;var thumb;this.thumbnails.get(real_time,true,function(_thumb){thumb=_thumb});if(!thumb||this.player.get_duration()<1)return void this.move_cancel();if((this.has_thumb_url=this.has_thumb_url||thumb.url)&&E.conf.params.stop_drag_propagation&&/move$/.test(event.type)){event.stopPropagation()}if(!this.first_shown){this.first_shown=true;E.stats.inc("unique_shown_n")}if(!this.first_shown_after_play&&this.player.is_playing()){this.first_shown_after_play=true;E.stats.inc_d("shown_after_play_n")}this.visible=true;var c_offset=this.container.offset();var point=get_event_point(event,c_offset);var left_pos=point.left-area.left-thumb.width/2-2;if(this.should_align_to_progress_bar())left_pos=Math.max(0,Math.min(left_pos,area.width-thumb.width-4));left_pos=area.left+left_pos;left_pos=Math.max(0,Math.min(left_pos,this.container.width()-thumb.width-4));var top_pos=area.top;assign(this.div.style,{left:left_pos+"px",top:top_pos+"px",display:"block"});assign(this.img.style,{"background-image":thumb.url?'url("'+thumb.url+'")':"none","background-position":"-"+thumb.img_x+"px -"+thumb.img_y+"px","transform-origin":"bottom",transform:this.is_fullscreen_mode()?"scale(1.5, 1.5)":"none",width:thumb.width+"px",height:thumb.height+"px"});var thumb_height=this.thumbnails.height||E.conf.ext_info_enabled&&def_thumb_height;this.img.style.setProperty(area.heightRefresh for thumbnails";this.pending_msg.style.display="block"}if(thumb.url)return;this.thumbnails.get(real_time,false,function(on_move_et,_thumb){if(_this.on_move_et!=on_move_et)return;if(_this.visible&&_thumb&&_thumb.url)_this.on_move(event)}.bind(null,this.on_move_et))};Viewer.prototype.is_ad_banner_visible=function(){var ima=this.player.vjs&&this.player.vjs.ima;if(ima)return ima.adContainerDiv&&ima.adContainerDiv.style.display=="block"};Viewer.prototype.get_hover_area=function(with_limit){if(this.native_controls)return this.get_native_hover_area();var progress_bar=this.get_progress_bar();if(!progress_bar.length||!dom_util.is_visible(progress_bar[0]))return this.hover_area;var p_offset=progress_bar.offset(),c_offset=this.container.offset();var p_width=progress_bar.width(),p_height=progress_bar.height();var thumb_height=this.thumbnails.height||E.conf.ext_info_enabled&&def_thumb_height;var area_height=thumb_height+Math.max(22,p_height+6);var area={left:p_offset.left-c_offset.left,width:p_width,top:p_offset.top-c_offset.top+p_height-area_height,height:area_height+3};if(with_limit){var c_height=this.container.height();if(this.thumbnails.vtimeline&&this.thumbnails.vtimeline.tlwrap)c_height-=$(this.thumbnails.vtimeline.tlwrap).height()||0;var diff=c_height*.7-area.top;if(diff>0){area.top+=diff;area.height-=diff}if(this.is_ad_banner_visible()){diff=area.height-Math.max(20,p_height);if(diff>0){area.top+=diff;area.height-=diff}}area_height=E.conf.params.area_height||E.conf.params.disable_wide_area&&p_height;if(area_height){diff=area.height-area_height;area.top+=diff;area.height-=diff}}this.hover_area=area;return area};Viewer.prototype.guess_native_controls=function(){function _pad(num,size){return("0"+num).slice(-size)}function sec2text(sec,opt){opt=opt||{};sec=Math.floor(sec);var hours=Math.floor(sec/(60*60));sec-=hours*60*60;var mins=Math.floor(sec/60);sec-=mins*60;return(hours>0?hours+":":"")+_pad(mins,opt.force_two_digit_min||hours>0||mins>9?2:1)+":"+_pad(sec,2)}function text2width(font,text){var canvas=text2width.canvas=text2width.canvas||document.createElement("canvas");var ctx=canvas.getContext("2d");ctx.font=font;return Math.round(ctx.measureText(text).width)}function platform_gt(width,desktop_val,mobile_val){return width>(util.is_mobile?mobile_val:desktop_val)}function is_control_available(elem,name){var clist=elem.controlsList;switch(name){case"fullscreen":if(clist&&clist.contains("nofullscreen"))return false;if(util.is_chrome)return elem.webkitSupportsFullscreen;if(util.is_firefox)return document.mozFullScreenEnabled;if(util.is_edge)return document.webkitFullscreenEnabled;return true;case"download":if(!util.is_chrome||clist&&clist.contains("nodownload"))return false;var src=util.is_enabled(html5)?html5.get_hola_video_source(elem):elem.currentSrc;return!util.is_blob_url(src);case"captions":return elem.textTracks.length;case"cast":if(!util.is_chrome||clist&&clist.contains("noremoteplayback"))return false;return false;default:return true}}var font,control_bar,autocalc=-1,$v=$(this.player.html5);var vwidth=$v.width(),vheight=$v.height();var is_big_player=util.is_safari?vwidth>210:!this.spark_player.is_small();if(util.is_chrome&&util.browser.version>66){font="12px Arial";if(vwidth>740){control_bar={frame:{left:0,width:vwidth,top:vheight-54,height:32},items:{padding1:32,timeline:autocalc,padding2:32}}}else{control_bar={frame:{left:0,width:vwidth,top:vheight-24,height:24},items:{padding1:16,timeline:autocalc,padding2:16}}}}else if(is_big_player&&util.is_chrome){font="12px Arial";control_bar={frame:{left:0,width:vwidth,top:vheight-32,height:32},items:{play:32,ctime:text2width(font,sec2text($v[0].currentTime)),padding1:4,duration:text2width(font,"/ "+sec2text($v[0].duration)),padding2:18,timeline:autocalc,padding3:18,mute:32,padding4:18,volume:70,padding5:18,fullscreen:32,download:32,cast:32,captions:32}}}else if(is_big_player&&util.is_firefox&&util.is_linux){font="12px Arial";control_bar={frame:{left:0,width:vwidth,top:vheight-28,height:28},items:{play:28,timeline:autocalc,padding1:5,duration:text2width(font,sec2text($v[0].duration)),mute:28,volume:35,fullscreen:28,captions:28}}}else if(is_big_player&&util.is_firefox&&!util.is_linux){font="14px Arial";control_bar={frame:{left:0,width:vwidth,top:vheight-40,height:40},items:{padding1:10,play:30,padding2:8,timeline:autocalc,padding3:8,time:text2width(font,sec2text($v[0].currentTime)+" / "+sec2text($v[0].duration)),padding4:8,mute:30,volume:70,captions:30,fullscreen:30,padding5:10}}}else if(is_big_player&&util.is_edge){font="20px Arial";control_bar={frame:{left:0,width:vwidth,top:vheight-55,height:55},items:{play:55,padding1:5,ctime:text2width(font,sec2text($v[0].currentTime,{force_two_digit_min:true})),padding2:10,timeline:autocalc,padding3:10,duration:text2width(font,sec2text($v[0].duration,{force_two_digit_min:true})),mute:55,fullscreen:55}}}else if(is_big_player&&util.is_safari&&$v[0].played.length){font="14px Arial";control_bar={frame:{left:0,width:vwidth,top:vheight-35,height:30},items:{padding1:15,backward:platform_gt(vwidth,340,321)?27:0,play:25,forward:platform_gt(vwidth,370,350)?27:0,padding2:10,ctime:vwidth>275?text2width(font,sec2text($v[0].currentTime,{force_two_digit_min:true})):0,padding3:vwidth>275?5:0,timeline:autocalc,padding4:5,duration:text2width(font,"-"+sec2text($v[0].duration,{force_two_digit_min:true})),padding5:5,volume:platform_gt(vwidth,315,0)?40:0,padding6:15}}}else return;var controls=[],items=Object.keys(control_bar.items);for(var i=0;i=0){controls[auto_idx].width-=width;for(var j=auto_idx+1;j=0&&time=area.top&&point.top<=area.top+area.height&&point.left>=area.left&&point.left<=area.left+area.width};Viewer.prototype.should_align_to_progress_bar=function(){if(E.conf.params.should_align_to_progress_bar)return true;return this.player.name=="hola"};Viewer.prototype.update_drag_handler=function(){var area=this.get_hover_area(true);if(!area)return;var progress_bar=this.get_progress_bar();if(progress_bar&&progress_bar.length){var p_offset=progress_bar.offset();var c_offset=this.container.offset();area=assign({},area,{left:c_offset.left-p_offset.left+area.left,top:c_offset.top-p_offset.top+area.top})}assign(this.drag_handler.style,{left:area.left+"px",top:area.top+"px",width:area.width+"px",height:area.height+"px"})};var Thumbnails=function(player,ctx){this.spark_player=player;this.player=player.controls;this.ctx=ctx;this.method=this.player.get_video_type_name();this.adaptive=ctx.attached_bws&&ctx.attached_bws.adaptive||!ctx.attached_bws&&util.is_adaptive(this.method);this.video_url=util.absolute_uri(this.player.get_url());this.listeners=[];if(!this.is_video_supported())return E.stats.inc_d("unsupported_video");this.load_thumb_et={};this.urls={};this.attach();this.subscribe(this.player.get_ui().progress_bar,"mousemove",this.retry_attach.bind(this))};Thumbnails.prototype.subscribe=function(elem,name,fn,use_capture){if(elem instanceof $)elem=elem[0];if(!elem)return;var _this=this;var names=Array.isArray(name)?name:[name];names.forEach(function(_name){elem.addEventListener(_name,fn,use_capture);_this.listeners.push({elem:elem,name:_name,fn:fn,use_capture:use_capture})})};Thumbnails.prototype.retry_attach=function(){if(this.thumbs||Date.now()=0){duration=$(_this.watermark.pic).css("transition-duration");duration=(duration||"").split(" ");duration=parseFloat(duration[idx%duration.length]||"0")*1e3}_this.watermark.defer=setTimeout(function(){if(!_this.watermark)return;$(_this.watermark.pic).addClass("hola_hidden");$(_this.watermark.pic).css("opacity","");_this.watermark.defer=0},duration)},util.get(E.conf,"watermark_delay",2e3))}).call(this,false);var hide_watermark=set_watermark_visible.bind(null,false);var show_watermark=set_watermark_visible.bind(null,true);$(_this.watermark.pic).on("mouseenter",show_watermark);$(_this.watermark.pic).on("mouseleave",hide_watermark);if(this.vtimeline){this.vtimeline.hide_watermark=hide_watermark;this.vtimeline.show_watermark=show_watermark}if(this.viewer){this.viewer.hide_watermark=hide_watermark;this.viewer.show_watermark=show_watermark;return}this.player.vjs.on("userinactive",hide_watermark);var control=this.player.vjs.controlBar.progressControl;control.on("mouseout",hide_watermark);control.on("touchcancel",hide_watermark);control.on("touchend",hide_watermark);control.on("mousemove",show_watermark);control.on("touchmove",show_watermark)};Thumbnails.prototype.check_attached=function(){if(this.viewer&&this.viewer.is_node_detached()){log.info("reattach");var is_vtimeline_shown=this.vtimeline&&this.vtimeline.shown;this.hide();this.show();if(is_vtimeline_shown)this.vtimeline.show()}};Thumbnails.prototype.turn_on=function(){this.disabled=false};Thumbnails.prototype.turn_off=function(){this.disabled=true};Thumbnails.prototype.is_allowed=function(){if(this.disabled||this.player.is_any_ad_mode()||this.player.is_live_stream()){return false}if(E.conf.is_allowed)return E.conf.is_allowed({$:$,E:E,_this:this});return true};E.default_conf={params:{}};E.style_injected={};E.init=function(spark_modules,conf){E.spark_modules=spark_modules;log=spark_modules.log;log.notice("thumbnails init conf %o",conf);E.conf=conf;E.conf.ext_info_enabled=util.has_ext&&E.conf.debug_ext;E.stats=spark_modules.stats;if(util.is_enabled(timeline))timeline.init(spark_modules,conf);E.spark_modules.players.on("attach",on_player_attach);E.inited=true;log.info("inited");E.stats.inc_d("init_n")};E.is_available=function(){if(util.is_ios){var os_ver=util.guess.version&&util.guess.version.split(".");os_ver=+(os_ver&&os_ver[0]);if(util.is_safari&&os_ver&&os_ver>=17&&!/spark_test=1/.test(location.href)){return false}}return true};return E});
define("/svc/cdn/pub/play_icon.js",["cash","/svc/cdn/pub/util.js","/svc/cdn/pub/dom_util.js"],function($,util,dom_util){var E={};var svg_shadow='