magcore-app-tv
Version:
Watch TV shows, movies, tv series, news, and educational programs in digital quality.
1 lines • 86.7 kB
JavaScript
!function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=16)}([function(e,t,i){"use strict";var n=i(25);n.back=n.backspace,n.channelNext=n.tab,n.channelPrev=n.tab+"s",n.ok=n.enter,n.exit=n.escape,n.volumeUp=107,n.volumeDown=109,n.f1="112c",n.f2="113c",n.f3="114c",n.f4="115c",n.refresh="116c",n.frame="117c",n.phone="119c",n.set="120c",n.tv="121c",n.menu="122c",n.app="123c",n.rewind="66a",n.forward="70a",n.audio="71a",n.standby="74a",n.keyboard="76a",n.usbMounted="80a",n.usbUnmounted="81a",n.playPause="82a",n.play=-1,n.pause=-1,n.stop="83a",n.power="85a",n.record="87a",n.info="89a",n.mute="192a",n.digit0=48,n.digit1=49,n.digit2=50,n.digit3=51,n.digit4=52,n.digit5=53,n.digit6=54,n.digit7=55,n.digit8=56,n.digit9=57,e.exports=n},function(e,t,i){"use strict";var n=i(5),s=i(18).parse,a=new n;a.query=s(document.location.search.substring(1)),a.config=i(19),a.activePage=null,a.route=function(e,t){var i,n=a.activePage;return!(!e||e.active)&&(e.name,e.id,e.name,e.id,(i=a.activePage)&&i.active&&(i.$node.classList.remove("active"),i.active=!1,a.activePage=null,i.name,i.id,i.name,i.id,i.events["hide"]&&i.emit("hide")),function(e,t){!e||e.active||(e.$node.classList.add("active"),e.active=!0,a.activePage=e,e.name,e.id,e.name,e.id,e.events["show"]&&e.emit("show",{data:t}))}(e,t),this.events["route"]&&this.emit("route",{from:n,to:e}),!0)},e.exports=a},function(e,t,i){"use strict";e.exports=i(4)},function(e,t,i){"use strict";var n=i(2),s=i(0);function a(e){var t=this;e=e||{},this.focusIndex=0,this.data=[],this.links={},n.call(this,e),this.init(e),this.addListener("keydown",function(e){switch(e.code){case s.right:t.children.length&&t.focusIndex<t.children.length-1&&t.children[++t.focusIndex].focus();break;case s.left:t.children.length&&t.focusIndex>0&&t.children[--t.focusIndex].focus();break;case s.back:t.parent&&(t.parent.focus(),t.$parentItem&&t.parent.focusItem(t.$parentItem))}})}a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.prototype.name="mag-component-layout",a.prototype.init=function(e){for(var t,i,s,a=this,o=function(e){var t,i;for(t=0;t<e.length;t++)"object"==typeof(i=e[t])?i instanceof n||i instanceof HTMLElement?e[t]={value:i,wrap:!1}:e[t].wrap=!0:e[t]={value:e[t],wrap:!0};return e}(e.data);this.$node.firstChild;)this.$node.removeChild(this.$node.firstChild);function c(){a.focusIndex=this.index}for(this.data=o,s=0;s<o.length;s++)"string"==typeof(t=o[s]).value?((i=document.createElement("div")).textContent=t.value,t.className&&(i.className=t.className),this.$node.appendChild(i),t.name&&(this.links[t.name]=i)):t.value instanceof HTMLElement?t.wrap?(i=document.createElement("div"),t.className&&(i.className=t.className),i.appendChild(t.value),this.$node.appendChild(i),t.name&&(this.links[t.name]=i)):(this.$node.appendChild(t.value),t.name&&(this.links[t.name]=t.value)):t.value instanceof n?(t.value.propagate=!0,t.value.index=this.children.length,t.value.addListener("click",c),t.wrap?(i=document.createElement("div"),t.className&&(i.className=t.className),i.appendChild(t.value.$node),this.$node.appendChild(i),this.children.push(t.value),t.value.parent=this,t.name&&(this.links[t.name]=i)):(this.add(t.value),t.name&&(this.links[t.name]=t.value))):(i=document.createElement("div"),t.className&&(i.className=t.className),this.$node.appendChild(i),t.name&&(this.links[t.name]=i))},e.exports=a},function(e,t,i){"use strict";var n=i(1),s=i(5),a=0;function o(e){var t,i=this;if(e=e||{},this.visible=!0,this.focusable=!0,this.$node=null,this.$body=null,this.parent=null,this.children=[],this.propagate=!!e.propagate,s.call(this),this.$node=e.$node||document.createElement("div"),this.$body=e.$body||this.$node,this.$node.className=this.name+" "+(e.className||""),this.id=e.id||this.$node.id||"cid"+a++,e.parent&&e.parent.add(this),!1===e.visible&&this.hide(),!1===e.focusable&&(this.focusable=!1),this.defaultEvents)for(t in e.events=e.events||{},this.defaultEvents)e.events[t]=e.events[t]||this.defaultEvents[t];e.events&&Object.keys(e.events).forEach(function(t){i.addListener(t,e.events[t])}),e.children&&this.add.apply(this,e.children),this.$node.addEventListener("click",function(e){i.focus(),i.events["click"]&&i.emit("click",e),e.stopPropagation()}),this.name,this.id,this.name,this.id}o.prototype=Object.create(s.prototype),o.prototype.constructor=o,o.prototype.defaultEvents=null,o.prototype.add=function(e){var t;for(t=0;t<arguments.length;t++)e=arguments[t],this.children.push(e),e.parent=this,e.$node&&null===e.$node.parentNode&&this.$body.appendChild(e.$node),e.name,e.id,this.name,this.id,this.name,this.id,e.name,e.id,this.events["add"]&&this.emit("add",{item:e})},o.prototype.remove=function(){this.parent&&(n.activePage.activeComponent===this&&(this.blur(),this.parent.focus()),this.parent.children.splice(this.parent.children.indexOf(this),1)),this.children.forEach(function(e){e.remove()}),this.$node.parentNode.removeChild(this.$node),this.events["remove"]&&this.emit("remove"),this.events={},this.name,this.id,this.name,this.id},o.prototype.focus=function(e){var t=n.activePage,i=t.activeComponent;return!(!this.focusable||this===i)&&(i&&i.blur(),t.activeComponent=i=this,i.$node.classList.add("focus"),this.name,this.id,this.name,this.id,i.events["focus"]&&i.emit("focus",e),!0)},o.prototype.blur=function(){var e=n.activePage,t=e.activeComponent;return this.$node.classList.remove("focus"),this===t?(e.activeComponent=null,this.name,this.id,this.name,this.id,this.events["blur"]&&this.emit("blur"),!0):(this.name,this.id,this.name,this.id,!1)},o.prototype.show=function(e,t){return!this.visible&&(this.$node.classList.remove("hidden"),this.visible=!0,this.name,this.id,this.name,this.id,this.events["show"]&&this.emit("show",e),"function"==typeof t&&setTimeout(t),!0)},o.prototype.hide=function(e){return!!this.visible&&(this.$node.classList.add("hidden"),this.visible=!1,this.name,this.id,this.name,this.id,this.events["hide"]&&this.emit("hide"),"function"==typeof e&&setTimeout(e),!0)},e.exports=o},function(e,t,i){"use strict";function n(){this.events={}}n.prototype={addListener:function(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)},once:function(e,t){var i=this;this.events[e]=this.events[e]||[],this.events[e].push(function n(){i.removeListener(e,n),t.apply(i,arguments)})},addListeners:function(e){var t;for(t in e)e.hasOwnProperty(t)&&this.addListener(t,e[t])},removeListener:function(e,t){this.events[e]&&(this.events[e]=this.events[e].filter(function(e){return e!==t}),0===this.events[e].length&&(this.events[e]=void 0))},emit:function(e){var t,i=this.events[e];if(i)for(t=0;t<i.length;t++)i[t].apply(this,Array.prototype.slice.call(arguments,1))}},n.prototype.constructor=n,e.exports=n},function(e,t,i){"use strict";var n=i(13),s=i(3);function a(e){var t=this;e=e||{},this.handlers={},this.links={},this.$noData=null,e.propagate=void 0===e.propagate||e.propagate,this.fixedData=e.fixedData||!1,e.$body=document.createElement("div"),e.$body.className="body",this.$noData=document.createElement("div"),this.$noData.className="noData hidden",n.call(this,e),this.$node.appendChild(this.$body),this.$node.appendChild(this.$noData),this.addListener("click:item",function(e){e.$item.layout.children.length&&!e.inner&&e.$item.layout.children[e.$item.layout.focusIndex].focus(),e.inner&&(t.focus(),t.focusItem(e.$item)),t.handlers[e.$item.index]&&t.handlers[e.$item.index](e.$item)})}a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.prototype.name="mag-component-layout-list",a.prototype.renderItemDefault=function(e,t){var i,n,a,o,c;if(e.ready&&this.fixedData)for(c=0;c<t.items.length;c++)"string"!=typeof(o=t.items[c]).value&&void 0!==o.value||((a=e.layout.$node.childNodes[c]).innerText=o.value||"",a.className=o.className||"");else{for(;e.firstChild;)e.removeChild(e.firstChild);n={focusable:!1,data:t.items},t.className&&(n.className=t.className),i=new s(n),t.name&&(this.links[t.name]=i),e.appendChild(i.$node),e.layout=i,i.parent=this,i.$parentItem=e,i.addListener("click",function(){i.parent.emit("click:item",{$item:e,inner:!0})}),t.click&&(this.handlers[e.index]=t.click),e.ready=!0}e.value=t.value||{}},a.prototype.setData=function(e){this.links={},n.prototype.setData.call(this,e),e.data&&e.data.length?this.$noData.classList.add("hidden"):this.$noData.classList.remove("hidden")},a.prototype.init=function(e){var t;n.prototype.init.call(this,e),e.noData&&(this.$noData.innerHTML="",e.noData instanceof Element?this.$noData.appendChild(e.noData):"string"==typeof e.noData&&((t=document.createElement("div")).innerText=e.noData,this.$noData.appendChild(t))),e.data&&e.data.length?this.$noData.classList.add("hidden"):this.$noData.classList.remove("hidden")},a.prototype.renderItem=a.prototype.renderItemDefault,e.exports=a},function(e,t,i){"use strict";var n=i(17);e.exports=n},function(e,t,i){"use strict";var n=i(1);e.exports=function(e){var t=document.createElement("link");t.rel="stylesheet",t.href="css/"+e+"."+n.metrics.height+".css",document.head.appendChild(t)}},function(e,t,i){"use strict";e.exports=i(30),e.exports.prototype.name="stb-component-page"},function(e,t,i){"use strict";var n={tag:function(e,t,i){var n,s,a=null;if(e){if(a=document.createElement(e),t&&"object"==typeof t)for(s in t)a[s]=t[s];for(n=2;n<arguments.length;n++)arguments[n]&&a.appendChild("object"==typeof arguments[n]?arguments[n]:document.createTextNode(arguments[n]))}return a},fragment:function(e){var t,i=document.createDocumentFragment();for(t=0;t<arguments.length;t++)(e=arguments[t])&&i.appendChild("object"==typeof e?e:document.createTextNode(e));return i},add:function(e,t){var i;if(e instanceof Node){for(i=1;i<arguments.length;i++)arguments[i]&&e.appendChild("object"==typeof arguments[i]?arguments[i]:document.createTextNode(arguments[i]));return e}return null},remove:function(e){var t,i=0;for(t=0;t<arguments.length;t++)arguments[t]&&arguments[t].parentNode&&arguments[t].parentNode.removeChild(arguments[t])===arguments[t]&&i++;return arguments.length>0&&i===arguments.length},clear:function(e){for(;e.lastChild;)e.removeChild(e.lastChild)}};e.exports=n},function(e,t,i){"use strict";var n=i(2),s=i(0),a={};function o(e){var t,i=0,s=this;(e=e||{}).focusable=!1,e.visible=e.visible||!1,e.$body=document.createElement("div"),e.$body.className="body",n.call(this,e),this.tabs=[{codes:{}},{codes:{}},{codes:{}},{codes:{}}],this.tab=0,this.$table=this.$node.appendChild(document.createElement("table")),this.$table.insertRow(),this.$table.rows[0].insertCell(-1),this.$table.rows[0].insertCell(-1),this.$table.rows[0].insertCell(-1),this.$left=this.$table.rows[0].cells[0].appendChild(document.createElement("div")),this.$left.className="theme-icon",this.$table.rows[0].cells[1].className="central",(t=this.tabs[i].$body=this.$table.rows[0].cells[1].appendChild(document.createElement("div"))).className="wrapper hidden",t.appendChild(document.createElement("div")),t.lastChild.className="button",t.lastChild.appendChild(document.createElement("div")),t.lastChild.appendChild(document.createElement("div")),t.lastChild.lastChild.className="title",(t=this.tabs[++i].$body=this.$table.rows[0].cells[1].appendChild(document.createElement("div"))).className="wrapper hidden",t.appendChild(document.createElement("div")),t.lastChild.className="button",t.lastChild.appendChild(document.createElement("div")),t.lastChild.appendChild(document.createElement("div")),t.lastChild.lastChild.className="title",t.appendChild(document.createElement("div")),t.lastChild.className="button",t.lastChild.appendChild(document.createElement("div")),t.lastChild.appendChild(document.createElement("div")),t.lastChild.lastChild.className="title",(t=this.tabs[++i].$body=this.$table.rows[0].cells[1].appendChild(document.createElement("div"))).className="wrapper hidden",t.appendChild(document.createElement("div")),t.lastChild.className="button",t.lastChild.appendChild(document.createElement("div")),t.lastChild.appendChild(document.createElement("div")),t.lastChild.lastChild.className="title",t.appendChild(document.createElement("div")),t.lastChild.className="button",t.lastChild.appendChild(document.createElement("div")),t.lastChild.appendChild(document.createElement("div")),t.lastChild.lastChild.className="title",t.appendChild(document.createElement("div")),t.lastChild.className="button",t.lastChild.appendChild(document.createElement("div")),t.lastChild.appendChild(document.createElement("div")),t.lastChild.lastChild.className="title",(t=this.tabs[++i].$body=this.$table.rows[0].cells[1].appendChild(document.createElement("div"))).className="wrapper hidden",t.appendChild(document.createElement("div")),t.lastChild.className="button",t.lastChild.appendChild(document.createElement("div")),t.lastChild.appendChild(document.createElement("div")),t.lastChild.lastChild.className="title",t.appendChild(document.createElement("div")),t.lastChild.className="button",t.lastChild.appendChild(document.createElement("div")),t.lastChild.appendChild(document.createElement("div")),t.lastChild.lastChild.className="title",t.appendChild(document.createElement("div")),t.lastChild.className="button",t.lastChild.appendChild(document.createElement("div")),t.lastChild.appendChild(document.createElement("div")),t.lastChild.lastChild.className="title",t.appendChild(document.createElement("div")),t.lastChild.className="button",t.lastChild.appendChild(document.createElement("div")),t.lastChild.appendChild(document.createElement("div")),t.lastChild.lastChild.className="title",this.$right=this.$table.rows[0].cells[2].appendChild(document.createElement("div")),this.$right.className="theme-icon",this.init(e.data),this.parent.addListener("keydown",function(e){var t=s.tabs[s.tab];s.visible&&t.codes[e.code]&&"function"==typeof t.codes[e.code].action&&t.codes[e.code].action()})}a[s.f1]="theme-icon-rc-f1",a[s.f2]="theme-icon-rc-f2",a[s.f3]="theme-icon-rc-f3",a[s.f4]="theme-icon-rc-f4",a[s.menu]="theme-icon-rc-menu",a[s.ok]="theme-icon-rc-ok",a[s.info]="theme-icon-rc-info",a[s.playPause]="theme-icon-rc-play-pause",a[s.back]="theme-icon-rc-back",a[s.exit]="theme-icon-rc-home",a[s.keyboard]="theme-icon-rc-vk",a[s.refresh]="theme-icon-rc-refresh",a[s.frame]="theme-icon-rc-aspect",o.prototype=Object.create(n.prototype),o.prototype.constructor=o,o.prototype.name="mag-component-footer",o.prototype.init=function(e){var t,i,n;function s(t){return function(){"function"==typeof e.middle[t].action&&e.middle[t].action()}}if(e=e||{},this.tabs[this.tab].$body.classList.add("hidden"),this.tab=e.middle&&e.middle.length?e.middle.length-1:0,(i=this.tabs[this.tab]).codes={},e.left?(this.$left.className=e.left.className||"theme-icon "+(a[e.left.code]||"theme-icon-warning"),e.left.disabled?this.$left.classList.add("disabled"):(i.codes[e.left.code]={action:e.left.action},this.$left.style.visibility="inherit",this.$left.onclick=function(){"function"==typeof e.left.action&&e.left.action()})):"hidden"!==this.$left.style.visibility&&(this.$left.style.visibility="hidden"),e.right?(this.$right.className=e.right.className||"theme-icon "+(a[e.right.code]||"theme-icon-warning"),e.right.disabled?this.$right.classList.add("disabled"):(i.codes[e.right.code]={action:e.right.action},this.$right.style.visibility="inherit",this.$right.onclick=function(){"function"==typeof e.right.action&&e.right.action()})):"hidden"!==this.$right.style.visibility&&(this.$right.style.visibility="hidden"),e.middle&&e.middle.length){for(t=0;t<e.middle.length;t++)i.codes[e.middle[t].code]={action:e.middle[t].action},e.middle[t].disabled?i.$body.children[t].classList.add("disabled"):(i.$body.children[t].classList.remove("disabled"),i.$body.children[t].onclick=s(t)),(n=i.$body.children[t].children)[0].className="iconImg "+(e.middle[t].className||"theme-icon "+(a[e.middle[t].code]||"theme-icon-warning")),n[1].innerText=e.middle[t].title||"";i.$body.classList.remove("hidden")}},e.exports=o},function(e,t,i){"use strict";var n=i(31),s=i(2),a=i(0);function o(e){var t,i,s,o=this;(e=e||{}).events=e.events||{},e.focusable=e.focusable||!1,e.visible=e.visible||!1,e.events.click=e.events.click||function(){o.hide()},s=e.events.keydown,e.events.keydown=function(e){s&&s.call(this,e),e.code!==a.back&&e.code!==a.menu||(e.stop=!0,o.hide())},n.call(this,e),this.$node.appendChild(document.createElement("div")),this.$node.firstChild.classList.add("alignBox"),this.$node.firstChild.appendChild(document.createElement("div")),this.$header=document.createElement("div"),this.$header.className="header",this.$text=this.$header.appendChild(document.createElement("div")),this.$text.classList.add("text"),this.$text.innerText=e.title||"",e.icon&&(this.$icon=this.$header.appendChild(document.createElement("div")),this.$icon.className="icon "+e.icon),(t=document.createElement("div")).className="overlay",i=this.$body.parentNode.removeChild(this.$body),this.$node.firstChild.firstChild.appendChild(this.$header),this.$node.firstChild.firstChild.appendChild(i),this.$node.firstChild.firstChild.appendChild(t)}o.prototype=Object.create(n.prototype),o.prototype.constructor=o,o.prototype.name="mag-component-modal",o.prototype.focus=function(){this.$node.classList.add("active"),n.prototype.focus.call(this),this.children[0]&&this.children[0]instanceof s&&this.children[0].focus()},o.prototype.blur=function(){this.$node.classList.remove("active"),n.prototype.blur.call(this)},e.exports=o},function(e,t,i){"use strict";var n=i(2),s=i(0);function a(e){e=e||{},this.$focusItem=null,this.viewIndex=null,this.data=[],this.type=this.TYPE_VERTICAL,this.size=5,this.cycle=!1,this.scroll=null,e.type&&(this.type=e.type),this.provider=null,this.type===this.TYPE_HORIZONTAL&&(e.className+=" horizontal"),n.call(this,e),this.init(e)}a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.prototype.name="mag-component-list",a.prototype.TYPE_VERTICAL=1,a.prototype.TYPE_HORIZONTAL=2,a.prototype.renderItemDefault=function(e,t){e.innerText=t.value},a.prototype.renderItem=a.prototype.renderItemDefault,a.prototype.defaultEvents={mousewheel:function(e){this.type===this.TYPE_VERTICAL&&e.wheelDeltaY&&this.move(e.wheelDeltaY>0?s.up:s.down),this.type===this.TYPE_HORIZONTAL&&e.wheelDeltaX&&this.move(e.wheelDeltaX>0?s.left:s.right)},keydown:function(e){switch(e.code){case s.up:case s.down:case s.right:case s.left:case s.pageUp:case s.pageDown:case s.home:case s.end:this.move(e.code);break;case s.enter:this.events["click:item"]&&this.$focusItem&&this.emit("click:item",{$item:this.$focusItem,event:e})}}},a.prototype.init=function(e){var t,i,n=this,s=this.$body.children.length,a=function(e){this.data&&(n.focusItem(this),n.events["click:item"]&&n.emit("click:item",{$item:this,event:e}))};if(void 0!==e.cycle&&(this.cycle=e.cycle),e.scroll&&(this.scroll=e.scroll),e.provider&&(this.provider=e.provider),e.render&&(this.renderItem=e.render),e.size&&(this.size=e.size),e.events&&Object.keys(e.events).forEach(function(t){n.events[t]=null,n.addListener(t,e.events[t])}),this.size!==s)for(s>0&&(this.$body.innerText=null),i=0;i<this.size;i++)(t=document.createElement("div")).index=i,t.className="item",t.addEventListener("click",a),this.$body.appendChild(t);if(this.provider){if(this.provider.blocked)return;this.provider.get(null,function(t,i){t?n.events["data:error"]&&n.emit("data:error",t):(i&&(e.data=i,n.setData(e),n.scroll&&n.scroll.init({realSize:n.provider.maxCount,viewSize:n.provider.size,value:n.provider.head+n.provider.pos})),n.events["data:get"]&&n.emit("data:get"))})}else e.data&&this.setData(e)},a.prototype.setData=function(e){e.data&&(this.data=function(e){var t;for(t=0;t<e.length;t++)"object"!=typeof e[t]&&(e[t]={value:e[t]});return e}(e.data)),this.viewIndex=null,this.$focusItem&&this.blurItem(this.$focusItem),this.scroll&&(this.provider?this.scroll.realSize!==this.provider.maxCount&&this.scroll.init({realSize:this.provider.maxCount,viewSize:this.provider.size,value:this.provider.head+this.provider.pos}):this.scroll.init({realSize:this.data.length,viewSize:this.size,value:e.viewIndex||0})),void 0!==e.focusIndex&&this.data.length?this.focusIndex(e.focusIndex):this.renderView(e.viewIndex||0)},a.prototype.renderView=function(e){var t,i,n,s,a;if(this.viewIndex!==e){for(s=this.viewIndex,this.viewIndex=a=e,i=0;i<this.size;i++)t=this.$body.children[i],(n=this.data[e])?(t.data=n,t.index=e,this.renderItem(t,n),n.mark?t.classList.add("mark"):t.classList.remove("mark")):(t.data=t.index=void 0,t.innerHTML=" ",t.ready=!1),e++;return this.events["move:view"]&&this.emit("move:view",{prevIndex:s,currIndex:a}),this.events["select:item"]&&this.emit("select:item",{$item:t}),this.scroll&&this.scroll.scrollTo(this.provider?this.provider.head+this.provider.pos:this.viewIndex),!0}return!1},a.prototype.move=function(e){var t=this,i=!1;if(this.data.length)switch(e){case s.left:if(this.type!==this.TYPE_HORIZONTAL)break;i=!0;case s.up:if(i||this.type===this.TYPE_VERTICAL)if(this.$focusItem&&this.$focusItem.index>0)this.$focusItem===this.$body.firstChild?this.renderView(this.viewIndex-1):this.focusItem(this.$focusItem.previousSibling);else if(this.provider){if(this.provider.blocked)return;this.provider.get(e,function(e,i,n){e?t.events["data:error"]&&t.emit("data:error",e):i&&t.setData({data:i,focusIndex:n||0===n?n:t.$focusItem.index})})}else this.cycle&&this.move(s.end),this.events["overflow"]&&this.emit("overflow",{direction:e,cycle:this.cycle});break;case s.right:if(this.type!==this.TYPE_HORIZONTAL)break;i=!0;case s.down:if(i||this.type===this.TYPE_VERTICAL)if(this.$focusItem&&this.$focusItem.index<this.data.length-1)this.$focusItem===this.$body.lastChild?this.renderView(this.viewIndex+1):this.focusItem(this.$focusItem.nextSibling);else if(this.provider){if(this.provider.blocked)return;this.provider.get(e,function(e,i,n){e?t.events["data:error"]&&t.emit("data:error",e):i&&t.setData({data:i,focusIndex:n||0===n?n:t.$focusItem.index})})}else this.cycle&&this.move(s.home),this.events["overflow"]&&this.emit("overflow",{direction:e,cycle:this.cycle});break;case s.pageUp:if(this.provider){if(this.provider.blocked)return;return void this.provider.get(e,function(e,i,n){e?t.events["data:error"]&&t.emit("data:error",e):i&&t.setData({data:i,focusIndex:n||0})})}this.viewIndex<this.size?this.renderView(0):this.renderView(this.viewIndex-this.size+1),this.focusItem(this.$body.firstChild);break;case s.pageDown:if(this.provider){if(this.provider.blocked)return;this.provider.get(e,function(e,i,n){var s;e?t.events["data:error"]&&t.emit("data:error",e):i&&(s=n||0===n?n:i.length<t.size?i.length-1:t.size-1,t.setData({data:i,focusIndex:s}))});break}this.data.length>this.size?(this.viewIndex>this.data.length-2*this.size?this.renderView(this.data.length-this.size):this.renderView(this.viewIndex+this.size-1),this.focusItem(this.$body.lastChild)):this.focusItem(this.$body.children[this.data.length-1]);break;case s.home:if(this.provider){if(this.provider.blocked)return;this.provider.get(e,function(e,i,n){e?t.events["data:error"]&&t.emit("data:error",e):i&&t.setData({data:i,focusIndex:n||0})});break}this.renderView(0),this.focusItem(this.$body.firstChild);break;case s.end:if(this.provider){if(this.provider.blocked)return;this.provider.get(e,function(e,i,n){var s;e?t.events["data:error"]&&t.emit("data:error",e):i&&(s=n||0===n?n:i.length<t.size?i.length-1:t.size-1,t.setData({data:i,focusIndex:s}))});break}this.data.length>this.size?(this.renderView(this.data.length-this.size),this.focusItem(this.$body.lastChild)):this.focusItem(this.$body.children[this.data.length-1])}},a.prototype.focusItem=function(e){var t=this.$focusItem;return!(!e||t===e)&&(null!==t&&(t.classList.remove("focus"),this.events["blur:item"]&&this.emit("blur:item",{$item:t})),this.$focusItem=e,this.$focusItem.data=this.data[this.$focusItem.index],e.classList.add("focus"),this.events["focus:item"]&&this.emit("focus:item",{$prev:t,$curr:e}),this.events["select:item"]&&this.emit("select:item",{$item:e}),!0)},a.prototype.blurItem=function(e){return!!e&&(e===this.$focusItem&&(this.$focusItem=null),e.classList.remove("focus"),this.events["blur:item"]&&this.emit("blur:item",{$item:e}),!0)},a.prototype.focusIndex=function(e){var t=this.viewIndex||0;e>=t+this.size?(e=e<this.data.length-1?e:this.data.length-1,this.renderView(e-this.size+1),this.focusItem(this.$body.lastChild)):e<t?(e=e>0?e:0,this.renderView(e),this.focusItem(this.$body.firstChild)):(null===this.viewIndex&&this.renderView(0),this.focusItem(this.$body.children[e-t]))},a.prototype.markItem=function(e,t){t?e.classList.add("mark"):e.classList.remove("mark"),e.data.mark=t},e.exports=a},function(e,t,i){"use strict";e.exports=i(33),e.exports.prototype.name="stb-component-scrollbar"},function(e,t,i){"use strict";e.exports={480:{epgGrid:6,scheduleWidth:372,timeStep:5400,countOfSteps:3,timeLineMargin:250,itemHeight:38,timeLineTop:2},576:{epgGrid:9,scheduleWidth:372,timeStep:5400,countOfSteps:3,timeLineMargin:250,itemHeight:38,timeLineTop:2},720:{epgGrid:9,scheduleWidth:830,timeStep:9e3,countOfSteps:5,timeLineMargin:350,itemHeight:48,timeLineTop:2},1080:{epgGrid:9,scheduleWidth:1245,timeStep:9e3,countOfSteps:5,timeLineMargin:525,itemHeight:72,timeLineTop:2}}[screen.height]},function(e,t,i){"use strict";var n=i(7),s=(i(0),i(26));i(28),n.intents={osdInput:null,osdTv:null},n.once("load",function(){n.provider=core.plugins.tvBackend,s.load({name:core.environment.language||"en"},function(e){var t=new(i(29))({$node:document.getElementById("pageEpg"),apiProvider:n.provider});t.addListener("back",function(e){n.route(n.pages.main,e)}),core.addListener("intent",function(e,t){t(!1,{})}),n.pages={main:i(35),epg:t},n.route(n.pages.main)})})},function(e,t,i){"use strict";var n=i(1),s=i(20);window.core=window.parent.getCoreInstance(window,n),i(21),i(22),i(8)("sdk"),i(24),i(8)("app"),n.platform="mag",n.ready=function(){window.core.call("app:ready")},n.exit=function(){n.events["exit"]&&n.emit("exit"),core.call("exit")},s.load=function(e){document.body.setAttribute("platform",n.platform),core.ready?n.events["load"]&&n.emit("load",{}):core.once("load",function(){n.events[e.type]&&n.emit(e.type,e)})},s.contextmenu=function(e){e.preventDefault()},Object.keys(s).forEach(function(e){window.addEventListener(e,s[e])}),e.exports=n},function(e,t,i){"use strict";e.exports={parse:function(e){var t={};return e.split("&").forEach(function(e){2===(e=e.split("=")).length&&(t[e[0]]=decodeURIComponent(e[1]))}),t},stringify:function(e){var t=[];return Object.keys(e).forEach(function(i){t.push(i+"="+encodeURIComponent(e[i]))}),t.join("&")}}},function(e,t,i){"use strict";e.exports={}},function(e,t,i){"use strict";var n=i(1);e.exports={DOMContentLoaded:function(e){n.events["dom"]&&n.emit("dom",e)},load:function(e){n.events[e.type]&&n.emit(e.type,e)},unload:function(e){n.events[e.type]&&n.emit(e.type,e)},error:function(e){},keydown:function(e){var t,i=n.activePage,s={code:e.keyCode,stop:!1};e.ctrlKey&&(s.code+="c"),e.altKey&&(s.code+="a"),e.shiftKey&&(s.code+="s"),(t=i.activeComponent)&&t!==i&&(t.events[e.type]&&t.emit(e.type,s,e),!s.stop&&t.propagate&&t.parent&&t.parent.events[e.type]&&t.parent.emit(e.type,s,e)),s.stop||(i.events[e.type]&&i.emit(e.type,s,e),e.stop||n.events[e.type]&&n.emit(e.type,s,e))},keypress:function(e){var t=n.activePage;t.activeComponent&&t.activeComponent!==t&&t.activeComponent.events[e.type]&&t.activeComponent.emit(e.type,e)},mousewheel:function(e){var t=n.activePage;t.activeComponent&&t.activeComponent!==t&&t.activeComponent.events[e.type]&&t.activeComponent.emit(e.type,e),e.stop||t.events[e.type]&&t.emit(e.type,e)}}},function(e,t,i){"use strict";if(!document.documentElement.classList){var n=Array.prototype,s=n.indexOf,a=n.slice,o=n.push,c=n.splice,r=n.join;window.DOMTokenList=function(e){if(this._element=e,e.className!==this._classCache){if(this._classCache=e.className,!this._classCache)return;var t,i=this._classCache.replace(/^\s+|\s+$/g,"").split(/\s+/);for(t=0;t<i.length;t++)o.call(this,i[t])}},window.DOMTokenList.prototype={add:function(e){this.contains(e)||(o.call(this,e),this._element.className=a.call(this,0).join(" "))},contains:function(e){return-1!==s.call(this,e)},item:function(e){return this[e]||null},remove:function(e){var t=s.call(this,e);-1!==t&&(c.call(this,t,1),this._element.className=a.call(this,0).join(" "))},toString:function(){return r.call(this," ")},toggle:function(e){return this.contains(e)?this.remove(e):this.add(e),this.contains(e)}},Object.defineProperty(Element.prototype,"classList",{get:function(){return new window.DOMTokenList(this)}})}},function(e,t,i){"use strict";var n=i(1),s=i(23);n.metrics=s[n.query.screenHeight]||s[screen.height]||s[720],n.metrics.availHeight=n.metrics.height-(n.metrics.availTop+n.metrics.availBottom),n.metrics.availWidth=n.metrics.width-(n.metrics.availLeft+n.metrics.availRight)},function(e,t,i){"use strict";e.exports={480:{height:480,width:720,availTop:24,availBottom:24,availRight:32,availLeft:48},576:{height:576,width:720,availTop:24,availBottom:24,availRight:26,availLeft:54},720:{height:720,width:1280,availTop:30,availBottom:30,availRight:40,availLeft:40},1080:{height:1080,width:1920,availTop:45,availBottom:45,availRight:60,availLeft:60}}},function(e,t,i){"use strict";var n,s=i(1);(n=document.createElement("link")).rel="stylesheet",n.href=window.core.theme.path+s.metrics.height+".css",document.head.appendChild(n),e.exports=n},function(e,t,i){"use strict";e.exports={backspace:8,tab:9,enter:13,escape:27,space:32,pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,del:46}},function(e,t,i){"use strict";var n=i(5),s=i(27),a=new n;function o(e){var t=new s(e);return window.gettext=window._=t.gettext,window.pgettext=t.pgettext,window.ngettext=t.ngettext,t}a.defaultLanguage="en",a.load=function(e,t){var i;return e.ext=e.ext||"json",e.path=e.path||"lang",e.name===a.defaultLanguage?(o(),t(null),!1):((i=new XMLHttpRequest).onload=function(){try{o(JSON.parse(i.responseText)),t(null),a.events["load"]&&a.emit("load")}catch(e){i.onerror(e)}},i.ontimeout=i.onerror=function(e){o(),t(e),a.events["error"]&&a.emit("error",e)},i.open("GET",e.path+"/"+e.name+"."+e.ext,!0),i.send(null),!0)},e.exports=a},function(module,exports,__webpack_require__){"use strict";function Gettext(config){var data,meta;config=config||{},data=config.data||{},data[""]=data[""]||{},meta=config.meta,this.gettext=function(e){return data[""][e]||e},this.pgettext=function(e,t){return data[e]&&data[e][t]||t},this.ngettext=function(msgId,plural,value){var n,evalResult;return data&&meta&&data[""][msgId]?(evalResult=eval("n = "+value+"; "+meta.plural),"boolean"==typeof evalResult&&(evalResult=+evalResult),data[""][msgId][evalResult]):1===value?msgId:plural}}Gettext.prototype.constructor=Gettext,module.exports=Gettext},function(e,t,i){"use strict";Array.prototype.findIndex||(Array.prototype.findIndex=function(e){if(null==this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t,i=Object(this),n=i.length>>>0,s=arguments[1],a=0;a<n;a++)if(t=i[a],e.call(s,t,a,i))return a;return-1})},function(e,t,i){"use strict";var n,s,a,o,c,r,l,d,h=i(9),u=i(10).tag,m=i(0),p=i(11),f=i(12),v=i(6),g=i(3),y=i(14),x=i(34);function $(e){var t,i,n,s,a,o=[],c=[];for(s=0;s<e.length;s++)a=u("div",{className:"logo"}),e[s].logo&&(a.style.backgroundImage="url("+core.backend.host+e[s].logo+")"),n=e[s].censored||e[s].genre&&e[s].genre.censored,c=[{className:"number",value:e[s].number.toString()},a,{className:"name",value:e[s].name},{className:e[s].archive?"theme-icon theme-icon-timeshift disabled":"theme-icon hidden"},{className:n?"theme-icon theme-icon-lock disabled":"theme-icon hidden"},{className:"arrowLeft theme-epg-grid-arrow-left"},{className:"arrowRight theme-epg-grid-arrow-right"},{className:"theme-epg-grid-timeshift hidden"}],t=new g({focusable:!1,data:c,className:"channel theme-epg-grid-main",events:{click:function(){this.parent.emit("click")}}}),i=new g({focusable:!1,className:"schedule",data:[],events:{click:function(){this.parent.emit("click")}}}),t.listIndex=s,i.listIndex=s,o.push({value:e[s],items:[t,i],censored:n});return o}function b(){var e,t=r.$focusItem.data.value;r.epgLastFocused&&(e=r.epgLastFocused.data),core.intent({action:"record",data:{uri:t.url,name:t.name,epgName:t.name,startTime:e?e.start:r.time,endTime:e?e.end:r.time+r.timeStep,id:t.id,pvr:{server:t.pvr,local:t.local_pvr}}},function(){})}function I(e){var t=this;e.className="magcore-page-epg"+(e.className?" "+e.className:""),h.call(this,e),this.addListener("show",function(e){r.focusIndex(e.data.index),r.focus(),r.startCheck()}),this.addListener("keydown",function(e){switch(e.code){case m.back:r.stopCheck(),t.emit("back",r.$focusItem)}}),o=new g({focusable:!1,data:[{name:"$title",className:"title",value:gettext("TV Guide")},{name:"$current",className:"current"},{name:"$description",className:"description"}],className:"header-layout theme-epg-grid-main"}),this.add(o),c=new g({focusable:!1,data:[{className:"time"},{name:"$timeline",className:"timeline theme-epg-grid-timeline"}],className:"content"}),this.add(c),r=new x({className:"epg-list",size:i(15).epgGrid,events:{"click:item":function(e){var i=e.$item;i.data.value.epgItems.length?i.data.value.epgItems[i.data.value.epgFocus]&&(i.data.value.archive&&i.data.value.epgItems[i.data.value.epgFocus].data.archive?t.emit("epg:click",{channelIndex:i.index,epg:i.data.value.epgItems[i.data.value.epgFocus].data}):t.emit("channel:click",{channelIndex:i.index})):t.emit("channel:click",{channelIndex:i.index})},"focus:item":function(e){var t=e.$curr,i=[];e={left:{},middle:[],label:{code:m.menu,title:gettext("Hold OK button to open Options menu"),action:function(){s.show(),s.focus()}}},(t.data.value.pvr||t.data.value.local_pvr)&&(e.middle.push({code:m.f1,title:gettext("Record"),action:b}),i.push({items:[{className:d.record},{className:"title",value:gettext("Record")}],click:function(){s.hide(),b()}})),i.push({items:[{className:d.realtime},{className:"title",value:gettext("To real time")}],click:function(){s.hide(),r.goToRealTime()}}),e.middle.push({code:m.f3,title:gettext("To real time"),action:function(){r.goToRealTime()}}),e.left={code:m.menu,action:function(){s.show(),s.focus()}},n.init(e),a.init({data:i,size:i.length,focusIndex:0})}},noData:gettext("No Channels"),apiProvider:e.apiProvider,focusIndex:0,scroll:l=new y,$timeBlock:c.$node.children[0],$programDescription:o.links.$description,$programName:o.links.$current,$timeLine:c.links.$timeline}),c.add(r),c.add(l),(n=new p({visible:!1,parent:this})).init({left:{code:m.menu,action:function(){s.show(),s.focus()}},middle:[{code:m.f1,title:gettext("Record"),action:b},{code:m.f3,title:gettext("To real time"),action:function(){r.goToRealTime()}}],label:{code:m.menu,title:gettext("Hold OK button to open Options menu"),action:function(){s.show(),s.focus()}}}),n.show(),this.add(s=new f({title:gettext("Actions"),className:"width2x",events:{show:function(){n.hide(),this.children[0].focus()},hide:function(){n.show(),r.focus()}},children:[a=new v({size:2,focusIndex:0,cycle:!0,data:[{items:[{className:d.record},{className:"title",value:gettext("Record")}],click:function(){s.hide(),b()}},{items:[{className:d.realtime},{className:"title",value:gettext("To real time")}],click:function(){s.hide(),r.goToRealTime()}}],events:{keydown:function(e){switch(v.prototype.defaultEvents.keydown.call(this,e),e.code){case m.menu:case m.back:s.hide(),e.stop=!0}}}})]}))}d={realtime:"theme-icon theme-icon-rc-f3",record:"theme-icon theme-icon-rc-f1"},I.prototype=Object.create(h.prototype),I.prototype.constructor=I,I.prototype.setChannels=function(e){r.setData({data:$(e),focusIndex:0}),r.updateEpg()},e.exports=I},function(e,t,i){"use strict";var n=i(4);function s(e){e=e||{},this.active=!1,this.activeComponent=null,n.call(this,e),this.active=this.$node.classList.contains("active"),null===this.$node.parentNode&&document.body.appendChild(this.$node),this.page=this}s.prototype=Object.create(n.prototype),s.prototype.constructor=s,s.prototype.name="spa-component-page",e.exports=s},function(e,t,i){"use strict";e.exports=i(32),e.exports.prototype.name="stb-component-modal"},function(e,t,i){"use strict";var n=i(4);function s(e){(e=e||{}).$body=document.createElement("div"),e.$body.className="body",n.call(this,e),this.$node.appendChild(document.createElement("div").appendChild(this.$body).parentNode)}s.prototype=Object.create(n.prototype),s.prototype.constructor=s,s.prototype.name="spa-component-modal",e.exports=s},function(e,t,i){"use strict";var n=i(4);function s(e){e=e||{},this.viewSize=10,this.realSize=100,this.value=0,this.type=this.TYPE_VERTICAL,this.thumbRect=null,this.trackRect=null,e.focusable=e.focusable||!1,e.type&&(this.type=e.type),this.type===this.TYPE_HORIZONTAL&&(e.className+=" horizontal"),n.call(this,e),this.$thumb=this.$body.appendChild(document.createElement("div")),this.$thumb.className="thumb",this.init(e)}s.prototype=Object.create(n.prototype),s.prototype.constructor=s,s.prototype.name="spa-component-scrollbar",s.prototype.TYPE_VERTICAL=1,s.prototype.TYPE_HORIZONTAL=2,s.prototype.init=function(e){void 0!==(e=e||{}).realSize&&(this.realSize=e.realSize),void 0!==e.viewSize&&(this.viewSize=e.viewSize),this.viewSize>=this.realSize?this.$thumb.classList.add("hidden"):this.$thumb.classList.remove("hidden"),void 0!==e.value&&this.scrollTo(e.value),this.type===this.TYPE_VERTICAL?this.$thumb.style.height=this.viewSize/this.realSize*100+"%":this.$thumb.style.width=this.viewSize/this.realSize*100+"%",this.thumbRect=this.$thumb.getBoundingClientRect(),this.trackRect=this.$node.getBoundingClientRect()},s.prototype.scrollTo=function(e){return this.value!==e&&(0!==this.thumbRect.height&&0!==this.thumbRect.width||(this.trackRect=this.$node.getBoundingClientRect(),this.thumbRect=this.$thumb.getBoundingClientRect()),this.type===this.TYPE_VERTICAL?this.$thumb.style.marginTop=(this.trackRect.height-this.thumbRect.height)*e/(this.realSize-this.viewSize)+"px":this.$thumb.style.marginLeft=(this.trackRect.width-this.thumbRect.width)*e/(this.realSize-this.viewSize)+"px",this.events["change"]&&this.emit("change",{curr:e,prev:this.value}),e>=this.realSize&&(e=this.realSize,this.events["done"]&&this.emit("done")),this.value=e,!0)},e.exports=s},function(e,t,i){"use strict";var n=i(10),s=i(0),a=i(3),o=i(6),c=i(15),r=[gettext("January"),gettext("February"),gettext("March"),gettext("April"),gettext("May"),gettext("June"),gettext("July"),gettext("August"),gettext("September"),gettext("October"),gettext("November"),gettext("December")],l=[gettext("Sunday "),gettext("Monday "),gettext("Tuesday "),gettext("Wednesday "),gettext("Thursday "),gettext("Friday "),gettext("Saturday ")];function d(e){this.scheduleWidth=c.scheduleWidth,this.time=null,this.day=0,this.timeStep=c.timeStep,this.countOfSteps=c.countOfSteps,this.scheduleBlock=this.scheduleWidth/this.timeStep,this.step=this.timeStep/this.countOfSteps,this.timeLineMargin=c.timeLineMargin,this.itemHeight=c.itemHeight,this.timeLineTop=c.timeLineTop,this.$timeBlock=e.$timeBlock,this.$programDescription=e.$programDescription,this.$programName=e.$programName,this.$timeLine=e.$timeLine,this.$timeLine.appendChild(n.tag("div",{className:"timemark theme-epg-grid-timemark"})),this.timers={},this.internal={},this.epgMode=0,this.epgFocusTime=null,this.epgLastFocused=null,e.events||(e.events={}),e.events.keydown||(e.events.keydown=function(e){switch(e.code){case s.right:case s.left:this.moveEpg(e.code);break;case s.up:case s.down:case s.pageUp:case s.pageDown:case s.home:case s.end:this.move(e.code);break;case s.enter:e.stop=!0,this.pressOk()}}),this.apiProvider=e.apiProvider,o.call(this,e)}d.prototype=Object.create(o.prototype),d.prototype.constructor=d,d.prototype.renderItem=function(e,t){for(var i,n,s,o=this;e.firstChild;)e.removeChild(e.firstChild);s={focusable:!1,data:t.items},t.className&&(s.className=t.className),t.events?s.events=t.events:s.events={click:function(){o.focusItem(e),o.pressOk()}},i=new a(s),e.appendChild(i.$node),e.layout=i,i.parent=this,i.$parentItem=e,n=t.items[0].value.$node.children,e.censored=t.censored,e.domLinks={$number:n[0],$icon:n[1],$title:n[2],$archiveIcon:n[3],$lockIcon:n[4],$archiveLine:n[7]},t.click&&(this.handlers[e.index]=t.click),e.ready=!0,e.value=t.value||{},t.value.archive?(t.value.$archiveLine=e.domLinks.$archiveLine,e.domLinks.$archiveLine.classList.remove("hidden")):(t.value.$archiveLine=null,e.domLinks.$archiveLine.classList.add("hidden")),t&&this.fillItem(e,t)},d.prototype.setData=function(e){o.prototype.setData.call(this,e),this.data.length<this.size?this.$timeLine.style.height=this.itemHeight*this.data.length+this.timeLineTop+"px":this.$timeLine.style.height=this.itemHeight*this.size+this.timeLineTop+"px"},d.prototype.moveEpg=function(e){switch(e){case s.left:this.subPrev();break;case s.right:this.subNext()}},d.prototype.pressOk=function(){this.events["click:item"]&&this.$focusItem&&this.emit("click:item",{$item:this.$focusItem,event:event})},d.prototype.onFocus=function(e){var t,i,n=this,s=0;this.repositionTimeLine(),this.timers.onFocus&&clearTimeout(this.timers.onFocus),this.epgMode&&(this.timers.onFocus=setTimeout(function(){if((i=e.$curr.data).value.epgItems.length){for(t=0;t<i.value.epgItems.length;t++)if(n.epgFocusTime>=i.value.epgItems[t].data.start&&n.epgFocusTime<i.value.epgItems[t].data.end){s=t;break}i.value.epgFocus=s,n.focusEpg(i.value.epgItems[i.value.epgFocus],!0)}else n.epgLastFocused&&(n.epgLastFocused.classList.remove("theme-epg-grid-focused"),n.epgLastFocused.focused=!1),n.epgLastFocused=null},core.environment.onFocusDebounceTimeout))},d.prototype.onOverflow=function(){var e=this;this.timers.onOverflow&&clearTimeout(this.timers.onOverflow),this.timers.onOverflow=setTimeout(function(){e.updateEpg()},core.environment.onFocusDebounceTimeout)},d.prototype.init=function(e){o.prototype.init.call(this,e),this.addListener("focus:item",this.onFocus),this.addListener("move:view",this.onOverflow)},d.prototype.startCheck=function(){this.checkingTime()},d.prototype.stopCheck=function(){var e;for(e in this.internal)clearInterval(this.internal[e]);for(e in this.timers)clearTimeout(this.timers[e])},d.prototype.fillItem=function(e,t){var i,s,a,o=0,c=[],r=this.time;if(n.clear(t.items[1].value.$node),(!e.censored||core.accessControl.state)&&t.value.epgGrid&&t.value.epgGrid.length){for(s=0;s<t.value.epgGrid.length&&!((a=t.value.epgGrid[s]).start>=this.time+this.timeStep-60);s++)a.end>this.time&&(a.start>=r+60&&(i=n.tag("div",{className:"program theme-epg-grid-noData"},n.tag("div",{className:"text",data:{focusable:!1}},gettext("No data"))),o=(a.start-r)*this.scheduleBlock,o=Math.floor(o)-2,i.children[0].style.width=o+"px",n.add(t.items[1].value.$node,i),r=a.start),a.focusable=!0,i=n.tag("div",{className:"program theme-epg-grid-default"},n.tag("div",{className:"text",data:a},a.title)),o=a.end<this.time+this.timeStep?(a.end-r)*this.scheduleBlock:(this.time+this.timeStep-r)*this.scheduleBlock,o=Math.floor(o)-2,r=a.end,i.children[0].style.width=o+"px",i.data=a,n.add(t.items[1].value.$node,i),c.push(i)),t.value.epgItems=c;r<this.time+this.timeStep&&(o=(this.time+this.timeStep-r)*this.scheduleBlock)>4&&(i=n.tag("div",{className:"program theme-epg-grid-noData"},n.tag("div",{className:"text",data:{focusable:!1}},gettext("No data"))),o=Math.floor(o)-2,i.children[0].style.width=o+"px",n.add(t.items[1].value.$node,i))}else(i=n.tag("div",{className:"program theme-epg-grid-noData"},n.tag("div",{className:"text",data:{focusable:!1}},gettext("No data")))).children[0].style.width=this.scheduleWidth-2+"px",n.add(t.items[1].value.$node,i),t.value.epgItems=[]},d.prototype.checkCurrent=function(){var e,t,i,n,s=this,a=this.$focusItem,o=Date.now()/1e3;function c(e,i){t&&e.data&&o>e.data.start&&o<e.data.end?(e.classList.add("theme-epg-grid-current"),t=!1,s.epgMode||n!==a||(s.focusEpg(e,!0),a.data.value.epgFocus=i)):(e.classList.remove("theme-epg-grid-current"),s.epgMode||s.$body.children[i]!==a||e.classList.remove("theme-epg-grid-focused"))}for(i=0;i<this.$body.children.length;i++)t=!0,(n=this.$body.children[i]).data&&n.data.value.epgItems&&n.data.value.epgItems.length&&n.data.value.epgItems.forEach(c);a&&a.data.value.$archiveLine&&(a.data.value.epgGrid&&a.data.value.epgGrid.length?this.time+this.timeStep>o?o>=this.time?(e=Math.ceil((o-this.time)*this.scheduleBlock),a.data.value.$archiveLine.style.width=e+"px",a.data.value.$archiveLine.style.display=""):a.data.value.$archiveLine.style.display="none":a.data.value.$archiveLine.style.width=this.scheduleWidth+"px":a.data.value.$archiveLine.style.display="none")},d.prototype.setCurrentProgram=function(){this.epgLastFocused&&this.epgLastFocused.data?(this.$programDescription.innerText=this.epgLastFocused.data.description||"",this.$programName.innerText=this.epgLastFocused.data.title||""):(this.$programDescription.innerText="",this.$programName.innerText="")},d.prototype.repositionTimeLine=function(){var e=new Date,t=0,i=Math.ceil(e.getTime()/1e3);i>=this.time&&this.time+this.timeStep>i?(t=Math.ceil((i-this.time)/this.timeStep*this.scheduleWidth),t+=this.timeLineMargin,this.$timeLine.style.display="block",this.$timeLine.style.left=t+"px"):this.$timeLine.style.display="none",this.checkCurrent()},d.prototype.epgModeChange=function(e){var t=this;this.epgMode=!!e,this.timers.epgModeChange&&clearTimeout(this.timers.epgModeChange),this.epgMode&&(this.timers.epgModeChange=setTimeout(function(){t.goToRealTime()},18e4))},d.prototype.checkingTime=function(){var e=this.getStartTime(),t=this;this.internal.checkingTime&&clearInterval(this.internal.checkingTime),this.epgMode||(this.time!==e&&(this.time=e),this.initTimeBlock(),this.internal.checkingTime=setInterval(function(){t.epgMode||(e=t.getStartTime(),t.time!==e&&(t.time=e,t.initTimeBlock())),t.repositionTimeLine()},6e4))},d.prototype.initTimeBlock=function(e,t){var i,s,a,o,c,d,h,u;for(null===this.time&&(this.time=this.getStartTime()),d=this.time-this.step/2,i=new Date(1e3*d),s=l[i.getDay()],a=i.getMinutes(),o=i.getHours(),c=i.getMonth()+1,h=s+", "+i.getDate()+" "+r[c-1],n.clear(this.$timeBlock),n.add(this.$timeBlock,n.tag("div",{className:"date theme-epg-grid-date"},h)),u=2;u<=2*this.countOfSteps;u+=2)i.setTime(1e3*(d+u*this.step/2)),a=i.getMinutes(),o=i.getHours(),n.add(this.$timeBlock,n.tag("div",{className:"hours theme-epg-grid-date "+(30===a?"halfhour":"hour")},(o<10?"0"+o:o)+":"+(a<10?"0"+a:a),n.tag("div",{className:"hourmark theme-epg-grid-hourmark"})));this.updateEpg(e,t)},d.prototype.getStartTime=function(){var e,t,i=new Date;return t=Math.floor(i.getTime()/1e3),(e=60*i.getMinutes()%(2*this.step))<this.step?t-e-this.step/2:t-e+this.step/2},d.prototype.updateEpg=function(e,t){var i,s,a,o=[],c={},r=this;for(i=0;i<this.$body.children.length;i++)this.$body.children[i].data&&o.push(this.$body.children[i].data.value);if(0!==o.length){for(c.channels=o,this.time||(this.time=this.getStartTime()),c.from=1e3*this.time,c.to=c.from+1e3*this.timeStep,this.request&&this.request.abort(),s=this.$body.children.length,a=this.data.length,i=0;i<s&&this.$body.children[i].index<a;i++)n.clear(this.data[this.$body.children[i].index].items[1].value.$node);this.request=this.apiProvider.getChannelsEpg(c,function(n,s){if(!n)for(i=0;i<o.length;i++)s[o[i].id]?o[i].epgGrid=s[o[i].id]:o[i].epgGrid=null;for(i=0;i<r.$body.children.length;i++)r.$body.children[i].data&&r.fillItem(r.$body.children[i],r.data[r.$body.children[i].index]);if(r.checkCurrent(),r.epgMode)if((s=r.$focusItem.data).value.epgItems.length){if(e)s.value.epgFocus=s.value.epgItems.length-1;else if(t)s.value.epgFocus=0;else for(s.value.epgFocus=0,i=0;i<s.value.epgItems.length;i++)if(r.epgFocusTime>=s.value.epgItems[i].data.start&&r.epgFocusTime<s.value.epgItems[i].data.end){s.value.epgFocus=i;break}r.focusEpg(s.value.epgItems[s.value.epgFocus],!0)}else r.focusEpg(r.epgLastFocused,!1)}),this.repositionTimeLine()}},d.prototype.focusEpg=function(e,t){t=!!t,e.focused!==t&&(t?(this.epgLastFocused&&(this.epgLastFocused.classList.remove("theme-epg-grid-focused"),this.epgLastFocused.focused=!1),e.classList.add("theme-epg-grid-focused"),e.focused=!0,this.epgLastFocused=e,this.epgFocusTime=e.data.start,this.setCurrentProgram()):(e.classList.remove("theme-epg-grid-focused"),e.focused=!1,this.epgLastFocused===e&&(this.epgLastFocused=null,this.epgFocusTime=this.time,this.setCurrentProgram())))},d.prototype.subNext=function(){var e=this.$focusItem.data;this.epgModeChange(!0),e.value.epgItems.length&&e.value.epgFocus+1<e.value.epgItems.length?(e.value.epgFocus++,this.focusEpg(e.value.epgItems[e.value.epgFocus],!0)):(this.time+=this.timeStep-this.step,this.initTimeBlock(!1,!0))},d.prototype.subPrev=function(){var e=this.$focusItem.data;this.epgModeChange(!0),e.value.epgItems.length>0&&e.value.epgFocus>0?(e.value.epgFocus--,this.focusEpg(e.value.epgItems[e.value.epgFocus],!0)):(this.time-=this.timeStep-this.step,this.initTimeBlock(!0))},d.prototype.goToRealTime=function(){var e=this.getStartTime();this.epgMode&&(this.epgModeChange(!1),this.time!==e&&(this.time=e,this.initTimeBlock()))},e.exports=d},function(e,t,i){"use strict";var n,s,a,o,c,r,l,d,h,u,m,p,f,v,g,y,x,$=new