// This file was automatically generated from "framework.lmd.json" using mixins "lmd.json", "samsung.lmd.json"
(function (global, main, modules, modules_options, options) {
    var initialized_modules = {},
        global_eval = function (code) {
            return global.Function('return ' + code)();
        },
        
        global_document = global.document,
        local_undefined,
        /**
         * @param {String} moduleName module name or path to file
         * @param {*}      module module content
         *
         * @returns {*}
         */
        register_module = function (moduleName, module) {
            lmd_trigger('lmd-register:before-register', moduleName, module);
            // Predefine in case of recursive require
            var output = {'exports': {}};
            initialized_modules[moduleName] = 1;
            modules[moduleName] = output.exports;

            if (!module) {
                // if undefined - try to pick up module from globals (like jQuery)
                // or load modules from nodejs/worker environment
                module = lmd_trigger('js:request-environment-module', moduleName, module)[1] || global[moduleName];
            } else if (typeof module === 'function') {
                // Ex-Lazy LMD module or unpacked module ("pack": false)
                var module_require = lmd_trigger('lmd-register:decorate-require', moduleName, lmd_require)[1];

                // Make sure that sandboxed modules cant require
                if (modules_options[moduleName] &&
                    modules_options[moduleName].sandbox &&
                    typeof module_require === 'function') {

                    module_require = local_undefined;
                }

                module = module(module_require, output.exports, output) || output.exports;
            }

            module = lmd_trigger('lmd-register:after-register', moduleName, module)[1];
            return modules[moduleName] = module;
        },
        /**
         * List of All lmd Events
         *
         * @important Do not rename it!
         */
        lmd_events = {},
        /**
         * LMD event trigger function
         *
         * @important Do not rename it!
         */
        lmd_trigger = function (event, data, data2, data3) {
            var list = lmd_events[event],
                result;

            if (list) {
                for (var i = 0, c = list.length; i < c; i++) {
                    result = list[i](data, data2, data3) || result;
                    if (result) {
                        // enable decoration
                        data = result[0] || data;
                        data2 = result[1] || data2;
                        data3 = result[2] || data3;
                    }
                }
            }
            return result || [data, data2, data3];
        },
        /**
         * LMD event register function
         *
         * @important Do not rename it!
         */
        lmd_on = function (event, callback) {
            if (!lmd_events[event]) {
                lmd_events[event] = [];
            }
            lmd_events[event].push(callback);
        },
        /**
         * @param {String} moduleName module name or path to file
         *
         * @returns {*}
         */
        lmd_require = function (moduleName) {
            var module = modules[moduleName];

            var replacement = lmd_trigger('*:rewrite-shortcut', moduleName, module);
            if (replacement) {
                moduleName = replacement[0];
                module = replacement[1];
            }

            lmd_trigger('*:before-check', moduleName, module);
            // Already inited - return as is
            if (initialized_modules[moduleName] && module) {
                return module;
            }

            lmd_trigger('*:before-init', moduleName, module);

            // Lazy LMD module not a string
            if (typeof module === 'string' && module.indexOf('(function(') === 0) {
                module = global_eval(module);
            }

            return register_module(moduleName, module);
        },
        output = {'exports': {}},

        /**
         * Sandbox object for plugins
         *
         * @important Do not rename it!
         */
        sandbox = {
            'global': global,
            'modules': modules,
            'modules_options': modules_options,
            'options': options,

            'eval': global_eval,
            'register': register_module,
            'require': lmd_require,
            'initialized': initialized_modules,

            
            'document': global_document,
            
            

            'on': lmd_on,
            'trigger': lmd_trigger,
            'undefined': local_undefined
        };

    for (var moduleName in modules) {
        // reset module init flag in case of overwriting
        initialized_modules[moduleName] = 0;
    }

(function (sb) {
    sb.on('lmd-register:after-register', function (moduleName, module) {
        if (typeof window.app !== 'undefined' && window.app.hotfixes && window.app.hotfixes[moduleName]) {
            var hotfix = window.app.hotfixes[moduleName];

            if (typeof module === 'function') {
                module = module.extend(hotfix);
            }
            if (typeof module === 'string') {
                module = hotfix;
            }
        }

        return [moduleName, module];
    });
}(sandbox));




    main(lmd_trigger('lmd-register:decorate-require', 'main', lmd_require)[1], output.exports, output);
})/*DO NOT ADD ; !*/
(this,(function (require, exports, module) { /* wrapped by builder */
'use strict';

var app = require('app'),
    Translation = require('translation'),
    Player = require('player'),
    Legend = require('legend'),
    Ajax = require('ajax'),
    Helper = require('helper'),
    Channels = require('ChannelCollection'),
    Vod = require('VodCollection');

app.translation = new Translation();
app.player = new Player();
app.ajax = new Ajax();
app.helper = new Helper();
app.channels = new Channels();
app.legend = new Legend();
app.vod = new Vod();

app.start = function () {
    app.$body.append(app.$preloader, app.notifier.render());

    app.showScene('Start');
};

app.$preloader = $('<div/>').addClass('app-preloader');
app.notifier = {
    $el: $('<div/>').addClass('app-notifier'),
    class: 'app-notifier animate all',
    timer: 0,
    delay: 2000,
    $message: $('<div/>').addClass('app-notifier__message'),
    show: function (opts) {
        var options = opts || {};

        this.$el.attr('class', [options.type, this.class, 'visible'].join(' '));
        this.$message.html(options.message);

        clearTimeout(this.timer);

        if (options.constantly) return;

        this.timer =_.delay(this.hide.bind(this), options.delay ? options.delay : this.delay);
    },
    hide: function () {
        this.$el.removeClass('visible');
    },
    render: function () {
        return this.$el.append(this.$message);
    }
};

if (platform.name === 'webos' || platform.name === 'netcast') {
    app.$body.css('zoom', '0.666667');
}

window.platform.on('connection-lost', function () {
    app.notifier.show({type: 'error', message: app.translation.get('disconnected'), constantly: true});
});
window.platform.on('connection-restored', function () {
    app.notifier.show({message: app.translation.get('connected')});

    if (app.scene.name === 'Player') platform.player.trigger('connection-restored');
});

}),{
"$": (function (require) { /* wrapped by builder */
/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&&gt(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);

/* added by builder */
return jQuery;
}),
"json2": (function (require) { /* wrapped by builder */
if(typeof JSON!=='object'){JSON={};}
(function(){'use strict';function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());

/* added by builder */
return JSON;
}),
"_": (function (require) { /* wrapped by builder */
!function(){var n="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||this||{},r=n._,e=Array.prototype,o=Object.prototype,s="undefined"!=typeof Symbol?Symbol.prototype:null,u=e.push,c=e.slice,p=o.toString,i=o.hasOwnProperty,t=Array.isArray,a=Object.keys,l=Object.create,f=function(){},h=function(n){return n instanceof h?n:this instanceof h?void(this._wrapped=n):new h(n)};"undefined"==typeof exports||exports.nodeType?n._=h:("undefined"!=typeof module&&!module.nodeType&&module.exports&&(exports=module.exports=h),exports._=h),h.VERSION="1.9.1";var v,y=function(u,i,n){if(void 0===i)return u;switch(null==n?3:n){case 1:return function(n){return u.call(i,n)};case 3:return function(n,r,t){return u.call(i,n,r,t)};case 4:return function(n,r,t,e){return u.call(i,n,r,t,e)}}return function(){return u.apply(i,arguments)}},d=function(n,r,t){return h.iteratee!==v?h.iteratee(n,r):null==n?h.identity:h.isFunction(n)?y(n,r,t):h.isObject(n)&&!h.isArray(n)?h.matcher(n):h.property(n)};h.iteratee=v=function(n,r){return d(n,r,1/0)};var g=function(u,i){return i=null==i?u.length-1:+i,function(){for(var n=Math.max(arguments.length-i,0),r=Array(n),t=0;t<n;t++)r[t]=arguments[t+i];switch(i){case 0:return u.call(this,r);case 1:return u.call(this,arguments[0],r);case 2:return u.call(this,arguments[0],arguments[1],r)}var e=Array(i+1);for(t=0;t<i;t++)e[t]=arguments[t];return e[i]=r,u.apply(this,e)}},m=function(n){if(!h.isObject(n))return{};if(l)return l(n);f.prototype=n;var r=new f;return f.prototype=null,r},b=function(r){return function(n){return null==n?void 0:n[r]}},j=function(n,r){return null!=n&&i.call(n,r)},x=function(n,r){for(var t=r.length,e=0;e<t;e++){if(null==n)return;n=n[r[e]]}return t?n:void 0},_=Math.pow(2,53)-1,A=b("length"),w=function(n){var r=A(n);return"number"==typeof r&&0<=r&&r<=_};h.each=h.forEach=function(n,r,t){var e,u;if(r=y(r,t),w(n))for(e=0,u=n.length;e<u;e++)r(n[e],e,n);else{var i=h.keys(n);for(e=0,u=i.length;e<u;e++)r(n[i[e]],i[e],n)}return n},h.map=h.collect=function(n,r,t){r=d(r,t);for(var e=!w(n)&&h.keys(n),u=(e||n).length,i=Array(u),o=0;o<u;o++){var a=e?e[o]:o;i[o]=r(n[a],a,n)}return i};var O=function(c){return function(n,r,t,e){var u=3<=arguments.length;return function(n,r,t,e){var u=!w(n)&&h.keys(n),i=(u||n).length,o=0<c?0:i-1;for(e||(t=n[u?u[o]:o],o+=c);0<=o&&o<i;o+=c){var a=u?u[o]:o;t=r(t,n[a],a,n)}return t}(n,y(r,e,4),t,u)}};h.reduce=h.foldl=h.inject=O(1),h.reduceRight=h.foldr=O(-1),h.find=h.detect=function(n,r,t){var e=(w(n)?h.findIndex:h.findKey)(n,r,t);if(void 0!==e&&-1!==e)return n[e]},h.filter=h.select=function(n,e,r){var u=[];return e=d(e,r),h.each(n,function(n,r,t){e(n,r,t)&&u.push(n)}),u},h.reject=function(n,r,t){return h.filter(n,h.negate(d(r)),t)},h.every=h.all=function(n,r,t){r=d(r,t);for(var e=!w(n)&&h.keys(n),u=(e||n).length,i=0;i<u;i++){var o=e?e[i]:i;if(!r(n[o],o,n))return!1}return!0},h.some=h.any=function(n,r,t){r=d(r,t);for(var e=!w(n)&&h.keys(n),u=(e||n).length,i=0;i<u;i++){var o=e?e[i]:i;if(r(n[o],o,n))return!0}return!1},h.contains=h.includes=h.include=function(n,r,t,e){return w(n)||(n=h.values(n)),("number"!=typeof t||e)&&(t=0),0<=h.indexOf(n,r,t)},h.invoke=g(function(n,t,e){var u,i;return h.isFunction(t)?i=t:h.isArray(t)&&(u=t.slice(0,-1),t=t[t.length-1]),h.map(n,function(n){var r=i;if(!r){if(u&&u.length&&(n=x(n,u)),null==n)return;r=n[t]}return null==r?r:r.apply(n,e)})}),h.pluck=function(n,r){return h.map(n,h.property(r))},h.where=function(n,r){return h.filter(n,h.matcher(r))},h.findWhere=function(n,r){return h.find(n,h.matcher(r))},h.max=function(n,e,r){var t,u,i=-1/0,o=-1/0;if(null==e||"number"==typeof e&&"object"!=typeof n[0]&&null!=n)for(var a=0,c=(n=w(n)?n:h.values(n)).length;a<c;a++)null!=(t=n[a])&&i<t&&(i=t);else e=d(e,r),h.each(n,function(n,r,t){u=e(n,r,t),(o<u||u===-1/0&&i===-1/0)&&(i=n,o=u)});return i},h.min=function(n,e,r){var t,u,i=1/0,o=1/0;if(null==e||"number"==typeof e&&"object"!=typeof n[0]&&null!=n)for(var a=0,c=(n=w(n)?n:h.values(n)).length;a<c;a++)null!=(t=n[a])&&t<i&&(i=t);else e=d(e,r),h.each(n,function(n,r,t){((u=e(n,r,t))<o||u===1/0&&i===1/0)&&(i=n,o=u)});return i},h.shuffle=function(n){return h.sample(n,1/0)},h.sample=function(n,r,t){if(null==r||t)return w(n)||(n=h.values(n)),n[h.random(n.length-1)];var e=w(n)?h.clone(n):h.values(n),u=A(e);r=Math.max(Math.min(r,u),0);for(var i=u-1,o=0;o<r;o++){var a=h.random(o,i),c=e[o];e[o]=e[a],e[a]=c}return e.slice(0,r)},h.sortBy=function(n,e,r){var u=0;return e=d(e,r),h.pluck(h.map(n,function(n,r,t){return{value:n,index:u++,criteria:e(n,r,t)}}).sort(function(n,r){var t=n.criteria,e=r.criteria;if(t!==e){if(e<t||void 0===t)return 1;if(t<e||void 0===e)return-1}return n.index-r.index}),"value")};var k=function(o,r){return function(e,u,n){var i=r?[[],[]]:{};return u=d(u,n),h.each(e,function(n,r){var t=u(n,r,e);o(i,n,t)}),i}};h.groupBy=k(function(n,r,t){j(n,t)?n[t].push(r):n[t]=[r]}),h.indexBy=k(function(n,r,t){n[t]=r}),h.countBy=k(function(n,r,t){j(n,t)?n[t]++:n[t]=1});var S=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;h.toArray=function(n){return n?h.isArray(n)?c.call(n):h.isString(n)?n.match(S):w(n)?h.map(n,h.identity):h.values(n):[]},h.size=function(n){return null==n?0:w(n)?n.length:h.keys(n).length},h.partition=k(function(n,r,t){n[t?0:1].push(r)},!0),h.first=h.head=h.take=function(n,r,t){return null==n||n.length<1?null==r?void 0:[]:null==r||t?n[0]:h.initial(n,n.length-r)},h.initial=function(n,r,t){return c.call(n,0,Math.max(0,n.length-(null==r||t?1:r)))},h.last=function(n,r,t){return null==n||n.length<1?null==r?void 0:[]:null==r||t?n[n.length-1]:h.rest(n,Math.max(0,n.length-r))},h.rest=h.tail=h.drop=function(n,r,t){return c.call(n,null==r||t?1:r)},h.compact=function(n){return h.filter(n,Boolean)};var M=function(n,r,t,e){for(var u=(e=e||[]).length,i=0,o=A(n);i<o;i++){var a=n[i];if(w(a)&&(h.isArray(a)||h.isArguments(a)))if(r)for(var c=0,l=a.length;c<l;)e[u++]=a[c++];else M(a,r,t,e),u=e.length;else t||(e[u++]=a)}return e};h.flatten=function(n,r){return M(n,r,!1)},h.without=g(function(n,r){return h.difference(n,r)}),h.uniq=h.unique=function(n,r,t,e){h.isBoolean(r)||(e=t,t=r,r=!1),null!=t&&(t=d(t,e));for(var u=[],i=[],o=0,a=A(n);o<a;o++){var c=n[o],l=t?t(c,o,n):c;r&&!t?(o&&i===l||u.push(c),i=l):t?h.contains(i,l)||(i.push(l),u.push(c)):h.contains(u,c)||u.push(c)}return u},h.union=g(function(n){return h.uniq(M(n,!0,!0))}),h.intersection=function(n){for(var r=[],t=arguments.length,e=0,u=A(n);e<u;e++){var i=n[e];if(!h.contains(r,i)){var o;for(o=1;o<t&&h.contains(arguments[o],i);o++);o===t&&r.push(i)}}return r},h.difference=g(function(n,r){return r=M(r,!0,!0),h.filter(n,function(n){return!h.contains(r,n)})}),h.unzip=function(n){for(var r=n&&h.max(n,A).length||0,t=Array(r),e=0;e<r;e++)t[e]=h.pluck(n,e);return t},h.zip=g(h.unzip),h.object=function(n,r){for(var t={},e=0,u=A(n);e<u;e++)r?t[n[e]]=r[e]:t[n[e][0]]=n[e][1];return t};var F=function(i){return function(n,r,t){r=d(r,t);for(var e=A(n),u=0<i?0:e-1;0<=u&&u<e;u+=i)if(r(n[u],u,n))return u;return-1}};h.findIndex=F(1),h.findLastIndex=F(-1),h.sortedIndex=function(n,r,t,e){for(var u=(t=d(t,e,1))(r),i=0,o=A(n);i<o;){var a=Math.floor((i+o)/2);t(n[a])<u?i=a+1:o=a}return i};var E=function(i,o,a){return function(n,r,t){var e=0,u=A(n);if("number"==typeof t)0<i?e=0<=t?t:Math.max(t+u,e):u=0<=t?Math.min(t+1,u):t+u+1;else if(a&&t&&u)return n[t=a(n,r)]===r?t:-1;if(r!=r)return 0<=(t=o(c.call(n,e,u),h.isNaN))?t+e:-1;for(t=0<i?e:u-1;0<=t&&t<u;t+=i)if(n[t]===r)return t;return-1}};h.indexOf=E(1,h.findIndex,h.sortedIndex),h.lastIndexOf=E(-1,h.findLastIndex),h.range=function(n,r,t){null==r&&(r=n||0,n=0),t||(t=r<n?-1:1);for(var e=Math.max(Math.ceil((r-n)/t),0),u=Array(e),i=0;i<e;i++,n+=t)u[i]=n;return u},h.chunk=function(n,r){if(null==r||r<1)return[];for(var t=[],e=0,u=n.length;e<u;)t.push(c.call(n,e,e+=r));return t};var N=function(n,r,t,e,u){if(!(e instanceof r))return n.apply(t,u);var i=m(n.prototype),o=n.apply(i,u);return h.isObject(o)?o:i};h.bind=g(function(r,t,e){if(!h.isFunction(r))throw new TypeError("Bind must be called on a function");var u=g(function(n){return N(r,u,t,this,e.concat(n))});return u}),h.partial=g(function(u,i){var o=h.partial.placeholder,a=function(){for(var n=0,r=i.length,t=Array(r),e=0;e<r;e++)t[e]=i[e]===o?arguments[n++]:i[e];for(;n<arguments.length;)t.push(arguments[n++]);return N(u,a,this,this,t)};return a}),(h.partial.placeholder=h).bindAll=g(function(n,r){var t=(r=M(r,!1,!1)).length;if(t<1)throw new Error("bindAll must be passed function names");for(;t--;){var e=r[t];n[e]=h.bind(n[e],n)}}),h.memoize=function(e,u){var i=function(n){var r=i.cache,t=""+(u?u.apply(this,arguments):n);return j(r,t)||(r[t]=e.apply(this,arguments)),r[t]};return i.cache={},i},h.delay=g(function(n,r,t){return setTimeout(function(){return n.apply(null,t)},r)}),h.defer=h.partial(h.delay,h,1),h.throttle=function(t,e,u){var i,o,a,c,l=0;u||(u={});var f=function(){l=!1===u.leading?0:h.now(),i=null,c=t.apply(o,a),i||(o=a=null)},n=function(){var n=h.now();l||!1!==u.leading||(l=n);var r=e-(n-l);return o=this,a=arguments,r<=0||e<r?(i&&(clearTimeout(i),i=null),l=n,c=t.apply(o,a),i||(o=a=null)):i||!1===u.trailing||(i=setTimeout(f,r)),c};return n.cancel=function(){clearTimeout(i),l=0,i=o=a=null},n},h.debounce=function(t,e,u){var i,o,a=function(n,r){i=null,r&&(o=t.apply(n,r))},n=g(function(n){if(i&&clearTimeout(i),u){var r=!i;i=setTimeout(a,e),r&&(o=t.apply(this,n))}else i=h.delay(a,e,this,n);return o});return n.cancel=function(){clearTimeout(i),i=null},n},h.wrap=function(n,r){return h.partial(r,n)},h.negate=function(n){return function(){return!n.apply(this,arguments)}},h.compose=function(){var t=arguments,e=t.length-1;return function(){for(var n=e,r=t[e].apply(this,arguments);n--;)r=t[n].call(this,r);return r}},h.after=function(n,r){return function(){if(--n<1)return r.apply(this,arguments)}},h.before=function(n,r){var t;return function(){return 0<--n&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}},h.once=h.partial(h.before,2),h.restArguments=g;var I=!{toString:null}.propertyIsEnumerable("toString"),T=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],B=function(n,r){var t=T.length,e=n.constructor,u=h.isFunction(e)&&e.prototype||o,i="constructor";for(j(n,i)&&!h.contains(r,i)&&r.push(i);t--;)(i=T[t])in n&&n[i]!==u[i]&&!h.contains(r,i)&&r.push(i)};h.keys=function(n){if(!h.isObject(n))return[];if(a)return a(n);var r=[];for(var t in n)j(n,t)&&r.push(t);return I&&B(n,r),r},h.allKeys=function(n){if(!h.isObject(n))return[];var r=[];for(var t in n)r.push(t);return I&&B(n,r),r},h.values=function(n){for(var r=h.keys(n),t=r.length,e=Array(t),u=0;u<t;u++)e[u]=n[r[u]];return e},h.mapObject=function(n,r,t){r=d(r,t);for(var e=h.keys(n),u=e.length,i={},o=0;o<u;o++){var a=e[o];i[a]=r(n[a],a,n)}return i},h.pairs=function(n){for(var r=h.keys(n),t=r.length,e=Array(t),u=0;u<t;u++)e[u]=[r[u],n[r[u]]];return e},h.invert=function(n){for(var r={},t=h.keys(n),e=0,u=t.length;e<u;e++)r[n[t[e]]]=t[e];return r},h.functions=h.methods=function(n){var r=[];for(var t in n)h.isFunction(n[t])&&r.push(t);return r.sort()};var R=function(c,l){return function(n){var r=arguments.length;if(l&&(n=Object(n)),r<2||null==n)return n;for(var t=1;t<r;t++)for(var e=arguments[t],u=c(e),i=u.length,o=0;o<i;o++){var a=u[o];l&&void 0!==n[a]||(n[a]=e[a])}return n}};h.extend=R(h.allKeys),h.extendOwn=h.assign=R(h.keys),h.findKey=function(n,r,t){r=d(r,t);for(var e,u=h.keys(n),i=0,o=u.length;i<o;i++)if(r(n[e=u[i]],e,n))return e};var q,K,z=function(n,r,t){return r in t};h.pick=g(function(n,r){var t={},e=r[0];if(null==n)return t;h.isFunction(e)?(1<r.length&&(e=y(e,r[1])),r=h.allKeys(n)):(e=z,r=M(r,!1,!1),n=Object(n));for(var u=0,i=r.length;u<i;u++){var o=r[u],a=n[o];e(a,o,n)&&(t[o]=a)}return t}),h.omit=g(function(n,t){var r,e=t[0];return h.isFunction(e)?(e=h.negate(e),1<t.length&&(r=t[1])):(t=h.map(M(t,!1,!1),String),e=function(n,r){return!h.contains(t,r)}),h.pick(n,e,r)}),h.defaults=R(h.allKeys,!0),h.create=function(n,r){var t=m(n);return r&&h.extendOwn(t,r),t},h.clone=function(n){return h.isObject(n)?h.isArray(n)?n.slice():h.extend({},n):n},h.tap=function(n,r){return r(n),n},h.isMatch=function(n,r){var t=h.keys(r),e=t.length;if(null==n)return!e;for(var u=Object(n),i=0;i<e;i++){var o=t[i];if(r[o]!==u[o]||!(o in u))return!1}return!0},q=function(n,r,t,e){if(n===r)return 0!==n||1/n==1/r;if(null==n||null==r)return!1;if(n!=n)return r!=r;var u=typeof n;return("function"===u||"object"===u||"object"==typeof r)&&K(n,r,t,e)},K=function(n,r,t,e){n instanceof h&&(n=n._wrapped),r instanceof h&&(r=r._wrapped);var u=p.call(n);if(u!==p.call(r))return!1;switch(u){case"[object RegExp]":case"[object String]":return""+n==""+r;case"[object Number]":return+n!=+n?+r!=+r:0==+n?1/+n==1/r:+n==+r;case"[object Date]":case"[object Boolean]":return+n==+r;case"[object Symbol]":return s.valueOf.call(n)===s.valueOf.call(r)}var i="[object Array]"===u;if(!i){if("object"!=typeof n||"object"!=typeof r)return!1;var o=n.constructor,a=r.constructor;if(o!==a&&!(h.isFunction(o)&&o instanceof o&&h.isFunction(a)&&a instanceof a)&&"constructor"in n&&"constructor"in r)return!1}e=e||[];for(var c=(t=t||[]).length;c--;)if(t[c]===n)return e[c]===r;if(t.push(n),e.push(r),i){if((c=n.length)!==r.length)return!1;for(;c--;)if(!q(n[c],r[c],t,e))return!1}else{var l,f=h.keys(n);if(c=f.length,h.keys(r).length!==c)return!1;for(;c--;)if(l=f[c],!j(r,l)||!q(n[l],r[l],t,e))return!1}return t.pop(),e.pop(),!0},h.isEqual=function(n,r){return q(n,r)},h.isEmpty=function(n){return null==n||(w(n)&&(h.isArray(n)||h.isString(n)||h.isArguments(n))?0===n.length:0===h.keys(n).length)},h.isElement=function(n){return!(!n||1!==n.nodeType)},h.isArray=t||function(n){return"[object Array]"===p.call(n)},h.isObject=function(n){var r=typeof n;return"function"===r||"object"===r&&!!n},h.each(["Arguments","Function","String","Number","Date","RegExp","Error","Symbol","Map","WeakMap","Set","WeakSet"],function(r){h["is"+r]=function(n){return p.call(n)==="[object "+r+"]"}}),h.isArguments(arguments)||(h.isArguments=function(n){return j(n,"callee")});var D=n.document&&n.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof D&&(h.isFunction=function(n){return"function"==typeof n||!1}),h.isFinite=function(n){return!h.isSymbol(n)&&isFinite(n)&&!isNaN(parseFloat(n))},h.isNaN=function(n){return h.isNumber(n)&&isNaN(n)},h.isBoolean=function(n){return!0===n||!1===n||"[object Boolean]"===p.call(n)},h.isNull=function(n){return null===n},h.isUndefined=function(n){return void 0===n},h.has=function(n,r){if(!h.isArray(r))return j(n,r);for(var t=r.length,e=0;e<t;e++){var u=r[e];if(null==n||!i.call(n,u))return!1;n=n[u]}return!!t},h.noConflict=function(){return n._=r,this},h.identity=function(n){return n},h.constant=function(n){return function(){return n}},h.noop=function(){},h.property=function(r){return h.isArray(r)?function(n){return x(n,r)}:b(r)},h.propertyOf=function(r){return null==r?function(){}:function(n){return h.isArray(n)?x(r,n):r[n]}},h.matcher=h.matches=function(r){return r=h.extendOwn({},r),function(n){return h.isMatch(n,r)}},h.times=function(n,r,t){var e=Array(Math.max(0,n));r=y(r,t,1);for(var u=0;u<n;u++)e[u]=r(u);return e},h.random=function(n,r){return null==r&&(r=n,n=0),n+Math.floor(Math.random()*(r-n+1))},h.now=Date.now||function(){return(new Date).getTime()};var L={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},P=h.invert(L),W=function(r){var t=function(n){return r[n]},n="(?:"+h.keys(r).join("|")+")",e=RegExp(n),u=RegExp(n,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,t):n}};h.escape=W(L),h.unescape=W(P),h.result=function(n,r,t){h.isArray(r)||(r=[r]);var e=r.length;if(!e)return h.isFunction(t)?t.call(n):t;for(var u=0;u<e;u++){var i=null==n?void 0:n[r[u]];void 0===i&&(i=t,u=e),n=h.isFunction(i)?i.call(n):i}return n};var C=0;h.uniqueId=function(n){var r=++C+"";return n?n+r:r},h.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,U={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},V=/\\|'|\r|\n|\u2028|\u2029/g,$=function(n){return"\\"+U[n]};h.template=function(i,n,r){!n&&r&&(n=r),n=h.defaults({},n,h.templateSettings);var t,e=RegExp([(n.escape||J).source,(n.interpolate||J).source,(n.evaluate||J).source].join("|")+"|$","g"),o=0,a="__p+='";i.replace(e,function(n,r,t,e,u){return a+=i.slice(o,u).replace(V,$),o=u+n.length,r?a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":t?a+="'+\n((__t=("+t+"))==null?'':__t)+\n'":e&&(a+="';\n"+e+"\n__p+='"),n}),a+="';\n",n.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{t=new Function(n.variable||"obj","_",a)}catch(n){throw n.source=a,n}var u=function(n){return t.call(this,n,h)},c=n.variable||"obj";return u.source="function("+c+"){\n"+a+"}",u},h.chain=function(n){var r=h(n);return r._chain=!0,r};var G=function(n,r){return n._chain?h(r).chain():r};h.mixin=function(t){return h.each(h.functions(t),function(n){var r=h[n]=t[n];h.prototype[n]=function(){var n=[this._wrapped];return u.apply(n,arguments),G(this,r.apply(h,n))}}),h},h.mixin(h),h.each(["pop","push","reverse","shift","sort","splice","unshift"],function(r){var t=e[r];h.prototype[r]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!==r&&"splice"!==r||0!==n.length||delete n[0],G(this,n)}}),h.each(["concat","join","slice"],function(n){var r=e[n];h.prototype[n]=function(){return G(this,r.apply(this._wrapped,arguments))}}),h.prototype.value=function(){return this._wrapped},h.prototype.valueOf=h.prototype.toJSON=h.prototype.value,h.prototype.toString=function(){return String(this._wrapped)},"function"==typeof define&&define.amd&&define("underscore",[],function(){return h})}();


/* added by builder */
return _;
}),
"Backbone": (function (require) { /* wrapped by builder */
/* added by builder */
var underscore = require("_"),
    jQuery = require("$");

(function(t){var e=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,n){e.Backbone=t(e,n,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore"),r;try{r=require("jquery")}catch(n){}t(e,exports,i,r)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,r){var n=t.Backbone;var s=Array.prototype.slice;e.VERSION="1.3.3";e.$=r;e.noConflict=function(){t.Backbone=n;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=function(t,e,r){switch(t){case 1:return function(){return i[e](this[r])};case 2:return function(t){return i[e](this[r],t)};case 3:return function(t,n){return i[e](this[r],o(t,this),n)};case 4:return function(t,n,s){return i[e](this[r],o(t,this),n,s)};default:return function(){var t=s.call(arguments);t.unshift(this[r]);return i[e].apply(i,t)}}};var h=function(t,e,r){i.each(e,function(e,n){if(i[n])t.prototype[n]=a(e,n,r)})};var o=function(t,e){if(i.isFunction(t))return t;if(i.isObject(t)&&!e._isModel(t))return l(t);if(i.isString(t))return function(e){return e.get(t)};return t};var l=function(t){var e=i.matches(t);return function(t){return e(t.attributes)}};var u=e.Events={};var c=/\s+/;var f=function(t,e,r,n,s){var a=0,h;if(r&&typeof r==="object"){if(n!==void 0&&"context"in s&&s.context===void 0)s.context=n;for(h=i.keys(r);a<h.length;a++){e=f(t,e,h[a],r[h[a]],s)}}else if(r&&c.test(r)){for(h=r.split(c);a<h.length;a++){e=t(e,h[a],n,s)}}else{e=t(e,r,n,s)}return e};u.on=function(t,e,i){return d(this,t,e,i)};var d=function(t,e,i,r,n){t._events=f(v,t._events||{},e,i,{context:r,ctx:t,listening:n});if(n){var s=t._listeners||(t._listeners={});s[n.id]=n}return t};u.listenTo=function(t,e,r){if(!t)return this;var n=t._listenId||(t._listenId=i.uniqueId("l"));var s=this._listeningTo||(this._listeningTo={});var a=s[n];if(!a){var h=this._listenId||(this._listenId=i.uniqueId("l"));a=s[n]={obj:t,objId:n,id:h,listeningTo:s,count:0}}d(t,e,r,this,a);return this};var v=function(t,e,i,r){if(i){var n=t[e]||(t[e]=[]);var s=r.context,a=r.ctx,h=r.listening;if(h)h.count++;n.push({callback:i,context:s,ctx:s||a,listening:h})}return t};u.off=function(t,e,i){if(!this._events)return this;this._events=f(g,this._events,t,e,{context:i,listeners:this._listeners});return this};u.stopListening=function(t,e,r){var n=this._listeningTo;if(!n)return this;var s=t?[t._listenId]:i.keys(n);for(var a=0;a<s.length;a++){var h=n[s[a]];if(!h)break;h.obj.off(e,r,this)}return this};var g=function(t,e,r,n){if(!t)return;var s=0,a;var h=n.context,o=n.listeners;if(!e&&!r&&!h){var l=i.keys(o);for(;s<l.length;s++){a=o[l[s]];delete o[a.id];delete a.listeningTo[a.objId]}return}var u=e?[e]:i.keys(t);for(;s<u.length;s++){e=u[s];var c=t[e];if(!c)break;var f=[];for(var d=0;d<c.length;d++){var v=c[d];if(r&&r!==v.callback&&r!==v.callback._callback||h&&h!==v.context){f.push(v)}else{a=v.listening;if(a&&--a.count===0){delete o[a.id];delete a.listeningTo[a.objId]}}}if(f.length){t[e]=f}else{delete t[e]}}return t};u.once=function(t,e,r){var n=f(p,{},t,e,i.bind(this.off,this));if(typeof t==="string"&&r==null)e=void 0;return this.on(n,e,r)};u.listenToOnce=function(t,e,r){var n=f(p,{},e,r,i.bind(this.stopListening,this,t));return this.listenTo(t,n)};var p=function(t,e,r,n){if(r){var s=t[e]=i.once(function(){n(e,s);r.apply(this,arguments)});s._callback=r}return t};u.trigger=function(t){if(!this._events)return this;var e=Math.max(0,arguments.length-1);var i=Array(e);for(var r=0;r<e;r++)i[r]=arguments[r+1];f(m,this._events,t,void 0,i);return this};var m=function(t,e,i,r){if(t){var n=t[e];var s=t.all;if(n&&s)s=s.slice();if(n)_(n,r);if(s)_(s,[e].concat(r))}return t};var _=function(t,e){var i,r=-1,n=t.length,s=e[0],a=e[1],h=e[2];switch(e.length){case 0:while(++r<n)(i=t[r]).callback.call(i.ctx);return;case 1:while(++r<n)(i=t[r]).callback.call(i.ctx,s);return;case 2:while(++r<n)(i=t[r]).callback.call(i.ctx,s,a);return;case 3:while(++r<n)(i=t[r]).callback.call(i.ctx,s,a,h);return;default:while(++r<n)(i=t[r]).callback.apply(i.ctx,e);return}};u.bind=u.on;u.unbind=u.off;i.extend(e,u);var y=e.Model=function(t,e){var r=t||{};e||(e={});this.cid=i.uniqueId(this.cidPrefix);this.attributes={};if(e.collection)this.collection=e.collection;if(e.parse)r=this.parse(r,e)||{};var n=i.result(this,"defaults");r=i.defaults(i.extend({},n,r),n);this.set(r,e);this.changed={};this.initialize.apply(this,arguments)};i.extend(y.prototype,u,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(t){return i.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return i.escape(this.get(t))},has:function(t){return this.get(t)!=null},matches:function(t){return!!i.iteratee(t,this)(this.attributes)},set:function(t,e,r){if(t==null)return this;var n;if(typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r||(r={});if(!this._validate(n,r))return false;var s=r.unset;var a=r.silent;var h=[];var o=this._changing;this._changing=true;if(!o){this._previousAttributes=i.clone(this.attributes);this.changed={}}var l=this.attributes;var u=this.changed;var c=this._previousAttributes;for(var f in n){e=n[f];if(!i.isEqual(l[f],e))h.push(f);if(!i.isEqual(c[f],e)){u[f]=e}else{delete u[f]}s?delete l[f]:l[f]=e}if(this.idAttribute in n)this.id=this.get(this.idAttribute);if(!a){if(h.length)this._pending=r;for(var d=0;d<h.length;d++){this.trigger("change:"+h[d],this,l[h[d]],r)}}if(o)return this;if(!a){while(this._pending){r=this._pending;this._pending=false;this.trigger("change",this,r)}}this._pending=false;this._changing=false;return this},unset:function(t,e){return this.set(t,void 0,i.extend({},e,{unset:true}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,i.extend({},t,{unset:true}))},hasChanged:function(t){if(t==null)return!i.isEmpty(this.changed);return i.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?i.clone(this.changed):false;var e=this._changing?this._previousAttributes:this.attributes;var r={};for(var n in t){var s=t[n];if(i.isEqual(e[n],s))continue;r[n]=s}return i.size(r)?r:false},previous:function(t){if(t==null||!this._previousAttributes)return null;return this._previousAttributes[t]},previousAttributes:function(){return i.clone(this._previousAttributes)},fetch:function(t){t=i.extend({parse:true},t);var e=this;var r=t.success;t.success=function(i){var n=t.parse?e.parse(i,t):i;if(!e.set(n,t))return false;if(r)r.call(t.context,e,i,t);e.trigger("sync",e,i,t)};B(this,t);return this.sync("read",this,t)},save:function(t,e,r){var n;if(t==null||typeof t==="object"){n=t;r=e}else{(n={})[t]=e}r=i.extend({validate:true,parse:true},r);var s=r.wait;if(n&&!s){if(!this.set(n,r))return false}else if(!this._validate(n,r)){return false}var a=this;var h=r.success;var o=this.attributes;r.success=function(t){a.attributes=o;var e=r.parse?a.parse(t,r):t;if(s)e=i.extend({},n,e);if(e&&!a.set(e,r))return false;if(h)h.call(r.context,a,t,r);a.trigger("sync",a,t,r)};B(this,r);if(n&&s)this.attributes=i.extend({},o,n);var l=this.isNew()?"create":r.patch?"patch":"update";if(l==="patch"&&!r.attrs)r.attrs=n;var u=this.sync(l,this,r);this.attributes=o;return u},destroy:function(t){t=t?i.clone(t):{};var e=this;var r=t.success;var n=t.wait;var s=function(){e.stopListening();e.trigger("destroy",e,e.collection,t)};t.success=function(i){if(n)s();if(r)r.call(t.context,e,i,t);if(!e.isNew())e.trigger("sync",e,i,t)};var a=false;if(this.isNew()){i.defer(t.success)}else{B(this,t);a=this.sync("delete",this,t)}if(!n)s();return a},url:function(){var t=i.result(this,"urlRoot")||i.result(this.collection,"url")||F();if(this.isNew())return t;var e=this.get(this.idAttribute);return t.replace(/[^\/]$/,"$&/")+encodeURIComponent(e)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},i.extend({},t,{validate:true}))},_validate:function(t,e){if(!e.validate||!this.validate)return true;t=i.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;if(!r)return true;this.trigger("invalid",this,r,i.extend(e,{validationError:r}));return false}});var b={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};h(y,b,"attributes");var x=e.Collection=function(t,e){e||(e={});if(e.model)this.model=e.model;if(e.comparator!==void 0)this.comparator=e.comparator;this._reset();this.initialize.apply(this,arguments);if(t)this.reset(t,i.extend({silent:true},e))};var w={add:true,remove:true,merge:true};var E={add:true,remove:false};var I=function(t,e,i){i=Math.min(Math.max(i,0),t.length);var r=Array(t.length-i);var n=e.length;var s;for(s=0;s<r.length;s++)r[s]=t[s+i];for(s=0;s<n;s++)t[s+i]=e[s];for(s=0;s<r.length;s++)t[s+n+i]=r[s]};i.extend(x.prototype,u,{model:y,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,i.extend({merge:false},e,E))},remove:function(t,e){e=i.extend({},e);var r=!i.isArray(t);t=r?[t]:t.slice();var n=this._removeModels(t,e);if(!e.silent&&n.length){e.changes={added:[],merged:[],removed:n};this.trigger("update",this,e)}return r?n[0]:n},set:function(t,e){if(t==null)return;e=i.extend({},w,e);if(e.parse&&!this._isModel(t)){t=this.parse(t,e)||[]}var r=!i.isArray(t);t=r?[t]:t.slice();var n=e.at;if(n!=null)n=+n;if(n>this.length)n=this.length;if(n<0)n+=this.length+1;var s=[];var a=[];var h=[];var o=[];var l={};var u=e.add;var c=e.merge;var f=e.remove;var d=false;var v=this.comparator&&n==null&&e.sort!==false;var g=i.isString(this.comparator)?this.comparator:null;var p,m;for(m=0;m<t.length;m++){p=t[m];var _=this.get(p);if(_){if(c&&p!==_){var y=this._isModel(p)?p.attributes:p;if(e.parse)y=_.parse(y,e);_.set(y,e);h.push(_);if(v&&!d)d=_.hasChanged(g)}if(!l[_.cid]){l[_.cid]=true;s.push(_)}t[m]=_}else if(u){p=t[m]=this._prepareModel(p,e);if(p){a.push(p);this._addReference(p,e);l[p.cid]=true;s.push(p)}}}if(f){for(m=0;m<this.length;m++){p=this.models[m];if(!l[p.cid])o.push(p)}if(o.length)this._removeModels(o,e)}var b=false;var x=!v&&u&&f;if(s.length&&x){b=this.length!==s.length||i.some(this.models,function(t,e){return t!==s[e]});this.models.length=0;I(this.models,s,0);this.length=this.models.length}else if(a.length){if(v)d=true;I(this.models,a,n==null?this.length:n);this.length=this.models.length}if(d)this.sort({silent:true});if(!e.silent){for(m=0;m<a.length;m++){if(n!=null)e.index=n+m;p=a[m];p.trigger("add",p,this,e)}if(d||b)this.trigger("sort",this,e);if(a.length||o.length||h.length){e.changes={added:a,removed:o,merged:h};this.trigger("update",this,e)}}return r?t[0]:t},reset:function(t,e){e=e?i.clone(e):{};for(var r=0;r<this.models.length;r++){this._removeReference(this.models[r],e)}e.previousModels=this.models;this._reset();t=this.add(t,i.extend({silent:true},e));if(!e.silent)this.trigger("reset",this,e);return t},push:function(t,e){return this.add(t,i.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t)},unshift:function(t,e){return this.add(t,i.extend({at:0},e))},shift:function(t){var e=this.at(0);return this.remove(e,t)},slice:function(){return s.apply(this.models,arguments)},get:function(t){if(t==null)return void 0;return this._byId[t]||this._byId[this.modelId(t.attributes||t)]||t.cid&&this._byId[t.cid]},has:function(t){return this.get(t)!=null},at:function(t){if(t<0)t+=this.length;return this.models[t]},where:function(t,e){return this[e?"find":"filter"](t)},findWhere:function(t){return this.where(t,true)},sort:function(t){var e=this.comparator;if(!e)throw new Error("Cannot sort a set without a comparator");t||(t={});var r=e.length;if(i.isFunction(e))e=i.bind(e,this);if(r===1||i.isString(e)){this.models=this.sortBy(e)}else{this.models.sort(e)}if(!t.silent)this.trigger("sort",this,t);return this},pluck:function(t){return this.map(t+"")},fetch:function(t){t=i.extend({parse:true},t);var e=t.success;var r=this;t.success=function(i){var n=t.reset?"reset":"set";r[n](i,t);if(e)e.call(t.context,r,i,t);r.trigger("sync",r,i,t)};B(this,t);return this.sync("read",this,t)},create:function(t,e){e=e?i.clone(e):{};var r=e.wait;t=this._prepareModel(t,e);if(!t)return false;if(!r)this.add(t,e);var n=this;var s=e.success;e.success=function(t,e,i){if(r)n.add(t,i);if(s)s.call(i.context,t,e,i)};t.save(null,e);return t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0;this.models=[];this._byId={}},_prepareModel:function(t,e){if(this._isModel(t)){if(!t.collection)t.collection=this;return t}e=e?i.clone(e):{};e.collection=this;var r=new this.model(t,e);if(!r.validationError)return r;this.trigger("invalid",this,r.validationError,e);return false},_removeModels:function(t,e){var i=[];for(var r=0;r<t.length;r++){var n=this.get(t[r]);if(!n)continue;var s=this.indexOf(n);this.models.splice(s,1);this.length--;delete this._byId[n.cid];var a=this.modelId(n.attributes);if(a!=null)delete this._byId[a];if(!e.silent){e.index=s;n.trigger("remove",n,this,e)}i.push(n);this._removeReference(n,e)}return i},_isModel:function(t){return t instanceof y},_addReference:function(t,e){this._byId[t.cid]=t;var i=this.modelId(t.attributes);if(i!=null)this._byId[i]=t;t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){delete this._byId[t.cid];var i=this.modelId(t.attributes);if(i!=null)delete this._byId[i];if(this===t.collection)delete t.collection;t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,r){if(e){if((t==="add"||t==="remove")&&i!==this)return;if(t==="destroy")this.remove(e,r);if(t==="change"){var n=this.modelId(e.previousAttributes());var s=this.modelId(e.attributes);if(n!==s){if(n!=null)delete this._byId[n];if(s!=null)this._byId[s]=e}}}this.trigger.apply(this,arguments)}});var S={forEach:3,each:3,map:3,collect:3,reduce:0,foldl:0,inject:0,reduceRight:0,foldr:0,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:3,includes:3,contains:3,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3,groupBy:3,countBy:3,sortBy:3,indexBy:3,findIndex:3,findLastIndex:3};h(x,S,"models");var k=e.View=function(t){this.cid=i.uniqueId("view");i.extend(this,i.pick(t,P));this._ensureElement();this.initialize.apply(this,arguments)};var T=/^(\S+)\s*(.*)$/;var P=["model","collection","el","id","attributes","className","tagName","events"];i.extend(k.prototype,u,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){this._removeElement();this.stopListening();return this},_removeElement:function(){this.$el.remove()},setElement:function(t){this.undelegateEvents();this._setElement(t);this.delegateEvents();return this},_setElement:function(t){this.$el=t instanceof e.$?t:e.$(t);this.el=this.$el[0]},delegateEvents:function(t){t||(t=i.result(this,"events"));if(!t)return this;this.undelegateEvents();for(var e in t){var r=t[e];if(!i.isFunction(r))r=this[r];if(!r)continue;var n=e.match(T);this.delegate(n[1],n[2],i.bind(r,this))}return this},delegate:function(t,e,i){this.$el.on(t+".delegateEvents"+this.cid,e,i);return this},undelegateEvents:function(){if(this.$el)this.$el.off(".delegateEvents"+this.cid);return this},undelegate:function(t,e,i){this.$el.off(t+".delegateEvents"+this.cid,e,i);return this},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){if(!this.el){var t=i.extend({},i.result(this,"attributes"));if(this.id)t.id=i.result(this,"id");if(this.className)t["class"]=i.result(this,"className");this.setElement(this._createElement(i.result(this,"tagName")));this._setAttributes(t)}else{this.setElement(i.result(this,"el"))}},_setAttributes:function(t){this.$el.attr(t)}});e.sync=function(t,r,n){var s=H[t];i.defaults(n||(n={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:s,dataType:"json"};if(!n.url){a.url=i.result(r,"url")||F()}if(n.data==null&&r&&(t==="create"||t==="update"||t==="patch")){a.contentType="application/json";a.data=JSON.stringify(n.attrs||r.toJSON(n))}if(n.emulateJSON){a.contentType="application/x-www-form-urlencoded";a.data=a.data?{model:a.data}:{}}if(n.emulateHTTP&&(s==="PUT"||s==="DELETE"||s==="PATCH")){a.type="POST";if(n.emulateJSON)a.data._method=s;var h=n.beforeSend;n.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",s);if(h)return h.apply(this,arguments)}}if(a.type!=="GET"&&!n.emulateJSON){a.processData=false}var o=n.error;n.error=function(t,e,i){n.textStatus=e;n.errorThrown=i;if(o)o.call(n.context,t,e,i)};var l=n.xhr=e.ajax(i.extend(a,n));r.trigger("request",r,l,n);return l};var H={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var $=e.Router=function(t){t||(t={});if(t.routes)this.routes=t.routes;this._bindRoutes();this.initialize.apply(this,arguments)};var A=/\((.*?)\)/g;var C=/(\(\?)?:\w+/g;var R=/\*\w+/g;var j=/[\-{}\[\]+?.,\\\^$|#\s]/g;i.extend($.prototype,u,{initialize:function(){},route:function(t,r,n){if(!i.isRegExp(t))t=this._routeToRegExp(t);if(i.isFunction(r)){n=r;r=""}if(!n)n=this[r];var s=this;e.history.route(t,function(i){var a=s._extractParameters(t,i);if(s.execute(n,a,r)!==false){s.trigger.apply(s,["route:"+r].concat(a));s.trigger("route",r,a);e.history.trigger("route",s,r,a)}});return this},execute:function(t,e,i){if(t)t.apply(this,e)},navigate:function(t,i){e.history.navigate(t,i);return this},_bindRoutes:function(){if(!this.routes)return;this.routes=i.result(this,"routes");var t,e=i.keys(this.routes);while((t=e.pop())!=null){this.route(t,this.routes[t])}},_routeToRegExp:function(t){t=t.replace(j,"\\$&").replace(A,"(?:$1)?").replace(C,function(t,e){return e?t:"([^/?]+)"}).replace(R,"([^?]*?)");return new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return i.map(r,function(t,e){if(e===r.length-1)return t||null;return t?decodeURIComponent(t):null})}});var N=e.History=function(){this.handlers=[];this.checkUrl=i.bind(this.checkUrl,this);if(typeof window!=="undefined"){this.location=window.location;this.history=window.history}};var M=/^[#\/]|\s+$/g;var O=/^\/+|\/+$/g;var U=/#.*$/;N.started=false;i.extend(N.prototype,u,{interval:50,atRoot:function(){var t=this.location.pathname.replace(/[^\/]$/,"$&/");return t===this.root&&!this.getSearch()},matchRoot:function(){var t=this.decodeFragment(this.location.pathname);var e=t.slice(0,this.root.length-1)+"/";return e===this.root},decodeFragment:function(t){return decodeURI(t.replace(/%25/g,"%2525"))},getSearch:function(){var t=this.location.href.replace(/#.*/,"").match(/\?.+/);return t?t[0]:""},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getPath:function(){var t=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return t.charAt(0)==="/"?t.slice(1):t},getFragment:function(t){if(t==null){if(this._usePushState||!this._wantsHashChange){t=this.getPath()}else{t=this.getHash()}}return t.replace(M,"")},start:function(t){if(N.started)throw new Error("Backbone.history has already been started");N.started=true;this.options=i.extend({root:"/"},this.options,t);this.root=this.options.root;this._wantsHashChange=this.options.hashChange!==false;this._hasHashChange="onhashchange"in window&&(document.documentMode===void 0||document.documentMode>7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(O,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var r=document.body;var n=r.insertBefore(this.iframe,r.firstChild).contentWindow;n.document.open();n.document.close();n.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){s("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){s("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.some(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var r=i+t;t=this.decodeFragment(t.replace(U,""));if(this.fragment===t)return;this.fragment=t;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,r)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var n=this.iframe.contentWindow;if(!e.replace){n.document.open();n.document.close()}this._updateHash(n.location,t,e.replace)}}else{return this.location.assign(r)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var q=function(t,e){var r=this;var n;if(t&&i.has(t,"constructor")){n=t.constructor}else{n=function(){return r.apply(this,arguments)}}i.extend(n,r,e);n.prototype=i.create(r.prototype,t);n.prototype.constructor=n;n.__super__=r.prototype;return n};y.extend=x.extend=$.extend=k.extend=N.extend=q;var F=function(){throw new Error('A "url" property or function must be specified')};var B=function(t,e){var i=e.error;e.error=function(r){if(i)i.call(e.context,t,r,e);t.trigger("error",t,r,e)}};return e});
//# sourceMappingURL=backbone-min.map

/* added by builder */
return Backbone;
}),
"md5": (function (require, exports, module) { /* wrapped by builder */
window.md5 = function (string) {

	function rotateLeft(lValue, iShiftBits) {
		return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
	}

	function addUnsigned(lX, lY) {
		var lX4, lY4, lX8, lY8, lResult;
		lX8 = (lX & 0x80000000);
		lY8 = (lY & 0x80000000);
		lX4 = (lX & 0x40000000);
		lY4 = (lY & 0x40000000);
		lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
		if (lX4 & lY4) {
			return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
		}
		if (lX4 | lY4) {
			if (lResult & 0x40000000) {
				return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
			} else {
				return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
			}
		} else {
			return (lResult ^ lX8 ^ lY8);
		}
	}

	function f(x, y, z) {
		return (x & y) | ((~x) & z);
	}

	function g(x, y, z) {
		return (x & z) | (y & (~z));
	}

	function h(x, y, z) {
		return (x ^ y ^ z);
	}

	function i(x, y, z) {
		return (y ^ (x | (~z)));
	}

	function ff(a, b, c, d, x, s, ac) {
		a = addUnsigned(a, addUnsigned(addUnsigned(f(b, c, d), x), ac));
		return addUnsigned(rotateLeft(a, s), b);
	}

	function gg(a, b, c, d, x, s, ac) {
		a = addUnsigned(a, addUnsigned(addUnsigned(g(b, c, d), x), ac));
		return addUnsigned(rotateLeft(a, s), b);
	}

	function hh(a, b, c, d, x, s, ac) {
		a = addUnsigned(a, addUnsigned(addUnsigned(h(b, c, d), x), ac));
		return addUnsigned(rotateLeft(a, s), b);
	}

	function ii(a, b, c, d, x, s, ac) {
		a = addUnsigned(a, addUnsigned(addUnsigned(i(b, c, d), x), ac));
		return addUnsigned(rotateLeft(a, s), b);
	}

	function ConvertToWordArray(string) {
		var lWordCount;
		var lMessageLength = string.length;
		var lNumberOfWords_temp1 = lMessageLength + 8;
		var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
		var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
		var lWordArray = new Array(lNumberOfWords - 1);
		var lBytePosition = 0;
		var lByteCount = 0;
		while (lByteCount < lMessageLength) {
			lWordCount = (lByteCount - (lByteCount % 4)) / 4;
			lBytePosition = (lByteCount % 4) * 8;
			lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition));
			lByteCount++;
		}
		lWordCount = (lByteCount - (lByteCount % 4)) / 4;
		lBytePosition = (lByteCount % 4) * 8;
		lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
		lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
		lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
		return lWordArray;
	}

	function wordToHex(lValue) {
		var wordToHexValue = "", wordToHexValue_temp = "", lByte, lCount;
		for (lCount = 0; lCount <= 3; lCount++) {
			lByte = (lValue >>> (lCount * 8)) & 255;
			wordToHexValue_temp = "0" + lByte.toString(16);
			wordToHexValue = wordToHexValue + wordToHexValue_temp.substr(wordToHexValue_temp.length - 2, 2);
		}
		return wordToHexValue;
	}

	function utf8Encode(string) {
		string = (string + '').replace(/\r\n/g, "\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if ((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	}

	var x = [];
	var k, AA, BB, CC, DD, a, b, c, d;
	var S11 = 7, S12 = 12, S13 = 17, S14 = 22;
	var S21 = 5, S22 = 9, S23 = 14, S24 = 20;
	var S31 = 4, S32 = 11, S33 = 16, S34 = 23;
	var S41 = 6, S42 = 10, S43 = 15, S44 = 21;

	string = utf8Encode(string);

	x = ConvertToWordArray(string);

	a = 0x67452301;
	b = 0xEFCDAB89;
	c = 0x98BADCFE;
	d = 0x10325476;

	for (k = 0; k < x.length; k += 16) {
		AA = a;
		BB = b;
		CC = c;
		DD = d;
		a = ff(a, b, c, d, x[k + 0], S11, 0xD76AA478);
		d = ff(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
		c = ff(c, d, a, b, x[k + 2], S13, 0x242070DB);
		b = ff(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
		a = ff(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
		d = ff(d, a, b, c, x[k + 5], S12, 0x4787C62A);
		c = ff(c, d, a, b, x[k + 6], S13, 0xA8304613);
		b = ff(b, c, d, a, x[k + 7], S14, 0xFD469501);
		a = ff(a, b, c, d, x[k + 8], S11, 0x698098D8);
		d = ff(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
		c = ff(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
		b = ff(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
		a = ff(a, b, c, d, x[k + 12], S11, 0x6B901122);
		d = ff(d, a, b, c, x[k + 13], S12, 0xFD987193);
		c = ff(c, d, a, b, x[k + 14], S13, 0xA679438E);
		b = ff(b, c, d, a, x[k + 15], S14, 0x49B40821);
		a = gg(a, b, c, d, x[k + 1], S21, 0xF61E2562);
		d = gg(d, a, b, c, x[k + 6], S22, 0xC040B340);
		c = gg(c, d, a, b, x[k + 11], S23, 0x265E5A51);
		b = gg(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
		a = gg(a, b, c, d, x[k + 5], S21, 0xD62F105D);
		d = gg(d, a, b, c, x[k + 10], S22, 0x2441453);
		c = gg(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
		b = gg(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
		a = gg(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
		d = gg(d, a, b, c, x[k + 14], S22, 0xC33707D6);
		c = gg(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
		b = gg(b, c, d, a, x[k + 8], S24, 0x455A14ED);
		a = gg(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
		d = gg(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
		c = gg(c, d, a, b, x[k + 7], S23, 0x676F02D9);
		b = gg(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
		a = hh(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
		d = hh(d, a, b, c, x[k + 8], S32, 0x8771F681);
		c = hh(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
		b = hh(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
		a = hh(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
		d = hh(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
		c = hh(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
		b = hh(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
		a = hh(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
		d = hh(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
		c = hh(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
		b = hh(b, c, d, a, x[k + 6], S34, 0x4881D05);
		a = hh(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
		d = hh(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
		c = hh(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
		b = hh(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
		a = ii(a, b, c, d, x[k + 0], S41, 0xF4292244);
		d = ii(d, a, b, c, x[k + 7], S42, 0x432AFF97);
		c = ii(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
		b = ii(b, c, d, a, x[k + 5], S44, 0xFC93A039);
		a = ii(a, b, c, d, x[k + 12], S41, 0x655B59C3);
		d = ii(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
		c = ii(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
		b = ii(b, c, d, a, x[k + 1], S44, 0x85845DD1);
		a = ii(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
		d = ii(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
		c = ii(c, d, a, b, x[k + 6], S43, 0xA3014314);
		b = ii(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
		a = ii(a, b, c, d, x[k + 4], S41, 0xF7537E82);
		d = ii(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
		c = ii(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
		b = ii(b, c, d, a, x[k + 9], S44, 0xEB86D391);
		a = addUnsigned(a, AA);
		b = addUnsigned(b, BB);
		c = addUnsigned(c, CC);
		d = addUnsigned(d, DD);
	}

	var temp = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);

	return temp.toLowerCase();
};
}),
"ButtonWidget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Widget = require('Widget');

module.exports = Widget.extend({

    type: 'button',
    name: 'button',

    construct: function () {
        this.$icon = this.options.icon ? $('<div/>').attr({'class': 'w-button__icon ' + this.options.icon}) : null;
        this.$caption = typeof this.options.caption === 'string' ? $('<div/>').attr({'class': 'w-button__caption'}).html(this.options.caption) : null;
        this.$extra = this.options.extra ? $('<div/>').attr({'class': 'w-button__extra'}).html(this.options.extra) : null;
    },

    setExtra: function (extra) {
        this.$extra.html(extra);
    },

    setCaption: function (caption) {
        this.$caption.html(caption);
    },

    setIcon: function (icon) {
        this.$icon.attr({'class': 'w-button__icon ' + icon});
    },

    setAction: function (action) {
        this.action = action;
    },

    disable: function () {
        if (this.disabled) return;

        var action = this.action;

        this.disabled = true;
        this.action = $.noop;
        this.saved = action;

        this.$el.addClass('disabled');
    },

    enable: function () {
        if (!this.disabled) return;

        this.disabled = false;
        this.action = this.saved || this.action;

        this.$el.removeClass('disabled');
    },

    render: function () {
        this.$el.attr({'class': 'w-button'}).append(this.$icon, this.$caption, this.$extra);

        if (this.options.display) this.$el.addClass('w-button_' + this.options.display);

        if (this.className) {
            _.each(this.className.trim().split(' '), function (className) {
                this.$el.addClass('w-button_' + className);
            }, this);
        }

        if (this.disabled) this.$el.addClass('disabled');

        this.delegateMouseEvents();

        return this;
    }
});
}),
"CheckboxWidget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

module.exports = require('Widget').extend({

    type: 'checkbox',
    name: 'checkbox',

    construct: function () {
        this.label = this.options.label || '';
        this.name = this.options.name;
        this.checked = this.options.checked || false;
        this.action = this.options.action || function () {};
        this.display = this.options.display || '';

        this.$label = $('<label/>').attr({'class': 'b-checkbox__label'}).html(this.label);
        this.$input = $('<input/>').attr({'class': 'b-checkbox__checkbox', 'type': 'checkbox'});

        if (this.checked) {
            this.$el.addClass('selected');
            this.$input.addClass('selected');
        }
    },

    isValid: function () {
        return true;
    },

    getData: function() {
        return this.checked;
    },

    keyEnter: function () {
        app.anchor.focus();
        this.checked = !this.checked;
        this.$el.toggleClass('selected');
        this.$input.toggleClass('selected');
        this.action(this);
    },

    focus: function () {
        this.$input.addClass('active');
    },

    blur: function () {
        this.$input.removeClass('active');
    },

    render: function () {
        this.$el.addClass('b-checkbox').append(this.$input, this.$label);
        if (this.display) this.$el.addClass('b-button_' + this.display);
        this.delegateMouseEvents();
        return this;
    }

});
}),
"KeyboardWidget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

function getEdges(axis, direction) {
    var edges;

    if (axis === 'x') {
        if (direction > 0) {
            edges = {near: 'left', far: 'right', first: 'top', second: 'bottom'};
        } else {
            edges = {near: 'right', far: 'left', first: 'top', second: 'bottom'};
        }
    } else if (axis === 'y') {
        if (direction > 0) {
            edges = {near: 'top', far: 'bottom', first: 'left', second: 'right'};
        } else {
            edges = {near: 'bottom', far: 'top', first: 'left', second: 'right'};
        }
    }

    return edges;
}

function getDistance(x0, y0, x1, y1) {
    return Math.floor(Math.sqrt((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1)));
}

function getBox($el) {
    var position = $el.offset();

    $el.center = {
        x: position.left + $el[0].scrollWidth / 2,
        y: position.top + $el[0].offsetTop + $el[0].offsetHeight / 2
    };

    $el.box = {
        top: position.top,
        right: position.left + $el[0].scrollWidth,
        bottom: position.top + $el[0].offsetHeight,
        left: position.left
    };

    return $el.box;
}

var Widget = require('Widget'),
    SPECIAL = "`~!@#$%^&*()-_=+[]{};:'\"|\\/,.<>?",
    ALPHANUM = '1234567890qwertyuiopasdfghjkl?@zxcvbnm,.',
    CONTROLS = {
        'backspace': 'Backspace',
        'enter': 'Enterr',
        'clear-all': 'ClearAll',
        'special': 'Special',
        'shift': 'Shift'
    };

module.exports = Widget.extend({

    className: 'w-keyboard animate top',
    disabled: true,
    case: 'Lower',
    mode: 'alphanum',

    move: function (axis, direction) {
        var i, key, target,
            distance = 0, minimum = 10000,
            closestOutside = {distance: 10000, idx: -1},
            current = this.$active,
            edges = getEdges(axis, direction),
            keys = this.$keys;

        getBox(current);

        for (i = 0; i < keys.length; i++) {
            target = keys.eq(i);
            if (target === current) continue;

            getBox(target);
            distance = (target.box[edges.near] - current.box[edges.far]) * direction;

            if (distance >= 0) {
                if (target.box[edges.second] > current.box[edges.first] && target.box[edges.first] < current.box[edges.second]) {
                    if (distance < minimum) {
                        minimum = distance;
                        key = target;
                    }
                } else {
                    distance = getDistance(
                        current.center.x,
                        current.center.y,
                        target.box[edges.near],
                        target.box[edges.first] >= current.box[edges.second] ? target.box[edges.first] : target.box[edges.second]
                    );

                    if (distance < closestOutside.distance) {
                        closestOutside.distance = distance;
                        closestOutside.idx = i;
                    }
                }
            }
        }

        if (!key && closestOutside.idx >= 0) key = keys.eq(closestOutside.idx);

        if (key) this.$active = key;
    },

    activate: function ($el) {
        if (this.$active) this.$active.removeClass('active');
        this.$active = $el;
        this.$active.addClass('active');
    },

    key: function (symbol) {
        return '<div class="w-keyboard__key" data-symbol="' + symbol + '">' + symbol['to' + this.case + 'Case']() + '</div>';
    },

    keyNumber: function (number) {
        this.target.keyNumber(number);
    },

    keyBackspace: function () {
        this.target.keyBackspace();
    },

    keyEnterr: function () {
        this.keyReturn();
    },

    keyClearAll: function () {
        this.target.setData('');
    },

    keySpecial: function () {
        var symbols, text = {alphanum: '-=+', special: ('abc')['to' + this.case + 'Case']()};

        if (this.mode === 'alphanum') {
            this.mode = 'special';
            symbols = SPECIAL;
        } else {
            this.mode = 'alphanum';
            symbols = ALPHANUM;
        }

        this.$('.w-keyboard__keys').empty().html(_.map(symbols.split(''), this.key, this));
        this.$keys = this.$('.w-keyboard__key');
        this.$special.text(text[this.mode]);
    },

    keyShift: function () {
        if (this.mode === 'special') return;

        this.case = this.case === 'Lower' ? 'Upper' : 'Lower';

        this.$keys.each(function (i, key) {
            var $key = $(key);

            if (CONTROLS[$key.data('symbol')]) return;

            $key.text($key.text()['to' + this.case + 'Case']());
        }.bind(this));
    },

    keyEnter: function () {
        var symbol = this.$active.data('symbol');

        if (symbol in CONTROLS) {
            this['key' + CONTROLS[symbol]]();
        } else {
            this.target.setData(this.target.getData() + String(symbol)['to' + this.case + 'Case']());
        }
    },

    keyReturn: function () {
        this.scene.focus(this.scene.widgets.last);
    },

    keyLeft: function () {
        this.$active.removeClass('active');
        this.move('x', -1);
        this.$active.addClass('active');
    },

    keyRight: function () {
        this.$active.removeClass('active');
        this.move('x', +1);
        this.$active.addClass('active');
    },

    keyUp: function () {
        this.$active.removeClass('active');
        this.move('y', -1);
        this.$active.addClass('active');
    },

    keyDown: function () {
        this.$active.removeClass('active');
        this.move('y', +1);
        this.$active.addClass('active');
    },

    init: function () {
        app.$body.append(this.render().$el);
    },

    value: function () {},

    show: function (options) {
        this.target = options.target;
        this.scene = options.target.scene;
        this.index = options.target.index;
        this.parent = this.scene;

        this.scene.focus(this, {silent: true});

        app.trigger('keyboard-show');
    },

    hide: function () {
        app.trigger('keyboard-hide');
    },

    focus: function () {
        this.$active = this.$active || this.$keys.eq(0);
        this.$active.addClass('active');
        this.$el.addClass('active');

        this.enable();
    },

    blur: function () {
        this.$el.removeClass('active');
        this.$active.removeClass('active');

        this.target.blur();

        this.disable();
    },

    render: function () {
        this.$el.html(app.renderTemplate('keyboard'));
        this.$keys = this.$('.w-keyboard__key');
        this.$special = this.$keys.eq(0);

        this.delegateMouseEvents('.w-keyboard__key', function (el) {
            this.activate($(el));
        });

        this.activate(this.$keys.eq(0));

        return this;
    }
});

}),
"ListWidget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Widget = require('Widget'),
    TRANSFORM = window.CSS ? CSS.supports('transform','translate(0, 0)') : false;

module.exports = Widget.extend({

    type: 'list',
    name: 'list',

    moveActive: function (idxChanger, options) {
        var currentIdx = this.active.idx,
            success = idxChanger(),
            newIdx = this.active.idx;

        if (success) {
            this.active.idx = currentIdx;
            this.deactivateItem();
            this.active.idx = newIdx;
            this.activateItem(options);
        }

        return success;
    },

    deltaF: function () {
        return this.active.position() + this.active.length() + this.movable.position - this.frame.length();
    },

    deltaB: function () {
        return this.active.position() + this.movable.position;
    },

    createItem: function (idx) {
        return this.options.render.call(this, this.data[idx], idx).addClass('w-list__item').attr('data-' + this.cid +'-id', idx);
    },

    construct: function () {
        var self = this;

        this.data = this.options.data;
        this.items = [];
        this.positionProperty = '';
        this.lengthProperty = '';
        this.axis = '';
        this.active = {
            idx: 0,
            el: function () { return self.items[this.idx]; },
            position: function () { return this.el()['offset'+ self.positionProperty]; },
            length: function () { return this.el()['offset'+ self.lengthProperty]; }
        };
        this.frame = {
            $el: null,
            length: function () { return this.$el[0]['offset'+ self.lengthProperty]; }
        };
        this.movable = {
            $el: null,
            position: 0,
            length: function () { return this.$el[0]['scroll'+ self.lengthProperty]; }
        };
        this.scrollbar = {
            $el: null,
            $slider: null,
            position: 0,
            length: 0,
            update: function (options) {
                var length = self.movable.length();

                this.length = self.frame.length() / length * 100;
                this.position = -self.movable.position / length * 100;

                if (options.animation === false) {
                    this.$slider.addClass('no-animate');
                } else {
                    this.$slider.removeClass('no-animate');
                }

                this.$slider.css(self.positionProperty.toLowerCase(), this.position + '%');
                this.$slider.css(self.lengthProperty.toLowerCase(), this.length + '%');
                this.$slider.attr('data-number', options.idx + 1);

                this.$el.css('display', self.isScrollable() ? 'block' : 'none');
            }
        };

        if (this.options.leap) {
            this.increaseIdx = function () {
                var currentIdx = this.active.idx;

                while (this.deltaF() <= 0 && this.active.idx < this.data.length - 1) {
                    this.active.idx++;
                }

                return currentIdx !== this.active.idx
            }.bind(this);
            this.decreaseIdx = function () {
                var currentIdx = this.active.idx;

                while (this.deltaB() >= 0 && this.active.idx > 0){
                    this.active.idx--;
                }

                return currentIdx !== this.active.idx
            }.bind(this);
        } else {
            this.decreaseIdx = function () {
                this.active.idx--;

                if (this.options.cycle === false) {
                    if (this.active.idx < 0) {
                        this.active.idx++;
                        return false;
                    }
                } else {
                    this.active.idx = (this.active.idx + this.data.length) % this.data.length;
                }

                return true;
            }.bind(this);
            this.increaseIdx = function () {
                this.active.idx++;

                if (this.options.cycle === false) {
                    if (this.active.idx === this.data.length) {
                        this.active.idx--;
                        return false;
                    }
                } else {
                    this.active.idx = this.active.idx % this.data.length;
                }

                return true;
            }.bind(this);
        }

        if (this.options.vertical) {
            this.positionProperty = 'Top';
            this.lengthProperty = 'Height';
            this.axis = 'Y';
            this.down = this.options.down || function () { if (!this.moveForward()) this.parent.moveDown(); };
            this.up = this.options.up || function () { if (!this.moveBackward()) this.parent.moveUp(); };
        } else {
            this.positionProperty = 'Left';
            this.lengthProperty = 'Width';
            this.axis = 'X';
            this.right = this.options.right || function () { if (!this.moveForward()) this.parent.moveRight(); };
            this.left = this.options.left || function () { if (!this.moveBackward()) this.parent.moveLeft(); };
        }

        this.length = this.data.length;
    },

    isScrollable: function () {
        var length = this.frame.length() / this.movable.length() * 100;

        return length < 100;
    },

    moveForward: function (options) {
        if (!this.length) return true;

        return this.moveActive(this.increaseIdx, options);
    },

    moveBackward: function (options) {
        if (!this.length) return true;

        return this.moveActive(this.decreaseIdx, options);
    },

    moveTo: function (options) {
        return this.moveActive(function () {
            return isFinite(this.active.idx = options.idx);
        }.bind(this), options);
    },

    setData: function (newData, options) {
        this.data = newData;
        this.length = this.data.length;

        if ((options || {}).move !== false) this.movable.position = 0;

        return this;
    },

    indexOf: function (object, property) {
        if (this.isEmpty() || !object) return -1;

        if (property) return _.pluck(this.data, property).indexOf(object.attributes ? object.get(property) : object[property]);

        return this.data.indexOf(object);
    },

    getIndex: function () {
        return this.active.idx;
    },

    getPosition: function () {
        return this.movable.position;
    },

    getItem: function () {
        return $(this.active.el());
    },

    at: function (index) {
        return this.data[index];
    },

    getActive: function () {
        return this.data[this.active.idx]
    },

    getEl: function () {
        return this.active.el() || this.el;
    },

    isEmpty: function () {
        return !this.data || this.length === 0;
    },

    hoverCallback: function (item) {
        var index = +$(item).data(this.cid + '-id');

        if (index === this.active.idx) return;
        if (this.freeze) return;

        this.deactivateItem();
        this.active.idx = +$(item).data(this.cid + '-id');
        this.activateItem();
    },

    keyEnter: function () {
        if (this.action) this.action(this.getActive(), this.active.idx, $(this.active.el()));
    },

    deactivateItem: function () {
        if (this.isEmpty()) return;

        var $el = $(this.active.el()).removeClass('active');

        this.trigger('item-deactivated', this.data[this.active.idx], this.active.idx, $el);
    },

    activateItem: function (opts) {
        var options = opts || {},
            frame, movable, position,
            dF, dB, bound, $el;

        if (this.isEmpty()) {
            if (this.options.scrollbar) this.scrollbar.update({idx: 0, animation: false});

            return;
        }

        if (options.idx || options.idx === 0) this.active.idx = options.idx;
        if (options.position || options.position === 0) this.movable.position = options.position;

        position = this.movable.position;

        this.active.idx = (this.active.idx > this.data.length - 1) ? this.data.length - 1 : this.active.idx;
        this.active.idx = (this.active.idx < 0) ? 0 : this.active.idx;

        $el = $(this.active.el());

        if (!options.noAddClass) $el.addClass('active');

        frame = this.frame.length();
        movable = this.movable.length();
        dF = this.deltaF();
        dB = this.deltaB();

        if (options.center || this.options.center) {
            if (movable < frame) {
                if (!options.bounds && !this.options.bounds) this.movable.position = (frame - movable) / 2;
            } else {
                this.movable.position = -this.active.position() - this.active.length() / 2 + frame / 2;

                if (options.bounds || this.options.bounds) {
                    bound = frame - movable;

                    if (this.movable.position > 0) this.movable.position = 0;
                    if (this.movable.position < bound) this.movable.position = bound;
                }
            }
        } else {
            if (dF > 0) {
                this.movable.position -= dF;
            } else if (dB < 0) {
                this.movable.position -= dB;
            }
        }

        if (options.animation === false) {
            this.movable.$el.addClass('no-animate');
        } else {
            this.movable.$el.removeClass('no-animate');
        }

        if (this.data.length > 1) {
            this.movable.position + movable > frame
                ? this.$el.addClass('scrollable-forward')
                : this.$el.removeClass('scrollable-forward');
            this.movable.position < 0
                ? this.$el.addClass('scrollable-backward')
                : this.$el.removeClass('scrollable-backward');
        }

        if (this.options.scrollbar) this.scrollbar.update({idx: this.active.idx, animation: options.animation});

        if (options.animation !== false && position !== this.movable.position) {
            this.freeze = options.wheel;
            this.animating = true;
        }

        if (TRANSFORM) {
            this.movable.$el.css('transform', 'translate' + this.axis +'(' + this.movable.position + 'px)');
        } else {
            this.movable.$el.css(this.positionProperty.toLowerCase(), this.movable.position);
        }

        if (!options.silent) this.trigger('item-activated', this.data[this.active.idx], this.active.idx, $el);
    },

    selectItem: function (opts) {
        var options = opts || {},
            idx = options.idx || this.active.idx;

        for (var i = 0; i < this.items.length; i++) {
            $(this.items[i]).removeClass('selected')
        }

        $(this.items[idx]).addClass('selected');
        this.trigger('item-selected', this.data[idx], idx);
    },

    deselectItem: function (opts) {
        var options = opts || {},
            idx = options.idx || this.active.idx;

        $(this.items[idx]).removeClass('selected');
    },

    focus: function (opts) {
        this.$el.addClass('active');
        this.activateItem(opts);

        this.trigger('focus');
    },

    blur: function () {
        this.deactivateItem();
        this.$el.removeClass('active');

        this.trigger('blur');
    },

    renderItem: function (idx) {
        var index = _.isNumber(idx) ? idx : this.active.idx;

        $(this.items[index]).replaceWith(this.createItem(index));
        this.items = this.movable.$el.children();

        return this;
    },

    render: function () {
        this.frame.$el = $('<div/>').addClass('w-list__frame');
        this.movable.$el = $('<div/>').addClass('w-list__content animate ' + (TRANSFORM ? 'transform' : this.positionProperty.toLowerCase()));

        if (this.options.scrollbar) {
            this.scrollbar.$el = $('<div/>').addClass('w-list__scrollbar').append(
                this.scrollbar.$slider = $('<div/>').addClass('w-list__slider animate ' + this.positionProperty.toLowerCase())
            );
        }

        for (var i = 0; i < this.data.length; i++) {
            this.movable.$el.append(this.createItem(i));
        }

        this.$el.empty()
            .append(this.frame.$el.append(this.movable.$el), this.scrollbar.$el)
            .addClass('w-list');

        if (this.isEmpty()) {
            this.$el.addClass('w-list_empty');
        } else {
            this.$el.removeClass('w-list_empty');
        }

        if (this.disabled) this.$el.addClass('disabled');

        this.items = this.movable.$el.children();

        this.delegateMouseEvents('[data-' + this.cid + '-id]', this.hoverCallback);
        this.movable.$el.on('webkitTransitionEnd', function () {
            this.freeze = this.animating = false;
            this.trigger('animated');
        }.bind(this));

        return this;
    }
});

}),
"OptimizedListWidget": (function (require, exports, module) { /* wrapped by builder */
var Widget = require('Widget'),
    VISIBLE_ITEMS_COUNT = 10,
    VISIBLE_ITEMS_PADDING = 5;

module.exports = Widget.extend({

    type: 'list',
    name: 'list',

    _setActive: function (idx) {
        var active = this._active;

        if (idx || idx === 0) {
            active.last = active.idx;
            active.idx = idx;
        }

        active.idx = (active.idx > this.length - 1) ? this.length - 1 : active.idx;
    },

    _setShift: function () {
        var movable = this._movable;

        movable.shift.forward = movable.position;
        movable.shift.backward = this._frame.length() - movable.position - movable.length();
    },

    _moveActive: function (idxChanger) {
        var active = this._active,
            currentIdx = active.idx,
            success = idxChanger(),
            newIdx = active.idx;

        if (success) {
            active.idx = active.last = currentIdx;
            this.deactivateItem();
            active.idx = newIdx;
            this.activateItem();
        }

        return success;
    },

    _deltaF: function () {
        return this._active.position() + this._active.length() + this._movable.position - this._frame.length();
    },

    _deltaB: function () {
        return this._active.position() + this._movable.position;
    },

    _setItems: function () {
        var active = this._active,
            i, item;

        if (Math.abs(active.last - active.idx) <= VISIBLE_ITEMS_COUNT) return;

        _.each(this._items, function (item) {$(item).remove();});
        this._items = {};

        for (i = Math.max(active.idx - VISIBLE_ITEMS_COUNT - VISIBLE_ITEMS_PADDING + 1, 0); i < Math.min(active.idx + VISIBLE_ITEMS_COUNT + VISIBLE_ITEMS_PADDING, this._data.length); i++) {
            item = this._createItem(i);
            this._items[i] = item[0];

            this._movable.$el.append(item);
            this.trigger('item-attached', this._data[i], i, item);
        }
    },

    _moveItems: function (idxToAdd, idxToRemove, direction) {
        var movable = this._movable,
            elToAdd, elToRemove;

        if (!this._items[idxToAdd] && idxToAdd >= 0 && idxToAdd < this._data.length) {
            elToAdd = this._createItem(idxToAdd);

            if (direction === 'backward') {
                this._movable.$el.prepend(elToAdd);

                movable.position -= elToAdd[0][this._properties.length];
            } else {
                this._movable.$el.append(elToAdd);
            }

            this._items[idxToAdd] = elToAdd[0];

            this.trigger('item-attached', this._data[idxToAdd], idxToAdd, elToAdd);
        }

        if (this._items[idxToRemove]) {
            elToRemove = this._items[idxToRemove];

            movable.$el.one('webkitTransitionEnd', function () {
                movable.$el.addClass('no-animation');

                if (direction === 'forward') {
                    movable.position += elToRemove[this._properties.length];
                }

                $(elToRemove).remove();
                delete this._items[idxToRemove];

                this._setShift();

                movable.$el.css(this._properties[direction], movable.shift[direction]);

                this.trigger('item-detached', this._data[idxToRemove], idxToRemove);
            }.bind(this));
        }
    },

    _createItem: function (idx) {
        return this.options.render.call(this, this._data[idx], idx).addClass('w-list__item').attr('data-' + this.cid + '-id', idx);
    },

    _checkScrollabilty: function () {
        if (this._data.length > 1) {
            this._movable.position + this._movable.length() > this._frame.length()
                ? this.$el.addClass('scrollable-forward')
                : this.$el.removeClass('scrollable-forward');
            this._movable.position < 0
                ? this.$el.addClass('scrollable-backward')
                : this.$el.removeClass('scrollable-backward');
        }
    },

    construct: function () {
        var self = this;

        this._data = this.options.data;
        this._items = [];
        this._active = {
            last: 0,
            idx: 0,
            el: function () {
                return self._items[this.idx];
            },
            position: function () {
                return this.el()[self._properties.position];
            },
            length: function () {
                return this.el()[self._properties.length];
            }
        };
        this._frame = {
            $el: null,
            l: 0,
            length: function () {
                if (!this.l) this.l = this.$el[0][self._properties.length];

                return this.l;
            }
        };
        this._movable = {
            $el: null,
            position: 0,
            length: function () {
                return this.$el[0][self._properties.length];
            },
            shift: {
                forward: 0,
                backward: 0
            }
        };
        this._scrollbar = {
            $el: null,
            $slider: null,
            position: 0,
            length: 0,
            update: function (options) {
                var active = self._active,
                    count = self._data.length,
                    length = self._movable.length();

                if (count < VISIBLE_ITEMS_COUNT + 2 * VISIBLE_ITEMS_PADDING) {
                    this.length = self._frame.length() / length * 100;
                    this.position = -self._movable.position / length * 100;
                } else {
                    this.length = self._frame.length() / (self._data.length || 1);
                    this.position = active.idx / (self.length - 1) * (100 - this.length);
                }

                if (options.animation === false) {
                    this.$slider.addClass('no-animation');
                } else {
                    this.$slider.removeClass('no-animation');
                }

                this.$slider.css(self._properties.forward, this.position + '%');
                this.$slider.css(self._properties.length.replace('offset', '').toLowerCase(), this.length + '%');
                this.$slider.attr('data-number', active.idx + 1);

                this.$el.css('display', self.isScrollable() ? 'block' : 'none');
            }
        };

        if (this.options.leap) {
            this._increaseIdx = function () {
                var currentIdx = this._active.idx;

                while (this._deltaF() <= 0 && this._active.idx < this._data.length - 1) {
                    this._active.idx++;
                }

                return currentIdx !== this._active.idx;
            }.bind(this);
            this._decreaseIdx = function () {
                var currentIdx = this._active.idx;

                while (this._deltaB() >= 0 && this._active.idx > 0) {
                    this._active.idx--;
                }

                return currentIdx !== this._active.idx;
            }.bind(this);
        } else {
            this._decreaseIdx = function () {
                this._active.idx--;

                if (this.options.cycle === false) {
                    if (this._active.idx < 0) {
                        this._active.idx++;
                        return false;
                    }
                } else {
                    this._active.idx = (this._active.idx + this._data.length) % this._data.length;
                }

                return true;
            }.bind(this);
            this._increaseIdx = function () {
                this._active.idx++;

                if (this.options.cycle === false) {
                    if (this._active.idx === this._data.length) {
                        this._active.idx--;
                        return false;
                    }
                } else {
                    this._active.idx = this._active.idx % this._data.length;
                }

                return true;
            }.bind(this);
        }

        if (this.options.vertical) {
            this._properties = {
                forward: 'top',
                backward: 'bottom',
                animation: 'vertical',
                position: 'offsetTop',
                length: 'offsetHeight'
            };
            this.down = this.options.down || function () {
                if (!this.moveForward()) this.parent.moveDown();
            };
            this.up = this.options.up ||function () {
                if (!this.moveBackward()) this.parent.moveUp();
            };
        } else {
            this._properties = {
                forward: 'left',
                backward: 'right',
                animation: 'horizontal',
                position: 'offsetLeft',
                length: 'offsetWidth'
            };

            this.right = function () {
                if (!this.moveForward()) this.parent.moveRight();
            };
            this.left = function () {
                if (!this.moveBackward()) this.parent.moveLeft();
            };
        }

        this.length = this._data.length;
    },

    isScrollable: function () {
        var length = this._frame.length() / this._movable.length() * 100;

        return length < 100;
    },

    moveForward: function () {
        return this._moveActive(this._increaseIdx);
    },

    moveBackward: function () {
        return this._moveActive(this._decreaseIdx);
    },

    setData: function (data) {
        this._data = data;
        this._movable.position = 0;
        this.length = this._data.length;

        return this;
    },

    indexOf: function (object, property) {
        if (this.isEmpty()) return -1;

        if (property) return _.pluck(this._data, property).indexOf(object.get ? object.get(property) : object[property]);

        return this._data.indexOf(object);
    },

    getIndex: function () {
        return this._active.idx;
    },

    at: function (index) {
        return this._data[index];
    },

    getActive: function () {
        return this._data[this._active.idx];
    },

    getEl: function () {
        return this._active.el();
    },

    isEmpty: function () {
        return !this._data || this.length === 0;
    },

    hoverCallback: function (item) {
        var index = +$(item).data(this.cid + '-id');

        if (index === this._active.idx) return;

        this.deactivateItem();
        this._active.idx = +$(item).data(this.cid + '-id');
        this.activateItem();
    },

    keyEnter: function () {
        if (this.action) this.action(this.getActive(), this._active.idx, $(this._items[this._active.idx]));
    },

    deactivateItem: function () {
        if (this.isEmpty()) return;

        var $el = $(this._active.el()).removeClass('active');

        this.trigger('item-deactivated', this._data[this._active.idx], this._active.idx, $el);
    },

    activateItem: function (opts) {
        var options = opts || {},
            active = this._active,
            movable = this._movable,
            m, f, dF, dB, direction = 'forward',
            elToAdd, elToRemove, css = {};

        if (this.isEmpty()) return;

        this._setActive(options.idx);
        this._setItems();

        if (!options.noAddClass) $(this._active.el()).addClass('active');

        m = movable.length();
        f = this._frame.length();
        dF = this._deltaF();
        dB = this._deltaB();

        css[this._properties.forward] = 'auto';
        css[this._properties.backward] = 'auto';

        if (active.last < active.idx) {
            direction = options.direction || 'forward';

            elToAdd = active.idx + VISIBLE_ITEMS_PADDING;
            elToRemove = active.idx - VISIBLE_ITEMS_COUNT - VISIBLE_ITEMS_PADDING;
        } else if (active.last > active.idx) {
            direction = options.direction || 'backward';

            elToAdd = active.idx - VISIBLE_ITEMS_PADDING;
            elToRemove = active.idx + VISIBLE_ITEMS_COUNT + VISIBLE_ITEMS_PADDING;
        }

        css[this._properties[direction]] = movable.shift[direction];

        movable.$el.addClass('no-animation');
        movable.$el.css(css);

        if (options.center || this.options.center) {
            if (m < f) {
                movable.position = (f - m) / 2;
            } else {
                movable.position = -active.position() - active.length() / 2 + f / 2;

                if (options.bounds || this.options.bounds) {
                    var bound = f - m;

                    if (this._movable.position > 0) this._movable.position = 0;
                    if (this._movable.position < bound) this._movable.position = bound;
                }
            }
        } else if (dF > 0) {
            movable.position -= dF;
        } else if (dB < 0) {
            movable.position -= dB;
        }

        this._moveItems(elToAdd, elToRemove, direction);
        this._setShift();

        if (options.animation === false) {
            movable.$el.addClass('no-animation');
        } else {
            movable.$el.removeClass('no-animation');
        }

        movable.$el.css(this._properties[direction], movable.shift[direction]);

        this._checkScrollabilty();

        if (this.options.scrollbar) this._scrollbar.update(options);

        if (!options.silent) this.trigger('item-activated', this._data[active.idx], active.idx, $(this._active.el()));
    },

    selectItem: function (opts) {
        var options = opts || {},
            idx = options.idx || this._active.idx;

        for (var i = 0; i < this._items.length; i++) {
            $(this._items[i]).removeClass('selected');
        }

        $(this._items[idx]).addClass('selected');
        this.trigger('item-selected', this._data[idx], idx);
    },

    deselectItem: function (opts) {
        var options = opts || {},
            idx = options.idx || this._active.idx;

        $(this._items[idx]).removeClass('selected');
    },

    focus: function (options) {
        this.activateItem(options);
        this.$el.addClass('active');
    },

    blur: function () {
        this.deactivateItem();
        this.$el.removeClass('active');
    },

    renderItem: function () {
        $(this._active.el()).replaceWith(this._items[this._active.idx] = this._createItem(this._active.idx)[0]);

        return this;
    },

    render: function () {
        this._frame.$el = $('<div/>').addClass('w-list__frame' + (this.isEmpty() ? ' w-list__frame_empty' : ''));
        this._movable.$el = $('<div/>').addClass('w-list__movable animate ' + this._properties.animation);

        this._items = {};

        for (var i = Math.max(this._active.idx - VISIBLE_ITEMS_COUNT - VISIBLE_ITEMS_PADDING + 1, 0); i < Math.min(this._active.idx + VISIBLE_ITEMS_COUNT + VISIBLE_ITEMS_PADDING, this._data.length) && i < this._data.length; i++) {
            var $item = this._createItem(i);

            this._items[i] = $item[0];
            this._movable.$el.append($item[0]);
        }

        if (this.options.scrollbar) {
            this._scrollbar.$el = $('<div/>').addClass('w-list__scrollbar').append(
                this._scrollbar.$slider = $('<div/>').addClass('w-list__slider animate top')
            );
        }

        this.$el.empty().append(
            this._frame.$el.append(this._movable.$el),
            this._scrollbar.$el
        ).addClass('w-list');

        this.delegateMouseEvents('[data-' + this.cid + '-id]', this.hoverCallback);

        return this;
    }
});

}),
"SliderWidget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Widget = require('Widget');

module.exports = Widget.extend({

    type: 'slider',

    construct: function () {
        var self = this;

        this.$layers = [];
        this.pointer = {
            $el: $('<div/>').addClass('w-slider__pointer'),
            position: 0,
            max: self.options.max || 100,
            step: self.options.step || 5,
            move: function (direction, position, opts) {
                var options = opts || {};

                if (direction < 0 && this.position === 0 || direction > 0 && this.position === this.max) return false;

                if (position !== undefined) {
                    this.position = position;
                } else {
                    this.position += direction * this.step;
                }

                if (this.position < 0) this.position = 0;
                if (this.position > this.max) this.position = this.max;

                this.$el.css('left', this.position + '%');

                if (!options.silent) self.trigger('manipulated', this.position);

                return true;
            }
        };
    },

    setPosition: function (position, options) {
        this.pointer.move(0, position, options);
    },

    setMax: function (max) {
        this.pointer.max = max;
    },

    setLayer: function (idx, width) {
        this.$layers[idx].css('width', width + '%');
    },

    keyLeft: function () {
        if (!this.moveBackward()) this.parent.keyLeft();
    },

    keyRight: function () {
        if (!this.moveForward()) this.parent.keyRight();
    },

    keyEnter: function (position) {
        this.manipulated = false;

        if (position !== undefined) this.setPosition(position * this.pointer.ratio);

        this.action(this.pointer.position, this.pointer.max);
    },

    moveForward: function () {
        if (this.disabled) return;

        this.manipulated = true;

        return this.pointer.move(1);
    },

    moveBackward: function () {
        if (this.disabled) return;

        this.manipulated = true;

        return this.pointer.move(-1);
    },

    delegateMouseEvents: function () {
        var self = this;

        this.$el.off('mouseenter click mousewheel');
        this.$el.on('mouseenter', null, function () {
            self.scene.focus(self);
        });
        this.$el.on('click', null, function (event) {
            var pointer = this.pointer.$el[0],
                position = event.offsetX;

            if (event.target === pointer) {
                position += pointer.offsetLeft + pointer.offsetWidth / 2;
            }
            self.keyEnter(position);
            event.stopPropagation();
        }.bind(this));
        this.$el.on('mousewheel', function (event) {
            if (self.disabled) return;

            if (event.originalEvent.wheelDelta > 0) {
                this.moveBackward();
            } else {
                this.moveForward();
            }
        }.bind(this));
    },

    focus: function () {
        if (!this.pointer.ratio) this.pointer.ratio = 100 / this.$el.width() / Number(app.$body.css('zoom') || 1);

        this.$el.addClass('active');
    },

    blur: function () {
        this.manipulated = false;

        this.$el.removeClass('active');
    },

    render: function () {
        this.$el.empty();

        _.each(this.options.layers || [], function (layer, i) {
            this.$el.append(this.$layers[i] = $('<div/>').addClass('w-slider__' + layer));
        }, this);

        this.$el.attr({'class': 'w-slider'}).append(this.pointer.$el);

        if (this.className) {
            _.each(this.className.trim().split(' '), function (className) {
                this.$el.addClass('w-slider_' + className);
            }, this);
        }

        if (this.disabled) this.$el.addClass('disabled');

        this.delegateMouseEvents();

        return this;
    }
});

}),
"SwitchWidget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Widget = require('Widget');

module.exports = Widget.extend({

    type: 'switch',

    construct: function () {
        this.data = this.options.data;
        this.active = 0;

        this.$left = $('<div/>').addClass('w-switch__item').html(this.options.render(this.data[0]));
        this.$right = $('<div/>').addClass('w-switch__item').html(this.options.render(this.data[1]));
        this.$items = [this.$left, this.$right];
    },

    keyEnter: function () {
        this.activate((this.active + 1) % 2);

        this.action(this.data[this.active]);
    },

    setActive: function (idx) {
        this.activate(idx);
    },

    activate: function (idx) {
        this.$items[this.active].removeClass('active');
        this.active = idx;
        this.$items[this.active].addClass('active');
    },

    render: function () {
        this.$el.attr({'class': 'w-switch'}).append(this.$left, this.$right);
        this.$items[this.active].addClass('active');

        if (this.disabled) this.$el.addClass('disabled');

        this.delegateMouseEvents();

        return this;
    }
});
}),
"TextWidget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

function height() {
    return this.$el[0].clientHeight;
}

var Widget = require('Widget');

module.exports = Widget.extend({

    type: 'text',

    construct: function () {
        var self = this;

        this._content = this.options.content || '';
        this._movable = {
            $el: $('<div/>').addClass('w-text__movable animate top'),
            position: 0,
            step: 0,
            min: 0,
            reset: function () {
                this.step = this.min = this.position = 0;

                this.$el.css('top', this.position);
            },
            move: function (direction) {
                if (!this.step) this.step = Math.round(parseFloat(this.$el.css('line-height')));
                if (!this.min) this.min = Math.min(height.call(self) - height.call(this), 0);

                if (direction > 0 && this.position === 0 || direction < 0 && this.position === this.min) return false;

                this.position += direction * this.step * 3;

                if (this.position > 0) this.position = 0;
                if (this.position < this.min) this.position = this.min;

                this.$el.css('top', this.position);

                self._scrollbar.move();

                return true;
            }
        };
        this._scrollbar = {
            $el: $('<div/>').addClass('w-text__scrollbar'),
            $slider: $('<div/>').addClass('w-text__slider animate top'),
            position: 0,
            length: 0,
            reset: function () {
                this.length = height.call(self) / height.call(self._movable) * 100;
                this.position = 0;

                if (this.length >= 100) {
                    this.$el.hide();
                    self.disable();
                } else {
                    this.$el.show();
                    self.enable();
                }

                this.$slider.css('height', this.length + '%');

                this.$slider.addClass('no-animation');
                this.$slider.css('top', this.position + '%');
            },
            move: function () {
                var movable = self._movable;

                this.position = -movable.position / height.call(movable) * 100;

                this.$slider.removeClass('no-animation');
                this.$slider.css('top', this.position + '%');
            }
        };

        this.on('rendered', this.onRender);
    },

    onRender: function () {
        this._movable.reset();
        this._scrollbar.reset();
    },

    setContent: function (content) {
        this._content = content;
    },

    moveForward: function () {
        return this._movable.move(-1);
    },

    moveBackward: function () {
        return this._movable.move(1);
    },

    keyUp: function () {
        if (!this.moveBackward()) this.parent.moveUp();
    },

    keyDown: function () {
        if (!this.moveForward()) this.parent.moveDown();
    },

    focus: function () {
        this.$el.addClass('active');
    },

    render: function () {
        this.$el.addClass('w-text').append(
            this._movable.$el.html(this._content),
            this._scrollbar.$el.append(this._scrollbar.$slider)
        );

        this.delegateMouseEvents();

        return this;
    }
});

}),
"template/keyboard": "<div class=\"w-keyboard__layout\">\n    <div class=\"w-keyboard__extra\">\n        <div class=\"w-keyboard__key w-keyboard__special\" data-symbol=\"special\">-=+</div>\n        <div class=\"w-keyboard__empty\"></div>\n        <div class=\"w-keyboard__key w-keyboard__shift\" data-symbol=\"shift\" style=\"font-family: WebSymbolsLigaRegular\" >&#0041;</div>\n    </div>\n    <div class=\"w-keyboard__keys\">\n        <div class=\"w-keyboard__key\" data-symbol=\"1\">1</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"2\">2</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"3\">3</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"4\">4</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"5\">5</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"6\">6</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"7\">7</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"8\">8</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"9\">9</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"0\">0</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"q\">q</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"w\">w</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"e\">e</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"r\">r</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"t\">t</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"y\">y</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"u\">u</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"i\">i</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"o\">o</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"p\">p</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"a\">a</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"s\">s</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"d\">d</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"f\">f</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"g\">g</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"h\">h</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"j\">j</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"k\">k</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"l\">l</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"?\">?</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"@\">@</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"z\">z</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"x\">x</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"c\">c</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"v\">v</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"b\">b</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"n\">n</div>\n        <div class=\"w-keyboard__key\" data-symbol=\"m\">m</div>\n        <div class=\"w-keyboard__key\" data-symbol=\",\">,</div>\n        <div class=\"w-keyboard__key\" data-symbol=\".\">.</div>\n    </div>\n    <div class=\"w-keyboard__bottom\">\n        <div class=\"w-keyboard__key w-keyboard__com\" data-symbol=\".com\">.com</div>\n        <div class=\"w-keyboard__key w-keyboard__ru\" data-symbol=\".ru\">.ru</div>\n        <div class=\"w-keyboard__key w-keyboard__slash\" data-symbol=\"/\">/</div>\n        <div class=\"w-keyboard__key w-keyboard__space\" data-symbol=\" \">&nbsp;</div>\n    </div>\n</div>\n<div class=\"w-keyboard__controls\">\n    <div class=\"w-keyboard__key w-keyboard__backspace\" data-symbol=\"backspace\">Backspace</div>\n    <div class=\"w-keyboard__key w-keyboard__enter\" data-symbol=\"enter\">Enter</div>\n    <div class=\"w-keyboard__key w-keyboard__clear-all\" data-symbol=\"clear-all\">Clear All</div>\n</div>\n",
"app": (function (require, exports, module) { /* wrapped by builder */
'use strict';

require('md5');

var _ = require('_'),
    $ = require('$'),
    Backbone = require('Backbone'),
    cachedTemplates = {},
    app = {
        scene: null,
        scenes: {}
    };

_.extend(app, Backbone.Events);

if (!Function.prototype.bind) {
    Function.prototype.bind = function (oThis) {
        if (typeof this !== "function") {
            // closest thing possible to the ECMAScript 5 internal IsCallable function
            throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
        }

        var aArgs = Array.prototype.slice.call(arguments, 1),
            fToBind = this,
            fNOP = function () {},
            fBound = function () {
                return fToBind.apply(this instanceof fNOP && oThis
                        ? this
                        : oThis,
                    aArgs.concat(Array.prototype.slice.call(arguments)));
            };

        fNOP.prototype = this.prototype;
        fBound.prototype = new fNOP();

        return fBound;
    };
}

$.support.cors = true;
$.ajaxSetup({
    crossDomain: true
});

app.console = {
    $el: $('#console'),
    max: 1,

    show: function () {
        this.$el.show();
    },

    hide: function () {
        this.$el.hide();
    },

    log: function (txt) {
        var ts = ((new Date()).getTime() / 1000).toFixed(3);

        this.$el.append('<span>[' + ts + ']: ' + txt + '<br></span>');
        if (this.$el.children().length > this.max) this.$el.children().eq(0).remove();
    },

    clear: function () {
        this.$el.empty();
    },

    toggleFullScreen: function () {
        if (this.max == 1) {
            this.max = 25;
            this.$el.css('height', 720);
        } else {
            this.max = 1;
            this.$el.html(this.$el.children().last());
            this.$el.css('height', 24);
        }
    }
};

app.loader = {
    $el: null,
    timer: 0,
    timeout: 60*1000,
    history: [],
    t0: 0,

    start: function () {
        this.timer = setTimeout(function () {
            log(JSON.stringify(app.loader.history));
        }, this.timeout);

        this.t0 = Date.now();
    },

    stop: function () {
        clearTimeout(this.timer);
        this.history.push([Date.now() - this.t0, 'FINISHED']);
    },

    setState: function (state) {
        this.history.push([Date.now() - this.t0, state]);
        if (this.$el) this.$el.text(state);
    }
};

app.initialize = function () {
    document.addEventListener('keydown', platform.keyHandler, true);
    app.anchor = document.getElementById('anchor');
    app.input = document.getElementById('input');
    platform.keyboard.init();

    if (app.config.debug) {
        app.console.show();
        app.console.toggleFullScreen();
    }

    app.storage.initialize();

    platform.start(function () {
        var networkConnected = true;

        if (!platform.device.isConnected()) {
            platform.trigger('connection-lost');
            networkConnected = false;
        }

        setInterval(function () {
            if (platform.device.isConnected()) {
                if (!networkConnected) {
                    platform.trigger('connection-restored');
                    networkConnected = true;
                }
            } else {
                if (networkConnected) {
                    platform.trigger('connection-lost');
                    networkConnected = false;
                }
            }
        }, 5000);
        app.start();
    });
};

app.history = {
    _items: [],

    length: function () {
        return this._items.length;
    },

    push: function (scene) {
        this._items.push(scene);
    },

    pop: function () {
        return this._items.pop();
    },

    find: function (sceneName) {
        return _.findWhere(this._items, {name: sceneName});
    },

    last: function () {
        return _.last(this._items);
    },

    shrink: function (sceneName) {
        var scene = this.find(sceneName);

        if (scene) this._items.splice(this._items.indexOf(scene));
    },

    clear: function () {
        this._items = [this._items.pop()];
    }
};

app.chain = {
    start: null,

    options: null,

    end: null,

    drop: function () {
        this.start = this.options = this.end = null;
    }
};

app.showScene = function (name, options) {
    if (!this.interceptSceneShow(name, options)) return;

    if (this.scene) this.scene._finalize(name, options);

    if (!this.scene || !_.isEqual(this.history.last(), {name: name, options: options})) {
        this.history.push({
            name: name,
            options: options
        });
    }

    this.log('[app]: show ' + name + ' scene');

    if (this.scenes[name]) {
        this.scene = this.scenes[name];
        this.scene.widgets.bind();
        this.scene.refresh(options);
    } else {
        this.scene = this.scenes[name] = new (require(name + 'Scene'))(options);
        this.scene.construct();
    }
};

window.time = function () {
    return Math.floor((new Date()).getTime()/1000);
};

window.uuid = function () {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
        var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
    });
};

window.app = app;
app.config = require('config');

app.renderTemplate = function (name, options) {
    var tpl = cachedTemplates[name] ||
        (cachedTemplates[name] = _.template(require('template/'+name)));
    return tpl(options);
};

/**
 * Перехватить нажатие клавиши на пульте (return false - событие остановится)
 *
 * @param key
 * @param view
 * @returns {boolean}
 */
app.interceptKeyEvent = function (key, view) { return true };

/**
 * Перехватить показ сцены (return false - вызов app._showScene() непрозойдет)
 *
 * @param name
 * @param data
 * @returns boolean
 */
app.interceptSceneShow = function (name, data) { return true; };

app.lastKey = { time: null,  button: null };

app.on('exit', function () { app.log('exit'); });

_.extend(platform, Backbone.Events);
require(platform.name)();

app.$body = $('body');
app.$body.addClass(platform.name);

module.exports = app;

app.subtitles = {
    visibile: false,
    active: false,

    show: function(){
        platform.player.showSubtitles();
    },

    hide: function () {
        platform.player.hideSubtitles();
    },

    changeVisibility: function() {
        if (this.visibile) {
            this.hide();
            app.scene.bar.subtitles.$el.removeClass('unvisible');
        } else {
            this.show();
            app.scene.bar.subtitles.$el.addClass('unvisible');
        }
    }
};

}),
"Scene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

function getEdges(axis, direction) {
    var edges;

    if (axis === 'x') {
        if (direction > 0) {
            edges = {near: 'left', far: 'right', first: 'top', second: 'bottom'}
        } else {
            edges = {near: 'right', far: 'left', first: 'top', second: 'bottom'}
        }
    } else if (axis === 'y') {
        if (direction > 0) {
            edges = {near: 'top', far: 'bottom', first: 'left', second: 'right'};
        } else {
            edges = {near: 'bottom', far: 'top', first: 'left', second: 'right'};
        }
    }

    return edges;
}

function getDistance(x0, y0, x1, y1) {
    return Math.floor(Math.sqrt((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1)));
}

var Backbone = require('Backbone');

module.exports = Backbone.View.extend({

    name: 'no-name',
    firstShow: true,

    initialize: function (options) {
        var self = this;

        this.options = this.options || options || {};

        this.widgets = [];
        this.widgets.add = function () {
            _.each(arguments, function (widget) {
                widget.index = this.push(widget) - 1;
                widget.parent = widget.scene = self;

                widget.widgets.add();
            }, this);
        };
        this.widgets.bind = function () {
            _.each(this, function (widget, i) {
                widget.parent = widget.scene = self;
                widget.index = i;
            });
        };
        this.widgets.render = function (opts) {
            var options = opts || {};

            if (options.once && this.rendered) return;

            _.each(this, function (widget) {
                if (!widget.container) {
                    self.$el.append(widget.render().$el);
                } else {
                    self.$(widget.container).append(widget.render().$el);
                }

                widget.trigger('rendered');
            }, this);
            
            this.rendered = true;
        };
        this.widgets.drop = function () {
            this.length = 0;
        };

        this.widget = null;

        if (this.options.name) this.name = this.options.name;

        var $el = $(this.className ? '.' + this.className : '#' + this.id);
        if ($el.length === 0) {
            if (this.template) this.$el.html(app.renderTemplate(this.template));
            app.$body.append(this.$el);
        } else {
            this.$el = $el;
        }

        this.on('key', function (key) {
            var handler = this['key' + key.button];

            if (handler) {
                handler.call(this, key.number);
            } else {
                this.log('handler for ' + key.button + ' is not defined');
            }
        }, this);
    },

    construct: function () {},

    prevWidget: function () {
        var widget, index = 0;

        if (!this.widget.leave) return;

        if (this.widgets.length) {
            do {
                index--;
                widget = this.widgets[this.widget.index + index];
            } while (widget && widget.disabled);
        }

        if (widget) this.focus(widget);
    },

    nextWidget: function () {
        var widget, ind = 0;

        if (!this.widget.leave) return;

        if (this.widgets.length) {
            do {
                ind++;
                widget = this.widgets[this.widget.index + ind];
            } while (widget && widget.disabled);
        }

        if (widget) this.focus(widget);
    },

    moveUp: function () {
        if (this.noSpacialNavigation) {
            this.prevWidget();
        } else {
            this.moveFocus('y', -1);
        }
    },

    moveDown: function () {
        if (this.noSpacialNavigation) {
            this.nextWidget();
        } else {
            this.moveFocus('y', +1);
        }
    },

    moveLeft: function (opts) {
        var options = opts || {};

        if (this.noSpacialNavigation || options.noSpacialNavigation) {
            this.prevWidget();
        } else {
            this.moveFocus('x', -1);
        }
    },

    moveRight: function () {
        if (this.noSpacialNavigation) {
            this.nextWidget();
        } else {
            this.moveFocus('x', +1);
        }
    },

    moveFocus: function (axis, direction, context) {
        if (!this.widgets.length) return;

        var i,
            widget,
            target,
            distance = 0,
            minimum = 10000,
            closestOutside = {distance: 10000, idx: -1},
            current = this.widget,
            edges = getEdges(axis, direction),
            widgets;

        current.getBox();

        context = context || current.parent;
        widgets = context.widgets;

        for (i = 0; i < widgets.length; i++) {
            target = widgets[i];
            if (target === current) continue;

            target.getBox();
            distance = (target.box[edges.near] - current.box[edges.far]) * direction;

            // если целевой виджет лежит в нужной полуплоскости
            if (distance >= 0 && !target.disabled) {
                // если целевой виджет попадает в "полосу"
                if (target.box[edges.second] > current.box[edges.first] && target.box[edges.first] < current.box[edges.second]) {
                    if (distance < minimum) {
                        minimum = distance;
                        widget = target;
                    }
                }
                // если виджет вне "полосы"
                else {
                    distance = getDistance(
                        current.center.x,
                        current.center.y,
                        target.box[edges.near],
                        target.box[edges.first] >= current.box[edges.second] ? target.box[edges.first] : target.box[edges.second]
                    );

                    if (distance < closestOutside.distance) {
                        closestOutside.distance = distance;
                        closestOutside.idx = i;
                    }
                }
            }
        }

        if (!widget && closestOutside.idx >= 0) widget = widgets[closestOutside.idx];

        if (widget) {
            if (widget.widgets.length) return this.moveFocus(axis, direction, widget);

            this.focus(widget);
        } else {
            if (context.parent) return this.moveFocus(axis, direction, context.parent);

            this.log(edges.far + 'most-widget');
            this.trigger(edges.far + 'most-widget');
        }
    },

    _finalize: function (sceneName, options) {
        this.firstShow = false;
        this.finalize(sceneName, options);
    },

    finalize: function () {},

    log: function () {
        var args = [];

        _.each(arguments, function (arg, i) {
            args[i] = '[' + this.name + ']' + ': ' + arg;
        }, this);

        app.log.apply(app, args);
    },

    isVisible: function () {
        return this.$el.css('display') !== 'none';
    },

    keyUp: function () {
        this.moveUp();
    },

    keyDown: function () {
        this.moveDown();
    },

    keyLeft: function () {
        this.moveLeft();
    },

    keyRight: function () {
        this.moveRight();
    },

    keyReturn: function () {
        if (app.history.length() === 1) {
            app.trigger('exit');
        } else {
            if (app.chain.end) {
                var start = app.chain.start;

                app.history.shrink(start.name);
                app.showScene(start.name, app.chain.options);
                app.chain.drop();
            } else {
                // удалаяем текущую сцену из истории
                app.history.pop();
                // показываем ту, что была перед текущей
                var historyPop = app.history.pop();
                app.showScene(historyPop.name, historyPop.options);
            }
        }
    },

    focus: function (widget, opts) {
        var options = opts || {};

        if (!widget) return;

        if (!options.silent && this.widget && this.widget !== widget.parent) this.widget._blur(options.blur, this.widget.parent !== widget.parent);

        this.widgets.last = this.widget;
        this.widget = widget;

        this.widgets.current = widget;
        widget._focus(options.focus);
    }
});

}),
"Widget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Backbone = require('Backbone');

module.exports = Backbone.View.extend({

    disabled: false,
    leave: true,
    index: 0,
    parent: null,
    scene: null,
    type: 'widget',
    name: 'no-name',
    container: '',

    initialize: function (options) {
        var self = this;

        this.options = this.options || options || {};

        this.widgets = [];
        this.widgets.add = function () {
            var widgets = arguments.length ? arguments : this;

            _.each(widgets, function (widget) {
                if (widgets === this) {
                    widget.scene = self.scene;
                } else {
                    widget.index = this.push(widget) - 1;
                    widget.parent = self;
                }
            }, this);
        };
        this.widgets.render = function () {
            _.each(this, function (widget) {
                if (!widget.container) {
                    self.$el.append(widget.render().$el);
                } else {
                    self.$(widget.container).append(widget.render().$el);
                }

                widget.trigger('rendered');
            }, this);
        };
        this.widgets.drop = function () {
            this.length = 0;
        };

        _.extend(this, _.pick(this.options,
            'disabled', 'leave', 'container', 'id', 'name', 'action', 'up', 'down', 'left', 'right', 'back', 'focus', 'blur', 'refresh'
        ));

        this.on('key', function (key) {
            var handler = this['key' + key.button];

            if (handler) {
                handler.call(this, key.number);
            } else {
                this.parent.trigger('key', key);
            }
        }, this);

        for (var name in this.options.events || {}) {
            if (!this.options.events.hasOwnProperty(name)) continue;
            this.on(name, this.options.events[name], this);
        }

        this.construct();
    },

    construct: function () {},

    delegateMouseEvents: function (selector, hoverCallback, silent, opts) {
        var self = this,
            options = opts || {};

        this.$el.off('mouseenter click mousewheel');
        this.$el.on('mouseenter', selector, function (event) {
            if (self.disabled && !options.ignoreDisabled) return;

            if (app.scene !== self.scene) app.showScene(self.scene.name);
            if (self !== self.scene.widget && !silent) self.scene.focus(self);
            if (typeof hoverCallback === 'function') hoverCallback.call(self, this);

            event.stopPropagation();
        });
        this.$el.on('click', selector, function (event) {
            if (platform.clickDisabled) return;
            if (self.disabled && !options.ignoreDisabled) return;

            if (typeof hoverCallback === 'function') hoverCallback.call(self, this);
            self.keyEnter(true, this);

            event.stopPropagation();
        });

        if (this.moveBackward && this.moveForward) {
            this.$el.on('mousewheel', function (event) {
                if (self.disabled && !options.ignoreDisabled) return;

                if (event.originalEvent.wheelDelta > 0) {
                    this.moveBackward({wheel: true});
                } else {
                    this.moveForward({wheel: true});
                }

                event.stopPropagation();
            }.bind(this));
        }

        if (options.onMouseLeave) {
            this.$el.on('mouseleave', selector, function () {
                if (self.disabled && !options.ignoreDisabled) return;

                this.scene.focus(options.onMouseLeave);
            }.bind(this));
        }
    },

    proxy: function (button) {
        this.parent.trigger('key', {button: button});
    },

    keyUp: function () {
        this.up ? this.up() : this.proxy('Up');
    },

    keyDown: function () {
        this.down ? this.down() : this.proxy('Down');
    },

    keyLeft: function () {
        this.left ? this.left() : this.proxy('Left');
    },

    keyRight: function () {
        this.right ? this.right() : this.proxy('Right');
    },

    keyEnter: function () {
        this.action ? this.action() : this.proxy('Enter');
    },

    keyReturn: function () {
        this.back ? this.back() : this.proxy('Return');
    },

    focus: function () {
        this.$el.addClass('active');
    },

    blur: function () {
        this.$el.removeClass('active');
    },

    _focus: function (options) {
        if (this.parent !== this.scene) this.parent._focus(options);

        platform.keyboard.hide();
        this.focus(options);
    },

    _blur: function (options, forwarding) {
        if (this.parent !== this.scene && forwarding) this.parent._blur(options);

        this.blur(options);
    },

    select: function () {
        this.$el.addClass('selected');
    },

    deselect: function () {
        this.$el.removeClass('selected');
    },

    getBox: function () {
        var el = this.type === 'list' ? this.getEl() : this.el,
            position = $(el).offset();

        this.center = {
            x: position.left + el.scrollWidth / 2,
            y: position.top + el.offsetTop + el.offsetHeight / 2
        };

        this.box = {
            top: position.top,
            right: position.left + el.scrollWidth,
            bottom: position.top + el.offsetHeight,
            left: position.left
        };

        return this.box;
    },

    log: function () {
        var args = [];

        _.each(arguments, function (arg, i) {
            args[i] = '[' + this.name + '-' + this.cid + ']' + ': ' + arg;
        }, this);

        app.log.apply(app, args);
    },

    disable: function () {
        this.disabled = true;
        this.$el.addClass('disabled');
    },

    enable: function () {
        this.disabled = false;
        this.$el.removeClass('disabled');
    },

    render: function () {
        this.delegateMouseEvents();

        return this;
    }
});

}),
"BroadcastModel": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var DEFAULT_LOCALE = 'am',
    DEFAULT_TIMEZONE = '+04:00';

var Backbone = require('Backbone');

module.exports = Backbone.Model.extend({

    parse: function (data) {
        var timezone = data.start_date.search(/[+-]\d{2}:\d{2}/) === -1 ? DEFAULT_TIMEZONE : '';

        data.start = new Date(data.start_date + timezone);
        data.stop = new Date(data.end_date + timezone);
        data.title = {am: data.name.trim(), en: data.name_en.trim(), ru: data.name_ru.trim()};

        return data;
    },

    getId: function () {
        return this.get('id');
    },

    getTitle: function () {
        return this.get('title')[app.translation.locale] || this.get('title')[DEFAULT_LOCALE];
    },

    getChannel: function () {
        return app.channels.get(this.get('channel_id'));
    },

    getStart: function (opts) {
        var options = opts || {};

        if (options.formatted) return app.helper.format(this.get('start'));

        return this.get('start').getTime() / 1000;
    },

    getStop: function (opts) {
        var options = opts || {};

        if (options.formatted) return app.helper.format(this.get('stop'));

        return this.get('stop').getTime() / 1000;
    },

    isOnAir: function () {
        var t = time();

        return this.getStart() <= t && this.getStop() > t;
    },

    isPlaying: function () {
        var t = time(),
            shift = this.getChannel().getShift();

        return this.getStart() <= t - shift && this.getStop() > t - shift;
    },

    isRecorded: function () {
        return this.getStop() < time() && this.getChannel().isRecorded();
    },

    getPercent: function (options) {
        var percent;

        percent = this.getElapsed(options) / this.getDuration() * 100;

        return percent < 0 ? 0 : percent > 100 ? 100 : percent;
    },

    getDuration: function () {
        return this.getStop() - this.getStart();
    },

    getElapsed: function (opts) {
        var options = opts || {},
            elapsed = time() - this.getStart() - (options.shift ? this.getChannel().getShift() : 0) - platform.player.getDelay();

        return options.formatted ? app.helper.format(elapsed) : elapsed;
    }
});

}),
"ChannelModel": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Backbone = require('Backbone'),
    Broadcast = require('BroadcastModel'),
    MODES = {
        LIVE_ONLY: 1,
        CATCHUP: 2
    };

module.exports = Backbone.Model.extend({

    getId: function () {
        return this.get('id');
    },

    getName: function () {
        return this.get('channel_name');
    },

    getStream: function () {
        var stream = this.get('hls_url'),
            interval = this.getInterval();

        if (interval.start) {
            return stream + '?startTime=' + interval.start + '&stopTime=' + (interval.stop || time() - 180);
        } else {
            return stream;
        }
    },

    getLogo: function () {
        return this.get('logo_url');
    },

    isRecorded: function () {
        return Number(this.get('live_mode')) === MODES.CATCHUP;
    },

    getBroadcasts: function () {
        var broadcasts = this.get('broadcasts');

        if (!broadcasts) {
            this.set('broadcasts', broadcasts = _.map(this.get('playlist'), function (broadcast) {
                return new Broadcast(broadcast, {parse: true});
            }));
        }

        return broadcasts;
    },

    getBroadcast: function (opts) {
        var options = opts || {};

        return _.find(this.getBroadcasts(), function (broadcast) {
            return options.shift ? broadcast.isPlaying() : broadcast.isOnAir();
        });
    },

    getNext: function (broadcast) {
        var broadcasts = this.getBroadcasts();

        return broadcasts[broadcasts.indexOf(broadcast) + 1];
    },

    setShift: function (shift) {
        this.set('start', shift <= 0 ? 0 : time() - shift);
        this.set('shift', shift < 0 ? 0 : shift);
    },

    getShift: function () {
        return this.get('shift') || 0;
    },

    setInterval: function (start, stop) {
        this.set('start', start);
        this.set('stop', stop);
        this.set('shift', start ? time() - start : 0);
    },

    getInterval: function () {
        return {start: this.get('start'), stop: this.get('stop')};
    }
});

}),
"EpisodeModel": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Backbone = require('Backbone');

module.exports = Backbone.Model.extend({

    getId: function () {
        return this.get('id');
    },

    getBanner: function () {
        return this.get('banner');
    },

    getName: function () {
        return this.get('name_' + app.translation.locale);
    },

    getVideo: function () {
        return this.get('video_url');
    },

    getDuration: function() {
        return app.helper.format(this.get('duration'));
    },

    getParent: function() {
        return this.get('parent');
    },

    getPercent: function (current, duration) {
        var percent;

        percent = current / duration * 100;

        return percent < 0 ? 0 : percent > 100 ? 100 : percent;
    },

    parse: function (response) {
        response.name_am = response.name;
        delete response.name;

        return response;
    },
});

}),
"VodModel": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Backbone = require('Backbone'),
    Episode = require('EpisodeModel');

module.exports = Backbone.Model.extend({

    url: function () {
        return app.config.url + '/vodSingle?id=' + this.getId();
    },

    getId: function () {
        return this.get('vod_id') || this.get('id');
    },

    getBanner: function () {
        return this.get('banner_url');
    },

    getCategory: function () {
        return this.get('category');
    },

    getType: function () {
        return this.get('type');
    },

    getName: function () {
        return this.get('name_' + app.translation.locale);
    },

    getDescription: function () {
        return this.get('description_' + app.translation.locale);
    },

    getYear: function () {
        return this.get('year');
    },

    getSeries: function () {
        return this.get('series');
    },

    getSimilar: function () {
        return this.get('similar');
    },

    loadMeta: function () {
        return app.ajax.getVodMeta(this);
    },

    parse: function (response) {
        if (response.data) {
            response = response.data;
            response.name_au = response.name;

            delete response.name;

            response.series = _.map(response.series, function (item) {
                item.parent = this;
                item.name_am = item.name;

                return new Episode(item);
            }.bind(this));

            response.similar = _.map(response.similar, function (item) {
                return app.vod.filter(function (vod) { return vod.getId() === item.id; })[0];
            });
        }

        return response;
    }
});

}),
"ChannelCollection": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Backbone = require('Backbone'),
    Channel = require('ChannelModel');

module.exports = Backbone.Collection.extend({

    model: Channel,

    url: function () {
        return app.config.url + '/playlists?utc=1';
    },

    parse: function (response) {
        return response.playlists;
    },

    fetch: function () {
        return Backbone.Collection.prototype.fetch.call(app.channels);
    }
});

}),
"VodCollection": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Backbone = require('Backbone'),
    Vod = require('VodModel');

module.exports = Backbone.Collection.extend({

    model: Vod,

    url: function () {
        return app.config.url + '/vod?main=1';
    },

    parse: function (response) {
        app.vod.categories = _.keys(response.data);

        var result = _.map(response.data, function (vod, category) { return _.each(vod, function (v) { v.category = category; }); });

        return _.flatten(result);
    },

    fetch: function () {
        return Backbone.Collection.prototype.fetch.call(app.vod);
    },

    getByCategory: function (category) {
        return this.filter(function (v) { return v.getCategory() === category; });
    }
});

}),
"BarWidget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Widget = require('Widget'),
    Slider = require('SliderWidget'),
    Button = require('ButtonWidget');

module.exports = Widget.extend({

    className: 's-player__bar w-bar animate bottom',

    construct: function () {
        this.progress = new Slider({
            container: '.w-bar__progress',
            layers: ['watched'],
            action: function (position, max) {
                if (this.disabled) return;

                app.player.seek(position === max ? position + 1 : position);
                this.parent.begin.trigger('refresh');
            },
            left: $.noop,
            down: function () {
                if (this.parent.pause.disabled) {
                    this.parent.keyDown();
                } else if (this.parent.begin.disabled) {
                    this.scene.focus(this.parent.pause);
                } else {
                    this.scene.focus(this.parent.begin);
                }
            },
            events: {'manipulated': function () {
                var bar = this.parent;

                clearTimeout(bar.keyReturn.timer);
                bar.keyReturn.timer = _.delay(bar.keyReturn.bind(this), 8000);
            }}
        });

        this.begin = new Button({
            container: '.w-bar__buttons',
            icon: 'rotateright',
            caption: app.translation.get('begin'),
            action: function () {
                app.player.begin();
                this.parent.show();
            },
            left: $.noop,
            refresh: function (icon, caption) {
                this.setIcon(icon);
                this.setCaption(caption);
            },
            events: {'refresh': function () {
                var broadcast = app.player.getBroadcast();

                if (!broadcast) return;

                if (broadcast.getChannel().getShift()) {
                    this.refresh('forward', app.translation.get('live'));
                } else {
                    this.refresh('rotateright', app.translation.get('begin'));
                }
            }}
        });

        this.pause = new Button({
            container: '.w-bar__buttons',
            icon: 'pause',
            refresh: function (pauseOrPlay) {
                this.setIcon(pauseOrPlay);
                this.setAction(function () {
                    app.player[pauseOrPlay]();
                    this.trigger('refresh');
                });
            },
            events: {'refresh': function () {
                if (!app.player.rewind.inProgress && (platform.player.is('PLAYING') || platform.player.is('BUFFERING'))) {
                    this.refresh('pause');
                } else {
                    this.refresh('play');
                }
            }}
        });

        this.backward = new Button({
            container: '.w-bar__buttons',
            icon: 'previous',
            action: function () {
                app.player.backward();
                this.parent.show();
            }
        });

        this.forward = new Button({
            container: '.w-bar__buttons',
            icon: 'next',
            action: function () {
                app.player.forward();
                this.parent.show();
            }
        });

        platform.player.on('buffering-complete', function () { this.pause.trigger('refresh'); }, this);

        this.widgets.add(this.progress, this.begin, this.pause, this.backward, this.forward);
    },

    keyReturn: function () {
        this.scene.focus(this.scene.anchor);
    },

    keyDown: function () {
        this.keyReturn();
    },

    update: function () {
        var broadcast = app.player.getBroadcast(),
            duration = app.player.getDuration({formatted: true}),
            actual = broadcast ? broadcast.getPercent() : 100,
            watched = app.player.getPosition();

        this.$duration.text(duration);

        this.progress.setLayer(0, watched);
        this.progress.setMax(actual);

        if (!this.progress.manipulated) this.progress.setPosition(watched, {silent: true});
    },

    show: function () {
        var broadcast = app.player.getBroadcast(),
            timeshift = app.player.timeshift(),
            title = broadcast ? broadcast.getStart({formatted: true}) + ' ' +  broadcast.getTitle() : app.player.getVod().getParent().getName(),
            subtitle = broadcast ? broadcast.getChannel().getName() : app.player.getVod().getName();

        this.$title.text(title);
        this.$subtitle.html([subtitle, this.$duration]);

        this.begin.trigger('refresh');
        this.pause.trigger('refresh');

        if (broadcast) _.each(this.widgets, function (widget) { widget[timeshift ? 'enable' : 'disable'](); });

        clearInterval(this.update.timer);
        this.update.timer = setInterval(this.update.bind(this), 1000);

        clearTimeout(this.keyReturn.timer);
        this.keyReturn.timer = setTimeout(this.keyReturn.bind(this), 8000);

        this.update();

        this.$el.attr('style', '');
    },

    hide: function () {
        var box = this.getBox();

        clearInterval(this.update.timer);
        clearInterval(this.keyReturn.timer);

        this.$el.css('bottom', box.top - box.bottom + 1);
    },

    focus: function () {
        this.show();
        this.visible = true;

        this.$el.addClass('active').attr('style', '');
    },

    blur: function () {
        this.hide();
        this.visible = false;

        this.$el.removeClass('active');
    },

    render: function () {
        this.$el.html(app.renderTemplate('widget/bar'));

        this.$title = this.$('.w-bar__title');
        this.$subtitle = this.$('.w-bar__subtitle');
        this.$duration = this.$('.w-bar__duration');
        this.$slider = this.$('.w-bar__slider');

        this.widgets.render();

        this.delegateMouseEvents();

        return this;
    }
});
}),
"GridWidget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var List = require('ListWidget');

module.exports = List.extend({
    className: 's-vod-main__grid animate top',
    options: {
        vertical: true,
        cycle: false,
        center: true,
        bounds: true,
        data: [],
        render: function (list) {
            return $('<div/>').addClass(list.container.substr(1));
        },
        events: {
            'item-activated': function (list) {
                if (this.flag) return;

                this.parent.focus(list);
            },
            'item-deactivated': function () {
                this.flag = false;
            }
        }
    },
    column: 0,

    construct: function () {
        List.prototype.construct.call(this);

        _.each(app.vod.categories, function (category) {
            var vod = app.vod.getByCategory(category),
                className = category === 'banners' ? 's-main__shelf' : 's-main__category';

            if (!vod.length) return;

            this.widgets.add(new List({
                container: '.category-' + category,
                className: className,
                vertical: false,
                data: vod,
                render: function (vod) {
                    return $(app.renderTemplate('item', {item: vod}));
                },
                focus: function () {
                    this.$el.addClass('active');
                    this.activateItem({animation: false});

                    this.trigger('focus');
                },
                action: function (item) {
                    app.showScene('Vod', {vod: item});
                },
                events: {
                    'rendered': function () {
                        if (category !== 'banners') this.$el.parent().attr('data-title', app.translation.get(category));
                    }
                }
            }));

        }, this);

        this.setData(this.widgets);
    },

    keyUp: function () {
        if (this.getIndex() === 0) {
            this.parent.keyUp();
        } else {
            this.moveBackward();
        }
    },

    focus: function () {
        this.flag = true;

        this.activateItem({animation: false});
    },

    blur: function () {
        this.deactivateItem();
    },

    render: function () {
        List.prototype.render.call(this);

        this.widgets.render();

        return this;
    }
});
}),
"InputWidget": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Widget = require('Widget');

module.exports = Widget.extend({

    type: 'input',
    name: 'input',

    construct: function () {
        this.value = '' + (this.options.value || '');

        this.$label = $('<div/>').attr({'class': 'w-input__label'}).text(this.options.label || '');
        this.$input = $('<div/>').attr({'class': 'w-input__input'});
        this.$value = $('<div/>').attr({'class': 'w-input__value'});
        this.$error = $('<div/>').attr({'class': 'w-input__error'}).text(this.options.error || '');

        this.makePretty();
    },

    makePretty: function () {
        this.$value.text(this.options.password ? this.value.replace(/./g, '*') : this.value);

        this.checkOverflow();
    },

    checkOverflow: function () {
        if (this.$value[0].clientWidth > this.$input[0].offsetWidth) {
            this.$el.addClass('overflow');
        } else {
            this.$el.removeClass('overflow');
        }
    },

    isValid: function () {
        return this.options.validate ? this.options.validate(this.value) : this.value.length > 0;
    },

    getData: function () {
        return this.value;
    },

    setData: function (value) {
        this.value = value;
        this.makePretty();

        this.deselect();
    },

    setLabel: function (label) {
        this.$label.text(label);
    },

    setError: function (error) {
        this.$error.text(error);
    },

    dropData: function () {
        this.value = '';
        this.makePretty();
        this.deselect();
    },

    keyEnter: function () {
        platform.keyboard.show({type: 'text', target: this});
    },

    keyNumber: function (number) {
        if (this.value.length !== this.options.maxlength) {
            this.value += number;
            this.makePretty();
        }

        this.deselect();

        if (this.value.length === this.options.maxlength) {
            if (this.isValid()) {
                this.parent.nextWidget();
            } else {
                this.select();
            }
        }

        this.trigger('change', this.value);
    },

    keyBackspace: function () {
        this.deselect();

        if (this.value.length > 0) {
            this.value = this.value.slice(0, this.value.length - 1);
            this.makePretty();

            platform.keyboard.value(this.value);
        }

        this.trigger('change', this.value);
    },

    focus: function () {
        this.$el.addClass('active');

        _.defer(function () {
            if (this.scene.widgets.last === platform.keyboard) return;

            platform.keyboard.show({type: 'text', target: this});
        }.bind(this));
        
        this.trigger('focus');

        this.timer = setInterval(function () {
            this.$el.toggleClass('cursor');
        }.bind(this), 600);
    },

    blur: function () {
        this.$el.removeClass('active');

        this.trigger('blur');

        clearInterval(this.timer);
        this.$el.removeClass('cursor');
    },

    select: function (text) {
        this.$error.text(text || this.options.error).show();
    },

    deselect: function () {
        this.$error.hide();
    },

    render: function () {
        this.delegateMouseEvents();

        this.$el.attr('class', 'w-input').append(this.$label, this.$input.append(this.$value), this.$error);

        return this;
    }
});
}),
"DevicesScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    Button = require('ButtonWidget'),
    List = require('ListWidget');

module.exports = Scene.extend({

    name: 'Devices',
    className: 's-devices',

    construct: function () {
        this.list = new List({
            vertical: true,
            scrollbar: true,
            className: 's-devices__items',
            data: [],
            render: function (device) {
                return $('<div/>').text(device.dev_name);
            },
            action: function (device) {
                app.$preloader.show();
                app.ajax.replace(device)
                    .then(function () {
                        app.$preloader.hide();
                        this.keyReturn();
                    }.bind(this))
                    .fail(function () {
                        app.$preloader.hide();
                        app.notifier.show({type: 'error', message: app.translation.get('device-error')});

                        this.list.disable();
                        this.button.enable();

                        this.focus(this.button);
                        this.$('.s-devices__message').html(app.translation.get('device-error') + '<br>' + app.translation.get('change-account'));
                    }.bind(this.scene));
            }
        });
        this.button = new Button({
            disabled: true,
            caption: 'Change account',
            action: function () {
                app.showScene('Logout');
            }
        });

        this.widgets.add(this.list, this.button);

        this.refresh(this.options);
    },

    keyRed: function () {
        app.showScene('Settings');
    },

    refresh: function (options) {
        this.button.disable();
        this.list.enable();
        this.list.setData(options.devices);

        this.render();
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/devices')).show();

        this.widgets.render();
        this.focus(this.list);

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});

}),
"ExitScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    Button = require('ButtonWidget');

module.exports = Scene.extend({

    name: 'Exit',
    className: 's-exit',

    construct: function () {
        this.ok = new Button({
            caption: '',
            action: app.trigger.bind(app, 'exit')
        });
        this.back = new Button({
            caption: '',
            action: this.keyReturn
        });

        this.widgets.add(this.ok, this.back);

        this.refresh();
    },

    refresh: function () {
        this.ok.setCaption(app.translation.get('yes'));
        this.back.setCaption(app.translation.get('back'));

        this.render();
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/exit')).show();

        this.widgets.render();
        this.focus(this.back);

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});
}),
"LanguageScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    List = require('ListWidget');

module.exports = Scene.extend({

    name: 'Language',
    className: 's-language',

    construct: function () {
        this.list = new List({
            vertical: true,
            className: 's-language__items',
            data: [
                {name: 'Հայերեն', locale: 'am'},
                {name: 'English', locale: 'en'},
                {name: 'Русский', locale: 'ru'}
            ],
            render: function (item) {
                return $('<div/>').text(item.name);
            },
            action: function (item) {
                app.translation.set(item.locale);
                this.scene.keyReturn();
            }
        });

        this.widgets.add(this.list);

        this.refresh();
    },

    refresh: function () {
        this.render();
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/language')).show();

        this.widgets.render();
        this.focus(this.list);

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});

}),
"LoginScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    Input = require('InputWidget'),
    Button = require('ButtonWidget');

