var addComment={moveForm:function(a,b,c,d){var e,f=this,g=f.I(a),h=f.I(c),i=f.I("cancel-comment-reply-link"),j=f.I("comment_parent"),k=f.I("comment_post_ID");if(g&&h&&i&&j){f.respondId=c,d=d||!1,f.I("wp-temp-form-div")||(e=document.createElement("div"),e.id="wp-temp-form-div",e.style.display="none",h.parentNode.insertBefore(e,h)),g.parentNode.insertBefore(h,g.nextSibling),k&&d&&(k.value=d),j.value=b,i.style.display="",i.onclick=function(){var a=addComment,b=a.I("wp-temp-form-div"),c=a.I(a.respondId);if(b&&c)return a.I("comment_parent").value="0",b.parentNode.insertBefore(c,b),b.parentNode.removeChild(b),this.style.display="none",this.onclick=null,!1};try{f.I("comment").focus()}catch(l){}return!1}},I:function(a){return document.getElementById(a)}};
;/*
RequireJS 2.1.11 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
Available via the MIT or new BSD license.
see: http://github.com/jrburke/requirejs for details
*/
var requirejs,require,define;
(function(ca){function G(b){return"[object Function]"===M.call(b)}function H(b){return"[object Array]"===M.call(b)}function v(b,c){if(b){var d;for(d=0;dthis.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&&
(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a=
this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f);
if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval",
"fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(N,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b,
a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(N,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m,
nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="index.html");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b,
a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild=
!0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(N,f))return N[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}L();i.nextTick(function(){L();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("index.html")[0];if(-1!==
d&&(!("."===g||".."===g)||1g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)):
(g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,L=g,D?y.insertBefore(g,D):y.appendChild(g),L=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(K=b.getAttribute("data-main"))return q=K,r.baseUrl||(E=q.split("index.html"),q=E.pop(),Q=E.length?E.join("index.html")+"/":"./",r.baseUrl=
Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=K),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=L))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b||
(b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this);
;(function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=Function.prototype,g=d.push,h=d.slice,i=d.concat,j=e.toString,k=e.hasOwnProperty,l=d.forEach,m=d.map,n=d.reduce,o=d.reduceRight,p=d.filter,q=d.every,r=d.some,s=d.indexOf,t=d.lastIndexOf,u=Array.isArray,v=Object.keys,w=f.bind,x=function(a){return a instanceof x?a:this instanceof x?void(this._wrapped=a):new x(a)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):a._=x,x.VERSION="1.6.0";var y=x.each=x.forEach=function(a,b,d){if(null==a)return a;if(l&&a.forEach===l)a.forEach(b,d);else if(a.length===+a.length){for(var e=0,f=a.length;f>e;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g=x.keys(a),e=0,f=g.length;f>e;e++)if(b.call(d,a[g[e]],g[e],a)===c)return;return a};x.map=x.collect=function(a,b,c){var d=[];return null==a?d:m&&a.map===m?a.map(b,c):(y(a,function(a,e,f){d.push(b.call(c,a,e,f))}),d)};var z="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),n&&a.reduce===n)return d&&(b=x.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(y(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(z);return c},x.reduceRight=x.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),o&&a.reduceRight===o)return d&&(b=x.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=x.keys(a);f=g.length}if(y(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(z);return c},x.find=x.detect=function(a,b,c){var d;return A(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},x.filter=x.select=function(a,b,c){var d=[];return null==a?d:p&&a.filter===p?a.filter(b,c):(y(a,function(a,e,f){b.call(c,a,e,f)&&d.push(a)}),d)},x.reject=function(a,b,c){return x.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},x.every=x.all=function(a,b,d){b||(b=x.identity);var e=!0;return null==a?e:q&&a.every===q?a.every(b,d):(y(a,function(a,f,g){return(e=e&&b.call(d,a,f,g))?void 0:c}),!!e)};var A=x.some=x.any=function(a,b,d){b||(b=x.identity);var e=!1;return null==a?e:r&&a.some===r?a.some(b,d):(y(a,function(a,f,g){return e||(e=b.call(d,a,f,g))?c:void 0}),!!e)};x.contains=x.include=function(a,b){return null==a?!1:s&&a.indexOf===s?-1!=a.indexOf(b):A(a,function(a){return a===b})},x.invoke=function(a,b){var c=h.call(arguments,2),d=x.isFunction(b);return x.map(a,function(a){return(d?b:a[b]).apply(a,c)})},x.pluck=function(a,b){return x.map(a,x.property(b))},x.where=function(a,b){return x.filter(a,x.matches(b))},x.findWhere=function(a,b){return x.find(a,x.matches(b))},x.max=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.max.apply(Math,a);var d=-1/0,e=-1/0;return y(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;h>e&&(d=a,e=h)}),d},x.min=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&a.length<65535)return Math.min.apply(Math,a);var d=1/0,e=1/0;return y(a,function(a,f,g){var h=b?b.call(c,a,f,g):a;e>h&&(d=a,e=h)}),d},x.shuffle=function(a){var b,c=0,d=[];return y(a,function(a){b=x.random(c++),d[c-1]=d[b],d[b]=a}),d},x.sample=function(a,b,c){return null==b||c?(a.length!==+a.length&&(a=x.values(a)),a[x.random(a.length-1)]):x.shuffle(a).slice(0,Math.max(0,b))};var B=function(a){return null==a?x.identity:x.isFunction(a)?a:x.property(a)};x.sortBy=function(a,b,c){return b=B(b),x.pluck(x.map(a,function(a,d,e){return{value:a,index:d,criteria:b.call(c,a,d,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||void 0===c)return 1;if(d>c||void 0===d)return-1}return a.index-b.index}),"value")};var C=function(a){return function(b,c,d){var e={};return c=B(c),y(b,function(f,g){var h=c.call(d,f,g,b);a(e,h,f)}),e}};x.groupBy=C(function(a,b,c){x.has(a,b)?a[b].push(c):a[b]=[c]}),x.indexBy=C(function(a,b,c){a[b]=c}),x.countBy=C(function(a,b){x.has(a,b)?a[b]++:a[b]=1}),x.sortedIndex=function(a,b,c,d){c=B(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;c.call(d,a[h])b?[]:h.call(a,0,b)},x.initial=function(a,b,c){return h.call(a,0,a.length-(null==b||c?1:b))},x.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:h.call(a,Math.max(a.length-b,0))},x.rest=x.tail=x.drop=function(a,b,c){return h.call(a,null==b||c?1:b)},x.compact=function(a){return x.filter(a,x.identity)};var D=function(a,b,c){return b&&x.every(a,x.isArray)?i.apply(c,a):(y(a,function(a){x.isArray(a)||x.isArguments(a)?b?g.apply(c,a):D(a,b,c):c.push(a)}),c)};x.flatten=function(a,b){return D(a,b,[])},x.without=function(a){return x.difference(a,h.call(arguments,1))},x.partition=function(a,b){var c=[],d=[];return y(a,function(a){(b(a)?c:d).push(a)}),[c,d]},x.uniq=x.unique=function(a,b,c,d){x.isFunction(b)&&(d=c,c=b,b=!1);var e=c?x.map(a,c,d):a,f=[],g=[];return y(e,function(c,d){(b?d&&g[g.length-1]===c:x.contains(g,c))||(g.push(c),f.push(a[d]))}),f},x.union=function(){return x.uniq(x.flatten(arguments,!0))},x.intersection=function(a){var b=h.call(arguments,1);return x.filter(x.uniq(a),function(a){return x.every(b,function(b){return x.contains(b,a)})})},x.difference=function(a){var b=i.apply(d,h.call(arguments,1));return x.filter(a,function(a){return!x.contains(b,a)})},x.zip=function(){for(var a=x.max(x.pluck(arguments,"length").concat(0)),b=new Array(a),c=0;a>c;c++)b[c]=x.pluck(arguments,""+c);return b},x.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1];return c},x.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=x.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(s&&a.indexOf===s)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},x.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(t&&a.lastIndexOf===t)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},x.range=function(a,b,c){arguments.length<=1&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=new Array(d);d>e;)f[e++]=a,a+=c;return f};var E=function(){};x.bind=function(a,b){var c,d;if(w&&a.bind===w)return w.apply(a,h.call(arguments,1));if(!x.isFunction(a))throw new TypeError;return c=h.call(arguments,2),d=function(){if(!(this instanceof d))return a.apply(b,c.concat(h.call(arguments)));E.prototype=a.prototype;var e=new E;E.prototype=null;var f=a.apply(e,c.concat(h.call(arguments)));return Object(f)===f?f:e}},x.partial=function(a){var b=h.call(arguments,1);return function(){for(var c=0,d=b.slice(),e=0,f=d.length;f>e;e++)d[e]===x&&(d[e]=arguments[c++]);for(;c=k?(clearTimeout(g),g=null,h=j,f=a.apply(d,e),d=e=null):g||c.trailing===!1||(g=setTimeout(i,k)),f}},x.debounce=function(a,b,c){var d,e,f,g,h,i=function(){var j=x.now()-g;b>j?d=setTimeout(i,b-j):(d=null,c||(h=a.apply(f,e),f=e=null))};return function(){f=this,e=arguments,g=x.now();var j=c&&!d;return d||(d=setTimeout(i,b)),j&&(h=a.apply(f,e),f=e=null),h}},x.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},x.wrap=function(a,b){return x.partial(b,a)},x.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},x.after=function(a,b){return function(){return--a<1?b.apply(this,arguments):void 0}},x.keys=function(a){if(!x.isObject(a))return[];if(v)return v(a);var b=[];for(var c in a)x.has(a,c)&&b.push(c);return b},x.values=function(a){for(var b=x.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=a[b[e]];return d},x.pairs=function(a){for(var b=x.keys(a),c=b.length,d=new Array(c),e=0;c>e;e++)d[e]=[b[e],a[b[e]]];return d},x.invert=function(a){for(var b={},c=x.keys(a),d=0,e=c.length;e>d;d++)b[a[c[d]]]=c[d];return b},x.functions=x.methods=function(a){var b=[];for(var c in a)x.isFunction(a[c])&&b.push(c);return b.sort()},x.extend=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},x.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return y(c,function(c){c in a&&(b[c]=a[c])}),b},x.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)x.contains(c,e)||(b[e]=a[e]);return b},x.defaults=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)void 0===a[c]&&(a[c]=b[c])}),a},x.clone=function(a){return x.isObject(a)?x.isArray(a)?a.slice():x.extend({},a):a},x.tap=function(a,b){return b(a),a};var F=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof x&&(a=a._wrapped),b instanceof x&&(b=b._wrapped);var e=j.call(a);if(e!=j.call(b))return!1;switch(e){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;var g=a.constructor,h=b.constructor;if(g!==h&&!(x.isFunction(g)&&g instanceof g&&x.isFunction(h)&&h instanceof h)&&"constructor"in a&&"constructor"in b)return!1;c.push(a),d.push(b);var i=0,k=!0;if("[object Array]"==e){if(i=a.length,k=i==b.length)for(;i--&&(k=F(a[i],b[i],c,d)););}else{for(var l in a)if(x.has(a,l)&&(i++,!(k=x.has(b,l)&&F(a[l],b[l],c,d))))break;if(k){for(l in b)if(x.has(b,l)&&!i--)break;k=!i}}return c.pop(),d.pop(),k};x.isEqual=function(a,b){return F(a,b,[],[])},x.isEmpty=function(a){if(null==a)return!0;if(x.isArray(a)||x.isString(a))return 0===a.length;for(var b in a)if(x.has(a,b))return!1;return!0},x.isElement=function(a){return!(!a||1!==a.nodeType)},x.isArray=u||function(a){return"[object Array]"==j.call(a)},x.isObject=function(a){return a===Object(a)},y(["Arguments","Function","String","Number","Date","RegExp"],function(a){x["is"+a]=function(b){return j.call(b)=="[object "+a+"]"}}),x.isArguments(arguments)||(x.isArguments=function(a){return!(!a||!x.has(a,"callee"))}),"function"!=typeof/./&&(x.isFunction=function(a){return"function"==typeof a}),x.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},x.isNaN=function(a){return x.isNumber(a)&&a!=+a},x.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==j.call(a)},x.isNull=function(a){return null===a},x.isUndefined=function(a){return void 0===a},x.has=function(a,b){return k.call(a,b)},x.noConflict=function(){return a._=b,this},x.identity=function(a){return a},x.constant=function(a){return function(){return a}},x.property=function(a){return function(b){return b[a]}},x.matches=function(a){return function(b){if(b===a)return!0;for(var c in a)if(a[c]!==b[c])return!1;return!0}},x.times=function(a,b,c){for(var d=Array(Math.max(0,a)),e=0;a>e;e++)d[e]=b.call(c,e);return d},x.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))},x.now=Date.now||function(){return(new Date).getTime()};var G={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};G.unescape=x.invert(G.escape);var H={escape:new RegExp("["+x.keys(G.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(G.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(a){x[a]=function(b){return null==b?"":(""+b).replace(H[a],function(b){return G[a][b]})}}),x.result=function(a,b){if(null==a)return void 0;var c=a[b];return x.isFunction(c)?c.call(a):c},x.mixin=function(a){y(x.functions(a),function(b){var c=x[b]=a[b];x.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),M.call(this,c.apply(x,a))}})};var I=0;x.uniqueId=function(a){var b=++I+"";return a?a+b:b},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var J=/(.)^/,K={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(a,b,c){var d;c=x.defaults({},c,x.templateSettings);var e=new RegExp([(c.escape||J).source,(c.interpolate||J).source,(c.evaluate||J).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(L,function(a){return"\\"+K[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=new Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,x);var i=function(a){return d.call(this,a,x)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},x.chain=function(a){return x(a).chain()};var M=function(a){return this._chain?x(a).chain():a};x.mixin(x),y(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];x.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],M.call(this,c)}}),y(["concat","join","slice"],function(a){var b=d[a];x.prototype[a]=function(){return M.call(this,b.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return x})}).call(this);
;// (c) 2010-2011 Jeremy Ashkenas, DocumentCloud Inc.
// (c) 2011-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Backbone may be freely distributed under the MIT license.
// Copyright (c)2014 Derick Bailey, Muted Solutions, LLC.
// Distributed under MIT license
/*!
* Includes BabySitter
* https://github.com/marionettejs/backbone.babysitter/
*
* Includes Wreqr
* https://github.com/marionettejs/backbone.wreqr/
*/
/** @license
*
* SoundManager 2: JavaScript Sound for the Web
* ----------------------------------------------
* http://schillmania.com/projects/soundmanager2/
*
* Copyright (c) 2007, Scott Schiller. All rights reserved.
* Code provided under the BSD License:
* http://schillmania.com/projects/soundmanager2/license.txt
*
* V2.97a.20131201
*/
/**
* @license RequireJS text 2.0.10 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/requirejs/text for details
*/
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
* Licensed under the MIT License (LICENSE.txt).
*
* Version: 3.1.9
*
* Requires: jQuery 1.2.2+
*/
/*!
* jScrollPane - v2.0.19 - 2013-11-16
* http://jscrollpane.kelvinluck.com/
*
* Copyright (c) 2013 Kelvin Luck
* Dual licensed under the MIT or GPL licenses.
*/
function replaceURLWithHTMLLinks(e){var t=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi;return e.replace(t,"$1")}function pad(e,t){for(var n=e+"";n.lengthl;l++)if(e=o[l],s=this._events[e]){if(this._events[e]=r=[],t||i)for(c=0,d=s.length;d>c;c++)a=s[c],(t&&t!==a.callback&&t!==a.callback._callback||i&&i!==a.context)&&r.push(a);r.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=s.call(arguments,1);if(!u(this,"trigger",e,t))return this;var n=this._events[e],i=this._events.all;return n&&p(n,t),i&&p(i,arguments),this},stopListening:function(e,t,i){var r=this._listeningTo;if(!r)return this;var a=!t&&!i;i||"object"!=typeof t||(i=this),e&&((r={})[e._listenId]=e);for(var s in r)e=r[s],e.off(t,i,this),(a||n.isEmpty(e._events))&&delete this._listeningTo[s];return this}},l=/\s+/,u=function(e,t,n,i){if(!n)return!0;if("object"==typeof n){for(var r in n)e[t].apply(e,[r,n[r]].concat(i));return!1}if(l.test(n)){for(var a=n.split(l),s=0,o=a.length;o>s;s++)e[t].apply(e,[a[s]].concat(i));return!1}return!0},p=function(e,t){var n,i=-1,r=e.length,a=t[0],s=t[1],o=t[2];switch(t.length){case 0:for(;++id;d++)this.trigger("change:"+o[d],this,c[o[d]],i)}if(u)return this;if(!l)for(;this._pending;)this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,n.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var i in this.attributes)t[i]=void 0;return this.set(t,n.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!n.isEmpty(this.changed):n.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?n.clone(this.changed):!1;var t,i=!1,r=this._changing?this._previousAttributes:this.attributes;for(var a in e)n.isEqual(r[a],t=e[a])||((i||(i={}))[a]=t);return i},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return n.clone(this._previousAttributes)},fetch:function(e){e=e?n.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=this,i=e.success;return e.success=function(n){return t.set(t.parse(n,e),e)?(i&&i(t,n,e),void t.trigger("sync",t,n,e)):!1},H(this,e),this.sync("read",this,e)},save:function(e,t,i){var r,a,s,o=this.attributes;if(null==e||"object"==typeof e?(r=e,i=t):(r={})[e]=t,i=n.extend({validate:!0},i),r&&!i.wait){if(!this.set(r,i))return!1}else if(!this._validate(r,i))return!1;r&&i.wait&&(this.attributes=n.extend({},o,r)),void 0===i.parse&&(i.parse=!0);var l=this,u=i.success;return i.success=function(e){l.attributes=o;var t=l.parse(e,i);return i.wait&&(t=n.extend(r||{},t)),n.isObject(t)&&!l.set(t,i)?!1:(u&&u(l,e,i),void l.trigger("sync",l,e,i))},H(this,i),a=this.isNew()?"create":i.patch?"patch":"update","patch"===a&&(i.attrs=r),s=this.sync(a,this,i),r&&i.wait&&(this.attributes=o),s},destroy:function(e){e=e?n.clone(e):{};var t=this,i=e.success,r=function(){t.trigger("destroy",t,t.collection,e)};if(e.success=function(n){(e.wait||t.isNew())&&r(),i&&i(t,n,e),t.isNew()||t.trigger("sync",t,n,e)},this.isNew())return e.success(),!1;H(this,e);var a=this.sync("delete",this,e);return e.wait||r(),a},url:function(){var e=n.result(this,"urlRoot")||n.result(this.collection,"url")||L();return this.isNew()?e:e+("/"===e.charAt(e.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(e){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},isValid:function(e){return this._validate({},n.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=n.extend({},this.attributes,e);var i=this.validationError=this.validate(e,t)||null;return i?(this.trigger("invalid",this,i,n.extend(t,{validationError:i})),!1):!0}});var h=["keys","values","pairs","invert","pick","omit"];n.each(h,function(e){d.prototype[e]=function(){var t=s.call(arguments);return t.unshift(this.attributes),n[e].apply(n,t)}});var f=t.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,n.extend({silent:!0},t))},m={add:!0,remove:!0,merge:!0},g={add:!0,remove:!1};n.extend(f.prototype,o,{model:d,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return t.sync.apply(this,arguments)},add:function(e,t){return this.set(e,n.extend({merge:!1},t,g))},remove:function(e,t){var i=!n.isArray(e);e=i?[e]:n.clone(e),t||(t={});var r,a,s,o;for(r=0,a=e.length;a>r;r++)o=e[r]=this.get(e[r]),o&&(delete this._byId[o.id],delete this._byId[o.cid],s=this.indexOf(o),this.models.splice(s,1),this.length--,t.silent||(t.index=s,o.trigger("remove",o,this,t)),this._removeReference(o));return i?e[0]:e},set:function(e,t){t=n.defaults({},t,m),t.parse&&(e=this.parse(e,t));var i=!n.isArray(e);e=i?e?[e]:[]:n.clone(e);var r,a,s,o,l,u,p,c=t.at,h=this.model,f=this.comparator&&null==c&&t.sort!==!1,g=n.isString(this.comparator)?this.comparator:null,v=[],y=[],_={},w=t.add,b=t.merge,k=t.remove,C=!f&&w&&k?[]:!1;for(r=0,a=e.length;a>r;r++){if(l=e[r],s=l instanceof d?o=l:l[h.prototype.idAttribute],u=this.get(s))k&&(_[u.cid]=!0),b&&(l=l===o?o.attributes:l,t.parse&&(l=u.parse(l,t)),u.set(l,t),f&&!p&&u.hasChanged(g)&&(p=!0)),e[r]=u;else if(w){if(o=e[r]=this._prepareModel(l,t),!o)continue;v.push(o),o.on("all",this._onModelEvent,this),this._byId[o.cid]=o,null!=o.id&&(this._byId[o.id]=o)}C&&C.push(u||o)}if(k){for(r=0,a=this.length;a>r;++r)_[(o=this.models[r]).cid]||y.push(o);y.length&&this.remove(y,t)}if(v.length||C&&C.length)if(f&&(p=!0),this.length+=v.length,null!=c)for(r=0,a=v.length;a>r;r++)this.models.splice(c+r,0,v[r]);else{C&&(this.models.length=0);var M=C||v;for(r=0,a=M.length;a>r;r++)this.models.push(M[r])}if(p&&this.sort({silent:!0}),!t.silent){for(r=0,a=v.length;a>r;r++)(o=v[r]).trigger("add",o,this,t);(p||C&&C.length)&&this.trigger("sort",this,t)}return i?e[0]:e},reset:function(e,t){t||(t={});for(var i=0,r=this.models.length;r>i;i++)this._removeReference(this.models[i]);return t.previousModels=this.models,this._reset(),e=this.add(e,n.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,n.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return this.add(e,n.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(){return s.apply(this.models,arguments)},get:function(e){return null==e?void 0:this._byId[e.id]||this._byId[e.cid]||this._byId[e]},at:function(e){return this.models[e]},where:function(e,t){return n.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),n.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(n.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return n.invoke(this.models,"get",e)},fetch:function(e){e=e?n.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=e.success,i=this;return e.success=function(n){var r=e.reset?"reset":"set";i[r](n,e),t&&t(i,n,e),i.trigger("sync",i,n,e)},H(this,e),this.sync("read",this,e)},create:function(e,t){if(t=t?n.clone(t):{},!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var i=this,r=t.success;return t.success=function(e,t,n){n.wait&&i.add(e,n),r&&r(e,t,n)},e.save(null,t),e},parse:function(e){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof d)return e.collection||(e.collection=this),e;t=t?n.clone(t):{},t.collection=this;var i=new this.model(e,t);return i.validationError?(this.trigger("invalid",this,i.validationError,t),!1):i},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,i){("add"!==e&&"remove"!==e||n===this)&&("destroy"===e&&this.remove(t,i),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],null!=t.id&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments))}});var v=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain"];n.each(v,function(e){f.prototype[e]=function(){var t=s.call(arguments);return t.unshift(this.models),n[e].apply(n,t)}});var y=["groupBy","countBy","sortBy"];n.each(y,function(e){f.prototype[e]=function(t,i){var r=n.isFunction(t)?t:function(e){return e.get(t)};return n[e](this.models,r,i)}});var _=t.View=function(e){this.cid=n.uniqueId("view"),e||(e={}),n.extend(this,n.pick(e,b)),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},w=/^(\S+)\s*(.*)$/,b=["model","collection","el","id","attributes","className","tagName","events"];n.extend(_.prototype,o,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,n){return this.$el&&this.undelegateEvents(),this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0],n!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=n.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var i=e[t];if(n.isFunction(i)||(i=this[e[t]]),i){var r=t.match(w),a=r[1],s=r[2];i=n.bind(i,this),a+=".delegateEvents"+this.cid,""===s?this.$el.on(a,i):this.$el.on(a,s,i)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_ensureElement:function(){if(this.el)this.setElement(n.result(this,"el"),!1);else{var e=n.extend({},n.result(this,"attributes"));this.id&&(e.id=n.result(this,"id")),this.className&&(e["class"]=n.result(this,"className"));var i=t.$("<"+n.result(this,"tagName")+">").attr(e);this.setElement(i,!1)}}}),t.sync=function(e,i,r){var a=C[e];n.defaults(r||(r={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var s={type:a,dataType:"json"};if(r.url||(s.url=n.result(i,"url")||L()),null!=r.data||!i||"create"!==e&&"update"!==e&&"patch"!==e||(s.contentType="application/json",s.data=JSON.stringify(r.attrs||i.toJSON(r))),r.emulateJSON&&(s.contentType="application/x-www-form-urlencoded",s.data=s.data?{model:s.data}:{}),r.emulateHTTP&&("PUT"===a||"DELETE"===a||"PATCH"===a)){s.type="POST",r.emulateJSON&&(s.data._method=a);var o=r.beforeSend;r.beforeSend=function(e){return e.setRequestHeader("X-HTTP-Method-Override",a),o?o.apply(this,arguments):void 0}}"GET"===s.type||r.emulateJSON||(s.processData=!1),"PATCH"===s.type&&k&&(s.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var l=r.xhr=t.ajax(n.extend(s,r));return i.trigger("request",i,l,r),l};var k=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent),C={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var M=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},P=/\((.*?)\)/g,T=/(\(\?)?:\w+/g,x=/\*\w+/g,O=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(M.prototype,o,{initialize:function(){},route:function(e,i,r){n.isRegExp(e)||(e=this._routeToRegExp(e)),n.isFunction(i)&&(r=i,i=""),r||(r=this[i]);var a=this;return t.history.route(e,function(n){var s=a._extractParameters(e,n);r&&r.apply(a,s),a.trigger.apply(a,["route:"+i].concat(s)),a.trigger("route",i,s),t.history.trigger("route",a,i,s)}),this},navigate:function(e,n){return t.history.navigate(e,n),this},_bindRoutes:function(){if(this.routes){this.routes=n.result(this,"routes");for(var e,t=n.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(O,"\\$&").replace(P,"(?:$1)?").replace(T,function(e,t){return t?e:"([^/]+)"}).replace(x,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var i=e.exec(t).slice(1);return n.map(i,function(e){return e?decodeURIComponent(e):null})}});var A=t.History=function(){this.handlers=[],n.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},j=/^[#\/]|\s+$/g,S=/^\/+|\/+$/g,I=/msie [\w.]+/,E=/\/$/,R=/[?#].*$/;A.started=!1,n.extend(A.prototype,o,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(null==e)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(E,"");e.indexOf(n)||(e=e.slice(n.length))}else e=this.getHash();return e.replace(j,"")},start:function(e){if(A.started)throw new Error("Backbone.history has already been started");A.started=!0,this.options=n.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var i=this.getFragment(),r=document.documentMode,a=I.exec(navigator.userAgent.toLowerCase())&&(!r||7>=r);this.root=("/"+this.root+"/").replace(S,"/"),a&&this._wantsHashChange&&(this.iframe=t.$('').hide().appendTo("body")[0].contentWindow,this.navigate(i)),this._hasPushState?t.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!a?t.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=i;var s=this.location,o=s.pathname.replace(/[^\/]$/,"%24%26/index.html")===this.root;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!o)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._hasPushState&&o&&s.hash&&(this.fragment=this.getHash().replace(j,""),this.history.replaceState({},document.title,this.root+this.fragment+s.search))}return this.options.silent?void 0:this.loadUrl()},stop:function(){t.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),A.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(){var e=this.getFragment();return e===this.fragment&&this.iframe&&(e=this.getFragment(this.getHash(this.iframe))),e===this.fragment?!1:(this.iframe&&this.navigate(e),void this.loadUrl())},loadUrl:function(e){return e=this.fragment=this.getFragment(e),n.any(this.handlers,function(t){return t.route.test(e)?(t.callback(e),!0):void 0})},navigate:function(e,t){if(!A.started)return!1;t&&t!==!0||(t={trigger:!!t});var n=this.root+(e=this.getFragment(e||""));if(e=e.replace(R,""),this.fragment!==e){if(this.fragment=e,""===e&&"/"!==n&&(n=n.slice(0,-1)),this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,n){if(n){var i=e.href.replace(/(javascript:|#).*$/,"");e.replace(i+"#"+t)}else e.hash="#"+t}}),t.history=new A;var $=function(e,t){var i,r=this;i=e&&n.has(e,"constructor")?e.constructor:function(){return r.apply(this,arguments)},n.extend(i,r,t);var a=function(){this.constructor=i};return a.prototype=r.prototype,i.prototype=new a,e&&n.extend(i.prototype,e),i.__super__=r.prototype,i};d.extend=f.extend=M.extend=_.extend=A.extend=$;var L=function(){throw new Error('A "url" property or function must be specified')},H=function(e,t){var n=t.error;t.error=function(i){n&&n(e,i,t),e.trigger("error",e,i,t)}};return t}),function(e,t){if("object"==typeof exports){var n=require("underscore"),i=require("backbone");module.exports=t(n,i)}else"function"==typeof define&&define.amd&&define("backbone.wreqr",["underscore","backbone"],t)}(this,function(e,t){return t.Wreqr=function(e,t,n){var i={};return i.Handlers=function(e,t){var n=function(e){this.options=e,this._wreqrHandlers={},t.isFunction(this.initialize)&&this.initialize(e)};return n.extend=e.Model.extend,t.extend(n.prototype,e.Events,{setHandlers:function(e){t.each(e,function(e,n){var i=null;t.isObject(e)&&!t.isFunction(e)&&(i=e.context,e=e.callback),this.setHandler(n,e,i)},this)},setHandler:function(e,t,n){var i={callback:t,context:n};this._wreqrHandlers[e]=i,this.trigger("handler:add",e,t,n)},hasHandler:function(e){return!!this._wreqrHandlers[e]},getHandler:function(e){var t=this._wreqrHandlers[e];if(!t)throw new Error("Handler not found for '"+e+"'");return function(){var e=Array.prototype.slice.apply(arguments);return t.callback.apply(t.context,e)}},removeHandler:function(e){delete this._wreqrHandlers[e]},removeAllHandlers:function(){this._wreqrHandlers={}}}),n}(e,n),i.CommandStorage=function(){var t=function(e){this.options=e,this._commands={},n.isFunction(this.initialize)&&this.initialize(e)};return n.extend(t.prototype,e.Events,{getCommands:function(e){var t=this._commands[e];return t||(t={command:e,instances:[]},this._commands[e]=t),t},addCommand:function(e,t){var n=this.getCommands(e);n.instances.push(t)},clearCommands:function(e){var t=this.getCommands(e);t.instances=[]}}),t}(),i.Commands=function(e){return e.Handlers.extend({storageType:e.CommandStorage,constructor:function(t){this.options=t||{},this._initializeStorage(this.options),this.on("handler:add",this._executeCommands,this);var n=Array.prototype.slice.call(arguments);e.Handlers.prototype.constructor.apply(this,n)},execute:function(e,t){e=arguments[0],t=Array.prototype.slice.call(arguments,1),this.hasHandler(e)?this.getHandler(e).apply(this,t):this.storage.addCommand(e,t)},_executeCommands:function(e,t,i){var r=this.storage.getCommands(e);n.each(r.instances,function(e){t.apply(i,e)}),this.storage.clearCommands(e)},_initializeStorage:function(e){var t,i=e.storageType||this.storageType;t=n.isFunction(i)?new i:i,this.storage=t}})}(i),i.RequestResponse=function(e){return e.Handlers.extend({request:function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);return this.getHandler(e).apply(this,t)}})}(i),i.EventAggregator=function(e,t){var n=function(){};return n.extend=e.Model.extend,t.extend(n.prototype,e.Events),n}(e,n),i}(t,t.Marionette,e),t.Wreqr}),function(e,t){if("object"==typeof exports){var n=require("underscore"),i=require("backbone");module.exports=t(n,i)}else"function"==typeof define&&define.amd&&define("backbone.babysitter",["underscore","backbone"],t)}(this,function(e,t){"option strict";return t.ChildViewContainer=function(e,t){var n=function(e){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(e,this.add,this)};t.extend(n.prototype,{add:function(e,t){var n=e.cid;return this._views[n]=e,e.model&&(this._indexByModel[e.model.cid]=n),t&&(this._indexByCustom[t]=n),this._updateLength(),this},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){var t=this._indexByModel[e];return this.findByCid(t)},findByCustom:function(e){var t=this._indexByCustom[e];return this.findByCid(t)},findByIndex:function(e){return t.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){var n=e.cid;return e.model&&delete this._indexByModel[e.model.cid],t.any(this._indexByCustom,function(e,t){return e===n?(delete this._indexByCustom[t],!0):void 0},this),delete this._views[n],this._updateLength(),this},call:function(e){this.apply(e,t.tail(arguments))},apply:function(e,n){t.each(this._views,function(i){t.isFunction(i[e])&&i[e].apply(i,n||[])})},_updateLength:function(){this.length=t.size(this._views)}});var i=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return t.each(i,function(e){n.prototype[e]=function(){var n=t.values(this._views),i=[n].concat(t.toArray(arguments));return t[e].apply(t,i)}}),n}(t,e),t.ChildViewContainer}),function(e,t){if("object"==typeof exports){var n=require("underscore"),i=require("backbone"),r=require("backbone.wreqr"),a=require("backbone.babysitter");module.exports=t(n,i,r,a)}else"function"==typeof define&&define.amd&&define("marionette",["underscore","backbone","backbone.wreqr","backbone.babysitter"],t)}(this,function(e,t){!function(e,t,n){function i(e){return s.call(e)}function r(e,t){var n=new Error(e);throw n.name=t||"Error",n}var a={};t.Marionette=a,a.$=t.$;var s=Array.prototype.slice;return a.extend=t.Model.extend,a.getOption=function(e,t){if(e&&t){var n;return n=e.options&&t in e.options&&void 0!==e.options[t]?e.options[t]:e[t]}},a.normalizeMethods=function(e){var t,i={};return n.each(e,function(e,r){t=e,n.isFunction(t)||(t=this[t]),t&&(i[r]=t)},this),i},a.triggerMethod=function(){function e(e,t,n){return n.toUpperCase()}var t=/(^|:)(\w)/gi,i=function(i){var r="on"+i.replace(t,e),a=this[r];return n.isFunction(this.trigger)&&this.trigger.apply(this,arguments),n.isFunction(a)?a.apply(this,n.tail(arguments)):void 0};return i}(),a.MonitorDOMRefresh=function(e){function t(e){e._isShown=!0,r(e)}function i(e){e._isRendered=!0,r(e)}function r(e){e._isShown&&e._isRendered&&a(e)&&n.isFunction(e.triggerMethod)&&e.triggerMethod("dom:refresh")}function a(t){return e.contains(t.el)}return function(e){e.listenTo(e,"show",function(){t(e)}),e.listenTo(e,"render",function(){i(e)})}}(document.documentElement),function(e){function t(e,t,i,a){var s=a.split(/\s+/);n.each(s,function(n){var a=e[n];a||r("Method '"+n+"' was configured as an event handler, but does not exist."),e.listenTo(t,i,a,e)})}function i(e,t,n,i){e.listenTo(t,n,i,e)}function a(e,t,i,r){var a=r.split(/\s+/);n.each(a,function(n){var r=e[n];e.stopListening(t,i,r,e)})}function s(e,t,n,i){e.stopListening(t,n,i,e)}function o(e,t,i,r,a){t&&i&&(n.isFunction(i)&&(i=i.call(e)),n.each(i,function(i,s){n.isFunction(i)?r(e,t,s,i):a(e,t,s,i)}))}e.bindEntityEvents=function(e,n,r){o(e,n,r,i,t)},e.unbindEntityEvents=function(e,t,n){o(e,t,n,s,a)}}(a),a.Callbacks=function(){this._deferred=a.$.Deferred(),this._callbacks=[]},n.extend(a.Callbacks.prototype,{add:function(e,t){this._callbacks.push({cb:e,ctx:t}),this._deferred.done(function(n,i){t&&(n=t),e.call(n,i)})},run:function(e,t){this._deferred.resolve(t,e)},reset:function(){var e=this._callbacks;this._deferred=a.$.Deferred(),this._callbacks=[],n.each(e,function(e){this.add(e.cb,e.ctx)},this)}}),a.Controller=function(e){this.triggerMethod=a.triggerMethod,this.options=e||{},n.isFunction(this.initialize)&&this.initialize(this.options)},a.Controller.extend=a.extend,n.extend(a.Controller.prototype,t.Events,{close:function(){this.stopListening(),this.triggerMethod("close"),this.unbind()}}),a.Region=function(e){if(this.options=e||{},this.el=a.getOption(this,"el"),!this.el){var t=new Error("An 'el' must be specified for a region.");throw t.name="NoElError",t}if(this.initialize){var n=Array.prototype.slice.apply(arguments);this.initialize.apply(this,n)}},n.extend(a.Region,{buildRegion:function(e,t){var i="string"==typeof e,r="string"==typeof e.selector,a="undefined"==typeof e.regionType,s="function"==typeof e;if(!s&&!i&&!r)throw new Error("Region must be specified as a Region type, a selector string or an object with selector property");var o,l;i&&(o=e),e.selector&&(o=e.selector,delete e.selector),s&&(l=e),!s&&a&&(l=t),e.regionType&&(l=e.regionType,delete e.regionType),(i||s)&&(e={}),e.el=o;var u=new l(e);return e.parentEl&&(u.getEl=function(t){var i=e.parentEl;return n.isFunction(i)&&(i=i()),i.find(t)}),u}}),n.extend(a.Region.prototype,t.Events,{show:function(e){this.ensureEl();var t=e.isClosed||n.isUndefined(e.$el),i=e!==this.currentView;i&&this.close(),e.render(),(i||t)&&this.open(e),this.currentView=e,a.triggerMethod.call(this,"show",e),a.triggerMethod.call(e,"show")},ensureEl:function(){this.$el&&0!==this.$el.length||(this.$el=this.getEl(this.el))},getEl:function(e){return a.$(e)},open:function(e){this.$el.empty().append(e.el)},close:function(){var e=this.currentView;e&&!e.isClosed&&(e.close?e.close():e.remove&&e.remove(),a.triggerMethod.call(this,"close",e),delete this.currentView)},attachView:function(e){this.currentView=e},reset:function(){this.close(),delete this.$el}}),a.Region.extend=a.extend,a.RegionManager=function(e){var t=e.Controller.extend({constructor:function(t){this._regions={},e.Controller.prototype.constructor.call(this,t)},addRegions:function(e,t){var i={};return n.each(e,function(e,r){"string"==typeof e&&(e={selector:e}),e.selector&&(e=n.defaults({},e,t));var a=this.addRegion(r,e);i[r]=a},this),i},addRegion:function(t,i){var r,a=n.isObject(i),s=n.isString(i),o=!!i.selector;return r=s||a&&o?e.Region.buildRegion(i,e.Region):n.isFunction(i)?e.Region.buildRegion(i,e.Region):i,this._store(t,r),this.triggerMethod("region:add",t,r),r},get:function(e){return this._regions[e]},removeRegion:function(e){var t=this._regions[e];this._remove(e,t)},removeRegions:function(){n.each(this._regions,function(e,t){this._remove(t,e)},this)},closeRegions:function(){n.each(this._regions,function(e){e.close()},this)},close:function(){this.removeRegions();var t=Array.prototype.slice.call(arguments);e.Controller.prototype.close.apply(this,t)},_store:function(e,t){this._regions[e]=t,this._setLength()},_remove:function(e,t){t.close(),delete this._regions[e],this._setLength(),this.triggerMethod("region:remove",e,t)},_setLength:function(){this.length=n.size(this._regions)}}),i=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return n.each(i,function(e){t.prototype[e]=function(){var t=n.values(this._regions),i=[t].concat(n.toArray(arguments));return n[e].apply(n,i)}}),t}(a),a.TemplateCache=function(e){this.templateId=e},n.extend(a.TemplateCache,{templateCaches:{},get:function(e){var t=this.templateCaches[e];return t||(t=new a.TemplateCache(e),this.templateCaches[e]=t),t.load()},clear:function(){var e,t=i(arguments),n=t.length;if(n>0)for(e=0;n>e;e++)delete this.templateCaches[t[e]];else this.templateCaches={}}}),n.extend(a.TemplateCache.prototype,{load:function(){if(this.compiledTemplate)return this.compiledTemplate;var e=this.loadTemplate(this.templateId);return this.compiledTemplate=this.compileTemplate(e),this.compiledTemplate},loadTemplate:function(e){var t=a.$(e).html();return t&&0!==t.length||r("Could not find template: '"+e+"'","NoTemplateError"),t},compileTemplate:function(e){return n.template(e)}}),a.Renderer={render:function(e,t){if(!e){var n=new Error("Cannot render the template since it's false, null or undefined.");throw n.name="TemplateNotFoundError",n}var i;return(i="function"==typeof e?e:a.TemplateCache.get(e))(t)}},a.View=t.View.extend({constructor:function(e){n.bindAll(this,"render");var i=Array.prototype.slice.apply(arguments);this.options=n.extend({},n.result(this,"options"),n.isFunction(e)?e.call(this):e),this.events=this.normalizeUIKeys(n.result(this,"events")),t.View.prototype.constructor.apply(this,i),a.MonitorDOMRefresh(this),this.listenTo(this,"show",this.onShowCalled,this)},triggerMethod:a.triggerMethod,normalizeMethods:a.normalizeMethods,getTemplate:function(){return a.getOption(this,"template")},mixinTemplateHelpers:function(e){e=e||{};var t=a.getOption(this,"templateHelpers");return n.isFunction(t)&&(t=t.call(this)),n.extend(e,t)},normalizeUIKeys:function(e){return"undefined"!=typeof e?(n.each(n.keys(e),function(t){var n=t.split("@ui.");2===n.length&&(e[n[0]+this.ui[n[1]]]=e[t],delete e[t])},this),e):void 0},configureTriggers:function(){if(this.triggers){var e={},t=this.normalizeUIKeys(n.result(this,"triggers"));return n.each(t,function(t,i){var r=n.isObject(t),a=r?t.event:t;e[i]=function(e){if(e){var n=e.preventDefault,i=e.stopPropagation,s=r?t.preventDefault:n,o=r?t.stopPropagation:i;s&&n&&n.apply(e),o&&i&&i.apply(e)}var l={view:this,model:this.model,collection:this.collection};this.triggerMethod(a,l)}},this),e}},delegateEvents:function(e){this._delegateDOMEvents(e),a.bindEntityEvents(this,this.model,a.getOption(this,"modelEvents")),a.bindEntityEvents(this,this.collection,a.getOption(this,"collectionEvents"))},_delegateDOMEvents:function(e){e=e||this.events,n.isFunction(e)&&(e=e.call(this));var i={},r=this.configureTriggers();n.extend(i,e,r),t.View.prototype.delegateEvents.call(this,i)},undelegateEvents:function(){var e=Array.prototype.slice.call(arguments);t.View.prototype.undelegateEvents.apply(this,e),a.unbindEntityEvents(this,this.model,a.getOption(this,"modelEvents")),a.unbindEntityEvents(this,this.collection,a.getOption(this,"collectionEvents"))
},onShowCalled:function(){},close:function(){if(!this.isClosed){var e=this.triggerMethod("before:close");e!==!1&&(this.isClosed=!0,this.triggerMethod("close"),this.unbindUIElements(),this.remove())}},bindUIElements:function(){if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var e=n.result(this,"_uiBindings");this.ui={},n.each(n.keys(e),function(t){var n=e[t];this.ui[t]=this.$(n)},this)}},unbindUIElements:function(){this.ui&&this._uiBindings&&(n.each(this.ui,function(e,t){delete this.ui[t]},this),this.ui=this._uiBindings,delete this._uiBindings)}}),a.ItemView=a.View.extend({constructor:function(){a.View.prototype.constructor.apply(this,i(arguments))},serializeData:function(){var e={};return this.model?e=this.model.toJSON():this.collection&&(e={items:this.collection.toJSON()}),e},render:function(){this.isClosed=!1,this.triggerMethod("before:render",this),this.triggerMethod("item:before:render",this);var e=this.serializeData();e=this.mixinTemplateHelpers(e);var t=this.getTemplate(),n=a.Renderer.render(t,e);return this.$el.html(n),this.bindUIElements(),this.triggerMethod("render",this),this.triggerMethod("item:rendered",this),this},close:function(){this.isClosed||(this.triggerMethod("item:before:close"),a.View.prototype.close.apply(this,i(arguments)),this.triggerMethod("item:closed"))}}),a.CollectionView=a.View.extend({itemViewEventPrefix:"itemview",constructor:function(){this._initChildViewStorage(),a.View.prototype.constructor.apply(this,i(arguments)),this._initialEvents(),this.initRenderBuffer()},initRenderBuffer:function(){this.elBuffer=document.createDocumentFragment(),this._bufferedChildren=[]},startBuffering:function(){this.initRenderBuffer(),this.isBuffering=!0},endBuffering:function(){this.isBuffering=!1,this.appendBuffer(this,this.elBuffer),this._triggerShowBufferedChildren(),this.initRenderBuffer()},_triggerShowBufferedChildren:function(){this._isShown&&(n.each(this._bufferedChildren,function(e){a.triggerMethod.call(e,"show")}),this._bufferedChildren=[])},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this.addChildView,this),this.listenTo(this.collection,"remove",this.removeItemView,this),this.listenTo(this.collection,"reset",this.render,this))},addChildView:function(e){this.closeEmptyView();var t=this.getItemView(e),n=this.collection.indexOf(e);this.addItemView(e,t,n)},onShowCalled:function(){this.children.each(function(e){a.triggerMethod.call(e,"show")})},triggerBeforeRender:function(){this.triggerMethod("before:render",this),this.triggerMethod("collection:before:render",this)},triggerRendered:function(){this.triggerMethod("render",this),this.triggerMethod("collection:rendered",this)},render:function(){return this.isClosed=!1,this.triggerBeforeRender(),this._renderChildren(),this.triggerRendered(),this},_renderChildren:function(){this.startBuffering(),this.closeEmptyView(),this.closeChildren(),this.isEmpty(this.collection)?this.showEmptyView():this.showCollection(),this.endBuffering()},showCollection:function(){var e;this.collection.each(function(t,n){e=this.getItemView(t),this.addItemView(t,e,n)},this)},showEmptyView:function(){var e=this.getEmptyView();if(e&&!this._showingEmptyView){this._showingEmptyView=!0;var n=new t.Model;this.addItemView(n,e,0)}},closeEmptyView:function(){this._showingEmptyView&&(this.closeChildren(),delete this._showingEmptyView)},getEmptyView:function(){return a.getOption(this,"emptyView")},getItemView:function(){var e=a.getOption(this,"itemView");return e||r("An `itemView` must be specified","NoItemViewError"),e},addItemView:function(e,t,i){var r=a.getOption(this,"itemViewOptions");n.isFunction(r)&&(r=r.call(this,e,i));var s=this.buildItemView(e,t,r);return this.addChildViewEventForwarding(s),this.triggerMethod("before:item:added",s),this.children.add(s),this.renderItemView(s,i),this._isShown&&!this.isBuffering&&a.triggerMethod.call(s,"show"),this.triggerMethod("after:item:added",s),s},addChildViewEventForwarding:function(e){var t=a.getOption(this,"itemViewEventPrefix");this.listenTo(e,"all",function(){var r=i(arguments),s=r[0],o=this.normalizeMethods(this.getItemEvents());r[0]=t+":"+s,r.splice(1,0,e),"undefined"!=typeof o&&n.isFunction(o[s])&&o[s].apply(this,r),a.triggerMethod.apply(this,r)},this)},getItemEvents:function(){return n.isFunction(this.itemEvents)?this.itemEvents.call(this):this.itemEvents},renderItemView:function(e,t){e.render(),this.appendHtml(this,e,t)},buildItemView:function(e,t,i){var r=n.extend({model:e},i);return new t(r)},removeItemView:function(e){var t=this.children.findByModel(e);this.removeChildView(t),this.checkEmpty()},removeChildView:function(e){e&&(this.stopListening(e),e.close?e.close():e.remove&&e.remove(),this.children.remove(e)),this.triggerMethod("item:removed",e)},isEmpty:function(){return!this.collection||0===this.collection.length},checkEmpty:function(){this.isEmpty(this.collection)&&this.showEmptyView()},appendBuffer:function(e,t){e.$el.append(t)},appendHtml:function(e,t){e.isBuffering?(e.elBuffer.appendChild(t.el),e._bufferedChildren.push(t)):e.$el.append(t.el)},_initChildViewStorage:function(){this.children=new t.ChildViewContainer},close:function(){this.isClosed||(this.triggerMethod("collection:before:close"),this.closeChildren(),this.triggerMethod("collection:closed"),a.View.prototype.close.apply(this,i(arguments)))},closeChildren:function(){this.children.each(function(e){this.removeChildView(e)},this),this.checkEmpty()}}),a.CompositeView=a.CollectionView.extend({constructor:function(){a.CollectionView.prototype.constructor.apply(this,i(arguments))},_initialEvents:function(){this.once("render",function(){this.collection&&(this.listenTo(this.collection,"add",this.addChildView,this),this.listenTo(this.collection,"remove",this.removeItemView,this),this.listenTo(this.collection,"reset",this._renderChildren,this))})},getItemView:function(){var e=a.getOption(this,"itemView")||this.constructor;return e||r("An `itemView` must be specified","NoItemViewError"),e},serializeData:function(){var e={};return this.model&&(e=this.model.toJSON()),e},render:function(){this.isRendered=!0,this.isClosed=!1,this.resetItemViewContainer(),this.triggerBeforeRender();var e=this.renderModel();return this.$el.html(e),this.bindUIElements(),this.triggerMethod("composite:model:rendered"),this._renderChildren(),this.triggerMethod("composite:rendered"),this.triggerRendered(),this},_renderChildren:function(){this.isRendered&&(this.triggerMethod("composite:collection:before:render"),a.CollectionView.prototype._renderChildren.call(this),this.triggerMethod("composite:collection:rendered"))},renderModel:function(){var e={};e=this.serializeData(),e=this.mixinTemplateHelpers(e);var t=this.getTemplate();return a.Renderer.render(t,e)},appendBuffer:function(e,t){var n=this.getItemViewContainer(e);n.append(t)},appendHtml:function(e,t){if(e.isBuffering)e.elBuffer.appendChild(t.el),e._bufferedChildren.push(t);else{var n=this.getItemViewContainer(e);n.append(t.el)}},getItemViewContainer:function(e){if("$itemViewContainer"in e)return e.$itemViewContainer;var t,i=a.getOption(e,"itemViewContainer");if(i){var s=n.isFunction(i)?i.call(this):i;t=e.$(s),t.length<=0&&r("The specified `itemViewContainer` was not found: "+e.itemViewContainer,"ItemViewContainerMissingError")}else t=e.$el;return e.$itemViewContainer=t,t},resetItemViewContainer:function(){this.$itemViewContainer&&delete this.$itemViewContainer}}),a.Layout=a.ItemView.extend({regionType:a.Region,constructor:function(e){e=e||{},this._firstRender=!0,this._initializeRegions(e),a.ItemView.prototype.constructor.call(this,e)},render:function(){this.isClosed&&this._initializeRegions(),this._firstRender?this._firstRender=!1:this.isClosed||this._reInitializeRegions();var e=Array.prototype.slice.apply(arguments),t=a.ItemView.prototype.render.apply(this,e);return t},close:function(){if(!this.isClosed){this.regionManager.close();var e=Array.prototype.slice.apply(arguments);a.ItemView.prototype.close.apply(this,e)}},addRegion:function(e,t){var n={};return n[e]=t,this._buildRegions(n)[e]},addRegions:function(e){return this.regions=n.extend({},this.regions,e),this._buildRegions(e)},removeRegion:function(e){return delete this.regions[e],this.regionManager.removeRegion(e)},_buildRegions:function(e){var t=this,n={regionType:a.getOption(this,"regionType"),parentEl:function(){return t.$el}};return this.regionManager.addRegions(e,n)},_initializeRegions:function(e){var t;this._initRegionManager(),t=n.isFunction(this.regions)?this.regions(e):this.regions||{},this.addRegions(t)},_reInitializeRegions:function(){this.regionManager.closeRegions(),this.regionManager.each(function(e){e.reset()})},_initRegionManager:function(){this.regionManager=new a.RegionManager,this.listenTo(this.regionManager,"region:add",function(e,t){this[e]=t,this.trigger("region:add",e,t)}),this.listenTo(this.regionManager,"region:remove",function(e,t){delete this[e],this.trigger("region:remove",e,t)})}}),a.AppRouter=t.Router.extend({constructor:function(e){t.Router.prototype.constructor.apply(this,i(arguments)),this.options=e||{};var n=a.getOption(this,"appRoutes"),r=this._getController();this.processAppRoutes(r,n)},appRoute:function(e,t){var n=this._getController();this._addAppRoute(n,e,t)},processAppRoutes:function(e,t){if(t){var i=n.keys(t).reverse();n.each(i,function(n){this._addAppRoute(e,n,t[n])},this)}},_getController:function(){return a.getOption(this,"controller")},_addAppRoute:function(e,t,i){var r=e[i];if(!r)throw new Error("Method '"+i+"' was not found on the controller");this.route(t,i,n.bind(r,e))}}),a.Application=function(e){this._initRegionManager(),this._initCallbacks=new a.Callbacks,this.vent=new t.Wreqr.EventAggregator,this.commands=new t.Wreqr.Commands,this.reqres=new t.Wreqr.RequestResponse,this.submodules={},n.extend(this,e),this.triggerMethod=a.triggerMethod},n.extend(a.Application.prototype,t.Events,{execute:function(){var e=Array.prototype.slice.apply(arguments);this.commands.execute.apply(this.commands,e)},request:function(){var e=Array.prototype.slice.apply(arguments);return this.reqres.request.apply(this.reqres,e)},addInitializer:function(e){this._initCallbacks.add(e)},start:function(e){this.triggerMethod("initialize:before",e),this._initCallbacks.run(e,this),this.triggerMethod("initialize:after",e),this.triggerMethod("start",e)},addRegions:function(e){return this._regionManager.addRegions(e)},closeRegions:function(){this._regionManager.closeRegions()},removeRegion:function(e){this._regionManager.removeRegion(e)},getRegion:function(e){return this._regionManager.get(e)},module:function(e,t){var n=a.Module;t&&(n=t.moduleClass||n);var r=i(arguments);return r.unshift(this),n.create.apply(n,r)},_initRegionManager:function(){this._regionManager=new a.RegionManager,this.listenTo(this._regionManager,"region:add",function(e,t){this[e]=t}),this.listenTo(this._regionManager,"region:remove",function(e){delete this[e]})}}),a.Application.extend=a.extend,a.Module=function(e,t,i){this.moduleName=e,this.options=n.extend({},this.options,i),this.initialize=i.initialize||this.initialize,this.submodules={},this._setupInitializersAndFinalizers(),this.app=t,this.startWithParent=!0,this.triggerMethod=a.triggerMethod,n.isFunction(this.initialize)&&this.initialize(this.options,e,t)},a.Module.extend=a.extend,n.extend(a.Module.prototype,t.Events,{initialize:function(){},addInitializer:function(e){this._initializerCallbacks.add(e)},addFinalizer:function(e){this._finalizerCallbacks.add(e)},start:function(e){this._isInitialized||(n.each(this.submodules,function(t){t.startWithParent&&t.start(e)}),this.triggerMethod("before:start",e),this._initializerCallbacks.run(e,this),this._isInitialized=!0,this.triggerMethod("start",e))},stop:function(){this._isInitialized&&(this._isInitialized=!1,a.triggerMethod.call(this,"before:stop"),n.each(this.submodules,function(e){e.stop()}),this._finalizerCallbacks.run(void 0,this),this._initializerCallbacks.reset(),this._finalizerCallbacks.reset(),a.triggerMethod.call(this,"stop"))},addDefinition:function(e,t){this._runModuleDefinition(e,t)},_runModuleDefinition:function(e,i){if(e){var r=n.flatten([this,this.app,t,a,a.$,n,i]);e.apply(this,r)}},_setupInitializersAndFinalizers:function(){this._initializerCallbacks=new a.Callbacks,this._finalizerCallbacks=new a.Callbacks}}),n.extend(a.Module,{create:function(e,t,r){var a=e,s=i(arguments);s.splice(0,3),t=t.split(".");var o=t.length,l=[];return l[o-1]=r,n.each(t,function(t,n){var i=a;a=this._getModule(i,t,e,r),this._addModuleDefinition(i,a,l[n],s)},this),a},_getModule:function(e,t,i,r){var s=a.Module,o=n.extend({},r);r&&(s=r.moduleClass||s);var l=e[t];return l||(l=new s(t,i,o),e[t]=l,e.submodules[t]=l),l},_addModuleDefinition:function(e,t,i,r){var a,s;n.isFunction(i)?(a=i,s=!0):n.isObject(i)?(a=i.define,s="undefined"!=typeof i.startWithParent?i.startWithParent:!0):s=!0,a&&t.addDefinition(a,r),t.startWithParent=t.startWithParent&&s,t.startWithParent&&!t.startWithParentIsConfigured&&(t.startWithParentIsConfigured=!0,e.addInitializer(function(e){t.startWithParent&&t.start(e)}))}}),a}(this,t,e);return t.Marionette}),function(e,t){function n(n,i){function r(e){return ut.preferFlash&&rt&&!ut.ignoreFlash&&ut.flash[e]!==t&&ut.flash[e]}function a(e){return function(t){var n=this._s;return n&&n._a?e.call(this,t):null}}this.setupOptions={url:n||null,flashVersion:8,debugMode:!0,debugFlash:!1,useConsole:!0,consoleOnly:!0,waitForWindowLoad:!1,bgColor:"#ffffff",useHighPerformance:!1,flashPollingInterval:null,html5PollingInterval:null,flashLoadTimeout:1e3,wmode:null,allowScriptAccess:"always",useFlashBlock:!1,useHTML5Audio:!0,html5Test:/^(probably|maybe)$/i,preferFlash:!1,noSWFCache:!1,idPrefix:"sound"},this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100},this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null},this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null},this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a","m4b"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},opus:{type:["audio/ogg; codecs=opus","audio/opus"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.movieID="sm2-container",this.id=i||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20131201",this.altURL=this.movieURL=this.version=null,this.enabled=this.swfLoaded=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.didFlashBlock=this.muted=!1,this.filePattern=null,this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i},this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1},this.sandbox={},this.html5={usingFlash:null},this.flash={},this.ignoreFlash=this.html5Only=!1;var s,o,l,u,p,c,d,h,f,m,g,v,y,_,w,b,k,C,M,P,T,x,O,A,j,S,I,E,R,$,L,H,D,q,F,B,V,z,U,N,W,X,Y,Q,J,G,K,Z,et,tt,nt,it,rt,at,st,ot,lt,ut=this,pt=null,ct=null,dt=navigator.userAgent,ht=e.location.href.toString(),ft=document,mt=[],gt=!1,vt=!1,yt=!1,_t=!1,wt=!1,bt=null,kt=null,Ct=!1,Mt=!1,Pt=0,Tt=null,xt=[],Ot=null,At=Array.prototype.slice,jt=!1,St=0,It=dt.match(/(ipad|iphone|ipod)/i),Et=dt.match(/android/i),Rt=dt.match(/msie/i),$t=dt.match(/webkit/i),Lt=dt.match(/safari/i)&&!dt.match(/chrome/i),Ht=dt.match(/opera/i),Dt=dt.match(/(mobile|pre\/|xoom)/i)||It||Et,qt=!ht.match(/usehtml5audio/i)&&!ht.match(/sm2\-ignorebadua/i)&&Lt&&!dt.match(/silk/i)&&dt.match(/OS X 10_6_([3-7])/i),Ft=ft.hasFocus!==t?ft.hasFocus():null,Bt=Lt&&(ft.hasFocus===t||!ft.hasFocus()),Vt=!Bt,zt=/(mp3|mp4|mpa|m4a|m4b)/i,Ut=ft.location?ft.location.protocol.match(/http/i):null,Nt=Ut?"":"http://",Wt=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i,Xt="mpeg4 aac flv mov mp4 m4v f4v m4a m4b mp4v 3gp 3g2".split(" "),Yt=RegExp("\\.("+Xt.join("|")+")(\\?.*)?$","i");this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!Ut;var Qt;try{Qt=Audio!==t&&(Ht&&opera!==t&&10>opera.version()?new Audio(null):new Audio).canPlayType!==t}catch(Jt){Qt=!1}this.hasHTML5=Qt,this.setup=function(e){var n=!ut.url;return e!==t&&yt&&Ot&&ut.ok(),f(e),e&&(n&&A&&e.url!==t&&ut.beginDelayedInit(),!A&&e.url!==t&&"complete"===ft.readyState&&setTimeout(x,1)),ut},this.supported=this.ok=function(){return Ot?yt&&!_t:ut.useHTML5Audio&&ut.hasHTML5},this.getMovie=function(t){return o(t)||ft[t]||e[t]},this.createSound=function(e,n){function i(){return r=B(r),ut.sounds[r.id]=new s(r),ut.soundIDs.push(r.id),ut.sounds[r.id]}var r,a=null;if(!yt||!ut.ok())return!1;if(n!==t&&(e={id:e,url:n}),r=h(e),r.url=X(r.url),void 0===r.id&&(r.id=ut.setupOptions.idPrefix+St++),z(r.id,!0))return ut.sounds[r.id];if(J(r))a=i(),a._setup_html5(r);else{if(ut.html5Only||ut.html5.usingFlash&&r.url&&r.url.match(/data\:/i))return i();c>8&&null===r.isMovieStar&&(r.isMovieStar=!(!r.serverURL&&!(r.type&&r.type.match(Wt)||r.url&&r.url.match(Yt)))),r=V(r,void 0),a=i(),8===c?ct._createSound(r.id,r.loops||1,r.usePolicyFile):(ct._createSound(r.id,r.url,r.usePeakData,r.useWaveformData,r.useEQData,r.isMovieStar,r.isMovieStar?r.bufferTime:!1,r.loops||1,r.serverURL,r.duration||null,r.autoPlay,!0,r.autoLoad,r.usePolicyFile),r.serverURL||(a.connected=!0,r.onconnect&&r.onconnect.apply(a))),!r.serverURL&&(r.autoLoad||r.autoPlay)&&a.load(r)}return!r.serverURL&&r.autoPlay&&a.play(),a},this.destroySound=function(e,t){if(!z(e))return!1;var n,i=ut.sounds[e];for(i._iO={},i.stop(),i.unload(),n=0;n=0;e--)ut.sounds[ut.soundIDs[e]].pause()},this.resume=function(e){return z(e)?ut.sounds[e].resume():!1},this.resumeAll=function(){var e;for(e=ut.soundIDs.length-1;e>=0;e--)ut.sounds[ut.soundIDs[e]].resume()},this.togglePause=function(e){return z(e)?ut.sounds[e].togglePause():!1},this.setPan=function(e,t){return z(e)?ut.sounds[e].setPan(t):!1},this.setVolume=function(e,t){return z(e)?ut.sounds[e].setVolume(t):!1},this.mute=function(e){var t=0;if(e instanceof String&&(e=null),e)return z(e)?ut.sounds[e].mute():!1;for(t=ut.soundIDs.length-1;t>=0;t--)ut.sounds[ut.soundIDs[t]].mute();return ut.muted=!0},this.muteAll=function(){ut.mute()},this.unmute=function(e){if(e instanceof String&&(e=null),e)return z(e)?ut.sounds[e].unmute():!1;for(e=ut.soundIDs.length-1;e>=0;e--)ut.sounds[ut.soundIDs[e]].unmute();return ut.muted=!1,!0},this.unmuteAll=function(){ut.unmute()},this.toggleMute=function(e){return z(e)?ut.sounds[e].toggleMute():!1},this.getMemoryUse=function(){var e=0;return ct&&8!==c&&(e=parseInt(ct._getMemoryUse(),10)),e},this.disable=function(n){var i;if(n===t&&(n=!1),_t)return!1;for(_t=!0,i=ut.soundIDs.length-1;i>=0;i--)$(ut.sounds[ut.soundIDs[i]]);return d(n),nt.remove(e,"load",y),!0},this.canPlayMIME=function(e){var t;return ut.hasHTML5&&(t=G({type:e})),!t&&Ot&&(t=e&&ut.ok()?!!(c>8&&e.match(Wt)||e.match(ut.mimePattern)):null),t},this.canPlayURL=function(e){var t;return ut.hasHTML5&&(t=G({url:e})),!t&&Ot&&(t=e&&ut.ok()?!!e.match(ut.filePattern):null),t},this.canPlayLink=function(e){return e.type!==t&&e.type&&ut.canPlayMIME(e.type)?!0:ut.canPlayURL(e.href)},this.getSoundById=function(e){return e?ut.sounds[e]:null},this.onready=function(t,n){if("function"!=typeof t)throw D("needFunction","onready");return n||(n=e),g("onready",t,n),v(),!0},this.ontimeout=function(t,n){if("function"!=typeof t)throw D("needFunction","ontimeout");return n||(n=e),g("ontimeout",t,n),v({type:"ontimeout"}),!0},this._wD=this._writeDebug=function(){return!0},this._debug=function(){},this.reboot=function(t,n){var i,r,a;for(i=ut.soundIDs.length-1;i>=0;i--)ut.sounds[ut.soundIDs[i]].destruct();if(ct)try{Rt&&(kt=ct.innerHTML),bt=ct.parentNode.removeChild(ct)}catch(s){}if(kt=bt=Ot=ct=null,ut.enabled=A=yt=Ct=Mt=gt=vt=_t=jt=ut.swfLoaded=!1,ut.soundIDs=[],ut.sounds={},St=0,t)mt=[];else for(i in mt)if(mt.hasOwnProperty(i))for(r=0,a=mt[i].length;a>r;r++)mt[i][r].fired=!1;return ut.html5={usingFlash:null},ut.flash={},ut.html5Only=!1,ut.ignoreFlash=!1,e.setTimeout(function(){T(),n||ut.beginDelayedInit()},20),ut},this.reset=function(){return ut.reboot(!0,!0)},this.getMoviePercent=function(){return ct&&"PercentLoaded"in ct?ct.PercentLoaded():null},this.beginDelayedInit=function(){wt=!0,x(),setTimeout(function(){return Mt?!1:(S(),P(),Mt=!0)},20),_()},this.destruct=function(){ut.disable(!0)},s=function(e){var n,i,r,a,s,o,l,u,p,d,f,m=this,g=!1,v=[],y=0,_=null;i=n=null,this.sID=this.id=e.id,this.url=e.url,this._iO=this.instanceOptions=this.options=h(e),this.pan=this.options.pan,this.volume=this.options.volume,this.isHTML5=!1,this._a=null,f=this.url?!1:!0,this.id3={},this._debug=function(){},this.load=function(e){var n,i=null;if(e!==t?m._iO=h(e,m.options):(e=m.options,m._iO=e,_&&_!==m.url&&(m._iO.url=m.url,m.url=null)),m._iO.url||(m._iO.url=m.url),m._iO.url=X(m._iO.url),n=m.instanceOptions=m._iO,!n.url&&!m.url)return m;if(n.url===m.url&&0!==m.readyState&&2!==m.readyState)return 3===m.readyState&&n.onload&<(m,function(){n.onload.apply(m,[!!m.duration])}),m;if(m.loaded=!1,m.readyState=1,m.playState=0,m.id3={},J(n))i=m._setup_html5(n),i._called_load||(m._html5_canplay=!1,m.url!==n.url&&(m._a.src=n.url,m.setPosition(0)),m._a.autobuffer="auto",m._a.preload="auto",m._a._called_load=!0);else{if(ut.html5Only||m._iO.url&&m._iO.url.match(/data\:/i))return m;try{m.isHTML5=!1,m._iO=V(B(n)),n=m._iO,8===c?ct._load(m.id,n.url,n.stream,n.autoPlay,n.usePolicyFile):ct._load(m.id,n.url,!!n.stream,!!n.autoPlay,n.loops||1,!!n.autoLoad,n.usePolicyFile)}catch(r){I({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}}return m.url=n.url,m},this.unload=function(){return 0!==m.readyState&&(m.isHTML5?(o(),m._a&&(m._a.pause(),_=Z(m._a))):8===c?ct._unload(m.id,"about:blank"):ct._unload(m.id),r()),m},this.destruct=function(e){m.isHTML5?(o(),m._a&&(m._a.pause(),Z(m._a),jt||s(),m._a._s=null,m._a=null)):(m._iO.onfailure=null,ct._destroySound(m.id)),e||ut.destroySound(m.id,!0)},this.start=this.play=function(e,n){var i,r,a,s,o;if(r=!0,r=null,n=n===t?!0:n,e||(e={}),m.url&&(m._iO.url=m.url),m._iO=h(m._iO,m.options),m._iO=h(e,m._iO),m._iO.url=X(m._iO.url),m.instanceOptions=m._iO,!m.isHTML5&&m._iO.serverURL&&!m.connected)return m.getAutoPlay()||m.setAutoPlay(!0),m;if(J(m._iO)&&(m._setup_html5(m._iO),l()),1===m.playState&&!m.paused&&(i=m._iO.multiShot,i||(m.isHTML5&&m.setPosition(m._iO.position),r=m)),null!==r)return r;if(e.url&&e.url!==m.url&&(m.readyState||m.isHTML5||8!==c||!f?m.load(m._iO):f=!1),m.loaded||(0===m.readyState?(m.isHTML5||ut.html5Only?m.isHTML5?m.load(m._iO):r=m:(m._iO.autoPlay=!0,m.load(m._iO)),m.instanceOptions=m._iO):2===m.readyState&&(r=m)),null!==r)return r;if(!m.isHTML5&&9===c&&08&&!m.getAutoPlay())&&m.instanceCount++,m._iO.onposition&&0===m.playState&&u(m),m.playState=1,m.paused=!1,m.position=m._iO.position===t||isNaN(m._iO.position)?0:m._iO.position,m.isHTML5||(m._iO=V(B(m._iO))),m._iO.onplay&&n&&(m._iO.onplay.apply(m),g=!0),m.setVolume(m._iO.volume,!0),m.setPan(m._iO.pan,!0),m.isHTML5?2>m.instanceCount?(l(),r=m._setup_html5(),m.setPosition(m._iO.position),r.play()):(a=new Audio(m._iO.url),s=function(){nt.remove(a,"ended",s),m._onfinish(m),Z(a),a=null},o=function(){nt.remove(a,"canplay",o);try{a.currentTime=m._iO.position/1e3}catch(e){}a.play()},nt.add(a,"ended",s),void 0!==m._iO.volume&&(a.volume=Math.max(0,Math.min(1,m._iO.volume/100))),m.muted&&(a.muted=!0),m._iO.position?nt.add(a,"canplay",o):a.play()):(r=ct._start(m.id,m._iO.loops||1,9===c?m.position:m.position/1e3,m._iO.multiShot||!1),9===c&&!r&&m._iO.onplayerror&&m._iO.onplayerror.apply(m))}return m},this.stop=function(e){var t=m._iO;return 1===m.playState&&(m._onbufferchange(0),m._resetOnPosition(0),m.paused=!1,m.isHTML5||(m.playState=0),p(),t.to&&m.clearOnPosition(t.to),m.isHTML5?m._a&&(e=m.position,m.setPosition(0),m.position=e,m._a.pause(),m.playState=0,m._onTimer(),o()):(ct._stop(m.id,e),t.serverURL&&m.unload()),m.instanceCount=0,m._iO={},t.onstop&&t.onstop.apply(m)),m},this.setAutoPlay=function(e){m._iO.autoPlay=e,m.isHTML5||(ct._setAutoPlay(m.id,e),e&&!m.instanceCount&&1===m.readyState&&m.instanceCount++)},this.getAutoPlay=function(){return m._iO.autoPlay},this.setPosition=function(e){e===t&&(e=0);var n=m.isHTML5?Math.max(e,0):Math.min(m.duration||m._iO.duration,Math.max(e,0));if(m.position=n,e=m.position/1e3,m._resetOnPosition(m.position),m._iO.position=n,m.isHTML5){if(m._a){if(m._html5_canplay){if(m._a.currentTime!==e)try{m._a.currentTime=e,(0===m.playState||m.paused)&&m._a.pause()}catch(i){}}else if(e)return m;m.paused&&m._onTimer(!0)}}else e=9===c?m.position:e,m.readyState&&2!==m.readyState&&ct._setPosition(m.id,e,m.paused||!m.playState,m._iO.multiShot);return m},this.pause=function(e){return m.paused||0===m.playState&&1!==m.readyState?m:(m.paused=!0,m.isHTML5?(m._setup_html5().pause(),o()):(e||e===t)&&ct._pause(m.id,m._iO.multiShot),m._iO.onpause&&m._iO.onpause.apply(m),m)},this.resume=function(){var e=m._iO;return m.paused?(m.paused=!1,m.playState=1,m.isHTML5?(m._setup_html5().play(),l()):(e.isMovieStar&&!e.serverURL&&m.setPosition(m.position),ct._pause(m.id,e.multiShot)),!g&&e.onplay?(e.onplay.apply(m),g=!0):e.onresume&&e.onresume.apply(m),m):m},this.togglePause=function(){return 0===m.playState?(m.play({position:9!==c||m.isHTML5?m.position/1e3:m.position}),m):(m.paused?m.resume():m.pause(),m)},this.setPan=function(e,n){return e===t&&(e=0),n===t&&(n=!1),m.isHTML5||ct._setPan(m.id,e),m._iO.pan=e,n||(m.pan=e,m.options.pan=e),m},this.setVolume=function(e,n){return e===t&&(e=100),n===t&&(n=!1),m.isHTML5?m._a&&(ut.muted&&!m.muted&&(m.muted=!0,m._a.muted=!0),m._a.volume=Math.max(0,Math.min(1,e/100))):ct._setVolume(m.id,ut.muted&&!m.muted||m.muted?0:e),m._iO.volume=e,n||(m.volume=e,m.options.volume=e),m},this.mute=function(){return m.muted=!0,m.isHTML5?m._a&&(m._a.muted=!0):ct._setVolume(m.id,0),m},this.unmute=function(){m.muted=!1;var e=m._iO.volume!==t;return m.isHTML5?m._a&&(m._a.muted=!1):ct._setVolume(m.id,e?m._iO.volume:m.options.volume),m},this.toggleMute=function(){return m.muted?m.unmute():m.mute()},this.onposition=this.onPosition=function(e,n,i){return v.push({position:parseInt(e,10),method:n,scope:i!==t?i:m,fired:!1}),m},this.clearOnPosition=function(e,t){var n;if(e=parseInt(e,10),isNaN(e))return!1;for(n=0;n=e)return!1;for(e-=1;e>=0;e--)t=v[e],!t.fired&&m.position>=t.position&&(t.fired=!0,y++,t.method.apply(t.scope,[t.position]));return!0},this._resetOnPosition=function(e){var t,n;if(t=v.length,!t)return!1;for(t-=1;t>=0;t--)n=v[t],n.fired&&e<=n.position&&(n.fired=!1,y--);return!0},d=function(){var e,t,n=m._iO,i=n.from,r=n.to;return t=function(){m.clearOnPosition(r,t),m.stop()},e=function(){null===r||isNaN(r)||m.onPosition(r,t)},null!==i&&!isNaN(i)&&(n.position=i,n.multiShot=!1,e()),n},u=function(){var e,t=m._iO.onposition;if(t)for(e in t)t.hasOwnProperty(e)&&m.onPosition(parseInt(e,10),t[e])},p=function(){var e,t=m._iO.onposition;if(t)for(e in t)t.hasOwnProperty(e)&&m.clearOnPosition(parseInt(e,10))},l=function(){m.isHTML5&&U(m)},o=function(){m.isHTML5&&N(m)},r=function(e){e||(v=[],y=0),g=!1,m._hasTimer=null,m._a=null,m._html5_canplay=!1,m.bytesLoaded=null,m.bytesTotal=null,m.duration=m._iO&&m._iO.duration?m._iO.duration:null,m.durationEstimate=null,m.buffered=[],m.eqData=[],m.eqData.left=[],m.eqData.right=[],m.failures=0,m.isBuffering=!1,m.instanceOptions={},m.instanceCount=0,m.loaded=!1,m.metadata={},m.readyState=0,m.muted=!1,m.paused=!1,m.peakData={left:0,right:0},m.waveformData={left:[],right:[]},m.playState=0,m.position=null,m.id3={}},r(),this._onTimer=function(e){var t,r=!1,a={};return m._hasTimer||e?(m._a&&(e||(01?"loop":""},this._setup_html5=function(e){e=h(m._iO,e);var t,n=jt?pt:m._a,i=decodeURI(e.url);if(jt?i===decodeURI(it)&&(t=!0):i===decodeURI(_)&&(t=!0),n){if(n._s)if(jt)n._s&&n._s.playState&&!t&&n._s.stop();else if(!jt&&i===decodeURI(_))return m._apply_loop(n,e.loops),n;t||(_&&r(!1),n.src=e.url,it=_=m.url=e.url,n._called_load=!1)}else e.autoLoad||e.autoPlay?(m._a=new Audio(e.url),m._a.load()):m._a=Ht&&10>opera.version()?new Audio(null):new Audio,n=m._a,n._called_load=!1,jt&&(pt=n);return m.isHTML5=!0,m._a=n,n._s=m,a(),m._apply_loop(n,e.loops),e.autoLoad||e.autoPlay?m.load():(n.autobuffer=!1,n.preload="auto"),n},a=function(){if(m._a._added_events)return!1;var e;m._a._added_events=!0;for(e in ot)ot.hasOwnProperty(e)&&m._a&&m._a.addEventListener(e,ot[e],!1);return!0},s=function(){var e;m._a._added_events=!1;for(e in ot)ot.hasOwnProperty(e)&&m._a&&m._a.removeEventListener(e,ot[e],!1)},this._onload=function(e){var t=!!e||!m.isHTML5&&8===c&&m.duration;return m.loaded=t,m.readyState=t?3:2,m._onbufferchange(0),m._iO.onload&<(m,function(){m._iO.onload.apply(m,[t])}),!0},this._onbufferchange=function(e){return 0===m.playState||e&&m.isBuffering||!e&&!m.isBuffering?!1:(m.isBuffering=1===e,m._iO.onbufferchange&&m._iO.onbufferchange.apply(m),!0)},this._onsuspend=function(){return m._iO.onsuspend&&m._iO.onsuspend.apply(m),!0},this._onfailure=function(e,t,n){m.failures++,m._iO.onfailure&&1===m.failures&&m._iO.onfailure(m,e,t,n)},this._onfinish=function(){var e=m._iO.onfinish;m._onbufferchange(0),m._resetOnPosition(0),m.instanceCount&&(m.instanceCount--,m.instanceCount||(p(),m.playState=0,m.paused=!1,m.instanceCount=0,m.instanceOptions={},m._iO={},o(),m.isHTML5&&(m.position=0)),(!m.instanceCount||m._iO.multiShotEvents)&&e&<(m,function(){e.apply(m)}))},this._whileloading=function(e,t,n,i){var r=m._iO;m.bytesLoaded=e,m.bytesTotal=t,m.duration=Math.floor(n),m.bufferLength=i,m.durationEstimate=m.isHTML5||r.isMovieStar?m.duration:r.duration?m.duration>r.duration?m.duration:r.duration:parseInt(m.bytesTotal/m.bytesLoaded*m.duration,10),m.isHTML5||(m.buffered=[{start:0,end:m.duration}]),(3!==m.readyState||m.isHTML5)&&r.whileloading&&r.whileloading.apply(m)
},this._whileplaying=function(e,n,i,r,a){var s=m._iO;return isNaN(e)||null===e?!1:(m.position=Math.max(0,e),m._processOnPosition(),!m.isHTML5&&c>8&&(s.usePeakData&&n!==t&&n&&(m.peakData={left:n.leftPeak,right:n.rightPeak}),s.useWaveformData&&i!==t&&i&&(m.waveformData={left:i.split(","),right:r.split(",")}),s.useEQData&&a!==t&&a&&a.leftEQ&&(e=a.leftEQ.split(","),m.eqData=e,m.eqData.left=e,a.rightEQ!==t&&a.rightEQ&&(m.eqData.right=a.rightEQ.split(",")))),1===m.playState&&(!m.isHTML5&&8===c&&!m.position&&m.isBuffering&&m._onbufferchange(0),s.whileplaying&&s.whileplaying.apply(m)),!0)},this._oncaptiondata=function(e){m.captiondata=e,m._iO.oncaptiondata&&m._iO.oncaptiondata.apply(m,[e])},this._onmetadata=function(e,t){var n,i,r={};for(n=0,i=e.length;i>n;n++)r[e[n]]=t[n];m.metadata=r,m._iO.onmetadata&&m._iO.onmetadata.apply(m)},this._onid3=function(e,t){var n,i,r=[];for(n=0,i=e.length;i>n;n++)r[e[n]]=t[n];m.id3=h(m.id3,r),m._iO.onid3&&m._iO.onid3.apply(m)},this._onconnect=function(e){e=1===e,(m.connected=e)&&(m.failures=0,z(m.id)&&(m.getAutoPlay()?m.play(t,m.getAutoPlay()):m._iO.autoLoad&&m.load()),m._iO.onconnect&&m._iO.onconnect.apply(m,[e]))},this._ondataerror=function(){03&&e.pop()):3===t&&e.push(!1),e}function n(e,t){var n=e.shift(),a=[r[t]];i?n[a](e[0],e[1]):n[a].apply(n,e)}var i=e.attachEvent,r={add:i?"attachEvent":"addEventListener",remove:i?"detachEvent":"removeEventListener"};return{add:function(){n(t(arguments),"add")},remove:function(){n(t(arguments),"remove")}}}(),ot={abort:a(function(){}),canplay:a(function(){var e,n=this._s;if(n._html5_canplay)return!0;if(n._html5_canplay=!0,n._onbufferchange(0),e=n._iO.position===t||isNaN(n._iO.position)?null:n._iO.position/1e3,n.position&&this.currentTime!==e)try{this.currentTime=e}catch(i){}n._iO._oncanplay&&n._iO._oncanplay()}),canplaythrough:a(function(){var e=this._s;e.loaded||(e._onbufferchange(0),e._whileloading(e.bytesLoaded,e.bytesTotal,e._get_html5_duration()),e._onload(!0))}),ended:a(function(){this._s._onfinish()}),error:a(function(){this._s._onload(!1)}),loadeddata:a(function(){var e=this._s;!e._loaded&&!Lt&&(e.duration=e._get_html5_duration())}),loadedmetadata:a(function(){}),loadstart:a(function(){this._s._onbufferchange(1)}),play:a(function(){this._s._onbufferchange(0)}),playing:a(function(){this._s._onbufferchange(0)}),progress:a(function(e){var t,n,i=this._s,r=0,r=e.target.buffered;t=e.loaded||0;var a=e.total||1;if(i.buffered=[],r&&r.length){for(t=0,n=r.length;n>t;t++)i.buffered.push({start:1e3*r.start(t),end:1e3*r.end(t)});r=1e3*(r.end(0)-r.start(0)),t=Math.min(1,r/(1e3*e.target.duration))}isNaN(t)||(i._onbufferchange(0),i._whileloading(t,a,i._get_html5_duration()),t&&a&&t===a&&ot.canplaythrough.call(this,e))}),ratechange:a(function(){}),suspend:a(function(e){var t=this._s;ot.progress.call(this,e),t._onsuspend()}),stalled:a(function(){}),timeupdate:a(function(){this._s._onTimer()}),waiting:a(function(){this._s._onbufferchange(1)})},J=function(e){return e&&(e.type||e.url||e.serverURL)?e.serverURL||e.type&&r(e.type)?!1:e.type?G({type:e.type}):G({url:e.url})||ut.html5Only||e.url.match(/data\:/i):!1},Z=function(e){var t;return e&&(t=Lt?"about:blank":ut.html5.canPlayType("audio/wav")?"data:audio/wave;base64,/UklGRiYAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQIAAAD//w==":"about:blank",e.src=t,void 0!==e._called_unload&&(e._called_load=!1)),jt&&(it=null),t},G=function(e){if(!ut.useHTML5Audio||!ut.hasHTML5)return!1;var n=e.url||null;e=e.type||null;var i,a=ut.audioFormats;if(e&&ut.html5[e]!==t)return ut.html5[e]&&!r(e);if(!K){K=[];for(i in a)a.hasOwnProperty(i)&&(K.push(i),a[i].related&&(K=K.concat(a[i].related)));K=RegExp("\\.("+K.join("|")+")(\\?.*)?$","i")}return i=n?n.toLowerCase().match(K):null,i&&i.length?i=i[1]:e&&(n=e.indexOf(";"),i=(-1!==n?e.substr(0,n):e).substr(6)),i&&ut.html5[i]!==t?n=ut.html5[i]&&!r(i):(e="audio/"+i,n=ut.html5.canPlayType({type:e}),n=(ut.html5[i]=n)&&ut.html5[e]&&!r(e)),n},tt=function(){function e(e){var t,n=t=!1;if(!s||"function"!=typeof s.canPlayType)return t;if(e instanceof Array){for(a=0,t=e.length;t>a;a++)(ut.html5[e[a]]||s.canPlayType(e[a]).match(ut.html5Test))&&(n=!0,ut.html5[e[a]]=!0,ut.flash[e[a]]=!!e[a].match(zt));t=n}else e=s&&"function"==typeof s.canPlayType?s.canPlayType(e):!1,t=!(!e||!e.match(ut.html5Test));return t}if(!ut.useHTML5Audio||!ut.hasHTML5)return Ot=ut.html5.usingFlash=!0,!1;var n,i,r,a,s=Audio!==t?Ht&&10>opera.version()?new Audio(null):new Audio:null,o={};r=ut.audioFormats;for(n in r)if(r.hasOwnProperty(n)&&(i="audio/"+n,o[n]=e(r[n].type),o[i]=o[n],n.match(zt)?(ut.flash[n]=!0,ut.flash[i]=!0):(ut.flash[n]=!1,ut.flash[i]=!1),r[n]&&r[n].related))for(a=r[n].related.length-1;a>=0;a--)o["audio/"+r[n].related[a]]=o[n],ut.html5[r[n].related[a]]=o[n],ut.flash[r[n].related[a]]=o[n];return o.canPlayType=s?e:null,ut.html5=h(ut.html5,o),ut.html5.usingFlash=Q(),Ot=ut.html5.usingFlash,!0},M={},D=function(){},B=function(e){return 8===c&&1c&&(ut.flashVersion=c=9),ut.version=ut.versionNumber+(ut.html5Only?" (HTML5-only mode)":9===c?" (AS3/Flash 9)":" (AS2/Flash 8)"),c>8?(ut.defaultOptions=h(ut.defaultOptions,ut.flash9Options),ut.features.buffering=!0,ut.defaultOptions=h(ut.defaultOptions,ut.movieStarOptions),ut.filePatterns.flash9=RegExp("\\.(mp3|"+Xt.join("|")+")(\\?.*)?$","i"),ut.features.movieStar=!0):ut.features.movieStar=!1,ut.filePattern=ut.filePatterns[8!==c?"flash9":"flash8"],ut.movieURL=(8===c?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",e),ut.features.peakData=ut.features.waveformData=ut.features.eqData=c>8},E=function(e,t){return ct?void ct._setPolling(e,t):!1},R=function(){},z=this.getSoundById,F=function(){var e=[];return ut.debugMode&&e.push("sm2_debug"),ut.debugFlash&&e.push("flash_debug"),ut.useHighPerformance&&e.push("high_performance"),e.join(" ")},q=function(){D("fbHandler");var e=ut.getMoviePercent(),t={type:"FLASHBLOCK"};return ut.html5Only?!1:void(ut.ok()?ut.oMC&&(ut.oMC.className=[F(),"movieContainer","swf_loaded"+(ut.didFlashBlock?" swf_unblocked":"")].join(" ")):(Ot&&(ut.oMC.className=F()+" movieContainer "+(null===e?"swf_timedout":"swf_error")),ut.didFlashBlock=!0,v({type:"ontimeout",ignoreInit:!0,error:t}),I(t)))},g=function(e,n,i){mt[e]===t&&(mt[e]=[]),mt[e].push({method:n,scope:i||null,fired:!1})},v=function(e){if(e||(e={type:ut.ok()?"onready":"ontimeout"}),!yt&&e&&!e.ignoreInit||"ontimeout"===e.type&&(ut.ok()||_t&&!e.ignoreInit))return!1;var t,n={success:e&&e.ignoreInit?ut.ok():!_t},i=e&&e.type?mt[e.type]||[]:[],r=[],n=[n],a=Ot&&!ut.ok();for(e.error&&(n[0].error=e.error),e=0,t=i.length;t>e;e++)!0!==i[e].fired&&r.push(i[e]);if(r.length)for(e=0,t=r.length;t>e;e++)r[e].scope?r[e].method.apply(r[e].scope,n):r[e].method.apply(this,n),a||(r[e].fired=!0);return!0},y=function(){e.setTimeout(function(){ut.useFlashBlock&&q(),v(),"function"==typeof ut.onload&&ut.onload.apply(e),ut.waitForWindowLoad&&nt.add(e,"load",y)},1)},at=function(){if(rt!==t)return rt;var n,i=!1,r=navigator,a=r.plugins,s=e.ActiveXObject;if(a&&a.length)(r=r.mimeTypes)&&r["application/x-shockwave-flash"]&&r["application/x-shockwave-flash"].enabledPlugin&&r["application/x-shockwave-flash"].enabledPlugin.description&&(i=!0);else if(s!==t&&!dt.match(/MSAppHost/i)){try{n=new s("ShockwaveFlash.ShockwaveFlash")}catch(o){n=null}i=!!n}return rt=i},Q=function(){var e,t,n=ut.audioFormats;if(It&&dt.match(/os (1|2|3_0|3_1)/i)?(ut.hasHTML5=!1,ut.html5Only=!0,ut.oMC&&(ut.oMC.style.display="none")):!ut.useHTML5Audio||ut.html5&&ut.html5.canPlayType||(ut.hasHTML5=!1),ut.useHTML5Audio&&ut.hasHTML5)for(t in Y=!0,n)n.hasOwnProperty(t)&&n[t].required&&(ut.html5.canPlayType(n[t].type)?ut.preferFlash&&(ut.flash[t]||ut.flash[n[t].type])&&(e=!0):(Y=!1,e=!0));return ut.ignoreFlash&&(e=!1,Y=!0),ut.html5Only=ut.hasHTML5&&ut.useHTML5Audio&&!e,!ut.html5Only},X=function(e){var t,n,i=0;if(e instanceof Array){for(t=0,n=e.length;n>t;t++)if(e[t]instanceof Object){if(ut.canPlayMIME(e[t].type)){i=t;break}}else if(ut.canPlayURL(e[t])){i=t;break}e[i].url&&(e[i]=e[i].url),e=e[i]}return e},U=function(e){e._hasTimer||(e._hasTimer=!0,!Dt&&ut.html5PollingInterval&&(null===Tt&&0===Pt&&(Tt=setInterval(W,ut.html5PollingInterval)),Pt++))},N=function(e){e._hasTimer&&(e._hasTimer=!1,!Dt&&ut.html5PollingInterval&&Pt--)},W=function(){var e;if(null!==Tt&&!Pt)return clearInterval(Tt),Tt=null,!1;for(e=ut.soundIDs.length-1;e>=0;e--)ut.sounds[ut.soundIDs[e]].isHTML5&&ut.sounds[ut.soundIDs[e]]._hasTimer&&ut.sounds[ut.soundIDs[e]]._onTimer()},I=function(n){n=n!==t?n:{},"function"==typeof ut.onerror&&ut.onerror.apply(e,[{type:n.type!==t?n.type:null}]),n.fatal!==t&&n.fatal&&ut.disable()},st=function(){if(!qt||!at())return!1;var e,t,n=ut.audioFormats;for(t in n)if(n.hasOwnProperty(t)&&("mp3"===t||"mp4"===t)&&(ut.html5[t]=!1,n[t]&&n[t].related))for(e=n[t].related.length-1;e>=0;e--)ut.html5[n[t].related[e]]=!1},this._setSandboxType=function(){},this._externalInterfaceOK=function(){return ut.swfLoaded?!1:(ut.swfLoaded=!0,Bt=!1,qt&&st(),void setTimeout(p,Rt?100:1))},S=function(e,n){function i(e,t){return''}if(gt&&vt)return!1;if(ut.html5Only)return k(),ut.oMC=o(ut.movieID),p(),vt=gt=!0,!1;var r,a,s,l=n||ut.url,u=ut.altURL||l,c=j(),d=F(),h=null,h=ft.getElementsByTagName("html")[0],h=h&&h.dir&&h.dir.match(/rtl/i);if(e=e===t?ut.id:e,k(),ut.url=H(Ut?l:u),n=ut.url,ut.wmode=!ut.wmode&&ut.useHighPerformance?"transparent":ut.wmode,null!==ut.wmode&&(dt.match(/msie 8/i)||!Rt&&!ut.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(xt.push(M.spcWmode),ut.wmode=null),c={name:e,id:e,src:n,quality:"high",allowScriptAccess:ut.allowScriptAccess,bgcolor:ut.bgColor,pluginspage:Nt+"www.macromedia.com/go/getflashplayer",title:"JS/Flash audio component (SoundManager 2)",type:"application/x-shockwave-flash",wmode:ut.wmode,hasPriority:"true"},ut.debugFlash&&(c.FlashVars="debug=1"),ut.wmode||delete c.wmode,Rt)l=ft.createElement("div"),a=['"].join("");else for(r in l=ft.createElement("embed"),c)c.hasOwnProperty(r)&&l.setAttribute(r,c[r]);if(R(),d=F(),c=j())if(ut.oMC=o(ut.movieID)||ft.createElement("div"),ut.oMC.id)s=ut.oMC.className,ut.oMC.className=(s?s+" ":"movieContainer")+(d?" "+d:""),ut.oMC.appendChild(l),Rt&&(r=ut.oMC.appendChild(ft.createElement("div")),r.className="sm2-object-box",r.innerHTML=a),vt=!0;else{if(ut.oMC.id=ut.movieID,ut.oMC.className="movieContainer "+d,r=d=null,ut.useFlashBlock||(ut.useHighPerformance?d={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(d={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},h&&(d.left=Math.abs(parseInt(d.left,10))+"px"))),$t&&(ut.oMC.style.zIndex=1e4),!ut.debugFlash)for(s in d)d.hasOwnProperty(s)&&(ut.oMC.style[s]=d[s]);try{Rt||ut.oMC.appendChild(l),c.appendChild(ut.oMC),Rt&&(r=ut.oMC.appendChild(ft.createElement("div")),r.className="sm2-object-box",r.innerHTML=a),vt=!0}catch(f){throw Error(D("domError")+" \n"+f.toString())}}return gt=!0},P=function(){return ut.html5Only?(S(),!1):ct||!ut.url?!1:(ct=ut.getMovie(ut.id),ct||(bt?(Rt?ut.oMC.innerHTML=kt:ut.oMC.appendChild(bt),bt=null,gt=!0):S(ut.id,ut.url),ct=ut.getMovie(ut.id)),"function"==typeof ut.oninitmovie&&setTimeout(ut.oninitmovie,1),!0)},_=function(){setTimeout(w,1e3)},b=function(){e.setTimeout(function(){ut.setup({preferFlash:!1}).reboot(),ut.didFlashBlock=!0,ut.beginDelayedInit()},1)},w=function(){var t,n=!1;return!ut.url||Ct?!1:(Ct=!0,nt.remove(e,"load",_),rt&&Bt&&!Ft?!1:(yt||(t=ut.getMoviePercent(),t>0&&100>t&&(n=!0)),void setTimeout(function(){return t=ut.getMoviePercent(),n?(Ct=!1,e.setTimeout(_,1),!1):void(!yt&&Vt&&(null===t?ut.useFlashBlock||0===ut.flashLoadTimeout?ut.useFlashBlock&&q():!ut.useFlashBlock&&Y?b():v({type:"ontimeout",ignoreInit:!0,error:{type:"INIT_FLASHBLOCK"}}):0!==ut.flashLoadTimeout&&(!ut.useFlashBlock&&Y?b():L(!0))))},ut.flashLoadTimeout)))},C=function(){return Ft||!Bt?(nt.remove(e,"focus",C),!0):(Ft=Vt=!0,Ct=!1,_(),nt.remove(e,"focus",C),!0)},d=function(t){if(yt)return!1;if(ut.html5Only)return yt=!0,y(),!0;var n,i=!0;return ut.useFlashBlock&&ut.flashLoadTimeout&&!ut.getMoviePercent()||(yt=!0),n={type:!rt&&Ot?"NO_FLASH":"INIT_TIMEOUT"},(_t||t)&&(ut.useFlashBlock&&ut.oMC&&(ut.oMC.className=F()+" "+(null===ut.getMoviePercent()?"swf_timedout":"swf_error")),v({type:"ontimeout",error:n,ignoreInit:!0}),I(n),i=!1),_t||(ut.waitForWindowLoad&&!wt?nt.add(e,"load",y):y()),i},u=function(){var e,n=ut.setupOptions;for(e in n)n.hasOwnProperty(e)&&(ut[e]===t?ut[e]=n[e]:ut[e]!==n[e]&&(ut.setupOptions[e]=ut[e]))},p=function(){if(yt)return!1;if(ut.html5Only)return yt||(nt.remove(e,"load",ut.beginDelayedInit),ut.enabled=!0,d()),!0;P();try{ct._externalInterfaceTest(!1),E(!0,ut.flashPollingInterval||(ut.useHighPerformance?10:50)),ut.debugMode||ct._disableDebug(),ut.enabled=!0,ut.html5Only||nt.add(e,"unload",l)}catch(t){return I({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),L(!0),d(),!1}return d(),nt.remove(e,"load",ut.beginDelayedInit),!0},x=function(){return A?!1:(A=!0,u(),R(),!rt&&ut.hasHTML5&&ut.setup({useHTML5Audio:!0,preferFlash:!1}),tt(),!rt&&Ot&&(xt.push(M.needFlash),ut.setup({flashLoadTimeout:1})),ft.removeEventListener&&ft.removeEventListener("DOMContentLoaded",x,!1),P(),!0)},et=function(){return"complete"===ft.readyState&&(x(),ft.detachEvent("onreadystatechange",et)),!0},O=function(){wt=!0,nt.remove(e,"load",O)},T=function(){Dt&&(ut.setupOptions.useHTML5Audio=!0,ut.setupOptions.preferFlash=!1,It||Et&&!dt.match(/android\s2\.3/i))&&(It&&(ut.ignoreFlash=!0),jt=!0)},T(),at(),nt.add(e,"focus",C),nt.add(e,"load",_),nt.add(e,"load",O),ft.addEventListener?ft.addEventListener("DOMContentLoaded",x,!1):ft.attachEvent?ft.attachEvent("onreadystatechange",et):I({type:"NO_DOM2_EVENTS",fatal:!0})}var i=null;void 0!==e.SM2_DEFER&&SM2_DEFER||(i=new n),e.SoundManager=n,e.soundManager=i}(window),define("soundmanager2",function(e){return function(){var t;return t||e.soundManager}}(this)),define("text",["module"],function(e){var t,n,i,r,a,s=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],o=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,l=/]*>\s*([\s\S]+)\s*<\/body>/im,u="undefined"!=typeof location&&location.href,p=u&&location.protocol&&location.protocol.replace(/\:/,""),c=u&&location.hostname,d=u&&(location.port||void 0),h={},f=e.config&&e.config()||{};return t={version:"2.0.10",strip:function(e){if(e){e=e.replace(o,"");var t=e.match(l);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:f.createXhr||function(){var e,t,n;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(t=0;3>t;t+=1){n=s[t];try{e=new ActiveXObject(n)}catch(i){}if(e){s=[n];break}}return e},parseName:function(e){var t,n,i,r=!1,a=e.indexOf("."),s=0===e.indexOf("./")||0===e.indexOf("../");return-1!==a&&(!s||a>1)?(t=e.substring(0,a),n=e.substring(a+1,e.length)):t=e,i=n||t,a=i.indexOf("!"),-1!==a&&(r="strip"===i.substring(a+1),i=i.substring(0,a),n?n=i:t=i),{moduleName:t,ext:n,strip:r}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,i,r){var a,s,o,l=t.xdRegExp.exec(e);return l?(a=l[2],s=l[3],s=s.split(":"),o=s[1],s=s[0],!(a&&a!==n||s&&s.toLowerCase()!==i.toLowerCase()||(o||s)&&o!==r)):!0},finishLoad:function(e,n,i,r){i=n?t.strip(i):i,f.isBuild&&(h[e]=i),r(i)},load:function(e,n,i,r){if(r.isBuild&&!r.inlineText)return void i();f.isBuild=r.isBuild;var a=t.parseName(e),s=a.moduleName+(a.ext?"."+a.ext:""),o=n.toUrl(s),l=f.useXhr||t.useXhr;return 0===o.indexOf("empty:")?void i():void(!u||l(o,p,c,d)?t.get(o,function(n){t.finishLoad(e,a.strip,n,i)},function(e){i.error&&i.error(e)}):n([s],function(e){t.finishLoad(a.moduleName+"."+a.ext,a.strip,e,i)}))},write:function(e,n,i){if(h.hasOwnProperty(n)){var r=t.jsEscape(h[n]);i.asModule(e+"!"+n,"define(function () { return '"+r+"';});\n")}},writeFile:function(e,n,i,r,a){var s=t.parseName(n),o=s.ext?"."+s.ext:"",l=s.moduleName+o,u=i.toUrl(s.moduleName+o)+".js";t.load(l,i,function(){var n=function(e){return r(u,e)};n.asModule=function(e,t){return r.asModule(e,u,t)},t.write(e,l,n,a)},a)}},"node"===f.env||!f.env&&"undefined"!=typeof process&&process.versions&&process.versions.node&&!process.versions["node-webkit"]?(n=require.nodeRequire("fs"),t.get=function(e,t,i){try{var r=n.readFileSync(e,"utf8");0===r.indexOf("")&&(r=r.substring(1)),t(r)}catch(a){i(a)}}):"xhr"===f.env||!f.env&&t.createXhr()?t.get=function(e,n,i,r){var a,s=t.createXhr();if(s.open("GET",e,!0),r)for(a in r)r.hasOwnProperty(a)&&s.setRequestHeader(a.toLowerCase(),r[a]);f.onXhr&&f.onXhr(s,e),s.onreadystatechange=function(){var t,r;4===s.readyState&&(t=s.status,t>399&&600>t?(r=new Error(e+" HTTP status: "+t),r.xhr=s,i(r)):n(s.responseText),f.onXhrComplete&&f.onXhrComplete(s,e))},s.send(null)}:"rhino"===f.env||!f.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java?t.get=function(e,t){var n,i,r="utf-8",a=new java.io.File(e),s=java.lang.System.getProperty("line.separator"),o=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(a),r)),l="";try{for(n=new java.lang.StringBuffer,i=o.readLine(),i&&i.length()&&65279===i.charAt(0)&&(i=i.substring(1)),null!==i&&n.append(i);null!==(i=o.readLine());)n.append(s),n.append(i);l=String(n.toString())}finally{o.close()}t(l)}:("xpconnect"===f.env||!f.env&&"undefined"!=typeof Components&&Components.classes&&Components.interfaces)&&(i=Components.classes,r=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),a="@mozilla.org/windows-registry-key;1"in i,t.get=function(e,t){var n,s,o,l={};a&&(e=e.replace(/\//g,"\\")),o=new FileUtils.File(e);try{n=i["@mozilla.org/network/file-input-stream;1"].createInstance(r.nsIFileInputStream),n.init(o,1,0,!1),s=i["@mozilla.org/intl/converter-input-stream;1"].createInstance(r.nsIConverterInputStream),s.init(n,"utf-8",n.available(),r.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),s.readString(n.available(),l),s.close(),n.close(),t(l.value)}catch(u){throw new Error((o&&o.path||"")+": "+u)}}),t}),define("text!templates/spp-template.html",[],function(){return'\r\n\r\n\r\n'}),define("text!templates/player-template.html",[],function(){return'<% if ( data.show_logo != undefined && data.show_logo != null ) { %>\r\n \r\n
\r\n
\r\n<% } %>\r\n\r\n\r\n
<%= data.show_name %>
\r\n
<%= data.title %>
\r\n
\r\n \r\n
\r\n\r\n
\r\n \r\n
\r\n \r\n \r\n \r\n \r\n
\r\n\r\n
Show Notes\r\n \r\n
'}),define("text!templates/podcast-track-template.html",[],function(){return'\r\n
<%= parseInt( data.episode_number, 10) %>
\r\n
<%= data.title_without_episode_number %>
\r\n
'}),define("text!templates/playlist-template.html",[],function(){return'\r\n\r\n'}),define("text!templates/playlist-header-template.html",[],function(){return""}),define("text!templates/playlist-footer-template.html",[],function(){return'\r\n'}),define("text!templates/current-track-template.html",[],function(){return'\r\n\r\n
\r\n \r\n <%= show_notes %>\r\n
\r\n
\r\n
\r\n
\r\n
\r\n'}),define("apps/smart-podcast-player/core/view",["app","text!templates/spp-template.html","text!templates/player-template.html","text!templates/podcast-track-template.html","text!templates/playlist-template.html","text!templates/playlist-header-template.html","text!templates/playlist-footer-template.html","text!templates/current-track-template.html"],function(e,t){return e.module("AskPatPlayerApp.Core.View",function(e,n,i,r,a,s){e.AP_Player=r.Layout.extend({template:s.template(t),regions:{playerRegion:".spp-player-container",trackDetailsRegion:".spp-track-details-container",playlistRegion:".spp-playlist-container"},onRender:function(){this.$(".spp-player-container").show()}})}),e.AskPatPlayerApp.Core.View}),define("entities/podcast-track",["app"],function(e){e.module("Entities",function(e,t,n,i,r,a){var s=[],o=[],l=[];e.Player=n.Model.extend({defaults:{data:{}}}),e.Track=n.Model.extend({defaults:{data:{active:!1,artwork_url:"",attachments_uri:"",bpm:null,comment_count:0,commentable:!0,created_at:"",current_time:"0:00:00",description:"",download_count:0,download_url:"",downloadable:!0,download:!0,duration:0,duration_time:"0:00:00",episode_number:0,embeddable_by:"all",email:"",fallback_permalink:"",favoritings_count:0,genre:"",id:0,isrc:"",key_signature:"",kind:"track",label_id:null,label_name:"",license:"",method:"file",original_content_size:0,original_format:"mp3",permalink:"",permalink_url:"",playing:!1,playback_count:0,purchase_title:null,purchase_url:null,release:"",release_day:null,release_month:null,release_year:null,sharing:"",show_name:"",state:"",stream_url:"",streamable:!0,subscription:"",tag_list:"",tags:"",tag_string:"",title:"",track_type:"",uri:"",user:{avatar_url:"",id:0,kind:"user",permalink:"",permalink_url:"",uri:"",username:""},user_id:0,video_url:null,waveform_url:"",show_notes:""}}}),e.Tracks=n.Collection.extend({model:e.Track,comparators:{newest:function(e){return-e.get("id")},oldest:function(e){return e.get("id")},mostPopular:function(e){return-e.get("playback_count")},leastPopular:function(e){return e.get("playback_count")}},setComparator:function(e){return this.comparator=this.comparators[e],this},totalPlaybackCount:function(){return this.reduce(function(e,t){var n=t.get("data");return n.playback_count},0)}});var u=function(t){var n,i=t.model.get("options"),a=t.model.get("region"),o=i.stream,l=new Array,u={action:"get_soundcloud_tracks",stream:o};if(r.ajax({url:AP_Player.ajaxurl,dataType:"json",type:"POST",async:!1,data:u,success:function(e){n=e}}),void 0!=n&&null!=n){var p=n.length;r.each(n,function(n,r){var a=/(?:[^\s"]+|"[^"]*")+/g;if(void 0!==r.tag_list&&""!=r.tag_list.trim()){var s=r.tag_list.match(a);s=s.join(",").replace(/\"|\"|\"|\"/g,"").toLowerCase(),r.tag_string=s,s=s.split(","),r.tags=s}else r.tags=new Array;var o=Math.ceil(r.duration/1e3),u=Math.floor(o/60),c=Math.floor(u/60),d=c,h=u%60,f=o%60;if(r.duration_time=d+":"+pad(h,2)+":"+pad(f,2),r.playing=!1,void 0!=i.numbering){var m=i.numbering,g=(m.split("#").length-1,new RegExp("[#]{1,10}")),v=m.replace(g,"([0-9]{0,4})"),y=r.title.match(v);y&&(r.episode_number=y[1]);var _=new RegExp(v,"g");r.title_without_episode_number=r.title.replace(_,"")}else r.title_without_episode_number=r.title,r.episode_number=p;r.download=i.download,r.social=i.social,r.poweredby=i.poweredby,r.show_logo=void 0!==i.show_image?i.show_image:r.artwork_url,r.show_name=i.show_name,r.hashtag=i.hashtag,r.fallback_permalink=void 0!=i.permalink?i.permalink:"",r.email="?subject=",r.email+=void 0!==r.show_name?": "+encodeURIComponent(r.title)+"&body=Hi,%0D%0A%0D%0AI thought you might enjoy this episode of "+r.show_name+":%0D%0A%0D%0A"+r.title+"%0D%0A":": "+encodeURIComponent(r.title)+"&body=Hi,%0D%0A%0D%0AI thought you might enjoy this podcast:%0D%0A%0D%0A"+r.title+"%0D%0A",r.email+=""!=r.permalink_url?r.permalink_url+"%0D%0A%0D%0AEnjoy!":r.fallback_permalink+"%0D%0A%0D%0AEnjoy!",r.method=r.permalink_url.indexOf("soundcloud.com")>0?"soundcloud":"file";var w=/\n/g;if("soundcloud"==r.method){r.show_notes=""+r.description+"
",r.show_notes=replaceURLWithHTMLLinks(r.show_notes),r.show_notes=r.show_notes.replace(w,"
");var b=/
\s*<\/p>/g;r.show_notes=r.show_notes.replace(b,"")}else r.show_notes=r.description;void 0!=t.model.attributes.options.subscription&&(r.subscription=t.model.attributes.options.subscription),r.stream_url=r.stream_url.indexOf("&")>-1?r.stream_url.slice(0,r.stream_url.indexOf("&")):r.stream_url;var k={data:r},C=new e.Track(k),M=C.get("data");M.cid=C.cid,C.set({data:M}),l.push(C),p--})}"oldest"==t.model.attributes.options.sort&&l.reverse(),s[a]=new e.Tracks(l)},p=function(t,n,i){var r=t.model.get("region");if(""==i)l[r]=s[r];else{var o=n.filter(function(e){{var t=e.get("data");t.tags}return a.indexOf(t.tags,i)>-1});l[r]=new e.Tracks(o)}return l[r]},c=function(t,n,i,a){var s=t.model.get("region"),o=new Array,u=(i-1)*a,p=i*a;return r.each(n.models,function(e,t){e>=u&&p>e&&o.push(t)}),l[s]=new e.Tracks(o),l[s]},d=function(e){var t=e.model.get("region");void 0===o[t]&&f(e);var n=o[t].find(function(e){var t=e.attributes.data;return t.playing===!0});return n?n:o[t].first()},h=function(e,t){var n=e.find(function(e){var n=e.attributes.data;return n.id===t});return n?n:-1},f=function(e){var t=e.model.get("region");return void 0===o[t]&&(void 0===s[t]&&u(e),o[t]=s[t]),o[t]},m={getTrackEntities:function(e){var t=e.model.get("region");return void 0===s[t]&&u(e),s[t]},getCurrentTrack:function(e){return d(e)},getPagedTracks:function(e,t,n,i){return c(e,t,n,i)},getCurrentTracks:function(e){return f(e)},getTracksByTag:function(e,t,n){var i=e.model.get("region");return l[i]=p(e,t,n),o[i]=l[i],l[i]},setValueAll:function(e,t,n){var i=e.model.get("region");void 0===o[i]&&f(e),s[i].each(function(e){var i=e.get("data");i[t]=n,e.set({data:i})}),o[i].each(function(e){var i=e.get("data");i[t]=n,e.set({data:i})})},setValue:function(e,t,n,i){var r=e.model.get("region");void 0===o[r]&&f(e);var a=h(s[r],t.attributes.data.id),l=h(o[r],t.attributes.data.id),u=o[r].at(o[r].indexOf(l)),p=u.get("data");p[n]=i;var c=(s[r].at(s[r].indexOf(a)),u.get("data"));c[n]=i}};t.reqres.setHandler("track:entities",function(e){return m.getTrackEntities(e)}),t.reqres.setHandler("track:entity:current",function(e){return m.getCurrentTrack(e)}),t.reqres.setHandler("track:entities:current",function(e){return m.getCurrentTracks(e)}),t.reqres.setHandler("track:entities:paged",function(e,t,n,i){return m.getPagedTracks(e,t,n,i)}),t.reqres.setHandler("track:entities:tagged",function(e,t,n){return m.getTracksByTag(e,t,n)}),t.reqres.setHandler("track:entities:set",function(e,t,n){m.setValueAll(e,t,n)}),t.reqres.setHandler("track:entity:set",function(e,t,n,i){m.setValue(e,t,n,i)})})}),define("entities/podcast-player",["app","entities/podcast-track"],function(e){return e.module("Entities",function(e,t){var n=[],i=function(e){var i=e.model.get("region");n[i]=t.request("track:entity:current",e)},r={getPlayerEntities:function(e){var t=e.model.get("region");return void 0===n[t]&&i(e),n[t]}};t.reqres.setHandler("player:entity",function(e){return r.getPlayerEntities(e)})}),e.Entities}),define("apps/smart-podcast-player/core/controller",["app","apps/smart-podcast-player/core/view","entities/podcast-track","entities/podcast-player","soundmanager2"],function(e,t){return e.module("AskPatPlayerApp.Core",function(e,n,i,r,a){e.Controller={init:function(){a(".smart-podcast-player").length>0&&n.trigger("core:color:setup"),a(".smart-podcast-player").each(function(e,r){var s="SPP_"+e,o=new t.AP_Player({model:new i.Model({region:s,options:{stream:a(r).data("stream"),sort:a(r).data("sort"),show_name:a(r).data("showName"),color:a(r).data("color"),link_color:a(r).data("link_color"),numbering:a(r).data("numbering"),download:a(r).data("download"),subscription:a(r).data("subscription"),show_image:a(r).data("image"),player_uid:a(r).data("uid"),hashtag:a(r).data("hashtag"),social:a(r).data("social"),poweredby:a(r).data("poweredby"),permalink:a(r).data("permalink"),current_page:1,tracks_per_page:10,consumer_key:AP_Player.soundcloudConsumerKey}})}),l=new i.Marionette.Region({el:a(r)});
n.regions=n.regions?n.regions:{},n[s]=l,n.trigger("playlist:init",o),n.trigger("track-details:init",o),n.trigger("player:init",o),n[s].show(o);var u="?spp_view=1",p=o.model.get("options");u+="&url="+(void 0!=p.stream?p.stream:""),u+="&sort="+(void 0!=p.sort?encodeURIComponent(p.sort):""),u+="&numbering="+(void 0!=p.numbering?encodeURIComponent(p.numbering):""),u+="&download="+(void 0!=p.download?encodeURIComponent(p.download):""),u+="&subscription="+(void 0!=p.subscription?p.subscription:""),u+="&show_name="+(void 0!=p.show_name?encodeURIComponent(p.show_name):""),u+="&image="+(void 0!=p.image?encodeURIComponent(p.image):""),u+="&social="+(void 0!=p.social?encodeURIComponent(p.social):""),u+="&poweredby="+(void 0!=p.poweredby?encodeURIComponent(p.poweredby):""),u+="&color="+(void 0!=p.color?encodeURIComponent(p.color):""),u+="&link_color="+(void 0!=p.link_color?encodeURIComponent(p.link_color):""),u+="&subscription="+(void 0!=p.subscription?encodeURIComponent(p.subscription):"")})},setupColors:function(){var e=new Array,t=new Array;a(".smart-podcast-player").each(function(n,i){var r=a(i).attr("class"),s=r.trim().split(/\s+/);a.each(s,function(n,i){var r=i.indexOf("spp-color-");if(r>-1){var s=i.replace("spp-color-","");-1==a.inArray(s,e)&&e.push(s)}var r=i.indexOf("spp-link-color-");if(r>-1){var s=i.replace("spp-link-color-","");-1==a.inArray(s,t)&&t.push(s)}})});var n={action:"get_colors",spp_colors:e,spp_link_colors:t};a.post(AP_Player.ajaxurl,n,function(e){a("head").append(e)})}}}),e.AskPatPlayerApp.Core.Controller}),define("apps/smart-podcast-player/playlist/view",["app","text!templates/podcast-track-template.html","text!templates/playlist-template.html","text!templates/playlist-header-template.html","text!templates/playlist-footer-template.html"],function(e,t,n,i,r){return e.module("AskPatPlayerApp.Playlist.View",function(e,a,s,o,l,u){e.Track=o.ItemView.extend({template:u.template(t),className:"spp-track",triggers:{"click .spp-play":"track:play","click .spp-track-title":"track:preview"},modelEvents:{change:"render"},events:{},initialize:function(){this.spp_elements={spp:null,loaded_container:null,loaded:null,duration:null,position:null,current_time:null};var e=this.model.get("data"),t="track_"+this.model.cid,n=(e.stream_url+"?consumer_key="+AP_Player.soundcloudConsumerKey,soundManager.getSoundById(t));n||this.createSound()},createSound:function(){var e=this,t=this.model.get("data"),n="track_"+this.model.cid,i=t.stream_url+"?consumer_key="+AP_Player.soundcloudConsumerKey;soundManager.createSound({id:n,url:i,hover:!1,onplay:function(){e.spp_elements.spp=null!==e.spp_elements.spp?e.spp_elements.spp:l(e.$el).parents(".smart-podcast-player"),l(e.spp_elements.spp).addClass("spp-playing")},onresume:function(){e.spp_elements.spp=null!==e.spp_elements.spp?e.spp_elements.spp:l(e.$el).parents(".smart-podcast-player"),l(e.spp_elements.spp).addClass("spp-playing")},onpause:function(){e.spp_elements.spp=null!==e.spp_elements.spp?e.spp_elements.spp:l(e.$el).parents(".smart-podcast-player"),l(e.spp_elements.spp).removeClass("spp-playing")},onfinish:function(){e.trigger("track:next")},whileloading:function(){var t=this.bytesLoaded/this.bytesTotal*100+"%";e.spp_elements.spp=null!==e.spp_elements.spp?e.spp_elements.spp:l(e.$el).parents(".smart-podcast-player"),e.spp_elements.loaded_container=null!==e.spp_elements.loaded_container?e.spp_elements.loaded_container:l(e.spp_elements.spp).find(".spp-loaded-container"),e.spp_elements.loaded=null!==e.spp_elements.loaded?e.spp_elements.loaded:l(e.spp_elements.loaded_container).find(".spp-loaded"),l(e.spp_elements.loaded).css({width:t}),this.bytesLoaded/this.bytesTotal>.98&&l(e.spp_elements.loaded_container).fadeOut("slow")},whileplaying:function(){var t,n,i,r,a=this.durationEstimate,s=this.position,o=a-s;t=s/1e3,n=t/60,i=n/60,r=Math.floor(i)+":"+pad(Math.floor(n%60),2)+":"+pad(Math.floor(t%60),2),t=o/1e3,n=t/60,i=n/60,remaining_time=pad(Math.floor(n),2)+":"+pad(Math.floor(t%60),2),e.spp_elements.spp=null!==e.spp_elements.spp?e.spp_elements.spp:l(e.$el).parents(".smart-podcast-player"),e.spp_elements.duration=null!==e.spp_elements.duration?e.spp_elements.duration:l(e.spp_elements.spp).find(".spp-duration"),e.spp_elements.current_time=null!==e.spp_elements.current_time?e.spp_elements.current_time:l(e.spp_elements.spp).find(".spp-current-time"),e.spp_elements.position=null!==e.spp_elements.position?e.spp_elements.position:l(e.spp_elements.spp).find(".spp-position"),l(e.spp_elements.duration).text("-"+remaining_time);var u=s/a*100;e.trigger("track:progress:update",u),l(e.spp_elements.current_time).css({width:u+"%"});var p=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);(!l(e.spp_elements.spp).hasClass("hover")||p)&&l(e.spp_elements.position).css({left:u+"%"})}})},onRender:function(){var e=this.model.get("data"),t="track_"+this.model.cid;e.active===!0&&this.$el.addClass("active"),this.$el.attr("data-tid",t)}}),e.Tracks=o.CollectionView.extend({itemView:e.Track,className:"spp-track-list",initialize:function(){var e=this;l(window).on("spp_resize",function(){e.resize()})},resize:function(){this.trigger("resize")}}),e.PlaylistRegion=o.Layout.extend({template:u.template(n),className:"spp-playlist",regions:{headerRegion:".spp-playlist-header",tracksRegion:".spp-playlist-tracks",footerRegion:".spp-playlist-footer"}}),e.PlaylistHeader=o.ItemView.extend({template:u.template(i),className:"spp-playlist-header",initialize:function(){this.render()},triggers:{"click h3 span":"tracks:filter","change .spp-playlist-sorter":"tracks:sort"},events:{"click .spp-playlist-tag":"filterTag"},filterTag:function(e){this.trigger("playlist:filter",l(e.currentTarget).text())}}),e.PlaylistFooter=o.ItemView.extend({template:u.template(r),className:"spp-playlist-footer",triggers:{"click .spp-playlist-next-page":"nav:next-page","click .spp-playlist-prev-page":"nav:prev-page","click .spp-sort":"playlist:sort"},initialize:function(){this.render()}})}),e.AskPatPlayerApp.Playlist.View}),define("entities/playlist",["app","entities/podcast-track"],function(e){return e.module("Entities",function(e,t,n){var i=[],r=[];e.PlaylistHeader=n.Model.extend({defaults:{data:{}}}),e.PlaylistFooter=n.Model.extend({defaults:{data:{}}});var a=function(t){var n=t.model.get("region");i[n]=new e.PlaylistHeader({})},s=function(n){var i=t.request("track:entities",n),a=n.model.get("region"),s=n.model.get("options"),o={current_page:1,num_pages:Math.ceil(i.length/s.tracks_per_page)};r[a]=new e.PlaylistFooter({data:o})},o={getPlaylistHeader:function(e){var t=e.model.get("region");return void 0===i[t]&&a(e),i[t]},getPlaylistFooter:function(e){var t=e.model.get("region");return void 0===r[t]&&s(e),r[t]}};t.reqres.setHandler("playlist:header",function(e){return o.getPlaylistHeader(e)}),t.reqres.setHandler("playlist:footer",function(e){return o.getPlaylistFooter(e)})}),e.Entities}),function(e){function t(){this===r.elem&&(r.pos=[-260,-260],r.elem=!1,a=3)}var n,i,r={pos:[-260,-260]},a=3,s=document,o=s.documentElement,l=s.body;e.event.special.mwheelIntent={setup:function(){var n=e(this).bind("mousewheel",e.event.special.mwheelIntent.handler);return this!==s&&this!==o&&this!==l&&n.bind("mouseleave",t),n=null,!0},teardown:function(){return e(this).unbind("mousewheel",e.event.special.mwheelIntent.handler).unbind("mouseleave",t),!0},handler:function(t){var s=[t.clientX,t.clientY];return this===r.elem||Math.abs(r.pos[0]-s[0])>a||Math.abs(r.pos[1]-s[1])>a?(r.elem=this,r.pos=s,a=250,clearTimeout(i),i=setTimeout(function(){a=10},200),clearTimeout(n),n=setTimeout(function(){a=3},1500),t=e.extend({},t,{type:"mwheelIntent"}),(e.event.dispatch||e.event.handle).apply(this,arguments)):void 0}},e.fn.extend({mwheelIntent:function(e){return e?this.bind("mwheelIntent",e):this.trigger("mwheelIntent")},unmwheelIntent:function(e){return this.unbind("mwheelIntent",e)}}),e(function(){l=s.body,e(s).bind("mwheelIntent.mwheelIntentDefault",e.noop)})}(jQuery),define("mwheel-intent",function(){}),function(e){"function"==typeof define&&define.amd?define("vendor/jquery.mousewheel",["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var s=t||window.event,o=l.call(arguments,1),u=0,p=0,c=0,d=0;if(t=e.event.fix(s),t.type="mousewheel","detail"in s&&(c=-1*s.detail),"wheelDelta"in s&&(c=s.wheelDelta),"wheelDeltaY"in s&&(c=s.wheelDeltaY),"wheelDeltaX"in s&&(p=-1*s.wheelDeltaX),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(p=-1*c,c=0),u=0===c?p:c,"deltaY"in s&&(c=-1*s.deltaY,u=c),"deltaX"in s&&(p=s.deltaX,0===c&&(u=-1*p)),0!==c||0!==p){if(1===s.deltaMode){var h=e.data(this,"mousewheel-line-height");u*=h,c*=h,p*=h}else if(2===s.deltaMode){var f=e.data(this,"mousewheel-page-height");u*=f,c*=f,p*=f}return d=Math.max(Math.abs(c),Math.abs(p)),(!a||a>d)&&(a=d,i(s,d)&&(a/=40)),i(s,d)&&(u/=40,p/=40,c/=40),u=Math[u>=1?"floor":"ceil"](u/a),p=Math[p>=1?"floor":"ceil"](p/a),c=Math[c>=1?"floor":"ceil"](c/a),t.deltaX=p,t.deltaY=c,t.deltaFactor=a,t.deltaMode=0,o.unshift(t,u,p,c),r&&clearTimeout(r),r=setTimeout(n,200),(e.event.dispatch||e.event.handle).apply(this,o)}}function n(){a=null}function i(e,t){return p.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var r,a,s=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],o="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var u=s.length;u;)e.event.fixHooks[s[--u]]=e.event.mouseHooks;var p=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var n=o.length;n;)this.addEventListener(o[--n],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",p.getLineHeight(this)),e.data(this,"mousewheel-page-height",p.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=o.length;e;)this.removeEventListener(o[--e],t,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),!function(e,t,n){e.fn.jScrollPane=function(i){function r(i,r){function a(t){var r,o,u,c,d,h,g=!1,v=!1;if(B=t,V===n)d=i.scrollTop(),h=i.scrollLeft(),i.css({overflow:"hidden",padding:0}),z=i.innerWidth()+_t,U=i.innerHeight(),i.width(z),V=e('
').css("padding",yt).append(i.children()),N=e('').css({width:z+"px",height:U+"px"}).append(V).appendTo(i);else{if(i.css("width",""),g=B.stickToBottom&&O(),v=B.stickToRight&&A(),c=i.innerWidth()+_t!=z||i.outerHeight()!=U,c&&(z=i.innerWidth()+_t,U=i.innerHeight(),N.css({width:z+"px",height:U+"px"})),!c&&wt==W&&V.outerHeight()==X)return void i.width(z);wt=W,V.css("width",""),i.width(z),N.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}V.css("overflow","auto"),W=t.contentWidth?t.contentWidth:V[0].scrollWidth,X=V[0].scrollHeight,V.css("overflow",""),Y=W/z,Q=X/U,J=Q>1,G=Y>1,G||J?(i.addClass("jspScrollable"),r=B.maintainPosition&&(et||it),r&&(o=T(),u=x()),s(),l(),p(),r&&(M(v?W-z:o,!1),C(g?X-U:u,!1)),E(),j(),q(),B.enableKeyboardNavigation&&$(),B.clickOnTrack&&f(),H(),B.hijackInternalLinks&&D()):(i.removeClass("jspScrollable"),V.css({top:0,left:0,width:N.width()-_t}),S(),R(),L(),m()),B.autoReinitialise&&!vt?vt=setInterval(function(){a(B)},B.autoReinitialiseDelay):!B.autoReinitialise&&vt&&clearInterval(vt),d&&i.scrollTop(0)&&C(d,!1),h&&i.scrollLeft(0)&&M(h,!1),i.trigger("jsp-initialised",[G||J])}function s(){J&&(N.append(e('').append(e(''),e('').append(e('').append(e(''),e(''))),e(''))),rt=N.find(">.jspVerticalBar"),at=rt.find(">.jspTrack"),K=at.find(">.jspDrag"),B.showArrows&&(ut=e('').bind("mousedown.html",d(0,-1)).bind("click.html",I),pt=e('').bind("mousedown.html",d(0,1)).bind("click.html",I),B.arrowScrollOnHover&&(ut.bind("mouseover.html",d(0,-1,ut)),pt.bind("mouseover.html",d(0,1,pt))),c(at,B.verticalArrowPositions,ut,pt)),ot=U,N.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){ot-=e(this).outerHeight()}),K.hover(function(){K.addClass("jspHover")},function(){K.removeClass("jspHover")}).bind("mousedown.html",function(t){e("html").bind("dragstart.jsp%20selectstart.html",I),K.addClass("jspActive");var n=t.pageY-K.position().top;return e("html").bind("mousemove.html",function(e){v(e.pageY-n,!1)}).bind("mouseup.jsp%20mouseleave.html",g),!1}),o())}function o(){at.height(ot+"px"),et=0,st=B.verticalGutter+at.outerWidth(),V.width(z-st-_t);try{0===rt.position().left&&V.css("margin-left",st+"px")}catch(e){}}function l(){G&&(N.append(e('').append(e(''),e('').append(e('').append(e(''),e(''))),e(''))),ct=N.find(">.jspHorizontalBar"),dt=ct.find(">.jspTrack"),tt=dt.find(">.jspDrag"),B.showArrows&&(mt=e('').bind("mousedown.html",d(-1,0)).bind("click.html",I),gt=e('').bind("mousedown.html",d(1,0)).bind("click.html",I),B.arrowScrollOnHover&&(mt.bind("mouseover.html",d(-1,0,mt)),gt.bind("mouseover.html",d(1,0,gt))),c(dt,B.horizontalArrowPositions,mt,gt)),tt.hover(function(){tt.addClass("jspHover")},function(){tt.removeClass("jspHover")}).bind("mousedown.html",function(t){e("html").bind("dragstart.jsp%20selectstart.html",I),tt.addClass("jspActive");var n=t.pageX-tt.position().left;return e("html").bind("mousemove.html",function(e){_(e.pageX-n,!1)}).bind("mouseup.jsp%20mouseleave.html",g),!1}),ht=N.innerWidth(),u())}function u(){N.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){ht-=e(this).outerWidth()}),dt.width(ht+"px"),it=0}function p(){if(G&&J){var t=dt.outerHeight(),n=at.outerWidth();ot-=t,e(ct).find(">.jspCap:visible,>.jspArrow").each(function(){ht+=e(this).outerWidth()}),ht-=n,U-=n,z-=t,dt.parent().append(e('').css("width",t+"px")),o(),u()}G&&V.width(N.outerWidth()-_t+"px"),X=V.outerHeight(),Q=X/U,G&&(ft=Math.ceil(1/Y*ht),ft>B.horizontalDragMaxWidth?ft=B.horizontalDragMaxWidth:ftB.verticalDragMaxHeight?lt=B.verticalDragMaxHeight:lts)et-p>n?bt.scrollByY(-a):v(n);else{if(!(s>0))return void u();n>et+p?bt.scrollByY(a):v(n)}i=setTimeout(l,o?B.initialDelay:B.trackClickRepeatFreq),o=!1},u=function(){i&&clearTimeout(i),i=null,e(document).unbind("mouseup.html",u)};return l(),e(document).bind("mouseup.html",u),!1}}),G&&dt.bind("mousedown.html",function(t){if(t.originalTarget===n||t.originalTarget==t.currentTarget){var i,r=e(this),a=r.offset(),s=t.pageX-a.left-it,o=!0,l=function(){var e=r.offset(),n=t.pageX-e.left-ft/2,a=z*B.scrollPagePercent,p=nt*a/(W-z);if(0>s)it-p>n?bt.scrollByX(-a):_(n);else{if(!(s>0))return void u();n>it+p?bt.scrollByX(a):_(n)}i=setTimeout(l,o?B.initialDelay:B.trackClickRepeatFreq),o=!1},u=function(){i&&clearTimeout(i),i=null,e(document).unbind("mouseup.html",u)};return l(),e(document).bind("mouseup.html",u),!1}})}function m(){dt&&dt.unbind("mousedown.html"),at&&at.unbind("mousedown.html")}function g(){e("html").unbind("dragstart.jsp%20selectstart.jsp%20mousemove.jsp%20mouseup.jsp%20mouseleave.html"),K&&K.removeClass("jspActive"),tt&&tt.removeClass("jspActive")}function v(e,t){J&&(0>e?e=0:e>Z&&(e=Z),t===n&&(t=B.animateScroll),t?bt.animate(K,"top",e,y):(K.css("top",e),y(e)))}function y(e){e===n&&(e=K.position().top),N.scrollTop(0),et=e;var t=0===et,r=et==Z,a=e/Z,s=-a*(X-U);(kt!=t||Mt!=r)&&(kt=t,Mt=r,i.trigger("jsp-arrow-change",[kt,Mt,Ct,Pt])),b(t,r),V.css("top",s),i.trigger("jsp-scroll-y",[-s,t,r]).trigger("scroll")}function _(e,t){G&&(0>e?e=0:e>nt&&(e=nt),t===n&&(t=B.animateScroll),t?bt.animate(tt,"left",e,w):(tt.css("left",e),w(e)))}function w(e){e===n&&(e=tt.position().left),N.scrollTop(0),it=e;var t=0===it,r=it==nt,a=e/nt,s=-a*(W-z);(Ct!=t||Pt!=r)&&(Ct=t,Pt=r,i.trigger("jsp-arrow-change",[kt,Mt,Ct,Pt])),k(t,r),V.css("left",s),i.trigger("jsp-scroll-x",[-s,t,r]).trigger("scroll")}function b(e,t){B.showArrows&&(ut[e?"addClass":"removeClass"]("jspDisabled"),pt[t?"addClass":"removeClass"]("jspDisabled"))}function k(e,t){B.showArrows&&(mt[e?"addClass":"removeClass"]("jspDisabled"),gt[t?"addClass":"removeClass"]("jspDisabled"))}function C(e,t){var n=e/(X-U);v(n*Z,t)}function M(e,t){var n=e/(W-z);_(n*nt,t)}function P(t,n,i){var r,a,s,o,l,u,p,c,d,h=0,f=0;try{r=e(t)}catch(m){return}for(a=r.outerHeight(),s=r.outerWidth(),N.scrollTop(0),N.scrollLeft(0);!r.is(".jspPane");)if(h+=r.position().top,f+=r.position().left,r=r.offsetParent(),/^body|html$/i.test(r[0].nodeName))return;o=x(),u=o+U,o>h||n?c=h-B.horizontalGutter:h+a>u&&(c=h-U+a+B.horizontalGutter),isNaN(c)||C(c,i),l=T(),p=l+z,l>f||n?d=f-B.horizontalGutter:f+s>p&&(d=f-z+s+B.horizontalGutter),isNaN(d)||M(d,i)}function T(){return-V.position().left}function x(){return-V.position().top}function O(){var e=X-U;return e>20&&e-x()<10}function A(){var e=W-z;return e>20&&e-T()<10}function j(){N.unbind(xt).bind(xt,function(e,t,n,i){var r=it,a=et,s=e.deltaFactor||B.mouseWheelSpeed;return bt.scrollBy(n*s,-i*s,!1),r==it&&a==et})}function S(){N.unbind(xt)}function I(){return!1}function E(){V.find(":input,a").unbind("focus.html").bind("focus.html",function(e){P(e.target,!1)})}function R(){V.find(":input,a").unbind("focus.html")}function $(){function t(){var e=it,t=et;switch(n){case 40:bt.scrollByY(B.keyboardSpeed,!1);break;case 38:bt.scrollByY(-B.keyboardSpeed,!1);break;case 34:case 32:bt.scrollByY(U*B.scrollPagePercent,!1);break;case 33:bt.scrollByY(-U*B.scrollPagePercent,!1);break;case 39:bt.scrollByX(B.keyboardSpeed,!1);break;case 37:bt.scrollByX(-B.keyboardSpeed,!1)}return r=e!=it||t!=et}var n,r,a=[];G&&a.push(ct[0]),J&&a.push(rt[0]),V.focus(function(){i.focus()}),i.attr("tabindex",0).unbind("keydown.jsp%20keypress.html").bind("keydown.html",function(i){if(i.target===this||a.length&&e(i.target).closest(a).length){var s=it,o=et;switch(i.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:n=i.keyCode,t();break;case 35:C(X-U),n=null;break;case 36:C(0),n=null}return r=i.keyCode==n&&s!=it||o!=et,!r}}).bind("keypress.html",function(e){return e.keyCode==n&&t(),!r}),B.hideFocus?(i.css("outline","none"),"hideFocus"in N[0]&&i.attr("hideFocus",!0)):(i.css("outline",""),"hideFocus"in N[0]&&i.attr("hideFocus",!1))}function L(){i.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp%20keypress.html")}function H(){if(location.hash&&location.hash.length>1){var t,n,i=escape(location.hash.substr(1));try{t=e("#"+i+', a[name="'+i+'"]')}catch(r){return}t.length&&V.find(i)&&(0===N.scrollTop()?n=setInterval(function(){N.scrollTop()>0&&(P(t,!0),e(document).scrollTop(N.position().top),clearInterval(n))},50):(P(t,!0),e(document).scrollTop(N.position().top)))}}function D(){e(document.body).data("jspHijack")||(e(document.body).data("jspHijack",!0),e(document.body).delegate("a[href*=#]","click",function(n){var i,r,a,s,o,l,u=this.href.substr(0,this.href.indexOf("#")),p=location.href;if(-1!==location.href.indexOf("#")&&(p=location.href.substr(0,location.href.indexOf("#"))),u===p){i=escape(this.href.substr(this.href.indexOf("#")+1));try{r=e("#"+i+', a[name="'+i+'"]')}catch(c){return}r.length&&(a=r.closest(".jspScrollable"),s=a.data("jsp"),s.scrollToElement(r,!0),a[0].scrollIntoView&&(o=e(t).scrollTop(),l=r.offset().top,(o>l||l>o+e(t).height())&&a[0].scrollIntoView()),n.preventDefault())}}))}function q(){var e,t,n,i,r,a=!1;N.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(s){var o=s.originalEvent.touches[0];e=T(),t=x(),n=o.pageX,i=o.pageY,r=!1,a=!0}).bind("touchmove.jsp",function(s){if(a){var o=s.originalEvent.touches[0],l=it,u=et;return bt.scrollTo(e+n-o.pageX,t+i-o.pageY),r=r||Math.abs(n-o.pageX)>5||Math.abs(i-o.pageY)>5,l==it&&u==et}}).bind("touchend.jsp",function(){a=!1}).bind("click.jsp-touchclick",function(){return r?(r=!1,!1):void 0})}function F(){var e=x(),t=T();i.removeClass("jspScrollable").unbind(".jsp"),i.replaceWith(Tt.append(V.children())),Tt.scrollTop(e),Tt.scrollLeft(t),vt&&clearInterval(vt)}var B,V,z,U,N,W,X,Y,Q,J,G,K,Z,et,tt,nt,it,rt,at,st,ot,lt,ut,pt,ct,dt,ht,ft,mt,gt,vt,yt,_t,wt,bt=this,kt=!0,Ct=!0,Mt=!1,Pt=!1,Tt=i.clone(!1,!1).empty(),xt=e.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";"border-box"===i.css("box-sizing")?(yt=0,_t=0):(yt=i.css("paddingTop")+" "+i.css("paddingRight")+" "+i.css("paddingBottom")+" "+i.css("paddingLeft"),_t=(parseInt(i.css("paddingLeft"),10)||0)+(parseInt(i.css("paddingRight"),10)||0)),e.extend(bt,{reinitialise:function(t){t=e.extend({},B,t),a(t)},scrollToElement:function(e,t,n){P(e,t,n)},scrollTo:function(e,t,n){M(e,n),C(t,n)},scrollToX:function(e,t){M(e,t)},scrollToY:function(e,t){C(e,t)},scrollToPercentX:function(e,t){M(e*(W-z),t)},scrollToPercentY:function(e,t){C(e*(X-U),t)},scrollBy:function(e,t,n){bt.scrollByX(e,n),bt.scrollByY(t,n)},scrollByX:function(e,t){var n=T()+Math[0>e?"floor":"ceil"](e),i=n/(W-z);_(i*nt,t)},scrollByY:function(e,t){var n=x()+Math[0>e?"floor":"ceil"](e),i=n/(X-U);v(i*Z,t)},positionDragX:function(e,t){_(e,t)},positionDragY:function(e,t){v(e,t)},animate:function(e,t,n,i){var r={};r[t]=n,e.animate(r,{duration:B.animateDuration,easing:B.animateEase,queue:!1,step:i})},getContentPositionX:function(){return T()},getContentPositionY:function(){return x()},getContentWidth:function(){return W},getContentHeight:function(){return X},getPercentScrolledX:function(){return T()/(W-z)},getPercentScrolledY:function(){return x()/(X-U)},getIsScrollableH:function(){return G},getIsScrollableV:function(){return J},getContentPane:function(){return V},scrollToBottom:function(e){v(Z,e)},hijackInternalLinks:e.noop,destroy:function(){F()}}),a(r)}return i=e.extend({},e.fn.jScrollPane.defaults,i),e.each(["arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){i[this]=i[this]||i.speed}),this.each(function(){var t=e(this),n=t.data("jsp");n?n.reinitialise(i):(e("script",t).filter('[type="text/javascript"],:not([type])').remove(),n=new r(t,i),t.data("jsp",n))})},e.fn.jScrollPane.defaults={showArrows:!1,maintainPosition:!0,stickToBottom:!1,stickToRight:!1,clickOnTrack:!0,autoReinitialise:!1,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:n,animateScroll:!1,animateDuration:300,animateEase:"linear",hijackInternalLinks:!1,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:3,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:!1,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:!0,hideFocus:!1,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:.8}}(jQuery,this),define("vendor/jquery.jscrollpane.min",function(){}),define("apps/smart-podcast-player/playlist/controller",["app","apps/smart-podcast-player/playlist/view","entities/podcast-track","entities/playlist","vendor/jquery.jscrollpane.min","vendor/jquery.mousewheel"],function(e,t){return e.module("AskPatPlayerApp.Playlist",function(e,n,i,r,a){var s=[],o=[],l=[],u=[],p=[],c=[],d=[],h=[],f=[];e.Controller={init:function(e){var i=e.model.get("region"),r=e.model.get("options");s[i]=void 0===s[i]?n.request("track:entities",e):s[i],o[i]=void 0===o[i]?n.request("track:entities:current",e):o[i],l[i]=void 0===l[i]?n.request("track:entities:paged",e,o[i],r.current_page,r.tracks_per_page):l[i],u[i]=void 0===u[i]?[]:u[i],p[i]=n.request("playlist:header",e),c[i]=n.request("playlist:footer",e);var m=new t.PlaylistRegion({}),g=new t.Tracks({collection:l[i]}),v=new t.PlaylistHeader({model:p[i]}),y=new t.PlaylistFooter({model:c[i]});m.on("show",function(){m.headerRegion.show(v),m.tracksRegion.show(g),m.footerRegion.show(y)}),v.on("playlist:filter",function(t){t=t.replace("×",""),n.trigger("playlist:filter",e,t)}),v.on("show",function(){this.$el.addClass("spp-empty")}),g.on("resize",function(){g.$el.removeData("jsp").removeClass("jspScrollable"),g.$(".jspContainer").remove(),g.$el.attr("style",""),this.render()}),g.on("show",function(){window.innerWidth>768&&this.$el.jScrollPane()}),g.on("playlist:sort",function(){var t=o[i].models;o[i].models=t.reverse(),r.current_page=1,l[i]=n.request("track:entities:paged",e,o[i],r.current_page,r.tracks_per_page),g.collection=l[i],g.render()}),g.on("render",function(){var e=v.$el.outerHeight();window.innerWidth>768?(this.$el.height(449-e),this.$el.jScrollPane()):this.$el.height("auto")}),g.on("itemview:track:loading",function(e,t){var n=(a(".spp-loaded-container"),a(".spp-loaded"));a(n).width(t)}),g.on("itemview:track:next",function(){o[i]=n.request("track:entities:current",e);var t=n.request("track:entity:current",e);t||(t=o[i].first());var r=o[i].indexOf(t),a=r1&&(r.current_page=r.current_page-1,l[i]=n.request("track:entities:paged",e,o[i],r.current_page,r.tracks_per_page),g.collection=l[i],g.render()),y.model.attributes.data.current_page=r.current_page,y.render()}),g.on("paging:goto:track",function(t){o[i]=n.request("track:entities:current",e);var a=(Math.ceil(o[i].length/r.tracks_per_page),o[i].indexOf(t)),s=a+10?c:1,l[i]=n.request("track:entities:paged",e,o[i],r.current_page,r.tracks_per_page),g.collection=l[i],g.render(),y.model.attributes.data.current_page=r.current_page,y.render())}),y.on("playlist:sort",function(){g.trigger("playlist:sort"),this.$(".spp-sort").toggleClass("spp-sort-reverse")}),y.on("nav:next-page",function(){g.trigger("paging:next")}),y.on("nav:prev-page",function(){g.trigger("paging:prev")}),y.on("render",function(){var t=e.model.get("options");o[i]=n.request("track:entities:current",e);var r=Math.ceil(o[i].length/t.tracks_per_page);1==t.current_page?a(".spp-playlist-prev-page").addClass("spp-disabled"):a(".spp-playlist-prev-page").removeClass("spp-disabled"),t.current_page==r?a(".spp-playlist-next-page").addClass("spp-disabled"):a(".spp-playlist-next-page").removeClass("spp-disabled")}),y.on("show",function(){var t=e.model.get("options");o[i]=n.request("track:entities:current",e);var r=Math.ceil(o[i].length/t.tracks_per_page);1==t.current_page?this.$(".spp-playlist-prev-page").addClass("spp-disabled"):this.$(".spp-playlist-prev-page").removeClass("spp-disabled"),t.current_page==r?this.$(".spp-playlist-next-page").addClass("spp-disabled"):this.$(".spp-playlist-next-page").removeClass("spp-disabled")}),d[i]=g,h[i]=v,f[i]=y,e.playlistRegion.show(m)},gotoPlaylistTrackPage:function(e,t){var n=e.model.get("region");d[n].trigger("paging:goto:track",t)},updatePaging:function(e){var t=e.model.get("region");d[t].trigger("paging:update")},filter:function(e,t){var i=e.model.get("region"),r=e.model.get("options"),s=a.inArray(t,u[i]);if("-1"==s?u[i].push(t):u[i].splice(s,1),u[i].length<1){h[i].$el.html("").addClass("spp-empty"),o[i]=n.request("track:entities",e),o[i]=n.request("track:entities:tagged",e,o[i],"");{Math.ceil(o[i].length/r.tracks_per_page)}l[i]=n.request("track:entities:paged",e,o[i],1,r.tracks_per_page);var p=Math.ceil(o[i].length/r.tracks_per_page);d[i].collection=l[i],d[i].render(),r.current_page=f[i].model.attributes.data.current_page=1,f[i].model.attributes.data.num_pages=p,f[i].render()}else{var c="";a.each(u[i],function(e,t){c+=''+t+'×'}),h[i].$el.html(c).removeClass("spp-empty"),o[i]=n.request("track:entities",e),a.each(u[i],function(t,r){o[i]=n.request("track:entities:tagged",e,o[i],r)});{Math.ceil(o[i].length/r.tracks_per_page)}l[i]=n.request("track:entities:paged",e,o[i],1,r.tracks_per_page),o[i]=n.request("track:entities:current",e);var p=Math.ceil(o[i].length/r.tracks_per_page);d[i].collection=l[i],d[i].render(),r.current_page=f[i].model.attributes.data.current_page=1,f[i].model.attributes.data.num_pages=p,f[i].render()}}}}),e.AskPatPlayerApp.Playlist.Controller}),define("text!templates/track-details-template.html",[],function(){return'\r\n\r\n\r\n \r\n <% if ( data.social == true ) { %>\r\n
\r\n <% } %> \r\n \r\n
\r\n <%= data.show_notes %>\r\n
\r\n\r\n
\r\n\r\n<% if ( data.poweredby == true ) { %>\r\n \r\n<% } %>\r\n\r\n
\r\n \r\n
\r\n'
}),define("apps/smart-podcast-player/track-details/view",["app","text!templates/track-details-template.html"],function(e,t){return e.module("AskPatPlayerApp.TrackDetails.View",function(e,n,i,r,a,s){e.TrackDetails=r.Layout.extend({template:s.template(t),className:"spp-track-details",triggers:{"click .spp-play-pause-btn":"play","click .spp-button-download":"track:download","click .spp-previous-btn":"track:previous","click .spp-next-btn":"track:next","click .spp-currently-playing":"track:current","click .details-btn":"content:toggle"},events:{"click .spp-player-tag":"filterTag","click .spp-progress-container":"seek","click .spp-share-btn":"share"},initialize:function(){var e=this;a(window).on("spp_resize",function(){e.resize()})},resize:function(){this.trigger("resize")},socialPopup:function(e,t){window.open(t,"pinterest","screenX=100,screenY=100,height=360,width=730"),e.preventDefault(),e.stopPropagation()},share:function(e){var t=this,n=t.model.get("data"),i=a(e.currentTarget),r=""!=n.fallback_permalink&&null!=n.fallback_permalink&&void 0!=n.fallback_permalink?n.fallback_permalink:""!=n.permalink_url?n.permalink_url:"";if(i.hasClass("spp-facebook")&&this.socialPopup(e,"http://www.facebook.com/sharer/sharer.php?s=100&p[url]="+encodeURIComponent(r)+"&p[images][0]=&p[title]="+encodeURIComponent(n.title)),i.hasClass("spp-twitter")){var s=encodeURIComponent(n.title)+" "+encodeURIComponent(r);""!=n.hashtag&&void 0!=n.hashtag&&(s=s+" "+encodeURIComponent("#"+n.hashtag)),this.socialPopup(e,"http://twitter.com/home?status="+s)}i.hasClass("spp-gplus")&&this.socialPopup(e,"https://plus.google.com/share?url="+encodeURIComponent(r))},seek:function(e){function t(){n.bytesLoaded/n.bytesTotal>p&&(n.pause(),n.setPosition(p*l),n.spp-play(),clearInterval(u))}var n=soundManager.getSoundById("track_"+this.model.get("id")),i=e.offsetX,r=e.offsetY,s=a(e.currentTarget).width(),o=n.spp-o,l=this.model.get("duration");void 0==i&&(i=e.pageX-this.$(".spp-progress-container").offset().left),void 0==r&&(r=e.pageY-this.$(".spp-progress-container").offset().top);var u,p=i/s;if(n.bytesLoaded/n.bytesTotal>p)n.pause(),n.setPosition(p*l),n.spp-play();else{this.$el.hasClass("playing")||n.spp-play(),n.pause();var c=100*p+"%";a(e.currentTarget).find(".spp-progress-icon").css({left:c}),u=setInterval(t,250)}},filterTag:function(e){this.trigger("playlist:filter",this,a(e.currentTarget).text())},onRender:function(){var e=this.model.get("data"),t=e.tags,n="";a.each(t,function(e,t){n+=''+t+""}),this.$(".spp-tag-list").html(n)}})}),e.AskPatPlayerApp.TrackDetails.View}),define("apps/smart-podcast-player/track-details/controller",["app","apps/smart-podcast-player/track-details/view","entities/podcast-track","soundmanager2","vendor/jquery.jscrollpane.min","vendor/jquery.mousewheel"],function(e,t){return e.module("AskPatPlayerApp.TrackDetails",function(e,n,i,r,a){var s=[];e.Controller={init:function(e){var i=e.model.get("region"),r=(e.model.get("options"),n.request("track:entity:current",e)),o=new t.TrackDetails({model:r});o.on("show",function(){window.innerWidth>768&&o.$el.jScrollPane()}),o.on("playlist:filter",function(t,i){n.trigger("playlist:filter",e,i)}),o.on("resize",function(){window.innerWidth>768&&a(".spp-player .spp-track-details-container").show(),o.$el.removeData("jsp").removeClass("jspScrollable"),o.$el.attr("style","").attr("tabindex",""),o.$(".jspContainer").remove(),o.render(),window.innerWidth>768&&o.$el.jScrollPane()}),o.on("track:download",function(e){var t=e.model.get("data"),n=t.download_url;"https:"===location.protocol&&(n=n.replace(/^http:\/\//i,"https://"));var i=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);if(i||"soundcloud"==t.method&&("http:"!==location.protocol||i))window.location=n+"?consumer_key="+AP_Player.soundcloudConsumerKey;else{var r="soundcloud"==t.method?n+"?consumer_key="+AP_Player.soundcloudConsumerKey:AP_Player.homeUrl+"?spp_download="+n;e.view.$(".spp-downloader").prop("src",r)}}),o.on("track:current",function(){var t=n.request("track:entity:current",e);o.$el.removeData("jsp").removeClass("jspScrollable"),o.$el.attr("style","").attr("tabindex",""),o.$(".jspContainer").remove(),this.model=t,this.render(),window.innerWidth>768&&this.$el.jScrollPane()}),o.on("render",function(){o.$el.removeClass("spp-current"),window.innerWidth>768?o.$el.jScrollPane():(o.$el.removeData("jsp").removeClass("jspScrollable"),o.$el.attr("style","").attr("tabindex",""),o.$(".jspContainer").remove());var t=n.request("track:entity:current",e);t.attributes.data.id===o.model.attributes.data.id&&o.$el.addClass("spp-current")}),e.trackDetailsRegion.show(o),s[i]=o},show:function(e,t){var n=e.model.get("region"),i=s[n];i.$el.removeData("jsp").removeClass("jspScrollable"),i.$el.attr("style","").attr("tabindex",""),i.$(".jspContainer").remove(),i.model=t,i.render(),window.innerWidth>768&&i.$el.jScrollPane()}}}),e.AskPatPlayerApp.TrackDetails.Controller}),define("apps/smart-podcast-player/player/view",["app","text!templates/player-template.html"],function(e,t){return e.module("AskPatPlayerApp.Player.View",function(e,n,i,r,a,s){e.Player=r.ItemView.extend({template:s.template(t),className:"spp-player",triggers:{"click .spp-play":"track:play","click .spp-next":"track:next","click .spp-previous":"track:previous","click .spp-speed":"track:speed","click .spp-show-notes-button":"track:show-notes"},events:{"mousemove .spp-track":"cursorMove","mouseout .spp-track":"cursorOut","click .spp-track":"seek"},initialize:function(){this.hover=!1;var e=this;a(window).on("spp_resize",function(){e.resize()})},resize:function(){this.trigger("resize")},seek:function(e){this.trigger("track:seek",e)},cursorMove:function(e){this.trigger("cursor:move",e)},cursorOut:function(e){this.trigger("cursor:out",e)},onRender:function(){}})}),e.AskPatPlayerApp.Player.View}),define("apps/smart-podcast-player/player/controller",["app","apps/smart-podcast-player/player/view","entities/podcast-player","entities/podcast-track","soundmanager2"],function(e,t){return e.module("AskPatPlayerApp.Player",function(e,n,i,r,a){var s=[],o=[],l=[];e.Controller={init:function(e){var i=e.model.get("region"),r=e.model.get("options"),u=n.request("player:entity",e);l[i]=new t.Player({model:u});var p=0,c=n.request("track:entities",e);c.each(function(e){var t=e.get("data");p+="number"==typeof t.playback_count?t.playback_count:0}),l[i].on("resize",function(){var e=l[i].model.get("data");if(window.innerWidth>768){var t=l[i].$el.outerWidth();null===e.show_logo||void 0===e.show_logo||""===e.show_logo?t=t:t-=100,l[i].$(".spp-track").css({width:t+"px"}),l[i].$(".spp-show-logo").show()}else l[i].$(".spp-track").css({width:"100%"}),l[i].$(".spp-show-logo").hide()}),l[i].on("track:show-notes",function(){this.$el.parents(".smart-podcast-player").find(".spp-track-details-container").is(":visible")?(this.$el.parents(".smart-podcast-player").find(".spp-track-details-container").hide(),l[i].$(".spp-show-notes-button").text("Show Notes")):(this.$el.parents(".smart-podcast-player").find(".spp-track-details-container").show(),l[i].$(".spp-show-notes-button").text("Hide Notes"))}),l[i].on("show",function(){var e=l[i].model.get("data");if(window.innerWidth>768){var t=l[i].$el.outerWidth();null===e.show_logo||void 0===e.show_logo||""===e.show_logo?t=t:t-=100,l[i].$(".spp-track").css({width:t+"px"}),l[i].$(".spp-show-logo").show()}else l[i].$(".spp-track").css({width:"100%"}),l[i].$(".spp-show-logo").hide();if(p){var n=p.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" Listens";""!=e.show_name&&void 0!==e.show_name&&(n=" • "+n),l[i].$(".spp-show-count").text(n)}}),l[i].on("render",function(){var e=l[i].model.get("data");if(window.innerWidth>768){var t=l[i].$el.outerWidth();null===e.show_logo||void 0===e.show_logo||""===e.show_logo?t=t:t-=100,l[i].$(".spp-track").css({width:t+"px"}),l[i].$(".spp-show-logo").show()}else l[i].$(".spp-track").css({width:"100%"}),l[i].$(".spp-show-logo").hide();if(p){var n=p.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")+" Listens";""!=e.show_name&&void 0!==e.show_name&&(n=" • "+n),l[i].$(".spp-show-count").text(n)}}),l[i].on("track:play",function(t){var i=this.$el.hasClass("spp-playing"),r=(t.model.get("data"),"track_"+t.model.cid);a(".spp-track, .smart-track-player").removeClass("spp-playing"),i?(a(".spp-player").removeClass("spp-playing"),this.$(".spp-player-playlist .spp-track").removeClass("spp-active"),soundManager.pauseAll(),n.request("track:entities:set",e,"playing",!1)):(soundManager.pauseAll(),soundManager.play(r),this.$el.addClass("spp-playing"),n.request("track:entities:set",e,"playing",!1),n.request("track:entity:set",e,t.model,"playing",!0),a('.spp-track[data-tid="'+r+'"]').addClass("spp-playing"))}),l[i].on("track:speed",function(t){var i=this.$el.hasClass("spp-playing"),r=(t.model.get("data"),"track_"+t.model.cid),s=soundManager.getSoundById(r);a(".spp-track, .smart-track-player").removeClass("spp-playing"),i||(soundManager.pauseAll(),soundManager.play(r),this.$el.addClass("spp-playing"),n.request("track:entities:set",e,"playing",!1),n.request("track:entity:set",e,t.model,"playing",!0),a('.spp-track[data-tid="'+r+'"]').addClass("spp-playing")),s.isHTML5&&(.5==s._a.playbackRate?(this.$el.hasClass("spp-speeding-half")&&this.$el.removeClass("spp-speeding-half"),s._a.playbackRate=1):1==s._a.playbackRate?(this.$el.addClass("spp-speeding-onehalf"),s._a.playbackRate=1.5):1.5==s._a.playbackRate?(this.$el.hasClass("spp-speeding-onehalf")&&this.$el.removeClass("spp-speeding-onehalf"),this.$el.addClass("spp-speeding-two"),s._a.playbackRate=2):2==s._a.playbackRate?(this.$el.hasClass("spp-speeding-two")&&this.$el.removeClass("spp-speeding-two"),this.$el.addClass("spp-speeding-three"),s._a.playbackRate=3):3==s._a.playbackRate?(this.$el.hasClass("spp-speeding-three")&&this.$el.removeClass("spp-speeding-three"),this.$el.addClass("spp-speeding-half"),s._a.playbackRate=.5):s._a.playbackRate=1)}),l[i].on("track:seek",function(e){function t(){r.bytesLoaded/r.bytesTotal>c&&(r.setPosition(c*r.durationEstimate),r.play(),clearInterval(p))}if(window.innerWidth>768){{var n=l[i].model.get("data"),r=soundManager.getSoundById("track_"+l[i].model.cid),s=l[i].$(".spp-track").offset(),o=e.pageX-s.left,u=a(e.currentTarget).outerWidth();r.position,n.durationEstimate}void 0==o&&(o=e.pageX-this.$(".spp-track").offset().left);var p,c=o/u;r.bytesLoaded/r.bytesTotal>c?(r.pause(),r.setPosition(c*r.durationEstimate),r.play()):(this.$el.hasClass("spp-playing")||r.play(),r.pause(),p=setInterval(t,250))}}),l[i].on("cursor:move",function(e){if(window.innerWidth>768){l[i].$el.addClass("spp-hover");var t=l[i].$(".spp-track").offset(),n=e.pageX-t.left;this.$(".spp-position").css({left:n+"px"})}}),l[i].on("cursor:out",function(){if(window.innerWidth>768){var e=l[i].model.get("data"),t=soundManager.getSoundById("track_"+l[i].model.cid);if(t){var n=t.position,r=e.duration,a=n/r*100;l[i].$(".spp-position").css({left:a+"%"})}l[i].$el.removeClass("spp-hover")}}),l[i].on("track:next",function(t){var u=t.model,p=(u.get("data"),"track_"+u.cid);soundManager.pauseAll(),soundManager.unload(p),a(".spp-player").removeClass("spp-playing"),s[i]=n.request("track:entities:current",e),o[i]=n.request("track:entities:paged",e,s[i],r.current_page,r.tracks_per_page);var c=s[i].indexOf(u),d=c+1,h=s[i].length-1,f=s[i].at(h>d?d:0);n.trigger("playlist:paging:track",e,f),l[i].trigger("track:update",f)}),l[i].on("track:previous",function(t){var a=t.model,u=(a.get("data"),"track_"+a.cid);soundManager.pauseAll(),soundManager.unload(u),s[i]=n.request("track:entities:current",e),o[i]=n.request("track:entities:paged",e,s[i],r.current_page,r.tracks_per_page);var p=s[i].indexOf(a),c=p-1,d=s[i].length-1,h=s[i].at(0>c?d:c);n.trigger("playlist:paging:track",e,h),l[i].trigger("track:update",h)}),l[i].on("track:update",function(t){{var r=(t.get("data"),"track_"+t.cid),s=(l[i].model.get("data"),"track_"+l[i].model.cid);this.$el.hasClass("spp-playing")}a(".spp-player").removeClass("spp-playing"),a(".spp-track").removeClass("spp-active"),s==r?l[i].trigger("track:play",this):(a('.spp-track[data-tid="'+s+'"]').addClass("spp-active"),soundManager.pauseAll(),soundManager.unload(s),l[i].model=t,l[i].render(),l[i].trigger("track:play",this),n.trigger("playlist:paging:update",e),n.trigger("track-details:show",e,t))}),e.playerRegion.show(l[i])},playTrack:function(e,t){var n=e.model.get("region");l[n].trigger("track:update",t)}}}),e.AskPatPlayerApp.Player.Controller}),define("apps/smart-podcast-player/app",["app"],function(e){return e.module("AskPatPlayerApp",function(e,t){var n={initCore:function(e){require(["apps/smart-podcast-player/core/controller"],function(t){t.init(e)})},setupColors:function(e){require(["apps/smart-podcast-player/core/controller"],function(t){t.setupColors(e)})},initPlaylist:function(e){require(["apps/smart-podcast-player/playlist/controller"],function(t){t.init(e)})},updatePlaylistPaging:function(e){require(["apps/smart-podcast-player/playlist/controller"],function(t){t.updatePaging(e)})},gotoPlaylistTrackPage:function(e,t){require(["apps/smart-podcast-player/playlist/controller"],function(n){n.gotoPlaylistTrackPage(e,t)})},filterPlaylist:function(e,t){require(["apps/smart-podcast-player/playlist/controller"],function(n){n.filter(e,t)})},initTrackDetails:function(e){require(["apps/smart-podcast-player/track-details/controller"],function(t){t.init(e)})},showTrack:function(e,t){require(["apps/smart-podcast-player/track-details/controller"],function(n){n.show(e,t)})},initPlayer:function(e){require(["apps/smart-podcast-player/player/controller"],function(t){t.init(e)})},playTrack:function(e,t){require(["apps/smart-podcast-player/player/controller"],function(n){n.playTrack(e,t)})}};t.on("app:core:init",function(){n.initCore()}),t.on("core:color:setup",function(){n.setupColors()}),t.on("player:track:play",function(e,t){n.playTrack(e,t)}),t.on("player:init",function(e){n.initPlayer(e)}),t.on("playlist:paging:update",function(e){n.updatePlaylistPaging(e)}),t.on("playlist:paging:track",function(e,t){n.gotoPlaylistTrackPage(e,t)}),t.on("playlist:init",function(e){n.initPlaylist(e)}),t.on("playlist:filter",function(e,t){n.filterPlaylist(e,t)}),t.on("track-details:init",function(e){n.initTrackDetails(e)}),t.on("track-details:show",function(e,t){n.showTrack(e,t)})}),e.PlaylistApp}),define("app",["jquery","marionette","soundmanager2"],function(e,t){var n=new t.Application;return n.options={},n.options.current_page=1,n.options.tracks_per_page=10,n.on("initialize:after",function(){(jQuery(".smart-podcast-player").length>0||jQuery(".smart-track-player").length>0)&&require(["apps/smart-podcast-player/app"],function(){soundManager.setup({url:AP_Player.baseUrl+"vendor/SoundManager2/swf/",flashVersion:9,useHighPerformance:!0,wmode:"transparent",useHTML5Audio:!0,preferFlash:!1,onready:function(){n.trigger("app:core:init")}})})}),n}),define("text!templates/track-template.html",[],function(){return'<% if ( data.show_logo != undefined && data.show_logo != null ) { %>\r\n \r\n
\r\n
\r\n<% } %>\r\n\r\n\r\n <% if ( data.artist != undefined && data.artist != null ) { %>\r\n
<%= data.artist %>
\r\n <% } %> \r\n\r\n
<%= data.title %>
\r\n
\r\n \r\n
\r\n\r\n
\r\n\r\n
\r\n
\r\n
\r\n \r\n \r\n\r\n <% var adl = document.createElement(\'a\'); %>\r\n <% var adloff = /Firefox/i.test(navigator.userAgent); %>\r\n\r\n <% if ( data.download == true && (typeof adl.download != "undefined") && (!adloff) && data.method != \'soundcloud\' ) { %>
<% } %>\r\n <% if ( data.download == true && (typeof adl.download == "undefined" || (adloff) || data.method == \'soundcloud\' ) ) { %>
<% } %>\r\n
\r\n
\r\n\r\n
\r\n \r\n
\r\n'}),define("apps/smart-track-player/player/view",["app","text!templates/track-template.html"],function(e,t){return e.module("SmartTrackPlayerApp.Player.View",function(e,n,i,r,a,s){e.Player=r.ItemView.extend({template:s.template(t),className:"smart-track-player",events:{"mousemove .spp-track":"cursorMove","mouseout .spp-track":"cursorOut","click .spp-position":"seek","click .spp-play":"play","click .spp-button-download":"download","click .spp-dload":"download","click .spp-speed":"speed","hover .spp-play":"shareOut","hover .spp-button-download":"shareOut","hover .spp-dload":"shareOut","hover .spp-dloada":"shareOut","hover .spp-speed":"shareOut","hover .spp-share":"shareOn","hover .spp-share-options":"shareOn","click .spp-share":"shareOn","click .spp-share-icon":"share","mouseleave .spp-controls":"shareOut"},initialize:function(){this.hover=!1;var e=this;a(window).on("resize",function(){e.resize()})},download:function(e){e.preventDefault();var t=this.model.get("data"),n=t.download_url;"https:"===location.protocol&&(n=n.replace(/^http:\/\//i,"https://"));var i=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);if(i||"soundcloud"==t.method&&("http:"!==location.protocol||i)){var r="soundcloud"==t.method?n+"?consumer_key="+AP_Player.soundcloudConsumerKey:n;window.location=r}else{var r="soundcloud"==t.method?n+"?consumer_key="+AP_Player.soundcloudConsumerKey:AP_Player.homeUrl+"?spp_download="+n;this.$(".spp-downloader").prop("src",r)}},resize:function(){var e=this.model.get("data");if(window.innerWidth>768){var t=a(".smart-track-player").first().outerWidth();null===e.artwork_url||void 0===e.artwork_url||(t-=100),this.$(".spp-track").css({width:t+"px"})}else this.$(".spp-track").css({width:"100%"})},socialPopup:function(e,t){window.open(t,"pinterest","screenX=100,screenY=100,height=360,width=730"),e.preventDefault(),e.stopPropagation()},shareOn:function(){this.$(".spp-share-options").css("display","block")},shareOut:function(){this.$(".spp-share-options").css("display","none")},share:function(e){var t=this,n=t.model.get("data"),i=a(e.currentTarget),r=window.location.href;if((i.hasClass("spp-facebook")||i.hasClass("spp-fb-btn"))&&this.socialPopup(e,"http://www.facebook.com/sharer/sharer.php?s=100&p[url]="+encodeURIComponent(r)+"&p[images][0]=&p[title]="+encodeURIComponent(n.title)),i.hasClass("spp-twitter")||i.hasClass("spp-twitter-btn")){var s=encodeURIComponent(n.title)+" "+encodeURIComponent(r);""!=n.hashtag&&void 0!=n.hashtag&&(s=s+" "+encodeURIComponent("#"+n.hashtag)),this.socialPopup(e,"http://twitter.com/home?status="+s)}(i.hasClass("spp-gplus")||i.hasClass("spp-gplus-btn"))&&this.socialPopup(e,"https://plus.google.com/share?url="+encodeURIComponent(r))},stop:function(){this.$el.removeClass("spp-playing")},seek:function(e){function t(){r.bytesLoaded/r.bytesTotal>d&&(p=null!==r.duration?r.duration:r.durationEstimate,s.pause(),r.setPosition(d*p),s.play(),clearInterval(c))}if(a(window).outerWidth()>768){var n=this.model.get("data"),i="smart_track_"+n.track_uid+"_"+this.model.cid,r=soundManager.getSoundById(i),s=this;void 0===r&&(r=this.createSound(),r.load());var o=this.$(".spp-track").offset(),l=e.pageX-o.left,u=this.$(".spp-track").outerWidth(),p=null!==r.duration?r.duration:r.durationEstimate;void 0==l&&(l=e.pageX-this.$(".spp-track").offset().left);var c,d=l/u;r.bytesLoaded/r.bytesTotal>d&&null!==p?(p=null!==r.duration?r.duration:r.durationEstimate,this.$el.hasClass("spp-playing")&&this.pause(),r.setPosition(d*p),this.play()):(this.pause(),c=setInterval(t,250))}},cursorMove:function(e){if(this.trigger("cursor:move",e),window.innerWidth>768){this.hover=!0;var t=this.$(".spp-track").offset(),n=e.pageX-t.left;this.$(".spp-position").css({left:n+"px"})}},cursorOut:function(){if(window.innerWidth>768){var e=this.model.get("data"),t="smart_track_"+e.track_uid+"_"+this.model.cid,n=soundManager.getSoundById(t);if(n){var i=n.position,r=n.duration,a=i/r*100;this.$(".spp-position").css({left:a+"%"})}this.hover=!1}},onRender:function(){{var e=this.model.get("data");"smart_track_"+e.track_uid+"_"+this.model.cid}if(window.innerWidth>768){var t=a(".smart-track-player").first().outerWidth();null===e.show_logo||void 0===e.show_logo||(t-=60),this.$(".spp-track").css({width:t+"px"})}else this.$(".spp-track").css({width:"100%"}),this.$(".spp-show-logo").hide();void 0!==e.download&&this.$el.addClass("spp-has-download"),void 0!==e.color&&this.$el.addClass("stp-color-"+e.color),void 0!==e.get&&0!=e.get&&"file"==e.method&&this.fetchTrackData(e.url)},fetchTrackData:function(e){var t=this,n={action:"fetch_track_data",url:e};console.log("Getting track data"),a.post(AP_Player.ajaxurl,n,function(e){var n=t.model.get("data");e=JSON.parse(e),"0"!=e?(void 0===typeof e.title||void 0!=n.title&&'Getting file data...'!=n.title||(n.title=e.title),void 0!==typeof e.artist&&void 0==n.artist&&(n.artist=e.artist),n.get=!1,t.model.set({data:n}),void 0!==typeof e.title&&t.$(".spp-track-title").text(n.title),void 0!==typeof e.artist&&(t.$(".spp-artist").length>0?t.$(".spp-artist").text(n.artist):t.$(".spp-track-title").before(''+n.artist+"
")),void 0!=t.loading_timer&&clearInterval(t.loading_timer),t.render()):(n.title="Unable to retrieve track data",n.get=!1,t.model.set({data:n}),t.render())})},pause:function(){var e=this.model.get("data"),t="smart_track_"+e.track_uid+"_"+this.model.cid,n=soundManager.getSoundById(t);n.pause(),this.$el.removeClass("spp-playing")},speed:function(){var e=this.model.get("data"),t="smart_track_"+e.track_uid+"_"+this.model.cid,n=soundManager.getSoundById(t);if(void 0===n)n=this.createSound(),this.play();else{var i=this.$el.hasClass("spp-playing");i||this.play()}n.isHTML5&&(.5==n._a.playbackRate?(this.$el.hasClass("spp-speeding-half")&&this.$el.removeClass("spp-speeding-half"),n._a.playbackRate=1):1==n._a.playbackRate?(this.$el.addClass("spp-speeding-onehalf"),n._a.playbackRate=1.5):1.5==n._a.playbackRate?(this.$el.hasClass("spp-speeding-onehalf")&&this.$el.removeClass("spp-speeding-onehalf"),this.$el.addClass("spp-speeding-two"),n._a.playbackRate=2):2==n._a.playbackRate?(this.$el.hasClass("spp-speeding-two")&&this.$el.removeClass("spp-speeding-two"),this.$el.addClass("spp-speeding-three"),n._a.playbackRate=3):3==n._a.playbackRate?(this.$el.hasClass("spp-speeding-three")&&this.$el.removeClass("spp-speeding-three"),this.$el.addClass("spp-speeding-half"),n._a.playbackRate=.5):n._a.playbackRate=1)},play:function(){var e=this.$el.hasClass("spp-playing"),t=this.model.get("data"),n="smart_track_"+t.track_uid+"_"+this.model.cid,i=soundManager.getSoundById(n);void 0===i&&(i=this.createSound()),a(".spp-track").removeClass("spp-playing"),e?(this.$el.removeClass("spp-playing"),soundManager.pauseAll()):(soundManager.pauseAll(),i.play(),this.$el.addClass("spp-playing"))},createSound:function(){var e=this,t=this.model,n=t.get("data"),i="smart_track_"+n.track_uid+"_"+this.model.cid,r=soundManager.createSound({id:i,url:n.url,type:"audio/mp3",onload:function(){},onresume:function(){},onplay:function(){},onid3:function(){},onfinish:function(){e.stop()},whileloading:function(){var t=this.bytesLoaded/this.bytesTotal*100+"%";e.$(".spp-loaded").width(t),this.bytesLoaded/this.bytesTotal==1&&e.$(".spp-loaded-container").fadeOut("slow")},whileplaying:function(){var t,n,i,r,a=this.durationEstimate,s=this.position,o=a-s;t=s/1e3,n=t/60,i=n/60,r=Math.floor(i)+":"+pad(Math.floor(n%60),2)+":"+pad(Math.floor(t%60),2),t=o/1e3,n=t/60,i=n/60,remaining_time=pad(Math.floor(n),2)+":"+pad(Math.floor(t%60),2),e.$(".spp-duration").text("-"+remaining_time);var l=s/a*100;e.$(".spp-current-time").css({width:l+"%"}),e.hover===!1&&e.$(".spp-position").css({left:l+"%"})}});return r}})}),e.SmartTrackPlayerApp.Player.View}),define("entities/player-track",["app"],function(e){e.module("Entities",function(e,t,n){e.Player=n.Model.extend({defaults:{data:{}}}),e.Track=n.Model.extend({defaults:{data:{active:!1,artwork_url:"",attachments_uri:"",bpm:null,comment_count:0,commentable:!0,created_at:"",current_time:"0:00:00",description:"",download_count:0,download_url:"",downloadable:!0,duration:0,duration_time:"0:00:00",episode_number:0,embeddable_by:"all",favoritings_count:0,filename:"",genre:"",id:0,isrc:"",key_signature:"",kind:"track",label_id:null,label_name:"",license:"",original_content_size:0,original_format:"mp3",permalink:"",permalink_url:"",playing:!1,playback_count:0,purchase_title:null,purchase_url:null,release:"",release_day:null,release_month:null,release_year:null,sharing:"",show_name:"",state:"",stream_url:"",streamable:!0,tag_list:"",tags:"",tag_string:"",title:"",track_type:"",uri:"",user:{avatar_url:"",id:0,kind:"user",permalink:"",permalink_url:"",uri:"",username:""},user_id:0,video_url:null,waveform_url:"",show_notes:""}}})})}),define("entities/player",["app","entities/player-track"],function(e){return e.module("Entities",function(e,t){var n=[],i=function(e){var i=e.model.get("region");n[i]=t.request("track:entity:current",e)},r={getPlayerEntities:function(e){var t=e.model.get("region");return void 0===n[t]&&i(e),n[t]}};t.reqres.setHandler("player:entity",function(e){return r.getPlayerEntities(e)})}),e.Entities}),define("apps/smart-track-player/player/controller",["app-player","apps/smart-track-player/player/view","entities/player","entities/player-track","soundmanager2"],function(e,t){return e.module("SmartTrackPlayerApp.Player",function(e,n,i,r,a){e.Controller={init:function(){a(".smart-track-player").length>0&&n.trigger("core:color:setup"),a(".smart-track-player").each(function(e,n){var r=a(n).data("url"),s={url:r,track_uid:a(n).data("uid"),show_logo:a(n).data("image"),download:a(n).data("download"),download_url:r,color:a(n).data("color"),title:a(n).data("title"),artist:a(n).data("artist"),filename:"",get:a(n).data("get"),method:"file"},o=document.createElement("a");o.href=r;var l=o.hostname;if(l.indexOf("soundcloud.com")>-1){var u="",p={action:"get_soundcloud_track",stream:r};a.ajax({url:AP_Player.ajaxurl,dataType:"json",async:!1,type:"POST",data:p,success:function(e){u=e}}),s.method="soundcloud",s.url=u.stream_url+"?consumer_key="+AP_Player.soundcloudConsumerKey,s.title=s.title?s.title:u.title,s.download_url=u.download_url,s.filename=u.permalink+".mp3";var c=new i.Model({data:s}),d=new t.Player({model:c});d.render(),a(n).after(d.$el);var h="?spp_view=1";h+="&type=track",h+="&url="+s.url,h+="&download="+(void 0!=s.download?encodeURIComponent(s.download):""),h+="&title="+(void 0!=s.title?encodeURIComponent(s.title):""),h+="&artist="+(void 0!=s.artist?encodeURIComponent(s.artist):""),h+="&image="+(void 0!=s.image?encodeURIComponent(s.image):""),h+="&color="+(void 0!=s.color?encodeURIComponent(s.color):""),a(n).remove()}else{void 0!=s.get&&void 0==s.title&&(s.title='Getting file data...'),s.filename=s.url.replace(/^.*[\\\/]/,"");var c=new i.Model({data:s}),d=new t.Player({model:c});d.on("render",function(){if(this.$(".spp-loading-ellipsis").length>0){var e=this,t=0;this.loading_timer=setInterval(function(){t++;var n=new Array(t%5).join(".");e.$(".spp-loading-ellipsis").text("."+n)},300)}}),d.render(),a(n).after(d.$el);var h="?spp_view=1";h+="&type=track",h+="&url="+s.url,h+="&download="+(void 0!=s.download?encodeURIComponent(s.download):""),h+="&image="+(void 0!=s.image?encodeURIComponent(s.image):""),h+="&color="+(void 0!=s.color?encodeURIComponent(s.color):""),a(n).remove()}})},setupColors:function(){var e=new Array;a(".smart-track-player").each(function(t,n){var i=a(n).attr("class"),r=i.trim().split(/\s+/);a.each(r,function(t,n){var i=n.indexOf("stp-color-");if(i>-1){var r=n.replace("stp-color-","");-1==a.inArray(r,e)&&e.push(r)}})});var t={action:"get_colors",stp_colors:e};a.post(AP_Player.ajaxurl,t,function(e){a("head").append(e)})}}}),e.SmartTrackPlayerApp.Player.Controller}),define("apps/smart-track-player/app",["app-player"],function(e){return e.module("SmartTrackPlayerApp",function(e,t){var n={initPlayer:function(){require(["apps/smart-track-player/player/controller"],function(e){e.init()})},setupColors:function(e){require(["apps/smart-track-player/player/controller"],function(t){t.setupColors(e)})}};t.on("player:init",function(){n.initPlayer()}),t.on("core:color:setup",function(){n.setupColors()})}),e.SmartTrackPlayerApp}),define("app-player",["marionette","soundmanager2"],function(e){var t=new e.Application;return t.options={},t.on("initialize:after",function(){jQuery(".smart-track-player").length>0&&require(["apps/smart-track-player/app"],function(){soundManager.setup({url:AP_Player.baseUrl+"vendor/SoundManager2/swf/",flashVersion:9,wmode:"transparent",useHTML5Audio:!0,preferFlash:!1,onready:function(){t.trigger("player:init")}})})}),t}),"function"==typeof jQuery&&define("jquery",function(){return jQuery}),"function"==typeof _&&define("underscore",function(){return _}),require.config({name:"AP_Player_App",baseUrl:"/wp-content/plugins/smart-podcast-player/assets/js/",urlArgs:"bust="+(new Date).getTime(),paths:{backbone:"vendor/amdjs/backbone","backbone.wreqr":"vendor/amdjs/backbone.wreqr","backbone.babysitter":"vendor/amdjs/backbone.babysitter",marionette:"vendor/amdjs/marionette",soundmanager2:"vendor/soundmanager2-jsmin","mwheel-intent":"vendor/mwheelIntent"},shim:{soundmanager2:{exports:"soundManager"},"vendor/jquery.mousewheel":["jquery","mwheel-intent"],"vendor/jquery.jscrollpane.min":["jquery","vendor/jquery.mousewheel","mwheel-intent"]}}),require(["jquery","app"],function(e,t){var n=jQuery(window).width(),i=jQuery(window).height();jQuery(window).on("resize",function(){(n!=jQuery(window).width()||i!=jQuery(window).height())&&(n=jQuery(window).width(),i=jQuery(window).height(),jQuery(window).trigger("spp_resize"))}),e(window).resize(function(){e(".smart-podcast-player").each(function(){var t=e(this).parent(),n=e(t).width(),i=e(window).width();768>n||768>i?t.addClass("spp-player-small"):t.removeClass("spp-player-small")})}),e(".smart-podcast-player").each(function(){var t=e(this).parent(),n=e(t).width(),i=e(window).width();(768>n||768>i)&&t.addClass("spp-player-small")}),t.start()}),require(["jquery","app-player"],function(e,t){jQuery(".smart-track-player ").length>0&&t.start()}),define("main",function(){});