150 lines
158 KiB
JavaScript
150 lines
158 KiB
JavaScript
// modules are defined as an array
|
|
// [ module function, map of requires ]
|
|
//
|
|
// map of requires is short require name -> numeric require
|
|
//
|
|
// anything defined in a previous bundle is accessed via the
|
|
// orig method which is the require for previous bundles
|
|
|
|
require = (function (modules, cache, entry) {
|
|
// Save the require from previous bundle to this closure if any
|
|
var previousRequire = typeof require === "function" && require;
|
|
|
|
function newRequire(name, jumped) {
|
|
if (!cache[name]) {
|
|
if (!modules[name]) {
|
|
// if we cannot find the module within our internal map or
|
|
// cache jump to the current global require ie. the last bundle
|
|
// that was added to the page.
|
|
var currentRequire = typeof require === "function" && require;
|
|
if (!jumped && currentRequire) {
|
|
return currentRequire(name, true);
|
|
}
|
|
|
|
// If there are other bundles on this page the require from the
|
|
// previous one is saved to 'previousRequire'. Repeat this as
|
|
// many times as there are bundles until the module is found or
|
|
// we exhaust the require chain.
|
|
if (previousRequire) {
|
|
return previousRequire(name, true);
|
|
}
|
|
|
|
var err = new Error('Cannot find module \'' + name + '\'');
|
|
err.code = 'MODULE_NOT_FOUND';
|
|
throw err;
|
|
}
|
|
|
|
function localRequire(x) {
|
|
return newRequire(localRequire.resolve(x));
|
|
}
|
|
|
|
localRequire.resolve = function (x) {
|
|
return modules[name][1][x] || x;
|
|
};
|
|
|
|
var module = cache[name] = new newRequire.Module;
|
|
modules[name][0].call(module.exports, localRequire, module, module.exports);
|
|
}
|
|
|
|
return cache[name].exports;
|
|
}
|
|
|
|
function Module() {
|
|
this.bundle = newRequire;
|
|
this.exports = {};
|
|
}
|
|
|
|
newRequire.Module = Module;
|
|
newRequire.modules = modules;
|
|
newRequire.cache = cache;
|
|
newRequire.parent = previousRequire;
|
|
|
|
for (var i = 0; i < entry.length; i++) {
|
|
newRequire(entry[i]);
|
|
}
|
|
|
|
// Override the current require with this new one
|
|
return newRequire;
|
|
})({7:[function(require,module,exports) {
|
|
"use strict";function t(t,i,s){return t<i?i:t>s?s:t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.clamp=t;class i{constructor(t=0,i=0){this.x=t,this.y=i}withX(t){return new i(t,this.y)}withY(t){return new i(this.x,t)}plus(t){return new i(this.x+t.x,this.y+t.y)}minus(t){return new i(this.x-t.x,this.y-t.y)}times(t){return new i(this.x*t,this.y*t)}timesPointwise(t){return new i(this.x*t.x,this.y*t.y)}dot(t){return this.x*t.x+this.y*t.y}length2(){return this.dot(this)}length(){return Math.sqrt(this.length2())}static min(t,s){return new i(Math.min(t.x,s.x),Math.min(t.y,s.y))}static max(t,s){return new i(Math.max(t.x,s.x),Math.max(t.y,s.y))}flatten(){return[this.x,this.y]}}exports.Vec2=i;class s{constructor(t=1,i=0,s=0,e=0,r=1,n=0){this.m00=t,this.m01=i,this.m02=s,this.m10=e,this.m11=r,this.m12=n}withScale(t){let{m00:i,m01:e,m02:r,m10:n,m11:h,m12:m}=this;return i=t.x,h=t.y,new s(i,e,r,n,h,m)}static withScale(t){return(new s).withScale(t)}scaledBy(t){return s.withScale(t).times(this)}getScale(){return new i(this.m00,this.m11)}withTranslation(t){let{m00:i,m01:e,m02:r,m10:n,m11:h,m12:m}=this;return r=t.x,m=t.y,new s(i,e,r,n,h,m)}static withTranslation(t){return(new s).withTranslation(t)}getTranslation(){return new i(this.m02,this.m12)}translatedBy(t){return s.withTranslation(t).times(this)}static betweenRects(t,e){return s.withTranslation(t.origin.times(-1)).scaledBy(new i(e.size.x/t.size.x,e.size.y/t.size.y)).translatedBy(e.origin)}times(t){const i=this.m00*t.m00+this.m01*t.m10,e=this.m00*t.m01+this.m01*t.m11,r=this.m00*t.m02+this.m01*t.m12+this.m02,n=this.m10*t.m00+this.m11*t.m10,h=this.m10*t.m01+this.m11*t.m11,m=this.m10*t.m02+this.m11*t.m12+this.m12;return new s(i,e,r,n,h,m)}timesScalar(t){const{m00:i,m01:e,m02:r,m10:n,m11:h,m12:m}=this;return new s(t*i,t*e,t*r,t*n,t*h,t*m)}det(){const{m00:t,m01:i,m02:s,m10:e,m11:r,m12:n}=this;return t*(1*r-0*n)-i*(1*e-0*n)+s*(0*e-0*r)}adj(){const{m00:t,m01:i,m02:e,m10:r,m11:n,m12:h}=this;return new s(+(1*n-0*h),-(1*i-0*e),+(i*h-e*n),-(1*r-0*h),+(1*t-0*e),-(t*h-e*r))}inverted(){const t=this.det();if(0===t)return null;return this.adj().timesScalar(1/t)}transformVector(t){return new i(t.x*this.m00+t.y*this.m01,t.x*this.m10+t.y*this.m11)}inverseTransformVector(t){const i=this.inverted();return i?i.transformVector(t):null}transformPosition(t){return new i(t.x*this.m00+t.y*this.m01+this.m02,t.x*this.m10+t.y*this.m11+this.m12)}inverseTransformPosition(t){const i=this.inverted();return i?i.transformPosition(t):null}transformRect(t){return new e(this.transformPosition(t.origin),this.transformVector(t.size))}flatten(){return[this.m00,this.m10,0,this.m01,this.m11,0,this.m02,this.m12,1]}}exports.AffineTransform=s;class e{constructor(t=new i,s=new i){this.origin=t,this.size=s}isEmpty(){return 0==this.width()||0==this.height()}width(){return this.size.x}height(){return this.size.y}left(){return this.origin.x}right(){return this.left()+this.width()}top(){return this.origin.y}bottom(){return this.top()+this.height()}topLeft(){return this.origin}topRight(){return this.origin.plus(new i(this.width(),0))}bottomRight(){return this.origin.plus(this.size)}bottomLeft(){return this.origin.plus(new i(0,this.height()))}withOrigin(t){return new e(t,this.size)}withSize(t){return new e(this.origin,t)}closestPointTo(s){return new i(t(s.x,this.left(),this.right()),t(s.y,this.top(),this.bottom()))}distanceFrom(t){return t.minus(this.closestPointTo(t)).length()}contains(t){return 0===this.distanceFrom(t)}intersectWith(t){const s=i.max(this.topLeft(),t.topLeft()),r=i.max(s,i.min(this.bottomRight(),t.bottomRight()));return new e(s,r.minus(s))}}exports.Rect=e;
|
|
},{}],8:[function(require,module,exports) {
|
|
"use strict";function e(e){let t=null;return function(...n){null==t&&(t=requestAnimationFrame(function(){e(...n),t=null}))}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.atMostOnceAFrame=e;
|
|
},{}],5:[function(require,module,exports) {
|
|
!function(){"use strict";function e(e,t){var n,o,r,i,l=N;for(i=arguments.length;i-- >2;)x.push(arguments[i]);for(t&&null!=t.children&&(x.length||x.push(t.children),delete t.children);x.length;)if((o=x.pop())&&void 0!==o.pop)for(i=o.length;i--;)x.push(o[i]);else"boolean"==typeof o&&(o=null),(r="function"!=typeof e)&&(null==o?o="":"number"==typeof o?o=String(o):"string"!=typeof o&&(r=!1)),r&&n?l[l.length-1]+=o:l===N?l=[o]:l.push(o),n=r;var a=new function(){};return a.nodeName=e,a.children=l,a.attributes=null==t?void 0:t,a.key=null==t?void 0:t.key,void 0!==C.vnode&&C.vnode(a),a}function t(e,t){for(var n in t)e[n]=t[n];return e}function n(e){!e.__d&&(e.__d=!0)&&1==U.push(e)&&(C.debounceRendering||w)(o)}function o(){var e,t=U;for(U=[];e=t.pop();)e.__d&&b(e)}function r(e,t,n){return"string"==typeof t||"number"==typeof t?void 0!==e.splitText:"string"==typeof t.nodeName?!e._componentConstructor&&i(e,t.nodeName):n||e._componentConstructor===t.nodeName}function i(e,t){return e.__n===t||e.nodeName.toLowerCase()===t.toLowerCase()}function l(e){var n=t({},e.attributes);n.children=e.children;var o=e.nodeName.defaultProps;if(void 0!==o)for(var r in o)void 0===n[r]&&(n[r]=o[r]);return n}function a(e){var t=e.parentNode;t&&t.removeChild(e)}function u(e,t,n,o,r){if("className"===t&&(t="class"),"key"===t);else if("ref"===t)n&&n(null),o&&o(e);else if("class"!==t||r)if("style"===t){if(o&&"string"!=typeof o&&"string"!=typeof n||(e.style.cssText=o||""),o&&"object"==typeof o){if("string"!=typeof n)for(var i in n)i in o||(e.style[i]="");for(var i in o)e.style[i]="number"==typeof o[i]&&!1===k.test(i)?o[i]+"px":o[i]}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html||"");else if("o"==t[0]&&"n"==t[1]){var l=t!==(t=t.replace(/Capture$/,""));t=t.toLowerCase().substring(2),o?n||e.addEventListener(t,_,l):e.removeEventListener(t,_,l),(e.__l||(e.__l={}))[t]=o}else if("list"!==t&&"type"!==t&&!r&&t in e)!function(e,t,n){try{e[t]=n}catch(e){}}(e,t,null==o?"":o),null!=o&&!1!==o||e.removeAttribute(t);else{var a=r&&t!==(t=t.replace(/^xlink\:?/,""));null==o||!1===o?a?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.removeAttribute(t):"function"!=typeof o&&(a?e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),o):e.setAttribute(t,o))}else e.className=o||""}function _(e){return this.__l[e.type](C.event&&C.event(e)||e)}function p(){for(var e;e=S.pop();)C.afterMount&&C.afterMount(e),e.componentDidMount&&e.componentDidMount()}function c(e,t,n,o,r,i){L++||(T=null!=r&&void 0!==r.ownerSVGElement,M=null!=e&&!("__preactattr_"in e));var l=s(e,t,n,o,i);return r&&l.parentNode!==r&&r.appendChild(l),--L||(M=!1,i||p()),l}function s(e,t,n,o,_){var p=e,c=T;if(null!=t&&"boolean"!=typeof t||(t=""),"string"==typeof t||"number"==typeof t)return e&&void 0!==e.splitText&&e.parentNode&&(!e._component||_)?e.nodeValue!=t&&(e.nodeValue=t):(p=document.createTextNode(t),e&&(e.parentNode&&e.parentNode.replaceChild(p,e),f(e,!0))),p.__preactattr_=!0,p;var d=t.nodeName;if("function"==typeof d)return function(e,t,n,o){var r=e&&e._component,i=r,a=e,u=r&&e._componentConstructor===t.nodeName,_=u,p=l(t);for(;r&&!_&&(r=r.__u);)_=r.constructor===t.nodeName;r&&_&&(!o||r._component)?(v(r,p,3,n,o),e=r.base):(i&&!u&&(y(i),e=a=null),r=h(t.nodeName,p,n),e&&!r.__b&&(r.__b=e,a=null),v(r,p,1,n,o),e=r.base,a&&e!==a&&(a._component=null,f(a,!1)));return e}(e,t,n,o);if(T="svg"===d||"foreignObject"!==d&&T,d=String(d),(!e||!i(e,d))&&(p=function(e,t){var n=t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return n.__n=e,n}(d,T),e)){for(;e.firstChild;)p.appendChild(e.firstChild);e.parentNode&&e.parentNode.replaceChild(p,e),f(e,!0)}var m=p.firstChild,b=p.__preactattr_,g=t.children;if(null==b){b=p.__preactattr_={};for(var C=p.attributes,x=C.length;x--;)b[C[x].name]=C[x].value}return!M&&g&&1===g.length&&"string"==typeof g[0]&&null!=m&&void 0!==m.splitText&&null==m.nextSibling?m.nodeValue!=g[0]&&(m.nodeValue=g[0]):(g&&g.length||null!=m)&&function(e,t,n,o,i){var l,u,_,p,c,d=e.childNodes,h=[],m={},v=0,b=0,y=d.length,g=0,C=t?t.length:0;if(0!==y)for(var x=0;x<y;x++){var N=d[x],w=N.__preactattr_,k=C&&w?N._component?N._component.__k:w.key:null;null!=k?(v++,m[k]=N):(w||(void 0!==N.splitText?!i||N.nodeValue.trim():i))&&(h[g++]=N)}if(0!==C)for(var x=0;x<C;x++){p=t[x],c=null;var k=p.key;if(null!=k)v&&void 0!==m[k]&&(c=m[k],m[k]=void 0,v--);else if(!c&&b<g)for(l=b;l<g;l++)if(void 0!==h[l]&&r(u=h[l],p,i)){c=u,h[l]=void 0,l===g-1&&g--,l===b&&b++;break}c=s(c,p,n,o),_=d[x],c&&c!==e&&c!==_&&(null==_?e.appendChild(c):c===_.nextSibling?a(_):e.insertBefore(c,_))}if(v)for(var x in m)void 0!==m[x]&&f(m[x],!1);for(;b<=g;)void 0!==(c=h[g--])&&f(c,!1)}(p,g,n,o,M||null!=b.dangerouslySetInnerHTML),function(e,t,n){var o;for(o in n)t&&null!=t[o]||null==n[o]||u(e,o,n[o],n[o]=void 0,T);for(o in t)"children"===o||"innerHTML"===o||o in n&&t[o]===("value"===o||"checked"===o?e[o]:n[o])||u(e,o,n[o],n[o]=t[o],T)}(p,t.attributes,b),T=c,p}function f(e,t){var n=e._component;n?y(n):(null!=e.__preactattr_&&e.__preactattr_.ref&&e.__preactattr_.ref(null),!1!==t&&null!=e.__preactattr_||a(e),d(e))}function d(e){for(e=e.lastChild;e;){var t=e.previousSibling;f(e,!0),e=t}}function h(e,t,n){var o,r=W[e.name];if(e.prototype&&e.prototype.render?(o=new e(t,n),g.call(o,t,n)):((o=new g(t,n)).constructor=e,o.render=m),r)for(var i=r.length;i--;)if(r[i].constructor===e){o.__b=r[i].__b,r.splice(i,1);break}return o}function m(e,t,n){return this.constructor(e,n)}function v(e,t,o,r,i){e.__x||(e.__x=!0,(e.__r=t.ref)&&delete t.ref,(e.__k=t.key)&&delete t.key,!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,r),r&&r!==e.context&&(e.__c||(e.__c=e.context),e.context=r),e.__p||(e.__p=e.props),e.props=t,e.__x=!1,0!==o&&(1!==o&&!1===C.syncComponentUpdates&&e.base?n(e):b(e,1,i)),e.__r&&e.__r(e))}function b(e,n,o,r){if(!e.__x){var i,a,u,_=e.props,s=e.state,d=e.context,m=e.__p||_,g=e.__s||s,x=e.__c||d,N=e.base,w=e.__b,k=N||w,U=e._component,T=!1;if(N&&(e.props=m,e.state=g,e.context=x,2!==n&&e.shouldComponentUpdate&&!1===e.shouldComponentUpdate(_,s,d)?T=!0:e.componentWillUpdate&&e.componentWillUpdate(_,s,d),e.props=_,e.state=s,e.context=d),e.__p=e.__s=e.__c=e.__b=null,e.__d=!1,!T){i=e.render(_,s,d),e.getChildContext&&(d=t(t({},d),e.getChildContext()));var M,W,E=i&&i.nodeName;if("function"==typeof E){var P=l(i);(a=U)&&a.constructor===E&&P.key==a.__k?v(a,P,1,d,!1):(M=a,e._component=a=h(E,P,d),a.__b=a.__b||w,a.__u=e,v(a,P,0,d,!1),b(a,1,o,!0)),W=a.base}else u=k,(M=U)&&(u=e._component=null),(k||1===n)&&(u&&(u._component=null),W=c(u,i,d,o||!N,k&&k.parentNode,!0));if(k&&W!==k&&a!==U){var V=k.parentNode;V&&W!==V&&(V.replaceChild(W,k),M||(k._component=null,f(k,!1)))}if(M&&y(M),e.base=W,W&&!r){for(var A=e,D=e;D=D.__u;)(A=D).base=W;W._component=A,W._componentConstructor=A.constructor}}if(!N||o?S.unshift(e):T||(e.componentDidUpdate&&e.componentDidUpdate(m,g,x),C.afterUpdate&&C.afterUpdate(e)),null!=e.__h)for(;e.__h.length;)e.__h.pop().call(e);L||r||p()}}function y(e){C.beforeUnmount&&C.beforeUnmount(e);var t=e.base;e.__x=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var n=e._component;n?y(n):t&&(t.__preactattr_&&t.__preactattr_.ref&&t.__preactattr_.ref(null),e.__b=t,a(t),function(e){var t=e.constructor.name;(W[t]||(W[t]=[])).push(e)}(e),d(t)),e.__r&&e.__r(null)}function g(e,t){this.__d=!0,this.context=t,this.props=e,this.state=this.state||{}}var C={},x=[],N=[],w="function"==typeof Promise?Promise.resolve().then.bind(Promise.resolve()):setTimeout,k=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,U=[],S=[],L=0,T=!1,M=!1,W={};t(g.prototype,{setState:function(e,o){var r=this.state;this.__s||(this.__s=t({},r)),t(r,"function"==typeof e?e(r,this.props):e),o&&(this.__h=this.__h||[]).push(o),n(this)},forceUpdate:function(e){e&&(this.__h=this.__h||[]).push(e),b(this,2)},render:function(){}});var E={h:e,createElement:e,cloneElement:function(n,o){return e(n.nodeName,t(t({},n.attributes),o),arguments.length>2?[].slice.call(arguments,2):n.children)},Component:g,render:function(e,t,n){return c(n,e,{},!1,t,!1)},rerender:o,options:C};"undefined"!=typeof module?module.exports=E:self.preact=E}();
|
|
},{}],38:[function(require,module,exports) {
|
|
"use strict";function e(e){return"string"==typeof e&&t.test(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var t=/-webkit-|-moz-|-ms-/;module.exports=exports.default;
|
|
},{}],26:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e,t){if("string"==typeof t&&!(0,u.default)(t)&&t.indexOf("calc(")>-1)return i.map(function(e){return t.replace(/calc\(/g,e+"calc(")})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("css-in-js-utils/lib/isPrefixedValue"),u=e(r),i=["-webkit-","-moz-",""];module.exports=exports.default;
|
|
},{"css-in-js-utils/lib/isPrefixedValue":38}],27:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function r(e,r){if("string"==typeof r&&!(0,s.default)(r)&&r.indexOf("cross-fade(")>-1)return u.map(function(e){return r.replace(/cross-fade\(/g,e+"cross-fade(")})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var t=require("css-in-js-utils/lib/isPrefixedValue"),s=e(t),u=["-webkit-",""];module.exports=exports.default;
|
|
},{"css-in-js-utils/lib/isPrefixedValue":38}],28:[function(require,module,exports) {
|
|
"use strict";function e(e,t){if("cursor"===e&&o.hasOwnProperty(t))return r.map(function(e){return e+t})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var r=["-webkit-","-moz-",""],o={"zoom-in":!0,"zoom-out":!0,grab:!0,grabbing:!0};module.exports=exports.default;
|
|
},{}],29:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e,t){if("string"==typeof t&&!(0,i.default)(t)&&t.indexOf("filter(")>-1)return u.map(function(e){return t.replace(/filter\(/g,e+"filter(")})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("css-in-js-utils/lib/isPrefixedValue"),i=e(r),u=["-webkit-",""];module.exports=exports.default;
|
|
},{"css-in-js-utils/lib/isPrefixedValue":38}],30:[function(require,module,exports) {
|
|
"use strict";function e(e,l){if("display"===e&&i.hasOwnProperty(l))return i[l]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var i={flex:["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex","flex"],"inline-flex":["-webkit-inline-box","-moz-inline-box","-ms-inline-flexbox","-webkit-inline-flex","inline-flex"]};module.exports=exports.default;
|
|
},{}],31:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e,t){if("string"==typeof t&&!(0,i.default)(t)&&t.indexOf("image-set(")>-1)return u.map(function(e){return t.replace(/image-set\(/g,e+"image-set(")})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("css-in-js-utils/lib/isPrefixedValue"),i=e(r),u=["-webkit-",""];module.exports=exports.default;
|
|
},{"css-in-js-utils/lib/isPrefixedValue":38}],32:[function(require,module,exports) {
|
|
"use strict";function e(e,l,r){s.hasOwnProperty(e)&&(r[s[e]]=t[l]||l)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var t={"space-around":"distribute","space-between":"justify","flex-start":"start","flex-end":"end"},s={alignContent:"msFlexLinePack",alignSelf:"msFlexItemAlign",alignItems:"msFlexAlign",justifyContent:"msFlexPack",order:"msFlexOrder",flexGrow:"msFlexPositive",flexShrink:"msFlexNegative",flexBasis:"msFlexPreferredSize"};module.exports=exports.default;
|
|
},{}],33:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e,t){if("string"==typeof t&&!(0,i.default)(t)&&n.test(t))return a.map(function(e){return e+t})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("css-in-js-utils/lib/isPrefixedValue"),i=e(r),a=["-webkit-","-moz-",""],n=/linear-gradient|radial-gradient|repeating-linear-gradient|repeating-radial-gradient/;module.exports=exports.default;
|
|
},{"css-in-js-utils/lib/isPrefixedValue":38}],34:[function(require,module,exports) {
|
|
"use strict";function e(e,r,o){"flexDirection"===e&&"string"==typeof r&&(r.indexOf("column")>-1?o.WebkitBoxOrient="vertical":o.WebkitBoxOrient="horizontal",r.indexOf("reverse")>-1?o.WebkitBoxDirection="reverse":o.WebkitBoxDirection="normal"),i.hasOwnProperty(e)&&(o[i[e]]=t[r]||r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;var t={"space-around":"justify","space-between":"justify","flex-start":"start","flex-end":"end","wrap-reverse":"multiple",wrap:"multiple"},i={alignItems:"WebkitBoxAlign",justifyContent:"WebkitBoxPack",flexWrap:"WebkitBoxLines"};module.exports=exports.default;
|
|
},{}],35:[function(require,module,exports) {
|
|
"use strict";function e(e,t){if("position"===e&&"sticky"===t)return["-webkit-sticky","sticky"]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e,module.exports=exports.default;
|
|
},{}],36:[function(require,module,exports) {
|
|
"use strict";function t(t,o){if(n.hasOwnProperty(t)&&i.hasOwnProperty(o))return e.map(function(t){return t+o})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var e=["-webkit-","-moz-",""],n={maxHeight:!0,maxWidth:!0,width:!0,height:!0,columnWidth:!0,minWidth:!0,minHeight:!0},i={"min-content":!0,"max-content":!0,"fill-available":!0,"fit-content":!0,"contain-floats":!0};module.exports=exports.default;
|
|
},{}],25:[function(require,module,exports) {
|
|
"use strict";function e(e){return e.charAt(0).toUpperCase()+e.slice(1)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e,module.exports=exports.default;
|
|
},{}],40:[function(require,module,exports) {
|
|
"use strict";function e(e){return e in t?t[e]:t[e]=e.replace(r,"-$&").toLowerCase().replace(s,"-ms-")}var r=/[A-Z]/g,s=/^ms-/,t={};module.exports=e;
|
|
},{}],39:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e){return(0,u.default)(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("hyphenate-style-name"),u=e(r);module.exports=exports.default;
|
|
},{"hyphenate-style-name":40}],37:[function(require,module,exports) {
|
|
"use strict";function t(t){return t&&t.__esModule?t:{default:t}}function e(t,e){if((0,s.default)(t))return t;for(var r=t.split(/,(?![^()]*(?:\([^()]*\))?\))/g),i=0,o=r.length;i<o;++i){var u=r[i],a=[u];for(var f in e){var p=(0,n.default)(f);if(u.indexOf(p)>-1&&"order"!==p)for(var d=e[f],c=0,b=d.length;c<b;++c)a.unshift(u.replace(p,l[d[c]]+p))}r[i]=a.join(",")}return r.join(",")}function r(t,r,i,n){if("string"==typeof r&&f.hasOwnProperty(t)){var o=e(r,n),s=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(t){return!/-moz-|-ms-/.test(t)}).join(",");if(t.indexOf("Webkit")>-1)return s;var u=o.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(t){return!/-webkit-|-ms-/.test(t)}).join(",");return t.indexOf("Moz")>-1?u:(i["Webkit"+(0,a.default)(t)]=s,i["Moz"+(0,a.default)(t)]=u,o)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var i=require("css-in-js-utils/lib/hyphenateProperty"),n=t(i),o=require("css-in-js-utils/lib/isPrefixedValue"),s=t(o),u=require("../../utils/capitalizeString"),a=t(u),f={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},l={Webkit:"-webkit-",Moz:"-moz-",ms:"-ms-"};module.exports=exports.default;
|
|
},{"../../utils/capitalizeString":25,"css-in-js-utils/lib/isPrefixedValue":38,"css-in-js-utils/lib/hyphenateProperty":39}],13:[function(require,module,exports) {
|
|
var e=require("inline-style-prefixer/static/plugins/calc"),i=require("inline-style-prefixer/static/plugins/crossFade"),t=require("inline-style-prefixer/static/plugins/cursor"),r=require("inline-style-prefixer/static/plugins/filter"),s=require("inline-style-prefixer/static/plugins/flex"),o=require("inline-style-prefixer/static/plugins/flexboxIE"),n=require("inline-style-prefixer/static/plugins/flexboxOld"),a=require("inline-style-prefixer/static/plugins/gradient"),k=require("inline-style-prefixer/static/plugins/imageSet"),m=require("inline-style-prefixer/static/plugins/position"),l=require("inline-style-prefixer/static/plugins/sizing"),b=require("inline-style-prefixer/static/plugins/transition");module.exports={plugins:[e,i,t,r,s,o,n,a,k,m,l,b],prefixMap:{transform:["Webkit","ms"],transformOrigin:["Webkit","ms"],transformOriginX:["Webkit","ms"],transformOriginY:["Webkit","ms"],backfaceVisibility:["Webkit"],perspective:["Webkit"],perspectiveOrigin:["Webkit"],transformStyle:["Webkit"],transformOriginZ:["Webkit"],animation:["Webkit"],animationDelay:["Webkit"],animationDirection:["Webkit"],animationFillMode:["Webkit"],animationDuration:["Webkit"],animationIterationCount:["Webkit"],animationName:["Webkit"],animationPlayState:["Webkit"],animationTimingFunction:["Webkit"],appearance:["Webkit","Moz"],userSelect:["Webkit","Moz","ms"],fontKerning:["Webkit"],textEmphasisPosition:["Webkit"],textEmphasis:["Webkit"],textEmphasisStyle:["Webkit"],textEmphasisColor:["Webkit"],boxDecorationBreak:["Webkit"],clipPath:["Webkit"],maskImage:["Webkit"],maskMode:["Webkit"],maskRepeat:["Webkit"],maskPosition:["Webkit"],maskClip:["Webkit"],maskOrigin:["Webkit"],maskSize:["Webkit"],maskComposite:["Webkit"],mask:["Webkit"],maskBorderSource:["Webkit"],maskBorderMode:["Webkit"],maskBorderSlice:["Webkit"],maskBorderWidth:["Webkit"],maskBorderOutset:["Webkit"],maskBorderRepeat:["Webkit"],maskBorder:["Webkit"],maskType:["Webkit"],textDecorationStyle:["Webkit","Moz"],textDecorationSkip:["Webkit","Moz"],textDecorationLine:["Webkit","Moz"],textDecorationColor:["Webkit","Moz"],filter:["Webkit"],fontFeatureSettings:["Webkit","Moz"],breakAfter:["Webkit","Moz","ms"],breakBefore:["Webkit","Moz","ms"],breakInside:["Webkit","Moz","ms"],columnCount:["Webkit","Moz"],columnFill:["Webkit","Moz"],columnGap:["Webkit","Moz"],columnRule:["Webkit","Moz"],columnRuleColor:["Webkit","Moz"],columnRuleStyle:["Webkit","Moz"],columnRuleWidth:["Webkit","Moz"],columns:["Webkit","Moz"],columnSpan:["Webkit","Moz"],columnWidth:["Webkit","Moz"],flex:["Webkit","ms"],flexBasis:["Webkit"],flexDirection:["Webkit","ms"],flexGrow:["Webkit"],flexFlow:["Webkit","ms"],flexShrink:["Webkit"],flexWrap:["Webkit","ms"],alignContent:["Webkit"],alignItems:["Webkit"],alignSelf:["Webkit"],justifyContent:["Webkit"],order:["Webkit"],transitionDelay:["Webkit"],transitionDuration:["Webkit"],transitionProperty:["Webkit"],transitionTimingFunction:["Webkit"],backdropFilter:["Webkit"],scrollSnapType:["Webkit","ms"],scrollSnapPointsX:["Webkit","ms"],scrollSnapPointsY:["Webkit","ms"],scrollSnapDestination:["Webkit","ms"],scrollSnapCoordinate:["Webkit","ms"],shapeImageThreshold:["Webkit"],shapeImageMargin:["Webkit"],shapeImageOutside:["Webkit"],hyphens:["Webkit","Moz","ms"],flowInto:["Webkit","ms"],flowFrom:["Webkit","ms"],regionFragment:["Webkit","ms"],boxSizing:["Moz"],textAlignLast:["Moz"],tabSize:["Moz"],wrapFlow:["ms"],wrapThrough:["ms"],wrapMargin:["ms"],touchAction:["ms"],gridTemplateColumns:["ms"],gridTemplateRows:["ms"],gridTemplateAreas:["ms"],gridTemplate:["ms"],gridAutoColumns:["ms"],gridAutoRows:["ms"],gridAutoFlow:["ms"],grid:["ms"],gridRowStart:["ms"],gridColumnStart:["ms"],gridRowEnd:["ms"],gridRow:["ms"],gridColumn:["ms"],gridColumnEnd:["ms"],gridColumnGap:["ms"],gridRowGap:["ms"],gridArea:["ms"],gridGap:["ms"],textSizeAdjust:["Webkit","ms"],borderImage:["Webkit"],borderImageOutset:["Webkit"],borderImageRepeat:["Webkit"],borderImageSlice:["Webkit"],borderImageSource:["Webkit"],borderImageWidth:["Webkit"]}};
|
|
},{"inline-style-prefixer/static/plugins/calc":26,"inline-style-prefixer/static/plugins/crossFade":27,"inline-style-prefixer/static/plugins/cursor":28,"inline-style-prefixer/static/plugins/filter":29,"inline-style-prefixer/static/plugins/flex":30,"inline-style-prefixer/static/plugins/imageSet":31,"inline-style-prefixer/static/plugins/flexboxIE":32,"inline-style-prefixer/static/plugins/gradient":33,"inline-style-prefixer/static/plugins/flexboxOld":34,"inline-style-prefixer/static/plugins/position":35,"inline-style-prefixer/static/plugins/sizing":36,"inline-style-prefixer/static/plugins/transition":37}],14:[function(require,module,exports) {
|
|
"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),n="undefined"!=typeof Map,r=function(){function r(){e(this,r),this.elements={},this.keyOrder=[]}return t(r,[{key:"forEach",value:function(e){for(var t=0;t<this.keyOrder.length;t++)e(this.elements[this.keyOrder[t]],this.keyOrder[t])}},{key:"set",value:function(e,t,s){var i=this;if(this.elements.hasOwnProperty(e)){if(s){var o=this.keyOrder.indexOf(e);this.keyOrder.splice(o,1),this.keyOrder.push(e)}}else this.keyOrder.push(e);if(null!=t){if(n&&t instanceof Map||t instanceof r){var a=function(){var n=i.elements.hasOwnProperty(e)?i.elements[e]:new r;return t.forEach(function(e,t){n.set(t,e,s)}),i.elements[e]=n,{v:void 0}}();if("object"==typeof a)return a.v}if(Array.isArray(t)||"object"!=typeof t)this.elements[e]=t;else{for(var f=this.elements.hasOwnProperty(e)?this.elements[e]:new r,l=Object.keys(t),u=0;u<l.length;u+=1)f.set(l[u],t[l[u]],s);this.elements[e]=f}}else this.elements[e]=t}},{key:"get",value:function(e){return this.elements[e]}},{key:"has",value:function(e){return this.elements.hasOwnProperty(e)}},{key:"addStyleType",value:function(e){var t=this;if(n&&e instanceof Map||e instanceof r)e.forEach(function(e,n){t.set(n,e,!0)});else for(var s=Object.keys(e),i=0;i<s.length;i++)this.set(s[i],e[s[i]],!0)}}]),r}();exports.default=r,module.exports=exports.default;
|
|
},{}],18:[function(require,module,exports) {
|
|
"use strict";function r(r){for(var t=5381,e=r.length;e;)t=33*t^r.charCodeAt(--e);return t>>>0}module.exports=r;
|
|
},{}],15:[function(require,module,exports) {
|
|
"use strict";function r(r){return r&&r.__esModule?r:{default:r}}function t(r,t){return r+t.charAt(0).toUpperCase()+t.substring(1)}Object.defineProperty(exports,"__esModule",{value:!0});var e=function(){return function(r,t){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return function(r,t){var e=[],n=!0,o=!1,i=void 0;try{for(var a,u=r[Symbol.iterator]();!(n=(a=u.next()).done)&&(e.push(a.value),!t||e.length!==t);n=!0);}catch(r){o=!0,i=r}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return e}(r,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),n=require("string-hash"),o=r(n),i=function(r,t){for(var n=Object.keys(r),o={},i=0;i<n.length;i+=1){var a=t([n[i],r[n[i]]]),u=e(a,2),f=u[0],s=u[1];o[f]=s}return o};exports.mapObj=i;var a=/([A-Z])/g,u=function(r){return"-"+r.toLowerCase()},f=function(r){var t=r.replace(a,u);return"m"===t[0]&&"s"===t[1]&&"-"===t[2]?"-"+t:t};exports.kebabifyStyleName=f;var s={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridColumn:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},l=["Webkit","ms","Moz","O"];Object.keys(s).forEach(function(r){l.forEach(function(e){s[t(e,r)]=s[r]})});var c=function(r,t){return"number"==typeof t?s[r]?""+t:t+"px":""+t};exports.stringifyValue=c;var p=function(r,t){return d(c(r,t))};exports.stringifyAndImportantifyValue=p;var y=function(r){return(0,o.default)(r).toString(36)};exports.hashString=y;var h=function(r){return y(JSON.stringify(r))};exports.hashObject=h;var d=function(r){return"!"===r[r.length-10]&&" !important"===r.slice(-11)?r:r+" !important"};
|
|
},{"string-hash":18}],21:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function t(e,t,r){if(e.hasOwnProperty(t))for(var o=e[t],a=0,l=o.length;a<l;++a)r[o[a]+(0,u.default)(t)]=r[t]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=t;var r=require("./capitalizeString"),u=e(r);module.exports=exports.default;
|
|
},{"./capitalizeString":25}],22:[function(require,module,exports) {
|
|
"use strict";function e(e,t,r,o,u){for(var s=0,f=e.length;s<f;++s){var l=e[s](t,r,o,u);if(l)return l}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e,module.exports=exports.default;
|
|
},{}],23:[function(require,module,exports) {
|
|
"use strict";function e(e,r){-1===e.indexOf(r)&&e.push(r)}function r(r,t){if(Array.isArray(t))for(var o=0,s=t.length;o<s;++o)e(r,t[o]);else e(r,t)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r,module.exports=exports.default;
|
|
},{}],24:[function(require,module,exports) {
|
|
"use strict";function e(e){return e instanceof Object&&!Array.isArray(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e,module.exports=exports.default;
|
|
},{}],20:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function r(e){function r(e){for(var i in e){var s=e[i];if((0,n.default)(s))e[i]=r(s);else if(Array.isArray(s)){for(var d=[],o=0,p=s.length;o<p;++o){var v=(0,a.default)(l,i,s[o],e,t);(0,f.default)(d,v||s[o])}d.length>0&&(e[i]=d)}else{var x=(0,a.default)(l,i,s,e,t);x&&(e[i]=x),(0,u.default)(t,i,e)}}return e}var t=e.prefixMap,l=e.plugins;return r}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var t=require("../utils/prefixProperty"),u=e(t),l=require("../utils/prefixValue"),a=e(l),i=require("../utils/addNewValuesOnly"),f=e(i),s=require("../utils/isObject"),n=e(s);module.exports=exports.default;
|
|
},{"../utils/prefixProperty":21,"../utils/prefixValue":22,"../utils/addNewValuesOnly":23,"../utils/isObject":24}],11:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},t=require("inline-style-prefixer/static/createPrefixer"),n=e(t),a=require("../lib/staticPrefixData"),i=e(a),l=require("./ordered-elements"),u=e(l),o=require("./util"),f=(0,n.default)(i.default),s=[function(e,r,t){return":"!==e[0]?null:t(r+e)},function(e,r,t){if("@"!==e[0])return null;return e+"{"+t(r)+"}"}];exports.defaultSelectorHandlers=s;var c=function e(r,t,n,a,i){for(var l=new u.default,o=0;o<t.length;o++)l.addStyleType(t[o]);var f=new u.default,s="";return l.forEach(function(t,l){n.some(function(u){var o=u(l,r,function(r){return e(r,[t],n,a,i)});if(null!=o)return s+=o,!0})||f.set(l,t,!0)}),v(r,f,a,i,n)+s};exports.generateCSS=c;var d=function(e,r,t){if(r)for(var n=Object.keys(r),a=0;a<n.length;a++){var i=n[a];e.has(i)&&e.set(i,r[i](e.get(i),t),!1)}},y=function(e,r,t){return(0,o.kebabifyStyleName)(e)+":"+t(e,r)+";"},v=function(e,t,n,a,i){d(t,n,i);var l=r({},t.elements),u=f(t.elements),s=Object.keys(u);if(s.length!==t.keyOrder.length)for(var c=0;c<s.length;c++)if(!l.hasOwnProperty(s[c])){var v=void 0;if((v="W"===s[c][0]?s[c][6].toLowerCase()+s[c].slice(7):"o"===s[c][1]?s[c][3].toLowerCase()+s[c].slice(4):s[c][2].toLowerCase()+s[c].slice(3))&&l.hasOwnProperty(v)){var h=t.keyOrder.indexOf(v);t.keyOrder.splice(h,0,s[c])}else t.keyOrder.unshift(s[c])}var p=!1===a?o.stringifyValue:o.stringifyAndImportantifyValue,g=[];for(c=0;c<t.keyOrder.length;c++){var O=t.keyOrder[c],k=u[O];if(Array.isArray(k))for(var b=0;b<k.length;b++)g.push(y(O,k[b],p));else g.push(y(O,k,p))}return g.length?e+"{"+g.join("")+"}":""};exports.generateCSSRuleset=v;
|
|
},{"../lib/staticPrefixData":13,"./ordered-elements":14,"./util":15,"inline-style-prefixer/static/createPrefixer":20}],19:[function(require,module,exports) {
|
|
var global = (1,eval)("this");
|
|
function e(e){u.length||(o(),l=!0),u[u.length]=e}function t(){for(;i<u.length;){var e=i;if(i+=1,u[e].call(),i>c){for(var t=0,n=u.length-i;t<n;t++)u[t]=u[t+i];u.length-=i,i=0}}u.length=0,i=0,l=!1}function n(e){var t=1,n=new v(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}function r(e){return function(){function t(){clearTimeout(n),clearInterval(r),e()}var n=setTimeout(t,0),r=setInterval(t,50)}}var a=(0,eval)("this");module.exports=e;var o,u=[],l=!1,i=0,c=1024,f=void 0!==a?a:self,v=f.MutationObserver||f.WebKitMutationObserver;o="function"==typeof v?n(t):r(t),e.requestFlush=o,e.makeRequestCallFromTimer=r;
|
|
},{}],17:[function(require,module,exports) {
|
|
"use strict";function t(){if(o.length)throw o.shift()}function r(t){var r;(r=l.length?l.pop():new n).task=t,e(r)}function n(){this.task=null}var e=require("./raw"),l=[],o=[],i=e.makeRequestCallFromTimer(t);module.exports=r,n.prototype.call=function(){try{this.task.call()}catch(t){r.onerror?r.onerror(t):(o.push(t),i())}finally{this.task=null,l[l.length]=this}};
|
|
},{"./raw":19}],16:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("asap"),n=e(t),r=require("./ordered-elements"),a=e(r),i=require("./generate"),o=require("./util"),s=null,u=function(e){if(null==s&&null==(s=document.querySelector("style[data-aphrodite]"))){var t=document.head||document.getElementsByTagName("head")[0];(s=document.createElement("style")).type="text/css",s.setAttribute("data-aphrodite",""),t.appendChild(s)}s.styleSheet?s.styleSheet.cssText+=e:s.appendChild(document.createTextNode(e))},f={fontFamily:function e(t){return Array.isArray(t)?t.map(e).join(","):"object"==typeof t?(h(t.src,"@font-face",[t],!1),'"'+t.fontFamily+'"'):t},animationName:function e(t,n){if(Array.isArray(t))return t.map(function(t){return e(t,n)}).join(",");if("object"==typeof t){var r="keyframe_"+(0,o.hashObject)(t),s="@keyframes "+r+"{";return t instanceof a.default?t.forEach(function(e,t){s+=(0,i.generateCSS)(t,[e],n,f,!1)}):Object.keys(t).forEach(function(e){s+=(0,i.generateCSS)(e,[t[e]],n,f,!1)}),s+="}",m(r,s),r}return t}},c={},l="",d=!1,m=function(e,t){if(!c[e]){if(!d){if("undefined"==typeof document)throw new Error("Cannot automatically buffer without a document");d=!0,(0,n.default)(g)}l+=t,c[e]=!0}},h=function(e,t,n,r){var a=arguments.length<=4||void 0===arguments[4]?[]:arguments[4];if(!c[e]){var o=(0,i.generateCSS)(t,n,a,f,r);m(e,o)}};exports.injectStyleOnce=h;var y=function(){l="",c={},d=!1,s=null};exports.reset=y;var p=function(){if(d)throw new Error("Cannot buffer while already buffering");d=!0};exports.startBuffering=p;var v=function(){d=!1;var e=l;return l="",e};exports.flushToString=v;var g=function(){var e=v();e.length>0&&u(e)};exports.flushToStyleTag=g;var S=function(){return Object.keys(c)};exports.getRenderedClassNames=S;var x=function(e){e.forEach(function(e){c[e]=!0})};exports.addRenderedClassNames=x;var N=function e(t,n){for(var r=0;r<t.length;r+=1)t[r]&&(Array.isArray(t[r])?e(t[r],n):(n.classNameBits.push(t[r]._name),n.definitionBits.push(t[r]._definition)))},j=function(e){return(e.reduce(function(e,t){return e+(t?t._len:0)},0)%36).toString(36)},B=function(e,t,n){var r={classNameBits:[],definitionBits:[]};if(N(t,r),0===r.classNameBits.length)return"";var a=void 0;return a=1===r.classNameBits.length?"_"+r.classNameBits[0]:"_"+(0,o.hashString)(r.classNameBits.join())+j(t),h(a,"."+a,r.definitionBits,e,n),a};exports.injectAndGetClassName=B;
|
|
},{"./ordered-elements":14,"./generate":11,"./util":15,"asap":17}],12:[function(require,module,exports) {
|
|
"use strict";var e=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var u,o=e[Symbol.iterator]();!(n=(u=o.next()).done)&&(r.push(u.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{!n&&o.return&&o.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r=require("./util"),n=require("./inject"),i={create:function(t){return(0,r.mapObj)(t,function(t){var n=e(t,2),i=n[0],a=n[1],u=JSON.stringify(a);return[i,{_len:u.length,_name:(0,r.hashString)(u),_definition:a}]})},rehydrate:function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];(0,n.addRenderedClassNames)(e)}},a={renderStatic:function(e){(0,n.reset)(),(0,n.startBuffering)();return{html:e(),css:{content:(0,n.flushToString)(),renderedClassNames:(0,n.getRenderedClassNames)()}}}},u={suppressStyleInjection:function(){(0,n.reset)(),(0,n.startBuffering)()},clearBufferAndResumeStyleInjection:function(){(0,n.reset)()}},o=function e(r,o){return{StyleSheet:t({},i,{extend:function(t){var n=t.map(function(e){return e.selectorHandler}).filter(function(e){return e});return e(r,o.concat(n))}}),StyleSheetServer:a,StyleSheetTestUtils:u,css:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return(0,n.injectAndGetClassName)(r,t,o)}}};module.exports=o;
|
|
},{"./util":15,"./inject":16}],6:[function(require,module,exports) {
|
|
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("./generate"),t=require("./exports"),u=e(t),l=!0;exports.default=(0,u.default)(l,r.defaultSelectorHandlers),module.exports=exports.default;
|
|
},{"./generate":11,"./exports":12}],10:[function(require,module,exports) {
|
|
var global = (1,eval)("this");
|
|
var e=(0,eval)("this");!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.createREGL=t()}(this,function(){"use strict";function e(e){return"undefined"!=typeof btoa?btoa(e):"base64:"+e}function t(e){var t=new Error("(regl) "+e);throw t}function r(e,r){e||t(r)}function n(e){return e?": "+e:""}function a(e,r,a){r.indexOf(e)<0&&t("invalid value"+n(a)+". must be one of: "+r)}function i(e,t){for(e+="";e.length<t;)e=" "+e;return e}function o(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function f(e,t){this.number=e,this.line=t,this.errors=[]}function u(e,t,r){this.file=e,this.line=t,this.message=r}function s(){var e=new Error,t=(e.stack||e).toString(),r=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(t);if(r)return r[1];var n=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(t);return n?n[1]:"unknown"}function c(){var e=new Error,t=(e.stack||e).toString(),r=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(t);if(r)return r[1];var n=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(t);return n?n[1]:"unknown"}function l(t,r){var n=t.split("\n"),a=1,i=0,u={unknown:new o,0:new o};u.unknown.name=u[0].name=r||s(),u.unknown.lines.push(new f(0,""));for(var c=0;c<n.length;++c){var l=n[c],d=/^\s*\#\s*(\w+)\s+(.+)\s*$/.exec(l);if(d)switch(d[1]){case"line":var m=/(\d+)(\s+\d+)?/.exec(d[2]);m&&(a=0|m[1],m[2]&&((i=0|m[2])in u||(u[i]=new o)));break;case"define":var p=/SHADER_NAME(_B64)?\s+(.*)$/.exec(d[2]);p&&(u[i].name=p[1]?e(p[2]):p[2])}u[i].lines.push(new f(a++,l))}return Object.keys(u).forEach(function(e){var t=u[e];t.lines.forEach(function(e){t.index[e.number]=e})}),u}function d(e){e._commandRef=s()}function m(e,r){var n=c();t(e+" in command "+(r||s())+("unknown"===n?"":" called from "+n))}function p(e,t,r,a){typeof e!==t&&m("invalid parameter type"+n(r)+". expected "+t+", got "+typeof e,a||s())}function h(e,t){return e===ye||e===ve||e===xe?2:e===we?4:ke[e]*t}function b(e){return!(e&e-1||!e)}function g(e,t){this.id=Se++,this.type=e,this.data=t}function v(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function y(e){if(0===e.length)return[];var t=e.charAt(0),r=e.charAt(e.length-1);if(e.length>1&&t===r&&('"'===t||"'"===t))return['"'+v(e.substr(1,e.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(e);if(n)return y(e.substr(0,n.index)).concat(y(n[1])).concat(y(e.substr(n.index+n[0].length)));var a=e.split(".");if(1===a.length)return['"'+v(e)+'"'];for(var i=[],o=0;o<a.length;++o)i=i.concat(y(a[o]));return i}function x(e){return"["+y(e).join("][")+"]"}function w(e){return"string"==typeof e?e.split():(Ae(Array.isArray(e),"invalid extension array"),e)}function k(e){return"string"==typeof e?(Ae("undefined"!=typeof document,"not supported outside of DOM"),document.querySelector(e)):e}function A(e){var t,r,n,a,i=e||{},o={},f=[],u=[],s="undefined"==typeof window?1:window.devicePixelRatio,c=!1,l=function(e){e&&Ae.raise(e)},d=function(){};if("string"==typeof i?(Ae("undefined"!=typeof document,"selector queries only supported in DOM enviroments"),t=document.querySelector(i),Ae(t,"invalid query string for element")):"object"==typeof i?!function(e){return"string"==typeof e.nodeName&&"function"==typeof e.appendChild&&"function"==typeof e.getBoundingClientRect}(i)?!function(e){return"function"==typeof e.drawArrays||"function"==typeof e.drawElements}(i)?(Ae.constructor(i),"gl"in i?a=i.gl:"canvas"in i?n=k(i.canvas):"container"in i&&(r=k(i.container)),"attributes"in i&&(o=i.attributes,Ae.type(o,"object","invalid context attributes")),"extensions"in i&&(f=w(i.extensions)),"optionalExtensions"in i&&(u=w(i.optionalExtensions)),"onDone"in i&&(Ae.type(i.onDone,"function","invalid or missing onDone callback"),l=i.onDone),"profile"in i&&(c=!!i.profile),"pixelRatio"in i&&Ae((s=+i.pixelRatio)>0,"invalid pixel ratio")):n=(a=i).canvas:t=i:Ae.raise("invalid arguments to regl"),t&&("canvas"===t.nodeName.toLowerCase()?n=t:r=t),!a){if(!n){Ae("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var m=function(e,t,r){function n(){var t=window.innerWidth,n=window.innerHeight;if(e!==document.body){var i=e.getBoundingClientRect();t=i.right-i.left,n=i.bottom-i.top}a.width=r*t,a.height=r*n,se(a.style,{width:t+"px",height:n+"px"})}var a=document.createElement("canvas");return se(a.style,{border:0,margin:0,padding:0,top:0,left:0}),e.appendChild(a),e===document.body&&(a.style.position="absolute",se(e.style,{margin:0,padding:0})),window.addEventListener("resize",n,!1),n(),{canvas:a,onDestroy:function(){window.removeEventListener("resize",n),e.removeChild(a)}}}(r||document.body,0,s);if(!m)return null;n=m.canvas,d=m.onDestroy}a=function(e,t){function r(r){try{return e.getContext(r,t)}catch(e){return null}}return r("webgl")||r("experimental-webgl")||r("webgl-experimental")}(n,o)}return a?{gl:a,canvas:n,container:r,extensions:f,optionalExtensions:u,pixelRatio:s,profile:c,onDone:l,onDestroy:d}:(d(),l("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function S(e){return!!e&&"object"==typeof e&&Array.isArray(e.shape)&&Array.isArray(e.stride)&&"number"==typeof e.offset&&e.shape.length===e.stride.length&&(Array.isArray(e.data)||ue(e.data))}function _(e,t){for(var r=Array(e),n=0;n<e;++n)r[n]=t(n);return r}function E(e){var t,r;return t=(e>65535)<<4,e>>>=t,r=(e>255)<<3,e>>>=r,t|=r,r=(e>15)<<2,e>>>=r,t|=r,r=(e>3)<<1,e>>>=r,(t|=r)|e>>1}function T(e){var t=function(e){for(var t=16;t<=1<<28;t*=16)if(e<=t)return t;return 0}(e),r=Ie[E(t)>>2];return r.length>0?r.pop():new ArrayBuffer(t)}function D(e){Ie[E(e.byteLength)>>2].push(e)}function j(e,t,r,n,a,i){for(var o=i,f=0;f<t;++f)for(var u=e[f],s=0;s<r;++s)for(var c=u[s],l=0;l<n;++l)a[o++]=c[l]}function O(e,t,r,n,a){for(var i=1,o=r+1;o<t.length;++o)i*=t[o];var f=t[r];if(t.length-r==4){var u=t[r+1],s=t[r+2],c=t[r+3];for(o=0;o<f;++o)j(e[o],u,s,c,n,a),a+=i}else for(o=0;o<f;++o)O(e[o],t,r+1,n,a),a+=i}function C(e){return 0|fe[Object.prototype.toString.call(e)]}function F(e,t){for(var r=0;r<t.length;++r)e[r]=t[r]}function z(e,t,r,n,a,i,o){for(var f=0,u=0;u<r;++u)for(var s=0;s<n;++s)e[f++]=t[a*u+i*s+o]}function B(e){for(var t=Me.allocType(lt,e.length),r=0;r<e.length;++r)if(isNaN(e[r]))t[r]=65535;else if(e[r]===1/0)t[r]=31744;else if(e[r]===-1/0)t[r]=64512;else{st[0]=e[r];var n=ct[0],a=n>>>31<<15,i=(n<<1>>>24)-127,o=n>>13&1023;if(i<-24)t[r]=a;else if(i<-14){var f=-14-i;t[r]=a+(o+1024>>f)}else t[r]=i>15?a+31744:a+(i+15<<10)+o}return t}function P(e){return Array.isArray(e)||ue(e)}function R(e){return"[object "+e+"]"}function L(e){return Array.isArray(e)&&(0===e.length||"number"==typeof e[0])}function I(e){if(!Array.isArray(e))return!1;return!(0===e.length||!P(e[0]))}function M(e){return Object.prototype.toString.call(e)}function W(e){return M(e)===kr}function H(e){if(!e)return!1;var t=M(e);return Er.indexOf(t)>=0||(L(e)||I(e)||S(e))}function G(e){return 0|fe[Object.prototype.toString.call(e)]}function U(e,t){return Me.allocType(e.type===Ft?Yt:e.type,t)}function N(e,t){e.type===Ft?(e.data=B(t),Me.freeType(t)):e.data=t}function q(e,t,r,n,a,i){var o;if(o=void 0!==Dr[e]?Dr[e]:wr[e]*Tr[t],i&&(o*=6),a){for(var f=0,u=r;u>=1;)f+=o*u*u,u/=2;return f}return o*r*n}function Q(e,t,r,n,a,i,o){function f(){this.internalformat=bt,this.format=bt,this.type=qt,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=0,this.width=0,this.height=0,this.channels=0}function u(e,t){e.internalformat=t.internalformat,e.format=t.format,e.type=t.type,e.compressed=t.compressed,e.premultiplyAlpha=t.premultiplyAlpha,e.flipY=t.flipY,e.unpackAlignment=t.unpackAlignment,e.colorSpace=t.colorSpace,e.width=t.width,e.height=t.height,e.channels=t.channels}function s(e,n){if("object"==typeof n&&n){if("premultiplyAlpha"in n&&(Ae.type(n.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),e.premultiplyAlpha=n.premultiplyAlpha),"flipY"in n&&(Ae.type(n.flipY,"boolean","invalid texture flip"),e.flipY=n.flipY),"alignment"in n&&(Ae.oneOf(n.alignment,[1,2,4,8],"invalid texture unpack alignment"),e.unpackAlignment=n.alignment),"colorSpace"in n&&(Ae.parameter(n.colorSpace,R,"invalid colorSpace"),e.colorSpace=R[n.colorSpace]),"type"in n){var a=n.type;Ae(t.oes_texture_float||!("float"===a||"float32"===a),"you must enable the OES_texture_float extension in order to use floating point textures."),Ae(t.oes_texture_half_float||!("half float"===a||"float16"===a),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),Ae(t.webgl_depth_texture||!("uint16"===a||"uint32"===a||"depth stencil"===a),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),Ae.parameter(a,Q,"invalid texture type"),e.type=Q[a]}var i=e.width,o=e.height,f=e.channels,u=!1;"shape"in n?(Ae(Array.isArray(n.shape)&&n.shape.length>=2,"shape must be an array"),i=n.shape[0],o=n.shape[1],3===n.shape.length&&(f=n.shape[2],Ae(f>0&&f<=4,"invalid number of channels"),u=!0),Ae(i>=0&&i<=r.maxTextureSize,"invalid width"),Ae(o>=0&&o<=r.maxTextureSize,"invalid height")):("radius"in n&&(i=o=n.radius,Ae(i>=0&&i<=r.maxTextureSize,"invalid radius")),"width"in n&&(i=n.width,Ae(i>=0&&i<=r.maxTextureSize,"invalid width")),"height"in n&&(o=n.height,Ae(o>=0&&o<=r.maxTextureSize,"invalid height")),"channels"in n&&(f=n.channels,Ae(f>0&&f<=4,"invalid number of channels"),u=!0)),e.width=0|i,e.height=0|o,e.channels=0|f;var s=!1;if("format"in n){var c=n.format;Ae(t.webgl_depth_texture||!("depth"===c||"depth stencil"===c),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),Ae.parameter(c,V,"invalid texture format");var l=e.internalformat=V[c];e.format=re[l],c in Q&&("type"in n||(e.type=Q[c])),c in Y&&(e.compressed=!0),s=!0}!u&&s?e.channels=wr[e.format]:u&&!s?e.channels!==xr[e.format]&&(e.format=e.internalformat=xr[e.channels]):s&&u&&Ae(e.channels===wr[e.format],"number of channels inconsistent with specified format")}}function c(t){e.pixelStorei(pr,t.flipY),e.pixelStorei(hr,t.premultiplyAlpha),e.pixelStorei(br,t.colorSpace),e.pixelStorei(mr,t.unpackAlignment)}function l(){f.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function d(e,t){var n=null;if(H(t)?n=t:t&&(Ae.type(t,"object","invalid pixel data type"),s(e,t),"x"in t&&(e.xOffset=0|t.x),"y"in t&&(e.yOffset=0|t.y),H(t.data)&&(n=t.data)),Ae(!e.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),t.copy){Ae(!n,"can not specify copy and data field for the same texture");var i=a.viewportWidth,o=a.viewportHeight;e.width=e.width||i-e.xOffset,e.height=e.height||o-e.yOffset,e.needsCopy=!0,Ae(e.xOffset>=0&&e.xOffset<i&&e.yOffset>=0&&e.yOffset<o&&e.width>0&&e.width<=i&&e.height>0&&e.height<=o,"copy texture read out of bounds")}else if(n){if(ue(n))e.channels=e.channels||4,e.data=n,"type"in t||e.type!==qt||(e.type=G(n));else if(L(n))e.channels=e.channels||4,function(e,t){var r=t.length;switch(e.type){case qt:case Qt:case Vt:case Yt:var n=Me.allocType(e.type,r);n.set(t),e.data=n;break;case Ft:e.data=B(t);break;default:Ae.raise("unsupported texture type, must specify a typed array")}}(e,n),e.alignment=1,e.needsFree=!0;else if(S(n)){var f=n.data;Array.isArray(f)||e.type!==qt||(e.type=G(f));var u,c,l,d,m,p,h=n.shape,b=n.stride;3===h.length?(l=h[2],p=b[2]):(Ae(2===h.length,"invalid ndarray pixel data, must be 2 or 3D"),l=1,p=1),u=h[0],c=h[1],d=b[0],m=b[1],e.alignment=1,e.width=u,e.height=c,e.channels=l,e.format=e.internalformat=xr[l],e.needsFree=!0,function(e,t,r,n,a,i){for(var o=e.width,f=e.height,u=e.channels,s=U(e,o*f*u),c=0,l=0;l<f;++l)for(var d=0;d<o;++d)for(var m=0;m<u;++m)s[c++]=t[r*d+n*l+a*m+i];N(e,s)}(e,f,d,m,p,n.offset)}else if(W(n)||function(e){return M(e)===Ar}(n))W(n)?e.element=n:e.element=n.canvas,e.width=e.element.width,e.height=e.element.height,e.channels=4;else if(function(e){return M(e)===Sr}(n))e.element=n,e.width=n.naturalWidth,e.height=n.naturalHeight,e.channels=4;else if(function(e){return M(e)===_r}(n))e.element=n,e.width=n.videoWidth,e.height=n.videoHeight,e.channels=4;else if(I(n)){var g=e.width||n[0].length,v=e.height||n.length,y=e.channels;y=P(n[0][0])?y||n[0][0].length:y||1;for(var x=We.shape(n),w=1,k=0;k<x.length;++k)w*=x[k];var A=U(e,w);We.flatten(n,x,"",A),N(e,A),e.alignment=1,e.width=g,e.height=v,e.channels=y,e.format=e.internalformat=xr[y],e.needsFree=!0}}else e.width=e.width||1,e.height=e.height||1,e.channels=e.channels||4;e.type===Yt?Ae(r.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):e.type===Ft&&Ae(r.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function m(t,r,a){var i=t.element,o=t.data,f=t.internalformat,u=t.format,s=t.type,l=t.width,d=t.height;c(t),i?e.texImage2D(r,a,u,u,s,i):t.compressed?e.compressedTexImage2D(r,a,f,l,d,0,o):t.needsCopy?(n(),e.copyTexImage2D(r,a,u,t.xOffset,t.yOffset,l,d,0)):e.texImage2D(r,a,u,l,d,0,u,s,o)}function p(t,r,a,i,o){var f=t.element,u=t.data,s=t.internalformat,l=t.format,d=t.type,m=t.width,p=t.height;c(t),f?e.texSubImage2D(r,o,a,i,l,d,f):t.compressed?e.compressedTexSubImage2D(r,o,a,i,s,m,p,u):t.needsCopy?(n(),e.copyTexSubImage2D(r,o,a,i,t.xOffset,t.yOffset,m,p)):e.texSubImage2D(r,o,a,i,m,p,l,d,u)}function h(){return ne.pop()||new l}function b(e){e.needsFree&&Me.freeType(e.data),l.call(e),ne.push(e)}function g(e,t,r){var n=e.images[0]=h();e.mipmask=1,n.width=e.width=t,n.height=e.height=r,n.channels=e.channels=4}function v(e,t){var r=null;if(H(t))u(r=e.images[0]=h(),e),d(r,t),e.mipmask=1;else if(s(e,t),Array.isArray(t.mipmap))for(var n=t.mipmap,a=0;a<n.length;++a)u(r=e.images[a]=h(),e),r.width>>=a,r.height>>=a,d(r,n[a]),e.mipmask|=1<<a;else u(r=e.images[0]=h(),e),d(r,t),e.mipmask=1;u(e,e.images[0]),(e.compressed&&e.internalformat===zt||e.internalformat===Bt||e.internalformat===Pt||e.internalformat===Rt)&&Ae(e.width%4==0&&e.height%4==0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function y(e,t){for(var r=e.images,n=0;n<r.length;++n){if(!r[n])return;m(r[n],t,n)}}function x(){var e=ae.pop()||new function(){f.call(this),this.genMipmaps=!1,this.mipmapHint=sr,this.mipmask=0,this.images=Array(16)};f.call(e),e.mipmask=0;for(var t=0;t<16;++t)e.images[t]=null;return e}function w(e){for(var t=e.images,r=0;r<t.length;++r)t[r]&&b(t[r]),t[r]=null;ae.push(e)}function k(){this.minFilter=rr,this.magFilter=rr,this.wrapS=Jt,this.wrapT=Jt,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=sr}function A(e,t){if("min"in t){var n=t.min;Ae.parameter(n,z),e.minFilter=z[n],yr.indexOf(e.minFilter)>=0&&(e.genMipmaps=!0)}if("mag"in t){var a=t.mag;Ae.parameter(a,F),e.magFilter=F[a]}var i=e.wrapS,o=e.wrapT;if("wrap"in t){var f=t.wrap;"string"==typeof f?(Ae.parameter(f,C),i=o=C[f]):Array.isArray(f)&&(Ae.parameter(f[0],C),Ae.parameter(f[1],C),i=C[f[0]],o=C[f[1]])}else{if("wrapS"in t){var u=t.wrapS;Ae.parameter(u,C),i=C[u]}if("wrapT"in t){var s=t.wrapT;Ae.parameter(s,C),o=C[s]}}if(e.wrapS=i,e.wrapT=o,"anisotropic"in t){var c=t.anisotropic;Ae("number"==typeof c&&c>=1&&c<=r.maxAnisotropic,"aniso samples must be between 1 and "),e.anisotropic=t.anisotropic}if("mipmap"in t){var l=!1;switch(typeof t.mipmap){case"string":Ae.parameter(t.mipmap,O,"invalid mipmap hint"),e.mipmapHint=O[t.mipmap],e.genMipmaps=!0,l=!0;break;case"boolean":l=e.genMipmaps=t.mipmap;break;case"object":Ae(Array.isArray(t.mipmap),"invalid mipmap type"),e.genMipmaps=!1,l=!0;break;default:Ae.raise("invalid mipmap type")}!l||"min"in t||(e.minFilter=ar)}}function _(r,n){e.texParameteri(n,tr,r.minFilter),e.texParameteri(n,er,r.magFilter),e.texParameteri(n,Xt,r.wrapS),e.texParameteri(n,$t,r.wrapT),t.ext_texture_filter_anisotropic&&e.texParameteri(n,dr,r.anisotropic),r.genMipmaps&&(e.hint(ur,r.mipmapHint),e.generateMipmap(n))}function E(t){f.call(this),this.mipmask=0,this.internalformat=bt,this.id=ie++,this.refCount=1,this.target=t,this.texture=e.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new k,o.profile&&(this.stats={size:0})}function T(t){e.activeTexture(vr),e.bindTexture(t.target,t.texture)}function D(){var t=ce[0];t?e.bindTexture(t.target,t.texture):e.bindTexture(mt,null)}function j(t){var r=t.texture;Ae(r,"must not double destroy texture");var n=t.unit,a=t.target;n>=0&&(e.activeTexture(vr+n),e.bindTexture(a,null),ce[n]=null),e.deleteTexture(r),t.texture=null,t.params=null,t.pixels=null,t.refCount=0,delete oe[t.id],i.textureCount--}var O={"don't care":sr,"dont care":sr,nice:lr,fast:cr},C={repeat:Kt,clamp:Jt,mirror:Zt},F={nearest:rr,linear:nr},z=se({mipmap:fr,"nearest mipmap nearest":ar,"linear mipmap nearest":ir,"nearest mipmap linear":or,"linear mipmap linear":fr},F),R={none:0,browser:gr},Q={uint8:qt,rgba4:St,rgb565:Et,"rgb5 a1":_t},V={alpha:gt,luminance:yt,"luminance alpha":xt,rgb:vt,rgba:bt,rgba4:wt,"rgb5 a1":kt,rgb565:At},Y={};t.ext_srgb&&(V.srgb=Ot,V.srgba=Ct),t.oes_texture_float&&(Q.float32=Q.float=Yt),t.oes_texture_half_float&&(Q.float16=Q["half float"]=Ft),t.webgl_depth_texture&&(se(V,{depth:Dt,"depth stencil":jt}),se(Q,{uint16:Qt,uint32:Vt,"depth stencil":Tt})),t.webgl_compressed_texture_s3tc&&se(Y,{"rgb s3tc dxt1":zt,"rgba s3tc dxt1":Bt,"rgba s3tc dxt3":Pt,"rgba s3tc dxt5":Rt}),t.webgl_compressed_texture_atc&&se(Y,{"rgb atc":Lt,"rgba atc explicit alpha":It,"rgba atc interpolated alpha":Mt}),t.webgl_compressed_texture_pvrtc&&se(Y,{"rgb pvrtc 4bppv1":Wt,"rgb pvrtc 2bppv1":Ht,"rgba pvrtc 4bppv1":Gt,"rgba pvrtc 2bppv1":Ut}),t.webgl_compressed_texture_etc1&&(Y["rgb etc1"]=Nt);var X=Array.prototype.slice.call(e.getParameter(dt));Object.keys(Y).forEach(function(e){var t=Y[e];X.indexOf(t)>=0&&(V[e]=t)});var $=Object.keys(V);r.textureFormats=$;var K=[];Object.keys(V).forEach(function(e){var t=V[e];K[t]=e});var J=[];Object.keys(Q).forEach(function(e){var t=Q[e];J[t]=e});var Z=[];Object.keys(F).forEach(function(e){var t=F[e];Z[t]=e});var ee=[];Object.keys(z).forEach(function(e){var t=z[e];ee[t]=e});var te=[];Object.keys(C).forEach(function(e){var t=C[e];te[t]=e});var re=$.reduce(function(e,t){var r=V[t];return r===yt||r===gt||r===yt||r===xt||r===Dt||r===jt?e[r]=r:r===kt||t.indexOf("rgba")>=0?e[r]=bt:e[r]=vt,e},{}),ne=[],ae=[],ie=0,oe={},fe=r.maxTextureUnits,ce=Array(fe).map(function(){return null});return se(E.prototype,{bind:function(){this.bindCount+=1;var t=this.unit;if(t<0){for(var r=0;r<fe;++r){var n=ce[r];if(n){if(n.bindCount>0)continue;n.unit=-1}ce[r]=this,t=r;break}t>=fe&&Ae.raise("insufficient number of texture units"),o.profile&&i.maxTextureUnits<t+1&&(i.maxTextureUnits=t+1),this.unit=t,e.activeTexture(vr+t),e.bindTexture(this.target,this.texture)}return t},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&j(this)}}),o.profile&&(i.getTotalTextureSize=function(){var e=0;return Object.keys(oe).forEach(function(t){e+=oe[t].stats.size}),e}),{create2D:function(t,n){function a(e,t){var n=f.texInfo;k.call(n);var i=x();return"number"==typeof e?g(i,0|e,"number"==typeof t?0|t:0|e):e?(Ae.type(e,"object","invalid arguments to regl.texture"),A(n,e),v(i,e)):g(i,1,1),n.genMipmaps&&(i.mipmask=(i.width<<1)-1),f.mipmask=i.mipmask,u(f,i),Ae.texture2D(n,i,r),f.internalformat=i.internalformat,a.width=i.width,a.height=i.height,T(f),y(i,mt),_(n,mt),D(),w(i),o.profile&&(f.stats.size=q(f.internalformat,f.type,i.width,i.height,n.genMipmaps,!1)),a.format=K[f.internalformat],a.type=J[f.type],a.mag=Z[n.magFilter],a.min=ee[n.minFilter],a.wrapS=te[n.wrapS],a.wrapT=te[n.wrapT],a}var f=new E(mt);return oe[f.id]=f,i.textureCount++,a(t,n),a.subimage=function(e,t,r,n){Ae(!!e,"must specify image data");var i=0|t,o=0|r,s=0|n,c=h();return u(c,f),c.width=0,c.height=0,d(c,e),c.width=c.width||(f.width>>s)-i,c.height=c.height||(f.height>>s)-o,Ae(f.type===c.type&&f.format===c.format&&f.internalformat===c.internalformat,"incompatible format for texture.subimage"),Ae(i>=0&&o>=0&&i+c.width<=f.width&&o+c.height<=f.height,"texture.subimage write out of bounds"),Ae(f.mipmask&1<<s,"missing mipmap data"),Ae(c.data||c.element||c.needsCopy,"missing image data"),T(f),p(c,mt,i,o,s),D(),b(c),a},a.resize=function(t,r){var n=0|t,i=0|r||n;if(n===f.width&&i===f.height)return a;a.width=f.width=n,a.height=f.height=i,T(f);for(var u=0;f.mipmask>>u;++u)e.texImage2D(mt,u,f.format,n>>u,i>>u,0,f.format,f.type,null);return D(),o.profile&&(f.stats.size=q(f.internalformat,f.type,n,i,!1,!1)),a},a._reglType="texture2d",a._texture=f,o.profile&&(a.stats=f.stats),a.destroy=function(){f.decRef()},a},createCube:function(t,n,a,f,c,l){function m(e,t,n,a,i,f){var c,l=S.texInfo;for(k.call(l),c=0;c<6;++c)j[c]=x();if("number"!=typeof e&&e)if("object"==typeof e)if(t)v(j[0],e),v(j[1],t),v(j[2],n),v(j[3],a),v(j[4],i),v(j[5],f);else if(A(l,e),s(S,e),"faces"in e){var d=e.faces;for(Ae(Array.isArray(d)&&6===d.length,"cube faces must be a length 6 array"),c=0;c<6;++c)Ae("object"==typeof d[c]&&!!d[c],"invalid input for cube map face"),u(j[c],S),v(j[c],d[c])}else for(c=0;c<6;++c)v(j[c],e);else Ae.raise("invalid arguments to cube map");else{var p=0|e||1;for(c=0;c<6;++c)g(j[c],p,p)}for(u(S,j[0]),l.genMipmaps?S.mipmask=(j[0].width<<1)-1:S.mipmask=j[0].mipmask,Ae.textureCube(S,l,j,r),S.internalformat=j[0].internalformat,m.width=j[0].width,m.height=j[0].height,T(S),c=0;c<6;++c)y(j[c],ht+c);for(_(l,pt),D(),o.profile&&(S.stats.size=q(S.internalformat,S.type,m.width,m.height,l.genMipmaps,!0)),m.format=K[S.internalformat],m.type=J[S.type],m.mag=Z[l.magFilter],m.min=ee[l.minFilter],m.wrapS=te[l.wrapS],m.wrapT=te[l.wrapT],c=0;c<6;++c)w(j[c]);return m}var S=new E(pt);oe[S.id]=S,i.cubeCount++;var j=new Array(6);return m(t,n,a,f,c,l),m.subimage=function(e,t,r,n,a){Ae(!!t,"must specify image data"),Ae("number"==typeof e&&e===(0|e)&&e>=0&&e<6,"invalid face");var i=0|r,o=0|n,f=0|a,s=h();return u(s,S),s.width=0,s.height=0,d(s,t),s.width=s.width||(S.width>>f)-i,s.height=s.height||(S.height>>f)-o,Ae(S.type===s.type&&S.format===s.format&&S.internalformat===s.internalformat,"incompatible format for texture.subimage"),Ae(i>=0&&o>=0&&i+s.width<=S.width&&o+s.height<=S.height,"texture.subimage write out of bounds"),Ae(S.mipmask&1<<f,"missing mipmap data"),Ae(s.data||s.element||s.needsCopy,"missing image data"),T(S),p(s,ht+e,i,o,f),D(),b(s),m},m.resize=function(t){var r=0|t;if(r!==S.width){m.width=S.width=r,m.height=S.height=r,T(S);for(var n=0;n<6;++n)for(var a=0;S.mipmask>>a;++a)e.texImage2D(ht+n,a,S.format,r>>a,r>>a,0,S.format,S.type,null);return D(),o.profile&&(S.stats.size=q(S.internalformat,S.type,m.width,m.height,!1,!0)),m}},m._reglType="textureCube",m._texture=S,o.profile&&(m.stats=S.stats),m.destroy=function(){S.decRef()},m},clear:function(){for(var t=0;t<fe;++t)e.activeTexture(vr+t),e.bindTexture(mt,null),ce[t]=null;Oe(oe).forEach(j),i.cubeCount=0,i.textureCount=0},getTexture:function(e){return null},restore:function(){Oe(oe).forEach(function(t){t.texture=e.createTexture(),e.bindTexture(t.target,t.texture);for(var r=0;r<32;++r)if(0!=(t.mipmask&1<<r))if(t.target===mt)e.texImage2D(mt,r,t.internalformat,t.width>>r,t.height>>r,0,t.internalformat,t.type,null);else for(var n=0;n<6;++n)e.texImage2D(ht+n,r,t.internalformat,t.width>>r,t.height>>r,0,t.internalformat,t.type,null);_(t.texInfo,t.target)})}}}function V(e,t,r){return Cr[e]*t*r}function Y(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=Kr,this.offset=0,this.stride=0,this.divisor=0}function X(e,t,r,n){function a(e,t,r,n){this.name=e,this.id=t,this.location=r,this.info=n}function i(e,t){for(var r=0;r<e.length;++r)if(e[r].id===t.id)return void(e[r].location=t.location);e.push(t)}function o(r,n,a){var i=r===Jr?u:s,o=i[n];if(!o){var f=t.str(n);o=e.createShader(r),e.shaderSource(o,f),e.compileShader(o),Ae.shaderError(e,o,f,r,a),i[n]=o}return o}function f(r,f){var u,s,c=o(Jr,r.fragId),l=o(Zr,r.vertId),d=r.program=e.createProgram();e.attachShader(d,c),e.attachShader(d,l),e.linkProgram(d),Ae.linkError(e,d,t.str(r.fragId),t.str(r.vertId),f);var m=e.getProgramParameter(d,en);n.profile&&(r.stats.uniformsCount=m);var p=r.uniforms;for(u=0;u<m;++u)if(s=e.getActiveUniform(d,u))if(s.size>1)for(var h=0;h<s.size;++h){var b=s.name.replace("[0]","["+h+"]");i(p,new a(b,t.id(b),e.getUniformLocation(d,b),s))}else i(p,new a(s.name,t.id(s.name),e.getUniformLocation(d,s.name),s));var g=e.getProgramParameter(d,tn);n.profile&&(r.stats.attributesCount=g);var v=r.attributes;for(u=0;u<g;++u)(s=e.getActiveAttrib(d,u))&&i(v,new a(s.name,t.id(s.name),e.getAttribLocation(d,s.name),s))}var u={},s={},c={},l=[],d=0;return n.profile&&(r.getMaxUniformsCount=function(){var e=0;return l.forEach(function(t){t.stats.uniformsCount>e&&(e=t.stats.uniformsCount)}),e},r.getMaxAttributesCount=function(){var e=0;return l.forEach(function(t){t.stats.attributesCount>e&&(e=t.stats.attributesCount)}),e}),{clear:function(){var t=e.deleteShader.bind(e);Oe(u).forEach(t),u={},Oe(s).forEach(t),s={},l.forEach(function(t){e.deleteProgram(t.program)}),l.length=0,c={},r.shaderCount=0},program:function(e,t,a){Ae.command(e>=0,"missing vertex shader",a),Ae.command(t>=0,"missing fragment shader",a);var i=c[t];i||(i=c[t]={});var o=i[e];return o||(o=new function(e,t){this.id=d++,this.fragId=e,this.vertId=t,this.program=null,this.uniforms=[],this.attributes=[],n.profile&&(this.stats={uniformsCount:0,attributesCount:0})}(t,e),r.shaderCount++,f(o,a),i[e]=o,l.push(o)),o},restore:function(){u={},s={};for(var e=0;e<l.length;++e)f(l[e])},shader:o,frag:-1,vert:-1}}function $(e,t,r,n,a,i){function o(o){var f;null===t.next?(Ae(a.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),f=nn):(Ae(null!==t.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),f=t.next.colorAttachments[0].texture._texture.type,i.oes_texture_float?Ae(f===nn||f===on,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"):Ae(f===nn,"Reading from a framebuffer is only allowed for the type 'uint8'"));var u=0,s=0,c=n.framebufferWidth,l=n.framebufferHeight,d=null;ue(o)?d=o:o&&(Ae.type(o,"object","invalid arguments to regl.read()"),u=0|o.x,s=0|o.y,Ae(u>=0&&u<n.framebufferWidth,"invalid x offset for regl.read"),Ae(s>=0&&s<n.framebufferHeight,"invalid y offset for regl.read"),c=0|(o.width||n.framebufferWidth-u),l=0|(o.height||n.framebufferHeight-s),d=o.data||null),d&&(f===nn?Ae(d instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):f===on&&Ae(d instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),Ae(c>0&&c+u<=n.framebufferWidth,"invalid width for read pixels"),Ae(l>0&&l+s<=n.framebufferHeight,"invalid height for read pixels"),r();var m=c*l*4;return d||(f===nn?d=new Uint8Array(m):f===on&&(d=d||new Float32Array(m))),Ae.isTypedArray(d,"data buffer for regl.read() must be a typedarray"),Ae(d.byteLength>=m,"data buffer for regl.read() too small"),e.pixelStorei(an,4),e.readPixels(u,s,c,l,rn,f,d),d}return function(e){return e&&"framebuffer"in e?function(e){var r;return t.setFBO({framebuffer:e.framebuffer},function(){r=o(e)}),r}(e):o(e)}}function K(e){return Array.prototype.slice.call(e)}function J(e){return K(e).join("")}function Z(e){return Array.isArray(e)||ue(e)||S(e)}function ee(e){return e.sort(function(e,t){return e===Gn?-1:t===Gn?1:e<t?-1:1})}function te(e,t,r,n){this.thisDep=e,this.contextDep=t,this.propDep=r,this.append=n}function re(e){return e&&!(e.thisDep||e.contextDep||e.propDep)}function ne(e){return new te(!1,!1,!1,e)}function ae(e,t){var r=e.type;if(r===ln){var n=e.data.length;return new te(!0,n>=1,n>=2,t)}if(r===hn){var a=e.data;return new te(a.thisDep,a.contextDep,a.propDep,t)}return new te(r===pn,r===mn,r===dn,t)}function ie(e,t,r,n,a,i,o,f,u,s,c,l,d,m,p){function h(e){return e.replace(".","_")}function b(e,t,r){var n=h(e);G.push(e),H[n]=W[n]=!!r,U[n]=t}function g(e,t,r){var n=h(e);G.push(e),Array.isArray(r)?(W[n]=r.slice(),H[n]=r.slice()):W[n]=H[n]=r,N[n]=t}function v(){var e=function(){function e(){var e=[],t=[];return se(function(){e.push.apply(e,K(arguments))},{def:function(){var n="v"+r++;return t.push(n),arguments.length>0&&(e.push(n,"="),e.push.apply(e,K(arguments)),e.push(";")),n},toString:function(){return J([t.length>0?"var "+t+";":"",J(e)])}})}function t(){function t(e,t){n(e,t,"=",r.def(e,t),";")}var r=e(),n=e(),a=r.toString,i=n.toString;return se(function(){r.apply(r,K(arguments))},{def:r.def,entry:r,exit:n,save:t,set:function(e,n,a){t(e,n),r(e,n,"=",a,";")},toString:function(){return a()+i()}})}var r=0,n=[],a=[],i=e(),o={};return{global:i,link:function(e){for(var t=0;t<a.length;++t)if(a[t]===e)return n[t];var i="g"+r++;return n.push(i),a.push(e),i},block:e,proc:function(e,r){function n(){var e="a"+a.length;return a.push(e),e}var a=[];r=r||0;for(var i=0;i<r;++i)n();var f=t(),u=f.toString;return o[e]=se(f,{arg:n,toString:function(){return J(["function(",a.join(),"){",u(),"}"])}})},scope:t,cond:function(){var e=J(arguments),r=t(),n=t(),a=r.toString,i=n.toString;return se(r,{then:function(){return r.apply(r,K(arguments)),this},else:function(){return n.apply(n,K(arguments)),this},toString:function(){var t=i();return t&&(t="else{"+t+"}"),J(["if(",e,"){",a(),"}",t])}})},compile:function(){var e=['"use strict";',i,"return {"];Object.keys(o).forEach(function(t){e.push('"',t,'":',o[t].toString(),",")}),e.push("}");var t=J(e).replace(/;/g,";\n").replace(/}/g,"}\n").replace(/{/g,"{\n");return Function.apply(null,n.concat(t)).apply(null,a)}}}(),r=e.link,n=e.global;e.id=V++,e.batchId="0";var a=r(q),i=e.shared={props:"a0"};Object.keys(q).forEach(function(e){i[e]=n.def(a,".",e)}),Ae.optional(function(){e.CHECK=r(Ae),e.commandStr=Ae.guessCommand(),e.command=r(e.commandStr),e.assert=function(e,t,n){e("if(!(",t,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},Q.invalidBlendCombinations=Ka});var o=e.next={},f=e.current={};Object.keys(N).forEach(function(e){Array.isArray(W[e])&&(o[e]=n.def(i.next,".",e),f[e]=n.def(i.current,".",e))});var u=e.constants={};Object.keys(Q).forEach(function(e){u[e]=n.def(JSON.stringify(Q[e]))}),e.invoke=function(t,n){switch(n.type){case ln:var a=["this",i.context,i.props,e.batchId];return t.def(r(n.data),".call(",a.slice(0,Math.max(n.data.length+1,4)),")");case dn:return t.def(i.props,n.data);case mn:return t.def(i.context,n.data);case pn:return t.def("this",n.data);case hn:return n.data.append(e,t),n.data.ref}},e.attribCache={};var c={};return e.scopeAttrib=function(e){var n=t.id(e);if(n in c)return c[n];var a=s.scope[n];a||(a=s.scope[n]=new R);return c[n]=r(a)},e}function y(e,r,o,u,s){function l(e){var t=b[e];t&&(v[e]=t)}var d=e.static,m=e.dynamic;Ae.optional(function(){function e(e){Object.keys(e).forEach(function(e){Ae.command(t.indexOf(e)>=0,'unknown parameter "'+e+'"',s.commandStr)})}var t=[Nn,qn,Qn,Vn,Yn,$n,Xn,Kn,Un].concat(G);e(d),e(m)});var p=function(e,t){var r=e.static,n=e.dynamic;if(Nn in r){var a=r[Nn];return a?(a=f.getFramebuffer(a),Ae.command(a,"invalid framebuffer object"),ne(function(e,t){var r=e.link(a),n=e.shared;t.set(n.framebuffer,".next",r);var i=n.context;return t.set(i,"."+Jn,r+".width"),t.set(i,"."+Zn,r+".height"),r})):ne(function(e,t){var r=e.shared;t.set(r.framebuffer,".next","null");var n=r.context;return t.set(n,"."+Jn,n+"."+ra),t.set(n,"."+Zn,n+"."+na),"null"})}if(Nn in n){var i=n[Nn];return ae(i,function(e,t){var r=e.invoke(t,i),n=e.shared,a=n.framebuffer,o=t.def(a,".getFramebuffer(",r,")");Ae.optional(function(){e.assert(t,"!"+r+"||"+o,"invalid framebuffer object")}),t.set(a,".next",o);var f=n.context;return t.set(f,"."+Jn,o+"?"+o+".width:"+f+"."+ra),t.set(f,"."+Zn,o+"?"+o+".height:"+f+"."+na),o})}return null}(e),b=function(e,t,r){function n(e){if(e in a){var n=a[e];Ae.commandType(n,"object","invalid "+e,r.commandStr);var o,f,u=!0,s=0|n.x,c=0|n.y;return"width"in n?(o=0|n.width,Ae.command(o>=0,"invalid "+e,r.commandStr)):u=!1,"height"in n?(f=0|n.height,Ae.command(f>=0,"invalid "+e,r.commandStr)):u=!1,new te(!u&&t&&t.thisDep,!u&&t&&t.contextDep,!u&&t&&t.propDep,function(e,t){var r=e.shared.context,a=o;"width"in n||(a=t.def(r,".",Jn,"-",s));var i=f;return"height"in n||(i=t.def(r,".",Zn,"-",c)),[s,c,a,i]})}if(e in i){var l=i[e],d=ae(l,function(t,r){var n=t.invoke(r,l);Ae.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+e)});var a=t.shared.context,i=r.def(n,".x|0"),o=r.def(n,".y|0"),f=r.def('"width" in ',n,"?",n,".width|0:","(",a,".",Jn,"-",i,")"),u=r.def('"height" in ',n,"?",n,".height|0:","(",a,".",Zn,"-",o,")");return Ae.optional(function(){t.assert(r,f+">=0&&"+u+">=0","invalid "+e)}),[i,o,f,u]});return t&&(d.thisDep=d.thisDep||t.thisDep,d.contextDep=d.contextDep||t.contextDep,d.propDep=d.propDep||t.propDep),d}return t?new te(t.thisDep,t.contextDep,t.propDep,function(e,t){var r=e.shared.context;return[0,0,t.def(r,".",Jn),t.def(r,".",Zn)]}):null}var a=e.static,i=e.dynamic,o=n(Gn);if(o){var f=o;o=new te(o.thisDep,o.contextDep,o.propDep,function(e,t){var r=f.append(e,t),n=e.shared.context;return t.set(n,"."+ea,r[2]),t.set(n,"."+ta,r[3]),r})}return{viewport:o,scissor_box:n(Hn)}}(e,p,s),g=function(e,t){function r(e,r){if(e in n){var i=0|n[e];return Ae.command(!r||i>=0,"invalid "+e,t.commandStr),ne(function(e,t){return r&&(e.OFFSET=i),i})}if(e in a){var f=a[e];return ae(f,function(t,n){var a=t.invoke(n,f);return r&&(t.OFFSET=a,Ae.optional(function(){t.assert(n,a+">=0","invalid "+e)})),a})}return r&&o?ne(function(e,t){return e.OFFSET="0",0}):null}var n=e.static,a=e.dynamic,o=function(){if(Vn in n){var e=n[Vn];Z(e)?e=i.getElements(i.create(e,!0)):e&&(e=i.getElements(e),Ae.command(e,"invalid elements",t.commandStr));var r=ne(function(t,r){if(e){var n=t.link(e);return t.ELEMENTS=n,n}return t.ELEMENTS=null,null});return r.value=e,r}if(Vn in a){var o=a[Vn];return ae(o,function(e,t){var r=e.shared,n=r.isBufferArgs,a=r.elements,i=e.invoke(t,o),f=t.def("null"),u=t.def(n,"(",i,")"),s=e.cond(u).then(f,"=",a,".createStream(",i,");").else(f,"=",a,".getElements(",i,");");return Ae.optional(function(){e.assert(s.else,"!"+i+"||"+f,"invalid elements")}),t.entry(s),t.exit(e.cond(u).then(a,".destroyStream(",f,");")),e.ELEMENTS=f,f})}return null}(),f=r($n,!0);return{elements:o,primitive:function(){if(Yn in n){var e=n[Yn];return Ae.commandParameter(e,$e,"invalid primitve",t.commandStr),ne(function(t,r){return $e[e]})}if(Yn in a){var r=a[Yn];return ae(r,function(e,t){var n=e.constants.primTypes,a=e.invoke(t,r);return Ae.optional(function(){e.assert(t,a+" in "+n,"invalid primitive, must be one of "+Object.keys($e))}),t.def(n,"[",a,"]")})}return o?re(o)?o.value?ne(function(e,t){return t.def(e.ELEMENTS,".primType")}):ne(function(){return Pa}):new te(o.thisDep,o.contextDep,o.propDep,function(e,t){var r=e.ELEMENTS;return t.def(r,"?",r,".primType:",Pa)}):null}(),count:function(){if(Xn in n){var e=0|n[Xn];return Ae.command("number"==typeof e&&e>=0,"invalid vertex count",t.commandStr),ne(function(){return e})}if(Xn in a){var r=a[Xn];return ae(r,function(e,t){var n=e.invoke(t,r);return Ae.optional(function(){e.assert(t,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")}),n})}if(o){if(re(o)){if(o)return f?new te(f.thisDep,f.contextDep,f.propDep,function(e,t){var r=t.def(e.ELEMENTS,".vertCount-",e.OFFSET);return Ae.optional(function(){e.assert(t,r+">=0","invalid vertex offset/element buffer too small")}),r}):ne(function(e,t){return t.def(e.ELEMENTS,".vertCount")});var i=ne(function(){return-1});return Ae.optional(function(){i.MISSING=!0}),i}var u=new te(o.thisDep||f.thisDep,o.contextDep||f.contextDep,o.propDep||f.propDep,function(e,t){var r=e.ELEMENTS;return e.OFFSET?t.def(r,"?",r,".vertCount-",e.OFFSET,":-1"):t.def(r,"?",r,".vertCount:-1")});return Ae.optional(function(){u.DYNAMIC=!0}),u}return null}(),instances:r(Kn,!1),offset:f}}(e,s),v=function(e,t){var r=e.static,a=e.dynamic,i={};return G.forEach(function(e){function o(t,n){if(e in r){var o=t(r[e]);i[f]=ne(function(){return o})}else if(e in a){var u=a[e];i[f]=ae(u,function(e,t){return n(e,t,e.invoke(t,u))})}}var f=h(e);switch(e){case En:case gn:case bn:case Pn:case wn:case Wn:case On:case Fn:case zn:case Sn:return o(function(r){return Ae.commandType(r,"boolean",e,t.commandStr),r},function(t,r,n){return Ae.optional(function(){t.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+e,t.commandStr)}),n});case kn:return o(function(r){return Ae.commandParameter(r,Ja,"invalid "+e,t.commandStr),Ja[r]},function(t,r,n){var a=t.constants.compareFuncs;return Ae.optional(function(){t.assert(r,n+" in "+a,"invalid "+e+", must be one of "+Object.keys(Ja))}),r.def(a,"[",n,"]")});case An:return o(function(e){return Ae.command(P(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]&&e[0]<=e[1],"depth range is 2d array",t.commandStr),e},function(e,t,r){return Ae.optional(function(){e.assert(t,e.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[t.def("+",r,"[0]"),t.def("+",r,"[1]")]});case xn:return o(function(e){Ae.commandType(e,"object","blend.func",t.commandStr);var r="srcRGB"in e?e.srcRGB:e.src,n="srcAlpha"in e?e.srcAlpha:e.src,a="dstRGB"in e?e.dstRGB:e.dst,i="dstAlpha"in e?e.dstAlpha:e.dst;return Ae.commandParameter(r,$a,f+".srcRGB",t.commandStr),Ae.commandParameter(n,$a,f+".srcAlpha",t.commandStr),Ae.commandParameter(a,$a,f+".dstRGB",t.commandStr),Ae.commandParameter(i,$a,f+".dstAlpha",t.commandStr),Ae.command(-1===Ka.indexOf(r+", "+a),"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+a+")",t.commandStr),[$a[r],$a[a],$a[n],$a[i]]},function(t,r,n){function a(a,o){var f=r.def('"',a,o,'" in ',n,"?",n,".",a,o,":",n,".",a);return Ae.optional(function(){t.assert(r,f+" in "+i,"invalid "+e+"."+a+o+", must be one of "+Object.keys($a))}),f}var i=t.constants.blendFuncs;Ae.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var o=a("src","RGB"),f=a("dst","RGB");Ae.optional(function(){var e=t.constants.invalidBlendCombinations;t.assert(r,e+".indexOf("+o+'+", "+'+f+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var u=r.def(i,"[",o,"]"),s=r.def(i,"[",a("src","Alpha"),"]");return[u,r.def(i,"[",f,"]"),s,r.def(i,"[",a("dst","Alpha"),"]")]});case yn:return o(function(r){return"string"==typeof r?(Ae.commandParameter(r,L,"invalid "+e,t.commandStr),[L[r],L[r]]):"object"==typeof r?(Ae.commandParameter(r.rgb,L,e+".rgb",t.commandStr),Ae.commandParameter(r.alpha,L,e+".alpha",t.commandStr),[L[r.rgb],L[r.alpha]]):void Ae.commandRaise("invalid blend.equation",t.commandStr)},function(t,r,n){var a=t.constants.blendEquations,i=r.def(),o=r.def(),f=t.cond("typeof ",n,'==="string"');return Ae.optional(function(){function r(e,r,n){t.assert(e,n+" in "+a,"invalid "+r+", must be one of "+Object.keys(L))}r(f.then,e,n),t.assert(f.else,n+"&&typeof "+n+'==="object"',"invalid "+e),r(f.else,e+".rgb",n+".rgb"),r(f.else,e+".alpha",n+".alpha")}),f.then(i,"=",o,"=",a,"[",n,"];"),f.else(i,"=",a,"[",n,".rgb];",o,"=",a,"[",n,".alpha];"),r(f),[i,o]});case vn:return o(function(e){return Ae.command(P(e)&&4===e.length,"blend.color must be a 4d array",t.commandStr),_(4,function(t){return+e[t]})},function(e,t,r){return Ae.optional(function(){e.assert(t,e.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),_(4,function(e){return t.def("+",r,"[",e,"]")})});case Rn:return o(function(e){return Ae.commandType(e,"number",f,t.commandStr),0|e},function(e,t,r){return Ae.optional(function(){e.assert(t,"typeof "+r+'==="number"',"invalid stencil.mask")}),t.def(r,"|0")});case Ln:return o(function(r){Ae.commandType(r,"object",f,t.commandStr);var n=r.cmp||"keep",a=r.ref||0,i="mask"in r?r.mask:-1;return Ae.commandParameter(n,Ja,e+".cmp",t.commandStr),Ae.commandType(a,"number",e+".ref",t.commandStr),Ae.commandType(i,"number",e+".mask",t.commandStr),[Ja[n],a,i]},function(e,t,r){var n=e.constants.compareFuncs;return Ae.optional(function(){function a(){e.assert(t,Array.prototype.join.call(arguments,""),"invalid stencil.func")}a(r+"&&typeof ",r,'==="object"'),a('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[t.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Ua),t.def(r,".ref|0"),t.def('"mask" in ',r,"?",r,".mask|0:-1")]});case In:case Mn:return o(function(r){Ae.commandType(r,"object",f,t.commandStr);var n=r.fail||"keep",a=r.zfail||"keep",i=r.zpass||"keep";return Ae.commandParameter(n,Za,e+".fail",t.commandStr),Ae.commandParameter(a,Za,e+".zfail",t.commandStr),Ae.commandParameter(i,Za,e+".zpass",t.commandStr),[e===Mn?La:Ra,Za[n],Za[a],Za[i]]},function(t,r,n){function a(a){return Ae.optional(function(){t.assert(r,'!("'+a+'" in '+n+")||("+n+"."+a+" in "+i+")","invalid "+e+"."+a+", must be one of "+Object.keys(Za))}),r.def('"',a,'" in ',n,"?",i,"[",n,".",a,"]:",Ua)}var i=t.constants.stencilOps;return Ae.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+e)}),[e===Mn?La:Ra,a("fail"),a("zfail"),a("zpass")]});case Cn:return o(function(e){Ae.commandType(e,"object",f,t.commandStr);var r=0|e.factor,n=0|e.units;return Ae.commandType(r,"number",f+".factor",t.commandStr),Ae.commandType(n,"number",f+".units",t.commandStr),[r,n]},function(t,r,n){return Ae.optional(function(){t.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+e)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case Tn:return o(function(e){var r=0;return"front"===e?r=Ra:"back"===e&&(r=La),Ae.command(!!r,f,t.commandStr),r},function(e,t,r){return Ae.optional(function(){e.assert(t,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),t.def(r,'==="front"?',Ra,":",La)});case jn:return o(function(e){return Ae.command("number"==typeof e&&e>=n.lineWidthDims[0]&&e<=n.lineWidthDims[1],"invalid line width, must positive number between "+n.lineWidthDims[0]+" and "+n.lineWidthDims[1],t.commandStr),e},function(e,t,r){return Ae.optional(function(){e.assert(t,"typeof "+r+'==="number"&&'+r+">="+n.lineWidthDims[0]+"&&"+r+"<="+n.lineWidthDims[1],"invalid line width")}),r});case Dn:return o(function(e){return Ae.commandParameter(e,ti,f,t.commandStr),ti[e]},function(e,t,r){return Ae.optional(function(){e.assert(t,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),t.def(r+'==="cw"?'+Ia+":"+Ma)});case _n:return o(function(e){return Ae.command(P(e)&&4===e.length,"color.mask must be length 4 array",t.commandStr),e.map(function(e){return!!e})},function(e,t,r){return Ae.optional(function(){e.assert(t,e.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),_(4,function(e){return"!!"+r+"["+e+"]"})});case Bn:return o(function(e){Ae.command("object"==typeof e&&e,f,t.commandStr);var r="value"in e?e.value:1,n=!!e.invert;return Ae.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",t.commandStr),[r,n]},function(e,t,r){return Ae.optional(function(){e.assert(t,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[t.def('"value" in ',r,"?+",r,".value:1"),t.def("!!",r,".invert")]})}}),i}(e,s),y=function(e){function r(e){if(e in a){var r=t.id(a[e]);Ae.optional(function(){c.shader(ei[e],r,Ae.guessCommand())});var n=ne(function(){return r});return n.id=r,n}if(e in i){var o=i[e];return ae(o,function(t,r){var n=t.invoke(r,o),a=r.def(t.shared.strings,".id(",n,")");return Ae.optional(function(){r(t.shared.shader,".shader(",ei[e],",",a,",",t.command,");")}),a})}return null}var n,a=e.static,i=e.dynamic,o=r(Qn),f=r(qn),u=null;return re(o)&&re(f)?(u=c.program(f.id,o.id),n=ne(function(e,t){return e.link(u)})):n=new te(o&&o.thisDep||f&&f.thisDep,o&&o.contextDep||f&&f.contextDep,o&&o.propDep||f&&f.propDep,function(e,t){var r,n=e.shared.shader;r=o?o.append(e,t):t.def(n,".",Qn);var a=n+".program("+(f?f.append(e,t):t.def(n,".",qn))+","+r;return Ae.optional(function(){a+=","+e.command}),t.def(a+")")}),{frag:o,vert:f,progVar:n,program:u}}(e);l(Gn),l(h(Hn));var x=Object.keys(v).length>0,w={framebuffer:p,draw:g,shader:y,state:v,dirty:x};return w.profile=function(e){var t,r=e.static,n=e.dynamic;if(Un in r){var a=!!r[Un];(t=ne(function(e,t){return a})).enable=a}else if(Un in n){var i=n[Un];t=ae(i,function(e,t){return e.invoke(t,i)})}return t}(e),w.uniforms=function(e,t){var r=e.static,n=e.dynamic,a={};return Object.keys(r).forEach(function(e){var n,i=r[e];if("number"==typeof i||"boolean"==typeof i)n=ne(function(){return i});else if("function"==typeof i){var o=i._reglType;"texture2d"===o||"textureCube"===o?n=ne(function(e){return e.link(i)}):"framebuffer"===o||"framebufferCube"===o?(Ae.command(i.color.length>0,'missing color attachment for framebuffer sent to uniform "'+e+'"',t.commandStr),n=ne(function(e){return e.link(i.color[0])})):Ae.commandRaise('invalid data for uniform "'+e+'"',t.commandStr)}else P(i)?n=ne(function(t){return t.global.def("[",_(i.length,function(r){return Ae.command("number"==typeof i[r]||"boolean"==typeof i[r],"invalid uniform "+e,t.commandStr),i[r]}),"]")}):Ae.commandRaise('invalid or missing data for uniform "'+e+'"',t.commandStr);n.value=i,a[e]=n}),Object.keys(n).forEach(function(e){var t=n[e];a[e]=ae(t,function(e,r){return e.invoke(r,t)})}),a}(o,s),w.attributes=function(e,r){var n=e.static,i=e.dynamic,o={};return Object.keys(n).forEach(function(e){var i=n[e],f=t.id(e),u=new R;if(Z(i))u.state=sn,u.buffer=a.getBuffer(a.create(i,ia,!1,!0)),u.type=0;else{var s=a.getBuffer(i);if(s)u.state=sn,u.buffer=s,u.type=0;else if(Ae.command("object"==typeof i&&i,"invalid data for attribute "+e,r.commandStr),i.constant){var c=i.constant;u.buffer="null",u.state=cn,"number"==typeof c?u.x=c:(Ae.command(P(c)&&c.length>0&&c.length<=4,"invalid constant for attribute "+e,r.commandStr),fn.forEach(function(e,t){t<c.length&&(u[e]=c[t])}))}else{s=Z(i.buffer)?a.getBuffer(a.create(i.buffer,ia,!1,!0)):a.getBuffer(i.buffer),Ae.command(!!s,'missing buffer for attribute "'+e+'"',r.commandStr);var l=0|i.offset;Ae.command(l>=0,'invalid offset for attribute "'+e+'"',r.commandStr);var d=0|i.stride;Ae.command(d>=0&&d<256,'invalid stride for attribute "'+e+'", must be integer betweeen [0, 255]',r.commandStr);var m=0|i.size;Ae.command(!("size"in i)||m>0&&m<=4,'invalid size for attribute "'+e+'", must be 1,2,3,4',r.commandStr);var p=!!i.normalized,h=0;"type"in i&&(Ae.commandParameter(i.type,He,"invalid type for attribute "+e,r.commandStr),h=He[i.type]);var b=0|i.divisor;"divisor"in i&&(Ae.command(0===b||I,'cannot specify divisor for attribute "'+e+'", instancing not supported',r.commandStr),Ae.command(b>=0,'invalid divisor for attribute "'+e+'"',r.commandStr)),Ae.optional(function(){var t=r.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(i).forEach(function(r){Ae.command(n.indexOf(r)>=0,'unknown parameter "'+r+'" for attribute pointer "'+e+'" (valid parameters are '+n+")",t)})}),u.buffer=s,u.state=sn,u.size=m,u.normalized=p,u.type=h||s.dtype,u.offset=l,u.stride=d,u.divisor=b}}o[e]=ne(function(e,t){var r=e.attribCache;if(f in r)return r[f];var n={isStream:!1};return Object.keys(u).forEach(function(e){n[e]=u[e]}),u.buffer&&(n.buffer=e.link(u.buffer),n.type=n.type||n.buffer+".dtype"),r[f]=n,n})}),Object.keys(i).forEach(function(e){var t=i[e];o[e]=ae(t,function(r,n){function a(e){n(s[e],"=",i,".",e,"|0;")}var i=r.invoke(n,t),o=r.shared,f=o.isBufferArgs,u=o.buffer;Ae.optional(function(){r.assert(n,i+"&&(typeof "+i+'==="object"||typeof '+i+'==="function")&&('+f+"("+i+")||"+u+".getBuffer("+i+")||"+u+".getBuffer("+i+".buffer)||"+f+"("+i+'.buffer)||("constant" in '+i+"&&(typeof "+i+'.constant==="number"||'+o.isArrayLike+"("+i+".constant))))",'invalid dynamic attribute "'+e+'"')});var s={isStream:n.def(!1)},c=new R;c.state=sn,Object.keys(c).forEach(function(e){s[e]=n.def(""+c[e])});var l=s.buffer,d=s.type;return n("if(",f,"(",i,")){",s.isStream,"=true;",l,"=",u,".createStream(",ia,",",i,");",d,"=",l,".dtype;","}else{",l,"=",u,".getBuffer(",i,");","if(",l,"){",d,"=",l,".dtype;",'}else if("constant" in ',i,"){",s.state,"=",cn,";","if(typeof "+i+'.constant === "number"){',s[fn[0]],"=",i,".constant;",fn.slice(1).map(function(e){return s[e]}).join("="),"=0;","}else{",fn.map(function(e,t){return s[e]+"="+i+".constant.length>="+t+"?"+i+".constant["+t+"]:0;"}).join(""),"}}else{","if(",f,"(",i,".buffer)){",l,"=",u,".createStream(",ia,",",i,".buffer);","}else{",l,"=",u,".getBuffer(",i,".buffer);","}",d,'="type" in ',i,"?",o.glTypes,"[",i,".type]:",l,".dtype;",s.normalized,"=!!",i,".normalized;"),a("size"),a("offset"),a("stride"),a("divisor"),n("}}"),n.exit("if(",s.isStream,"){",u,".destroyStream(",l,");","}"),s})}),o}(r,s),w.context=function(e){var t=e.static,r=e.dynamic,n={};return Object.keys(t).forEach(function(e){var r=t[e];n[e]=ne(function(e,t){return"number"==typeof r||"boolean"==typeof r?""+r:e.link(r)})}),Object.keys(r).forEach(function(e){var t=r[e];n[e]=ae(t,function(e,r){return e.invoke(r,t)})}),n}(u),w}function x(e,t,r){var n=e.shared.context,a=e.scope();Object.keys(r).forEach(function(i){t.save(n,"."+i);var o=r[i];a(n,".",i,"=",o.append(e,t),";")}),t(a)}function w(e,t,r,n){var a,i=e.shared,o=i.gl,f=i.framebuffer;M&&(a=t.def(i.extensions,".webgl_draw_buffers"));var u,s=e.constants,c=s.drawBuffer,l=s.backBuffer;u=r?r.append(e,t):t.def(f,".next"),n||t("if(",u,"!==",f,".cur){"),t("if(",u,"){",o,".bindFramebuffer(",Ya,",",u,".framebuffer);"),M&&t(a,".drawBuffersWEBGL(",c,"[",u,".colorAttachments.length]);"),t("}else{",o,".bindFramebuffer(",Ya,",null);"),M&&t(a,".drawBuffersWEBGL(",l,");"),t("}",f,".cur=",u,";"),n||t("}")}function k(e,t,r){var n=e.shared,a=n.gl,i=e.current,o=e.next,f=n.current,u=n.next,s=e.cond(f,".dirty");G.forEach(function(t){var n=h(t);if(!(n in r.state)){var c,l;if(n in o){c=o[n],l=i[n];var d=_(W[n].length,function(e){return s.def(c,"[",e,"]")});s(e.cond(d.map(function(e,t){return e+"!=="+l+"["+t+"]"}).join("||")).then(a,".",N[n],"(",d,");",d.map(function(e,t){return l+"["+t+"]="+e}).join(";"),";"))}else{c=s.def(u,".",n);var m=e.cond(c,"!==",f,".",n);s(m),n in U?m(e.cond(c).then(a,".enable(",U[n],");").else(a,".disable(",U[n],");"),f,".",n,"=",c,";"):m(a,".",N[n],"(",c,");",f,".",n,"=",c,";")}}}),0===Object.keys(r.state).length&&s(f,".dirty=false;"),t(s)}function A(e,t,r,n){var a=e.shared,i=e.current,o=a.current,f=a.gl;ee(Object.keys(r)).forEach(function(a){var u=r[a];if(!n||n(u)){var s=u.append(e,t);if(U[a]){var c=U[a];re(u)?t(f,s?".enable(":".disable(",c,");"):t(e.cond(s).then(f,".enable(",c,");").else(f,".disable(",c,");")),t(o,".",a,"=",s,";")}else if(P(s)){var l=i[a];t(f,".",N[a],"(",s,");",s.map(function(e,t){return l+"["+t+"]="+e}).join(";"),";")}else t(f,".",N[a],"(",s,");",o,".",a,"=",s,";")}})}function S(e,t){I&&(e.instancing=t.def(e.shared.extensions,".angle_instanced_arrays"))}function E(e,t,r,n,a){function i(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function o(e){e(s=t.def(),"=",i(),";"),"string"==typeof a?e(p,".count+=",a,";"):e(p,".count++;"),m&&(n?e(c=t.def(),"=",b,".getNumPendingQueries();"):e(b,".beginQuery(",p,");"))}function f(e){e(p,".cpuTime+=",i(),"-",s,";"),m&&(n?e(b,".pushScopeStats(",c,",",b,".getNumPendingQueries(),",p,");"):e(b,".endQuery();"))}function u(e){var r=t.def(h,".profile");t(h,".profile=",e,";"),t.exit(h,".profile=",r,";")}var s,c,l,d=e.shared,p=e.stats,h=d.current,b=d.timer,g=r.profile;if(g){if(re(g))return void(g.enable?(o(t),f(t.exit),u("true")):u("false"));u(l=g.append(e,t))}else l=t.def(h,".profile");var v=e.block();o(v),t("if(",l,"){",v,"}");var y=e.block();f(y),t.exit("if(",l,"){",y,"}")}function T(e,t,r,n,a){var i=e.shared;n.forEach(function(n){var o,f=n.name,u=r.attributes[f];if(u){if(!a(u))return;o=u.append(e,t)}else{if(!a(ri))return;var s=e.scopeAttrib(f);Ae.optional(function(){e.assert(t,s+".state","missing attribute "+f)}),o={},Object.keys(new R).forEach(function(e){o[e]=t.def(s,".",e)})}!function(r,n,a){function o(){t("if(!",c,".buffer){",u,".enableVertexAttribArray(",s,");}");var r,i=a.type;if(r=a.size?t.def(a.size,"||",n):n,t("if(",c,".type!==",i,"||",c,".size!==",r,"||",p.map(function(e){return c+"."+e+"!=="+a[e]}).join("||"),"){",u,".bindBuffer(",ia,",",d,".buffer);",u,".vertexAttribPointer(",[s,r,i,a.normalized,a.stride,a.offset],");",c,".type=",i,";",c,".size=",r,";",p.map(function(e){return c+"."+e+"="+a[e]+";"}).join(""),"}"),I){var o=a.divisor;t("if(",c,".divisor!==",o,"){",e.instancing,".vertexAttribDivisorANGLE(",[s,o],");",c,".divisor=",o,";}")}}function f(){t("if(",c,".buffer){",u,".disableVertexAttribArray(",s,");","}if(",fn.map(function(e,t){return c+"."+e+"!=="+m[t]}).join("||"),"){",u,".vertexAttrib4f(",s,",",m,");",fn.map(function(e,t){return c+"."+e+"="+m[t]+";"}).join(""),"}")}var u=i.gl,s=t.def(r,".location"),c=t.def(i.attributes,"[",s,"]"),l=a.state,d=a.buffer,m=[a.x,a.y,a.z,a.w],p=["buffer","normalized","offset","stride"];l===sn?o():l===cn?f():(t("if(",l,"===",sn,"){"),o(),t("}else{"),f(),t("}"))}(e.link(n),function(e){switch(e){case ya:case Aa:case Ta:return 2;case xa:case Sa:case Da:return 3;case wa:case _a:case ja:return 4;default:return 1}}(n.info.type),o)})}function D(e,r,n,a,i){for(var o,f=e.shared,u=f.gl,s=0;s<a.length;++s){var c,l=a[s],d=l.name,m=l.info.type,p=n.uniforms[d],h=e.link(l)+".location";if(p){if(!i(p))continue;if(re(p)){var b=p.value;if(Ae.command(null!==b&&void 0!==b,'missing uniform "'+d+'"',e.commandStr),m===za||m===Ba){Ae.command("function"==typeof b&&(m===za&&("texture2d"===b._reglType||"framebuffer"===b._reglType)||m===Ba&&("textureCube"===b._reglType||"framebufferCube"===b._reglType)),"invalid texture for uniform "+d,e.commandStr);var g=e.link(b._texture||b.color[0]._texture);r(u,".uniform1i(",h,",",g+".bind());"),r.exit(g,".unbind();")}else if(m===Oa||m===Ca||m===Fa){Ae.optional(function(){Ae.command(P(b),"invalid matrix for uniform "+d,e.commandStr),Ae.command(m===Oa&&4===b.length||m===Ca&&9===b.length||m===Fa&&16===b.length,"invalid length for matrix uniform "+d,e.commandStr)});var v=e.global.def("new Float32Array(["+Array.prototype.slice.call(b)+"])"),y=2;m===Ca?y=3:m===Fa&&(y=4),r(u,".uniformMatrix",y,"fv(",h,",false,",v,");")}else{switch(m){case va:Ae.commandType(b,"number","uniform "+d,e.commandStr),o="1f";break;case ya:Ae.command(P(b)&&2===b.length,"uniform "+d,e.commandStr),o="2f";break;case xa:Ae.command(P(b)&&3===b.length,"uniform "+d,e.commandStr),o="3f";break;case wa:Ae.command(P(b)&&4===b.length,"uniform "+d,e.commandStr),o="4f";break;case Ea:Ae.commandType(b,"boolean","uniform "+d,e.commandStr),o="1i";break;case ka:Ae.commandType(b,"number","uniform "+d,e.commandStr),o="1i";break;case Ta:case Aa:Ae.command(P(b)&&2===b.length,"uniform "+d,e.commandStr),o="2i";break;case Da:case Sa:Ae.command(P(b)&&3===b.length,"uniform "+d,e.commandStr),o="3i";break;case ja:case _a:Ae.command(P(b)&&4===b.length,"uniform "+d,e.commandStr),o="4i"}r(u,".uniform",o,"(",h,",",P(b)?Array.prototype.slice.call(b):b,");")}continue}c=p.append(e,r)}else{if(!i(ri))continue;c=r.def(f.uniforms,"[",t.id(d),"]")}m===za?r("if(",c,"&&",c,'._reglType==="framebuffer"){',c,"=",c,".color[0];","}"):m===Ba&&r("if(",c,"&&",c,'._reglType==="framebufferCube"){',c,"=",c,".color[0];","}"),Ae.optional(function(){function t(t,n){e.assert(r,t,'bad data or missing for uniform "'+d+'". '+n)}function n(e){t("typeof "+c+'==="'+e+'"',"invalid type, expected "+e)}function a(r,n){t(f.isArrayLike+"("+c+")&&"+c+".length==="+r,"invalid vector, should have length "+r,e.commandStr)}function i(r){t("typeof "+c+'==="function"&&'+c+'._reglType==="texture'+(r===fa?"2d":"Cube")+'"',"invalid texture type",e.commandStr)}switch(m){case ka:n("number");break;case Aa:a(2);break;case Sa:a(3);break;case _a:a(4);break;case va:n("number");break;case ya:a(2);break;case xa:a(3);break;case wa:a(4);break;case Ea:n("boolean");break;case Ta:a(2);break;case Da:a(3);break;case ja:case Oa:a(4);break;case Ca:a(9);break;case Fa:a(16);break;case za:i(fa);break;case Ba:i(ua)}});var x=1;switch(m){case za:case Ba:var w=r.def(c,"._texture");r(u,".uniform1i(",h,",",w,".bind());"),r.exit(w,".unbind();");continue;case ka:case Ea:o="1i";break;case Aa:case Ta:o="2i",x=2;break;case Sa:case Da:o="3i",x=3;break;case _a:case ja:o="4i",x=4;break;case va:o="1f";break;case ya:o="2f",x=2;break;case xa:o="3f",x=3;break;case wa:o="4f",x=4;break;case Oa:o="Matrix2fv";break;case Ca:o="Matrix3fv";break;case Fa:o="Matrix4fv"}if(r(u,".uniform",o,"(",h,","),"M"===o.charAt(0)){var k=Math.pow(m-Oa+2,2),A=e.global.def("new Float32Array(",k,")");r("false,(Array.isArray(",c,")||",c," instanceof Float32Array)?",c,":(",_(k,function(e){return A+"["+e+"]="+c+"["+e+"]"}),",",A,")")}else r(x>1?_(x,function(e){return c+"["+e+"]"}):c);r(");")}}function j(e,t,r,n){function a(a){var i=c[a];return i?i.contextDep&&n.contextDynamic||i.propDep?i.append(e,r):i.append(e,t):t.def(s,".",a)}function i(){function e(){r(b,".drawElementsInstancedANGLE(",[d,p,g,m+"<<(("+g+"-"+un+")>>1)",h],");")}function t(){r(b,".drawArraysInstancedANGLE(",[d,m,p,h],");")}l?v?e():(r("if(",l,"){"),e(),r("}else{"),t(),r("}")):t()}function o(){function e(){r(u+".drawElements("+[d,p,g,m+"<<(("+g+"-"+un+")>>1)"]+");")}function t(){r(u+".drawArrays("+[d,m,p]+");")}l?v?e():(r("if(",l,"){"),e(),r("}else{"),t(),r("}")):t()}var f=e.shared,u=f.gl,s=f.draw,c=n.draw,l=function(){var a,i=c.elements,o=t;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(e,o)):a=o.def(s,".",Vn),a&&o("if("+a+")"+u+".bindBuffer("+oa+","+a+".buffer.buffer);"),a}(),d=a(Yn),m=a($n),p=function(){var a,i=c.count,o=t;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(o=r),a=i.append(e,o),Ae.optional(function(){i.MISSING&&e.assert(t,"false","missing vertex count"),i.DYNAMIC&&e.assert(o,a+">=0","missing vertex count")})):(a=o.def(s,".",Xn),Ae.optional(function(){e.assert(o,a+">=0","missing vertex count")})),a}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");var h,b;I&&(h=a(Kn),b=e.instancing);var g=l+".type",v=c.elements&&re(c.elements);I&&("number"!=typeof h||h>=0)?"string"==typeof h?(r("if(",h,">0){"),i(),r("}else if(",h,"<0){"),o(),r("}")):i():o()}function O(e,t,r,n,a){var i=v(),o=i.proc("body",a);return Ae.optional(function(){i.commandStr=t.commandStr,i.command=i.link(t.commandStr)}),I&&(i.instancing=o.def(i.shared.extensions,".angle_instanced_arrays")),e(i,o,r,n),i.compile().body}function C(e,t,r,n){S(e,t),T(e,t,r,n.attributes,function(){return!0}),D(e,t,r,n.uniforms,function(){return!0}),j(e,t,t,r)}function F(e,t,r,n){function a(){return!0}e.batchId="a1",S(e,t),T(e,t,r,n.attributes,a),D(e,t,r,n.uniforms,a),j(e,t,t,r)}function z(e,t,r,n){function a(e){return e.contextDep&&o||e.propDep}function i(e){return!a(e)}S(e,t);var o=r.contextDep,f=t.def(),u=t.def();e.shared.props=u,e.batchId=f;var s=e.scope(),c=e.scope();if(t(s.entry,"for(",f,"=0;",f,"<","a1",";++",f,"){",u,"=","a0","[",f,"];",c,"}",s.exit),r.needsContext&&x(e,c,r.context),r.needsFramebuffer&&w(e,c,r.framebuffer),A(e,c,r.state,a),r.profile&&a(r.profile)&&E(e,c,r,!1,!0),n)T(e,s,r,n.attributes,i),T(e,c,r,n.attributes,a),D(e,s,r,n.uniforms,i),D(e,c,r,n.uniforms,a),j(e,s,c,r);else{var l=e.global.def("{}"),d=r.shader.progVar.append(e,c),m=c.def(d,".id"),p=c.def(l,"[",m,"]");c(e.shared.gl,".useProgram(",d,".program);","if(!",p,"){",p,"=",l,"[",m,"]=",e.link(function(t){return O(F,e,r,t,2)}),"(",d,");}",p,".call(this,a0[",f,"],",f,");")}}function B(e,t,r){var n=t.static[r];if(n&&function(e){if("object"==typeof e&&!P(e)){for(var t=Object.keys(e),r=0;r<t.length;++r)if(Ee.isDynamic(e[t[r]]))return!0;return!1}}(n)){var a=e.global,i=Object.keys(n),o=!1,f=!1,u=!1,s=e.global.def("{}");i.forEach(function(t){var r=n[t];if(Ee.isDynamic(r)){"function"==typeof r&&(r=n[t]=Ee.unbox(r));var i=ae(r,null);o=o||i.thisDep,u=u||i.propDep,f=f||i.contextDep}else{switch(a(s,".",t,"="),typeof r){case"number":a(r);break;case"string":a('"',r,'"');break;case"object":Array.isArray(r)&&a("[",r.join(),"]");break;default:a(e.link(r))}a(";")}}),t.dynamic[r]=new Ee.DynamicVariable(hn,{thisDep:o,contextDep:f,propDep:u,ref:s,append:function(e,t){i.forEach(function(r){var a=n[r];if(Ee.isDynamic(a)){var i=e.invoke(t,a);t(s,".",r,"=",i,";")}})}}),delete t.static[r]}}var R=s.Record,L={add:32774,subtract:32778,"reverse subtract":32779};r.ext_blend_minmax&&(L.min=Wa,L.max=Ha);var I=r.angle_instanced_arrays,M=r.webgl_draw_buffers,W={dirty:!0,profile:p.profile},H={},G=[],U={},N={};b(bn,la),b(gn,ca),g(vn,"blendColor",[0,0,0,0]),g(yn,"blendEquationSeparate",[Qa,Qa]),g(xn,"blendFuncSeparate",[qa,Na,qa,Na]),b(wn,ma,!0),g(kn,"depthFunc",Va),g(An,"depthRange",[0,1]),g(Sn,"depthMask",!0),g(_n,_n,[!0,!0,!0,!0]),b(En,sa),g(Tn,"cullFace",La),g(Dn,Dn,Ma),g(jn,jn,1),b(On,ha),g(Cn,"polygonOffset",[0,0]),b(Fn,ba),b(zn,ga),g(Bn,"sampleCoverage",[1,!1]),b(Pn,da),g(Rn,"stencilMask",-1),g(Ln,"stencilFunc",[Ga,0,-1]),g(In,"stencilOpSeparate",[Ra,Ua,Ua,Ua]),g(Mn,"stencilOpSeparate",[La,Ua,Ua,Ua]),b(Wn,pa),g(Hn,"scissor",[0,0,e.drawingBufferWidth,e.drawingBufferHeight]),g(Gn,Gn,[0,0,e.drawingBufferWidth,e.drawingBufferHeight]);var q={gl:e,context:d,strings:t,next:H,current:W,draw:l,elements:i,buffer:a,shader:c,attributes:s.state,uniforms:u,framebuffer:f,extensions:r,timer:m,isBufferArgs:Z},Q={primTypes:$e,compareFuncs:Ja,blendFuncs:$a,blendEquations:L,stencilOps:Za,glTypes:He,orientationType:ti};Ae.optional(function(){q.isArrayLike=P}),M&&(Q.backBuffer=[La],Q.drawBuffer=_(n.maxDrawbuffers,function(e){return 0===e?[0]:_(e,function(e){return Xa+e})}));var V=0;return{next:H,current:W,procs:function(){var t=v(),r=t.proc("poll"),a=t.proc("refresh"),i=t.block();r(i),a(i);var o=t.shared,f=o.gl,u=o.next,s=o.current;i(s,".dirty=false;"),w(t,r),w(t,a,null,!0);var c,l=e.getExtension("angle_instanced_arrays");l&&(c=t.link(l));for(var d=0;d<n.maxAttributes;++d){var m=a.def(o.attributes,"[",d,"]"),p=t.cond(m,".buffer");p.then(f,".enableVertexAttribArray(",d,");",f,".bindBuffer(",ia,",",m,".buffer.buffer);",f,".vertexAttribPointer(",d,",",m,".size,",m,".type,",m,".normalized,",m,".stride,",m,".offset);").else(f,".disableVertexAttribArray(",d,");",f,".vertexAttrib4f(",d,",",m,".x,",m,".y,",m,".z,",m,".w);",m,".buffer=null;"),a(p),l&&a(c,".vertexAttribDivisorANGLE(",d,",",m,".divisor);")}return Object.keys(U).forEach(function(e){var n=U[e],o=i.def(u,".",e),c=t.block();c("if(",o,"){",f,".enable(",n,")}else{",f,".disable(",n,")}",s,".",e,"=",o,";"),a(c),r("if(",o,"!==",s,".",e,"){",c,"}")}),Object.keys(N).forEach(function(e){var n,o,c=N[e],l=W[e],d=t.block();if(d(f,".",c,"("),P(l)){var m=l.length;n=t.global.def(u,".",e),o=t.global.def(s,".",e),d(_(m,function(e){return n+"["+e+"]"}),");",_(m,function(e){return o+"["+e+"]="+n+"["+e+"];"}).join("")),r("if(",_(m,function(e){return n+"["+e+"]!=="+o+"["+e+"]"}).join("||"),"){",d,"}")}else n=i.def(u,".",e),o=i.def(s,".",e),d(n,");",s,".",e,"=",n,";"),r("if(",n,"!==",o,"){",d,"}");a(d)}),t.compile()}(),compile:function(e,r,n,a,i){var o=v();o.stats=o.link(i),Object.keys(r.static).forEach(function(e){B(o,r,e)}),aa.forEach(function(t){B(o,e,t)});var f=y(e,r,n,a,o);return function(e,t){var r=e.proc("draw",1);S(e,r),x(e,r,t.context),w(e,r,t.framebuffer),k(e,r,t),A(e,r,t.state),E(e,r,t,!1,!0);var n=t.shader.progVar.append(e,r);if(r(e.shared.gl,".useProgram(",n,".program);"),t.shader.program)C(e,r,t,t.shader.program);else{var a=e.global.def("{}"),i=r.def(n,".id"),o=r.def(a,"[",i,"]");r(e.cond(o).then(o,".call(this,a0);").else(o,"=",a,"[",i,"]=",e.link(function(r){return O(C,e,t,r,1)}),"(",n,");",o,".call(this,a0);"))}Object.keys(t.state).length>0&&r(e.shared.current,".dirty=true;")}(o,f),function(e,r){function n(t){var n=r.shader[t];n&&a.set(i.shader,"."+t,n.append(e,a))}var a=e.proc("scope",3);e.batchId="a2";var i=e.shared,o=i.current;x(e,a,r.context),r.framebuffer&&r.framebuffer.append(e,a),ee(Object.keys(r.state)).forEach(function(t){var n=r.state[t].append(e,a);P(n)?n.forEach(function(r,n){a.set(e.next[t],"["+n+"]",r)}):a.set(i.next,"."+t,n)}),E(e,a,r,!0,!0),[Vn,$n,Xn,Kn,Yn].forEach(function(t){var n=r.draw[t];n&&a.set(i.draw,"."+t,""+n.append(e,a))}),Object.keys(r.uniforms).forEach(function(n){a.set(i.uniforms,"["+t.id(n)+"]",r.uniforms[n].append(e,a))}),Object.keys(r.attributes).forEach(function(t){var n=r.attributes[t].append(e,a),i=e.scopeAttrib(t);Object.keys(new R).forEach(function(e){a.set(i,"."+e,n[e])})}),n(qn),n(Qn),Object.keys(r.state).length>0&&(a(o,".dirty=true;"),a.exit(o,".dirty=true;")),a("a1(",e.shared.context,",a0,",e.batchId,");")}(o,f),function(e,t){function r(e){return e.contextDep&&a||e.propDep}var n=e.proc("batch",2);e.batchId="0",S(e,n);var a=!1,i=!0;Object.keys(t.context).forEach(function(e){a=a||t.context[e].propDep}),a||(x(e,n,t.context),i=!1);var o=t.framebuffer,f=!1;o?(o.propDep?a=f=!0:o.contextDep&&a&&(f=!0),f||w(e,n,o)):w(e,n,null),t.state.viewport&&t.state.viewport.propDep&&(a=!0),k(e,n,t),A(e,n,t.state,function(e){return!r(e)}),t.profile&&r(t.profile)||E(e,n,t,!1,"a1"),t.contextDep=a,t.needsContext=i,t.needsFramebuffer=f;var u=t.shader.progVar;if(u.contextDep&&a||u.propDep)z(e,n,t,null);else{var s=u.append(e,n);if(n(e.shared.gl,".useProgram(",s,".program);"),t.shader.program)z(e,n,t,t.shader.program);else{var c=e.global.def("{}"),l=n.def(s,".id"),d=n.def(c,"[",l,"]");n(e.cond(d).then(d,".call(this,a0,a1);").else(d,"=",c,"[",l,"]=",e.link(function(r){return O(z,e,t,r,2)}),"(",s,");",d,".call(this,a0,a1);"))}}Object.keys(t.state).length>0&&n(e.shared.current,".dirty=true;")}(o,f),o.compile()}}}function oe(e,t){for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1}var fe={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},ue=function(e){return Object.prototype.toString.call(e)in fe},se=function(e,t){for(var r=Object.keys(t),n=0;n<r.length;++n)e[r[n]]=t[r[n]];return e},ce=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"],le=33071,de=9728,me=9984,pe=9985,he=9986,be=9987,ge=5126,ve=32819,ye=32820,xe=33635,we=34042,ke={};ke[5120]=ke[5121]=1,ke[5122]=ke[5123]=ke[36193]=ke[xe]=ke[ve]=ke[ye]=2,ke[5124]=ke[5125]=ke[ge]=ke[we]=4;var Ae=se(r,{optional:function(e){e()},raise:t,commandRaise:m,command:function(e,t,r){e||m(t,r||s())},parameter:function(e,r,a){e in r||t("unknown parameter ("+e+")"+n(a)+". possible values: "+Object.keys(r).join())},commandParameter:function(e,t,r,a){e in t||m("unknown parameter ("+e+")"+n(r)+". possible values: "+Object.keys(t).join(),a||s())},constructor:function(e){Object.keys(e).forEach(function(e){ce.indexOf(e)<0&&t('invalid regl constructor argument "'+e+'". must be one of '+ce)})},type:function(e,r,a){typeof e!==r&&t("invalid parameter type"+n(a)+". expected "+r+", got "+typeof e)},commandType:p,isTypedArray:function(e,r){ue(e)||t("invalid parameter type"+n(r)+". must be a typed array")},nni:function(e,r){e>=0&&(0|e)===e||t("invalid parameter type, ("+e+")"+n(r)+". must be a nonnegative integer")},oneOf:a,shaderError:function(e,t,n,a,o){if(!e.getShaderParameter(t,e.COMPILE_STATUS)){var f=e.getShaderInfoLog(t),s=a===e.FRAGMENT_SHADER?"fragment":"vertex";p(n,"string",s+" shader source must be a string",o);var c=l(n,o),d=function(e){var t=[];return e.split("\n").forEach(function(e){if(!(e.length<5)){var r=/^ERROR\:\s+(\d+)\:(\d+)\:\s*(.*)$/.exec(e);r?t.push(new u(0|r[1],0|r[2],r[3].trim())):e.length>0&&t.push(new u("unknown",0,e))}}),t}(f);!function(e,t){t.forEach(function(t){var r=e[t.file];if(r){var n=r.index[t.line];if(n)return n.errors.push(t),void(r.hasErrors=!0)}e.unknown.hasErrors=!0,e.unknown.lines[0].errors.push(t)})}(c,d),Object.keys(c).forEach(function(e){function t(e,t){n.push(e),a.push(t||"")}var r=c[e];if(r.hasErrors){var n=[""],a=[""];t("file number "+e+": "+r.name+"\n","color:red;text-decoration:underline;font-weight:bold"),r.lines.forEach(function(e){if(e.errors.length>0){t(i(e.number,4)+"| ","background-color:yellow; font-weight:bold"),t(e.line+"\n","color:red; background-color:yellow; font-weight:bold");var r=0;e.errors.forEach(function(n){var a=n.message,o=/^\s*\'(.*)\'\s*\:\s*(.*)$/.exec(a);if(o){var f=o[1];switch(a=o[2],f){case"assign":f="="}r=Math.max(e.line.indexOf(f,r),0)}else r=0;t(i("| ",6)),t(i("^^^",r+3)+"\n","font-weight:bold"),t(i("| ",6)),t(a+"\n","font-weight:bold")}),t(i("| ",6)+"\n")}else t(i(e.number,4)+"| "),t(e.line+"\n","color:red")}),"undefined"!=typeof document&&(a[0]=n.join("%c"))}}),r.raise("Error compiling "+s+" shader, "+c[0].name)}},linkError:function(e,t,n,a,i){if(!e.getProgramParameter(t,e.LINK_STATUS)){e.getProgramInfoLog(t);var o=l(n,i),f='Error linking program with vertex shader, "'+l(a,i)[0].name+'", and fragment shader "'+o[0].name+'"';r.raise(f)}},callSite:c,saveCommandRef:d,saveDrawInfo:function(e,t,r,n){function a(e){return e?n.id(e):0}function i(e,t){Object.keys(t).forEach(function(t){e[n.id(t)]=!0})}d(e),e._fragId=a(e.static.frag),e._vertId=a(e.static.vert);var o=e._uniformSet={};i(o,t.static),i(o,t.dynamic);var f=e._attributeSet={};i(f,r.static),i(f,r.dynamic),e._hasCount="count"in e.static||"count"in e.dynamic||"elements"in e.static||"elements"in e.dynamic},framebufferFormat:function(e,t,r){e.texture?a(e.texture._texture.internalformat,t,"unsupported texture format for attachment"):a(e.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")},guessCommand:s,texture2D:function(e,t,n){var a,i=t.width,o=t.height,f=t.channels;r(i>0&&i<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),e.wrapS===le&&e.wrapT===le||r(b(i)&&b(o),"incompatible wrap mode for texture, both width and height must be power of 2"),1===t.mipmask?1!==i&&1!==o&&r(e.minFilter!==me&&e.minFilter!==he&&e.minFilter!==pe&&e.minFilter!==be,"min filter requires mipmap"):(r(b(i)&&b(o),"texture must be a square power of 2 to support mipmapping"),r(t.mipmask===(i<<1)-1,"missing or incomplete mipmap data")),t.type===ge&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(e.minFilter===de&&e.magFilter===de,"filter not supported, must enable oes_texture_float_linear"),r(!e.genMipmaps,"mipmap generation not supported with float textures"));var u=t.images;for(a=0;a<16;++a)if(u[a]){var s=i>>a,c=o>>a;r(t.mipmask&1<<a,"missing mipmap data");var l=u[a];if(r(l.width===s&&l.height===c,"invalid shape for mip images"),r(l.format===t.format&&l.internalformat===t.internalformat&&l.type===t.type,"incompatible type for mip image"),l.compressed);else if(l.data){var d=Math.ceil(h(l.type,f)*s/l.unpackAlignment)*l.unpackAlignment;r(l.data.byteLength===d*c,"invalid data for image, buffer size is inconsistent with image format")}else l.element||l.copy}else e.genMipmaps||r(0==(t.mipmask&1<<a),"extra mipmap data");t.compressed&&r(!e.genMipmaps,"mipmap generation for compressed images not supported")},textureCube:function(e,t,n,a){var i=e.width,o=e.height,f=e.channels;r(i>0&&i<=a.maxTextureSize&&o>0&&o<=a.maxTextureSize,"invalid texture shape"),r(i===o,"cube map must be square"),r(t.wrapS===le&&t.wrapT===le,"wrap mode not supported by cube map");for(var u=0;u<n.length;++u){var s=n[u];r(s.width===i&&s.height===o,"inconsistent cube map face shape"),t.genMipmaps&&(r(!s.compressed,"can not generate mipmap for compressed textures"),r(1===s.mipmask,"can not specify mipmaps and generate mipmaps"));for(var c=s.images,l=0;l<16;++l){var d=c[l];if(d){var m=i>>l,p=o>>l;r(s.mipmask&1<<l,"missing mipmap data"),r(d.width===m&&d.height===p,"invalid shape for mip images"),r(d.format===e.format&&d.internalformat===e.internalformat&&d.type===e.type,"incompatible type for mip image"),d.compressed||(d.data?r(d.data.byteLength===m*p*Math.max(h(d.type,f),d.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):d.element||d.copy)}}}}}),Se=0,_e=0,Ee={DynamicVariable:g,define:function(e,t){return new g(e,x(t+""))},isDynamic:function(e){return"function"==typeof e&&!e._reglType||e instanceof g},unbox:function(e,t){return"function"==typeof e?new g(_e,e):e},accessor:x},Te={next:"function"==typeof requestAnimationFrame?function(e){return requestAnimationFrame(e)}:function(e){return setTimeout(e,16)},cancel:"function"==typeof cancelAnimationFrame?function(e){return cancelAnimationFrame(e)}:clearTimeout},De="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date},je=function(e,t){var r=1;t.ext_texture_filter_anisotropic&&(r=e.getParameter(34047));var n=1,a=1;return t.webgl_draw_buffers&&(n=e.getParameter(34852),a=e.getParameter(36063)),{colorBits:[e.getParameter(3410),e.getParameter(3411),e.getParameter(3412),e.getParameter(3413)],depthBits:e.getParameter(3414),stencilBits:e.getParameter(3415),subpixelBits:e.getParameter(3408),extensions:Object.keys(t).filter(function(e){return!!t[e]}),maxAnisotropic:r,maxDrawbuffers:n,maxColorAttachments:a,pointSizeDims:e.getParameter(33901),lineWidthDims:e.getParameter(33902),maxViewportDims:e.getParameter(3386),maxCombinedTextureUnits:e.getParameter(35661),maxCubeMapSize:e.getParameter(34076),maxRenderbufferSize:e.getParameter(34024),maxTextureUnits:e.getParameter(34930),maxTextureSize:e.getParameter(3379),maxAttributes:e.getParameter(34921),maxVertexUniforms:e.getParameter(36347),maxVertexTextureUnits:e.getParameter(35660),maxVaryingVectors:e.getParameter(36348),maxFragmentUniforms:e.getParameter(36349),glsl:e.getParameter(35724),renderer:e.getParameter(7937),vendor:e.getParameter(7936),version:e.getParameter(7938)}},Oe=function(e){return Object.keys(e).map(function(t){return e[t]})},Ce=5120,Fe=5121,ze=5122,Be=5123,Pe=5124,Re=5125,Le=5126,Ie=_(8,function(){return[]}),Me={alloc:T,free:D,allocType:function(e,t){var r=null;switch(e){case Ce:r=new Int8Array(T(t),0,t);break;case Fe:r=new Uint8Array(T(t),0,t);break;case ze:r=new Int16Array(T(2*t),0,t);break;case Be:r=new Uint16Array(T(2*t),0,t);break;case Pe:r=new Int32Array(T(4*t),0,t);break;case Re:r=new Uint32Array(T(4*t),0,t);break;case Le:r=new Float32Array(T(4*t),0,t);break;default:return null}return r.length!==t?r.subarray(0,t):r},freeType:function(e){D(e.buffer)}},We={shape:function(e){for(var t=[],r=e;r.length;r=r[0])t.push(r.length);return t},flatten:function(e,t,r,n){var a=1;if(t.length)for(var i=0;i<t.length;++i)a*=t[i];else a=0;var o=n||Me.allocType(r,a);switch(t.length){case 0:break;case 1:!function(e,t,r){for(var n=0;n<t;++n)r[n]=e[n]}(e,t[0],o);break;case 2:!function(e,t,r,n){for(var a=0,i=0;i<t;++i)for(var o=e[i],f=0;f<r;++f)n[a++]=o[f]}(e,t[0],t[1],o);break;case 3:j(e,t[0],t[1],t[2],o,0);break;default:O(e,t,0,o,0)}return o}},He={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},Ge={dynamic:35048,stream:35040,static:35044},Ue=We.flatten,Ne=We.shape,qe=35044,Qe=35040,Ve=5121,Ye=5126,Xe=[];Xe[5120]=1,Xe[5122]=2,Xe[5124]=4,Xe[5121]=1,Xe[5123]=2,Xe[5125]=4,Xe[5126]=4;var $e={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},Ke=0,Je=1,Ze=4,et=5120,tt=5121,rt=5122,nt=5123,at=5124,it=5125,ot=34963,ft=35040,ut=35044,st=new Float32Array(1),ct=new Uint32Array(st.buffer),lt=5123,dt=34467,mt=3553,pt=34067,ht=34069,bt=6408,gt=6406,vt=6407,yt=6409,xt=6410,wt=32854,kt=32855,At=36194,St=32819,_t=32820,Et=33635,Tt=34042,Dt=6402,jt=34041,Ot=35904,Ct=35906,Ft=36193,zt=33776,Bt=33777,Pt=33778,Rt=33779,Lt=35986,It=35987,Mt=34798,Wt=35840,Ht=35841,Gt=35842,Ut=35843,Nt=36196,qt=5121,Qt=5123,Vt=5125,Yt=5126,Xt=10242,$t=10243,Kt=10497,Jt=33071,Zt=33648,er=10240,tr=10241,rr=9728,nr=9729,ar=9984,ir=9985,or=9986,fr=9987,ur=33170,sr=4352,cr=4353,lr=4354,dr=34046,mr=3317,pr=37440,hr=37441,br=37443,gr=37444,vr=33984,yr=[ar,or,ir,fr],xr=[0,yt,xt,vt,bt],wr={};wr[yt]=wr[gt]=wr[Dt]=1,wr[jt]=wr[xt]=2,wr[vt]=wr[Ot]=3,wr[bt]=wr[Ct]=4;var kr=R("HTMLCanvasElement"),Ar=R("CanvasRenderingContext2D"),Sr=R("HTMLImageElement"),_r=R("HTMLVideoElement"),Er=Object.keys(fe).concat([kr,Ar,Sr,_r]),Tr=[];Tr[qt]=1,Tr[Yt]=4,Tr[Ft]=2,Tr[Qt]=2,Tr[Vt]=4;var Dr=[];Dr[wt]=2,Dr[kt]=2,Dr[At]=2,Dr[jt]=4,Dr[zt]=.5,Dr[Bt]=.5,Dr[Pt]=1,Dr[Rt]=1,Dr[Lt]=.5,Dr[It]=1,Dr[Mt]=1,Dr[Wt]=.5,Dr[Ht]=.25,Dr[Gt]=.5,Dr[Ut]=.25,Dr[Nt]=.5;var jr=36161,Or=32854,Cr=[];Cr[Or]=2,Cr[32855]=2,Cr[36194]=2,Cr[33189]=2,Cr[36168]=1,Cr[34041]=4,Cr[35907]=4,Cr[34836]=16,Cr[34842]=8,Cr[34843]=6;var Fr=function(e,t,r,n,a){function i(e){this.id=s++,this.refCount=1,this.renderbuffer=e,this.format=Or,this.width=0,this.height=0,a.profile&&(this.stats={size:0})}function o(t){var r=t.renderbuffer;Ae(r,"must not double destroy renderbuffer"),e.bindRenderbuffer(jr,null),e.deleteRenderbuffer(r),t.renderbuffer=null,t.refCount=0,delete c[t.id],n.renderbufferCount--}var f={rgba4:Or,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};t.ext_srgb&&(f.srgba=35907),t.ext_color_buffer_half_float&&(f.rgba16f=34842,f.rgb16f=34843),t.webgl_color_buffer_float&&(f.rgba32f=34836);var u=[];Object.keys(f).forEach(function(e){var t=f[e];u[t]=e});var s=0,c={};return i.prototype.decRef=function(){--this.refCount<=0&&o(this)},a.profile&&(n.getTotalRenderbufferSize=function(){var e=0;return Object.keys(c).forEach(function(t){e+=c[t].stats.size}),e}),{create:function(t,o){function s(t,n){var i=0,o=0,c=Or;if("object"==typeof t&&t){var d=t;if("shape"in d){var m=d.shape;Ae(Array.isArray(m)&&m.length>=2,"invalid renderbuffer shape"),i=0|m[0],o=0|m[1]}else"radius"in d&&(i=o=0|d.radius),"width"in d&&(i=0|d.width),"height"in d&&(o=0|d.height);"format"in d&&(Ae.parameter(d.format,f,"invalid renderbuffer format"),c=f[d.format])}else"number"==typeof t?(i=0|t,o="number"==typeof n?0|n:i):t?Ae.raise("invalid arguments to renderbuffer constructor"):i=o=1;if(Ae(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),i!==l.width||o!==l.height||c!==l.format)return s.width=l.width=i,s.height=l.height=o,l.format=c,e.bindRenderbuffer(jr,l.renderbuffer),e.renderbufferStorage(jr,c,i,o),a.profile&&(l.stats.size=V(l.format,l.width,l.height)),s.format=u[l.format],s}var l=new i(e.createRenderbuffer());return c[l.id]=l,n.renderbufferCount++,s(t,o),s.resize=function(t,n){var i=0|t,o=0|n||i;return i===l.width&&o===l.height?s:(Ae(i>0&&o>0&&i<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),s.width=l.width=i,s.height=l.height=o,e.bindRenderbuffer(jr,l.renderbuffer),e.renderbufferStorage(jr,l.format,i,o),a.profile&&(l.stats.size=V(l.format,l.width,l.height)),s)},s._reglType="renderbuffer",s._renderbuffer=l,a.profile&&(s.stats=l.stats),s.destroy=function(){l.decRef()},s},clear:function(){Oe(c).forEach(o)},restore:function(){Oe(c).forEach(function(t){t.renderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(jr,t.renderbuffer),e.renderbufferStorage(jr,t.format,t.width,t.height)}),e.bindRenderbuffer(jr,null)}}},zr=36160,Br=36161,Pr=3553,Rr=34069,Lr=36064,Ir=36096,Mr=36128,Wr=33306,Hr=36053,Gr=6402,Ur=[6408],Nr=[];Nr[6408]=4;var qr=[];qr[5121]=1,qr[5126]=4,qr[36193]=2;var Qr=33189,Vr=36168,Yr=34041,Xr=[32854,32855,36194,35907,34842,34843,34836],$r={};$r[Hr]="complete",$r[36054]="incomplete attachment",$r[36057]="incomplete dimensions",$r[36055]="incomplete, missing attachment",$r[36061]="unsupported";var Kr=5126,Jr=35632,Zr=35633,en=35718,tn=35721,rn=6408,nn=5121,an=3333,on=5126,fn="xyzw".split(""),un=5121,sn=1,cn=2,ln=0,dn=1,mn=2,pn=3,hn=4,bn="dither",gn="blend.enable",vn="blend.color",yn="blend.equation",xn="blend.func",wn="depth.enable",kn="depth.func",An="depth.range",Sn="depth.mask",_n="colorMask",En="cull.enable",Tn="cull.face",Dn="frontFace",jn="lineWidth",On="polygonOffset.enable",Cn="polygonOffset.offset",Fn="sample.alpha",zn="sample.enable",Bn="sample.coverage",Pn="stencil.enable",Rn="stencil.mask",Ln="stencil.func",In="stencil.opFront",Mn="stencil.opBack",Wn="scissor.enable",Hn="scissor.box",Gn="viewport",Un="profile",Nn="framebuffer",qn="vert",Qn="frag",Vn="elements",Yn="primitive",Xn="count",$n="offset",Kn="instances",Jn=Nn+"Width",Zn=Nn+"Height",ea=Gn+"Width",ta=Gn+"Height",ra="drawingBufferWidth",na="drawingBufferHeight",aa=[xn,yn,Ln,In,Mn,Bn,Gn,Hn,Cn],ia=34962,oa=34963,fa=3553,ua=34067,sa=2884,ca=3042,la=3024,da=2960,ma=2929,pa=3089,ha=32823,ba=32926,ga=32928,va=5126,ya=35664,xa=35665,wa=35666,ka=5124,Aa=35667,Sa=35668,_a=35669,Ea=35670,Ta=35671,Da=35672,ja=35673,Oa=35674,Ca=35675,Fa=35676,za=35678,Ba=35680,Pa=4,Ra=1028,La=1029,Ia=2304,Ma=2305,Wa=32775,Ha=32776,Ga=519,Ua=7680,Na=0,qa=1,Qa=32774,Va=513,Ya=36160,Xa=36064,$a={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Ka=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Ja={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Za={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},ei={frag:35632,vert:35633},ti={cw:Ia,ccw:Ma},ri=new te(!1,!1,!1,function(){}),ni=34918,ai=34919,ii=35007,oi=function(e,t){function r(e){o.push(e)}function n(e){u.push(e)}function a(e,t,r){var n=u.pop()||new function(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null};n.startQueryIndex=e,n.endQueryIndex=t,n.sum=0,n.stats=r,s.push(n)}var i=t.ext_disjoint_timer_query;if(!i)return null;var o=[],f=[],u=[],s=[],c=[],l=[];return{beginQuery:function(e){var t=o.pop()||i.createQueryEXT();i.beginQueryEXT(ii,t),f.push(t),a(f.length-1,f.length,e)},endQuery:function(){i.endQueryEXT(ii)},pushScopeStats:a,update:function(){var e,t,a=f.length;if(0!==a){l.length=Math.max(l.length,a+1),c.length=Math.max(c.length,a+1),c[0]=0,l[0]=0;var o=0;for(e=0,t=0;t<f.length;++t){var u=f[t];i.getQueryObjectEXT(u,ai)?(o+=i.getQueryObjectEXT(u,ni),r(u)):f[e++]=u,c[t+1]=o,l[t+1]=e}for(f.length=e,e=0,t=0;t<s.length;++t){var d=s[t],m=d.startQueryIndex,p=d.endQueryIndex;d.sum+=c[p]-c[m];var h=l[m],b=l[p];b===h?(d.stats.gpuTime+=d.sum/1e6,n(d)):(d.startQueryIndex=h,d.endQueryIndex=b,s[e++]=d)}s.length=e}},getNumPendingQueries:function(){return f.length},clear:function(){o.push.apply(o,f);for(var e=0;e<o.length;e++)i.deleteQueryEXT(o[e]);f.length=0,o.length=0},restore:function(){f.length=0,o.length=0}}},fi=16384,ui=256,si=1024,ci=34962,li="webglcontextlost",di="webglcontextrestored",mi=1,pi=2,hi=3;return function(e){function t(){if(0===U.length)return w&&w.update(),void(K=null);K=Te.next(t),c();for(var e=U.length-1;e>=0;--e){var r=U[e];r&&r(T,null,0)}p.flush(),w&&w.update()}function r(){!K&&U.length>0&&(K=Te.next(t))}function n(){K&&(Te.cancel(t),K=null)}function a(e){e.preventDefault(),b=!0,n(),N.forEach(function(e){e()})}function i(e){p.getError(),b=!1,g.restore(),P.restore(),j.restore(),R.restore(),L.restore(),I.restore(),w&&w.restore(),M.procs.refresh(),r(),q.forEach(function(e){e()})}function o(e){function t(e){var t={},r={};return Object.keys(e).forEach(function(n){var a=e[n];Ee.isDynamic(a)?r[n]=Ee.unbox(a,n):t[n]=a}),{dynamic:r,static:t}}Ae(!!e,"invalid args to regl({...})"),Ae.type(e,"object","invalid args to regl({...})");var r=t(e.context||{}),n=t(e.uniforms||{}),a=t(e.attributes||{}),i=t(function(e){function t(e){if(e in r){var t=r[e];delete r[e],Object.keys(t).forEach(function(n){r[e+"."+n]=t[n]})}}var r=se({},e);return delete r.uniforms,delete r.attributes,delete r.context,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),t("blend"),t("depth"),t("cull"),t("stencil"),t("polygonOffset"),t("scissor"),t("sample"),r}(e)),o={gpuTime:0,cpuTime:0,count:0},f=M.compile(i,a,n,r,o),u=f.draw,s=f.batch,c=f.scope,l=[];return se(function(e,t){var r;if(b&&Ae.raise("context lost"),"function"==typeof e)return c.call(this,null,e,0);if("function"==typeof t){if("number"==typeof e){for(r=0;r<e;++r)c.call(this,null,t,r);return}if(Array.isArray(e)){for(r=0;r<e.length;++r)c.call(this,e[r],t,r);return}return c.call(this,e,t,0)}if("number"==typeof e){if(e>0)return s.call(this,function(e){for(;l.length<e;)l.push(null);return l}(0|e),0|e)}else{if(!Array.isArray(e))return u.call(this,e);if(e.length)return s.call(this,e,e.length)}},{stats:o})}function f(e,t){var r=0;M.procs.poll();var n=t.color;n&&(p.clearColor(+n[0]||0,+n[1]||0,+n[2]||0,+n[3]||0),r|=fi),"depth"in t&&(p.clearDepth(+t.depth),r|=ui),"stencil"in t&&(p.clearStencil(0|t.stencil),r|=si),Ae(!!r,"called regl.clear with no buffer specified"),p.clear(r)}function u(e){return Ae.type(e,"function","regl.frame() callback must be a function"),U.push(e),r(),{cancel:function(){function t(){var e=oe(U,t);U[e]=U[U.length-1],U.length-=1,U.length<=0&&n()}var r=oe(U,e);Ae(r>=0,"cannot cancel a frame twice"),U[r]=t}}}function s(){var e=H.viewport,t=H.scissor_box;e[0]=e[1]=t[0]=t[1]=0,T.viewportWidth=T.framebufferWidth=T.drawingBufferWidth=e[2]=t[2]=p.drawingBufferWidth,T.viewportHeight=T.framebufferHeight=T.drawingBufferHeight=e[3]=t[3]=p.drawingBufferHeight}function c(){T.tick+=1,T.time=d(),s(),M.procs.poll()}function l(){s(),M.procs.refresh(),w&&w.update()}function d(){return(De()-k)/1e3}var m=A(e);if(!m)return null;var p=m.gl,h=p.getContextAttributes(),b=p.isContextLost(),g=function(e,t){function r(t){Ae.type(t,"string","extension name must be string");var r,a=t.toLowerCase();try{r=n[a]=e.getExtension(a)}catch(e){}return!!r}for(var n={},a=0;a<t.extensions.length;++a){var i=t.extensions[a];if(!r(i))return t.onDestroy(),t.onDone('"'+i+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return t.optionalExtensions.forEach(r),{extensions:n,restore:function(){Object.keys(n).forEach(function(e){if(!r(e))throw new Error("(regl): error restoring extension "+e)})}}}(p,m);if(!g)return null;var v=function(){var e={"":0},t=[""];return{id:function(r){var n=e[r];return n||(n=e[r]=t.length,t.push(r),n)},str:function(e){return t[e]}}}(),y={bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},x=g.extensions,w=oi(p,x),k=De(),_=p.drawingBufferWidth,E=p.drawingBufferHeight,T={tick:0,time:0,viewportWidth:_,viewportHeight:E,framebufferWidth:_,framebufferHeight:E,drawingBufferWidth:_,drawingBufferHeight:E,pixelRatio:m.pixelRatio},D=je(p,x),j=function(e,t,r){function n(t){this.id=f++,this.buffer=e.createBuffer(),this.type=t,this.usage=qe,this.byteLength=0,this.dimension=1,this.dtype=Ve,this.persistentData=null,r.profile&&(this.stats={size:0})}function a(t,r,n){t.byteLength=r.byteLength,e.bufferData(t.type,r,n)}function i(e,t,r,n,i,o){var f;if(e.usage=r,Array.isArray(t)){if(e.dtype=n||Ye,t.length>0){var u;if(Array.isArray(t[0])){f=Ne(t);for(var s=1,c=1;c<f.length;++c)s*=f[c];e.dimension=s,a(e,u=Ue(t,f,e.dtype),r),o?e.persistentData=u:Me.freeType(u)}else if("number"==typeof t[0]){e.dimension=i;var l=Me.allocType(e.dtype,t.length);F(l,t),a(e,l,r),o?e.persistentData=l:Me.freeType(l)}else ue(t[0])?(e.dimension=t[0].length,e.dtype=n||C(t[0])||Ye,a(e,u=Ue(t,[t.length,t[0].length],e.dtype),r),o?e.persistentData=u:Me.freeType(u)):Ae.raise("invalid buffer data")}}else if(ue(t))e.dtype=n||C(t),e.dimension=i,a(e,t,r),o&&(e.persistentData=new Uint8Array(new Uint8Array(t.buffer)));else if(S(t)){f=t.shape;var d=t.stride,m=t.offset,p=0,h=0,b=0,g=0;1===f.length?(p=f[0],h=1,b=d[0],g=0):2===f.length?(p=f[0],h=f[1],b=d[0],g=d[1]):Ae.raise("invalid shape"),e.dtype=n||C(t.data)||Ye,e.dimension=h;var v=Me.allocType(e.dtype,p*h);z(v,t.data,p,h,b,g,m),a(e,v,r),o?e.persistentData=v:Me.freeType(v)}else Ae.raise("invalid buffer data")}function o(r){t.bufferCount--;var n=r.buffer;Ae(n,"buffer must not be deleted already"),e.deleteBuffer(n),r.buffer=null,delete u[r.id]}var f=0,u={};n.prototype.bind=function(){e.bindBuffer(this.type,this.buffer)},n.prototype.destroy=function(){o(this)};var s=[];return r.profile&&(t.getTotalBufferSize=function(){var e=0;return Object.keys(u).forEach(function(t){e+=u[t].stats.size}),e}),{create:function(a,f,s,c){function l(t){var n=qe,a=null,o=0,f=0,u=1;return Array.isArray(t)||ue(t)||S(t)?a=t:"number"==typeof t?o=0|t:t&&(Ae.type(t,"object","buffer arguments must be an object, a number or an array"),"data"in t&&(Ae(null===a||Array.isArray(a)||ue(a)||S(a),"invalid data for buffer"),a=t.data),"usage"in t&&(Ae.parameter(t.usage,Ge,"invalid buffer usage"),n=Ge[t.usage]),"type"in t&&(Ae.parameter(t.type,He,"invalid buffer type"),f=He[t.type]),"dimension"in t&&(Ae.type(t.dimension,"number","invalid dimension"),u=0|t.dimension),"length"in t&&(Ae.nni(o,"buffer length must be a nonnegative integer"),o=0|t.length)),m.bind(),a?i(m,a,n,f,u,c):(e.bufferData(m.type,o,n),m.dtype=f||Ve,m.usage=n,m.dimension=u,m.byteLength=o),r.profile&&(m.stats.size=m.byteLength*Xe[m.dtype]),l}function d(t,r){Ae(r+t.byteLength<=m.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+t.byteLength+" starting from offset "+r+" to a buffer of size "+m.byteLength),e.bufferSubData(m.type,r,t)}t.bufferCount++;var m=new n(f);return u[m.id]=m,s||l(a),l._reglType="buffer",l._buffer=m,l.subdata=function(e,t){var r,n=0|(t||0);if(m.bind(),Array.isArray(e)){if(e.length>0)if("number"==typeof e[0]){var a=Me.allocType(m.dtype,e.length);F(a,e),d(a,n),Me.freeType(a)}else if(Array.isArray(e[0])||ue(e[0])){r=Ne(e);var i=Ue(e,r,m.dtype);d(i,n),Me.freeType(i)}else Ae.raise("invalid buffer data")}else if(ue(e))d(e,n);else if(S(e)){r=e.shape;var o=e.stride,f=0,u=0,s=0,c=0;1===r.length?(f=r[0],u=1,s=o[0],c=0):2===r.length?(f=r[0],u=r[1],s=o[0],c=o[1]):Ae.raise("invalid shape");var p=Array.isArray(e.data)?m.dtype:C(e.data),h=Me.allocType(p,f*u);z(h,e.data,f,u,s,c,e.offset),d(h,n),Me.freeType(h)}else Ae.raise("invalid data for buffer subdata");return l},r.profile&&(l.stats=m.stats),l.destroy=function(){o(m)},l},createStream:function(e,t){var r=s.pop();return r||(r=new n(e)),r.bind(),i(r,t,Qe,0,1,!1),r},destroyStream:function(e){s.push(e)},clear:function(){Oe(u).forEach(o),s.forEach(o)},getBuffer:function(e){return e&&e._buffer instanceof n?e._buffer:null},restore:function(){Oe(u).forEach(function(t){t.buffer=e.createBuffer(),e.bindBuffer(t.type,t.buffer),e.bufferData(t.type,t.persistentData||t.byteLength,t.usage)})},_initBuffer:i}}(p,y,m),O=function(e,t,r,n){function a(e){this.id=u++,f[this.id]=this,this.buffer=e,this.primType=Ze,this.vertCount=0,this.type=0}function i(n,a,i,o,f,u,s){if(n.buffer.bind(),a){var c=s;s||ue(a)&&(!S(a)||ue(a.data))||(c=t.oes_element_index_uint?it:nt),r._initBuffer(n.buffer,a,i,c,3)}else e.bufferData(ot,u,i),n.buffer.dtype=l||tt,n.buffer.usage=i,n.buffer.dimension=3,n.buffer.byteLength=u;var l=s;if(!s){switch(n.buffer.dtype){case tt:case et:l=tt;break;case nt:case rt:l=nt;break;case it:case at:l=it;break;default:Ae.raise("unsupported type for element array")}n.buffer.dtype=l}n.type=l,Ae(l!==it||!!t.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var d=f;d<0&&(d=n.buffer.byteLength,l===nt?d>>=1:l===it&&(d>>=2)),n.vertCount=d;var m=o;if(o<0){m=Ze;var p=n.buffer.dimension;1===p&&(m=Ke),2===p&&(m=Je),3===p&&(m=Ze)}n.primType=m}function o(e){n.elementsCount--,Ae(null!==e.buffer,"must not double destroy elements"),delete f[e.id],e.buffer.destroy(),e.buffer=null}var f={},u=0,s={uint8:tt,uint16:nt};t.oes_element_index_uint&&(s.uint32=it),a.prototype.bind=function(){this.buffer.bind()};var c=[];return{create:function(e,t){function f(e){if(e)if("number"==typeof e)u(e),c.primType=Ze,c.vertCount=0|e,c.type=tt;else{var t=null,r=ut,n=-1,a=-1,o=0,l=0;Array.isArray(e)||ue(e)||S(e)?t=e:(Ae.type(e,"object","invalid arguments for elements"),"data"in e&&(t=e.data,Ae(Array.isArray(t)||ue(t)||S(t),"invalid data for element buffer")),"usage"in e&&(Ae.parameter(e.usage,Ge,"invalid element buffer usage"),r=Ge[e.usage]),"primitive"in e&&(Ae.parameter(e.primitive,$e,"invalid element buffer primitive"),n=$e[e.primitive]),"count"in e&&(Ae("number"==typeof e.count&&e.count>=0,"invalid vertex count for elements"),a=0|e.count),"type"in e&&(Ae.parameter(e.type,s,"invalid buffer type"),l=s[e.type]),"length"in e?o=0|e.length:(o=a,l===nt||l===rt?o*=2:l!==it&&l!==at||(o*=4))),i(c,t,r,n,a,o,l)}else u(),c.primType=Ze,c.vertCount=0,c.type=tt;return f}var u=r.create(null,ot,!0),c=new a(u._buffer);return n.elementsCount++,f(e),f._reglType="elements",f._elements=c,f.subdata=function(e,t){return u.subdata(e,t),f},f.destroy=function(){o(c)},f},createStream:function(e){var t=c.pop();return t||(t=new a(r.create(null,ot,!0,!1)._buffer)),i(t,e,ft,-1,-1,0,0),t},destroyStream:function(e){c.push(e)},getElements:function(e){return"function"==typeof e&&e._elements instanceof a?e._elements:null},clear:function(){Oe(f).forEach(o)}}}(p,x,j,y),B=function(e,t,r,n,a){for(var i=r.maxAttributes,o=new Array(i),f=0;f<i;++f)o[f]=new Y;return{Record:Y,scope:{},state:o}}(0,0,D),P=X(p,v,y,m),R=Q(p,x,D,function(){M.procs.poll()},T,y,m),L=Fr(p,x,D,y,m),I=function(e,t,r,n,a,i){function o(e,t,r){this.target=e,this.texture=t,this.renderbuffer=r;var n=0,a=0;t?(n=t.width,a=t.height):r&&(n=r.width,a=r.height),this.width=n,this.height=a}function f(e){e&&(e.texture&&e.texture._texture.decRef(),e.renderbuffer&&e.renderbuffer._renderbuffer.decRef())}function u(e,t,r){if(e)if(e.texture){var n=e.texture._texture,a=Math.max(1,n.width),i=Math.max(1,n.height);Ae(a===t&&i===r,"inconsistent width/height for supplied texture"),n.refCount+=1}else{var o=e.renderbuffer._renderbuffer;Ae(o.width===t&&o.height===r,"inconsistent width/height for renderbuffer"),o.refCount+=1}}function s(t,r){r&&(r.texture?e.framebufferTexture2D(zr,t,r.target,r.texture._texture.texture,0):e.framebufferRenderbuffer(zr,t,Br,r.renderbuffer._renderbuffer.renderbuffer))}function c(e){var t=Pr,r=null,n=null,a=e;"object"==typeof e&&(a=e.data,"target"in e&&(t=0|e.target)),Ae.type(a,"function","invalid attachment data");var i=a._reglType;return"texture2d"===i?(r=a,Ae(t===Pr)):"textureCube"===i?(r=a,Ae(t>=Rr&&t<Rr+6,"invalid cube map target")):"renderbuffer"===i?(n=a,t=Br):Ae.raise("invalid regl object for attachment"),new o(t,r,n)}function l(e,t,r,i,f){if(r){var u=n.create2D({width:e,height:t,format:i,type:f});return u._texture.refCount=0,new o(Pr,u,null)}var s=a.create({width:e,height:t,format:i});return s._renderbuffer.refCount=0,new o(Br,null,s)}function d(e){return e&&(e.texture||e.renderbuffer)}function m(e,t,r){e&&(e.texture?e.texture.resize(t,r):e.renderbuffer&&e.renderbuffer.resize(t,r))}function p(){this.id=A++,S[this.id]=this,this.framebuffer=e.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function h(e){e.colorAttachments.forEach(f),f(e.depthAttachment),f(e.stencilAttachment),f(e.depthStencilAttachment)}function b(t){var r=t.framebuffer;Ae(r,"must not double destroy framebuffer"),e.deleteFramebuffer(r),t.framebuffer=null,i.framebufferCount--,delete S[t.id]}function g(t){var n;e.bindFramebuffer(zr,t.framebuffer);var a=t.colorAttachments;for(n=0;n<a.length;++n)s(Lr+n,a[n]);for(n=a.length;n<r.maxColorAttachments;++n)e.framebufferTexture2D(zr,Lr+n,Pr,null,0);e.framebufferTexture2D(zr,Wr,Pr,null,0),e.framebufferTexture2D(zr,Ir,Pr,null,0),e.framebufferTexture2D(zr,Mr,Pr,null,0),s(Ir,t.depthAttachment),s(Mr,t.stencilAttachment),s(Wr,t.depthStencilAttachment);var i=e.checkFramebufferStatus(zr);i!==Hr&&Ae.raise("framebuffer configuration not supported, status = "+$r[i]),e.bindFramebuffer(zr,y.next),y.cur=y.next,e.getError()}function v(e,n){function a(e,n){var i;Ae(y.next!==o,"can not update framebuffer which is currently in use");var f=t.webgl_draw_buffers,s=0,m=0,p=!0,b=!0,v=null,A=!0,S="rgba",_="uint8",E=1,T=null,D=null,j=null,O=!1;if("number"==typeof e)s=0|e,m=0|n||s;else if(e){Ae.type(e,"object","invalid arguments for framebuffer");var C=e;if("shape"in C){var F=C.shape;Ae(Array.isArray(F)&&F.length>=2,"invalid shape for framebuffer"),s=F[0],m=F[1]}else"radius"in C&&(s=m=C.radius),"width"in C&&(s=C.width),"height"in C&&(m=C.height);("color"in C||"colors"in C)&&(v=C.color||C.colors,Array.isArray(v)&&Ae(1===v.length||f,"multiple render targets not supported")),v||("colorCount"in C&&(E=0|C.colorCount,Ae(E>0,"invalid color buffer count")),"colorTexture"in C&&(A=!!C.colorTexture,S="rgba4"),"colorType"in C&&(_=C.colorType,A?(Ae(t.oes_texture_float||!("float"===_||"float32"===_),"you must enable OES_texture_float in order to use floating point framebuffer objects"),Ae(t.oes_texture_half_float||!("half float"===_||"float16"===_),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===_||"float16"===_?(Ae(t.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),S="rgba16f"):"float"!==_&&"float32"!==_||(Ae(t.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),S="rgba32f"),Ae.oneOf(_,k,"invalid color type")),"colorFormat"in C&&(S=C.colorFormat,x.indexOf(S)>=0?A=!0:w.indexOf(S)>=0?A=!1:A?Ae.oneOf(C.colorFormat,x,"invalid color format for texture"):Ae.oneOf(C.colorFormat,w,"invalid color format for renderbuffer"))),("depthTexture"in C||"depthStencilTexture"in C)&&(O=!(!C.depthTexture&&!C.depthStencilTexture),Ae(!O||t.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in C&&("boolean"==typeof C.depth?p=C.depth:(T=C.depth,b=!1)),"stencil"in C&&("boolean"==typeof C.stencil?b=C.stencil:(D=C.stencil,p=!1)),"depthStencil"in C&&("boolean"==typeof C.depthStencil?p=b=C.depthStencil:(j=C.depthStencil,p=!1,b=!1))}else s=m=1;var z=null,B=null,P=null,R=null;if(Array.isArray(v))z=v.map(c);else if(v)z=[c(v)];else for(z=new Array(E),i=0;i<E;++i)z[i]=l(s,m,A,S,_);Ae(t.webgl_draw_buffers||z.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),Ae(z.length<=r.maxColorAttachments,"too many color attachments, not supported"),s=s||z[0].width,m=m||z[0].height,T?B=c(T):p&&!b&&(B=l(s,m,O,"depth","uint32")),D?P=c(D):b&&!p&&(P=l(s,m,!1,"stencil","uint8")),j?R=c(j):!T&&!D&&b&&p&&(R=l(s,m,O,"depth stencil","depth stencil")),Ae(!!T+!!D+!!j<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var L=null;for(i=0;i<z.length;++i)if(u(z[i],s,m),Ae(!z[i]||z[i].texture&&Ur.indexOf(z[i].texture._texture.format)>=0||z[i].renderbuffer&&Xr.indexOf(z[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid"),z[i]&&z[i].texture){var I=Nr[z[i].texture._texture.format]*qr[z[i].texture._texture.type];null===L?L=I:Ae(L===I,"all color attachments much have the same number of bits per pixel.")}return u(B,s,m),Ae(!B||B.texture&&B.texture._texture.format===Gr||B.renderbuffer&&B.renderbuffer._renderbuffer.format===Qr,"invalid depth attachment for framebuffer object"),u(P,s,m),Ae(!P||P.renderbuffer&&P.renderbuffer._renderbuffer.format===Vr,"invalid stencil attachment for framebuffer object"),u(R,s,m),Ae(!R||R.texture&&R.texture._texture.format===Yr||R.renderbuffer&&R.renderbuffer._renderbuffer.format===Yr,"invalid depth-stencil attachment for framebuffer object"),h(o),o.width=s,o.height=m,o.colorAttachments=z,o.depthAttachment=B,o.stencilAttachment=P,o.depthStencilAttachment=R,a.color=z.map(d),a.depth=d(B),a.stencil=d(P),a.depthStencil=d(R),a.width=o.width,a.height=o.height,g(o),a}var o=new p;return i.framebufferCount++,a(e,n),se(a,{resize:function(e,t){Ae(y.next!==o,"can not resize a framebuffer which is currently in use");var r=0|e,n=0|t||r;if(r===o.width&&n===o.height)return a;for(var i=o.colorAttachments,f=0;f<i.length;++f)m(i[f],r,n);return m(o.depthAttachment,r,n),m(o.stencilAttachment,r,n),m(o.depthStencilAttachment,r,n),o.width=a.width=r,o.height=a.height=n,g(o),a},_reglType:"framebuffer",_framebuffer:o,destroy:function(){b(o),h(o)},use:function(e){y.setFBO({framebuffer:a},e)}})}var y={cur:null,next:null,dirty:!1,setFBO:null},x=["rgba"],w=["rgba4","rgb565","rgb5 a1"];t.ext_srgb&&w.push("srgba"),t.ext_color_buffer_half_float&&w.push("rgba16f","rgb16f"),t.webgl_color_buffer_float&&w.push("rgba32f");var k=["uint8"];t.oes_texture_half_float&&k.push("half float","float16"),t.oes_texture_float&&k.push("float","float32");var A=0,S={};return se(y,{getFramebuffer:function(e){if("function"==typeof e&&"framebuffer"===e._reglType){var t=e._framebuffer;if(t instanceof p)return t}return null},create:v,createCube:function(e){function a(e){var r;Ae(i.indexOf(y.next)<0,"can not update framebuffer which is currently in use");var o=t.webgl_draw_buffers,f={color:null},u=0,s=null,c="rgba",l="uint8",d=1;if("number"==typeof e)u=0|e;else if(e){Ae.type(e,"object","invalid arguments for framebuffer");var m=e;if("shape"in m){var p=m.shape;Ae(Array.isArray(p)&&p.length>=2,"invalid shape for framebuffer"),Ae(p[0]===p[1],"cube framebuffer must be square"),u=p[0]}else"radius"in m&&(u=0|m.radius),"width"in m?(u=0|m.width,"height"in m&&Ae(m.height===u,"must be square")):"height"in m&&(u=0|m.height);("color"in m||"colors"in m)&&(s=m.color||m.colors,Array.isArray(s)&&Ae(1===s.length||o,"multiple render targets not supported")),s||("colorCount"in m&&(d=0|m.colorCount,Ae(d>0,"invalid color buffer count")),"colorType"in m&&(Ae.oneOf(m.colorType,k,"invalid color type"),l=m.colorType),"colorFormat"in m&&(c=m.colorFormat,Ae.oneOf(m.colorFormat,x,"invalid color format for texture"))),"depth"in m&&(f.depth=m.depth),"stencil"in m&&(f.stencil=m.stencil),"depthStencil"in m&&(f.depthStencil=m.depthStencil)}else u=1;var h;if(s)if(Array.isArray(s))for(h=[],r=0;r<s.length;++r)h[r]=s[r];else h=[s];else{h=Array(d);var b={radius:u,format:c,type:l};for(r=0;r<d;++r)h[r]=n.createCube(b)}for(f.color=Array(h.length),r=0;r<h.length;++r){var g=h[r];Ae("function"==typeof g&&"textureCube"===g._reglType,"invalid cube map"),u=u||g.width,Ae(g.width===u&&g.height===u,"invalid cube map shape"),f.color[r]={target:Rr,data:h[r]}}for(r=0;r<6;++r){for(var w=0;w<h.length;++w)f.color[w].target=Rr+r;r>0&&(f.depth=i[0].depth,f.stencil=i[0].stencil,f.depthStencil=i[0].depthStencil),i[r]?i[r](f):i[r]=v(f)}return se(a,{width:u,height:u,color:h})}var i=Array(6);return a(e),se(a,{faces:i,resize:function(e){var t,n=0|e;if(Ae(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===a.width)return a;var o=a.color;for(t=0;t<o.length;++t)o[t].resize(n);for(t=0;t<6;++t)i[t].resize(n);return a.width=a.height=n,a},_reglType:"framebufferCube",destroy:function(){i.forEach(function(e){e.destroy()})}})},clear:function(){Oe(S).forEach(b)},restore:function(){Oe(S).forEach(function(t){t.framebuffer=e.createFramebuffer(),g(t)})}})}(p,x,D,R,L,y),M=ie(p,v,x,D,j,O,0,I,{},B,P,{elements:null,primitive:4,count:-1,offset:0,instances:-1},T,w,m),W=$(p,I,M.procs.poll,T,h,x),H=M.next,G=p.canvas,U=[],N=[],q=[],V=[m.onDestroy],K=null;G&&(G.addEventListener(li,a,!1),G.addEventListener(di,i,!1));var J=I.setFBO=o({framebuffer:Ee.define.call(null,mi,"framebuffer")});l();var Z=se(o,{clear:function(e){if(Ae("object"==typeof e&&e,"regl.clear() takes an object as input"),"framebuffer"in e)if(e.framebuffer&&"framebufferCube"===e.framebuffer_reglType)for(var t=0;t<6;++t)J(se({framebuffer:e.framebuffer.faces[t]},e),f);else J(e,f);else f(0,e)},prop:Ee.define.bind(null,mi),context:Ee.define.bind(null,pi),this:Ee.define.bind(null,hi),draw:o({}),buffer:function(e){return j.create(e,ci,!1,!1)},elements:function(e){return O.create(e,!1)},texture:R.create2D,cube:R.createCube,renderbuffer:L.create,framebuffer:I.create,framebufferCube:I.createCube,attributes:h,frame:u,on:function(e,t){Ae.type(t,"function","listener callback must be a function");var r;switch(e){case"frame":return u(t);case"lost":r=N;break;case"restore":r=q;break;case"destroy":r=V;break;default:Ae.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(t),{cancel:function(){for(var e=0;e<r.length;++e)if(r[e]===t)return r[e]=r[r.length-1],void r.pop()}}},limits:D,hasExtension:function(e){return D.extensions.indexOf(e.toLowerCase())>=0},read:W,destroy:function(){U.length=0,n(),G&&(G.removeEventListener(li,a),G.removeEventListener(di,i)),P.clear(),I.clear(),L.clear(),R.clear(),O.clear(),j.clear(),w&&w.clear(),V.forEach(function(e){e()})},_gl:p,_refresh:l,poll:function(){c(),w&&w.update()},now:d,stats:y});return m.onDone(null,Z),Z}});
|
|
},{}],2:[function(require,module,exports) {
|
|
"use strict";function e(e,t,i,s,n=1){for(;;){if(t-e<=n)return[e,t];const o=(t+e)/2,r=i(o);r<s&&(e=o),r>s&&(t=o)}}function t(e,t){const i=Math.floor(t/2),s=e.substr(0,i),n=e.substr(e.length-i,i);return s+p+n}function i(e,t){return d.has(t)||d.set(t,e.measureText(t).width),d.get(t)}function s(s,n,o){if(i(s,n)<=o)return n;const[r]=e(0,n.length,e=>i(s,t(n,e)),o);return t(n,r)}Object.defineProperty(exports,"__esModule",{value:!0});const n=require("preact"),o=require("aphrodite"),r=require("regl"),a=require("./math"),h=require("./utils");var c;(c||(c={})).MONOSPACE="Courier, monospace";var l;!function(e){e[e.LABEL=10]="LABEL"}(l||(l={}));class f{constructor(e){this.profile=e,this.layers=[],this.duration=0,this.frameColors=new Map,e.forEachSample(this.appendSample.bind(this)),this.layers=this.layers.map(f.mergeAdjacentFrames),this.selectFrameColors(e)}getDuration(){return this.duration}getLayers(){return this.layers}getFrameColors(){return this.frameColors}appendFrame(e,t,i,s){for(;e>=this.layers.length;)this.layers.push([]);const n={node:t,start:this.duration,end:this.duration+i,parent:s,children:[]};return this.layers[e].push(n),s&&s.children.push(n),n}appendSample(e,t){let i=null;for(let s=0;s<e.length;s++)i=this.appendFrame(s,e[s],t,i);this.duration+=t}static shouldMergeFrames(e,t){return e.node===t.node&&(e.parent===t.parent&&e.end===t.start)}static mergeFrames(e,t){const i={node:e.node,start:e.start,end:t.end,parent:e.parent,children:e.children.concat(t.children)};for(let e of i.children)e.parent=i;return i}static mergeAdjacentFrames(e){const t=[];for(let i of e){const e=t.length>0?t[t.length-1]:null;e&&f.shouldMergeFrames(e,i)?(t.pop(),t.push(f.mergeFrames(e,i))):t.push(i)}return t}selectFrameColors(e){function t(e){return(e.file||"").split("/").concat(e.name.split(/\W/))}function i(e,i){const s=t(e),n=t(i),o=Math.min(s.length,n.length);let r=0;for(let e=0;e<o&&s[e]===n[e];e++)r++;const a=Math.pow(.9,r);return s.join()>n.join()?a:-a}const s=[];this.profile.forEachFrame(e=>s.push(e)),s.sort(i);const n=[];let o=0;for(let e=0;e<s.length;e++){const t=o+Math.abs(i(s[e],s[(e+1)%s.length]));n.push(t),o=t}const r=[],a=n[n.length-1]||1;for(let e=0;e<n.length;e++)r.push(360*n[e]/a);for(let e=0;e<r.length;e++){const t=r[e],i=.2*Math.random()-.1,n=.2+i,o=.85-i,a=t/60,h=n*(1-Math.abs(a%2-1)),[c,l,f]=a<1?[n,h,0]:a<2?[h,n,0]:a<3?[0,n,h]:a<4?[0,h,n]:a<5?[h,0,n]:[n,0,h],p=o-(.3*c+.59*l+.11*f);this.frameColors.set(s[e],[c+p,l+p,f+p])}}}exports.Flamechart=f;const p="…",d=new Map,u=window.devicePixelRatio;class m extends n.Component{constructor(){super(...arguments),this.renderer=null,this.ctx=null,this.canvas=null,this.overlayCanvas=null,this.overlayCtx=null,this.configSpaceViewportRect=new a.Rect,this.labels=[],this.hoveredLabel=null,this.canvasRef=(e=>{e?(this.canvas=e,this.ctx=this.canvas.getContext("webgl"),this.renderCanvas()):this.canvas=null}),this.overlayCanvasRef=(e=>{e?(this.overlayCanvas=e,this.overlayCtx=this.overlayCanvas.getContext("2d"),this.renderCanvas()):(this.overlayCanvas=null,this.overlayCtx=null)}),this.LOGICAL_VIEW_SPACE_FRAME_HEIGHT=16,this.renderCanvas=h.atMostOnceAFrame(()=>{!this.canvas||this.canvas.getBoundingClientRect().width<2?requestAnimationFrame(()=>this.renderCanvas()):(this.renderer||this.preprocess(this.props.flamechart),this.renderRects(),this.renderLabels())}),this.lastDragPos=null,this.onMouseDown=(e=>{this.lastDragPos=new a.Vec2(e.offsetX,e.offsetY)}),this.onMouseDrag=(e=>{if(!this.lastDragPos)return;const t=new a.Vec2(e.offsetX,e.offsetY);this.pan(this.lastDragPos.minus(t)),this.lastDragPos=t}),this.onMouseMove=(e=>{if(this.lastDragPos)return e.preventDefault(),void this.onMouseDrag(e);this.hoveredLabel=null;const t=new a.Vec2(e.offsetX,e.offsetY),i=this.logicalToPhysicalViewSpace().transformPosition(t),s=this.configSpaceToPhysicalViewSpace().inverseTransformPosition(i);if(s){for(let e of this.labels)if(e.configSpaceBounds.contains(s)){this.hoveredLabel=e;break}this.props.setNodeHover(this.hoveredLabel?this.hoveredLabel.node:null,t),this.renderCanvas()}}),this.onWheel=(e=>{if(e.preventDefault(),e.metaKey||e.ctrlKey){let t=1+e.deltaY/100;e.ctrlKey&&(t=1+e.deltaY/40),this.zoom(new a.Vec2(e.offsetX,e.offsetY),t)}else this.pan(new a.Vec2(e.deltaX,e.deltaY)),this.hoveredLabel=null,this.props.setNodeHover(null,new a.Vec2);this.renderCanvas()}),this.onWindowMouseUp=(e=>{this.lastDragPos=null})}preprocess(e){if(!this.canvas||!this.ctx)return;const t=[],i=[],s=e.getLayers(),n=e.getFrameColors();this.labels=[];for(let e=0;e<s.length;e++){const o=s[e];for(let s of o){const o=new a.Rect(new a.Vec2(s.start,e),new a.Vec2(s.end-s.start,1));t.push(o),i.push(n.get(s.node.frame)||[0,0,0]),this.labels.push({configSpaceBounds:o,node:s.node})}}this.renderer=exports.rectangleBatchRenderer(this.ctx,t,i),this.configSpaceViewportRect=new a.Rect,this.hoveredLabel=null}configSpaceSize(){return new a.Vec2(this.props.flamechart.getDuration(),this.props.flamechart.getLayers().length)}physicalViewSize(){return new a.Vec2(this.canvas?this.canvas.width:0,this.canvas?this.canvas.height:0)}configSpaceToPhysicalViewSpace(){return a.AffineTransform.betweenRects(this.configSpaceViewportRect,new a.Rect(new a.Vec2(0,0),this.physicalViewSize()))}physicalViewSpaceToNDC(){return a.AffineTransform.withScale(new a.Vec2(1,-1)).times(a.AffineTransform.betweenRects(new a.Rect(new a.Vec2(0,0),this.physicalViewSize()),new a.Rect(new a.Vec2(-1,-1),new a.Vec2(2,2))))}logicalToPhysicalViewSpace(){return a.AffineTransform.withScale(new a.Vec2(u,u))}resizeOverlayCanvasIfNeeded(){if(!this.overlayCanvas)return;let{width:e,height:t}=this.overlayCanvas.getBoundingClientRect();if(e=Math.floor(e),t=Math.floor(t),0===e||0===t)return;const i=e*u,s=t*u;i===this.overlayCanvas.width&&s===this.overlayCanvas.height||(this.overlayCanvas.width=i,this.overlayCanvas.height=s)}renderLabels(){const e=this.overlayCtx;if(!e)return;this.resizeOverlayCanvasIfNeeded();const t=this.configSpaceToPhysicalViewSpace(),n=l.LABEL*u,o=this.LOGICAL_VIEW_SPACE_FRAME_HEIGHT*u,r=this.physicalViewSize(),h=new a.Rect(new a.Vec2(0,0),r);if(e.clearRect(0,0,r.x,r.y),e.strokeStyle="rgba(15, 10, 5, 0.5)",e.lineWidth=2,this.hoveredLabel){const i=t.transformRect(this.hoveredLabel.configSpaceBounds);e.strokeRect(Math.floor(i.left()),Math.floor(i.top()),Math.floor(i.width()),Math.floor(i.height()))}e.font=`${n}px/${o}px ${c.MONOSPACE}`,e.fillStyle="rgba(80, 70, 70, 1)",e.textBaseline="top";const f=i(e,"M"+p+"M");for(let i of this.labels){const n=2*u;let o=t.transformRect(i.configSpaceBounds);if((o=o.withOrigin(o.origin.plus(new a.Vec2(n,n))).withSize(o.size.minus(new a.Vec2(2*n,2*n))).intersectWith(new a.Rect(new a.Vec2(n,-1/0),new a.Vec2(r.x,1/0)))).width()<f)continue;if(h.intersectWith(o).isEmpty())continue;o.origin.x<0&&(o=o.withOrigin(new a.Vec2(0,o.origin.y)));const c=s(e,i.node.frame.name,o.width());e.fillText(c,o.left(),o.top())}}resizeCanvasIfNeeded(){if(!this.canvas||!this.ctx)return;let{width:e,height:t}=this.canvas.getBoundingClientRect();const i=t;if(e=Math.floor(e)*u,t=Math.floor(t)*u,0===e||0===t)return;const s=this.canvas.width,n=this.canvas.height;this.configSpaceViewportRect.isEmpty()?this.configSpaceViewportRect=new a.Rect(new a.Vec2(0,0),new a.Vec2(this.configSpaceSize().x,i/this.LOGICAL_VIEW_SPACE_FRAME_HEIGHT)):this.configSpaceViewportRect=this.configSpaceViewportRect.withSize(this.configSpaceViewportRect.size.timesPointwise(new a.Vec2(e/s,t/n))),e===s&&t===n||(this.canvas.width=e,this.canvas.height=t,this.ctx.viewport(0,0,e,t))}renderRects(){if(!this.renderer||!this.canvas)return;this.resizeCanvasIfNeeded();const e=this.physicalViewSpaceToNDC().times(this.configSpaceToPhysicalViewSpace());this.renderer({configSpaceToNDC:e,physicalSize:this.physicalViewSize()})}transformViewport(e){const t=e.transformRect(this.configSpaceViewportRect),i=new a.Rect(new a.Vec2(0,0),a.Vec2.max(new a.Vec2(0,0),this.configSpaceSize().minus(t.size))),s=new a.Rect(new a.Vec2(1,t.height()),new a.Vec2(this.configSpaceSize().x,t.height()));this.configSpaceViewportRect=new a.Rect(i.closestPointTo(t.origin),s.closestPointTo(t.size)),this.renderCanvas()}pan(e){const t=this.logicalToPhysicalViewSpace().transformVector(e),i=this.configSpaceToPhysicalViewSpace().inverseTransformVector(t);i&&this.transformViewport(a.AffineTransform.withTranslation(i))}zoom(e,t){const i=this.logicalToPhysicalViewSpace().transformPosition(e),s=this.configSpaceToPhysicalViewSpace().inverseTransformPosition(i);if(!s)return;const n=a.AffineTransform.withTranslation(s.times(-1)).scaledBy(new a.Vec2(t,1)).translatedBy(s);this.transformViewport(n)}shouldComponentUpdate(){return!1}componentWillReceiveProps(e){this.props.flamechart!==e.flamechart&&(this.renderer=null),this.renderCanvas()}componentDidMount(){window.addEventListener("mouseup",this.onWindowMouseUp)}componentWillUnmount(){window.removeEventListener("mouseup",this.onWindowMouseUp)}render(){return n.h("div",{className:o.css(w.fill),onMouseDown:this.onMouseDown,onMouseMove:this.onMouseMove,onWheel:this.onWheel},n.h("canvas",{width:1,height:1,ref:this.canvasRef,className:o.css(w.fill)}),n.h("canvas",{width:1,height:1,ref:this.overlayCanvasRef,className:o.css(w.fill)}))}}exports.FlamechartPanZoomView=m;class v extends n.Component{constructor(){super(),this.container=null,this.onNodeHover=((e,t)=>{this.setState({hoveredNode:e,logicalSpaceMouse:t})}),this.containerRef=(e=>{this.container=e||null}),this.state={hoveredNode:null,logicalSpaceMouse:new a.Vec2}}formatTime(e){const t=this.props.flamechart.getDuration();return`${(e/1e3).toFixed(2)}ms (${(100*e/t).toFixed()}%)`}renderTooltip(){if(!this.container)return null;const{hoveredNode:e,logicalSpaceMouse:t}=this.state;if(!e)return null;const{width:i,height:s}=this.container.getBoundingClientRect(),r={};return t.x+7+v.TOOLTIP_WIDTH_MAX<i?r.left=t.x+7:r.right=i-t.x+1,t.y+7+v.TOOLTIP_HEIGHT_MAX<s?r.top=t.y+7:r.bottom=s-t.y+1,n.h("div",{className:o.css(w.hoverTip),style:r},n.h("div",{className:o.css(w.hoverTipRow)},e.frame.name),n.h("div",{className:o.css(w.hoverTipRow)},"Total Time: ",this.formatTime(e.getTotalTime())),n.h("div",{className:o.css(w.hoverTipRow)},"Self Time: ",this.formatTime(e.getSelfTime())),n.h("div",{className:o.css(w.hoverTipRow)},"Cum. Total Time: ",this.formatTime(e.frame.getTotalTime())),n.h("div",{className:o.css(w.hoverTipRow)},"Cum. Self Time: ",this.formatTime(e.frame.getSelfTime())))}render(){return n.h("div",{className:o.css(w.fill,w.clip),ref:this.containerRef},n.h(m,{flamechart:this.props.flamechart,setNodeHover:this.onNodeHover}),this.renderTooltip())}}v.TOOLTIP_WIDTH_MAX=300,v.TOOLTIP_HEIGHT_MAX=75,exports.FlamechartView=v;const g=2,w=o.StyleSheet.create({hoverTip:{position:"absolute",background:"white",border:"1px solid black",maxWidth:v.TOOLTIP_WIDTH_MAX,overflow:"hidden",paddingTop:2,paddingBottom:2,pointerEvents:"none",userSelect:"none",fontSize:l.LABEL,fontFamily:c.MONOSPACE},hoverTipRow:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",paddingLeft:2,paddingRight:2,maxWidth:v.TOOLTIP_WIDTH_MAX},clip:{overflow:"hidden"},fill:{width:"100%",height:"100%",position:"absolute",left:0,top:0}});exports.rectangleBatchRenderer=((e,t,i)=>{const s=[],n=[],o=(e,t)=>{function i(e){s.push(e.flatten()),n.push(t)}i(e.topLeft()),i(e.bottomLeft()),i(e.topRight()),i(e.bottomLeft()),i(e.topRight()),i(e.bottomRight())};for(let e=0;e<t.length;e++)o(t[e],i[e]);return r(e)({vert:"\n uniform mat3 configSpaceToNDC;\n uniform vec2 physicalSize;\n attribute vec2 position;\n attribute vec3 color;\n varying vec3 vColor;\n void main() {\n vColor = color;\n vec2 roundedPosition = (configSpaceToNDC * vec3(position, 1)).xy;\n vec2 halfSize = physicalSize / 2.0;\n roundedPosition = floor(roundedPosition * halfSize) / halfSize;\n gl_Position = vec4(roundedPosition, 0, 1);\n }\n ",frag:"\n precision mediump float;\n varying vec3 vColor;\n void main() {\n gl_FragColor = vec4(vColor, 1);\n }\n ",attributes:{position:s,color:n},uniforms:{configSpaceToNDC:(e,t)=>t.configSpaceToNDC.flatten(),physicalSize:(e,t)=>t.physicalSize.flatten()},primitive:"triangles",count:n.length})});
|
|
},{"./math":7,"./utils":8,"preact":5,"aphrodite":6,"regl":10}],9:[function(require,module,exports) {
|
|
"use strict";function e(e,t,s){return e.has(t)||e.set(t,s),e.get(t)}function t(e){return e[e.length-1]}Object.defineProperty(exports,"__esModule",{value:!0});class s{constructor(){this.selfTime=0,this.totalTime=0}getSelfTime(){return this.selfTime}getTotalTime(){return this.totalTime}addToTotalTime(e){this.totalTime+=e}addToSelfTime(e){this.selfTime+=e}}exports.HasTimings=s;class i extends s{constructor(e){super(),this.key=e.key,this.name=e.name,this.file=e.file,this.line=e.line,this.col=e.col}}exports.Frame=i;class r extends s{constructor(e,t){super(),this.frame=e,this.parent=t,this.children=[]}}exports.CallTreeNode=r;class a{constructor(e){this.frames=new Map,this.calltreeRoots=[],this.samples=[],this.timeDeltas=[],this.events=[],this.duration=e}getDuration(){return this.duration}getEvents(){return this.events}forEachSample(e){const t=new Map;for(let s=0;s<this.samples.length;s++){let i=this.samples[s];if(!t.has(i)){const e=[];for(let t=i;t;t=t.parent)e.push(t);e.reverse(),t.set(i,e)}e(t.get(i),this.timeDeltas[s])}}forEachFrame(e){this.frames.forEach(e)}appendSample(s,a){if(isNaN(a))throw new Error("invalid timeDelta");let l=null,o=this.calltreeRoots;for(let n of s){const s=e(this.frames,n.key,new i(n)),h=t(o);h&&h.frame==s?l=h:(l=new r(s,l),o.push(l)),l.addToTotalTime(a),l.frame.addToTotalTime(a),o=l.children}l&&(l.addToSelfTime(a),l.frame.addToSelfTime(a),this.samples.push(l),this.timeDeltas.push(a))}sortedAlphabetically(){function e(e){let t="",s=e;for(;s;)t=s.frame.name+":"+t,s=s.parent;return t}let t=[];for(let e=0;e<this.samples.length;e++)t.push([this.samples[e],this.timeDeltas[e]]);t.sort((t,s)=>e(t[0])<e(s[0])?-1:1);const s=new a(this.duration);for(const[e,r]of t){const t=[];function i(e){e.parent&&i(e.parent);const s=Object.assign({},e.frame);s.key=s.name,t.push(s)}i(e),s.appendSample(t,r)}return s}}exports.Profile=a;
|
|
},{}],3:[function(require,module,exports) {
|
|
"use strict";function e(e){const r=[];return e.replace(/^(.*) (\d+)$/gm,(e,t,o)=>(r.push({stack:t.split(";").map(e=>({key:e,name:e})),duration:parseInt(o,10)}),e)),r}function r(r){const o=e(r),n=o.reduce((e,r)=>e+r.duration,0),a=new t.Profile(n);for(let e of o)a.appendSample(e.stack,e.duration);return a}Object.defineProperty(exports,"__esModule",{value:!0});const t=require("../profile");exports.importFromBGFlameGraph=r;
|
|
},{"../profile":9}],4:[function(require,module,exports) {
|
|
"use strict";function e(e){const r=JSON.parse(e),s=r.raw_timestamp_deltas.reduce((e,t)=>e+t,0),o=new t.Profile(s),{frames:a,raw:l,raw_timestamp_deltas:n}=r;let p=0;for(let e=0;e<l.length;){const t=l[e++],r=[];for(let s=0;s<t;s++){const t=l[e++];r.push(Object.assign({key:t},a[t]))}const s=l[e++];let c=0;for(let e=0;e<s;e++)c+=n[p++];o.appendSample(r,c)}return o}Object.defineProperty(exports,"__esModule",{value:!0});const t=require("../profile");exports.importFromStackprof=e;
|
|
},{"../profile":9}],1:[function(require,module,exports) {
|
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e=require("preact"),t=require("aphrodite"),r=require("./import/bg-flamegraph"),o=require("./import/stackprof"),s=require("./flamechart");var n;!function(e){e[e.CHRONO=0]="CHRONO",e[e.ALPHA=1]="ALPHA"}(n||(n={}));class i extends e.Component{constructor(){super(),this.onDrop=(e=>{const t=e.dataTransfer.files.item(0),n=new FileReader;n.addEventListener("loadend",()=>{const e=t.name.endsWith("json")?o.importFromStackprof(n.result):r.importFromBGFlameGraph(n.result),i=new s.Flamechart(e),a=new s.Flamechart(e.sortedAlphabetically());this.setState({profile:e,flamechart:i,sortedFlamechart:a})}),n.readAsText(t),e.preventDefault()}),this.onDragOver=(e=>{e.preventDefault()}),this.onWindowKeyPress=(e=>{"a"==e.key&&this.setState({sortOrder:this.state.sortOrder===n.CHRONO?n.ALPHA:n.CHRONO})}),this.onWindowResize=(()=>{this.forceUpdate()}),this.state={profile:null,flamechart:null,sortedFlamechart:null,sortOrder:n.CHRONO}}componentDidMount(){window.addEventListener("resize",this.onWindowResize),window.addEventListener("keypress",this.onWindowKeyPress)}componentWillUnmount(){window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keypress",this.onWindowKeyPress)}render(){const{flamechart:r,sortedFlamechart:o,sortOrder:i}=this.state,d=i==n.CHRONO?r:o;return e.h("div",{onDrop:this.onDrop,onDragOver:this.onDragOver,className:t.css(a.root)},d&&e.h(s.FlamechartView,{flamechart:d}))}}const a=t.StyleSheet.create({root:{width:"100vw",height:"100vh",overflow:"hidden"}});e.render(e.h(i,null),document.body);
|
|
},{"./flamechart":2,"./import/bg-flamegraph":3,"./import/stackprof":4,"preact":5,"aphrodite":6}]},{},[1]) |