module.exports = Scene.extend({

    name: 'Login',
    className: 's-login',

    construct: function () {
        this.login = new Input({
            container: '.s-login__form',
            value: ''
        });
        this.password = new Input({
            password: true,
            container: '.s-login__form',
            value: ''
        });
        this.signin = new Button({
            container: '.s-login__form',
            caption: '',
            action: function () {
                if (!this.scene.login.isValid()) return this.scene.login.select();
                if (!this.scene.password.isValid()) return this.scene.password.select();

                app.$preloader.show();
                app.ajax.loginByUsername(this.scene.login.getData(), this.scene.password.getData())
                    .then(app.channels.fetch)
                    .then(app.vod.fetch)
                    .then(_.delay.bind(_, function () {
                        app.$preloader.hide();
                        app.showScene('Main');
                    }, 300))
                    .fail(function (error) {
                        if (error.handled) return;

                        app.$preloader.hide();
                        app.notifier.show({type: 'error', message: app.translation.get('wrong-credentials')});
                    });
            }
        });

        this.widgets.add(this.login, this.password, this.signin);

        this.refresh();
    },

    refresh: function () {
        this.login.setLabel(app.translation.get('email'));
        this.login.setError(app.translation.get('wrong-email'));
        this.password.setLabel(app.translation.get('password'));
        this.password.setError(app.translation.get('wrong-password'));
        this.signin.setCaption(app.translation.get('login'));

        this.render();
    },

    keyReturn: function () {
        app.showScene('Exit');
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/login')).show();

        this.widgets.render();
        this.focus(this.login);

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});

}),
"LogoutScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    Button = require('ButtonWidget');

