-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilt.js
6 lines (6 loc) · 177 KB
/
built.js
1
2
3
4
5
6
/*!
* Jade - runtime
* Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
define("ui/throbber",[],function(){function b(b){var c;for(c in b)typeof a[c]!="undefined"&&(a[c]=b[c])}var a={element:document.body,text:"Loading...",startColor:"#000",endColor:"#fff"},c;return c=document.createElement("div"),c.className="tui-text-tobber",{start:function(d){typeof d=="object"&&b(d),c.innerHTML=a.text,c.style.height=a.element.style.height,c.style.width=a.element.style.width,c.style.top="-"+window.innerHeight+"px",c.style.lineHeight=a.element.style.height,a.element.appendChild(c)},stop:function(){c.parentNode&&c.parentNode.removeChild(c)}}}),define("data/static-strings",{common:{refresh:"Reloading ",old_password:"Your old password",new_password:"Your new password",load_indication:"Loading ",initial_load_indication:"Loading TUI..."},player:{states:{playing:"Playing: ",buffering:"Buffering: ",paused:"Paused: ",starting:"Starting: "}},lists:{sorting:{sortByIndex:"Sort by Index, Bookmarked first",sortByName:"Sort by Name"},noContent:"There are no items in this category",lock:"Lock",unlock:"Unlock",bookmark:"Bookmark",unbookmark:"Unbookmark",actionFailed:"The selected action cannot be completed",resumePlay:"Resume",play:"Play"},epg:{panels:{bottom:{upDown:"Scroll",info:"Hide EPG",ok:"Select","return":"Deactivate",ok_alternate:"Rec/Switch"}}},games:{panels:{bottom:{ok:"Start game","return":"End game"}},hints:{Sudoku:{ok:"Check validity",arrows:"Move around"},Tetris:{arrows:"Move"},SizzleBox:{arrows:"Move tiles"},Hangman:{arrows:"Select letter",ok:"Use letter"}}},screens:{setup:{header:{settings:"Parameter",value:"Value"}},iptv:{panels:{bottom:{info:"Show EPG",ok:"Select",playPause:"Options","return":"Apply changes"}},errors:{cannotSchedule:"Scheduling failed",scheduled:"Schedule saved"}},callcenter:{panels:{bottom:{}},list:{}},general:{panels:{bottom:{"return":"Apply changes"}}},voip:{panels:{bottom:{"return":"Apply changes"}}},wifi:{panels:{bottom:{"return":"Apply changes"}}},lannetworking:{panels:{bottom:{"return":"Apply changes"}}},sms:{panels:{bottom:{arrows:"Navigate"}},list:{header:{},body:{to:"To:",message:"Text:"}}},phonebook:{panels:{bottom:{ok:"Call now",info:"Contact options",upDown:"Select"}},list:{header:{name:"Name",number:"Number",speedDial:"SD"}}},voicemail:{panels:{bottom:{upDown:"Navigation",ok:"Listen"}},list:{header:{},body:{caller:"Call from",time:"Time of call"}}},callhistory:{panels:{bottom:{ok:"Call"}},list:{header:{caller:"Caller Name",time:"Time of call",duration:"Call duration",type:"Type"}}},chooser:{panels:{bottom:{leftRight:"Scroll",ok:"Select"}},list:{header:{},body:{callcenter:"Call Centre",history:"Call History",voicemail:"Voice Mail",sms:"Send SMS",phonebook:"Phonebook"}}},incall:{panels:{bottom:{"return":"Go to menu",upDown:"Switch line"}},list:{header:{},body:{statuses:{nocall:"No current call"}}}}},components:{dialogs:{confirmApply:"Save changes?",confirmPay:"Please confirm charges of ",select:"Select action",lock:"Password",wrongPassword:"The password is incorrect",ok:"OK",cancel:"Cancel",updateFailed:"Update failed<br>",ytube:{mostPopular:"Most popular",topRated:"Top Rated",mostViewed:"Most Viewed",recent:"Recent Videos",search:"Search",select:"Choose Category",searchquery:"Enter your search query"}}}}),define("ui/load-indicator",["ui/throbber","data/static-strings"],function(a,b){return{show:function(c){a.start({element:document.body,text:c||b.common.initial_load_indication})},hide:function(){a.stop()}}}),define("config/options",{DEBUG:!0,USE_NODEJS:!1,VERSION:"1.0beta3",USE_SCALE:!1,PANELS_ENABLED:!1}),define("dom/string",[],function(){var a={};return{build:function(a){return Array.prototype.join.call(arguments,"")},selectorCase:function(b){return a[b]||(a[b]=String(b).replace(/([A-Z])/g,"-$1").toLowerCase())},isAlpha:function(a){return!/[^a-zA-Z]/.test(a)},isNumeric:function(a){return!/[^0-9]/.test(a)},isAlNum:function(a){return!/[^a-zA-Z0-9]/.test(a)},stripNewLine:function(a){return a.replace(/(\r\n|\r|\n)+/g," ")},normalizeWhiteSpace:function(a){return a.replace(/\xa0|\s/g," ")},htmlize:function(a){return a.replace(/(\r\n|\r|\n)/g,opt_xml?"<br />":"<br>")},textilize:function(a){return a.replace(/(<br>|<BR>|<br\ \/>)/g,"\n")},toNumber:function(a){var b=Number(a);return b==0&&this.isEmpty(a)?NaN:b},isEmpty:function(a){return/^[\s\xa0]*$/.test(a)},shrink:function(a,b){return b=parseInt(b,10),a.length>b?a.substring(0,b-4)+" ...":a},camelCase:function(a){return a.replace(/-\D/g,function(a){return a.charAt(1).toUpperCase()})},trim:function(a){return a.replace(/^\s+|\s+$/g,"")},clean:function(a){return this.trim(a.replace(/\s+/g," "))},contains:function(a,b,c){return c?(c+a+c).indexOf(c+b+c)>-1:a.indexOf(b)>-1},makeSafe:function(a){return a==null?"":String(a)},substitute:function(a,b,c){return a.replace(c||/\\?\{([^{}]+)\}/g,function(a,c){return a.charAt(0)=="\\"?a.slice(1):b[c]!=null?b[c]:""})}}}),define("types/types",{toType:function(b){return function(a){var b=typeof a;if(b==="object"){if(a instanceof Array)return"array";if(typeof b.tagName!="undefined")return"htmlelement"}return b}}(window),getType:function(a){return this.toType(a).toLowerCase()},assert:function(a,b){return this.getType(a)===b}}),define("shims/indexof",[],function(){return Array.indexOf||(Array.prototype.indexOf=function(a,b){for(var c=b||0;c<this.length;c++)if(this[c]==a)return c;return-1}),{}}),define("array/array",["shims/indexof"],function(){return{has:function(a,b){return a.indexOf(b)>-1?!0:!1},remove:function(a,b){var c=a.indexOf(b),d;(d=c>=0)&&a.splice(c--,1)},removeExisting:function(a,b){for(var c=0;c<a.length;c++)b.indexOf(a[c])!==-1&&a.splice(c--,1)},addMissing:function(a,b){for(var c=0;c<b.length;c++)a.indexOf(b[c])===-1&&a.push(b[c])},isEmpty:function(a){return a.length&&a.length>0?!1:!0},last:function(a){return a[a.length-1]}}}),define("dom/classes",["types/types","array/array"],function(a,b){return{getClasses:function(a){var b=a.className;return b&&typeof b.split=="function"?b.split(/\s+/):[]},hasClass:function(a,b){return this.getClasses(a).indexOf(b)===-1?!1:!0},addClasses:function(c,d){if(c===null)return;var e;a.assert(d,"array")?e=d:e=Array.prototype.slice.call(arguments,1);var f=this.getClasses(c);b.addMissing(f,e),c.className=f.join(" ")},removeClasses:function(c,d){var e;a.assert(d,"array")?e=d:e=Array.prototype.slice.call(arguments,1);var f=this.getClasses(c);b.removeExisting(f,e),c.className=f.join(" ")},addRemoveClasses:function(a,c,d){var e=this.getClasses(a);typeof d=="string"?b.remove(e,d):b.removeExisting(e,d),typeof c=="string"?e.indexOf(c)===-1&&e.push(c):b.addMissing(e,c),a.className=e.join(" ")},radioClass:function(a,b){this.addClasses(a,b),a.parentNode.children.forEach(function(a){this.removeClasses(a,"."+b)})}}}),define("dom/attributes",["dom/classes"],function(a){function b(a){switch(a){case"html":return"innerHTML";case"text":return"textContent";default:return a}}return{set:function(c,d,e){switch(d){case"classes":var f=e.split(/\s+/);a.addClasses(c,f);return;case"style":c.setAttribute("style",e);return;default:c[b(d)]=e}},get:function(c,d){switch(d){case"classes":return a.getClasses(c).join(" ");default:return c[b(d)]}},remove:function(a,b){a.removeAttribute(b)}}}),define("dom/dom",["dom/string","types/types","dom/attributes"],function(a,b,c){function f(a){return b.assert(a,"string")&&document.querySelector("#"+a)===null?a:(d+=1,"autoID_"+d)}var d=1,e=document.body.dataset?!0:!1;return{empty:function(a){a.innerHTML=""},getInnerNodes:function(a){var b=this.create("div",{html:a}),c=b.firstElementChild.cloneNode(!0);return b=null,c},$:function(a,b){return b=b||document,b.querySelector(a)},$$:function(a,b){return b=b||document,b.querySelectorAll(a)},create:function(a,d){var e,f;if(b.assert(a,"string")){e=document.createElement(a);if(e===null)throw{name:"DOMError",message:"Cannot create element"};if(b.assert(d,"object"))for(f in d)d.hasOwnProperty(f)&&c.set(e,f,d[f]);return e}return null},adopt:function(a,b){return arguments.length===1?document.body.appendChild(a):a.appendChild(b)},dispose:function(a){if(a&&a.parentNode)return a.parentNode.removeChild(a)},dataSet:function(){return e?function(a,b,c){a.dataset[b]=c}:function(b,c,d){b.setAttribute("data-"+a.selectorCase(c),d)}}(),dataGet:function(){return e?function(a,b){return a.dataset[b]}:function(b,c){return b.getAttribute("data-"+a.selectorCase(c))}}(),dataRemove:function(){return e?function(a,b){delete a.dataset[b]}:function(b,c){b.removeAttribute("data-"+a.selectorCase(c))}}(),dataHas:function(b,c){return b.dataset?c in b.dataset:b.hasAttribute?b.hasAttribute("data-"+a.selectorCase(c)):!!b.getAttribute("data-"+a.selectorCase(c))},getUniqueId:function(a){return f(a)}}}),define("oop/inherit",[],function(){return function(a,b){function c(){}c.prototype=b.prototype,a.superClass_=b.prototype,a.prototype=new c,a.prototype.constructor=a}}),define("oop/idisposable",[],function(){var a=function(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];typeof d.dispose=="function"&&d.dispose()}},b=function(){};return b.prototype.disposed_=!1,b.prototype.dependentDisposables_,b.prototype.isDisposed=function(){return this.isDisposed},b.prototype.dispose=function(){this.disposed_||(this.disposed_=!0,this.disposeInternal())},b.prototype.registerDisposable=function(a){this.dependentDisposables_||(this.dependentDisposables_=[]),this.dependentDisposables_.push(a)},b.prototype.disposeInternal=function(){this.dependentDisposables_&&a.apply(null,this.dependentDisposables_)},b}),define("debug/log-record",["oop/inherit","oop/idisposable"],function(a,b){var c=function(a,c,d,e){b.call(this),this.time_=e||new Date,this.level_=a,this.loggerName_=d,this.msg_=c};return a(c,b),c.prototype.getLoggerName=function(){return this.loggerName_},c.prototype.getLevel=function(){return this.level_},c.prototype.getMessage=function(){return this.msg_},c.prototype.getTime=function(){return this.time_},c.prototype.disposeInternal=function(){c.superClass_.disposeInternal.call(this),delete this.time_,delete this.msg_,delete this.level_,delete this.loggerName_},c}),define("support/runtime",[],function(){var a=function(a){return Array.isArray||(Array.isArray=function(a){return"[object Array]"=="".toString.call(a)}),Object.keys||(Object.keys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}),a.attrs=function(c){var d=[],e=c.terse;delete c.terse;var f=Object.keys(c),g=f.length;if(g){d.push("");for(var h=0;h<g;++h){var i=f[h],j=c[i];"boolean"==typeof j||null==j?j&&(e?d.push(i):d.push(i+'="'+i+'"')):"class"==i&&Array.isArray(j)?d.push(i+'="'+a.escape(j.join(" "))+'"'):d.push(i+'="'+a.escape(j)+'"')}}return d.join(" ")},a.escape=function(b){return String(b).replace(/&(?!\w+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},a.rethrow=function(b,c,d,e){var f=3,g=c.split("\n"),h=Math.max(e-f,0),i=Math.min(g.length,e+f),f=g.slice(h,i).map(function(a,b){var c=b+h+1;return(c==e?" > ":" ")+c+"| "+a}).join("\n");throw b.path=d,b.message=(d||"Jade")+":"+e+"\n"+f+"\n\n"+b.message,b},a}({});return a}),define("utils/datetime",{getCurrentTime:function(){return(new Date).getTime()},parseTime:function(a){return new Date(parseInt(a))},fillMinutes:function(a){return a=""+a,a.length<2&&(a="0"+a),a},parseHoursFromDateTime:function(a){a=this.setAsDateTime(a);var b=a.getHours(a);return b=this.fillMinutes(b.toString()),b},setAsDateTime:function(a){return a instanceof Date||(a=this.parseTime(a)),a},parseMinutesFromDateTime:function(a){a=this.setAsDateTime(a);var b=a.getMinutes();return b=this.fillMinutes(b.toString()),b},parseSecondsFromDateTime:function(a){a=this.setAsDateTime(a);var b=a.getSconds();return b=this.fillMinutes(b.toString()),b},getParsedTime:function(a,b,c){typeof b!="string"&&(b=":");var d="",e=this.parseMinutesFromDateTime(a),f=this.parseHoursFromDateTime(a);return d=f+b+e,c===!0&&(d=d+b+this.parseSecondsFromDateTime(a)),d},SECOND:60,MINUTE:3600,parseTimeFromSeconds:function(a){var b=parseInt(a,10),c,d=b%this.SECOND;c=b-d;var e=parseInt(c/this.SECOND,10);return this.fillMinutes(e)+":"+this.fillMinutes(d)}}),define("tpl/popups",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div><div"),buf.push(attrs({"class":"multi-select-shadow"+(addKbdContainer?" has-kbd":type==="confirm"||type==="ip"?" wide":type=="message"?" message":"")})),buf.push("><div"),buf.push(attrs({"class":"multi-select-container"})),buf.push("><div"),buf.push(attrs({"class":"title"})),buf.push(">");var __val__=title;buf.push(null==__val__?"":__val__),buf.push("</div>");if(typeof type=="string"&&["input","password","text","confirm","ip","message"].indexOf(type)!==-1)buf.push("<div"),buf.push(attrs({"class":"textarea area-type-"+type})),buf.push("></div>"),type==="text"&&(buf.push("<div"),buf.push(attrs({"class":"kbd-submitBtn"})),buf.push(">Submit</div>")),addKbdContainer===!0?(buf.push("<div"),buf.push(attrs({"class":"tui-kbd-container"})),buf.push("></div>")):type=="confirm"?(buf.push("<div"),buf.push(attrs({"class":"tui-horizontal-container"})),buf.push(">"),useDefaultButtons===!0?(buf.push("<div"),buf.push(attrs({"data-trigger":"1","class":"tui-popup-button horizontal-button active"})),buf.push(">OK</div><div"),buf.push(attrs({"data-trigger":"0","class":"tui-popup-button horizontal-button"})),buf.push(">Cancel</div>")):(buf.push("<div"),buf.push(attrs({"data-trigger":"1","class":"tui-popup-button horizontal-button"})),buf.push(">OK</div><div"),buf.push(attrs({"data-trigger":"0","class":"tui-popup-button horizontal-button active"})),buf.push(">Cancel</div>")),buf.push("</div>")):type=="message"?(buf.push("<div"),buf.push(attrs({"class":"tui-horizontal-container"})),buf.push("><div"),buf.push(attrs({"class":"tui popup-button horizontal-button single-button active"})),buf.push(">OK</div></div>")):type=="ip"&&(buf.push("<div"),buf.push(attrs({"class":"tui-horizontal-container"})),buf.push("><div"),buf.push(attrs({"class":"input-box active"})),buf.push("></div><div"),buf.push(attrs({"class":"input-box"})),buf.push("></div><div"),buf.push(attrs({"class":"input-box"})),buf.push("></div><div"),buf.push(attrs({"class":"input-box"})),buf.push("></div></div>"));else if(typeof things=="object")for(var i=0;i<things.length;i++){buf.push("<div"),buf.push(attrs({"class":"multi-select-item"})),buf.push(">");var __val__=things[i];buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("</div></div></div>")}return buf.join("")}return{render:anonymous}}),define("tpl/vkbs",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({"class":"tui-keyboard"})),buf.push(">");for(var i=0;i<kbdlayout.length;i++){buf.push("<ul"),buf.push(attrs({"class":"ul"+i+" kbdrow"})),buf.push(">");for(var j=0;j<kbdlayout[i].length;j++){buf.push("<li"),buf.push(attrs({"class":kbdlayout[i][j].length>4?"widekey":kbdlayout[i][j].length>1?"smallwidekey":kbdlayout[i][j]===" "?"spacek":""})),buf.push(">");var __val__=kbdlayout[i][j];buf.push(null==__val__?"":__val__),buf.push("</li>")}buf.push("</ul><br"),buf.push(attrs({})),buf.push("/>")}buf.push("</div>")}return buf.join("")}return{render:anonymous}}),function(){var a=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],b=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,c=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,d=typeof location!="undefined"&&location.href,e=[];define("text",[],function(){var f,g,h;return typeof window!="undefined"&&window.navigator&&window.document?g=function(a,b){var c=f.createXhr();c.open("GET",a,!0),c.onreadystatechange=function(){c.readyState===4&&b(c.responseText)},c.send(null)}:typeof process!="undefined"&&process.versions&&process.versions.node?(h=require.nodeRequire("fs"),g=function(a,b){b(h.readFileSync(a,"utf8"))}):typeof Packages!="undefined"&&(g=function(a,b){var c=new java.io.File(a),d=java.lang.System.getProperty("line.separator"),c=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(c),"utf-8")),e,f,g="";try{e=new java.lang.StringBuffer,(f=c.readLine())&&f.length()&&f.charAt(0)===65279&&(f=f.substring(1));for(e.append(f);(f=c.readLine())!==null;)e.append(d),e.append(f);g=String(e.toString())}finally{c.close()}b(g)}),f={version:"0.26.0",strip:function(a){if(a){var a=a.replace(b,""),d=a.match(c);d&&(a=d[1])}else a="";return a},jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r")},createXhr:function(){var b,c,d;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;for(c=0;c<3;c++){d=a[c];try{b=new ActiveXObject(d)}catch(e){}if(b){a=[d];break}}if(!b)throw Error("createXhr(): XMLHttpRequest not available");return b},get:g,parseName:function(a){var b=!1,c=a.indexOf("."),d=a.substring(0,c),a=a.substring(c+1,a.length),c=a.indexOf("!");return c!==-1&&(b=a.substring(c+1,a.length),b=b==="strip",a=a.substring(0,c)),{moduleName:d,ext:a,strip:b}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,canUseXhr:function(a,b,c,d){var e=f.xdRegExp.exec(a),g;return e?(a=e[2],e=e[3],e=e.split(":"),g=e[1],e=e[0],(!a||a===b)&&(!e||e===c)&&(!g&&!e||g===d)):!0},finishLoad:function(a,b,c,d,g){c=b?f.strip(c):c,g.isBuild&&g.inlineText&&(e[a]=c),d(c)},load:function(a,b,c,e){var g=f.parseName(a),h=g.moduleName+"."+g.ext,i=b.toUrl(h);!d||f.canUseXhr(i)?f.get(i,function(b){f.finishLoad(a,g.strip,b,c,e)}):b([h],function(a){f.finishLoad(g.moduleName+"."+g.ext,g.strip,a,c,e)})},write:function(a,b,c){if(b in e){var d=f.jsEscape(e[b]);c("define('"+a+"!"+b+"', function () { return '"+d+"';});\n")}},writeFile:function(a,b,c,d,e){var b=f.parseName(b),g=b.moduleName+"."+b.ext,h=c.toUrl(b.moduleName+"."+b.ext)+".js";f.load(g,c,function(){f.write(a,g,function(a){d(h,a)},e)},e)}}})}(),define("text!css/vkbd.css",function(){return"\n.tui-keyboard {\n\ttext-align: center;\n\theight: 169px;\n}\n\n.tui-keyboard .kbdrow {\n list-style: none; \n}\n.tui-keyboard > ul {\n/*\tmargin: 0;*/\n\tpadding: 0;\n}\n.tui-keyboard .ul0 {\n\tmargin-left: 15px;\n}\n.tui-keyboard .ul1 {\n margin-left: 30px;\n}\n.tui-keyboard .ul2 {\n margin-left: 15px;\n}\n.tui-keyboard .ul3 {\n margin-left: 15px;\n}\n.tui-keyboard .ul4 {\n margin-left: 45px;\n}\n.tui-keyboard .kbdrow li {\n border-radius: 3px;\n\twidth: 23px;\n\theight: 20px;\n\tdisplay: block;\n\tcursor: pointer;\n\tmargin: 3px;\n\tfloat: left;\n\tpadding-top: 3px;\n\ttext-align: center;\n\tcolor: #92B3E7;\n\tborder: 1px solid #3E5170;\n\tfont-weight: bold;\n}\n.tui-keyboard .kbdrow li.smallwidekey {\n width: 54px;\n}\n.tui-keyboard .kbdrow li.widekey {\n width: 84px;\n}\n.tui-keyboard .kbdrow li.spacek {\n width: 143px;\n}\n.tui-keyboard .kbdrow li.activekey {\n\tcolor: #E4EDFB;\n\tbackground: #001C3D;\n\tborder: 1px solid #AEC9F4;\n}\n"}),define("loader/loader",["dom/dom"],function(a){function c(a){var c=[],d;for(d=0;d<a.length;d++)b.indexOf(a[d])===-1&&c.push(a[d]);return c}function d(a){document.getElementsByTagName("head")[0].appendChild(a)}function e(){return new XMLHttpRequest}function f(c,d){function h(){i>=c.length&&(a.adopt(a.$("head"),a.create("style",{text:f})),d())}function j(a){var c=e();b.push(a),c.open("GET",a,!0),c.onreadystatechange=function(a){c.readyState==4&&(c.status==200&&(f+=c.responseText),i++,h())},c.send(null)}var f="",g,i=0;for(var k=0;k<c.length;k++)j(c[k])}var b=[];return{loadTemplate:function(b,c,d){var e=a.create("iframe",{src:b,id:a.getUniqueId(d),classes:"tui-display-none"});e.onload=function(){c(this)},document.body.appendChild(e)},loadCSS:function(a,b){var d=c(a);d.length<1?b():f(d,b)},loadCSSFromText:function(b,c){var d=a.$("head"),e=a.create("style",{text:b});if(typeof c=="string"){if(a.$("#"+c,d)!==null){e=null;return}e.setAttribute("id",c)}a.adopt(d,e)},loadExternalCSS:function(a,e){var f=c([a]);f.length!==1&&typeof e=="function"&&e(),f=f[0];var g,h;g=document.createElement("link"),g.setAttribute("href",f),g.setAttribute("rel","stylesheet"),g.setAttribute("type","text/css"),b.push(f),d(g),h=document.createElement("img"),h.onerror=function(){typeof e=="function"&&e(),h.parentNode.removeChild(h)},h.setAttribute("style","position: absolute; left: -5000px;"),document.body.appendChild(h),h.src=f},loadJSONP:function(b,c){console.log("try loading JSONP",c);var e=document.querySelector("#"+b);e&&(a.dispose(e),e=null);var f=c+"&tstamp="+(new Date).getTime();e=document.createElement("script"),e.setAttribute("id",b),e.setAttribute("type","text/javascript"),e.setAttribute("async",!0),d(e),window.setTimeout(function(){e.setAttribute("src",f)},1)}}}),define("data/i18l",{bg_bg:[["'","1","2","3","4","5","6","7","8","9","0","|","Del"],["я","в","е","р","т","ъ","у","и","о","п","ш","щ","ю"],["а","с","д","ф","г","х","й","к","л",";",'"',"Enter"],["Shift","з","ь","ц","ж","б","н","м",",",".","+","-"],["Lang:Bg"," "]],il_il:[["'","1","2","3","4","5","6","7","8","9","0","|","Del"],["ק","ו","א","ר","ת","ע","ו","י","ס","פ","[","]","/"],["א","ש","ד","פ","ג","ה","י","כ","ל",";",'"',"Enter"],["⎇","ז","ח","צ","ו","ב","נ","מ",",",".","+","-"],["Lang:Il"," "]]}),define("shims/bind",[],function(){return function(a,b,c){if(arguments.length>2){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(c,d),a.apply(b,c)}}return function(){return a.apply(b,arguments)}}}),define("ui/vkbd",["tpl/vkbs","text!css/vkbd.css","loader/loader","dom/dom","dom/classes","shims/bind","data/i18l","array/array"],function(a,b,c,d,e,f,g,h){var i=function(){this.layouts=[],this.currentLayoutIndex=0,this.shiftMutators=[],this.boundElement=null,this.value="",this.container=null,this.layouts.push(this.defaultLayout),this.customKeyPressHandlers=[]};return i.prototype.shiftKeyPressedState=!1,i.prototype.inputIsMasked=!1,i.prototype.bindToElement=function(a,b){b?this.inputIsMasked=!0:delete this.inputIsMasked,this.boundElement=a,this.value=this.boundElement.textContent},i.prototype.defaultLayout=[["`","1","2","3","4","5","6","7","8","9","0","Delete"],["q","w","e","r","t","y","u","i","o","p","[","]","/"],["a","s","d","f","g","h","j","k","l",";",'"',"Return"],["Shift","z","x","c","v","b","n","m",",",".","+","-"],["Lang:En"," ","www.",".com"]],i.prototype.shiftMutate=function(){var a,b,c=d.$$("li",d.$(".tui-keyboard")),e=this.shiftKeyPressedState?"toLowerCase":"toUpperCase",f=c.length,g,h;for(a=0;a<f;a++){g=c[a].childNodes[0],b=g.nodeValue;if(g.nodeValue.length===1){h=b[e]();if(b!==h){g.nodeValue=h;continue}}g.nodeValue=this.iterateOverMutators(b)}this.shiftKeyPressedState=!this.shiftKeyPressedState},i.prototype.iterateOverMutators=function(a){var b,c;c=this.defaultShiftMutator(a);if(c.found===!0)return c.c;for(b=0;b<this.shiftMutators.length;b++)if(typeof this.shiftMutators[b]=="function"){c=this.shiftMutators[b](a);if(c.found===!0)return c.c}return a},i.prototype.selectNextLayout=function(){this.currentLayoutIndex++,this.currentLayoutIndex>=this.layouts.length&&(this.currentLayoutIndex=0),this.shiftKeyPressedState=!1,this.rasterizeLayout(!0)},i.prototype.rasterizeLayout=function(b){var c,e,f;this.dom_=a.render({kbdlayout:this.layouts[this.currentLayoutIndex]}),this.container.innerHTML=this.dom_,c=d.$$(".kbdrow",this.container),f=b?c[c.length-1]:c[0],e=d.$("li",f),this.setActiveKey(e)},i.prototype.activeItemClass="activekey",i.prototype.activeItemSelector=".",i.prototype.activeItemSelectorHelper="li",i.prototype.rowSelector="ul.kbdrow",i.prototype.getActiveKey=function(){return d.$(this.activeItemSelectorHelper+this.activeItemSelector+this.activeItemClass,this.container)},i.prototype.setActiveKey=function(a,b){var c=b||this.getActiveKey();c!==null&&e.removeClasses(c,this.activeItemClass),e.addClasses(a,this.activeItemClass)},i.prototype.defaultVirtualKeyHandler=function(a){if(/Lang:/.test(a)){this.selectNextLayout();return}switch(a){case"⌫":case"Delete":case"Del":case"delete":case"del":this.deleteCharacter();break;case"Return":case"Enter":typeof this.submitCallback=="function"&&this.submitCallback(this.value);break;case"⎇":case"Shift":this.shiftMutate();break;default:this.addCharacter(a)}},i.prototype.addCharacter=function(a){this.value=this.value+a,this.updateElement()},i.prototype.deleteCharacter=function(){this.value=this.value.substr(0,this.value.length-1),this.updateElement()},i.prototype.updateElement=function(){this.inputIsMasked?this.boundElement.textContent=(new Array(this.value.length+1)).join("*"):this.boundElement.textContent=this.value},i.prototype.show=function(a,b,c){if(!a)return;this.container=a,this.submitCallback=b,this.isMultiline=c||!1,this.rasterizeLayout()},i.prototype.getEventHandler=function(){return f(this.eventHandler,this)},i.prototype.eventHandler=function(a){var b,c,e,f,g,h,i,j,k=this.getActiveKey(),l;if(a==="ok")this.keyPress(k.childNodes[0].nodeValue);else{f=d.$$(this.rowSelector,this.container);for(b=0;b<f.length;b++)if(k.parentNode===f[b]){e=b,l=f[b];break}j=l.children.length;for(b=0;b<j;b++)if(k===l.children[b]){c=b;break}switch(a){case"left":c===0?h=l.lastElementChild:h=k.previousElementSibling;break;case"right":c===j-1?h=l.firstElementChild:h=k.nextElementSibling;break;case"up":case"down":a==="up"?e===0?g=f[f.length-1]:g=f[e-1]:e>=f.length-1?g=f[0]:g=f[e+1],i=d.$$(this.activeItemSelectorHelper,g),c>i.length-1?h=i[i.length-1]:h=i[c]}h&&this.setActiveKey(h,k)}},i.prototype.keyPress=function(a){var b,c;if(this.customKeyPressHandlers.length>0)for(b=0;b<this.customKeyPressHandlers.length;b++)if(this.customKeyPressHandlers[b](a))return;this.defaultVirtualKeyHandler(a)},i.prototype.defaultShiftMutator=function(a){switch(a){case"⎇":return{found:!0,c:"⎇"};case"⌫":return{found:!0,c:"⌫"};case"1":return{found:!0,c:"!"};case"!":return{found:!0,c:"1"};case"2":return{found:!0,c:"@"};case"@":return{found:!0,c:"2"};case"3":return{found:!0,c:"#"};case"#":return{found:!0,c:"3"};case"4":return{found:!0,c:"$"};case"$":return{found:!0,c:"4"};case"5":return{found:!0,c:"%"};case"%":return{found:!0,c:"5"};case"6":return{found:!0,c:"^"};case"^":return{found:!0,c:"6"};case"7":return{found:!0,c:"&"};case"&":return{found:!0,c:"7"};case"8":return{found:!0,c:"*"};case"*":return{found:!0,c:"8"};case"9":return{found:!0,c:"("};case"(":return{found:!0,c:"9"};case"0":return{found:!0,c:")"};case")":return{found:!0,c:"0"};case"-":return{found:!0,c:"_"};case"_":return{found:!0,c:"-"};case"=":return{found:!0,c:"+"};case"+":return{found:!0,c:"="};case"'":return{found:!0,c:'"'};case'"':return{found:!0,c:"'"};case"[":return{found:!0,c:"{"};case"]":return{found:!0,c:"}"};case"{":return{found:!0,c:"["};case"}":return{found:!0,c:"]"};case".":return{found:!0,c:">"};case",":return{found:!0,c:"<"};case">":return{found:!0,c:"."};case"<":return{found:!0,c:","};case";":return{found:!0,c:":"};case":":return{found:!0,c:";"};case"/":return{found:!0,c:"|"};case"|":return{found:!0,c:"/"};case"`":return{found:!0,c:"~"};case"~":return{found:!0,c:"`"};default:return{found:!1,c:a}}},i.prototype.addCustomLayout=function(a){typeof a=="string"&&typeof g[a]=="object"?this.layouts.push(g[a]):typeof a=="object"&&this.layouts.push(a)},i.prototype.removeCustomLayout=function(a){typeof a=="object"?h.remove(this.layout,a):typeof a=="string"&&typeof g[a]=="object"&&h.remove(this.layouts,g[a])},i.knownKeys_=["ok","up","down","left","right"],i.instance_=null,i.getInstance=function(){return i.instance_===null&&(i.instance_=new i,i.instance_.addCustomLayout("bg_bg"),i.instance_.addCustomLayout("il_il")),i.instance_},i}),define("ui/popup",["dom/dom","tpl/popups","oop/idisposable","oop/inherit","dom/classes","dom/attributes","ui/vkbd","array/array","shims/bind"],function(a,b,c,d,e,f,g,h,i){var j=function(a,b,d){c.call(this),this.type=a,this.callback=b,this.title=d};d(j,c),j.prototype.numerics_=["zero","one","two","three","four","five","six","seven","eight","nine"],j.prototype.useKbd=!1,j.prototype.useOkCancel=!1,j.prototype.useOkOnly=!1,j.prototype.ipDialog=!1,j.prototype.destroyer=function(){exportedSymbols.tui.instance.restoreEventTree(this.getEventHandler())},j.prototype.show=function(c){this.container=c||document.body,this.dom_=a.create("div",{classes:"multi-select-wrapper",style:f.get(this.container,"style").cssText}),this.dom_.innerHTML=b.render({title:this.title,things:this.options||[],type:this.type,addKbdContainer:this.useKbd,useDefaultButtons:this.useOkCancel}),a.adopt(this.container,this.dom_),exportedSymbols.tui.instance.stealEvents(this.getEventHandler()),exportedSymbols.tui.instance.getGlobalPlayer().setVState(1)},j.prototype.getNumberFromName=function(a){return this.numerics_.indexOf(a)},j.prototype.destroy=function(){a.dispose(this.dom_),this.destroyer()},j.prototype.eventHandler=function(){},j.prototype.getEventHandler=function(){return this.boundEventHandler_||(this.boundEventHandler_=i(this.eventHandler,this)),this.boundEventHandler_},j.prototype.disposeInternal=function(){j.superClass_.disposeInternal.call(this),delete this.type,delete this.container,delete this.dom_,delete this.callback};var k=function(a,b,c,d,e){j.call(this,a,c,d),this.options=b,this.selectedIndex=e||0};d(k,j),k.prototype.itemSelector=".multi-select-item",k.prototype.activeItemSelector=".multi-select-item.active",k.prototype.activeClass="active",k.prototype.eventHandler=function(a){switch(a){case"up":this.selectItem(!1);break;case"down":this.selectItem(!0);break;case"ok":this.resolver(this.selectedIndex);break;default:}},k.prototype.disposeInternal=function(){k.superClass_.disposeInternal.call(this),delete this.options,delete this.selectedIndex},k.prototype.selectItem=function(a){var b;a?(b=this.selectedIndex+1,b<this.options.length&&(this.selectedIndex=b)):(b=this.selectedIndex-1,b>=0&&(this.selectedIndex=b)),this.activateItem()},k.prototype.activateItem=function(){var b=a.$(this.activeItemSelector,this.dom_);b!==null&&e.removeClasses(b,this.activeClass),e.addClasses(a.$$(this.itemSelector,this.dom_)[this.selectedIndex],this.activeClass)},k.prototype.resolver=function(a){this.destroy(),this.callback(a),this.dispose()},k.prototype.show=function(a){this.constructor.superClass_.show.call(this,a),this.activateItem()};var l=function(a,b,c,d){j.call(this,a,c,d),this.useKbd=b||this.useKbd};d(l,j),l.prototype.disposeInternal=function(){l.superClass_.disposeInternal.call(this),delete this.value,delete this.input,delete this.kbd},l.prototype.show=function(b){l.superClass_.show.call(this,b),this.value="",this.input=a.$(".tui-kbd-container",this.dom_),this.useKbd?(this.input=a.$(".tui-kbd-container",this.dom_),this.kbd=g.getInstance(),this.kbd.show(this.input,i(this.kbdSubmit,this)),this.kbd.bindToElement(a.$(".textarea",this.dom_),this.type==="password"?!0:!1),exportedSymbols.tui.instance.setKeyboardInputHandler(i(function(a){if(TUI.keyboardIgnoredKeys.indexOf(a.keyCode)!==-1)return;var b=String.fromCharCode(a.charCode);this.kbd.addCharacter(b)},this))):this.input=a.$(".textarea",this.dom_)},l.prototype.kbdSubmit=function(a){this.useKbd&&exportedSymbols.tui.instance.resetKeyboardInputHandler(),this.submit(a)},l.prototype.submit=function(a){typeof a=="undefined"&&(a=this.value),this.destroy(),this.callback(a),this.dispose()},l.prototype.updateElement=function(){this.type==="password"?this.input.textContent=(new Array(this.value.length+1)).join("*"):this.input.textContent=this.value},l.prototype.eventHandler=function(a){if(!this.useKbd)if(this.getNumberFromName(a)>-1)this.value=this.value+""+this.getNumberFromName(a),this.updateElement();else switch(a){case"delete":this.value=this.value.substr(0,this.value.length-1),this.updateElement();break;case"ok":this.submit();break;default:}else h.has(g.knownKeys_,a)?this.kbd.eventHandler(a):a==="delete"?this.kbd.deleteCharacter():this.getNumberFromName(a)>-1&&this.kbd.addCharacter(this.getNumberFromName(a))};var m=function(a,b,c,d){j.call(this,a,c,d),this.useOkCancel=b||!1};d(m,j),m.prototype.cssSelector=".horizontal-button",m.prototype.eventHandler=function(b){var c=a.$(this.cssSelector+".active",this.dom_);switch(b){case"left":c.previousElementSibling!==null&&(e.removeClasses(c,"active"),e.addClasses(c.previousElementSibling,"active"));break;case"right":c.nextElementSibling!==null&&(e.removeClasses(c,"active"),e.addClasses(c.nextElementSibling,"active"));break;case"ok":var d=parseInt(a.dataGet(c,"trigger"),10);this.destroy(),this.callback(d),this.dispose()}},m.prototype.destroyer=k.prototype.destroyer,m.prototype.destroy=function(){k.prototype.destroy.call(this)},m.prototype.disposeInternal=function(){m.superClass_.disposeInternal.call(this),delete this.useOkCancel};var n=function(a,b,c,d){m.call(this,a,!1,c,d),this.ipDialog=!0};d(n,m),n.prototype.cssSelector=".input-box",n.prototype.disposeInternal=function(){n.superClass_.disposeInternal.call(this),delete this.ipDialog},n.prototype.next_=["star"],n.prototype.eventHandler=function(b){var c;b==this.next_&&(b="right");switch(b){case"left":case"right":n.superClass_.eventHandler.call(this,b),c=a.$(this.cssSelector+".active",this.dom_);break;case"delete":c=a.$(this.cssSelector+".active",this.dom_),c.innerHTML="";break;case"ok":break;case"return":this.destroy(),this.dispose();break;default:if(this.numerics_.indexOf(b)!==-1){c=a.$(this.cssSelector+".active",this.dom_);var d=c.textContent;d.length===3?(this.eventHandler(this.next_),this.eventHandler("delete"),this.eventHandler(b)):c.innerHTML=d+this.numerics_.indexOf(b)}}};var o=function(a,b){j.call(this,a,null,b)};return d(o,j),o.prototype.eventHandler=function(a){a=="ok"&&(this.destroy(),this.dispose())},{createDialog:function(a,b,c,d,e){var f;a==="optionlist"?f=new k(a,b,c,d,e):["input","password","text"].indexOf(a)!==-1?f=new l(a,b,c,d):a==="confirm"?f=new m(a,!0,c,d):a==="ip"?f=new n(a,undefined,c,d):a==="message"&&(f=new o(a,d)),f.show()}}}),define("config/main",{transport:{DEFAULT_CALLBACK:"window.transportReceiver"}}),define("transport/requestheader",["config/main"],function(a){var b=function(b,c,d,e,f){this.cb=e||this.defaultCallback,this.transport=d||this.transport,this.mode=f||this.mode,this.method=b,this.type=c||this.type,this.getUID()};b.prototype.defaultCallback=a.transport.DEFAULT_CALLBACK,b.prototype.transport="socket",b.prototype.type="request",b.prototype.mode="async",b.prototype.disposeInternal=function(){for(key in this)this.hasOwnProperty(key)&&(this.key=null,delete this.key)},b.prototype.getUID=function(){this.tag="_"+(new Date).getTime()+"_"+this.getRandomBetween_(1,1e3)},b.prototype.getRandomBetween_=function(a,b){return Math.floor(Math.random()*(b-a+1)+a)};var c=function(a){b.prototype.defaultCallback=a},d=function(a){b.prototype.transport=a};return{create:function(a,c,d){return new b(a,c,d)},setDefaultTransport:d,setDefaultCallback:c}}),define("transport/requestdata",["transport/requestheader"],function(a){var b=function(b,c,d){this.header=a.create(b),this.compileRequest_(b,c,d)};return b.prototype.disposeInternal=function(){this.header.disposeInternal(),delete this.header,this.request=null,delete this.request},b.prototype.compileRequest_=function(a,b,c){this.request=b},{create:function(a,c,d){return new b(a,c,d)}}}),define("json/json",{parse:function(JSONString){var result;try{result=JSON.parse(JSONString)}catch(e){console.log("CANNOT PARSE JSON STRING, try with eval",JSONString);try{result=eval("("+JSONString+")")}catch(e){console.log("Eval also failed",JSONString),result=null}}return result},serialize:function(a){var b="";try{b=JSON.stringify(a)}catch(c){}return b}}),define("appdebug/config",{socket:"ws://192.168.2.64:7681"}),define("paths/jsonpaths",{general:["lock","unlock","bookmark","unbookmark"],urls:{lock:{list:{run:"add_json_lock",sig:"lock"}},unlock:{list:{run:"add_json_lock",sig:"unlock"}},bookmark:{list:{run:"add_json_favorites",sig:"bookmark"}},unbookmark:{list:{run:"add_json_favorites",sig:"unbookmark"}},vod:{list:"vod_json_list"},iptv:{list:"iptv_json_list",epg:"epg_json_list"},radio:{list:"radio_json_list"},ppv:{list:"ppv_json_list"},aod:{list:"aod_json_list"},games:{skipParametrize:!0,list:"app/apps/games/list.js"},uservideo:{list:"uvideo_json_list"},weather:{units:{run:"get_cfgval_json",section:"system","var":"temperature"},city:{run:"get_cfgval_json",section:"system","var":"weather_code"}}},getPath:function(a,b){var c;typeof b=="undefined"&&(b="list");if(this.urls[a].skipParametrize)return this.urls[a][b];if(typeof this.urls[a][b]=="string")c={run:this.urls[a][b],newif:1};else{c={};for(var d in this.urls[a][b])c[d]=this.urls[a][b][d]}return c}}),define("env/exports",[],function(){return{exportSymbol:function(a,b){typeof window.exportedSymbols=="undefined"&&(window.exportedSymbols={}),typeof window.exportedSymbols[a]=="undefined"&&(window.exportedSymbols[a]={}),window.exportedSymbols[a][b.name]=b.symbol}}}),define("tpl/audio-player",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({"class":"audio-pannel"})),buf.push("><div"),buf.push(attrs({"class":"audio-display"})),buf.push("><div"),buf.push(attrs({"class":"audio-icons"})),buf.push("><div"),buf.push(attrs({"class":"play"})),buf.push("></div></div><div"),buf.push(attrs({"class":"audio-bar"})),buf.push("><div"),buf.push(attrs({"class":"audio-fill-cutter"})),buf.push("><div"),buf.push(attrs({style:"left:-100%;","class":"audio-fill-bar"})),buf.push("></div></div><div"),buf.push(attrs({"class":"audio-bar-bg"})),buf.push("></div></div><div"),buf.push(attrs({"class":"audio-time"})),buf.push("></div></div><div"),buf.push(attrs({"class":"audio-title"})),buf.push("></div></div>")}return buf.join("")}return{render:anonymous}}),define("oop/mix",[],function(){return function(a,b){var c;for(c in b)b.hasOwnProperty(c)&&(a.hasOwnProperty(c)&&(a[c+"_overridden"]=a[c]),a[c]=b[c]);return c}}),define("debug/log-keeper",[],function(){var a=function(){this.logRecords=[],this.pointer=0,this.logLevel=a.Levels.ALL,this.console=null};return a.prototype.maxRecords=100,a.prototype.setLogLevel=function(a){a<0&&(a=0),this.logLevel=a},a.prototype.addRecord=function(a){a.getLevel()>=this.logLevel&&(this.console!==null?(this.console.putRecord(a),a.dispose()):this.logRecords.length>=this.maxRecords?(this.logRecords[this.pointer]=a,this.pointer++):this.logRecords.push(a))},a.prototype.setConsole=function(a){var b;this.console=a;if(this.logRecords.length>0){for(b=this.pointer;b<this.logRecords.length;b++)this.console.putRecord(this.logRecords[b]),this.logRecords[b].dispose();if(this.pointer>0)for(b=0;b<this.pointer;b++)this.console.putRecord(this.logRecords[b]),this.logRecords[b].dispose()}delete this.logRecords,delete this.pointer},a.Levels={ALL:0,OK:1,FINE:2,INFO:3,WARN:4,ERROR:5,SHOUT:100,NONE:999999},a.getInstance=function(){var b=new a;return a.getInstance=function(){return b},b},a}),define("debug/logger",["debug/log-keeper","debug/log-record"],function(a,b){var c=function(a){this.name=a};return c.prototype.addRecord=function(c,d){a.getInstance().addRecord(new b(c,d,this.name))},c.prototype.error=function(a){this.addRecord(c.Levels.ERROR,arguments)},c.prototype.warn=function(){this.addRecord(c.Levels.WARN,arguments)},c.prototype.info=function(){this.addRecord(c.Levels.INFO,arguments)},c.prototype.fine=function(){this.addRecord(c.Levels.FINE,arguments)},c.prototype.ok=function(){this.addRecord(c.Levels.OK,arguments)},c.Levels=a.Levels,c}),define("net/socket",["json/json","debug/logger"],function(a,b){var c=function(b,c,d,e,f){this.url=b,this.isConnected=!1,this.shouldParse=typeof f=="boolean"?f:!0,this.protocol=c,this.sendQueue=[],typeof e=="undefined"&&(e=null),this.messageHandler=this.createMessageHandler(d,e),this.connect()};return c.prototype.logger_=new b("Socket"),c.prototype.createMessageHandler=function(b,c){var d=b,e=c,f=this.shouldParse;return function(b){d.call(e,f?a.parse(b.data):b.data)}},c.prototype.connect=function(){if(this.socket)return;try{this.socket=new WebSocket(this.url,this.protocol)}catch(a){try{this.socket=new MozWebSocket(this.url,this.protocol)}catch(a){this.logger_.warn("Web socket is not supported"),this.socket=null;return}}this.socket.onmessage=this.messageHandler,this.socket.onopen=this.setConnected.bind(this),this.socket.onclose=this.disposeInternal.bind(this)},c.prototype.setConnected=function(){var a;this.isConnected=!0;if(this.sendQueue.length>0)for(a=0;a<this.sendQueue.length;a++)this.send(this.sendQueue[a]);delete this.sendQueue},c.prototype.send=function(a){if(!this.url){this.logger_.error("The Object is already disposed, probably connection was terminated or did not success");return}if(typeof a!="string")return;this.isConnected?this.socket.send(a):this.sendQueue.push(a)},c.prototype.disposeInternal=function(){this.socket&&(this.socket.readyState<3&&this.socket.close(),this.socket.onmessage=null,this.socket.onopen=null,this.socket.onclose=null,this.socket=null,delete this.socket),delete this.url,delete this.protocol,this.messageHandler=null,delete this.messageHandler,this.sendQueue&&delete this.sendQueue,delete this.isConnected},{create:function(a,b,d,e){return new c(a,b,d,e)}}}),define("dmc/smjs",["net/socket","appdebug/config"],function(a,b){var c=function(){typeof window.transportReceiver=="function"&&window.transportReceiver.apply(null,Array.prototype.slice.call(arguments,0))};return typeof window.smjs!="undefined"?(document.querySelector("html").className="m55",window.smjs):(document.querySelector("html").className="browser",window.smjs={socket:null,set_json_handler:function(a){this.socket.send('{ "header" : { "transport":"socket", "mode":"async", "method":"set_global_callback", "type":"request", "tag":"0000" }, "request": { "name": "'+a+'" } }')},emulated:!0,initapi:function(){}},window.smjs.socket=a.create(b.socket,"stb-json-protocol",c),window.smjs.jsoncmd=function(a){if(this.socket!==null)this.socket.send(a);else throw Error("No socket has been created")},window.smjs)}),define("transport/request",["transport/requestdata","json/json","dmc/smjs","debug/logger"],function(a,b,c,d){var e=function(b,c){this.json=a.create(b,c)};return e.prototype.logger_=new d("JSON Request"),e.prototype.getRequestString=function(){return b.serialize(this.json)},e.prototype.send=function(){this.logger_.ok(this.getRequestString()),c.jsoncmd(this.getRequestString()),this.disposeInternal()},e.prototype.disposeInternal=function(){this.json.disposeInternal(),this.json=null,delete this.json},{create:function(a,b,c){return new e(a,b)}}}),define("utils/osd",["transport/request"],function(a){var b=function(){this.state_=b.OFF};return b.prototype.defaultTimeout_=3,b.prototype.defaultMessage_="",b.prototype.setContent=function(b,c,d){var e=a.create("osd",{action:"show",timeout:c||this.defaultTimeout_,message:b||this.defaultMessage_,icon:d});e.send()},b.prototype.clear=function(){var b=a.create("osd",{action:"hide"});b.send()},b.states={OFF:1,ON:2},b.instance_=null,b.getInstance=function(){return b.instance_===null&&(b.instance_=new b),b.instance_},b}),define("utils/events",["types/types","array/array","dmc/smjs","debug/logger"],function(a,b,c,d){function j(c,d){return a.assert(d,"function")&&b.has(f,c)?(i[c].push(d),!0):!1}function k(c,d){var e;if(a.assert(d,"function")&&b.has(f,c))for(e=i[c].length-1;e>0;e--)if(i[c][e]===d)return i[c].splice(e,1),!1;return!0}var e=new d("SimpleAppSelector"),f=["display","volup","voldown","mute","one","two","three","four","five","six","seven","eight","nine","zero","pound","star","recall","home","info","return","ok","left","right","up","down","chup","chdown","play","stop","ff","rw","rec","save","power","delete","setup","video","audio","web"],g=["zero","one","two","three","four","five","six","seven","eight","nine"],h=function(a){},i={};f.forEach(function(a){i[a]=[h]});var l=function(a){a&&i[a][i[a].length-1](a)},m=function(){c.initapi(),c.set_json_handler("window.transportReceiver")};return m(),{addHandlers:function(a){var b;for(b in a)a[b].attached===!1&&(a[b].attached=j(a[b].name,a[b].func))},removeHandlers:function(a){var b;for(b in a)a[b].attached===!0&&(a[b].attached=k(a[b].name,a[b].func));a},showAll:function(){e.warn("Event registry dump:",i)},getNumberEvent:function(){return g},defaultEventAccepter:l,initEvents:m}}),define("ui/player",["transport/request","shims/bind","data/static-strings","utils/events","array/array","tpl/audio-player","dom/dom","oop/mix","utils/datetime","debug/logger","ui/popup","utils/osd","env/exports"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n={fontname:"Tahoma",fontsize:15,timefmt:"us"},o=function(){this.state=o.STATES.STOPPED,this.keyHandler=b(this.handleKeys,this),this.timeout_=null,this.history_=null,this.current_=null,this.playlist_=null,this.shufflePlayList_=!1,this.visualPlayer=this.createPlayer(),this.vstate_=o.VSTATE.OPAQUE};return o.prototype.logger_=new j("UIPlayer"),o.prototype.recording_=!1,o.prototype.setRecording=function(a){this.recording_=a},o.prototype.useVisualPlayer_=!1,o.prototype.parentalPassword="",o.STATES={STOPPED:0,PLAYING:1,PAUSED:2},o.VSTATE={OPAQUE:0,TRANSLUSENT:1},o.dspStates={stopped:o.STATES.STOPPED,started:o.STATES.PLAYING,finished:o.STATES.STOPPED,nodata:o.STATES.STOPPED,paused:o.STATES.PAUSED,unpaused:o.STATES.PLAYING,buffering:o.STATES.PLAYING,playing:o.STATES.PLAYING,error:o.STATES.STOPPED},o.prototype.vstateName_="display",o.prototype.createPlayer=function(){var a={};return a.dom=g.getInnerNodes(f.render({})),a.trackname_="",a.trackName=g.$(".audio-title",a.dom),a.timeIndicator=g.$(".audio-time",a.dom),a.progressBar=g.$(".audio-fill-bar",a.dom),a.statusIndicator=g.$(".audio-icons div",a.dom),a.focus=function(a){a?this.dom.style.opacity=1:this.dom.style.opacity=.5},a.update=function(a,b,c){var d=0,e="",b=parseInt(b,10),c=parseInt(c,10),f=[this.timeIndicator],g=!1;isNaN(b)?e="0 / "+(isNaN(c)||c===0)?"0":c:(e+=i.parseTimeFromSeconds(b),!isNaN(c)&&c>0&&(e+=" - ",e+=i.parseTimeFromSeconds(c),d=parseInt(b/c*100,10),e+=" ("+d+"%)")),this.timeIndicator.textContent=e,a!==undefined&&a!==this.trackname_&&(this.trackname_=a,this.trackName.textContent=this.trackname_,g=!0),g&&f.push(this.trackName),this.progressBar.style.left=-100+d+"%"},a.clean=function(){this.update("",0,0)},a.setState=function(a){this.statusIndicator.className=a},a},o.prototype.getVState=function(){return this.vstate_},o.prototype.setVState=function(b){var c=a.create("display",{page:b===o.VSTATE.OPAQUE?"media":"ui"});c.send()},o.prototype.setOSDState=function(a){var b=this.current_[0];switch(a){case"started":case"playing":this.useVisualPlayer_?this.visualPlayer.setState("play"):l.getInstance().setContent(c.player.states.playing+b.title,5,"play");break;case"buffering":l.getInstance().setContent(c.player.states.buffering+b.title,5,"buffering");break;case"paused":this.useVisualPlayer_?this.visualPlayer.setState("pause"):l.getInstance().setContent(c.player.states.paused,5,"pause");break;default:}},o.prototype.setState=function(a){var b=this.state;o.AUDIO_TYPES.indexOf(this.current_[0].type)===-1&&this.setOSDState(a),this.state=o.dspStates[a],this.state===o.STATES.STOPPED&&exportedSymbols.tui.instance.restoreEventTree(this.keyHandler),b!==this.state&&(this.state===o.STATES.STOPPED?this.disableVisual():this.state===o.STATES.PLAYING&&(exportedSymbols.tui.instance.stealEvents(this.keyHandler),o.AUDIO_TYPES.indexOf(this.current_[0].type)!==-1&&(this.enableVisual(this.current_[0].publishName),this.visualPlayer.setState("play"))))},o.fastSwitchKeys=["zero","one","two","three","four","five","six","seven","eight","nine"],o.prototype.handleKeys=function(a){o.fastSwitchKeys.indexOf(a)!==-1&&d.defaultEventAccepter(a);switch(a){case"up":case"down":if(exportedSymbols.tui.instance.currentAppHasModelWithChannels()){a==="up"?exportedSymbols.tui.instance.currentActiveApp.model.activatePreviousItem():exportedSymbols.tui.instance.currentActiveApp.model.activateNextItem(),this.timeout_!==null&&clearTimeout(this.timeout_);var b=exportedSymbols.tui.instance.currentActiveApp.model.getItem();this.timeout_=window.setTimeout(function(){exportedSymbols.tui.instance.currentActiveApp.fire("try-play",b)},500)}break;case"stop":this.stop();break;case"play":this.pause();break;case"display":this.state!==o.STATES.STOPPED&&(exportedSymbols.tui.instance.restoreEventTree(this.keyHandler),this.useVisualPlayer_?this.visualPlayer.focus(!1):this.setVState(o.VSTATE.TRANSLUSENT));break;case"recall":this.alterChannels();break;case"power":break;case"rec":this.record();break;default:return}},o.prototype.defaultRecordingPath="/mnt/usb/",o.prototype.pathSeparator="/",o.prototype.record=function(a){a?object=a:object=this.current_[0];if(!object.personalRecordingOptions||!object.personalRecordingOptions.canRecord)return;var b=new Date,c=this.defaultRecordingPath+object.publishName;c+=this.pathSeparator,c+=b.getFullYear(),c+=this.pathSeparator,c+=b.getMonth()+1,c+=this.pathSeparator,c+=b.getDate(),c+=this.pathSeparator,c+=b.getHours()+":"+b.getMinutes()},o.AUDIO_TYPES=["radio","music","useraudio"],o.VIDEO_TYPES=["iptv","ppv","vod","uservideo"],o.IMAGE_TYPES=["userpicture"],o.prototype.alterChannels=function(){this.logger_.ok(this.history_),this.history_&&this.history_.length===2&&(this.stop(),this.play.apply(this,this.history_))},o.prototype.getState=function(){return this.state},o.prototype.playAll=function(a,b){this.playlist_=a,this.shufflePlayList_=b},o.responseRegistry=null,o.setResponseRegistry=function(a){o.responseRegistry=a},o.prototype.play=function(d,f,g,h){this.logger_.fine("Try to play uri:",d.playURI,"pass",g,"shoul resume",f);var i;if(d.isLocked){this.state!==o.STATES.STOPPED&&(this.state=o.STATES.STOPPED,this.stop()),this.parentalPassword===""&&(i=a.create("calld",{run:"get_cfgval_json",section:"streaming","var":"lockpass"}),o.responseRegistry.register(i,b(this.setParentalPass,this)),i.send());if(typeof g!="string"){k.createDialog("password",!1,b(this.play,this,d,f),c.components.dialogs.lock);return}if(g!==this.parentalPassword){k.createDialog("message",undefined,undefined,c.components.dialogs.wrongPassword);return}}if(typeof d.cost!="undefined"&&d.cost>0){if(typeof h=="undefined"){this.state!==o.STATES.STOPPED&&(this.state=o.STATES.STOPPED,this.stop()),k.createDialog("confirm",null,b(this.play,this,d,f,g),c.components.dialogs.confirmPay+d.cost+d.currency+"<br>"+d.publishName);return}if(h!==1)return}var j=d.player?"play_youtube":"play",l=!1;this.addToHistory([d,g]),this.notifyOSD(d),e.has(o.AUDIO_TYPES,d.type)?(this.enableVisual(d.publishName),l=!0):e.has(o.VIDEO_TYPES,d.type)&&this.disableVisual(),i=a.create(j,{url:d.playURI,resume:f,audio:l}),o.responseRegistry.register(i,b(this.requestResultHandle,this,exportedSymbols.tui.instance,d.title,"play")),i.send()},o.prototype.notifyOSD=function(b){h(b,n),this.logger_.fine("Notify osd",b);var c=a.create("mediainfo",b);c.send(b)},o.prototype.enableVisual=function(a){this.logger_.fine("Enable visual mode of player"),this.useVisualPlayer_=!0,g.adopt(this.visualPlayer.dom),this.visualPlayer.focus(!0),this.visualPlayer.update(a)},o.prototype.disableVisual=function(){this.useVisualPlayer_=!1,g.dispose(this.visualPlayer.dom),this.visualPlayer.clean()},o.prototype.addToHistory=function(a){this.history_=this.current_,this.current_=a},o.prototype.setParentalPass=function(a){a.content&&(this.parentalPassword=a.content)},o.prototype.stop=function(b){var c=a.create("stop",{});c.send()},o.prototype.pause=function(){var b=a.create("pause",{});b.send()},o.prototype.requestResultHandle=function(a,b,d){l.getInstance().setContent(c.player.states.starting+b,10,d)},o.prototype.handleEvent=function(a){switch(a.header.method){case"media":this.setState(a.event.state);break;case"player":this.handlePlaybackInfo(a.event);break;default:}},o.prototype.handlePlaybackInfo=function(a){this.useVisualPlayer_&&this.visualPlayer.update(undefined,a.current_position,a.duration)},o.instance_=null,o.getInstance=function(){return o.instance_===null&&(o.instance_=new o),o.instance_},o}),define("transport/response",["debug/logger","ui/popup","ui/player"],function(a,b,c){var d=null,e={OK:"OK",FAIL:"FAIL"},f={},g=function(a){this.json=a,this.findCallback()};return g.prototype.logger_=new a("JSONResponse"),g.prototype.findCallback=function(){var a=this.json.header.tag;switch(this.json.header.type){case"response":if(typeof f[a]!="undefined"){if(!!this.json.response){switch(this.json.response.status){case e.FAIL:break;default:}f[a][0].call(f[a][1],this.json.response)}delete f[a]}break;case"event":switch(this.json.header.method){case"media":c.getInstance().handleEvent(this.json);break;case"player":c.getInstance().handleEvent(this.json);break;case"remote":d!==null&&d(this.json.event.key);break;case"msgbox":b.createDialog("message",undefined,undefined,this.json.event.title+"<br>"+this.json.event.message);break;case"telephony":window.exportedSymbols.telephony.setLineStatus(this.json.event);break;case"cmd":switch(this.json.event.action){case"reloadconfig":exportedSymbols.tui.instance.refreshConfig();break;case"refreshdata":exportedSymbols.tui.instance.refreshLists();break;case"reloadinterface":this.logger_.info("Reload interface came from remote"),window.location.reload(!0);break;case"reload_lists":this.logger_.info("Reload lists command arrived");break;default:}break;default:}break;case"reply":break;default:}this.disposeInternal()},g.prototype.disposeInternal=function(){this.json=null,delete this.json},responseRegistry={register:function(a,b,c){f[a.json.header.tag]=[b,c]},recall:function(a){new g(a)},setRemoteKeyHandler:function(a){d=a},getRemoteKeyHandler:function(){return d}},c.setResponseRegistry(responseRegistry),responseRegistry}),define("debug/time-provider",[],function(){var a=function(){this.relativeTimeStart_=new Date};return a.prototype.get=function(){return this.relativeTimeStart_},a.prototype.reset=function(){this.set(new Date)},a.prototype.set=function(a){this.relativeTimeStart_=a},new a}),define("string/strings",{newLineToBr:function(a){return a.replace(/(\r\n|\r|\n)/g,"<br>")}}),define("debug/expose",[],function(){return function(a){if(typeof a=="undefined")return"undefined";if(a===null)return"NULL";var b=[];for(var c in a){var d=c+" = ";try{d+=a[c]}catch(e){d+="*** "+e+" ***"}b.push(d)}return b.join("\n")}}),define("debug/log-formaters",["debug/time-provider","string/strings","debug/expose"],function(a,b,c){function d(a){return a}function e(a){return JSON.stringify(a)}function f(b){var c=+b.getTime()- +a.get(),d=c/1e3,e=d.toFixed(3),f=0;if(d<1)f=2;else while(d<100)f++,d*=10;while(f-->0)e=" "+e;return e}function g(a){var b=Array.prototype.slice.call(a.getMessage(),0);return Array.prototype.unshift.call(b,a.getLoggerName()),b}function h(a){var d=[],e;d.push('<span class="dbg-timestamp">['+a[0]+"]</span>"),d.push('<span class="dbg-logger-name">'+a[1]+"</span>"),d.push('<span class="dbg-log-record">');for(e=2;e<a.length;e++){switch(typeof a[e]){case"number":case"string":case"boolean":d.push(a[e].toString());break;case"object":a[e]instanceof Array?d.push(a[e].toString()):a[e]===null?d.push("NULL"):d.push(b.newLineToBr(c(a[e])));break;default:console.log("wtf?",a[e])}e<a.length-1&&d.push(", ")}return d.push("</span>"),d.join("")}function i(a){var b=g(a);return b[0]="["+b[0]+"]: ",Array.prototype.unshift.call(b,f(a)),b}function j(a){switch(typeof a){case"undefined":return"UNDEFINED";case"object":return c(a);case"boolean":return a?"TRUE":"FALSE";default:return a}}function k(a){var b=i(a);b.unshift("LEVEL-"+a.getLevel());for(var c=0;c<b.length;c++)b[c]=j(b[c]);return b}return{echo:d,json:e,webkitConsole:g,browser:i,html:function(a){return h(i(a))},text:k,getRelativeTime:f}}),define("debug/simple-console",["debug/log-keeper","debug/log-formaters"],function(a,b){var c=function(){this.initStream_(),this.formatter_=b.browser};return c.prototype.initStream_=function(){this.stream_=typeof window!="undefined"?window.console:console;if(typeof this.stream_!="object")throw Error("Console interface is not supported")},c.prototype.putRecord=function(b){var c;switch(b.getLevel()){case a.Levels.SHOUT:case a.Levels.ERROR:c="error";break;case a.Levels.WARN:c="warn";break;case a.Levels.INFO:c="info";break;default:c="log"}this.stream_[c].apply(this.stream_,this.formatter_(b))},c.prototype.setFormatter=function(a){this.formatter_=a},c.prototype.enable=function(){a.getInstance().setConsole(this)},c}),define("tpl/appselector2",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({"class":"screenChooserWrapper screenChooser"})),buf.push("><div"),buf.push(attrs({"class":"tui-component screen-selector-pointer"})),buf.push("></div><div"),buf.push(attrs({"class":"filler"})),buf.push("></div>");for(var i=0;i<apps.length;i++)buf.push("<div"),buf.push(attrs({"data-appname":""+apps[i].apptag+"","data-sequence":i,"class":"screen approtator-item "+apps[i].apptag})),buf.push("></div>");buf.push("<div"),buf.push(attrs({"class":"filler"})),buf.push("></div></div>")}return buf.join("")}return{render:anonymous}}),define("data/applist",{welcome:{name:"Welcome",apptag:"welcome",module:"apps/start",info:'<img style="margin-right: 10px;"src="app/imgs/warning.png" />Welcome Feature:<br> <span style="font-size: 80%">you can show branding information here or any important messages the user must see when the device is turned on.<br>The message can be text or HTML, images are also supported</span>'},iptv:{name:"",apptag:"iptv",module:"apps/iptv",icon:"imgs/start_screen_icon.png",info:'IPTV Feature:<br> <span style="font-size: 80%">Provides live channels to watch and optionally includes EPG data for the provided channels</span>'},vod:{name:"",apptag:"vod",module:"apps/vod",info:'Video on Demand Feature<br><span style="font-size: 80%">Includes video files</span>'},ppv:{name:"",apptag:"ppv",module:"apps/ppv",info:'Pey Per View Feature:<br> <span style="font-size: 80%">Includes video streams that are payed content</span>'},uservideo:{name:"",apptag:"uservideo",module:"apps/uvideo",info:'User Folders Feature:<br> <span style="font-size: 80%">Implements DLNA servise discovery and browsing</span>'},youtube:{name:"",apptag:"youtube",module:"apps/youtube",info:'YouTube Feature:<br> <span style="font-size: 80%">Watch YouTube videos on your TV</span>'},aod:{name:"",apptag:"aod",module:"apps/aod",info:'Audio On Demand Feature:<br> <span style="font-size: 80%">Audio files and music</span>'},radio:{name:"",apptag:"radio",module:"apps/radio",info:'Online Radio:<br> <span style="font-size: 80%">List of online radio stations you can listent to on your TV set</span>'},games:{name:"",apptag:"games",module:"apps/games",info:'Games Feature:<br> <span style="font-size: 80%">Provides list of entertaining games to play on the TV</span>'},weather:{name:"",apptag:"weather",module:"apps/weather",info:"Weather forecast"},setup:{name:"",apptag:"setup",module:"apps/setup",info:'Setup Feature:<br> <span style="font-size: 80%">Configurable device options</span>'}}),define("utils/sizes",{pixelate:function(a){return a+"px"},depixelate:function(a){return parseInt(a,10)},getSizesForWindow:function(){return{width:this.depixelate(window.innerWidth),height:this.depixelate(window.innerHeight)}},getSizesForEPG:function(){return{width:this.depixelate(this.getSizesForWindow().width*70/100),height:this.depixelate(this.getSizesForWindow().height),listHeight:this.depixelate(this.getSizesForWindow().height)-90-60}},getSizesForAppselector:function(a){return{padding:this.depixelate(this.getSizesForWindow().height/2-a/2)}},getSizesForGameLayer:function(){var a=this.getSizesForWindow();return{width:a.width,height:a.height}},getStyle:function(a){var b="",c;for(c in a)b=b+c+": "+a[c]+"px; ";return b}}),define("ui/simplescreenselector",["tpl/appselector2","data/applist","dom/dom","dom/classes","utils/events","utils/sizes","env/exports","array/array","json/json","shims/bind","debug/logger"],function(a,b,c,d,e,f,g,h,i,j,k){function l(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(a[c]);return b}var m=function(){this.shortCuts_={},this.currentScreen=null,this.controllerInstance_=null,this.itemSize=90,this.internalAppList=l(b),this.currentScreen=null,this.setupDom(),this.boundShourtCutExecution=j(this.executeShortCut,this),this.moduleEvent={one:{name:"one",func:this.boundShourtCutExecution,attached:!1},two:{name:"two",func:this.boundShourtCutExecution,attached:!1},three:{name:"three",func:this.boundShourtCutExecution,attached:!1},four:{name:"four",func:this.boundShourtCutExecution,attached:!1},five:{name:"five",func:this.boundShourtCutExecution,attached:!1},six:{name:"six",func:this.boundShourtCutExecution,attached:!1},seven:{name:"seven",func:this.boundShourtCutExecution,attached:!1},eight:{name:"eight",func:this.boundShourtCutExecution,attached:!1},nine:{name:"nine",func:this.boundShourtCutExecution,attached:!1},zero:{name:"zero",func:this.boundShourtCutExecution,attached:!1},up:{name:"up",func:j(function(a){this.triggerScreen(!1)},this),attached:!1},down:{name:"down",func:j(function(a){this.triggerScreen(!0)},this),attached:!1},hide:{name:"return",func:j(this.hideDOMm,this),attached:!1},loadApp:{name:"ok",func:j(this.selectApp,this),attached:!1},addShortCut:{name:"pound",func:j(this.addShortcutNow,this),attached:!1}}};m.prototype.logger_=new k("AppSelector"),m.prototype.addShortcutNow=function(){m.boundSaveShirtCut===null&&(m.boundSaveShirtCut=j(this.saveShortCut,this)),this.controllerInstance_.stealEvents(m.boundSaveShirtCut)},m.boundSaveShirtCut=null,m.prototype.saveShortCut=function(a,b){h.has(e.getNumberEvent(),a)&&this.saveShortCut_(a,b),this.controllerInstance_.restoreEventTree(m.boundSaveShirtCut)},m.prototype.saveShortCut_=function(a,b){this.shortCuts_[a]=b||c.dataGet(this.currenScreen,"appname"),window.localStorage.setItem("shortcuts",i.serialize(this.shortCuts_))},m.prototype.executeShortCut=function(a){this.shortCuts_[a]&&b[this.shortCuts_[a]]&&(this.updateSelectedAppInUI(b[this.shortCuts_[a]]),this.selectApp(b[this.shortCuts_[a]]))},m.prototype.show=function(){this.showAppSel()},m.prototype.setControllerInstance=function(a){this.controllerInstance_=a},m.prototype.setupDom=function(){this.padding=f.pixelate(f.getSizesForAppselector(90).padding),this.DOM=c.getInnerNodes(a.render({apps:this.internalAppList})),this.DOM.style.height=f.pixelate(f.getSizesForWindow().height);var b=c.$$(".filler",this.DOM);for(var d=0;d<b.length;d++)b[d].style.height=this.padding;c.$(".screen-selector-pointer",this.DOM).style.top=f.depixelate(this.padding)-12+"px",this.currenScreen=c.$(".approtator-item",this.DOM),this.baloon=c.create("p",{classes:"text-baloon"}),this.baloon_wrapper=c.create("div",{style:"position: absolute; right: 200px; display: table; height: 100%; top:0;",html:'<div style=" display: table-cell; vertical-align: middle; ">'}),this.baloon_wrapper.firstChild.appendChild(this.baloon),this.baloon_wrapper.firstChild.appendChild(c.create("p",{style:'content: ""; position: absolute; border-style: solid; display: -webkit-inline-box; width: 0; border-color: transparent hsl(204, 70%, 38%); top: 49%; right: -40px; border-width: 10px 0 10px 40px;'}))},m.prototype.relocateTo=function(a){this.DOM.scrollTop=this.itemSize*a},m.prototype.triggerScreen=function(a){var e=a?"nextElementSibling":"previousElementSibling";this.currenScreen[e]!==null&&d.hasClass(this.currenScreen[e],"approtator-item")&&(this.currenScreen=this.currenScreen[e],this.updateBaloonInfo(b[c.dataGet(this.currenScreen,"appname")].info),this.relocateTo(c.dataGet(this.currenScreen,"sequence")))},m.prototype.updateBaloonInfo=function(a){a&&a.length>0?(this.baloon.innerHTML=a,c.adopt(this.baloon_wrapper)):c.dispose(this.baloon_wrapper)},m.prototype.updateSelectedAppInUI=function(a){var d=0,e,f;for(e in b){if(b[e]===a){f=d;break}d++}var g=c.$$(".approtator-item",this.DOM);this.currenScreen=g[f]},m.prototype.selectApp=function(a){typeof a=="string"&&(a=b[c.dataGet(this.currenScreen,"appname")]);var e=c.$(".obscure");e!==null&&d.removeClasses(e,"obscure"),this.hideDOM(),this.controllerInstance_.loadApp(a)},m.prototype.hideDOM=function(){e.removeHandlers(this.moduleEvent),this.SelectorState=!1,c.dispose(this.DOM),this.updateBaloonInfo()},m.prototype.isActive=function(){return this.SelectorState},m.prototype.showAppSel=function(){if(this.controllerInstance_===null)throw Error("Global controller is not defined");this.controllerInstance_.looseFocusForAppSelector(),this.SelectorState=!0,e.addHandlers(this.moduleEvent),c.adopt(document.body,this.DOM),this.relocateTo(c.dataGet(this.currenScreen,"sequence")),this.updateBaloonInfo(b[c.dataGet(this.currenScreen,"appname")].info)},m.prototype.SelectorState=!1;var n=new m;return e.addHandlers({appselector:{name:"home",func:j(n.showAppSel,n),attached:!1}}),n}),define("tui/tui",["debug/logger","utils/datetime","utils/osd","dom/dom","dom/classes","ui/load-indicator","data/static-strings","ui/simplescreenselector","config/options","paths/jsonpaths","shims/bind","array/array","transport/response","utils/events","ui/player","env/exports"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){var q=function(a){this.lastRefreshTimeStamp_=b.getCurrentTime(),this.mainContainer=d.$("#maincontainer"),this.options=a,this.currentActiveApp=null,this.appRequested=!1,this.paths_=j,this._queue_=[]};q.listingApp=["iptv","vod","ppv","aod","radio","uservideo"],q.prototype.getPaths=function(){return this.paths_},q.prototype.getGlobalPlayer=function(){return o.getInstance()},q.prototype.restoreEventTree=function(a){this.logger_.warn("Removing an event"),l.remove(this._queue_,a),l.isEmpty(this._queue_)?(this.logger_.warn("Event que clean, restore defaults"),m.setRemoteKeyHandler(n.defaultEventAccepter),this.eventsAreFetched=!1):m.setRemoteKeyHandler(l.last(this._queue_))},q.prototype.eventsAreFetched=!1,q.prototype.init=function(){f.hide(),h.setControllerInstance(this),h.show()},q.prototype.logger_=new a("TUI"),q.keyboardIgnoredKeys=[34,8,46,37,38,39,40,13,36],q.osdInstance=c.getInstance(),q.defaultKeyboardInputHandler=function(a){this.logger_.ok(String.fromCharCode(a.charCode))},q.prototype.keyboardInputHandler_=function(){},q.prototype.resetKeyboardInputHandler=function(){this.keyboardInputHandler_=q.defaultKeyboardInputHandler},q.prototype.setKeyboardInputHandler=function(a){this.keyboardInputHandler_=a},q.prototype.currentAppHasModelWithChannels=function(){if(this.currentActiveApp&&this.currentActiveApp.model)if(this.currentActiveApp.model.activateNextItem||this.currentActiveApp.model.activatePreviousItem)return!0;return!1},q.prototype.fastSwitchChannels=function(a){this.currentAppHasModelWithChannels()&&(a==="down"?this.currentActiveApp.model.activateNextItem():this.currentActiveApp.model.activatePreviousItem())},q.prototype.appModuleAdded=function(a){this.currentActiveApp=a,h.isActive()||a.Start()},q.prototype.panelsAreEnabled=function(){return this.options&&this.options.PANELS_ENABLED?!0:!1},q.prototype.useContainerScale=function(){return this.options&&this.options.USE_SCALE?!0:!1},q.prototype.setPanels=function(a,b,c,d){this.panelsAreEnabled()&&(a?(c&&(q.panels.top.innerHTML=c),q.panels.top.style.top="0px",this.mainContainer.style.marginTop="40px"):(q.panels.top.style.top="-40px",this.mainContainer.style.marginTop="0px",q.panels.top.innerHTML=""),b?(d&&(q.panels.infoBlock.innerHTML=d),q.panels.bottom.style.bottom="0px",this.mainContainer.style.marginBottom="40px"):(q.panels.bottom.style.bottom="-40px",this.mainContainer.style.marginBottom="0px",q.panels.infoBlock.innerHTML=""))},q.prototype.scaleContainer=function(a){var b=this.mainContainer;if(a)if(this.useContainerScale()){b.className="scaled";var c=parseInt(this.mainContainer.style.width,10),d=parseInt(this.mainContainer.style.height,10),e=parseInt(c*20/100,10),f=parseInt(d*20/100,10),g=parseInt(c/2,10)-parseInt(e/2,10),h="scale(0.2) translateX("+g*5+"px)";b.style.webkitTransform=h,b.style.MozTransform=h}else b.style.visibility="hidden";else this.useContainerScale()?(b.className="",b.style.MozTransform="scale(1)",b.style.webkitTransform="scale(1)"):b.style.visibility=""},q.prototype.loadApp=function(a){f.show(g.common.load_indication+a.name+"..."),this.currentActiveApp!==null&&(typeof this.currentActiveApp.Pause=="function"?this.currentActiveApp.Pause():this.currentActiveApp.Stop()),require([a.module],k(function(a){this.appModuleAdded(a.init())},this))},q.prototype.getContainer=function(){return this.mainContainer},q.prototype.setContainerVisibility=function(a){a?this.mainContainer.style.opacity=.2:this.mainContainer.style.opacity=1},q.prototype.stealEvents=function(a){l.has(this._queue_,a)||(this._queue_.push(a),m.setRemoteKeyHandler(l.last(this._queue_)),this.logger_.warn("Events are now stolen"),this.eventsAreFetched=!0)},q.prototype.showApp=function(){f.hide(),this.setContainerVisibility(!1),this.currentActiveApp.Show(this.getContainer())},q.prototype.looseFocusForAppSelector=function(){this.setContainerVisibility(!0),this.setPanels(!1,!1),e.addClasses(this.getContainer(),"obscure")},q.prototype.refreshLists=function(){this.logger_.warn("refreshing the list"),this.lastRefreshTimeStamp_=b.getCurrentTime(),l.has(q.listingApp,this.currentActiveApp.name)&&(this.currentActiveApp.cancelData(),this.appModuleAdded(this.currentActiveApp))},q.prototype.handleAppSignals=function(a,b){switch(a){case"ready":this.currentActiveApp.name===b.name&&this.showApp();break;case"restore-event-stack":this.restoreEventTree();break;default:}};if(i.PANELS_ENABLED){var r=function(){function c(a){var b=(a%60).toString();return b.length<2&&(b="0"+b),b}var a=null,b;return function(d){d&&(a=d),b&&clearTimeout(b);var e=new Date,f=e.getDate()+"/"+(e.getMonth()+1).toString()+"/"+e.getFullYear()+" "+e.getHours()+":"+c(e.getMinutes());a.innerHTML=f,b=setTimeout(r,6e4)}}();q.panels={top:d.create("div",{classes:"tui-component panels top-panel",style:"top : -40px;"}),bottom:d.create("div",{classes:"tui-component panels bottom-panel",style:"bottom: -40px"})},q.panels.bottom.appendChild(d.create("div",{html:"<h1></h1>",classes:"tui-component tui-systemclock"})),r(d.$(".tui-systemclock h1",q.panels.bottom)),q.panels.infoBlock=d.create("div",{classes:"tui-component tui-infoblock"}),q.systemClock=r,d.adopt(q.panels.bottom,q.panels.infoBlock),d.adopt(q.panels.top),d.adopt(q.panels.bottom)}return q.instance_=null,q.getInstance=function(){return q.instance_===null&&(q.instance_=new q(i),p.exportSymbol("tui",{name:"instance",symbol:q.instance_})),q.instance_},q.prototype.selectApp=function(a){h.executeShortCut(a)},q}),define("oop/ievent",["oop/inherit","oop/idisposable"],function(a,b){var c=function(){b.call(this),this.eventRegistry_=[]};return a(c,b),c.prototype.on=function(a,b,c){var d={method:b,parameters:c};this.eventRegistry_.hasOwnProperty(a)||(this.eventRegistry_[a]=[]),this.eventRegistry_[a].push(d)},c.prototype.fire=function(a){var b,c,d,e,f=typeof a=="string"?a:a.type,g;arguments.length>1&&(g=Array.prototype.slice.call(arguments,1));if(this.eventRegistry_.hasOwnProperty(f)){b=this.eventRegistry_[f];for(e=0;e<b.length;e++)d=b[e],c=d.method,typeof c=="string"&&(c=this[c]),c.apply(this,g||d.parameters||[a])}},c.prototype.removeAll=function(){},c.prototype.disposeInternal=function(){this.constructor.superClass_.disposeInternal.call(this),this.removeAll(),delete this.eventRegistry_},c}),define("utils/defaultapp",["oop/inherit","oop/ievent","tui/tui"],function(a,b,c){var d=function(a){b.call(this),this.setName(a?a.name:null),this.registerWithTUI()};return a(d,b),d.prototype.name="UnnamedApp",d.prototype.setName=function(a){typeof a=="string"&&(this.name=a)},d.prototype.registerWithTUI=function(){this.on("start-ready",this.setStateReady)},d.prototype.setStateReady=function(){c.getInstance().handleAppSignals("ready",{name:this.name})},d.prototype.disposeInternal=function(){d.superClass_.disposeInternal.call(this),delete this.name},d}),define("utils/visualapp",["oop/inherit","utils/defaultapp","utils/events"],function(a,b,c){var d=function(a){b.call(this,a)};return a(d,b),d.prototype.container=null,d.prototype.Start=function(){this.fire("start-requested")},d.prototype.Show=function(a){this.container=a,this.fire("show-requested")},d.prototype.Stop=function(){this.fire("stop-requested")},d.prototype.disposeInternal=function(){this.constructor.superClass_.disposeInternal.call(this),this.container!==null&&delete this.container},d.prototype.attachEvents=function(a){typeof this.appEvents=="object"&&(a?c.addHandlers(this.appEvents):c.removeHandlers(this.appEvents))},d}),define("net/simplexhr",["json/json"],function(a){function b(a){return new XMLHttpRequest}function c(a){return a.substring(a.indexOf("{")-1,a.lastIndexOf("}")+1)}return{get:function(d,e,f){f=f||{stripJSON:!1},typeof f.stripJSON=="undefined"&&(f.stripJSON=!1);var g=b();g.open("GET",d,!0),g.onreadystatechange=function(b){var d;g.readyState==4&&(g.status==200?(g.responseText[0]==="L"?d=c(g.responseText):d=g.responseText,f.parse===!0&&(d=a.parse(d)),e(d,g)):e(null),g.onreadystatechange=null,g=null)},g.send(null)},getMany:function(a,b,c){var d=0,e=a.length,f=[],g=[],h=this,i=function(){b(g)},j=function(a,b){g[a]=b,d+=1,d==e&&i()};for(var k=0;k<e;k++)(function(b){h.get(a[b],function(a){j(b,a)},c)})(k)},blockGet:function(){}}}),define("model/listmodel",["types/types","array/array","oop/idisposable","oop/inherit","net/simplexhr","shims/bind","ui/simplescreenselector","transport/request","data/static-strings","paths/jsonpaths","ui/load-indicator","tui/tui"],function(a,b,c,d,e,f,g,h,i,j,k,l){var m=function(a){c.call(this),this.app=a,this.history=[],this.currentIndex=0,this.data={list:[],dirs:{},epg:null},this.isLoaded=!1,this.pointer=null,this.isLoading=!1,this.bound=f(this.loadDir,this),this.lastLoadedTS=null};return d(m,c),m.prototype.wipe=function(){this.history.length=0,this.currentIndex=0,this.data.list.length=0,this.data.dirs={},this.data.epg=null,this.isLoaded=!1,this.isLoading=!1,this.pointer=this.data.list},m.prototype.loadData=function(a){var b=a.url||j.getPath(a.name,a.type),c=this;e.get(b,function(b){c.load(b,a)},{parse:!0}),this.app.fire("data-load-start")},m.prototype.acceptEvent=function(a){if(this.isLoading||this.app.updateInProcess)return;var b=this.app.presentation.getStep(),c=this.app.presentation.getHStep();switch(a.action){case"chdown":this.currentIndex+b*c<this.pointer.length&&this.app.presentation.activate(this.currentIndex+b*c);break;case"chup":this.currentIndex-b*c>=0&&this.app.presentation.activate(this.currentIndex-b*c);break;case"right":if(b===1){this.data.epg!==null&&this.app.fire("epg-selection",!0);return}this.currentIndex+1<this.pointer.length&&this.app.presentation.activate(this.currentIndex+1);break;case"left":if(b===1){this.data.epg!==null&&this.app.fire("epg-selection",!1);return}this.currentIndex>0&&this.app.presentation.activate(this.currentIndex-1);break;case"down":this.currentIndex+b<this.pointer.length?this.app.presentation.activate(this.currentIndex+b):this.app.presentation.activate(0);break;case"up":this.currentIndex-b>-1?this.app.presentation.activate(this.currentIndex-b):this.app.presentation.activate(this.data.list.length-1);break;case"ok":this.enterDir()===!1&&(this.getItem().id===null?this.outDir():this.app.fire("try-play",this.getItem()));break;case"return":this.pointer.length>0&&this.pointer[0].id===null?this.outDir():g.show();break;case"recall":this.app.presentation.reset(!0),this.app.Stop();var d=h.create("calld",{run:"refresh_media_json"});d.send(),k.show(i.common.refresh+this.app.name.toUpperCase());break;default:}},m.prototype.selectByIndex=function(a){a<this.pointer.length&&(this.currentIndex=a,this.app.presentation.activate(this.currentIndex))},m.prototype.activateNextItem=function(){var a=this.currentIndex,b=null;for(a++;a<this.pointer.length;a++)if(this.pointer[a].isDir===!1&&this.pointer[a].id!==null){b=a;break}if(b===null){a=0;for(;a<this.currentIndex;a++)if(this.pointer[a].isDir===!1&&this.pointer[a].id!==null){b=a;break}}b!==null&&this.selectByIndex(b)},m.sortById=function(a,b){var c=parseInt(a.id,10),d=parseInt(b.id,10);return c>d?1:c<d?-1:0},m.sortByName=function(a,b){var c=a.publishName.toLowerCase(),d=b.publishName.toLowerCase();return c>d?1:c<d?-1:0},m.sortByIndex=function(a,b){var c=a.isBookmarked?1:0,d=b.isBookmarked?1:0,e=parseInt(a.sortIndex,10),f=parseInt(b.sortIndex,10);return c!=d?c<d?1:c>d?-1:0:e<f?-1:e>f?1:0},m.prototype.sort=function(a){this.pointer.length>0&&(this.pointer.sort(m[a]),this.app.presentation.reset(!0),this.app.fire("data-load-end",{type:this.history.length>0?"folder":"list"}))},m.prototype.activatePreviousItem=function(){var a=this.currentIndex-1,b=null;for(;a>=0;a--)if(this.pointer[a].isDir===!1&&this.pointer[a].id!==null){b=a;break}if(b===null){a=this.pointer.length-1;for(;a>this.currentIndex;a--)if(this.pointer[a].isDir===!1&&this.pointer[a].id!==null){b=a;break}}b!==null&&this.selectByIndex(b)},m.prototype.outDir=function(){var a=this.history.pop();this.pointer=a.dir,this.app.fire("data-load-end",{type:"folder",index:a.index})},m.prototype.enterDir=function(){var a=this.getItem(),b={};if(typeof a.isDir!="undefined"&&a.isDir!==!1){this.isLoading=!0;for(var c in a.isDir)b[c]=a.isDir[c];return b.newif=1,this.loadData({url:b,type:"folder",callback:this.bound}),!0}return!1},m.prototype.loadDir=function(a){this.data.dirs[this.pointer[this.currentIndex].id]=a,this.history.push({dir:this.pointer,index:this.currentIndex}),this.pointer=this.data.dirs[this.pointer[this.currentIndex].id],this.isLoading=!1},m.prototype.getItem=function(b){var c=a.assert(b,"number")?b:this.currentIndex;return this.pointer[c]},m.prototype.get=function(b){b=a.assert(b,"string")?b:"list";if(b==="list")return this.pointer;if(b==="epg")return this.data.epg},m.prototype.load=function(a,c){if(a===null)throw{name:"NetworkError",message:"Cannot get requested URL : "};switch(c.type){case"list":this.data.list=a,b.isEmpty(this.history)&&(this.pointer=this.data.list),this.isLoaded=!0,this.lastLoadedTS=(new Date).getTime(),this.lastLoadedTS>l.getInstance().lastRefreshTimeStamp_&&(this.pointer=this.data.list);break;case"folder":a.unshift({id:null,sortIndex:0,publishName:"..",type:"",time:"",cost:0,currency:null,genre:"FOLDER",thumbnail:"app/imgs/mosaic-folder.png",settings:function(){return!1},isLocked:!1,isBookmarked:!1,personalRecordingOptions:{canRecord:!1},isDir:!1});break;case"epg":this.data.epg=a;break;default:}typeof c.callback=="function"&&c.callback(a),this.app.fire("data-load-end",{type:c.type,app:this.app.name})},m.prototype.getPropertyFromItem=function(a,b){var c=this.getItem(b);return c[a]},m.prototype.getEPGForItem=function(a){if(this.data.epg===null)return null;var b=this.getPropertyFromItem("id",a);return this.getEPGForItemByID(b)},m.prototype.getEPGForItemByID=function(a){return this.data.epg[a]?this.data.epg[a].body:[]},m.prototype.unload=function(){},m.prototype.disposeInternal=function(){m.superClass_.disposeInternal.call(this)},m}),define("model/listmodel2",["model/listmodel","oop/inherit","json/json","transport/request","transport/response","shims/bind","paths/jsonpaths"],function(a,b,c,d,e,f,g){var h=function(b){a.call(this,b)};return b(h,a),h.prototype.loadData=function(a){var b=a.url||g.getPath(a.name,a.type),c=d.create("calld",b);e.register(c,f(this.load,this,a)),c.send(),this.app.fire("data-load-start")},h.prototype.load=function(a,b){var d;b.status.toLowerCase()==="ok"&&typeof b.content=="string"&&(d=c.parse(b.content)),h.superClass_.load.call(this,d,a)},h}),define("tpl/mosaiclist",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({style:"width:"+w,"data-appid":id,"class":"tui-mosaic list-container"})),buf.push(">");if(things.length>0)for(var i=0;i<things.length;i++){buf.push("<div"),buf.push(attrs({"data-sequence":i,"class":"item "+(alterClass?"larger":"regular")})),buf.push(">"),things[i].thumbnail.length<5?(buf.push("<div"),buf.push(attrs({"class":"imgcont"})),buf.push("><div"),buf.push(attrs({"class":"imgcontin"})),buf.push("></div><div"),buf.push(attrs({"class":"default_icon screen_default_icon_size"})),buf.push("></div></div>")):(buf.push("<div"),buf.push(attrs({"class":"imgcont"})),buf.push("><div"),buf.push(attrs({"class":"imgcontin"})),buf.push("></div><img"),buf.push(attrs({src:things[i].thumbnail})),buf.push("/></div>")),buf.push("<span"),buf.push(attrs({"class":"title"})),buf.push(">");var __val__=things[i].publishName;buf.push(null==__val__?"":__val__),buf.push("</span><ul"),buf.push(attrs({"class":"channel-settings-icons"})),buf.push(">"),things[i].isLocked&&(buf.push("<li"),buf.push(attrs({"class":"icon locked"})),buf.push("></li>")),things[i].isBookmarked&&(buf.push("<li"),buf.push(attrs({"class":"icon bookmarked"})),buf.push("></li>")),things[i].cost>0&&(buf.push("<li"),buf.push(attrs({"class":"icon paid"})),buf.push("></li>")),buf.push("</ul>");if(!/[^0-9]/.test(things[i].id)){buf.push("<div"),buf.push(attrs({"class":"object-index"})),buf.push(">");var __val__=things[i].sortIndex;buf.push(null==__val__?"":__val__),buf.push("</div>")}things[i].isDir!==!1&&(buf.push("<div"),buf.push(attrs({"class":"folder-icon"})),buf.push("></div>")),buf.push("</div>")}else{buf.push("<div"),buf.push(attrs({"class":"no-content"})),buf.push(">");var __val__=nocontentstring;buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("</div>")}return buf.join("")}return{render:anonymous}}),define("text!css/mosaic.css",function(){return".tui-mosaic.list-container {\n\tmargin: 10px auto 10px auto;\n\tposition: relative;\n\t/*if we really need the height...*/\n\toverflow: auto;\n\ttop: 0;\n}\nhtml.browser .tui-mosaic.list-container {\n\t-webkit-transition-property: top;\n\t-webkit-transition-duration: 0.8s;\n}\n.tui-mosaic.list-container .no-content {\n\tmargin: 30% auto;\n\tborder: 2px solid #3E6EBB;\n\tborder-radius: 4px;\n\tpadding: 35px 0 35px 0;\n\tcolor: white;\n\tfont-weight: inherit;\n\tpadding: 4% 20%;\n\ttext-align: center;\n\tfont-size: 135%;\n\twidth: 49%;\n}\n.tui-mosaic .item.regular {\n width: 150px;\n height: 130px;\n}\n.tui-mosaic .item.larger {\n\twidth: 210px;\n\theight: 190px;\n}\n.tui-mosaic .item {\n/* do not use - attributes to +1/+2 px in positioning (offsetTop)\n\tdisplay: inline-block;\n*/\n float: left;\n text-align: center;\n \tpadding: 5px 5px 5px 5px;\n\tposition: relative;\n}\n.tui-mosaic .larger .imgcont {\n\twidth: 200px;\n\theight: 160px;\n}\n.tui-mosaic .regular .imgcont{\n\twidth: 140px;\n\theight: 100px;\n\toverflow: hidden;\n}\n/*------------ start-Rating-bar ----------------*/\n.tui-mosaic .regular .imgcont .video-bar {\n\theight: 15px;\n\twidth: 70px;\n\tbackground: rgba(0, 0, 0, 0.4);\n\tborder-radius: 3px;\n\tposition: absolute;\n\tborder-bottom-style: solid;\n\tborder-width: 1px 1px 1px 1px;\n\tborder-bottom-color: rgba(255, 255, 255, 0.2);\n\tborder-left-color: rgba(255, 255, 255, 0.3);\n\tborder-left-style: solid;\n\tright: 9px;\n}\n.tui-mosaic .regular .imgcont .video-bar .rating_bar {\n\twidth: 66px;\n\tbackground: url(../imgs/icon-favorite-grey.png) 0 0 repeat-x;\n\tbackground-size: 13px;\n}\n\n.tui-mosaic .regular .imgcont .video-bar .rating_bar div {\n\theight: 17px;\n\tbackground: url(../imgs/icon_favorite.png) 0 0 repeat-x;\n\tbackground-size: 13px;\n}\n/*------------- end-Ratin-bar -------------------*/\n.tui-mosaic .imgcont {\n\t-webkit-transition: background-color 1.2s;\n\t-webkit-border-radius: 3px;\n\tfloat: left;\n\tmargin-left: 5px;\n\tbackground: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(51,78,114,0.9)), color-stop(4%,rgba(51,78,114,0)), color-stop(96%,rgba(51,78,114,0)), color-stop(100%,rgba(51,78,114,0.9)));\n}\n.tui-mosaic .imgcontin {\n\theight: 100px;\n\twidth: 140px;\n\tborder-radius: 3px;\n\tposition:absolute;\n\tbackground: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(51,78,114,0.9)), color-stop(4%,rgba(51,78,114,0)), color-stop(96%,rgba(51,78,114,0)), color-stop(100%,rgba(51,78,114,0.9)));\n}\n.tui-mosaic .item.regular img {\n /*width: 130px;*/\n height: 90px;\n}\n.tui-mosaic .item.larger img {\n\twidth: 190px;\n\theight: 150px;\n}\n.tui-mosaic .item img {\n\tborder-radius: 3px;\n padding: 5px;\n /*display: block;\n margin: auto auto 2px auto;\n */\n}\n.tui-mosaic .title {\n\tfloat:left; \n\ttext-align:center;\n\tdisplay:block;\n\twidth: 100%;\n\toverflow: hidden;\n/*\twhite-space: nowrap;\n\ttext-overflow: ellipsis;*/\n\theight: 33px;\n}\n\n.tui-mosaic .icon {\n\tbackground-position: center center;\n\tbackground-repeat: no-repeat;\n\twidth: 20px;\n\theight: 20px;\n\tbackground-color: rgba(0, 0, 0, 0.3);\n\tmargin-bottom: 1px;\n}\n\n.tui-mosaic ul.channel-settings-icons {\n\tmargin: 0;\n\tpadding:0; \n\tlist-style-type:none;\n\tposition: absolute;\n\ttop: 3px;\n\tleft: 9px;\t\n}\n.tui-mosaic div.object-index {\n\tbackground-color: rgba(0, 0, 0, 0.4);\n font-weight: bold;\n padding: 2px 4px;\n position: absolute;\n\tleft: 10px;\n\ttop: 85px;\n}\n.tui-mosaic .item.current .imgcont {\nbackground: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(198,222,255,0.9)), color-stop(1%,rgba(104,151,221,0.75)), color-stop(3%,rgba(30,105,222,0.45)), color-stop(6%,rgba(30,105,222,0)), color-stop(94%,rgba(30,105,222,0)), color-stop(97%,rgba(30,105,222,0.45)), color-stop(99%,rgba(104,151,221,0.75)), color-stop(100%,rgba(198,222,255,0.9)));\n}\n.tui-mosaic .item.current .imgcontin {\nbackground: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(198,222,255,0.9)), color-stop(1%,rgba(104,151,221,0.75)), color-stop(3%,rgba(30,105,222,0.45)), color-stop(6%,rgba(30,105,222,0)), color-stop(94%,rgba(30,105,222,0)), color-stop(97%,rgba(30,105,222,0.45)), color-stop(99%,rgba(104,151,221,0.75)), color-stop(100%,rgba(198,222,255,0.9)));\n}\n.tui-mosaic .item.current span {\n color: rgba(153, 206, 255, 1);\n}\n.tui-mosaic .icon.locked {\n\tbackground-image: url('../imgs/icon_lock.png');\n}\n.tui-mosaic .icon.bookmarked {\n\tbackground-image: url('../imgs/icon_favorite.png');\n}\n.tui-mosaic .icon.recordable {\n\tbackground-image: url('../imgs/icon_recording.png');\n}\n.tui-mosaic .icon.paid {\n\tbackground-image: url('../imgs/icon_dollar.png');\n}\n.item .imgcont .screen_default_icon_size {\n\twidth: 130px; \n\theight: 90px;\n\tmargin: 5px;\n}\n.item .default_icon {\n\tbackground-image: url('../imgs/icon_set.png');\n}\ndiv[data-appid=\"iptv\"] .item .default_icon {\n\tbackground-position: center -3px;\n}\ndiv[data-appid=\"ppv\"] .item .default_icon {\n\tbackground-position: center -104px;\n}\ndiv[data-appid=\"vod\"] .item .default_icon {\n\tbackground-position: center -205px;\n}\ndiv[data-appid=\"uservideo\"] .item .default_icon {\n\tbackground-position: center -306px;\n}\ndiv[data-appid=\"radio\"] .item .default_icon {\n\tbackground-position: center -407px;\n}\ndiv[data-appid=\"aod\"] .item .default_icon {\n\tbackground-position: center -508px;\n}\n.tui-mosaic div.folder-icon {\n\tbackground: url('../imgs/folder.png') no-repeat;\n\tbackground-size: contain;\n\tposition: absolute;\n\twidth: 43px;\n\theight: 43px;\n\tright: 11px;\n\ttop: 73px; \n}\n"}),define("view/mosaictemplate",["tpl/mosaiclist","text!css/mosaic.css","loader/loader","oop/idisposable","oop/inherit","data/static-strings"],function(a,b,c,d,e,f){var g=function(a,b){d.call(this),this.w=window.innerWidth,this.h=window.innerHeight,this.iw=a||this.iw,this.ih=b||this.ih,this.vh=window.innerHeight-60-10,this.iw>g.prototype.iw&&(this.alterClass=!0)};return e(g,d),g.prototype.alterClass=!1,g.prototype.iw=160,g.prototype.ih=140,g.prototype.getStep=function(){return Math.floor(this.w/this.iw)},g.prototype.getHStep=function(){return Math.floor(this.h/this.ih)},g.prototype.getULWidth=function(){return this.w-this.w%this.iw},g.prototype.getULLeft=function(){return this.w%this.iw/2+"px"},g.prototype.getItemHeight=function(){return this.ih},g.prototype.rasterize=function(b,c){return a.render({alterClass:this.alterClass,things:b,id:c,w:this.getULWidth()+"px",nocontentstring:f.lists.noContent})},g.prototype.disposeInternal=function(){this.constructor.superClass_.disposeInternal.call(this),delete this.w,delete this.h,delete this.iw,delete this.ih,delete this.vh},g}),define("tpl/list",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({style:"width:"+w,"data-appid":id,"class":"tui-list list-container"})),buf.push(">");for(var i=0;i<things.length;i++){buf.push("<div"),buf.push(attrs({"data-sequence":i,"class":"item"})),buf.push("><div"),buf.push(attrs({"class":things[i].thumbnail!==null?"leftCont":"leftContLong"})),buf.push(">");if(things[i].sortIndex!=="0"&&things[i].sortIndex!==0){buf.push("<h1"),buf.push(attrs({"class":"number_id"})),buf.push(">");var __val__=things[i].sortIndex;buf.push(null==__val__?"":__val__),buf.push("</h1>")}else buf.push("<h1"),buf.push(attrs({"class":"number_id"})),buf.push("></h1>");buf.push("<h2"),buf.push(attrs({"class":"item_name"})),buf.push(">");var __val__=things[i].publishName;buf.push(null==__val__?"":__val__),buf.push("</h2>");if(things[i].genre){buf.push("<div"),buf.push(attrs({"class":"description"})),buf.push(">");var __val__="Genre:"+things[i].genre;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things[i].time){buf.push("<div"),buf.push(attrs({"class":"description"})),buf.push(">");var __val__="Time:"+things[i].time;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things[i].cost){buf.push("<div"),buf.push(attrs({"class":"description"})),buf.push(">");var __val__="Cost:"+things[i].cost;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things[i].size){buf.push("<div"),buf.push(attrs({"class":"description"})),buf.push(">");var __val__="Size:"+things[i].size;buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("</div>"),things[i].isDir!==!1?(buf.push("<div"),buf.push(attrs({"class":"rightCont-folder"})),buf.push("></div>")):things[i].thumbnail.length>5&&(buf.push("<div"),buf.push(attrs({"class":"rightCont"})),buf.push("><img"),buf.push(attrs({src:things[i].thumbnail,"class":"img_thumb"})),buf.push("/></div>")),buf.push("<ul"),buf.push(attrs({"class":"channel-settings-icons"})),buf.push(">"),things[i].isLocked&&(buf.push("<li"),buf.push(attrs({"class":"icon locked"})),buf.push("></li>")),things[i].isBookmarked&&(buf.push("<li"),buf.push(attrs({"class":"icon bookmarked"})),buf.push("></li>")),things[i].cost>0&&(buf.push("<li"),buf.push(attrs({"class":"icon paid"})),buf.push("></li>")),buf.push("</ul></div>")}buf.push("</div>")}return buf.join("")}return{render:anonymous}}),define("text!css/list.css",function(){return'.tui-list.list-container {\n\ttext-align: center;\n\tmargin: 10px auto 10px auto;\n\tposition: absolute;\n}\n.tui-list .item {\n\tmargin: 0.3em auto 0 auto;\n\twidth: 94%;\n\theight: 3.4em;\n\ttext-align: left;\n\t-moz-box-pack: center;\n\t-webkit-box-pack: center;\n\tborder-radius: 0.3em;\n\t-moz-border-radius: 0.3em;\n\t-webkit-border-radius: 0.3em;\n\t-ms-border-radius: 0.3em;\n\tborder: 2px solid #3E5170;\n\tcolor: white;\n\tposition: relative;\n\t/*\n\tbackground-image: linear-gradient(bottom, rgb(74,80,92) 4%, rgb(39,44,52) 49%, rgb(74,80,92) 93%);\n\tbackground-image: -o-linear-gradient(bottom, rgb(74,80,92) 4%, rgb(39,44,52) 49%, rgb(74,80,92) 93%);\n\tbackground-image: -moz-linear-gradient(bottom, rgb(74,80,92) 4%, rgb(39,44,52) 49%, rgb(74,80,92) 93%);\n\tbackground-image: -webkit-linear-gradient(bottom, rgb(74,80,92) 4%, rgb(39,44,52) 49%, rgb(74,80,92) 93%);\n\tbackground-image: -ms-linear-gradient(bottom, rgb(74,80,92) 4%, rgb(39,44,52) 49%, rgb(74,80,92) 93%);\n\n\tbackground-image: -webkit-gradient(\n\t\tlinear,\n\t\tleft bottom,\n\t\tleft top,\n\t\tcolor-stop(0.04, rgb(74,80,92)),\n\t\tcolor-stop(0.49, rgb(39,44,52)),\n\t\tcolor-stop(0.93, rgb(74,80,92))\n\t);\t*/\n}\n.tui-list.list-container .current {\n\t/*background-color: gray;\n\tbackground-image: none;\n\tborder: 2px solid #b74e02;\n\t\n box-shadow:inset 0 0 10px #000000;\n\t-moz-box-shadow:inset 0 0 10px #000000;\n \t-webkit-box-shadow:inset 0 0 10px #000000;\n\t-ms-box-shadow:inset 0 0 10px #000000;*/\n\tborder: 2px solid #1E69D1;\n\tbackground: -webkit-gradient(linear, left top, left bottom, color-stop(2%,rgba(198, 222, 255, 0.9)), color-stop(4%,rgba(104, 151, 221, 0.75)), color-stop(5%,rgba(30, 105, 222, 0.45)), color-stop(50%,rgba(30, 105, 222, 0)), color-stop(96%,rgba(30, 105, 222, 0)), color-stop(96%,rgba(30, 105, 222, 0.45)), color-stop(98%,rgba(104, 151, 221, 0.75)), color-stop(100%,rgba(198, 222, 255, 0.9)));\n\n}\n.tui-list.list-container .current .number_id {\n\tcolor: #d08b05;\n/*\tborder-right: 5px solid #d3d2d2;\n\tbox-shadow:\t10px 0 10px -10px #555555;\n\t-moz-box-shadow: 10px 0 10px -10px #555555;\n\t-webkit-box-shadow: 10px 0 10px -10px #555555;\n\t-ms-box-shadow: 10px 0 10px -10px #555555;\t*/\n}\n\n.tui-list .leftCont {\n\tfloat: left;\n\twidth: 88%;\n\theight: 80%;\n\tpadding: 0.5em;\n}\n.tui-list .leftContLong {\n\tfloat: left;\n\twidth: 99%;\n\theight: 80%;\n\tpadding: 0.5em;\n}\n\n.tui-list .rightCont {\n\theight: 40px;\n\twidth: 53px;\n\ttext-align: right;\n\tdisplay: -webkit-inline-box;\n\tmargin-top:3px;\n}\n.tui-list .rightCont-folder {\n\tfloat: right;\n\twidth: 57px;\n\theight: 38px;\n\toverflow-x: hidden;\n\toverflow-y: hidden;\n\tbackground: url(../imgs/folder.png) no-repeat;\n\tbackground-size: contain;\n\tmargin: 4px 4px 0 0;\n}\n.tui-list .leftCont .number_id {\n\tcolor: #b4b3ae;\n float: left;\n font-size: 1.3em;\n font-weight: bold;\n height: 100%;\n margin-right: 0.5em;\n text-align: center;\n width: 70px;\n line-height: 1em;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\toverflow: hidden;\n}\n\n.tui-list .leftContLong .number_id {\n\tcolor: #b4b3ae;\n float: left;\n font-size: 1.3em;\n font-weight: bold;\n height: 100%;\n margin-right: 0.5em;\n text-align: center;\n width: 70px;\n line-height: 1em;\n}\n\n.tui-list .item_name {\n font-size: 1.1em;\n font-weight: bold;\n height: 50%;\n\t-moz-box-pack:center;\n\t-moz-box-align:center;\n\t-webkit-box-pack:center;\n\t-webkit-box-align:center;\n\toverflow: hidden;\n\twhite-space: nowrap;\n\ttext-overflow: ellipsis;\n}\n.tui-list .img_thumb {\n\tborder: 0;\n\twidth: 100%;\n\tdisplay: -webkit-box;\n}\n.tui-list .description {\n\tdisplay: inline-block;\n\tmargin-right: 20px;\n}\n.tui-list .channel-settings-icons {\n\tleft: 11px;\n list-style-type: none;\n position: absolute;\n bottom: 2px;\n}\n\n.tui-list.list-container .icon {\n\t/*background-color: #596876;*/\n background-position: center center;\n background-repeat: no-repeat;\n height: 20px;\n margin-right: 1px;\n width: 20px;\n float: left; \n}\n.tui-list.list-container .bookmarked {\n\tbackground-image: url("../imgs/icon_favorite.png");\n}\n.tui-list.list-container .recordable {\n\tbackground-image: url("../imgs/icon_recording.png");\n}\n.tui-list.list-container .locked {\n\tbackground-image: url("../imgs/icon_lock.png");\n}\n.tui-list.list-container .paid {\n\tbackground-image: url(\'../imgs/icon_dollar.png\');\n}\n'}),define("view/listtemplate",["tpl/list","text!css/list.css","loader/loader","view/mosaictemplate","oop/inherit"],function(a,b,c,d,e){var f=function(a,b){d.call(this,undefined,64)};return e(f,d),f.prototype.getStep=function(){return 1},f.prototype.rasterize=function(b,c){return a.render({things:b,id:c,w:this.getULWidth()+"px"})},f}),define("tpl/youtube",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({style:"width:"+w,"data-appid":id,"class":"tui-mosaic list-container"})),buf.push(">");if(things.length>0)for(var i=0;i<things.length;i++){buf.push("<div"),buf.push(attrs({"data-sequence":i,"class":"item "+(alterClass?"larger":"regular")})),buf.push("><div"),buf.push(attrs({"class":"imgcont"})),buf.push("><div"),buf.push(attrs({"class":"imgcontin"})),buf.push("></div><div"),buf.push(attrs({"class":"video-bar"})),buf.push("><div"),buf.push(attrs({"class":"rating_bar"})),buf.push("><div"),buf.push(attrs({style:"width:"+things[i].starRating+"%"})),buf.push("></div></div></div><img"),buf.push(attrs({src:things[i].thumbnail.sqDefault})),buf.push("/></div><span"),buf.push(attrs({"class":"title"})),buf.push(">");var __val__=things[i].title;buf.push(null==__val__?"":__val__),buf.push("</span></div>")}else{buf.push("<div"),buf.push(attrs({"class":"no-content"})),buf.push(">");var __val__=nocontentstring;buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("</div>")}return buf.join("")}return{render:anonymous}}),define("view/youtubetemplate",["tpl/youtube","view/mosaictemplate","oop/inherit","data/static-strings"],function(a,b,c,d){var e=function(a,c){b.call(this)};return c(e,b),e.prototype.rasterize=function(b,c){return a.render({alterClass:this.alterClass,things:b,id:c,w:this.getULWidth()+"px",nocontentstring:d.lists.noContent})},e}),define("view/mosaicpresentation",["dom/dom","dom/attributes","dom/classes","view/mosaictemplate","view/listtemplate","view/youtubetemplate","oop/idisposable","oop/inherit","tui/tui"],function(a,b,c,d,e,f,g,h,i){function j(a){var b=window.getComputedStyle(a,null);return{w:b.getPropertyValue("width"),h:b.getPropertyValue("height")}}var k=function(a,b,c,h,i){g.call(this),this.app=a,b==="mosaic"||!b?this.template=new d(c,h):b==="youtube"?this.template=new f(c,h):this.template=new e(c,h),this.registerDisposable(this.template),this.shouldJump=i||this.shouldJump};return h(k,g),k.prototype.shouldJump=!1,k.prototype.isRendered_=!1,k.prototype.reset=function(a){this.isRendered_=!1,a&&(this.container.innerHTML="")},k.prototype.updateItem=function(b,c){var d=a.$('div[data-sequence="'+b+'"]'),e=a.$(".channel-settings-icons",d),f=a.$(".locked",e),g=a.$(".bookmarked",e);c.isLocked&&f===null?a.adopt(e,a.create("li",{classes:"icon locked"})):!c.isLocked&&f!==null&&a.dispose(f),c.isBookmarked&&g===null?a.adopt(e,a.create("li",{classes:"icon bookmarked"})):!c.isBookmarked&&g!==null&&a.dispose(g)},k.prototype.show=function(a,b){this.app.fire("show-start"),typeof a!="undefined"&&a!==null&&(this.container=a),this.rasterize_(undefined,b),this.app.fire("show-complete")},k.prototype.rasterize_=function(b,c){if(this.container===null)return;!this.isRendered_||c?(typeof b=="undefined"&&(b=0),this.container.innerHTML=this.template.rasterize(this.app.model.get("list"),this.app.name),this.dom=this.container.firstChild,this.app.model.get("list").length>0&&this.activate(b),this.isRendered_=!0):(this.container.innerHTML="",a.adopt(this.container,this.dom))},k.prototype.activate=function(b){var d=a.$(".item.current",this.container),e=a.$$(".item",this.container);d!==null&&c.removeClasses(d,"current"),c.addClasses(e[b],"current");var f=parseInt(i.getInstance().getContainer().style.marginTop,10),g=parseInt(i.getInstance().getContainer().style.marginBottom,10),h=a.$(".list-container"),j=e[b].offsetTop,k=parseInt(h.style.top,10)||0,l=this.template.getItemHeight(),m=0;Math.abs(k)+window.innerHeight<j+l+f+g?(this.shouldJump?m="-"+j+"px":m="-"+(j+l-window.innerHeight+f+g)+"px",h.style.top=m):Math.abs(k)>j&&(this.shouldJump?(m=j+l-window.innerHeight+f+g,m<0?m=0:m="-"+m,m+="px"):m="-"+j+"px",h.style.top=m),this.app.fire("selection-changed",{index:b})},k.prototype.getStep=function(){return this.template.getStep()},k.prototype.getHStep=function(){return this.template.getHStep()},k.prototype.unload=function(){this.container.innerHTML=""},k.prototype.disposeInternal=function(){this.constructor.superClass_.disposeInternal.call(this),delete this.container,delete this.shouldJump,delete this.dom},k}),define("view/paginator",[],function(){var a=function(a){this.container=a||window,this.update_()};return a.prototype.getItemsPerPage_=function(a,b){var c=this.getItemsPerRow_(a,b),d=this.getItemsPerColumn_(a,b);return c*d},a.prototype.getItemsPerRow_=function(a,b){return Math.floor(this.w/a)},a.prototype.getItemsPerColumn_=function(a,b){return Math.floor(this.h/b)},a.prototype.update_=function(){this.w=this.container.innerWidth,this.h=this.container.innerHeight},a.prototype.update=function(){this.update_()},new a}),define("tpl/partials",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({style:"width:"+width,"data-appid":name,"class":"tui-mosaic list-container"})),buf.push(">");if(data.length>startIndex){for(var i=startIndex;i<endIndex;i++)if(data.length>i){buf.push("<div"),buf.push(attrs({"data-sequence":i,"class":"item "+(alterClass?"larger":"regular")})),buf.push(">"),data[i].thumbnail.length<5?(buf.push("<div"),buf.push(attrs({"class":"imgcont"})),buf.push("><div"),buf.push(attrs({"class":"imgcontin"})),buf.push("></div><div"),buf.push(attrs({"class":"default_icon screen_default_icon_size"})),buf.push("></div></div>")):(buf.push("<div"),buf.push(attrs({"class":"imgcont"})),buf.push("><div"),buf.push(attrs({"class":"imgcontin"})),buf.push("></div><img"),buf.push(attrs({src:data[i].thumbnail})),buf.push("/></div>")),buf.push("<span"),buf.push(attrs({"class":"title"})),buf.push(">");var __val__=data[i].publishName;buf.push(null==__val__?"":__val__),buf.push("</span><ul"),buf.push(attrs({"class":"channel-settings-icons"})),buf.push(">"),data[i].isLocked&&(buf.push("<li"),buf.push(attrs({"class":"icon locked"})),buf.push("></li>")),data[i].isBookmarked&&(buf.push("<li"),buf.push(attrs({"class":"icon bookmarked"})),buf.push("></li>")),data[i].cost>0&&(buf.push("<li"),buf.push(attrs({"class":"icon paid"})),buf.push("></li>")),buf.push("</ul>");if(!/[^0-9]/.test(data[i].id)){buf.push("<div"),buf.push(attrs({"class":"object-index"})),buf.push(">");var __val__=data[i].sortIndex;buf.push(null==__val__?"":__val__),buf.push("</div>")}data[i].isDir!==!1&&(buf.push("<div"),buf.push(attrs({"class":"folder-icon"})),buf.push("></div>")),buf.push("</div>")}}else{buf.push("<div"),buf.push(attrs({"class":"no-content"})),buf.push(">");var __val__=nocontentstring;buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("</div>")}return buf.join("")}return{render:anonymous}}),define("view/partials",["oop/inherit","oop/idisposable","dom/dom","view/paginator","dom/classes","tpl/partials","loader/loader","text!css/mosaic.css","data/static-strings"],function(a,b,c,d,e,f,g,h,i){var j=function(a,c,d,e,f,g){b.call(this),this.app=a,this.itemWidth=d||this.itemWidth,this.itemHeight=e||this.itemHeight,this.template=g||this.defaultTemplate,this.registerDisposable(this.template),this.shouldJump=f||this.shouldJump,this.dom_=null};return a(j,b),j.prototype.getDataInternal=function(){return this.app.model.get("list")},j.prototype.getData=function(){return this.getDataInternal()},j.prototype.setPage=function(){this.page_=Math.floor(this.dataIndex/this.itemsPerPage_)},j.prototype.getPage=function(){return this.page_},j.prototype.getAppName=function(){return this.app.name},j.prototype.rasterizeInternal=function(a){if(this.container===null)return;typeof a!="undefined"&&(this.dataIndex=a),this.setPage(),this.dom_=c.getInnerNodes(this.template.render({alterClass:!1,name:this.getAppName(),data:this.getData(),startIndex:this.getStartIndex(),endIndex:this.getStartIndex()+this.itemsPerPage_,width:this.getULWidth()+"px",nocontentstring:i.lists.noContent})),this.container.innerHTML="",c.adopt(this.container,this.dom_),this.activate(this.dataIndex)},j.prototype.getULWidth=function(){return d.w-d.w%this.itemWidth},j.prototype.getStartIndex=function(){return this.getPage()*this.itemsPerPage_},j.prototype.unload=function(){},j.prototype.activateItemInternal=function(){var a,b,d;this.dataIndex>=this.getStartIndex()&&this.dataIndex<this.getStartIndex()+this.itemsPerPage_?(a=c.$(this.activateItemCSSSelector,this.container),b=c.$$(this.itemCSSSelector,this.container),a!==null&&e.removeClasses(a,this.activeCSSClass),d=this.dataIndex-this.getStartIndex(),e.addClasses(b[d],this.activeCSSClass),this.app.fire("selection-changed",{index:this.dataIndex})):this.rasterizeInternal()},j.prototype.activate=function(a){this.getData().length>a&&(this.dataIndex=a,this.activateItemInternal())},j.prototype.updateItem=function(a,b){if(a>=this.getStartIndex()&&a<this.getStartIndex()+this.itemsPerPage_){var d=c.$('div[data-sequence="'+a+'"]'),e=c.$(".channel-settings-icons",d),f=c.$(".locked",e),g=c.$(".bookmarked",e);b.isLocked&&f===null?c.adopt(e,c.create("li",{classes:"icon locked"})):!b.isLocked&&f!==null&&c.dispose(f),b.isBookmarked&&g===null?c.adopt(e,c.create("li",{classes:"icon bookmarked"})):!b.isBookmarked&&g!==null&&c.dispose(g)}},j.prototype.reset=function(){},j.prototype.show=function(a,b){this.app.fire("show-start"),typeof a!="undefined"&&a!==null&&(this.container=a,this.container_=this.container,this.itemsPerPage_=d.getItemsPerPage_(this.itemWidth,this.itemHeight)),this.rasterizeInternal(undefined,b),this.app.fire("show-complete")},j.prototype.disposeInternal=function(){j.superClass_.disposeInternal.call(this),this.app=null,delete this.itemWidth,delete this.itemHeight,this.template=null,delete this.shouldJump,delete this.isRendered_,this.dom_=null,delete this.itemsPerPage_,delete this.dataIndex,delete this.page_,delete this.container_},j.prototype.getStep=function(){return this.app.epgInstance&&this.app.epgInstance.isVisible()?1:d.getItemsPerRow_(this.itemWidth,this.itemHeight)},j.prototype.getHStep=function(){return this.app.epgInstance&&this.app.epgInstance.isVisible()?1:d.getItemsPerColumn_(this.itemWidth,this.itemHeight)},j.prototype.itemWidth=160,j.prototype.itemHeight=140,j.prototype.shouldJump=!1,j.prototype.isRendered_=!1,j.prototype.container=null,j.prototype.defaultTemplate=f,j.prototype.dataIndex=0,j.prototype.itemsPerPage_,j.prototype.activateItemCSSSelector=".item.current",j.prototype.itemCSSSelector=".item",j.prototype.containerCSSSelector=".list-container",j.prototype.activeCSSClass="current",j.prototype.page_=0,j}),define("oop/clone",[],function(){var a=function(b){var c=typeof b;if(c=="object"||c=="array"&&b!==null){var d=c=="array"?[]:{};for(var e in b)d[e]=a(b[e]);return d}return b};return a}),define("tpl/nflist",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({"class":channel.thumbnail!==null?"leftCont":"leftContLong"})),buf.push(">");if(channel.sortIndex!=="0"&&channel.sortIndex!==0){buf.push("<h1"),buf.push(attrs({"class":"number_id"})),buf.push(">");var __val__=channel.id;buf.push(null==__val__?"":__val__),buf.push("</h1>")}else buf.push("<h1"),buf.push(attrs({"class":"number_id"})),buf.push("></h1>");buf.push("<h2"),buf.push(attrs({"class":"item_name"})),buf.push(">");var __val__=channel.publishName;buf.push(null==__val__?"":__val__),buf.push("</h2>");if(channel.genre){buf.push("<div"),buf.push(attrs({"class":"description"})),buf.push(">");var __val__="Genre:"+channel.genre;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(channel.time){buf.push("<div"),buf.push(attrs({"class":"description"})),buf.push(">");var __val__="Time:"+datetime.parseTimeFromSeconds(channel.time);buf.push(null==__val__?"":__val__),buf.push("</div>")}if(channel.cost){buf.push("<div"),buf.push(attrs({"class":"description"})),buf.push(">");var __val__="Cost:"+channel.cost;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(channel.size){buf.push("<div"),buf.push(attrs({"class":"description"})),buf.push(">");var __val__="Size:"+channel.size;buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("</div>"),channel.isDir!==!1?(buf.push("<div"),buf.push(attrs({"class":"rightCont-folder"})),buf.push("></div>")):channel.thumbnail.length>5&&(buf.push("<div"),buf.push(attrs({"class":"rightCont"})),buf.push("><img"),buf.push(attrs({src:channel.thumbnail,"class":"img_thumb"})),buf.push("/></div>")),buf.push("<ul"),buf.push(attrs({"class":"channel-settings-icons"})),buf.push(">"),channel.isLocked&&(buf.push("<li"),buf.push(attrs({"class":"icon locked"})),buf.push("></li>")),channel.isBookmarked&&(buf.push("<li"),buf.push(attrs({"class":"icon bookmarked"})),buf.push("></li>")),channel.cost>0&&(buf.push("<li"),buf.push(attrs({"class":"icon paid"})),buf.push("></li>")),buf.push("</ul>")}return buf.join("")}return{render:anonymous}}),define("ui/nflist",["dom/dom","dom/classes","tpl/nflist"],function(a,b,c){var d=function(b,c,e){this.app=b,this.dataAccessor_=c,typeof e=="number"&&(this.itemHeight_=e),this.dataPointer_=0,this.elements_=[],this.onscreen_=[],this.beforescreen_=[],this.afterscreen_=[],this.activeChannelElement_=null,d.enableAnimation_&&a.adopt(document.head,d.animationStyleElement)};return d.prototype.contentBox_,d.prototype.isDomConstructed_=!1,d.prototype.isVisible_=!1,d.prototype.mainContainerCssClass="tui-nflist-container",d.prototype.transitionContainerCssClass="tui-vertical-transition-container",d.prototype.listItemCssClass="tui-nflist-item",d.prototype.listItemActiveCssClass="active",d.prototype.itemHeight_=70,d.prototype.rows_=0,d.prototype.horizontalPadding=0,d.prototype.verticalPadding=0,d.enableAnimation_=!1,d.animationDuration_=300,d.composeAnimationStyle=function(){var a="."+d.prototype.listItemCssClass+"{ -webkit-transition: -webkit-transform ";return a+=d.animationDuration_,a+="ms; }",a},d.animationStyleElement=function(){return a.create("style",{text:d.composeAnimationStyle()})}(),d.prototype.reEnterDom=function(){a.adopt(this.contentBox_,this.container_),this.isVisible_=!0},d.prototype.enterDom=function(b,c){this.app.fire("show-start"),c?(this.dataPointer_=0,this.createTransElements_()):b!==undefined?b!==this.contentBox_&&(this.contentBox_=b,this.constructDom(!0)):this.contentBox_?this.setItemsContent():(this.contentBox_=document.body,this.constructDom(!0)),this.isVisible_=!0,a.adopt(this.contentBox_,this.container_),this.app.fire("show-complete")},d.prototype.constructDom=function(b){if(this.isDomConstructed_&&b!==!0)return;this.container_=a.create("div",{classes:this.mainContainerCssClass}),this.transContainer_=a.create("div",{classes:this.transitionContainerCssClass}),a.adopt(this.container_,this.transContainer_),this.transWidth_=parseInt(this.contentBox_.style.width,10),this.transHeight_=parseInt(this.contentBox_.style.height,10),this.container_.style.width=this.transWidth_+"px",this.container_.style.height=this.transHeight_+"px",this.transContainer_.style.width=this.transWidth_-this.horizontalPadding+"px",this.transContainer_.style.height=this.transHeight_-this.verticalPadding+"px",this.transContainer_.style.top=this.verticalPadding/2+"px",this.transContainer_.style.left=this.horizontalPadding/2+"px",this.createTransElements_(),this.isDomConstructed_=!0},d.prototype.getDataList=function(){return this.dataAccessor_.get()},d.prototype.setItemsContent=function(){var a=this.getDataList(),c;if(a.length===0){for(c=0;c<this.elements_.length;c++)b.addClasses(this.elements_[c],"empty");var d=this.elements_[Math.floor((this.elements_.length-2)/2)-2];d.innerHTML="No content",b.addRemoveClasses(d,["no-content"],"empty")}else for(c=0;c<this.elements_.length;c++)this.populateItem(this.elements_[c],a[this.dataPointer_+c])},d.prototype.createTransElements_=function(){var a;this.onscreen_.length=0,this.beforescreen_.length=0,this.afterscreen_.length=0,this.rows_=Math.floor(parseInt(this.transHeight_,10)/this.itemHeight_),this.elements_.length===0&&(this.elements_=d.createElements(this.rows_,this.transContainer_,this.listItemCssClass)),this.setItemsContent();for(a=0;a<this.rows_;a++)this.onscreen_.push(this.elements_[a]);for(;a<this.elements_.length;a++)this.afterscreen_.push(this.elements_[a]);this.setVerticalTransformations(),this.isVisuallyInitialized_=!0},d.prototype.getTemplate=function(){return c},d.prototype.populateItem=function(a,c){typeof c!="undefined"?(b.removeClasses(a,"empty"),a.innerHTML=this.getTemplate().render({channel:c})):(b.addClasses(a,"empty"),a.innerHTML="")},d.prototype.setVerticalTransformations=function(){var a=0;for(a=0;a<this.beforescreen_.length;a++)d.setTranformationsY(this.beforescreen_[a],"-"+this.itemHeight_);for(a=0;a<this.onscreen_.length;a++)d.setTranformationsY(this.onscreen_[a],this.itemHeight_*a);for(a=0;a<this.afterscreen_.length;a++)d.setTranformationsY(this.afterscreen_[a],this.itemHeight_*(this.rows_+1))},d.setTranformationsY=function(a,b){a.style.webkitTransform="translate(0,"+b+"px)",a.style.MozTransform="translateY("+b+"px)",d.enableAnimation_&&a.style.webkitTransition=="none"&&setTimeout(function(){a.style.webkitTransition=""},d.animationDuration_)},d.createElements=function(b,c,d){var e=b+2,f=[],g;for(var h=0;h<e;h++)g=a.create("div",{classes:d}),f.push(g),a.adopt(c,g);return f},d.prototype.isVisible=function(){return this.isVisible_},d.prototype.selectRow=function(a){if(this.isVisible()){var b;a>=this.dataPointer_&&a<=this.dataPointer_+this.rows_-1?this.setActiveChannel(this.onscreen_[a-this.dataPointer_]):a>this.dataPointer_+this.rows_-1?(this.setActiveChannel(this.onscreen_[this.onscreen_.length-1]),b=a-(this.dataPointer_+this.rows_-1),b>this.rows_*2+3&&(this.dataPointer_=a-(this.rows_*2+3),b=a-(this.dataPointer_+this.rows_-1)),this.iterateRotationTimes_(b,"down"),this.setActiveChannel(this.onscreen_[this.onscreen_.length-1])):a<this.dataPointer_&&(this.setActiveChannel(this.onscreen_[0]),b=this.dataPointer_-a,b>this.rows_*2&&(this.dataPointer_=a+this.rows_*2,b=this.dataPointer_-a),this.iterateRotationTimes_(b,"up"),this.setActiveChannel(this.onscreen_[0]))}this.app.fire("selection-changed",{index:a})},d.prototype.iterateRotationTimes_=function(a,b){var c;for(c=0;c<a;c++)b==="down"?this.rotateDown_():b==="up"&&this.rotateUp_();this.setVerticalTransformations()},d.prototype.rotateUp_=function(){var a,b=this.onscreen_.pop(),c=this.getDataList();this.afterscreen_.unshift(b),b=this.beforescreen_.pop(),this.onscreen_.unshift(b),this.dataPointer_--,this.beforescreen_.length<1&&this.dataPointer_>0&&(b=this.afterscreen_.pop(),a=c[this.dataPointer_-1],b.style.webkitTransition="none",this.populateItem(b,a),this.beforescreen_.push(b))},d.prototype.rotateDown_=function(){var a,b=this.getDataList(),c=this.onscreen_.shift();this.beforescreen_.push(c),c=this.afterscreen_.shift(),this.onscreen_.push(c),this.dataPointer_++,this.afterscreen_.length<1&&b.length>this.dataPointer_+this.rows_&&(c=this.beforescreen_.shift(),a=b[this.dataPointer_+this.rows_],c.style.webkitTransition="none",this.populateItem(c,a),this.afterscreen_.push(c))},d.prototype.setActiveChannel=function(a){this.activeChannelElement_!==null&&b.removeClasses(this.activeChannelElement_,this.listItemActiveCssClass),b.addClasses(a,this.listItemActiveCssClass),this.activeChannelElement_=a},d.prototype.indexIsPresentation=function(a){if(a>=this.dataPointer_||a<this.dataPointer_+this.rows_)return!0;var b=this.afterscreen_.length,c=this.beforescreen_.length;return a<this.dataPointer_+this.rows_-1+b?!0:a>this.dataPointer_-c?!0:!1},d.prototype.indexIsVisible=function(a){return a<this.dataPointer_?!1:a>this.dataPointer_+this.rows_-1?!1:!0},d.prototype.getStep=function(){return 1},d.prototype.getHStep=function(){return this.rows_},d.prototype.reset=function(){},d.prototype.activate=function(){this.selectRow.apply(this,arguments)},d.prototype.unload=function(){a.dispose(this.container_),this.isVisible_=!1},d.prototype.show=function(){this.enterDom.apply(this,arguments)},d.prototype.unhide=function(){this.reEnterDom()},d.prototype.updateItem=function(a,b){this.indexIsVisible(a)&&this.populateItem(this.activeChannelElement_,b)},d}),define("utils/listingapp",["oop/inherit","utils/visualapp","model/listmodel2","view/mosaicpresentation","shims/bind","data/static-strings","transport/request","transport/response","json/json","view/partials","oop/clone","ui/nflist","paths/jsonpaths","tui/tui","ui/popup","ui/player"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){var q=function(a){b.call(this,a),this.numericTimeout_=null,this.selectChannelIndex="",a.datamodel?this.model=new a.datamodel(this):this.model=new c(this),a.listType&&a.listType!=="mosaic"&&a.listType!=="list"?this.presentation=new d(this,a.listType,a.itemWidth,a.itemHeight,a.shouldJump):window.BACKEND_CONFIG&&typeof window.BACKEND_CONFIG.LIST_TYPE=="string"&&a.listType!=="mosaic"&&a.listType!=="list"?window.BACKEND_CONFIG.LIST_TYPE==="0"?this.presentation=new l(this,this.model,50):window.BACKEND_CONFIG.LIST_TYPE==="1"&&(this.presentation=new j(this,"mosaic",a.itemWidth,a.itemHeight,a.shouldJump)):a.usePagination?this.presentation=new j(this,a.listType,a.itemWidth,a.itemHeight,a.shouldJump):this.presentation=new d(this,a.listType,a.itemWidth,a.itemHeight,a.shouldJump),this.canResume=a.canResume,this.registerDisposable(this.model),this.generateDefaultEvents(),this.appEvents.play={name:"play",func:e(this.handlePlayButton,this),attached:!1},this.on("start-requested",this.defaultStartRequested),this.on("show-requested",this.onShowScreen),this.on("selection-changed",this.onSelectionChanged),this.on("show-complete",this.onShowComplete),this.on("stop-requested",this.onStopRequested),this.on("data-load-end",this.onDataLoadEnd),this.on("try-play",this.onPlayRequest)};return a(q,b),q.remoteKeys_=["left","right","up","down","chup","chdown","ok","zero","one","two","three","four","five","six","seven","eight","nine","return","recall","star"],q.prototype.onShowComplete=function(){this.attachEvents(!0)},q.prototype.getEPGByID=function(){return[]},q.prototype.onPlayRequest=function(a,b){var c=k(a);isNaN(parseInt(c.id,10))?c.title=c.publishName||"":c.title="["+c.id+"] "+(c.publishName||""),c.epg=[],p.getInstance().play(c,b)},q.prototype.onSelectionChanged=function(a){this.model.currentIndex=a.index},q.prototype.onStopRequested=function(){this.model.unload(),this.presentation.unload(),this.attachEvents(!1)},q.prototype.onDataLoadEnd=function(a){a.type==="list"?this.fire("start-ready"):a.type==="folder"&&(this.presentation.show(undefined,!0),typeof a.index!="undefined"?this.presentation.activate(a.index):this.model.pointer.length>1?this.presentation.activate(1):this.model.pointer.length===1&&this.presentation.activate(0))},q.prototype.onShowScreen=function(){this.presentation.show(this.container,this.forceRedraw_),this.forceRedraw_=!1,this.model.get().length>0&&this.presentation.activate(0)},q.numerics_=["zero","one","two","three","four","five","six","seven","eight","nine"],q.prototype.defaultRemoteKeyHandler=function(a){q.numerics_.indexOf(a)!==-1?this.handleNumerics(a):a==="star"?this.handleSortRequest():(this.numericTimeout_!==null&&(window.clearTimeout(this.numericTimeout_),this.numericTimeout_=null,this.selectChannelIndex=""),this.model.acceptEvent({type:"remote",action:a}))},q.prototype.handleNumerics=function(a){var b=q.numerics_.indexOf(a);window.clearTimeout(this.numericTimeout_),this.selectChannelIndex+=b.toString(),n.osdInstance.setContent(this.selectChannelIndex,3),this.numericTimeout_=window.setTimeout(e(this.goToChannel,this),3e3)},q.prototype.goToChannel=function(a){var b=this.selectChannelIndex;this.selectChannelIndex="",this.numericTimeout_=null;var c=this.model.get(),d;for(d=0;d<c.length;d++)if(c[d].id==b){this.model.selectByIndex(d),this.fire("try-play",this.model.getItem());break}},q.prototype.defaultStartRequested=function(){!this.model.isLoaded||this.model.lastLoadedTS!==null&&this.model.lastLoadedTS<n.getInstance().lastRefreshTimeStamp_?this.model.loadData({name:this.name,type:"list"}):this.fire("start-ready")},q.prototype.generateDefaultEvents=function(a,b){this.appEvents||(this.appEvents={}),a||(a=q.remoteKeys_),b||(b=e(this.defaultRemoteKeyHandler,this)),a.forEach(e(function(a){this.appEvents[a]={name:a,func:b,attached:!1}},this))},q.sortAlgorithms_=["sortByIndex","sortByName"],q.prototype.handleSortRequest=function(){var a=[];q.sortAlgorithms_.forEach(function(b){a.push(f.lists.sorting[b])}),a.push(f.components.dialogs.cancel),o.createDialog("optionlist",a,e(this.handleSorting,this),f.lists.sorting.title)},q.prototype.handleSorting=function(a){if(a>=q.sortAlgorithms_.length)return;this.model.sort(q.sortAlgorithms_[a])},q.prototype.handlePlayButton=function(){var a=this.model.currentIndex,b=this.model.getItem(a);if(b.id===null)return;var c=[],d=[];c.push(f.lists.play),d.push("play"),this.canResume===!0&&(c.push(f.lists.resumePlay),d.push("resume")),b.isBookmarked?(c.push(f.lists.unbookmark),d.push("unbookmark")):(c.push(f.lists.bookmark),d.push("bookmark")),b.rating!=="X"&&(b.isLocked?(c.push(f.lists.unlock),d.push("unlock")):(c.push(f.lists.lock),d.push("lock"))),c.push(f.components.dialogs.cancel),this.dialogInstance={index:a,object:b,options:c,actions:d},o.createDialog("optionlist",this.dialogInstance.options,e(this.handleDialogSelection,this),f.components.dialogs.select)},q.prototype.forceRedraw_=!1,q.prototype.cancelData=function(){this.model.wipe(),this.forceRedraw_=!0},q.prototype.handleDialogSelection=function(a){var b;if(this.dialogInstance){this.dialogInstance.action=this.dialogInstance.actions[a];switch(this.dialogInstance.action){case"lock":case"unlock":o.createDialog("password",!1,e(this.acceptPass,this),f.components.dialogs.lock);break;case"bookmark":case"unbookmark":this.acceptPass();break;case"resume":this.fire("try-play",this.model.getItem(),!0),this.dialogInstance=null,delete this.dialogInstance;break;case"play":this.fire("try-play",this.model.getItem()),this.dialogInstance=null,delete this.dialogInstance;break;default:this.dialogInstance=null,delete this.dialogInstance}}},q.prototype.acceptPass=function(a){var b=m.getPath(this.dialogInstance.action),c={run:b.run,sig:b.sig,type:this.name.toUpperCase(),id:this.dialogInstance.object.id,newif:1};["lock","unlock"].indexOf(this.dialogInstance.action)!==-1&&(c.password=a);var d=g.create("calld",c);this.updateInProcess=!0,h.register(d,e(this.handleUpdate,this,this.dialogInstance.index,this.dialogInstance.action)),d.send(),this.dialogInstance.object=null,delete this.dialogInstance},q.prototype.handleUpdate=function(a,b,c){var d=this.model.getItem(a),e=i.parse(c.content);if(e&&e.status==="OK"){switch(b){case"lock":case"unlock":d.isLocked=!d.isLocked;break;case"bookmark":case"unbookmark":d.isBookmarked=!d.isBookmarked;break;default:}this.updateItem(a,d)}else o.createDialog("message",undefined,undefined,f.lists.actionFailed);this.updateInProcess=!1},q.prototype.updateItem=function(a,b){this.presentation.updateItem(a,b)},q.prototype.disposeInternal=function(){this.constructor.superClass_.disposeInternal.call(this),delete this.appEvents,delete this.numericTimeout_},q}),define("model/youtubelist",["model/listmodel","oop/inherit","env/exports","shims/bind","loader/loader","data/static-strings","ui/popup"],function(a,b,c,d,e,f,g){var h=function(b){a.call(this,b),this.currentDataURL=h.urls.most_popular_url,c.exportSymbol("youtube",{name:"load",symbol:d(this.load,this)}),this.lastDisplayedIndex=0};return b(h,a),h.urls={most_popular_url:"http://gdata.youtube.com/feeds/api/standardfeeds/most_popular?alt=jsonc&callback=exportedSymbols.youtube.load&v=2&max-results=16&prettyprint=true",toprated:"http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?alt=jsonc&callback=exportedSymbols.youtube.load&v=2&max-results=16&prettyprint=true",most_viewed:"http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed?alt=jsonc&callback=exportedSymbols.youtube.load&v=2&max-results=16&prettyprint=true",recently_featured:"http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured?alt=jsonc&callback=exportedSymbols.youtube.load&v=2&max-results=16&prettyprint=true",search_url:"http://gdata.youtube.com/feeds/api/videos?alt=jsonc&callback=exportedSymbols.youtube.load&v=2&max-results=16&prettyprint=true&q="},h.prototype.itemsPerLoad=16,h.prototype.isLoading=!1,h.prototype.hasMoreResult=!0,h.prototype.resetSource=function(a,b){if(h.urls[a]){if(a==="search_url"&&typeof b!="string"){g.createDialog("input",!0,d(this.resetSource,this,a),f.components.dialogs.ytube.searchquery);return}this.currentDataURL=h.urls[a],this.lastDisplayedIndex=0,delete this.data.list,this.data.list=[],this.app.presentation.reset(!0),this.loadData({name:this.name,type:"list",querystring:b})}},h.prototype.loadData=function(a){typeof a.querystring=="string"&&(this.currentDataURL+=a.querystring);var b=this.currentDataURL;a.type==="append"&&(b=b+"&start-index="+(this.lastDisplayedIndex+1)),this.app.fire("data-load-start"),this.isLoading=!0,e.loadJSONP("youtubevideos",b)},h.prototype.load=function(a){this.isLoading=!1,a.data.startIndex+a.data.itemsPerPage>=a.data.totalItems&&(this.hasMoreResult=!1);if(a.data.totalItems!==0){var b=a.data.items,c,d;for(c=0;c<b.length;c++)d=b[c],d.accessControl&&d.accessControl.list==="allowed"&&(d.playURI=d.id,d.starRating=parseInt((d.rating-1)/4*100),this.data.list.push(d))}this.lastDisplayedIndex=this.data.list.length,this.pointer=this.data.list,this.isLoaded=!0,this.app.fire("data-load-end",{type:a.data.startIndex===1?"list":"append",app:this.app.name})},h.prototype.disposeInternal=function(){h.superClass_.disposeInternal.call(this),delete this.currentDataURL,delete this.hasMoreResult},h}),define("tpl/youtube-partial",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;if(things.length>0)for(var i=startIndex;i<things.length;i++){buf.push("<div"),buf.push(attrs({"data-sequence":i,"class":"item "+(alterClass?"larger":"regular")})),buf.push("><div"),buf.push(attrs({"class":"imgcont"})),buf.push("><div"),buf.push(attrs({"class":"imgcontin"})),buf.push("></div><div"),buf.push(attrs({"class":"video-bar"})),buf.push("><div"),buf.push(attrs({"class":"rating_bar"})),buf.push("><div"),buf.push(attrs({style:"width:"+things[i].starRating+"%"})),buf.push("></div></div></div><img"),buf.push(attrs({src:things[i].thumbnail.sqDefault})),buf.push("/></div><span"),buf.push(attrs({"class":"title"})),buf.push(">");var __val__=things[i].title;buf.push(null==__val__?"":__val__),buf.push("</span></div>")}}return buf.join("")}return{render:anonymous}}),define("apps/youtube",["utils/listingapp","model/youtubelist","tpl/youtube-partial","dom/dom","shims/bind","data/static-strings","debug/logger","ui/popup"],function(a,b,c,d,e,f,g,h){var i=new a({name:"youtube",datamodel:b,listType:"youtube"});return i.logger_=new g("YouTube"),i.on("selection-changed",function(){this.model.currentIndex>this.model.data.list.length-this.presentation.getStep()*2&&this.model.hasMoreResult&&this.model.loadData({name:this.name,type:"append"})}),i.selectionDialogOptions={options:[f.components.dialogs.ytube.mostPopular,f.components.dialogs.ytube.topRated,f.components.dialogs.ytube.mostViewed,f.components.dialogs.ytube.recent,f.components.dialogs.ytube.search],actions:["most_popular_url","toprated","most_viewed","recently_featured","search_url"]},i.presentation.addNewResults=function(){var a=c.render({alterClass:this.template.alterClass,things:this.app.model.get(),startIndex:this.app.model.lastDisplayedIndex-this.app.model.itemsPerLoad}),b=d.$(".list-container",this.container);b.insertAdjacentHTML("beforeend",a)},i.on("data-load-end",function(a){a.type==="append"&&this.presentation.addNewResults()}),i.appEvents.play={name:"play",func:e(function(){h.createDialog("optionlist",this.selectionDialogOptions.options,e(this.handleDialogSelection,this),f.components.dialogs.ytube.select)},i),attached:!1},i.handleDialogSelection=function(a){i.logger_.info("selection is ",this.selectionDialogOptions.actions[a]),this.model.resetSource(this.selectionDialogOptions.actions[a])},{init:function(){return i}}}),define("tpl/weather",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({"class":"weatherWrapper"})),buf.push("><div"),buf.push(attrs({"class":"weatherScreen"})),buf.push("><div"),buf.push(attrs({"class":"weatherCity"})),buf.push(">");var __val__="City: "+location.city+", "+location.country;buf.push(null==__val__?"":__val__),buf.push("</div>");for(var i=0;i<things.length;i++){buf.push("<div"),buf.push(attrs({"class":"weatherDay"})),buf.push("><div"),buf.push(attrs({"class":"weatherDayTitle"})),buf.push(">");var __val__=things[i].dayTitle;buf.push(null==__val__?"":__val__),buf.push("</div><div"),buf.push(attrs({"class":"icon"})),buf.push("><img"),buf.push(attrs({src:"http://img.weather.weatherbug.com/forecast/icons/localized/80x67/en/trans/"+things[i].dayIcon+".png"})),buf.push("/></div><div"),buf.push(attrs({"class":"weatherName"})),buf.push(">");var __val__=things[i].dayDesc;buf.push(null==__val__?"":__val__),buf.push("</div>");if(things[i].humidity){buf.push("<div"),buf.push(attrs({"class":"humidity"})),buf.push(">");var __val__="Humidity: "+things[i].humidity;buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("<div"),buf.push(attrs({"class":"minTemp"})),buf.push(">");var __val__="Temp. Low: "+things[i].low+" "+unit;buf.push(null==__val__?"":__val__),buf.push("</div><div"),buf.push(attrs({"class":"maxTemp"})),buf.push(">");var __val__="Temp. High: "+things[i].high+" "+unit;buf.push(null==__val__?"":__val__),buf.push("</div>");if(things[i].feelslike){buf.push("<div"),buf.push(attrs({"class":"feelsLike"})),buf.push(">");var __val__="Feels like: "+things[i].feelslike;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things[i].wind){buf.push("<div"),buf.push(attrs({"class":"wind"})),buf.push(">");var __val__="Winds: "+things[i].wind;buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("</div>")}buf.push("</div></div>")}return buf.join("")}return{render:anonymous}}),define("transport/grouprequest",["transport/response","shims/bind"],function(a,b){var c=function(a,b){this.requestList=Array.prototype.slice.call(arguments,1),this.callback=a,this.resultList=[],this.counter=0,this.startRequests_()};return c.prototype.startRequests_=function(){var c;for(c=0;c<this.requestList.length;c++)a.register(this.requestList[c],b(this.getResponse,this,c)),this.requestList[c].send()},c.prototype.getResponse=function(a,b){this.counter++,this.resultList[a]=b,this.counter>=this.requestList.length&&(this.callback(this.resultList),this.disposeInternal())},c.prototype.disposeInternal=function(){delete this.requestList,delete this.responseList,delete this.callback,delete this.counter},c}),define("apps/weather",["oop/inherit","utils/visualapp","shims/bind","env/exports","loader/loader","tpl/weather","transport/request","transport/grouprequest","paths/jsonpaths"],function(a,b,c,d,e,f,g,h,i){var j="1",k="104164",l=function(a){b.call(this,a),this.forecast=null,this.location=null,this.on("start-requested",this.onStartRequested),this.on("show-requested",this.onShowRequested),this.on("stop-requested",this.onStopRequested)};return a(l,b),l.prototype.onStopRequested=function(){this.container.innerHTML=""},l.prototype.onStartRequested=function(){this.forecast===null||this.location===null?this.loadData():this.fire("start-ready")},l.prototype.cityLoaded_=!1,l.prototype.unitsLoaded_=!1,l.prototype.loadJSON=function(a){a[0].status.toLowerCase()==="ok"?this.city=a[0].content:this.city=k,a[1].status.toLowerCase()==="ok"?this.units=a[1].content:this.units=j,this.loadData([this.units,this.city])},l.prototype.onShowRequested=function(){this.dom_=f.render({things:this.forecast.forecastList,unit:this.forecast.temperatureUnits,location:this.location.location}),this.container.innerHTML=this.dom_},l.prototype.loadData=function(a){if(a){e.loadJSONP("weatherlocation","http://i.wxbug.net/REST/Direct/GetLocation.ashx?api_key=u2bwf83unq43dt66ugm6t2fa&nf&f=exportedSymbols.weather.locationInfo&city="+this.city),e.loadJSONP("weatherinfo","http://i.wxbug.net/REST/Direct/GetForecast.ashx?api_key=u2bwf83unq43dt66ugm6t2fa&nf=4&f=exportedSymbols.weather.load&city="+this.city+"&units="+this.units);return}var b=g.create("calld",i.getPath(this.name,"units")),d=g.create("calld",i.getPath(this.name,"city"));new h(c(this.loadJSON,this),d,b)},l.prototype.setLocationInfo=function(a){this.location=a,this.forecast!==null&&this.fire("start-ready")},l.prototype.noDataLoaded=function(){},l.prototype.load=function(a){if(a===null){this.noDataLoaded();return}this.forecast=a;var b;for(var c=0;c<this.forecast.forecastList.length;c++)b=this.forecast.forecastList[c].dayPred,/feels-like temperature of (.*)$/.exec(b)!==null&&(this.forecast.forecastList[c].feelslike=/feels-like temperature of (.*)$/.exec(b)[1]),/[wW]inds ([^\.]*)/.exec(b)!==null&&(this.forecast.forecastList[c].wind=/[wW]inds ([^\.]*)/.exec(b)[1]),/ ([0-9]*%) /.exec(b)!==null&&(this.forecast.forecastList[c].humidity=/ ([0-9]*%) /.exec(b)[1]);this.location!==null&&this.fire("start-ready")},l.prototype.disposeInternal=function(){l.superClass_.disposeInternal.call(this),delete this.dom_,delete this.forecast,delete this.location,delete this.city,delete this.units,delete this.cityLoaded_,delete this.unitsLoaded_},{instance:null,init:function(){return this.instance===null&&(this.instance=new l({name:"weather"}),d.exportSymbol("weather",{name:"load",symbol:c(this.instance.load,this.instance)}),d.exportSymbol("weather",{name:"locationInfo",symbol:c(this.instance.setLocationInfo,this.instance)})),this.instance}}}),define("tpl/channelitem",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({"class":"title"})),buf.push(">");if(channel.thumbnail.length>4){buf.push("<div"),buf.push(attrs({"class":"imgcont"})),buf.push("><img"),buf.push(attrs({src:channel.thumbnail})),buf.push("/></div><div"),buf.push(attrs({"class":"channel-name"})),buf.push(">");var __val__=channel.publishName;buf.push(null==__val__?"":__val__),buf.push("</div>")}else{buf.push("<div>");var __val__=channel.publishName;buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("<ul"),buf.push(attrs({"class":"channel-settings-icons"})),buf.push(">"),channel.isLocked&&(buf.push("<li"),buf.push(attrs({"class":"icon locked"})),buf.push("></li>")),channel.isBookmarked&&(buf.push("<li"),buf.push(attrs({"class":"icon bookmarked"})),buf.push("></li>")),channel.cost>0&&(buf.push("<li"),buf.push(attrs({"class":"icon paid"})),buf.push("></li>")),buf.push("</ul></div>")}return buf.join("")}return{render:anonymous}}),define("tpl/epgrecord",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<span"),buf.push(attrs({style:"left:"+leftOffset+"px;width:"+widthByDuration+"px;","data-index":epgRecordIndex,"class":"p"})),buf.push("><div"),buf.push(attrs({style:"display: block; overflow: hidden; width:"+(widthByDuration-20)+"px;","class":"bordered"})),buf.push("><div>");var __val__=progTitle;buf.push(null==__val__?"":__val__),buf.push("</div></div><div"),buf.push(attrs({"class":"highlight"})),buf.push("></div></span>")}return buf.join("")}return{render:anonymous}}),define("datetime/xdate",[],function(){var a=function(a){if(a instanceof Date)this.date_=a;else switch(typeof a){case"undefined":this.date_=new Date;break;case"number":this.date_=new Date(a);break;case"string":a=parseInt(a,10);if(!isNaN(a))this.date_=new Date(a);else throw Error("Cannot create Xdate");break;default:throw Error("Cannot create Xdate Object")}this.timeAsNumber_=this.date_.getTime()};return a.prototype.anHour=36e5,a.prototype.aMinute=6e4,a.prototype.getRoundedTime=function(b){switch(b){case a.ROUNDERS.PRIOR_FULL_HOUR:return new a(this.timeAsNumber_-this.timeAsNumber_%this.anHour);case a.ROUNDERS.PRIOR_FULL_MINUTE:return new a(this.timeAsNumber_-this.timeAsNumber_%this.aMinute)}throw Error("What time rounded you mean?")},a.prototype.getTime=function(){return this.timeAsNumber_},a.prototype.isLaterThan=function(b){var c=a.compareTimes(this,b);return c===1?!0:!1},a.prototype.isEarlierThan=function(b){var c=a.compareTimes(this,b);return c===-1?!0:!1},a.prototype.isEarlierOrSameThan=function(b){return a.compareTimes(this,b)===1?!1:!0},a.prototype.getHours=function(){return a.fillToTwoSimbols(this.date_.getHours())},a.prototype.getMinutes=function(){return a.fillToTwoSimbols(this.date_.getMinutes())},a.prototype.getSeconds=function(){return a.fillToTwoSimbols(this.date_.getSeconds())},a.ROUNDERS={PRIOR_FULL_HOUR:0,PRIOR_FULL_MINUTE:1},a.CONST={MILISECONDS:1e3,SECONDS:6e4,MINUTES:36e5,HOURS:864e5},a.compareTimes=function(b,c){return b=a.convertToXdate(b),c=a.convertToXdate(c),b.getTime()>c.getTime()?1:c.getTime()>b.getTime()?-1:0},a.convertToXdate=function(b){return b instanceof a?b:new a(b)},a.getTimeDifference=function(b,c){return b=a.convertToXdate(b),c=a.convertToXdate(c),c.getTime()-b.getTime()},a.getTimeDiffereceAsMinutes=function(b,c){b=a.convertToXdate(b),c=a.convertToXdate(c);var d=b.getTime()-c.getTime();return Math.floor(d/a.CONST.SECONDS)},a.now=function(){return new a((new Date).getTime())},a.fillToTwoSimbols=function(a){return a=""+a,a.length<2&&(a="0"+a),a},a}),define("tpl/timeline",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;for(var a=0;a<hours;a++,start++){buf.push("<span"),buf.push(attrs({style:"width:"+(pixelsPerHour-9)+"px;","class":"anhour"})),buf.push(">");var __val__=start+":00";buf.push(null==__val__?"":__val__),buf.push("</span>")}}return buf.join("")}return{render:anonymous}}),define("tpl/epg-details",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({"class":"epg-name-holder"})),buf.push("><div"),buf.push(attrs({"class":"epg-details-name"})),buf.push(">");var __val__=channelname;buf.push(null==__val__?"":__val__),buf.push("</div></div><div"),buf.push(attrs({"class":"epg-details-text"})),buf.push(">");if(noData===!0)buf.push("<div"),buf.push(attrs({"class":"noData"})),buf.push(">No EPG information</div>");else{buf.push("<div"),buf.push(attrs({"class":"epg-details-info"})),buf.push("><span"),buf.push(attrs({"class":"startTime"})),buf.push(">");var __val__=startTime;buf.push(null==__val__?"":__val__),buf.push("</span><span> - </span><span"),buf.push(attrs({"class":"endTime"})),buf.push(">");var __val__=endTime;buf.push(null==__val__?"":__val__),buf.push("</span></div><div"),buf.push(attrs({"class":"epg-details-title"})),buf.push(">");var __val__=title;buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("</div>")}return buf.join("")}return{render:anonymous}}),define("ui/epgvisual",["dom/dom","tpl/channelitem","dom/classes","utils/datetime","tpl/epgrecord","datetime/xdate","tpl/timeline","tpl/epg-details","shims/bind"],function(a,b,c,d,e,f,g,h,i){var j=function(a){this.channelList_=null,this.epgList_=null,this.dataAccessor_=a,this.isVisible_=!1,this.currentEpgElement_=null,this.currentEpgPixelOffset_=0,this.styleisDirty=!1,this.constructDom_(),this.dataPointer_=0,this.onscreen_=[],this.beforescreen_=[],this.afterscreen_=[],this.activeChannelElement_=null};return j.enableAnimation_=!1,j.animationDuration_=300,j.prototype.mainContainerClass="tui-epg-container",j.prototype.transContainerClass="tui-internal-epg-container",j.prototype.epgDetailContainerClass="epg-details",j.prototype.constructDom_=function(){this.container_=a.create("div",{classes:this.mainContainerClass}),this.setupContainerInternal(),this.transContainer_=a.create("div",{classes:this.transContainerClass}),this.timelineElement_=a.create("div",{classes:"timeline",html:"test"}),this.detailsContainer_=a.create("div",{classes:this.epgDetailContainerClass,style:"height:"+this.detailsHeight_+"px"}),this.setupContainerInternal(this.transContainer_),this.transContainer_.style.position="relative",this.transContainer_.style.height=parseInt(this.transContainer_.style.height,10)-this.detailsHeight_+"px",this.timelineElement_.style.top=this.detailsHeight_-20+"px",this.container_.appendChild(this.detailsContainer_),this.container_.appendChild(this.transContainer_),this.container_.appendChild(this.timelineElement_)},j.prototype.style_=".prog, .timeline {-webkit-transform: translate(",j.prototype.style2_="px, 0px); }",j.prototype.initOffset_=140,j.prototype.detailsHeight_=100,j.prototype.maxShownPeriod_=288e5,j.prototype.timelineLookbackTreshold_=36e5,j.prototype.timelineHourDistance_=180,j.prototype.itemHeight_=70,j.prototype.rows_=0,j.prototype.isVisuallyInitialized_=!1,j.prototype.show=function(){this.showInternal_()},j.prototype.isVisible=function(){return this.isVisible_},j.prototype.selectRow=function(a){this.selectRowInternal_(a)},j.prototype.compileStyle_=function(a){typeof a!="undefined"&&(a===0&&(this.styleisDirty=!1),this.currentEpgPixelOffset_=a);var b=this.currentEpgPixelOffset_+this.initOffset_;return this.style_+b+this.style2_},j.prototype.updateChannelItem=function(a){!(a>=this.dataPointer_&&a<=this.dataPointer_+this.rows_-1)},j.prototype.selectRowInternal_=function(a){var b;a>=this.dataPointer_&&a<=this.dataPointer_+this.rows_-1?this.setActiveChannel_(this.onscreen_[a-this.dataPointer_]):a>this.dataPointer_+this.rows_-1?(this.setActiveChannel_(this.onscreen_[this.onscreen_.length-1]),b=a-(this.dataPointer_+this.rows_-1),this.iterateRotationTimes_(b,"down"),this.setActiveChannel_(this.onscreen_[this.onscreen_.length-1])):a<this.dataPointer_&&(this.setActiveChannel_(this.onscreen_[0]),b=this.dataPointer_-a,this.iterateRotationTimes_(b,"up"),this.setActiveChannel_(this.onscreen_[0]))},j.prototype.setNextActiveEPG=function(a){if(a===null)return;this.currentEpgElement_!==null&&c.removeClasses(this.currentEpgElement_,"active"),c.addClasses(a,"active"),this.currentEpgElement_=a,this.setEpgDetails_(),this.fitEpgElementOnScreen()},j.prototype.setEpgDetails_=function(){if(this.currentEpgElement_===null){this.detailsContainer_.innerHTML=h.render({channelname:this.dataAccessor_.getItem().publishName,noData:!0});return}var b=this.getEpgDataByObject(this.dataAccessor_.getItem()),c=null;b&&(c=b[parseInt(a.dataGet(this.currentEpgElement_,"index"),10)],this.detailsContainer_.innerHTML=h.render({channelname:this.dataAccessor_.getItem().publishName,startTime:d.getParsedTime(c[1]),endTime:d.getParsedTime(c[2]),title:c[3],noData:!1}))},j.prototype.fitEpgElementOnScreen=function(){this.styleisDirty=!0;var a=this.currentEpgElement_,b=parseInt(a.style.left,10),c=b+parseInt(a.style.width,10),d=Math.abs(this.currentEpgPixelOffset_),e=parseInt(this.container_.style.width,10)-this.initOffset_,f=d+e;b<d?this.styleElement_.textContent=this.compileStyle_(b*-1):c>f&&(this.styleElement_.textContent=this.compileStyle_((c-e)*-1))},j.prototype.selectEpg=function(a){a?this.setNextActiveEPG(this.currentEpgElement_.nextElementSibling):this.setNextActiveEPG(this.currentEpgElement_.previousElementSibling)},j.prototype.iterateRotationTimes_=function(a,b){var c;for(c=0;c<a;c++)b==="down"?this.rotateDown_():b==="up"&&this.rotateUp_();this.setTranformationsForChannelsInternal()},j.prototype.getEpgDataByObject=function(a){var b=this.epgList_[a.id];return b?b.body:b},j.prototype.rotateUp_=function(){var a,b,c;c=this.onscreen_.pop(),this.afterscreen_.unshift(c),c=this.beforescreen_.pop(),this.onscreen_.unshift(c),this.dataPointer_--,this.beforescreen_.length<1&&this.dataPointer_>0&&(c=this.afterscreen_.pop(),b=this.channelList_[this.dataPointer_-1],a=this.getEpgDataByObject(b),c.style.webkitTransition="none",j.populateChannelItem(c,b,a,this.timelineStart_,this.endTimeInterval_),this.beforescreen_.push(c))},j.prototype.rotateDown_=function(){var a,b,c;c=this.onscreen_.shift(),this.beforescreen_.push(c),c=this.afterscreen_.shift(),this.onscreen_.push(c),this.dataPointer_++,this.afterscreen_.length<1&&this.channelList_.length>this.dataPointer_+this.rows_&&(c=this.beforescreen_.shift(),b=this.channelList_[this.dataPointer_+this.rows_],a=this.getEpgDataByObject(b),c.style.webkitTransition="none",j.populateChannelItem(c,b,a,this.timelineStart_,this.endTimeInterval_),this.afterscreen_.push(c))},j.timeOut_=null,j.prototype.setActiveChannel_=function(a){this.currentEpgElement_=null,window.clearTimeout(this.timeout_),this.timeout_=window.setTimeout(i(this.setFirtProgramAsActive,this,a),180)},j.prototype.setFirtProgramAsActive=function(b){var d;this.activeChannelElement_!==null&&(c.removeClasses(this.activeChannelElement_,"active"),d=a.$("span.p.active",this.activeChannelElement_),d!==null&&c.removeClasses(d,"active")),this.activeChannelElement_=b,d=a.$("span.p",this.activeChannelElement_),d!==null&&c.addClasses(d,"active"),this.currentEpgElement_=d,this.setEpgDetails_(),c.addClasses(this.activeChannelElement_,"active"),this.styleisDirty&&(this.styleElement_.textContent=this.compileStyle_(0))},j.prototype.getEvents_=function(){return this.events_===null&&this.constructEvents_(),this.events_},j.prototype.eventHandler_=function(){},j.prototype.updateTime_=function(){this.now_=new f,this.timelineStart_=this.now_.getRoundedTime(f.ROUNDERS.PRIOR_FULL_HOUR),this.endTimeInterval_=new f(this.timelineStart_.getTime()+this.maxShownPeriod_)},j.prototype.updateChannelList_=function(){this.channelList_=this.dataAccessor_.get("list")},j.prototype.updateEpgList_=function(){this.epgList_=this.dataAccessor_.get("epg")},j.prototype.updateAll_=function(){this.updateTime_(),this.updateChannelList_(),this.updateEpgList_()},j.prototype.showInternal_=function(){document.body.appendChild(this.container_),this.updateAll_(),this.styleElement_=a.create("style"),a.adopt(document.head,this.styleElement_),this.styleElement_.textContent=this.compileStyle_(),this.isVisible_=!0,this.isVisuallyInitialized_||this.visuallyInitialize_(this.timelineStart_,this.endTimeInterval_)},j.prototype.visuallyInitialize_=function(a,b){var c;this.rows_=Math.floor(parseInt(this.transContainer_.style.height,10)/this.itemHeight_),this.elements_=j.createElements(this.rows_,this.transContainer_);var d;for(c=0;c<this.elements_.length;c++)this.epgList_[this.channelList_[this.dataPointer_+c].id]?d=this.epgList_[this.channelList_[this.dataPointer_+c].id].body:d=undefined,j.populateChannelItem(this.elements_[c],this.channelList_[this.dataPointer_+c],d,a,b);for(c=0;c<this.rows_;c++)this.onscreen_.push(this.elements_[c]);for(;c<this.elements_.length;c++)this.afterscreen_.push(this.elements_[c]);this.setTranformationsForChannelsInternal(),this.populateTimeLine(),this.isVisuallyInitialized_=!0},j.prototype.populateTimeLine=function(){this.timelineElement_.innerHTML=g.render({start:parseInt(this.timelineStart_.getHours(),10),pixelsPerHour:this.timelineHourDistance_,hours:this.maxShownPeriod_/1e3/60/60})},j.prototype.setTranformationsForChannelsInternal=function(){var a=0;for(a=0;a<this.beforescreen_.length;a++)j.setTranformationsY(this.beforescreen_[a],"-"+(this.itemHeight_+this.detailsHeight_));for(a=0;a<this.onscreen_.length;a++)j.setTranformationsY(this.onscreen_[a],this.itemHeight_*a);for(a=0;a<this.afterscreen_.length;a++)j.setTranformationsY(this.afterscreen_[a],this.itemHeight_*(this.rows_+1))},j.findCurrentProgramIndex=function(a){var b=a.length,c,e=d.getCurrentTime();for(c=0;c<b;c++)if(a[c][2]>e)return c;return-1},j.setTranformationsY=function(a,b){a.style.webkitTransform="translate(0,"+b+"px)",a.style.MozTransform="translateY("+b+"px)",j.enableAnimation_&&a.style.webkitTransition=="none"&&setTimeout(function(){a.style.webkitTransition=""},j.animationDuration_)},j.populateChannelItem=function(a,c,d,e,f){var g=b.render({channel:c}),h=j.populatePrograms(d,e,f);a.innerHTML=h+g},j.findProgramThatFinishesAfterNow=function(a,b,c){var d;for(d=0;d<a.length;d++)if(b.isEarlierThan(a[d][2]))return c.isEarlierOrSameThan(a[d][1])?-1:d;return-1},j.findProgramThatEndsAfterEndTimeFrame=function(a,b,c){var d;for(d=b;d<a.length;d++)if(c.isEarlierOrSameThan(a[d][2]))return d<1?d:d-1;return a.length-1},j.populatePrograms=function(a,b,c){var d='<div class="prog">';if(typeof a=="undefined")return d+'<div class="spoofgrid"></div></div>';var g,h;g=j.findProgramThatFinishesAfterNow(a,b,c);if(g>-1){h=j.findProgramThatEndsAfterEndTimeFrame(a,g,c);var i=new f(a[g][1]),k,l=!1;b.isLaterThan(i)?(k=0,l=!0):b.isEarlierThan(i)?k=i.getTime()-b.getTime():k=0;var m=f.getTimeDiffereceAsMinutes(b,b.getTime()+k),n=f.getTimeDiffereceAsMinutes(a[g][2],l?b.getTime():a[g][1]);d+=e.render({epgRecordIndex:g,leftOffset:Math.abs(m*3),widthByDuration:n*3,progTitle:a[g][3]}),g++;for(;g<h;g++)m=f.getTimeDiffereceAsMinutes(b,a[g][1]),n=f.getTimeDiffereceAsMinutes(a[g][2],a[g][1]),d+=e.render({epgRecordIndex:g,leftOffset:Math.abs(m*3),widthByDuration:n*3,progTitle:a[g][3]});return m=f.getTimeDiffereceAsMinutes(b,a[h][1]),n=c.isEarlierThan(a[h][2])?f.getTimeDiffereceAsMinutes(c,a[h][1]):f.getTimeDiffereceAsMinutes(a[h][2],a[h][1]),d+=e.render({epgRecordIndex:g,leftOffset:Math.abs(m*3),widthByDuration:n*3,progTitle:a[g][3]}),d+"</div>"}return d+'<div class="spoofgrid"></div></div>'},j.calculateWidthByDuration=function(a,b){var c=Math.floor(a/6e4),d=Math.floor(b/6e4);return 0},j.setupContainer=function(a){var b=document.querySelector("#maincontainer");a.style.width=parseInt(b.style.width,10)+"px",a.style.height=parseInt(b.style.height,10)+"px",a.style.position="absolute",a.style.top=0,a.style.left=0},j.createElements=function(a,b){var c=a+2,d=[],e;for(var f=0;f<c;f++)e=document.createElement("div"),e.className="epgrow",d.push(e),b.appendChild(e);return d},j.prototype.setupContainerInternal=function(a){j.setupContainer(a||this.getContainer_())},j.prototype.getContainer_=function(){return this.container_===null&&(this.container_=document.body),this.container_},j.prototype.hide=function(){a.dispose(this.container_),this.isVisible_=!1},j}),define("tpl/infobuttons",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;if(things.ok){buf.push("<div"),buf.push(attrs({"class":"remoteOK"})),buf.push(">");var __val__=things.ok;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things.arrows){buf.push("<div"),buf.push(attrs({"class":"remoteArrows"})),buf.push(">");var __val__=things.arrows;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things.home){buf.push("<div"),buf.push(attrs({"class":"remoteHome"})),buf.push(">");var __val__=things.home;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things.info){buf.push("<div"),buf.push(attrs({"class":"remoteInfo"})),buf.push(">");var __val__=things.info;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things.display){buf.push("<div"),buf.push(attrs({"class":"remoteDisplay"})),buf.push(">");var __val__=things.display;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things.leftRight){buf.push("<div"),buf.push(attrs({"class":"remote-left-right"})),buf.push(">");var __val__=things.leftRight;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things.upDown){buf.push("<div"),buf.push(attrs({"class":"remote-up-down"})),buf.push(">");var __val__=things.upDown;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things.playPause){buf.push("<div"),buf.push(attrs({"class":"remote-play-pause"})),buf.push(">");var __val__=things.playPause;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things.save){buf.push("<div"),buf.push(attrs({"class":"remote-save"})),buf.push(">");var __val__=things.save;buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things["delete"]){buf.push("<div"),buf.push(attrs({"class":"remote-delete"})),buf.push(">");var __val__=things["delete"];buf.push(null==__val__?"":__val__),buf.push("</div>")}if(things["return"]){buf.push("<div"),buf.push(attrs({"class":"remote-return"})),buf.push(">");var __val__=things["return"];buf.push(null==__val__?"":__val__),buf.push("</div>")}}return buf.join("")}return{render:anonymous}}),define("utils/listwithepg",["oop/inherit","utils/listingapp","ui/epgvisual","shims/bind","tpl/infobuttons","oop/clone","utils/datetime","dom/dom","datetime/xdate","transport/request","transport/response","json/json","data/static-strings","tui/tui","ui/player","ui/popup"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){var q=function(a){b.call(this,a),this.epgInstance=new c(this.model,b.remoteKeys_),this.hints=a.hints||null,this.appEvents.info={name:"info",func:d(function(){this.epgInstance.isVisible()?(this.epgInstance.hide(),this.presentation.unhide(),this.presentation.activate(this.model.currentIndex)):(this.epgInstance.show(),this.epgInstance.selectRow(this.model.currentIndex),this.presentation.unload())},this),attached:!1},this.appEvents.play={name:"play",func:d(this.handlePlayButton,this),attached:!1},this.on("epg-selection",this.onEpgSelection)};return a(q,b),q.prototype.handlePlayButton=function(){if(this.epgInstance.isVisible())return;q.superClass_.handlePlayButton.call(this)},q.prototype.onEpgSelection=function(a){this.epgInstance.isVisible()&&this.epgInstance.selectEpg(a)},q.prototype.showHints=function(){this.hints&&n.getInstance().setPanels(!1,!0,undefined,e.render({things:this.hints}))},q.prototype.onSelectionChanged=function(a){this.constructor.superClass_.onSelectionChanged.call(this,a),this.epgInstance.isVisible()&&this.epgInstance.selectRow(a.index)},q.prototype.getEPGByID=function(a){if(a&&a.id){var b=this.model.getEPGForItemByID(a.id),d=c.findCurrentProgramIndex(b);return d<0?[]:b.slice(d,b.length)}return q.superClass_.getEPGByID.call(this)},q.prototype.defaultStartRequested=function(){this.constructor.superClass_.defaultStartRequested.call(this),this.model.data.epg===null&&this.model.loadData({name:this.name,type:"epg"})},q.prototype.scheduleSwitch=function(a,b,c){if(c===1){var e=j.create("calld",{run:"sched_save_json",sig:"save_tv_scheduler",chan:a,stime:b[1],etime:b[2],newif:1,action:1});k.register(e,d(this.handleScheduleSave,this)),e.send()}},q.prototype.handleScheduleSave=function(a){if(a.status==="OK"){var b=l.parse(a.content);b.status!=="OK"?p.createDialog("message",undefined,undefined,m.screens.iptv.errors.cannotSchedule):p.createDialog("message",undefined,undefined,m.screens.iptv.errors.scheduled)}else p.createDialog("message",undefined,undefined,m.screens.iptv.errors.cannotSchedule)},q.prototype.epgFrameSeparator_=" - ",q.prototype.onPlayRequest=function(a,b){var c=f(a),e=null,j=this.model.get("epg")[c.id];j&&(e=j.body);var k=[],l;if(this.epgInstance.isVisible()&&this.epgInstance.currentEpgElement_!==null&&e!==null){var m=parseInt(h.dataGet(this.epgInstance.currentEpgElement_,"index"),10),n=e[m][1];if(i.now().isEarlierThan(n)){p.createDialog("confirm",undefined,d(this.scheduleSwitch,this,c.id,e[m]),"Shedule program switch");return}}if(e!==null&&e.length>0)for(l=0;l<e.length;l++)k.push({Prog:g.getParsedTime(e[l][1])+this.epgFrameSeparator_+g.getParsedTime(e[l][2])+" "+e[l][3]});c.epg=k,c.title=c.id+". "+c.publishName,o.getInstance().play(c,b)},q.prototype.updateItem=function(a,b){q.superClass_.updateItem.call(this,a,b),!this.epgInstance.isVisible()},q.prototype.onStopRequested=function(){this.epgInstance.isVisible()&&(this.epgInstance.hide(),this.presentation.container_.style.display="block"),q.superClass_.onStopRequested.call(this)},q}),define("utils/framedapp",["oop/inherit","utils/listingapp","dom/dom","utils/sizes","shims/bind","tpl/infobuttons","utils/events"],function(a,b,c,d,e,f,g){var h=function(a){b.call(this,a),this.gamelayer=c.create("div",{classes:"tui-component game-layer",style:d.getStyle(d.getSizesForGameLayer())}),this.activeFrame=null,this.generateDefaultEvents(["one","two","three","four","five","six","seven","eight","nine","left","right","down","up","return","play"],e(this.defaultRemoteKeyHandler,this)),this.on("show-complete",this.showInfoPanel)};return a(h,b),h.prototype.onPlayRequest=function(){var a=this.model.getItem();this.startGame(a)},h.prototype.onStopRequested=function(){this.activeFrame!==null&&this.endGame(),h.superClass_.onStopRequested.call(this)},h.prototype.showInfoPanel=function(){exportedSymbols.tui.instance.setPanels(!1,!0,undefined,f.render({things:this.hints.general}))},h.prototype.defaultRemoteKeyHandler=function(a){if(this.activeFrame===null)h.superClass_.defaultRemoteKeyHandler.call(this,a);else switch(a){case"return":this.endGame();break;default:this.activeFrame.contentWindow.remoteEvent(a)}},h.reinit=function(){g.initEvents()},h.prototype.startGame=function(a){c.empty(this.gamelayer),this.activeFrame=c.create("iframe",{style:d.getStyle(d.getSizesForGameLayer())}),this.activeFrame.onload=h.reinit,this.activeFrame.setAttribute("src",window.location.href+"app/"+a.path),c.adopt(this.gamelayer,this.activeFrame),c.adopt(this.gamelayer),this.hints[a.publishName]?exportedSymbols.tui.instance.setPanels(!1,!0,undefined,f.render({things:this.hints[a.publishName]})):exportedSymbols.tui.instance.setPanels(!1,!1)},h.prototype.endGame=function(){exportedSymbols.tui.instance.setPanels(!1,!1),c.dispose(this.gamelayer),this.gamelayer.innerHTML="",this.activeFrame.onload=null,this.activeFrame=null},h.prototype.disposeInternal=function(){h.superClass_.disposeInternal.call(this),c.dispose(this.gamelayer),delete this.gamelayer},h}),define("utils/miniscreen",["oop/inherit","oop/ievent","dom/dom","shims/bind","utils/visualapp","data/static-strings","tpl/infobuttons"],function(a,b,c,d,e,f,g){var h=function(a){b.call(this),this.name=a.name,this.template_=a.template,this.deps_=a.deps,this.appEvents={},this.master=null;var c=d(this.eventReceiver,this);h.remoteKeys_.forEach(d(function(a){this.appEvents[a]={name:a,func:c,attached:!1}},this))};return a(h,b),h.remoteKeys_=["left","right","up","down","ok","return","zero","one","two","three","four","five","six","seven","eight","nine","delete"],h.prototype.render=function(a){var b=c.getInnerNodes(this.template_.render({things:this.master.getData(this.name),header:f.screens[this.name].list.header,body:f.screens[this.name].list.body}));this.dom_&&this.dom_.parentNode?this.dom_.parentNode.replaceChild(b,this.dom_):c.adopt(a,b),this.dom_=b},h.prototype.attachEvents=function(a,b){e.prototype.attachEvents.call(this,a);if(a){this.fire("activated",b);if(this.panelSetup){var c={};for(var d=0;d<this.panelSetup.keys.length;d++)c[this.panelSetup.keys[d]]=f.screens[this.name].panels.bottom[this.panelSetup.keys[d]];exportedSymbols.tui.instance.setPanels(this.panelSetup.top,this.panelSetup.bottom,undefined,g.render({things:c}))}}},h.prototype.eventReceiver=function(a){this.fire("remote-key",a)},h.prototype.getDom=function(){return this.dom_?this.dom_:null},h.prototype.disposeInternal=function(){this.constructor.superClass_.disposeInternal.call(this),delete this.template_,delete this.dom_,delete this.name,delete this.appEvents},h}),define("utils/multiscreen",["oop/inherit","utils/visualapp","utils/miniscreen","dom/dom","shims/bind","net/simplexhr"],function(a,b,c,d,e,f){var g=function(a){b.call(this,a),this.screens=a.miniscreens,this.assets={},this.currentScreenIndex=0,this.initScreens(),this.loadDeps(),this.innerContainer=document.createElement("div"),this.innerContainer.className="tui-horizontal-centered tui-scrollable-vertical";var c=e(this.selectMiniScreen,this);this.appEvents={chup:{name:"chup",func:c,attached:!1},chdown:{name:"chdown",func:c,attached:!1}},this.on("start-requested",this.start),this.on("show-requested",this.onShowRequested),this.on("show-complete",this.onShowComplete),this.on("stop-requested",this.onStopRequested)};return a(g,b),g.prototype.currentScreenIndex=0,g.prototype.isRendered=!1,g.prototype.depsLoaded_=!1,g.prototype.reload=function(){delete this.isRendered,this.loadDeps()},g.prototype.loadDeps=function(){var a=[],b,c=[];for(b in this.assets)c.push(b),a.push(this.assets[b].src);if(a.length===0){this.depsLoaded_=!0;return}f.getMany(a,e(this.loadData,this,c),{parse:!0})},g.prototype.loadData=function(a,b){var c;for(c=0;c<b.length;c++)this.assets[a[c]].data=b[c];this.depsLoaded_=!0,this.isRendered||this.fire("start-ready")},g.prototype.initScreens=function(a){var b,c=this.screens.length;for(b=0;b<c;b++)this.screens[b].deps_&&this.registerDataDependency(this.screens[b].name,this.screens[b].deps_),this.screens[b].master=this},g.prototype.registerDataDependency=function(a,b){this.assets[a]||(this.assets[a]={src:b,data:null})},g.prototype.onShowRequested=function(){if(!this.isRendered){this.innerContainer.style.width=this.container.style.width,this.innerContainer.style.height=this.container.style.height;var a;for(a=0;a<this.screens.length;a++)this.screens[a].render(this.innerContainer);this.isRendered=!0}this.container.innerHTML="",this.innerContainer.parentNode===null&&d.adopt(this.container,this.innerContainer),this.fire("show-complete")},g.prototype.getData=function(a){return this.assets[a]?this.assets[a].data:undefined},g.prototype.onShowComplete=function(){this.attachEvents(!0),this.activateScreen(this.currentScreenIndex)},g.prototype.onStopRequested=function(){this.screens[this.currentScreenIndex].attachEvents(!1),this.attachEvents(!1),this.container.innerHTML=""},g.prototype.start=function(){if(!this.depsLoaded_)return;this.fire("start-ready")},g.prototype.selectMiniScreen=function(a){a==="chdown"?this.currentScreenIndex+1<this.screens.length&&this.activateScreen(this.currentScreenIndex+1):a==="chup"&&this.currentScreenIndex-1>-1&&this.activateScreen(this.currentScreenIndex-1)},g.prototype.activateScreen=function(a,b){typeof a=="number"&&(this.screens[this.currentScreenIndex].attachEvents(!1),this.currentScreenIndex=a,this.innerContainer.scrollTop=480*this.currentScreenIndex,this.screens[this.currentScreenIndex].attachEvents(!0,b))},g.prototype.disposeInternal=function(){this.constructor.superClass_.disposeInternal.call(this),delete this.screens},g}),define("utils/multiscreenjson",["oop/inherit","utils/multiscreen","transport/request","transport/response","json/json","shims/bind"],function(a,b,c,d,e,f){var g=function(a){this.commonDeps_=a.deps,b.call(this,a),this.commonData_=null};return a(g,b),g.prototype.loadDeps=function(){var a=c.create("calld",this.commonDeps_);d.register(a,f(this.loadData,this)),a.send()},g.prototype.loadData=function(a){a.status==="OK"?this.commonData_=e.parse(a.content):this.commonData_={},this.depsLoaded_=!0,this.isRendered||this.fire("start-ready")},g.prototype.getData=function(a){if(this.commonData_[a])return this.commonData_[a]},g}),define("utils/telescreen",["oop/inherit","utils/miniscreen"],function(a,b){var c=function(a){b.call(this,a),this.on("remote-key",this.remoteKeyHandler),this.setupPanels(a.panels)};return a(c,b),c.prototype.remoteKeyHandler=function(a){a==="return"?this.master.activateScreen(0):this.keyHandler(a)},c.prototype.useTopPanel=!1,c.prototype.useBottomPanel=!0,c.prototype.setupPanels=function(a){this.panelSetup={top:typeof a.top=="boolean"?a.top:this.useTopPanel,bottom:typeof a.bottom=="boolean"?a.bottom:this.useBottomPanel,topContent:a.topContent,keys:a.keys||[]}},c.prototype.keyHandler=function(a){},c.prototype.disposeInternal=function(){c.superClass_.disposeInternal.call(this),delete this.keyHandler},c}),define("utils/scrollable",["oop/inherit","oop/idisposable","dom/dom"],function(a,b,c){var d=function(a,c){b.call(this),this.setContainerSelector(a),this.setElementSelector(c)};return a(d,b),d.prototype.containerSelector_,d.prototype.setContainerSelector=function(a){typeof a=="string"&&(this.containerSelector_=a)},d.prototype.elementSelector_,d.prototype.setElementSelector=function(a){this.elementSelector_=a},d.prototype.scroll=function(a){var b=a||c.$(this.elementSelector_),d=c.$(this.containerSelector_);if(b===null)return;var e=b.offsetTop,f=b.scrollHeight,g=d.scrollTop,h=d.clientHeight;e+f>g+h?d.scrollTop=e-h+f:g>e&&(d.scrollTop=e)},d.prototype.disposeInternal=function(){this.constructor.superClass_.disposeInternal.call(this),delete this.containerSelector_,delete this.elementSelector_},d}),define("utils/miniscreenjson",["oop/inherit","utils/telescreen","dom/dom","data/static-strings","dom/classes","utils/scrollable","transport/request","transport/response","shims/bind","json/json","ui/popup"],function(a,b,c,d,e,f,g,h,i,j,k){var l=function(a){b.call(this,a),this.currentItem=0,this.scroller_=null,this.on("activated",this.onActivate),this.selectedIndex=null,this.listIsActive=!1,this.activeListNode=null,this.updates_={}};return a(l,b),l.prototype.activeDataCssSelector=".general-item.active",l.prototype.isDirty_=!1,l.prototype.dataCssSelector=".general-item",l.prototype.updateRun="update_section_json",l.prototype.activeDataCss="active",l.prototype.getData=function(){return this.master.getData(this.name)},l.prototype.keyHandler=function(a){switch(a){case"up":this.listIsActive?this.selectInList(!1):this.selectItem(this.selectedIndex-1);break;case"down":this.listIsActive?this.selectInList(!0):this.selectItem(this.selectedIndex+1);break;case"ok":this.listIsActive?this.activateItemInList():this.activateItem();break;case"return":this.listIsActive?this.deactivateItem():this.isDirty_?k.createDialog("confirm",undefined,i(this.handleUpdateDataOnServer,this),d.components.dialogs.confirmApply):this.master.activateScreen(0);break;default:}},l.prototype.handleUpdateDataOnServer=function(a){if(a===1){this.updates_.run=this.updateRun,this.updates_.newif=1,this.updates_.section=this.name;var b=g.create("calld",this.updates_);h.register(b,i(this.handleSettingsUpdate,this)),b.send()}else delete this.isDirty_,this.updates_=null,this.updates_={},this.master.reload()},l.prototype.handleSettingsUpdate=function(a){if(a.status==="OK"){var b=j.parse(a.content);b.status.toLowerCase()!=="ok"?k.createDialog("message",undefined,undefined,d.components.dialogs.updateFailed+b.message):(delete this.isDirty_,this.updates_=null,this.updates_=[])}},l.prototype.remoteKeyHandler=l.prototype.keyHandler,l.prototype.deactivateItem=function(){var a=c.$(".row."+this.activeDataCss,this.activeListNode);e.removeClasses(a,this.activeDataCss),e.removeClasses(this.activeListNode,this.activeDataCss),this.activeListNode=null,this.listIsActive=!1;var b=this.getDataNodes();e.addClasses(b[this.selectedIndex],this.activeDataCss)},l.prototype.getDataNodes=function(){return c.$$(this.dataCssSelector,this.dom_)},l.prototype.selectInList=function(a){var b=c.$("."+this.activeDataCss,this.activeListNode),d;a?d=b.nextElementSibling:d=b.previousElementSibling,d!==null&&e.hasClass(d,"row")&&(e.removeClasses(b,this.activeDataCss),e.addClasses(d,this.activeDataCss),this.scroller_.scroll(d))},l.prototype.activateItemInList=function(){var a=this.getData()[this.selectedIndex],b=a.name,d=a.value,e=c.dataGet(c.$("."+this.activeDataCss,this.activeListNode),"key");e!=d&&(c.$(".value",this.getDataNodes()[this.selectedIndex]).textContent=a.values[e],this.isDirty_=!0,this.updates_[encodeURIComponent(b)]=encodeURIComponent(e),a.servicedata&&(this.updates_.servicedata=a.servicedata)),this.deactivateItem()},l.prototype.activateItem=function(){var a=this.getData(),b=this.selectedIndex;a=a[b];switch(a.type){case"list":this.showListOptions();break;case"static":break;case"action":a["action"]=="confirm"?k.createDialog("confirm",undefined,i(this.performAction,this,a.exec),a.actiontitle):a["action"]=="prompt"&&(a["prompttype"]=="text"?k.createDialog("input",!0,i(this.setValueByText,this,a.name,this.getDataNodes()[b]),a.help):a["prompttype"]=="ip"&&k.createDialog("ip",!1,i(this.setIpAddress,this),a.help));break;case"password":k.createDialog("password",!0,i(this.setPassWord,this,a.name,0),d.common.new_password);break;case"string":k.createDialog("input",!0,i(this.setValueByText,this,a.name,this.getDataNodes()[b]),a.publishName);break;default:}},l.prototype.setValueByText=function(a,b,d){d!==""&&(this.isDirty_=!0,this.updates_[a]=d,c.$(".value",b).textContent=d)},l.prototype.setPassWord=function(a,b,c){c!==""?(this.isDirty_=!0,this.updates_[a]=c,b===0&&k.createDialog("password",!0,i(this.setPassWord,this,a+"2",1),d.common.old_password)):b===1&&delete this.updates_[a]},l.prototype.performAction=function(a,b){if(b===1){var c=g.create("calld",a);h.register(c,i(this.handleExecError,this)),c.send()}},l.prototype.handleExecError=function(a){},l.prototype.showListOptions=function(){var a=c.$(this.activeDataCssSelector,this.dom_),b=a.nextElementSibling;e.removeClasses(a,this.activeDataCss),e.addClasses(b,this.activeDataCss),this.activeListNode=b,this.listIsActive=!0,e.addClasses(c.$(".row",this.activeListNode),this.activeDataCss),this.scroller_.scroll(b),this.scroller_.scroll(c.$(".row",this.activeListNode))},l.prototype.onActivate=function(){this.selectedIndex===null?this.selectItem(0):this.selectItem(this.selectedIndex)},l.prototype.selectItem=function(a){var b=this.getData();if(a>=b.length||a<0)return;this.selectedIndex=a;var d=c.$$(this.dataCssSelector,this.dom_),f=c.$(this.activeDataCssSelector,this.dom_);f!==null&&e.removeClasses(f,this.activeDataCss),e.addClasses(d[this.selectedIndex],this.activeDataCss),this.scroller_.scroll(d[this.selectedIndex])},l.prototype.render=function(a){var b=this.getData(),e=c.getInnerNodes(this.template_.render({items:this.master.getData(this.name),transl:d.screens.setup.header,appname:this.name}));this.dom_&&this.dom_.parentNode?this.dom_.parentNode.replaceChild(e,this.dom_):c.adopt(a,e),this.dom_=e,this.scroller_=new f(".general-content."+this.name,".active")},l}),define("tpl/setupminiscreen",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({"class":"tui-multiscreen general-wrapper"})),buf.push("><div"),buf.push(attrs({"class":"image-selector "+appname})),buf.push("></div><div"),buf.push(attrs({"class":"general-content "+appname})),buf.push(">");for(var i=0;i<items.length;i++)if(items[i].type==="list"){buf.push("<div"),buf.push(attrs({"class":"general-item"})),buf.push("><div"),buf.push(attrs({"class":"settings"})),buf.push(">");var __val__=items[i].publishName;buf.push(null==__val__?"":__val__),buf.push("</div><div"),buf.push(attrs({"class":"value"})),buf.push(">");var __val__=items[i].values[items[i].value];buf.push(null==__val__?"":__val__),buf.push("</div></div><div"),buf.push(attrs({"class":"section"})),buf.push("><div"),buf.push(attrs({style:"float: left; text-align: center; margin-left: 9%; position: relative; top: 8px; width: 36%; margin-bottom: 8px;"})),buf.push(">");var __val__=items[i].help;buf.push(null==__val__?"":__val__),buf.push("</div>");for(var k in items[i].values){buf.push("<div"),buf.push(attrs({"data-key":k,"class":"row"})),buf.push(">");var __val__=items[i].values[k];buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("</div>")}else if(items[i].type==="static"){buf.push("<div"),buf.push(attrs({"class":"general-item inactive"})),buf.push("><div"),buf.push(attrs({"class":"settings"})),buf.push(">");var __val__=items[i].publishName;buf.push(null==__val__?"":__val__),buf.push("</div><div"),buf.push(attrs({"class":"value"})),buf.push(">");var __val__=items[i].value;buf.push(null==__val__?"":__val__),buf.push("</div></div>")}else if(items[i].type==="password"||items[i].type==="string"){buf.push("<div"),buf.push(attrs({"class":"general-item"})),buf.push("><div"),buf.push(attrs({"class":"settings"})),buf.push(">");var __val__=items[i].publishName;buf.push(null==__val__?"":__val__),buf.push("</div><div"),buf.push(attrs({"class":"value"})),buf.push(">");var __val__=items[i].value;buf.push(null==__val__?"":__val__),buf.push("</div></div>")}else if(items[i].type==="action"){buf.push("<div"),buf.push(attrs({"class":"general-item"})),buf.push("><div"),buf.push(attrs({"class":"settings"})),buf.push(">");var __val__=items[i].publishName;buf.push(null==__val__?"":__val__),buf.push("</div>");if(typeof items[i].value!="undefined"){buf.push("<div"),buf.push(attrs({"class":"value"})),buf.push(">");var __val__=items[i].value;buf.push(null==__val__?"":__val__),buf.push("</div>")}else{buf.push("<div"),buf.push(attrs({"class":"value"})),buf.push(">");var __val__=items[i].help;buf.push(null==__val__?"":__val__),buf.push("</div>")}buf.push("</div>")}buf.push("</div></div>")}return buf.join("")}return{render:anonymous}}),define("tpl/setup_chooser",["support/runtime","utils/datetime"],function(jade,datetime){function anonymous(locals,attrs,escape,rethrow){var attrs=jade.attrs,escape=jade.escape,rethrow=jade.rethrow,buf=[];with(locals||{}){var interp;buf.push("<div"),buf.push(attrs({"class":"tui-multiscreen setup-container"})),buf.push("><div"),buf.push(attrs({"data-sequence":"1","class":"icon"})),buf.push("><div"),buf.push(attrs({"class":"general"})),buf.push("></div><span"),buf.push(attrs({"class":"setup"})),buf.push(">General</span></div><div"),buf.push(attrs({"data-sequence":"2","class":"icon"})),buf.push("><div"),buf.push(attrs({"class":"iptv-settings"})),buf.push("></div><span>iptv </span></div><div"),buf.push(attrs({"data-sequence":"3","class":"icon"})),buf.push("><div"),buf.push(attrs({"class":"LAN"})),buf.push("></div><span>Lan</span></div><div"),buf.push(attrs({"data-sequence":"4","class":"icon active"})),buf.push("><div"),buf.push(attrs({"class":"WIFI"})),buf.push("></div><span>Wifi</span></div><div"),buf.push(attrs({"data-sequence":"5","class":"icon"})),buf.push("><div"),buf.push(attrs({"class":"voip-settings"})),buf.push("></div><span>voip</span></div></div>")}return buf.join("")}return{render:anonymous}}),define("apps/iptv",["utils/listwithepg","data/static-strings"],function(a,b){return{init:function(){return this.instance===null&&(this.instance=new a({name:"iptv",hints:{ok:b.screens.iptv.panels.bottom.ok,info:b.screens.iptv.panels.bottom.info,playPause:b.screens.iptv.panels.bottom.playPause}})),this.instance},instance:null}}),define("apps/aod",["utils/listingapp"],function(a){return{init:function(){return this.instance===null&&(this.instance=new a({name:"aod",shouldJump:!0})),this.instance},instance:null}}),define("apps/games",["utils/framedapp","data/static-strings","model/listmodel"],function(a,b,c){return{instance:null,init:function(){return this.instance===null&&(this.instance=new a({name:"games",shouldJump:!1,itemWidth:160,itemHeight:138,datamodel:c}),this.instance.hints={general:{ok:b.games.panels.bottom.ok,"return":b.games.panels.bottom["return"]},Sudoku:{ok:b.games.hints.Sudoku.ok,arrows:b.games.hints.Sudoku.arrows},SizzleBox:{arrows:b.games.hints.SizzleBox.arrows},Hangman:{arrows:b.games.hints.Hangman.arrows,ok:b.games.hints.Hangman.ok}}),this.instance}}}),define("apps/ppv",["utils/listingapp"],function(a){return{instance:null,init:function(){return this.instance===null&&(this.instance=new a({name:"ppv"})),this.instance}}}),define("apps/radio",["utils/listingapp"],function(a){return{instance:null,init:function(){return this.instance===null&&(this.instance=new a({name:"radio"})),this.instance}}}),define("apps/setup",["utils/multiscreenjson","utils/telescreen","dom/dom","dom/classes","tpl/setup_chooser","utils/miniscreenjson","json/json","tpl/setupminiscreen"],function(a,b,c,d,e,f,g,h){var i=new b({name:"chooser",template:e,panels:{keys:["leftRight","ok"]}});i.keyHandler=function(a){var b;typeof a!="string"&&this.setActiveIcon(a);switch(a){case"ok":b=c.$(".active",this.dom_),this.master.activateScreen(parseInt(c.dataGet(b,"sequence"),10));break;case"left":case"right":this.setActiveIcon(a);break;default:}},i.setActiveIcon=function(a){var b=c.$(".active",this.dom_),e;typeof a=="number"?e=c.$$(".icon",this.dom_)[a]:typeof a=="string"&&(a=="right"&&b.nextElementSibling!==null?e=b.nextElementSibling:a=="left"&&b.previousElementSibling!==null&&(e=b.previousElementSibling)),e&&(b!==null&&d.removeClasses(b,"active"),d.addClasses(e,"active"))},i.on("activated",function(a){typeof a!="number"&&(a=0),this.setActiveIcon(a)});var j=new f({name:"general",template:h,panels:{top:!1,bottom:!0,keys:["return"]}}),k=new f({name:"iptv",template:h,panels:{top:!1,bottom:!0,keys:["return"]}}),l=new f({name:"lannetworking",template:h,panels:{top:!1,bottom:!0,keys:["return"]}}),m=new f({name:"wifi",template:h,panels:{top:!1,bottom:!0,keys:["return"]}}),n=new f({name:"voip",template:h,panels:{top:!1,bottom:!0,keys:["return"]}});return{instance:null,init:function(){return this.instance===null&&(this.instance=new a({name:"setup",miniscreens:[i,j,k,l,m,n],deps:{run:"fill_setup_json",newif:1}}),this.instance.fillContent=function(a){}),this.instance}}}),define("apps/uvideo",["utils/listingapp"],function(a){return{instance:null,init:function(){return this.instance===null&&(this.instance=new a({name:"uservideo",canResume:!0})),this.instance}}}),define("apps/vod",["utils/listingapp"],function(a){return{instance:null,init:function(){return this.instance===null&&(this.instance=new a({name:"vod",canResume:!0})),this.instance}}}),require.config({baseUrl:"app",paths:{types:"../library/js/types",window:"../library/js/window","utils/autoid":"../library/js/utils/autoid","templates/compiler":"../library/js/templates/compiler",support:"../library/js/support",shims:"../library/js/shims",oop:"../library/js/oop",nls:"../library/js/nls",net:"../library/js/net",json:"../library/js/json",loader:"../library/js/loader",host:"../library/js/host","env/exports":"../library/js/env/exports",dom:"../library/js/dom",debug:"../library/js/debug",array:"../library/js/array",text:"../library/js/text",string:"../library/js/string","datetime/xdate":"../library/js/datetime/xdate"},urlArgs:"bust="+(new Date).getTime()}),document.body.style.width=window.innerWidth+"px",document.body.style.height=window.innerHeight+"px",require(["ui/load-indicator","config/options","dom/dom","transport/response","transport/request","tui/tui","utils/events","ui/player","debug/log-keeper","debug/simple-console","ui/simplescreenselector","apps/youtube","apps/weather","ui/epgvisual","tpl/infobuttons","utils/listwithepg","utils/framedapp","utils/multiscreenjson","utils/miniscreenjson","utils/scrollable","tpl/setupminiscreen","tpl/setup_chooser","apps/iptv","apps/aod","apps/games","apps/ppv","apps/radio","apps/setup","apps/uvideo","apps/vod","apps/weather","apps/youtube"],function(LoadIndicator,ConfigOptions,dom,Response,Request,TUI,RemoteEvents,Player,LogKeeper,SimpleConsole,AppSelector){LoadIndicator.show(),dom.adopt(dom.create("div",{id:"maincontainer",style:"height: "+window.innerHeight+"px; width: "+window.innerWidth+"px; margin-top: 0; margin-bottom: 0"})),window.transportReceiver=function(a){Response.recall(a)};var getServerConfig=Request.create("calld",{run:"backend_json",newif:1});Response.register(getServerConfig,function(res){res.status=="OK"&&eval(res.content)}),getServerConfig.send(),window.addEventListener("keypress",function(a){tui.keyboardInputHandler_(a)},!1),window.addEventListener("keydown",function(a){var b;switch(a.keyCode){case 8:b="return";break;case 46:b="delete";break;case 37:b="left";break;case 38:b="up";break;case 39:b="right";break;case 40:b="down";break;case 13:b="ok";break;case 36:b="home";break;case 33:b="chup";break;case 34:b="chdown";break;case 73:b="info";break;default:return}window.transportReceiver({header:{type:"event",tag:"0000000000",method:"remote",tstamp:1322144158.278165},event:{key:b}})});var tui=TUI.getInstance(),__startBrowser=function(a){a=="display"&&(Request.create("display",{page:"ui"}).send(),exportedSymbols.tui.instance.restoreEventTree(__startBrowser))};RemoteEvents.addHandlers({globalreturn:{name:"display",func:function(){var a=tui.getGlobalPlayer();a.getState()!==Player.STATES.STOPPED&&(tui.stealEvents(a.keyHandler),a.useVisualPlayer_?a.visualPlayer.focus(!0):a.setVState(Player.VSTATE.OPAQUE))},attached:!1},globalstop:{name:"stop",func:function(){tui.getGlobalPlayer().stop()},attached:!1},loadiptv:{name:"video",func:tui.selectApp,attached:!1},loadonlineradio:{name:"audio",func:tui.selectApp,attached:!1},loadsetup:{name:"setup",func:tui.selectApp,attached:!1},loadWebBrowser:{name:"web",func:function(){Request.create("display",{page:"browser"}).send(),exportedSymbols.tui.instance.stealEvents(__startBrowser)},attached:!1}}),AppSelector.saveShortCut_("setup","setup"),AppSelector.saveShortCut_("video","iptv"),AppSelector.saveShortCut_("audio","radio"),Response.setRemoteKeyHandler(RemoteEvents.defaultEventAccepter),ConfigOptions.DEBUG&&(LogKeeper.getInstance().setLogLevel(LogKeeper.Levels.ALL),(new SimpleConsole).enable()),tui.init(),alert("app://dmcready")}),define("start",function(){})