diff --git a/build/bundle.min.js b/build/bundle.min.js
index 3f38978..213dc4d 100644
--- a/build/bundle.min.js
+++ b/build/bundle.min.js
@@ -1 +1 @@
-!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;oAn introduction to the WebGL API that runs in your browser. webgl-workshop \nis a NodeSchool workshop originally created for\nCampJS IV . Everything is powered by node.js, browserify and\na selection of stackgl packages under the hood.
',thumb:"http://i.imgur.com/vBJ7d6o.jpg",featured:!0,i:1},{name:"shader-school",link:"http://github.com/stackgl/shader-school",desc:"",thumb:"http://imgur.com/hegi9dZ.png",featured:!1,i:2},{name:"plotly",link:"https://plot.ly/javascript/open-source-announcement/",desc:"",thumb:"http://i.imgur.com/BnD72G0.png",featured:!1,i:3},{name:"understanding npm",link:"http://unpm.nodesource.com/",desc:"",thumb:"http://i.imgur.com/P1wWlDx.jpg",featured:!1,i:4},{name:"rust",link:"http://mattdesl.github.io/rust/",desc:"",thumb:"http://i.imgur.com/0kNWm2g.png",featured:!1,i:5},{name:"bunny-walkthrough",link:"https://github.com/stackgl/bunny-walkthrough",desc:"",thumb:"http://i.imgur.com/OefbPjB.jpg",featured:!1,i:6},{name:"glsl-lighting-walkthrough",link:"https://github.com/stackgl/glsl-lighting-walkthrough",desc:"",thumb:"http://i.imgur.com/Ohqd9Ip.png",featured:!1,i:7},{name:"voxel-fall",link:"http://hughsk.io/voxel-fall/",desc:"",thumb:"http://i.imgur.com/cnSkHJL.jpg",featured:!1,i:8},{name:"glsl.io",link:"http://glsl.io/",desc:"",thumb:"http://imgur.com/56SPiLL.png",featured:!1,i:9},{name:"run.south.im",link:"http://run.south.im/",desc:"",thumb:"http://imgur.com/kZjW5QD.png",featured:!1,i:10},{name:"nodesource.com",link:"http://nodesource.com/company",desc:"",thumb:"http://imgur.com/tCKuJfx.png",featured:!1,i:11},{name:"voxel-mipmap-demo",link:"https://github.com/mikolalysenko/voxel-mipmap-demo/",desc:"",thumb:"http://imgur.com/9eUBmfB.png",featured:!1,i:12},{name:"gif-3d",link:"http://mikolalysenko.github.io/gif-3d/",desc:"",thumb:"http://imgur.com/gItopw0.jpg",featured:!1,i:13},{name:"moire #1",link:"http://hughsk.io/moire-1",desc:"",thumb:"http://imgur.com/9tbJfnF.png",featured:!1,i:14},{name:"campjs '14",link:"http://hughsk.io/campjs",desc:"",thumb:"http://imgur.com/d47Vesp.png",featured:!1,i:15},{name:"particle-excess-demo",link:"https://github.com/hughsk/particle-excess-demo/",desc:"",thumb:"http://imgur.com/YyrtLqM.png",featured:!1,i:16},{name:"web-audio-analyser",link:"https://github.com/hughsk/web-audio-analyser/",desc:"",thumb:"http://imgur.com/xhPfMFP.png",featured:!1,i:17}]},{}],3:[function(require,module,exports){function fill(elements){function refill(){for(var width=window.innerWidth+"px",height=window.innerHeight+"px",i=0;i{{name}} \n{{/category}}\n');module.exports=function(thumbs){var filtered=slice(thumbs.querySelectorAll("[data-filter]")),categories=filtered.reduce(function(categories,el){var cat=el.getAttribute("data-filter");return-1===categories.indexOf(cat)&&categories.push(cat),categories},[]);categories.unshift(all),categories=categories.map(function(name){return{name:name}});var list=domify(template({category:categories})),children=slice(list.childNodes).filter(function(node){return node.nodeType===Node.ELEMENT_NODE}),prev=children[0];return children[0].setAttribute("class","selected"),children.forEach(function(child){var name=child.getAttribute("data-name");child.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var target=findup(e.target,"li");if(target!==child)return!1;prev.setAttribute("class",""),prev=target,prev.setAttribute("class","selected");for(var i=0;i-1||(list.push(token),setTokens(list))}function remove(token){var list=getTokens(),index=indexof(list,token);-1!==index&&(list.splice(index,1),setTokens(list))}function contains(token){return indexof(getTokens(),token)>-1}function toggle(token){return contains(token)?(remove(token),!1):(add(token),!0)}function $toString(){return elem.className}function item(index){var tokens=getTokens();return tokens[index]||null}function getTokens(){var className=elem.className;return filter(className.split(" "),isTruthy)}function setTokens(list){var length=list.length;elem.className=list.join(" "),classList.length=length;for(var i=0;ia ',innerHTMLBug=!bugTestDiv.getElementsByTagName("link").length,bugTestDiv=void 0);var map={legend:[1,""," "],tr:[2,""],col:[2,""],_default:innerHTMLBug?[1,"X","
"]:[0,"",""]};map.td=map.th=[3,""],map.option=map.optgroup=[1,''," "],map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,""],map.polyline=map.ellipse=map.polygon=map.circle=map.text=map.line=map.path=map.rect=map.g=[1,''," "]},{}],9:[function(require,module,exports){function findup(child,check){for("string"==typeof check&&(check=byName(check)),"function"!=typeof check&&(check=byExact(check));child&&!check(child);)child=child.parentNode;return child||null}function byName(name){return name=String(name).toUpperCase(),function(element){return name===element.nodeName}}function byExact(el){return function(element){return el===element}}module.exports=findup},{}],10:[function(require,module,exports){(function(process){function debounce(fn,now){function debounced(){null===args&&(args=slice(arguments),ctx=this,now&&fn.apply(ctx,args),raf(next))}function next(){now||fn.apply(ctx,args),args=null,ctx=null}var args=null,ctx=null;return debounced}var slice=require("sliced");if(process.browser)var raf=require("raf-component");else var raf="undefined"!=typeof setImmediate?setImmediate:process.nextTick;module.exports=debounce}).call(this,require("_process"))},{_process:5,"raf-component":11,sliced:13}],11:[function(require,module,exports){function fallback(fn){var curr=(new Date).getTime(),ms=Math.max(0,16-(curr-prev)),req=setTimeout(fn,ms);return prev=curr,req}exports=module.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||fallback;var prev=(new Date).getTime(),cancel=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout;exports.cancel=function(id){cancel.call(window,id)}},{}],12:[function(require,module,exports){function render(str,obj){obj=obj||{};var fn=compile(str);return fn(obj)}function compile(str){for(var tok,js=[],toks=parse(str),i=0;i /g,">")}exports=module.exports=render,exports.compile=compile},{}],13:[function(require,module,exports){module.exports=exports=require("./lib/sliced")},{"./lib/sliced":14}],14:[function(require,module,exports){module.exports=function(args,slice,sliceEnd){var ret=[],len=args.length;if(0===len)return ret;var start=0>slice?Math.max(0,slice+len):slice||0;for(void 0!==sliceEnd&&(len=0>sliceEnd?sliceEnd+len:sliceEnd);len-- >start;)ret[len-start]=args[len];return ret}},{}],15:[function(require,module,exports){function shuffle(){return Math.random()-.5}var minstache=(require("../lib/filter"),require("class-list"),require("minstache")),domify=require("domify");require("sliced");require("../lib/fill")(document.querySelectorAll("[data-fill]"));var thumb=minstache.compile('\n \n
\n {{name}} \n \n \n'),examples=require("../build/examples.json").map(function(meta){return thumb(meta)}).join("\n");document.getElementById("examples").querySelector("ul.thumbs").appendChild(domify(examples));var contribs=require("../build/contributors.json"),upper=Math.ceil(.1*contribs.length);contribs=[].concat(contribs.slice(0,upper).sort(shuffle)).concat(contribs.slice(upper).sort(shuffle)).map(function(d){return' "}).join(""),document.getElementById("contributor-list").appendChild(domify(contribs))},{"../build/contributors.json":1,"../build/examples.json":2,"../lib/fill":3,"../lib/filter":4,"class-list":6,domify:8,minstache:12,sliced:13}]},{},[15]);
+!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n||e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;oAn introduction to the WebGL API that runs in your browser. webgl-workshop \nis a NodeSchool workshop originally created for\nCampJS IV . Everything is powered by node.js, browserify and\na selection of stackgl packages under the hood.',thumb:"http://i.imgur.com/vBJ7d6o.jpg",featured:!0,i:1},{name:"shader-school",link:"http://github.com/stackgl/shader-school",desc:"",thumb:"http://imgur.com/hegi9dZ.png",featured:!1,i:2},{name:"plotly",link:"https://plot.ly/javascript/open-source-announcement/",desc:"",thumb:"http://i.imgur.com/BnD72G0.png",featured:!1,i:3},{name:"understanding npm",link:"http://unpm.nodesource.com/",desc:"",thumb:"http://i.imgur.com/P1wWlDx.jpg",featured:!1,i:4},{name:"rust",link:"http://mattdesl.github.io/rust/",desc:"",thumb:"http://i.imgur.com/0kNWm2g.png",featured:!1,i:5},{name:"bunny-walkthrough",link:"https://github.com/stackgl/bunny-walkthrough",desc:"",thumb:"http://i.imgur.com/OefbPjB.jpg",featured:!1,i:6},{name:"glsl-lighting-walkthrough",link:"https://github.com/stackgl/glsl-lighting-walkthrough",desc:"",thumb:"http://i.imgur.com/Ohqd9Ip.png",featured:!1,i:7},{name:"voxel-fall",link:"http://hughsk.io/voxel-fall/",desc:"",thumb:"http://i.imgur.com/cnSkHJL.jpg",featured:!1,i:8},{name:"gl-transitions",link:"https://gl-transitions.com",desc:"",thumb:"http://imgur.com/56SPiLL.png",featured:!1,i:9},{name:"run.south.im",link:"http://run.south.im/",desc:"",thumb:"http://imgur.com/kZjW5QD.png",featured:!1,i:10},{name:"nodesource.com",link:"http://nodesource.com/company",desc:"",thumb:"http://imgur.com/tCKuJfx.png",featured:!1,i:11},{name:"voxel-mipmap-demo",link:"https://github.com/mikolalysenko/voxel-mipmap-demo/",desc:"",thumb:"http://imgur.com/9eUBmfB.png",featured:!1,i:12},{name:"gif-3d",link:"http://mikolalysenko.github.io/gif-3d/",desc:"",thumb:"http://imgur.com/gItopw0.jpg",featured:!1,i:13},{name:"moire #1",link:"http://hughsk.io/moire-1",desc:"",thumb:"http://imgur.com/9tbJfnF.png",featured:!1,i:14},{name:"campjs '14",link:"http://hughsk.io/campjs",desc:"",thumb:"http://imgur.com/d47Vesp.png",featured:!1,i:15},{name:"particle-excess-demo",link:"https://github.com/hughsk/particle-excess-demo/",desc:"",thumb:"http://imgur.com/YyrtLqM.png",featured:!1,i:16},{name:"web-audio-analyser",link:"https://github.com/hughsk/web-audio-analyser/",desc:"",thumb:"http://imgur.com/xhPfMFP.png",featured:!1,i:17}]},{}],3:[function(require,module,exports){function fill(elements){function refill(){for(var width=window.innerWidth+"px",height=window.innerHeight+"px",i=0;i{{name}} \n{{/category}}\n');module.exports=function(thumbs){var filtered=slice(thumbs.querySelectorAll("[data-filter]")),categories=filtered.reduce(function(categories,el){var cat=el.getAttribute("data-filter");return-1===categories.indexOf(cat)&&categories.push(cat),categories},[]);categories.unshift(all),categories=categories.map(function(name){return{name:name}});var list=domify(template({category:categories})),children=slice(list.childNodes).filter(function(node){return node.nodeType===Node.ELEMENT_NODE}),prev=children[0];return children[0].setAttribute("class","selected"),children.forEach(function(child){var name=child.getAttribute("data-name");child.addEventListener("click",function(e){e.preventDefault(),e.stopPropagation();var target=findup(e.target,"li");if(target!==child)return!1;prev.setAttribute("class",""),prev=target,prev.setAttribute("class","selected");for(var i=0;i-1||(list.push(token),setTokens(list))}function remove(token){var list=getTokens(),index=indexof(list,token);-1!==index&&(list.splice(index,1),setTokens(list))}function contains(token){return indexof(getTokens(),token)>-1}function toggle(token){return contains(token)?(remove(token),!1):(add(token),!0)}function $toString(){return elem.className}function item(index){return getTokens()[index]||null}function getTokens(){return filter(elem.className.split(" "),isTruthy)}function setTokens(list){var length=list.length;elem.className=list.join(" "),classList.length=length;for(var i=0;ia ',innerHTMLBug=!bugTestDiv.getElementsByTagName("link").length,bugTestDiv=void 0);var map={legend:[1,""," "],tr:[2,""],col:[2,""],_default:innerHTMLBug?[1,"X","
"]:[0,"",""]};map.td=map.th=[3,""],map.option=map.optgroup=[1,''," "],map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,""],map.polyline=map.ellipse=map.polygon=map.circle=map.text=map.line=map.path=map.rect=map.g=[1,''," "]},{}],7:[function(require,module,exports){function findup(child,check){for("string"==typeof check&&(check=byName(check)),"function"!=typeof check&&(check=byExact(check));child&&!check(child);)child=child.parentNode;return child||null}function byName(name){return name=String(name).toUpperCase(),function(element){return name===element.nodeName}}function byExact(el){return function(element){return el===element}}module.exports=findup},{}],8:[function(require,module,exports){(function(process){function debounce(fn,now){function debounced(){null===args&&(args=slice(arguments),ctx=this,now&&fn.apply(ctx,args),raf(next))}function next(){now||fn.apply(ctx,args),args=null,ctx=null}var args=null,ctx=null;return debounced}var slice=require("sliced");if(process.browser)var raf=require("raf-component");else var raf="undefined"!=typeof setImmediate?setImmediate:process.nextTick;module.exports=debounce}).call(this,require("_process"))},{_process:11,"raf-component":12,sliced:13}],9:[function(require,module,exports){var indexOf=[].indexOf;module.exports=function(arr,obj){if(indexOf)return arr.indexOf(obj);for(var i=0;i /g,">")}exports=module.exports=render,exports.compile=compile},{}],11:[function(require,module,exports){function drainQueue(){if(!draining){draining=!0;for(var currentQueue,len=queue.length;len;){currentQueue=queue,queue=[];for(var i=-1;++istart;)ret[len-start]=args[len];return ret}},{}],15:[function(require,module,exports){function shuffle(){return Math.random()-.5}var minstache=(require("../lib/filter"),require("class-list"),require("minstache")),domify=require("domify");require("sliced");require("../lib/fill")(document.querySelectorAll("[data-fill]"));var thumb=minstache.compile('\n \n
\n {{name}} \n \n \n'),examples=require("../build/examples.json").map(function(meta){return thumb(meta)}).join("\n");document.getElementById("examples").querySelector("ul.thumbs").appendChild(domify(examples));var contribs=require("../build/contributors.json"),upper=Math.ceil(.1*contribs.length);contribs=[].concat(contribs.slice(0,upper).sort(shuffle)).concat(contribs.slice(upper).sort(shuffle)).map(function(d){return' "}).join(""),document.getElementById("contributor-list").appendChild(domify(contribs))},{"../build/contributors.json":1,"../build/examples.json":2,"../lib/fill":3,"../lib/filter":4,"class-list":5,domify:6,minstache:10,sliced:13}]},{},[15]);
diff --git a/build/contributors.json b/build/contributors.json
index 6f9bd66..c10bfe4 100644
--- a/build/contributors.json
+++ b/build/contributors.json
@@ -1 +1 @@
-[{"name":"hughsk","image":"https://avatars.githubusercontent.com/u/569817?v=3","count":114},{"name":"mattdesl","image":"https://avatars.githubusercontent.com/u/1383811?v=3","count":89},{"name":"mikolalysenko","image":"https://avatars.githubusercontent.com/u/231686?v=3","count":79},{"name":"thibauts","image":"https://avatars.githubusercontent.com/u/2544184?v=3","count":14},{"name":"wwwtyro","image":"https://avatars.githubusercontent.com/u/929443?v=3","count":11},{"name":"mikkoh","image":"https://avatars.githubusercontent.com/u/496903?v=3","count":10},{"name":"yoshuawuyts","image":"https://avatars.githubusercontent.com/u/2467194?v=3","count":8},{"name":"chrisdickinson","image":"https://avatars.githubusercontent.com/u/37303?v=3","count":8},{"name":"shama","image":"https://avatars.githubusercontent.com/u/99604?v=3","count":6},{"name":"tmpvar","image":"https://avatars.githubusercontent.com/u/46673?v=3","count":5},{"name":"timoxley","image":"https://avatars.githubusercontent.com/u/43438?v=3","count":5},{"name":"TatumCreative","image":"https://avatars.githubusercontent.com/u/1588648?v=3","count":5},{"name":"deathcap","image":"https://avatars.githubusercontent.com/u/5897956?v=3","count":5},{"name":"marklundin","image":"https://avatars.githubusercontent.com/u/430764?v=3","count":3},{"name":"substack","image":"https://avatars.githubusercontent.com/u/12631?v=3","count":3},{"name":"ranweiler","image":"https://avatars.githubusercontent.com/u/515835?v=3","count":2},{"name":"dy-dx","image":"https://avatars.githubusercontent.com/u/1074881?v=3","count":2},{"name":"maxogden","image":"https://avatars.githubusercontent.com/u/39759?v=3","count":2},{"name":"abiro","image":"https://avatars.githubusercontent.com/u/5764438?v=3","count":2},{"name":"Hypercubed","image":"https://avatars.githubusercontent.com/u/509946?v=3","count":2},{"name":"bsergean","image":"https://avatars.githubusercontent.com/u/11857745?v=3","count":2},{"name":"nickdesaulniers","image":"https://avatars.githubusercontent.com/u/1823839?v=3","count":2},{"name":"gre","image":"https://avatars.githubusercontent.com/u/211411?v=3","count":2},{"name":"mreinstein","image":"https://avatars.githubusercontent.com/u/718067?v=3","count":2},{"name":"twolfson","image":"https://avatars.githubusercontent.com/u/902488?v=3","count":2},{"name":"danez","image":"https://avatars.githubusercontent.com/u/231804?v=3","count":2},{"name":"sidorares","image":"https://avatars.githubusercontent.com/u/173025?v=3","count":2},{"name":"razh","image":"https://avatars.githubusercontent.com/u/240770?v=3","count":2},{"name":"msfeldstein","image":"https://avatars.githubusercontent.com/u/161135?v=3","count":2},{"name":"etpinard","image":"https://avatars.githubusercontent.com/u/6675409?v=3","count":2},{"name":"geek","image":"https://avatars.githubusercontent.com/u/441346?v=3","count":1},{"name":"andyinabox","image":"https://avatars.githubusercontent.com/u/151084?v=3","count":1},{"name":"hamoid","image":"https://avatars.githubusercontent.com/u/108264?v=3","count":1},{"name":"jacob-meacham","image":"https://avatars.githubusercontent.com/u/1624811?v=3","count":1},{"name":"jakepruitt","image":"https://avatars.githubusercontent.com/u/5084263?v=3","count":1},{"name":"dannyfritz","image":"https://avatars.githubusercontent.com/u/315788?v=3","count":1},{"name":"rasteiner","image":"https://avatars.githubusercontent.com/u/6684137?v=3","count":1},{"name":"micha149","image":"https://avatars.githubusercontent.com/u/298880?v=3","count":1},{"name":"tschundler","image":"https://avatars.githubusercontent.com/u/1110025?v=3","count":1},{"name":"oparisy","image":"https://avatars.githubusercontent.com/u/812977?v=3","count":1},{"name":"rezaali","image":"https://avatars.githubusercontent.com/u/555207?v=3","count":1},{"name":"jb55","image":"https://avatars.githubusercontent.com/u/45598?v=3","count":1},{"name":"davebrent","image":"https://avatars.githubusercontent.com/u/1835547?v=3","count":1},{"name":"1wheel","image":"https://avatars.githubusercontent.com/u/1643998?v=3","count":1},{"name":"mdtusz","image":"https://avatars.githubusercontent.com/u/6494463?v=3","count":1},{"name":"mikeseven","image":"https://avatars.githubusercontent.com/u/809004?v=3","count":1},{"name":"lmeyerov","image":"https://avatars.githubusercontent.com/u/4249447?v=3","count":1},{"name":"creationix","image":"https://avatars.githubusercontent.com/u/89353?v=3","count":1},{"name":"pastasfuture","image":"https://avatars.githubusercontent.com/u/2949353?v=3","count":1},{"name":"ralphtheninja","image":"https://avatars.githubusercontent.com/u/308049?v=3","count":1},{"name":"timknip2","image":"https://avatars.githubusercontent.com/u/138757?v=3","count":1},{"name":"tmcw","image":"https://avatars.githubusercontent.com/u/32314?v=3","count":1},{"name":"acerix","image":"https://avatars.githubusercontent.com/u/379534?v=3","count":1},{"name":"Gloridea","image":"https://avatars.githubusercontent.com/u/322413?v=3","count":1},{"name":"joekarl","image":"https://avatars.githubusercontent.com/u/150038?v=3","count":1},{"name":"Maratyszcza","image":"https://avatars.githubusercontent.com/u/1093985?v=3","count":1},{"name":"nicholasbishop","image":"https://avatars.githubusercontent.com/u/1023208?v=3","count":1},{"name":"ansis","image":"https://avatars.githubusercontent.com/u/1421652?v=3","count":1},{"name":"abacon","image":"https://avatars.githubusercontent.com/u/903181?v=3","count":1},{"name":"robert-chiniquy","image":"https://avatars.githubusercontent.com/u/623808?v=3","count":1},{"name":"twilson63","image":"https://avatars.githubusercontent.com/u/21292?v=3","count":1},{"name":"mafintosh","image":"https://avatars.githubusercontent.com/u/376661?v=3","count":1},{"name":"TehShrike","image":"https://avatars.githubusercontent.com/u/1141869?v=3","count":1},{"name":"jenanwise","image":"https://avatars.githubusercontent.com/u/21303?v=3","count":1},{"name":"zeke","image":"https://avatars.githubusercontent.com/u/2289?v=3","count":1},{"name":"anandthakker","image":"https://avatars.githubusercontent.com/u/4974151?v=3","count":1},{"name":"cvan","image":"https://avatars.githubusercontent.com/u/203725?v=3","count":1},{"name":"wooorm","image":"https://avatars.githubusercontent.com/u/944406?v=3","count":1},{"name":"wbinnssmith","image":"https://avatars.githubusercontent.com/u/755844?v=3","count":1},{"name":"scothis","image":"https://avatars.githubusercontent.com/u/302992?v=3","count":1},{"name":"RGBboy","image":"https://avatars.githubusercontent.com/u/1566539?v=3","count":1},{"name":"shuhei","image":"https://avatars.githubusercontent.com/u/498635?v=3","count":1},{"name":"mrspeaker","image":"https://avatars.githubusercontent.com/u/129330?v=3","count":1},{"name":"jwerle","image":"https://avatars.githubusercontent.com/u/1462973?v=3","count":1},{"name":"sfrdmn","image":"https://avatars.githubusercontent.com/u/590570?v=3","count":1},{"name":"drspaniel","image":"https://avatars.githubusercontent.com/u/1588273?v=3","count":1},{"name":"breedx2","image":"https://avatars.githubusercontent.com/u/1888255?v=3","count":1},{"name":"59naga","image":"https://avatars.githubusercontent.com/u/1548478?v=3","count":1},{"name":"hapticdata","image":"https://avatars.githubusercontent.com/u/330356?v=3","count":1},{"name":"Barryrowe","image":"https://avatars.githubusercontent.com/u/1013426?v=3","count":1},{"name":"arthurvr","image":"https://avatars.githubusercontent.com/u/6025224?v=3","count":1},{"name":"coballast","image":"https://avatars.githubusercontent.com/u/1788893?v=3","count":1},{"name":"lchenay","image":"https://avatars.githubusercontent.com/u/804687?v=3","count":1},{"name":"lukeapage","image":"https://avatars.githubusercontent.com/u/309321?v=3","count":1},{"name":"mauricedb","image":"https://avatars.githubusercontent.com/u/3197730?v=3","count":1},{"name":"noffle","image":"https://avatars.githubusercontent.com/u/489362?v=3","count":1},{"name":"vorg","image":"https://avatars.githubusercontent.com/u/171001?v=3","count":1},{"name":"kumavis","image":"https://avatars.githubusercontent.com/u/1474978?v=3","count":1},{"name":"liamgriffiths","image":"https://avatars.githubusercontent.com/u/179645?v=3","count":1},{"name":"alexanderGugel","image":"https://avatars.githubusercontent.com/u/703628?v=3","count":1},{"name":"olivierrr","image":"https://avatars.githubusercontent.com/u/8010834?v=3","count":1},{"name":"kemitchell","image":"https://avatars.githubusercontent.com/u/205760?v=3","count":1},{"name":"pdehaan","image":"https://avatars.githubusercontent.com/u/557895?v=3","count":1},{"name":"maurizzzio","image":"https://avatars.githubusercontent.com/u/1616682?v=3","count":1},{"name":"billautomata","image":"https://avatars.githubusercontent.com/u/432483?v=3","count":1},{"name":"mdda","image":"https://avatars.githubusercontent.com/u/362532?v=3","count":1},{"name":"doug","image":"https://avatars.githubusercontent.com/u/3379?v=3","count":1},{"name":"wblankenship","image":"https://avatars.githubusercontent.com/u/1081565?v=3","count":1},{"name":"kenrussell","image":"https://avatars.githubusercontent.com/u/1149904?v=3","count":1},{"name":"greggman","image":"https://avatars.githubusercontent.com/u/234804?v=3","count":1},{"name":"toji","image":"https://avatars.githubusercontent.com/u/805273?v=3","count":1},{"name":"Oletus","image":"https://avatars.githubusercontent.com/u/453050?v=3","count":1},{"name":"grorg","image":"https://avatars.githubusercontent.com/u/47596?v=3","count":1},{"name":"zhenyao","image":"https://avatars.githubusercontent.com/u/2073521?v=3","count":1},{"name":"pyalot","image":"https://avatars.githubusercontent.com/u/592826?v=3","count":1},{"name":"jdashg","image":"https://avatars.githubusercontent.com/u/1471629?v=3","count":1},{"name":"dsheets","image":"https://avatars.githubusercontent.com/u/59918?v=3","count":1},{"name":"TiborsHub","image":"https://avatars.githubusercontent.com/u/2655184?v=3","count":1},{"name":"RafaelCintron","image":"https://avatars.githubusercontent.com/u/8486520?v=3","count":1},{"name":"jareiko","image":"https://avatars.githubusercontent.com/u/764352?v=3","count":1},{"name":"jamiemadill","image":"https://avatars.githubusercontent.com/u/5702513?v=3","count":1},{"name":"andrewvarga","image":"https://avatars.githubusercontent.com/u/911440?v=3","count":1},{"name":"JunJiang","image":"https://avatars.githubusercontent.com/u/2585737?v=3","count":1},{"name":"nayankk","image":"https://avatars.githubusercontent.com/u/1480682?v=3","count":1},{"name":"mvujovic","image":"https://avatars.githubusercontent.com/u/1356052?v=3","count":1},{"name":"bjacob","image":"https://avatars.githubusercontent.com/u/79535?v=3","count":1},{"name":"apatrick-google","image":"https://avatars.githubusercontent.com/u/2199431?v=3","count":1},{"name":"dslomov","image":"https://avatars.githubusercontent.com/u/5008223?v=3","count":1},{"name":"c0d1f1ed","image":"https://avatars.githubusercontent.com/u/1659707?v=3","count":1},{"name":"gregcouch","image":"https://avatars.githubusercontent.com/u/6979917?v=3","count":1},{"name":"jbauman2","image":"https://avatars.githubusercontent.com/u/716431?v=3","count":1},{"name":"imzet","image":"https://avatars.githubusercontent.com/u/6390033?v=3","count":1},{"name":"janharaldfredriksen","image":"https://avatars.githubusercontent.com/u/3064393?v=3","count":1},{"name":"djg","image":"https://avatars.githubusercontent.com/u/156077?v=3","count":1},{"name":"vonture","image":"https://avatars.githubusercontent.com/u/3650582?v=3","count":1},{"name":"jdarpinian","image":"https://avatars.githubusercontent.com/u/454184?v=3","count":1},{"name":"emilbayes","image":"https://avatars.githubusercontent.com/u/416524?v=3","count":1}]
\ No newline at end of file
+[{"name":"hughsk","image":"https://avatars0.githubusercontent.com/u/569817?v=4","count":116},{"name":"mattdesl","image":"https://avatars1.githubusercontent.com/u/1383811?v=4","count":96},{"name":"mikolalysenko","image":"https://avatars2.githubusercontent.com/u/231686?v=4","count":81},{"name":"dy","image":"https://avatars1.githubusercontent.com/u/300067?v=4","count":19},{"name":"rreusser","image":"https://avatars0.githubusercontent.com/u/572717?v=4","count":17},{"name":"wwwtyro","image":"https://avatars1.githubusercontent.com/u/929443?v=4","count":16},{"name":"thibauts","image":"https://avatars1.githubusercontent.com/u/2544184?v=4","count":14},{"name":"vorg","image":"https://avatars2.githubusercontent.com/u/171001?v=4","count":13},{"name":"Erkaman","image":"https://avatars1.githubusercontent.com/u/602313?v=4","count":12},{"name":"mikkoh","image":"https://avatars2.githubusercontent.com/u/496903?v=4","count":11},{"name":"dmnsgn","image":"https://avatars0.githubusercontent.com/u/1636460?v=4","count":11},{"name":"monfera","image":"https://avatars0.githubusercontent.com/u/1548516?v=4","count":8},{"name":"yoshuawuyts","image":"https://avatars3.githubusercontent.com/u/2467194?v=4","count":8},{"name":"chrisdickinson","image":"https://avatars3.githubusercontent.com/u/37303?v=4","count":8},{"name":"dependabot[bot]","image":"https://avatars0.githubusercontent.com/in/29110?v=4","count":7},{"name":"archmoj","image":"https://avatars1.githubusercontent.com/u/33888540?v=4","count":7},{"name":"shama","image":"https://avatars0.githubusercontent.com/u/99604?v=4","count":6},{"name":"timoxley","image":"https://avatars1.githubusercontent.com/u/43438?v=4","count":6},{"name":"deathcap","image":"https://avatars3.githubusercontent.com/u/5897956?v=4","count":5},{"name":"tmpvar","image":"https://avatars3.githubusercontent.com/u/46673?v=4","count":5},{"name":"realazthat","image":"https://avatars3.githubusercontent.com/u/141522?v=4","count":5},{"name":"gregtatum","image":"https://avatars3.githubusercontent.com/u/1588648?v=4","count":5},{"name":"gre","image":"https://avatars1.githubusercontent.com/u/211411?v=4","count":5},{"name":"etpinard","image":"https://avatars0.githubusercontent.com/u/6675409?v=4","count":4},{"name":"substack","image":"https://avatars0.githubusercontent.com/u/12631?v=4","count":3},{"name":"JamesKyburz","image":"https://avatars3.githubusercontent.com/u/220678?v=4","count":3},{"name":"riccardoscalco","image":"https://avatars0.githubusercontent.com/u/1370300?v=4","count":3},{"name":"oparisy","image":"https://avatars2.githubusercontent.com/u/812977?v=4","count":3},{"name":"TatumCreative","image":"https://avatars0.githubusercontent.com/u/22155328?v=4","count":3},{"name":"marklundin","image":"https://avatars3.githubusercontent.com/u/430764?v=4","count":3},{"name":"abiro","image":"https://avatars0.githubusercontent.com/u/5764438?v=4","count":2},{"name":"cvan","image":"https://avatars0.githubusercontent.com/u/203725?v=4","count":2},{"name":"dy-dx","image":"https://avatars2.githubusercontent.com/u/1074881?v=4","count":2},{"name":"jwerle","image":"https://avatars1.githubusercontent.com/u/1462973?v=4","count":2},{"name":"noffle","image":"https://avatars2.githubusercontent.com/u/489362?v=4","count":2},{"name":"benwiley4000","image":"https://avatars2.githubusercontent.com/u/13558253?v=4","count":2},{"name":"twolfson","image":"https://avatars3.githubusercontent.com/u/902488?v=4","count":2},{"name":"danez","image":"https://avatars2.githubusercontent.com/u/231804?v=4","count":2},{"name":"sidorares","image":"https://avatars0.githubusercontent.com/u/173025?v=4","count":2},{"name":"Hypercubed","image":"https://avatars1.githubusercontent.com/u/509946?v=4","count":2},{"name":"ataber","image":"https://avatars3.githubusercontent.com/u/1509787?v=4","count":2},{"name":"mreinstein","image":"https://avatars1.githubusercontent.com/u/718067?v=4","count":2},{"name":"lejeunerenard","image":"https://avatars1.githubusercontent.com/u/2146515?v=4","count":2},{"name":"razh","image":"https://avatars0.githubusercontent.com/u/240770?v=4","count":2},{"name":"msfeldstein","image":"https://avatars3.githubusercontent.com/u/161135?v=4","count":2},{"name":"ranweiler","image":"https://avatars1.githubusercontent.com/u/515835?v=4","count":2},{"name":"anandthakker","image":"https://avatars3.githubusercontent.com/u/4974151?v=4","count":2},{"name":"dependabot-preview[bot]","image":"https://avatars3.githubusercontent.com/in/2141?v=4","count":2},{"name":"bsergean","image":"https://avatars1.githubusercontent.com/u/11857745?v=4","count":2},{"name":"hapticdata","image":"https://avatars3.githubusercontent.com/u/330356?v=4","count":1},{"name":"liamgriffiths","image":"https://avatars3.githubusercontent.com/u/179645?v=4","count":1},{"name":"goto-bus-stop","image":"https://avatars1.githubusercontent.com/u/1006268?v=4","count":1},{"name":"micahscopes","image":"https://avatars0.githubusercontent.com/u/389782?v=4","count":1},{"name":"Eronana","image":"https://avatars3.githubusercontent.com/u/9164153?v=4","count":1},{"name":"billautomata","image":"https://avatars3.githubusercontent.com/u/432483?v=4","count":1},{"name":"parasti","image":"https://avatars2.githubusercontent.com/u/179160?v=4","count":1},{"name":"mdtusz","image":"https://avatars1.githubusercontent.com/u/6494463?v=4","count":1},{"name":"jarnoh","image":"https://avatars0.githubusercontent.com/u/1207975?v=4","count":1},{"name":"zbryikt","image":"https://avatars0.githubusercontent.com/u/2672307?v=4","count":1},{"name":"dhritzkiv","image":"https://avatars1.githubusercontent.com/u/1349865?v=4","count":1},{"name":"mikeseven","image":"https://avatars0.githubusercontent.com/u/809004?v=4","count":1},{"name":"robertleeplummerjr","image":"https://avatars3.githubusercontent.com/u/679099?v=4","count":1},{"name":"lmeyerov","image":"https://avatars2.githubusercontent.com/u/4249447?v=4","count":1},{"name":"bkotzz","image":"https://avatars1.githubusercontent.com/u/15876322?v=4","count":1},{"name":"creationix","image":"https://avatars3.githubusercontent.com/u/89353?v=4","count":1},{"name":"brupelo","image":"https://avatars3.githubusercontent.com/u/18058492?v=4","count":1},{"name":"mourner","image":"https://avatars1.githubusercontent.com/u/25395?v=4","count":1},{"name":"dphil","image":"https://avatars3.githubusercontent.com/u/3652549?v=4","count":1},{"name":"ralphtheninja","image":"https://avatars2.githubusercontent.com/u/308049?v=4","count":1},{"name":"begmec","image":"https://avatars3.githubusercontent.com/u/39699295?v=4","count":1},{"name":"mikemorris","image":"https://avatars0.githubusercontent.com/u/1149913?v=4","count":1},{"name":"bhouston","image":"https://avatars3.githubusercontent.com/u/588541?v=4","count":1},{"name":"timknip2","image":"https://avatars0.githubusercontent.com/u/138757?v=4","count":1},{"name":"stevesan","image":"https://avatars0.githubusercontent.com/u/1388372?v=4","count":1},{"name":"IvanSanchez","image":"https://avatars0.githubusercontent.com/u/1125786?v=4","count":1},{"name":"akihikodaki","image":"https://avatars1.githubusercontent.com/u/17036990?v=4","count":1},{"name":"ansis","image":"https://avatars0.githubusercontent.com/u/1421652?v=4","count":1},{"name":"Benjamin-Dobell","image":"https://avatars1.githubusercontent.com/u/482276?v=4","count":1},{"name":"retrohacker","image":"https://avatars3.githubusercontent.com/u/1081565?v=4","count":1},{"name":"Gloridea","image":"https://avatars1.githubusercontent.com/u/322413?v=4","count":1},{"name":"geek","image":"https://avatars0.githubusercontent.com/u/441346?v=4","count":1},{"name":"Jas99","image":"https://avatars1.githubusercontent.com/u/59360622?v=4","count":1},{"name":"joekarl","image":"https://avatars1.githubusercontent.com/u/150038?v=4","count":1},{"name":"kriscarle","image":"https://avatars0.githubusercontent.com/u/2431570?v=4","count":1},{"name":"Maratyszcza","image":"https://avatars1.githubusercontent.com/u/1093985?v=4","count":1},{"name":"nicholasbishop","image":"https://avatars2.githubusercontent.com/u/1023208?v=4","count":1},{"name":"abacon","image":"https://avatars3.githubusercontent.com/u/903181?v=4","count":1},{"name":"robert-chiniquy","image":"https://avatars3.githubusercontent.com/u/623808?v=4","count":1},{"name":"maxogden","image":"https://avatars0.githubusercontent.com/u/39759?v=4","count":1},{"name":"mafintosh","image":"https://avatars1.githubusercontent.com/u/376661?v=4","count":1},{"name":"twilson63","image":"https://avatars3.githubusercontent.com/u/21292?v=4","count":1},{"name":"Arjen-Smit","image":"https://avatars2.githubusercontent.com/u/697189?v=4","count":1},{"name":"emilbayes","image":"https://avatars1.githubusercontent.com/u/416524?v=4","count":1},{"name":"jan-swiecki","image":"https://avatars3.githubusercontent.com/u/2249708?v=4","count":1},{"name":"TehShrike","image":"https://avatars0.githubusercontent.com/u/1141869?v=4","count":1},{"name":"zeke","image":"https://avatars1.githubusercontent.com/u/2289?v=4","count":1},{"name":"veggiemonk","image":"https://avatars1.githubusercontent.com/u/5487021?v=4","count":1},{"name":"mantoni","image":"https://avatars1.githubusercontent.com/u/332271?v=4","count":1},{"name":"aral","image":"https://avatars3.githubusercontent.com/u/41798?v=4","count":1},{"name":"bendrucker","image":"https://avatars0.githubusercontent.com/u/808808?v=4","count":1},{"name":"donmccurdy","image":"https://avatars3.githubusercontent.com/u/1848368?v=4","count":1},{"name":"thorn0","image":"https://avatars0.githubusercontent.com/u/94334?v=4","count":1},{"name":"pawsong","image":"https://avatars2.githubusercontent.com/u/2945463?v=4","count":1},{"name":"jmckinnell","image":"https://avatars1.githubusercontent.com/u/923288?v=4","count":1},{"name":"acerix","image":"https://avatars3.githubusercontent.com/u/379534?v=4","count":1},{"name":"rosszurowski","image":"https://avatars3.githubusercontent.com/u/303731?v=4","count":1},{"name":"rtsao","image":"https://avatars0.githubusercontent.com/u/780408?v=4","count":1},{"name":"Steveorevo","image":"https://avatars1.githubusercontent.com/u/635399?v=4","count":1},{"name":"wooorm","image":"https://avatars0.githubusercontent.com/u/944406?v=4","count":1},{"name":"wbinnssmith","image":"https://avatars0.githubusercontent.com/u/755844?v=4","count":1},{"name":"ashnur","image":"https://avatars1.githubusercontent.com/u/407934?v=4","count":1},{"name":"naoyashiga","image":"https://avatars3.githubusercontent.com/u/1988660?v=4","count":1},{"name":"sethvincent","image":"https://avatars1.githubusercontent.com/u/164214?v=4","count":1},{"name":"fibo","image":"https://avatars3.githubusercontent.com/u/176730?v=4","count":1},{"name":"rstacruz","image":"https://avatars1.githubusercontent.com/u/74385?v=4","count":1},{"name":"vweevers","image":"https://avatars2.githubusercontent.com/u/3055345?v=4","count":1},{"name":"tdhooper","image":"https://avatars2.githubusercontent.com/u/170479?v=4","count":1},{"name":"hamoid","image":"https://avatars0.githubusercontent.com/u/108264?v=4","count":1},{"name":"mrspeaker","image":"https://avatars3.githubusercontent.com/u/129330?v=4","count":1},{"name":"stultiloquence","image":"https://avatars1.githubusercontent.com/u/2306246?v=4","count":1},{"name":"derhuerst","image":"https://avatars2.githubusercontent.com/u/5072613?v=4","count":1},{"name":"1wheel","image":"https://avatars1.githubusercontent.com/u/1643998?v=4","count":1},{"name":"andyinabox","image":"https://avatars1.githubusercontent.com/u/151084?v=4","count":1},{"name":"pconerly","image":"https://avatars2.githubusercontent.com/u/469808?v=4","count":1},{"name":"sfrdmn","image":"https://avatars3.githubusercontent.com/u/590570?v=4","count":1},{"name":"courajs","image":"https://avatars3.githubusercontent.com/u/1588273?v=4","count":1},{"name":"dannyfritz","image":"https://avatars1.githubusercontent.com/u/315788?v=4","count":1},{"name":"59naga","image":"https://avatars0.githubusercontent.com/u/1548478?v=4","count":1},{"name":"breedx2","image":"https://avatars0.githubusercontent.com/u/1888255?v=4","count":1},{"name":"martinheidegger","image":"https://avatars3.githubusercontent.com/u/914122?v=4","count":1},{"name":"arthurvr","image":"https://avatars0.githubusercontent.com/u/6025224?v=4","count":1},{"name":"nadous","image":"https://avatars2.githubusercontent.com/u/4922696?v=4","count":1},{"name":"jacob-meacham","image":"https://avatars2.githubusercontent.com/u/1624811?v=4","count":1},{"name":"lchenay","image":"https://avatars2.githubusercontent.com/u/804687?v=4","count":1},{"name":"lukeapage","image":"https://avatars1.githubusercontent.com/u/309321?v=4","count":1},{"name":"Barryrowe","image":"https://avatars3.githubusercontent.com/u/1013426?v=4","count":1},{"name":"jaspervdg","image":"https://avatars3.githubusercontent.com/u/3264193?v=4","count":1},{"name":"mathieu-aubin","image":"https://avatars0.githubusercontent.com/u/15820228?v=4","count":1},{"name":"mauricedb","image":"https://avatars2.githubusercontent.com/u/3197730?v=4","count":1},{"name":"kumavis","image":"https://avatars0.githubusercontent.com/u/1474978?v=4","count":1},{"name":"jakepruitt","image":"https://avatars3.githubusercontent.com/u/5084263?v=4","count":1},{"name":"alexanderGugel","image":"https://avatars1.githubusercontent.com/u/703628?v=4","count":1},{"name":"freeman-lab","image":"https://avatars3.githubusercontent.com/u/3387500?v=4","count":1},{"name":"adamflorin","image":"https://avatars3.githubusercontent.com/u/15598?v=4","count":1},{"name":"tschundler","image":"https://avatars1.githubusercontent.com/u/1110025?v=4","count":1},{"name":"RGBboy","image":"https://avatars2.githubusercontent.com/u/1566539?v=4","count":1},{"name":"clarkbw","image":"https://avatars2.githubusercontent.com/u/2134?v=4","count":1},{"name":"greenkeeper[bot]","image":"https://avatars3.githubusercontent.com/in/505?v=4","count":1},{"name":"nkint","image":"https://avatars3.githubusercontent.com/u/609314?v=4","count":1},{"name":"alvinsight","image":"https://avatars3.githubusercontent.com/u/4254030?v=4","count":1},{"name":"casr","image":"https://avatars0.githubusercontent.com/u/566719?v=4","count":1},{"name":"olivierrr","image":"https://avatars0.githubusercontent.com/u/8010834?v=4","count":1},{"name":"kemitchell","image":"https://avatars1.githubusercontent.com/u/205760?v=4","count":1},{"name":"pdehaan","image":"https://avatars2.githubusercontent.com/u/557895?v=4","count":1},{"name":"mauriciopoppe","image":"https://avatars3.githubusercontent.com/u/1616682?v=4","count":1},{"name":"kevzettler","image":"https://avatars0.githubusercontent.com/u/126209?v=4","count":1},{"name":"rasteiner","image":"https://avatars3.githubusercontent.com/u/6684137?v=4","count":1},{"name":"shuhei","image":"https://avatars3.githubusercontent.com/u/498635?v=4","count":1},{"name":"slobodin","image":"https://avatars3.githubusercontent.com/u/864263?v=4","count":1},{"name":"WemyJu","image":"https://avatars3.githubusercontent.com/u/4346147?v=4","count":1},{"name":"asarode","image":"https://avatars1.githubusercontent.com/u/4860899?v=4","count":1},{"name":"plepers","image":"https://avatars0.githubusercontent.com/u/1036540?v=4","count":1},{"name":"micha149","image":"https://avatars2.githubusercontent.com/u/298880?v=4","count":1},{"name":"MaxBittker","image":"https://avatars1.githubusercontent.com/u/5915546?v=4","count":1},{"name":"mattbierner","image":"https://avatars1.githubusercontent.com/u/212305?v=4","count":1},{"name":"davschne","image":"https://avatars1.githubusercontent.com/u/12088350?v=4","count":1},{"name":"rezaali","image":"https://avatars1.githubusercontent.com/u/555207?v=4","count":1},{"name":"miyu","image":"https://avatars2.githubusercontent.com/u/1606755?v=4","count":1},{"name":"TyLindberg","image":"https://avatars3.githubusercontent.com/u/12196053?v=4","count":1},{"name":"jb55","image":"https://avatars0.githubusercontent.com/u/45598?v=4","count":1},{"name":"ayamflow","image":"https://avatars0.githubusercontent.com/u/1998991?v=4","count":1},{"name":"mdda","image":"https://avatars2.githubusercontent.com/u/362532?v=4","count":1},{"name":"pqml","image":"https://avatars3.githubusercontent.com/u/7287905?v=4","count":1},{"name":"ahem","image":"https://avatars0.githubusercontent.com/u/163283?v=4","count":1},{"name":"davebrent","image":"https://avatars3.githubusercontent.com/u/1835547?v=4","count":1},{"name":"doug","image":"https://avatars2.githubusercontent.com/u/3379?v=4","count":1},{"name":"alexcjohnson","image":"https://avatars3.githubusercontent.com/u/2678795?v=4","count":1},{"name":"bpostlethwaite","image":"https://avatars1.githubusercontent.com/u/1176674?v=4","count":1},{"name":"amilajack","image":"https://avatars1.githubusercontent.com/u/6374832?v=4","count":1},{"name":"wvl","image":"https://avatars0.githubusercontent.com/u/387?v=4","count":1},{"name":"kenrussell","image":"https://avatars1.githubusercontent.com/u/1149904?v=4","count":1},{"name":"zhenyao","image":"https://avatars0.githubusercontent.com/u/2073521?v=4","count":1},{"name":"toji","image":"https://avatars2.githubusercontent.com/u/805273?v=4","count":1},{"name":"Oletus","image":"https://avatars2.githubusercontent.com/u/453050?v=4","count":1},{"name":"greggman","image":"https://avatars2.githubusercontent.com/u/234804?v=4","count":1},{"name":"grorg","image":"https://avatars0.githubusercontent.com/u/47596?v=4","count":1},{"name":"qkmiao","image":"https://avatars2.githubusercontent.com/u/1152109?v=4","count":1},{"name":"Richard-Yunchao","image":"https://avatars1.githubusercontent.com/u/11435653?v=4","count":1},{"name":"pyalot","image":"https://avatars1.githubusercontent.com/u/592826?v=4","count":1},{"name":"xidachen","image":"https://avatars3.githubusercontent.com/u/16124653?v=4","count":1},{"name":"jasomobica","image":"https://avatars1.githubusercontent.com/u/9953117?v=4","count":1},{"name":"RafaelCintron","image":"https://avatars3.githubusercontent.com/u/8486520?v=4","count":1},{"name":"djg","image":"https://avatars1.githubusercontent.com/u/156077?v=4","count":1},{"name":"nvmatthewn","image":"https://avatars1.githubusercontent.com/u/20565100?v=4","count":1},{"name":"kygx-legend","image":"https://avatars1.githubusercontent.com/u/2180657?v=4","count":1},{"name":"TiborsHub","image":"https://avatars3.githubusercontent.com/u/2655184?v=4","count":1},{"name":"bjacob","image":"https://avatars1.githubusercontent.com/u/79535?v=4","count":1},{"name":"jdashg","image":"https://avatars2.githubusercontent.com/u/1471629?v=4","count":1},{"name":"null77","image":"https://avatars3.githubusercontent.com/u/541607?v=4","count":1},{"name":"sugoi1","image":"https://avatars2.githubusercontent.com/u/10076232?v=4","count":1},{"name":"renchenglei","image":"https://avatars3.githubusercontent.com/u/13829262?v=4","count":1},{"name":"jareiko","image":"https://avatars0.githubusercontent.com/u/764352?v=4","count":1},{"name":"andrewvarga","image":"https://avatars1.githubusercontent.com/u/911440?v=4","count":1},{"name":"putsman","image":"https://avatars3.githubusercontent.com/u/756638?v=4","count":1},{"name":"JunJiang","image":"https://avatars2.githubusercontent.com/u/2585737?v=4","count":1},{"name":"xhcao","image":"https://avatars1.githubusercontent.com/u/15917439?v=4","count":1},{"name":"apatole","image":"https://avatars0.githubusercontent.com/u/8667981?v=4","count":1},{"name":"marcorperez","image":"https://avatars0.githubusercontent.com/u/10619104?v=4","count":1},{"name":"ChBernat","image":"https://avatars3.githubusercontent.com/u/8881569?v=4","count":1}]
\ No newline at end of file
diff --git a/build/splash.min.js b/build/splash.min.js
index 931fe10..fff457a 100644
--- a/build/splash.min.js
+++ b/build/splash.min.js
@@ -1,9 +1,10 @@
-!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o=offset&&data.length>len)return gl.bufferData(type,data,usage),data.length;if(data.length+offset>len)throw new Error("gl-buffer: If resizing buffer, offset must be 0");return gl.bufferSubData(type,offset,data),len}function makeScratchTypeArray(array,dtype){for(var res=pool.malloc(array.length,dtype),n=array.length,i=0;n>i;++i)res[i]=array[i];return res}function createBuffer(gl,type,data,usage){void 0===data&&(data=type,type=gl.ARRAY_BUFFER),usage||(usage=gl.DYNAMIC_DRAW);var len=0,handle=gl.createBuffer();if(gl.bindBuffer(type,handle),"number"==typeof data)gl.bufferData(type,data,usage),len=data;else if(data instanceof Array)type===gl.ELEMENT_ARRAY_BUFFER?gl.bufferData(type,new Uint16Array(data),usage):gl.bufferData(type,new Float32Array(data),usage),len=data.length;else if(data.length)gl.bufferData(type,data,usage),len=data.length;else{if(!data.shape)throw new Error("gl-buffer: Invalid format for buffer data");var dtype=data.dtype;if(("float64"===dtype||"array"===dtype||"generic"===dtype)&&(dtype="float32"),type===gl.ELEMENT_ARRAY_BUFFER&&(dtype="uint16"),1!==data.shape.length)throw new Error("gl-buffer: Array shape must be 1D");var len=data.shape[0];if(dtype===data.type&&1===data.stride[0])gl.bufferData(type,data.data.subarray(data.offset,data.offset+len),usage);else{var tmp=pool.malloc(data.shape[0],dtype),ndt=ndarray(tmp);ops.assign(ndt,data),gl.bufferData(type,tmp,usage),pool.free(tmp)}}if(type!==gl.ARRAY_BUFFER&&type!==gl.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer");if(usage!==gl.DYNAMIC_DRAW&&usage!==gl.STATIC_DRAW&&usage!==gl.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer");return new GLBuffer(gl,type,handle,len,usage)}var pool=require("typedarray-pool"),ops=require("ndarray-ops"),ndarray=require("ndarray");GLBuffer.prototype.bind=function(){this.gl.bindBuffer(this.type,this.handle)},GLBuffer.prototype.dispose=function(){this.gl.deleteBuffer(this.handle)},GLBuffer.prototype.update=function(array,offset){if(offset||(offset=0),this.bind(),"number"==typeof array){if(offset>0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");this.gl.bufferData(this.type,array,this.usage),this.length=array}else if(array.shape){var dtype=array.dtype;if(("float64"===dtype||"array"===dtype||"generic"===dtype)&&(dtype="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER&&(dtype="uint16"),1!==array.shape.length)throw new Error("gl-buffer: Array length must be 1");if(dtype===array.dtype&&1===array.stride[0])0===array.offset&&array.data.length===array.shape[0]?this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data,offset):this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data.subarray(array.offset,array.shape[0]),offset);else{var tmp=pool.malloc(array.shape[0],dtype),ndt=ndarray(tmp);ops.assign(ndt,array),this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,tmp,offset),pool.free(tmp)}}else if(Array.isArray(array))if(this.type===this.gl.ELEMENT_ARRAY_BUFFER){var t=makeScratchTypeArray(array,"uint16");this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,t.subarray(0,array.length),offset),pool.freeUint16(t)}else{var t=makeScratchTypeArray(array,"float32");this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,t.subarray(0,array.length),offset),pool.freeFloat32(t)}else this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array,offset)},GLBuffer.prototype.draw=function(mode,count,offset){offset=offset||0;var gl=this.gl;if(this.type===gl.ARRAY_BUFFER)gl.drawArrays(mode,offset,count);else{if(this.type!==gl.ELEMENT_ARRAY_BUFFER)throw new Error("Invalid type for WebGL buffer");this.bind(),gl.drawElements(mode,count,gl.UNSIGNED_SHORT,offset)}},module.exports=createBuffer},{ndarray:9,"ndarray-ops":4,"typedarray-pool":14}],4:[function(require,module,exports){"use strict";function fixup(x){if(!x)return EmptyProc;for(var i=0;i>",rrshift:">>>"};!function(){for(var id in assign_ops){var op=assign_ops[id];exports[id]=makeOp({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+op+"c"},funcName:id}),exports[id+"eq"]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a"+op+"=b"},rvalue:!0,funcName:id+"eq"}),exports[id+"s"]=makeOp({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+op+"s"},funcName:id+"s"}),exports[id+"seq"]=makeOp({args:["array","scalar"],body:{args:["a","s"],body:"a"+op+"=s"},rvalue:!0,funcName:id+"seq"})}}();var unary_ops={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var id in unary_ops){var op=unary_ops[id];exports[id]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a="+op+"b"},funcName:id}),exports[id+"eq"]=makeOp({args:["array"],body:{args:["a"],body:"a="+op+"a"},rvalue:!0,count:2,funcName:id+"eq"})}}();var binary_ops={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var id in binary_ops){var op=binary_ops[id];exports[id]=makeOp({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+op+"c"},funcName:id}),exports[id+"s"]=makeOp({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+op+"s"},funcName:id+"s"}),exports[id+"eq"]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a=a"+op+"b"},rvalue:!0,count:2,funcName:id+"eq"}),exports[id+"seq"]=makeOp({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+op+"s"},rvalue:!0,count:2,funcName:id+"seq"})}}();var math_unary=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var i=0;ithis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),exports.norm1=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),exports.sup=compile({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),exports.inf=compile({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),exports.random=makeOp({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),exports.assign=makeOp({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),exports.assigns=makeOp({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),exports.equals=compile({args:["array","array"],pre:EmptyProc,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":5}],5:[function(require,module,exports){"use strict";function Procedure(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function compileCwise(user_args){var proc=new Procedure;proc.pre=user_args.pre,proc.body=user_args.body,proc.post=user_args.post;var proc_args=user_args.args.slice(0);proc.argTypes=proc_args;for(var i=0;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===arg_type)proc.scalarArgs.push(i),proc.shimArgs.push("scalar"+i);else if("index"===arg_type){if(proc.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===arg_type){if(proc.shapeArgs.push(i),iproc_args.length)throw new Error("cwise: Too many arguments in pre() block");if(proc.body.args.length>proc_args.length)throw new Error("cwise: Too many arguments in body() block");if(proc.post.args.length>proc_args.length)throw new Error("cwise: Too many arguments in post() block");return proc.debug=!!user_args.printCode||!!user_args.debug,proc.funcName=user_args.funcName||"cwise",proc.blockSize=user_args.blockSize||64,createThunk(proc)}var createThunk=require("./lib/thunk.js");module.exports=compileCwise},{"./lib/thunk.js":7}],6:[function(require,module,exports){"use strict";function innerFill(order,proc,body){var i,j,dimension=order.length,nargs=proc.arrayArgs.length,has_index=proc.indexArgs.length>0,code=[],vars=[],idx=0,pidx=0;for(i=0;dimension>i;++i)vars.push(["i",i,"=0"].join(""));for(j=0;nargs>j;++j)for(i=0;dimension>i;++i)pidx=idx,idx=order[i],0===i?vars.push(["d",j,"s",i,"=t",j,"p",idx].join("")):vars.push(["d",j,"s",i,"=(t",j,"p",idx,"-s",pidx,"*t",j,"p",pidx,")"].join(""));for(code.push("var "+vars.join(",")),i=dimension-1;i>=0;--i)idx=order[i],code.push(["for(i",i,"=0;i",i,"i;++i){for(pidx=idx,idx=order[i],j=0;nargs>j;++j)code.push(["p",j,"+=d",j,"s",i].join(""));has_index&&(i>0&&code.push(["index[",pidx,"]-=s",pidx].join("")),code.push(["++index[",idx,"]"].join(""))),code.push("}")}return code.join("\n")}function outerFill(matched,order,proc,body){for(var dimension=order.length,nargs=proc.arrayArgs.length,blockSize=proc.blockSize,has_index=proc.indexArgs.length>0,code=[],i=0;nargs>i;++i)code.push(["var offset",i,"=p",i].join(""));for(var i=matched;dimension>i;++i)code.push(["for(var j"+i+"=SS[",order[i],"]|0;j",i,">0;){"].join("")),code.push(["if(j",i,"<",blockSize,"){"].join("")),code.push(["s",order[i],"=j",i].join("")),code.push(["j",i,"=0"].join("")),code.push(["}else{s",order[i],"=",blockSize].join("")),code.push(["j",i,"-=",blockSize,"}"].join("")),has_index&&code.push(["index[",order[i],"]=j",i].join(""));for(var i=0;nargs>i;++i){for(var indexStr=["offset"+i],j=matched;dimension>j;++j)indexStr.push(["j",j,"*t",i,"p",order[j]].join(""));code.push(["p",i,"=(",indexStr.join("+"),")"].join(""))}code.push(innerFill(order,proc,body));for(var i=matched;dimension>i;++i)code.push("}");return code.join("\n")}function countMatches(orders){for(var matched=0,dimension=orders[0].length;dimension>matched;){for(var j=1;j0&&(allEqual=allEqual&&summary[i]===summary[i-1])}return allEqual?summary[0]:summary.join("")}function generateCWiseOp(proc,typesig){for(var dimension=typesig[1].length-Math.abs(proc.arrayBlockIndices[0])|0,orders=new Array(proc.arrayArgs.length),dtypes=new Array(proc.arrayArgs.length),i=0;ij;++j)vars.push(["s",j,"=SS[",j,"]"].join(""));for(var i=0;ij;++j)vars.push(["t",i,"p",j,"=t",i,"[",loopBegin[i]+j,"]"].join(""));for(var j=0;j0&&vars.push("shape=SS.slice(0)"),proc.indexArgs.length>0){for(var zeros=new Array(dimension),i=0;dimension>i;++i)zeros[i]="0";vars.push(["index=[",zeros.join(","),"]"].join(""))}for(var i=0;i3&&code.push(processBlock(proc.pre,proc,dtypes));var body=processBlock(proc.body,proc,dtypes),matched=countMatches(loopOrders);dimension>matched?code.push(outerFill(matched,loopOrders[0],proc,body)):code.push(innerFill(loopOrders[0],proc,body)),proc.post.body.length>3&&code.push(processBlock(proc.post,proc,dtypes)),proc.debug&&console.log("-----Generated cwise routine for ",typesig,":\n"+code.join("\n")+"\n----------");var loopName=[proc.funcName||"unnamed","_cwise_loop_",orders[0].join("s"),"m",matched,typeSummary(dtypes)].join(""),f=new Function(["function ",loopName,"(",arglist.join(","),"){",code.join("\n"),"} return ",loopName].join(""));
-return f()}var uniq=require("uniq");module.exports=generateCWiseOp},{uniq:8}],7:[function(require,module,exports){"use strict";function createThunk(proc){var code=["'use strict'","var CACHED={}"],vars=[],thunkName=proc.funcName+"_cwise_thunk";code.push(["return function ",thunkName,"(",proc.shimArgs.join(","),"){"].join(""));for(var typesig=[],string_typesig=[],proc_args=[["array",proc.arrayArgs[0],".shape.slice(",Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?","+proc.arrayBlockIndices[0]+")":")"].join("")],shapeLengthConditions=[],shapeConditions=[],i=0;i0&&(shapeLengthConditions.push("array"+proc.arrayArgs[0]+".shape.length===array"+j+".shape.length+"+(Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))),shapeConditions.push("array"+proc.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,proc.arrayBlockIndices[0])+"]===array"+j+".shape[shapeIndex+"+Math.max(0,proc.arrayBlockIndices[i])+"]"))}proc.arrayArgs.length>1&&(code.push("if (!("+shapeLengthConditions.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),code.push("for(var shapeIndex=array"+proc.arrayArgs[0]+".shape.length-"+Math.abs(proc.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),code.push("if (!("+shapeConditions.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),code.push("}"));for(var i=0;ii;++i)if(b=a,a=list[i],compare(a,b)){if(i===ptr){ptr++;continue}list[ptr++]=a}return list.length=ptr,list}function unique_eq(list){for(var ptr=1,len=list.length,a=list[0],b=list[0],i=1;len>i;++i,b=a)if(b=a,a=list[i],a!==b){if(i===ptr){ptr++;continue}list[ptr++]=a}return list.length=ptr,list}function unique(list,compare,sorted){return 0===list.length?list:compare?(sorted||list.sort(compare),unique_pred(list,compare)):(sorted||list.sort(),unique_eq(list))}module.exports=unique},{}],9:[function(require,module,exports){function compare1st(a,b){return a[0]-b[0]}function order(){var i,stride=this.stride,terms=new Array(stride.length);for(i=0;idimension&&(className="View_Nil"+dtype);var useGetters="generic"===dtype;if(-1===dimension){var code="function "+className+"(a){this.data=a;};var proto="+className+".prototype;proto.dtype='"+dtype+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+className+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+className+"(a){return new "+className+"(a);}",procedure=new Function(code);return procedure()}if(0===dimension){var code="function "+className+"(a,d) {this.data = a;this.offset = d};var proto="+className+".prototype;proto.dtype='"+dtype+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+className+"_copy() {return new "+className+"(this.data,this.offset)};proto.pick=function "+className+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+className+"_get(){return "+(useGetters?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+className+"_set(v){return "+(useGetters?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+className+"(a,b,c,d){return new "+className+"(a,d)}",procedure=new Function("TrivialArray",code);return procedure(CACHED_CONSTRUCTORS[dtype][0])}var code=["'use strict'"],indices=iota(dimension),args=indices.map(function(i){return"i"+i}),index_str="this.offset+"+indices.map(function(i){return"this.stride["+i+"]*i"+i}).join("+"),shapeArg=indices.map(function(i){return"b"+i}).join(","),strideArg=indices.map(function(i){return"c"+i}).join(",");code.push("function "+className+"(a,"+shapeArg+","+strideArg+",d){this.data=a","this.shape=["+shapeArg+"]","this.stride=["+strideArg+"]","this.offset=d|0}","var proto="+className+".prototype","proto.dtype='"+dtype+"'","proto.dimension="+dimension),code.push("Object.defineProperty(proto,'size',{get:function "+className+"_size(){return "+indices.map(function(i){return"this.shape["+i+"]"}).join("*"),"}})"),1===dimension?code.push("proto.order=[0]"):(code.push("Object.defineProperty(proto,'order',{get:"),4>dimension?(code.push("function "+className+"_order(){"),2===dimension?code.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===dimension&&code.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):code.push("ORDER})")),code.push("proto.set=function "+className+"_set("+args.join(",")+",v){"),useGetters?code.push("return this.data.set("+index_str+",v)}"):code.push("return this.data["+index_str+"]=v}"),code.push("proto.get=function "+className+"_get("+args.join(",")+"){"),useGetters?code.push("return this.data.get("+index_str+")}"):code.push("return this.data["+index_str+"]}"),code.push("proto.index=function "+className+"_index(",args.join(),"){return "+index_str+"}"),code.push("proto.hi=function "+className+"_hi("+args.join(",")+"){return new "+className+"(this.data,"+indices.map(function(i){return["(typeof i",i,"!=='number'||i",i,"<0)?this.shape[",i,"]:i",i,"|0"].join("")}).join(",")+","+indices.map(function(i){return"this.stride["+i+"]"}).join(",")+",this.offset)}");var a_vars=indices.map(function(i){return"a"+i+"=this.shape["+i+"]"}),c_vars=indices.map(function(i){return"c"+i+"=this.stride["+i+"]"});code.push("proto.lo=function "+className+"_lo("+args.join(",")+"){var b=this.offset,d=0,"+a_vars.join(",")+","+c_vars.join(","));for(var i=0;dimension>i;++i)code.push("if(typeof i"+i+"==='number'&&i"+i+">=0){d=i"+i+"|0;b+=c"+i+"*d;a"+i+"-=d}");code.push("return new "+className+"(this.data,"+indices.map(function(i){return"a"+i}).join(",")+","+indices.map(function(i){return"c"+i}).join(",")+",b)}"),code.push("proto.step=function "+className+"_step("+args.join(",")+"){var "+indices.map(function(i){return"a"+i+"=this.shape["+i+"]"}).join(",")+","+indices.map(function(i){return"b"+i+"=this.stride["+i+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var i=0;dimension>i;++i)code.push("if(typeof i"+i+"==='number'){d=i"+i+"|0;if(d<0){c+=b"+i+"*(a"+i+"-1);a"+i+"=ceil(-a"+i+"/d)}else{a"+i+"=ceil(a"+i+"/d)}b"+i+"*=d}");code.push("return new "+className+"(this.data,"+indices.map(function(i){return"a"+i}).join(",")+","+indices.map(function(i){return"b"+i}).join(",")+",c)}");for(var tShape=new Array(dimension),tStride=new Array(dimension),i=0;dimension>i;++i)tShape[i]="a[i"+i+"]",tStride[i]="b[i"+i+"]";code.push("proto.transpose=function "+className+"_transpose("+args+"){"+args.map(function(n,idx){return n+"=("+n+"===undefined?"+idx+":"+n+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+className+"(this.data,"+tShape.join(",")+","+tStride.join(",")+",this.offset)}"),code.push("proto.pick=function "+className+"_pick("+args+"){var a=[],b=[],c=this.offset");for(var i=0;dimension>i;++i)code.push("if(typeof i"+i+"==='number'&&i"+i+">=0){c=(c+this.stride["+i+"]*i"+i+")|0}else{a.push(this.shape["+i+"]);b.push(this.stride["+i+"])}");code.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),code.push("return function construct_"+className+"(data,shape,stride,offset){return new "+className+"(data,"+indices.map(function(i){return"shape["+i+"]"}).join(",")+","+indices.map(function(i){return"stride["+i+"]"}).join(",")+",offset)}");var procedure=new Function("CTOR_LIST","ORDER",code.join("\n"));return procedure(CACHED_CONSTRUCTORS[dtype],order)}function arrayDType(data){if(isBuffer(data))return"buffer";if(hasTypedArrays)switch(Object.prototype.toString.call(data)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(data)?"array":"generic"}function wrappedNDArrayCtor(data,shape,stride,offset){if(void 0===data){var ctor=CACHED_CONSTRUCTORS.array[0];return ctor([])}"number"==typeof data&&(data=[data]),void 0===shape&&(shape=[data.length]);var d=shape.length;if(void 0===stride){stride=new Array(d);for(var i=d-1,sz=1;i>=0;--i)stride[i]=sz,sz*=shape[i]}if(void 0===offset){offset=0;for(var i=0;d>i;++i)stride[i]<0&&(offset-=(shape[i]-1)*stride[i])}for(var dtype=arrayDType(data),ctor_list=CACHED_CONSTRUCTORS[dtype];ctor_list.length<=d+1;)ctor_list.push(compileConstructor(dtype,ctor_list.length-1));var ctor=ctor_list[d+1];return ctor(data,shape,stride,offset)}var iota=require("iota-array"),isBuffer=require("is-buffer"),hasTypedArrays="undefined"!=typeof Float64Array,CACHED_CONSTRUCTORS={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};module.exports=wrappedNDArrayCtor},{"iota-array":10,"is-buffer":11}],10:[function(require,module,exports){"use strict";function iota(n){for(var result=new Array(n),i=0;n>i;++i)result[i]=i;return result}module.exports=iota},{}],11:[function(require,module,exports){module.exports=function(obj){return!(null==obj||!(obj._isBuffer||obj.constructor&&"function"==typeof obj.constructor.isBuffer&&obj.constructor.isBuffer(obj)))}},{}],12:[function(require,module,exports){"use strict";"use restrict";function countTrailingZeros(v){var c=32;return v&=-v,v&&c--,65535&v&&(c-=16),16711935&v&&(c-=8),252645135&v&&(c-=4),858993459&v&&(c-=2),1431655765&v&&(c-=1),c}var INT_BITS=32;exports.INT_BITS=INT_BITS,exports.INT_MAX=2147483647,exports.INT_MIN=-1<0)-(0>v)},exports.abs=function(v){var mask=v>>INT_BITS-1;return(v^mask)-mask},exports.min=function(x,y){return y^(x^y)&-(y>x)},exports.max=function(x,y){return x^(x^y)&-(y>x)},exports.isPow2=function(v){return!(v&v-1||!v)},exports.log2=function(v){var r,shift;return r=(v>65535)<<4,v>>>=r,shift=(v>255)<<3,v>>>=shift,r|=shift,shift=(v>15)<<2,v>>>=shift,r|=shift,shift=(v>3)<<1,v>>>=shift,r|=shift,r|v>>1},exports.log10=function(v){return v>=1e9?9:v>=1e8?8:v>=1e7?7:v>=1e6?6:v>=1e5?5:v>=1e4?4:v>=1e3?3:v>=100?2:v>=10?1:0},exports.popCount=function(v){return v-=v>>>1&1431655765,v=(858993459&v)+(v>>>2&858993459),16843009*(v+(v>>>4)&252645135)>>>24},exports.countTrailingZeros=countTrailingZeros,exports.nextPow2=function(v){return v+=0===v,--v,v|=v>>>1,v|=v>>>2,v|=v>>>4,v|=v>>>8,v|=v>>>16,v+1},exports.prevPow2=function(v){return v|=v>>>1,v|=v>>>2,v|=v>>>4,v|=v>>>8,v|=v>>>16,v-(v>>>1)},exports.parity=function(v){return v^=v>>>16,v^=v>>>8,v^=v>>>4,v&=15,27030>>>v&1};var REVERSE_TABLE=new Array(256);!function(tab){for(var i=0;256>i;++i){var v=i,r=i,s=7;for(v>>>=1;v;v>>>=1)r<<=1,r|=1&v,--s;tab[i]=r<>>8&255]<<16|REVERSE_TABLE[v>>>16&255]<<8|REVERSE_TABLE[v>>>24&255]},exports.interleave2=function(x,y){return x&=65535,x=16711935&(x|x<<8),x=252645135&(x|x<<4),x=858993459&(x|x<<2),x=1431655765&(x|x<<1),y&=65535,y=16711935&(y|y<<8),y=252645135&(y|y<<4),y=858993459&(y|y<<2),y=1431655765&(y|y<<1),x|y<<1},exports.deinterleave2=function(v,n){return v=v>>>n&1431655765,v=858993459&(v|v>>>1),v=252645135&(v|v>>>2),v=16711935&(v|v>>>4),v=65535&(v|v>>>16),v<<16>>16},exports.interleave3=function(x,y,z){return x&=1023,x=4278190335&(x|x<<16),x=251719695&(x|x<<8),x=3272356035&(x|x<<4),x=1227133513&(x|x<<2),y&=1023,y=4278190335&(y|y<<16),y=251719695&(y|y<<8),y=3272356035&(y|y<<4),y=1227133513&(y|y<<2),x|=y<<1,z&=1023,z=4278190335&(z|z<<16),z=251719695&(z|z<<8),z=3272356035&(z|z<<4),z=1227133513&(z|z<<2),x|z<<2},exports.deinterleave3=function(v,n){return v=v>>>n&1227133513,v=3272356035&(v|v>>>2),v=251719695&(v|v>>>4),v=4278190335&(v|v>>>8),v=1023&(v|v>>>16),v<<22>>22},exports.nextCombination=function(v){var t=v|v-1;return t+1|(~t&-~t)-1>>>countTrailingZeros(v)+1}},{}],13:[function(require,module,exports){"use strict";function dupe_array(count,value,i){var c=0|count[i];if(0>=c)return[];var j,result=new Array(c);if(i===count.length-1)for(j=0;c>j;++j)result[j]=value;else for(j=0;c>j;++j)result[j]=dupe_array(count,value,i+1);return result}function dupe_number(count,value){var result,i;for(result=new Array(count),i=0;count>i;++i)result[i]=value;return result}function dupe(count,value){switch("undefined"==typeof value&&(value=0),typeof count){case"number":if(count>0)return dupe_number(0|count,value);break;case"object":if("number"==typeof count.length)return dupe_array(count,value,0)}return[]}module.exports=dupe},{}],14:[function(require,module,exports){(function(global){"use strict";var bits=require("bit-twiddle"),dup=require("dup");global.__TYPEDARRAY_POOL||(global.__TYPEDARRAY_POOL={UINT8:dup([32,0]),UINT16:dup([32,0]),UINT32:dup([32,0]),INT8:dup([32,0]),INT16:dup([32,0]),INT32:dup([32,0]),FLOAT:dup([32,0]),DOUBLE:dup([32,0]),DATA:dup([32,0])});var POOL=global.__TYPEDARRAY_POOL,UINT8=POOL.UINT8,UINT16=POOL.UINT16,UINT32=POOL.UINT32,INT8=POOL.INT8,INT16=POOL.INT16,INT32=POOL.INT32,FLOAT=POOL.FLOAT,DOUBLE=POOL.DOUBLE,DATA=POOL.DATA;exports.free=function(array){if(array instanceof ArrayBuffer){var n=0|array.byteLength,log_n=bits.log2(n);DATA[log_n].push(array)}else{var n=0|array.length,log_n=bits.log2(n);array instanceof Uint8Array?UINT8[log_n].push(array):array instanceof Uint16Array?UINT16[log_n].push(array):array instanceof Uint32Array?UINT32[log_n].push(array):array instanceof Int8Array?INT8[log_n].push(array):array instanceof Int16Array?INT16[log_n].push(array):array instanceof Int32Array?INT32[log_n].push(array):array instanceof Float32Array?FLOAT[log_n].push(array):array instanceof Float64Array&&DOUBLE[log_n].push(array)}},exports.freeUint8=function(array){UINT8[bits.log2(array.length)].push(array)},exports.freeUint16=function(array){UINT16[bits.log2(array.length)].push(array)},exports.freeUint32=function(array){UINT32[bits.log2(array.length)].push(array)},exports.freeInt8=function(array){INT8[bits.log2(array.length)].push(array)},exports.freeInt16=function(array){INT16[bits.log2(array.length)].push(array)},exports.freeInt32=function(array){INT32[bits.log2(array.length)].push(array)},exports.freeFloat32=exports.freeFloat=function(array){FLOAT[bits.log2(array.length)].push(array)},exports.freeFloat64=exports.freeDouble=function(array){DOUBLE[bits.log2(array.length)].push(array)},exports.freeArrayBuffer=function(array){DATA[bits.log2(array.length)].push(array)},exports.malloc=function(n,dtype){n=bits.nextPow2(n);var log_n=bits.log2(n);if(void 0===dtype){var d=DATA[log_n];if(d.length>0){var r=d[d.length-1];return d.pop(),r}return new ArrayBuffer(n)}switch(dtype){case"uint8":var u8=UINT8[log_n];return u8.length>0?u8.pop():new Uint8Array(n);case"uint16":var u16=UINT16[log_n];return u16.length>0?u16.pop():new Uint16Array(n);case"uint32":var u32=UINT32[log_n];return u32.length>0?u32.pop():new Uint32Array(n);case"int8":var i8=INT8[log_n];return i8.length>0?i8.pop():new Int8Array(n);case"int16":var i16=INT16[log_n];return i16.length>0?i16.pop():new Int16Array(n);case"int32":var i32=INT32[log_n];return i32.length>0?i32.pop():new Int32Array(n);case"float":case"float32":var f=FLOAT[log_n];return f.length>0?f.pop():new Float32Array(n);case"double":case"float64":var dd=DOUBLE[log_n];return dd.length>0?dd.pop():new Float64Array(n);default:return null}return null},exports.mallocUint8=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=UINT8[log_n];return cache.length>0?cache.pop():new Uint8Array(n)},exports.mallocUint16=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=UINT16[log_n];return cache.length>0?cache.pop():new Uint16Array(n)},exports.mallocUint32=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=UINT32[log_n];return cache.length>0?cache.pop():new Uint32Array(n)},exports.mallocInt8=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=INT8[log_n];return cache.length>0?cache.pop():new Int8Array(n)},exports.mallocInt16=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=INT16[log_n];return cache.length>0?cache.pop():new Int16Array(n)},exports.mallocInt32=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=INT32[log_n];return cache.length>0?cache.pop():new Int32Array(n)},exports.mallocFloat32=exports.mallocFloat=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=FLOAT[log_n];return cache.length>0?cache.pop():new Float32Array(n)},exports.mallocFloat64=exports.mallocDouble=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=DOUBLE[log_n];return cache.length>0?cache.pop():new Float64Array(n)},exports.mallocArrayBuffer=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=DATA[log_n];return cache.length>0?cache.pop():new ArrayBuffer(n)},exports.clearCache=function(){for(var i=0;32>i;++i)UINT8[i].length=0,UINT16[i].length=0,UINT32[i].length=0,INT8[i].length=0,INT16[i].length=0,INT32[i].length=0,FLOAT[i].length=0,DOUBLE[i].length=0,DATA[i].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":12,dup:13}],15:[function(require,module,exports){"use strict";function doBind(gl,elements,attributes){elements?elements.bind():gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,null);var nattribs=0|gl.getParameter(gl.MAX_VERTEX_ATTRIBS);if(attributes){if(attributes.length>nattribs)throw new Error("Too many vertex attributes");for(var i=0;ii;++i)gl.disableVertexAttribArray(i)}else{gl.bindBuffer(gl.ARRAY_BUFFER,null);for(var i=0;nattribs>i;++i)gl.disableVertexAttribArray(i)}}module.exports=doBind},{}],16:[function(require,module,exports){"use strict";function VAOEmulated(gl){this.gl=gl,this.elements=null,this.attributes=null}function createVAOEmulated(gl){return new VAOEmulated(gl)}var bindAttribs=require("./do-bind.js");VAOEmulated.prototype.bind=function(){bindAttribs(this.gl,this.elements,this.attributes)},VAOEmulated.prototype.update=function(elements,attributes){this.elements=elements,this.attributes=attributes},VAOEmulated.prototype.dispose=function(){},VAOEmulated.prototype.unbind=function(){},module.exports=createVAOEmulated},{"./do-bind.js":15}],17:[function(require,module,exports){"use strict";function VAONative(gl,ext,handle){this.gl=gl,this.ext=ext,this.handle=handle}function createVAONative(gl,ext){return new VAONative(gl,ext,ext.createVertexArrayOES())}var bindAttribs=require("./do-bind.js");VAONative.prototype.bind=function(){this.ext.bindVertexArrayOES(this.handle)},VAONative.prototype.unbind=function(){this.ext.bindVertexArrayOES(null)},VAONative.prototype.dispose=function(){this.ext.deleteVertexArrayOES(this.handle)},VAONative.prototype.update=function(elements,attributes){this.bind(),bindAttribs(this.gl,elements,attributes),this.unbind()},module.exports=createVAONative},{"./do-bind.js":15}],18:[function(require,module,exports){"use strict";function baseName(ext_name){for(var i=0;ix;x++)for(var y=0;h>y;y++)for(var z=0;d>z;z++)if(filter(x,y,z)){var cube=prism(size,[x/w,y/h,z/d]);cubes.push(cube),cube.centroid=[(x+.5)/w,(y+.5)/h,(z+.5)/d],cube.index=[x,y,z]}return cubes}var prism=require("rectangular-prism"),truthy=function(){return!0};module.exports=cubecube},{"rectangular-prism":26}],25:[function(require,module,exports){module.exports={cells:[[1,0,2],[3,1,2],[4,5,6],[5,7,6],[0,1,5],[4,0,5],[1,3,5],[3,7,5],[2,0,4],[2,4,6],[2,6,3],[6,7,3]],positions:[[0,0,0],[0,0,1],[1,0,0],[1,0,1],[0,1,0],[0,1,1],[1,1,0],[1,1,1]]}},{}],26:[function(require,module,exports){function createPrism(size,pos){pos=pos||[0,0,0],size=size||[1,1,1],Array.isArray(size)||(size=[size,size,size]);for(var prism=clonePrism(),i=0;ii;i+=9){var p1x=verts[i+3]-verts[i],p1y=verts[i+4]-verts[i+1],p1z=verts[i+5]-verts[i+2],p2x=verts[i+6]-verts[i],p2y=verts[i+7]-verts[i+1],p2z=verts[i+8]-verts[i+2],p3x=p1y*p2z-p1z*p2y,p3y=p1z*p2x-p1x*p2z,p3z=p1x*p2y-p1y*p2x,mag=Math.sqrt(p3x*p3x+p3y*p3y+p3z*p3z);0===mag?(output[i]=0,output[i+1]=0,output[i+2]=0,output[i+3]=0,output[i+4]=0,output[i+5]=0,output[i+6]=0,output[i+7]=0,output[i+8]=0):(p3x/=mag,p3y/=mag,p3z/=mag,output[i]=p3x,output[i+1]=p3y,output[i+2]=p3z,output[i+3]=p3x,output[i+4]=p3y,output[i+5]=p3z,output[i+6]=p3x,output[i+7]=p3y,output[i+8]=p3z)}return output}module.exports=faceNormals},{}],28:[function(require,module,exports){(function(process){function debounce(fn,now){function debounced(){null===args&&(args=slice(arguments),ctx=this,now&&fn.apply(ctx,args),raf(next))}function next(){now||fn.apply(ctx,args),args=null,ctx=null}var args=null,ctx=null;return debounced}var slice=require("sliced");if(process.browser)var raf=require("raf-component");else var raf="undefined"!=typeof setImmediate?setImmediate:process.nextTick;module.exports=debounce}).call(this,require("_process"))},{_process:126,"raf-component":29,sliced:30}],29:[function(require,module,exports){function fallback(fn){var curr=(new Date).getTime(),ms=Math.max(0,16-(curr-prev)),req=setTimeout(fn,ms);return prev=curr,req}exports=module.exports=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||fallback;var prev=(new Date).getTime(),cancel=window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.oCancelAnimationFrame||window.msCancelAnimationFrame||window.clearTimeout;exports.cancel=function(id){cancel.call(window,id)}},{}],30:[function(require,module,exports){module.exports=exports=require("./lib/sliced")},{"./lib/sliced":31}],31:[function(require,module,exports){module.exports=function(args,slice,sliceEnd){var ret=[],len=args.length;if(0===len)return ret;var start=0>slice?Math.max(0,slice+len):slice||0;for(void 0!==sliceEnd&&(len=0>sliceEnd?sliceEnd+len:sliceEnd);len-- >start;)ret[len-start]=args[len];return ret}},{}],32:[function(require,module,exports){function defaults(opts){return{color:array(opts.color,[0,0,0,1]),depth:number(opts.depth,1),stencil:number(opts.stencil,!1)}}function number(n,def){return n===!1?!1:"undefined"==typeof n?def:n+0}function array(a,def){return a===!1?!1:Array.isArray(a)?a||def:def}module.exports=defaults},{}],33:[function(require,module,exports){function clear(opts){opts=defaults(opts||{});var stencil=opts.stencil,color=opts.color,depth=opts.depth;return function(gl){var flags=0;return color!==!1&&(gl.clearColor(color[0],color[1],color[2],color[3]),flags|=gl.COLOR_BUFFER_BIT),depth!==!1&&(gl.clearDepth(depth),flags|=gl.DEPTH_BUFFER_BIT),stencil!==!1&&(gl.clearStencil(stencil),flags|=gl.STENCIL_BUFFER_BIT),gl.clear(flags),gl}}var defaults=require("./defaults");module.exports=clear},{"./defaults":32}],34:[function(require,module,exports){function createContext(canvas,opts,render){function tick(){render(gl),raf(tick)}"function"==typeof opts?(render=opts,opts={}):opts=opts||{};var gl=canvas.getContext("webgl",opts)||canvas.getContext("webgl-experimental",opts)||canvas.getContext("experimental-webgl",opts);if(!gl)throw new Error("Unable to initialize WebGL");return render&&raf(tick),gl}var raf=require("raf-component");module.exports=createContext},{"raf-component":35}],35:[function(require,module,exports){arguments[4][29][0].apply(exports,arguments)},{dup:29}],36:[function(require,module,exports){"use strict";function lazyInitColorAttachments(gl,ext){var maxColorAttachments=gl.getParameter(ext.MAX_COLOR_ATTACHMENTS_WEBGL);colorAttachmentArrays=new Array(maxColorAttachments+1);for(var i=0;maxColorAttachments>=i;++i){for(var x=new Array(maxColorAttachments),j=0;i>j;++j)x[j]=gl.COLOR_ATTACHMENT0+j;for(var j=i;maxColorAttachments>j;++j)x[j]=gl.NONE;colorAttachmentArrays[i]=x}}function throwFBOError(status){switch(status){case FRAMEBUFFER_UNSUPPORTED:throw new Error("gl-fbo: Framebuffer unsupported");
-case FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw new Error("gl-fbo: Framebuffer incomplete attachment");case FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function initTexture(gl,width,height,type,format,attachment){if(!type)return null;var result=createTexture(gl,width,height,format,type);return result.magFilter=gl.NEAREST,result.minFilter=gl.NEAREST,result.mipSamples=1,gl.framebufferTexture2D(gl.FRAMEBUFFER,attachment,gl.TEXTURE_2D,result.handle,0),gl.bindTexture(gl.TEXTURE_2D,null),result}function initRenderBuffer(gl,width,height,component,attachment){var result=gl.createRenderbuffer();return gl.bindRenderbuffer(gl.RENDERBUFFER,result),gl.renderbufferStorage(gl.RENDERBUFFER,component,width,height),gl.framebufferRenderbuffer(gl.FRAMEBUFFER,attachment,gl.RENDERBUFFER,result),result}function rebuildFBO(fbo){var gl=fbo.gl,handle=fbo.handle=gl.createFramebuffer(),height=fbo._shape[0],width=fbo._shape[1],numColors=fbo.color.length,ext=fbo._ext,useStencil=fbo._useStencil,useDepth=fbo._useDepth,colorType=fbo._colorType,extensions=webglew(gl);gl.bindFramebuffer(gl.FRAMEBUFFER,handle);for(var i=0;numColors>i;++i)fbo.color[i]=initTexture(gl,width,height,colorType,gl.RGBA,gl.COLOR_ATTACHMENT0+i);0===numColors?(fbo._color_rb=initRenderBuffer(gl,width,height,gl.RGBA4,gl.COLOR_ATTACHMENT0),ext&&ext.drawBuffersWEBGL(colorAttachmentArrays[0])):numColors>1&&ext.drawBuffersWEBGL(colorAttachmentArrays[numColor]),extensions.WEBGL_depth_texture?useStencil?fbo.depth=initTexture(gl,width,height,extensions.WEBGL_depth_texture.UNSIGNED_INT_24_8_WEBGL,gl.DEPTH_STENCIL,gl.DEPTH_STENCIL_ATTACHMENT):useDepth&&(fbo.depth=initTexture(gl,width,height,gl.UNSIGNED_SHORT,gl.DEPTH_COMPONENT,gl.DEPTH_ATTACHMENT)):useDepth&&useStencil?fbo._depth_rb=initRenderBuffer(gl,width,height,gl.DEPTH_STENCIL,gl.DEPTH_STENCIL_ATTACHMENT):useDepth?fbo._depth_rb=initRenderBuffer(gl,width,height,gl.DEPTH_COMPONENT16,gl.DEPTH_ATTACHMENT):useStencil&&(fbo._depth_rb=initRenderBuffer(gl,width,height,gl.STENCIL_INDEX,gl.STENCIL_ATTACHMENT));var status=gl.checkFramebufferStatus(gl.FRAMEBUFFER);if(status!==gl.FRAMEBUFFER_COMPLETE){fbo._destroyed=!0,gl.bindFramebuffer(gl.FRAMEBUFFER,null),gl.deleteFramebuffer(fbo.handle),fbo.handle=null,fbo.depth&&(fbo.depth.dispose(),fbo.depth=null),fbo._depth_rb&&(gl.deleteRenderbuffer(fbo._depth_rb),fbo._depth_rb=null);for(var i=0;iwidth||width>maxFBOSize||0>height||height>maxFBOSize)throw new Error("gl-fbo: Parameters are too large for FBO");options=options||{};var numColors=1;if("color"in options){if(numColors=Math.max(0|options.color,0),0>numColors)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(numColors>1){var mrtext=extensions.WEBGL_draw_buffers;if(!mrtext)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(numColors>gl.getParameter(mrtext.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+numColors+" draw buffers")}}var colorType=gl.UNSIGNED_BYTE;if(options["float"]&&numColors>0){if(!extensions.OES_texture_float)throw new Error("gl-fbo: Context does not support floating point textures");colorType=gl.FLOAT}else options.preferFloat&&numColors>0&&extensions.OES_texture_float&&(colorType=gl.FLOAT);var useDepth=!0;"depth"in options&&(useDepth=!!options.depth);var useStencil=!1;return"stencil"in options&&(useStencil=!!options.stencil),new Framebuffer(gl,width,height,colorType,numColors,useDepth,useStencil,extensions.WEBGL_draw_buffers)}var webglew=require("webglew"),createTexture=require("gl-texture2d");module.exports=createFBO;var FRAMEBUFFER_UNSUPPORTED,FRAMEBUFFER_INCOMPLETE_ATTACHMENT,FRAMEBUFFER_INCOMPLETE_DIMENSIONS,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT,colorAttachmentArrays=null,proto=Framebuffer.prototype;Object.defineProperty(proto,"valid",{get:function(){return!this._destroyed}}),Object.defineProperty(proto,"shape",{get:function(){return this._destroyed?[0,0]:this._shape},set:function(x){if(this._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(!(this._shape[0]===x[0]|0&&this._shape[1]===x[1]|0)){var gl=this.gl,maxFBOSize=gl.getParameter(gl.MAX_RENDERBUFFER_SIZE);if(!Array.isArray(x)||2!==x.length||x[0]<0||x[0]>maxFBOSize||x[1]<0||x[1]>maxFBOSize)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");this._shape[0]=0|x[0],this._shape[1]=0|x[1];for(var i=0;i=0?values[index]:opt_default)}function has___(key){var hiddenRecord=getHiddenRecord(key);return hiddenRecord?id in hiddenRecord:keys.indexOf(key)>=0}function set___(key,value){var index,hiddenRecord=getHiddenRecord(key);return hiddenRecord?hiddenRecord[id]=value:(index=keys.indexOf(key),index>=0?values[index]=value:(index=keys.length,values[index]=value,keys[index]=key)),this}function delete___(key){var index,lastIndex,hiddenRecord=getHiddenRecord(key);return hiddenRecord?id in hiddenRecord&&delete hiddenRecord[id]:(index=keys.indexOf(key),0>index?!1:(lastIndex=keys.length-1,keys[index]=void 0,values[index]=values[lastIndex],keys[index]=keys[lastIndex],keys.length=lastIndex,values.length=lastIndex,!0))}this instanceof OurWeakMap||calledAsFunctionWarning();var keys=[],values=[],id=nextId++;return Object.create(OurWeakMap.prototype,{get___:{value:constFunc(get___)},has___:{value:constFunc(has___)},set___:{value:constFunc(set___)},delete___:{value:constFunc(delete___)}})};OurWeakMap.prototype=Object.create(Object.prototype,{get:{value:function(key,opt_default){return this.get___(key,opt_default)},writable:!0,configurable:!0},has:{value:function(key){return this.has___(key)},writable:!0,configurable:!0},set:{value:function(key,value){return this.set___(key,value)},writable:!0,configurable:!0},"delete":{value:function(key){return this.delete___(key)},writable:!0,configurable:!0}}),"function"==typeof HostWeakMap?!function(){function DoubleWeakMap(){function dget(key,opt_default){return omap?hmap.has(key)?hmap.get(key):omap.get___(key,opt_default):hmap.get(key,opt_default)}function dhas(key){return hmap.has(key)||(omap?omap.has___(key):!1)}function ddelete(key){var result=!!hmap["delete"](key);return omap?omap.delete___(key)||result:result}this instanceof OurWeakMap||calledAsFunctionWarning();var dset,hmap=new HostWeakMap,omap=void 0,enableSwitching=!1;return dset=doubleWeakMapCheckSilentFailure?function(key,value){return hmap.set(key,value),hmap.has(key)||(omap||(omap=new OurWeakMap),omap.set(key,value)),this}:function(key,value){if(enableSwitching)try{hmap.set(key,value)}catch(e){omap||(omap=new OurWeakMap),omap.set___(key,value)}else hmap.set(key,value);return this},Object.create(OurWeakMap.prototype,{get___:{value:constFunc(dget)},has___:{value:constFunc(dhas)},set___:{value:constFunc(dset)},delete___:{value:constFunc(ddelete)},permitHostObjects___:{value:constFunc(function(token){if(token!==weakMapPermitHostObjects)throw new Error("bogus call to permitHostObjects___");enableSwitching=!0})}})}doubleWeakMapCheckSilentFailure&&"undefined"!=typeof Proxy&&(Proxy=void 0),DoubleWeakMap.prototype=OurWeakMap.prototype,module.exports=DoubleWeakMap,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),module.exports=OurWeakMap)}}()},{}],38:[function(require,module,exports){"use strict";function baseName(ext_name){return ext_name.replace(/^[A-Z]+_/,"")}function initWebGLEW(gl){var struct=WebGLEWStruct.get(gl);if(struct)return struct;for(var extensions={},supported=gl.getSupportedExtensions(),i=0;ij;j++)out[k++]=arr[i][j];return out}var dtype=require("dtype");module.exports=pack},{dtype:41}],41:[function(require,module,exports){(function(Buffer){module.exports=function(dtype){switch(dtype){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray;case"generic":case"data":case"dataview":return ArrayBuffer;case"buffer":return"undefined"==typeof Buffer?ArrayBuffer:Buffer}}}).call(this,require("buffer").Buffer)},{buffer:122}],42:[function(require,module,exports){module.exports=function(dtype){switch(dtype){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array}}},{}],43:[function(require,module,exports){"use strict";function GLBuffer(gl,type,handle,length,usage){this.gl=gl,this.type=type,this.handle=handle,this.length=length,this.usage=usage}function updateTypeArray(gl,type,len,usage,data,offset){var dataLen=data.length*data.BYTES_PER_ELEMENT;if(0>offset)return gl.bufferData(type,data,usage),dataLen;if(dataLen+offset>len)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return gl.bufferSubData(type,offset,data),len}function makeScratchTypeArray(array,dtype){for(var res=pool.malloc(array.length,dtype),n=array.length,i=0;n>i;++i)res[i]=array[i];return res}function isPacked(shape,stride){for(var n=1,i=stride.length-1;i>=0;--i){if(stride[i]!==n)return!1;n*=shape[i]}return!0}function createBuffer(gl,data,type,usage){if(type=type||gl.ARRAY_BUFFER,usage=usage||gl.DYNAMIC_DRAW,type!==gl.ARRAY_BUFFER&&type!==gl.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(usage!==gl.DYNAMIC_DRAW&&usage!==gl.STATIC_DRAW&&usage!==gl.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var handle=gl.createBuffer(),result=new GLBuffer(gl,type,handle,0,usage);return result.update(data),result}var pool=require("typedarray-pool"),ops=require("ndarray-ops"),ndarray=require("ndarray"),SUPPORTED_TYPES=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],proto=GLBuffer.prototype;proto.bind=function(){this.gl.bindBuffer(this.type,this.handle)},proto.unbind=function(){this.gl.bindBuffer(this.type,null)},proto.dispose=function(){this.gl.deleteBuffer(this.handle)},proto.update=function(array,offset){if("number"!=typeof offset&&(offset=-1),this.bind(),"object"==typeof array&&"undefined"!=typeof array.shape){var dtype=array.dtype;if(SUPPORTED_TYPES.indexOf(dtype)<0&&(dtype="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){var ext=gl.getExtension("OES_element_index_uint");dtype=ext&&"uint16"!==dtype?"uint32":"uint16"}if(dtype===array.dtype&&isPacked(array.shape,array.stride))0===array.offset&&array.data.length===array.shape[0]?this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data,offset):this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data.subarray(array.offset,array.shape[0]),offset);else{var tmp=pool.malloc(array.size,dtype),ndt=ndarray(tmp,array.shape);ops.assign(ndt,array),0>offset?this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,tmp,offset):this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,tmp.subarray(0,array.size),offset),pool.free(tmp)}}else if(Array.isArray(array)){var t;t=this.type===this.gl.ELEMENT_ARRAY_BUFFER?makeScratchTypeArray(array,"uint16"):makeScratchTypeArray(array,"float32"),0>offset?this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,t,offset):this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,t.subarray(0,array.length),offset),pool.free(t)}else if("object"==typeof array&&"number"==typeof array.length)this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array,offset);else{if("number"!=typeof array&&void 0!==array)throw new Error("gl-buffer: Invalid data type");if(offset>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");array=0|array,0>=array&&(array=1),this.gl.bufferData(this.type,0|array,this.usage),this.length=array}},module.exports=createBuffer},{ndarray:49,"ndarray-ops":44,"typedarray-pool":54}],44:[function(require,module,exports){arguments[4][4][0].apply(exports,arguments)},{"cwise-compiler":45,dup:4}],45:[function(require,module,exports){arguments[4][5][0].apply(exports,arguments)},{"./lib/thunk.js":47,dup:5}],46:[function(require,module,exports){arguments[4][6][0].apply(exports,arguments)},{dup:6,uniq:48}],47:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{"./compile.js":46,dup:7}],48:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],49:[function(require,module,exports){arguments[4][9][0].apply(exports,arguments)},{dup:9,"iota-array":50,"is-buffer":51}],50:[function(require,module,exports){arguments[4][10][0].apply(exports,arguments)},{dup:10}],51:[function(require,module,exports){arguments[4][11][0].apply(exports,arguments)},{dup:11}],52:[function(require,module,exports){arguments[4][12][0].apply(exports,arguments)},{dup:12}],53:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],54:[function(require,module,exports){(function(global,Buffer){"use strict";function freeArrayBuffer(buffer){if(buffer){var n=buffer.length||buffer.byteLength,log_n=bits.log2(n);DATA[log_n].push(buffer)}}function freeTypedArray(array){freeArrayBuffer(array.buffer)}function mallocArrayBuffer(n){var n=bits.nextPow2(n),log_n=bits.log2(n),d=DATA[log_n];return d.length>0?d.pop():new ArrayBuffer(n)}function mallocUint8(n){return new Uint8Array(mallocArrayBuffer(n),0,n)}function mallocUint16(n){return new Uint16Array(mallocArrayBuffer(2*n),0,n)}function mallocUint32(n){return new Uint32Array(mallocArrayBuffer(4*n),0,n)}function mallocInt8(n){return new Int8Array(mallocArrayBuffer(n),0,n)}function mallocInt16(n){return new Int16Array(mallocArrayBuffer(2*n),0,n)}function mallocInt32(n){return new Int32Array(mallocArrayBuffer(4*n),0,n)}function mallocFloat(n){return new Float32Array(mallocArrayBuffer(4*n),0,n)}function mallocDouble(n){return new Float64Array(mallocArrayBuffer(8*n),0,n)}function mallocUint8Clamped(n){return hasUint8C?new Uint8ClampedArray(mallocArrayBuffer(n),0,n):mallocUint8(n)}function mallocDataView(n){return new DataView(mallocArrayBuffer(n),0,n)}function mallocBuffer(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=BUFFER[log_n];return cache.length>0?cache.pop():new Buffer(n)}var bits=require("bit-twiddle"),dup=require("dup");global.__TYPEDARRAY_POOL||(global.__TYPEDARRAY_POOL={UINT8:dup([32,0]),UINT16:dup([32,0]),UINT32:dup([32,0]),INT8:dup([32,0]),INT16:dup([32,0]),INT32:dup([32,0]),FLOAT:dup([32,0]),DOUBLE:dup([32,0]),DATA:dup([32,0]),UINT8C:dup([32,0]),BUFFER:dup([32,0])});var hasUint8C="undefined"!=typeof Uint8ClampedArray,POOL=global.__TYPEDARRAY_POOL;POOL.UINT8C||(POOL.UINT8C=dup([32,0])),POOL.BUFFER||(POOL.BUFFER=dup([32,0]));var DATA=POOL.DATA,BUFFER=POOL.BUFFER;exports.free=function(array){if(Buffer.isBuffer(array))BUFFER[bits.log2(array.length)].push(array);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(array)&&(array=array.buffer),!array)return;var n=array.length||array.byteLength,log_n=0|bits.log2(n);DATA[log_n].push(array)}},exports.freeUint8=exports.freeUint16=exports.freeUint32=exports.freeInt8=exports.freeInt16=exports.freeInt32=exports.freeFloat32=exports.freeFloat=exports.freeFloat64=exports.freeDouble=exports.freeUint8Clamped=exports.freeDataView=freeTypedArray,exports.freeArrayBuffer=freeArrayBuffer,exports.freeBuffer=function(array){BUFFER[bits.log2(array.length)].push(array)},exports.malloc=function(n,dtype){if(void 0===dtype||"arraybuffer"===dtype)return mallocArrayBuffer(n);switch(dtype){case"uint8":return mallocUint8(n);case"uint16":return mallocUint16(n);case"uint32":return mallocUint32(n);case"int8":return mallocInt8(n);case"int16":return mallocInt16(n);case"int32":return mallocInt32(n);case"float":case"float32":return mallocFloat(n);case"double":case"float64":return mallocDouble(n);case"uint8_clamped":return mallocUint8Clamped(n);case"buffer":return mallocBuffer(n);case"data":case"dataview":return mallocDataView(n);default:return null}return null},exports.mallocArrayBuffer=mallocArrayBuffer,exports.mallocUint8=mallocUint8,exports.mallocUint16=mallocUint16,exports.mallocUint32=mallocUint32,exports.mallocInt8=mallocInt8,exports.mallocInt16=mallocInt16,exports.mallocInt32=mallocInt32,exports.mallocFloat32=exports.mallocFloat=mallocFloat,exports.mallocFloat64=exports.mallocDouble=mallocDouble,exports.mallocUint8Clamped=mallocUint8Clamped,exports.mallocDataView=mallocDataView,exports.mallocBuffer=mallocBuffer,exports.clearCache=function(){for(var i=0;32>i;++i)POOL.UINT8[i].length=0,POOL.UINT16[i].length=0,POOL.UINT32[i].length=0,POOL.INT8[i].length=0,POOL.INT16[i].length=0,POOL.INT32[i].length=0,POOL.FLOAT[i].length=0,POOL.DOUBLE[i].length=0,POOL.UINT8C[i].length=0,DATA[i].length=0,BUFFER[i].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer)},{"bit-twiddle":52,buffer:122,dup:53}],55:[function(require,module,exports){"use strict";function doBind(gl,elements,attributes){elements?elements.bind():gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,null);var nattribs=0|gl.getParameter(gl.MAX_VERTEX_ATTRIBS);if(attributes){if(attributes.length>nattribs)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;ii;++i)gl.disableVertexAttribArray(i)}else{gl.bindBuffer(gl.ARRAY_BUFFER,null);for(var i=0;nattribs>i;++i)gl.disableVertexAttribArray(i)}}module.exports=doBind},{}],56:[function(require,module,exports){"use strict";function VAOEmulated(gl){this.gl=gl,this._elements=null,this._attributes=null,this._elementsType=gl.UNSIGNED_SHORT}function createVAOEmulated(gl){return new VAOEmulated(gl)}var bindAttribs=require("./do-bind.js");VAOEmulated.prototype.bind=function(){bindAttribs(this.gl,this._elements,this._attributes)},VAOEmulated.prototype.update=function(attributes,elements,elementsType){this._elements=elements,this._attributes=attributes,this._elementsType=elementsType||this.gl.UNSIGNED_SHORT},VAOEmulated.prototype.dispose=function(){},VAOEmulated.prototype.unbind=function(){},VAOEmulated.prototype.draw=function(mode,count,offset){offset=offset||0;var gl=this.gl;this._elements?gl.drawElements(mode,count,this._elementsType,offset):gl.drawArrays(mode,offset,count)},module.exports=createVAOEmulated},{"./do-bind.js":55}],57:[function(require,module,exports){"use strict";function VertexAttribute(location,dimension,a,b,c,d){this.location=location,this.dimension=dimension,this.a=a,this.b=b,this.c=c,this.d=d}function VAONative(gl,ext,handle){this.gl=gl,this._ext=ext,this.handle=handle,this._attribs=[],this._useElements=!1,this._elementsType=gl.UNSIGNED_SHORT}function createVAONative(gl,ext){return new VAONative(gl,ext,ext.createVertexArrayOES())}var bindAttribs=require("./do-bind.js");VertexAttribute.prototype.bind=function(gl){switch(this.dimension){case 1:gl.vertexAttrib1f(this.location,this.a);break;case 2:gl.vertexAttrib2f(this.location,this.a,this.b);break;case 3:gl.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:gl.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d)}},VAONative.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var i=0;idot?(vec3.cross(tmpvec3,xUnitVec3,a),vec3.length(tmpvec3)<1e-6&&vec3.cross(tmpvec3,yUnitVec3,a),vec3.normalize(tmpvec3,tmpvec3),quat.setAxisAngle(out,tmpvec3,Math.PI),out):dot>.999999?(out[0]=0,out[1]=0,out[2]=0,out[3]=1,out):(vec3.cross(tmpvec3,a,b),out[0]=tmpvec3[0],out[1]=tmpvec3[1],out[2]=tmpvec3[2],out[3]=1+dot,quat.normalize(out,out))}}(),quat.setAxes=function(){var matr=mat3.create();return function(out,view,right,up){return matr[0]=right[0],matr[3]=right[1],matr[6]=right[2],matr[1]=up[0],matr[4]=up[1],matr[7]=up[2],matr[2]=-view[0],matr[5]=-view[1],matr[8]=-view[2],quat.normalize(out,quat.fromMat3(out,matr))}}(),quat.clone=vec4.clone,quat.fromValues=vec4.fromValues,quat.copy=vec4.copy,quat.set=vec4.set,quat.identity=function(out){return out[0]=0,out[1]=0,out[2]=0,out[3]=1,out},quat.setAxisAngle=function(out,axis,rad){rad=.5*rad;var s=Math.sin(rad);return out[0]=s*axis[0],out[1]=s*axis[1],out[2]=s*axis[2],out[3]=Math.cos(rad),out},quat.add=vec4.add,quat.multiply=function(out,a,b){var ax=a[0],ay=a[1],az=a[2],aw=a[3],bx=b[0],by=b[1],bz=b[2],bw=b[3];return out[0]=ax*bw+aw*bx+ay*bz-az*by,out[1]=ay*bw+aw*by+az*bx-ax*bz,out[2]=az*bw+aw*bz+ax*by-ay*bx,out[3]=aw*bw-ax*bx-ay*by-az*bz,out},quat.mul=quat.multiply,quat.scale=vec4.scale,quat.rotateX=function(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3],bx=Math.sin(rad),bw=Math.cos(rad);return out[0]=ax*bw+aw*bx,out[1]=ay*bw+az*bx,out[2]=az*bw-ay*bx,out[3]=aw*bw-ax*bx,out},quat.rotateY=function(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3],by=Math.sin(rad),bw=Math.cos(rad);return out[0]=ax*bw-az*by,out[1]=ay*bw+aw*by,out[2]=az*bw+ax*by,out[3]=aw*bw-ay*by,out},quat.rotateZ=function(out,a,rad){rad*=.5;var ax=a[0],ay=a[1],az=a[2],aw=a[3],bz=Math.sin(rad),bw=Math.cos(rad);return out[0]=ax*bw+ay*bz,out[1]=ay*bw-ax*bz,out[2]=az*bw+aw*bz,out[3]=aw*bw-az*bz,out},quat.calculateW=function(out,a){var x=a[0],y=a[1],z=a[2];return out[0]=x,out[1]=y,out[2]=z,out[3]=Math.sqrt(Math.abs(1-x*x-y*y-z*z)),out},quat.dot=vec4.dot,quat.lerp=vec4.lerp,quat.slerp=function(out,a,b,t){var omega,cosom,sinom,scale0,scale1,ax=a[0],ay=a[1],az=a[2],aw=a[3],bx=b[0],by=b[1],bz=b[2],bw=b[3];return cosom=ax*bx+ay*by+az*bz+aw*bw,0>cosom&&(cosom=-cosom,bx=-bx,by=-by,bz=-bz,bw=-bw),1-cosom>1e-6?(omega=Math.acos(cosom),sinom=Math.sin(omega),scale0=Math.sin((1-t)*omega)/sinom,scale1=Math.sin(t*omega)/sinom):(scale0=1-t,scale1=t),out[0]=scale0*ax+scale1*bx,out[1]=scale0*ay+scale1*by,out[2]=scale0*az+scale1*bz,out[3]=scale0*aw+scale1*bw,out},quat.sqlerp=function(){var temp1=quat.create(),temp2=quat.create();return function(out,a,b,c,d,t){return quat.slerp(temp1,a,d,t),quat.slerp(temp2,b,c,t),quat.slerp(out,temp1,temp2,2*t*(1-t)),out}}(),quat.invert=function(out,a){var a0=a[0],a1=a[1],a2=a[2],a3=a[3],dot=a0*a0+a1*a1+a2*a2+a3*a3,invDot=dot?1/dot:0;return out[0]=-a0*invDot,out[1]=-a1*invDot,out[2]=-a2*invDot,out[3]=a3*invDot,out},quat.conjugate=function(out,a){return out[0]=-a[0],out[1]=-a[1],out[2]=-a[2],out[3]=a[3],out},quat.length=vec4.length,quat.len=quat.length,quat.squaredLength=vec4.squaredLength,quat.sqrLen=quat.squaredLength,quat.normalize=vec4.normalize,quat.fromMat3=function(out,m){var fRoot,fTrace=m[0]+m[4]+m[8];if(fTrace>0)fRoot=Math.sqrt(fTrace+1),out[3]=.5*fRoot,fRoot=.5/fRoot,out[0]=(m[5]-m[7])*fRoot,out[1]=(m[6]-m[2])*fRoot,out[2]=(m[1]-m[3])*fRoot;else{var i=0;m[4]>m[0]&&(i=1),m[8]>m[3*i+i]&&(i=2);var j=(i+1)%3,k=(i+2)%3;fRoot=Math.sqrt(m[3*i+i]-m[3*j+j]-m[3*k+k]+1),out[i]=.5*fRoot,fRoot=.5/fRoot,out[3]=(m[3*j+k]-m[3*k+j])*fRoot,out[j]=(m[3*j+i]+m[3*i+j])*fRoot,out[k]=(m[3*k+i]+m[3*i+k])*fRoot}return out},quat.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"},module.exports=quat},{"./common.js":63,"./mat3.js":66,"./vec3.js":70,"./vec4.js":71}],69:[function(require,module,exports){var glMatrix=require("./common.js"),vec2={};vec2.create=function(){var out=new glMatrix.ARRAY_TYPE(2);return out[0]=0,out[1]=0,out},vec2.clone=function(a){var out=new glMatrix.ARRAY_TYPE(2);return out[0]=a[0],out[1]=a[1],out},vec2.fromValues=function(x,y){var out=new glMatrix.ARRAY_TYPE(2);return out[0]=x,out[1]=y,out},vec2.copy=function(out,a){return out[0]=a[0],out[1]=a[1],out},vec2.set=function(out,x,y){return out[0]=x,out[1]=y,out},vec2.add=function(out,a,b){return out[0]=a[0]+b[0],out[1]=a[1]+b[1],out},vec2.subtract=function(out,a,b){return out[0]=a[0]-b[0],out[1]=a[1]-b[1],out},vec2.sub=vec2.subtract,vec2.multiply=function(out,a,b){return out[0]=a[0]*b[0],out[1]=a[1]*b[1],out},vec2.mul=vec2.multiply,vec2.divide=function(out,a,b){return out[0]=a[0]/b[0],out[1]=a[1]/b[1],out},vec2.div=vec2.divide,vec2.min=function(out,a,b){return out[0]=Math.min(a[0],b[0]),out[1]=Math.min(a[1],b[1]),out},vec2.max=function(out,a,b){return out[0]=Math.max(a[0],b[0]),out[1]=Math.max(a[1],b[1]),out},vec2.scale=function(out,a,b){return out[0]=a[0]*b,out[1]=a[1]*b,out},vec2.scaleAndAdd=function(out,a,b,scale){return out[0]=a[0]+b[0]*scale,out[1]=a[1]+b[1]*scale,out},vec2.distance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1];return Math.sqrt(x*x+y*y)},vec2.dist=vec2.distance,vec2.squaredDistance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1];return x*x+y*y},vec2.sqrDist=vec2.squaredDistance,vec2.length=function(a){var x=a[0],y=a[1];return Math.sqrt(x*x+y*y)},vec2.len=vec2.length,vec2.squaredLength=function(a){var x=a[0],y=a[1];return x*x+y*y},vec2.sqrLen=vec2.squaredLength,vec2.negate=function(out,a){return out[0]=-a[0],out[1]=-a[1],out},vec2.inverse=function(out,a){return out[0]=1/a[0],out[1]=1/a[1],out},vec2.normalize=function(out,a){var x=a[0],y=a[1],len=x*x+y*y;return len>0&&(len=1/Math.sqrt(len),out[0]=a[0]*len,out[1]=a[1]*len),
-out},vec2.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]},vec2.cross=function(out,a,b){var z=a[0]*b[1]-a[1]*b[0];return out[0]=out[1]=0,out[2]=z,out},vec2.lerp=function(out,a,b,t){var ax=a[0],ay=a[1];return out[0]=ax+t*(b[0]-ax),out[1]=ay+t*(b[1]-ay),out},vec2.random=function(out,scale){scale=scale||1;var r=2*glMatrix.RANDOM()*Math.PI;return out[0]=Math.cos(r)*scale,out[1]=Math.sin(r)*scale,out},vec2.transformMat2=function(out,a,m){var x=a[0],y=a[1];return out[0]=m[0]*x+m[2]*y,out[1]=m[1]*x+m[3]*y,out},vec2.transformMat2d=function(out,a,m){var x=a[0],y=a[1];return out[0]=m[0]*x+m[2]*y+m[4],out[1]=m[1]*x+m[3]*y+m[5],out},vec2.transformMat3=function(out,a,m){var x=a[0],y=a[1];return out[0]=m[0]*x+m[3]*y+m[6],out[1]=m[1]*x+m[4]*y+m[7],out},vec2.transformMat4=function(out,a,m){var x=a[0],y=a[1];return out[0]=m[0]*x+m[4]*y+m[12],out[1]=m[1]*x+m[5]*y+m[13],out},vec2.forEach=function(){var vec=vec2.create();return function(a,stride,offset,count,fn,arg){var i,l;for(stride||(stride=2),offset||(offset=0),l=count?Math.min(count*stride+offset,a.length):a.length,i=offset;l>i;i+=stride)vec[0]=a[i],vec[1]=a[i+1],fn(vec,vec,arg),a[i]=vec[0],a[i+1]=vec[1];return a}}(),vec2.str=function(a){return"vec2("+a[0]+", "+a[1]+")"},module.exports=vec2},{"./common.js":63}],70:[function(require,module,exports){var glMatrix=require("./common.js"),vec3={};vec3.create=function(){var out=new glMatrix.ARRAY_TYPE(3);return out[0]=0,out[1]=0,out[2]=0,out},vec3.clone=function(a){var out=new glMatrix.ARRAY_TYPE(3);return out[0]=a[0],out[1]=a[1],out[2]=a[2],out},vec3.fromValues=function(x,y,z){var out=new glMatrix.ARRAY_TYPE(3);return out[0]=x,out[1]=y,out[2]=z,out},vec3.copy=function(out,a){return out[0]=a[0],out[1]=a[1],out[2]=a[2],out},vec3.set=function(out,x,y,z){return out[0]=x,out[1]=y,out[2]=z,out},vec3.add=function(out,a,b){return out[0]=a[0]+b[0],out[1]=a[1]+b[1],out[2]=a[2]+b[2],out},vec3.subtract=function(out,a,b){return out[0]=a[0]-b[0],out[1]=a[1]-b[1],out[2]=a[2]-b[2],out},vec3.sub=vec3.subtract,vec3.multiply=function(out,a,b){return out[0]=a[0]*b[0],out[1]=a[1]*b[1],out[2]=a[2]*b[2],out},vec3.mul=vec3.multiply,vec3.divide=function(out,a,b){return out[0]=a[0]/b[0],out[1]=a[1]/b[1],out[2]=a[2]/b[2],out},vec3.div=vec3.divide,vec3.min=function(out,a,b){return out[0]=Math.min(a[0],b[0]),out[1]=Math.min(a[1],b[1]),out[2]=Math.min(a[2],b[2]),out},vec3.max=function(out,a,b){return out[0]=Math.max(a[0],b[0]),out[1]=Math.max(a[1],b[1]),out[2]=Math.max(a[2],b[2]),out},vec3.scale=function(out,a,b){return out[0]=a[0]*b,out[1]=a[1]*b,out[2]=a[2]*b,out},vec3.scaleAndAdd=function(out,a,b,scale){return out[0]=a[0]+b[0]*scale,out[1]=a[1]+b[1]*scale,out[2]=a[2]+b[2]*scale,out},vec3.distance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2];return Math.sqrt(x*x+y*y+z*z)},vec3.dist=vec3.distance,vec3.squaredDistance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2];return x*x+y*y+z*z},vec3.sqrDist=vec3.squaredDistance,vec3.length=function(a){var x=a[0],y=a[1],z=a[2];return Math.sqrt(x*x+y*y+z*z)},vec3.len=vec3.length,vec3.squaredLength=function(a){var x=a[0],y=a[1],z=a[2];return x*x+y*y+z*z},vec3.sqrLen=vec3.squaredLength,vec3.negate=function(out,a){return out[0]=-a[0],out[1]=-a[1],out[2]=-a[2],out},vec3.inverse=function(out,a){return out[0]=1/a[0],out[1]=1/a[1],out[2]=1/a[2],out},vec3.normalize=function(out,a){var x=a[0],y=a[1],z=a[2],len=x*x+y*y+z*z;return len>0&&(len=1/Math.sqrt(len),out[0]=a[0]*len,out[1]=a[1]*len,out[2]=a[2]*len),out},vec3.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]},vec3.cross=function(out,a,b){var ax=a[0],ay=a[1],az=a[2],bx=b[0],by=b[1],bz=b[2];return out[0]=ay*bz-az*by,out[1]=az*bx-ax*bz,out[2]=ax*by-ay*bx,out},vec3.lerp=function(out,a,b,t){var ax=a[0],ay=a[1],az=a[2];return out[0]=ax+t*(b[0]-ax),out[1]=ay+t*(b[1]-ay),out[2]=az+t*(b[2]-az),out},vec3.hermite=function(out,a,b,c,d,t){var factorTimes2=t*t,factor1=factorTimes2*(2*t-3)+1,factor2=factorTimes2*(t-2)+t,factor3=factorTimes2*(t-1),factor4=factorTimes2*(3-2*t);return out[0]=a[0]*factor1+b[0]*factor2+c[0]*factor3+d[0]*factor4,out[1]=a[1]*factor1+b[1]*factor2+c[1]*factor3+d[1]*factor4,out[2]=a[2]*factor1+b[2]*factor2+c[2]*factor3+d[2]*factor4,out},vec3.bezier=function(out,a,b,c,d,t){var inverseFactor=1-t,inverseFactorTimesTwo=inverseFactor*inverseFactor,factorTimes2=t*t,factor1=inverseFactorTimesTwo*inverseFactor,factor2=3*t*inverseFactorTimesTwo,factor3=3*factorTimes2*inverseFactor,factor4=factorTimes2*t;return out[0]=a[0]*factor1+b[0]*factor2+c[0]*factor3+d[0]*factor4,out[1]=a[1]*factor1+b[1]*factor2+c[1]*factor3+d[1]*factor4,out[2]=a[2]*factor1+b[2]*factor2+c[2]*factor3+d[2]*factor4,out},vec3.random=function(out,scale){scale=scale||1;var r=2*glMatrix.RANDOM()*Math.PI,z=2*glMatrix.RANDOM()-1,zScale=Math.sqrt(1-z*z)*scale;return out[0]=Math.cos(r)*zScale,out[1]=Math.sin(r)*zScale,out[2]=z*scale,out},vec3.transformMat4=function(out,a,m){var x=a[0],y=a[1],z=a[2],w=m[3]*x+m[7]*y+m[11]*z+m[15];return w=w||1,out[0]=(m[0]*x+m[4]*y+m[8]*z+m[12])/w,out[1]=(m[1]*x+m[5]*y+m[9]*z+m[13])/w,out[2]=(m[2]*x+m[6]*y+m[10]*z+m[14])/w,out},vec3.transformMat3=function(out,a,m){var x=a[0],y=a[1],z=a[2];return out[0]=x*m[0]+y*m[3]+z*m[6],out[1]=x*m[1]+y*m[4]+z*m[7],out[2]=x*m[2]+y*m[5]+z*m[8],out},vec3.transformQuat=function(out,a,q){var x=a[0],y=a[1],z=a[2],qx=q[0],qy=q[1],qz=q[2],qw=q[3],ix=qw*x+qy*z-qz*y,iy=qw*y+qz*x-qx*z,iz=qw*z+qx*y-qy*x,iw=-qx*x-qy*y-qz*z;return out[0]=ix*qw+iw*-qx+iy*-qz-iz*-qy,out[1]=iy*qw+iw*-qy+iz*-qx-ix*-qz,out[2]=iz*qw+iw*-qz+ix*-qy-iy*-qx,out},vec3.rotateX=function(out,a,b,c){var p=[],r=[];return p[0]=a[0]-b[0],p[1]=a[1]-b[1],p[2]=a[2]-b[2],r[0]=p[0],r[1]=p[1]*Math.cos(c)-p[2]*Math.sin(c),r[2]=p[1]*Math.sin(c)+p[2]*Math.cos(c),out[0]=r[0]+b[0],out[1]=r[1]+b[1],out[2]=r[2]+b[2],out},vec3.rotateY=function(out,a,b,c){var p=[],r=[];return p[0]=a[0]-b[0],p[1]=a[1]-b[1],p[2]=a[2]-b[2],r[0]=p[2]*Math.sin(c)+p[0]*Math.cos(c),r[1]=p[1],r[2]=p[2]*Math.cos(c)-p[0]*Math.sin(c),out[0]=r[0]+b[0],out[1]=r[1]+b[1],out[2]=r[2]+b[2],out},vec3.rotateZ=function(out,a,b,c){var p=[],r=[];return p[0]=a[0]-b[0],p[1]=a[1]-b[1],p[2]=a[2]-b[2],r[0]=p[0]*Math.cos(c)-p[1]*Math.sin(c),r[1]=p[0]*Math.sin(c)+p[1]*Math.cos(c),r[2]=p[2],out[0]=r[0]+b[0],out[1]=r[1]+b[1],out[2]=r[2]+b[2],out},vec3.forEach=function(){var vec=vec3.create();return function(a,stride,offset,count,fn,arg){var i,l;for(stride||(stride=3),offset||(offset=0),l=count?Math.min(count*stride+offset,a.length):a.length,i=offset;l>i;i+=stride)vec[0]=a[i],vec[1]=a[i+1],vec[2]=a[i+2],fn(vec,vec,arg),a[i]=vec[0],a[i+1]=vec[1],a[i+2]=vec[2];return a}}(),vec3.angle=function(a,b){var tempA=vec3.fromValues(a[0],a[1],a[2]),tempB=vec3.fromValues(b[0],b[1],b[2]);vec3.normalize(tempA,tempA),vec3.normalize(tempB,tempB);var cosine=vec3.dot(tempA,tempB);return cosine>1?0:Math.acos(cosine)},vec3.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"},module.exports=vec3},{"./common.js":63}],71:[function(require,module,exports){var glMatrix=require("./common.js"),vec4={};vec4.create=function(){var out=new glMatrix.ARRAY_TYPE(4);return out[0]=0,out[1]=0,out[2]=0,out[3]=0,out},vec4.clone=function(a){var out=new glMatrix.ARRAY_TYPE(4);return out[0]=a[0],out[1]=a[1],out[2]=a[2],out[3]=a[3],out},vec4.fromValues=function(x,y,z,w){var out=new glMatrix.ARRAY_TYPE(4);return out[0]=x,out[1]=y,out[2]=z,out[3]=w,out},vec4.copy=function(out,a){return out[0]=a[0],out[1]=a[1],out[2]=a[2],out[3]=a[3],out},vec4.set=function(out,x,y,z,w){return out[0]=x,out[1]=y,out[2]=z,out[3]=w,out},vec4.add=function(out,a,b){return out[0]=a[0]+b[0],out[1]=a[1]+b[1],out[2]=a[2]+b[2],out[3]=a[3]+b[3],out},vec4.subtract=function(out,a,b){return out[0]=a[0]-b[0],out[1]=a[1]-b[1],out[2]=a[2]-b[2],out[3]=a[3]-b[3],out},vec4.sub=vec4.subtract,vec4.multiply=function(out,a,b){return out[0]=a[0]*b[0],out[1]=a[1]*b[1],out[2]=a[2]*b[2],out[3]=a[3]*b[3],out},vec4.mul=vec4.multiply,vec4.divide=function(out,a,b){return out[0]=a[0]/b[0],out[1]=a[1]/b[1],out[2]=a[2]/b[2],out[3]=a[3]/b[3],out},vec4.div=vec4.divide,vec4.min=function(out,a,b){return out[0]=Math.min(a[0],b[0]),out[1]=Math.min(a[1],b[1]),out[2]=Math.min(a[2],b[2]),out[3]=Math.min(a[3],b[3]),out},vec4.max=function(out,a,b){return out[0]=Math.max(a[0],b[0]),out[1]=Math.max(a[1],b[1]),out[2]=Math.max(a[2],b[2]),out[3]=Math.max(a[3],b[3]),out},vec4.scale=function(out,a,b){return out[0]=a[0]*b,out[1]=a[1]*b,out[2]=a[2]*b,out[3]=a[3]*b,out},vec4.scaleAndAdd=function(out,a,b,scale){return out[0]=a[0]+b[0]*scale,out[1]=a[1]+b[1]*scale,out[2]=a[2]+b[2]*scale,out[3]=a[3]+b[3]*scale,out},vec4.distance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2],w=b[3]-a[3];return Math.sqrt(x*x+y*y+z*z+w*w)},vec4.dist=vec4.distance,vec4.squaredDistance=function(a,b){var x=b[0]-a[0],y=b[1]-a[1],z=b[2]-a[2],w=b[3]-a[3];return x*x+y*y+z*z+w*w},vec4.sqrDist=vec4.squaredDistance,vec4.length=function(a){var x=a[0],y=a[1],z=a[2],w=a[3];return Math.sqrt(x*x+y*y+z*z+w*w)},vec4.len=vec4.length,vec4.squaredLength=function(a){var x=a[0],y=a[1],z=a[2],w=a[3];return x*x+y*y+z*z+w*w},vec4.sqrLen=vec4.squaredLength,vec4.negate=function(out,a){return out[0]=-a[0],out[1]=-a[1],out[2]=-a[2],out[3]=-a[3],out},vec4.inverse=function(out,a){return out[0]=1/a[0],out[1]=1/a[1],out[2]=1/a[2],out[3]=1/a[3],out},vec4.normalize=function(out,a){var x=a[0],y=a[1],z=a[2],w=a[3],len=x*x+y*y+z*z+w*w;return len>0&&(len=1/Math.sqrt(len),out[0]=x*len,out[1]=y*len,out[2]=z*len,out[3]=w*len),out},vec4.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]},vec4.lerp=function(out,a,b,t){var ax=a[0],ay=a[1],az=a[2],aw=a[3];return out[0]=ax+t*(b[0]-ax),out[1]=ay+t*(b[1]-ay),out[2]=az+t*(b[2]-az),out[3]=aw+t*(b[3]-aw),out},vec4.random=function(out,scale){return scale=scale||1,out[0]=glMatrix.RANDOM(),out[1]=glMatrix.RANDOM(),out[2]=glMatrix.RANDOM(),out[3]=glMatrix.RANDOM(),vec4.normalize(out,out),vec4.scale(out,out,scale),out},vec4.transformMat4=function(out,a,m){var x=a[0],y=a[1],z=a[2],w=a[3];return out[0]=m[0]*x+m[4]*y+m[8]*z+m[12]*w,out[1]=m[1]*x+m[5]*y+m[9]*z+m[13]*w,out[2]=m[2]*x+m[6]*y+m[10]*z+m[14]*w,out[3]=m[3]*x+m[7]*y+m[11]*z+m[15]*w,out},vec4.transformQuat=function(out,a,q){var x=a[0],y=a[1],z=a[2],qx=q[0],qy=q[1],qz=q[2],qw=q[3],ix=qw*x+qy*z-qz*y,iy=qw*y+qz*x-qx*z,iz=qw*z+qx*y-qy*x,iw=-qx*x-qy*y-qz*z;return out[0]=ix*qw+iw*-qx+iy*-qz-iz*-qy,out[1]=iy*qw+iw*-qy+iz*-qx-ix*-qz,out[2]=iz*qw+iw*-qz+ix*-qy-iy*-qx,out[3]=a[3],out},vec4.forEach=function(){var vec=vec4.create();return function(a,stride,offset,count,fn,arg){var i,l;for(stride||(stride=4),offset||(offset=0),l=count?Math.min(count*stride+offset,a.length):a.length,i=offset;l>i;i+=stride)vec[0]=a[i],vec[1]=a[i+1],vec[2]=a[i+2],vec[3]=a[i+3],fn(vec,vec,arg),a[i]=vec[0],a[i+1]=vec[1],a[i+2]=vec[2],a[i+3]=vec[3];return a}}(),vec4.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"},module.exports=vec4},{"./common.js":63}],72:[function(require,module,exports){"use strict";function Shader(gl){this.gl=gl,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}function compareAttributes(a,b){return a.name=0){for(var size=0|attr.type.charAt(attr.type.length-1),locVector=new Array(size),j=0;size>j;++j)locVector[j]=attributeLocations.length,attributeNames.push(attr.name+"["+j+"]"),"number"==typeof attr.location?attributeLocations.push(attr.location+j):Array.isArray(attr.location)&&attr.location.length===size&&"number"==typeof attr.location[j]?attributeLocations.push(0|attr.location[j]):attributeLocations.push(-1);attributeUnpacked.push({name:attr.name,type:attr.type,locations:locVector})}else attributeUnpacked.push({name:attr.name,type:attr.type,locations:[attributeLocations.length]}),attributeNames.push(attr.name),"number"==typeof attr.location?attributeLocations.push(0|attr.location):attributeLocations.push(-1)}for(var curLocation=0,i=0;i=0;)curLocation+=1;attributeLocations[i]=curLocation}var uniformLocations=new Array(uniforms.length);relink(),wrapper._relink=relink,wrapper.types={uniforms:makeReflect(uniforms),attributes:makeReflect(attributes)},wrapper.attributes=createAttributeWrapper(gl,wrapper,attributeUnpacked,attributeLocations),Object.defineProperty(wrapper,"uniforms",createUniformWrapper(gl,wrapper,uniforms,uniformLocations))},module.exports=createShader},{"./lib/create-attributes":73,"./lib/create-uniforms":74,"./lib/reflect":75,"./lib/runtime-reflect":76,"./lib/shader-cache":77}],73:[function(require,module,exports){"use strict";function ShaderAttribute(gl,wrapper,index,locations,dimension,constFunc){this._gl=gl,this._wrapper=wrapper,this._index=index,this._locations=locations,this._dimension=dimension,this._constFunc=constFunc}function addVectorAttribute(gl,wrapper,index,locations,dimension,obj,name){for(var constFuncArgs=["gl","v"],varNames=[],i=0;dimension>i;++i)constFuncArgs.push("x"+i),varNames.push("x"+i);constFuncArgs.push("if(x0.length===void 0){return gl.vertexAttrib"+dimension+"f(v,"+varNames.join()+")}else{return gl.vertexAttrib"+dimension+"fv(v,x0)}");var constFunc=Function.apply(null,constFuncArgs),attr=new ShaderAttribute(gl,wrapper,index,locations,dimension,constFunc);Object.defineProperty(obj,name,{set:function(x){return gl.disableVertexAttribArray(locations[index]),constFunc(gl,locations[index],x),x},get:function(){return attr},enumerable:!0})}function addMatrixAttribute(gl,wrapper,index,locations,dimension,obj,name){for(var parts=new Array(dimension),attrs=new Array(dimension),i=0;dimension>i;++i)addVectorAttribute(gl,wrapper,index[i],locations,dimension,parts,i),attrs[i]=parts[i];Object.defineProperty(parts,"location",{set:function(v){if(Array.isArray(v))for(var i=0;dimension>i;++i)attrs[i].location=v[i];else for(var i=0;dimension>i;++i)attrs[i].location=v+i;return v},get:function(){for(var result=new Array(dimension),i=0;dimension>i;++i)result[i]=locations[index[i]];return result},enumerable:!0}),parts.pointer=function(type,normalized,stride,offset){type=type||gl.FLOAT,normalized=!!normalized,stride=stride||dimension*dimension,offset=offset||0;for(var i=0;dimension>i;++i){var location=locations[index[i]];gl.vertexAttribPointer(location,dimension,type,normalized,stride,offset+i*dimension),gl.enableVertexAttribArray(location)}};var scratch=new Array(dimension),vertexAttrib=gl["vertexAttrib"+dimension+"fv"];Object.defineProperty(obj,name,{set:function(x){for(var i=0;dimension>i;++i){var loc=locations[index[i]];if(gl.disableVertexAttribArray(loc),Array.isArray(x[0]))vertexAttrib.call(gl,loc,x[i]);else{for(var j=0;dimension>j;++j)scratch[j]=x[dimension*i+j];vertexAttrib.call(gl,loc,scratch)}}return x},get:function(){return parts},enumerable:!0})}function createAttributeWrapper(gl,wrapper,attributes,locations){for(var obj={},i=0,n=attributes.length;n>i;++i){var a=attributes[i],name=a.name,type=a.type,locs=a.locations;switch(type){case"bool":case"int":case"float":addVectorAttribute(gl,wrapper,locs[0],locations,1,obj,name);break;default:if(type.indexOf("vec")>=0){var d=type.charCodeAt(type.length-1)-48;if(2>d||d>4)throw new Error("gl-shader: Invalid data type for attribute "+name+": "+type);addVectorAttribute(gl,wrapper,locs[0],locations,d,obj,name)}else{if(!(type.indexOf("mat")>=0))throw new Error("gl-shader: Unknown data type for attribute "+name+": "+type);var d=type.charCodeAt(type.length-1)-48;if(2>d||d>4)throw new Error("gl-shader: Invalid data type for attribute "+name+": "+type);addMatrixAttribute(gl,wrapper,locs,locations,d,obj,name)}}}return obj}module.exports=createAttributeWrapper;var proto=ShaderAttribute.prototype;proto.pointer=function(type,normalized,stride,offset){var self=this,gl=self._gl,location=self._locations[self._index];gl.vertexAttribPointer(location,self._dimension,type||gl.FLOAT,!!normalized,stride||0,offset||0),gl.enableVertexAttribArray(location)},proto.set=function(x0,x1,x2,x3){return this._constFunc(this._locations[this._index],x0,x1,x2,x3)},Object.defineProperty(proto,"location",{get:function(){return this._locations[this._index]},set:function(v){return v!==this._locations[this._index]&&(this._locations[this._index]=0|v,this._wrapper.program=null),0|v}})},{}],74:[function(require,module,exports){"use strict";function identity(x){var c=new Function("y","return function(){return y}");return c(x)}function makeVector(length,fill){for(var result=new Array(length),i=0;length>i;++i)result[i]=fill;return result}function createUniformWrapper(gl,wrapper,uniforms,locations){function makeGetter(index){var proc=new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+index+"])}");return proc(gl,wrapper,locations)}function makePropSetter(path,index,type){switch(type){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+index+"],obj"+path+")";case"float":return"gl.uniform1f(locations["+index+"],obj"+path+")";default:var vidx=type.indexOf("vec");if(!(vidx>=0&&1>=vidx&&type.length===4+vidx)){if(0===type.indexOf("mat")&&4===type.length){var d=type.charCodeAt(type.length-1)-48;if(2>d||d>4)throw new Error("gl-shader: Invalid uniform dimension type for matrix "+name+": "+type);return"gl.uniformMatrix"+d+"fv(locations["+index+"],false,obj"+path+")"}throw new Error("gl-shader: Unknown uniform data type for "+name+": "+type)}var d=type.charCodeAt(type.length-1)-48;if(2>d||d>4)throw new Error("gl-shader: Invalid data type");switch(type.charAt(0)){case"b":case"i":return"gl.uniform"+d+"iv(locations["+index+"],obj"+path+")";case"v":return"gl.uniform"+d+"fv(locations["+index+"],obj"+path+")";default:throw new Error("gl-shader: Unrecognized data type for vector "+name+": "+type)}}}function enumerateIndices(prefix,type){if("object"!=typeof type)return[[prefix,type]];var indices=[];for(var id in type){var prop=type[id],tprefix=prefix;tprefix+=parseInt(id)+""===id?"["+id+"]":"."+id,"object"==typeof prop?indices.push.apply(indices,enumerateIndices(tprefix,prop)):indices.push([tprefix,prop])}return indices}function makeSetter(type){for(var code=["return function updateProperty(obj){"],indices=enumerateIndices("",type),i=0;i=0&&1>=vidx&&type.length===4+vidx){var d=type.charCodeAt(type.length-1)-48;if(2>d||d>4)throw new Error("gl-shader: Invalid data type");return"b"===type.charAt(0)?makeVector(d,!1):makeVector(d,0)}if(0===type.indexOf("mat")&&4===type.length){var d=type.charCodeAt(type.length-1)-48;if(2>d||d>4)throw new Error("gl-shader: Invalid uniform dimension type for matrix "+name+": "+type);return makeVector(d*d,0)}throw new Error("gl-shader: Unknown uniform data type for "+name+": "+type)}}function storeProperty(obj,prop,type){if("object"==typeof type){var child=processObject(type);Object.defineProperty(obj,prop,{get:identity(child),set:makeSetter(type),enumerable:!0,configurable:!1})}else locations[type]?Object.defineProperty(obj,prop,{get:makeGetter(type),set:makeSetter(type),enumerable:!0,configurable:!1}):obj[prop]=defaultValue(uniforms[type].type)}function processObject(obj){var result;if(Array.isArray(obj)){result=new Array(obj.length);for(var i=0;i1){x[0]in o||(o[x[0]]=[]),o=o[x[0]];for(var k=1;ki;++i){var info=gl.getActiveUniform(program,i);if(info){var type=getType(gl,info.type);if(info.size>1)for(var j=0;ji;++i){var info=gl.getActiveAttrib(program,i);info&&result.push({name:info.name,type:getType(gl,info.type)})}return result}exports.uniforms=runtimeUniforms,exports.attributes=runtimeAttributes;var GL_TO_GLSL_TYPES={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},GL_TABLE=null},{}],77:[function(require,module,exports){"use strict";function ShaderReference(id,src,type,shader,programs,count,cache){this.id=id,this.src=src,this.type=type,this.shader=shader,this.count=count,this.programs=[],this.cache=cache}function ContextCache(gl){this.gl=gl,this.shaders=[{},{}],this.programs={}}function compileShader(gl,type,src){var shader=gl.createShader(type);if(gl.shaderSource(shader,src),gl.compileShader(shader),!gl.getShaderParameter(shader,gl.COMPILE_STATUS)){var errLog=gl.getShaderInfoLog(shader);throw console.error("gl-shader: Error compiling shader:",errLog),new Error("gl-shader: Error compiling shader:"+errLog)}return shader}function linkProgram(gl,vshader,fshader,attribs,locations){var program=gl.createProgram();gl.attachShader(program,vshader),gl.attachShader(program,fshader);for(var i=0;ii;++i){var p=cache.programs[programs[i]];p&&(delete cache.programs[i],gl.deleteProgram(p))}gl.deleteShader(this.shader),delete cache.shaders[this.type===gl.FRAGMENT_SHADER|0][this.src]}};var proto=ContextCache.prototype;proto.getShaderReference=function(type,src){var gl=this.gl,shaders=this.shaders[type===gl.FRAGMENT_SHADER|0],shader=shaders[src];if(shader&&gl.isShader(shader.shader))shader.count+=1;else{var shaderObj=compileShader(gl,type,src);shader=shaders[src]=new ShaderReference(SHADER_COUNTER++,src,type,shaderObj,[],1,this)}return shader},proto.getProgram=function(vref,fref,attribs,locations){var token=[vref.id,fref.id,attribs.join(":"),locations.join(":")].join("@"),prog=this.programs[token];return prog&&this.gl.isProgram(prog)||(this.programs[token]=prog=linkProgram(this.gl,vref.shader,fref.shader,attribs,locations),vref.programs.push(token),fref.programs.push(token)),prog}},{"weakmap-shim":80}],78:[function(require,module,exports){function createStore(){var key={};return function(obj){if(("object"!=typeof obj||null===obj)&&"function"!=typeof obj)throw new Error("Weakmap-shim: Key must be object");var store=obj.valueOf(key);return store&&store.identity===key?store:hiddenStore(obj,key)}}var hiddenStore=require("./hidden-store.js");module.exports=createStore},{"./hidden-store.js":79}],79:[function(require,module,exports){function hiddenStore(obj,key){var store={identity:key},valueOf=obj.valueOf;return Object.defineProperty(obj,"valueOf",{value:function(value){return value!==key?valueOf.apply(this,arguments):store},writable:!0}),store}module.exports=hiddenStore},{}],80:[function(require,module,exports){function weakMap(){var privates=createStore();return{get:function(key,fallback){var store=privates(key);return store.hasOwnProperty("value")?store.value:fallback},set:function(key,value){privates(key).value=value},has:function(key){return"value"in privates(key)},"delete":function(key){return delete privates(key).value}}}var createStore=require("./create-store.js");module.exports=weakMap},{"./create-store.js":78}],81:[function(require,module,exports){arguments[4][4][0].apply(exports,arguments)},{"cwise-compiler":82,dup:4}],82:[function(require,module,exports){arguments[4][5][0].apply(exports,arguments)},{"./lib/thunk.js":84,dup:5}],83:[function(require,module,exports){arguments[4][6][0].apply(exports,arguments)},{dup:6,uniq:85}],84:[function(require,module,exports){arguments[4][7][0].apply(exports,arguments)},{"./compile.js":83,dup:7}],85:[function(require,module,exports){arguments[4][8][0].apply(exports,arguments)},{dup:8}],86:[function(require,module,exports){arguments[4][9][0].apply(exports,arguments)},{dup:9,"iota-array":87,"is-buffer":88}],87:[function(require,module,exports){arguments[4][10][0].apply(exports,arguments)},{dup:10}],88:[function(require,module,exports){arguments[4][11][0].apply(exports,arguments)},{dup:11}],89:[function(require,module,exports){arguments[4][12][0].apply(exports,arguments)},{dup:12}],90:[function(require,module,exports){arguments[4][13][0].apply(exports,arguments)},{dup:13}],91:[function(require,module,exports){arguments[4][54][0].apply(exports,arguments)},{"bit-twiddle":89,buffer:122,dup:54}],92:[function(require,module,exports){arguments[4][37][0].apply(exports,arguments)},{dup:37}],93:[function(require,module,exports){arguments[4][38][0].apply(exports,arguments)},{dup:38,"weak-map":92}],94:[function(require,module,exports){"use strict";function lazyInitLinearTypes(gl){linearTypes=[gl.LINEAR,gl.NEAREST_MIPMAP_LINEAR,gl.LINEAR_MIPMAP_NEAREST,gl.LINEAR_MIPMAP_NEAREST],filterTypes=[gl.NEAREST,gl.LINEAR,gl.NEAREST_MIPMAP_NEAREST,gl.NEAREST_MIPMAP_LINEAR,gl.LINEAR_MIPMAP_NEAREST,gl.LINEAR_MIPMAP_LINEAR],wrapTypes=[gl.REPEAT,gl.CLAMP_TO_EDGE,gl.MIRRORED_REPEAT]}function Texture2D(gl,handle,width,height,format,type){this.gl=gl,this.handle=handle,this.format=format,this.type=type,this._shape=[height,width],this._mipLevels=[0],this._magFilter=gl.NEAREST,this._minFilter=gl.NEAREST,this._wrapS=gl.CLAMP_TO_EDGE,this._wrapT=gl.CLAMP_TO_EDGE,this._anisoSamples=1}function texSubImageArray(gl,x_off,y_off,mip_level,cformat,ctype,mipLevels,array){var dtype=array.dtype,shape=array.shape,packed=isPacked(array),type=0,format=0;if("float32"===dtype?type=gl.FLOAT:"float64"===dtype?(type=gl.FLOAT,packed=!1,dtype="float32"):"uint8"===dtype?type=gl.UNSIGNED_BYTE:(type=gl.UNSIGNED_BYTE,packed=!1,dtype="uint8"),2===shape.length)format=gl.LUMINANCE;else{if(3!==shape.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===shape[2])format=gl.ALPHA;else if(2===shape[2])format=gl.LUMINANCE_ALPHA;else if(3===shape[2])format=gl.RGB;else{if(4!==shape[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");format=gl.RGBA}}if(format!==gl.LUMINANCE&&format!==gl.ALPHA||cformat!==gl.LUMINANCE&&cformat!==gl.ALPHA||(format=cformat),format!==cformat)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var size=array.size,needsMip=mipLevels.indexOf(mip_level)<0;if(needsMip&&mipLevels.push(mip_level),type===ctype&&packed)0===array.offset&&array.data.length===size?needsMip?gl.texImage2D(gl.TEXTURE_2D,mip_level,cformat,shape[1],shape[0],0,cformat,ctype,array.data):gl.texSubImage2D(gl.TEXTURE_2D,mip_level,x_off,y_off,shape[1],shape[0],cformat,ctype,array.data):needsMip?gl.texImage2D(gl.TEXTURE_2D,mip_level,cformat,shape[1],shape[0],0,cformat,ctype,array.data.subarray(array.offset,array.offset+size)):gl.texSubImage2D(gl.TEXTURE_2D,mip_level,x_off,y_off,shape[1],shape[0],cformat,ctype,array.data.subarray(array.offset,array.offset+size));else{var pack_buffer;pack_buffer=ctype===gl.FLOAT?pool.mallocFloat32(size):pool.mallocUint8(size);var pack_view=ndarray(pack_buffer,shape);type===gl.FLOAT&&ctype===gl.UNSIGNED_BYTE?convertFloatToUint8(pack_view,array):ops.assign(pack_view,array),needsMip?gl.texImage2D(gl.TEXTURE_2D,mip_level,cformat,shape[1],shape[0],0,cformat,ctype,pack_buffer.subarray(0,size)):gl.texSubImage2D(gl.TEXTURE_2D,mip_level,x_off,y_off,shape[1],shape[0],cformat,ctype,pack_buffer.subarray(0,size)),ctype===gl.FLOAT?pool.freeFloat32(pack_buffer):pool.freeUint8(pack_buffer);
-}}function initTexture(gl){var tex=gl.createTexture();return gl.bindTexture(gl.TEXTURE_2D,tex),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),tex}function createTextureShape(gl,width,height,format,type){var maxTextureSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);if(0>width||width>maxTextureSize||0>height||height>maxTextureSize)throw new Error("gl-texture2d: Invalid texture shape");var tex=initTexture(gl);return gl.texImage2D(gl.TEXTURE_2D,0,format,width,height,0,format,type,null),new Texture2D(gl,tex,width,height,format,type)}function createTextureDOM(gl,element,format,type){var tex=initTexture(gl);return gl.texImage2D(gl.TEXTURE_2D,0,format,format,type,element),new Texture2D(gl,tex,0|element.width,0|element.height,format,type)}function isPacked(array){for(var shape=array.shape,stride=array.stride,s=1,i=shape.length-1;i>=0;--i){if(stride[i]!==s)return!1;s*=shape[i]}return!0}function createTextureArray(gl,array){var dtype=array.dtype,shape=array.shape.slice(),maxSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);if(shape[0]<0||shape[0]>maxSize||shape[1]<0||shape[1]>maxSize)throw new Error("gl-texture2d: Invalid texture size");var packed=isPacked(array),type=0;"float32"===dtype?type=gl.FLOAT:"float64"===dtype?(type=gl.FLOAT,packed=!1,dtype="float32"):"uint8"===dtype?type=gl.UNSIGNED_BYTE:(type=gl.UNSIGNED_BYTE,packed=!1,dtype="uint8");var format=0;if(2===shape.length)format=gl.LUMINANCE;else{if(3!==shape.length)throw new Error("Invalid shape for texture");if(1===shape[2])format=gl.ALPHA;else if(2===shape[2])format=gl.LUMINANCE_ALPHA;else if(3===shape[2])format=gl.RGB;else{if(4!==shape[2])throw new Error("Invalid shape for pixel coords");format=gl.RGBA}}type===gl.FLOAT&&webglew(gl).texture_float&&(type=gl.UNSIGNED_BYTE,packed=!1);var buffer,buf_store;if(packed){var array_size=array.size;buffer=array.data.subarray(array.offset,array.offset+array_size)}else{for(var sz=1,stride=new Array(shape.length),i=shape.length-1;i>=0;--i)stride[i]=sz,sz*=shape[i];buf_store=pool.malloc(sz,dtype);var buf_array=ndarray(buf_store,array.shape,stride,0);"float32"!==dtype&&"float64"!==dtype||type!==gl.UNSIGNED_BYTE?ops.assign(buf_array,array):convertFloatToUint8(buf_array,array),buffer=buf_store.subarray(0,sz)}var tex=initTexture(gl);return gl.texImage2D(gl.TEXTURE_2D,0,format,shape[1],shape[0],0,format,type,buffer),packed||pool.free(buf_store),new Texture2D(gl,tex,shape[1],shape[0],format,type)}function createTexture2D(gl){if(arguments.length<=1)throw new Error("Missing arguments for texture2d constructor");if(linearTypes||lazyInitLinearTypes(gl),"number"==typeof arguments[1])return createTextureShape(gl,arguments[1],arguments[2],arguments[3]||gl.RGBA,arguments[4]||gl.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return createTextureShape(gl,0|arguments[1][1],0|arguments[1][0],arguments[2]||gl.RGBA,arguments[4]||gl.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var obj=arguments[1];if(obj instanceof HTMLCanvasElement||obj instanceof HTMLImageElement||obj instanceof HTMLVideoElement||obj instanceof ImageData)return createTextureDOM(gl,obj,arguments[2]||gl.RGBA,arguments[3]||gl.UNSIGNED_BYTE);if(obj.shape&&obj.data&&obj.stride)return createTextureArray(gl,obj)}throw new Error("Invalid arguments for texture2d constructor")}var ndarray=require("ndarray"),ops=require("ndarray-ops"),pool=require("typedarray-pool"),webglew=require("webglew"),linearTypes=null,filterTypes=null,wrapTypes=null,convertFloatToUint8=function(out,inp){ops.muls(out,inp,255)};Object.defineProperty(Texture2D.prototype,"minFilter",{get:function(){return this._minFilter},set:function(v){this.bind();var gl=this.gl;if(this.type===gl.FLOAT&&linearTypes.indexOf(v)>=0&&(webglew(gl).OES_texture_float_linear||(v=gl.NEAREST)),filterTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown filter mode "+v);return gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,v),this._minFilter=v}});var proto=Texture2D.prototype;Object.defineProperty(proto,"magFilter",{get:function(){return this._magFilter},set:function(v){this.bind();var gl=this.gl;if(this.type===gl.FLOAT&&linearTypes.indexOf(v)>=0&&(webglew(gl).OES_texture_float_linear||(v=gl.NEAREST)),filterTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown filter mode "+v);return gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,v),this._magFilter=v}}),Object.defineProperty(proto,"wrapS",{get:function(){return this._wrapS},set:function(v){if(this.bind(),wrapTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown wrap mode "+v);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,v),this._wrapS=v}}),Object.defineProperty(proto,"wrapT",{get:function(){return this._wrapT},set:function(v){if(this.bind(),wrapTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown wrap mode "+v);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,v),this._wrapT=v}}),Object.defineProperty(proto,"wrap",{get:function(){return[this._wrapT,this._wrapS]},set:function(v){if(Array.isArray(v)||(v=[v,v]),2!==v.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var i=0;2>i;++i)if(wrapTypes.indexOf(v[i])<0)throw new Error("gl-texture2d: Unknown wrap mode "+v);this._wrapT=v[0],this._wrapS=v[1];var gl=this.gl;return this.bind(),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,this._wrapT),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,this._wrapS),v}}),Object.defineProperty(proto,"mipSamples",{get:function(){return this._anisoSamples},set:function(i){var psamples=this._anisoSamples;if(this._anisoSamples=0|Math.max(i,1),psamples!==this._anisoSamples){var ext=webglew(this.gl).EXT_texture_filter_anisotropic;ext&&this.gl.texParameterf(this.gl.TEXTURE_2D,ext.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}}),Object.defineProperty(proto,"shape",{get:function(){return this._shape},set:function(x){if(Array.isArray(x)){if(2!==x.length)throw new Error("gl-texture2d: Invalid texture shape")}else x=[0|x,0|x];var r=0|x[0],c=0|x[1];if(this.height===r&&this.width===c)return x;var gl=this.gl,maxSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);if(0>c||c>maxSize||0>r||r>maxSize)throw new Error("gl-texture2d: Invalid texture size");return this._shape=[r,c],this.bind(),gl.texImage2D(gl.TEXTURE_2D,0,this.format,c,r,0,this.format,this.type,null),this._mipLevels=[0],x}}),proto.bind=function(unit){var gl=this.gl;return void 0!==unit&&gl.activeTexture(gl.TEXTURE0+(0|unit)),gl.bindTexture(gl.TEXTURE_2D,this.handle),void 0!==unit?unit:gl.getParameter(gl.ACTIVE_TEXTURE)-gl.TEXTURE0},proto.dispose=function(){this.gl.deleteTexture(this.handle)},proto.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var l=Math.min(this._shape[0],this._shape[1]),i=0;l>0;++i,l>>>=1)this._mipLevels.indexOf(i)<0&&this._mipLevels.push(i)},proto.setPixels=function(data,x_off,y_off,mip_level){var gl=this.gl;if(this.bind(),Array.isArray(x_off)?(mip_level=y_off,y_off=0|x_off[0],x_off=0|x_off[1]):(x_off=x_off||0,y_off=y_off||0),mip_level=mip_level||0,data instanceof HTMLCanvasElement||data instanceof ImageData||data instanceof HTMLImageElement||data instanceof HTMLVideoElement){var needsMip=this._mipLevels.indexOf(mip_level)<0;needsMip?(gl.texImage2D(gl.TEXTURE_2D,0,this.format,this.format,this.type,data),this._mipLevels.push(mip_level)):gl.texSubImage2D(gl.TEXTURE_2D,mip_level,x_off,y_off,this.format,this.type,data)}else{if(!(data.shape&&data.stride&&data.data))throw new Error("gl-texture2d: Unsupported data type");if(data.shape.length<2||x_off+data.shape[1]>this._shape[1]>>>mip_level||y_off+data.shape[0]>this._shape[0]>>>mip_level||0>x_off||0>y_off)throw new Error("gl-texture2d: Texture dimensions are out of bounds");texSubImageArray(gl,x_off,y_off,mip_level,this.format,this.type,this._mipLevels,data)}},module.exports=createTexture2D},{ndarray:86,"ndarray-ops":81,"typedarray-pool":91,webglew:93}],95:[function(require,module,exports){function combine(meshes){for(var pos=[],cel=[],p=0,c=0,k=0,i=0;i=pa&&pc>=pa?a:pc>=pb?b:c}function parseData(dataBuffer){function inputData(data){for(var tmp,j,len=data.length,i=0;i!==len;)switch(state){case 0:if(data.readUInt8(i++)!==HEADER[off++])return!1;off===HEADER.length&&(state=1,off=0);break;case 1:if(8-off>len-i)data.copy(buf,off,i),off+=len-i,i=len;else switch(data.copy(buf,off,i,i+8-off),i+=8-off,off=0,chunkLength=buf.readUInt32BE(0),buf.toString("ascii",4,8)){case"IHDR":state=2;break;case"PLTE":if(3!==pngColorType)state=7;else{if(chunkLength%3!==0)return!1;pngPaletteEntries=chunkLength/3,pngPalette=new Buffer(chunkLength),state=3}break;case"tRNS":if(3!==pngColorType)return!1;idChannels++,pngAlphaEntries=chunkLength,pngAlpha=new Buffer(chunkLength),state=4;break;case"IDAT":pngPixels||(pngPixels=new Uint8Array(pngWidth*pngHeight*idChannels)),state=5;break;case"IEND":state=6;break;default:state=7}break;case 2:if(13!==chunkLength)return!1;if(chunkLength-off>len-i)data.copy(buf,off,i),off+=len-i,i=len;else{if(data.copy(buf,off,i,i+chunkLength-off),0!==buf.readUInt8(10))return!1;if(0!==buf.readUInt8(11))return!1;if(0!==buf.readUInt8(12))return!1;switch(i+=chunkLength-off,state=8,off=0,pngWidth=buf.readUInt32BE(0),pngHeight=buf.readUInt32BE(4),pngBitDepth=buf.readUInt8(8),pngDepthMult=255/((1<len-i)data.copy(pngPalette,off,i),off+=len-i,i=len;else for(data.copy(pngPalette,off,i,i+chunkLength-off),i+=chunkLength-off,state=8,off=0,idChannels=1,j=pngPaletteEntries;j--;)if(pngPalette[3*j+0]!==pngPalette[3*j+1]||pngPalette[3*j+0]!==pngPalette[3*j+2]){idChannels=3;break}break;case 4:chunkLength-off>len-i?(data.copy(pngAlpha,off,i),off+=len-i,i=len):(data.copy(pngAlpha,off,i,i+chunkLength-off),i+=chunkLength-off,state=8,off=0);break;case 5:chunkLength-off>len-i?(inflateQueue.push(data.slice(i)),off+=len-i,i=len):(inflateQueue.push(data.slice(i,i+chunkLength-off)),i+=chunkLength-off,state=8,off=0);break;case 6:if(0!==chunkLength)return!1;4-off>len-i?(off+=len-i,i=len):(pngTrailer=new Buffer(0),i+=4-off,state=9,off=0);break;case 7:chunkLength-off>len-i?(off+=len-i,i=len):(i+=chunkLength-off,state=8,off=0);break;case 8:4-off>len-i?(off+=len-i,i=len):(i+=4-off,state=1,off=0);break;case 9:tmp=new Buffer(off+len-i),pngTrailer.copy(tmp),data.copy(tmp,off,i,len),pngTrailer=tmp,off+=len-i,i=len}return!0}function unpackPixels(data){var i,tmp,x,j,k,len=data.length;for(i=0;i!==len;++i){if(-1===b)scanlineFilter=data[i],tmp=currentScanline,currentScanline=priorScanline,priorScanline=tmp;else switch(scanlineFilter){case 0:currentScanline[b]=data[i];break;case 1:currentScanline[b]=pngBytesPerPixel>b?data[i]:data[i]+currentScanline[b-pngBytesPerPixel]&255;break;case 2:currentScanline[b]=data[i]+priorScanline[b]&255;break;case 3:currentScanline[b]=data[i]+((pngBytesPerPixel>b?priorScanline[b]:currentScanline[b-pngBytesPerPixel]+priorScanline[b])>>>1)&255;break;case 4:currentScanline[b]=data[i]+(pngBytesPerPixel>b?priorScanline[b]:paeth(currentScanline[b-pngBytesPerPixel],priorScanline[b],priorScanline[b-pngBytesPerPixel]))&255;break;default:return null}if(++b===pngBytesPerScanline){if(p===pngPixels.length)return null;for(j=0,x=0;x!==pngWidth;++x){for(k=0;k!==pngSamplesPerPixel;++j,++k)switch(pngBitDepth){case 1:pngSamples[k]=currentScanline[j>>>3]>>7-(7&j)&1;break;case 2:pngSamples[k]=currentScanline[j>>>2]>>(3-(3&j)<<1)&3;break;case 4:pngSamples[k]=currentScanline[j>>>1]>>(1-(1&j)<<2)&15;break;case 8:pngSamples[k]=currentScanline[j];break;default:return null}switch(pngColorType){case 0:pngPixels[p++]=pngSamples[0]*pngDepthMult;break;case 2:pngPixels[p++]=pngSamples[0]*pngDepthMult,pngPixels[p++]=pngSamples[1]*pngDepthMult,pngPixels[p++]=pngSamples[2]*pngDepthMult;break;case 3:if(pngSamples[0]>=pngPaletteEntries)return null;switch(idChannels){case 1:pngPixels[p++]=pngPalette[3*pngSamples[0]];break;case 2:pngPixels[p++]=pngPalette[3*pngSamples[0]],pngPixels[p++]=pngSamples[0]0?opt.windowBits=-opt.windowBits:opt.gzip&&opt.windowBits>0&&opt.windowBits<16&&(opt.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;var status=zlib_deflate.deflateInit2(this.strm,opt.level,opt.method,opt.windowBits,opt.memLevel,opt.strategy);if(status!==Z_OK)throw new Error(msg[status]);opt.header&&zlib_deflate.deflateSetHeader(this.strm,opt.header)};Deflate.prototype.push=function(data,mode){var status,_mode,strm=this.strm,chunkSize=this.options.chunkSize;if(this.ended)return!1;_mode=mode===~~mode?mode:mode===!0?Z_FINISH:Z_NO_FLUSH,"string"==typeof data?strm.input=strings.string2buf(data):"[object ArrayBuffer]"===toString.call(data)?strm.input=new Uint8Array(data):strm.input=data,strm.next_in=0,strm.avail_in=strm.input.length;do{if(0===strm.avail_out&&(strm.output=new utils.Buf8(chunkSize),strm.next_out=0,strm.avail_out=chunkSize),status=zlib_deflate.deflate(strm,_mode),status!==Z_STREAM_END&&status!==Z_OK)return this.onEnd(status),this.ended=!0,!1;(0===strm.avail_out||0===strm.avail_in&&(_mode===Z_FINISH||_mode===Z_SYNC_FLUSH))&&("string"===this.options.to?this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output,strm.next_out))):this.onData(utils.shrinkBuf(strm.output,strm.next_out)))}while((strm.avail_in>0||0===strm.avail_out)&&status!==Z_STREAM_END);return _mode===Z_FINISH?(status=zlib_deflate.deflateEnd(this.strm),this.onEnd(status),this.ended=!0,status===Z_OK):_mode===Z_SYNC_FLUSH?(this.onEnd(Z_OK),strm.avail_out=0,!0):!0},Deflate.prototype.onData=function(chunk){this.chunks.push(chunk)},Deflate.prototype.onEnd=function(status){status===Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=utils.flattenChunks(this.chunks)),this.chunks=[],this.err=status,this.msg=this.strm.msg},exports.Deflate=Deflate,exports.deflate=deflate,exports.deflateRaw=deflateRaw,exports.gzip=gzip},{"./utils/common":105,"./utils/strings":106,"./zlib/deflate.js":110,"./zlib/messages":115,"./zlib/zstream":117}],104:[function(require,module,exports){"use strict";function inflate(input,options){var inflator=new Inflate(options);if(inflator.push(input,!0),inflator.err)throw inflator.msg;return inflator.result}function inflateRaw(input,options){return options=options||{},options.raw=!0,inflate(input,options)}var zlib_inflate=require("./zlib/inflate.js"),utils=require("./utils/common"),strings=require("./utils/strings"),c=require("./zlib/constants"),msg=require("./zlib/messages"),zstream=require("./zlib/zstream"),gzheader=require("./zlib/gzheader"),toString=Object.prototype.toString,Inflate=function(options){this.options=utils.assign({chunkSize:16384,windowBits:0,to:""},options||{});var opt=this.options;opt.raw&&opt.windowBits>=0&&opt.windowBits<16&&(opt.windowBits=-opt.windowBits,0===opt.windowBits&&(opt.windowBits=-15)),!(opt.windowBits>=0&&opt.windowBits<16)||options&&options.windowBits||(opt.windowBits+=32),opt.windowBits>15&&opt.windowBits<48&&0===(15&opt.windowBits)&&(opt.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;var status=zlib_inflate.inflateInit2(this.strm,opt.windowBits);if(status!==c.Z_OK)throw new Error(msg[status]);this.header=new gzheader,zlib_inflate.inflateGetHeader(this.strm,this.header)};Inflate.prototype.push=function(data,mode){var status,_mode,next_out_utf8,tail,utf8str,strm=this.strm,chunkSize=this.options.chunkSize,allowBufError=!1;if(this.ended)return!1;_mode=mode===~~mode?mode:mode===!0?c.Z_FINISH:c.Z_NO_FLUSH,"string"==typeof data?strm.input=strings.binstring2buf(data):"[object ArrayBuffer]"===toString.call(data)?strm.input=new Uint8Array(data):strm.input=data,strm.next_in=0,strm.avail_in=strm.input.length;do{if(0===strm.avail_out&&(strm.output=new utils.Buf8(chunkSize),strm.next_out=0,strm.avail_out=chunkSize),status=zlib_inflate.inflate(strm,c.Z_NO_FLUSH),status===c.Z_BUF_ERROR&&allowBufError===!0&&(status=c.Z_OK,allowBufError=!1),status!==c.Z_STREAM_END&&status!==c.Z_OK)return this.onEnd(status),this.ended=!0,!1;strm.next_out&&(0===strm.avail_out||status===c.Z_STREAM_END||0===strm.avail_in&&(_mode===c.Z_FINISH||_mode===c.Z_SYNC_FLUSH))&&("string"===this.options.to?(next_out_utf8=strings.utf8border(strm.output,strm.next_out),tail=strm.next_out-next_out_utf8,utf8str=strings.buf2string(strm.output,next_out_utf8),strm.next_out=tail,strm.avail_out=chunkSize-tail,tail&&utils.arraySet(strm.output,strm.output,next_out_utf8,tail,0),this.onData(utf8str)):this.onData(utils.shrinkBuf(strm.output,strm.next_out))),0===strm.avail_in&&0===strm.avail_out&&(allowBufError=!0)}while((strm.avail_in>0||0===strm.avail_out)&&status!==c.Z_STREAM_END);return status===c.Z_STREAM_END&&(_mode=c.Z_FINISH),_mode===c.Z_FINISH?(status=zlib_inflate.inflateEnd(this.strm),this.onEnd(status),this.ended=!0,status===c.Z_OK):_mode===c.Z_SYNC_FLUSH?(this.onEnd(c.Z_OK),strm.avail_out=0,!0):!0},Inflate.prototype.onData=function(chunk){this.chunks.push(chunk)},Inflate.prototype.onEnd=function(status){status===c.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=utils.flattenChunks(this.chunks)),this.chunks=[],this.err=status,this.msg=this.strm.msg},exports.Inflate=Inflate,exports.inflate=inflate,exports.inflateRaw=inflateRaw,exports.ungzip=inflate},{"./utils/common":105,"./utils/strings":106,"./zlib/constants":108,"./zlib/gzheader":111,"./zlib/inflate.js":113,"./zlib/messages":115,"./zlib/zstream":117}],105:[function(require,module,exports){"use strict";var TYPED_OK="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;exports.assign=function(obj){for(var sources=Array.prototype.slice.call(arguments,1);sources.length;){var source=sources.shift();if(source){if("object"!=typeof source)throw new TypeError(source+"must be non-object");for(var p in source)source.hasOwnProperty(p)&&(obj[p]=source[p])}}return obj},exports.shrinkBuf=function(buf,size){return buf.length===size?buf:buf.subarray?buf.subarray(0,size):(buf.length=size,buf)};var fnTyped={arraySet:function(dest,src,src_offs,len,dest_offs){if(src.subarray&&dest.subarray)return void dest.set(src.subarray(src_offs,src_offs+len),dest_offs);for(var i=0;len>i;i++)dest[dest_offs+i]=src[src_offs+i]},flattenChunks:function(chunks){var i,l,len,pos,chunk,result;for(len=0,i=0,l=chunks.length;l>i;i++)len+=chunks[i].length;for(result=new Uint8Array(len),pos=0,i=0,l=chunks.length;l>i;i++)chunk=chunks[i],result.set(chunk,pos),pos+=chunk.length;return result}},fnUntyped={arraySet:function(dest,src,src_offs,len,dest_offs){for(var i=0;len>i;i++)dest[dest_offs+i]=src[src_offs+i]},flattenChunks:function(chunks){return[].concat.apply([],chunks)}};exports.setTyped=function(on){on?(exports.Buf8=Uint8Array,exports.Buf16=Uint16Array,exports.Buf32=Int32Array,exports.assign(exports,fnTyped)):(exports.Buf8=Array,exports.Buf16=Array,exports.Buf32=Array,exports.assign(exports,fnUntyped))},exports.setTyped(TYPED_OK)},{}],106:[function(require,module,exports){"use strict";function buf2binstring(buf,len){if(65537>len&&(buf.subarray&&STR_APPLY_UIA_OK||!buf.subarray&&STR_APPLY_OK))return String.fromCharCode.apply(null,utils.shrinkBuf(buf,len));for(var result="",i=0;len>i;i++)result+=String.fromCharCode(buf[i]);return result}var utils=require("./common"),STR_APPLY_OK=!0,STR_APPLY_UIA_OK=!0;try{String.fromCharCode.apply(null,[0])}catch(__){STR_APPLY_OK=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(__){STR_APPLY_UIA_OK=!1}for(var _utf8len=new utils.Buf8(256),q=0;256>q;q++)_utf8len[q]=q>=252?6:q>=248?5:q>=240?4:q>=224?3:q>=192?2:1;_utf8len[254]=_utf8len[254]=1,exports.string2buf=function(str){var buf,c,c2,m_pos,i,str_len=str.length,buf_len=0;for(m_pos=0;str_len>m_pos;m_pos++)c=str.charCodeAt(m_pos),55296===(64512&c)&&str_len>m_pos+1&&(c2=str.charCodeAt(m_pos+1),56320===(64512&c2)&&(c=65536+(c-55296<<10)+(c2-56320),m_pos++)),buf_len+=128>c?1:2048>c?2:65536>c?3:4;for(buf=new utils.Buf8(buf_len),i=0,m_pos=0;buf_len>i;m_pos++)c=str.charCodeAt(m_pos),55296===(64512&c)&&str_len>m_pos+1&&(c2=str.charCodeAt(m_pos+1),56320===(64512&c2)&&(c=65536+(c-55296<<10)+(c2-56320),m_pos++)),128>c?buf[i++]=c:2048>c?(buf[i++]=192|c>>>6,buf[i++]=128|63&c):65536>c?(buf[i++]=224|c>>>12,buf[i++]=128|c>>>6&63,buf[i++]=128|63&c):(buf[i++]=240|c>>>18,buf[i++]=128|c>>>12&63,buf[i++]=128|c>>>6&63,buf[i++]=128|63&c);return buf},exports.buf2binstring=function(buf){return buf2binstring(buf,buf.length)},exports.binstring2buf=function(str){for(var buf=new utils.Buf8(str.length),i=0,len=buf.length;len>i;i++)buf[i]=str.charCodeAt(i);return buf},exports.buf2string=function(buf,max){var i,out,c,c_len,len=max||buf.length,utf16buf=new Array(2*len);for(out=0,i=0;len>i;)if(c=buf[i++],128>c)utf16buf[out++]=c;else if(c_len=_utf8len[c],c_len>4)utf16buf[out++]=65533,i+=c_len-1;else{for(c&=2===c_len?31:3===c_len?15:7;c_len>1&&len>i;)c=c<<6|63&buf[i++],c_len--;c_len>1?utf16buf[out++]=65533:65536>c?utf16buf[out++]=c:(c-=65536,utf16buf[out++]=55296|c>>10&1023,utf16buf[out++]=56320|1023&c)}return buf2binstring(utf16buf,out)},exports.utf8border=function(buf,max){var pos;for(max=max||buf.length,max>buf.length&&(max=buf.length),pos=max-1;pos>=0&&128===(192&buf[pos]);)pos--;return 0>pos?max:0===pos?max:pos+_utf8len[buf[pos]]>max?pos:max}},{"./common":105}],107:[function(require,module,exports){"use strict";function adler32(adler,buf,len,pos){for(var s1=65535&adler|0,s2=adler>>>16&65535|0,n=0;0!==len;){n=len>2e3?2e3:len,len-=n;do s1=s1+buf[pos++]|0,s2=s2+s1|0;while(--n);s1%=65521,s2%=65521}return s1|s2<<16|0}module.exports=adler32},{}],108:[function(require,module,exports){module.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],109:[function(require,module,exports){"use strict";function makeTable(){for(var c,table=[],n=0;256>n;n++){c=n;for(var k=0;8>k;k++)c=1&c?3988292384^c>>>1:c>>>1;table[n]=c}return table}function crc32(crc,buf,len,pos){var t=crcTable,end=pos+len;crc=-1^crc;for(var i=pos;end>i;i++)crc=crc>>>8^t[255&(crc^buf[i])];return-1^crc}var crcTable=makeTable();module.exports=crc32},{}],110:[function(require,module,exports){"use strict";function err(strm,errorCode){return strm.msg=msg[errorCode],errorCode}function rank(f){return(f<<1)-(f>4?9:0)}function zero(buf){for(var len=buf.length;--len>=0;)buf[len]=0}function flush_pending(strm){var s=strm.state,len=s.pending;len>strm.avail_out&&(len=strm.avail_out),0!==len&&(utils.arraySet(strm.output,s.pending_buf,s.pending_out,len,strm.next_out),strm.next_out+=len,s.pending_out+=len,strm.total_out+=len,strm.avail_out-=len,s.pending-=len,0===s.pending&&(s.pending_out=0))}function flush_block_only(s,last){trees._tr_flush_block(s,s.block_start>=0?s.block_start:-1,s.strstart-s.block_start,last),s.block_start=s.strstart,flush_pending(s.strm)}function put_byte(s,b){s.pending_buf[s.pending++]=b}function putShortMSB(s,b){s.pending_buf[s.pending++]=b>>>8&255,s.pending_buf[s.pending++]=255&b}function read_buf(strm,buf,start,size){var len=strm.avail_in;return len>size&&(len=size),0===len?0:(strm.avail_in-=len,utils.arraySet(buf,strm.input,strm.next_in,len,start),1===strm.state.wrap?strm.adler=adler32(strm.adler,buf,len,start):2===strm.state.wrap&&(strm.adler=crc32(strm.adler,buf,len,start)),strm.next_in+=len,strm.total_in+=len,len)}function longest_match(s,cur_match){var match,len,chain_length=s.max_chain_length,scan=s.strstart,best_len=s.prev_length,nice_match=s.nice_match,limit=s.strstart>s.w_size-MIN_LOOKAHEAD?s.strstart-(s.w_size-MIN_LOOKAHEAD):0,_win=s.window,wmask=s.w_mask,prev=s.prev,strend=s.strstart+MAX_MATCH,scan_end1=_win[scan+best_len-1],scan_end=_win[scan+best_len];s.prev_length>=s.good_match&&(chain_length>>=2),nice_match>s.lookahead&&(nice_match=s.lookahead);do if(match=cur_match,_win[match+best_len]===scan_end&&_win[match+best_len-1]===scan_end1&&_win[match]===_win[scan]&&_win[++match]===_win[scan+1]){scan+=2,match++;do;while(_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&strend>scan);if(len=MAX_MATCH-(strend-scan),scan=strend-MAX_MATCH,len>best_len){if(s.match_start=cur_match,best_len=len,len>=nice_match)break;scan_end1=_win[scan+best_len-1],scan_end=_win[scan+best_len]}}while((cur_match=prev[cur_match&wmask])>limit&&0!==--chain_length);return best_len<=s.lookahead?best_len:s.lookahead}function fill_window(s){var p,n,m,more,str,_w_size=s.w_size;do{if(more=s.window_size-s.lookahead-s.strstart,s.strstart>=_w_size+(_w_size-MIN_LOOKAHEAD)){utils.arraySet(s.window,s.window,_w_size,_w_size,0),s.match_start-=_w_size,s.strstart-=_w_size,s.block_start-=_w_size,n=s.hash_size,p=n;do m=s.head[--p],s.head[p]=m>=_w_size?m-_w_size:0;while(--n);n=_w_size,p=n;do m=s.prev[--p],s.prev[p]=m>=_w_size?m-_w_size:0;while(--n);more+=_w_size}if(0===s.strm.avail_in)break;if(n=read_buf(s.strm,s.window,s.strstart+s.lookahead,more),s.lookahead+=n,s.lookahead+s.insert>=MIN_MATCH)for(str=s.strstart-s.insert,s.ins_h=s.window[str],s.ins_h=(s.ins_h<s.pending_buf_size-5&&(max_block_size=s.pending_buf_size-5);;){if(s.lookahead<=1){if(fill_window(s),0===s.lookahead&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(0===s.lookahead)break}s.strstart+=s.lookahead,s.lookahead=0;var max_start=s.block_start+max_block_size;if((0===s.strstart||s.strstart>=max_start)&&(s.lookahead=s.strstart-max_start,s.strstart=max_start,flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE;if(s.strstart-s.block_start>=s.w_size-MIN_LOOKAHEAD&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}return s.insert=0,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):s.strstart>s.block_start&&(flush_block_only(s,!1),0===s.strm.avail_out)?BS_NEED_MORE:BS_NEED_MORE}function deflate_fast(s,flush){for(var hash_head,bflush;;){if(s.lookahead=MIN_MATCH&&(s.ins_h=(s.ins_h<=MIN_MATCH)if(bflush=trees._tr_tally(s,s.strstart-s.match_start,s.match_length-MIN_MATCH),s.lookahead-=s.match_length,s.match_length<=s.max_lazy_match&&s.lookahead>=MIN_MATCH){
-s.match_length--;do s.strstart++,s.ins_h=(s.ins_h<=MIN_MATCH&&(s.ins_h=(s.ins_h<4096)&&(s.match_length=MIN_MATCH-1)),s.prev_length>=MIN_MATCH&&s.match_length<=s.prev_length){max_insert=s.strstart+s.lookahead-MIN_MATCH,bflush=trees._tr_tally(s,s.strstart-1-s.prev_match,s.prev_length-MIN_MATCH),s.lookahead-=s.prev_length-1,s.prev_length-=2;do++s.strstart<=max_insert&&(s.ins_h=(s.ins_h<=MIN_MATCH&&s.strstart>0&&(scan=s.strstart-1,prev=_win[scan],prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan])){strend=s.strstart+MAX_MATCH;do;while(prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&strend>scan);s.match_length=MAX_MATCH-(strend-scan),s.match_length>s.lookahead&&(s.match_length=s.lookahead)}if(s.match_length>=MIN_MATCH?(bflush=trees._tr_tally(s,1,s.match_length-MIN_MATCH),s.lookahead-=s.match_length,s.strstart+=s.match_length,s.match_length=0):(bflush=trees._tr_tally(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++),bflush&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}return s.insert=0,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):s.last_lit&&(flush_block_only(s,!1),0===s.strm.avail_out)?BS_NEED_MORE:BS_BLOCK_DONE}function deflate_huff(s,flush){for(var bflush;;){if(0===s.lookahead&&(fill_window(s),0===s.lookahead)){if(flush===Z_NO_FLUSH)return BS_NEED_MORE;break}if(s.match_length=0,bflush=trees._tr_tally(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++,bflush&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}return s.insert=0,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):s.last_lit&&(flush_block_only(s,!1),0===s.strm.avail_out)?BS_NEED_MORE:BS_BLOCK_DONE}function lm_init(s){s.window_size=2*s.w_size,zero(s.head),s.max_lazy_match=configuration_table[s.level].max_lazy,s.good_match=configuration_table[s.level].good_length,s.nice_match=configuration_table[s.level].nice_length,s.max_chain_length=configuration_table[s.level].max_chain,s.strstart=0,s.block_start=0,s.lookahead=0,s.insert=0,s.match_length=s.prev_length=MIN_MATCH-1,s.match_available=0,s.ins_h=0}function DeflateState(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Z_DEFLATED,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new utils.Buf16(2*HEAP_SIZE),this.dyn_dtree=new utils.Buf16(2*(2*D_CODES+1)),this.bl_tree=new utils.Buf16(2*(2*BL_CODES+1)),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new utils.Buf16(MAX_BITS+1),this.heap=new utils.Buf16(2*L_CODES+1),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new utils.Buf16(2*L_CODES+1),zero(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function deflateResetKeep(strm){var s;return strm&&strm.state?(strm.total_in=strm.total_out=0,strm.data_type=Z_UNKNOWN,s=strm.state,s.pending=0,s.pending_out=0,s.wrap<0&&(s.wrap=-s.wrap),s.status=s.wrap?INIT_STATE:BUSY_STATE,strm.adler=2===s.wrap?0:1,s.last_flush=Z_NO_FLUSH,trees._tr_init(s),Z_OK):err(strm,Z_STREAM_ERROR)}function deflateReset(strm){var ret=deflateResetKeep(strm);return ret===Z_OK&&lm_init(strm.state),ret}function deflateSetHeader(strm,head){return strm&&strm.state?2!==strm.state.wrap?Z_STREAM_ERROR:(strm.state.gzhead=head,Z_OK):Z_STREAM_ERROR}function deflateInit2(strm,level,method,windowBits,memLevel,strategy){if(!strm)return Z_STREAM_ERROR;var wrap=1;if(level===Z_DEFAULT_COMPRESSION&&(level=6),0>windowBits?(wrap=0,windowBits=-windowBits):windowBits>15&&(wrap=2,windowBits-=16),1>memLevel||memLevel>MAX_MEM_LEVEL||method!==Z_DEFLATED||8>windowBits||windowBits>15||0>level||level>9||0>strategy||strategy>Z_FIXED)return err(strm,Z_STREAM_ERROR);8===windowBits&&(windowBits=9);var s=new DeflateState;return strm.state=s,s.strm=strm,s.wrap=wrap,s.gzhead=null,s.w_bits=windowBits,s.w_size=1<>1,s.l_buf=3*s.lit_bufsize,s.level=level,s.strategy=strategy,s.method=method,deflateReset(strm)}function deflateInit(strm,level){return deflateInit2(strm,level,Z_DEFLATED,MAX_WBITS,DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY)}function deflate(strm,flush){var old_flush,s,beg,val;if(!strm||!strm.state||flush>Z_BLOCK||0>flush)return strm?err(strm,Z_STREAM_ERROR):Z_STREAM_ERROR;if(s=strm.state,!strm.output||!strm.input&&0!==strm.avail_in||s.status===FINISH_STATE&&flush!==Z_FINISH)return err(strm,0===strm.avail_out?Z_BUF_ERROR:Z_STREAM_ERROR);if(s.strm=strm,old_flush=s.last_flush,s.last_flush=flush,s.status===INIT_STATE)if(2===s.wrap)strm.adler=0,put_byte(s,31),put_byte(s,139),put_byte(s,8),s.gzhead?(put_byte(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),put_byte(s,255&s.gzhead.time),put_byte(s,s.gzhead.time>>8&255),put_byte(s,s.gzhead.time>>16&255),put_byte(s,s.gzhead.time>>24&255),put_byte(s,9===s.level?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0),put_byte(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(put_byte(s,255&s.gzhead.extra.length),put_byte(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=EXTRA_STATE):(put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,9===s.level?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0),put_byte(s,OS_CODE),s.status=BUSY_STATE);else{var header=Z_DEFLATED+(s.w_bits-8<<4)<<8,level_flags=-1;level_flags=s.strategy>=Z_HUFFMAN_ONLY||s.level<2?0:s.level<6?1:6===s.level?2:3,header|=level_flags<<6,0!==s.strstart&&(header|=PRESET_DICT),header+=31-header%31,s.status=BUSY_STATE,putShortMSB(s,header),0!==s.strstart&&(putShortMSB(s,strm.adler>>>16),putShortMSB(s,65535&strm.adler)),strm.adler=1}if(s.status===EXTRA_STATE)if(s.gzhead.extra){for(beg=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),flush_pending(strm),beg=s.pending,s.pending!==s.pending_buf_size));)put_byte(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=NAME_STATE)}else s.status=NAME_STATE;if(s.status===NAME_STATE)if(s.gzhead.name){beg=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),flush_pending(strm),beg=s.pending,s.pending===s.pending_buf_size)){val=1;break}val=s.gzindexbeg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),0===val&&(s.gzindex=0,s.status=COMMENT_STATE)}else s.status=COMMENT_STATE;if(s.status===COMMENT_STATE)if(s.gzhead.comment){beg=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),flush_pending(strm),beg=s.pending,s.pending===s.pending_buf_size)){val=1;break}val=s.gzindexbeg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),0===val&&(s.status=HCRC_STATE)}else s.status=HCRC_STATE;if(s.status===HCRC_STATE&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&flush_pending(strm),s.pending+2<=s.pending_buf_size&&(put_byte(s,255&strm.adler),put_byte(s,strm.adler>>8&255),strm.adler=0,s.status=BUSY_STATE)):s.status=BUSY_STATE),0!==s.pending){if(flush_pending(strm),0===strm.avail_out)return s.last_flush=-1,Z_OK}else if(0===strm.avail_in&&rank(flush)<=rank(old_flush)&&flush!==Z_FINISH)return err(strm,Z_BUF_ERROR);if(s.status===FINISH_STATE&&0!==strm.avail_in)return err(strm,Z_BUF_ERROR);if(0!==strm.avail_in||0!==s.lookahead||flush!==Z_NO_FLUSH&&s.status!==FINISH_STATE){var bstate=s.strategy===Z_HUFFMAN_ONLY?deflate_huff(s,flush):s.strategy===Z_RLE?deflate_rle(s,flush):configuration_table[s.level].func(s,flush);if((bstate===BS_FINISH_STARTED||bstate===BS_FINISH_DONE)&&(s.status=FINISH_STATE),bstate===BS_NEED_MORE||bstate===BS_FINISH_STARTED)return 0===strm.avail_out&&(s.last_flush=-1),Z_OK;if(bstate===BS_BLOCK_DONE&&(flush===Z_PARTIAL_FLUSH?trees._tr_align(s):flush!==Z_BLOCK&&(trees._tr_stored_block(s,0,0,!1),flush===Z_FULL_FLUSH&&(zero(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),flush_pending(strm),0===strm.avail_out))return s.last_flush=-1,Z_OK}return flush!==Z_FINISH?Z_OK:s.wrap<=0?Z_STREAM_END:(2===s.wrap?(put_byte(s,255&strm.adler),put_byte(s,strm.adler>>8&255),put_byte(s,strm.adler>>16&255),put_byte(s,strm.adler>>24&255),put_byte(s,255&strm.total_in),put_byte(s,strm.total_in>>8&255),put_byte(s,strm.total_in>>16&255),put_byte(s,strm.total_in>>24&255)):(putShortMSB(s,strm.adler>>>16),putShortMSB(s,65535&strm.adler)),flush_pending(strm),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?Z_OK:Z_STREAM_END)}function deflateEnd(strm){var status;return strm&&strm.state?(status=strm.state.status,status!==INIT_STATE&&status!==EXTRA_STATE&&status!==NAME_STATE&&status!==COMMENT_STATE&&status!==HCRC_STATE&&status!==BUSY_STATE&&status!==FINISH_STATE?err(strm,Z_STREAM_ERROR):(strm.state=null,status===BUSY_STATE?err(strm,Z_DATA_ERROR):Z_OK)):Z_STREAM_ERROR}var configuration_table,utils=require("../utils/common"),trees=require("./trees"),adler32=require("./adler32"),crc32=require("./crc32"),msg=require("./messages"),Z_NO_FLUSH=0,Z_PARTIAL_FLUSH=1,Z_FULL_FLUSH=3,Z_FINISH=4,Z_BLOCK=5,Z_OK=0,Z_STREAM_END=1,Z_STREAM_ERROR=-2,Z_DATA_ERROR=-3,Z_BUF_ERROR=-5,Z_DEFAULT_COMPRESSION=-1,Z_FILTERED=1,Z_HUFFMAN_ONLY=2,Z_RLE=3,Z_FIXED=4,Z_DEFAULT_STRATEGY=0,Z_UNKNOWN=2,Z_DEFLATED=8,MAX_MEM_LEVEL=9,MAX_WBITS=15,DEF_MEM_LEVEL=8,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,MIN_MATCH=3,MAX_MATCH=258,MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1,PRESET_DICT=32,INIT_STATE=42,EXTRA_STATE=69,NAME_STATE=73,COMMENT_STATE=91,HCRC_STATE=103,BUSY_STATE=113,FINISH_STATE=666,BS_NEED_MORE=1,BS_BLOCK_DONE=2,BS_FINISH_STARTED=3,BS_FINISH_DONE=4,OS_CODE=3,Config=function(good_length,max_lazy,nice_length,max_chain,func){this.good_length=good_length,this.max_lazy=max_lazy,this.nice_length=nice_length,this.max_chain=max_chain,this.func=func};configuration_table=[new Config(0,0,0,0,deflate_stored),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)],exports.deflateInit=deflateInit,exports.deflateInit2=deflateInit2,exports.deflateReset=deflateReset,exports.deflateResetKeep=deflateResetKeep,exports.deflateSetHeader=deflateSetHeader,exports.deflate=deflate,exports.deflateEnd=deflateEnd,exports.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":105,"./adler32":107,"./crc32":109,"./messages":115,"./trees":116}],111:[function(require,module,exports){"use strict";function GZheader(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}module.exports=GZheader},{}],112:[function(require,module,exports){"use strict";var BAD=30,TYPE=12;module.exports=function(strm,start){var state,_in,last,_out,beg,end,dmax,wsize,whave,wnext,s_window,hold,bits,lcode,dcode,lmask,dmask,here,op,len,dist,from,from_source,input,output;state=strm.state,_in=strm.next_in,input=strm.input,last=_in+(strm.avail_in-5),_out=strm.next_out,output=strm.output,beg=_out-(start-strm.avail_out),end=_out+(strm.avail_out-257),dmax=state.dmax,wsize=state.wsize,whave=state.whave,wnext=state.wnext,s_window=state.window,hold=state.hold,bits=state.bits,lcode=state.lencode,dcode=state.distcode,lmask=(1<bits&&(hold+=input[_in++]<>>24,hold>>>=op,bits-=op,op=here>>>16&255,0===op)output[_out++]=65535&here;else{if(!(16&op)){if(0===(64&op)){here=lcode[(65535&here)+(hold&(1<bits&&(hold+=input[_in++]<>>=op,bits-=op),15>bits&&(hold+=input[_in++]<>>24,hold>>>=op,bits-=op,op=here>>>16&255,!(16&op)){if(0===(64&op)){here=dcode[(65535&here)+(hold&(1<bits&&(hold+=input[_in++]<bits&&(hold+=input[_in++]<dmax){strm.msg="invalid distance too far back",state.mode=BAD;break top}if(hold>>>=op,bits-=op,op=_out-beg,dist>op){if(op=dist-op,op>whave&&state.sane){strm.msg="invalid distance too far back",state.mode=BAD;break top}if(from=0,from_source=s_window,0===wnext){if(from+=wsize-op,len>op){len-=op;do output[_out++]=s_window[from++];while(--op);from=_out-dist,from_source=output}}else if(op>wnext){if(from+=wsize+wnext-op,op-=wnext,len>op){len-=op;do output[_out++]=s_window[from++];while(--op);if(from=0,len>wnext){op=wnext,len-=op;do output[_out++]=s_window[from++];while(--op);from=_out-dist,from_source=output}}}else if(from+=wnext-op,len>op){len-=op;do output[_out++]=s_window[from++];while(--op);from=_out-dist,from_source=output}for(;len>2;)output[_out++]=from_source[from++],output[_out++]=from_source[from++],output[_out++]=from_source[from++],len-=3;len&&(output[_out++]=from_source[from++],len>1&&(output[_out++]=from_source[from++]))}else{from=_out-dist;do output[_out++]=output[from++],output[_out++]=output[from++],output[_out++]=output[from++],len-=3;while(len>2);len&&(output[_out++]=output[from++],len>1&&(output[_out++]=output[from++]))}break}}break}}while(last>_in&&end>_out);len=bits>>3,_in-=len,bits-=len<<3,hold&=(1<_in?5+(last-_in):5-(_in-last),strm.avail_out=end>_out?257+(end-_out):257-(_out-end),state.hold=hold,state.bits=bits}},{}],113:[function(require,module,exports){"use strict";function ZSWAP32(q){return(q>>>24&255)+(q>>>8&65280)+((65280&q)<<8)+((255&q)<<24)}function InflateState(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new utils.Buf16(320),this.work=new utils.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function inflateResetKeep(strm){var state;return strm&&strm.state?(state=strm.state,strm.total_in=strm.total_out=state.total=0,strm.msg="",state.wrap&&(strm.adler=1&state.wrap),state.mode=HEAD,state.last=0,state.havedict=0,state.dmax=32768,state.head=null,state.hold=0,state.bits=0,state.lencode=state.lendyn=new utils.Buf32(ENOUGH_LENS),state.distcode=state.distdyn=new utils.Buf32(ENOUGH_DISTS),state.sane=1,state.back=-1,Z_OK):Z_STREAM_ERROR}function inflateReset(strm){var state;return strm&&strm.state?(state=strm.state,state.wsize=0,state.whave=0,state.wnext=0,inflateResetKeep(strm)):Z_STREAM_ERROR}function inflateReset2(strm,windowBits){var wrap,state;return strm&&strm.state?(state=strm.state,0>windowBits?(wrap=0,windowBits=-windowBits):(wrap=(windowBits>>4)+1,48>windowBits&&(windowBits&=15)),windowBits&&(8>windowBits||windowBits>15)?Z_STREAM_ERROR:(null!==state.window&&state.wbits!==windowBits&&(state.window=null),state.wrap=wrap,state.wbits=windowBits,inflateReset(strm))):Z_STREAM_ERROR}function inflateInit2(strm,windowBits){var ret,state;return strm?(state=new InflateState,strm.state=state,state.window=null,ret=inflateReset2(strm,windowBits),ret!==Z_OK&&(strm.state=null),ret):Z_STREAM_ERROR}function inflateInit(strm){return inflateInit2(strm,DEF_WBITS)}function fixedtables(state){if(virgin){var sym;for(lenfix=new utils.Buf32(512),distfix=new utils.Buf32(32),sym=0;144>sym;)state.lens[sym++]=8;for(;256>sym;)state.lens[sym++]=9;for(;280>sym;)state.lens[sym++]=7;for(;288>sym;)state.lens[sym++]=8;for(inflate_table(LENS,state.lens,0,288,lenfix,0,state.work,{bits:9}),sym=0;32>sym;)state.lens[sym++]=5;inflate_table(DISTS,state.lens,0,32,distfix,0,state.work,{bits:5}),virgin=!1}state.lencode=lenfix,state.lenbits=9,state.distcode=distfix,state.distbits=5}function updatewindow(strm,src,end,copy){var dist,state=strm.state;return null===state.window&&(state.wsize=1<=state.wsize?(utils.arraySet(state.window,src,end-state.wsize,state.wsize,0),state.wnext=0,state.whave=state.wsize):(dist=state.wsize-state.wnext,dist>copy&&(dist=copy),utils.arraySet(state.window,src,end-copy,dist,state.wnext),copy-=dist,copy?(utils.arraySet(state.window,src,end-copy,copy,0),state.wnext=copy,state.whave=state.wsize):(state.wnext+=dist,state.wnext===state.wsize&&(state.wnext=0),state.whavebits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>8&255,state.check=crc32(state.check,hbuf,2,0),hold=0,bits=0,state.mode=FLAGS;break}if(state.flags=0,state.head&&(state.head.done=!1),!(1&state.wrap)||(((255&hold)<<8)+(hold>>8))%31){strm.msg="incorrect header check",state.mode=BAD;break}if((15&hold)!==Z_DEFLATED){strm.msg="unknown compression method",state.mode=BAD;break}if(hold>>>=4,bits-=4,len=(15&hold)+8,0===state.wbits)state.wbits=len;else if(len>state.wbits){strm.msg="invalid window size",state.mode=BAD;break}state.dmax=1<bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>8&1),512&state.flags&&(hbuf[0]=255&hold,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0)),hold=0,bits=0,state.mode=TIME;case TIME:for(;32>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>8&255,hbuf[2]=hold>>>16&255,hbuf[3]=hold>>>24&255,state.check=crc32(state.check,hbuf,4,0)),hold=0,bits=0,state.mode=OS;case OS:for(;16>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>8),512&state.flags&&(hbuf[0]=255&hold,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0)),hold=0,bits=0,state.mode=EXLEN;case EXLEN:if(1024&state.flags){for(;16>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>8&255,state.check=crc32(state.check,hbuf,2,0)),hold=0,bits=0}else state.head&&(state.head.extra=null);state.mode=EXTRA;case EXTRA:if(1024&state.flags&&(copy=state.length,copy>have&&(copy=have),copy&&(state.head&&(len=state.head.extra_len-state.length,state.head.extra||(state.head.extra=new Array(state.head.extra_len)),utils.arraySet(state.head.extra,input,next,copy,len)),512&state.flags&&(state.check=crc32(state.check,input,copy,next)),have-=copy,next+=copy,state.length-=copy),state.length))break inf_leave;state.length=0,state.mode=NAME;case NAME:if(2048&state.flags){if(0===have)break inf_leave;copy=0;do len=input[next+copy++],state.head&&len&&state.length<65536&&(state.head.name+=String.fromCharCode(len));while(len&&have>copy);if(512&state.flags&&(state.check=crc32(state.check,input,copy,next)),have-=copy,next+=copy,len)break inf_leave}else state.head&&(state.head.name=null);state.length=0,state.mode=COMMENT;case COMMENT:if(4096&state.flags){if(0===have)break inf_leave;copy=0;do len=input[next+copy++],state.head&&len&&state.length<65536&&(state.head.comment+=String.fromCharCode(len));while(len&&have>copy);if(512&state.flags&&(state.check=crc32(state.check,input,copy,next)),have-=copy,next+=copy,len)break inf_leave}else state.head&&(state.head.comment=null);state.mode=HCRC;case HCRC:if(512&state.flags){for(;16>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>9&1,state.head.done=!0),strm.adler=state.check=0,state.mode=TYPE;break;case DICTID:for(;32>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=7&bits,bits-=7&bits,state.mode=CHECK;break}for(;3>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=1,bits-=1,3&hold){case 0:state.mode=STORED;break;case 1:if(fixedtables(state),state.mode=LEN_,flush===Z_TREES){hold>>>=2,bits-=2;break inf_leave}break;case 2:state.mode=TABLE;break;case 3:strm.msg="invalid block type",state.mode=BAD}hold>>>=2,bits-=2;break;case STORED:for(hold>>>=7&bits,bits-=7&bits;32>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>16^65535)){strm.msg="invalid stored block lengths",state.mode=BAD;break}if(state.length=65535&hold,hold=0,bits=0,state.mode=COPY_,flush===Z_TREES)break inf_leave;case COPY_:state.mode=COPY;case COPY:if(copy=state.length){if(copy>have&&(copy=have),copy>left&&(copy=left),0===copy)break inf_leave;utils.arraySet(output,input,next,copy,put),have-=copy,next+=copy,left-=copy,put+=copy,state.length-=copy;break}state.mode=TYPE;break;case TABLE:for(;14>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=5,bits-=5,state.ndist=(31&hold)+1,hold>>>=5,bits-=5,state.ncode=(15&hold)+4,hold>>>=4,bits-=4,state.nlen>286||state.ndist>30){strm.msg="too many length or distance symbols",state.mode=BAD;break}state.have=0,state.mode=LENLENS;case LENLENS:for(;state.havebits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=3,bits-=3}for(;state.have<19;)state.lens[order[state.have++]]=0;if(state.lencode=state.lendyn,state.lenbits=7,opts={bits:state.lenbits},ret=inflate_table(CODES,state.lens,0,19,state.lencode,0,state.work,opts),state.lenbits=opts.bits,ret){strm.msg="invalid code lengths set",state.mode=BAD;break}state.have=0,state.mode=CODELENS;case CODELENS:for(;state.have>>24,here_op=here>>>16&255,here_val=65535&here,!(bits>=here_bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<here_val)hold>>>=here_bits,bits-=here_bits,state.lens[state.have++]=here_val;else{if(16===here_val){for(n=here_bits+2;n>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=here_bits,bits-=here_bits,0===state.have){strm.msg="invalid bit length repeat",state.mode=BAD;break}len=state.lens[state.have-1],copy=3+(3&hold),hold>>>=2,bits-=2}else if(17===here_val){for(n=here_bits+3;n>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=here_bits,bits-=here_bits,len=0,copy=3+(7&hold),hold>>>=3,bits-=3}else{for(n=here_bits+7;n>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=here_bits,bits-=here_bits,len=0,copy=11+(127&hold),hold>>>=7,bits-=7}if(state.have+copy>state.nlen+state.ndist){strm.msg="invalid bit length repeat",state.mode=BAD;break}for(;copy--;)state.lens[state.have++]=len}}if(state.mode===BAD)break;if(0===state.lens[256]){strm.msg="invalid code -- missing end-of-block",state.mode=BAD;break}if(state.lenbits=9,opts={bits:state.lenbits},ret=inflate_table(LENS,state.lens,0,state.nlen,state.lencode,0,state.work,opts),state.lenbits=opts.bits,ret){strm.msg="invalid literal/lengths set",state.mode=BAD;break}if(state.distbits=6,state.distcode=state.distdyn,opts={bits:state.distbits},ret=inflate_table(DISTS,state.lens,state.nlen,state.ndist,state.distcode,0,state.work,opts),state.distbits=opts.bits,ret){strm.msg="invalid distances set",state.mode=BAD;break}if(state.mode=LEN_,flush===Z_TREES)break inf_leave;case LEN_:state.mode=LEN;case LEN:if(have>=6&&left>=258){strm.next_out=put,strm.avail_out=left,strm.next_in=next,strm.avail_in=have,state.hold=hold,state.bits=bits,inflate_fast(strm,_out),put=strm.next_out,output=strm.output,left=strm.avail_out,next=strm.next_in,input=strm.input,have=strm.avail_in,hold=state.hold,bits=state.bits,state.mode===TYPE&&(state.back=-1);break}for(state.back=0;here=state.lencode[hold&(1<>>24,here_op=here>>>16&255,here_val=65535&here,!(bits>=here_bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<>last_bits)],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(bits>=last_bits+here_bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=last_bits,bits-=last_bits,state.back+=last_bits}if(hold>>>=here_bits,bits-=here_bits,state.back+=here_bits,state.length=here_val,0===here_op){state.mode=LIT;break}if(32&here_op){state.back=-1,state.mode=TYPE;break}if(64&here_op){strm.msg="invalid literal/length code",state.mode=BAD;break}state.extra=15&here_op,state.mode=LENEXT;case LENEXT:if(state.extra){for(n=state.extra;n>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=state.extra,bits-=state.extra,state.back+=state.extra}state.was=state.length,state.mode=DIST;case DIST:for(;here=state.distcode[hold&(1<>>24,here_op=here>>>16&255,here_val=65535&here,!(bits>=here_bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<>last_bits)],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(bits>=last_bits+here_bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=last_bits,bits-=last_bits,state.back+=last_bits}if(hold>>>=here_bits,bits-=here_bits,state.back+=here_bits,64&here_op){strm.msg="invalid distance code",state.mode=BAD;break}state.offset=here_val,state.extra=15&here_op,state.mode=DISTEXT;case DISTEXT:if(state.extra){for(n=state.extra;n>bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=state.extra,
-bits-=state.extra,state.back+=state.extra}if(state.offset>state.dmax){strm.msg="invalid distance too far back",state.mode=BAD;break}state.mode=MATCH;case MATCH:if(0===left)break inf_leave;if(copy=_out-left,state.offset>copy){if(copy=state.offset-copy,copy>state.whave&&state.sane){strm.msg="invalid distance too far back",state.mode=BAD;break}copy>state.wnext?(copy-=state.wnext,from=state.wsize-copy):from=state.wnext-copy,copy>state.length&&(copy=state.length),from_source=state.window}else from_source=output,from=put-state.offset,copy=state.length;copy>left&&(copy=left),left-=copy,state.length-=copy;do output[put++]=from_source[from++];while(--copy);0===state.length&&(state.mode=LEN);break;case LIT:if(0===left)break inf_leave;output[put++]=state.length,left--,state.mode=LEN;break;case CHECK:if(state.wrap){for(;32>bits;){if(0===have)break inf_leave;have--,hold|=input[next++]<bits;){if(0===have)break inf_leave;have--,hold+=input[next++]<=len;len++)count[len]=0;for(sym=0;codes>sym;sym++)count[lens[lens_index+sym]]++;for(root=bits,max=MAXBITS;max>=1&&0===count[max];max--);if(root>max&&(root=max),0===max)return table[table_index++]=20971520,table[table_index++]=20971520,opts.bits=1,0;for(min=1;max>min&&0===count[min];min++);for(min>root&&(root=min),left=1,len=1;MAXBITS>=len;len++)if(left<<=1,left-=count[len],0>left)return-1;if(left>0&&(type===CODES||1!==max))return-1;for(offs[1]=0,len=1;MAXBITS>len;len++)offs[len+1]=offs[len]+count[len];for(sym=0;codes>sym;sym++)0!==lens[lens_index+sym]&&(work[offs[lens[lens_index+sym]]++]=sym);if(type===CODES?(base=extra=work,end=19):type===LENS?(base=lbase,base_index-=257,extra=lext,extra_index-=257,end=256):(base=dbase,extra=dext,end=-1),huff=0,sym=0,len=min,next=table_index,curr=root,drop=0,low=-1,used=1<ENOUGH_LENS||type===DISTS&&used>ENOUGH_DISTS)return 1;for(var i=0;;){i++,here_bits=len-drop,work[sym]end?(here_op=extra[extra_index+work[sym]],here_val=base[base_index+work[sym]]):(here_op=96,here_val=0),incr=1<>drop)+fill]=here_bits<<24|here_op<<16|here_val|0;while(0!==fill);for(incr=1<>=1;if(0!==incr?(huff&=incr-1,huff+=incr):huff=0,sym++,0===--count[len]){if(len===max)break;len=lens[lens_index+work[sym]]}if(len>root&&(huff&mask)!==low){for(0===drop&&(drop=root),next+=min,curr=len-drop,left=1<curr+drop&&(left-=count[curr+drop],!(0>=left));)curr++,left<<=1;if(used+=1<ENOUGH_LENS||type===DISTS&&used>ENOUGH_DISTS)return 1;low=huff&mask,table[low]=root<<24|curr<<16|next-table_index|0}}return 0!==huff&&(table[next+huff]=len-drop<<24|64<<16|0),opts.bits=root,0}},{"../utils/common":105}],115:[function(require,module,exports){"use strict";module.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],116:[function(require,module,exports){"use strict";function zero(buf){for(var len=buf.length;--len>=0;)buf[len]=0}function d_code(dist){return 256>dist?_dist_code[dist]:_dist_code[256+(dist>>>7)]}function put_short(s,w){s.pending_buf[s.pending++]=255&w,s.pending_buf[s.pending++]=w>>>8&255}function send_bits(s,value,length){s.bi_valid>Buf_size-length?(s.bi_buf|=value<>Buf_size-s.bi_valid,s.bi_valid+=length-Buf_size):(s.bi_buf|=value<>>=1,res<<=1;while(--len>0);return res>>>1}function bi_flush(s){16===s.bi_valid?(put_short(s,s.bi_buf),s.bi_buf=0,s.bi_valid=0):s.bi_valid>=8&&(s.pending_buf[s.pending++]=255&s.bi_buf,s.bi_buf>>=8,s.bi_valid-=8)}function gen_bitlen(s,desc){var h,n,m,bits,xbits,f,tree=desc.dyn_tree,max_code=desc.max_code,stree=desc.stat_desc.static_tree,has_stree=desc.stat_desc.has_stree,extra=desc.stat_desc.extra_bits,base=desc.stat_desc.extra_base,max_length=desc.stat_desc.max_length,overflow=0;for(bits=0;MAX_BITS>=bits;bits++)s.bl_count[bits]=0;for(tree[2*s.heap[s.heap_max]+1]=0,h=s.heap_max+1;HEAP_SIZE>h;h++)n=s.heap[h],bits=tree[2*tree[2*n+1]+1]+1,bits>max_length&&(bits=max_length,overflow++),tree[2*n+1]=bits,n>max_code||(s.bl_count[bits]++,xbits=0,n>=base&&(xbits=extra[n-base]),f=tree[2*n],s.opt_len+=f*(bits+xbits),has_stree&&(s.static_len+=f*(stree[2*n+1]+xbits)));if(0!==overflow){do{for(bits=max_length-1;0===s.bl_count[bits];)bits--;s.bl_count[bits]--,s.bl_count[bits+1]+=2,s.bl_count[max_length]--,overflow-=2}while(overflow>0);for(bits=max_length;0!==bits;bits--)for(n=s.bl_count[bits];0!==n;)m=s.heap[--h],m>max_code||(tree[2*m+1]!==bits&&(s.opt_len+=(bits-tree[2*m+1])*tree[2*m],tree[2*m+1]=bits),n--)}}function gen_codes(tree,max_code,bl_count){var bits,n,next_code=new Array(MAX_BITS+1),code=0;for(bits=1;MAX_BITS>=bits;bits++)next_code[bits]=code=code+bl_count[bits-1]<<1;for(n=0;max_code>=n;n++){var len=tree[2*n+1];0!==len&&(tree[2*n]=bi_reverse(next_code[len]++,len))}}function tr_static_init(){var n,bits,length,code,dist,bl_count=new Array(MAX_BITS+1);for(length=0,code=0;LENGTH_CODES-1>code;code++)for(base_length[code]=length,n=0;n<1<code;code++)for(base_dist[code]=dist,n=0;n<1<>=7;D_CODES>code;code++)for(base_dist[code]=dist<<7,n=0;n<1<=bits;bits++)bl_count[bits]=0;for(n=0;143>=n;)static_ltree[2*n+1]=8,n++,bl_count[8]++;for(;255>=n;)static_ltree[2*n+1]=9,n++,bl_count[9]++;for(;279>=n;)static_ltree[2*n+1]=7,n++,bl_count[7]++;for(;287>=n;)static_ltree[2*n+1]=8,n++,bl_count[8]++;for(gen_codes(static_ltree,L_CODES+1,bl_count),n=0;D_CODES>n;n++)static_dtree[2*n+1]=5,static_dtree[2*n]=bi_reverse(n,5);static_l_desc=new StaticTreeDesc(static_ltree,extra_lbits,LITERALS+1,L_CODES,MAX_BITS),static_d_desc=new StaticTreeDesc(static_dtree,extra_dbits,0,D_CODES,MAX_BITS),static_bl_desc=new StaticTreeDesc(new Array(0),extra_blbits,0,BL_CODES,MAX_BL_BITS)}function init_block(s){var n;for(n=0;L_CODES>n;n++)s.dyn_ltree[2*n]=0;for(n=0;D_CODES>n;n++)s.dyn_dtree[2*n]=0;for(n=0;BL_CODES>n;n++)s.bl_tree[2*n]=0;s.dyn_ltree[2*END_BLOCK]=1,s.opt_len=s.static_len=0,s.last_lit=s.matches=0}function bi_windup(s){s.bi_valid>8?put_short(s,s.bi_buf):s.bi_valid>0&&(s.pending_buf[s.pending++]=s.bi_buf),s.bi_buf=0,s.bi_valid=0}function copy_block(s,buf,len,header){bi_windup(s),header&&(put_short(s,len),put_short(s,~len)),utils.arraySet(s.pending_buf,s.window,buf,len,s.pending),s.pending+=len}function smaller(tree,n,m,depth){var _n2=2*n,_m2=2*m;return tree[_n2]n;n++)0!==tree[2*n]?(s.heap[++s.heap_len]=max_code=n,s.depth[n]=0):tree[2*n+1]=0;for(;s.heap_len<2;)node=s.heap[++s.heap_len]=2>max_code?++max_code:0,tree[2*node]=1,s.depth[node]=0,s.opt_len--,has_stree&&(s.static_len-=stree[2*node+1]);for(desc.max_code=max_code,n=s.heap_len>>1;n>=1;n--)pqdownheap(s,tree,n);node=elems;do n=s.heap[1],s.heap[1]=s.heap[s.heap_len--],pqdownheap(s,tree,1),m=s.heap[1],s.heap[--s.heap_max]=n,s.heap[--s.heap_max]=m,tree[2*node]=tree[2*n]+tree[2*m],s.depth[node]=(s.depth[n]>=s.depth[m]?s.depth[n]:s.depth[m])+1,tree[2*n+1]=tree[2*m+1]=node,s.heap[1]=node++,pqdownheap(s,tree,1);while(s.heap_len>=2);s.heap[--s.heap_max]=s.heap[1],gen_bitlen(s,desc),gen_codes(tree,max_code,s.bl_count)}function scan_tree(s,tree,max_code){var n,curlen,prevlen=-1,nextlen=tree[1],count=0,max_count=7,min_count=4;for(0===nextlen&&(max_count=138,min_count=3),tree[2*(max_code+1)+1]=65535,n=0;max_code>=n;n++)curlen=nextlen,nextlen=tree[2*(n+1)+1],++countcount?s.bl_tree[2*curlen]+=count:0!==curlen?(curlen!==prevlen&&s.bl_tree[2*curlen]++,s.bl_tree[2*REP_3_6]++):10>=count?s.bl_tree[2*REPZ_3_10]++:s.bl_tree[2*REPZ_11_138]++,count=0,prevlen=curlen,0===nextlen?(max_count=138,min_count=3):curlen===nextlen?(max_count=6,min_count=3):(max_count=7,min_count=4))}function send_tree(s,tree,max_code){var n,curlen,prevlen=-1,nextlen=tree[1],count=0,max_count=7,min_count=4;for(0===nextlen&&(max_count=138,min_count=3),n=0;max_code>=n;n++)if(curlen=nextlen,nextlen=tree[2*(n+1)+1],!(++countcount){do send_code(s,curlen,s.bl_tree);while(0!==--count)}else 0!==curlen?(curlen!==prevlen&&(send_code(s,curlen,s.bl_tree),count--),send_code(s,REP_3_6,s.bl_tree),send_bits(s,count-3,2)):10>=count?(send_code(s,REPZ_3_10,s.bl_tree),send_bits(s,count-3,3)):(send_code(s,REPZ_11_138,s.bl_tree),send_bits(s,count-11,7));count=0,prevlen=curlen,0===nextlen?(max_count=138,min_count=3):curlen===nextlen?(max_count=6,min_count=3):(max_count=7,min_count=4)}}function build_bl_tree(s){var max_blindex;for(scan_tree(s,s.dyn_ltree,s.l_desc.max_code),scan_tree(s,s.dyn_dtree,s.d_desc.max_code),build_tree(s,s.bl_desc),max_blindex=BL_CODES-1;max_blindex>=3&&0===s.bl_tree[2*bl_order[max_blindex]+1];max_blindex--);return s.opt_len+=3*(max_blindex+1)+5+5+4,max_blindex}function send_all_trees(s,lcodes,dcodes,blcodes){var rank;for(send_bits(s,lcodes-257,5),send_bits(s,dcodes-1,5),send_bits(s,blcodes-4,4),rank=0;blcodes>rank;rank++)send_bits(s,s.bl_tree[2*bl_order[rank]+1],3);send_tree(s,s.dyn_ltree,lcodes-1),send_tree(s,s.dyn_dtree,dcodes-1)}function detect_data_type(s){var n,black_mask=4093624447;for(n=0;31>=n;n++,black_mask>>>=1)if(1&black_mask&&0!==s.dyn_ltree[2*n])return Z_BINARY;if(0!==s.dyn_ltree[18]||0!==s.dyn_ltree[20]||0!==s.dyn_ltree[26])return Z_TEXT;for(n=32;LITERALS>n;n++)if(0!==s.dyn_ltree[2*n])return Z_TEXT;return Z_BINARY}function _tr_init(s){static_init_done||(tr_static_init(),static_init_done=!0),s.l_desc=new TreeDesc(s.dyn_ltree,static_l_desc),s.d_desc=new TreeDesc(s.dyn_dtree,static_d_desc),s.bl_desc=new TreeDesc(s.bl_tree,static_bl_desc),s.bi_buf=0,s.bi_valid=0,init_block(s)}function _tr_stored_block(s,buf,stored_len,last){send_bits(s,(STORED_BLOCK<<1)+(last?1:0),3),copy_block(s,buf,stored_len,!0)}function _tr_align(s){send_bits(s,STATIC_TREES<<1,3),send_code(s,END_BLOCK,static_ltree),bi_flush(s)}function _tr_flush_block(s,buf,stored_len,last){var opt_lenb,static_lenb,max_blindex=0;s.level>0?(s.strm.data_type===Z_UNKNOWN&&(s.strm.data_type=detect_data_type(s)),build_tree(s,s.l_desc),build_tree(s,s.d_desc),max_blindex=build_bl_tree(s),opt_lenb=s.opt_len+3+7>>>3,static_lenb=s.static_len+3+7>>>3,opt_lenb>=static_lenb&&(opt_lenb=static_lenb)):opt_lenb=static_lenb=stored_len+5,opt_lenb>=stored_len+4&&-1!==buf?_tr_stored_block(s,buf,stored_len,last):s.strategy===Z_FIXED||static_lenb===opt_lenb?(send_bits(s,(STATIC_TREES<<1)+(last?1:0),3),compress_block(s,static_ltree,static_dtree)):(send_bits(s,(DYN_TREES<<1)+(last?1:0),3),send_all_trees(s,s.l_desc.max_code+1,s.d_desc.max_code+1,max_blindex+1),compress_block(s,s.dyn_ltree,s.dyn_dtree)),init_block(s),last&&bi_windup(s)}function _tr_tally(s,dist,lc){return s.pending_buf[s.d_buf+2*s.last_lit]=dist>>>8&255,s.pending_buf[s.d_buf+2*s.last_lit+1]=255&dist,s.pending_buf[s.l_buf+s.last_lit]=255&lc,s.last_lit++,0===dist?s.dyn_ltree[2*lc]++:(s.matches++,dist--,s.dyn_ltree[2*(_length_code[lc]+LITERALS+1)]++,s.dyn_dtree[2*d_code(dist)]++),s.last_lit===s.lit_bufsize-1}var utils=require("../utils/common"),Z_FIXED=4,Z_BINARY=0,Z_TEXT=1,Z_UNKNOWN=2,STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,MIN_MATCH=3,MAX_MATCH=258,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,Buf_size=16,MAX_BL_BITS=7,END_BLOCK=256,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],DIST_CODE_LEN=512,static_ltree=new Array(2*(L_CODES+2));zero(static_ltree);var static_dtree=new Array(2*D_CODES);zero(static_dtree);var _dist_code=new Array(DIST_CODE_LEN);zero(_dist_code);var _length_code=new Array(MAX_MATCH-MIN_MATCH+1);zero(_length_code);var base_length=new Array(LENGTH_CODES);zero(base_length);var base_dist=new Array(D_CODES);zero(base_dist);var static_l_desc,static_d_desc,static_bl_desc,StaticTreeDesc=function(static_tree,extra_bits,extra_base,elems,max_length){this.static_tree=static_tree,this.extra_bits=extra_bits,this.extra_base=extra_base,this.elems=elems,this.max_length=max_length,this.has_stree=static_tree&&static_tree.length},TreeDesc=function(dyn_tree,stat_desc){this.dyn_tree=dyn_tree,this.max_code=0,this.stat_desc=stat_desc},static_init_done=!1;exports._tr_init=_tr_init,exports._tr_stored_block=_tr_stored_block,exports._tr_flush_block=_tr_flush_block,exports._tr_tally=_tr_tally,exports._tr_align=_tr_align},{"../utils/common":105}],117:[function(require,module,exports){"use strict";function ZStream(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}module.exports=ZStream},{}],118:[function(require,module,exports){(function(Buffer){"use strict";function decodeB64(str){return new Buffer(str,"base64")}function unpackPNG(w,h,c,str){var pixels=parse(decodeB64(str));return ndarray(pixels.data,[h,w,pixels.channels],[pixels.channels*w,pixels.channels,1],0)}module.exports=unpackPNG;var ndarray=require("ndarray"),parse=require("pngparse-sync")}).call(this,require("buffer").Buffer)},{buffer:122,ndarray:98,"pngparse-sync":101}],119:[function(require,module,exports){"use strict";function OrbitCamera(rotation,center,distance){this.rotation=rotation,this.center=center,this.distance=distance}function quatFromVec(out,da){var x=da[0],y=da[1],s=(da[2],x*x+y*y);s>1&&(s=1),out[0]=-da[0],out[1]=da[1],out[2]=da[2]||Math.sqrt(1-s),out[3]=0}function createOrbitCamera(eye,target,up){eye=eye||[0,0,-1],target=target||[0,0,0],up=up||[0,1,0];var camera=new OrbitCamera(quat.create(),vec3.create(),1);return camera.lookAt(eye,target,up),camera}var glm=require("gl-matrix"),vec3=glm.vec3,mat3=glm.mat3,mat4=glm.mat4,quat=glm.quat,scratch0=new Float32Array(16),scratch1=new Float32Array(16),proto=OrbitCamera.prototype;proto.view=function(out){return out||(out=mat4.create()),scratch1[0]=scratch1[1]=0,scratch1[2]=-this.distance,mat4.fromRotationTranslation(out,quat.conjugate(scratch0,this.rotation),scratch1),mat4.translate(out,out,vec3.negate(scratch0,this.center)),out},proto.lookAt=function(eye,center,up){mat4.lookAt(scratch0,eye,center,up),mat3.fromMat4(scratch0,scratch0),quat.fromMat3(this.rotation,scratch0),vec3.copy(this.center,center),this.distance=vec3.distance(eye,center)},proto.pan=function(dpan){var d=this.distance;scratch0[0]=-d*(dpan[0]||0),scratch0[1]=d*(dpan[1]||0),scratch0[2]=d*(dpan[2]||0),vec3.transformQuat(scratch0,scratch0,this.rotation),vec3.add(this.center,this.center,scratch0)},proto.zoom=function(d){this.distance+=d,this.distance<0&&(this.distance=0)},proto.rotate=function(da,db){quatFromVec(scratch0,da),quatFromVec(scratch1,db),quat.invert(scratch1,scratch1),quat.multiply(scratch0,scratch0,scratch1),quat.length(scratch0)<1e-6||(quat.multiply(this.rotation,this.rotation,scratch0),quat.normalize(this.rotation,this.rotation))},module.exports=createOrbitCamera},{"gl-matrix":62}],120:[function(require,module,exports){(function(global){module.exports=global.performance&&global.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],121:[function(require,module,exports){function unindex(positions,cells,out){positions.positions&&positions.cells&&(out=cells,cells=positions.cells,positions=positions.positions),out=out||new Float32Array(9*cells.length);for(var i=0,n=0,l=cells.length;l>i;i+=1)out[n++]=positions[cells[i][0]][0],out[n++]=positions[cells[i][0]][1],out[n++]=positions[cells[i][0]][2],out[n++]=positions[cells[i][1]][0],out[n++]=positions[cells[i][1]][1],out[n++]=positions[cells[i][1]][2],out[n++]=positions[cells[i][2]][0],out[n++]=positions[cells[i][2]][1],out[n++]=positions[cells[i][2]][2];return out}module.exports=unindex},{}],122:[function(require,module,exports){(function(global){function typedArraySupport(){function Bar(){}try{var arr=new Uint8Array(1);return arr.foo=function(){return 42},arr.constructor=Bar,42===arr.foo()&&arr.constructor===Bar&&"function"==typeof arr.subarray&&0===arr.subarray(1,1).byteLength}catch(e){return!1}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Buffer(arg){return this instanceof Buffer?(this.length=0,this.parent=void 0,"number"==typeof arg?fromNumber(this,arg):"string"==typeof arg?fromString(this,arg,arguments.length>1?arguments[1]:"utf8"):fromObject(this,arg)):arguments.length>1?new Buffer(arg,arguments[1]):new Buffer(arg)}function fromNumber(that,length){if(that=allocate(that,0>length?0:0|checked(length)),!Buffer.TYPED_ARRAY_SUPPORT)for(var i=0;length>i;i++)that[i]=0;return that}function fromString(that,string,encoding){("string"!=typeof encoding||""===encoding)&&(encoding="utf8");var length=0|byteLength(string,encoding);return that=allocate(that,length),that.write(string,encoding),that}function fromObject(that,object){if(Buffer.isBuffer(object))return fromBuffer(that,object);if(isArray(object))return fromArray(that,object);if(null==object)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(object.buffer instanceof ArrayBuffer)return fromTypedArray(that,object);if(object instanceof ArrayBuffer)return fromArrayBuffer(that,object)}return object.length?fromArrayLike(that,object):fromJsonObject(that,object)}function fromBuffer(that,buffer){var length=0|checked(buffer.length);return that=allocate(that,length),buffer.copy(that,0,0,length),that}function fromArray(that,array){var length=0|checked(array.length);that=allocate(that,length);for(var i=0;length>i;i+=1)that[i]=255&array[i];return that}function fromTypedArray(that,array){var length=0|checked(array.length);that=allocate(that,length);for(var i=0;length>i;i+=1)that[i]=255&array[i];return that}function fromArrayBuffer(that,array){return Buffer.TYPED_ARRAY_SUPPORT?(array.byteLength,that=Buffer._augment(new Uint8Array(array))):that=fromTypedArray(that,new Uint8Array(array)),that}function fromArrayLike(that,array){var length=0|checked(array.length);that=allocate(that,length);for(var i=0;length>i;i+=1)that[i]=255&array[i];return that}function fromJsonObject(that,object){var array,length=0;"Buffer"===object.type&&isArray(object.data)&&(array=object.data,length=0|checked(array.length)),that=allocate(that,length);for(var i=0;length>i;i+=1)that[i]=255&array[i];return that}function allocate(that,length){Buffer.TYPED_ARRAY_SUPPORT?(that=Buffer._augment(new Uint8Array(length)),that.__proto__=Buffer.prototype):(that.length=length,that._isBuffer=!0);var fromPool=0!==length&&length<=Buffer.poolSize>>>1;return fromPool&&(that.parent=rootParent),that}function checked(length){if(length>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function SlowBuffer(subject,encoding){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding);var buf=new Buffer(subject,encoding);return delete buf.parent,buf}function byteLength(string,encoding){"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"binary":case"raw":case"raws":return len;case"utf8":case"utf-8":return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function slowToString(encoding,start,end){var loweredCase=!1;if(start=0|start,end=void 0===end||end===1/0?this.length:0|end,encoding||(encoding="utf8"),0>start&&(start=0),end>this.length&&(end=this.length),start>=end)return"";for(;;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;length?(length=Number(length),length>remaining&&(length=remaining)):length=remaining;var strLen=string.length;if(strLen%2!==0)throw new Error("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;length>i;i++){var parsed=parseInt(string.substr(2*i,2),16);if(isNaN(parsed))throw new Error("Invalid hex string");buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function binaryWrite(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64.fromByteArray(buf):base64.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;end>i;){var firstByte=buf[i],codePoint=null,bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(end>=i+bytesPerSequence){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:128>firstByte&&(codePoint=firstByte);break;case 2:secondByte=buf[i+1],128===(192&secondByte)&&(tempCodePoint=(31&firstByte)<<6|63&secondByte,tempCodePoint>127&&(codePoint=tempCodePoint));break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128===(192&secondByte)&&128===(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte,tempCodePoint>2047&&(55296>tempCodePoint||tempCodePoint>57343)&&(codePoint=tempCodePoint));break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128===(192&secondByte)&&128===(192&thirdByte)&&128===(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte,tempCodePoint>65535&&1114112>tempCodePoint&&(codePoint=tempCodePoint))}}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return decodeCodePointsArray(res)}function decodeCodePointsArray(codePoints){var len=codePoints.length;if(MAX_ARGUMENTS_LENGTH>=len)return String.fromCharCode.apply(String,codePoints);for(var res="",i=0;len>i;)res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH));return res}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;end>i;i++)ret+=String.fromCharCode(127&buf[i]);return ret}function binarySlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;end>i;i++)ret+=String.fromCharCode(buf[i]);return ret}function hexSlice(buf,start,end){var len=buf.length;(!start||0>start)&&(start=0),(!end||0>end||end>len)&&(end=len);for(var out="",i=start;end>i;i++)out+=toHex(buf[i]);return out}function utf16leSlice(buf,start,end){for(var bytes=buf.slice(start,end),res="",i=0;ioffset)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||min>value)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){0>value&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);j>i;i++)buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){0>value&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);j>i;i++)buf[offset+i]=value>>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||min>value)throw new RangeError("value is out of bounds");if(offset+ext>buf.length)throw new RangeError("index out of range");if(0>offset)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}function base64clean(str){if(str=stringtrim(str).replace(INVALID_BASE64_RE,""),str.length<2)return"";for(;str.length%4!==0;)str+="=";return str}function stringtrim(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}function toHex(n){return 16>n?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(string,units){units=units||1/0;for(var codePoint,length=string.length,leadSurrogate=null,bytes=[],i=0;length>i;i++){if(codePoint=string.charCodeAt(i),codePoint>55295&&57344>codePoint){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(56320>codePoint){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,128>codePoint){if((units-=1)<0)break;bytes.push(codePoint)}else if(2048>codePoint){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(65536>codePoint){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(1114112>codePoint))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function asciiToBytes(str){for(var byteArray=[],i=0;i>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;length>i&&!(i+offset>=dst.length||i>=src.length);i++)dst[i+offset]=src[i];return i}var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("is-array");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.poolSize=8192;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:typedArraySupport(),Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array),Buffer.isBuffer=function(b){return!(null==b||!b._isBuffer)},Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);len>i&&a[i]===b[i];)++i;return i!==len&&(x=a[i],y=b[i]),y>x?-1:x>y?1:0},Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(list,length){if(!isArray(list))throw new TypeError("list argument must be an Array of Buffers.");if(0===list.length)return new Buffer(0);var i;if(void 0===length)for(length=0,i=0;i0&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),""},Buffer.prototype.compare=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b?0:Buffer.compare(this,b)},Buffer.prototype.indexOf=function(val,byteOffset){function arrayIndexOf(arr,val,byteOffset){for(var foundIndex=-1,i=0;byteOffset+i2147483647?byteOffset=2147483647:-2147483648>byteOffset&&(byteOffset=-2147483648),byteOffset>>=0,0===this.length)return-1;if(byteOffset>=this.length)return-1;if(0>byteOffset&&(byteOffset=Math.max(this.length+byteOffset,0)),"string"==typeof val)return 0===val.length?-1:String.prototype.indexOf.call(this,val,byteOffset);if(Buffer.isBuffer(val))return arrayIndexOf(this,val,byteOffset);if("number"==typeof val)return Buffer.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,val,byteOffset):arrayIndexOf(this,[val],byteOffset);throw new TypeError("val must be string, number or Buffer")},Buffer.prototype.get=function(offset){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(offset)},Buffer.prototype.set=function(v,offset){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(v,offset)},Buffer.prototype.write=function(string,offset,length,encoding){if(void 0===offset)encoding="utf8",length=this.length,offset=0;else if(void 0===length&&"string"==typeof offset)encoding=offset,length=this.length,offset=0;else if(isFinite(offset))offset=0|offset,isFinite(length)?(length=0|length,void 0===encoding&&(encoding="utf8")):(encoding=length,length=void 0);else{var swap=encoding;encoding=offset,offset=0|length,length=swap}var remaining=this.length-offset;if((void 0===length||length>remaining)&&(length=remaining),string.length>0&&(0>length||0>offset)||offset>this.length)throw new RangeError("attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"binary":return binaryWrite(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start,end=void 0===end?len:~~end,0>start?(start+=len,0>start&&(start=0)):start>len&&(start=len),0>end?(end+=len,0>end&&(end=0)):end>len&&(end=len),start>end&&(end=start);var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT)newBuf=Buffer._augment(this.subarray(start,end));else{var sliceLen=end-start;newBuf=new Buffer(sliceLen,void 0);for(var i=0;sliceLen>i;i++)newBuf[i]=this[i+start]}return newBuf.length&&(newBuf.parent=this.parent||this),newBuf},Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset=0|offset,byteLength=0|byteLength,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i0&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset=0|offset,byteLength=0|byteLength,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset=0|offset,byteLength=0|byteLength,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];i>0&&(mul*=256);)val+=this[offset+--i]*mul;return mul*=128,val>=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),128&this[offset]?-1*(255-this[offset]+1):this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){value=+value,offset=0|offset,byteLength=0|byteLength,noAssert||checkInt(this,value,offset,byteLength,Math.pow(2,8*byteLength),0);var mul=1,i=0;for(this[offset]=255&value;++i=0&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset=0|offset,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0>value?1:0;for(this[offset]=255&value;++i>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset=0|offset,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0>value?1:0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),0>value&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),0>value&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&start>end&&(end=start),end===start)return 0;if(0===target.length||0===this.length)return 0;if(0>targetStart)throw new RangeError("targetStart out of bounds");if(0>start||start>=this.length)throw new RangeError("sourceStart out of bounds");if(0>end)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStartstart&&end>targetStart)for(i=len-1;i>=0;i--)target[i+targetStart]=this[i+start];else if(1e3>len||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;len>i;i++)target[i+targetStart]=this[i+start];else target._set(this.subarray(start,start+len),targetStart);return len},Buffer.prototype.fill=function(value,start,end){if(value||(value=0),start||(start=0),end||(end=this.length),start>end)throw new RangeError("end < start");if(end!==start&&0!==this.length){if(0>start||start>=this.length)throw new RangeError("start out of bounds");if(0>end||end>this.length)throw new RangeError("end out of bounds");var i;if("number"==typeof value)for(i=start;end>i;i++)this[i]=value;else{var bytes=utf8ToBytes(value.toString()),len=bytes.length;for(i=start;end>i;i++)this[i]=bytes[i%len]}return this}},Buffer.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(Buffer.TYPED_ARRAY_SUPPORT)return new Buffer(this).buffer;for(var buf=new Uint8Array(this.length),i=0,len=buf.length;len>i;i+=1)buf[i]=this[i];return buf.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var BP=Buffer.prototype;Buffer._augment=function(arr){return arr.constructor=Buffer,arr._isBuffer=!0,arr._set=arr.set,arr.get=BP.get,arr.set=BP.set,arr.write=BP.write,arr.toString=BP.toString,arr.toLocaleString=BP.toString,arr.toJSON=BP.toJSON,arr.equals=BP.equals,arr.compare=BP.compare,arr.indexOf=BP.indexOf,arr.copy=BP.copy,arr.slice=BP.slice,arr.readUIntLE=BP.readUIntLE,arr.readUIntBE=BP.readUIntBE,arr.readUInt8=BP.readUInt8,arr.readUInt16LE=BP.readUInt16LE,arr.readUInt16BE=BP.readUInt16BE,arr.readUInt32LE=BP.readUInt32LE,arr.readUInt32BE=BP.readUInt32BE,arr.readIntLE=BP.readIntLE,arr.readIntBE=BP.readIntBE,arr.readInt8=BP.readInt8,arr.readInt16LE=BP.readInt16LE,arr.readInt16BE=BP.readInt16BE,arr.readInt32LE=BP.readInt32LE,arr.readInt32BE=BP.readInt32BE,arr.readFloatLE=BP.readFloatLE,arr.readFloatBE=BP.readFloatBE,arr.readDoubleLE=BP.readDoubleLE,arr.readDoubleBE=BP.readDoubleBE,arr.writeUInt8=BP.writeUInt8,arr.writeUIntLE=BP.writeUIntLE,arr.writeUIntBE=BP.writeUIntBE,arr.writeUInt16LE=BP.writeUInt16LE,arr.writeUInt16BE=BP.writeUInt16BE,arr.writeUInt32LE=BP.writeUInt32LE,arr.writeUInt32BE=BP.writeUInt32BE,arr.writeIntLE=BP.writeIntLE,arr.writeIntBE=BP.writeIntBE,arr.writeInt8=BP.writeInt8,arr.writeInt16LE=BP.writeInt16LE,arr.writeInt16BE=BP.writeInt16BE,arr.writeInt32LE=BP.writeInt32LE,arr.writeInt32BE=BP.writeInt32BE,arr.writeFloatLE=BP.writeFloatLE,arr.writeFloatBE=BP.writeFloatBE,arr.writeDoubleLE=BP.writeDoubleLE,arr.writeDoubleBE=BP.writeDoubleBE,arr.fill=BP.fill,arr.inspect=BP.inspect,arr.toArrayBuffer=BP.toArrayBuffer,arr};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":123,ieee754:124,"is-array":125}],123:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(exports){"use strict";function decode(elt){var code=elt.charCodeAt(0);return code===PLUS||code===PLUS_URL_SAFE?62:code===SLASH||code===SLASH_URL_SAFE?63:NUMBER>code?-1:NUMBER+10>code?code-NUMBER+26+26:UPPER+26>code?code-UPPER:LOWER+26>code?code-LOWER+26:void 0}function b64ToByteArray(b64){function push(v){arr[L++]=v}var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0,arr=new Arr(3*b64.length/4-placeHolders),l=placeHolders>0?b64.length-4:b64.length;var L=0;for(i=0,j=0;l>i;i+=4,j+=3)tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3)),push((16711680&tmp)>>16),push((65280&tmp)>>8),push(255&tmp);return 2===placeHolders?(tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4,push(255&tmp)):1===placeHolders&&(tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2,push(tmp>>8&255),push(255&tmp)),arr}function uint8ToBase64(uint8){function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(63&num)}var i,temp,length,extraBytes=uint8.length%3,output="";for(i=0,length=uint8.length-extraBytes;length>i;i+=3)temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2],output+=tripletToBase64(temp);switch(extraBytes){case 1:temp=uint8[uint8.length-1],output+=encode(temp>>2),output+=encode(temp<<4&63),output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1],output+=encode(temp>>10),output+=encode(temp>>4&63),output+=encode(temp<<2&63),output+="="}return output}var Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,PLUS="+".charCodeAt(0),SLASH="/".charCodeAt(0),NUMBER="0".charCodeAt(0),LOWER="a".charCodeAt(0),UPPER="A".charCodeAt(0),PLUS_URL_SAFE="-".charCodeAt(0),SLASH_URL_SAFE="_".charCodeAt(0);exports.toByteArray=b64ToByteArray,exports.fromByteArray=uint8ToBase64}("undefined"==typeof exports?this.base64js={}:exports)},{}],124:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;nBits>0;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;nBits>0;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:(s?-1:1)*(1/0);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=0>value||0===value&&0>1/value?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),value+=e+eBias>=1?rt/c:rt*Math.pow(2,1-eBias),value*c>=2&&(e++,c/=2),e+eBias>=eMax?(m=0,e=eMax):e+eBias>=1?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));mLen>=8;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<0;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},{}],125:[function(require,module,exports){var isArray=Array.isArray,str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}],126:[function(require,module,exports){function drainQueue(){if(!draining){draining=!0;for(var currentQueue,len=queue.length;len;){currentQueue=queue,queue=[];for(var i=-1;++i-1||(list.push(token),setTokens(list))}function remove(token){var list=getTokens(),index=indexof(list,token);-1!==index&&(list.splice(index,1),setTokens(list))}function contains(token){return indexof(getTokens(),token)>-1}function toggle(token){return contains(token)?(remove(token),!1):(add(token),!0)}function $toString(){return elem.className}function item(index){var tokens=getTokens();return tokens[index]||null}function getTokens(){var className=elem.className;return filter(className.split(" "),isTruthy)}function setTokens(list){var length=list.length;elem.className=list.join(" "),classList.length=length;for(var i=0;i0)-(v<0)},exports.abs=function(v){var mask=v>>31;return(v^mask)-mask},exports.min=function(x,y){return y^(x^y)&-(x65535)<<4,v>>>=r,shift=(v>255)<<3,v>>>=shift,r|=shift,shift=(v>15)<<2,v>>>=shift,r|=shift,shift=(v>3)<<1,v>>>=shift,(r|=shift)|v>>1},exports.log10=function(v){return v>=1e9?9:v>=1e8?8:v>=1e7?7:v>=1e6?6:v>=1e5?5:v>=1e4?4:v>=1e3?3:v>=100?2:v>=10?1:0},exports.popCount=function(v){return v-=v>>>1&1431655765,16843009*((v=(858993459&v)+(v>>>2&858993459))+(v>>>4)&252645135)>>>24},exports.countTrailingZeros=countTrailingZeros,exports.nextPow2=function(v){return v+=0===v,--v,v|=v>>>1,v|=v>>>2,v|=v>>>4,v|=v>>>8,(v|=v>>>16)+1},exports.prevPow2=function(v){return v|=v>>>1,v|=v>>>2,v|=v>>>4,v|=v>>>8,(v|=v>>>16)-(v>>>1)},exports.parity=function(v){return v^=v>>>16,v^=v>>>8,v^=v>>>4,27030>>>(v&=15)&1};var REVERSE_TABLE=new Array(256);!function(tab){for(var i=0;i<256;++i){var v=i,r=i,s=7;for(v>>>=1;v;v>>>=1)r<<=1,r|=1&v,--s;tab[i]=r<>>8&255]<<16|REVERSE_TABLE[v>>>16&255]<<8|REVERSE_TABLE[v>>>24&255]},exports.interleave2=function(x,y){return x&=65535,x=16711935&(x|x<<8),x=252645135&(x|x<<4),x=858993459&(x|x<<2),x=1431655765&(x|x<<1),y&=65535,y=16711935&(y|y<<8),y=252645135&(y|y<<4),y=858993459&(y|y<<2),y=1431655765&(y|y<<1),x|y<<1},exports.deinterleave2=function(v,n){return v=v>>>n&1431655765,v=858993459&(v|v>>>1),v=252645135&(v|v>>>2),v=16711935&(v|v>>>4),(v=65535&(v|v>>>16))<<16>>16},exports.interleave3=function(x,y,z){return x&=1023,x=4278190335&(x|x<<16),x=251719695&(x|x<<8),x=3272356035&(x|x<<4),x=1227133513&(x|x<<2),y&=1023,y=4278190335&(y|y<<16),y=251719695&(y|y<<8),y=3272356035&(y|y<<4),y=1227133513&(y|y<<2),x|=y<<1,z&=1023,z=4278190335&(z|z<<16),z=251719695&(z|z<<8),z=3272356035&(z|z<<4),z=1227133513&(z|z<<2),x|z<<2},exports.deinterleave3=function(v,n){return v=v>>>n&1227133513,v=3272356035&(v|v>>>2),v=251719695&(v|v>>>4),v=4278190335&(v|v>>>8),(v=1023&(v|v>>>16))<<22>>22},exports.nextCombination=function(v){var t=v|v-1;return t+1|(~t&-~t)-1>>>countTrailingZeros(v)+1}},{}],9:[function(require,module,exports){function fit(canvas,parent,scale){function resize(){var p=resize.parent||canvas.parentNode;if("function"==typeof p)var dims=p(scratch)||scratch,width=dims[0],height=dims[1];else if(p&&p!==document.body)var psize=size(p),width=0|psize[0],height=0|psize[1];else var width=window.innerWidth,height=window.innerHeight;return isSVG?(canvas.setAttribute("width",width*resize.scale+"px"),canvas.setAttribute("height",height*resize.scale+"px")):(canvas.width=width*resize.scale,canvas.height=height*resize.scale),canvas.style.width=width+"px",canvas.style.height=height+"px",resize}var isSVG="SVG"===canvas.nodeName.toUpperCase();return canvas.style.position=canvas.style.position||"absolute",canvas.style.top=0,canvas.style.left=0,resize.scale=parseFloat(scale||1),resize.parent=parent,resize()}var size=require("element-size");module.exports=fit;var scratch=new Float32Array(2)},{"element-size":17}],10:[function(require,module,exports){(function(Buffer){"use strict";function objectToString(o){return Object.prototype.toString.call(o)}function clone(parent,circular,depth,prototype){function _clone(parent,depth){if(null===parent)return null;if(0==depth)return parent;var child,proto;if("object"!=typeof parent)return parent;if(util.isArray(parent))child=[];else if(util.isRegExp(parent))child=new RegExp(parent.source,util.getRegExpFlags(parent)),parent.lastIndex&&(child.lastIndex=parent.lastIndex);else if(util.isDate(parent))child=new Date(parent.getTime());else{if(useBuffer&&Buffer.isBuffer(parent))return child=new Buffer(parent.length),parent.copy(child),child;void 0===prototype?(proto=Object.getPrototypeOf(parent),child=Object.create(proto)):(child=Object.create(prototype),proto=prototype)}if(circular){var index=allParents.indexOf(parent);if(-1!=index)return allChildren[index];allParents.push(parent),allChildren.push(child)}for(var i in parent){var attrs;proto&&(attrs=Object.getOwnPropertyDescriptor(proto,i)),attrs&&null==attrs.set||(child[i]=_clone(parent[i],depth-1))}return child}var allParents=[],allChildren=[],useBuffer=void 0!==Buffer;return void 0===circular&&(circular=!0),void 0===depth&&(depth=1/0),_clone(parent,depth)}var util={isArray:function(ar){return Array.isArray(ar)||"object"==typeof ar&&"[object Array]"===objectToString(ar)},isDate:function(d){return"object"==typeof d&&"[object Date]"===objectToString(d)},isRegExp:function(re){return"object"==typeof re&&"[object RegExp]"===objectToString(re)},getRegExpFlags:function(re){var flags="";return re.global&&(flags+="g"),re.ignoreCase&&(flags+="i"),re.multiline&&(flags+="m"),flags}};"object"==typeof module&&(module.exports=clone),clone.clonePrototype=function(parent){if(null===parent)return null;var c=function(){};return c.prototype=parent,new c}}).call(this,require("buffer").Buffer)},{buffer:108}],11:[function(require,module,exports){function cubecube(w,h,d,filter){filter=filter||truthy;for(var size=[1/w,1/h,1/d],cubes=[],x=0;x0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===arg_type)proc.scalarArgs.push(i),proc.shimArgs.push("scalar"+i);else if("index"===arg_type){if(proc.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===arg_type){if(proc.shapeArgs.push(i),iproc_args.length)throw new Error("cwise: Too many arguments in pre() block");if(proc.body.args.length>proc_args.length)throw new Error("cwise: Too many arguments in body() block");if(proc.post.args.length>proc_args.length)throw new Error("cwise: Too many arguments in post() block");return proc.debug=!!user_args.printCode||!!user_args.debug,proc.funcName=user_args.funcName||"cwise",proc.blockSize=user_args.blockSize||64,createThunk(proc)}var createThunk=require("./lib/thunk.js");module.exports=compileCwise},{"./lib/thunk.js":14}],13:[function(require,module,exports){"use strict";function innerFill(order,proc,body){var i,j,dimension=order.length,nargs=proc.arrayArgs.length,has_index=proc.indexArgs.length>0,code=[],vars=[],idx=0,pidx=0;for(i=0;i0&&code.push("var "+vars.join(",")),i=dimension-1;i>=0;--i)idx=order[i],code.push(["for(i",i,"=0;i",i,"0&&code.push(["index[",pidx,"]-=s",pidx].join("")),code.push(["++index[",idx,"]"].join(""))),code.push("}")}return code.join("\n")}function outerFill(matched,order,proc,body){for(var dimension=order.length,nargs=proc.arrayArgs.length,blockSize=proc.blockSize,has_index=proc.indexArgs.length>0,code=[],i=0;i0;){"].join("")),code.push(["if(j",i,"<",blockSize,"){"].join("")),code.push(["s",order[i],"=j",i].join("")),code.push(["j",i,"=0"].join("")),code.push(["}else{s",order[i],"=",blockSize].join("")),code.push(["j",i,"-=",blockSize,"}"].join("")),has_index&&code.push(["index[",order[i],"]=j",i].join(""));for(var i=0;i0&&(allEqual=allEqual&&summary[i]===summary[i-1])}return allEqual?summary[0]:summary.join("")}function generateCWiseOp(proc,typesig){for(var dimension=typesig[1].length-Math.abs(proc.arrayBlockIndices[0])|0,orders=new Array(proc.arrayArgs.length),dtypes=new Array(proc.arrayArgs.length),i=0;i0&&vars.push("shape=SS.slice(0)"),proc.indexArgs.length>0){for(var zeros=new Array(dimension),i=0;i0&&code.push("var "+vars.join(","));for(var i=0;i3&&code.push(processBlock(proc.pre,proc,dtypes));var body=processBlock(proc.body,proc,dtypes),matched=countMatches(loopOrders);matched3&&code.push(processBlock(proc.post,proc,dtypes)),proc.debug&&console.log("-----Generated cwise routine for ",typesig,":\n"+code.join("\n")+"\n----------");var loopName=[proc.funcName||"unnamed","_cwise_loop_",orders[0].join("s"),"m",matched,typeSummary(dtypes)].join("");return new Function(["function ",loopName,"(",arglist.join(","),"){",code.join("\n"),"} return ",loopName].join(""))()}var uniq=require("uniq");module.exports=generateCWiseOp},{uniq:101}],14:[function(require,module,exports){"use strict";function createThunk(proc){var code=["'use strict'","var CACHED={}"],vars=[],thunkName=proc.funcName+"_cwise_thunk";code.push(["return function ",thunkName,"(",proc.shimArgs.join(","),"){"].join(""));for(var typesig=[],string_typesig=[],proc_args=[["array",proc.arrayArgs[0],".shape.slice(",Math.max(0,proc.arrayBlockIndices[0]),proc.arrayBlockIndices[0]<0?","+proc.arrayBlockIndices[0]+")":")"].join("")],shapeLengthConditions=[],shapeConditions=[],i=0;i0&&(shapeLengthConditions.push("array"+proc.arrayArgs[0]+".shape.length===array"+j+".shape.length+"+(Math.abs(proc.arrayBlockIndices[0])-Math.abs(proc.arrayBlockIndices[i]))),shapeConditions.push("array"+proc.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,proc.arrayBlockIndices[0])+"]===array"+j+".shape[shapeIndex+"+Math.max(0,proc.arrayBlockIndices[i])+"]"))}proc.arrayArgs.length>1&&(code.push("if (!("+shapeLengthConditions.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),code.push("for(var shapeIndex=array"+proc.arrayArgs[0]+".shape.length-"+Math.abs(proc.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),code.push("if (!("+shapeConditions.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),code.push("}"));for(var i=0;i0)return dupe_number(0|count,value);break;case"object":if("number"==typeof count.length)return dupe_array(count,value,0)}return[]}module.exports=dupe},{}],17:[function(require,module,exports){function getSize(element){if(element===window||element===document.body)return[window.innerWidth,window.innerHeight];if(!element.parentNode){var temporary=!0;document.body.appendChild(element)}var bounds=element.getBoundingClientRect(),styles=getComputedStyle(element),height=(0|bounds.height)+parse(styles.getPropertyValue("margin-top"))+parse(styles.getPropertyValue("margin-bottom")),width=(0|bounds.width)+parse(styles.getPropertyValue("margin-left"))+parse(styles.getPropertyValue("margin-right"));return temporary&&document.body.removeChild(element),[width,height]}function parse(prop){return parseFloat(prop)||0}module.exports=getSize},{}],18:[function(require,module,exports){function faceNormals(verts,output){var l=verts.length;output||(output=new Float32Array(l));for(var i=0;ilen)return gl.bufferData(type,data,usage),data.length;if(data.length+offset>len)throw new Error("gl-buffer: If resizing buffer, offset must be 0");return gl.bufferSubData(type,offset,data),len}function makeScratchTypeArray(array,dtype){for(var res=pool.malloc(array.length,dtype),n=array.length,i=0;i0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");this.gl.bufferData(this.type,array,this.usage),this.length=array}else if(array.shape){var dtype=array.dtype;if("float64"!==dtype&&"array"!==dtype&&"generic"!==dtype||(dtype="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER&&(dtype="uint16"),1!==array.shape.length)throw new Error("gl-buffer: Array length must be 1");if(dtype===array.dtype&&1===array.stride[0])0===array.offset&&array.data.length===array.shape[0]?this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data,offset):this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data.subarray(array.offset,array.shape[0]),offset);else{var tmp=pool.malloc(array.shape[0],dtype),ndt=ndarray(tmp);ops.assign(ndt,array),this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,tmp,offset),pool.free(tmp)}}else if(Array.isArray(array))if(this.type===this.gl.ELEMENT_ARRAY_BUFFER){var t=makeScratchTypeArray(array,"uint16");this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,t.subarray(0,array.length),offset),pool.freeUint16(t)}else{var t=makeScratchTypeArray(array,"float32");this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,t.subarray(0,array.length),offset),pool.freeFloat32(t)}else this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array,offset)},GLBuffer.prototype.draw=function(mode,count,offset){offset=offset||0;var gl=this.gl;if(this.type===gl.ARRAY_BUFFER)gl.drawArrays(mode,offset,count);else{if(this.type!==gl.ELEMENT_ARRAY_BUFFER)throw new Error("Invalid type for WebGL buffer");this.bind(),gl.drawElements(mode,count,gl.UNSIGNED_SHORT,offset)}},module.exports=createBuffer},{ndarray:70,"ndarray-ops":69,"typedarray-pool":99}],21:[function(require,module,exports){function defaults(opts){return{color:array(opts.color,[0,0,0,1]),depth:number(opts.depth,1),stencil:number(opts.stencil,!1)}}function number(n,def){return!1!==n&&(void 0===n?def:n+0)}function array(a,def){return!1!==a&&(Array.isArray(a)?a||def:def)}module.exports=defaults},{}],22:[function(require,module,exports){function clear(opts){opts=defaults(opts||{});var stencil=opts.stencil,color=opts.color,depth=opts.depth;return function(gl){var flags=0;return!1!==color&&(gl.clearColor(color[0],color[1],color[2],color[3]),flags|=gl.COLOR_BUFFER_BIT),!1!==depth&&(gl.clearDepth(depth),flags|=gl.DEPTH_BUFFER_BIT),!1!==stencil&&(gl.clearStencil(stencil),flags|=gl.STENCIL_BUFFER_BIT),gl.clear(flags),gl}}var defaults=require("./defaults");module.exports=clear},{"./defaults":21}],23:[function(require,module,exports){module.exports={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34e3:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"}},{}],24:[function(require,module,exports){var gl10=require("./1.0/numbers");module.exports=function(number){return gl10[number]}},{"./1.0/numbers":23}],25:[function(require,module,exports){function createContext(canvas,opts,render){function tick(){render(gl),raf(tick)}"function"==typeof opts?(render=opts,opts={}):opts=opts||{};var gl=canvas.getContext("webgl",opts)||canvas.getContext("webgl-experimental",opts)||canvas.getContext("experimental-webgl",opts);if(!gl)throw new Error("Unable to initialize WebGL");return render&&raf(tick),gl}var raf=require("raf-component");module.exports=createContext},{"raf-component":91}],26:[function(require,module,exports){"use strict";function lazyInitColorAttachments(gl,ext){var maxColorAttachments=gl.getParameter(ext.MAX_COLOR_ATTACHMENTS_WEBGL);colorAttachmentArrays=new Array(maxColorAttachments+1);for(var i=0;i<=maxColorAttachments;++i){for(var x=new Array(maxColorAttachments),j=0;j1&&ext.drawBuffersWEBGL(colorAttachmentArrays[numColor]),extensions.WEBGL_depth_texture?useStencil?fbo.depth=initTexture(gl,width,height,extensions.WEBGL_depth_texture.UNSIGNED_INT_24_8_WEBGL,gl.DEPTH_STENCIL,gl.DEPTH_STENCIL_ATTACHMENT):useDepth&&(fbo.depth=initTexture(gl,width,height,gl.UNSIGNED_SHORT,gl.DEPTH_COMPONENT,gl.DEPTH_ATTACHMENT)):useDepth&&useStencil?fbo._depth_rb=initRenderBuffer(gl,width,height,gl.DEPTH_STENCIL,gl.DEPTH_STENCIL_ATTACHMENT):useDepth?fbo._depth_rb=initRenderBuffer(gl,width,height,gl.DEPTH_COMPONENT16,gl.DEPTH_ATTACHMENT):useStencil&&(fbo._depth_rb=initRenderBuffer(gl,width,height,gl.STENCIL_INDEX,gl.STENCIL_ATTACHMENT));var status=gl.checkFramebufferStatus(gl.FRAMEBUFFER);if(status!==gl.FRAMEBUFFER_COMPLETE){fbo._destroyed=!0,gl.bindFramebuffer(gl.FRAMEBUFFER,null),gl.deleteFramebuffer(fbo.handle),fbo.handle=null,fbo.depth&&(fbo.depth.dispose(),fbo.depth=null),fbo._depth_rb&&(gl.deleteRenderbuffer(fbo._depth_rb),fbo._depth_rb=null);for(var i=0;imaxFBOSize||height<0||height>maxFBOSize)throw new Error("gl-fbo: Parameters are too large for FBO");options=options||{};var numColors=1;if("color"in options){if((numColors=Math.max(0|options.color,0))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(numColors>1){var mrtext=extensions.WEBGL_draw_buffers;if(!mrtext)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(numColors>gl.getParameter(mrtext.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+numColors+" draw buffers")}}var colorType=gl.UNSIGNED_BYTE;if(options.float&&numColors>0){if(!extensions.OES_texture_float)throw new Error("gl-fbo: Context does not support floating point textures");colorType=gl.FLOAT}else options.preferFloat&&numColors>0&&extensions.OES_texture_float&&(colorType=gl.FLOAT);var useDepth=!0;"depth"in options&&(useDepth=!!options.depth);var useStencil=!1;return"stencil"in options&&(useStencil=!!options.stencil),new Framebuffer(gl,width,height,colorType,numColors,useDepth,useStencil,extensions.WEBGL_draw_buffers)}var webglew=require("webglew"),createTexture=require("gl-texture2d");module.exports=createFBO;var FRAMEBUFFER_UNSUPPORTED,FRAMEBUFFER_INCOMPLETE_ATTACHMENT,FRAMEBUFFER_INCOMPLETE_DIMENSIONS,FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT,colorAttachmentArrays=null,proto=Framebuffer.prototype;Object.defineProperty(proto,"valid",{get:function(){return!this._destroyed}}),Object.defineProperty(proto,"shape",{get:function(){return this._destroyed?[0,0]:this._shape},set:function(x){if(this._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(!(this._shape[0]===x[0]|0&&this._shape[1]===x[1]|0)){var gl=this.gl,maxFBOSize=gl.getParameter(gl.MAX_RENDERBUFFER_SIZE);if(!Array.isArray(x)||2!==x.length||x[0]<0||x[0]>maxFBOSize||x[1]<0||x[1]>maxFBOSize)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");this._shape[0]=0|x[0],this._shape[1]=0|x[1];for(var i=0;ilen)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return gl.bufferSubData(type,offset,data),len}function makeScratchTypeArray(array,dtype){for(var res=pool.malloc(array.length,dtype),n=array.length,i=0;i=0;--i){if(stride[i]!==n)return!1;n*=shape[i]}return!0}function createBuffer(gl,data,type,usage){if(type=type||gl.ARRAY_BUFFER,usage=usage||gl.DYNAMIC_DRAW,type!==gl.ARRAY_BUFFER&&type!==gl.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(usage!==gl.DYNAMIC_DRAW&&usage!==gl.STATIC_DRAW&&usage!==gl.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var handle=gl.createBuffer(),result=new GLBuffer(gl,type,handle,0,usage);return result.update(data),result}var pool=require("typedarray-pool"),ops=require("ndarray-ops"),ndarray=require("ndarray"),SUPPORTED_TYPES=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],proto=GLBuffer.prototype;proto.bind=function(){this.gl.bindBuffer(this.type,this.handle)},proto.unbind=function(){this.gl.bindBuffer(this.type,null)},proto.dispose=function(){this.gl.deleteBuffer(this.handle)},proto.update=function(array,offset){if("number"!=typeof offset&&(offset=-1),this.bind(),"object"==typeof array&&void 0!==array.shape){var dtype=array.dtype;if(SUPPORTED_TYPES.indexOf(dtype)<0&&(dtype="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){dtype=gl.getExtension("OES_element_index_uint")&&"uint16"!==dtype?"uint32":"uint16"}if(dtype===array.dtype&&isPacked(array.shape,array.stride))0===array.offset&&array.data.length===array.shape[0]?this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data,offset):this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array.data.subarray(array.offset,array.shape[0]),offset);else{var tmp=pool.malloc(array.size,dtype),ndt=ndarray(tmp,array.shape);ops.assign(ndt,array),this.length=offset<0?updateTypeArray(this.gl,this.type,this.length,this.usage,tmp,offset):updateTypeArray(this.gl,this.type,this.length,this.usage,tmp.subarray(0,array.size),offset),pool.free(tmp)}}else if(Array.isArray(array)){var t;t=this.type===this.gl.ELEMENT_ARRAY_BUFFER?makeScratchTypeArray(array,"uint16"):makeScratchTypeArray(array,"float32"),this.length=offset<0?updateTypeArray(this.gl,this.type,this.length,this.usage,t,offset):updateTypeArray(this.gl,this.type,this.length,this.usage,t.subarray(0,array.length),offset),pool.free(t)}else if("object"==typeof array&&"number"==typeof array.length)this.length=updateTypeArray(this.gl,this.type,this.length,this.usage,array,offset);else{if("number"!=typeof array&&void 0!==array)throw new Error("gl-buffer: Invalid data type");if(offset>=0)throw new Error("gl-buffer: Cannot specify offset when resizing buffer");array|=0,array<=0&&(array=1),this.gl.bufferData(this.type,0|array,this.usage),this.length=array}},module.exports=createBuffer},{ndarray:70,"ndarray-ops":69,"typedarray-pool":37}],33:[function(require,module,exports){"use strict";function doBind(gl,elements,attributes){elements?elements.bind():gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,null);var nattribs=0|gl.getParameter(gl.MAX_VERTEX_ATTRIBS);if(attributes){if(attributes.length>nattribs)throw new Error("gl-vao: Too many vertex attributes");for(var i=0;i0?d.pop():new ArrayBuffer(n)}function mallocUint8(n){return new Uint8Array(mallocArrayBuffer(n),0,n)}
+function mallocUint16(n){return new Uint16Array(mallocArrayBuffer(2*n),0,n)}function mallocUint32(n){return new Uint32Array(mallocArrayBuffer(4*n),0,n)}function mallocInt8(n){return new Int8Array(mallocArrayBuffer(n),0,n)}function mallocInt16(n){return new Int16Array(mallocArrayBuffer(2*n),0,n)}function mallocInt32(n){return new Int32Array(mallocArrayBuffer(4*n),0,n)}function mallocFloat(n){return new Float32Array(mallocArrayBuffer(4*n),0,n)}function mallocDouble(n){return new Float64Array(mallocArrayBuffer(8*n),0,n)}function mallocUint8Clamped(n){return hasUint8C?new Uint8ClampedArray(mallocArrayBuffer(n),0,n):mallocUint8(n)}function mallocBigUint64(n){return hasBigUint64?new BigUint64Array(mallocArrayBuffer(8*n),0,n):null}function mallocBigInt64(n){return hasBigInt64?new BigInt64Array(mallocArrayBuffer(8*n),0,n):null}function mallocDataView(n){return new DataView(mallocArrayBuffer(n),0,n)}function mallocBuffer(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=BUFFER[log_n];return cache.length>0?cache.pop():new Buffer(n)}var bits=require("bit-twiddle"),dup=require("dup"),Buffer=require("buffer").Buffer;global.__TYPEDARRAY_POOL||(global.__TYPEDARRAY_POOL={UINT8:dup([32,0]),UINT16:dup([32,0]),UINT32:dup([32,0]),BIGUINT64:dup([32,0]),INT8:dup([32,0]),INT16:dup([32,0]),INT32:dup([32,0]),BIGINT64:dup([32,0]),FLOAT:dup([32,0]),DOUBLE:dup([32,0]),DATA:dup([32,0]),UINT8C:dup([32,0]),BUFFER:dup([32,0])});var hasUint8C="undefined"!=typeof Uint8ClampedArray,hasBigUint64="undefined"!=typeof BigUint64Array,hasBigInt64="undefined"!=typeof BigInt64Array,POOL=global.__TYPEDARRAY_POOL;POOL.UINT8C||(POOL.UINT8C=dup([32,0])),POOL.BIGUINT64||(POOL.BIGUINT64=dup([32,0])),POOL.BIGINT64||(POOL.BIGINT64=dup([32,0])),POOL.BUFFER||(POOL.BUFFER=dup([32,0]));var DATA=POOL.DATA,BUFFER=POOL.BUFFER;exports.free=function(array){if(Buffer.isBuffer(array))BUFFER[bits.log2(array.length)].push(array);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(array)&&(array=array.buffer),!array)return;var n=array.length||array.byteLength,log_n=0|bits.log2(n);DATA[log_n].push(array)}},exports.freeUint8=exports.freeUint16=exports.freeUint32=exports.freeBigUint64=exports.freeInt8=exports.freeInt16=exports.freeInt32=exports.freeBigInt64=exports.freeFloat32=exports.freeFloat=exports.freeFloat64=exports.freeDouble=exports.freeUint8Clamped=exports.freeDataView=freeTypedArray,exports.freeArrayBuffer=freeArrayBuffer,exports.freeBuffer=function(array){BUFFER[bits.log2(array.length)].push(array)},exports.malloc=function(n,dtype){if(void 0===dtype||"arraybuffer"===dtype)return mallocArrayBuffer(n);switch(dtype){case"uint8":return mallocUint8(n);case"uint16":return mallocUint16(n);case"uint32":return mallocUint32(n);case"int8":return mallocInt8(n);case"int16":return mallocInt16(n);case"int32":return mallocInt32(n);case"float":case"float32":return mallocFloat(n);case"double":case"float64":return mallocDouble(n);case"uint8_clamped":return mallocUint8Clamped(n);case"bigint64":return mallocBigInt64(n);case"biguint64":return mallocBigUint64(n);case"buffer":return mallocBuffer(n);case"data":case"dataview":return mallocDataView(n);default:return null}return null},exports.mallocArrayBuffer=mallocArrayBuffer,exports.mallocUint8=mallocUint8,exports.mallocUint16=mallocUint16,exports.mallocUint32=mallocUint32,exports.mallocInt8=mallocInt8,exports.mallocInt16=mallocInt16,exports.mallocInt32=mallocInt32,exports.mallocFloat32=exports.mallocFloat=mallocFloat,exports.mallocFloat64=exports.mallocDouble=mallocDouble,exports.mallocUint8Clamped=mallocUint8Clamped,exports.mallocBigUint64=mallocBigUint64,exports.mallocBigInt64=mallocBigInt64,exports.mallocDataView=mallocDataView,exports.mallocBuffer=mallocBuffer,exports.clearCache=function(){for(var i=0;i<32;++i)POOL.UINT8[i].length=0,POOL.UINT16[i].length=0,POOL.UINT32[i].length=0,POOL.INT8[i].length=0,POOL.INT16[i].length=0,POOL.INT32[i].length=0,POOL.FLOAT[i].length=0,POOL.DOUBLE[i].length=0,POOL.BIGUINT64[i].length=0,POOL.BIGINT64[i].length=0,POOL.UINT8C[i].length=0,DATA[i].length=0,BUFFER[i].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":30,buffer:108,dup:31}],38:[function(require,module,exports){function normalize(gl,attr,size,mode,type){return Array.isArray(attr)&&Array.isArray(attr[0])?{buffer:createBuffer(gl,pack(attr,type),mode),length:attr.length}:Array.isArray(attr)?{buffer:createBuffer(gl,new(dtype(type))(attr),mode),length:attr.length/size}:attr.handle instanceof WebGLBuffer?{buffer:attr,length:attr.length/size/4}:attr.cells&&attr.positions?{length:attr.cells.length*size,buffer:createBuffer(gl,pack(attr.positions,type),mode),index:createBuffer(gl,pack(attr.cells,"uint16"),gl.ELEMENT_ARRAY_BUFFER)}:isnd(attr)?{buffer:createBuffer(gl,attr,mode),length:ndlength(attr.shape)/size}:ista(attr)?(!type||attr instanceof dtype(type)||(attr=convert(attr,dtype(type))),{buffer:createBuffer(gl,attr,mode),length:attr.length/size}):void 0}function ndlength(shape){for(var length=1,i=0;i0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=a*o,t[2]=e*o,t[3]=u*o),t},n.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},n.lerp=function(t,n,r,a){var e=n[0],u=n[1],o=n[2],i=n[3];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t[2]=o+a*(r[2]-o),t[3]=i+a*(r[3]-i),t},n.random=function(t,n){var r,e,u,o,i,s;n=n||1;do{r=2*a.RANDOM()-1,e=2*a.RANDOM()-1,i=r*r+e*e}while(i>=1);do{u=2*a.RANDOM()-1,o=2*a.RANDOM()-1,s=u*u+o*o}while(s>=1);var c=Math.sqrt((1-i)/s);return t[0]=n*r,t[1]=n*e,t[2]=n*u*c,t[3]=n*o*c,t},n.transformMat4=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3];return t[0]=r[0]*a+r[4]*e+r[8]*u+r[12]*o,t[1]=r[1]*a+r[5]*e+r[9]*u+r[13]*o,t[2]=r[2]*a+r[6]*e+r[10]*u+r[14]*o,t[3]=r[3]*a+r[7]*e+r[11]*u+r[15]*o,t},n.transformQuat=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[0],i=r[1],s=r[2],c=r[3],f=c*a+i*u-s*e,M=c*e+s*a-o*u,h=c*u+o*e-i*a,l=-o*a-i*e-s*u;return t[0]=f*c+l*-o+M*-s-h*-i,t[1]=M*c+l*-i+h*-o-f*-s,t[2]=h*c+l*-s+f*-i-M*-o,t[3]=n[3],t},n.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=n[0],s=n[1],c=n[2],f=n[3];return Math.abs(r-i)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(e-s)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(s))&&Math.abs(u-c)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(c))&&Math.abs(o-f)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.sub=u,n.mul=o,n.div=i,n.dist=s,n.sqrDist=c,n.len=f,n.sqrLen=M,n.forEach=function(){var t=e();return function(n,r,a,e,u,o){var i=void 0,s=void 0;for(r||(r=4),a||(a=0),s=e?Math.min(e*r+a,n.length):n.length,i=a;i0&&(u=1/Math.sqrt(u),t[0]=n[0]*u,t[1]=n[1]*u,t[2]=n[2]*u),t}function v(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}Object.defineProperty(n,"__esModule",{value:!0}),n.forEach=n.sqrLen=n.len=n.sqrDist=n.dist=n.div=n.mul=n.sub=void 0,n.create=e,n.clone=function(t){var n=new a.ARRAY_TYPE(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n},n.length=u,n.fromValues=o,n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},n.set=function(t,n,r,a){return t[0]=n,t[1]=r,t[2]=a,t},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t},n.subtract=i,n.multiply=s,n.divide=c,n.ceil=function(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t},n.floor=function(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t},n.min=function(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t[2]=Math.min(n[2],r[2]),t},n.max=function(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t[2]=Math.max(n[2],r[2]),t},n.round=function(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t},n.scale=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t},n.scaleAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t},n.distance=f,n.squaredDistance=M,n.squaredLength=h,n.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t},n.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t},n.normalize=l,n.dot=v,n.cross=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[0],i=r[1],s=r[2];return t[0]=e*s-u*i,t[1]=u*o-a*s,t[2]=a*i-e*o,t},n.lerp=function(t,n,r,a){var e=n[0],u=n[1],o=n[2];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t[2]=o+a*(r[2]-o),t},n.hermite=function(t,n,r,a,e,u){var o=u*u,i=o*(2*u-3)+1,s=o*(u-2)+u,c=o*(u-1),f=o*(3-2*u);return t[0]=n[0]*i+r[0]*s+a[0]*c+e[0]*f,t[1]=n[1]*i+r[1]*s+a[1]*c+e[1]*f,t[2]=n[2]*i+r[2]*s+a[2]*c+e[2]*f,t},n.bezier=function(t,n,r,a,e,u){var o=1-u,i=o*o,s=u*u,c=i*o,f=3*u*i,M=3*s*o,h=s*u;return t[0]=n[0]*c+r[0]*f+a[0]*M+e[0]*h,t[1]=n[1]*c+r[1]*f+a[1]*M+e[1]*h,t[2]=n[2]*c+r[2]*f+a[2]*M+e[2]*h,t},n.random=function(t,n){n=n||1;var r=2*a.RANDOM()*Math.PI,e=2*a.RANDOM()-1,u=Math.sqrt(1-e*e)*n;return t[0]=Math.cos(r)*u,t[1]=Math.sin(r)*u,t[2]=e*n,t},n.transformMat4=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[3]*a+r[7]*e+r[11]*u+r[15];return o=o||1,t[0]=(r[0]*a+r[4]*e+r[8]*u+r[12])/o,t[1]=(r[1]*a+r[5]*e+r[9]*u+r[13])/o,t[2]=(r[2]*a+r[6]*e+r[10]*u+r[14])/o,t},n.transformMat3=function(t,n,r){var a=n[0],e=n[1],u=n[2];return t[0]=a*r[0]+e*r[3]+u*r[6],t[1]=a*r[1]+e*r[4]+u*r[7],t[2]=a*r[2]+e*r[5]+u*r[8],t},n.transformQuat=function(t,n,r){var a=r[0],e=r[1],u=r[2],o=r[3],i=n[0],s=n[1],c=n[2],f=e*c-u*s,M=u*i-a*c,h=a*s-e*i,l=e*h-u*M,v=u*f-a*h,d=a*M-e*f,b=2*o;return f*=b,M*=b,h*=b,l*=2,v*=2,d*=2,t[0]=i+f+l,t[1]=s+M+v,t[2]=c+h+d,t},n.rotateX=function(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[0],u[1]=e[1]*Math.cos(a)-e[2]*Math.sin(a),u[2]=e[1]*Math.sin(a)+e[2]*Math.cos(a),t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t},n.rotateY=function(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[2]*Math.sin(a)+e[0]*Math.cos(a),u[1]=e[1],u[2]=e[2]*Math.cos(a)-e[0]*Math.sin(a),t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t},n.rotateZ=function(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[0]*Math.cos(a)-e[1]*Math.sin(a),u[1]=e[0]*Math.sin(a)+e[1]*Math.cos(a),u[2]=e[2],t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t},n.angle=function(t,n){var r=o(t[0],t[1],t[2]),a=o(n[0],n[1],n[2]);l(r,r),l(a,a);var e=v(r,a);return e>1?0:e<-1?Math.PI:Math.acos(e)},n.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=n[0],i=n[1],s=n[2];return Math.abs(r-o)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(e-i)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(i))&&Math.abs(u-s)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(s))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.sub=i,n.mul=s,n.div=c,n.dist=f,n.sqrDist=M,n.len=u,n.sqrLen=h,n.forEach=function(){var t=e();return function(n,r,a,e,u,o){var i=void 0,s=void 0;for(r||(r=3),a||(a=0),s=e?Math.min(e*r+a,n.length):n.length,i=a;ia.EPSILON?(l=Math.acos(v),d=Math.sin(l),b=Math.sin((1-e)*l)/d,m=Math.sin(e*l)/d):(b=1-e,m=e),t[0]=b*u+m*c,t[1]=b*o+m*f,t[2]=b*i+m*M,t[3]=b*s+m*h,t}function h(t,n){var r=n[0]+n[4]+n[8],a=void 0;if(r>0)a=Math.sqrt(r+1),t[3]=.5*a,a=.5/a,t[0]=(n[5]-n[7])*a,t[1]=(n[6]-n[2])*a,t[2]=(n[1]-n[3])*a;else{var e=0;n[4]>n[0]&&(e=1),n[8]>n[3*e+e]&&(e=2);var u=(e+1)%3,o=(e+2)%3;a=Math.sqrt(n[3*e+e]-n[3*u+u]-n[3*o+o]+1),t[e]=.5*a,a=.5/a,t[3]=(n[3*u+o]-n[3*o+u])*a,t[u]=(n[3*u+e]+n[3*e+u])*a,t[o]=(n[3*o+e]+n[3*e+o])*a}return t}Object.defineProperty(n,"__esModule",{value:!0}),n.setAxes=n.sqlerp=n.rotationTo=n.equals=n.exactEquals=n.normalize=n.sqrLen=n.squaredLength=n.len=n.length=n.lerp=n.dot=n.scale=n.mul=n.add=n.set=n.copy=n.fromValues=n.clone=void 0,n.create=s,n.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},n.setAxisAngle=c,n.getAxisAngle=function(t,n){var r=2*Math.acos(n[3]),e=Math.sin(r/2);return e>a.EPSILON?(t[0]=n[0]/e,t[1]=n[1]/e,t[2]=n[2]/e):(t[0]=1,t[1]=0,t[2]=0),r},n.multiply=f,n.rotateX=function(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s+o*i,t[1]=e*s+u*i,t[2]=u*s-e*i,t[3]=o*s-a*i,t},n.rotateY=function(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s-u*i,t[1]=e*s+o*i,t[2]=u*s+a*i,t[3]=o*s-e*i,t},n.rotateZ=function(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s+e*i,t[1]=e*s-a*i,t[2]=u*s+o*i,t[3]=o*s-u*i,t},n.calculateW=function(t,n){var r=n[0],a=n[1],e=n[2];return t[0]=r,t[1]=a,t[2]=e,t[3]=Math.sqrt(Math.abs(1-r*r-a*a-e*e)),t},n.slerp=M,n.random=function(t){var n=a.RANDOM(),r=a.RANDOM(),e=a.RANDOM(),u=Math.sqrt(1-n),o=Math.sqrt(n);return t[0]=u*Math.sin(2*Math.PI*r),t[1]=u*Math.cos(2*Math.PI*r),t[2]=o*Math.sin(2*Math.PI*e),t[3]=o*Math.cos(2*Math.PI*e),t},n.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r*r+a*a+e*e+u*u,i=o?1/o:0;return t[0]=-r*i,t[1]=-a*i,t[2]=-e*i,t[3]=u*i,t},n.conjugate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t},n.fromMat3=h,n.fromEuler=function(t,n,r,a){var e=.5*Math.PI/180;n*=e,r*=e,a*=e;var u=Math.sin(n),o=Math.cos(n),i=Math.sin(r),s=Math.cos(r),c=Math.sin(a),f=Math.cos(a);return t[0]=u*s*f-o*i*c,t[1]=o*i*f+u*s*c,t[2]=o*s*c-u*i*f,t[3]=o*s*f+u*i*c,t},n.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"};var a=i(r(0)),e=i(r(5)),u=i(r(2)),o=i(r(1));n.clone=o.clone,n.fromValues=o.fromValues,n.copy=o.copy,n.set=o.set,n.add=o.add,n.mul=f,n.scale=o.scale,n.dot=o.dot,n.lerp=o.lerp;var l=n.length=o.length,v=(n.len=l,n.squaredLength=o.squaredLength),d=(n.sqrLen=v,n.normalize=o.normalize);n.exactEquals=o.exactEquals,n.equals=o.equals,n.rotationTo=function(){var t=u.create(),n=u.fromValues(1,0,0),r=u.fromValues(0,1,0);return function(a,e,o){var i=u.dot(e,o);return i<-.999999?(u.cross(t,n,e),u.len(t)<1e-6&&u.cross(t,r,e),u.normalize(t,t),c(a,t,Math.PI),a):i>.999999?(a[0]=0,a[1]=0,a[2]=0,a[3]=1,a):(u.cross(t,e,o),a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=1+i,d(a,a))}}(),n.sqlerp=function(){var t=s(),n=s();return function(r,a,e,u,o,i){return M(t,a,o,i),M(n,e,u,i),M(r,t,n,2*i*(1-i)),r}}(),n.setAxes=function(){var t=e.create();return function(n,r,a,e){return t[0]=a[0],t[3]=a[1],t[6]=a[2],t[1]=e[0],t[4]=e[1],t[7]=e[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],d(n,h(n,t))}}()},function(t,n,r){"use strict";function e(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function u(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=n[6],f=n[7],M=n[8],h=n[9],l=n[10],v=n[11],d=n[12],b=n[13],m=n[14],p=n[15],P=r[0],A=r[1],E=r[2],O=r[3];return t[0]=P*a+A*i+E*M+O*d,t[1]=P*e+A*s+E*h+O*b,t[2]=P*u+A*c+E*l+O*m,t[3]=P*o+A*f+E*v+O*p,P=r[4],A=r[5],E=r[6],O=r[7],t[4]=P*a+A*i+E*M+O*d,t[5]=P*e+A*s+E*h+O*b,t[6]=P*u+A*c+E*l+O*m,t[7]=P*o+A*f+E*v+O*p,P=r[8],A=r[9],E=r[10],O=r[11],t[8]=P*a+A*i+E*M+O*d,t[9]=P*e+A*s+E*h+O*b,t[10]=P*u+A*c+E*l+O*m,t[11]=P*o+A*f+E*v+O*p,P=r[12],A=r[13],E=r[14],O=r[15],t[12]=P*a+A*i+E*M+O*d,t[13]=P*e+A*s+E*h+O*b,t[14]=P*u+A*c+E*l+O*m,t[15]=P*o+A*f+E*v+O*p,t}function o(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=a+a,s=e+e,c=u+u,f=a*i,M=a*s,h=a*c,l=e*s,v=e*c,d=u*c,b=o*i,m=o*s,p=o*c;return t[0]=1-(l+d),t[1]=M+p,t[2]=h-m,t[3]=0,t[4]=M-p,t[5]=1-(f+d),t[6]=v+b,t[7]=0,t[8]=h+m,t[9]=v-b,t[10]=1-(f+l),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function i(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t[4]=n[4]-r[4],t[5]=n[5]-r[5],t[6]=n[6]-r[6],t[7]=n[7]-r[7],t[8]=n[8]-r[8],t[9]=n[9]-r[9],t[10]=n[10]-r[10],t[11]=n[11]-r[11],t[12]=n[12]-r[12],t[13]=n[13]-r[13],t[14]=n[14]-r[14],t[15]=n[15]-r[15],t}Object.defineProperty(n,"__esModule",{value:!0}),n.sub=n.mul=void 0,n.create=function(){var t=new a.ARRAY_TYPE(16);return a.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},n.clone=function(t){var n=new a.ARRAY_TYPE(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},n.fromValues=function(t,n,r,e,u,o,i,s,c,f,M,h,l,v,d,b){var m=new a.ARRAY_TYPE(16);return m[0]=t,m[1]=n,m[2]=r,m[3]=e,m[4]=u,m[5]=o,m[6]=i,m[7]=s,m[8]=c,m[9]=f,m[10]=M,m[11]=h,m[12]=l,m[13]=v,m[14]=d,m[15]=b,m},n.set=function(t,n,r,a,e,u,o,i,s,c,f,M,h,l,v,d,b){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t[4]=u,t[5]=o,t[6]=i,t[7]=s,t[8]=c,t[9]=f,t[10]=M,t[11]=h,t[12]=l,t[13]=v,t[14]=d,t[15]=b,t},n.identity=e,n.transpose=function(t,n){if(t===n){var r=n[1],a=n[2],e=n[3],u=n[6],o=n[7],i=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=r,t[6]=n[9],t[7]=n[13],t[8]=a,t[9]=u,t[11]=n[14],t[12]=e,t[13]=o,t[14]=i}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t},n.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=n[6],c=n[7],f=n[8],M=n[9],h=n[10],l=n[11],v=n[12],d=n[13],b=n[14],m=n[15],p=r*i-a*o,P=r*s-e*o,A=r*c-u*o,E=a*s-e*i,O=a*c-u*i,R=e*c-u*s,y=f*d-M*v,q=f*b-h*v,x=f*m-l*v,_=M*b-h*d,Y=M*m-l*d,L=h*m-l*b,S=p*L-P*Y+A*_+E*x-O*q+R*y;return S?(S=1/S,t[0]=(i*L-s*Y+c*_)*S,t[1]=(e*Y-a*L-u*_)*S,t[2]=(d*R-b*O+m*E)*S,t[3]=(h*O-M*R-l*E)*S,t[4]=(s*x-o*L-c*q)*S,t[5]=(r*L-e*x+u*q)*S,t[6]=(b*A-v*R-m*P)*S,t[7]=(f*R-h*A+l*P)*S,t[8]=(o*Y-i*x+c*y)*S,t[9]=(a*x-r*Y-u*y)*S,t[10]=(v*O-d*A+m*p)*S,t[11]=(M*A-f*O-l*p)*S,t[12]=(i*q-o*_-s*y)*S,t[13]=(r*_-a*q+e*y)*S,t[14]=(d*P-v*E-b*p)*S,t[15]=(f*E-M*P+h*p)*S,t):null},n.adjoint=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=n[6],c=n[7],f=n[8],M=n[9],h=n[10],l=n[11],v=n[12],d=n[13],b=n[14],m=n[15];return t[0]=i*(h*m-l*b)-M*(s*m-c*b)+d*(s*l-c*h),t[1]=-(a*(h*m-l*b)-M*(e*m-u*b)+d*(e*l-u*h)),t[2]=a*(s*m-c*b)-i*(e*m-u*b)+d*(e*c-u*s),t[3]=-(a*(s*l-c*h)-i*(e*l-u*h)+M*(e*c-u*s)),t[4]=-(o*(h*m-l*b)-f*(s*m-c*b)+v*(s*l-c*h)),t[5]=r*(h*m-l*b)-f*(e*m-u*b)+v*(e*l-u*h),t[6]=-(r*(s*m-c*b)-o*(e*m-u*b)+v*(e*c-u*s)),t[7]=r*(s*l-c*h)-o*(e*l-u*h)+f*(e*c-u*s),t[8]=o*(M*m-l*d)-f*(i*m-c*d)+v*(i*l-c*M),t[9]=-(r*(M*m-l*d)-f*(a*m-u*d)+v*(a*l-u*M)),t[10]=r*(i*m-c*d)-o*(a*m-u*d)+v*(a*c-u*i),t[11]=-(r*(i*l-c*M)-o*(a*l-u*M)+f*(a*c-u*i)),t[12]=-(o*(M*b-h*d)-f*(i*b-s*d)+v*(i*h-s*M)),t[13]=r*(M*b-h*d)-f*(a*b-e*d)+v*(a*h-e*M),t[14]=-(r*(i*b-s*d)-o*(a*b-e*d)+v*(a*s-e*i)),t[15]=r*(i*h-s*M)-o*(a*h-e*M)+f*(a*s-e*i),t},n.determinant=function(t){var n=t[0],r=t[1],a=t[2],e=t[3],u=t[4],o=t[5],i=t[6],s=t[7],c=t[8],f=t[9],M=t[10],h=t[11],l=t[12],v=t[13],d=t[14],b=t[15];return(n*o-r*u)*(M*b-h*d)-(n*i-a*u)*(f*b-h*v)+(n*s-e*u)*(f*d-M*v)+(r*i-a*o)*(c*b-h*l)-(r*s-e*o)*(c*d-M*l)+(a*s-e*i)*(c*v-f*l)},n.multiply=u,n.translate=function(t,n,r){var a=r[0],e=r[1],u=r[2],o=void 0,i=void 0,s=void 0,c=void 0,f=void 0,M=void 0,h=void 0,l=void 0,v=void 0,d=void 0,b=void 0,m=void 0;return n===t?(t[12]=n[0]*a+n[4]*e+n[8]*u+n[12],t[13]=n[1]*a+n[5]*e+n[9]*u+n[13],t[14]=n[2]*a+n[6]*e+n[10]*u+n[14],t[15]=n[3]*a+n[7]*e+n[11]*u+n[15]):(o=n[0],i=n[1],s=n[2],c=n[3],f=n[4],M=n[5],h=n[6],l=n[7],v=n[8],d=n[9],b=n[10],m=n[11],t[0]=o,t[1]=i,t[2]=s,t[3]=c,t[4]=f,t[5]=M,t[6]=h,t[7]=l,t[8]=v,t[9]=d,t[10]=b,t[11]=m,t[12]=o*a+f*e+v*u+n[12],t[13]=i*a+M*e+d*u+n[13],t[14]=s*a+h*e+b*u+n[14],t[15]=c*a+l*e+m*u+n[15]),t},n.scale=function(t,n,r){var a=r[0],e=r[1],u=r[2];return t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a,t[3]=n[3]*a,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*u,t[9]=n[9]*u,t[10]=n[10]*u,t[11]=n[11]*u,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},n.rotate=function(t,n,r,e){var u=e[0],o=e[1],i=e[2],s=Math.sqrt(u*u+o*o+i*i),c=void 0,f=void 0,M=void 0,h=void 0,l=void 0,v=void 0,d=void 0,b=void 0,m=void 0,p=void 0,P=void 0,A=void 0,E=void 0,O=void 0,R=void 0,y=void 0,q=void 0,x=void 0,_=void 0,Y=void 0,L=void 0,S=void 0,w=void 0,I=void 0;return s0?(r[0]=2*(c*s+h*e+f*i-M*u)/l,r[1]=2*(f*s+h*u+M*e-c*i)/l,r[2]=2*(M*s+h*i+c*u-f*e)/l):(r[0]=2*(c*s+h*e+f*i-M*u),r[1]=2*(f*s+h*u+M*e-c*i),r[2]=2*(M*s+h*i+c*u-f*e)),o(t,n,r),t},n.getTranslation=function(t,n){return t[0]=n[12],t[1]=n[13],t[2]=n[14],t},n.getScaling=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[4],o=n[5],i=n[6],s=n[8],c=n[9],f=n[10];return t[0]=Math.sqrt(r*r+a*a+e*e),t[1]=Math.sqrt(u*u+o*o+i*i),t[2]=Math.sqrt(s*s+c*c+f*f),t},n.getRotation=function(t,n){var r=n[0]+n[5]+n[10],a=0;return r>0?(a=2*Math.sqrt(r+1),t[3]=.25*a,t[0]=(n[6]-n[9])/a,t[1]=(n[8]-n[2])/a,t[2]=(n[1]-n[4])/a):n[0]>n[5]&&n[0]>n[10]?(a=2*Math.sqrt(1+n[0]-n[5]-n[10]),t[3]=(n[6]-n[9])/a,t[0]=.25*a,t[1]=(n[1]+n[4])/a,t[2]=(n[8]+n[2])/a):n[5]>n[10]?(a=2*Math.sqrt(1+n[5]-n[0]-n[10]),t[3]=(n[8]-n[2])/a,t[0]=(n[1]+n[4])/a,t[1]=.25*a,t[2]=(n[6]+n[9])/a):(a=2*Math.sqrt(1+n[10]-n[0]-n[5]),t[3]=(n[1]-n[4])/a,t[0]=(n[8]+n[2])/a,t[1]=(n[6]+n[9])/a,t[2]=.25*a),t},n.fromRotationTranslationScale=function(t,n,r,a){var e=n[0],u=n[1],o=n[2],i=n[3],s=e+e,c=u+u,f=o+o,M=e*s,h=e*c,l=e*f,v=u*c,d=u*f,b=o*f,m=i*s,p=i*c,P=i*f,A=a[0],E=a[1],O=a[2];return t[0]=(1-(v+b))*A,t[1]=(h+P)*A,t[2]=(l-p)*A,t[3]=0,t[4]=(h-P)*E,t[5]=(1-(M+b))*E,t[6]=(d+m)*E,t[7]=0,t[8]=(l+p)*O,t[9]=(d-m)*O,t[10]=(1-(M+v))*O,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},n.fromRotationTranslationScaleOrigin=function(t,n,r,a,e){var u=n[0],o=n[1],i=n[2],s=n[3],c=u+u,f=o+o,M=i+i,h=u*c,l=u*f,v=u*M,d=o*f,b=o*M,m=i*M,p=s*c,P=s*f,A=s*M,E=a[0],O=a[1],R=a[2],y=e[0],q=e[1],x=e[2],_=(1-(d+m))*E,Y=(l+A)*E,L=(v-P)*E,S=(l-A)*O,w=(1-(h+m))*O,I=(b+p)*O,N=(v+P)*R,g=(b-p)*R,T=(1-(h+d))*R;return t[0]=_,t[1]=Y,t[2]=L,t[3]=0,t[4]=S,t[5]=w,t[6]=I,t[7]=0,t[8]=N,t[9]=g,t[10]=T,t[11]=0,t[12]=r[0]+y-(_*y+S*q+N*x),t[13]=r[1]+q-(Y*y+w*q+g*x),t[14]=r[2]+x-(L*y+I*q+T*x),t[15]=1,t},n.fromQuat=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r+r,i=a+a,s=e+e,c=r*o,f=a*o,M=a*i,h=e*o,l=e*i,v=e*s,d=u*o,b=u*i,m=u*s;return t[0]=1-M-v,t[1]=f+m,t[2]=h-b,t[3]=0,t[4]=f-m,t[5]=1-c-v,t[6]=l+d,t[7]=0,t[8]=h+b,t[9]=l-d,t[10]=1-c-M,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},n.frustum=function(t,n,r,a,e,u,o){var i=1/(r-n),s=1/(e-a),c=1/(u-o);return t[0]=2*u*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*u*s,t[6]=0,t[7]=0,t[8]=(r+n)*i,t[9]=(e+a)*s,t[10]=(o+u)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*u*2*c,t[15]=0,t},n.perspective=function(t,n,r,a,e){var u=1/Math.tan(n/2),o=void 0;return t[0]=u/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=e&&e!==1/0?(o=1/(a-e),
+t[10]=(e+a)*o,t[14]=2*e*a*o):(t[10]=-1,t[14]=-2*a),t},n.perspectiveFromFieldOfView=function(t,n,r,a){var e=Math.tan(n.upDegrees*Math.PI/180),u=Math.tan(n.downDegrees*Math.PI/180),o=Math.tan(n.leftDegrees*Math.PI/180),i=Math.tan(n.rightDegrees*Math.PI/180),s=2/(o+i),c=2/(e+u);return t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(o-i)*s*.5,t[9]=(e-u)*c*.5,t[10]=a/(r-a),t[11]=-1,t[12]=0,t[13]=0,t[14]=a*r/(r-a),t[15]=0,t},n.ortho=function(t,n,r,a,e,u,o){var i=1/(n-r),s=1/(a-e),c=1/(u-o);return t[0]=-2*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(n+r)*i,t[13]=(e+a)*s,t[14]=(o+u)*c,t[15]=1,t},n.lookAt=function(t,n,r,u){var o=void 0,i=void 0,s=void 0,c=void 0,f=void 0,M=void 0,h=void 0,l=void 0,v=void 0,d=void 0,b=n[0],m=n[1],p=n[2],P=u[0],A=u[1],E=u[2],O=r[0],R=r[1],y=r[2];return Math.abs(b-O)0&&(l=1/Math.sqrt(l),f*=l,M*=l,h*=l);var v=s*h-c*M,d=c*f-i*h,b=i*M-s*f;return(l=v*v+d*d+b*b)>0&&(l=1/Math.sqrt(l),v*=l,d*=l,b*=l),t[0]=v,t[1]=d,t[2]=b,t[3]=0,t[4]=M*b-h*d,t[5]=h*v-f*b,t[6]=f*d-M*v,t[7]=0,t[8]=f,t[9]=M,t[10]=h,t[11]=0,t[12]=e,t[13]=u,t[14]=o,t[15]=1,t},n.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},n.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t[4]=n[4]+r[4],t[5]=n[5]+r[5],t[6]=n[6]+r[6],t[7]=n[7]+r[7],t[8]=n[8]+r[8],t[9]=n[9]+r[9],t[10]=n[10]+r[10],t[11]=n[11]+r[11],t[12]=n[12]+r[12],t[13]=n[13]+r[13],t[14]=n[14]+r[14],t[15]=n[15]+r[15],t},n.subtract=i,n.multiplyScalar=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=n[7]*r,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=n[11]*r,t[12]=n[12]*r,t[13]=n[13]*r,t[14]=n[14]*r,t[15]=n[15]*r,t},n.multiplyScalarAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t[4]=n[4]+r[4]*a,t[5]=n[5]+r[5]*a,t[6]=n[6]+r[6]*a,t[7]=n[7]+r[7]*a,t[8]=n[8]+r[8]*a,t[9]=n[9]+r[9]*a,t[10]=n[10]+r[10]*a,t[11]=n[11]+r[11]*a,t[12]=n[12]+r[12]*a,t[13]=n[13]+r[13]*a,t[14]=n[14]+r[14]*a,t[15]=n[15]+r[15]*a,t},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]&&t[9]===n[9]&&t[10]===n[10]&&t[11]===n[11]&&t[12]===n[12]&&t[13]===n[13]&&t[14]===n[14]&&t[15]===n[15]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=t[4],s=t[5],c=t[6],f=t[7],M=t[8],h=t[9],l=t[10],v=t[11],d=t[12],b=t[13],m=t[14],p=t[15],P=n[0],A=n[1],E=n[2],O=n[3],R=n[4],y=n[5],q=n[6],x=n[7],_=n[8],Y=n[9],L=n[10],S=n[11],w=n[12],I=n[13],N=n[14],g=n[15];return Math.abs(r-P)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(P))&&Math.abs(e-A)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(A))&&Math.abs(u-E)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(o-O)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(O))&&Math.abs(i-R)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(R))&&Math.abs(s-y)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(y))&&Math.abs(c-q)<=a.EPSILON*Math.max(1,Math.abs(c),Math.abs(q))&&Math.abs(f-x)<=a.EPSILON*Math.max(1,Math.abs(f),Math.abs(x))&&Math.abs(M-_)<=a.EPSILON*Math.max(1,Math.abs(M),Math.abs(_))&&Math.abs(h-Y)<=a.EPSILON*Math.max(1,Math.abs(h),Math.abs(Y))&&Math.abs(l-L)<=a.EPSILON*Math.max(1,Math.abs(l),Math.abs(L))&&Math.abs(v-S)<=a.EPSILON*Math.max(1,Math.abs(v),Math.abs(S))&&Math.abs(d-w)<=a.EPSILON*Math.max(1,Math.abs(d),Math.abs(w))&&Math.abs(b-I)<=a.EPSILON*Math.max(1,Math.abs(b),Math.abs(I))&&Math.abs(m-N)<=a.EPSILON*Math.max(1,Math.abs(m),Math.abs(N))&&Math.abs(p-g)<=a.EPSILON*Math.max(1,Math.abs(p),Math.abs(g))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.mul=u,n.sub=i},function(t,n,r){"use strict";function e(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=n[6],f=n[7],M=n[8],h=r[0],l=r[1],v=r[2],d=r[3],b=r[4],m=r[5],p=r[6],P=r[7],A=r[8];return t[0]=h*a+l*o+v*c,t[1]=h*e+l*i+v*f,t[2]=h*u+l*s+v*M,t[3]=d*a+b*o+m*c,t[4]=d*e+b*i+m*f,t[5]=d*u+b*s+m*M,t[6]=p*a+P*o+A*c,t[7]=p*e+P*i+A*f,t[8]=p*u+P*s+A*M,t}function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t[4]=n[4]-r[4],t[5]=n[5]-r[5],t[6]=n[6]-r[6],t[7]=n[7]-r[7],t[8]=n[8]-r[8],t}Object.defineProperty(n,"__esModule",{value:!0}),n.sub=n.mul=void 0,n.create=function(){var t=new a.ARRAY_TYPE(9);return a.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},n.fromMat4=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[4],t[4]=n[5],t[5]=n[6],t[6]=n[8],t[7]=n[9],t[8]=n[10],t},n.clone=function(t){var n=new a.ARRAY_TYPE(9);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},n.fromValues=function(t,n,r,e,u,o,i,s,c){var f=new a.ARRAY_TYPE(9);return f[0]=t,f[1]=n,f[2]=r,f[3]=e,f[4]=u,f[5]=o,f[6]=i,f[7]=s,f[8]=c,f},n.set=function(t,n,r,a,e,u,o,i,s,c){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t[4]=u,t[5]=o,t[6]=i,t[7]=s,t[8]=c,t},n.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},n.transpose=function(t,n){if(t===n){var r=n[1],a=n[2],e=n[5];t[1]=n[3],t[2]=n[6],t[3]=r,t[5]=n[7],t[6]=a,t[7]=e}else t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8];return t},n.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=n[6],c=n[7],f=n[8],M=f*o-i*c,h=-f*u+i*s,l=c*u-o*s,v=r*M+a*h+e*l;return v?(v=1/v,t[0]=M*v,t[1]=(-f*a+e*c)*v,t[2]=(i*a-e*o)*v,t[3]=h*v,t[4]=(f*r-e*s)*v,t[5]=(-i*r+e*u)*v,t[6]=l*v,t[7]=(-c*r+a*s)*v,t[8]=(o*r-a*u)*v,t):null},n.adjoint=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=n[6],c=n[7],f=n[8];return t[0]=o*f-i*c,t[1]=e*c-a*f,t[2]=a*i-e*o,t[3]=i*s-u*f,t[4]=r*f-e*s,t[5]=e*u-r*i,t[6]=u*c-o*s,t[7]=a*s-r*c,t[8]=r*o-a*u,t},n.determinant=function(t){var n=t[0],r=t[1],a=t[2],e=t[3],u=t[4],o=t[5],i=t[6],s=t[7],c=t[8];return n*(c*u-o*s)+r*(-c*e+o*i)+a*(s*e-u*i)},n.multiply=e,n.translate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=n[6],f=n[7],M=n[8],h=r[0],l=r[1];return t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=i,t[5]=s,t[6]=h*a+l*o+c,t[7]=h*e+l*i+f,t[8]=h*u+l*s+M,t},n.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=n[6],f=n[7],M=n[8],h=Math.sin(r),l=Math.cos(r);return t[0]=l*a+h*o,t[1]=l*e+h*i,t[2]=l*u+h*s,t[3]=l*o-h*a,t[4]=l*i-h*e,t[5]=l*s-h*u,t[6]=c,t[7]=f,t[8]=M,t},n.scale=function(t,n,r){var a=r[0],e=r[1];return t[0]=a*n[0],t[1]=a*n[1],t[2]=a*n[2],t[3]=e*n[3],t[4]=e*n[4],t[5]=e*n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},n.fromTranslation=function(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=n[0],t[7]=n[1],t[8]=1,t},n.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=0,t[3]=-r,t[4]=a,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},n.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=n[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},n.fromMat2d=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=0,t[3]=n[2],t[4]=n[3],t[5]=0,t[6]=n[4],t[7]=n[5],t[8]=1,t},n.fromQuat=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r+r,i=a+a,s=e+e,c=r*o,f=a*o,M=a*i,h=e*o,l=e*i,v=e*s,d=u*o,b=u*i,m=u*s;return t[0]=1-M-v,t[3]=f-m,t[6]=h+b,t[1]=f+m,t[4]=1-c-v,t[7]=l-d,t[2]=h-b,t[5]=l+d,t[8]=1-c-M,t},n.normalFromMat4=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=n[6],c=n[7],f=n[8],M=n[9],h=n[10],l=n[11],v=n[12],d=n[13],b=n[14],m=n[15],p=r*i-a*o,P=r*s-e*o,A=r*c-u*o,E=a*s-e*i,O=a*c-u*i,R=e*c-u*s,y=f*d-M*v,q=f*b-h*v,x=f*m-l*v,_=M*b-h*d,Y=M*m-l*d,L=h*m-l*b,S=p*L-P*Y+A*_+E*x-O*q+R*y;return S?(S=1/S,t[0]=(i*L-s*Y+c*_)*S,t[1]=(s*x-o*L-c*q)*S,t[2]=(o*Y-i*x+c*y)*S,t[3]=(e*Y-a*L-u*_)*S,t[4]=(r*L-e*x+u*q)*S,t[5]=(a*x-r*Y-u*y)*S,t[6]=(d*R-b*O+m*E)*S,t[7]=(b*A-v*R-m*P)*S,t[8]=(v*O-d*A+m*p)*S,t):null},n.projection=function(t,n,r){return t[0]=2/n,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},n.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},n.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t[4]=n[4]+r[4],t[5]=n[5]+r[5],t[6]=n[6]+r[6],t[7]=n[7]+r[7],t[8]=n[8]+r[8],t},n.subtract=u,n.multiplyScalar=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=n[7]*r,t[8]=n[8]*r,t},n.multiplyScalarAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t[4]=n[4]+r[4]*a,t[5]=n[5]+r[5]*a,t[6]=n[6]+r[6]*a,t[7]=n[7]+r[7]*a,t[8]=n[8]+r[8]*a,t},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=t[4],s=t[5],c=t[6],f=t[7],M=t[8],h=n[0],l=n[1],v=n[2],d=n[3],b=n[4],m=n[5],p=n[6],P=n[7],A=n[8];return Math.abs(r-h)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(e-l)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(l))&&Math.abs(u-v)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(v))&&Math.abs(o-d)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(i-b)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(s-m)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(c-p)<=a.EPSILON*Math.max(1,Math.abs(c),Math.abs(p))&&Math.abs(f-P)<=a.EPSILON*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(M-A)<=a.EPSILON*Math.max(1,Math.abs(M),Math.abs(A))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.mul=e,n.sub=u},function(t,n,r){"use strict";function e(){var t=new a.ARRAY_TYPE(2);return a.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t}function o(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t}function i(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t}function s(t,n){var r=n[0]-t[0],a=n[1]-t[1];return Math.sqrt(r*r+a*a)}function c(t,n){var r=n[0]-t[0],a=n[1]-t[1];return r*r+a*a}function f(t){var n=t[0],r=t[1];return Math.sqrt(n*n+r*r)}function M(t){var n=t[0],r=t[1];return n*n+r*r}Object.defineProperty(n,"__esModule",{value:!0}),n.forEach=n.sqrLen=n.sqrDist=n.dist=n.div=n.mul=n.sub=n.len=void 0,n.create=e,n.clone=function(t){var n=new a.ARRAY_TYPE(2);return n[0]=t[0],n[1]=t[1],n},n.fromValues=function(t,n){var r=new a.ARRAY_TYPE(2);return r[0]=t,r[1]=n,r},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t},n.set=function(t,n,r){return t[0]=n,t[1]=r,t},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t},n.subtract=u,n.multiply=o,n.divide=i,n.ceil=function(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t},n.floor=function(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t},n.min=function(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t},n.max=function(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t},n.round=function(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t},n.scale=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t},n.scaleAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t},n.distance=s,n.squaredDistance=c,n.length=f,n.squaredLength=M,n.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t},n.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t},n.normalize=function(t,n){var r=n[0],a=n[1],e=r*r+a*a;return e>0&&(e=1/Math.sqrt(e),t[0]=n[0]*e,t[1]=n[1]*e),t},n.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]},n.cross=function(t,n,r){var a=n[0]*r[1]-n[1]*r[0];return t[0]=t[1]=0,t[2]=a,t},n.lerp=function(t,n,r,a){var e=n[0],u=n[1];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t},n.random=function(t,n){n=n||1;var r=2*a.RANDOM()*Math.PI;return t[0]=Math.cos(r)*n,t[1]=Math.sin(r)*n,t},n.transformMat2=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[2]*e,t[1]=r[1]*a+r[3]*e,t},n.transformMat2d=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[2]*e+r[4],t[1]=r[1]*a+r[3]*e+r[5],t},n.transformMat3=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[3]*e+r[6],t[1]=r[1]*a+r[4]*e+r[7],t},n.transformMat4=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[4]*e+r[12],t[1]=r[1]*a+r[5]*e+r[13],t},n.rotate=function(t,n,r,a){var e=n[0]-r[0],u=n[1]-r[1],o=Math.sin(a),i=Math.cos(a);return t[0]=e*i-u*o+r[0],t[1]=e*o+u*i+r[1],t},n.angle=function(t,n){var r=t[0],a=t[1],e=n[0],u=n[1],o=r*r+a*a;o>0&&(o=1/Math.sqrt(o));var i=e*e+u*u;i>0&&(i=1/Math.sqrt(i));var s=(r*e+a*u)*o*i;return s>1?0:s<-1?Math.PI:Math.acos(s)},n.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]},n.equals=function(t,n){var r=t[0],e=t[1],u=n[0],o=n[1];return Math.abs(r-u)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(e-o)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(o))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.len=f,n.sub=u,n.mul=o,n.div=i,n.dist=s,n.sqrDist=c,n.sqrLen=M,n.forEach=function(){var t=e();return function(n,r,a,e,u,o){var i=void 0,s=void 0;for(r||(r=2),a||(a=0),s=e?Math.min(e*r+a,n.length):n.length,i=a;i0){r=Math.sqrt(r);var a=n[0]/r,e=n[1]/r,u=n[2]/r,o=n[3]/r,i=n[4],s=n[5],c=n[6],f=n[7],M=a*i+e*s+u*c+o*f;t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=(i-a*M)/r,t[5]=(s-e*M)/r,t[6]=(c-u*M)/r,t[7]=(f-o*M)/r}return t},n.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=t[4],s=t[5],c=t[6],f=t[7],M=n[0],h=n[1],l=n[2],v=n[3],d=n[4],b=n[5],m=n[6],p=n[7];return Math.abs(r-M)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(M))&&Math.abs(e-h)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(h))&&Math.abs(u-l)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(l))&&Math.abs(o-v)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(i-d)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(s-b)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(c-m)<=a.EPSILON*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(f-p)<=a.EPSILON*Math.max(1,Math.abs(f),Math.abs(p))};var a=o(r(0)),e=o(r(3)),u=o(r(4));n.getReal=e.copy,n.setReal=e.copy,n.mul=c;var f=n.dot=e.dot,M=n.length=e.length,h=(n.len=M,n.squaredLength=e.squaredLength);n.sqrLen=h},function(t,n,r){"use strict";function e(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=r[0],f=r[1],M=r[2],h=r[3],l=r[4],v=r[5];return t[0]=a*c+u*f,t[1]=e*c+o*f,t[2]=a*M+u*h,t[3]=e*M+o*h,t[4]=a*l+u*v+i,t[5]=e*l+o*v+s,t}function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t[4]=n[4]-r[4],t[5]=n[5]-r[5],t}Object.defineProperty(n,"__esModule",{value:!0}),n.sub=n.mul=void 0,n.create=function(){var t=new a.ARRAY_TYPE(6);return a.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},n.clone=function(t){var n=new a.ARRAY_TYPE(6);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t},n.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},n.fromValues=function(t,n,r,e,u,o){var i=new a.ARRAY_TYPE(6);return i[0]=t,i[1]=n,i[2]=r,i[3]=e,i[4]=u,i[5]=o,i},n.set=function(t,n,r,a,e,u,o){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t[4]=u,t[5]=o,t},n.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],s=r*u-a*e;return s?(s=1/s,t[0]=u*s,t[1]=-a*s,t[2]=-e*s,t[3]=r*s,t[4]=(e*i-u*o)*s,t[5]=(a*o-r*i)*s,t):null},n.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},n.multiply=e,n.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=Math.sin(r),f=Math.cos(r);return t[0]=a*f+u*c,t[1]=e*f+o*c,t[2]=a*-c+u*f,t[3]=e*-c+o*f,t[4]=i,t[5]=s,t},n.scale=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=r[0],f=r[1];return t[0]=a*c,t[1]=e*c,t[2]=u*f,t[3]=o*f,t[4]=i,t[5]=s,t},n.translate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],s=n[5],c=r[0],f=r[1];return t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=a*c+u*f+i,t[5]=e*c+o*f+s,t},n.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=-r,t[3]=a,t[4]=0,t[5]=0,t},n.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=n[1],t[4]=0,t[5]=0,t},n.fromTranslation=function(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=n[0],t[5]=n[1],t},n.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},n.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t[4]=n[4]+r[4],t[5]=n[5]+r[5],t},n.subtract=u,n.multiplyScalar=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*r,t[5]=n[5]*r,t},n.multiplyScalarAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t[4]=n[4]+r[4]*a,t[5]=n[5]+r[5]*a,t},n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=t[4],s=t[5],c=n[0],f=n[1],M=n[2],h=n[3],l=n[4],v=n[5];return Math.abs(r-c)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(e-f)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(f))&&Math.abs(u-M)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(M))&&Math.abs(o-h)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(i-l)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(s-v)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(v))};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.mul=e,n.sub=u},function(t,n,r){"use strict";function e(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],s=r[1],c=r[2],f=r[3];return t[0]=a*i+u*s,t[1]=e*i+o*s,t[2]=a*c+u*f,t[3]=e*c+o*f,t}function u(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t}Object.defineProperty(n,"__esModule",{value:!0}),n.sub=n.mul=void 0,n.create=function(){var t=new a.ARRAY_TYPE(4);return a.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},n.clone=function(t){var n=new a.ARRAY_TYPE(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},n.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},n.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},n.fromValues=function(t,n,r,e){var u=new a.ARRAY_TYPE(4);return u[0]=t,u[1]=n,u[2]=r,u[3]=e,u},n.set=function(t,n,r,a,e){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t},n.transpose=function(t,n){if(t===n){var r=n[1];t[1]=n[2],t[2]=r}else t[0]=n[0],t[1]=n[2],t[2]=n[1],t[3]=n[3];return t},n.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r*u-e*a;return o?(o=1/o,t[0]=u*o,t[1]=-a*o,t[2]=-e*o,t[3]=r*o,t):null},n.adjoint=function(t,n){var r=n[0];return t[0]=n[3],t[1]=-n[1],t[2]=-n[2],t[3]=r,t},n.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},n.multiply=e,n.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s+u*i,t[1]=e*s+o*i,t[2]=a*-i+u*s,t[3]=e*-i+o*s,t},n.scale=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],s=r[1];return t[0]=a*i,t[1]=e*i,t[2]=u*s,t[3]=o*s,t},n.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=-r,t[3]=a,t},n.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=n[1],t},n.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},n.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},n.LDU=function(t,n,r,a){return t[2]=a[2]/a[0],r[0]=a[0],r[1]=a[1],r[3]=a[3]-t[2]*r[1],[t,n,r]},n.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t},n.subtract=u,n.exactEquals=function(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]},n.equals=function(t,n){var r=t[0],e=t[1],u=t[2],o=t[3],i=n[0],s=n[1],c=n[2],f=n[3];return Math.abs(r-i)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(e-s)<=a.EPSILON*Math.max(1,Math.abs(e),Math.abs(s))&&Math.abs(u-c)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(c))&&Math.abs(o-f)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))},n.multiplyScalar=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t},n.multiplyScalarAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t};var a=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(r(0));n.mul=e,n.sub=u},function(t,n,r){"use strict";function l(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}Object.defineProperty(n,"__esModule",{value:!0}),n.vec4=n.vec3=n.vec2=n.quat2=n.quat=n.mat4=n.mat3=n.mat2d=n.mat2=n.glMatrix=void 0;var a=l(r(0)),e=l(r(9)),u=l(r(8)),o=l(r(5)),i=l(r(4)),s=l(r(3)),c=l(r(7)),f=l(r(6)),M=l(r(2)),h=l(r(1));n.glMatrix=a,n.mat2=e,n.mat2d=u,n.mat3=o,n.mat4=i,n.quat=s,n.quat2=c,n.vec2=f,n.vec3=M,n.vec4=h}])})},{}],40:[function(require,module,exports){"use strict";function Shader(gl){this.gl=gl,this.gl.lastAttribCount=0,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}function compareAttributes(a,b){return a.nameoldAttribCount)for(i=oldAttribCount;inewAttribCount)for(i=newAttribCount;i=0){for(var size=0|attr.type.charAt(attr.type.length-1),locVector=new Array(size),j=0;j=0;)curLocation+=1;attributeLocations[i]=curLocation}var uniformLocations=new Array(uniforms.length);relink(),wrapper._relink=relink,wrapper.types={uniforms:makeReflect(uniforms),attributes:makeReflect(attributes)},wrapper.attributes=createAttributeWrapper(gl,wrapper,attributeUnpacked,attributeLocations),Object.defineProperty(wrapper,"uniforms",createUniformWrapper(gl,wrapper,uniforms,uniformLocations))},module.exports=createShader},{"./lib/GLError":41,"./lib/create-attributes":42,"./lib/create-uniforms":43,"./lib/reflect":44,"./lib/runtime-reflect":45,"./lib/shader-cache":46}],41:[function(require,module,exports){function GLError(rawError,shortMessage,longMessage){this.shortMessage=shortMessage||"",this.longMessage=longMessage||"",this.rawError=rawError||"",this.message="gl-shader: "+(shortMessage||rawError||"")+(longMessage?"\n"+longMessage:""),this.stack=(new Error).stack}GLError.prototype=new Error,GLError.prototype.name="GLError",GLError.prototype.constructor=GLError,module.exports=GLError},{}],42:[function(require,module,exports){"use strict";function ShaderAttribute(gl,wrapper,index,locations,dimension,constFunc){this._gl=gl,this._wrapper=wrapper,this._index=index,this._locations=locations,this._dimension=dimension,this._constFunc=constFunc}function addVectorAttribute(gl,wrapper,index,locations,dimension,obj,name){for(var constFuncArgs=["gl","v"],varNames=[],i=0;i=0){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4)throw new GLError("","Invalid data type for attribute "+name+": "+type);addVectorAttribute(gl,wrapper,locs[0],locations,d,obj,name)}else{if(!(type.indexOf("mat")>=0))throw new GLError("","Unknown data type for attribute "+name+": "+type);var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4)throw new GLError("","Invalid data type for attribute "+name+": "+type);addMatrixAttribute(gl,wrapper,locs,locations,d,obj,name)}}}return obj}module.exports=createAttributeWrapper;var GLError=require("./GLError"),proto=ShaderAttribute.prototype;proto.pointer=function(type,normalized,stride,offset){var self=this,gl=self._gl,location=self._locations[self._index];gl.vertexAttribPointer(location,self._dimension,type||gl.FLOAT,!!normalized,stride||0,offset||0),gl.enableVertexAttribArray(location)},proto.set=function(x0,x1,x2,x3){return this._constFunc(this._locations[this._index],x0,x1,x2,x3)},Object.defineProperty(proto,"location",{get:function(){return this._locations[this._index]},set:function(v){return v!==this._locations[this._index]&&(this._locations[this._index]=0|v,this._wrapper.program=null),0|v}})},{"./GLError":41}],43:[function(require,module,exports){"use strict";function identity(x){return new Function("y","return function(){return y}")(x)}function makeVector(length,fill){for(var result=new Array(length),i=0;i4)throw new GLError("","Invalid uniform dimension type for matrix "+name+": "+type);return"gl.uniformMatrix"+d+"fv(locations["+index+"],false,obj"+path+")"}throw new GLError("","Unknown uniform data type for "+name+": "+type)}var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4)throw new GLError("","Invalid data type");switch(type.charAt(0)){case"b":case"i":return"gl.uniform"+d+"iv(locations["+index+"],obj"+path+")";case"v":return"gl.uniform"+d+"fv(locations["+index+"],obj"+path+")";default:throw new GLError("","Unrecognized data type for vector "+name+": "+type)}}}function enumerateIndices(prefix,type){if("object"!=typeof type)return[[prefix,type]];var indices=[];for(var id in type){var prop=type[id],tprefix=prefix;parseInt(id)+""===id?tprefix+="["+id+"]":tprefix+="."+id,"object"==typeof prop?indices.push.apply(indices,enumerateIndices(tprefix,prop)):indices.push([tprefix,prop])}return indices}function makeSetter(type){for(var code=["return function updateProperty(obj){"],indices=enumerateIndices("",type),i=0;i4)throw new GLError("","Invalid data type");return"b"===type.charAt(0)?makeVector(d,!1):makeVector(d,0)}if(0===type.indexOf("mat")&&4===type.length){var d=type.charCodeAt(type.length-1)-48;if(d<2||d>4)throw new GLError("","Invalid uniform dimension type for matrix "+name+": "+type);return makeVector(d*d,0)}throw new GLError("","Unknown uniform data type for "+name+": "+type)}}function storeProperty(obj,prop,type){if("object"==typeof type){var child=processObject(type);Object.defineProperty(obj,prop,{get:identity(child),set:makeSetter(type),enumerable:!0,configurable:!1})}else locations[type]?Object.defineProperty(obj,prop,{get:makeGetter(type),set:makeSetter(type),enumerable:!0,configurable:!1}):obj[prop]=defaultValue(uniforms[type].type)}function processObject(obj){var result;if(Array.isArray(obj)){result=new Array(obj.length);for(var i=0;i1){x[0]in o||(o[x[0]]=[]),o=o[x[0]];for(var k=1;k1)for(var j=0;jmaxTextureSize||height<0||height>maxTextureSize)throw new Error("gl-texture2d: Invalid texture shape");var tex=initTexture(gl);return gl.texImage2D(gl.TEXTURE_2D,0,format,width,height,0,format,type,null),new Texture2D(gl,tex,width,height,format,type)}function createTextureDOM(gl,element,format,type){var tex=initTexture(gl);return gl.texImage2D(gl.TEXTURE_2D,0,format,format,type,element),new Texture2D(gl,tex,0|element.width,0|element.height,format,type)}function isPacked(array){for(var shape=array.shape,stride=array.stride,s=1,i=shape.length-1;i>=0;--i){if(stride[i]!==s)return!1;s*=shape[i]}return!0}function createTextureArray(gl,array){var dtype=array.dtype,shape=array.shape.slice(),maxSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);if(shape[0]<0||shape[0]>maxSize||shape[1]<0||shape[1]>maxSize)throw new Error("gl-texture2d: Invalid texture size");var packed=isPacked(array),type=0;"float32"===dtype?type=gl.FLOAT:"float64"===dtype?(type=gl.FLOAT,packed=!1,dtype="float32"):"uint8"===dtype?type=gl.UNSIGNED_BYTE:(type=gl.UNSIGNED_BYTE,packed=!1,dtype="uint8");var format=0;if(2===shape.length)format=gl.LUMINANCE;else{if(3!==shape.length)throw new Error("Invalid shape for texture");if(1===shape[2])format=gl.ALPHA;else if(2===shape[2])format=gl.LUMINANCE_ALPHA;else if(3===shape[2])format=gl.RGB;else{if(4!==shape[2])throw new Error("Invalid shape for pixel coords");format=gl.RGBA}}type===gl.FLOAT&&webglew(gl).texture_float&&(type=gl.UNSIGNED_BYTE,packed=!1);var buffer,buf_store;if(packed){var array_size=array.size;buffer=array.data.subarray(array.offset,array.offset+array_size)}else{for(var sz=1,stride=new Array(shape.length),i=shape.length-1;i>=0;--i)stride[i]=sz,sz*=shape[i];buf_store=pool.malloc(sz,dtype);var buf_array=ndarray(buf_store,array.shape,stride,0);"float32"!==dtype&&"float64"!==dtype||type!==gl.UNSIGNED_BYTE?ops.assign(buf_array,array):convertFloatToUint8(buf_array,array),buffer=buf_store.subarray(0,sz)}var tex=initTexture(gl);return gl.texImage2D(gl.TEXTURE_2D,0,format,shape[1],shape[0],0,format,type,buffer),packed||pool.free(buf_store),new Texture2D(gl,tex,shape[1],shape[0],format,type)}function createTexture2D(gl){if(arguments.length<=1)throw new Error("Missing arguments for texture2d constructor");if(linearTypes||lazyInitLinearTypes(gl),"number"==typeof arguments[1])return createTextureShape(gl,arguments[1],arguments[2],arguments[3]||gl.RGBA,arguments[4]||gl.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return createTextureShape(gl,0|arguments[1][1],0|arguments[1][0],arguments[2]||gl.RGBA,arguments[4]||gl.UNSIGNED_BYTE);if("object"==typeof arguments[1]){var obj=arguments[1];if(obj instanceof HTMLCanvasElement||obj instanceof HTMLImageElement||obj instanceof HTMLVideoElement||obj instanceof ImageData)return createTextureDOM(gl,obj,arguments[2]||gl.RGBA,arguments[3]||gl.UNSIGNED_BYTE);if(obj.shape&&obj.data&&obj.stride)return createTextureArray(gl,obj)}throw new Error("Invalid arguments for texture2d constructor")}var ndarray=require("ndarray"),ops=require("ndarray-ops"),pool=require("typedarray-pool"),webglew=require("webglew"),linearTypes=null,filterTypes=null,wrapTypes=null,convertFloatToUint8=function(out,inp){ops.muls(out,inp,255)};Object.defineProperty(Texture2D.prototype,"minFilter",{get:function(){return this._minFilter},set:function(v){this.bind();var gl=this.gl;if(this.type===gl.FLOAT&&linearTypes.indexOf(v)>=0&&(webglew(gl).OES_texture_float_linear||(v=gl.NEAREST)),filterTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown filter mode "+v);return gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,v),this._minFilter=v}});var proto=Texture2D.prototype;Object.defineProperty(proto,"magFilter",{get:function(){return this._magFilter},set:function(v){this.bind();var gl=this.gl;if(this.type===gl.FLOAT&&linearTypes.indexOf(v)>=0&&(webglew(gl).OES_texture_float_linear||(v=gl.NEAREST)),filterTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown filter mode "+v);return gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,v),this._magFilter=v}}),Object.defineProperty(proto,"wrapS",{get:function(){return this._wrapS},set:function(v){if(this.bind(),wrapTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown wrap mode "+v);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,v),this._wrapS=v}}),Object.defineProperty(proto,"wrapT",{get:function(){return this._wrapT},set:function(v){if(this.bind(),wrapTypes.indexOf(v)<0)throw new Error("gl-texture2d: Unknown wrap mode "+v);return this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,v),this._wrapT=v}}),Object.defineProperty(proto,"wrap",{get:function(){return[this._wrapT,this._wrapS]},set:function(v){if(Array.isArray(v)||(v=[v,v]),2!==v.length)throw new Error("gl-texture2d: Must specify wrap mode for rows and columns");for(var i=0;i<2;++i)if(wrapTypes.indexOf(v[i])<0)throw new Error("gl-texture2d: Unknown wrap mode "+v);this._wrapT=v[0],this._wrapS=v[1];var gl=this.gl;return this.bind(),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,this._wrapT),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,this._wrapS),v}}),Object.defineProperty(proto,"mipSamples",{get:function(){return this._anisoSamples},set:function(i){var psamples=this._anisoSamples;if(this._anisoSamples=0|Math.max(i,1),psamples!==this._anisoSamples){var ext=webglew(this.gl).EXT_texture_filter_anisotropic;ext&&this.gl.texParameterf(this.gl.TEXTURE_2D,ext.TEXTURE_MAX_ANISOTROPY_EXT,this._anisoSamples)}return this._anisoSamples}}),Object.defineProperty(proto,"shape",{get:function(){return this._shape},set:function(x){if(Array.isArray(x)){if(2!==x.length)throw new Error("gl-texture2d: Invalid texture shape")}else x=[0|x,0|x];var r=0|x[0],c=0|x[1];if(this.height===r&&this.width===c)return x;var gl=this.gl,maxSize=gl.getParameter(gl.MAX_TEXTURE_SIZE);if(c<0||c>maxSize||r<0||r>maxSize)throw new Error("gl-texture2d: Invalid texture size");return this._shape=[r,c],this.bind(),gl.texImage2D(gl.TEXTURE_2D,0,this.format,c,r,0,this.format,this.type,null),this._mipLevels=[0],x}}),proto.bind=function(unit){var gl=this.gl;return void 0!==unit&&gl.activeTexture(gl.TEXTURE0+(0|unit)),gl.bindTexture(gl.TEXTURE_2D,this.handle),void 0!==unit?unit:gl.getParameter(gl.ACTIVE_TEXTURE)-gl.TEXTURE0},proto.dispose=function(){this.gl.deleteTexture(this.handle)},proto.generateMipmap=function(){this.bind(),this.gl.generateMipmap(this.gl.TEXTURE_2D);for(var l=Math.min(this._shape[0],this._shape[1]),i=0;l>0;++i,l>>>=1)this._mipLevels.indexOf(i)<0&&this._mipLevels.push(i)},proto.setPixels=function(data,x_off,y_off,mip_level){var gl=this.gl;if(this.bind(),Array.isArray(x_off)?(mip_level=y_off,y_off=0|x_off[0],x_off=0|x_off[1]):(x_off=x_off||0,y_off=y_off||0),mip_level=mip_level||0,data instanceof HTMLCanvasElement||data instanceof ImageData||data instanceof HTMLImageElement||data instanceof HTMLVideoElement){this._mipLevels.indexOf(mip_level)<0?(gl.texImage2D(gl.TEXTURE_2D,0,this.format,this.format,this.type,data),this._mipLevels.push(mip_level)):gl.texSubImage2D(gl.TEXTURE_2D,mip_level,x_off,y_off,this.format,this.type,data)}else{if(!(data.shape&&data.stride&&data.data))throw new Error("gl-texture2d: Unsupported data type");if(data.shape.length<2||x_off+data.shape[1]>this._shape[1]>>>mip_level||y_off+data.shape[0]>this._shape[0]>>>mip_level||x_off<0||y_off<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");texSubImageArray(gl,x_off,y_off,mip_level,this.format,this.type,this._mipLevels,data)}},module.exports=createTexture2D},{ndarray:70,"ndarray-ops":69,"typedarray-pool":49,webglew:50}],52:[function(require,module,exports){"use strict";function doBind(gl,elements,attributes){elements?elements.bind():gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER,null);var nattribs=0|gl.getParameter(gl.MAX_VERTEX_ATTRIBS);if(attributes){if(attributes.length>nattribs)throw new Error("Too many vertex attributes");for(var i=0;i0)continue;res=buf.slice(0,1).join("")}return token(res),start+=res.length,content=content.slice(res.length),content.length}}function hex(){return/[^a-fA-F0-9]/.test(c)?(token(content.join("")),mode=NORMAL,i):(content.push(c),last=c,i+1)}function integer(){return"."===c?(content.push(c),mode=FLOAT,last=c,i+1):/[eE]/.test(c)?(content.push(c),mode=FLOAT,last=c,i+1):"x"===c&&1===content.length&&"0"===content[0]?(mode=HEX,content.push(c),last=c,i+1):/[^\d]/.test(c)?(token(content.join("")),mode=NORMAL,i):(content.push(c),last=c,i+1)}function decimal(){return"f"===c&&(content.push(c),last=c,i+=1),/[eE]/.test(c)?(content.push(c),last=c,i+1):("-"!==c&&"+"!==c||!/[eE]/.test(last))&&/[^\d]/.test(c)?(token(content.join("")),mode=NORMAL,i):(content.push(c),last=c,i+1)}function readtoken(){if(/[^\d\w_]/.test(c)){var contentstr=content.join("");return mode=literalsDict[contentstr]?KEYWORD:builtinsDict[contentstr]?BUILTIN:IDENT,token(content.join("")),mode=NORMAL,i}return content.push(c),last=c,i+1}var c,last,len,i=0,total=0,mode=NORMAL,content=[],tokens=[],line=1,col=0,start=0,isnum=!1,isoperator=!1,input="";opt=opt||{};var allBuiltins=builtins100,allLiterals=literals100;"300 es"===opt.version&&(allBuiltins=builtins300es,allLiterals=literals300es);for(var builtinsDict={},literalsDict={},i=0;i>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],63:[function(require,module,exports){function tokenizeString(str,opt){var generator=tokenize(opt),tokens=[];return tokens=tokens.concat(generator(str)),tokens=tokens.concat(generator(null))}var tokenize=require("./index");module.exports=tokenizeString},{"./index":57}],64:[function(require,module,exports){"use strict";function iota(n){for(var result=new Array(n),i=0;i>",rrshift:">>>"};!function(){for(var id in assign_ops){var op=assign_ops[id];exports[id]=makeOp({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+op+"c"},funcName:id}),exports[id+"eq"]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a"+op+"=b"},rvalue:!0,funcName:id+"eq"}),exports[id+"s"]=makeOp({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+op+"s"},funcName:id+"s"}),exports[id+"seq"]=makeOp({args:["array","scalar"],body:{args:["a","s"],body:"a"+op+"=s"},rvalue:!0,funcName:id+"seq"})}}();var unary_ops={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var id in unary_ops){var op=unary_ops[id];exports[id]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a="+op+"b"},funcName:id}),exports[id+"eq"]=makeOp({args:["array"],body:{args:["a"],body:"a="+op+"a"},rvalue:!0,count:2,funcName:id+"eq"})}}();var binary_ops={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var id in binary_ops){var op=binary_ops[id];exports[id]=makeOp({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+op+"c"},funcName:id}),exports[id+"s"]=makeOp({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+op+"s"},funcName:id+"s"}),exports[id+"eq"]=makeOp({args:["array","array"],body:{args:["a","b"],body:"a=a"+op+"b"},rvalue:!0,count:2,funcName:id+"eq"}),exports[id+"seq"]=makeOp({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+op+"s"},rvalue:!0,count:2,funcName:id+"seq"})}}();var math_unary=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var i=0;ithis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),exports.norm1=compile({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),exports.sup=compile({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),exports.inf=compile({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),exports.random=makeOp({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),exports.assign=makeOp({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),exports.assigns=makeOp({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),exports.equals=compile({args:["array","array"],pre:EmptyProc,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})},{"cwise-compiler":12}],70:[function(require,module,exports){function compare1st(a,b){return a[0]-b[0]}function order(){var i,stride=this.stride,terms=new Array(stride.length);for(i=0;iMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===dimension&&code.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):code.push("ORDER})")),code.push("proto.set=function "+className+"_set("+args.join(",")+",v){"),useGetters?code.push("return this.data.set("+index_str+",v)}"):code.push("return this.data["+index_str+"]=v}"),code.push("proto.get=function "+className+"_get("+args.join(",")+"){"),useGetters?code.push("return this.data.get("+index_str+")}"):code.push("return this.data["+index_str+"]}"),code.push("proto.index=function "+className+"_index(",args.join(),"){return "+index_str+"}"),code.push("proto.hi=function "+className+"_hi("+args.join(",")+"){return new "+className+"(this.data,"+indices.map(function(i){return["(typeof i",i,"!=='number'||i",i,"<0)?this.shape[",i,"]:i",i,"|0"].join("")}).join(",")+","+indices.map(function(i){return"this.stride["+i+"]"}).join(",")+",this.offset)}");var a_vars=indices.map(function(i){return"a"+i+"=this.shape["+i+"]"}),c_vars=indices.map(function(i){return"c"+i+"=this.stride["+i+"]"});code.push("proto.lo=function "+className+"_lo("+args.join(",")+"){var b=this.offset,d=0,"+a_vars.join(",")+","+c_vars.join(","));for(var i=0;i=0){d=i"+i+"|0;b+=c"+i+"*d;a"+i+"-=d}");code.push("return new "+className+"(this.data,"+indices.map(function(i){return"a"+i}).join(",")+","+indices.map(function(i){return"c"+i}).join(",")+",b)}"),code.push("proto.step=function "+className+"_step("+args.join(",")+"){var "+indices.map(function(i){return"a"+i+"=this.shape["+i+"]"}).join(",")+","+indices.map(function(i){return"b"+i+"=this.stride["+i+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var i=0;i=0){c=(c+this.stride["+i+"]*i"+i+")|0}else{a.push(this.shape["+i+"]);b.push(this.stride["+i+"])}");code.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),code.push("return function construct_"+className+"(data,shape,stride,offset){return new "+className+"(data,"+indices.map(function(i){return"shape["+i+"]"}).join(",")+","+indices.map(function(i){return"stride["+i+"]"}).join(",")+",offset)}");var procedure=new Function("CTOR_LIST","ORDER",code.join("\n"));return procedure(CACHED_CONSTRUCTORS[dtype],order)}function arrayDType(data){if(isBuffer(data))return"buffer";if(hasTypedArrays)switch(Object.prototype.toString.call(data)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(data)?"array":"generic"}function wrappedNDArrayCtor(data,shape,stride,offset){if(void 0===data){var ctor=CACHED_CONSTRUCTORS.array[0];return ctor([])}"number"==typeof data&&(data=[data]),void 0===shape&&(shape=[data.length]);var d=shape.length;if(void 0===stride){stride=new Array(d);for(var i=d-1,sz=1;i>=0;--i)stride[i]=sz,sz*=shape[i]}if(void 0===offset){offset=0;for(var i=0;i1&&(s=1),out[0]=-da[0],out[1]=da[1],out[2]=da[2]||Math.sqrt(1-s),out[3]=0}function createOrbitCamera(eye,target,up){eye=eye||[0,0,-1],target=target||[0,0,0],up=up||[0,1,0];var camera=new OrbitCamera(quat.create(),vec3.create(),1);return camera.lookAt(eye,target,up),camera}var glm=require("gl-matrix"),vec3=glm.vec3,mat3=glm.mat3,mat4=glm.mat4,quat=glm.quat,scratch0=new Float32Array(16),scratch1=new Float32Array(16),proto=OrbitCamera.prototype;proto.view=function(out){return out||(out=mat4.create()),scratch1[0]=scratch1[1]=0,scratch1[2]=-this.distance,mat4.fromRotationTranslation(out,quat.conjugate(scratch0,this.rotation),scratch1),mat4.translate(out,out,vec3.negate(scratch0,this.center)),out},proto.lookAt=function(eye,center,up){mat4.lookAt(scratch0,eye,center,up),mat3.fromMat4(scratch0,scratch0),quat.fromMat3(this.rotation,scratch0),vec3.copy(this.center,center),this.distance=vec3.distance(eye,center)},proto.pan=function(dpan){var d=this.distance;scratch0[0]=-d*(dpan[0]||0),scratch0[1]=d*(dpan[1]||0),scratch0[2]=d*(dpan[2]||0),vec3.transformQuat(scratch0,scratch0,this.rotation),vec3.add(this.center,this.center,scratch0)},proto.zoom=function(d){this.distance+=d,this.distance<0&&(this.distance=0)},proto.rotate=function(da,db){quatFromVec(scratch0,da),quatFromVec(scratch1,db),quat.invert(scratch1,scratch1),quat.multiply(scratch0,scratch0,scratch1),quat.length(scratch0)<1e-6||(quat.multiply(this.rotation,this.rotation,scratch0),quat.normalize(this.rotation,this.rotation))},module.exports=createOrbitCamera},{"gl-matrix":39}],73:[function(require,module,exports){"use strict";var repeat=require("repeat-string");module.exports=function(str,num,ch){return ch=void 0!==ch?ch+"":" ",repeat(ch,num)+str}},{"repeat-string":94}],74:[function(require,module,exports){"use strict";var assign=require("./lib/utils/common").assign,deflate=require("./lib/deflate"),inflate=require("./lib/inflate"),constants=require("./lib/zlib/constants"),pako={};assign(pako,deflate,inflate,constants),module.exports=pako},{"./lib/deflate":75,"./lib/inflate":76,"./lib/utils/common":77,"./lib/zlib/constants":80}],75:[function(require,module,exports){"use strict";function Deflate(options){if(!(this instanceof Deflate))return new Deflate(options);this.options=utils.assign({level:Z_DEFAULT_COMPRESSION,method:Z_DEFLATED,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z_DEFAULT_STRATEGY,to:""},options||{});var opt=this.options;opt.raw&&opt.windowBits>0?opt.windowBits=-opt.windowBits:opt.gzip&&opt.windowBits>0&&opt.windowBits<16&&(opt.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ZStream,this.strm.avail_out=0;var status=zlib_deflate.deflateInit2(this.strm,opt.level,opt.method,opt.windowBits,opt.memLevel,opt.strategy);if(status!==Z_OK)throw new Error(msg[status]);if(opt.header&&zlib_deflate.deflateSetHeader(this.strm,opt.header),opt.dictionary){var dict;if(dict="string"==typeof opt.dictionary?strings.string2buf(opt.dictionary):"[object ArrayBuffer]"===toString.call(opt.dictionary)?new Uint8Array(opt.dictionary):opt.dictionary,(status=zlib_deflate.deflateSetDictionary(this.strm,dict))!==Z_OK)throw new Error(msg[status]);this._dict_set=!0}}function deflate(input,options){var deflator=new Deflate(options);if(deflator.push(input,!0),deflator.err)throw deflator.msg;return deflator.result}function deflateRaw(input,options){return options=options||{},options.raw=!0,deflate(input,options)}function gzip(input,options){return options=options||{},options.gzip=!0,deflate(input,options)}var zlib_deflate=require("./zlib/deflate"),utils=require("./utils/common"),strings=require("./utils/strings"),msg=require("./zlib/messages"),ZStream=require("./zlib/zstream"),toString=Object.prototype.toString,Z_OK=0,Z_DEFAULT_COMPRESSION=-1,Z_DEFAULT_STRATEGY=0,Z_DEFLATED=8;Deflate.prototype.push=function(data,mode){var status,_mode,strm=this.strm,chunkSize=this.options.chunkSize;if(this.ended)return!1;_mode=mode===~~mode?mode:!0===mode?4:0,"string"==typeof data?strm.input=strings.string2buf(data):"[object ArrayBuffer]"===toString.call(data)?strm.input=new Uint8Array(data):strm.input=data,strm.next_in=0,strm.avail_in=strm.input.length;do{if(0===strm.avail_out&&(strm.output=new utils.Buf8(chunkSize),strm.next_out=0,strm.avail_out=chunkSize),1!==(status=zlib_deflate.deflate(strm,_mode))&&status!==Z_OK)return this.onEnd(status),this.ended=!0,!1
+;0!==strm.avail_out&&(0!==strm.avail_in||4!==_mode&&2!==_mode)||("string"===this.options.to?this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output,strm.next_out))):this.onData(utils.shrinkBuf(strm.output,strm.next_out)))}while((strm.avail_in>0||0===strm.avail_out)&&1!==status);return 4===_mode?(status=zlib_deflate.deflateEnd(this.strm),this.onEnd(status),this.ended=!0,status===Z_OK):2!==_mode||(this.onEnd(Z_OK),strm.avail_out=0,!0)},Deflate.prototype.onData=function(chunk){this.chunks.push(chunk)},Deflate.prototype.onEnd=function(status){status===Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=utils.flattenChunks(this.chunks)),this.chunks=[],this.err=status,this.msg=this.strm.msg},exports.Deflate=Deflate,exports.deflate=deflate,exports.deflateRaw=deflateRaw,exports.gzip=gzip},{"./utils/common":77,"./utils/strings":78,"./zlib/deflate":82,"./zlib/messages":87,"./zlib/zstream":89}],76:[function(require,module,exports){"use strict";function Inflate(options){if(!(this instanceof Inflate))return new Inflate(options);this.options=utils.assign({chunkSize:16384,windowBits:0,to:""},options||{});var opt=this.options;opt.raw&&opt.windowBits>=0&&opt.windowBits<16&&(opt.windowBits=-opt.windowBits,0===opt.windowBits&&(opt.windowBits=-15)),!(opt.windowBits>=0&&opt.windowBits<16)||options&&options.windowBits||(opt.windowBits+=32),opt.windowBits>15&&opt.windowBits<48&&0==(15&opt.windowBits)&&(opt.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ZStream,this.strm.avail_out=0;var status=zlib_inflate.inflateInit2(this.strm,opt.windowBits);if(status!==c.Z_OK)throw new Error(msg[status]);this.header=new GZheader,zlib_inflate.inflateGetHeader(this.strm,this.header)}function inflate(input,options){var inflator=new Inflate(options);if(inflator.push(input,!0),inflator.err)throw inflator.msg;return inflator.result}function inflateRaw(input,options){return options=options||{},options.raw=!0,inflate(input,options)}var zlib_inflate=require("./zlib/inflate"),utils=require("./utils/common"),strings=require("./utils/strings"),c=require("./zlib/constants"),msg=require("./zlib/messages"),ZStream=require("./zlib/zstream"),GZheader=require("./zlib/gzheader"),toString=Object.prototype.toString;Inflate.prototype.push=function(data,mode){var status,_mode,next_out_utf8,tail,utf8str,dict,strm=this.strm,chunkSize=this.options.chunkSize,dictionary=this.options.dictionary,allowBufError=!1;if(this.ended)return!1;_mode=mode===~~mode?mode:!0===mode?c.Z_FINISH:c.Z_NO_FLUSH,"string"==typeof data?strm.input=strings.binstring2buf(data):"[object ArrayBuffer]"===toString.call(data)?strm.input=new Uint8Array(data):strm.input=data,strm.next_in=0,strm.avail_in=strm.input.length;do{if(0===strm.avail_out&&(strm.output=new utils.Buf8(chunkSize),strm.next_out=0,strm.avail_out=chunkSize),status=zlib_inflate.inflate(strm,c.Z_NO_FLUSH),status===c.Z_NEED_DICT&&dictionary&&(dict="string"==typeof dictionary?strings.string2buf(dictionary):"[object ArrayBuffer]"===toString.call(dictionary)?new Uint8Array(dictionary):dictionary,status=zlib_inflate.inflateSetDictionary(this.strm,dict)),status===c.Z_BUF_ERROR&&!0===allowBufError&&(status=c.Z_OK,allowBufError=!1),status!==c.Z_STREAM_END&&status!==c.Z_OK)return this.onEnd(status),this.ended=!0,!1;strm.next_out&&(0!==strm.avail_out&&status!==c.Z_STREAM_END&&(0!==strm.avail_in||_mode!==c.Z_FINISH&&_mode!==c.Z_SYNC_FLUSH)||("string"===this.options.to?(next_out_utf8=strings.utf8border(strm.output,strm.next_out),tail=strm.next_out-next_out_utf8,utf8str=strings.buf2string(strm.output,next_out_utf8),strm.next_out=tail,strm.avail_out=chunkSize-tail,tail&&utils.arraySet(strm.output,strm.output,next_out_utf8,tail,0),this.onData(utf8str)):this.onData(utils.shrinkBuf(strm.output,strm.next_out)))),0===strm.avail_in&&0===strm.avail_out&&(allowBufError=!0)}while((strm.avail_in>0||0===strm.avail_out)&&status!==c.Z_STREAM_END);return status===c.Z_STREAM_END&&(_mode=c.Z_FINISH),_mode===c.Z_FINISH?(status=zlib_inflate.inflateEnd(this.strm),this.onEnd(status),this.ended=!0,status===c.Z_OK):_mode!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),strm.avail_out=0,!0)},Inflate.prototype.onData=function(chunk){this.chunks.push(chunk)},Inflate.prototype.onEnd=function(status){status===c.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=utils.flattenChunks(this.chunks)),this.chunks=[],this.err=status,this.msg=this.strm.msg},exports.Inflate=Inflate,exports.inflate=inflate,exports.inflateRaw=inflateRaw,exports.ungzip=inflate},{"./utils/common":77,"./utils/strings":78,"./zlib/constants":80,"./zlib/gzheader":83,"./zlib/inflate":85,"./zlib/messages":87,"./zlib/zstream":89}],77:[function(require,module,exports){"use strict";var TYPED_OK="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;exports.assign=function(obj){for(var sources=Array.prototype.slice.call(arguments,1);sources.length;){var source=sources.shift();if(source){if("object"!=typeof source)throw new TypeError(source+"must be non-object");for(var p in source)source.hasOwnProperty(p)&&(obj[p]=source[p])}}return obj},exports.shrinkBuf=function(buf,size){return buf.length===size?buf:buf.subarray?buf.subarray(0,size):(buf.length=size,buf)};var fnTyped={arraySet:function(dest,src,src_offs,len,dest_offs){if(src.subarray&&dest.subarray)return void dest.set(src.subarray(src_offs,src_offs+len),dest_offs);for(var i=0;i=252?6:q>=248?5:q>=240?4:q>=224?3:q>=192?2:1;_utf8len[254]=_utf8len[254]=1,exports.string2buf=function(str){var buf,c,c2,m_pos,i,str_len=str.length,buf_len=0;for(m_pos=0;m_pos>>6,buf[i++]=128|63&c):c<65536?(buf[i++]=224|c>>>12,buf[i++]=128|c>>>6&63,buf[i++]=128|63&c):(buf[i++]=240|c>>>18,buf[i++]=128|c>>>12&63,buf[i++]=128|c>>>6&63,buf[i++]=128|63&c);return buf},exports.buf2binstring=function(buf){return buf2binstring(buf,buf.length)},exports.binstring2buf=function(str){for(var buf=new utils.Buf8(str.length),i=0,len=buf.length;i4)utf16buf[out++]=65533,i+=c_len-1;else{for(c&=2===c_len?31:3===c_len?15:7;c_len>1&&i1?utf16buf[out++]=65533:c<65536?utf16buf[out++]=c:(c-=65536,utf16buf[out++]=55296|c>>10&1023,utf16buf[out++]=56320|1023&c)}return buf2binstring(utf16buf,out)},exports.utf8border=function(buf,max){var pos;for(max=max||buf.length,max>buf.length&&(max=buf.length),pos=max-1;pos>=0&&128==(192&buf[pos]);)pos--;return pos<0?max:0===pos?max:pos+_utf8len[buf[pos]]>max?pos:max}},{"./common":77}],79:[function(require,module,exports){"use strict";function adler32(adler,buf,len,pos){for(var s1=65535&adler|0,s2=adler>>>16&65535|0,n=0;0!==len;){n=len>2e3?2e3:len,len-=n;do{s1=s1+buf[pos++]|0,s2=s2+s1|0}while(--n);s1%=65521,s2%=65521}return s1|s2<<16|0}module.exports=adler32},{}],80:[function(require,module,exports){"use strict";module.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],81:[function(require,module,exports){"use strict";function crc32(crc,buf,len,pos){var t=crcTable,end=pos+len;crc^=-1;for(var i=pos;i>>8^t[255&(crc^buf[i])];return-1^crc}var crcTable=function(){for(var c,table=[],n=0;n<256;n++){c=n;for(var k=0;k<8;k++)c=1&c?3988292384^c>>>1:c>>>1;table[n]=c}return table}();module.exports=crc32},{}],82:[function(require,module,exports){"use strict";function err(strm,errorCode){return strm.msg=msg[errorCode],errorCode}function rank(f){return(f<<1)-(f>4?9:0)}function zero(buf){for(var len=buf.length;--len>=0;)buf[len]=0}function flush_pending(strm){var s=strm.state,len=s.pending;len>strm.avail_out&&(len=strm.avail_out),0!==len&&(utils.arraySet(strm.output,s.pending_buf,s.pending_out,len,strm.next_out),strm.next_out+=len,s.pending_out+=len,strm.total_out+=len,strm.avail_out-=len,s.pending-=len,0===s.pending&&(s.pending_out=0))}function flush_block_only(s,last){trees._tr_flush_block(s,s.block_start>=0?s.block_start:-1,s.strstart-s.block_start,last),s.block_start=s.strstart,flush_pending(s.strm)}function put_byte(s,b){s.pending_buf[s.pending++]=b}function putShortMSB(s,b){s.pending_buf[s.pending++]=b>>>8&255,s.pending_buf[s.pending++]=255&b}function read_buf(strm,buf,start,size){var len=strm.avail_in;return len>size&&(len=size),0===len?0:(strm.avail_in-=len,utils.arraySet(buf,strm.input,strm.next_in,len,start),1===strm.state.wrap?strm.adler=adler32(strm.adler,buf,len,start):2===strm.state.wrap&&(strm.adler=crc32(strm.adler,buf,len,start)),strm.next_in+=len,strm.total_in+=len,len)}function longest_match(s,cur_match){var match,len,chain_length=s.max_chain_length,scan=s.strstart,best_len=s.prev_length,nice_match=s.nice_match,limit=s.strstart>s.w_size-MIN_LOOKAHEAD?s.strstart-(s.w_size-MIN_LOOKAHEAD):0,_win=s.window,wmask=s.w_mask,prev=s.prev,strend=s.strstart+MAX_MATCH,scan_end1=_win[scan+best_len-1],scan_end=_win[scan+best_len];s.prev_length>=s.good_match&&(chain_length>>=2),nice_match>s.lookahead&&(nice_match=s.lookahead);do{if(match=cur_match,_win[match+best_len]===scan_end&&_win[match+best_len-1]===scan_end1&&_win[match]===_win[scan]&&_win[++match]===_win[scan+1]){scan+=2,match++;do{}while(_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&_win[++scan]===_win[++match]&&scanbest_len){if(s.match_start=cur_match,best_len=len,len>=nice_match)break;scan_end1=_win[scan+best_len-1],scan_end=_win[scan+best_len]}}}while((cur_match=prev[cur_match&wmask])>limit&&0!=--chain_length);return best_len<=s.lookahead?best_len:s.lookahead}function fill_window(s){var p,n,m,more,str,_w_size=s.w_size;do{if(more=s.window_size-s.lookahead-s.strstart,s.strstart>=_w_size+(_w_size-MIN_LOOKAHEAD)){utils.arraySet(s.window,s.window,_w_size,_w_size,0),s.match_start-=_w_size,s.strstart-=_w_size,s.block_start-=_w_size,n=s.hash_size,p=n;do{m=s.head[--p],s.head[p]=m>=_w_size?m-_w_size:0}while(--n);n=_w_size,p=n;do{m=s.prev[--p],s.prev[p]=m>=_w_size?m-_w_size:0}while(--n);more+=_w_size}if(0===s.strm.avail_in)break;if(n=read_buf(s.strm,s.window,s.strstart+s.lookahead,more),s.lookahead+=n,s.lookahead+s.insert>=MIN_MATCH)for(str=s.strstart-s.insert,s.ins_h=s.window[str],s.ins_h=(s.ins_h<s.pending_buf_size-5&&(max_block_size=s.pending_buf_size-5);;){if(s.lookahead<=1){if(fill_window(s),0===s.lookahead&&flush===Z_NO_FLUSH)return BS_NEED_MORE;if(0===s.lookahead)break}s.strstart+=s.lookahead,s.lookahead=0;var max_start=s.block_start+max_block_size;if((0===s.strstart||s.strstart>=max_start)&&(s.lookahead=s.strstart-max_start,s.strstart=max_start,flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE;if(s.strstart-s.block_start>=s.w_size-MIN_LOOKAHEAD&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}return s.insert=0,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):(s.strstart>s.block_start&&(flush_block_only(s,!1),s.strm.avail_out),BS_NEED_MORE)}function deflate_fast(s,flush){for(var hash_head,bflush;;){if(s.lookahead=MIN_MATCH&&(s.ins_h=(s.ins_h<=MIN_MATCH)if(bflush=trees._tr_tally(s,s.strstart-s.match_start,s.match_length-MIN_MATCH),s.lookahead-=s.match_length,s.match_length<=s.max_lazy_match&&s.lookahead>=MIN_MATCH){s.match_length--;do{s.strstart++,s.ins_h=(s.ins_h<=MIN_MATCH&&(s.ins_h=(s.ins_h<4096)&&(s.match_length=MIN_MATCH-1)),s.prev_length>=MIN_MATCH&&s.match_length<=s.prev_length){max_insert=s.strstart+s.lookahead-MIN_MATCH,bflush=trees._tr_tally(s,s.strstart-1-s.prev_match,s.prev_length-MIN_MATCH),s.lookahead-=s.prev_length-1,s.prev_length-=2;do{++s.strstart<=max_insert&&(s.ins_h=(s.ins_h<=MIN_MATCH&&s.strstart>0&&(scan=s.strstart-1,(prev=_win[scan])===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan])){strend=s.strstart+MAX_MATCH;do{}while(prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&prev===_win[++scan]&&scans.lookahead&&(s.match_length=s.lookahead)}if(s.match_length>=MIN_MATCH?(bflush=trees._tr_tally(s,1,s.match_length-MIN_MATCH),s.lookahead-=s.match_length,s.strstart+=s.match_length,s.match_length=0):(bflush=trees._tr_tally(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++),bflush&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}return s.insert=0,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):s.last_lit&&(flush_block_only(s,!1),0===s.strm.avail_out)?BS_NEED_MORE:BS_BLOCK_DONE}function deflate_huff(s,flush){for(var bflush;;){if(0===s.lookahead&&(fill_window(s),0===s.lookahead)){if(flush===Z_NO_FLUSH)return BS_NEED_MORE;break}if(s.match_length=0,bflush=trees._tr_tally(s,0,s.window[s.strstart]),s.lookahead--,s.strstart++,bflush&&(flush_block_only(s,!1),0===s.strm.avail_out))return BS_NEED_MORE}return s.insert=0,flush===Z_FINISH?(flush_block_only(s,!0),0===s.strm.avail_out?BS_FINISH_STARTED:BS_FINISH_DONE):s.last_lit&&(flush_block_only(s,!1),0===s.strm.avail_out)?BS_NEED_MORE:BS_BLOCK_DONE}function Config(good_length,max_lazy,nice_length,max_chain,func){this.good_length=good_length,this.max_lazy=max_lazy,this.nice_length=nice_length,this.max_chain=max_chain,this.func=func}function lm_init(s){s.window_size=2*s.w_size,zero(s.head),s.max_lazy_match=configuration_table[s.level].max_lazy,s.good_match=configuration_table[s.level].good_length,s.nice_match=configuration_table[s.level].nice_length,s.max_chain_length=configuration_table[s.level].max_chain,s.strstart=0,s.block_start=0,s.lookahead=0,s.insert=0,s.match_length=s.prev_length=MIN_MATCH-1,s.match_available=0,s.ins_h=0}function DeflateState(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Z_DEFLATED,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new utils.Buf16(2*HEAP_SIZE),this.dyn_dtree=new utils.Buf16(2*(2*D_CODES+1)),this.bl_tree=new utils.Buf16(2*(2*BL_CODES+1)),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new utils.Buf16(MAX_BITS+1),this.heap=new utils.Buf16(2*L_CODES+1),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new utils.Buf16(2*L_CODES+1),zero(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function deflateResetKeep(strm){var s;return strm&&strm.state?(strm.total_in=strm.total_out=0,strm.data_type=Z_UNKNOWN,s=strm.state,s.pending=0,s.pending_out=0,s.wrap<0&&(s.wrap=-s.wrap),s.status=s.wrap?INIT_STATE:BUSY_STATE,strm.adler=2===s.wrap?0:1,s.last_flush=Z_NO_FLUSH,trees._tr_init(s),Z_OK):err(strm,Z_STREAM_ERROR)}function deflateReset(strm){var ret=deflateResetKeep(strm);return ret===Z_OK&&lm_init(strm.state),ret}function deflateSetHeader(strm,head){return strm&&strm.state?2!==strm.state.wrap?Z_STREAM_ERROR:(strm.state.gzhead=head,Z_OK):Z_STREAM_ERROR}function deflateInit2(strm,level,method,windowBits,memLevel,strategy){if(!strm)return Z_STREAM_ERROR;var wrap=1;if(level===Z_DEFAULT_COMPRESSION&&(level=6),windowBits<0?(wrap=0,windowBits=-windowBits):windowBits>15&&(wrap=2,windowBits-=16),memLevel<1||memLevel>MAX_MEM_LEVEL||method!==Z_DEFLATED||windowBits<8||windowBits>15||level<0||level>9||strategy<0||strategy>Z_FIXED)return err(strm,Z_STREAM_ERROR);8===windowBits&&(windowBits=9);var s=new DeflateState;return strm.state=s,s.strm=strm,s.wrap=wrap,s.gzhead=null,s.w_bits=windowBits,s.w_size=1<Z_BLOCK||flush<0)return strm?err(strm,Z_STREAM_ERROR):Z_STREAM_ERROR;if(s=strm.state,!strm.output||!strm.input&&0!==strm.avail_in||s.status===FINISH_STATE&&flush!==Z_FINISH)return err(strm,0===strm.avail_out?Z_BUF_ERROR:Z_STREAM_ERROR);if(s.strm=strm,old_flush=s.last_flush,s.last_flush=flush,s.status===INIT_STATE)if(2===s.wrap)strm.adler=0,put_byte(s,31),put_byte(s,139),put_byte(s,8),s.gzhead?(put_byte(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),put_byte(s,255&s.gzhead.time),put_byte(s,s.gzhead.time>>8&255),put_byte(s,s.gzhead.time>>16&255),put_byte(s,s.gzhead.time>>24&255),put_byte(s,9===s.level?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0),put_byte(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(put_byte(s,255&s.gzhead.extra.length),put_byte(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=EXTRA_STATE):(put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,0),put_byte(s,9===s.level?2:s.strategy>=Z_HUFFMAN_ONLY||s.level<2?4:0),put_byte(s,OS_CODE),s.status=BUSY_STATE);else{var header=Z_DEFLATED+(s.w_bits-8<<4)<<8,level_flags=-1;level_flags=s.strategy>=Z_HUFFMAN_ONLY||s.level<2?0:s.level<6?1:6===s.level?2:3,header|=level_flags<<6,0!==s.strstart&&(header|=PRESET_DICT),header+=31-header%31,s.status=BUSY_STATE,putShortMSB(s,header),0!==s.strstart&&(putShortMSB(s,strm.adler>>>16),putShortMSB(s,65535&strm.adler)),strm.adler=1}if(s.status===EXTRA_STATE)if(s.gzhead.extra){for(beg=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),flush_pending(strm),beg=s.pending,s.pending!==s.pending_buf_size));)put_byte(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=NAME_STATE)}else s.status=NAME_STATE;if(s.status===NAME_STATE)if(s.gzhead.name){beg=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),flush_pending(strm),beg=s.pending,s.pending===s.pending_buf_size)){val=1;break}val=s.gzindexbeg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),0===val&&(s.gzindex=0,s.status=COMMENT_STATE)}else s.status=COMMENT_STATE;if(s.status===COMMENT_STATE)if(s.gzhead.comment){beg=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>beg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),flush_pending(strm),beg=s.pending,s.pending===s.pending_buf_size)){val=1;break}val=s.gzindexbeg&&(strm.adler=crc32(strm.adler,s.pending_buf,s.pending-beg,beg)),0===val&&(s.status=HCRC_STATE)}else s.status=HCRC_STATE;if(s.status===HCRC_STATE&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&flush_pending(strm),s.pending+2<=s.pending_buf_size&&(put_byte(s,255&strm.adler),put_byte(s,strm.adler>>8&255),strm.adler=0,s.status=BUSY_STATE)):s.status=BUSY_STATE),0!==s.pending){if(flush_pending(strm),0===strm.avail_out)return s.last_flush=-1,Z_OK}else if(0===strm.avail_in&&rank(flush)<=rank(old_flush)&&flush!==Z_FINISH)return err(strm,Z_BUF_ERROR);if(s.status===FINISH_STATE&&0!==strm.avail_in)return err(strm,Z_BUF_ERROR);if(0!==strm.avail_in||0!==s.lookahead||flush!==Z_NO_FLUSH&&s.status!==FINISH_STATE){var bstate=s.strategy===Z_HUFFMAN_ONLY?deflate_huff(s,flush):s.strategy===Z_RLE?deflate_rle(s,flush):configuration_table[s.level].func(s,flush);if(bstate!==BS_FINISH_STARTED&&bstate!==BS_FINISH_DONE||(s.status=FINISH_STATE),bstate===BS_NEED_MORE||bstate===BS_FINISH_STARTED)return 0===strm.avail_out&&(s.last_flush=-1),Z_OK;if(bstate===BS_BLOCK_DONE&&(flush===Z_PARTIAL_FLUSH?trees._tr_align(s):flush!==Z_BLOCK&&(trees._tr_stored_block(s,0,0,!1),flush===Z_FULL_FLUSH&&(zero(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),flush_pending(strm),0===strm.avail_out))return s.last_flush=-1,Z_OK}return flush!==Z_FINISH?Z_OK:s.wrap<=0?Z_STREAM_END:(2===s.wrap?(put_byte(s,255&strm.adler),put_byte(s,strm.adler>>8&255),put_byte(s,strm.adler>>16&255),put_byte(s,strm.adler>>24&255),put_byte(s,255&strm.total_in),put_byte(s,strm.total_in>>8&255),put_byte(s,strm.total_in>>16&255),put_byte(s,strm.total_in>>24&255)):(putShortMSB(s,strm.adler>>>16),putShortMSB(s,65535&strm.adler)),flush_pending(strm),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?Z_OK:Z_STREAM_END)}function deflateEnd(strm){var status;return strm&&strm.state?(status=strm.state.status)!==INIT_STATE&&status!==EXTRA_STATE&&status!==NAME_STATE&&status!==COMMENT_STATE&&status!==HCRC_STATE&&status!==BUSY_STATE&&status!==FINISH_STATE?err(strm,Z_STREAM_ERROR):(strm.state=null,status===BUSY_STATE?err(strm,Z_DATA_ERROR):Z_OK):Z_STREAM_ERROR}function deflateSetDictionary(strm,dictionary){var s,str,n,wrap,avail,next,input,tmpDict,dictLength=dictionary.length;if(!strm||!strm.state)return Z_STREAM_ERROR;if(s=strm.state,2===(wrap=s.wrap)||1===wrap&&s.status!==INIT_STATE||s.lookahead)return Z_STREAM_ERROR;for(1===wrap&&(strm.adler=adler32(strm.adler,dictionary,dictLength,0)),s.wrap=0,dictLength>=s.w_size&&(0===wrap&&(zero(s.head),s.strstart=0,s.block_start=0,s.insert=0),tmpDict=new utils.Buf8(s.w_size),utils.arraySet(tmpDict,dictionary,dictLength-s.w_size,s.w_size,0),dictionary=tmpDict,dictLength=s.w_size),avail=strm.avail_in,next=strm.next_in,input=strm.input,strm.avail_in=dictLength,strm.next_in=0,strm.input=dictionary,fill_window(s);s.lookahead>=MIN_MATCH;){str=s.strstart,n=s.lookahead-(MIN_MATCH-1);do{s.ins_h=(s.ins_h<>>24,hold>>>=op,bits-=op,0===(op=here>>>16&255))output[_out++]=65535&here;else{if(!(16&op)){if(0==(64&op)){here=lcode[(65535&here)+(hold&(1<>>=op,bits-=op),bits<15&&(hold+=input[_in++]<>>24,hold>>>=op,bits-=op,!(16&(op=here>>>16&255))){if(0==(64&op)){
+here=dcode[(65535&here)+(hold&(1<dmax){strm.msg="invalid distance too far back",state.mode=30;break top}if(hold>>>=op,bits-=op,op=_out-beg,dist>op){if((op=dist-op)>whave&&state.sane){strm.msg="invalid distance too far back",state.mode=30;break top}if(from=0,from_source=s_window,0===wnext){if(from+=wsize-op,op2;)output[_out++]=from_source[from++],output[_out++]=from_source[from++],output[_out++]=from_source[from++],len-=3;len&&(output[_out++]=from_source[from++],len>1&&(output[_out++]=from_source[from++]))}else{from=_out-dist;do{output[_out++]=output[from++],output[_out++]=output[from++],output[_out++]=output[from++],len-=3}while(len>2);len&&(output[_out++]=output[from++],len>1&&(output[_out++]=output[from++]))}break}}break}}while(_in>3,_in-=len,bits-=len<<3,hold&=(1<>>24&255)+(q>>>8&65280)+((65280&q)<<8)+((255&q)<<24)}function InflateState(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new utils.Buf16(320),this.work=new utils.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function inflateResetKeep(strm){var state;return strm&&strm.state?(state=strm.state,strm.total_in=strm.total_out=state.total=0,strm.msg="",state.wrap&&(strm.adler=1&state.wrap),state.mode=HEAD,state.last=0,state.havedict=0,state.dmax=32768,state.head=null,state.hold=0,state.bits=0,state.lencode=state.lendyn=new utils.Buf32(ENOUGH_LENS),state.distcode=state.distdyn=new utils.Buf32(ENOUGH_DISTS),state.sane=1,state.back=-1,Z_OK):Z_STREAM_ERROR}function inflateReset(strm){var state;return strm&&strm.state?(state=strm.state,state.wsize=0,state.whave=0,state.wnext=0,inflateResetKeep(strm)):Z_STREAM_ERROR}function inflateReset2(strm,windowBits){var wrap,state;return strm&&strm.state?(state=strm.state,windowBits<0?(wrap=0,windowBits=-windowBits):(wrap=1+(windowBits>>4),windowBits<48&&(windowBits&=15)),windowBits&&(windowBits<8||windowBits>15)?Z_STREAM_ERROR:(null!==state.window&&state.wbits!==windowBits&&(state.window=null),state.wrap=wrap,state.wbits=windowBits,inflateReset(strm))):Z_STREAM_ERROR}function inflateInit2(strm,windowBits){var ret,state;return strm?(state=new InflateState,strm.state=state,state.window=null,ret=inflateReset2(strm,windowBits),ret!==Z_OK&&(strm.state=null),ret):Z_STREAM_ERROR}function inflateInit(strm){return inflateInit2(strm,DEF_WBITS)}function fixedtables(state){if(virgin){var sym;for(lenfix=new utils.Buf32(512),distfix=new utils.Buf32(32),sym=0;sym<144;)state.lens[sym++]=8;for(;sym<256;)state.lens[sym++]=9;for(;sym<280;)state.lens[sym++]=7;for(;sym<288;)state.lens[sym++]=8;for(inflate_table(LENS,state.lens,0,288,lenfix,0,state.work,{bits:9}),sym=0;sym<32;)state.lens[sym++]=5;inflate_table(DISTS,state.lens,0,32,distfix,0,state.work,{bits:5}),virgin=!1}state.lencode=lenfix,state.lenbits=9,state.distcode=distfix,state.distbits=5}function updatewindow(strm,src,end,copy){var dist,state=strm.state;return null===state.window&&(state.wsize=1<=state.wsize?(utils.arraySet(state.window,src,end-state.wsize,state.wsize,0),state.wnext=0,state.whave=state.wsize):(dist=state.wsize-state.wnext,dist>copy&&(dist=copy),utils.arraySet(state.window,src,end-copy,dist,state.wnext),copy-=dist,copy?(utils.arraySet(state.window,src,end-copy,copy,0),state.wnext=copy,state.whave=state.wsize):(state.wnext+=dist,state.wnext===state.wsize&&(state.wnext=0),state.whave>>8&255,state.check=crc32(state.check,hbuf,2,0),hold=0,bits=0,state.mode=FLAGS;break}if(state.flags=0,state.head&&(state.head.done=!1),!(1&state.wrap)||(((255&hold)<<8)+(hold>>8))%31){strm.msg="incorrect header check",state.mode=BAD;break}if((15&hold)!==Z_DEFLATED){strm.msg="unknown compression method",state.mode=BAD;break}if(hold>>>=4,bits-=4,len=8+(15&hold),0===state.wbits)state.wbits=len;else if(len>state.wbits){strm.msg="invalid window size",state.mode=BAD;break}state.dmax=1<>8&1),512&state.flags&&(hbuf[0]=255&hold,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0)),hold=0,bits=0,state.mode=TIME;case TIME:for(;bits<32;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>8&255,hbuf[2]=hold>>>16&255,hbuf[3]=hold>>>24&255,state.check=crc32(state.check,hbuf,4,0)),hold=0,bits=0,state.mode=OS;case OS:for(;bits<16;){if(0===have)break inf_leave;have--,hold+=input[next++]<>8),512&state.flags&&(hbuf[0]=255&hold,hbuf[1]=hold>>>8&255,state.check=crc32(state.check,hbuf,2,0)),hold=0,bits=0,state.mode=EXLEN;case EXLEN:if(1024&state.flags){for(;bits<16;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>8&255,state.check=crc32(state.check,hbuf,2,0)),hold=0,bits=0}else state.head&&(state.head.extra=null);state.mode=EXTRA;case EXTRA:if(1024&state.flags&&(copy=state.length,copy>have&&(copy=have),copy&&(state.head&&(len=state.head.extra_len-state.length,state.head.extra||(state.head.extra=new Array(state.head.extra_len)),utils.arraySet(state.head.extra,input,next,copy,len)),512&state.flags&&(state.check=crc32(state.check,input,copy,next)),have-=copy,next+=copy,state.length-=copy),state.length))break inf_leave;state.length=0,state.mode=NAME;case NAME:if(2048&state.flags){if(0===have)break inf_leave;copy=0;do{len=input[next+copy++],state.head&&len&&state.length<65536&&(state.head.name+=String.fromCharCode(len))}while(len&©>9&1,state.head.done=!0),strm.adler=state.check=0,state.mode=TYPE;break;case DICTID:for(;bits<32;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=7&bits,bits-=7&bits,state.mode=CHECK;break}for(;bits<3;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=1,bits-=1,3&hold){case 0:state.mode=STORED;break;case 1:if(fixedtables(state),state.mode=LEN_,flush===Z_TREES){hold>>>=2,bits-=2;break inf_leave}break;case 2:state.mode=TABLE;break;case 3:strm.msg="invalid block type",state.mode=BAD}hold>>>=2,bits-=2;break;case STORED:for(hold>>>=7&bits,bits-=7&bits;bits<32;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>16^65535)){strm.msg="invalid stored block lengths",state.mode=BAD;break}if(state.length=65535&hold,hold=0,bits=0,state.mode=COPY_,flush===Z_TREES)break inf_leave;case COPY_:state.mode=COPY;case COPY:if(copy=state.length){if(copy>have&&(copy=have),copy>left&&(copy=left),0===copy)break inf_leave;utils.arraySet(output,input,next,copy,put),have-=copy,next+=copy,left-=copy,put+=copy,state.length-=copy;break}state.mode=TYPE;break;case TABLE:for(;bits<14;){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=5,bits-=5,state.ndist=1+(31&hold),hold>>>=5,bits-=5,state.ncode=4+(15&hold),hold>>>=4,bits-=4,state.nlen>286||state.ndist>30){strm.msg="too many length or distance symbols",state.mode=BAD;break}state.have=0,state.mode=LENLENS;case LENLENS:for(;state.have>>=3,bits-=3}for(;state.have<19;)state.lens[order[state.have++]]=0;if(state.lencode=state.lendyn,state.lenbits=7,opts={bits:state.lenbits},ret=inflate_table(CODES,state.lens,0,19,state.lencode,0,state.work,opts),state.lenbits=opts.bits,ret){strm.msg="invalid code lengths set",state.mode=BAD;break}state.have=0,state.mode=CODELENS;case CODELENS:for(;state.have>>24,here_op=here>>>16&255,here_val=65535&here,!(here_bits<=bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=here_bits,bits-=here_bits,state.lens[state.have++]=here_val;else{if(16===here_val){for(n=here_bits+2;bits>>=here_bits,bits-=here_bits,0===state.have){strm.msg="invalid bit length repeat",state.mode=BAD;break}len=state.lens[state.have-1],copy=3+(3&hold),hold>>>=2,bits-=2}else if(17===here_val){for(n=here_bits+3;bits>>=here_bits,bits-=here_bits,len=0,copy=3+(7&hold),hold>>>=3,bits-=3}else{for(n=here_bits+7;bits>>=here_bits,bits-=here_bits,len=0,copy=11+(127&hold),hold>>>=7,bits-=7}if(state.have+copy>state.nlen+state.ndist){strm.msg="invalid bit length repeat",state.mode=BAD;break}for(;copy--;)state.lens[state.have++]=len}}if(state.mode===BAD)break;if(0===state.lens[256]){strm.msg="invalid code -- missing end-of-block",state.mode=BAD;break}if(state.lenbits=9,opts={bits:state.lenbits},ret=inflate_table(LENS,state.lens,0,state.nlen,state.lencode,0,state.work,opts),state.lenbits=opts.bits,ret){strm.msg="invalid literal/lengths set",state.mode=BAD;break}if(state.distbits=6,state.distcode=state.distdyn,opts={bits:state.distbits},ret=inflate_table(DISTS,state.lens,state.nlen,state.ndist,state.distcode,0,state.work,opts),state.distbits=opts.bits,ret){strm.msg="invalid distances set",state.mode=BAD;break}if(state.mode=LEN_,flush===Z_TREES)break inf_leave;case LEN_:state.mode=LEN;case LEN:if(have>=6&&left>=258){strm.next_out=put,strm.avail_out=left,strm.next_in=next,strm.avail_in=have,state.hold=hold,state.bits=bits,inflate_fast(strm,_out),put=strm.next_out,output=strm.output,left=strm.avail_out,next=strm.next_in,input=strm.input,have=strm.avail_in,hold=state.hold,bits=state.bits,state.mode===TYPE&&(state.back=-1);break}for(state.back=0;here=state.lencode[hold&(1<>>24,here_op=here>>>16&255,here_val=65535&here,!(here_bits<=bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<>last_bits)],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(last_bits+here_bits<=bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=last_bits,bits-=last_bits,state.back+=last_bits}if(hold>>>=here_bits,bits-=here_bits,state.back+=here_bits,state.length=here_val,0===here_op){state.mode=LIT;break}if(32&here_op){state.back=-1,state.mode=TYPE;break}if(64&here_op){strm.msg="invalid literal/length code",state.mode=BAD;break}state.extra=15&here_op,state.mode=LENEXT;case LENEXT:if(state.extra){for(n=state.extra;bits>>=state.extra,bits-=state.extra,state.back+=state.extra}state.was=state.length,state.mode=DIST;case DIST:for(;here=state.distcode[hold&(1<>>24,here_op=here>>>16&255,here_val=65535&here,!(here_bits<=bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<>last_bits)],here_bits=here>>>24,here_op=here>>>16&255,here_val=65535&here,!(last_bits+here_bits<=bits);){if(0===have)break inf_leave;have--,hold+=input[next++]<>>=last_bits,bits-=last_bits,state.back+=last_bits}if(hold>>>=here_bits,bits-=here_bits,state.back+=here_bits,64&here_op){strm.msg="invalid distance code",state.mode=BAD;break}state.offset=here_val,state.extra=15&here_op,state.mode=DISTEXT;case DISTEXT:if(state.extra){for(n=state.extra;bits>>=state.extra,bits-=state.extra,state.back+=state.extra}if(state.offset>state.dmax){strm.msg="invalid distance too far back",state.mode=BAD;break}state.mode=MATCH;case MATCH:if(0===left)break inf_leave;if(copy=_out-left,state.offset>copy){if((copy=state.offset-copy)>state.whave&&state.sane){strm.msg="invalid distance too far back",state.mode=BAD;break}copy>state.wnext?(copy-=state.wnext,from=state.wsize-copy):from=state.wnext-copy,copy>state.length&&(copy=state.length),from_source=state.window}else from_source=output,from=put-state.offset,copy=state.length;copy>left&&(copy=left),left-=copy,state.length-=copy;do{output[put++]=from_source[from++]}while(--copy);0===state.length&&(state.mode=LEN);break;case LIT:if(0===left)break inf_leave;output[put++]=state.length,left--,state.mode=LEN;break;case CHECK:if(state.wrap){for(;bits<32;){if(0===have)break inf_leave;have--,hold|=input[next++]<=1&&0===count[max];max--);if(root>max&&(root=max),0===max)return table[table_index++]=20971520,table[table_index++]=20971520,opts.bits=1,0;for(min=1;min0&&(0===type||1!==max))return-1;for(offs[1]=0,len=1;len<15;len++)offs[len+1]=offs[len]+count[len];for(sym=0;sym852||2===type&&used>592)return 1;for(var i=0;;){i++,here_bits=len-drop,work[sym]end?(here_op=extra[extra_index+work[sym]],here_val=base[base_index+work[sym]]):(here_op=96,here_val=0),incr=1<>drop)+fill]=here_bits<<24|here_op<<16|here_val|0}while(0!==fill);for(incr=1<>=1;if(0!==incr?(huff&=incr-1,huff+=incr):huff=0,sym++,0==--count[len]){if(len===max)break;len=lens[lens_index+work[sym]]}if(len>root&&(huff&mask)!==low){for(0===drop&&(drop=root),next+=min,curr=len-drop,left=1<852||2===type&&used>592)return 1;low=huff&mask,table[low]=root<<24|curr<<16|next-table_index|0}}return 0!==huff&&(table[next+huff]=len-drop<<24|64<<16|0),opts.bits=root,0}},{"../utils/common":77}],87:[function(require,module,exports){"use strict";module.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],88:[function(require,module,exports){"use strict";function zero(buf){for(var len=buf.length;--len>=0;)buf[len]=0}function StaticTreeDesc(static_tree,extra_bits,extra_base,elems,max_length){this.static_tree=static_tree,this.extra_bits=extra_bits,this.extra_base=extra_base,this.elems=elems,this.max_length=max_length,this.has_stree=static_tree&&static_tree.length}function TreeDesc(dyn_tree,stat_desc){this.dyn_tree=dyn_tree,this.max_code=0,this.stat_desc=stat_desc}function d_code(dist){return dist<256?_dist_code[dist]:_dist_code[256+(dist>>>7)]}function put_short(s,w){s.pending_buf[s.pending++]=255&w,s.pending_buf[s.pending++]=w>>>8&255}function send_bits(s,value,length){s.bi_valid>Buf_size-length?(s.bi_buf|=value<>Buf_size-s.bi_valid,s.bi_valid+=length-Buf_size):(s.bi_buf|=value<>>=1,res<<=1}while(--len>0);return res>>>1}function bi_flush(s){16===s.bi_valid?(put_short(s,s.bi_buf),s.bi_buf=0,s.bi_valid=0):s.bi_valid>=8&&(s.pending_buf[s.pending++]=255&s.bi_buf,s.bi_buf>>=8,s.bi_valid-=8)}function gen_bitlen(s,desc){var h,n,m,bits,xbits,f,tree=desc.dyn_tree,max_code=desc.max_code,stree=desc.stat_desc.static_tree,has_stree=desc.stat_desc.has_stree,extra=desc.stat_desc.extra_bits,base=desc.stat_desc.extra_base,max_length=desc.stat_desc.max_length,overflow=0;for(bits=0;bits<=MAX_BITS;bits++)s.bl_count[bits]=0;for(tree[2*s.heap[s.heap_max]+1]=0,h=s.heap_max+1;hmax_length&&(bits=max_length,overflow++),tree[2*n+1]=bits,n>max_code||(s.bl_count[bits]++,xbits=0,n>=base&&(xbits=extra[n-base]),f=tree[2*n],s.opt_len+=f*(bits+xbits),has_stree&&(s.static_len+=f*(stree[2*n+1]+xbits)));if(0!==overflow){do{for(bits=max_length-1;0===s.bl_count[bits];)bits--;s.bl_count[bits]--,s.bl_count[bits+1]+=2,s.bl_count[max_length]--,overflow-=2}while(overflow>0);for(bits=max_length;0!==bits;bits--)for(n=s.bl_count[bits];0!==n;)(m=s.heap[--h])>max_code||(tree[2*m+1]!==bits&&(s.opt_len+=(bits-tree[2*m+1])*tree[2*m],tree[2*m+1]=bits),n--)}}function gen_codes(tree,max_code,bl_count){var bits,n,next_code=new Array(MAX_BITS+1),code=0;for(bits=1;bits<=MAX_BITS;bits++)next_code[bits]=code=code+bl_count[bits-1]<<1;for(n=0;n<=max_code;n++){var len=tree[2*n+1];0!==len&&(tree[2*n]=bi_reverse(next_code[len]++,len))}}function tr_static_init(){var n,bits,length,code,dist,bl_count=new Array(MAX_BITS+1);for(length=0,code=0;code>=7;code8?put_short(s,s.bi_buf):s.bi_valid>0&&(s.pending_buf[s.pending++]=s.bi_buf),s.bi_buf=0,s.bi_valid=0}function copy_block(s,buf,len,header){bi_windup(s),header&&(put_short(s,len),put_short(s,~len)),utils.arraySet(s.pending_buf,s.window,buf,len,s.pending),s.pending+=len}function smaller(tree,n,m,depth){var _n2=2*n,_m2=2*m;return tree[_n2]>1;n>=1;n--)pqdownheap(s,tree,n);node=elems;do{n=s.heap[1],s.heap[1]=s.heap[s.heap_len--],pqdownheap(s,tree,1),m=s.heap[1],s.heap[--s.heap_max]=n,s.heap[--s.heap_max]=m,tree[2*node]=tree[2*n]+tree[2*m],s.depth[node]=(s.depth[n]>=s.depth[m]?s.depth[n]:s.depth[m])+1,tree[2*n+1]=tree[2*m+1]=node,s.heap[1]=node++,pqdownheap(s,tree,1)}while(s.heap_len>=2);s.heap[--s.heap_max]=s.heap[1],gen_bitlen(s,desc),gen_codes(tree,max_code,s.bl_count)}function scan_tree(s,tree,max_code){var n,curlen,prevlen=-1,nextlen=tree[1],count=0,max_count=7,min_count=4;for(0===nextlen&&(max_count=138,min_count=3),tree[2*(max_code+1)+1]=65535,n=0;n<=max_code;n++)curlen=nextlen,nextlen=tree[2*(n+1)+1],++count=3&&0===s.bl_tree[2*bl_order[max_blindex]+1];max_blindex--);return s.opt_len+=3*(max_blindex+1)+5+5+4,max_blindex}function send_all_trees(s,lcodes,dcodes,blcodes){var rank;for(send_bits(s,lcodes-257,5),send_bits(s,dcodes-1,5),send_bits(s,blcodes-4,4),rank=0;rank>>=1)if(1&black_mask&&0!==s.dyn_ltree[2*n])return Z_BINARY;if(0!==s.dyn_ltree[18]||0!==s.dyn_ltree[20]||0!==s.dyn_ltree[26])return Z_TEXT;for(n=32;n0?(s.strm.data_type===Z_UNKNOWN&&(s.strm.data_type=detect_data_type(s)),build_tree(s,s.l_desc),build_tree(s,s.d_desc),max_blindex=build_bl_tree(s),opt_lenb=s.opt_len+3+7>>>3,(static_lenb=s.static_len+3+7>>>3)<=opt_lenb&&(opt_lenb=static_lenb)):opt_lenb=static_lenb=stored_len+5,stored_len+4<=opt_lenb&&-1!==buf?_tr_stored_block(s,buf,stored_len,last):s.strategy===Z_FIXED||static_lenb===opt_lenb?(send_bits(s,(STATIC_TREES<<1)+(last?1:0),3),compress_block(s,static_ltree,static_dtree)):(send_bits(s,(DYN_TREES<<1)+(last?1:0),3),send_all_trees(s,s.l_desc.max_code+1,s.d_desc.max_code+1,max_blindex+1),
+compress_block(s,s.dyn_ltree,s.dyn_dtree)),init_block(s),last&&bi_windup(s)}function _tr_tally(s,dist,lc){return s.pending_buf[s.d_buf+2*s.last_lit]=dist>>>8&255,s.pending_buf[s.d_buf+2*s.last_lit+1]=255&dist,s.pending_buf[s.l_buf+s.last_lit]=255&lc,s.last_lit++,0===dist?s.dyn_ltree[2*lc]++:(s.matches++,dist--,s.dyn_ltree[2*(_length_code[lc]+LITERALS+1)]++,s.dyn_dtree[2*d_code(dist)]++),s.last_lit===s.lit_bufsize-1}var utils=require("../utils/common"),Z_FIXED=4,Z_BINARY=0,Z_TEXT=1,Z_UNKNOWN=2,STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,Buf_size=16,MAX_BL_BITS=7,END_BLOCK=256,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,extra_lbits=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],extra_dbits=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],extra_blbits=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],bl_order=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],static_ltree=new Array(2*(L_CODES+2));zero(static_ltree);var static_dtree=new Array(2*D_CODES);zero(static_dtree);var _dist_code=new Array(512);zero(_dist_code);var _length_code=new Array(256);zero(_length_code);var base_length=new Array(LENGTH_CODES);zero(base_length);var base_dist=new Array(D_CODES);zero(base_dist);var static_l_desc,static_d_desc,static_bl_desc,static_init_done=!1;exports._tr_init=_tr_init,exports._tr_stored_block=_tr_stored_block,exports._tr_flush_block=_tr_flush_block,exports._tr_tally=_tr_tally,exports._tr_align=_tr_align},{"../utils/common":77}],89:[function(require,module,exports){"use strict";function ZStream(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}module.exports=ZStream},{}],90:[function(require,module,exports){(function(Buffer){"use strict";function ImageData(width,height,channels,data,trailer){this.width=width,this.height=height,this.channels=channels,this.data=data,this.trailer=trailer}function paeth(a,b,c){var p=a+b-c,pa=Math.abs(p-a),pb=Math.abs(p-b),pc=Math.abs(p-c);return pa<=pb&&pa<=pc?a:pb<=pc?b:c}function parseData(dataBuffer){var chunkLength,pngWidth,pngHeight,pngBitDepth,pngDepthMult,pngColorType,pngPixels,pngSamplesPerPixel,pngBytesPerPixel,pngBytesPerScanline,pngSamples,currentScanline,priorScanline,scanlineFilter,pngTrailer,pngPalette,pngAlpha,idChannels,state=0,off=0,buf=new Buffer(13),b=-1,p=0,pngPaletteEntries=0,pngAlphaEntries=0,inflateQueue=[];if(!function(data){for(var tmp,j,len=data.length,i=0;i!==len;)switch(state){case 0:if(data.readUInt8(i++)!==HEADER[off++])return!1;off===HEADER.length&&(state=1,off=0);break;case 1:if(len-i<8-off)data.copy(buf,off,i),off+=len-i,i=len;else switch(data.copy(buf,off,i,i+8-off),i+=8-off,off=0,chunkLength=buf.readUInt32BE(0),buf.toString("ascii",4,8)){case"IHDR":state=2;break;case"PLTE":if(3!==pngColorType)state=7;else{if(chunkLength%3!=0)return!1;pngPaletteEntries=chunkLength/3,pngPalette=new Buffer(chunkLength),state=3}break;case"tRNS":if(3!==pngColorType)return!1;idChannels++,pngAlphaEntries=chunkLength,pngAlpha=new Buffer(chunkLength),state=4;break;case"IDAT":pngPixels||(pngPixels=new Uint8Array(pngWidth*pngHeight*idChannels)),state=5;break;case"IEND":state=6;break;default:state=7}break;case 2:if(13!==chunkLength)return!1;if(len-i>>1)&255;break;case 4:currentScanline[b]=data[i]+(b>>3]>>7-(7&j)&1;break;case 2:pngSamples[k]=currentScanline[j>>>2]>>(3-(3&j)<<1)&3;break;case 4:pngSamples[k]=currentScanline[j>>>1]>>(1-(1&j)<<2)&15;break;case 8:pngSamples[k]=currentScanline[j];break;default:return null}switch(pngColorType){case 0:pngPixels[p++]=pngSamples[0]*pngDepthMult;break;case 2:pngPixels[p++]=pngSamples[0]*pngDepthMult,pngPixels[p++]=pngSamples[1]*pngDepthMult,pngPixels[p++]=pngSamples[2]*pngDepthMult;break;case 3:if(pngSamples[0]>=pngPaletteEntries)return null;switch(idChannels){case 1:pngPixels[p++]=pngPalette[3*pngSamples[0]];break;case 2:pngPixels[p++]=pngPalette[3*pngSamples[0]],pngPixels[p++]=pngSamples[0]=max)return res.substr(0,max);for(;max>res.length&&num>1;)1&num&&(res+=str),num>>=1,str+=str;return res+=str,res=res.substr(0,max)}var cache,res="";module.exports=repeat},{}],95:[function(require,module,exports){(function(global){module.exports=global.performance&&global.performance.now?function(){return performance.now()}:Date.now||function(){return+new Date}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],96:[function(require,module,exports){module.exports=require("./lib/sliced")},{"./lib/sliced":97}],97:[function(require,module,exports){module.exports=function(args,slice,sliceEnd){var ret=[],len=args.length;if(0===len)return ret;var start=slice<0?Math.max(0,slice+len):slice||0;for(void 0!==sliceEnd&&(len=sliceEnd<0?sliceEnd+len:sliceEnd);len-- >start;)ret[len-start]=args[len];return ret}},{}],98:[function(require,module,exports){!function(){"use strict";function sprintf(key){return sprintf_format(sprintf_parse(key),arguments)}function vsprintf(fmt,argv){return sprintf.apply(null,[fmt].concat(argv||[]))}function sprintf_format(parse_tree,argv){var arg,i,k,ph,pad,pad_character,pad_length,is_positive,sign,cursor=1,tree_length=parse_tree.length,output="";for(i=0;i=0),ph.type){case"b":arg=parseInt(arg,10).toString(2);break;case"c":arg=String.fromCharCode(parseInt(arg,10));break;case"d":case"i":arg=parseInt(arg,10);break;case"j":arg=JSON.stringify(arg,null,ph.width?parseInt(ph.width):0);break;case"e":arg=ph.precision?parseFloat(arg).toExponential(ph.precision):parseFloat(arg).toExponential();break;case"f":arg=ph.precision?parseFloat(arg).toFixed(ph.precision):parseFloat(arg);break;case"g":arg=ph.precision?String(Number(arg.toPrecision(ph.precision))):parseFloat(arg);break;case"o":arg=(parseInt(arg,10)>>>0).toString(8);break;case"s":arg=String(arg),arg=ph.precision?arg.substring(0,ph.precision):arg;break;case"t":arg=String(!!arg),arg=ph.precision?arg.substring(0,ph.precision):arg;break;case"T":arg=Object.prototype.toString.call(arg).slice(8,-1).toLowerCase(),arg=ph.precision?arg.substring(0,ph.precision):arg;break;case"u":arg=parseInt(arg,10)>>>0;break;case"v":arg=arg.valueOf(),arg=ph.precision?arg.substring(0,ph.precision):arg;break;case"x":arg=(parseInt(arg,10)>>>0).toString(16);break;case"X":arg=(parseInt(arg,10)>>>0).toString(16).toUpperCase()}re.json.test(ph.type)?output+=arg:(!re.number.test(ph.type)||is_positive&&!ph.sign?sign="":(sign=is_positive?"+":"-",arg=arg.toString().replace(re.sign,"")),pad_character=ph.pad_char?"0"===ph.pad_char?"0":ph.pad_char.charAt(1):" ",pad_length=ph.width-(sign+arg).length,pad=ph.width&&pad_length>0?pad_character.repeat(pad_length):"",output+=ph.align?sign+arg+pad:"0"===pad_character?sign+pad+arg:pad+sign+arg)}return output}function sprintf_parse(fmt){if(sprintf_cache[fmt])return sprintf_cache[fmt];for(var match,_fmt=fmt,parse_tree=[],arg_names=0;_fmt;){if(null!==(match=re.text.exec(_fmt)))parse_tree.push(match[0]);else if(null!==(match=re.modulo.exec(_fmt)))parse_tree.push("%");else{if(null===(match=re.placeholder.exec(_fmt)))throw new SyntaxError("[sprintf] unexpected placeholder");if(match[2]){arg_names|=1;var field_list=[],replacement_field=match[2],field_match=[];if(null===(field_match=re.key.exec(replacement_field)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(field_list.push(field_match[1]);""!==(replacement_field=replacement_field.substring(field_match[0].length));)if(null!==(field_match=re.key_access.exec(replacement_field)))field_list.push(field_match[1]);else{if(null===(field_match=re.index_access.exec(replacement_field)))throw new SyntaxError("[sprintf] failed to parse named argument key");field_list.push(field_match[1])}match[2]=field_list}else arg_names|=2;if(3===arg_names)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");parse_tree.push({placeholder:match[0],param_no:match[1],keys:match[2],sign:match[3],pad_char:match[4],align:match[5],width:match[6],precision:match[7],type:match[8]})}_fmt=_fmt.substring(match[0].length)}return sprintf_cache[fmt]=parse_tree}var re={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/},sprintf_cache=Object.create(null);void 0!==exports&&(exports.sprintf=sprintf,exports.vsprintf=vsprintf),"undefined"!=typeof window&&(window.sprintf=sprintf,window.vsprintf=vsprintf,"function"==typeof define&&define.amd&&define(function(){return{sprintf:sprintf,vsprintf:vsprintf}}))}()},{}],99:[function(require,module,exports){(function(global){"use strict";var bits=require("bit-twiddle"),dup=require("dup");global.__TYPEDARRAY_POOL||(global.__TYPEDARRAY_POOL={UINT8:dup([32,0]),UINT16:dup([32,0]),UINT32:dup([32,0]),INT8:dup([32,0]),INT16:dup([32,0]),INT32:dup([32,0]),FLOAT:dup([32,0]),DOUBLE:dup([32,0]),DATA:dup([32,0])});var POOL=global.__TYPEDARRAY_POOL,UINT8=POOL.UINT8,UINT16=POOL.UINT16,UINT32=POOL.UINT32,INT8=POOL.INT8,INT16=POOL.INT16,INT32=POOL.INT32,FLOAT=POOL.FLOAT,DOUBLE=POOL.DOUBLE,DATA=POOL.DATA;exports.free=function(array){if(array instanceof ArrayBuffer){var n=0|array.byteLength,log_n=bits.log2(n);DATA[log_n].push(array)}else{var n=0|array.length,log_n=bits.log2(n);array instanceof Uint8Array?UINT8[log_n].push(array):array instanceof Uint16Array?UINT16[log_n].push(array):array instanceof Uint32Array?UINT32[log_n].push(array):array instanceof Int8Array?INT8[log_n].push(array):array instanceof Int16Array?INT16[log_n].push(array):array instanceof Int32Array?INT32[log_n].push(array):array instanceof Float32Array?FLOAT[log_n].push(array):array instanceof Float64Array&&DOUBLE[log_n].push(array)}},exports.freeUint8=function(array){UINT8[bits.log2(array.length)].push(array)},exports.freeUint16=function(array){UINT16[bits.log2(array.length)].push(array)},exports.freeUint32=function(array){UINT32[bits.log2(array.length)].push(array)},exports.freeInt8=function(array){INT8[bits.log2(array.length)].push(array)},exports.freeInt16=function(array){INT16[bits.log2(array.length)].push(array)},exports.freeInt32=function(array){INT32[bits.log2(array.length)].push(array)},exports.freeFloat32=exports.freeFloat=function(array){FLOAT[bits.log2(array.length)].push(array)},exports.freeFloat64=exports.freeDouble=function(array){DOUBLE[bits.log2(array.length)].push(array)},exports.freeArrayBuffer=function(array){DATA[bits.log2(array.length)].push(array)},exports.malloc=function(n,dtype){n=bits.nextPow2(n);var log_n=bits.log2(n);if(void 0===dtype){var d=DATA[log_n];if(d.length>0){var r=d[d.length-1];return d.pop(),r}return new ArrayBuffer(n)}switch(dtype){case"uint8":var u8=UINT8[log_n];return u8.length>0?u8.pop():new Uint8Array(n);case"uint16":var u16=UINT16[log_n];return u16.length>0?u16.pop():new Uint16Array(n);case"uint32":var u32=UINT32[log_n];return u32.length>0?u32.pop():new Uint32Array(n);case"int8":var i8=INT8[log_n];return i8.length>0?i8.pop():new Int8Array(n);case"int16":var i16=INT16[log_n];return i16.length>0?i16.pop():new Int16Array(n);case"int32":var i32=INT32[log_n];return i32.length>0?i32.pop():new Int32Array(n);case"float":case"float32":var f=FLOAT[log_n];return f.length>0?f.pop():new Float32Array(n);case"double":case"float64":var dd=DOUBLE[log_n];return dd.length>0?dd.pop():new Float64Array(n);default:return null}return null},exports.mallocUint8=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=UINT8[log_n];return cache.length>0?cache.pop():new Uint8Array(n)},exports.mallocUint16=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=UINT16[log_n];return cache.length>0?cache.pop():new Uint16Array(n)},exports.mallocUint32=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=UINT32[log_n];return cache.length>0?cache.pop():new Uint32Array(n)},exports.mallocInt8=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=INT8[log_n];return cache.length>0?cache.pop():new Int8Array(n)},exports.mallocInt16=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=INT16[log_n];return cache.length>0?cache.pop():new Int16Array(n)},exports.mallocInt32=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=INT32[log_n];return cache.length>0?cache.pop():new Int32Array(n)},exports.mallocFloat32=exports.mallocFloat=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=FLOAT[log_n];return cache.length>0?cache.pop():new Float32Array(n)},exports.mallocFloat64=exports.mallocDouble=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=DOUBLE[log_n];return cache.length>0?cache.pop():new Float64Array(n)},exports.mallocArrayBuffer=function(n){n=bits.nextPow2(n);var log_n=bits.log2(n),cache=DATA[log_n];return cache.length>0?cache.pop():new ArrayBuffer(n)},exports.clearCache=function(){for(var i=0;i<32;++i)UINT8[i].length=0,UINT16[i].length=0,UINT32[i].length=0,INT8[i].length=0,INT16[i].length=0,INT32[i].length=0,FLOAT[i].length=0,DOUBLE[i].length=0,DATA[i].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bit-twiddle":8,dup:16}],100:[function(require,module,exports){function unindex(positions,cells,out){positions.positions&&positions.cells&&(out=cells,cells=positions.cells,positions=positions.positions),out=out||new Float32Array(9*cells.length);for(var i=0,n=0,l=cells.length;i=0?values[index]:opt_default)}function has___(key){var hiddenRecord=getHiddenRecord(key);return hiddenRecord?id in hiddenRecord:keys.indexOf(key)>=0}function set___(key,value){var index,hiddenRecord=getHiddenRecord(key);return hiddenRecord?hiddenRecord[id]=value:(index=keys.indexOf(key),index>=0?values[index]=value:(index=keys.length,values[index]=value,keys[index]=key)),this}function delete___(key){var index,lastIndex,hiddenRecord=getHiddenRecord(key);return hiddenRecord?id in hiddenRecord&&delete hiddenRecord[id]:!((index=keys.indexOf(key))<0)&&(lastIndex=keys.length-1,keys[index]=void 0,values[index]=values[lastIndex],keys[index]=keys[lastIndex],keys.length=lastIndex,values.length=lastIndex,!0)}this instanceof OurWeakMap||calledAsFunctionWarning();var keys=[],values=[],id=nextId++;return Object.create(OurWeakMap.prototype,{get___:{value:constFunc(get___)},has___:{value:constFunc(has___)},set___:{value:constFunc(set___)},delete___:{value:constFunc(delete___)}})};OurWeakMap.prototype=Object.create(Object.prototype,{get:{value:function(key,opt_default){return this.get___(key,opt_default)},writable:!0,configurable:!0},has:{value:function(key){return this.has___(key)},writable:!0,configurable:!0},set:{value:function(key,value){return this.set___(key,value)},writable:!0,configurable:!0},delete:{value:function(key){return this.delete___(key)},writable:!0,configurable:!0}}),"function"==typeof HostWeakMap?function(){function DoubleWeakMap(){function dget(key,opt_default){return omap?hmap.has(key)?hmap.get(key):omap.get___(key,opt_default):hmap.get(key,opt_default)}function dhas(key){return hmap.has(key)||!!omap&&omap.has___(key)}function ddelete(key){var result=!!hmap.delete(key);return omap?omap.delete___(key)||result:result}this instanceof OurWeakMap||calledAsFunctionWarning();var dset,hmap=new HostWeakMap,omap=void 0,enableSwitching=!1;return dset=doubleWeakMapCheckSilentFailure?function(key,value){return hmap.set(key,value),hmap.has(key)||(omap||(omap=new OurWeakMap),omap.set(key,value)),this}:function(key,value){if(enableSwitching)try{hmap.set(key,value)}catch(e){omap||(omap=new OurWeakMap),omap.set___(key,value)}else hmap.set(key,value);return this},Object.create(OurWeakMap.prototype,{get___:{value:constFunc(dget)},has___:{value:constFunc(dhas)},set___:{value:constFunc(dset)},delete___:{value:constFunc(ddelete)},permitHostObjects___:{value:constFunc(function(token){if(token!==weakMapPermitHostObjects)throw new Error("bogus call to permitHostObjects___");enableSwitching=!0})}})}doubleWeakMapCheckSilentFailure&&"undefined"!=typeof Proxy&&(Proxy=void 0),DoubleWeakMap.prototype=OurWeakMap.prototype,module.exports=DoubleWeakMap,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),module.exports=OurWeakMap)}}()},{}],103:[function(require,module,exports){function createStore(){var key={};return function(obj){if(("object"!=typeof obj||null===obj)&&"function"!=typeof obj)throw new Error("Weakmap-shim: Key must be object");var store=obj.valueOf(key);return store&&store.identity===key?store:hiddenStore(obj,key)}}var hiddenStore=require("./hidden-store.js");module.exports=createStore},{"./hidden-store.js":104}],104:[function(require,module,exports){function hiddenStore(obj,key){var store={identity:key},valueOf=obj.valueOf;return Object.defineProperty(obj,"valueOf",{value:function(value){return value!==key?valueOf.apply(this,arguments):store},writable:!0}),store}module.exports=hiddenStore},{}],105:[function(require,module,exports){function weakMap(){var privates=createStore();return{get:function(key,fallback){var store=privates(key);return store.hasOwnProperty("value")?store.value:fallback},set:function(key,value){return privates(key).value=value,this},has:function(key){return"value"in privates(key)},delete:function(key){return delete privates(key).value}}}var createStore=require("./create-store.js");module.exports=weakMap},{"./create-store.js":103}],106:[function(require,module,exports){"use strict";function baseName(ext_name){for(var i=0;i0)throw new Error("Invalid string. Length must be a multiple of 4");var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0,arr=new Arr(3*b64.length/4-placeHolders),l=placeHolders>0?b64.length-4:b64.length;var L=0;for(i=0,j=0;i>16),push((65280&tmp)>>8),push(255&tmp);return 2===placeHolders?(tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4,push(255&tmp)):1===placeHolders&&(tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2,push(tmp>>8&255),push(255&tmp)),arr}function uint8ToBase64(uint8){function encode(num){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(num)}var i,temp,length,extraBytes=uint8.length%3,output="";for(i=0,length=uint8.length-extraBytes;i>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(63&num)}(temp);switch(extraBytes){case 1:temp=uint8[uint8.length-1],output+=encode(temp>>2),output+=encode(temp<<4&63),output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1],output+=encode(temp>>10),output+=encode(temp>>4&63),output+=encode(temp<<2&63),output+="="}return output}var Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,PLUS="+".charCodeAt(0),SLASH="/".charCodeAt(0),NUMBER="0".charCodeAt(0),LOWER="a".charCodeAt(0),UPPER="A".charCodeAt(0),PLUS_URL_SAFE="-".charCodeAt(0),SLASH_URL_SAFE="_".charCodeAt(0);exports.toByteArray=b64ToByteArray,exports.fromByteArray=uint8ToBase64}(void 0===exports?this.base64js={}:exports)},{}],108:[function(require,module,exports){(function(global){"use strict";function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Buffer(arg){return this instanceof Buffer?(Buffer.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof arg?fromNumber(this,arg):"string"==typeof arg?fromString(this,arg,arguments.length>1?arguments[1]:"utf8"):fromObject(this,arg)):arguments.length>1?new Buffer(arg,arguments[1]):new Buffer(arg)}function fromNumber(that,length){if(that=allocate(that,length<0?0:0|checked(length)),!Buffer.TYPED_ARRAY_SUPPORT)for(var i=0;i>>1&&(that.parent=rootParent),that}function checked(length){if(length>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function SlowBuffer(subject,encoding){if(!(this instanceof SlowBuffer))return new SlowBuffer(subject,encoding);var buf=new Buffer(subject,encoding);return delete buf.parent,buf}function byteLength(string,encoding){"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"binary":case"raw":case"raws":return len;case"utf8":case"utf-8":return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function slowToString(encoding,start,end){var loweredCase=!1;if(start|=0,end=void 0===end||end===1/0?this.length:0|end,encoding||(encoding="utf8"),start<0&&(start=0),end>this.length&&(end=this.length),end<=start)return"";for(;;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"binary":return binarySlice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;length?(length=Number(length))>remaining&&(length=remaining):length=remaining;var strLen=string.length;if(strLen%2!=0)throw new Error("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:secondByte=buf[i+1],128==(192&secondByte)&&(tempCodePoint=(31&firstByte)<<6|63&secondByte)>127&&(codePoint=tempCodePoint);break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128==(192&secondByte)&&128==(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte)>2047&&(tempCodePoint<55296||tempCodePoint>57343)&&(codePoint=tempCodePoint);break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128==(192&secondByte)&&128==(192&thirdByte)&&128==(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte)>65535&&tempCodePoint<1114112&&(codePoint=tempCodePoint)}}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return decodeCodePointsArray(res)}function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);for(var res="",i=0;ilen)&&(end=len);for(var out="",i=start;ilength)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError("buffer must be a Buffer instance");if(value>max||valuebuf.length)throw new RangeError("index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){value<0&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);i>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){value<0&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);i>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(value>max||valuebuf.length)throw new RangeError("index out of range");if(offset<0)throw new RangeError("index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}function base64clean(str){if(str=stringtrim(str).replace(INVALID_BASE64_RE,""),str.length<2)return"";for(;str.length%4!=0;)str+="=";return str}function stringtrim(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}function toHex(n){return n<16?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(string,units){units=units||1/0;for(var codePoint,length=string.length,leadSurrogate=null,bytes=[],i=0;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=65536+(leadSurrogate-55296<<10|codePoint-56320)}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function asciiToBytes(str){for(var byteArray=[],i=0;i>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length);i++)dst[i+offset]=src[i];return i}var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.poolSize=8192;var rootParent={};Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:function(){function Bar(){}try{var arr=new Uint8Array(1);return arr.foo=function(){return 42},arr.constructor=Bar,42===arr.foo()&&arr.constructor===Bar&&"function"==typeof arr.subarray&&0===arr.subarray(1,1).byteLength}catch(e){return!1}}(),Buffer.TYPED_ARRAY_SUPPORT?(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array):(Buffer.prototype.length=void 0,Buffer.prototype.parent=void 0),Buffer.isBuffer=function(b){return!(null==b||!b._isBuffer)},Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i