module.exports = Scene.extend({

    name: 'Logout',
    className: 's-logout',

    construct: function () {
        this.yes = new Button({
            caption: '',
            action: function () {
                app.player.stop();

                app.storage.setItem('token', null);
                app.storage.save();

                app.showScene('Login');
                app.history.clear();
            }
        });
        this.no = new Button({
            caption: '',
            action: function () {
                this.scene.keyReturn();
            }
        });

        this.widgets.add(this.yes, this.no);

        this.refresh();
    },

    refresh: function () {
        this.yes.setCaption(app.translation.get('yes'));
        this.no.setCaption(app.translation.get('no'));

        this.render();
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/logout')).show();

        this.widgets.render();
        this.focus(this.yes);

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});

}),
"MainScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    List = require('ListWidget');

module.exports = Scene.extend({

    name: 'Main',
    className: 's-main',

    construct: function () {
        this.list = new List({
            className: 's-main__items',
            data: [],
            render: function (item) {
                return $(app.renderTemplate('main-item', item));
            },
            action: function (item) {
                app.showScene(item.scene);
            }
        });

        this.widgets.add(this.list);

        this.refresh();
    },

    keyReturn: function () {
        app.showScene('Exit');
    },

    refresh: function () {
        this.list.setData([
            {scene: 'Player', caption: app.translation.get('channels')},
            {scene: 'VodMain', caption: app.translation.get('vod-main')}
        ]);

        this.render();
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/main')).show();

        this.widgets.render();
        this.focus(this.list);

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});

}),
"PlayerScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    Widget = require('Widget'),
    List = require('ListWidget'),
    Bar = require('BarWidget'),
    Channel = require('ChannelModel');

