Upgraded fandango, general cleanup

This commit is contained in:
unkelpehr 2014-09-21 19:53:57 +02:00
parent e13f5d18a1
commit dcbc4c90c6
9 changed files with 73 additions and 84 deletions

View File

@ -55,6 +55,7 @@ body, html {
#chat i.error { color: #ff7777; }
#chat i.message { color: #eeeeee; }
#chat i.nick { color: #99FF99; }
#chat i.fatal { color: #ff7777; }
/*------------------------------------*\
INPUT

View File

@ -20,7 +20,7 @@
</div>
<!-- Only include the script needed for loading the app -->
<script src="js/vendor/fandango.v20140918.min.js"></script>
<script src="js/vendor/fandango.v20140921.min.js"></script>
<script src="js/bootstrap.js"></script>
</body>

View File

@ -19,12 +19,8 @@ fandango.defaults({
}
});
// Fetch our modules asynchronously, when the DOM is finished loading.
//define('bootstrap_module', ['domReady'], function (domReady) {
// domReady(function () {
// require(['cryptalk']);
// });
//});
// No need to wait for DOM - the Javascript is at the bottom
require(['cryptalk']);
// Require main cryptalk module.
require(['cryptalk'], function () {}, function (e) {
document.getElementById('chat').innerHTML = '<li><i class="fatal">Fatal: An error was thrown during initialization causing the application to stop.<br>Examine the logs for more details.</i></li>';
throw e;
});

View File

@ -1,4 +1,4 @@
define('$', ['fandango', 'websocket', 'aes'], function (fandango, websocket, aes) {
define(['fandango', 'websocket', 'aes'], function (fandango, websocket, aes) {
var exports = {
selector: 0,
utilities: {},

View File

@ -1,11 +1,11 @@
// Main cryptalk module. Will be called by bootstrap.js when the DOM is ready to interact with.
define('cryptalk', {
// Main cryptalk module
define({
data: {
// If no host is given it will default to localhost.
host: ''
},
compiles: ['$'],
requires: ['templates','sound']
requires: ['templates', 'sound', 'fandango']
}, function ($, requires, data) {
var socket,
key,
@ -27,6 +27,7 @@ define('cryptalk', {
},
// Shortcut
fandango = requires.fandango;
templates = requires.templates;
sound = requires.sound;
@ -66,7 +67,6 @@ define('cryptalk', {
} else {
post('error', templates.messages.leave_from_nowhere);
}
},
count: function () {
@ -75,7 +75,6 @@ define('cryptalk', {
} else {
post('error', templates.messages.not_in_room);
}
},
key: function (payload) {
@ -105,14 +104,11 @@ define('cryptalk', {
},
mute: function () {
// Set nick
// Invert mute
mute = !mute;
// Inform that the key has been set
if( mute )
post('info', $.template(templates.messages.muted ));
else
post('info', $.template(templates.messages.unmuted ));
post('info', $.template(templates.messages[mute ? 'muted' : 'unmuted']));
},
join: function (payload) {
@ -137,7 +133,9 @@ define('cryptalk', {
history.push(b);
// Shift oldest buffer if we have more than we should keep
if( history.length > history_keep ) history.shift();
if (history.length > history_keep) {
history.shift();
}
},
// Clear input buffer history
@ -148,7 +146,9 @@ define('cryptalk', {
// Clear input buffer
clearInput = function() {
setTimeout(function(){components.input[0].value = '';},0);
fandango.subordinate(function () {
components.input[0].value = '';
});
},
// Handler for the document`s keyDown-event.
@ -168,7 +168,7 @@ define('cryptalk', {
// Reset command history clear timer
clearTimeout(history_timer);
history_timer = setTimeout(function(){clearHistory()}, 60000);
history_timer = setTimeout(clearHistory, 60000);
// Check for escape key, this does nothing but clear the input buffer and reset history position
if ( e.keyCode == 27 ) {

View File

@ -1,23 +1,17 @@
define('queue', function(){
define(function (){
var exports = {},
queue = [],
now = function () {
return performance.now() || Date.now();
};
var exports = {};
queue = [];
exports.add_function_delayed = function(d,callback,data) {
queue.push(
{
func:
function(){
var finished = callback();
},
pushed:Date.now(),
delay:d,
exports.add_function_delayed = function(delay, callback, data) {
queue.push({
func: callback,
pushed: now(),
delay: delay,
data: data
}
);
});
}
exports.get = function () {
@ -25,24 +19,26 @@ define('queue', function(){
}
exports.run = function () {
var i = 0,
current,
lrt_inner;
for(var i=0;i<queue.length;i++){
var current = queue[i];
if (Date.now() - current.pushed > current.delay) {
while (current = queue[i++]) {
if (now() - current.pushed > current.delay) {
current.func();
queue.splice(i,1);
queue.splice(i - 1, 1);
}
}
if(!queue.length) return;
if (queue.length) {
// Waste a ms to prevent callstack overflow
lrt_inner = Date.now();
while (Date.now() - lrt_inner < 1) { var a=1+1; };
lrt_inner = now();
while (now() - lrt_inner < 1) { void 0; };
exports.run();
}
}
return exports;
});

View File

@ -1,8 +1,7 @@
// Sounds module, used for emitting those annoying bl-up sounds when receiving a message
define('sound',{requires: ['queue']}, function (requires) {
define(['queue'], function (queue) {
var exports = { messages: {} },
queue = requires.queue,
ac = false;

View File

@ -1,23 +0,0 @@
(function(l){var y={"http://":1,"https://":1,"file://":1},u={deepCopy:!0,baseUrl:"",namespace:"default",timeout:1E3,paths:{}},g={};(function(){this.is=function(){var f=Object.prototype.hasOwnProperty,b=Object.prototype.toString,d={array:Array.isArray||function(a){return"[object Array]"==b.call(a)},arraylike:function(a){if(!a||!a.length&&0!==a.length||d.window(a))return!1;var c=a.length;return 1===a.nodeType||d.array(a)||!d["function"](a)&&(0===c||"number"===typeof c&&0<c&&!g.is(a,"primitive")&&c-
1 in a)},"boolean":function(a){return!0===a||!1===a},element:function(a){return!(!a||1!==a.nodeType)},finite:function(a){return isFinite(a)&&!isNaN(parseFloat(a))},integer:Number.isInteger||function(a){return"number"===typeof a&&d.finite(a)&&-9007199254740992<a&&9007199254740992>a&&Math.floor(a)===a},iterable:function(a){try{1 in obj}catch(c){return!1}return!0},nan:function(a){return d.number(a)&&a!=+a},number:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},object:function(a){return a===Object(a)},
primitive:function(a){return!0===a||!1===a||null==a||!!{string:1,number:1}[typeof a]},string:function(a){return"string"==typeof a||a instanceof String},undefined:function(a){return void 0===a},untyped:function(a){if(!a||a.nodeType||"[object Object]"!==b.call(a)||d.window(a))return!1;try{if(a.constructor&&!f.call(a,"constructor")&&!f.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}for(var e in a);return void 0===e||f.call(a,e)},window:function(a){return null!=a&&a==a.window},
empty:function(a){if(a){if(g.is(a,"array"))return 0===a.length;for(var c in a)if(f.call(a,c))return!1}return!0}},e=0,c=["Arguments","Date","Function","RegExp"];for(;4>e;e++)d[c[e].toLowerCase()]=function(a){a="[object "+a+"]";return function(c){return b.call(c)==a}}(c[e]);d.args=d.arguments;d.bool=d["boolean"];d.plain=d.untyped;return function(a,c){if(d["function"](c))return a===c(a);if(!d.string(c))return a===c;if((c=c.toLowerCase())&&d[c])return d[c](a);throw'Unknown type "'+c+'"';}}();this.each=
function(){var f=Array.prototype.some;return function(b,d,e){var c,a;if(void 0===b)return obj;e=e||g;if(f&&b.some===f)return b.some(d,e),b;if(g.is(b,"array")||g.is(b,"arraylike")){c=0;for(a=b.length;c<a&&(void 0===b[c]||!d.call(e,b[c],c,b));c++);return b}for(c in b)if(b.hasOwnProperty(c)&&d.call(e,b[c],c,b))break;return b}}();this.merge=function(f){var b,d,e,c,a;b=arguments.length;var C=!1;f=arguments[0];var w=1,z,l,A=0;if(!0===f||!1===f)C=f,f=arguments[w],w++;g.is(arguments[b-1],"function")&&(a=
arguments[b-1],b--);if(void 0===f)f={};else if(g.is(f,"primitive"))throw new TypeError("Cannot merge primitive data types: merge("+Array.prototype.join.call(arguments,", ")+")");l=g.is(f,"array");if(w<b)for(;c=arguments[w++];){l=l&&g.is(c,"array");for(e in c)d=f[e],b=c[e],void 0===b||b===f?l&&A--:(C&&b&&((z=g.is(b,"array"))||g.is(b,"untyped"))&&(b=g.merge(C,d&&(z?g.is(d,"array")?d:[]:g.is(d,"untyped")?d:{}),b,a)),a&&a(e,f,c)||(A&&(e=+e+A),f[e]=b));A=0}return f};this.subordinate=function(){function f(a){if(!a||
a.source===window&&a.data===e){var b=c.shift();a=b[0];var b=b[1],d=b.length;d?1===d?a(b[0]):2===d?a(b[0],b[1]):3===d?a(b[0],b[1],b[2]):4===d?a(b[0],b[1],b[2],b[3]):a.apply(void 0,b):a()}}var b=Array.prototype.slice,d=window.postMessage,e="__fandango@"+Math.random().toString(36),c=[],a=function(){return d?function(){d(e,"*")}:function(){setTimeout(f)}}();d&&window.addEventListener("message",f,!1);return function(e){a(c.push([arguments[arguments.length-1],b.call(arguments).slice(0,-1)])-1)}}();this.noop=
function(){};this.coalesce=function(){for(var f=0,b=arguments.length;f<b;f++)if(void 0!==arguments[f])return arguments[f]};this.hasOwn=function(f){var b=1,d=arguments.length,e,c=!0,a=!0;if(1===d)return!0;if(2===d)return f.hasOwnProperty(arguments[1]);for(;b<d;b++)if(e=arguments[b],!0===e||!1===e)a=e;else if(!f.hasOwnProperty(e)){if(a)return!1;c=!1}else if(!a)return!0;return c};this.freezeObject=Object.freeze||function(f){return object}}).call(g);var D=function(){var f={};headElement=document.getElementsByTagName("head")[0];
nativeSlice=[].slice;isOpera="undefined"!==typeof opera&&"[object Opera]"===opera.toString();createScriptNode=function(b){var d=document.createElement("script");d.setAttribute("id","script::"+b);d.type="text/javascript";d.charset="utf-8";d.async=!0;return d};useAttachEvent=!(!((useAttachEvent=createScriptNode())&&useAttachEvent.attachEvent&&useAttachEvent.attachEvent.toString&&0<useAttachEvent.attachEvent.toString().indexOf("[native code"))||isOpera);onError=function(b,d,e){return function(c){f[d]=
0;b.error=c||!0;for(e.parentElement.removeChild(e);func=b.onRejected.shift();)func(c,d)}};onProgress=function(b,d,e,c){return function(){var a,g;if(f[d]){f[d]=2;for(g=0;a=b.onProgress[g++];)a(d,e);c?e.onreadystatechange=null:(e.removeEventListener("load",b.loadListener),e.removeEventListener("error",b.errorListener));if(b.loaded.push(d)===b.load.length)for(g=0;a=b.onResolved[g++];)a(b.load)}}};isLoaded=function(b,d){for(var e=0,c;c=d[e++];)if(f[c])return!0;return!1};load=function(b){var d=0,e,c;if(0<
b.onResolved.length&&0>=b.load.length){for(;d=b.onResolved.shift();)d([]);return b.shared}for(;!b.error&&(e=b.load[d++]);)e=b.prefix+e+b.suffix,f[e]?onProgress(b,e,document.getElementById("script::"+e))():(f[e]=1,c=createScriptNode(e),useAttachEvent?c.attachEvent("onreadystatechange",onProgress(b,e,c,!0)):(b.loadListener=onProgress(b,e,c),b.errorListener=onError(b,e,c),c.addEventListener("load",b.loadListener,!1),c.addEventListener("error",b.errorListener,!1)),c.src=e,headElement.appendChild(c))};
unload=function(b){for(var d=0,e,c;e=b[d++];)(c=document.getElementById("script::"+e))&&c.parentElement.removeChild(c),f[e]=0};return function(b,d){var e,c={load:b,loaded:[],prefix:"",suffix:"",onResolved:[],onRejected:[],onProgress:[],onAlways:[],error:null,shared:e};void 0!==d&&!0!==d||load(c);e={prefix:function(a){c.prefix=a;return e},suffix:function(a){c.suffix=a;return e},now:function(){load(c);return e},and:function(a){c.load=c.load.concat(a);return e},unload:function(a){unload(a);return e},
isLoaded:function(a){return isLoaded(c,a)},done:function(){c.onResolved=c.onResolved.concat(nativeSlice.call(arguments));return e},fail:function(){c.onRejected=c.onRejected.concat(nativeSlice.call(arguments));return e},progress:function(){c.onProgress=c.onProgress.concat(nativeSlice.call(arguments));return e},always:function(){c.onAlways=c.onAlways.concat(nativeSlice.call(arguments));return e}};e["try"]=e.done;e["catch"]=e.fail;e["finally"]=e.always;e.add=e.and;return e}}(),E=function(){function f(a){var c=
function(){return[]},b={},e={},d,f;for(f=0;d=a[f++];)d.selector&&(c=d.selector),d.prototype&&("function"===typeof d.prototype?d.prototype.call(e):g.merge(e,d.prototype)),d.utilities&&("function"===typeof d.utilities?d.utilities.call(b):g.merge(b,d.utilities));var k=function(a,b,e){var d=0;a=c(a,b);this.context=b||document;this.identify=e;for(this.length=a.length;d<this.length;d++)this[d]=a[d];return this};k.prototype=e;k.prototype.length=0;k.prototype.selector="";k.prototype.splice=Array.prototype.slice;
return function(a){return g.merge(function(c,b){return new k(c,b,a)},b)}}function b(b){var e,d,h=c[b],q=g.is(h.factory,"function"),m=q?h.factory.length:0,k=h.amdStyle,r=h.compiles&&[],n=h.requires&&(k?[]:{}),l=h.inherits&&{},p,t,s;void 0===(e=h.deepCopy)&&(e=u.deepCopy);h=c[b]=g.merge(e,{},u,h);if(m&&h.requires)for(t=0;s=h.requires[t++];)k?n.push(c[s].exports):g.is(c[s].exports,"function")?n[s]=c[s].exports:g.merge(e,n[s]={},c[s].exports);if(m&&h.compiles)for(t=0;s=h.compiles[t++];)r.push(c[s].exports);
if(h.inherits)for(t=0;s=h.inherits[t++];)g.merge(e,l,c[s].exports);r&&(d=f(r));for(s in h.instances)p=h.instances[s],p.context=void 0===p.context?h.context:p.context,p.deepCopy=void 0===p.deepCopy?h.deepCopy:p.deepCopy,p.namespace=void 0===p.namespace?h.namespace:p.namespace,r=[],k?r=n:(d&&(e=function(){var a={namespace:p.namespace,module:b,instance:s};a.UID=[a.namespace,a.module,a.instance].join("/");return function(){return a}}(),d=d(e),d.identify=e,r.push(d)),n&&r.push(n),m>r.length&&r.push(p.data?
g.merge(p.deepCopy,{},p.data,h.data):h.data),m>r.length&&r.push(g.merge(p.deepCopy,{},p,h))),p.exports=q?h.factory.apply(p.context,r)||{}:h.factory,void 0===h.exports&&(h.exports=l?p.exports?g.merge(!0,{},l,p.exports):l:p.exports);h.state=3;if(a[b])for(;a[b].length;)a[b].pop()(b)}function d(d,f){var l,h=f.length,q,m,k=[],r={},n,x=[],p,t=void 0!==c[d].timeout?c[d].timeout:u.timeout,s=function(a){1===c[d].state&&(k.push(a),--h||(t&&clearTimeout(p),b(d)))};for(l=0;n=f[l++];)if(q=c[n],!q||1===q.state)(a[n]=
a[n]||[]).push(s),q||((m=u.paths[n])?g.is(m,"array")&&(m=m[0]):m=n,m=v(m),r[m]=n,x.push(m));else if(3===q.state)k.push(n);else if(2===q.state)throw Error('Could not instantiate "'+d+'"; dependency "'+n+'" has been rejected.');if(!((h=f.length)-k.length))return b(d);0<x.length&&D(x).fail(function(a,b){c[d].state=2;t&&clearTimeout(p);throw Error('Could not instantiate "'+d+'"; an error occured while trying to load "'+b+'".');}).progress(function(a){(a=r[a])&&!c[a]&&e(w,a)});t&&(p=setTimeout(function(){var a,
b,e=0,g=0;for(c[d].state=2;a=f[e++];)for(g=0;b=k[g++];)a===b&&(k.splice(--g,1),f.splice(--e,1));throw Error("Load timeout of "+t+'ms exceeded for module "'+d+'". Missing "'+f.join('", "')+'".');},t))}function e(){var a=0,f,B,h,q,m=!1,k,r,n,x;if(arguments[0]!==w){for(;(n=arguments[a++])&&(_type=(typeof n)[0]);)if("s"===_type?k?x=1:k=n:"f"===_type?q?r?x=1:r=n:q=n:"o"===_type&&(g.is(n,"array")?(f={requires:n},m=!0):f?q=n:f=n),x)throw new TypeError("define called with unrecognized signature; `"+Array.prototype.join.call(arguments,
", ")+"`.");f=f||{};k=k||f.UID;q=q||f.factory;r=r||f.onRejected}else{if(!(a=l.pop()))throw Error("Inconsistent naming queue");k=arguments[1];f=a[0];q=a[1];r=a[3]}if(!q)if(f)q=f,f={};else throw Error('Missing factory for module "'+k+'"');if(c[k])throw Error('Duplicate entry for module "'+k+'"');if(k)if(a=c[k]=f,a.UID=k,a.amdStyle=m,a.factory=q,a.state=1,a.requires=g.is(a.requires,"array")&&a.requires,a.inherits=g.is(a.inherits,"array")&&a.inherits,a.compiles=g.is(a.compiles,"array")&&a.compiles,a.instances||
(a.instances={instance1:{}}),a.requires||a.compiles||a.inherits){m=[a.requires,a.inherits,a.compiles];m=[];a.requires&&z.apply(m,a.requires);a.inherits&&z.apply(m,a.inherits);a.compiles&&z.apply(m,a.compiles);for(a=0;f=m[a++];)if(c[f]&&3===c[f].state)m.splice(--a,1);else if(B=u.shim[f])h=v(u.paths[f]||h),q=g.is(B.exports,"function")?B.exports:function(){return window[B.exports]},D([h]).done(function(a,b){return function(){e(a,b)}}(f,q));m.length?g.subordinate(k,m,d):b(k)}else b(k);else l.unshift([f,
q,r])}var c={},a={},l=[],w={sentinel:1},z=Array.prototype.push,v=function(a){var b=a.toLowerCase(),c=b[0];"/"===c||"\\"===c||"h"===c&&(y[b.slice(0,7)]||y[b.slice(0,8)])||"f"===c&&y[b.slice(0,7)]||(a=u.baseUrl+a);".js"!==a.slice(-3)&&(a+=".js");return a};e.amd={};return e}();E("fandango",function(){return g});var F=l.fandango,G=l.define,v={fn:g,define:E,require:function(f){var b,d,e,c,a=[];for(b=0;d=f[b++];)e=d.toLowerCase(),c=e.slice(0,1),(isAbsolutePath=!!("/"===c||"\\"===c||"h"===c&&(y[e.slice(0,
7)]||y[e.slice(0,8)])||"f"===c&&y[e.slice(0,7)]))||(d=u.baseUrl+d),e.slice(-3)&&(d+=".js"),a.push(d);return D(a)},noConflict:function(f){l.define===E&&(l.define=G);f&&l.fandango===v&&(l.fandango=F);return v},defaults:function(f){return f?g.merge(u,f):u}};l.define||(l.define=v.define);l.require||(l.require=v.require);l.fandango=v})(this);

View File

@ -0,0 +1,20 @@
(function(r){function A(f){this.name="TimeoutError";this.message=f||""}function B(f){this.name="RejectedError";this.message=f||""}function F(f,c,e,g){var d,a,b=[],m,p,k,h=function(a){f.length===b.push(l[a].exports)&&(g&&clearTimeout(m),c(b))};g=g||v.timeout;for(k=0;p=f[k++];)if((d=l[p])&&1!==d.state)if(2===d.state)if(a=new B('Could resolve all dependencies; dependency "'+p+'" has been rejected.'),e)e(a);else throw a;else 3===d.state&&h(p);else(u[p]=u[p]||[]).push(h);g&&(m=setTimeout(function(){for(var c,
d,m=0,p=0;c=f[m++];)for(p=0;d=b[p++];)c===d&&(b.splice(--p,1),f.splice(--m,1));a=new A("Load timeout of "+g+'ms exceeded for module(s) "'+f.join('", "')+'".');if(e)e(a);else throw a;},g))}function y(){var f=!1,c,e,g,d,a,b,m;if(arguments[0]!==C){for(c=0;(e=arguments[c++])&&(_type=(typeof e)[0]);)if("s"===_type?d?g=1:d=e:"f"===_type?b?m?g=1:m=e:b=e:"o"===_type&&(h.is(e,"array")?(a={requires:e},f=!0):a?b=e:a=e),g)throw new TypeError("define called with unrecognized signature; `"+Array.prototype.join.call(arguments,
", ")+"`.");a=a||{};d=d||a.UID;b=b||a.factory;m=m||a.onRejected}else if(c=D.pop())d=arguments[1],a=c[0],b=c[1],m=c[2],f=c[3];else throw Error("Inconsistent naming queue");if(!b)if(a)b=a,a={};else throw Error('Missing factory for module "'+d+'"');if(l[d])throw Error('Duplicate entry for module "'+d+'"');d?(c=l[d]=a,c.UID=d,c.amdStyle=f,c.factory=b,c.state=1,c.requires=h.is(c.requires,"array")&&c.requires,c.inherits=h.is(c.inherits,"array")&&c.inherits,c.compiles=h.is(c.compiles,"array")&&c.compiles,
c.instances||(c.instances={instance1:{}})):D.unshift([a,b,m,f])}var l={},v={deepCopy:!0,baseUrl:"",namespace:"default",timeout:1E3,paths:{},shim:{}},h={},C={a:1},u={},D=[],z=Array.prototype.push;A.prototype=Error.prototype;B.prototype=Error.prototype;h.is=function(){var f=Object.prototype.hasOwnProperty,c=Object.prototype.toString,e={array:Array.isArray||function(a){return"[object Array]"==c.call(a)},arraylike:function(a){if(!a||!a.length&&0!==a.length||e.window(a))return!1;var b=a.length;return 1===
a.nodeType||e.array(a)||!e["function"](a)&&(0===b||"number"===typeof b&&0<b&&!h.is(a,"primitive")&&b-1 in a)},"boolean":function(a){return!0===a||!1===a},element:function(a){return!(!a||1!==a.nodeType)},finite:function(a){return isFinite(a)&&!isNaN(parseFloat(a))},integer:Number.isInteger||function(a){return"number"===typeof a&&e.finite(a)&&-9007199254740992<a&&9007199254740992>a&&Math.floor(a)===a},iterable:function(a){try{1 in obj}catch(b){return!1}return!0},nan:function(a){return e.number(a)&&
a!=+a},number:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},object:function(a){return a===Object(a)},primitive:function(a){return!0===a||!1===a||null==a||!!{string:1,number:1}[typeof a]},string:function(a){return"string"==typeof a||a instanceof String},undefined:function(a){return void 0===a},untyped:function(a){if(!a||a.nodeType||"[object Object]"!==c.call(a)||e.window(a))return!1;try{if(a.constructor&&!f.call(a,"constructor")&&!f.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(b){return!1}for(var d in a);
return void 0===d||f.call(a,d)},window:function(a){return null!=a&&a==a.window},empty:function(a){if(a){if(h.is(a,"array"))return 0===a.length;for(var b in a)if(f.call(a,b))return!1}return!0}},g=0,d=["Arguments","Date","Function","RegExp"];for(;4>g;g++)e[d[g].toLowerCase()]=function(a){a="[object "+a+"]";return function(b){return c.call(b)==a}}(d[g]);e.args=e.arguments;e.bool=e["boolean"];e.plain=e.untyped;return function(a,b){if(e["function"](b))return a===b(a);if(!e.string(b))return a===b;if((b=
b.toLowerCase())&&e[b])return e[b](a);throw'Unknown type "'+b+'"';}}();h.each=function(){var f=Array.prototype.some;return function(c,e,g){var d,a;if(void 0===c)return obj;g=g||h;if(f&&c.some===f)return c.some(e,g),c;if(h.is(c,"array")||h.is(c,"arraylike")){d=0;for(a=c.length;d<a&&(void 0===c[d]||!e.call(g,c[d],d,c));d++);return c}for(d in c)if(c.hasOwnProperty(d)&&e.call(g,c[d],d,c))break;return c}}();h.merge=function(f){var c,e,g,d,a;c=arguments.length;var b=!1;f=arguments[0];var m=1,p,k,l=0;if(!0===
f||!1===f)b=f,f=arguments[m],m++;h.is(arguments[c-1],"function")&&(a=arguments[c-1],c--);if(void 0===f)f={};else if(h.is(f,"primitive"))throw new TypeError("Cannot merge primitive data types: merge("+Array.prototype.join.call(arguments,", ")+")");k=h.is(f,"array");if(m<c)for(;d=arguments[m++];){k=k&&h.is(d,"array");for(g in d)e=f[g],c=d[g],void 0===c||c===f?k&&l--:(b&&c&&((p=h.is(c,"array"))||h.is(c,"untyped"))&&(c=h.merge(b,e&&(p?h.is(e,"array")?e:[]:h.is(e,"untyped")?e:{}),c,a)),a&&a(g,f,d)||(l&&
(g=+g+l),f[g]=c));l=0}return f};h.subordinate=function(){function f(a){if(!a||a.source===window&&a.data===g){var c=d.shift();a=c[0];var c=c[1],f=c.length;f?1===f?a(c[0]):2===f?a(c[0],c[1]):3===f?a(c[0],c[1],c[2]):4===f?a(c[0],c[1],c[2],c[3]):a.apply(0,c):a()}}var c=Array.prototype.slice,e=window.postMessage,g="__fandango@"+Math.random().toString(36),d=[],a=function(){return e?function(){e(g,"*")}:function(){setTimeout(f)}}();e&&window.addEventListener("message",f,!1);return function(b){a(d.push([arguments[arguments.length-
1],c.call(arguments).slice(0,-1)])-1)}}();var G=function(){var f={},c=[].slice,e=function(){return[]};return function(g,d){function a(a,c){return new b(a,c)}function b(a,b){var c=0,d=m(a,b),f=d.length;this.context=b||document;this.selector=a;for(this.length=f;c<f;c++)this[c]=d[c];return this}var m,p,k,h;if(f[g])return f[g];for(h=d.length;p=d[--h];){p.selector&&(m=p.selector);if(source=p.prototype)if("function"===typeof source)source.call(b.prototype);else if(b.prototype.prototype)for(k in source)source.hasOwnProperty(k)&&
(b.prototype[k]=source[k]);else b.prototype=source;if(source=p.utilities)if("function"===typeof source)source.utilities.call(a);else for(k in source)source.hasOwnProperty(k)&&(a[k]=source[k])}b.prototype.length=0;b.prototype.selector="";b.prototype.splice=c;b.prototype.fandango=1;m||(m=e);return f[g]=a}}(),E=function(){function f(c,f,g,d){var a,b=l[c],m=h.is(b.factory,"function"),p=m?b.factory.length:0,k=b.amdStyle,t,s;d&&(a=G(b.compiles+"",d));for(s in b.instances)d=b.instances[s],d.context=void 0===
d.context?b.context:d.context,d.deepCopy=void 0===d.deepCopy?b.deepCopy:d.deepCopy,d.namespace=void 0===d.namespace?b.namespace:d.namespace,t=[],k?t=f||[]:(a&&t.push(a),f&&t.push(f),p>t.length&&t.push(d.data?h.merge(d.deepCopy,{},d.data,b.data):b.data),p>t.length&&t.push(h.merge(d.deepCopy,{},d,b))),d.exports=m?b.factory.apply(d.context,t)||{}:b.factory,void 0===b.exports&&(b.exports=g?d.exports?h.merge(!0,{},g,d.exports):g:d.exports);b.state=3;if(u[c])for(;u[c].length;)u[c].pop()(c)}return function e(g,
d){var a,b=l[g],m=h.is(b.factory,"function")?b.factory.length:0,p=b.amdStyle,k=[],t,s,r;a=[];var q,n;if(!d&&(b.requires||b.compiles||b.inherits)){b.requires&&z.apply(a,b.requires);b.inherits&&z.apply(a,b.inherits);b.compiles&&z.apply(a,b.compiles);for(q=0;n=a[q++];)if(l[n])if(3===l[n].state)a.splice(--q,1);else if(2===l[n].state)throw Error('Could not instantiate "'+UID+'"; dependency "'+dependency+'" has been rejected.');if(0<a.length){h.subordinate(a,function(){e(g,!0)},x);return}}void 0===(a=b.deepCopy)&&
(a=v.deepCopy);b=l[g]=h.merge(a,{},v,b);if(m&&b.requires)for(s=b.requires&&(p?[]:{}),q=0;n=b.requires[q++];)l[n]?p?s.push(l[n].exports):h.is(l[n].exports,"function")?s[n]=l[n].exports:h.merge(a,s[n]={},l[n].exports):k.push(n);if(b.inherits)for(r=b.inherits&&{},q=0;n=b.inherits[q++];)l[n]?h.merge(a,r,l[n].exports):k.push(n);if(m&&b.compiles)for(t=b.compiles&&[],q=0;n=b.compiles[q++];)l[n]?t.push(l[n].exports):k.push(n);k.length?x(k,function(){},onError):f(g,s,r,t)}}();y.amd={};var x=function(){var f=
{},c=document.getElementsByTagName("head")[0],e="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),g=function(a){var b=document.createElement("script");b.setAttribute("id",a);b.type="text/javascript";b.charset="utf-8";b.async=!0;return b},d=!(!((d=g())&&d.attachEvent&&d.attachEvent.toString&&0<d.attachEvent.toString().indexOf("[native code"))||e);buildUrl=function(){var a={"http://":1,"https://":1,"file://":1};return function(b){var c=b.toLowerCase(),d=c[0];"/"===d||"\\"===d||"h"===d&&
(a[c.slice(0,7)]||a[c.slice(0,8)])||"f"===d&&a[c.slice(0,7)]||(b=v.baseUrl+b);".js"!==b.slice(-3)&&(b+=".js");return b}}();onErrorEvent=function(a,b,c,d){return function(e){f[b]=0;a.error=e||!0;d.parentElement.removeChild(d);if(a.onError)a.onError(e,c,b)}};onLoadEvent=function(a,b,c,d,e){return function(){if(2===f[b]){f[b]=3;if(a.onPartial)a.onPartial(b,c,d);e?d.onreadystatechange=null:(d.removeEventListener("load",a.loadListener),d.removeEventListener("error",a.errorListener));if(a.loaded.push(b)===
a.paths.length&&a.onDone)a.onDone(a.load)}}};get=function(a){for(var b=0,e,h,k;!a.error&&(e=a.paths[b++]);)h=a.names[b-1],f[e]=2,k=g(e),d?k.attachEvent("onreadystatechange",onLoadEvent(a,e,h,k,!0)):(a.loadListener=onLoadEvent(a,e,h,k),a.errorListener=onErrorEvent(a,e,h,k),k.addEventListener("load",a.loadListener,!1),k.addEventListener("error",a.errorListener,!1)),k.src=e,c.appendChild(k)};return function(a,b,c,d){var e=[],g=[],s={paths:[],names:[],loaded:[],error:null,loadListener:null,errorListener:null},
u,q,n,w,x;for(x=0;q=a[x++];)if(l[q])if(3===l[q].state)g.push(l[q].exports);else{if(2===l[q].state)throw Error("require(): Rejected dependency. Cannot continue.");E(q);e.push(q)}else f[u]||(u=buildUrl(v.paths[q]||q),s.paths.push(u),s.names.push(q)),e.push(q);b&&!e.length?b.apply(null,g):(s.paths&&(s.onError=function(a,b,d){a instanceof Event&&(a=Error('Could require "'+b+'"; an error occurred while trying to load "'+d+'".'));if(c)c(a);else throw a;},s.onPartial=function(a,b,c){l[b]||((n=v.shim[b])?
(w=h.is(n.exports,"function")?n.exports:function(){return r[n.exports]},y(b,w)):y(C,b));E(b);d&&d(a,c)},get(s)),F(e,function(a){b.apply(null,a)},s.onError))}}();y("fandango",h);var H=r.fandango,I=r.define,J=r.require,w={fn:h,define:y,require:x,noConflict:function(f){r.define===y&&(r.define=I);r.require===x&&(r.require=J);f&&r.fandango===w&&(r.fandango=H);return w},defaults:function(f){return f?h.merge(v,f):v}};r.define||(r.define=w.define);r.require||(r.require=w.require);r.fandango=w})(this);