Template:NKU China/js/diaporama

!function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var h=new Error("Cannot find module '"+a+"'");throw h.code="MODULE_NOT_FOUND",h}var f=r[a]={exports:{}};e[a][0].call(f.exports,function(t){var r=e[a][1][t];return i(r?r:t)},f,f.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(t,e,r){"use strict";window.Diaporama=t("diaporama"),window.Qajax=t("qajax")},{diaporama:9,qajax:55}],2:[function(t,e,r){!function(t){"object"==typeof r?e.exports=t():"function"==typeof define&&define.amd?define([],t):window.BezierEasing=t()}(function(){function t(t,e,h,f){function c(t,e){return 1-3*e+3*t}function l(t,e){return 3*e-6*t}function p(t){return 3*t}function d(t,e,r){return((c(e,r)*t+l(e,r))*t+p(e))*t}function g(t,e,r){return 3*c(e,r)*t*t+2*l(e,r)*t+p(e)}function m(e,n){for(var i=0;r>i;++i){var o=g(n,t,h);if(0===o)return n;var a=d(n,t,h)-e;n-=a/o}return n}function v(){for(var e=0;a>e;++e)E[e]=d(e*s,t,h)}function _(e,r,n){var a,s,u=0;do s=r+(n-r)/2,a=d(s,t,h)-e,a>0?n=s:r=s;while(Math.abs(a)>i&&++u<o);return s}function y(e){for(var r=0,i=1,o=a-1;i!=o&&E[i]<=e;++i)r+=s;--i;var u=(e-E[i])/(E[i+1]-E[i]),f=r+u*s,c=g(f,t,h);return c>=n?m(e,f):0===c?f:_(e,r,r+s)}function b(){T=!0,(t!=e||h!=f)&&v()}if(4!==arguments.length)throw new Error("BezierEasing requires 4 arguments.");for(var w=0;4>w;++w)if("number"!=typeof arguments[w]||isNaN(arguments[w])||!isFinite(arguments[w]))throw new Error("BezierEasing arguments should be integers.");if(0>t||t>1||0>h||h>1)throw new Error("BezierEasing x values must be in [0, 1] range.");var E=u?new Float32Array(a):new Array(a),T=!1,A=function(r){return T||b(),t===e&&h===f?r:0===r?0:1===r?1:d(y(r),e,f)};A.getControlPoints=function(){return[{x:t,y:e},{x:h,y:f}]};var x=[t,e,h,f],R="BezierEasing("+x+")";A.toString=function(){return R};var I="cubic-bezier("+x+")";return A.toCSS=function(){return I},A}var e=this,r=4,n=.001,i=1e-7,o=10,a=11,s=1/(a-1),u="Float32Array"in e;return t.css={ease:t(.25,.1,.25,1),linear:t(0,0,1,1),"ease-in":t(.42,0,1,1),"ease-out":t(0,0,.58,1),"ease-in-out":t(.42,0,.58,1)},t})},{}],3:[function(t,e,r){function n(t,e){var r=this;if(!(r instanceof n))return new n(t,e);var i,o=typeof t;if("number"===o)i=+t;else if("string"===o)i=n.byteLength(t,e);else{if("object"!==o||null===t)throw new TypeError("must start with number, buffer, array or string");"Buffer"===t.type&&P(t.data)&&(t=t.data),i=+t.length}if(i>D)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+D.toString(16)+" bytes");0>i?i=0:i>>>=0,n.TYPED_ARRAY_SUPPORT?r=n._augment(new Uint8Array(i)):(r.length=i,r._isBuffer=!0);var a;if(n.TYPED_ARRAY_SUPPORT&&"number"==typeof t.byteLength)r._set(t);else if(R(t))if(n.isBuffer(t))for(a=0;i>a;a++)r[a]=t.readUInt8(a);else for(a=0;i>a;a++)r[a]=(t[a]%256+256)%256;else if("string"===o)r.write(t,0,e);else if("number"===o&&!n.TYPED_ARRAY_SUPPORT)for(a=0;i>a;a++)r[a]=0;return i>0&&i<=n.poolSize&&(r.parent=B),r}function i(t,e){if(!(this instanceof i))return new i(t,e);var r=new n(t,e);return delete r.parent,r}function o(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=e.length;if(o%2!==0)throw new Error("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;n>a;a++){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");t[r+a]=s}return a}function a(t,e,r,n){var i=U(j(e,t.length-r),t,r,n);return i}function s(t,e,r,n){var i=U(S(e),t,r,n);return i}function u(t,e,r,n){return s(t,e,r,n)}function h(t,e,r,n){var i=U(k(e),t,r,n);return i}function f(t,e,r,n){var i=U(L(e,t.length-r),t,r,n);return i}function c(t,e,r){return N.fromByteArray(0===e&&r===t.length?t:t.slice(e,r))}function l(t,e,r){var n="",i="";r=Math.min(t.length,r);for(var o=e;r>o;o++)t[o]<=127?(n+=C(i)+String.fromCharCode(t[o]),i=""):i+="%"+t[o].toString(16);return n+C(i)}function p(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(127&t[i]);return n}function d(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(t[i]);return n}function g(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var i="",o=e;r>o;o++)i+=I(t[o]);return i}function m(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function v(t,e,r){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function _(t,e,r,i,o,a){if(!n.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>o||a>e)throw new RangeError("value is out of bounds");if(r+i>t.length)throw new RangeError("index out of range")}function y(t,e,r,n){0>e&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);o>i;i++)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function b(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);o>i;i++)t[r+i]=e>>>8*(n?i:3-i)&255}function w(t,e,r,n,i,o){if(e>i||o>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function E(t,e,r,n,i){return i||w(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),O.write(t,e,r,n,23,4),r+4}function T(t,e,r,n,i){return i||w(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),O.write(t,e,r,n,52,8),r+8}function A(t){if(t=x(t).replace(V,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function x(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function R(t){return P(t)||n.isBuffer(t)||t&&"object"==typeof t&&"number"==typeof t.length}function I(t){return 16>t?"0"+t.toString(16):t.toString(16)}function j(t,e){e=e||1/0;for(var r,n=t.length,i=null,o=[],a=0;n>a;a++){if(r=t.charCodeAt(a),r>55295&&57344>r){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(56320>r){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=i-55296<<10|r-56320|65536,i=null}else i&&((e-=3)>-1&&o.push(239,191,189),i=null);if(128>r){if((e-=1)<0)break;o.push(r)}else if(2048>r){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(2097152>r))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function S(t){for(var e=[],r=0;r<t.length;r++)e.push(255&t.charCodeAt(r));return e}function L(t,e){for(var r,n,i,o=[],a=0;a<t.length&&!((e-=2)<0);a++)r=t.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function k(t){return N.toByteArray(A(t))}function U(t,e,r,n){for(var i=0;n>i&&!(i+r>=e.length||i>=t.length);i++)e[i+r]=t[i];return i}function C(t){try{return decodeURIComponent(t)}catch(t){return String.fromCharCode(65533)}}var N=t("base64-js"),O=t("ieee754"),P=t("is-array");r.Buffer=n,r.SlowBuffer=i,r.INSPECT_MAX_BYTES=50,n.poolSize=8192;var D=1073741823,B={};n.TYPED_ARRAY_SUPPORT=function(){try{var t=new ArrayBuffer(0),e=new Uint8Array(t);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(t){return!1}}(),n.isBuffer=function(t){return!(null==t||!t._isBuffer)},n.compare=function(t,e){if(!n.isBuffer(t)||!n.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,i=e.length,o=0,a=Math.min(r,i);a>o&&t[o]===e[o];o++);return o!==a&&(r=t[o],i=e[o]),i>r?-1:r>i?1:0},n.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},n.concat=function(t,e){if(!P(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new n(0);if(1===t.length)return t[0];var r;if(void 0===e)for(e=0,r=0;r<t.length;r++)e+=t[r].length;var i=new n(e),o=0;for(r=0;r<t.length;r++){var a=t[r];a.copy(i,o),o+=a.length}return i},n.byteLength=function(t,e){var r;switch(t+="",e||"utf8"){case"ascii":case"binary":case"raw":r=t.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=2*t.length;break;case"hex":r=t.length>>>1;break;case"utf8":case"utf-8":r=j(t).length;break;case"base64":r=k(t).length;break;default:r=t.length}return r},n.prototype.length=void 0,n.prototype.parent=void 0,n.prototype.toString=function(t,e,r){var n=!1;if(e>>>=0,r=void 0===r||r===1/0?this.length:r>>>0,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return g(this,e,r);case"utf8":case"utf-8":return l(this,e,r);case"ascii":return p(this,e,r);case"binary":return d(this,e,r);case"base64":return c(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}},n.prototype.equals=function(t){if(!n.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:0===n.compare(this,t)},n.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},n.prototype.compare=function(t){if(!n.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:n.compare(this,t)},n.prototype.indexOf=function(t,e){function r(t,e,r){for(var n=-1,i=0;r+i<t.length;i++)if(t[r+i]===e[-1===n?0:i-n]){if(-1===n&&(n=i),i-n+1===e.length)return r+n}else n=-1;return-1}if(e>2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(n.isBuffer(t))return r(this,t,e);if("number"==typeof t)return n.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):r(this,[t],e);throw new TypeError("val must be string, number or Buffer")},n.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},n.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},n.prototype.write=function(t,e,r,n){if(isFinite(e))isFinite(r)||(n=r,r=void 0);else{var i=n;n=e,e=r,r=i}if(e=Number(e)||0,0>r||0>e||e>this.length)throw new RangeError("attempt to write outside buffer bounds");var c=this.length-e;r?(r=Number(r),r>c&&(r=c)):r=c,n=String(n||"utf8").toLowerCase();var l;switch(n){case"hex":l=o(this,t,e,r);break;case"utf8":case"utf-8":l=a(this,t,e,r);break;case"ascii":l=s(this,t,e,r);break;case"binary":l=u(this,t,e,r);break;case"base64":l=h(this,t,e,r);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":l=f(this,t,e,r);break;default:throw new TypeError("Unknown encoding: "+n)}return l},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},n.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),t>e&&(e=t);var i;if(n.TYPED_ARRAY_SUPPORT)i=n._augment(this.subarray(t,e));else{var o=e-t;i=new n(o,void 0);for(var a=0;o>a;a++)i[a]=this[a+t]}return i.length&&(i.parent=this.parent||this),i},n.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},n.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},n.prototype.readUInt8=function(t,e){return e||v(t,1,this.length),this[t]},n.prototype.readUInt16LE=function(t,e){return e||v(t,2,this.length),this[t]|this[t+1]<<8},n.prototype.readUInt16BE=function(t,e){return e||v(t,2,this.length),this[t]<<8|this[t+1]},n.prototype.readUInt32LE=function(t,e){return e||v(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},n.prototype.readUInt32BE=function(t,e){return e||v(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},n.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},n.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||v(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},n.prototype.readInt8=function(t,e){return e||v(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},n.prototype.readInt16LE=function(t,e){e||v(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt16BE=function(t,e){e||v(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt32LE=function(t,e){return e||v(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},n.prototype.readInt32BE=function(t,e){return e||v(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},n.prototype.readFloatLE=function(t,e){return e||v(t,4,this.length),O.read(this,t,!0,23,4)},n.prototype.readFloatBE=function(t,e){return e||v(t,4,this.length),O.read(this,t,!1,23,4)},n.prototype.readDoubleLE=function(t,e){return e||v(t,8,this.length),O.read(this,t,!0,52,8)},n.prototype.readDoubleBE=function(t,e){return e||v(t,8,this.length),O.read(this,t,!1,52,8)},n.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||_(this,t,e,r,Math.pow(2,8*r),0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i>>>0&255;return e+r},n.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||_(this,t,e,r,Math.pow(2,8*r),0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o>>>0&255;return e+r},n.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||_(this,t,e,1,255,0),n.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t,e+1},n.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||_(this,t,e,2,65535,0),n.TYPED_ARRAY_SUPPORT?(this[e]=t,this[e+1]=t>>>8):y(this,t,e,!0),e+2},n.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||_(this,t,e,2,65535,0),n.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t):y(this,t,e,!1),e+2},n.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||_(this,t,e,4,4294967295,0),n.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t):b(this,t,e,!0),e+4},n.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||_(this,t,e,4,4294967295,0),n.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t):b(this,t,e,!1),e+4},n.prototype.writeIntLE=function(t,e,r,n){t=+t,e>>>=0,n||_(this,t,e,r,Math.pow(2,8*r-1)-1,-Math.pow(2,8*r-1));var i=0,o=1,a=0>t?1:0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=(t/o>>0)-a&255;return e+r},n.prototype.writeIntBE=function(t,e,r,n){t=+t,e>>>=0,n||_(this,t,e,r,Math.pow(2,8*r-1)-1,-Math.pow(2,8*r-1));var i=r-1,o=1,a=0>t?1:0;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=(t/o>>0)-a&255;return e+r},n.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||_(this,t,e,1,127,-128),n.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=t,e+1},n.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||_(this,t,e,2,32767,-32768),n.TYPED_ARRAY_SUPPORT?(this[e]=t,this[e+1]=t>>>8):y(this,t,e,!0),e+2},n.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||_(this,t,e,2,32767,-32768),n.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t):y(this,t,e,!1),e+2},n.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||_(this,t,e,4,2147483647,-2147483648),n.TYPED_ARRAY_SUPPORT?(this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):b(this,t,e,!0),e+4},n.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||_(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),n.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t):b(this,t,e,!1),e+4},n.prototype.writeFloatLE=function(t,e,r){return E(this,t,e,!0,r)},n.prototype.writeFloatBE=function(t,e,r){return E(this,t,e,!1,r)},n.prototype.writeDoubleLE=function(t,e,r){return T(this,t,e,!0,r)},n.prototype.writeDoubleBE=function(t,e,r){return T(this,t,e,!1,r)},n.prototype.copy=function(t,e,r,i){if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&r>i&&(i=r),i===r)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>i)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);var o=i-r;if(1e3>o||!n.TYPED_ARRAY_SUPPORT)for(var a=0;o>a;a++)t[a+e]=this[a+r];else t._set(this.subarray(r,r+o),e);return o},n.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var i=j(t.toString()),o=i.length;for(n=e;r>n;n++)this[n]=i[n%o]}return this}},n.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(n.TYPED_ARRAY_SUPPORT)return new n(this).buffer;for(var t=new Uint8Array(this.length),e=0,r=t.length;r>e;e+=1)t[e]=this[e];return t.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var M=n.prototype;n._augment=function(t){return t.constructor=n,t._isBuffer=!0,t._set=t.set,t.get=M.get,t.set=M.set,t.write=M.write,t.toString=M.toString,t.toLocaleString=M.toString,t.toJSON=M.toJSON,t.equals=M.equals,t.compare=M.compare,t.indexOf=M.indexOf,t.copy=M.copy,t.slice=M.slice,t.readUIntLE=M.readUIntLE,t.readUIntBE=M.readUIntBE,t.readUInt8=M.readUInt8,t.readUInt16LE=M.readUInt16LE,t.readUInt16BE=M.readUInt16BE,t.readUInt32LE=M.readUInt32LE,t.readUInt32BE=M.readUInt32BE,t.readIntLE=M.readIntLE,t.readIntBE=M.readIntBE,t.readInt8=M.readInt8,t.readInt16LE=M.readInt16LE,t.readInt16BE=M.readInt16BE,t.readInt32LE=M.readInt32LE,t.readInt32BE=M.readInt32BE,t.readFloatLE=M.readFloatLE,t.readFloatBE=M.readFloatBE,t.readDoubleLE=M.readDoubleLE,t.readDoubleBE=M.readDoubleBE,t.writeUInt8=M.writeUInt8,t.writeUIntLE=M.writeUIntLE,t.writeUIntBE=M.writeUIntBE,t.writeUInt16LE=M.writeUInt16LE,t.writeUInt16BE=M.writeUInt16BE,t.writeUInt32LE=M.writeUInt32LE,t.writeUInt32BE=M.writeUInt32BE,t.writeIntLE=M.writeIntLE,t.writeIntBE=M.writeIntBE,t.writeInt8=M.writeInt8,t.writeInt16LE=M.writeInt16LE,t.writeInt16BE=M.writeInt16BE,t.writeInt32LE=M.writeInt32LE,t.writeInt32BE=M.writeInt32BE,t.writeFloatLE=M.writeFloatLE,t.writeFloatBE=M.writeFloatBE,t.writeDoubleLE=M.writeDoubleLE,t.writeDoubleBE=M.writeDoubleBE,t.fill=M.fill,t.inspect=M.inspect,t.toArrayBuffer=M.toArrayBuffer,t};var V=/[^+\/0-9A-z\-]/g},{"base64-js":4,ieee754:5,"is-array":6}],4:[function(t,e,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===a||e===c?62:e===s||e===l?63:u>e?-1:u+10>e?e-u+26+26:f+26>e?e-f:h+26>e?e-h+26:void 0}function r(t){function r(t){h[c++]=t}var n,i,a,s,u,h;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=t.length;u="="===t.charAt(f-2)?2:"="===t.charAt(f-1)?1:0,h=new o(3*t.length/4-u),a=u>0?t.length-4:t.length;var c=0;for(n=0,i=0;a>n;n+=4,i+=3)s=e(t.charAt(n))<<18|e(t.charAt(n+1))<<12|e(t.charAt(n+2))<<6|e(t.charAt(n+3)),r((16711680&s)>>16),r((65280&s)>>8),r(255&s);return 2===u?(s=e(t.charAt(n))<<2|e(t.charAt(n+1))>>4,r(255&s)):1===u&&(s=e(t.charAt(n))<<10|e(t.charAt(n+1))<<4|e(t.charAt(n+2))>>2,r(s>>8&255),r(255&s)),h}function i(t){function e(t){return n.charAt(t)}function r(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var i,o,a,s=t.length%3,u="";for(i=0,a=t.length-s;a>i;i+=3)o=(t[i]<<16)+(t[i+1]<<8)+t[i+2],u+=r(o);switch(s){case 1:o=t[t.length-1],u+=e(o>>2),u+=e(o<<4&63),u+="==";break;case 2:o=(t[t.length-2]<<8)+t[t.length-1],u+=e(o>>10),u+=e(o>>4&63),u+=e(o<<2&63),u+="="}return u}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="+".charCodeAt(0),s="/".charCodeAt(0),u="0".charCodeAt(0),h="a".charCodeAt(0),f="A".charCodeAt(0),c="-".charCodeAt(0),l="_".charCodeAt(0);t.toByteArray=r,t.fromByteArray=i}("undefined"==typeof r?this.base64js={}:r)},{}],5:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<<s)-1,h=u>>1,f=-7,c=r?i-1:0,l=r?-1:1,p=t[e+c];for(c+=l,o=p&(1<<-f)-1,p>>=-f,f+=s;f>0;o=256*o+t[e+c],c+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=n;f>0;a=256*a+t[e+c],c+=l,f-=8);if(0===o)o=1-h;else{if(o===u)return a?0/0:(p?-1:1)*(1/0);a+=Math.pow(2,n),o-=h}return(p?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,u,h=8*o-i-1,f=(1<<h)-1,c=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,g=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),e+=a+c>=1?l/u:l*Math.pow(2,1-c),e*u>=2&&(a++,u/=2),a+c>=f?(s=0,a=f):a+c>=1?(s=(e*u-1)*Math.pow(2,i),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&s,p+=d,s/=256,i-=8);for(a=a<<i|s,h+=i;h>0;t[r+p]=255&a,p+=d,a/=256,h-=8);t[r+p-d]|=128*g}},{}],6:[function(t,e,r){var n=Array.isArray,i=Object.prototype.toString;e.exports=n||function(t){return!!t&&"[object Array]"==i.call(t)}},{}],7:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function a(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!o(t)||0>t||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,o,u,h;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],s(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:for(n=arguments.length,o=new Array(n-1),u=1;n>u;u++)o[u-1]=arguments[u];r.apply(this,o)}else if(a(r)){for(n=arguments.length,o=new Array(n-1),u=1;n>u;u++)o[u-1]=arguments[u];for(h=r.slice(),n=h.length,u=0;n>u;u++)h[u].apply(this,o)}return!0},n.prototype.addListener=function(t,e){var r;if(!i(e))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned){var r;r=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(r)){for(s=o;s-->0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(0>n)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.listenerCount=function(t,e){var r;return r=t._events&&t._events[e]?i(t._events[e])?1:t._events[e].length:0}},{}],8:[function(t,e,r){function n(){if(!s){s=!0;for(var t,e=a.length;e;){t=a,a=[];for(var r=-1;++r<e;)t[r]();e=a.length}s=!1}}function i(){}var o=e.exports={},a=[],s=!1;o.nextTick=function(t){a.push(t),s||setTimeout(n,0)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=i,o.addListener=i,o.once=i,o.off=i,o.removeListener=i,o.removeAllListeners=i,o.emit=i,o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],9:[function(t,e,r){e.exports=t("./lib/Diaporama")},{"./lib/Diaporama":11}],10:[function(t,e,r){e.exports={TRANSITION:0,KENBURNS:[1,2,3],CANVAS2D:[4,5,6],sort:function(t,e){return t-e}}},{}],11:[function(t,e,r){function n(t,e){return p.sort(t[1].channel,e[1].channel)}function i(t){if(u||(u=new y),t){if("webgl"===t||"canvas"===t)return u.supported()?"webgl":null}else t=u.supported()?"webgl":"dom";return t}function o(t,e,r){switch(r){case"webgl":return new g(t,e);case"dom":return new m(t,e)}return null}function a(t,e,r,n,i){var o=T(r/n)+r*i/(e-t);return t+(e-t)*Math.max(0,Math.min(o,1))}function s(t,e,r){if(!(this instanceof s))return new s(t,e,r);if(!t||!t.nodeType)throw new Error("Diaporama: a DOM container is required.");e&&!r&&e.data&&(r=e,e=null),r||(r={}),this._runningSegments=[],this._renderingMode=i(r.renderingMode),this._rendering=o(t,r.backgroundColor||this._backgroundColor,this._renderingMode),delete r.renderingMode,delete r.backgroundColor,this._handleResize=this._handleResize.bind(this),this._handleRender=this._handleRender.bind(this),this._container=t;for(var n in r)this[n]=r[n];e&&(this.data=e),(null===this._width||null===this._height)&&this.fitToContainer();var a=this;this.once("canplay",function(){a.renderNow()}),this.once("canplaythrough",function(){a._autoplay?a._start():a._requestRender()}),this._requestResize()}var u,h=t("raf"),f=t("events").EventEmitter,c=t("object-assign"),l=t("bezier-easing"),p=t("./Channels"),d=t("./findTransitionByName"),g=t("./DiaporamaRenderingCanvas"),m=t("./DiaporamaRenderingDOM"),v=t("./TimeInterval"),_=t("./DiaporamaFormatError"),y=t("./WebGLDetector"),b=0,w=1,E=2,T=l(.4,0,.8,1);s.prototype=c({},f.prototype,{destroy:function(){this.emit("destroy"),this.removeAllListeners(),this._stopCurrentDiaporamaLoading&&(this._stopCurrentDiaporamaLoading(),this._stopCurrentDiaporamaLoading=null),this._stop(),this._rendering.destroy()},play:function(){this.paused=!1},pause:function(){this.paused=!0},next:function(t){var e=this._slideIndexForTime(this._slidingTarget?this._slidingTarget.to:this._currentTime);if(-1!==e){if(e++,e>=this._slideTimes.length){if(!this._loop)return;e=0}this._slideToTime(this._slideTimes[e],t)}},prev:function(t){var e=this._slideIndexForTime(this._slidingTarget?this._slidingTarget.to:this._currentTime);if(-1!==e){if(e--,0>e){if(!this._loop)return;e=this._slideTimes.length-1}this._slideToTime(this._slideTimes[e],t)}},jump:function(t,e){if("number"!=typeof t)throw new Error("Diaporama#jump requires the slide index number.");if(!(0>t||t>=this._slideTimes.length)){var r=this._slideIndexForTime(this._currentTime);r!==t&&this._slideToTime(this._slideTimes[t],e)}},fitToContainer:function(){var t=this._container,e=t.getBoundingClientRect();this._width=e.width,this._height=e.height,this._requestResize()},_playbackRate:1,_loop:!1,_autoplay:!1,_paused:!0,_width:null,_height:null,_resolution:window.devicePixelRatio||1,_currentTime:0,_duration:0,_backgroundColor:[0,0,0],_curLoop:null,_startLoopId:0,_needResize:null,_needRender:null,_slidingTarget:null,_loadImages:function(){function t(){c||(c=1,s.emit("canplay"),s._requestRender())}function e(){l||(l=1,s.emit("canplaythrough"),s._requestRender())}function r(){s.emit("load"),s._requestRender()}function n(){if(f.length===h.length)t(),e(),r(),a();else if(c||d&&-1===f.indexOf(d)||t(),c&&!l){var n=Date.now()-p,i=s._duration;.8*f.length/h.length>n/i&&e()}}function i(t){-1!==h.indexOf(t)&&(s.emit("progress",f.length/h.length),f.push(t),n())}function o(t,e){s.emit("error",new Error("Failure to load "+t),e),a()}function a(){u.removeListener("load",i),u.removeListener("error",o),clearInterval(g)}this._stopCurrentDiaporamaLoading&&(this._stopCurrentDiaporamaLoading(),this._stopCurrentDiaporamaLoading=null);var s=this,u=this._rendering.images,h=[],f=[];this._data.timeline.forEach(function(t){var e=t.image;e&&(u.has(e)||h.push(e))});var c,l;if(0===h.length)return t(),e(),void r();var p=Date.now(),d=h[0],g=setInterval(n,200);u.on("load",i),u.on("error",o);for(var m=0;m<h.length;++m)u.load(h[m]);this._stopCurrentDiaporamaLoading=a},_loadTransitions:function(){var t=this._rendering.transitions;if(t){var e=this._data.transitions||this.GlslTransitions||{};this._data.timeline.forEach(function(r){var n=r.transitionNext&&r.transitionNext.name;if(n&&!t.has(n)){var i=d(n,e);i&&t.set(n,i)}})}},_requestResize:function(){null===this._needResize&&(this._needResize=h(this._handleResize))},_handleResize:function(){null!==this._needResize&&(this._needResize=null,this._resize())},_resize:function(){var t=this._width,e=this._height,r=this._resolution;this._rendering.resize(t,e,r);for(var n=0;n<this._runningSegments.length;++n)this._runningSegments[n][1].resize(t,e,r);this.emit("resize",t,e),this._requestRender()},_computeTimelineSegments:function(){for(var t;t=this._runningSegments.pop();){var e=t[1].leave();e&&this.emit.apply(this,e)}for(var r,i=this.loop,o=this._data,a=o.timeline.length,s=0,u=0,h=[],f=[],l=[],d=0;a>d;d++){h.push(s);var g=o.timeline[d],m=g.duration||0,y=g.transitionNext,b=y&&y.duration||0,w=d===a-1?2:d%2;if(g.image){if(0===d){var E=c({},g);E.kenburns=c({},E.kenburns),E.kenburns.to=E.kenburns.from,r=new this._rendering.SegmentKenBurns(p.KENBURNS[w],E)}t=new this._rendering.SegmentKenBurns(p.KENBURNS[w],g)}else{if(!g.canvas2d)throw new _("timeline item can't be understood as a segment.",g);0===d&&(r=new this._rendering.SegmentCanvas2d(p.CANVAS2D[w],g)),t=new this._rendering.SegmentCanvas2d(p.CANVAS2D[w],g)}f.push([new v(s-u,i||d!==a-1?s+m+b:s+m),t]),u=b,s+=m,b&&(l.push({interval:new v(s,s+b),index:d}),s+=b)}for(var T=s-u,A=[],x=0;x<l.length;++x){var R=l[x],I=R.index,j=I+1<o.timeline.length?I+1:0,S=f[I][1],L=f[j][1],k=o.timeline[I].transitionNext;(0!==j||i)&&A.push([R.interval,new this._rendering.SegmentTransition(p.TRANSITION,k,S,L)])}if(i&&f.length){var U=f[0][0].clone();U.add(T),f.push([U,r])}f=A.concat(f),f.sort(n),this._slideTimes=h,this._segments=f,this._duration=T,this._lastTransitionDuration=u},_slideIndexForTime:function(t){var e=this._slideTimes;if(!e)return-1;t=this._normalizeTime(t);for(var r=e.length,n=0;r>n;++n)if(t<e[n])return n-1;return r-1},_slideToTime:function(t,e){var r=this._currentTime;if(t!==r){if(this._loop){var n=this._duration,i=Math.abs(t-r),o=Math.abs(t+n-r),a=Math.abs(t-n-r);(i>o||i>a)&&(a>o?t+=n:t-=n)}if(this.paused||!e)this._currentTime=t,this._requestRender();else{var s=this._playbackRate;this._slidingTarget={ from:r,to:t,startTime:null,duration:e,initialPlaybackRate:t>r==s>0?s:0}}}},renderNow:function(){this._needRender=!0,this._handleRender()},_requestRender:function(){null===this._curLoop&&null===this._needRender&&(this._needRender=h(this._handleRender))},_handleRender:function(){null!==this._needRender&&(this._needRender=null,this._render())},_normalizeTime:function(t){var e=this._duration;if(this._loop){if(!e)return 0;var r=this._lastTransitionDuration;return e+=r,(t+e)%e}return Math.max(0,Math.min(t,e))},_render:function(){this._handleResize();var t=this._segments;if(0!==t.length){var e,r,i=this._normalizeTime(this._currentTime),o=this._runningSegments,a=this._rendering,s=!1,u=[],h=[],f=t.length;for(e=0;f>e;++e){r=t[e];var c=o.indexOf(r),l=-1!==c;if(r[0].timeInside(i)){if(!l){if(!r[1].ready(a)){s=!0;continue}o.push(r),u.push(r[1])}}else l&&(o.splice(c,1),h.push(r[1]))}for(o.sort(n),e=h.length-1;e>=0;e--){r=h[e];var p=r.leave();p&&this.emit.apply(this,p)}for(e=u.length-1;e>=0;e--){r=u[e];var d=r.enter(a);d&&this.emit.apply(this,d)}if(o.length>0){for(var g=o.length-1;g>=0;g--){var m=o[g];m[1].render(m[0].interpolate(i))}return this._rendering.switchChannel(o[0][1].channel),s?w:E}return b}},_start:function(){var t,e=this,r=++this._startLoopId;this._curLoop=h(function n(i){if(e._startLoopId===r){h(n),t||(t=i,e.emit("play"));var o=i-t;t=i;var s=e._render();if(s===b)e.loop?e.currentTime=0:e._stop(!0);else if(s===E){var u=e._slidingTarget;if(null!==u){null===u.startTime&&(u.startTime=i);var f=i-u.startTime,c=a(u.from,u.to,f,u.duration,u.initialPlaybackRate);Math.abs(u.to-c)<10||f>=u.duration?(e._currentTime=u.to,e._slidingTarget=null):e._currentTime=c}else e._currentTime=e._normalizeTime(e._currentTime+o*e._playbackRate)}}})},_stop:function(t){this._startLoopId++,this._slidingTarget&&(this.currentTime=this._slidingTarget.endAt,this._slidingTarget=null),null!==this._curLoop&&(h.cancel(this._curLoop),this._curLoop=null,this.emit("pause"),t&&this.emit("ended"))}}),Object.defineProperties(s.prototype,{loop:{set:function(t){this._loop!==t&&(this._loop=t,this._data&&(this._computeTimelineSegments(this._data),this._requestRender()))},get:function(){return this._loop}},autoplay:{set:function(t){this._autoplay=t},get:function(){return this._autoplay}},data:{set:function(t){var e=this._data;e!==t&&(this._data=t,0===t.timeline.length&&this._rendering.emptyChild(),this._computeTimelineSegments(e),this._loadTransitions(),this._loadImages(),this._requestRender())},get:function(){return this._data}},resolution:{set:function(t){t!==this._resolution&&(this._resolution=t,this._requestResize())},get:function(){return this._resolution}},width:{set:function(t){t!==this._width&&(this._width=t,this._requestResize())},get:function(){return this._width}},height:{set:function(t){t!==this._height&&(this._height=t,this._requestResize())},get:function(){return this._height}},currentTime:{set:function(t){t!==this._currentTime&&(this._currentTime=this._normalizeTime(t),this._requestRender())},get:function(){return this._currentTime}},playbackRate:{set:function(t){this._playbackRate=t},get:function(){return this._playbackRate}},paused:{set:function(t){var e=null===this._curLoop;t!==e&&(t?this._stop():this._start())},get:function(){return null===this._curLoop}},duration:{get:function(){return this._duration},set:function(){throw new Error("Diaporama: duration is a read-only value.")}},renderingMode:{get:function(){return this._renderingMode},set:function(){throw new Error("Diaporama: setting renderingMode afterwards is not supported.")}},backgroundColor:{get:function(){return this._backgroundColor},set:function(){throw new Error("Diaporama: setting backgroundColor afterwards is not supported.")}}}),e.exports=s},{"./Channels":10,"./DiaporamaFormatError":12,"./DiaporamaRenderingCanvas":15,"./DiaporamaRenderingDOM":17,"./TimeInterval":22,"./WebGLDetector":23,"./findTransitionByName":24,"bezier-easing":2,events:7,"object-assign":50,raf:57}],12:[function(t,e,r){function n(t,e){this.message=t,this.stack=(new Error).stack}n.prototype=new Error,n.prototype.name="DiaporamaFormatError",e.exports=n},{}],13:[function(t,e,r){function n(t,e,r,n){s.call(this,t,e),this.segmentFrom=r,this.segmentTo=n}var i=t("object-assign"),o=t("gl-texture2d"),a=t("bezier-easing"),s=t("../SegmentTimeline");n.prototype=i({},s.prototype,{toString:function(){return"SegmentTransition("+this.channel+","+this.segmentFrom.channel+"~>"+this.segmentTo.channel+")"},ready:function(t){return this.segmentFrom.ready(t)&&this.segmentTo.ready(t)&&(!this.data.name||t.transitions.has(this.data.name))},enter:function(t){var e=this.data,r=t.transitions.getOrFade(e.name),n=t.getChannelContext(this.channel);return this.gl=n,this.from=t.getChannel(this.segmentFrom.channel),this.to=t.getChannel(this.segmentTo.channel),this.fromTexture=o(n,this.from),this.toTexture=o(n,this.to),this.uniforms=i({},r.uniforms,e.uniforms||{}),this.duration=e.duration||1e3,this.easing=a.apply(null,e.easing||[0,0,1,1]),this.t=r.t,["transition",this.data,this.segmentFrom.data,this.segmentTo.data]},resize:function(){this.fromTexture&&this.fromTexture.dispose(),this.toTexture&&this.toTexture.dispose(),this.fromTexture=o(this.gl,this.from),this.toTexture=o(this.gl,this.to),this.t.render(this.easing(this._p||0),this.fromTexture,this.toTexture,this.uniforms)},leave:function(){return this.fromTexture&&this.fromTexture.dispose(),this.toTexture&&this.toTexture.dispose(),this.fromTexture=null,this.toTexture=null,["transitionEnd",this.data,this.segmentFrom.data,this.segmentTo.data]},render:function(t){this._p=t,this.fromTexture.setPixels(this.from),this.toTexture.setPixels(this.to),this.t.render(this.easing(t),this.fromTexture,this.toTexture,this.uniforms)}}),e.exports=n},{"../SegmentTimeline":20,"bezier-easing":2,"gl-texture2d":37,"object-assign":50}],14:[function(t,e,r){function n(t){this.gl=t,this.ts={},this.set("fade",o)}var i=t("glsl-transition"),o=t("glsl-transition-fade");n.prototype={destroy:function(){for(var t in this.ts)this.ts[t].t.dispose();this.ts=null},has:function(t){return t in this.ts},set:function(t,e){var r=i(this.gl,e.glsl);this.ts[t]={t:r,uniforms:e.uniforms||{}}},get:function(t){return this.ts[t]},getOrFade:function(t){return t&&this.ts[t]||this.ts.fade}},e.exports=n},{"glsl-transition":38,"glsl-transition-fade":53}],15:[function(t,e,r){function n(t,e){this._container=t,this._container.style.backgroundColor="rgb("+e.map(function(t){return~~(255*t)})+")",this._canvases={},this._ctxs={},this.createDOM(),this.images=new h,this.transitions=new u(this.getChannelContext(f.TRANSITION))}var i=t("kenburns-webgl"),o=t("./SegmentGlslTransition"),a=t("../SegmentKenBurns"),s=t("../SegmentCanvas2d"),u=t("./StoreTransitions"),h=t("../StoreImages"),f=t("../Channels");n.prototype={SegmentTransition:o,SegmentKenBurns:a,SegmentCanvas2d:s,destroy:function(){this.emptyChild(),this.images.destroy(),this.transitions.destroy();for(var t in this._ctxs)this._ctxs[t].destroy&&this._ctxs[t].destroy();this._canvases=null,this._ctxs=null},resize:function(t,e,r){var n=t*r,i=e*r;for(var o in this._canvases){var a=this._canvases[o];a.style.width=t+"px",a.style.height=e+"px",a.width=n,a.height=i}this._container.style.width=t+"px",this._container.style.height=e+"px"},getChannel:function(t){return this._canvases[t]},getChannelContext:function(t){return this._ctxs[t]},switchChannel:function(t){t!==this._c&&this._setChild(this._canvases[t])},createDOM:function(){var t,e;t=document.createElement("canvas"),e=t.getContext("webgl"),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),this._attachChannel(f.TRANSITION,t,e),f.KENBURNS.forEach(function(r){t=document.createElement("canvas"),e=new i(t),this._attachChannel(r,t,e)},this),f.CANVAS2D.forEach(function(r){t=document.createElement("canvas"),e=t.getContext("2d"),this._attachChannel(r,t,e)},this)},emptyChild:function(){return this._setChild()},_attachChannel:function(t,e,r){this._canvases[t]=e,this._ctxs[t]=r},_setChild:function(t){this._c=t;var e=this._container,r=e.children[0];r&&e.removeChild(r),t&&e.appendChild(t)}},e.exports=n},{"../Channels":10,"../SegmentCanvas2d":18,"../SegmentKenBurns":19,"../StoreImages":21,"./SegmentGlslTransition":13,"./StoreTransitions":14,"kenburns-webgl":49}],16:[function(t,e,r){function n(t,e,r,n){a.call(this,t,e),this.segmentFrom=r,this.segmentTo=n}var i=t("object-assign"),o=t("bezier-easing"),a=t("../SegmentTimeline");n.prototype=i({},a.prototype,{toString:function(){return"SegmentTransition("+this.channel+","+this.segmentFrom.channel+"~>"+this.segmentTo.channel+")"},ready:function(t){return this.segmentFrom.ready(t)&&this.segmentTo.ready(t)},enter:function(t){var e=this.data,r=t.getChannel(this.segmentFrom.channel),n=t.getChannel(this.segmentTo.channel),i=t.getChannel(this.channel);return r.style.position="absolute",r.style.top=0,r.style.left=0,n.style.position="absolute",n.style.top=0,n.style.left=0,i.appendChild(n),i.appendChild(r),this.container=i,this.from=r,this.to=n,this.duration=e.duration||1e3,this.easing=o.apply(null,e.easing||[0,0,1,1]),["transition",e,this.segmentFrom.data,this.segmentTo.data]},resize:function(){},leave:function(){return this.container.removeChild(this.from),this.container.removeChild(this.to),this.from.style.opacity=1,this.to.style.opacity=1,["transitionEnd",this.data,this.segmentFrom.data,this.segmentTo.data]},render:function(t){var e=this.easing(t);this.from.style.opacity=1-e}}),e.exports=n},{"../SegmentTimeline":20,"bezier-easing":2,"object-assign":50}],17:[function(t,e,r){function n(t,e){this._container=t,this._container.style.backgroundColor="rgb("+e.map(function(t){return~~(255*t)})+")",this._nodes={},this._ctxs={},this.createDOM(),this.images=new a}var i=t("kenburns-dom"),o=t("../Channels"),a=t("../StoreImages"),s=t("./SegmentDomTransition"),u=t("../SegmentKenBurns"),h=t("../SegmentCanvas2d");n.prototype={SegmentTransition:s,SegmentKenBurns:u,SegmentCanvas2d:h,destroy:function(){this.emptyChild(),this.images.destroy();for(var t in this._ctxs)this._ctxs[t].destroy&&this._ctxs[t].destroy();this._nodes=null,this._ctxs=null},resize:function(t,e,r){this._w=t,this._h=e;var n=t*r,i=e*r;for(var o in this._nodes){var a=this._nodes[o];a.style.width=t+"px",a.style.height=e+"px","CANVAS"===a.nodeName&&(a.width=n,a.height=i)}this._container.style.width=t+"px",this._container.style.height=e+"px"},getSize:function(){return{width:this._w,height:this._h}},getChannel:function(t){return this._nodes[t]},getChannelContext:function(t){return this._ctxs[t]},switchChannel:function(t){t!==this._c&&(this._c=t,this._setChild(this._nodes[t]))},createDOM:function(){var t=document.createElement("div");this._attachChannel(o.TRANSITION,t,t),o.KENBURNS.forEach(function(t){var e=document.createElement("div"),r=new i(e);r.getViewport=this.getSize.bind(this),this._attachChannel(t,e,r)},this),o.CANVAS2D.forEach(function(t){var e=document.createElement("canvas"),r=e.getContext("2d");this._attachChannel(t,e,r)},this)},emptyChild:function(){return this._setChild()},_attachChannel:function(t,e,r){this._nodes[t]=e,this._ctxs[t]=r},_setChild:function(t){var e=this._container,r=e.children[0];r&&e.removeChild(r),t&&e.appendChild(t)}},e.exports=n},{"../Channels":10,"../SegmentCanvas2d":18,"../SegmentKenBurns":19,"../StoreImages":21,"./SegmentDomTransition":16,"kenburns-dom":48}],18:[function(t,e,r){function n(t,e){o.call(this,t,e),this._needRender=!1}var i=t("object-assign"),o=t("./SegmentTimeline"),a=t("rect-crop");n.prototype=i({},o.prototype,{toString:function(){return"SegmentCanvas2d("+this.channel+")"},ready:function(){return!0},enter:function(t){return this.ctx=t.getChannelContext(this.channel),this._render(),["slide",this.data]},resize:function(){this._needRender=!0},leave:function(){return["slideEnd",this.data]},render:function(){this._needRender&&this._render()},_render:function(){this._needRender=!1;var t=this.ctx,e=t.canvas,r=e.width,n=e.height,i=this.data.canvas2d,o=i.size||[1e3,1e3],s=o[0],u=o[1],h=i.background||"black",f=i.draws||[];t.save(),t.fillStyle=h,t.fillRect(0,0,r,n);var c=a.largest({width:s,height:u},e);t.translate(Math.round(c[0]),Math.round(c[1])),t.scale(c[2]/s,c[3]/u);for(var l=0;l<f.length;++l){var p=f[l];if(p instanceof Array){var d=p.slice(1);t[p[0]].apply(t,d)}else for(var g in p)t[g]=p[g]}t.restore()}}),e.exports=n},{"./SegmentTimeline":20,"object-assign":50,"rect-crop":60}],19:[function(t,e,r){function n(t,e){h.call(this,t,e),this.clamped=!0}var i=t("object-assign"),o=t("rect-clamp"),a=t("rect-crop"),s=t("rect-mix"),u=t("bezier-easing"),h=t("./SegmentTimeline");n.prototype=i({},h.prototype,{toString:function(){return"SegmentKenBurns("+this.channel+")"},ready:function(t){return t.images.has(this.data.image)},enter:function(t){var e=this.data,r=t.images.get(e.image),n=t.getChannelContext(this.channel);this.kenburns=n,this.image=r,this.div=t.getChannel(this.channel),t.getSize&&(this.getSize=t.getSize.bind(t));var i=a.largest,o=a.largest;return e.kenburns&&(e.kenburns.from&&(i=a.apply(null,e.kenburns.from)),e.kenburns.to&&(o=a.apply(null,e.kenburns.to))),this.from=i,this.to=o,this.easing=u.apply(null,e.kenburns&&e.kenburns.easing||[0,0,1,1]),this.viewport=[0,0,r.width,r.height],this.computeBounds(),n.runStart&&n.runStart(r),["slide",e]},resize:function(){this.computeBounds()},leave:function(){var t=this.kenburns;return t.runEnd&&t.runEnd(),["slideEnd",this.data]},render:function(t){var e=this.image,r=this.kenburns,n=s(this.fromCropBound,this.toCropBound,this.easing(t));this.clamped&&(n=o(n,this.viewport)),r.draw(e,n)},cropBound:function(t){var e=this.image,r=t(this.getSize?this.getSize():this.div,e);return this.clamped&&(r=o(r,this.viewport)),r},computeBounds:function(){this.fromCropBound=this.cropBound(this.from),this.toCropBound=this.cropBound(this.to)}}),e.exports=n},{"./SegmentTimeline":20,"bezier-easing":2,"object-assign":50,"rect-clamp":59,"rect-crop":60,"rect-mix":61}],20:[function(t,e,r){function n(t,e){this.channel=t,this.data=e}var i=t("./noop");n.prototype={toString:function(){return"SegmentTimeline("+this.channel+")"},ready:function(){return!0},enter:i,leave:i,render:i,resize:i},e.exports=n},{"./noop":26}],21:[function(t,e,r){function n(t){this.imgs={},this._loading=[],this._threshold=t||3,this._queue=[]}var i=t("object-assign"),o=t("events").EventEmitter;n.prototype=i({},o.prototype,{destroy:function(){this.removeAllListeners(),this.imgs={},this._loading=[],this._queue=[]},has:function(t){return t in this.imgs},get:function(t){return this.imgs[t]},load:function(t){this._loading.length>=this._threshold?this._queue.push(t):this._loadImage(t)},_loadImage:function(t){if(-1===this._loading.indexOf(t)){var e=this,r=new window.Image;r.crossOrigin=!0,this._take(t),r.onload=function(){e._release(t)&&(e.imgs[t]=r,e.emit("load",t,r))},r.onabort=r.onerror=function(r){e._release(t)&&(e.imgs[t]=null,e.emit("error",t,r))},r.src=t}},_take:function(t){this._loading.push(t)},_release:function(t){var e=this._loading.indexOf(t);if(-1===e)return!1;if(this._loading.splice(e,1),this._queue.length>0){var r=this._queue.shift();this._loadImage(r)}return!0}}),e.exports=n},{events:7,"object-assign":50}],22:[function(t,e,r){function n(t,e){this.startT=t,this.endT=e}var i=t("./mix");n.prototype={toString:function(){return"TimeInterval("+this.startT+","+this.endT+")"},clone:function(){return new n(this.startT,this.endT)},add:function(t){this.startT+=t,this.endT+=t},timeInside:function(t){return this.startT<=t&&t<this.endT},interpolate:function(t){return i(this.startT,this.endT,t)}},e.exports=n},{"./mix":25}],23:[function(t,e,r){function n(){this.canvas=document.createElement("canvas"),this.canvas.addEventListener("webglcontextlost",function(t){t.preventDefault(),this.gl=null}.bind(this),!1)}var i=t("webglew");n.prototype={supported:function(){if(this.gl||(this.gl=this.canvas.getContext("webgl")),!this.gl)return!1;var t=i(this.gl);return t.OES_texture_float}},e.exports=n},{webglew:52}],24:[function(t,e,r){e.exports=function(t,e){for(var r=0;r<e.length;++r)if(e[r].name.toLowerCase()===t.toLowerCase())return e[r]}},{}],25:[function(t,e,r){e.exports=function(t,e,r){return Math.max(0,Math.min(1,(r-t)/(e-t)))}},{}],26:[function(t,e,r){e.exports=function(){}},{}],27:[function(t,e,r){"use strict";function n(t){if(!t)return s;for(var e=0;e<t.args.length;++e){var r=t.args[e];t.args[e]=0===e?{name:r,lvalue:!0,rvalue:!!t.rvalue,count:t.count||1}:{name:r,lvalue:!1,rvalue:!0,count:1}}return t.thisVars||(t.thisVars=[]),t.localVars||(t.localVars=[]),t}function i(t){return a({args:t.args,pre:n(t.pre),body:n(t.body),post:n(t.proc),funcName:t.funcName})}function o(t){for(var e=[],r=0;r<t.args.length;++r)e.push("a"+r);var n=new Function("P",["return function ",t.funcName,"_ndarrayops(",e.join(","),") {P(",e.join(","),");return a0}"].join(""));return n(i(t))}var a=t("cwise-compiler"),s={body:"",args:[],thisVars:[],localVars:[]},u={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};!function(){for(var t in u){var e=u[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var h={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in h){var e=h[t];r[t]=o({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=o({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var f={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in f){var e=f[t];r[t]=o({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=o({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=o({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=o({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var c=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;t<c.length;++t){var e=c[t];r[e]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:e}),r[e+"eq"]=o({args:["array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"eq"})}}();var l=["max","min","atan2","pow"];!function(){for(var t=0;t<l.length;++t){var e=l[t];r[e]=o({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:e}),r[e+"s"]=o({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:e+"s"}),r[e+"eq"]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"eq"}),r[e+"seq"]=o({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"seq"})}}();var p=["atan2","pow"];!function(){for(var t=0;t<p.length;++t){var e=p[t];r[e+"op"]=o({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:e+"op"}),r[e+"ops"]=o({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:e+"ops"}),r[e+"opeq"]=o({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"opeq"}),r[e+"opseq"]=o({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"opseq"})}}(),r.any=a({args:["array"],pre:s,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),r.all=a({args:["array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),r.sum=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),r.prod=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),r.norm2squared=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),r.norm2=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),r.norminf=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),r.sup=a({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.inf=a({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),r.argmin=a({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.argmax=a({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),r.random=o({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),r.assign=o({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=o({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=a({args:["array","array"],pre:s,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":28}],28:[function(t,e,r){"use strict";function n(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function i(t){var e=new n;e.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;i<r.length;++i){var a=r[i];if("array"===a||"object"==typeof a&&a.blockIndices){if(e.argTypes[i]="array",e.arrayArgs.push(i),e.arrayBlockIndices.push(a.blockIndices?a.blockIndices:0),e.shimArgs.push("array"+i),i<e.pre.args.length&&e.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array args");if(i<e.post.args.length&&e.post.args[i].count>0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===a){if(e.indexArgs.push(i),i<e.pre.args.length&&e.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array index");if(i<e.body.args.length&&e.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array index");if(i<e.post.args.length&&e.post.args[i].count>0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(i),i<e.pre.args.length&&e.pre.args[i].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(i<e.body.args.length&&e.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array shape");if(i<e.post.args.length&&e.post.args[i].lvalue)throw new Error("cwise: post() block may not write to array shape")}else{if("object"!=typeof a||!a.offset)throw new Error("cwise: Unknown argument type "+r[i]);e.argTypes[i]="offset",e.offsetArgs.push({array:a.array,offset:a.offset}),e.offsetArgIndex.push(i)}}if(e.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(e.pre.args.length>r.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>r.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>r.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,o(e)}var o=t("./lib/thunk.js");e.exports=i},{"./lib/thunk.js":30}],29:[function(t,e,r){"use strict";function n(t,e,r){var n,i,o=t.length,a=e.arrayArgs.length,s=e.indexArgs.length>0,u=[],h=[],f=0,c=0;for(n=0;o>n;++n)h.push(["i",n,"=0"].join(""));for(i=0;a>i;++i)for(n=0;o>n;++n)c=f,f=t[n],h.push(0===n?["d",i,"s",n,"=t",i,"p",f].join(""):["d",i,"s",n,"=(t",i,"p",f,"-s",c,"*t",i,"p",c,")"].join(""));for(u.push("var "+h.join(",")),n=o-1;n>=0;--n)f=t[n],u.push(["for(i",n,"=0;i",n,"<s",f,";++i",n,"){"].join(""));for(u.push(r),n=0;o>n;++n){for(c=f,f=t[n],i=0;a>i;++i)u.push(["p",i,"+=d",i,"s",n].join(""));s&&(n>0&&u.push(["index[",c,"]-=s",c].join("")),u.push(["++index[",f,"]"].join(""))),u.push("}")}return u.join("\n")}function i(t,e,r,i){for(var o=e.length,a=r.arrayArgs.length,s=r.blockSize,u=r.indexArgs.length>0,h=[],f=0;a>f;++f)h.push(["var offset",f,"=p",f].join(""));for(var f=t;o>f;++f)h.push(["for(var j"+f+"=SS[",e[f],"]|0;j",f,">0;){"].join("")),h.push(["if(j",f,"<",s,"){"].join("")),h.push(["s",e[f],"=j",f].join("")),h.push(["j",f,"=0"].join("")),h.push(["}else{s",e[f],"=",s].join("")),h.push(["j",f,"-=",s,"}"].join("")),u&&h.push(["index[",e[f],"]=j",f].join(""));for(var f=0;a>f;++f){for(var c=["offset"+f],l=t;o>l;++l)c.push(["j",l,"*t",f,"p",e[l]].join(""));h.push(["p",f,"=(",c.join("+"),")"].join(""))}h.push(n(e,r,i));for(var f=t;o>f;++f)h.push("}");return h.join("\n")}function o(t){for(var e=0,r=t[0].length;r>e;){for(var n=1;n<t.length;++n)if(t[n][e]!==t[0][e])return e;++e}return e}function a(t,e,r){for(var n=t.body,i=[],o=[],a=0;a<t.args.length;++a){var s=t.args[a];if(!(s.count<=0)){var u=new RegExp(s.name,"g"),h="",f=e.arrayArgs.indexOf(a);switch(e.argTypes[a]){case"offset":var c=e.offsetArgIndex.indexOf(a),l=e.offsetArgs[c];f=l.array,h="+q"+c;case"array":h="p"+f+h;var p="l"+a,d="a"+f;if(0===e.arrayBlockIndices[f])1===s.count?"generic"===r[f]?s.lvalue?(i.push(["var ",p,"=",d,".get(",h,")"].join("")),n=n.replace(u,p),o.push([d,".set(",h,",",p,")"].join(""))):n=n.replace(u,[d,".get(",h,")"].join("")):n=n.replace(u,[d,"[",h,"]"].join("")):"generic"===r[f]?(i.push(["var ",p,"=",d,".get(",h,")"].join("")),n=n.replace(u,p),s.lvalue&&o.push([d,".set(",h,",",p,")"].join(""))):(i.push(["var ",p,"=",d,"[",h,"]"].join("")),n=n.replace(u,p),s.lvalue&&o.push([d,"[",h,"]=",p].join("")));else{for(var g=[s.name],m=[h],v=0;v<Math.abs(e.arrayBlockIndices[f]);v++)g.push("\\s*\\[([^\\]]+)\\]"),m.push("$"+(v+1)+"*t"+f+"b"+v);if(u=new RegExp(g.join(""),"g"),h=m.join("+"),"generic"===r[f])throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(u,[d,"[",h,"]"].join(""))}break;case"scalar":n=n.replace(u,"Y"+e.scalarArgs.indexOf(a));break;case"index":n=n.replace(u,"index");break;case"shape":n=n.replace(u,"shape")}}}return[i.join("\n"),n,o.join("\n")].join("\n").trim()}function s(t){for(var e=new Array(t.length),r=!0,n=0;n<t.length;++n){var i=t[n],o=i.match(/\d+/);o=o?o[0]:"",e[n]=0===i.charAt(0)?"u"+i.charAt(1)+o:i.charAt(0)+o,n>0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}function u(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,u=new Array(t.arrayArgs.length),f=new Array(t.arrayArgs.length),c=0;c<t.arrayArgs.length;++c)f[c]=e[2*c],u[c]=e[2*c+1];for(var l=[],p=[],d=[],g=[],m=[],c=0;c<t.arrayArgs.length;++c){t.arrayBlockIndices[c]<0?(d.push(0),g.push(r),l.push(r),p.push(r+t.arrayBlockIndices[c])):(d.push(t.arrayBlockIndices[c]),g.push(t.arrayBlockIndices[c]+r),l.push(0),p.push(t.arrayBlockIndices[c]));for(var v=[],_=0;_<u[c].length;_++)d[c]<=u[c][_]&&u[c][_]<g[c]&&v.push(u[c][_]-d[c]);m.push(v)}for(var y=["SS"],b=["'use strict'"],w=[],_=0;r>_;++_)w.push(["s",_,"=SS[",_,"]"].join(""));for(var c=0;c<t.arrayArgs.length;++c){y.push("a"+c),y.push("t"+c),y.push("p"+c);for(var _=0;r>_;++_)w.push(["t",c,"p",_,"=t",c,"[",d[c]+_,"]"].join(""));for(var _=0;_<Math.abs(t.arrayBlockIndices[c]);++_)w.push(["t",c,"b",_,"=t",c,"[",l[c]+_,"]"].join(""))}for(var c=0;c<t.scalarArgs.length;++c)y.push("Y"+c);if(t.shapeArgs.length>0&&w.push("shape=SS.slice(0)"),t.indexArgs.length>0){for(var E=new Array(r),c=0;r>c;++c)E[c]="0";w.push(["index=[",E.join(","),"]"].join(""))}for(var c=0;c<t.offsetArgs.length;++c){for(var T=t.offsetArgs[c],A=[],_=0;_<T.offset.length;++_)0!==T.offset[_]&&A.push(1===T.offset[_]?["t",T.array,"p",_].join(""):[T.offset[_],"*t",T.array,"p",_].join(""));

w.push(0===A.length?"q"+c+"=0":["q",c,"=",A.join("+")].join(""))}var x=h([].concat(t.pre.thisVars).concat(t.body.thisVars).concat(t.post.thisVars));w=w.concat(x),b.push("var "+w.join(","));for(var c=0;c<t.arrayArgs.length;++c)b.push("p"+c+"|=0");t.pre.body.length>3&&b.push(a(t.pre,t,f));var R=a(t.body,t,f),I=o(m);b.push(r>I?i(I,m[0],t,R):n(m[0],t,R)),t.post.body.length>3&&b.push(a(t.post,t,f)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+b.join("\n")+"\n----------");var j=[t.funcName||"unnamed","_cwise_loop_",u[0].join("s"),"m",I,s(f)].join(""),S=new Function(["function ",j,"(",y.join(","),"){",b.join("\n"),"} return ",j].join(""));return S()}var h=t("uniq");e.exports=u},{uniq:31}],30:[function(t,e,r){"use strict";function n(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var o=[],a=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[u]),t.arrayBlockIndices[u]<0?","+t.arrayBlockIndices[u]+")":")"].join("")],u=0;u<t.arrayArgs.length;++u){var h=t.arrayArgs[u];r.push(["t",h,"=array",h,".dtype,","r",h,"=array",h,".order"].join("")),o.push("t"+h),o.push("r"+h),a.push("t"+h),a.push("r"+h+".join()"),s.push("array"+h+".data"),s.push("array"+h+".stride"),s.push("array"+h+".offset|0")}for(var u=0;u<t.scalarArgs.length;++u)s.push("scalar"+t.scalarArgs[u]);r.push(["type=[",a.join(","),"].join()"].join("")),r.push("proc=CACHED[type]"),e.push("var "+r.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",o.join(","),"])}","return proc(",s.join(","),")}"].join("")),t.debug&&console.log("-----Generated thunk:\n"+e.join("\n")+"\n----------");var f=new Function("compile",e.join("\n"));return f(i.bind(void 0,t))}var i=t("./compile.js");e.exports=n},{"./compile.js":29}],31:[function(t,e,r){"use strict";function n(t,e){for(var r=1,n=t.length,i=t[0],o=t[0],a=1;n>a;++a)if(o=i,i=t[a],e(i,o)){if(a===r){r++;continue}t[r++]=i}return t.length=r,t}function i(t){for(var e=1,r=t.length,n=t[0],i=t[0],o=1;r>o;++o,i=n)if(i=n,n=t[o],n!==i){if(o===e){e++;continue}t[e++]=n}return t.length=e,t}function o(t,e,r){return 0===t.length?t:e?(r||t.sort(e),n(t,e)):(r||t.sort(),i(t))}e.exports=o},{}],32:[function(t,e,r){(function(r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;t<r.length;++t)r[t]=[Math.abs(e[t]),t];r.sort(n);var i=new Array(r.length);for(t=0;t<i.length;++t)i[t]=r[t][1];return i}function o(t,e){var r=["View",e,"d",t].join("");0>e&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var o="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}",a=new Function(o);return a()}if(0===e){var o="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}",a=new Function("TrivialArray",o);return a(c[t][0])}var o=["'use strict'"],s=u(e),h=s.map(function(t){return"i"+t}),f="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),l=s.map(function(t){return"b"+t}).join(","),p=s.map(function(t){return"c"+t}).join(",");o.push("function "+r+"(a,"+l+","+p+",d){this.data=a","this.shape=["+l+"]","this.stride=["+p+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),o.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?o.push("proto.order=[0]"):(o.push("Object.defineProperty(proto,'order',{get:"),4>e?(o.push("function "+r+"_order(){"),2===e?o.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&o.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):o.push("ORDER})")),o.push("proto.set=function "+r+"_set("+h.join(",")+",v){"),o.push(n?"return this.data.set("+f+",v)}":"return this.data["+f+"]=v}"),o.push("proto.get=function "+r+"_get("+h.join(",")+"){"),o.push(n?"return this.data.get("+f+")}":"return this.data["+f+"]}"),o.push("proto.index=function "+r+"_index(",h.join(),"){return "+f+"}"),o.push("proto.hi=function "+r+"_hi("+h.join(",")+"){return new "+r+"(this.data,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var d=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),g=s.map(function(t){return"c"+t+"=this.stride["+t+"]"});o.push("proto.lo=function "+r+"_lo("+h.join(",")+"){var b=this.offset,d=0,"+d.join(",")+","+g.join(","));for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'&&i"+m+">=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),o.push("proto.step=function "+r+"_step("+h.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'){d=i"+m+"|0;if(d<0){c+=b"+m+"*(a"+m+"-1);a"+m+"=ceil(-a"+m+"/d)}else{a"+m+"=ceil(a"+m+"/d)}b"+m+"*=d}");o.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");for(var v=new Array(e),_=new Array(e),m=0;e>m;++m)v[m]="a[i"+m+"]",_[m]="b[i"+m+"]";o.push("proto.transpose=function "+r+"_transpose("+h+"){"+h.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+v.join(",")+","+_.join(",")+",this.offset)}"),o.push("proto.pick=function "+r+"_pick("+h+"){var a=[],b=[],c=this.offset");for(var m=0;e>m;++m)o.push("if(typeof i"+m+"==='number'&&i"+m+">=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");o.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),o.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");var a=new Function("CTOR_LIST","ORDER",o.join("\n"));return a(c[t],i)}function a(t){if(f&&r.isBuffer(t))return"buffer";if(h)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}function s(t,e,r,n){if(void 0===t){var i=c.array[0];return i([])}"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var s=e.length;if(void 0===r){r=new Array(s);for(var u=s-1,h=1;u>=0;--u)r[u]=h,h*=e[u]}if(void 0===n){n=0;for(var u=0;s>u;++u)r[u]<0&&(n-=(e[u]-1)*r[u])}for(var f=a(t),l=c[f];l.length<=s+1;)l.push(o(f,l.length-1));var i=l[s+1];return i(t,e,r,n)}var u=t("iota-array"),h="undefined"!=typeof Float64Array,f="undefined"!=typeof r,c={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=s}).call(this,t("buffer").Buffer)},{buffer:3,"iota-array":33}],33:[function(t,e,r){"use strict";function n(t){for(var e=new Array(t),r=0;t>r;++r)e[r]=r;return e}e.exports=n},{}],34:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return t&=-t,t&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<<i-1,r.sign=function(t){return(t>0)-(0>t)},r.abs=function(t){var e=t>>i-1;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(e>t)},r.max=function(t,e){return t^(t^e)&-(e>t)},r.isPow2=function(t){return!(t&t-1||!t)},r.log2=function(t){var e,r;return e=(t>65535)<<4,t>>>=e,r=(t>255)<<3,t>>>=r,e|=r,r=(t>15)<<2,t>>>=r,e|=r,r=(t>3)<<1,t>>>=r,e|=r,e|t>>1},r.log10=function(t){return t>=1e9?9:t>=1e8?8:t>=1e7?7:t>=1e6?6:t>=1e5?5:t>=1e4?4:t>=1e3?3:t>=100?2:t>=10?1:0},r.popCount=function(t){return t-=t>>>1&1431655765,t=(858993459&t)+(t>>>2&858993459),16843009*(t+(t>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t+1},r.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t-(t>>>1)},r.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,t&=15,27030>>>t&1};var o=new Array(256);!function(t){for(var e=0;256>e;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<<i&255}}(o),r.reverse=function(t){return o[255&t]<<24|o[t>>>8&255]<<16|o[t>>>16&255]<<8|o[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),t=65535&(t|t>>>16),t<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),t=1023&(t|t>>>16),t<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],35:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(0>=i)return[];var o,a=new Array(i);if(r===t.length-1)for(o=0;i>o;++o)a[o]=e;else for(o=0;i>o;++o)a[o]=n(t,e,r+1);return a}function i(t,e){var r,n;for(r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e){switch("undefined"==typeof e&&(e=0),typeof t){case"number":if(t>0)return i(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}e.exports=o},{}],36:[function(t,e,r){(function(e,n){"use strict";function i(t){if(t){var e=t.length||t.byteLength,r=_.log2(e);E[r].push(t)}}function o(t){i(t.buffer)}function a(t){var t=_.nextPow2(t),e=_.log2(t),r=E[e];return r.length>0?r.pop():new ArrayBuffer(t)}function s(t){return new Uint8Array(a(t),0,t)}function u(t){return new Uint16Array(a(2*t),0,t)}function h(t){return new Uint32Array(a(4*t),0,t)}function f(t){return new Int8Array(a(t),0,t)}function c(t){return new Int16Array(a(2*t),0,t)}function l(t){return new Int32Array(a(4*t),0,t)}function p(t){return new Float32Array(a(4*t),0,t)}function d(t){return new Float64Array(a(8*t),0,t)}function g(t){return b?new Uint8ClampedArray(a(t),0,t):s(t)}function m(t){return new DataView(a(t),0,t)}function v(t){t=_.nextPow2(t);var e=_.log2(t),r=T[e];return r.length>0?r.pop():new n(t)}var _=t("bit-twiddle"),y=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:y([32,0]),UINT16:y([32,0]),UINT32:y([32,0]),INT8:y([32,0]),INT16:y([32,0]),INT32:y([32,0]),FLOAT:y([32,0]),DOUBLE:y([32,0]),DATA:y([32,0]),UINT8C:y([32,0]),BUFFER:y([32,0])});var b="undefined"!=typeof Uint8ClampedArray,w=e.__TYPEDARRAY_POOL;w.UINT8C||(w.UINT8C=y([32,0])),w.BUFFER||(w.BUFFER=y([32,0]));var E=w.DATA,T=w.BUFFER;r.free=function(t){if(n.isBuffer(t))T[_.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var e=t.length||t.byteLength,r=0|_.log2(e);E[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=o,r.freeArrayBuffer=i,r.freeBuffer=function(t){T[_.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return a(t);switch(e){case"uint8":return s(t);case"uint16":return u(t);case"uint32":return h(t);case"int8":return f(t);case"int16":return c(t);case"int32":return l(t);case"float":case"float32":return p(t);case"double":case"float64":return d(t);case"uint8_clamped":return g(t);case"buffer":return v(t);case"data":case"dataview":return m(t);default:return null}return null},r.mallocArrayBuffer=a,r.mallocUint8=s,r.mallocUint16=u,r.mallocUint32=h,r.mallocInt8=f,r.mallocInt16=c,r.mallocInt32=l,r.mallocFloat32=r.mallocFloat=p,r.mallocFloat64=r.mallocDouble=d,r.mallocUint8Clamped=g,r.mallocDataView=m,r.mallocBuffer=v,r.clearCache=function(){for(var t=0;32>t;++t)w.UINT8[t].length=0,w.UINT16[t].length=0,w.UINT32[t].length=0,w.INT8[t].length=0,w.INT16[t].length=0,w.INT32[t].length=0,w.FLOAT[t].length=0,w.DOUBLE[t].length=0,w.UINT8C[t].length=0,E[t].length=0,T[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":34,buffer:3,dup:35}],37:[function(t,e,r){"use strict";function n(t){v=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],_=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],y=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}function i(t,e,r){var n=t.gl,i=n.getParameter(n.MAX_TEXTURE_SIZE);if(0>e||e>i||0>r||r>i)throw new Error("gl-texture2d: Invalid texture size");return t._shape=[e,r],t.bind(),n.texImage2D(n.TEXTURE_2D,0,t.format,e,r,0,t.format,t.type,null),t._mipLevels=[0],t}function o(t,e,r,n,i,o){this.gl=t,this.handle=e,this.format=i,this.type=o,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var a=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return a._wrapS},set:function(t){return a.wrapS=t}},{get:function(){return a._wrapT},set:function(t){return a.wrapT=t}}]),this._wrapVector=s;var u=[this._shape[0],this._shape[1]];Object.defineProperties(u,[{get:function(){return a._shape[0]},set:function(t){return a.width=t}},{get:function(){return a._shape[1]},set:function(t){return a.height=t}}]),this._shapeVector=u}function a(t,e){return 3===t.length?1===e[2]&&e[1]===t[0]*t[2]&&e[0]===t[2]:1===e[0]&&e[1]===t[0]}function s(t,e,r,n,i,o,s,u){var h=u.dtype,f=u.shape.slice();if(f.length<2||f.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var c=0,l=0,m=a(f,u.stride.slice());"float32"===h?c=t.FLOAT:"float64"===h?(c=t.FLOAT,m=!1,h="float32"):"uint8"===h?c=t.UNSIGNED_BYTE:(c=t.UNSIGNED_BYTE,m=!1,h="uint8");var v=1;if(2===f.length)l=t.LUMINANCE,f=[f[0],f[1],1],u=p(u.data,f,[u.stride[0],u.stride[1],1],u.offset);else{if(3!==f.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===f[2])l=t.ALPHA;else if(2===f[2])l=t.LUMINANCE_ALPHA;else if(3===f[2])l=t.RGB;else{if(4!==f[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");l=t.RGBA}v=f[2]}if(l!==t.LUMINANCE&&l!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(l=i),l!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var _=u.size,y=s.indexOf(n)<0;if(y&&s.push(n),c===o&&m)0===u.offset&&u.data.length===_?y?t.texImage2D(t.TEXTURE_2D,n,i,f[0],f[1],0,i,o,u.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,f[0],f[1],i,o,u.data):y?t.texImage2D(t.TEXTURE_2D,n,i,f[0],f[1],0,i,o,u.data.subarray(u.offset,u.offset+_)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,f[0],f[1],i,o,u.data.subarray(u.offset,u.offset+_));else{var w;w=o===t.FLOAT?g.mallocFloat32(_):g.mallocUint8(_);var E=p(w,f,[f[2],f[2]*f[0],1]);c===t.FLOAT&&o===t.UNSIGNED_BYTE?b(E,u):d.assign(E,u),y?t.texImage2D(t.TEXTURE_2D,n,i,f[0],f[1],0,i,o,w.subarray(0,_)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,f[0],f[1],i,o,w.subarray(0,_)),o===t.FLOAT?g.freeFloat32(w):g.freeUint8(w)}}function u(t){var e=t.createTexture();return t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),e}function h(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(0>e||e>a||0>r||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!m(t).texture_float)throw new Error("gl-texture2d: Floating point textures not supported on this platform");var s=u(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new o(t,s,e,r,n,i)}function f(t,e,r,n){var i=u(t);return t.texImage2D(t.TEXTURE_2D,0,r,r,n,e),new o(t,i,0|e.width,0|e.height,r,n)}function c(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var s=a(n,e.stride.slice()),h=0;"float32"===r?h=t.FLOAT:"float64"===r?(h=t.FLOAT,s=!1,r="float32"):"uint8"===r?h=t.UNSIGNED_BYTE:(h=t.UNSIGNED_BYTE,s=!1,r="uint8");var f=0;if(2===n.length)f=t.LUMINANCE,n=[n[0],n[1],1],e=p(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])f=t.ALPHA;else if(2===n[2])f=t.LUMINANCE_ALPHA;else if(3===n[2])f=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");f=t.RGBA}}h!==t.FLOAT||m(t).texture_float||(h=t.UNSIGNED_BYTE,s=!1);var c,l,v=e.size;if(s)c=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var _=[n[2],n[2]*n[0],1];l=g.malloc(v,r);var y=p(l,n,_,0);"float32"!==r&&"float64"!==r||h!==t.UNSIGNED_BYTE?d.assign(y,e):b(y,e),c=l.subarray(0,v)}var w=u(t);return t.texImage2D(t.TEXTURE_2D,0,f,n[0],n[1],0,f,h,c),s||g.free(l),new o(t,w,n[0],n[1],f,h)}function l(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(v||n(t),"number"==typeof arguments[1])return h(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return h(t,0|arguments[1][0],0|arguments[1][1],arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var e=arguments[1];if(e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof ImageData)return f(t,e,arguments[2]||t.RGBA,arguments[3]||t.UNSIGNED_BYTE);if(e.shape&&e.data&&e.stride)return c(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")}var p=t("ndarray"),d=t("ndarray-ops"),g=t("typedarray-pool"),m=t("webglew");e.exports=l;var v=null,_=null,y=null,b=function(t,e){d.muls(t,e,255)},w=o.prototype;Object.defineProperties(w,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(m(e).texture_float_linear||(t=e.NEAREST)),_.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,t),this._minFilter=t}},magFilter:{get:function(){return this._magFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&v.indexOf(t)>=0&&(m(e).texture_float_linear||(t=e.NEAREST)),_.indexOf(t)<0)throw new Error("gl-texture2d: Unknown filter mode "+t);return e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,t),this._magFilter=t}},mipSamples:{get:function(){return this._anisoSamples},set:function(t){var e=this._anisoSamples;if(this._anisoSamples=0|Math.max(t,1),e!==this._anisoSamples){var r=m(this.gl).EXT_texture_filter_anisotropic;r&&this.gl.texParameterf(this.gl.TEXTURE_2D,r.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}},wrapS:{get:function(){return this._wrapS},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,t),this._wrapS=t}},wrapT:{get:function(){return this._wrapT},set:function(t){if(this.bind(),y.indexOf(t)<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,t),this._wrapT=t}},wrap:{get:function(){return this._wrapVector},set:function(t){if(Array.isArray(t)||(t=[t,t]),2!==t.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var e=0;2>e;++e)if(y.indexOf(t[e])<0)throw new Error("gl-texture2d: Unknown wrap mode "+t);this._wrapS=t[0],this._wrapT=t[1];var r=this.gl;return this.bind(),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,this._wrapS),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,this._wrapT),t}},shape:{get:function(){return this._shapeVector},set:function(t){if(Array.isArray(t)){if(2!==t.length)throw new Error("gl-texture2d: Invalid texture shape")}else t=[0|t,0|t];return i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t=0|t,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t=0|t,i(this,this._shape[0],t),t}}}),w.bind=function(t){var e=this.gl;return void 0!==t&&e.activeTexture(e.TEXTURE0+(0|t)),e.bindTexture(e.TEXTURE_2D,this.handle),void 0!==t?0|t:e.getParameter(e.ACTIVE_TEXTURE)-e.TEXTURE0},w.dispose=function(){this.gl.deleteTexture(this.handle)},w.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var t=Math.min(this._shape[0],this._shape[1]),e=0;t>0;++e,t>>>=1)this._mipLevels.indexOf(e)<0&&this._mipLevels.push(e)},w.setPixels=function(t,e,r,n){var i=this.gl;if(this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0,t instanceof HTMLCanvasElement||t instanceof ImageData||t instanceof HTMLImageElement||t instanceof HTMLVideoElement){var o=this._mipLevels.indexOf(n)<0;o?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,t),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,t)}else{if(!(t.shape&&t.stride&&t.data))throw new Error("gl-texture2d: Unsupported data type");if(t.shape.length<2||e+t.shape[1]>this._shape[1]>>>n||r+t.shape[0]>this._shape[0]>>>n||0>e||0>r)throw new Error("gl-texture2d: Texture dimensions are out of bounds");s(i,e,r,n,this.format,this.type,this._mipLevels,t)}}},{ndarray:32,"ndarray-ops":27,"typedarray-pool":36,webglew:52}],38:[function(t,e,r){function n(t,e){return this instanceof n?(this.gl=t,this.shader=i(t,o,e),void(this.buffer=t.createBuffer())):new n(t,e)}var i=t("gl-shader"),o="attribute vec2 position; void main() { gl_Position = vec4(2.0*position-1.0, 0.0, 1.0);}";e.exports=n,n.prototype={dispose:function(){this.shader.dispose(),this.gl.deleteBuffer(this.buffer),this.shader=null,this.buffer=null},render:function(t,e,r,n){var i=this.gl,o=this.shader,a=0;o.bind(),this._checkViewport(),o.uniforms.progress=t,o.uniforms.from=e.bind(a++),o.uniforms.to=r.bind(a++);for(var s in n){var u=n[s];u&&u.bind?o.uniforms[s]=u.bind(a++):o.uniforms[s]!==u&&(o.uniforms[s]=u)}i.drawArrays(i.TRIANGLES,0,6)},_checkViewport:function(){var t=this.gl,e=t.canvas,r=e.width,n=e.height;(this._w!==r||this._h!==n)&&(this._syncViewport(r,n),this._w=r,this._h=n)},_syncViewport:function(t,e){var r=this.gl,n=this.shader,i=this.buffer,o=0,a=t,s=0,u=e;n.uniforms.resolution=new Float32Array([t,e]),r.bindBuffer(r.ARRAY_BUFFER,i),n.attributes.position.pointer(),r.bufferData(r.ARRAY_BUFFER,new Float32Array([o,s,a,s,o,u,o,u,a,s,a,u]),r.STATIC_DRAW),r.viewport(o,s,a,u)}}},{"gl-shader":39}],39:[function(t,e,r){"use strict";function n(t){this.gl=t,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}function i(t,e){return t.name<e.name?-1:1}function o(t,e,r,i,o){var a=new n(t);return a.update(e,r,i,o),a}var a=t("./lib/create-uniforms"),s=t("./lib/create-attributes"),u=t("./lib/reflect"),h=t("./lib/shader-cache"),f=t("./lib/runtime-reflect"),c=n.prototype;c.bind=function(){this.program||this._relink(),this.gl.useProgram(this.program)},c.dispose=function(){this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null},c.update=function(t,e,r,n){function o(){l.program=h.program(p,l._vref,l._fref,y,b);for(var t=0;t<r.length;++t)I[t]=p.getUniformLocation(l.program,r[t].name)}if(!e||1===arguments.length){var c=t;t=c.vertex,e=c.fragment,r=c.uniforms,n=c.attributes}var l=this,p=l.gl,d=l._vref;l._vref=h.shader(p,p.VERTEX_SHADER,t),d&&d.dispose(),l.vertShader=l._vref.shader;var g=this._fref;if(l._fref=h.shader(p,p.FRAGMENT_SHADER,e),g&&g.dispose(),l.fragShader=l._fref.shader,!r||!n){var m=p.createProgram();if(p.attachShader(m,l.fragShader),p.attachShader(m,l.vertShader),p.linkProgram(m),!p.getProgramParameter(m,p.LINK_STATUS)){var v=p.getProgramInfoLog(m);throw console.error("gl-shader: Error linking program:",v),new Error("gl-shader: Error linking program:"+v)}r=r||f.uniforms(p,m),n=n||f.attributes(p,m),p.deleteProgram(m)}n=n.slice(),n.sort(i);for(var _=[],y=[],b=[],w=0;w<n.length;++w){var E=n[w];if(E.type.indexOf("mat")>=0){for(var T=0|E.type.charAt(E.type.length-1),A=new Array(T),x=0;T>x;++x)A[x]=b.length,y.push(E.name+"["+x+"]"),b.push("number"==typeof E.location?E.location+x:Array.isArray(E.location)&&E.location.length===T&&"number"==typeof E.location[x]?0|E.location[x]:-1);_.push({name:E.name,type:E.type,locations:A})}else _.push({name:E.name,type:E.type,locations:[b.length]}),y.push(E.name),b.push("number"==typeof E.location?0|E.location:-1)}for(var R=0,w=0;w<b.length;++w)if(b[w]<0){for(;b.indexOf(R)>=0;)R+=1;b[w]=R}var I=new Array(r.length);o(),l._relink=o,l.types={uniforms:u(r),attributes:u(n)},l.attributes=s(p,l,_,b),Object.defineProperty(l,"uniforms",a(p,l,r,I))},e.exports=o},{"./lib/create-attributes":40,"./lib/create-uniforms":41,"./lib/reflect":42,"./lib/runtime-reflect":43,"./lib/shader-cache":44}],40:[function(t,e,r){"use strict";function n(t,e,r,n,i,o){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=o}function i(t,e,r,i,o,a,s){for(var u=["gl","v"],h=[],f=0;o>f;++f)u.push("x"+f),h.push("x"+f);u.push("if(x0.length===void 0){return gl.vertexAttrib"+o+"f(v,"+h.join()+")}else{return gl.vertexAttrib"+o+"fv(v,x0)}");var c=Function.apply(null,u),l=new n(t,e,r,i,o,c);Object.defineProperty(a,s,{set:function(e){return t.disableVertexAttribArray(i[r]),c(t,i[r],e),e},get:function(){return l},enumerable:!0})}function o(t,e,r,n,o,a,s){for(var u=new Array(o),h=new Array(o),f=0;o>f;++f)i(t,e,r[f],n,o,u,f),h[f]=u[f];Object.defineProperty(u,"location",{set:function(t){if(Array.isArray)for(var e=0;o>e;++e)h[e].location=t[e];else for(var e=0;o>e;++e)result[e]=h[e].location=t+e;return t},get:function(){for(var t=new Array(o),e=0;o>e;++e)t[e]=n[r[e]];return t},enumerable:!0}),u.pointer=function(e,i,a,s){e=e||t.FLOAT,i=!!i,a=a||o*o,s=s||0;for(var u=0;o>u;++u){var h=n[r[u]];t.vertexAttribPointer(h,o,e,i,a,s+u*o),t.enableVertexAttribArray(h)}};var c=new Array(o),l=t["vertexAttrib"+o+"fv"];Object.defineProperty(a,s,{set:function(e){for(var i=0;o>i;++i){var a=n[r[i]];if(t.disableVertexAttribArray(a),Array.isArray(e[0]))l.call(t,a,e[i]);else{for(var s=0;o>s;++s)c[s]=e[o*i+s];l.call(t,a,c)}}return e},get:function(){return u},enumerable:!0})}function a(t,e,r,n){for(var a={},s=0,u=r.length;u>s;++s){var h=r[s],f=h.name,c=h.type,l=h.locations;switch(c){case"bool":case"int":case"float":i(t,e,l[0],n,1,a,f);break;default:if(c.indexOf("vec")>=0){var p=c.charCodeAt(c.length-1)-48;if(2>p||p>4)throw new Error("gl-shader: Invalid data type for attribute "+f+": "+c);i(t,e,l[0],n,p,a,f)}else{if(!(c.indexOf("mat")>=0))throw new Error("gl-shader: Unknown data type for attribute "+f+": "+c);var p=c.charCodeAt(c.length-1)-48;if(2>p||p>4)throw new Error("gl-shader: Invalid data type for attribute "+f+": "+c);o(t,e,l,n,p,a,f)}}}return a}e.exports=a;var s=n.prototype;s.pointer=function(t,e,r,n){var i=this,o=i._gl,a=i._locations[i._index];o.vertexAttribPointer(a,i._dimension,t||o.FLOAT,!!e,r||0,n||0),o.enableVertexAttribArray(a)},s.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(s,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{}],41:[function(t,e,r){"use strict";function n(t){var e=new Function("y","return function(){return y}");return e(t)}function i(t,e){for(var r=new Array(t),n=0;t>n;++n)r[n]=e;return r}function o(t,e,r,o){function s(r){var n=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}");return n(t,e,o)}function u(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(n>=0&&1>=n&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new Error("gl-shader: Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new Error("gl-shader: Unknown uniform data type for "+name+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(2>i||i>4)throw new Error("gl-shader: Invalid data type");switch(r.charAt(0)){case"b":case"i":return"gl.uniform"+i+"iv(locations["+e+"],obj"+t+")";case"v":return"gl.uniform"+i+"fv(locations["+e+"],obj"+t+")";default:throw new Error("gl-shader: Unrecognized data type for vector "+name+": "+r)}}}function h(t,e){if("object"!=typeof e)returnt,e;var r=[];for(var n in e){var i=e[n],o=t;o+=parseInt(n)+""===n?"["+n+"]":"."+n,"object"==typeof i?r.push.apply(r,h(o,i)):r.push([o,i])}return r}function f(e){for(var n=["return function updateProperty(obj){"],i=h("",e),a=0;a<i.length;++a){var s=i[a],f=s[0],c=s[1];o[c]&&n.push(u(f,c,r[c].type))}n.push("return obj}");var l=new Function("gl","locations",n.join("\n"));return l(t,o)}function c(t){switch(t){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":return 0;case"float":return 0;default:var e=t.indexOf("vec");if(e>=0&&1>=e&&t.length===4+e){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new Error("gl-shader: Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(2>r||r>4)throw new Error("gl-shader: Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new Error("gl-shader: Unknown uniform data type for "+name+": "+t)}}function l(t,e,i){if("object"==typeof i){var a=p(i);Object.defineProperty(t,e,{get:n(a),set:f(i),enumerable:!0,configurable:!1})}else o[i]?Object.defineProperty(t,e,{get:s(i),set:f(i),enumerable:!0,configurable:!1}):t[e]=c(r[i].type)}function p(t){var e; if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r<t.length;++r)l(e,r,t[r])}else{e={};for(var n in t)l(e,n,t[n])}return e}var d=a(r,!0);return{get:n(p(d)),set:f(d),enumerable:!0,configurable:!0}}var a=t("./reflect");e.exports=o},{"./reflect":42}],42:[function(t,e,r){"use strict";function n(t,e){for(var r={},n=0;n<t.length;++n)for(var i=t[n].name,o=i.split("."),a=r,s=0;s<o.length;++s){var u=o[s].split("[");if(u.length>1){u[0]in a||(a[u[0]]=[]),a=a[u[0]];for(var h=1;h<u.length;++h){var f=parseInt(u[h]);h<u.length-1||s<o.length-1?(f in a||(a[f]=h<u.length-1?[]:{}),a=a[f]):a[f]=e?n:t[n].type}}else s<o.length-1?(u[0]in a||(a[u[0]]={}),a=a[u[0]]):a[u[0]]=e?n:t[n].type}return r}e.exports=n},{}],43:[function(t,e,r){"use strict";function n(t,e){if(!s){var r=Object.keys(a);s={};for(var n=0;n<r.length;++n){var i=r[n];s[t[i]]=a[i]}}return s[e]}function i(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=[],o=0;r>o;++o){var a=t.getActiveUniform(e,o);a&&i.push({name:a.name,type:n(t,a.type)})}return i}function o(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),i=[],o=0;r>o;++o){var a=t.getActiveAttrib(e,o);a&&i.push({name:a.name,type:n(t,a.type)})}return i}r.uniforms=i,r.attributes=o;var a={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},s=null},{}],44:[function(t,e,r){"use strict";function n(t,e,r,n,i,o,a){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=o,this.programs=[],this.cache=a}function i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function o(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);throw console.error("gl-shader: Error compiling shader:",i),new Error("gl-shader: Error compiling shader:"+i)}return n}function a(t,e,r,n,i){var o=t.createProgram();t.attachShader(o,e),t.attachShader(o,r);for(var a=0;a<n.length;++a)t.bindAttribLocation(o,i[a],n[a]);if(t.linkProgram(o),!t.getProgramParameter(o,t.LINK_STATUS)){var s=t.getProgramInfoLog(o);throw console.error("gl-shader: Error linking program:",s),new Error("gl-shader: Error linking program:"+s)}return o}function s(t){var e=c.get(t);return e||(e=new i(t),c.set(t,e)),e}function u(t,e,r){return s(t).getShaderReference(e,r)}function h(t,e,r,n,i){return s(t).getProgram(e,r,n,i)}r.shader=u,r.program=h;var f="undefined"==typeof WeakMap?t("weakmap-shim"):WeakMap,c=new f,l=0;n.prototype.dispose=function(){if(0===--this.count){for(var t=this.cache,e=t.gl,r=this.programs,n=0,i=r.length;i>n;++n){var o=t.programs[r[n]];o&&(delete t.programs[n],e.deleteProgram(o))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var p=i.prototype;p.getShaderReference=function(t,e){var r=this.gl,i=this.shaders[t===r.FRAGMENT_SHADER|0],a=i[e];if(a)a.count+=1;else{var s=o(r,t,e);a=i[e]=new n(l++,e,t,s,[],1,this)}return a},p.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),o=this.programs[i];return o||(this.programs[i]=o=a(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),o}},{"weakmap-shim":47}],45:[function(t,e,r){function n(){var t={};return function(e){if(("object"!=typeof e||null===e)&&"function"!=typeof e)throw new Error("Weakmap-shim: Key must be object");var r=e.valueOf(t);return r&&r.identity===t?r:i(e,t)}}var i=t("./hidden-store.js");e.exports=n},{"./hidden-store.js":46}],46:[function(t,e,r){function n(t,e){var r={identity:e},n=t.valueOf;return Object.defineProperty(t,"valueOf",{value:function(t){return t!==e?n.apply(this,arguments):r},writable:!0}),r}e.exports=n},{}],47:[function(t,e,r){function n(){var t=i();return{get:function(e,r){var n=t(e);return n.hasOwnProperty("value")?n.value:r},set:function(e,r){t(e).value=r},has:function(e){return"value"in t(e)},delete:function(e){return delete t(e).value}}}var i=t("./create-store.js");e.exports=n},{"./create-store.js":45}],48:[function(t,e,r){function n(t){this.elt=t,"absolute"!==t.style.position&&(t.style.position="relative"),t.style.overflow="hidden"}var i=t("vendor-prefix"),o=i("transform"),a=i("transform-origin");n.prototype={clamped:!0,rgb:[0,0,0],getViewport:function(){return this.elt.getBoundingClientRect()},abort:function(){this.reset()},_transformForRect:function(t){var e=this.getViewport(),r=e.width/t[2],n=[-t[0]+"px",-t[1]+"px"];return"scale("+r+") translate("+n+")"},_reset:function(){this.elt.style.backgroundColor="rgb("+this.rgb.map(function(t){return 255*t})+")",this.elt.innerHTML=""},_setImage:function(t){t!==this.image&&(this._reset(),this.elt.appendChild(t),t.style.position="absolute",t.style.top=0,t.style.left=0,t.style[a]="0% 0%",this.image=t)},_positionImage:function(t){this.image.style[o]=this._transformForRect(t)},runStart:function(t){this._setImage(t)},draw:function(t,e){this._positionImage(e)}},e.exports=n},{"vendor-prefix":62}],49:[function(t,e,r){function n(t){this.canvas=t;var e=this.gl=t.getContext("webgl"),r=this.program=e.createProgram(),n=e.createShader(e.VERTEX_SHADER);e.shaderSource(n,i),e.compileShader(n),e.attachShader(r,n);var a=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(a,o),e.compileShader(a),e.attachShader(r,a),e.linkProgram(r),e.useProgram(r),this.positionLocation=e.getAttribLocation(r,"p"),this.imgResL=e.getUniformLocation(r,"imgRes"),this.posL=e.getUniformLocation(r,"pos"),this.dimL=e.getUniformLocation(r,"dim"),this.bgL=e.getUniformLocation(r,"bg"),this.buffer=e.createBuffer(),this._lastW=t.width,this._lastH=t.height}var i="uniform vec2 imgRes;uniform vec2 pos;uniform vec2 dim;attribute vec2 p;varying vec2 uv;void main() {uv = pos/imgRes + ((p * vec2(1.,-1.)+1.)/2.) * (dim/imgRes);gl_Position = vec4(p,0.,1.);}",o="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D img;uniform vec3 bg;varying vec2 uv;void main() {if(uv.x<0.||uv.x>1.||uv.y<0.||uv.y>1.)gl_FragColor = vec4(bg, 1.0);else gl_FragColor = texture2D(img, uv);}";n.prototype={clamped:!0,rgb:[0,0,0],runStart:function(t){{var e=this.gl;this.canvas}e.useProgram(this.program),e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);var r=this.positionLocation;e.enableVertexAttribArray(r),e.vertexAttribPointer(r,2,e.FLOAT,!1,0,0),e.uniform2f(this.imgResL,t.width,t.height),e.uniform3fv(this.bgL,this.rgb);var n=this.texture=e.createTexture();e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,n),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t)},runEnd:function(){this.gl.deleteTexture(this.texture)},draw:function(t,e){var r=this.gl,n=this.canvas;(this._lastW!==n.width||this._lastH!==n.height)&&(this._lastW=n.width,this._lastH=n.height,r.viewport(0,0,n.width,n.height)),r.uniform2f(this.posL,e[0],e[1]),r.uniform2f(this.dimL,e[2],e[3]),r.drawArrays(r.TRIANGLES,0,6)},destroy:function(){this.gl.deleteBuffer(this.buffer),this.gl.deleteProgram(this.program)},getViewport:function(){return this.canvas}},e.exports=n},{}],50:[function(t,e,r){"use strict";function n(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}e.exports=Object.assign||function(t,e){for(var r,i,o=n(t),a=1;a<arguments.length;a++){r=arguments[a],i=Object.keys(Object(r));for(var s=0;s<i.length;s++)o[i[s]]=r[i[s]]}return o}},{}],51:[function(t,e,r){!function(){"use strict";function t(e){e.permitHostObjects___&&e.permitHostObjects___(t)}function r(t){return!(t.substr(0,p.length)==p&&"___"===t.substr(t.length-3))}function n(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[d];if(e&&e.key===t)return e;if(!l(t))return void 0;e={key:t};try{return c(t,d,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return void 0}}function i(t){return t.prototype=null,Object.freeze(t)}function o(){_||"undefined"==typeof console||(_=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=t);var a=!1;if("function"==typeof WeakMap){var s=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var u=new s,h=Object.freeze({});if(u.set(h,1),1===u.get(h))return void(e.exports=WeakMap);a=!0}}var f=(Object.prototype.hasOwnProperty,Object.getOwnPropertyNames),c=Object.defineProperty,l=Object.isExtensible,p="weakmap:",d=p+"ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var g=new ArrayBuffer(25),m=new Uint8Array(g);crypto.getRandomValues(m),d=p+"rand:"+Array.prototype.map.call(m,function(t){return(t%36).toString(36)}).join("")+"___"}if(c(Object,"getOwnPropertyNames",{value:function(t){return f(t).filter(r)}}),"getPropertyNames"in Object){var v=Object.getPropertyNames;c(Object,"getPropertyNames",{value:function(t){return v(t).filter(r)}})}!function(){var t=Object.freeze;c(Object,"freeze",{value:function(e){return n(e),t(e)}});var e=Object.seal;c(Object,"seal",{value:function(t){return n(t),e(t)}});var r=Object.preventExtensions;c(Object,"preventExtensions",{value:function(t){return n(t),r(t)}})}();var _=!1,y=0,b=function(){function t(t,e){var r,i=n(t);return i?h in i?i[h]:e:(r=s.indexOf(t),r>=0?u[r]:e)}function e(t){var e=n(t);return e?h in e:s.indexOf(t)>=0}function r(t,e){var r,i=n(t);return i?i[h]=e:(r=s.indexOf(t),r>=0?u[r]=e:(r=s.length,u[r]=e,s[r]=t)),this}function a(t){var e,r,i=n(t);return i?h in i&&delete i[h]:(e=s.indexOf(t),0>e?!1:(r=s.length-1,s[e]=void 0,u[e]=u[r],s[e]=s[r],s.length=r,u.length=r,!0))}this instanceof b||o();var s=[],u=[],h=y++;return Object.create(b.prototype,{get___:{value:i(t)},has___:{value:i(e)},set___:{value:i(r)},delete___:{value:i(a)}})};b.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof s?!function(){function r(){function e(t,e){return f?h.has(t)?h.get(t):f.get___(t,e):h.get(t,e)}function r(t){return h.has(t)||(f?f.has___(t):!1)}function n(t){var e=!!h.delete(t);return f?f.delete___(t)||e:e}this instanceof b||o();var u,h=new s,f=void 0,c=!1;return u=a?function(t,e){return h.set(t,e),h.has(t)||(f||(f=new b),f.set(t,e)),this}:function(t,e){if(c)try{h.set(t,e)}catch(r){f||(f=new b),f.set___(t,e)}else h.set(t,e);return this},Object.create(b.prototype,{get___:{value:i(e)},has___:{value:i(r)},set___:{value:i(u)},delete___:{value:i(n)},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");c=!0})}})}a&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=b.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=b)}}()},{}],52:[function(t,e,r){"use strict";function n(t){return t.replace(/^[A-Z]+_/,"")}function i(t){var e=a.get(t);if(e)return e;for(var r={},i=t.getSupportedExtensions(),o=0;o<i.length;++o){var s=i[o];if(0!==s.indexOf("MOZ_")){var u=t.getExtension(i[o]);if(u)for(;;){r[s]=u;var h=n(s);if(h===s)break;s=h}}}return a.set(t,r),r}var o="undefined"==typeof WeakMap?t("weak-map"):WeakMap,a=new o;e.exports=i},{"weak-map":51}],53:[function(t,e,r){e.exports={glsl:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 resolution;uniform sampler2D from, to;uniform float progress;void main() {vec2 p = gl_FragCoord.xy / resolution;gl_FragColor = mix(texture2D(from, p), texture2D(to, p), progress);}",uniforms:{},id:"7e61b1f44a391f0c0894",name:"fade",owner:"glslioadmin",html_url:"https://gist.github.com/glslioadmin/7e61b1f44a391f0c0894",created_at:"2014-05-16T00:00:00Z",updated_at:"2014-05-16T00:00:00Z",stars:0}},{}],54:[function(t,e,r){(function(t){!function(t){"use strict";if("function"==typeof bootstrap)bootstrap("promise",t);else if("object"==typeof r&&"object"==typeof e)e.exports=t();else if("function"==typeof define&&define.amd)define(t);else if("undefined"!=typeof ses){if(!ses.ok())return;ses.makeQ=t}else{if("undefined"==typeof self)throw new Error("This environment was not anticipated by Q. Please file a bug.");self.Q=t()}}(function(){"use strict";function e(t){return function(){return W.apply(t,arguments)}}function r(t){return t===Object(t)}function n(t){return"[object StopIteration]"===rt(t)||t instanceof X}function i(t,e){if(q&&e.stack&&"object"==typeof t&&null!==t&&t.stack&&-1===t.stack.indexOf(nt)){for(var r=[],n=e;n;n=n.source)n.stack&&r.unshift(n.stack);r.unshift(t.stack);var i=r.join("\n"+nt+"\n");t.stack=o(i)}}function o(t){for(var e=t.split("\n"),r=[],n=0;n<e.length;++n){var i=e[n];u(i)||a(i)||!i||r.push(i)}return r.join("\n")}function a(t){return-1!==t.indexOf("(module.js:")||-1!==t.indexOf("(node.js:")}function s(t){var e=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(t);if(e)return[e[1],Number(e[2])];var r=/at ([^ ]+):(\d+):(?:\d+)$/.exec(t);if(r)return[r[1],Number(r[2])];var n=/.*@(.+):(\d+)$/.exec(t);return n?[n[1],Number(n[2])]:void 0}function u(t){var e=s(t);if(!e)return!1;var r=e[0],n=e[1];return r===z&&n>=Y&&st>=n}function h(){if(q)try{throw new Error}catch(n){var t=n.stack.split("\n"),e=t[0].indexOf("@")>0?t[1]:t[2],r=s(e);if(!r)return;return z=r[0],r[1]}}function f(t,e,r){return function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(e+" is deprecated, use "+r+" instead.",new Error("").stack),t.apply(t,arguments)}}function c(t){return t instanceof g?t:y(t)?j(t):I(t)}function l(){function t(t){e=t,o.source=t,Q(r,function(e,r){c.nextTick(function(){t.promiseDispatch.apply(t,r)})},void 0),r=void 0,n=void 0}var e,r=[],n=[],i=$(l.prototype),o=$(g.prototype);if(o.promiseDispatch=function(t,i,o){var a=K(arguments);r?(r.push(a),"when"===i&&o[1]&&n.push(o[1])):c.nextTick(function(){e.promiseDispatch.apply(e,a)})},o.valueOf=function(){if(r)return o;var t=v(e);return _(t)&&(e=t),t},o.inspect=function(){return e?e.inspect():{state:"pending"}},c.longStackSupport&&q)try{throw new Error}catch(t){o.stack=t.stack.substring(t.stack.indexOf("\n")+1)}return i.promise=o,i.resolve=function(r){e||t(c(r))},i.fulfill=function(r){e||t(I(r))},i.reject=function(r){e||t(R(r))},i.notify=function(t){e||Q(n,function(e,r){c.nextTick(function(){r(t)})},void 0)},i}function p(t){if("function"!=typeof t)throw new TypeError("resolver must be a function.");var e=l();try{t(e.resolve,e.reject,e.notify)}catch(t){e.reject(t)}return e.promise}function d(t){return p(function(e,r){for(var n=0,i=t.length;i>n;n++)c(t[n]).then(e,r)})}function g(t,e,r){void 0===e&&(e=function(t){return R(new Error("Promise does not support operation: "+t))}),void 0===r&&(r=function(){return{state:"unknown"}});var n=$(g.prototype);if(n.promiseDispatch=function(r,i,o){var a;try{a=t[i]?t[i].apply(n,o):e.call(n,i,o)}catch(t){a=R(t)}r&&r(a)},n.inspect=r,r){var i=r();"rejected"===i.state&&(n.exception=i.reason),n.valueOf=function(){var t=r();return"pending"===t.state||"rejected"===t.state?n:t.value}}return n}function m(t,e,r,n){return c(t).then(e,r,n)}function v(t){if(_(t)){var e=t.inspect();if("fulfilled"===e.state)return e.value}return t}function _(t){return t instanceof g}function y(t){return r(t)&&"function"==typeof t.then}function b(t){return _(t)&&"pending"===t.inspect().state}function w(t){return!_(t)||"fulfilled"===t.inspect().state}function E(t){return _(t)&&"rejected"===t.inspect().state}function T(){it.length=0,ot.length=0,at||(at=!0)}function A(t,e){at&&(ot.push(t),it.push(e&&"undefined"!=typeof e.stack?e.stack:"(no stack) "+e))}function x(t){if(at){var e=Z(ot,t);-1!==e&&(ot.splice(e,1),it.splice(e,1))}}function R(t){var e=g({when:function(e){return e&&x(this),e?e(t):this}},function(){return this},function(){return{state:"rejected",reason:t}});return A(e,t),e}function I(t){return g({when:function(){return t},get:function(e){return t[e]},set:function(e,r){t[e]=r},delete:function(e){delete t[e]},post:function(e,r){return null===e||void 0===e?t.apply(void 0,r):t[e].apply(t,r)},apply:function(e,r){return t.apply(e,r)},keys:function(){return et(t)}},void 0,function(){return{state:"fulfilled",value:t}})}function j(t){var e=l();return c.nextTick(function(){try{t.then(e.resolve,e.reject,e.notify)}catch(t){e.reject(t)}}),e.promise}function S(t){return g({isDef:function(){}},function(e,r){return O(t,e,r)},function(){return c(t).inspect()})}function L(t,e,r){return c(t).spread(e,r)}function k(t){return function(){function e(t,e){var a;if("undefined"==typeof StopIteration){try{a=r[t](e)}catch(t){return R(t)}return a.done?c(a.value):m(a.value,i,o)}try{a=r[t](e)}catch(t){return n(t)?c(t.value):R(t)}return m(a,i,o)}var r=t.apply(this,arguments),i=e.bind(e,"next"),o=e.bind(e,"throw");return i()}}function U(t){c.done(c.async(t)())}function C(t){throw new X(t)}function N(t){return function(){return L([this,P(arguments)],function(e,r){return t.apply(e,r)})}}function O(t,e,r){return c(t).dispatch(e,r)}function P(t){return m(t,function(t){var e=0,r=l();return Q(t,function(n,i,o){var a;_(i)&&"fulfilled"===(a=i.inspect()).state?t[o]=a.value:(++e,m(i,function(n){t[o]=n,0===--e&&r.resolve(t)},r.reject,function(t){r.notify({index:o,value:t})}))},void 0),0===e&&r.resolve(t),r.promise})}function D(t){if(0===t.length)return c.resolve();var e=c.defer(),r=0;return Q(t,function(n,i,o){function a(t){e.resolve(t)}function s(){r--,0===r&&e.reject(new Error("Can't get fulfillment value from any promise, all promises were rejected."))}function u(t){e.notify({index:o,value:t})}var h=t[o];r++,m(h,a,s,u)},void 0),e.promise}function B(t){return m(t,function(t){return t=J(t,c),m(P(J(t,function(t){return m(t,G,G)})),function(){return t})})}function M(t){return c(t).allSettled()}function V(t,e){return c(t).then(void 0,void 0,e)}function F(t,e){return c(t).nodeify(e)}var q=!1;try{throw new Error}catch(t){q=!!t.stack}var z,X,Y=h(),G=function(){},H=function(){function e(){for(;r.next;){r=r.next;var t=r.task;r.task=void 0;var n=r.domain;n&&(r.domain=void 0,n.enter());try{t()}catch(t){if(a)throw n&&n.exit(),setTimeout(e,0),n&&n.enter(),t;setTimeout(function(){throw t},0)}n&&n.exit()}i=!1}var r={task:void 0,next:null},n=r,i=!1,o=void 0,a=!1;if(H=function(e){n=n.next={task:e,domain:a&&t.domain,next:null},i||(i=!0,o())},"undefined"!=typeof t&&t.nextTick)a=!0,o=function(){t.nextTick(e)};else if("function"==typeof setImmediate)o="undefined"!=typeof window?setImmediate.bind(window,e):function(){setImmediate(e)};else if("undefined"!=typeof MessageChannel){var s=new MessageChannel;s.port1.onmessage=function(){o=u,s.port1.onmessage=e,e()};var u=function(){s.port2.postMessage(0)};o=function(){setTimeout(e,0),u()}}else o=function(){setTimeout(e,0)};return H}(),W=Function.call,K=e(Array.prototype.slice),Q=e(Array.prototype.reduce||function(t,e){var r=0,n=this.length;if(1===arguments.length)for(;;){if(r in this){e=this[r++];break}if(++r>=n)throw new TypeError}for(;n>r;r++)r in this&&(e=t(e,this[r],r));return e}),Z=e(Array.prototype.indexOf||function(t){for(var e=0;e<this.length;e++)if(this[e]===t)return e;return-1}),J=e(Array.prototype.map||function(t,e){var r=this,n=[];return Q(r,function(i,o,a){n.push(t.call(e,o,a,r))},void 0),n}),$=Object.create||function(t){function e(){}return e.prototype=t,new e},tt=e(Object.prototype.hasOwnProperty),et=Object.keys||function(t){var e=[];for(var r in t)tt(t,r)&&e.push(r);return e},rt=e(Object.prototype.toString);X="undefined"!=typeof ReturnValue?ReturnValue:function(t){this.value=t};var nt="From previous event:";c.resolve=c,c.nextTick=H,c.longStackSupport=!1,"object"==typeof t&&t&&t.env&&t.env.Q_DEBUG&&(c.longStackSupport=!0),c.defer=l,l.prototype.makeNodeResolver=function(){var t=this;return function(e,r){e?t.reject(e):t.resolve(arguments.length>2?K(arguments,1):r)}},c.Promise=p,c.promise=p,p.race=d,p.all=P,p.reject=R,p.resolve=c,c.passByCopy=function(t){return t},g.prototype.passByCopy=function(){return this},c.join=function(t,e){return c(t).join(e)},g.prototype.join=function(t){return c([this,t]).spread(function(t,e){if(t===e)return t;throw new Error("Can't join: not the same: "+t+" "+e)})},c.race=d,g.prototype.race=function(){return this.then(c.race)},c.makePromise=g,g.prototype.toString=function(){return"[object Promise]"},g.prototype.then=function(t,e,r){function n(e){try{return"function"==typeof t?t(e):e}catch(t){return R(t)}}function o(t){if("function"==typeof e){i(t,s);try{return e(t)}catch(t){return R(t)}}return R(t)}function a(t){return"function"==typeof r?r(t):t}var s=this,u=l(),h=!1;return c.nextTick(function(){s.promiseDispatch(function(t){h||(h=!0,u.resolve(n(t)))},"when",[function(t){h||(h=!0,u.resolve(o(t)))}])}),s.promiseDispatch(void 0,"when",[void 0,function(t){var e,r=!1;try{e=a(t)}catch(t){if(r=!0,!c.onerror)throw t;c.onerror(t)}r||u.notify(e)}]),u.promise},c.tap=function(t,e){return c(t).tap(e)},g.prototype.tap=function(t){return t=c(t),this.then(function(e){return t.fcall(e).thenResolve(e)})},c.when=m,g.prototype.thenResolve=function(t){return this.then(function(){return t})},c.thenResolve=function(t,e){return c(t).thenResolve(e)},g.prototype.thenReject=function(t){return this.then(function(){throw t})},c.thenReject=function(t,e){return c(t).thenReject(e)},c.nearer=v,c.isPromise=_,c.isPromiseAlike=y,c.isPending=b,g.prototype.isPending=function(){return"pending"===this.inspect().state},c.isFulfilled=w,g.prototype.isFulfilled=function(){return"fulfilled"===this.inspect().state},c.isRejected=E,g.prototype.isRejected=function(){return"rejected"===this.inspect().state};var it=[],ot=[],at=!0;c.resetUnhandledRejections=T,c.getUnhandledReasons=function(){return it.slice()},c.stopUnhandledRejectionTracking=function(){T(),at=!1},T(),c.reject=R,c.fulfill=I,c.master=S,c.spread=L,g.prototype.spread=function(t,e){return this.all().then(function(e){return t.apply(void 0,e)},e)},c.async=k,c.spawn=U,c.return=C,c.promised=N,c.dispatch=O,g.prototype.dispatch=function(t,e){var r=this,n=l();return c.nextTick(function(){r.promiseDispatch(n.resolve,t,e)}),n.promise},c.get=function(t,e){return c(t).dispatch("get",[e])},g.prototype.get=function(t){return this.dispatch("get",[t])},c.set=function(t,e,r){return c(t).dispatch("set",[e,r])},g.prototype.set=function(t,e){return this.dispatch("set",[t,e])},c.del=c.delete=function(t,e){return c(t).dispatch("delete",[e])},g.prototype.del=g.prototype.delete=function(t){return this.dispatch("delete",[t])},c.mapply=c.post=function(t,e,r){return c(t).dispatch("post",[e,r])},g.prototype.mapply=g.prototype.post=function(t,e){return this.dispatch("post",[t,e])},c.send=c.mcall=c.invoke=function(t,e){return c(t).dispatch("post",[e,K(arguments,2)])},g.prototype.send=g.prototype.mcall=g.prototype.invoke=function(t){return this.dispatch("post",[t,K(arguments,1)])},c.fapply=function(t,e){return c(t).dispatch("apply",[void 0,e])},g.prototype.fapply=function(t){return this.dispatch("apply",[void 0,t])},c.try=c.fcall=function(t){return c(t).dispatch("apply",[void 0,K(arguments,1)])},g.prototype.fcall=function(){return this.dispatch("apply",[void 0,K(arguments)])},c.fbind=function(t){var e=c(t),r=K(arguments,1);return function(){return e.dispatch("apply",[this,r.concat(K(arguments))])}},g.prototype.fbind=function(){var t=this,e=K(arguments);return function(){return t.dispatch("apply",[this,e.concat(K(arguments))])}},c.keys=function(t){return c(t).dispatch("keys",[])},g.prototype.keys=function(){return this.dispatch("keys",[])},c.all=P,g.prototype.all=function(){return P(this)},c.any=D,g.prototype.any=function(){return D(this)},c.allResolved=f(B,"allResolved","allSettled"),g.prototype.allResolved=function(){return B(this)},c.allSettled=M,g.prototype.allSettled=function(){return this.then(function(t){return P(J(t,function(t){function e(){return t.inspect()}return t=c(t),t.then(e,e)}))})},c.fail=c.catch=function(t,e){return c(t).then(void 0,e)},g.prototype.fail=g.prototype.catch=function(t){return this.then(void 0,t)},c.progress=V,g.prototype.progress=function(t){return this.then(void 0,void 0,t)},c.fin=c.finally=function(t,e){return c(t).finally(e)},g.prototype.fin=g.prototype.finally=function(t){return t=c(t),this.then(function(e){return t.fcall().then(function(){return e})},function(e){return t.fcall().then(function(){throw e})})},c.done=function(t,e,r,n){return c(t).done(e,r,n)},g.prototype.done=function(e,r,n){var o=function(t){c.nextTick(function(){if(i(t,a),!c.onerror)throw t;c.onerror(t)})},a=e||r||n?this.then(e,r,n):this;"object"==typeof t&&t&&t.domain&&(o=t.domain.bind(o)),a.then(void 0,o)},c.timeout=function(t,e,r){return c(t).timeout(e,r)},g.prototype.timeout=function(t,e){var r=l(),n=setTimeout(function(){e&&"string"!=typeof e||(e=new Error(e||"Timed out after "+t+" ms"),e.code="ETIMEDOUT"),r.reject(e)},t);return this.then(function(t){clearTimeout(n),r.resolve(t)},function(t){clearTimeout(n),r.reject(t)},r.notify),r.promise},c.delay=function(t,e){return void 0===e&&(e=t,t=void 0),c(t).delay(e)},g.prototype.delay=function(t){return this.then(function(e){var r=l();return setTimeout(function(){r.resolve(e)},t),r.promise})},c.nfapply=function(t,e){return c(t).nfapply(e)},g.prototype.nfapply=function(t){var e=l(),r=K(t);return r.push(e.makeNodeResolver()),this.fapply(r).fail(e.reject),e.promise},c.nfcall=function(t){var e=K(arguments,1);return c(t).nfapply(e)},g.prototype.nfcall=function(){var t=K(arguments),e=l();return t.push(e.makeNodeResolver()),this.fapply(t).fail(e.reject),e.promise},c.nfbind=c.denodeify=function(t){var e=K(arguments,1);return function(){var r=e.concat(K(arguments)),n=l();return r.push(n.makeNodeResolver()),c(t).fapply(r).fail(n.reject),n.promise}},g.prototype.nfbind=g.prototype.denodeify=function(){var t=K(arguments);return t.unshift(this),c.denodeify.apply(void 0,t)},c.nbind=function(t,e){var r=K(arguments,2);return function(){function n(){return t.apply(e,arguments)}var i=r.concat(K(arguments)),o=l();return i.push(o.makeNodeResolver()),c(n).fapply(i).fail(o.reject),o.promise}},g.prototype.nbind=function(){var t=K(arguments,0);return t.unshift(this),c.nbind.apply(void 0,t)},c.nmapply=c.npost=function(t,e,r){return c(t).npost(e,r)},g.prototype.nmapply=g.prototype.npost=function(t,e){var r=K(e||[]),n=l();return r.push(n.makeNodeResolver()),this.dispatch("post",[t,r]).fail(n.reject),n.promise},c.nsend=c.nmcall=c.ninvoke=function(t,e){var r=K(arguments,2),n=l();return r.push(n.makeNodeResolver()),c(t).dispatch("post",[e,r]).fail(n.reject),n.promise},g.prototype.nsend=g.prototype.nmcall=g.prototype.ninvoke=function(t){var e=K(arguments,1),r=l();return e.push(r.makeNodeResolver()),this.dispatch("post",[t,e]).fail(r.reject),r.promise},c.nodeify=F,g.prototype.nodeify=function(t){return t?void this.then(function(e){c.nextTick(function(){t(null,e)})},function(e){c.nextTick(function(){t(e)})}):this};var st=h();return c})}).call(this,t("_process"))},{_process:8}],55:[function(t,e,r){e.exports=t("./qajax")(t("q"),window.XMLHttpRequest)},{"./qajax":56,q:54}],56:[function(t,e,r){!function(t,n){"object"==typeof r?e.exports=n:"function"==typeof define&&define.amd?define(["q"],function(e){return n(e,t.XMLHttpRequest)}):t.Qajax=n(t.Q,t.XMLHttpRequest)}(this,function(t,e){"use strict";function r(){}function n(t){var e,r=[];for(e in t)t.hasOwnProperty(e)&&void 0!==t[e]&&r.push(encodeURIComponent(e)+"="+encodeURIComponent(t[e]));return r.join("&")}function i(t){return-1===t.indexOf("?")}function o(t){var e={};if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function a(e,r){if(0===arguments.length)throw new Error("Qajax: settings are required");var a;if("string"==typeof e)a="object"==typeof r&&r||{},a.url=e;else{if("object"!=typeof e)throw new Error("Qajax: settings must be an object");a=e}if(!a.url)throw new Error("Qajax: settings.url is required");if("cancellation"in a&&!t.isPromiseAlike(a.cancellation))throw new Error("cancellation must be a Promise.");this.headers=o(this.headers),this.params={};for(var s in a)this[s]=a[s];var h=this.params,f=this.cache;f&&(h[f===!0?"_":f]=(new Date).getTime());var c=this.base+this.url,l=n(h);l&&(c=c+(i(c)?"?":"&")+l),this.url=c;var p=this.data,d=this.headers;null!==p&&"object"==typeof p&&(u in d||(d[u]="application/json"),this.data=JSON.stringify(p));var g=this._send,m=this;this.send=function(){return t.fcall(function(){return g.call(m)})}}function s(t,e){return new a(t,e).send()}var u="Content-Type",h=t.defer().promise;return a.prototype={log:r,timeout:6e4,cache:"undefined"==typeof window?!1:!!(window.ActiveXObject||"ActiveXObject"in window),method:"GET",base:"",withCredentials:!1,cancellation:h,_send:function(){var r=new e,n=t.defer(),i=this.log,o=this.method,a=this.url;r.onreadystatechange=function(){if(4===r.readyState)try{i(o+" "+a+" => "+r.status),r.status?n.resolve(r):n.reject(r)}catch(t){n.reject(r)}},r.onprogress=function(t){n.notify(t)},r.open(o,a,!0),this.responseType&&(r.responseType=this.responseType);var s=this.headers;for(var u in s)s.hasOwnProperty(u)&&r.setRequestHeader(u,s[u]);this.withCredentials&&(r.withCredentials=!0);var h=this.data;return void 0!==h&&null!==h?r.send(h):r.send(),this.cancellation.fin(function(){n.promise.isFulfilled()||(i("Qajax cancellation reached."),r.abort())}),this.timeout?n.promise.timeout(this.timeout).fail(function(t){throw t instanceof Error&&(i("Qajax request delay reach in "+o+" "+a),r.abort()),r}):n.promise}},s.defaults=a.prototype,s.Builder=a,s.filterStatus=function(e){var r,n,i=this.log;if(n=typeof e,"function"===n)r=e;else{if("number"!==n)throw"validStatus type "+n+" unsupported";r=function(t){return t===e}}return function(e){var n=0;try{n=e.status}catch(t){i("Qajax: failed to read xhr.status")}return 1223===n&&(n=204),r(n)?t.resolve(e):t.reject(e)}},s.filterSuccess=s.filterStatus(function(t){return t>=200&&300>t||304===t}),s.toJSON=function(e){return t.fcall(function(){return JSON.parse(e.responseText)})},s.getJSON=function(t){return s({url:t,method:"GET"}).then(s.filterSuccess).then(s.toJSON)},s.serialize=n,s})},{}],57:[function(t,e,r){for(var n=t("performance-now"),i="undefined"==typeof window?{}:window,o=["moz","webkit"],a="AnimationFrame",s=i["request"+a],u=i["cancel"+a]||i["cancelRequest"+a],h=!0,f=0;f<o.length&&!s;f++)s=i[o[f]+"Request"+a],u=i[o[f]+"Cancel"+a]||i[o[f]+"CancelRequest"+a];if(!s||!u){h=!1;var c=0,l=0,p=[],d=1e3/60;s=function(t){if(0===p.length){var e=n(),r=Math.max(0,d-(e-c));c=r+e,setTimeout(function(){var t=p.slice(0);p.length=0;for(var e=0;e<t.length;e++)if(!t[e].cancelled)try{t[e].callback(c)}catch(t){setTimeout(function(){throw t},0)}},Math.round(r))}return p.push({handle:++l,callback:t,cancelled:!1}),l},u=function(t){for(var e=0;e<p.length;e++)p[e].handle===t&&(p[e].cancelled=!0)}}e.exports=function(t){return h?s.call(i,function(){try{t.apply(this,arguments)}catch(t){setTimeout(function(){throw t},0)}}):s.call(i,t)},e.exports.cancel=function(){u.apply(i,arguments)}},{"performance-now":58}],58:[function(t,e,r){(function(t){(function(){var r,n,i;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:"undefined"!=typeof t&&null!==t&&t.hrtime?(e.exports=function(){return(r()-i)/1e6},n=t.hrtime,r=function(){var t;return t=n(),1e9*t[0]+t[1]},i=r()):Date.now?(e.exports=function(){return Date.now()-i},i=Date.now()):(e.exports=function(){ return(new Date).getTime()-i},i=(new Date).getTime())}).call(this)}).call(this,t("_process"))},{_process:8}],59:[function(t,e,r){e.exports=function(t,e){var r=t[2],n=t[3],i=e[2],o=e[3],a=r/n;return r>i&&(r=i,n=~~(r/a)),n>o&&(n=o,r=~~(n*a)),[e[0]+Math.max(0,Math.min(t[0],i-r)),e[1]+Math.max(0,Math.min(t[1],o-n)),r,n]}},{}],60:[function(t,e,r){function n(t,e){return e||(e=[.5,.5]),function(r,n){var i=r.width/r.height,o=n.width/n.height,a=Math.max(i,o),s=[i/a*n.width*t,o/a*n.height*t];return[n.width*e[0]-s[0]/2,n.height*e[1]-s[1]/2,s[0],s[1]]}}n.largest=n(1),e.exports=n},{}],61:[function(t,e,r){function n(t,e,r){return t*(1-r)+e*r}e.exports=function(t,e,r){for(var i=[],o=0;4>o;++o)i[o]=n(t[o],e[o],r);return i}},{}],62:[function(t,e,r){"use strict";function n(t){return t in f?f[t]:f[t]=i(t)}function i(t){var e,r=t.replace(/-([a-z])/g,function(t,e){return e.toUpperCase()}),n=u.length;if(void 0!==s[r])return r;for(r=o(t);n--;)if(e=u[n]+r,void 0!==s[e])return e;throw new Error("unable to prefix "+t)}function o(t){return t.charAt(0).toUpperCase()+t.slice(1)}function a(t){var e=n(t),r=/([A-Z])/g;return r.test(e)&&(e=(h.test(e)?"-":"")+e.replace(r,"-$1")),e.toLowerCase()}var s=document.createElement("p").style,u="O ms Moz webkit".split(" "),h=/^(o|ms|moz|webkit)/,f={};e.exports=n,e.exports.dash=a},{}]},{},[1]);