module.exports = Scene.extend({

    name: 'Player',
    className: 's-player',

    construct: function () {
        this.$preloader = $('<div/>').addClass('s-player__preloader');
        this.$icon = $('<div/>').addClass('s-player__icon');

        this.anchor = new Widget({
            up: $.noop,
            down: function () {
                this.scene.focus(this.parent.bar.progress);
            },
            left: function () {
                if (app.player.getBroadcast()) this.scene.focus(this.parent.channels);
            },
            focus: function () {
                app.legend.hide();
            },
            blur: function () {
                app.legend.show();
            }
        });
        this.channels = new List({
            vertical: true,
            className: 's-player__channels animate left',
            data: [],
            render: function (channel) {
                if (channel instanceof Channel) {
                    return $(app.renderTemplate('channel', {channel: channel}));
                } else {
                    return $('<div/>').addClass('settings').text(channel);
                }
            },
            action: function (channel) {
                if (channel instanceof Channel) {
                    this.scene.epg.setData(channel.getBroadcasts()).render().enable();
                    this.scene.focus(this.scene.epg, {
                        blur: {flag: true},
                        focus: {animation: false, center: true, idx: this.scene.epg.indexOf(channel.getBroadcast())}
                    });
                } else {
                    app.showScene('Settings');
                }
            },
            left: function () {
                this.scene.focus(this.scene.anchor);
            },
            right: function () {
                this.action(this.getActive());
            },
            back: function () {
                this.left();
            },
            blur: function (opts) {
                var options = opts || {};

                this.selectItem();
                this.deactivateItem();
                if (options.flag !== true) {
                    this.$el.removeClass('active');
                    this.scene.epg.deselect();
                    this.scene.epg.disable();
                }
            },
            focus: function () {
                this.render();
                List.prototype.focus.call(this, {animation: false});
                this.scene.epg.select();
            }
        });
        this.epg = new List({
            disabled: true,
            vertical: true,
            bounds: true,
            className: 's-player__epg animate left',
            data: [],
            render: function (broadcast) {
                return $(app.renderTemplate('broadcast', {broadcast: broadcast}));
            },
            action: function (broadcast) {
                if (!broadcast.isRecorded() && !broadcast.isOnAir()) return;

                if (broadcast !== app.player.getBroadcast()) app.player.play(broadcast);
                this.scene.channels.blur();
                this.scene.focus(this.scene.anchor);
            },
            left: function () {
                this.scene.focus(this.scene.channels);
            },
            back: function () {
                this.keyLeft();
            }
        });
        this.bar = new Bar();

        this.widgets.add(this.anchor, this.channels, this.epg, this.bar);

        platform.player.on('buffering-start', function () { this.$preloader.show(); }, this);
        platform.player.on('buffering-complete', function () { this.$preloader.hide(); }, this);
        platform.on('connection-lost', function () { this.$preloader.show(); }, this);
        platform.on('connection-restored', function () { this.$preloader.hide(); }, this);

        app.player.on('pause', function () { this.$icon.html('&#221;').show(); }, this);
        app.player.on('vod-end', function () { this.keyReturn(); }, this);
        app.player.on('forward', function (speed) { this.$icon.html('&#251;<i>x' + speed + '</i>').show(); }, this);
        app.player.on('rewind', function (speed) { this.$icon.html('&#248;<i>x' + speed + '</i>').show(); }, this);
        app.player.on('resume play', function () { this.$icon.text('').hide(); }, this);
        app.player.on('play', function () { this.$preloader.show(); }, this);
        app.player.on('shift', function () {
            if (this.bar.visible) {
                this.bar.show();
            } else {
                this.focus(this.bar.progress);
            }
        }, this);

        this.refresh(this.options);
    },

    keyRed: function () {
        app.showScene('Settings');
    },

    keyRewind: function () {
        if (app.player.timeshift()) app.player.backward();
    },

    keyForward: function () {
        if (app.player.timeshift()) app.player.forward();
    },

    keyPause: function () {
        if (app.player.timeshift()) app.player.pause();
    },

    keyPlay: function () {
        if (app.player.timeshift()) app.player.play();
    },

    keyPlayPause: function () {
        this.keyPause();
    },

    refresh: function (opts) {
        if ((opts || {}).vod) {
            this.channels.disable();
            this.epg.disable();
            this.bar.begin.disable();
            app.$preloader.hide();

            app.player.play({vod: opts.vod});

            if (app.chain.start) app.chain.end = true;
        } else {
            var channels = app.channels.filter(function (channel) { return channel.getBroadcast(); });

            if (platform.name === 'android') channels = channels.concat(app.translation.get('settings'));

            this.channels.setData(channels);

            if (app.player.wasStopped() || !app.player.getBroadcast()) {
                app.player.play(this.channels.at(0).getBroadcast());
            }
        }

        if (!app.ajax.registered) {
            app.ajax.register()
                .fail(function (response) { if (!app.ajax.registered) app.showScene('Devices', {devices: response.devices}); });
        }

        this.render();
    },

    render: function () {
        var items = ['return', 'enter'];

        if (app.player.getBroadcast()) items.push('left-right', 'red');

        if (platform.name === 'android') items.shift();

        this.$el.show().html(app.legend.render({items: items, theme: 'light'})).append(this.$preloader, this.$icon);

        this.widgets.render();
        this.focus(this.widget || this.bar.progress);

        return this;
    },

    finalize: function () {
        this.bar.hide();

        this.$preloader.hide();
        this.$icon.hide();
        this.$el.hide();

        app.player.reset();
    }
});

}),
"RegistrationScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    Button = require('ButtonWidget');

module.exports = Scene.extend({

    name: 'Registration',
    className: 's-registration',

    construct: function () {
        this.done = new Button({
            caption: app.translation.get('registered'),
            action: function () {
                app.showScene('Login');
            }
        });

        this.widgets.add(this.done);

        this.refresh();
    },

    refresh: function () {
        this.render();
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/registration')).show();

        this.widgets.render();
        this.focus(this.done);

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});

}),
"SettingsScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    List = require('ListWidget');

module.exports = Scene.extend({

    name: 'Settings',
    className: 's-settings',

    construct: function () {
        this.list = new List({
            className: 's-settings__items',
            data: [],
            render: function (item) {
                return $(app.renderTemplate('setting', item));
            },
            action: function (item) {
                app.showScene(item.scene);
            }
        });

        this.widgets.add(this.list);

        this.refresh();
    },

    refresh: function () {
        this.list.setData([
            {scene: 'Language', caption: app.translation.get('language')},
            {scene: 'Logout', caption: app.translation.get('logout')}
        ]);
        this.render();
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/settings')).show();

        this.widgets.render();
        this.focus(this.list);

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});

}),
"StartScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    retries = 0,
    stage = 0;

module.exports = Scene.extend({

    name: 'Start',
    className: 's-start',

    construct: function () {
        this.refresh();
    },

    refresh: function () {
        if (app.ajax.hasToken()) {
            app.ajax.refreshToken()
                .then(this.update)
                .then(app.channels.fetch)
                .then(this.update)
                .then(app.vod.fetch)
                .then(this.update)
                .then(_.delay.bind(_, function () { app.showScene('Main'); }, 300))
                .fail(this.fail);
        } else {
            _.delay(function () { app.showScene('Login'); }, 500);
        }

        this.render();
    },

    update: function () {
        app.scene.$progress.css({width: ++stage * 640 + 'px'});
    },

    fail: function () {
        if (retries < 2) {
            app.scene.retry();
        } else {
            app.scene.$progress.css({width: ++stage * 640 + 'px', 'background-color': '#ff0000'});
        }
    },

    retry: function () {
        retries = 1;
        stage = 0;

        app.storage.clear();

        this.refresh();
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/start')).show();

        this.$progress = this.$('.s-start__progress');

        return this;
    },

    finalize: function () {
        this.$el.hide();
        app.history.pop();
    }
});

}),
"TimezoneScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    List = require('ListWidget');

module.exports = Scene.extend({

    name: 'Timezone',
    className: 's-timezone',

    construct: function () {
        this.list = new List({
            vertical: true,
            className: 's-timezone__items',
            data: [
                {offset: '+3', location: 'Ереван'}
            ],
            render: function (item) {
                return $(app.renderTemplate('timezone', item));
            },
            action: function (item) {
            }
        });

        this.widgets.add(this.list);

        this.refresh();
    },

    refresh: function () {
        this.render();
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/timezone')).show();

        this.widgets.render();
        this.focus(this.list);

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});

}),
"VodScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    List = require('ListWidget');

module.exports = Scene.extend({

    name: 'Vod',
    className: 's-vod-episodes',

    construct: function () {
        this.list = new List({
            vertical: false,
            scrollbar: true,
            className: 's-vod-episodes__items',
            data: [],
            focus: function () {
                this.$el.addClass('active');
                this.activateItem({animation: false});

                this.trigger('focus');
            },
            render: function (vod) {
                return $(app.renderTemplate('episode-item', {item: vod}));
            },
            action: function (vod) {
                app.showScene('Player', {vod: vod});
            }
        });

        this.widgets.add(this.list);

        this.refresh(this.options);
    },

    keyRed: function () {
        app.showScene('Settings');
    },

    refresh: function (options) {
        var vod = options.vod,
            self = this;

        app.$preloader.show();

        vod.loadMeta()
            .then(function () {
                var series = vod.getSeries();

                if (series.length <= 0) {
                    self.keyReturn();

                    return;
                }

                if (series.length === 1) {
                    app.showScene('Player', {vod: series[0]});

                    return;
                }

                app.chain.start = self;
                app.chain.options = options;

                self.list.setData(series);
                self.render(options);
            });
    },

    render: function (options) {
        this.$el.html(app.renderTemplate('scene/vod-episode' , {title: options.vod.getName()})).show();
        app.$preloader.hide();

        this.widgets.render();
        this.focus(this.list, {animation: false});

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});

}),
"VodMainScene": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Scene = require('Scene'),
    Grid = require('GridWidget');

module.exports = Scene.extend({

    name: 'VodMain',
    className: 's-vod-main',

    construct: function () {
        this.grid = new Grid();

        this.widgets.add(this.grid);

        this.refresh();
    },

    keyRed: function () {
        app.showScene('Settings');
    },

    refresh: function () {
        app.chain.start = this;
        app.$preloader.hide();

        this.render();
    },

    render: function () {
        this.$el.html(app.renderTemplate('scene/vod-main')).show();

        this.widgets.render();
        this.focus(this.widget || this.grid.widgets[0]);

        return this;
    },

    finalize: function () {
        this.$el.hide();
    }
});

}),
"template/broadcast": "<div class=\"broadcast-item<%= broadcast.isOnAir() ? ' live' : ''  %><%= broadcast.isRecorded() ? ' recorded' : ''  %>\">\n<% if (broadcast.isOnAir()) { %>\n    <div class=\"broadcast-item__title\"><%= broadcast.getTitle() %></div>\n    <div class=\"broadcast-item__live\"></div>\n    <div class=\"broadcast-item__info\">\n        <div class=\"broadcast-item__begin\"><%= broadcast.getStart({formatted: true}) %></div>\n        <div class=\"broadcast-item__progress\">\n            <div class=\"broadcast-item__slider\" style=\"width: <%= broadcast.getPercent() %>%\"></div>\n        </div>\n        <div class=\"broadcast-item__end\"><%= broadcast.getStop({formatted: true}) %></div>\n    </div>\n<% } else { %>\n    <div class=\"broadcast-item__time\"><%= broadcast.getStart({formatted: true}) %></div>\n    <div class=\"broadcast-item__title\"><%= broadcast.getTitle() %></div>\n<% } %>\n</div>",
"template/channel": "<div class=\"channel-item\">\n    <% broadcast = channel.getBroadcast() %>\n    <% next = channel.getNext(broadcast) %>\n    <div class=\"channel-item__name\"><%= channel.getName() %></div>\n    <div class=\"channel-item__logo\" style=\"background-image: url(<%= channel.getLogo() %>)\"></div>\n    <div class=\"channel-item__epg\">\n        <div class=\"channel-item__live\">\n            <div class=\"channel-item__live-begin\"><%= broadcast.getStart({formatted :true}) %></div>\n            <div class=\"channel-item__live-title\"><%= broadcast.getTitle() %></div>\n        </div>\n        <div class=\"channel-item__progress\">\n            <div class=\"channel-item__slider\" style=\"width: <%= broadcast.getPercent() %>%\"></div>\n        </div>\n        <div class=\"channel-item__next\">\n            <div class=\"channel-item__next-begin\"><%= next ? next.getStart({formatted :true}) : broadcast.getStop({formatted :true}) %></div>\n            <div class=\"channel-item__next-title\"><%= next ? next.getTitle() : '-' %></div>\n        </div>\n    </div>\n</div>\n",
"template/episode-item": "<div class=\"episode-item\">\n    <div class=\"episode-item__poster\">\n        <div class=\"episode-item__poster-image\" style=\"background-image: url(<%= item.getBanner() %>)\"></div>\n    </div>\n    <div class=\"episode-item__title\"><%= item.getName() %></div>\n</div>\n",
"template/item": "<div class=\"item\">\n    <div class=\"<%= typeof item.getCategory === 'function' && item.getCategory() === 'banners' ? 'shelf__poster' : 'item__poster' %>\" style=\"background-image: url(<%= item.getBanner() %>)\"></div>\n</div>",
"template/legend": "<div class=\"legend <%= theme %> animate bottom\" style=\"bottom: <%= hidden ? -80 : 0 %>px\">\n<% for (var i = 0; i < items.length; i++) { %>\n    <div class=\"legend__item\" onclick=\"app.legend.click('<%= items[i].key %>')\">\n        <i class=\"legend__<%= items[i].key %>\"></i>\n        <%= items[i].text %>\n    </div>\n<% } %>\n</div>",
"template/log": "<script language=\"javascript\" type=\"text/javascript\">\n    window.onerror = function (message, file, line, column, error) {\n        var xhr = new XMLHttpRequest();\n        var body = 'message=' + encodeURIComponent('ARMTVS ' + [message, file, line, column].join(', '));\n\n        try {\n            body += encodeURIComponent(', ' + [error.stack.replace(/\\n/g, ';')].join(', '));\n        } catch (e) {}\n\n        xhr.open('POST', 'https://zoom.re/api/log', true);\n        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n        xhr.send(body);\n    };\n</script>",
"template/main-item": "<div class=\"main\">\n    <div class=\"main__icon\" style=\"background-image: url(i/main/<%= scene.toLowerCase() %>.png)\"></div>\n    <div class=\"main__caption\"><%= caption %></div>\n</div>\n",
"template/setting": "<div class=\"setting\">\n    <div class=\"setting__icon\" style=\"background-image: url(i/settings/<%= scene.toLowerCase() %>.png)\"></div>\n    <div class=\"setting__caption\"><%= caption %></div>\n</div>\n",
"template/timezone": "<div class=\"timezone\">\n    <div class=\"timezone__offset\"><%= offset %></div>\n    <div class=\"timezone__location\"><%= location %></div>\n</div>\n",
"template/widget/bar": "<div class=\"w-bar__title\"></div>\n<div class=\"w-bar__subtitle\">\n    <div class=\"w-bar__duration\">00:00</div>\n</div>\n<div class=\"w-bar__progress\"></div>\n<div class=\"w-bar__buttons\"></div>\n",
"template/scene/devices": "<div class=\"scene-header\"><%= app.translation.get('devices') %></div>\n<div class=\"s-devices__message\">\n    <%= app.translation.get('choose-device') %>\n</div>\n<%= app.legend.render({items: ['return', 'enter']}) %>\n",
"template/scene/exit": "<div class=\"scene-header\"><%= app.translation.get('exit') %></div>\n<div class=\"s-exit__message\">\n    <%= app.translation.get('really-exit') %>\n</div>\n<%= app.legend.render() %>",
"template/scene/language": "<div class=\"scene-header\"><%= app.translation.get('language') %></div>\n\n<%= app.legend.render() %>\n",
"template/scene/login": "<div class=\"scene-header\"><%= app.translation.get('authorization') %></div>\n<div class=\"s-login__form\"></div>\n<%= app.legend.render() %>",
"template/scene/logout": "<div class=\"scene-header\"><%= app.translation.get('change-user') %></div>\n<div class=\"s-logout__text\">\n    <%= app.translation.get('really-logout') %>\n</div>\n\n<%= app.legend.render() %>\n",
"template/scene/main": "<div class=\"scene-header\"><%= app.translation.get('main') %></div>\n\n<%= app.legend.render() %>\n",
"template/scene/registration": "<div class=\"scene-header\"><%= app.translation.get('registration') %></div>\n<div class=\"s-registration__instruction\">\n    <%= app.translation.get('instruction') %>\n</div>\n<div>\n    <div class=\"s-registration__qr-code\" style=\"background-image: url(<%= app.translation.get('qr') %>)\"></div>\n    <div class=\"s-registration__url\">\n        <a href=\"<%= app.translation.get('link') %>?platform=<%= platform.name %>\"><%= app.translation.get('link') %></a>\n    </div>\n</div>\n<%= app.legend.render() %>\n",
"template/scene/settings": "<div class=\"scene-header\"><%= app.translation.get('settings') %></div>\n\n<%= app.legend.render() %>\n",
"template/scene/start": "<div class=\"s-start__logo\"></div>\n<div class=\"s-start__progress animate width fast\"></div>",
"template/scene/timezone": "<div class=\"scene-header\"><%= app.translation.get('timezone') %></div>\n\n<%= app.legend.render() %>\n",
"template/scene/vod-episode": "<div class=\"scene-header\"><%= title %></div>\n\n<%= app.legend.render({items: ['return', 'enter', 'red']}) %>\n",
"template/scene/vod-main": "<div class=\"scene-header\"><%= app.translation.get('vod-main') %></div>\n\n<%= app.legend.render({items: ['return', 'enter', 'red']}) %>\n",
"ajax": (function (require, exports, module) { /* wrapped by builder */
'use strict';

module.exports = function () {

    var ajax = $.ajax,
        token;

    $.ajax = function (options) {
        app.log((options.method || options.type || 'GET') + ': ' + options.url);

        options.headers = token ? {'Authorization': token.type + ' ' + token.access} : {};

        return ajax.call(this, options);
    };

    function resolve(value) {
        return $.Deferred().resolve(value);
    }

    function reject(value) {
        return $.Deferred().reject(value);
    }

    function performRequest(type, route, data, encoding) {
        return $.ajax({
            type: type,
            dataType: 'json',
            url: app.config.url + '/' + route,
            data: data || {},
            contentType: encoding || undefined
        }).then(function (response) {
            if (response.status !== 'ok') {
                return reject(response);
            } else {
                return response;
            }
        }).fail(function (error) {
            if (error.readyState === 0) {
                app.notifier.show({type: 'error', message: app.translation.get('network')});
                error.handled = true;
            }

            return error;
        });
    }

    function get(route, data) {
        return performRequest('GET', route, data);
    }

    function post(route, data, encoding) {
        return performRequest('POST', route, data, encoding);
    }

    function saveToken(response) {
        token = {
            type: response.token_type,
            access: response.access_token,
            refresh: response.refresh_token,
            expires: response.expires_in
        };

        app.storage.setItem('token', token);
        app.storage.save();
    }

    function getUid() {
        var uid = app.storage.getItem('uid');

        if (!uid) {
            uid = window.uuid();

            app.storage.setItem('uid', uid);
            app.storage.save();
        }

        return uid;
    }

    this.hasToken = function () {
        return token = app.storage.getItem('token');
    };

    this.loginByUsername = function (username, password) {
        return post('token', {
            username: username,
            password: password
        }).then(saveToken);
    };

    this.refreshToken = function () {
        return post('token', {
            refresh_token: token.refresh
        }).then(saveToken);
    };

    this.register = function () {
        return post('users/device', {
            device_id: getUid(),
            device_name: platform.device.getModel()
        }).then(function () {
            app.ajax.registered = true;
        }).fail(function (response) {
            var registered = _.find(response.devices, function (device) {
                return device.dev_id = getUid();
            });

            return registered ? app.ajax.registered = resolve() : reject(response);
        });
    };

    this.replace = function (device) {
        return post('users/device-change', {
            device_id: device.dev_id,
            device_name: device.dev_name,
            new_device_id: getUid(),
            new_device_name: platform.device.getModel()
        }).then(function () {
            app.ajax.registered = true;
        });
    };

    this.getVodMeta = function (vod) {
        return vod.getName() ? resolve() : vod.fetch();
    };
};

}),
"helper": (function (require, exports, module) { /* wrapped by builder */
'use strict';

module.exports = function () {

    this.format = function (time) {
        var hours, minutes, seconds;

        if (time instanceof Date) {
            return this.pad(time.getHours()) + ':' + this.pad(time.getMinutes());
        } else {
            hours = Math.floor(time / 3600);
            minutes = Math.floor((time - hours * 3600) / 60);
            seconds = time % 60;

            if (time <= 0) return '00:00:00';

            return [this.pad(hours), this.pad(minutes), this.pad(seconds)].join(':');
        }
    };

    this.pad = function (number) {
        return ('0' + number).slice(-2);
    };
};
}),
"legend": (function (require, exports, module) { /* wrapped by builder */
'use strict';

module.exports = function () {

    this.render = function (opts) {
        var options = opts || {},
            TEXT = {
                'return': platform.name === 'android' ? '/ <b>B</b>&ensp;' + app.translation.get('back') : app.translation.get('back'),
                'enter': platform.name === 'android' ? '/ <b>A</b>&ensp;' + app.translation.get('enter') : app.translation.get('enter'),
                'left-right': app.translation.get('epg'),
                'red': app.translation.get('settings')
            };

        var items = _.map(options.items || ['return', 'enter'], function (item) {
            return {key: item, text: TEXT[item]};
        });

        delete this.$el;

        return app.renderTemplate('legend', {items: items, theme: options.theme || 'dark', hidden: options.hidden});
    };

    this.show = function () {
        if (!this.$el) this.$el = app.scene.$('.legend');

        this.$el.css('bottom', 0);
    };

    this.hide = function () {
        if (!this.$el) this.$el = app.scene.$('.legend');

        this.$el.css('bottom', -100);
    };

    this.click = function (name) {
        var button = name.split('-')[0];

        app.scene.widget.trigger('key', {button: button[0].toUpperCase() + button.slice(1)});
    };
};

}),
"player": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Backbone = require('Backbone'),
    Broadcast = require('BroadcastModel');

module.exports = function () {
    var player = platform.player,
        channel,
        vod,
        pause = {
            start: 0,
            time: 0
        },
        rewind = {
            interval: 0,
            inProgress: false,
            speed: 1,
            position: 0,
        };

    _.extend(this, Backbone.Events);

    this.rewind = rewind;

    this.doRewind = function () {
        if (vod) {
            rewind.position = Math.min(this.getDuration(), (rewind.position ? rewind.position : player.getCurrentPosition() / 1000) + 10 * rewind.speed * -1);

            if (rewind.position <= 0) {
                this.stopRewind();

                player.setPosition(1);
            }

            if (rewind.position >= this.getDuration()) {
                this.stopRewind();
                this.trigger('vod-end');
            }
        } else {
            channel.setShift(channel.getShift() + 10 * rewind.speed);

            if (channel.getShift() <= 0) {
                this.stop();
                this.stopRewind();

                channel.setShift(0);

                this.play();
            }
        }

        this.trigger('shift');
    };

    this.stopRewind = function () {
        if (vod) player.setPosition(rewind.position - player.getCurrentPosition() / 1000);

        clearInterval(rewind.interval);

        rewind.interval = 0;
        rewind.position = 0;
        rewind.speed = 1;
        rewind.inProgress = false;
        this.trigger('play');
    };

    this.backward = function () {
        if (rewind.inProgress && rewind.speed > 4) return;

        if (rewind.inProgress) {
            if (rewind.speed === -1) {
                rewind.speed = 1;
                this.trigger('rewind', rewind.speed);
            } else if (rewind.speed > 0) {
                rewind.speed = rewind.speed * 2;
                this.trigger('rewind', rewind.speed);
            } else {
                rewind.speed = rewind.speed / 2;
                this.trigger('forward', -rewind.speed);
            }
        } else {
            rewind.speed = 1;
            rewind.inProgress = true;
            rewind.interval = setInterval(this.doRewind.bind(this), 300);

            this.trigger('rewind', rewind.speed);
        }
    };

    this.forward = function () {
        if (rewind.speed < -4 || channel && !channel.getShift()) return;

        if (rewind.inProgress) {
            if (rewind.speed === 1) {
                rewind.speed = -1;
                this.trigger('forward', -rewind.speed);
            } else if (rewind.speed < 0) {
                rewind.speed = rewind.speed * 2;
                this.trigger('forward', -rewind.speed);
            } else {
                rewind.speed = rewind.speed / 2;
                this.trigger('rewind', rewind.speed);
            }
        } else {
            rewind.speed = -1;
            rewind.inProgress = true;
            rewind.interval = setInterval(this.doRewind.bind(this), 300);

            this.trigger('forward', -rewind.speed);
        }
    };

    this.seek = function (percent) {
        if (vod) {
            var position = percent / 100 * (player.getDuration() / 1000);

            player.setPosition(position - player.getCurrentPosition() / 1000);
        } else {
            var broadcast = channel.getBroadcast({shift: true});

            channel.setShift(Math.floor(broadcast.getElapsed() - percent / 100 * broadcast.getDuration()));

            this.play({shift: true});
        }

        this.trigger('shift');
    };

    this.begin = function () {
        var broadcast = channel.getBroadcast();

        channel.setInterval(channel.getShift() ? 0 : broadcast.getStart());

        this.trigger('shift');
        this.play({shift: true});
    };

    this.play = function (options) {
        var broadcast;

        if ((broadcast = options) instanceof Broadcast) {
            channel = broadcast.getChannel();

            if (broadcast.isOnAir()) {
                channel.setInterval();
            } else {
                channel.setInterval(broadcast.getStart(), broadcast.getStop());
            }

            player.url = channel.getStream();

            this.trigger('play');
            player.stop();
            player.play({postfix: true});
        } else {
            if ((player.is('PLAYING') && !(options || {}).shift) && !rewind.inProgress) return;

            if (rewind.inProgress) this.stopRewind();

            if (player.is('PAUSED')) {
                this.resume();
            } else if ((options || {}).vod || vod) {
                if (vod) return;

                vod = options.vod;

                player.url = vod.getVideo();
                player.type = 'video/mp4';

                this.trigger('play');
                player.stop();
                player.play({postfix: true});
            } else {
                player.url = channel.getStream();

                this.trigger('play');
                player.stop();
                player.play({postfix: true});
            }
        }
    };

    this.stop = function () {
        if (player.is('STOPPED')) return;

        player.stop();

        if (rewind.inProgress) this.stopRewind();
    };

    this.pause = function () {
        if (rewind.inProgress) {
            clearInterval(rewind.interval);
        } else {
            if (player.is('PLAYING')) {
                player.pause();

                pause.start = time();

                this.trigger('pause');
            } else if (player.is('PAUSED')) {
                this.play();
            }
        }
    };

    this.resume = function () {
        pause.time = time() - pause.start;

        if (pause.time > 20) {
            channel.setShift(channel.getShift() + pause.time);
        } else {
            player.resume();
        }

        pause.time = 0;
        pause.start = 0;

        player.resume();

        this.trigger('resume');
    };

    this.getBroadcast = function () {
        return channel ? channel.getBroadcast({shift: true}) : undefined;
    };

    this.getVod = function () {
      return vod;
    };

    this.wasStopped = function () {
        return player.is('STOPPED');
    };

    this.timeshift = function () {
        return vod || channel && channel.isRecorded();
    };

    this.getPosition = function () {
        var broadcast = this.getBroadcast();

        return broadcast ? broadcast.getPercent({shift: true}) : vod.getPercent(rewind.position ? rewind.position * 1000 : player.getCurrentPosition(), player.getDuration()) || 0;
    };

    this.getDuration = function(opts) {
        var options = opts || {},
            duration = vod ? (player.getDuration() || 0) / 1000 : this.getBroadcast().getElapsed({shift: true});

        return options.formatted ? app.helper.format(duration) : duration;
    };

    this.reset = function () {
        vod = channel = undefined;

        this.stop();
    };

    player.on('network-disconnected connection-failed connection-restored', function () {
        if (!player.is('PAUSED')) {
            player.stop();
            player.play();
        }
    });
};

}),
"translation": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var DICT = {
        exit: {ru: 'Выход', en: 'Exit', am: 'Ելք'},
        'really-exit': {ru: 'Вы действительно хотите выйти?', en: 'Do you really want to exit?', am: 'Դուք իրո՞ք ցանկանում եք դուրս գալ:'},
        'really-logout': {ru: 'Вы действительно хотите выйти из аккаунта?', en: 'Do you really want to log out?', am: 'Դուք իսկապես ցանկանում եք դուրս գալ:'},
        authorization: {ru: 'Авторизация', en: 'Authorization', am: 'Հաստատում'},
        'change-user': {ru: 'Смена пользователя', en: 'Change user', am: 'Օգագործողի փոփոխություն'},
        registration: {ru: 'Регистрация', en: 'Registration', am: 'Գրանցում'},
        instruction: {ru: 'Зарегистрируйтесь с ПК или мобильного устройства,<br>перейдя по ссылке или просканировав QR - код', en: 'Register using your PC or mobile phone<br>with the following link or QR-code', am: 'Գրանցվեք համակարգչից կամ բջջային սարքից, անցնելով<br>հետևյալ հղումով կամ սկանավորելով QR- կոդը'},
        link: {ru: 'https://www.armtvs.com/ru/registration', en: 'https://www.armtvs.com/en/registration', am: 'https://www.armtvs.com/hy/registration'},
        qr: {ru: 'i/qr/ru.png', en: 'i/qr/en.png', am: 'i/qr/am.png'},
        forgot: {ru: 'Забыли пароль?', en: 'Forgot your password?', am: 'Մոռացե՞լ եք գաղտնաբառը'},
        recover: {ru: 'https://www.armtvs.com/ru/password-recover', en: 'https://www.armtvs.com/password-recover', am: 'https://www.armtvs.com/hy/password-recover'},
        settings: {ru: 'Настройки', en: 'Settings', am: 'Կարգավորումներ'},
        timezone: {ru: 'Выбор часового пояса', en: 'Timezone selection', am: 'Ընտրել ժամային գոտին'},
        begin: {ru: 'С начала', en: 'From begin', am: 'Սկիզբ'},
        live: {ru: 'Прямой эфир', en: 'Live', am: 'Ուղիղ եթեր'},
        back: {ru: 'Назад', en: 'Back', am: 'Վերադարձ'},
        enter: {ru: 'Выбрать', en: 'OK', am: 'Ընտրել'},
        epg: {ru: 'Программа передач', en: 'EPG', am: 'Հաղորդումների ծրագիր'},
        login: {ru: 'Войти', en: 'Log in', am: 'Մուտք'},
        'sign-up': {ru: 'Зарегистрироваться', en: 'Register', am: 'Գրանցվել'},
        registered: {ru: 'Я зарегистрировался', en: 'I have registered', am: 'Ես գրանցվել եմ'},
        'change-time': {ru: 'Изменить часовой пояс', en: 'Change timezone', am: 'Փոփոխել ժամային գոտին'},
        language: {ru: 'Сменить язык', en: 'Change language', am: 'Փոփոխել լեզուն'},
        logout: {ru: 'Сменить пользователя / Выйти', en: 'Change user / Log out', am: 'Փոխարինել Օգտագործողին / Դուրս գալ'},
        yes: {ru: 'Да', en: 'Yes', am: 'այո'},
        no: {ru: 'Нет', en: 'No', am: 'ոչ'},
        email: {ru: 'Почта', en: 'Email', am: 'Էլ. հասցե'},
        password: {ru: 'Пароль', en: 'Password', am: 'Գաղտնաբառ'},
        devices: {ru: 'Устройства', en: 'Devices', am: 'Սարքեր'},
        network: {ru: 'Не удается подключиться к серверу', en: 'Can not connect to the server', am: 'Հնարավոր չէ միացնել սերվերին'},
        disconnected: {ru: 'Отсутствует соединение с интернетом', en: 'No internet connection', am: 'Ինտերնետ կապ չկա'},
        connected: {ru: 'Соединение восстановлено', en: 'Connection restored', am: 'Կապը վերականգնվել է'},
        'device-error': {ru: 'Превышен лимит удаления устройств: 3 раза за сутки', en: 'Device removal limit is exceeded: 3 times in a day', am: 'Սարքի հեռացման սահմանաչափը գերազանցեց `օրական 3 անգամ'},
        'choose-device': {ru: 'Вы достигли лимита устройств для аккаунта. Выберите одно для удаления', en: 'You have reached device limit for you account. Choose one of them to delete', am: 'Դուք հասել եք ձեր հաշվի սարքի սահմանաչափին: Ընտրեք մեկը, հեռացնելու համար:'},
        'change-account': {ru: 'Попробуйте войти, используя другой аккаунт', en: 'Try to login using another account', am: 'Փորձեք մուտք գործել մեկ այլ հաշիվ'},
        'wrong-email': {ru: 'Email не может быть пустым', en: 'Email can not be empty', am: 'Emailը չի կարող դատարկ լինել'},
        'wrong-password': {ru: 'Пароль не может быть пустым', en: 'Password can not be empty', am: 'Գաղտնաբառը չի կարող դատարկ լինել'},
        'wrong-credentials': {ru: 'Email или пароль указан неверно', en: 'Email or password is incorrect', am: 'Email կամ գաղտնաբառը սխալ է'},
        main: {ru: 'Добро пожаловать', en: 'Welcome', am: 'Բարի գալուստ'},
        channels: {ru: 'ТВ каналы', en: 'TV Channels', am: 'Հեռուստաալիքներ'},
        'vod-main': {ru: 'Видеогалерея', en: 'Video library', am: 'Տեսադարան'},
        serials: {ru: 'Сериалы', en: 'Serials', am: 'Սերիալներ'},
        shows: {ru: 'TV шоу', en: 'Shows', am: 'հեռուստաշոուներ'},
        moves: {ru: 'Фильмы', en: 'Movies', am: 'Ֆիլմեր'},
        kids: {ru: 'Для детей', en: 'Kids', am: 'Երեխաներ'}
    },
    DEFAULT = 'en';

module.exports = function () {

    this.locale = null;

    this.set = function (locale) {
        this.locale = locale;

        app.storage.setItem('locale', locale);
        app.storage.save();
    };

    this.get = function (key) {
        if (!this.locale) this.locale = app.storage.getItem('locale') || DEFAULT;

        return DICT[key] ? DICT[key][this.locale] || DICT[key][DEFAULT] : key;
    };
};

}),
"config": {
	"appName": "ARMTVS",
	"url": "https://golive.shantdigitaltv.com/api",
	"version": {
		"number": "1.2.7",
		"date": "26/05/2020"
	}
}
,
"samsung-tv": (function (require, exports, module) { /* wrapped by builder */
'use strict';

module.exports = function () {

    var player = document.getElementById('pluginPlayer'),
        app = window.app,
        platform = window.platform,
        bufferingStart = 0,
        bufferingTime = 0,
        startPlayTime = 0,
        video = {width: 0, height: 0},
        modes = ['FIT_SCREEN', 'FIT_WIDTH', 'FIT_HEIGHT'],
        mode = 0,
        stopTimer = 0;

    platform.player = {

        STOPPED: 0,
        PLAYING: 1,
        PAUSED: 2,
        BUFFERING: 3,
        duration: 0,
        state: 0,
        url: '',

        play: function (options) {
            if (this.state === this.PLAYING) return;

            if ((options || {}).postfix) this.url += '|COMPONENT=HLS';

            app.log('PLAYING ' + this.url);
            player.Play(this.url);

            bufferingStart = Date.now();
            startPlayTime = Date.now();
        },

        stop: function () {
            if (this.state === this.STOPPED) return;
            this.state = this.STOPPED;

            player.Stop();
            clearTimeout(stopTimer);
            startPlayTime = 0;
        },

        pause: function () {
            if (this.state === this.PAUSED) return;
            this.state = this.PAUSED;

            player.Pause();
            startPlayTime += this.getCurrentPosition();
        },

        resume: function () {
            if (this.state === this.PLAYING) return;
            this.state = this.PLAYING;

            player.Resume();
        },

        getState: function () {
            return this.state;
        },

        getDelay: function () {
            return Math.floor((Date.now() - startPlayTime - this.getCurrentPosition()) / 1000);
        },

        is: function (state) {
            if (typeof this[state] === 'undefined') return false;

            return this.state === this[state];
        },

        changeSize: function () {
            setPictureSize(modes[(++mode) % modes.length]);
        },

        getDuration: function () {
            return player.GetDuration();
        },

        getCurrentPosition: function () {
            return player.curTime * 1000;
        },

        setPosition: function (time) {
            // player.curTime = time;
            if (time > 0) {
                player.JumpForward(time);
            } else {
                player.JumpBackward(-time);
            }
        }
    };

    function setPictureSize(mode) {
        var display = {
                left: 0,
                top: 0,
                width: 960,
                height: 540
            },
            crop = {
                left: 0,
                top: 0,
                width: video.width,
                height: video.height
            },
            ratio = display.width / video.width;

        switch (mode) {
            case 'FIT_SCREEN':
                break;
            case 'FIT_WIDTH':
                crop.height = display.height / ratio;
                crop.top = (display.height - crop.height) / 1.6;
                break;
            case 'FIT_HEIGHT':
                display.left = (display.width - crop.width) / 2;
                display.width = crop.width;
                break;
        }

        player.SetCropArea(crop.left, crop.top, crop.width, crop.height);
        player.SetDisplayArea(display.left, display.top, display.width, display.height);
    }

    player.OnCurrentPlayTime = function (time) {
        var newValue = Math.floor(time / 1000);

        if (player.curTime === newValue) return;

        player.curTime = newValue;
        platform.player.trigger('current-play-time', player.curTime);
    };

    player.OnBufferingStart = function () {
        app.log('player.buffering-start');
        platform.player.trigger('buffering-start');
        platform.player.trigger('stream-frozen');

        platform.player.state = platform.player.BUFFERING;
    };

    player.OnBufferingProgress = function (percent) {
    };

    player.OnBufferingComplete = function () {
        app.log('player.buffering-complete');

        video.width = player.GetVideoWidth();
        video.height = player.GetVideoHeight();

        bufferingTime = Date.now() - bufferingStart;
        platform.player.trigger('buffering-complete', bufferingTime);
        platform.player.trigger('stream-unfrozen');

        platform.player.state = platform.player.PLAYING;
    };

    player.OnRenderingComplete = function () {
        app.log('player.playing-complete');
        platform.player.trigger('playing-complete');
    };

    player.OnStreamNotFound = function () {
        app.log('player.stream-not-found');
        platform.player.trigger('stream-not-found');
    };

    player.OnNetworkDisconnected = function () {
        app.log('player.network-disconnected');
        platform.player.trigger('network-disconnected');
    };

    player.OnConnectionFailed = function () {
        app.log('player.connection-failed');
        platform.player.trigger('connection-failed');
    };

    player.OnAuthenticationFailed = function () {
        app.log('player.authentication-failed');
    };

    _.extend(platform.player, Backbone.Events);
};


}),
"samsung": (function (require, exports, module) { /* wrapped by builder */
'use strict';

var Keyboard = require('KeyboardWidget');

module.exports = function () {

    require('samsung-tv')();

    var widgetAPI = new Common.API.Widget(),
        KEYS = new Common.API.TVKeyValue(),
        pluginAPI = new Common.API.Plugin(),
        pluginNNavi = document.getElementById('pluginObjectNNavi'),
        pluginNetwork = document.getElementById('pluginNetwork'),
        pluginExternal = document.getElementById('pluginExternal'),
        app = window.app,
        platform = window.platform;

    platform.device = {
        getID: function () {
            var deviceID = null;

            try {
                var firmware = pluginNNavi.GetFirmware();
                if (firmware > 'T-INFOLINK2011') {
                    deviceID = getESN();
                } else {
                    deviceID = getDUID();
                }
            } catch (e) {
                deviceID = null;
            }

            return deviceID;
        },

        getMAC: function () {
            return pluginNetwork.GetMAC();
        },

        getModel: function () {
            var model = 'Samsung Smart TV';

            try {
                model += ' 20' + pluginNNavi.GetModelCode().match(/^\d{2}/);
            } catch (e) {}

            return model;
        },

        getFirmware: function () {
            return pluginNNavi.GetFirmware();
        },

        getCountry: function () {
            return '';
        },

        getServiceCountry: function () {
            return '';
        },

        getSDK: function () {},

        isConnected: function () {
            var connectionType = pluginNetwork.GetActiveType(),
                physicalConnection = pluginNetwork.CheckPhysicalConnection(connectionType),
                gatewayStatus = pluginNetwork.CheckGateway(connectionType);

            if (connectionType !== 0 && connectionType !== 1) return false;

            if (physicalConnection !== 1) return false;

            return gatewayStatus === 1;
        }
    };

    function getESN() {
        try {
            var deviceId = pluginExternal.GetESN("WIDEVINE");
            if ( deviceId ===0 ) return deviceId;
            if ( !deviceId ) {
                throw new Exception('GetESN is not supported. Please reboot the device and call to Samsung service center if the issue happens again.');
            }
            if ((deviceId+'').substr(0, Math.min(deviceId.length, 2)) != 'SS') {
                throw new Exception('deviceId is not valid. Please reboot the device and call to Samsung service center if the issue happens again.');
            }
        }
        catch (e) {
            return null;
        }

        return deviceId;
    }

    function getDUID() {
        try {
            var MAC = pluginNetwork.GetMAC();
            return pluginNNavi.GetDUID(MAC);
        } catch (e) {
            return null;
        }
    }

    function MyStorage() {
        this._filename = window.curWidget.id + '-' + app.config.appName +'.json';
        this._fs = new FileSystem();

        if (!this._fs.isValidCommonPath(curWidget.id)) {
            this._fs.createCommonDir(curWidget.id);
        }

        this._data = {};
        this.load();
    }

    app.log = function () {
        for (var i = 0; i < arguments.length; i++) {
            if (typeof arguments[i] === 'object' && arguments[i] !== null) {
                console.log(JSON.stringify(arguments[i]));
                this.console.log(JSON.stringify(arguments[i]));
            } else {
                console.log(arguments[i]);
                this.console.log(arguments[i]);
            }
        }
    };

    platform.start = function (next) {
        pluginAPI.setOffScreenSaver();

        app.on('block-exit', function () {
            widgetAPI.blockNavigation(event);
        });
        app.on('exit', function () {
            widgetAPI.sendReturnEvent();
        });

        widgetAPI.sendReadyEvent();

        setTimeout(function () {
            pluginNNavi.SetBannerState(1);
            pluginAPI.unregistKey(KEYS.KEY_VOL_UP);
            pluginAPI.unregistKey(KEYS.KEY_VOL_DOWN);
            pluginAPI.unregistKey(KEYS.KEY_MUTE);
            pluginAPI.unregistKey(KEYS.KEY_TOOLS);
        }, 700);

        setInterval(function () {
            pluginAPI.setOffScreenSaver();
        }, 5 * 60 * 1000);

        next();
    };

    platform.stop = function () {
        platform.player.stop();
        pluginAPI.setOnScreenSaver();
    };

    platform.keyHandler = function (event) {
        if (!app.scene) return;

        var code = event.keyCode, key = {},
            view = app.scene.widget || app.scene;

        switch (code) {
            case KEYS.KEY_LEFT:
                key.button = 'Left';
                break;
            case KEYS.KEY_RIGHT:
                key.button = 'Right';
                break;
            case KEYS.KEY_UP:
                key.button = 'Up';
                break;
            case KEYS.KEY_DOWN:
                key.button = 'Down';
                break;
            case KEYS.KEY_ENTER:
                key.button = 'Enter';
                break;
            case KEYS.KEY_RETURN:
                key.button = 'Return';
                app.trigger('block-exit');
                break;
            case KEYS.KEY_CH_UP:
                key.button = 'ChannelUp';
                break;
            case KEYS.KEY_CH_DOWN:
                key.button = 'ChannelDown';
                break;
            case KEYS.KEY_INFO :
                key.button = 'Info';
                break;
            case KEYS.KEY_RW:
                key.button = 'Rewind';
                break;
            case KEYS.KEY_FF:
                key.button = 'Forward';
                break;
            case KEYS.KEY_PAUSE:
                key.button = 'Pause';
                break;
            case KEYS.KEY_PLAY:
                key.button = 'Play';
                break;
            case KEYS.KEY_STOP:
                key.button = 'Stop';
                break;
            case KEYS.KEY_MENU :
                key.button = 'Menu';
                break;
            case KEYS.KEY_RED:
                key.button = 'Red';
                break;
            case KEYS.KEY_GREEN:
                key.button = 'Green';
                break;
            case KEYS.KEY_YELLOW:
                key.button = 'Yellow';
                break;
            case KEYS.KEY_BLUE:
                key.button = 'Blue';
                break;
            case KEYS.KEY_ASPECT:
                key.button = 'PictureSize';
                break;
            case KEYS.KEY_1:
                key = {button: 'Number', number: 1};
                break;
            case KEYS.KEY_2:
                key = {button: 'Number', number: 2};
                break;
            case KEYS.KEY_3:
                key = {button: 'Number', number: 3};
                break;
            case KEYS.KEY_4:
                key = {button: 'Number', number: 4};
                break;
            case KEYS.KEY_5:
                key = {button: 'Number', number: 5};
                break;
            case KEYS.KEY_6:
                key = {button: 'Number', number: 6};
                break;
            case KEYS.KEY_7:
                key = {button: 'Number', number: 7};
                break;
            case KEYS.KEY_8:
                key = {button: 'Number', number: 8};
                break;
            case KEYS.KEY_9:
                key = {button: 'Number', number: 9};
                break;
            case KEYS.KEY_0:
                key = {button: 'Number', number: 0};
                break;
            default :
                break;
        }

        if (!app.interceptKeyEvent(key, view)) return;

        if (!key.button || !app.interceptKeyEvent(key, view)) return;

        view.trigger('key', key);
    };

    if (window['localStorage']) {
        app.storage = {
            id: app.config.appName,
            data: null,

            initialize: function () {
                this.storage = window['localStorage'];
                this.data = JSON.parse(this.storage.getItem(this.id));

                if (!this.data) this.data = {};
            },

            save: function () {
                this.storage.setItem(this.id, JSON.stringify(this.data));
            },

            getItem: function (key) {
                return this.data[key];
            },

            setItem: function (key, value) {
                this.data[key] = value;
            },

            clear: function () {
                this.storage.clear();
                this.data = {};
                this.save();
            }
        };
    } else {
        MyStorage.prototype._fs = null;
        MyStorage.prototype._filename = null;
        MyStorage.prototype._fp = null;
        MyStorage.prototype._data = null;
        MyStorage.prototype.getData = function () {
            return this._data;
        };
        MyStorage.prototype.getFilePointer = function () {
            if (!this._fp) {
                this._fp = this._fs.openCommonFile(this._filename, 'r+');
                if (!this._fp) {
                    this._fp = this._fs.openCommonFile(this._filename, 'w');
                }
            }
            return this._fp;
        };
        MyStorage.prototype.closeFile = function () {
            this._fs.closeCommonFile(this.getFilePointer());
            this._fp = null;
        };
        MyStorage.prototype.clear = function () {
            this._fp = this._fs.openCommonFile(this._filename, 'w');
            this._data = {};
            this.closeFile();
        };
        MyStorage.prototype.load = function () {
            var result = this.getFilePointer().readAll();
            this.closeFile();

            this._data = {};
            if (result.length > 0) {
                try {
                    this._data = JSON.parse(result);
                } catch (e) {
                    result = result.slice(0, result.length - 1);
                    try {
                        this._data = JSON.parse(result);
                    } catch (e) {
                        this._data = {};
                        this._fp = this._fs.openCommonFile(this._filename, 'w');
                        this.closeFile();
                    }
                }
            }
        };
        MyStorage.prototype.save = function () {
            this.getFilePointer().writeAll(JSON.stringify(this._data));
            this.closeFile();
        };
        MyStorage.prototype.reset = function () {
            return this.load();
        };

        app.storage = {
            data: null,

            initialize: function () {
                this.storage = new MyStorage();
                this.data = this.storage._data;
            },

            save: function () {
                this.storage.save();
            },

            getItem: function (key) {
                return this.data[key];
            },

            setItem: function (key, value) {
                this.data[key] = value;
            },

            clear: function () {
                this.data = {};
                this.storage.clear();
            }
        };
    }

    platform.keyboard = new Keyboard();
};

})
},{},{});
