-
Notifications
You must be signed in to change notification settings - Fork 26
/
ambisonics.min.js
9 lines (9 loc) · 261 KB
/
ambisonics.min.js
1
2
3
4
5
6
7
8
9
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.ambisonics=e()}}(function(){var define,module,exports;return function(){function e(t,r,n){function i(o,s){if(!r[o]){if(!t[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[o]={exports:{}};t[o][0].call(f.exports,function(e){return i(t[o][1][e]||e)},f,f.exports,e,t,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}return e}()({1:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=function(){function e(t,r){(0,a.default)(this,e),this.initialized=!1,this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.decFilters=new Array(this.nCh),this.decFilterNodes=new Array(this.nCh),this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(2),this.out.channelCountMode="explicit",this.out.channelCount=1,this.gainMid=this.ctx.createGain(),this.gainSide=this.ctx.createGain(),this.invertSide=this.ctx.createGain(),this.gainMid.gain.value=1,this.gainSide.gain.value=1,this.invertSide.gain.value=-1;for(var n=0;n<this.nCh;n++)this.decFilterNodes[n]=this.ctx.createConvolver(),this.decFilterNodes[n].normalize=!1;this.resetFilters();for(var n=0;n<this.nCh;n++){this.in.connect(this.decFilterNodes[n],n,0);var i=Math.floor(Math.sqrt(n));n-i*i-i>=0?this.decFilterNodes[n].connect(this.gainMid):this.decFilterNodes[n].connect(this.gainSide)}this.gainMid.connect(this.out,0,0),this.gainSide.connect(this.out,0,0),this.gainMid.connect(this.out,0,1),this.gainSide.connect(this.invertSide,0,0),this.invertSide.connect(this.out,0,1),this.initialized=!0}return(0,s.default)(e,[{key:"updateFilters",value:function(e){for(var t=0;t<this.nCh;t++)this.decFilters[t]=this.ctx.createBuffer(1,e.length,e.sampleRate),this.decFilters[t].getChannelData(0).set(e.getChannelData(t)),this.decFilterNodes[t].buffer=this.decFilters[t]}},{key:"resetFilters",value:function(){var e=new Array(this.nCh);e.fill(0),e[0]=.5,e[1]=.5/Math.sqrt(3);for(var t=0;t<this.nCh;t++){this.decFilters[t]=this.ctx.createBuffer(1,64,this.ctx.sampleRate);for(var r=0;r<64;r++)this.decFilters[t].getChannelData(0)[r]=0;this.decFilters[t].getChannelData(0)[0]=e[t],this.decFilterNodes[t].buffer=this.decFilters[t]}}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],2:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=function(){function e(t,r){(0,a.default)(this,e),this.initialized=!1,this.ctx=t,this.order=r,this.nCh=2*r+1,this.decFilters=new Array(this.nCh),this.decFilterNodes=new Array(this.nCh),this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(2),this.out.channelCountMode="explicit",this.out.channelCount=1,this.gainMid=this.ctx.createGain(),this.gainSide=this.ctx.createGain(),this.invertSide=this.ctx.createGain(),this.gainMid.gain.value=1,this.gainSide.gain.value=1,this.invertSide.gain.value=-1;for(var n=0;n<this.nCh;n++)this.decFilterNodes[n]=this.ctx.createConvolver(),this.decFilterNodes[n].normalize=!1;this.resetFilters();for(var n=0;n<this.nCh;n++)this.in.connect(this.decFilterNodes[n],n,0),n%2==0?this.decFilterNodes[n].connect(this.gainMid):this.decFilterNodes[n].connect(this.gainSide);this.gainMid.connect(this.out,0,0),this.gainSide.connect(this.out,0,0),this.gainMid.connect(this.out,0,1),this.gainSide.connect(this.invertSide,0,0),this.invertSide.connect(this.out,0,1),this.initialized=!0}return(0,s.default)(e,[{key:"updateFilters",value:function(e){for(var t=0;t<this.nCh;t++)this.decFilters[t]=this.ctx.createBuffer(1,e.length,e.sampleRate),this.decFilters[t].getChannelData(0).set(e.getChannelData(t)),this.decFilterNodes[t].buffer=this.decFilters[t]}},{key:"resetFilters",value:function(){var e=new Array(this.nCh);e.fill(0),e[0]=.5,e[1]=.5/Math.sqrt(3);for(var t=0;t<this.nCh;t++){this.decFilters[t]=this.ctx.createBuffer(1,64,this.ctx.sampleRate);for(var r=0;r<64;r++)this.decFilters[t].getChannelData(0)[r]=0;this.decFilters[t].getChannelData(0)[0]=e[t],this.decFilterNodes[t].buffer=this.decFilters[t]}}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],3:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fuma2acn=r.n3d2sn3d=r.sn3d2n3d=r.acn2wxyz=r.wxyz2acn=void 0;var n=e("babel-runtime/helpers/classCallCheck"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);r.wxyz2acn=function e(t){(0,i.default)(this,e),this.ctx=t,this.in=this.ctx.createChannelSplitter(4),this.out=this.ctx.createChannelMerger(4),this.gains=new Array(4);for(var r=0;r<4;r++)this.gains[r]=this.ctx.createGain(),this.gains[r].gain.value=0==r?Math.SQRT2:Math.sqrt(3),this.gains[r].connect(this.out,0,r);this.in.connect(this.gains[0],0,0),this.in.connect(this.gains[3],1,0),this.in.connect(this.gains[1],2,0),this.in.connect(this.gains[2],3,0)},r.acn2wxyz=function e(t){(0,i.default)(this,e),this.ctx=t,this.in=this.ctx.createChannelSplitter(4),this.out=this.ctx.createChannelMerger(4),this.gains=new Array(4);for(var r=0;r<4;r++)this.gains[r]=this.ctx.createGain(),this.gains[r].gain.value=0==r?Math.SQRT1_2:1/Math.sqrt(3),this.gains[r].connect(this.out,0,r);this.in.connect(this.gains[0],0,0),this.in.connect(this.gains[2],1,0),this.in.connect(this.gains[3],2,0),this.in.connect(this.gains[1],3,0)},r.sn3d2n3d=function e(t,r){(0,i.default)(this,e),this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(this.nCh),this.gains=new Array(this.nCh);for(var n=0;n<this.nCh;n++){var a=Math.floor(Math.sqrt(n));this.gains[n]=this.ctx.createGain(),this.gains[n].gain.value=Math.sqrt(2*a+1),this.in.connect(this.gains[n],n,0),this.gains[n].connect(this.out,0,n)}},r.n3d2sn3d=function e(t,r){(0,i.default)(this,e),this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(this.nCh),this.gains=new Array(this.nCh);for(var n=0;n<this.nCh;n++){var a=Math.floor(Math.sqrt(n));this.gains[n]=this.ctx.createGain(),this.gains[n].gain.value=1/Math.sqrt(2*a+1),this.in.connect(this.gains[n],n,0),this.gains[n].connect(this.out,0,n)}},r.fuma2acn=function e(t,r){(0,i.default)(this,e),r>3&&(console.log("FuMa specifiction is supported up to 3rd order"),r=3);var n=[Math.sqrt(2),Math.sqrt(3),Math.sqrt(3),Math.sqrt(3),Math.sqrt(15)/2,Math.sqrt(15)/2,Math.sqrt(5),Math.sqrt(15)/2,Math.sqrt(15)/2,Math.sqrt(35/8),Math.sqrt(35)/3,Math.sqrt(224/45),Math.sqrt(7),Math.sqrt(224/45),Math.sqrt(35)/3,Math.sqrt(35/8)];if(this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(this.nCh),this.gains=[],this.remapArray=[],this.remapArray.push(0,2,3,1),r>1)for(var a,o=0,s=0;s<this.nCh;s++)if(a=[],s>=(o+1)*(o+1)){o+=1;for(var u=(o+1)*(o+1);u<(o+2)*(o+2);u++)(u+o%2)%2==0?a.push(u):a.unshift(u);this.remapArray=this.remapArray.concat(a)}for(var s=0;s<this.nCh;s++)this.gains[s]=this.ctx.createGain(),this.gains[s].gain.value=n[s],this.in.connect(this.gains[s],this.remapArray[s],0),this.gains[s].connect(this.out,0,s)}},{"babel-runtime/helpers/classCallCheck":28}],4:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=function(){function e(t,r){(0,a.default)(this,e),this.initialized=!1,this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.encFilters=new Array(this.nCh),this.encFilterNodes=new Array(this.nCh),this.in=this.ctx.createGain(),this.in.channelCountMode="explicit",this.in.channelCount=1,this.out=this.ctx.createChannelMerger(this.nCh);for(var n=0;n<this.nCh;n++)this.encFilterNodes[n]=this.ctx.createConvolver(),this.encFilterNodes[n].normalize=!1;for(var n=0;n<this.nCh;n++)this.in.connect(this.encFilterNodes[n]),this.encFilterNodes[n].connect(this.out,0,n);this.initialized=!0}return(0,s.default)(e,[{key:"updateFilters",value:function(e){for(var t=0;t<this.nCh;t++)this.encFilters[t]=this.ctx.createBuffer(1,e.length,e.sampleRate),this.encFilters[t].getChannelData(0).set(e.getChannelData(t)),this.encFilterNodes[t].buffer=this.encFilters[t]}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],5:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=e("./utils.js"),c=function(){function e(t,r){(0,a.default)(this,e),this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.nSpk=0,this._decodingMatrix=[],this._spkSphPosArray=[],this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(1),this._spkSphPosArray=this._getDefaultSpkConfig(this.order),this._updateDecodeMtx(this._spkSphPosArray)}return(0,s.default)(e,[{key:"_updateDecodeMtx",value:function(e){this.nSpk=e.length,this.out=this.ctx.createChannelMerger(this.nSpk),this._decodingMatrix=u.getAmbisonicDecMtx(e,this.order),this.mtxGain=new Array(this.nCh);for(var t=0;t<this.nCh;t++){this.mtxGain[t]=new Array(this.nSpk);for(var r=0;r<this.nSpk;r++){var n=this.ctx.createGain();n.gain.value=this._decodingMatrix[r][t],this.in.connect(n,t,0),n.connect(this.out,0,r),this.mtxGain[t][r]=n}}}},{key:"_getDefaultSpkConfig",value:function(e){var t=[];switch(e){case 1:t=[[0,0,1],[90,0,1],[180,0,1],[270,0,1],[0,90,1],[0,-90,1]];break;case 2:t=[[180,-31.7161,.5878],[180,31.7161,.5878],[-121.7161,0,.5878],[121.7161,0,.5878],[-90,-58.2839,.5878],[-90,58.2839,.5878],[90,-58.2839,.5878],[90,58.2839,.5878],[-58.2839,0,.5878],[58.2839,0,.5878],[0,-31.7161,.5878],[0,31.7161,.5878]];break;case 3:t=[[-159.0931,0,.5352],[159.0931,0,.5352],[-135,-35.2644,.5352],[-135,35.2644,.5352],[135,-35.2644,.5352],[135,35.2644,.5352],[180,-69.0931,.5352],[180,69.0931,.5352],[-90,-20.9069,.5352],[-90,20.9069,.5352],[90,-20.9069,.5352],[90,20.9069,.5352],[0,-69.0931,.5352],[0,69.0931,.5352],[-45,-35.2644,.5352],[-45,35.2644,.5352],[45,-35.2644,.5352],[45,35.2644,.5352],[-20.9069,0,.5352],[20.9069,0,.5352]];break;default:console.error("unsupported default order:",e)}return t}},{key:"speakerPos",set:function(e){void 0===e&&(e=this._getDefaultSpkConfig(this.order)),this._spkSphPosArray=e,this.out.disconnect(),this._updateDecodeMtx(e)},get:function(){return this._spkSphPosArray}}]),e}();r.default=c},{"./utils.js":25,"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],6:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o);e("get-float-time-domain-data");var u=function(){function e(t){(0,a.default)(this,e),this.ctx=t,this.fftSize=2048,this.in=this.ctx.createChannelSplitter(4),this.out=this.ctx.createChannelMerger(4),this.gains=new Array(3);for(var r=0;r<3;r++)this.gains[r]=this.ctx.createGain(),this.gains[r].gain.value=1/Math.sqrt(3);for(this.analysers=new Array(4),this.analBuffers=new Array(4),r=0;r<4;r++)this.analysers[r]=this.ctx.createAnalyser(),this.analysers[r].fftSize=this.fftSize,this.analysers[r].smoothingTimeConstant=0,this.analBuffers[r]=new Float32Array(this.fftSize);for(this.in.connect(this.out,0,0),this.in.connect(this.analysers[0],0,0),this.in.connect(this.gains[1],1,0),this.in.connect(this.gains[2],2,0),this.in.connect(this.gains[0],3,0),r=0;r<3;r++)this.gains[r].connect(this.analysers[r+1],0,0),this.gains[r].connect(this.out,0,r+1)}return(0,s.default)(e,[{key:"updateBuffers",value:function(){for(var e=0;e<4;e++)this.analysers[e].getFloatTimeDomainData(this.analBuffers[e])}},{key:"computeIntensity",value:function(){for(var e,t,r,n,i,a,o=0,s=0,u=0,c=0,f=0,h=0,l=0,d=0;d<this.fftSize;d++)o+=this.analBuffers[0][d]*this.analBuffers[1][d],s+=this.analBuffers[0][d]*this.analBuffers[2][d],u+=this.analBuffers[0][d]*this.analBuffers[3][d],c+=this.analBuffers[0][d]*this.analBuffers[0][d],f+=this.analBuffers[1][d]*this.analBuffers[1][d],h+=this.analBuffers[2][d]*this.analBuffers[2][d],l+=this.analBuffers[3][d]*this.analBuffers[3][d];return e=[o,s,u],t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=(c+f+h+l)/2,n=1-t/(r+1e-7),i=180*Math.atan2(s,o)/Math.PI,a=180*Math.atan2(e[2],Math.sqrt(e[0]*e[0]+e[1]*e[1]))/Math.PI,[i,a,n,r]}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29,"get-float-time-domain-data":60}],7:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o);e("get-float-time-domain-data");var u=function(){function e(t){(0,a.default)(this,e),this.ctx=t,this.fftSize=2048,this.in=this.ctx.createChannelSplitter(3),this.out=this.ctx.createChannelMerger(3),this.gains=new Array(2);for(var r=0;r<2;r++)this.gains[r]=this.ctx.createGain(),this.gains[r].gain.value=1/Math.sqrt(3);for(this.analysers=new Array(3),this.analBuffers=new Array(3),r=0;r<3;r++)this.analysers[r]=this.ctx.createAnalyser(),this.analysers[r].fftSize=this.fftSize,this.analysers[r].smoothingTimeConstant=0,this.analBuffers[r]=new Float32Array(this.fftSize);for(this.in.connect(this.out,0,0),this.in.connect(this.analysers[0],0,0),this.in.connect(this.gains[1],1,0),this.in.connect(this.gains[0],2,0),r=0;r<2;r++)this.gains[r].connect(this.analysers[r+1],0,0),this.gains[r].connect(this.out,0,r+1)}return(0,s.default)(e,[{key:"updateBuffers",value:function(){for(var e=0;e<3;e++)this.analysers[e].getFloatTimeDomainData(this.analBuffers[e])}},{key:"computeIntensity",value:function(){for(var e,t,r,n,i,a,o=0,s=0,u=0,c=0,f=0,h=0;h<this.fftSize;h++)o+=this.analBuffers[0][h]*this.analBuffers[1][h],s+=this.analBuffers[0][h]*this.analBuffers[2][h],u+=this.analBuffers[0][h]*this.analBuffers[0][h],c+=this.analBuffers[1][h]*this.analBuffers[1][h],f+=this.analBuffers[2][h]*this.analBuffers[2][h];return e=[o,s],t=Math.sqrt(e[0]*e[0]+e[1]*e[1]),r=(u+c+f)/2,n=1-t/(r+1e-7),i=180*-Math.atan2(s,o)/Math.PI,a=0,[i,a,n,r]}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29,"get-float-time-domain-data":60}],8:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=e("spherical-harmonic-transform"),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(u),f=function(){function e(t,r){(0,a.default)(this,e),this.initialized=!1,this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.azim=0,this.elev=0,this.gains=new Array(this.nCh),this.gainNodes=new Array(this.nCh),this.in=this.ctx.createGain(),this.in.channelCountMode="explicit",this.in.channelCount=1,this.out=this.ctx.createChannelMerger(this.nCh);for(var n=0;n<this.nCh;n++)this.gainNodes[n]=this.ctx.createGain(),this.gainNodes[n].channelCountMode="explicit",this.gainNodes[n].channelCount=1;this.updateGains();for(var n=0;n<this.nCh;n++)this.in.connect(this.gainNodes[n]),this.gainNodes[n].connect(this.out,0,n);this.initialized=!0}return(0,s.default)(e,[{key:"updateGains",value:function(){for(var e=this.order,t=c.computeRealSH(e,[[this.azim*Math.PI/180,this.elev*Math.PI/180]]),r=0;r<this.nCh;r++)this.gains[r]=t[r][0],this.gainNodes[r].gain.value=this.gains[r]}}]),e}();r.default=f},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29,"spherical-harmonic-transform":83}],9:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=e("./utils.js"),c=function(){function e(t,r){(0,a.default)(this,e),this.initialized=!1,this.ctx=t,this.order=r,this.nCh=2*r+1,this.azim=0,this.elev=0,this.gains=new Array(this.nCh),this.gainNodes=new Array(this.nCh),this.in=this.ctx.createGain(),this.in.channelCountMode="explicit",this.in.channelCount=1,this.out=this.ctx.createChannelMerger(this.nCh);for(var n=0;n<this.nCh;n++)this.gainNodes[n]=this.ctx.createGain(),this.gainNodes[n].channelCountMode="explicit",this.gainNodes[n].channelCount=1;this.updateGains();for(var n=0;n<this.nCh;n++)this.in.connect(this.gainNodes[n]),this.gainNodes[n].connect(this.out,0,n);this.initialized=!0}return(0,s.default)(e,[{key:"updateGains",value:function(){for(var e=this.order,t=u.getCircHarmonics(e,[this.azim]),r=0;r<this.nCh;r++)this.gainNodes[r].gain.value=t[r][0]}}]),e}();r.default=c},{"./utils.js":25,"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],10:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=function(){function e(t,r,n){(0,a.default)(this,e),this.ctx=t,this.orderIn=r,this.orderOut=n<r?n:r,this.nChIn=(this.orderIn+1)*(this.orderIn+1),this.nChOut=(this.orderOut+1)*(this.orderOut+1),this.in=this.ctx.createChannelSplitter(this.nChIn),this.out=this.ctx.createChannelMerger(this.nChOut);for(var i=0;i<this.nChOut;i++)this.in.connect(this.out,i,i)}return(0,s.default)(e,[{key:"updateOrder",value:function(e){if(e<=this.orderIn){this.orderOut=e,this.nChOut=(this.orderOut+1)*(this.orderOut+1),this.out.disconnect(),this.out=this.ctx.createChannelMerger(this.nChOut);for(var t=0;t<this.nChOut;t++)this.in.connect(this.out,t,t)}}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],11:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=function(){function e(t,r,n){(0,a.default)(this,e),this.ctx=t,this.orderIn=r,this.orderOut=n<r?n:r,this.nChIn=2*this.orderIn+1,this.nChOut=2*this.orderOut+1,this.in=this.ctx.createChannelSplitter(this.nChIn),this.out=this.ctx.createChannelMerger(this.nChOut);for(var i=0;i<this.nChOut;i++)this.in.connect(this.out,i,i)}return(0,s.default)(e,[{key:"updateOrder",value:function(e){if(e<=this.orderIn){this.orderOut=e,this.nChOut=2*this.orderOut+1,this.out.disconnect(),this.out=this.ctx.createChannelMerger(this.nChOut);for(var t=0;t<this.nChOut;t++)this.in.connect(this.out,t,t)}}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],12:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=e("spherical-harmonic-transform"),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(u),f=function(){function e(t,r){(0,a.default)(this,e),this.ctx=t,this.order=r,this.nCh=(this.order+1)*(this.order+1),this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(this.nCh),this.gains=new Array(this.nCh),this.orderGains=new Array(this.order+1),this.orderGains.fill(1);for(var n=0;n<this.nCh;n++)this.gains[n]=this.ctx.createGain(),this.in.connect(this.gains[n],n,0),this.gains[n].connect(this.out,0,n)}return(0,s.default)(e,[{key:"updateOrderGains",value:function(){for(var e,t=0;t<this.nCh;t++)e=Math.floor(Math.sqrt(t)),this.gains[t].gain.value=this.orderGains[e]}},{key:"computeMaxRECoeffs",value:function(){var e=this.order;this.orderGains[0]=1;for(var t=0,r=0,n=0,i=1;i<=e;i++)n=c.recurseLegendrePoly(i,[Math.cos(2.406809/(e+1.51))],t,r),this.orderGains[i]=n[0][0],r=t,t=n}}]),e}();r.default=f},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29,"spherical-harmonic-transform":83}],13:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var a=e("babel-runtime/helpers/classCallCheck"),o=i(a),s=e("babel-runtime/helpers/createClass"),u=i(s);e("get-float-time-domain-data");var c=e("numeric"),f=n(c),h=e("spherical-harmonic-transform"),l=n(h),d=e("./utils.js"),m=function(){function e(t,r,n){(0,o.default)(this,e),this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.fftSize=2048,this.analysers=new Array(this.nCh),this.analBuffers=new Array(this.nCh),this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(this.nCh);for(var i=0;i<this.nCh;i++)this.analysers[i]=this.ctx.createAnalyser(),this.analysers[i].fftSize=this.fftSize,this.analysers[i].smoothingTimeConstant=0,this.analBuffers[i]=new Float32Array(this.fftSize);for(var a=0;a<this.nCh;a++)this.in.connect(this.out,a,a),this.in.connect(this.analysers[a],a,0);var s=d.getTdesign(4*r);this.td_dirs_rad=d.deg2rad(s),this.SHmtx=l.computeRealSH(this.order,this.td_dirs_rad),this.mode=n}return(0,u.default)(e,[{key:"updateBuffers",value:function(){for(var e=0;e<this.nCh;e++)this.analysers[e].getFloatTimeDomainData(this.analBuffers[e])}},{key:"computePowermap",value:function(){for(var e=this.td_dirs_rad.length,t=f.dot(f.transpose(this.SHmtx),this.analBuffers),r=new Array(e),n=0;n<e;n++){for(var i=0;i<this.fftSize;i++){var a=0;a+=t[n][i]*t[n][i]}var a=a/this.fftSize;r[n]=[this.td_dirs_rad[n][0],this.td_dirs_rad[n][1],a]}if(0==this.mode)return r;if(1==this.mode){return l.forwardSHT(2*this.order,r)}}}]),e}();r.default=m},{"./utils.js":25,"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29,"get-float-time-domain-data":60,numeric:65,"spherical-harmonic-transform":83}],14:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o);e("get-float-time-domain-data");var u=function(){function e(t,r){(0,a.default)(this,e),this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.fftSize=2048,this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(this.nCh),this.analysers=new Array(this.nCh),this.analBuffers=new Array(this.nCh);for(var n=0;n<this.nCh;n++)this.analysers[n]=this.ctx.createAnalyser(),this.analysers[n].fftSize=this.fftSize,this.analysers[n].smoothingTimeConstant=0,this.analBuffers[n]=new Float32Array(this.fftSize),this.in.connect(this.analysers[n],n,0),this.analysers[n].connect(this.out,0,n)}return(0,s.default)(e,[{key:"updateBuffers",value:function(){for(var e=0;e<this.nCh;e++)this.analysers[e].getFloatTimeDomainData(this.analBuffers[e])}},{key:"computeRMS",value:function(){var e=new Array(this.nCh);e.fill(0);for(var t=0;t<this.nCh;t++){for(var r=0;r<this.fftSize;r++)e[t]=e[t]+this.analBuffers[t][r]*this.analBuffers[t][r];e[t]=Math.sqrt(e[t]/this.fftSize)}return e}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29,"get-float-time-domain-data":60}],15:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=function(){function e(t,r){(0,a.default)(this,e),this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.mirrorPlane=0,this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(this.nCh),this.gains=new Array(this.nCh);for(var n=0;n<this.nCh;n++)this.gains[n]=this.ctx.createGain(),this.gains[n].gain.value=1,this.in.connect(this.gains[n],n,0),this.gains[n].connect(this.out,0,n)}return(0,s.default)(e,[{key:"reset",value:function(){for(var e=0;e<this.nCh;e++)this.gains[e].gain.value=1}},{key:"mirror",value:function(e){switch(e){case 0:this.mirrorPlane=0,this.reset();break;case 1:this.reset(),this.mirrorPlane=1;for(var t,r=0;r<=this.order;r++)for(var n=-r;n<=r;n++)t=r*r+r+n,(n<0&&n%2==0||n>0&&n%2==1)&&(this.gains[t].gain.value=-1);break;case 2:this.reset(),this.mirrorPlane=2;for(var t,r=0;r<=this.order;r++)for(var n=-r;n<=r;n++)t=r*r+r+n,n<0&&(this.gains[t].gain.value=-1);break;case 3:this.reset(),this.mirrorPlane=3;for(var t,r=0;r<=this.order;r++)for(var n=-r;n<=r;n++)t=r*r+r+n,(n+r)%2==1&&(this.gains[t].gain.value=-1);break;default:console.log("The mirroring planes can be either 1 (yz), 2 (xz), 3 (xy), or 0 (no mirroring). Value set to 0."),this.mirrorPlane=0,this.reset()}}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],16:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=function(){function e(t,r){(0,a.default)(this,e),this.ctx=t,this.order=r,this.nCh=2*r+1,this.mirrorPlane=0,this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(this.nCh),this.gains=new Array(this.nCh);for(var n=0;n<this.nCh;n++)this.gains[n]=this.ctx.createGain(),this.gains[n].gain.value=1,this.in.connect(this.gains[n],n,0),this.gains[n].connect(this.out,0,n)}return(0,s.default)(e,[{key:"reset",value:function(){for(var e=0;e<this.nCh;e++)this.gains[e].gain.value=1}},{key:"mirror",value:function(e){switch(e){case 0:this.mirrorPlane=0,this.reset();break;case 1:this.reset(),this.mirrorPlane=1;for(var t=2;t<this.nCh;t++)this.gains[t].gain.value=-1,t%2!=0&&(t+=2);break;case 2:this.reset(),this.mirrorPlane=2;for(var t=0;t<this.nCh;t++)t%2!=0&&(this.gains[t].gain.value=-1);break;case 3:console.log("up-down mirroring in 2D mode not possible");break;default:console.log("The mirroring planes can be either 1 (yz), 2 (xz) or 0 (no mirroring). Value set to 0."),this.mirrorPlane=0,this.reset()}}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],17:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=e("spherical-harmonic-transform"),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(u),f=function(){function e(t,r){(0,a.default)(this,e),this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.yaw=0,this.pitch=0,this.roll=0,this.rotMtx=numeric.identity(this.nCh),this.rotMtxNodes=new Array(this.order),this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(this.nCh);for(var n=1;n<=this.order;n++){for(var i=new Array(2*n+1),o=0;o<2*n+1;o++){i[o]=new Array(2*n+1);for(var s=0;s<2*n+1;s++)i[o][s]=this.ctx.createGain(),i[o][s].gain.value=o==s?1:0}this.rotMtxNodes[n-1]=i}this.in.connect(this.out,0,0);var u=1;for(n=1;n<=this.order;n++){for(o=0;o<2*n+1;o++)for(s=0;s<2*n+1;s++)this.in.connect(this.rotMtxNodes[n-1][o][s],u+s,0),this.rotMtxNodes[n-1][o][s].connect(this.out,0,u+o);u=u+2*n+1}}return(0,s.default)(e,[{key:"updateRotMtx",value:function(){var e=this.yaw*Math.PI/180,t=this.pitch*Math.PI/180,r=this.roll*Math.PI/180;this.rotMtx=c.getSHrotMtx(c.yawPitchRoll2Rzyx(e,t,r),this.order);for(var n=1,i=1;i<this.order+1;i++){for(var a=0;a<2*i+1;a++)for(var o=0;o<2*i+1;o++)this.rotMtxNodes[i-1][a][o].gain.value=this.rotMtx[n+a][n+o];n=n+2*i+1}}}]),e}();r.default=f},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29,"spherical-harmonic-transform":83}],18:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=function(){function e(t,r){(0,a.default)(this,e),this.ctx=t,this.order=r,this.nCh=2*r+1,this.yaw=0,this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createChannelMerger(this.nCh),this.rotMtxNodes=new Array(2*this.order),this.in.connect(this.out,0,0);for(var n=0;n<2*this.order;n+=2){var i=new Array(2);i[0]=this.ctx.createGain(),i[1]=this.ctx.createGain();var o=new Array(2);o[0]=this.ctx.createGain(),o[1]=this.ctx.createGain(),this.rotMtxNodes[n]=i,this.rotMtxNodes[n+1]=o,this.in.connect(this.rotMtxNodes[n][0],n+1,0),this.rotMtxNodes[n][0].connect(this.out,0,n+1),this.in.connect(this.rotMtxNodes[n][1],n+2,0),this.rotMtxNodes[n][1].connect(this.out,0,n+1),this.in.connect(this.rotMtxNodes[n+1][0],n+1,0),this.rotMtxNodes[n+1][0].connect(this.out,0,n+2),this.in.connect(this.rotMtxNodes[n+1][1],n+2,0),this.rotMtxNodes[n+1][1].connect(this.out,0,n+2)}this.updateRotMtx()}return(0,s.default)(e,[{key:"updateRotMtx",value:function(){for(var e=this.yaw*Math.PI/180,t=1,r=0;r<2*this.order;r+=2)this.rotMtxNodes[r][0].gain.value=Math.cos(t*e),this.rotMtxNodes[r][1].gain.value=Math.sin(t*e),this.rotMtxNodes[r+1][0].gain.value=-Math.sin(t*e),this.rotMtxNodes[r+1][1].gain.value=Math.cos(t*e),t++}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],19:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=e("spherical-harmonic-transform"),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(u),f=function(){function e(t,r){(0,a.default)(this,e),this.initialized=!1,this.ctx=t,this.order=r,this.nCh=(r+1)*(r+1),this.azim=0,this.elev=0,this.vmicGains=new Array(this.nCh),this.vmicGainNodes=new Array(this.nCh),this.vmicCoeffs=new Array(this.order+1),this.vmicPattern="hypercardioid",this.in=this.ctx.createChannelSplitter(this.nCh),this.out=this.ctx.createGain();for(var n=0;n<this.nCh;n++)this.vmicGainNodes[n]=this.ctx.createGain();for(this.SHxyz=new Array(this.nCh),this.SHxyz.fill(0),this.updatePattern(),this.updateOrientation(),n=0;n<this.nCh;n++)this.in.connect(this.vmicGainNodes[n],n,0),this.vmicGainNodes[n].connect(this.out);this.initialized=!0}return(0,s.default)(e,[{key:"updatePattern",value:function(){function e(e){for(var t=new Array(e+1),r=(e+1)*(e+1),n=0;n<=e;n++)t[n]=1/r;return t}switch(this.vmicPattern){case"cardioid":this.vmicCoeffs=function(e){for(var t=new Array(e+1),r=0;r<=e;r++)t[r]=c.factorial(e)*c.factorial(e)/(c.factorial(e+r+1)*c.factorial(e-r));return t}(this.order);break;case"supercardioid":this.vmicCoeffs=function(e){switch(e){case 1:var t=[.366,.2113];break;case 2:var t=[.2362,.1562,.059];break;case 3:var t=[.1768,.1281,.0633,.0175];break
;case 4:var t=[.1414,.1087,.0623,.0247,.0054];break;default:return void console.error("Orders should be in the range of 1-4 at the moment.")}return t}(this.order);break;case"hypercardioid":this.vmicCoeffs=e(this.order);break;case"max_rE":this.vmicCoeffs=function(e){var t=new Array(e+1);t[0]=1;for(var r=0,n=0,i=0,a=1;a<e+1;a++)i=c.recurseLegendrePoly(a,[Math.cos(2.406809/(e+1.51))],r,n),t[a]=i[0][0],n=r,r=i;for(var o=0,a=0;a<=e;a++)o+=t[a]*(2*a+1);for(var a=0;a<=e;a++)t[a]=t[a]/o;return t}(this.order);break;default:this.vmicPattern="hypercardioid",this.vmicCoeffs=e(this.order)}this.updateGains()}},{key:"updateOrientation",value:function(){for(var e=this.azim*Math.PI/180,t=this.elev*Math.PI/180,r=c.computeRealSH(this.order,[[e,t]]),n=0;n<this.nCh;n++)this.SHxyz[n]=r[n][0];this.updateGains()}},{key:"updateGains",value:function(){for(var e,t=0;t<=this.order;t++)for(var r=-t;r<=t;r++)e=t*t+t+r,this.vmicGains[e]=this.vmicCoeffs[t]*this.SHxyz[e];for(var n=0;n<this.nCh;n++)this.vmicGainNodes[n].gain.value=this.vmicGains[n]}}]),e}();r.default=f},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29,"spherical-harmonic-transform":83}],20:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=function(){function e(t,r,n,i){function o(e,t){return("000000000"+e).substr(-t)}(0,a.default)(this,e),this.context=t,this.order=r,this.nCh=(r+1)*(r+1),this.nChGroups=Math.ceil(this.nCh/8),this.buffers=new Array,this.loadCount=0,this.loaded=!1,this.onLoad=i,this.urls=new Array(this.nChGroups);var s=n.slice(n.length-3,n.length);this.fileExt=s;for(var u=0;u<this.nChGroups;u++)u==this.nChGroups-1?this.urls[u]=n.slice(0,n.length-4)+"_"+o(8*u+1,2)+"-"+o(this.nCh,2)+"ch."+s:this.urls[u]=n.slice(0,n.length-4)+"_"+o(8*u+1,2)+"-"+o(8*u+8,2)+"ch."+s}return(0,s.default)(e,[{key:"loadBuffers",value:function(e,t){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer";var n=this;r.onload=function(){n.context.decodeAudioData(r.response,function(r){if(!r)return void alert("error decoding file data: "+e);n.buffers[t]=r,++n.loadCount==n.nChGroups&&(n.loaded=!0,n.concatBuffers(),console.log("HOAloader: all buffers loaded and concatenated"),n.onLoad(n.concatBuffer))},function(t){alert("Browser cannot decode audio data: "+e+"\n\nError: "+t+"\n\n(If you re using Safari and get a null error, this is most likely due to Apple's shady plan going on to stop the .ogg format from easing web developer's life :)")})},r.onerror=function(){alert("HOAloader: XHR error")},r.send()}},{key:"load",value:function(){for(var e=0;e<this.nChGroups;++e)this.loadBuffers(this.urls[e],e)}},{key:"concatBuffers",value:function(){if(this.loaded){var e=this.nCh,t=this.nChGroups,r=this.buffers[0].length;this.buffers.forEach(function(e){r=Math.max(r,e.length)});var n=this.buffers[0].sampleRate,i=[1,2,3,4,5,6,7,8];"ogg"==this.fileExt.toLowerCase()&&(console.log("Loading of 8chan OGG files [Chrome/Firefox]: remap channels to correct order!"),i=[1,3,2,7,8,5,6,4]),this.concatBuffer=this.context.createBuffer(e,r,n);for(var a=0;a<t;a++)for(var o=0;o<this.buffers[a].numberOfChannels;o++)this.concatBuffer.getChannelData(8*a+o).set(this.buffers[a].getChannelData(i[o]-1))}}}]),e}();r.default=u},{"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],21:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=e("./utils.js"),c=function(){function e(t,r,n){(0,a.default)(this,e),this.context=t,this.order=r,this.nCh=2*r+1,this.onLoad=n,this.vls_dirs_deg=u.sampleCircle(2*this.order+2),this.nVLS=this.vls_dirs_deg.length,this.nearestLookupRes=[5,5]}return(0,s.default)(e,[{key:"load",value:function(e){var t=this,r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="json",r.onload=function(){t.parseHrirFromJSON(r.response),t.nearestLookup=u.createNearestLookup(t.hrir_dirs_deg,t.nearestLookupRes);var e=u.findNearest(t.vls_dirs_deg,t.nearestLookup,t.nearestLookupRes);t.nearest_dirs_deg=t.getClosestDirs(e,t.hrir_dirs_deg),t.vls_hrirs=t.getClosestHrirFilters(e,t.hrirs),t.computeDecFilters()},r.send()}},{key:"parseHrirFromJSON",value:function(e){var t=this;this.fs=e.leaves[6].data[0],this.nHrirs=e.leaves[4].data.length,this.nSamples=e.leaves[8].data[0][1].length,this.hrir_dirs_deg=[],e.leaves[4].data.forEach(function(e){t.hrir_dirs_deg.push([e[0],e[1]])}),this.hrirs=[],e.leaves[8].data.forEach(function(e){var r=new Float64Array(e[0]),n=new Float64Array(e[1]);t.hrirs.push([r,n])})}},{key:"getClosestDirs",value:function(e,t){for(var r=e.length,n=[],i=0;i<r;i++)n.push(t[e[i]]);return n}},{key:"getClosestHrirFilters",value:function(e,t){for(var r=e.length,n=[],i=0;i<r;i++)n.push(t[e[i]]);return n}},{key:"computeDecFilters",value:function(){var e=[];e.push(1);for(var t=1;t<this.order+1;t++)e.push(Math.cos(t*Math.PI/(2*this.order+2))),e.push(Math.cos(t*Math.PI/(2*this.order+2)));var r=numeric.diag(e);this.decodingMatrix=numeric.transpose(u.getCircHarmonics(this.order,u.getColumn(this.vls_dirs_deg,0))),this.decodingMatrix=numeric.dot(this.decodingMatrix,r),this.decodingMatrix=numeric.mul(2*Math.PI/this.vls_dirs_deg.length,this.decodingMatrix),this.hoaBuffer=this.getHoaFilterFromHrirFilter(this.nCh,this.nSamples,this.fs,this.vls_hrirs,this.decodingMatrix),this.onLoad(this.hoaBuffer)}},{key:"getHoaFilterFromHrirFilter",value:function(e,t,r,n,i){t>n[0][0].length&&(t=n[0][0].length);for(var a=this.context.createBuffer(e,t,r),o=0;o<e;o++){for(var s=new Float32Array(t),u=0;u<n.length;u++)for(var c=0;c<t;c++)s[c]+=i[u][o]*n[u][0][c];a.getChannelData(o).set(s)}return a}}]),e}();r.default=c},{"./utils.js":25,"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],22:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=e("serve-sofa-hrir"),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(u),f=e("./utils.js"),h=function(){function e(t,r,n){(0,a.default)(this,e),this.context=t,this.order=r,this.nCh=(r+1)*(r+1),this.onLoad=n,this.hrtfSet=new c.HrtfSet({audioContext:this.context,coordinateSystem:"sofaSpherical"}),this.wishedSpeakerPos=f.getTdesign(2*this.order)}return(0,s.default)(e,[{key:"load",value:function(e){var t=this;this.hrtfSet.load(e).then(function(){var e=[];t.hrirBuffer=[];for(var r=0;r<t.wishedSpeakerPos.length;r++)e.push(t.hrtfSet.nearest(t.wishedSpeakerPos[r]).position),t.hrirBuffer.push(t.hrtfSet.nearest(t.wishedSpeakerPos[r]).fir);for(var n=0,i=0;i<t.wishedSpeakerPos.length;i++)t.wishedSpeakerPos[i][0]<0&&(t.wishedSpeakerPos[i][0]+=360),n+=Math.sqrt(Math.pow(t.wishedSpeakerPos[i][0]-e[i][0],2)+Math.pow(t.wishedSpeakerPos[i][1]-e[i][1],2));console.log("summed / average angular dist between asked and present pos:",Math.round(100*n)/100,"deg /",Math.round(n/t.wishedSpeakerPos.length*100)/100,"deg"),t.decodingMatrix=f.getAmbisonicDecMtx(e,t.order),t.hoaBuffer=t.getHoaFilterFromHrirFilter(),t.onLoad(t.hoaBuffer)})}},{key:"getHoaFilterFromHrirFilter",value:function(){for(var e=this.hrirBuffer[0].length,t=this.hrirBuffer[0].sampleRate,r=this.context.createBuffer(this.nCh,e,t),n=0;n<this.nCh;n++){for(var i=new Float32Array(e),a=0;a<this.hrirBuffer.length;a++)for(var o=0;o<e;o++)i[o]+=this.decodingMatrix[a][n]*this.hrirBuffer[a].getChannelData(0)[o];r.getChannelData(n).set(i)}return r}}]),e}();r.default=h},{"./utils.js":25,"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29,"serve-sofa-hrir":74}],23:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),u=e("./utils.js"),c=function(){function e(t,r,n){(0,a.default)(this,e),this.context=t,this.order=r,this.nCh=(r+1)*(r+1),this.onLoad=n,this.vls_dirs_deg=u.getTdesign(2*this.order),this.nVLS=this.vls_dirs_deg.length,this.nearestLookupRes=[5,5]}return(0,s.default)(e,[{key:"load",value:function(e){var t=this,r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="json",r.onload=function(){t.parseHrirFromJSON(r.response),t.nearestLookup=u.createNearestLookup(t.hrir_dirs_deg,t.nearestLookupRes);var e=u.findNearest(t.vls_dirs_deg,t.nearestLookup,t.nearestLookupRes);t.nearest_dirs_deg=t.getClosestDirs(e,t.hrir_dirs_deg),t.vls_hrirs=t.getClosestHrirFilters(e,t.hrirs),t.computeDecFilters()},r.send()}},{key:"parseHrirFromJSON",value:function(e){var t=this;this.fs=e.leaves[6].data[0],this.nHrirs=e.leaves[4].data.length,this.nSamples=e.leaves[8].data[0][1].length,this.hrir_dirs_deg=[],e.leaves[4].data.forEach(function(e){t.hrir_dirs_deg.push([e[0],e[1]])}),this.hrirs=[],e.leaves[8].data.forEach(function(e){var r=new Float64Array(e[0]),n=new Float64Array(e[1]);t.hrirs.push([r,n])})}},{key:"getClosestDirs",value:function(e,t){for(var r=e.length,n=[],i=0;i<r;i++)n.push(t[e[i]]);return n}},{key:"getClosestHrirFilters",value:function(e,t){for(var r=e.length,n=[],i=0;i<r;i++)n.push(t[e[i]]);return n}},{key:"computeDecFilters",value:function(){this.decodingMatrix=u.getAmbisonicDecMtx(this.nearest_dirs_deg,this.order),this.hoaBuffer=this.getHoaFilterFromHrirFilter(this.nCh,this.nSamples,this.fs,this.vls_hrirs,this.decodingMatrix),this.onLoad(this.hoaBuffer)}},{key:"getHoaFilterFromHrirFilter",value:function(e,t,r,n,i){t>n[0][0].length&&(t=n[0][0].length);for(var a=this.context.createBuffer(e,t,r),o=0;o<e;o++){for(var s=new Float32Array(t),u=0;u<n.length;u++)for(var c=0;c<t;c++)s[c]+=i[u][o]*n[u][0][c];a.getChannelData(o).set(s)}return a}}]),e}();r.default=c},{"./utils.js":25,"babel-runtime/helpers/classCallCheck":28,"babel-runtime/helpers/createClass":29}],24:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.utils=r.converters=r.HRIRloader_ircam=r.HRIRloader2D_local=r.HRIRloader_local=r.HOAloader=r.intensityAnalyser2D=r.intensityAnalyser=r.powermapAnalyser=r.rmsAnalyser=r.virtualMic=r.convolver=r.decoder=r.binDecoder2D=r.binDecoder=r.sceneMirror2D=r.sceneMirror=r.sceneRotator2D=r.sceneRotator=r.orderWeight=r.orderLimiter2D=r.orderLimiter=r.monoEncoder2D=r.monoEncoder=void 0;var a=e("./ambi-monoEncoder");Object.defineProperty(r,"monoEncoder",{enumerable:!0,get:function(){return i(a).default}});var o=e("./ambi-monoEncoder2D");Object.defineProperty(r,"monoEncoder2D",{enumerable:!0,get:function(){return i(o).default}});var s=e("./ambi-orderLimiter");Object.defineProperty(r,"orderLimiter",{enumerable:!0,get:function(){return i(s).default}});var u=e("./ambi-orderLimiter2D");Object.defineProperty(r,"orderLimiter2D",{enumerable:!0,get:function(){return i(u).default}});var c=e("./ambi-orderWeight");Object.defineProperty(r,"orderWeight",{enumerable:!0,get:function(){return i(c).default}});var f=e("./ambi-sceneRotator");Object.defineProperty(r,"sceneRotator",{enumerable:!0,get:function(){return i(f).default}});var h=e("./ambi-sceneRotator2D");Object.defineProperty(r,"sceneRotator2D",{enumerable:!0,get:function(){return i(h).default}});var l=e("./ambi-sceneMirror");Object.defineProperty(r,"sceneMirror",{enumerable:!0,get:function(){return i(l).default}});var d=e("./ambi-sceneMirror2D");Object.defineProperty(r,"sceneMirror2D",{enumerable:!0,get:function(){return i(d).default}});var m=e("./ambi-binauralDecoder");Object.defineProperty(r,"binDecoder",{enumerable:!0,get:function(){return i(m).default}});var p=e("./ambi-binauralDecoder2D");Object.defineProperty(r,"binDecoder2D",{enumerable:!0,get:function(){return i(p).default}});var v=e("./ambi-decoder");Object.defineProperty(r,"decoder",{enumerable:!0,get:function(){return i(v).default}});var g=e("./ambi-convolver");Object.defineProperty(r,"convolver",{enumerable:!0,get:function(){return i(g).default}});var y=e("./ambi-virtualMic");Object.defineProperty(r,"virtualMic",{enumerable:!0,get:function(){return i(y).default}});var b=e("./ambi-rmsAnalyser");Object.defineProperty(r,"rmsAnalyser",{enumerable:!0,get:function(){return i(b).default}});var M=e("./ambi-powermapAnalyser");Object.defineProperty(r,"powermapAnalyser",{enumerable:!0,get:function(){return i(M).default}});var x=e("./ambi-intensityAnalyser");Object.defineProperty(r,"intensityAnalyser",{enumerable:!0,get:function(){return i(x).default}});var w=e("./ambi-intensityAnalyser2D");Object.defineProperty(r,"intensityAnalyser2D",{enumerable:!0,get:function(){return i(w).default}});var _=e("./hoa-loader");Object.defineProperty(r,"HOAloader",{enumerable:!0,get:function(){return i(_).default}});var S=e("./hrir-loader_local");Object.defineProperty(r,"HRIRloader_local",{enumerable:!0,get:function(){return i(S).default}});var C=e("./hrir-loader2D_local");Object.defineProperty(r,"HRIRloader2D_local",{enumerable:!0,get:function(){return i(C).default}});var P=e("./hrir-loader_ircam");Object.defineProperty(r,"HRIRloader_ircam",{enumerable:!0,get:function(){return i(P).default}});var A=e("./ambi-converters"),k=n(A),j=e("./utils"),T=n(j);r.converters=k,r.utils=T},{"./ambi-binauralDecoder":1,"./ambi-binauralDecoder2D":2,"./ambi-converters":3,"./ambi-convolver":4,"./ambi-decoder":5,"./ambi-intensityAnalyser":6,"./ambi-intensityAnalyser2D":7,"./ambi-monoEncoder":8,"./ambi-monoEncoder2D":9,"./ambi-orderLimiter":10,"./ambi-orderLimiter2D":11,"./ambi-orderWeight":12,"./ambi-powermapAnalyser":13,"./ambi-rmsAnalyser":14,"./ambi-sceneMirror":15,"./ambi-sceneMirror2D":16,"./ambi-sceneRotator":17,"./ambi-sceneRotator2D":18,"./ambi-virtualMic":19,"./hoa-loader":20,"./hrir-loader2D_local":21,"./hrir-loader_ircam":22,"./hrir-loader_local":23,"./utils":25}],25:[function(e,t,r){"use strict";function n(e){for(var t=[],r=Math.PI/180,n=0;n<e.length;n++)3==e[0].length?t.push([e[n][0]*r,e[n][1]*r,e[n][2]]):2==e[0].length&&t.push([e[n][0]*r,e[n][1]*r]);return t}function i(e){for(var t=[],r=180/Math.PI,n=0;n<e.length;n++)3==e[0].length?t.push([e[n][0]*r,e[n][1]*r,e[n][2]]):2==e[0].length&&t.push([e[n][0]*r,e[n][1]*r]);return t}function a(e,t){return e.map(function(e){return e[t]})}function o(e){for(var t=[],r=360/e,n=0,i=0;i<e;i++)t.push([n,0,1]),n+=r;return t}function s(e,t){var r=e,n=2*r+1,i=t.length,a=new Array(n),o=new Array(i);t=l.mul(t,Math.PI/180),o.fill(1/Math.sqrt(2*Math.PI)),a[0]=o;for(var s=0;s<r;s++)a[2*s+1]=l.div(l.sin(l.mul(-(s+1),t)),Math.sqrt(Math.PI)),a[2*s+2]=l.div(l.cos(l.mul(s+1,t)),Math.sqrt(Math.PI));return a}function u(e,t){for(var r=n(e),i=d.convertSph2Cart(r),a=m(i),o=a.length,s=r.length,u=new Array(o),c=0;c<o;c++){for(var f=new Array(3),v=0;v<3;v++)f[v]=i[a[c][v]];for(var g=l.inv(f),y=[],b=0;b<3;b++)for(var M=0;M<3;M++)y.push(g[M][b]);u[c]=y}var x=h(2*t),w=n(x),_=p(w,a,u,s);_=l.transpose(_);var S=d.computeRealSH(t,w);S=l.transpose(S);var C=w.length,P=l.dotMMsmall(_,S);return P=l.mul(1/C,P)}function c(e,t){var r=e.length,i=d.convertSph2Cart(n(e)),a=Math.round(360/t[0])+1,o=Math.round(180/t[1])+1,s=new Array(a);s[0]=-180;for(var u=1;u<a;u++)s[u]=s[u-1]+t[0];for(var c=a*o,f=new Array(c),h=0;h<c;h++)for(var m=[[h%a*t[0]-180,Math.floor(h/a)*t[1]-90]],p=d.convertSph2Cart(n(m)),v=1e3,g=0;g<r;g++){var y=l.sum(l.pow(l.sub(p[0],i[g]),2));y<v&&(f[h]=g,v=y)}return f}function f(e,t,r){for(var n=e.length,i=[],a=[],o=0;o<n;o++)i.push(e[o][0]+180),a.push(e[o][1]+90);for(var s=Math.round(360/r[0])+1,u=l.round(l.div(l.mod(i,360),r[0])),c=l.round(l.div(a,r[1])),f=l.add(l.mul(c,s),u,1),h=[],d=0;d<n;d++)h.push(t[f[d]]);return h}function h(e){if(e>21)throw new Error("Designs of order greater than 21 are not implemented");if(e<1)throw new Error("Order should be at least 1")
;return[[[0,0,1],[180,0,1]],[[45,35.26,1],[-45,-35.26,1],[135,-35.26,1],[-135,35.26,1]],[[0,0,1],[180,0,1],[90,0,1],[-90,0,1],[0,90,1],[0,-90,1]],[[0,-31.72,1],[-58.28,0,1],[-90,58.28,1],[0,31.72,1],[-121.72,0,1],[90,-58.28,1],[180,-31.72,1],[121.72,0,1],[90,58.28,1],[180,31.72,1],[58.28,0,1],[-90,-58.28,1]],[[0,-31.72,1],[-58.28,0,1],[-90,58.28,1],[0,31.72,1],[-121.72,0,1],[90,-58.28,1],[180,-31.72,1],[121.72,0,1],[90,58.28,1],[180,31.72,1],[58.28,0,1],[-90,-58.28,1]],[[26,15.46,1],[-26,-15.46,1],[17.11,-24.99,1],[-17.11,24.99,1],[154,-15.46,1],[-154,15.46,1],[162.89,24.99,1],[-162.89,-24.99,1],[72.89,24.99,1],[107.11,-24.99,1],[116,15.46,1],[64,-15.46,1],[-107.11,24.99,1],[-72.89,-24.99,1],[-64,15.46,1],[-116,-15.46,1],[32.25,60.03,1],[-147.75,60.03,1],[-57.75,60.03,1],[122.25,60.03,1],[-32.25,-60.03,1],[147.75,-60.03,1],[57.75,-60.03,1],[-122.25,-60.03,1]],[[26,15.46,1],[-26,-15.46,1],[17.11,-24.99,1],[-17.11,24.99,1],[154,-15.46,1],[-154,15.46,1],[162.89,24.99,1],[-162.89,-24.99,1],[72.89,24.99,1],[107.11,-24.99,1],[116,15.46,1],[64,-15.46,1],[-107.11,24.99,1],[-72.89,-24.99,1],[-64,15.46,1],[-116,-15.46,1],[32.25,60.03,1],[-147.75,60.03,1],[-57.75,60.03,1],[122.25,60.03,1],[-32.25,-60.03,1],[147.75,-60.03,1],[57.75,-60.03,1],[-122.25,-60.03,1]],[[-31.11,53.65,1],[110.82,30.5,1],[148.89,53.65,1],[32.21,-17.83,1],[69.18,-30.5,1],[-32.21,17.83,1],[-69.18,30.5,1],[-147.79,-17.83,1],[-110.82,-30.5,1],[147.79,17.83,1],[31.11,-53.65,1],[-148.89,-53.65,1],[-21.25,-47.78,1],[-108.2,38.78,1],[158.75,-47.78,1],[139.77,-14.09,1],[-71.8,-38.78,1],[-139.77,14.09,1],[71.8,38.78,1],[-40.23,-14.09,1],[108.2,-38.78,1],[40.23,14.09,1],[21.25,47.78,1],[-158.75,47.78,1],[106.65,-2.55,1],[-2.66,-16.63,1],[-73.35,-2.55,1],[-98.84,73.16,1],[-177.34,16.63,1],[98.84,-73.16,1],[177.34,-16.63,1],[81.16,73.16,1],[2.66,16.63,1],[-81.16,-73.16,1],[-106.65,2.55,1],[73.35,2.55,1]],[[20.75,-3.55,1],[-20.75,3.55,1],[-3.8,-20.7,1],[3.8,20.7,1],[159.25,3.55,1],[-159.25,-3.55,1],[-176.2,20.7,1],[176.2,-20.7,1],[93.8,20.7,1],[86.2,-20.7,1],[110.75,-3.55,1],[69.25,3.55,1],[-86.2,20.7,1],[-93.8,-20.7,1],[-69.25,-3.55,1],[-110.75,3.55,1],[-9.94,68.97,1],[170.06,68.97,1],[-99.94,68.97,1],[80.06,68.97,1],[9.94,-68.97,1],[-170.06,-68.97,1],[99.94,-68.97,1],[-80.06,-68.97,1],[42.15,17.57,1],[-42.15,-17.57,1],[23.12,-39.77,1],[-23.12,39.77,1],[137.85,-17.57,1],[-137.85,17.57,1],[156.88,39.77,1],[-156.88,-39.77,1],[66.88,39.77,1],[113.12,-39.77,1],[132.15,17.57,1],[47.85,-17.57,1],[-113.12,39.77,1],[-66.88,-39.77,1],[-47.85,17.57,1],[-132.15,-17.57,1],[25.26,44.98,1],[-154.74,44.98,1],[-64.74,44.98,1],[115.26,44.98,1],[-25.26,-44.98,1],[154.74,-44.98,1],[64.74,-44.98,1],[-115.26,-44.98,1]],[[144.09,-21.45,1],[-33.81,-48.92,1],[-35.91,-21.45,1],[-115.87,33.09,1],[-146.19,48.92,1],[115.87,-33.09,1],[146.19,-48.92,1],[64.13,33.09,1],[33.81,48.92,1],[-64.13,-33.09,1],[-144.09,21.45,1],[35.91,21.45,1],[-45.53,1.95,1],[177.26,44.44,1],[134.47,1.95,1],[87.21,-45.49,1],[2.74,-44.44,1],[-87.21,45.49,1],[-2.74,44.44,1],[-92.79,-45.49,1],[-177.26,-44.44,1],[92.79,45.49,1],[45.53,-1.95,1],[-134.47,-1.95,1],[15.59,-73.34,1],[-85.4,16.04,1],[-164.41,-73.34,1],[163.92,4.42,1],[-94.6,-16.04,1],[-163.92,-4.42,1],[94.6,16.04,1],[-16.08,4.42,1],[85.4,-16.04,1],[16.08,-4.42,1],[-15.59,73.34,1],[164.41,73.34,1],[-60.02,25.27,1],[151.41,26.86,1],[119.98,25.27,1],[46.63,-51.57,1],[28.59,-26.86,1],[-46.63,51.57,1],[-28.59,26.86,1],[-133.37,-51.57,1],[-151.41,-26.86,1],[133.37,51.57,1],[60.02,-25.27,1],[-119.98,-25.27,1],[-109.94,6.91,1],[172.65,-19.79,1],[70.06,6.91,1],[-70.44,-68.94,1],[7.35,19.79,1],[70.44,68.94,1],[-7.35,-19.79,1],[109.56,-68.94,1],[-172.65,19.79,1],[-109.56,68.94,1],[109.94,-6.91,1],[-70.06,-6.91,1]],[[132.93,7.69,1],[-83.93,-23.73,1],[8.47,23.51,1],[-113.34,70.42,1],[-103.27,-9.9,1],[-33.24,-70.75,1],[21.86,-26.46,1],[-156.54,47.78,1],[-64.26,-7.72,1],[165.78,44.53,1],[-25.2,26.39,1],[-97,-44.66,1],[27.85,9.77,1],[153.21,-47.71,1],[-155.06,7.45,1],[-11.84,-23.59,1],[80.54,23.72,1],[-42.06,70.44,1],[-31.22,-9.84,1],[38.84,-70.5,1],[93.76,-26.29,1],[-84.76,47.61,1],[7.76,-7.52,1],[-122.28,44.29,1],[46.8,26.64,1],[-24.77,-44.57,1],[99.89,9.91,1],[-134.78,-47.96,1],[-83.09,7.3,1],[60.13,-23.34,1],[152.64,23.64,1],[29.76,70.68,1],[40.78,-9.58,1],[110.18,-70.39,1],[165.65,-26.43,1],[-12.99,47.75,1],[79.74,-7.31,1],[-50.52,44.26,1],[118.92,26.71,1],[47.22,-44.31,1],[171.93,9.76,1],[-62.51,-48.04,1],[-11.12,7.44,1],[132.02,-23.33,1],[-135.36,23.39,1],[102.37,70.82,1],[112.74,-9.49,1],[-178.3,-70.58,1],[-122.32,-26.67,1],[59.08,48,1],[151.7,-7.38,1],[21.38,44.5,1],[-169.01,26.5,1],[118.98,-44.25,1],[-116.09,9.52,1],[9.65,-47.83,1],[60.89,7.68,1],[-156.02,-23.57,1],[-63.46,23.31,1],[174.93,70.66,1],[-175.29,-9.68,1],[-105.95,-70.8,1],[-50.19,-26.7,1],[131.36,48.01,1],[-136.3,-7.64,1],[93.56,44.67,1],[-97.08,26.3,1],[-169.16,-44.46,1],[-44.13,9.52,1],[81.48,-47.62,1]],[[-154.47,7.9,1],[162.15,-63.36,1],[25.53,7.9,1],[-81.26,-25.27,1],[17.85,63.36,1],[81.26,25.27,1],[-17.85,-63.36,1],[98.74,-25.27,1],[-162.15,63.36,1],[-98.74,25.27,1],[154.47,-7.9,1],[-25.53,-7.9,1],[1.3,-10.47,1],[-83.01,79.45,1],[-178.7,-10.47,1],[100.48,1.28,1],[-96.99,-79.45,1],[-100.48,-1.28,1],[96.99,79.45,1],[-79.52,1.28,1],[83.01,-79.45,1],[79.52,-1.28,1],[-1.3,10.47,1],[178.7,10.47,1],[157.24,13.15,1],[31.14,-63.89,1],[-22.76,13.15,1],[-75.78,22.13,1],[148.86,63.89,1],[75.78,-22.13,1],[-148.86,-63.89,1],[104.22,22.13,1],[-31.14,63.89,1],[-104.22,-22.13,1],[-157.24,-13.15,1],[22.76,-13.15,1],[110.44,-60.62,1],[-62.18,-9.87,1],[-69.56,-60.62,1],[-168.88,27.37,1],[-117.82,9.87,1],[168.88,-27.37,1],[117.82,-9.87,1],[11.12,27.37,1],[62.18,9.87,1],[-11.12,-27.37,1],[-110.44,60.62,1],[69.56,60.62,1],[-125.93,-47.4,1],[-126.67,-23.4,1],[54.07,-47.4,1],[-151.65,-33.24,1],[-53.33,23.4,1],[151.65,33.24,1],[53.33,-23.4,1],[28.35,-33.24,1],[126.67,23.4,1],[-28.35,33.24,1],[125.93,47.4,1],[-54.07,47.4,1],[61.41,37.54,1],[41.19,22.3,1],[-118.59,37.54,1],[31.92,44.13,1],[138.81,-22.3,1],[-31.92,-44.13,1],[-138.81,22.3,1],[-148.08,44.13,1],[-41.19,-22.3,1],[148.08,-44.13,1],[-61.41,-37.54,1],[118.59,-37.54,1],[132.92,4.73,1],[6.45,-42.74,1],[-47.08,4.73,1],[-83.07,46.87,1],[173.55,42.74,1],[83.07,-46.87,1],[-173.55,-42.74,1],[96.93,46.87,1],[-6.45,42.74,1],[-96.93,-46.87,1],[-132.92,-4.73,1],[47.08,-4.73,1]],[[-40.36,68.7,1],[61.12,65.68,1],[141.73,70.75,1],[-131.25,72.32,1],[-154.88,-12.62,1],[-66.2,-9.78,1],[26.36,-11.97,1],[114.95,-12.58,1],[37.02,51.13,1],[129.77,51.95,1],[-140.63,50.15,1],[-56.5,47.88,1],[-65.05,12.58,1],[25.12,12.62,1],[113.8,9.78,1],[-153.64,11.97,1],[-134.51,-9.73,1],[-46.23,-8.37,1],[47.91,-9.73,1],[141.51,-8.73,1],[-17.84,-44.1,1],[69.37,-43.27,1],[151.22,-42.67,1],[-106.78,-40.18,1],[-50.23,-51.95,1],[39.37,-50.15,1],[123.5,-47.88,1],[-142.98,-51.13,1],[-179.19,-60.75,1],[-84.57,-54.07,1],[5.39,-58.05,1],[89.5,-60.75,1],[-145.98,31.02,1],[-54.39,26.43,1],[28.92,32.51,1],[125.34,30.94,1],[168.71,-7.06,1],[-112.49,-10.38,1],[-21.96,-9.6,1],[73.11,-8.31,1],[95.68,.04,1],[-170.71,2.32,1],[-84.32,-.04,1],[9.29,-2.32,1],[9.19,-34.33,1],[98.21,-37.31,1],[-179.2,-40.48,1],[-77.81,-31.6,1],[-177.08,-21.74,1],[-93.77,-18.83,1],[-2.72,-19.8,1],[90.51,-20.91,1],[-106.89,8.31,1],[-11.29,7.06,1],[67.51,10.38,1],[158.04,9.6,1],[-118.88,-65.68,1],[-38.27,-70.75,1],[48.75,-72.32,1],[139.64,-68.7,1],[-54.66,-30.94,1],[34.02,-31.02,1],[125.61,-26.43,1],[-151.08,-32.51,1],[-170.81,34.33,1],[-81.79,37.31,1],[.8,40.48,1],[102.19,31.6,1],[-28.78,42.67,1],[73.22,40.18,1],[162.16,44.1,1],[-110.63,43.27,1],[-89.49,20.91,1],[2.92,21.74,1],[86.23,18.83,1],[177.28,19.8,1],[133.77,8.37,1],[-132.09,9.73,1],[-38.49,8.73,1],[45.49,9.73,1],[-25.6,24.04,1],[55.12,30.23,1],[149.3,28.05,1],[-118.71,26.06,1],[.81,60.75,1],[95.43,54.07,1],[-174.61,58.05,1],[-90.5,60.75,1],[-124.88,-30.23,1],[-30.7,-28.05,1],[61.29,-26.06,1],[154.4,-24.04,1],[-132.92,-85.6,1],[47.08,85.6,1]],[[-129.19,8.11,1],[169.58,-38.73,1],[50.81,8.12,1],[-77.27,-50.11,1],[10.42,38.73,1],[77.3,50.12,1],[-10.41,-38.72,1],[102.71,-50.11,1],[-169.57,38.72,1],[-102.71,50.11,1],[129.19,-8.11,1],[-50.8,-8.11,1],[-4.59,-56.01,1],[-93.1,33.85,1],[175.39,-56.03,1],[146.11,-2.57,1],[-86.89,-33.86,1],[-146.1,2.56,1],[86.91,33.86,1],[-33.89,-2.57,1],[93.1,-33.85,1],[33.9,2.58,1],[4.6,56.03,1],[-175.38,56.01,1],[106.57,26.1,1],[27.07,-14.82,1],[-73.44,26.09,1],[-30.2,59.41,1],[152.94,14.83,1],[30.2,-59.4,1],[-152.93,-14.84,1],[149.82,59.41,1],[-27.06,14.83,1],[-149.8,-59.42,1],[-106.55,-26.1,1],[73.44,-26.09,1],[-171.42,77.45,1],[91.9,-12.4,1],[8.54,77.46,1],[-12.4,-1.85,1],[88.11,12.41,1],[12.41,1.86,1],[-88.1,-12.41,1],[167.6,-1.86,1],[-91.89,12.4,1],[-167.59,1.84,1],[171.43,-77.46,1],[-8.52,-77.45,1],[-122.73,-10.44,1],[-167.65,-32.13,1],[57.27,-10.43,1],[-108.8,-55.83,1],[-12.35,32.13,1],[108.83,55.83,1],[12.36,-32.12,1],[71.19,-55.82,1],[167.66,32.12,1],[-71.19,55.82,1],[122.74,10.44,1],[-57.27,10.44,1],[-135.84,-23.05,1],[-148.58,-41.32,1],[44.16,-23.04,1],[-120.66,-39.88,1],[-31.41,41.31,1],[120.68,39.87,1],[31.42,-41.3,1],[59.33,-39.86,1],[148.6,41.31,1],[-59.33,39.87,1],[135.85,23.05,1],[-44.16,23.05,1],[-161.55,20.62,1],[130.04,-62.6,1],[18.45,20.64,1],[-68.35,-17.23,1],[49.96,62.61,1],[68.36,17.23,1],[-49.93,-62.6,1],[111.65,-17.22,1],[-130.05,62.59,1],[-111.64,17.22,1],[161.56,-20.63,1],[-18.44,-20.62,1],[-105.23,-3.38,1],[-176.5,-15.21,1],[74.77,-3.37,1],[-102.64,-74.41,1],[-3.5,15.21,1],[102.69,74.41,1],[3.51,-15.2,1],[77.33,-74.4,1],[176.51,15.2,1],[-77.36,74.4,1],[105.24,3.38,1],[-74.76,3.37,1],[-142.39,25.42,1],[142.08,-45.69,1],[37.61,25.43,1],[-59.02,-33.44,1],[37.92,45.69,1],[59.04,33.45,1],[-37.91,-45.68,1],[120.97,-33.44,1],[-142.07,45.68,1],[-120.96,33.44,1],[142.4,-25.43,1],[-37.6,-25.42,1]],[[-30.6,6.94,1],[166.56,58.69,1],[149.4,6.96,1],[81.95,-30.36,1],[13.48,-58.69,1],[-81.93,30.36,1],[-13.46,58.68,1],[-98.06,-30.37,1],[-166.54,-58.68,1],[98.07,30.37,1],[30.62,-6.95,1],[-149.38,-6.95,1],[106.69,-22.68,1],[-23.57,-15.36,1],[-73.31,-22.69,1],[-145.5,62.1,1],[-156.41,15.36,1],[145.53,-62.1,1],[156.43,-15.35,1],[34.47,62.11,1],[23.58,15.36,1],[-34.46,-62.11,1],[-106.67,22.68,1],[73.33,22.69,1],[166.82,1.39,1],[6.09,-76.74,1],[-13.19,1.38,1],[-88.57,13.18,1],[173.99,76.74,1],[88.59,-13.18,1],[-173.97,-76.73,1],[91.43,13.2,1],[-6.07,76.73,1],[-91.42,-13.2,1],[-166.8,-1.38,1],[13.2,-1.39,1],[-74.67,48.11,1],[130.86,10.16,1],[105.32,48.13,1],[13.34,-40.08,1],[49.16,-10.15,1],[-13.32,40.07,1],[-49.14,10.15,1],[-166.67,-40.08,1],[-130.84,-10.16,1],[166.69,40.08,1],[74.7,-48.11,1],[-105.31,-48.13,1],[-126.99,26.55,1],[147.96,-32.57,1],[53,26.56,1],[-50.28,-45.59,1],[32.05,32.58,1],[50.3,45.59,1],[-32.03,-32.58,1],[129.71,-45.58,1],[-147.94,32.57,1],[-129.69,45.58,1],[127.02,-26.55,1],[-52.98,-26.56,1],[-171.93,30.37,1],[103.47,-58.68,1],[8.07,30.36,1],[-59.38,-6.96,1],[76.54,58.69,1],[59.4,6.95,1],[-76.53,-58.69,1],[120.62,-6.94,1],[-103.44,58.68,1],[-120.6,6.95,1],[171.94,-30.36,1],[-8.05,-30.37,1],[40.86,10.16,1],[15.32,48.12,1],[-139.14,10.16,1],[76.68,40.09,1],[164.69,-48.12,1],[-76.67,-40.09,1],[-164.67,48.12,1],[-103.31,40.07,1],[-15.3,-48.13,1],[103.34,-40.07,1],[-40.84,-10.16,1],[139.16,-10.15,1],[103.2,-1.38,1],[-1.41,-13.19,1],[-76.8,-1.39,1],[-96.02,76.73,1],[-178.57,13.19,1],[96.07,-76.73,1],[178.58,-13.19,1],[83.94,76.74,1],[1.43,13.19,1],[-83.95,-76.74,1],[-103.18,1.38,1],[76.81,1.39,1],[37.02,-26.56,1],[-39.7,45.58,1],[-142.99,-26.56,1],[122.05,32.58,1],[-140.29,-45.59,1],[-122.04,-32.58,1],[140.31,45.59,1],[-57.95,32.57,1],[39.72,-45.58,1],[57.97,-32.57,1],[-37,26.55,1],[143,26.56,1],[163.33,22.69,1],[55.55,-62.1,1],[-16.67,22.68,1],[-66.41,15.35,1],[124.49,62.11,1],[66.43,-15.35,1],[-124.48,-62.11,1],[113.58,15.36,1],[-55.52,62.1,1],[-113.57,-15.36,1],[-163.31,-22.68,1],[16.69,-22.69,1]],[[-10.57,-17.35,1],[-120.42,69.76,1],[169.43,-17.35,1],[107.63,-10.08,1],[-59.57,-69.78,1],[-107.63,10.08,1],[59.57,69.78,1],[-72.37,-10.09,1],[120.42,-69.76,1],[72.37,10.09,1],[10.57,17.35,1],[-169.43,17.35,1],[-30.77,68.25,1],[101.53,18.57,1],[149.25,68.26,1],[18.92,-10.92,1],[78.47,-18.56,1],[-18.92,10.92,1],[-78.47,18.56,1],[-161.09,-10.92,1],[-101.53,-18.56,1],[161.09,10.92,1],[30.78,-68.26,1],[-149.26,-68.26,1],[56.46,41.26,1],[46.46,24.54,1],[-123.53,41.26,1],[32.19,38.8,1],[133.53,-24.53,1],[-32.19,-38.8,1],[-133.53,24.53,1],[-147.8,38.8,1],[-46.46,-24.54,1],[147.8,-38.8,1],[-56.46,-41.27,1],[123.53,-41.26,1],[84.74,27.31,1],[27.41,4.68,1],[-95.26,27.3,1],[10.06,62.23,1],[152.59,-4.67,1],[-10.06,-62.23,1],[-152.59,4.67,1],[-169.92,62.23,1],[-27.4,-4.68,1],[169.92,-62.22,1],[-84.74,-27.31,1],[95.26,-27.3,1],[136.27,-.73,1],[-1.05,-46.27,1],[-43.73,-.74,1],[-91.01,43.72,1],[-178.94,46.27,1],[91.01,-43.72,1],[178.94,-46.27,1],[88.99,43.73,1],[1.05,46.27,1],[-88.99,-43.73,1],[-136.27,.73,1],[43.73,.73,1],[55.23,10.82,1],[13.09,34.07,1],[-124.77,10.81,1],[71.48,53.8,1],[166.91,-34.06,1],[-71.48,-53.8,1],[-166.9,34.06,1],[-108.52,53.79,1],[-13.09,-34.06,1],[108.52,-53.79,1],[-55.23,-10.82,1],[124.77,-10.81,1],[-105.49,-68.13,1],[-111.15,-5.71,1],[74.52,-68.12,1],[-173.89,-21.04,1],[-68.85,5.7,1],[173.89,21.04,1],[68.85,-5.7,1],[6.12,-21.04,1],[111.15,5.71,1],[-6.12,21.04,1],[105.49,68.13,1],[-74.52,68.12,1],[35.28,-15.18,1],[-25.17,51.98,1],[-144.72,-15.19,1],[108.39,33.88,1],[-154.84,-51.99,1],[-108.39,-33.88,1],[154.84,51.99,1],[-71.61,33.87,1],[25.17,-51.98,1],[71.61,-33.87,1],[-35.28,15.18,1],[144.72,15.19,1],[-125.28,-28.56,1],[-146.32,-30.49,1],[54.72,-28.55,1],[-133.29,-45.82,1],[-33.69,30.48,1],[133.3,45.82,1],[33.68,-30.48,1],[46.71,-45.81,1],[146.32,30.49,1],[-46.71,45.81,1],[125.28,28.56,1],[-54.72,28.54,1],[-144.4,54.71,1],[112.38,-28.01,1],[35.58,54.72,1],[-29.92,-19.65,1],[67.62,28.02,1],[29.92,19.65,1],[-67.62,-28.02,1],[150.08,-19.64,1],[-112.38,28.01,1],[-150.08,19.64,1],[144.4,-54.71,1],[-35.58,-54.72,1],[68.53,-52.85,1],[-54.82,12.76,1],[-111.46,-52.87,1],[164.51,34.19,1],[-125.18,-12.77,1],[-164.51,-34.19,1],[125.18,12.77,1],[-15.5,34.19,1],[54.82,-12.76,1],[15.49,-34.19,1],[-68.53,52.85,1],[111.47,52.86,1],[91.48,-7.37,1],[-7.38,-1.47,1],[-88.52,-7.38,1],[-168.69,82.47,1],[-172.62,1.47,1],[168.69,-82.47,1],[172.62,-1.46,1],[11.22,82.48,1],[7.38,1.47,1],[-11.21,-82.48,1],[-91.48,7.37,1],[88.52,7.38,1]],[[-110.97,-81.34,1],[-98.09,-3.09,1],[69.03,-81.34,1],[-176.88,-8.08,1],[-81.91,3.09,1],[176.88,8.08,1],[81.91,-3.09,1],[3.12,-8.08,1],[98.09,3.09,1],[-3.12,8.08,1],[110.97,81.34,1],[-69.03,81.34,1],[145.76,30.52,1],[46.33,-45.41,1],[-34.24,30.52,1],[-54.51,28.99,1],[133.67,45.41,1],[54.51,-28.99,1],[-133.67,-45.41,1],[125.49,28.99,1],[-46.33,45.41,1],[-125.49,-28.99,1],[-145.76,-30.52,1],[34.24,-30.52,1],[159.58,41.4,1],[68.4,-44.67,1],[-20.42,41.4,1],[-46.75,15.18,1],[111.6,44.67,1],[46.75,-15.18,1],[-111.6,-44.67,1],[133.25,15.18,1],[-68.4,44.67,1],[-133.25,-15.18,1],[-159.58,-41.4,1],[20.42,-41.4,1],[85.43,-37.93,1],[-38.02,3.6,1],[-94.57,-37.93,1],[174.17,51.83,1],[-141.98,-3.6,1],[-174.17,-51.83,1],[141.98,3.6,1],[-5.83,51.83,1],[38.02,-3.6,1],[5.83,-51.83,1],[-85.43,37.93,1],[94.57,37.93,1],[21.18,27.17,1],[54.86,56.05,1],[-158.82,27.17,1],[61.17,18.75,1],[125.14,-56.05,1],[-61.17,-18.75,1],[-125.14,56.05,1],[-118.83,18.75,1],[-54.86,-56.05,1],[118.83,-18.75,1],[-21.18,-27.17,1],[158.82,-27.17,1],[104.66,-9.56,1],[-9.88,-14.45,1],[-75.34,-9.56,1],[-123.65,72.56,1],[-170.12,14.45,1],[123.65,-72.56,1],[170.12,-14.45,1],[56.35,72.56,1],[9.88,14.45,1],[-56.35,-72.56,1],[-104.66,9.56,1],[75.34,9.56,1],[25.94,-16.83,1],[-34.66,59.4,1],[-154.06,-16.83,1],[108.59,24.75,1],[-145.34,-59.41,1],[-108.59,-24.75,1],[145.34,59.41,1],[-71.41,24.75,1],[34.66,-59.41,1],[71.41,-24.75,1],[-25.94,16.83,1],[154.06,16.83,1],[-100.89,26.49,1],[153.1,-9.74,1],[79.11,26.49,1],[-20.77,-61.51,1],[26.9,9.74,1],[20.77,61.51,1],[-26.9,-9.74,1],[159.23,-61.51,1],[-153.1,9.74,1],[-159.23,61.51,1],[100.89,-26.49,1],[-79.11,-26.49,1],[44.31,12.28,1],[17.3,44.36,1],[-135.69,12.28,1],[73.08,43.05,1],[162.7,-44.36,1],[-73.08,-43.05,1],[-162.7,44.36,1],[-106.92,43.05,1],[-17.3,-44.36,1],[106.92,-43.05,1],[-44.31,-12.28,1],[135.69,-12.28,1],[-169.08,-24.53,1],[-112.54,-63.29,1],[10.92,-24.53,1],[-114.93,-9.92,1],[-67.46,63.28,1],[114.93,9.92,1],[67.46,-63.29,1],[65.07,-9.92,1],[112.54,63.29,1],[-65.07,9.92,1],[169.08,24.53,1],[-10.92,24.53,1],[93.2,-57.39,1],[-57.43,-1.73,1],[-86.8,-57.39,1],[-177.95,32.55,1],[-122.57,1.73,1],[177.95,-32.55,1],[122.57,-1.73,1],[2.05,32.55,1],[57.43,1.73,1],[-2.05,-32.55,1],[-93.2,57.39,1],[86.8,57.39,1],[-17.59,3.04,1],[170.04,72.16,1],[162.41,3.04,1],[86.81,-17.56,1],[9.96,-72.16,1],[-86.81,17.56,1],[-9.96,72.16,1],[-93.19,-17.56,1],[-170.04,-72.16,1],[93.19,17.56,1],[17.59,-3.04,1],[-162.41,-3.04,1],[39.38,44.26,1],[56.93,33.61,1],[-140.62,44.26,1],[38.42,27.03,1],[123.07,-33.61,1],[-38.42,-27.03,1],[-123.07,33.61,1],[-141.58,27.03,1],[-56.93,-33.61,1],[141.58,-27.03,1],[-39.38,-44.26,1],[140.62,-44.26,1]],[[165.52,26.52,1],[63.39,-60.04,1],[-14.48,26.52,1],[-62.74,12.93,1],[116.61,60.04,1],[62.74,-12.93,1],[-116.61,-60.04,1],[117.26,12.93,1],[-63.39,60.04,1],[-117.26,-12.93,1],[-165.52,-26.52,1],[14.48,-26.52,1],[-150.22,-21.62,1],[-141.41,-53.79,1],[29.78,-21.62,1],[-114.55,-27.5,1],[-38.59,53.79,1],[114.55,27.5,1],[38.59,-53.79,1],[65.45,-27.5,1],[141.41,53.79,1],[-65.45,27.5,1],[150.22,21.62,1],[-29.78,21.62,1],[-163.47,81.91,1],[92.31,-7.75,1],[16.53,81.91,1],[-7.76,-2.29,1],[87.69,7.75,1],[7.76,2.29,1],[-87.69,-7.75,1],[172.24,-2.29,1],[-92.31,7.75,1],[-172.24,2.29,1],[163.47,-81.91,1],[-16.53,-81.91,1],[-79.91,-73.49,1],[-106.27,2.85,1],[100.09,-73.49,1],[177.03,-16.24,1],[-73.73,-2.85,1],[-177.03,16.24,1],[73.73,2.85,1],[-2.97,-16.24,1],[106.27,-2.85,1],[2.97,16.24,1],[79.91,73.49,1],[-100.09,73.49,1],[-43.19,73.63,1],[101.37,11.86,1],[136.81,73.63,1],[12.09,-11.12,1],[78.63,-11.86,1],[-12.09,11.12,1],[-78.63,11.86,1],[-167.91,-11.12,1],[-101.37,-11.86,1],[167.91,11.12,1],[43.19,-73.63,1],[-136.81,-73.63,1],[109.86,-34.83,1],[-36.5,-16.19,1],[-70.14,-34.83,1],[-153.97,50.53,1],[-143.5,16.19,1],[153.97,-50.53,1],[143.5,-16.19,1],[26.03,50.53,1],[36.5,16.19,1],[-26.03,-50.53,1],[-109.86,34.83,1],[70.14,34.83,1],[-23.31,-6.54,1],[-163.84,65.83,1],[156.69,-6.54,1],[97.12,-23.15,1],[-16.16,-65.83,1],[-97.12,23.15,1],[16.16,65.83,1],[-82.88,-23.15,1],[163.84,-65.83,1],[82.88,23.15,1],[23.31,6.54,1],[-156.69,6.54,1],[-.87,-31.92,1],[-91.4,58.07,1],[179.13,-31.92,1],[121.93,-.74,1],[-88.6,-58.07,1],[-121.93,.74,1],[88.6,58.07,1],[-58.07,-.74,1],[91.4,-58.07,1],[58.07,.74,1],[.87,31.92,1],[-179.13,31.92,1],[163.12,43.35,1],[72.9,-44.1,1],[-16.88,43.35,1],[-45.39,12.19,1],[107.1,44.1,1],[45.39,-12.19,1],[-107.1,-44.1,1],[134.61,12.19,1],[-72.9,44.1,1],[-134.61,-12.19,1],[-163.12,-43.35,1],[16.88,-43.35,1],[-114.23,50.37,1],[127.06,-15.17,1],[65.77,50.37,1],[-18.77,-35.57,1],[52.94,15.17,1],[18.77,35.57,1],[-52.94,-15.17,1],[161.23,-35.57,1],[-127.06,15.17,1],[-161.23,35.57,1],[114.23,-50.37,1],[-65.77,-50.37,1],[54.17,30.16,1],[35.63,30.41,1],[-125.83,30.16,1],[45.21,44.51,1],[144.37,-30.41,1],[-45.21,-44.51,1],[-144.37,30.41,1],[-134.79,44.51,1],[-35.63,-30.41,1],[134.79,-44.51,1],[-54.17,-30.16,1],[125.83,-30.16,1],[126.2,41.73,1],[47.86,-26.15,1],[-53.8,41.73,1],[-33.51,37.03,1],[132.14,26.15,1],[33.51,-37.03,1],[-132.14,-26.15,1],[146.49,37.03,1],[-47.86,26.15,1],[-146.49,-37.03,1],[-126.2,-41.73,1],[53.8,-41.73,1],[-161.75,20.38,1],[130.12,-62.91,1],[18.25,20.38,1],[-68.63,-17.07,1],[49.88,62.91,1],[68.63,17.07,1],[-49.88,-62.91,1],[111.37,-17.07,1],[-130.12,62.91,1],[-111.37,17.07,1],[161.75,-20.38,1],[-18.25,-20.38,1],[2.71,48.49,1],[87.6,41.45,1],[-177.29,48.49,1],[41.48,1.8,1],[92.4,-41.45,1],[-41.48,-1.8,1],[-92.4,41.45,1],[-138.52,1.8,1],[-87.6,-41.45,1],[138.52,-1.8,1],[-2.71,-48.49,1],[177.29,-48.49,1],[-98.15,-27.54,1],[-152.22,-7.22,1],[81.85,-27.54,1],[-164.79,-61.37,1],[-27.78,7.22,1],[164.79,61.37,1],[27.78,-7.22,1],[15.21,-61.37,1],[152.22,7.22,1],[-15.21,61.37,1],[98.15,27.54,1],[-81.85,27.54,1]],[[-40.48,43.36,1],[124.51,33.58,1],[139.52,43.36,1],[38.85,-28.17,1],[55.49,-33.58,1],[-38.85,28.17,1],[-55.49,33.58,1],[-141.15,-28.17,1],[-124.51,-33.58,1],[141.15,28.17,1],[40.48,-43.36,1],[-139.52,-43.36,1],[56.01,17.18,1],[20.46,32.29,1],[-123.99,17.18,1],[61.05,52.38,1],[159.54,-32.29,1],[-61.05,-52.38,1],[-159.54,32.29,1],[-118.95,52.38,1],[-20.46,-32.29,1],[118.95,-52.38,1],[-56.01,-17.18,1],[123.99,-17.18,1],[-179.51,-8.95,1],[-93.08,-81.04,1],[.49,-8.95,1],[-98.95,-.48,1],[-86.92,81.04,1],[98.95,.48,1],[86.92,-81.04,1],[81.05,-.48,1],[93.08,81.04,1],[-81.05,.48,1],[179.51,8.95,1],[-.49,8.95,1],[12.04,-13.56,1],[-49.15,71.95,1],[-167.96,-13.56,1],[103.85,11.7,1],[-130.85,-71.95,1],[-103.85,-11.7,1],[130.85,71.95,1],[-76.15,11.7,1],[49.15,-71.95,1],[76.15,-11.7,1],[-12.04,13.56,1],[167.96,13.56,1],[-13.62,-58.2,1],[-98.3,30.8,1],[166.38,-58.2,1],[148.93,-7.13,1],[-81.7,-30.8,1],[-148.93,7.13,1],[81.7,30.8,1],[-31.07,-7.13,1],[98.3,-30.8,1],[31.07,7.13,1],[13.62,58.2,1],[-166.38,58.2,1],[65.26,-20.55,1],[-22.43,23.07,1],[-114.74,-20.55,1],[131.85,58.26,1],[-157.57,-23.07,1],[-131.85,-58.26,1],[157.57,23.07,1],[-48.15,58.26,1],[22.43,-23.07,1],[48.15,-58.26,1],[-65.26,20.55,1],[114.74,20.55,1],[-135.39,26.5,1],[144.63,-39.58,1],[44.61,26.5,1],[-55,-38.94,1],[35.37,39.58,1],[55,38.94,1],[-35.37,-39.58,1],[125,-38.94,1],[-144.63,39.58,1],[-125,38.94,1],[135.39,-26.5,1],[-44.61,-26.5,1],[114.95,-4.75,1],[-5.23,-24.86,1],[-65.05,-4.75,1],[-101.14,64.63,1],[-174.77,24.86,1],[101.14,-64.63,1],[174.77,-24.86,1],[78.86,64.63,1],[5.23,24.86,1],[-78.86,-64.63,1],[-114.95,4.75,1],[65.05,4.75,1],[35.85,52.64,1],[65.91,29.46,1],[-144.15,52.64,1],[31.75,20.82,1],[114.09,-29.46,1],[-31.75,-20.82,1],[-114.09,29.46,1],[-148.25,20.82,1],[-65.91,-29.46,1],[148.25,-20.82,1],[-35.85,-52.64,1],[144.15,-52.64,1],[86.45,11.52,1],[11.54,3.48,1],[-93.55,11.52,1],[16.9,77.95,1],[168.46,-3.48,1],[-16.9,-77.95,1],[-168.46,3.48,1],[-163.1,77.95,1],[-11.54,-3.48,1],[163.1,-77.95,1],[-86.45,-11.52,1],[93.55,-11.52,1],[135.24,4.02,1],[5.69,-45.1,1],[-44.76,4.02,1],[-84.35,44.62,1],[174.31,45.1,1],[84.35,-44.62,1],[-174.31,-45.1,1],[95.65,44.62,1],[-5.69,45.1,1],[-95.65,-44.62,1],[-135.24,-4.02,1],[44.76,-4.02,1],[-129.84,-18.16,1],[-156.86,-37.5,1],[50.16,-18.16,1],[-117.12,-46.85,1],[-23.14,37.5,1],[117.12,46.85,1],[23.14,-37.5,1],[62.88,-46.85,1],[156.86,37.5,1],[-62.88,46.85,1],[129.84,18.16,1],[-50.16,18.16,1],[-74.1,32.87,1],[146.1,13.3,1],[105.9,32.87,1],[22.97,-53.88,1],[33.9,-13.3,1],[-22.97,53.88,1],[-33.9,13.3,1],[-157.03,-53.88,1],[-146.1,-13.3,1],[157.03,53.88,1],[74.1,-32.87,1],[-105.9,-32.87,1],[-119.92,-5.64,1],[-173.5,-29.76,1],[60.08,-5.64,1],[-101.2,-59.6,1],[-6.5,29.76,1],[101.2,59.6,1],[6.5,-29.76,1],[78.8,-59.6,1],[173.5,29.76,1],[-78.8,59.6,1],[119.92,5.64,1],[-60.08,5.64,1],[73.14,16.13,1],[16.82,16.18,1],[-106.86,16.13,1],[45.09,66.83,1],[163.18,-16.18,1],[-45.09,-66.83,1],[-163.18,16.18,1],[-134.91,66.83,1],[-16.82,-16.18,1],[134.91,-66.83,1],[-73.14,-16.13,1],[106.86,-16.13,1],[-11.7,-43.38,1],[-102.11,45.38,1],[168.3,-43.38,1],[133.98,-8.47,1],[-77.89,-45.38,1],[-133.98,8.47,1],[77.89,45.38,1],[-46.02,-8.47,1],[102.11,-45.38,1],[46.02,8.47,1],[11.7,43.38,1],[-168.3,43.38,1],[-24.11,3.73,1],[170.94,65.63,1],[155.89,3.73,1],[85.92,-24.05,1],[9.06,-65.63,1],[-85.92,24.05,1],[-9.06,65.63,1],[-94.08,-24.05,1],[-170.94,-65.63,1],[94.08,24.05,1],[24.11,-3.73,1],[-155.89,-3.73,1]],[[104.6,-3.68,1],[-3.81,-14.57,1],[-75.4,-3.68,1],[-104.32,74.95,1],[-176.19,14.57,1],[104.32,-74.95,1],[176.19,-14.57,1],[75.68,74.95,1],[3.81,14.57,1],[-75.68,-74.95,1],[-104.6,3.68,1],[75.4,3.68,1],[153.77,-30.33,1],[-52.93,-50.74,1],[-26.23,-30.33,1],[-123.11,22.43,1],[-127.07,50.74,1],[123.11,-22.43,1],[127.07,-50.74,1],[56.89,22.43,1],[52.93,50.74,1],[-56.89,-22.43,1],[-153.77,30.33,1],[26.23,30.33,1],[35.99,-39.77,1],[-54.77,38.45,1],[-144.01,-39.77,1],[135.81,26.85,1],[-125.23,-38.45,1],[-135.81,-26.85,1],[125.23,38.45,1],[-44.19,26.85,1],[54.77,-38.45,1],[44.19,-26.85,1],[-35.99,39.77,1],[144.01,39.77,1],[71.82,-25.43,1],[-26.58,16.37,1],[-108.18,-25.43,1],[146.72,59.1,1],[-153.42,-16.37,1],[-146.72,-59.1,1],[153.42,16.37,1],[-33.28,59.1,1],[26.58,-16.37,1],[33.28,-59.1,1],[-71.82,25.43,1],[108.18,25.43,1],[-136.55,26.52,1],[144.03,-40.51,1],[43.45,26.52,1],[-55.5,-37.97,1],[35.97,40.51,1],[55.5,37.97,1],[-35.97,-40.51,1],[124.5,-37.97,1],[-144.03,40.51,1],[-124.5,37.97,1],[136.55,-26.52,1],[-43.45,-26.52,1],[-6.52,-1.08,1],[-170.58,83.4,1],[173.48,-1.08,1],[91.09,-6.52,1],[-9.42,-83.4,1],[-91.09,6.52,1],[9.42,83.4,1],[-88.91,-6.52,1],[170.58,-83.4,1],[88.91,6.52,1],[6.52,1.08,1],[-173.48,1.08,1],[-71.13,40.38,1],[138.05,14.26,1],[108.87,40.38,1],[20.82,-46.12,1],[41.95,-14.26,1],[-20.82,46.12,1],[-41.95,14.26,1],[-159.18,-46.12,1],[-138.05,-14.26,1],[159.18,46.12,1],[71.13,-40.38,1],[-108.87,-40.38,1],[-153.97,-27.97,1],[-129.57,-52.52,1],[26.03,-27.97,1],[-120.59,-22.81,1],[-50.43,52.52,1],[120.59,22.81,1],[50.43,-52.52,1],[59.41,-22.81,1],[129.57,52.52,1],[-59.41,22.81,1],[153.97,27.97,1],[-26.03,27.97,1],[-80.23,13.48,1],[166.33,9.49,1],[99.77,13.48,1],[35.29,-73.41,1],[13.67,-9.49,1],[-35.29,73.41,1],[-13.67,9.49,1],[-144.71,-73.41,1],[-166.33,-9.49,1],[144.71,73.41,1],[80.23,-13.48,1],[-99.77,-13.48,1],[55.43,-9,1],[-10.89,34.09,1],[-124.57,-9,1],[105.6,54.41,1],[-169.11,-34.09,1],[-105.6,-54.41,1],[169.11,34.09,1],[-74.4,54.41,1],[10.89,-34.09,1],[74.4,-54.41,1],[-55.43,9,1],[124.57,9,1],[68.32,-7.14,1],[-7.68,21.51,1],[-111.68,-7.14,1],[108.74,67.22,1],[-172.32,-21.51,1],[-108.74,-67.22,1],[172.32,21.51,1],[-71.26,67.22,1],[7.68,-21.51,1],[71.26,-67.22,1],[-68.32,7.14,1],[111.68,7.14,1],[-174.97,36.12,1],[96.85,-53.58,1],[5.03,36.12,1],[-53.77,-4.06,1],[83.15,53.58,1],[53.77,4.06,1],[-83.15,-53.58,1],[126.23,-4.06,1],[-96.85,53.58,1],[-126.23,4.06,1],[174.97,-36.12,1],[-5.03,-36.12,1],[-149.91,16.26,1],[149.81,-56.16,1],[30.09,16.26,1],[-71.37,-28.77,1],[30.19,56.16,1],[71.37,28.77,1],[-30.19,-56.16,1],[108.63,-28.77,1],[-149.81,56.16,1],[-108.63,28.77,1],[149.91,-16.26,1],[-30.09,-16.26,1],[2.52,-51.45,1],[-87.99,38.5,1],[-177.48,-51.45,1],[141.48,1.57,1],[-92.01,-38.5,1],[-141.48,-1.57,1],[92.01,38.5,1],[-38.52,1.57,1],[87.99,-38.5,1],[38.52,-1.57,1],[-2.52,51.45,1],[177.48,51.45,1],[161.12,-9.98,1],[-28.54,-68.73,1],[-18.88,-9.98,1],[-100.54,18.59,1],[-151.46,68.73,1],[100.54,-18.59,1],[151.46,-68.73,1],[79.46,18.59,1],[28.54,68.73,1],[-79.46,-18.59,1],[-161.12,9.98,1],[18.88,9.98,1],[12.84,24.97,1],[64.49,62.11,1],[-167.16,24.97,1],[64.47,11.62,1],[115.51,-62.11,1],[-64.47,-11.62,1],[-115.51,62.11,1],[-115.53,11.62,1],[-64.49,-62.11,1],[115.53,-11.62,1],[-12.84,-24.97,1],[167.16,-24.97,1],[74.13,41.65,1],[42.76,11.79,1],[-105.87,41.65,1],[17.09,45.95,1],[137.24,-11.79,1],[-17.09,-45.95,1],[-137.24,11.79,1],[-162.91,45.95,1],[-42.76,-11.79,1],[162.91,-45.95,1],[-74.13,-41.65,1],[105.87,-41.65,1],[154.04,1.27,1],[2.9,-64.01,1],[-25.96,1.27,1],[-88.59,25.96,1],[177.1,64.01,1],[88.59,-25.96,1],[-177.1,-64.01,1],[91.41,25.96,1],[-2.9,64.01,1],[-91.41,-25.96,1],[-154.04,-1.27,1],[25.96,-1.27,1]],[[24.8,-10.46,1],[-23.76,63.21,1],[-155.2,-10.46,1],[101.5,24.36,1],[-156.24,-63.21,1],[-101.5,-24.36,1],[156.24,63.21,1],[-78.5,24.36,1],[23.76,-63.21,1],[78.5,-24.36,1],[-24.8,10.46,1],[155.2,10.46,1],[-134.64,65.44,1],[108.01,-16.98,1],[45.36,65.44,1],[-17.8,-17.2,1],[71.99,16.98,1],[17.8,17.2,1],[-71.99,-16.98,1],[162.2,-17.2,1],[-108.01,16.98,1],[-162.2,17.2,1],[134.64,-65.44,1],[-45.36,-65.44,1],[177.6,54.85,1],[88.31,-35.12,1],[-2.4,54.85,1],[-35.13,1.38,1],[91.69,35.12,1],[35.13,-1.38,1],[-91.69,-35.12,1],[144.87,1.38,1],[-88.31,35.12,1],[-144.87,-1.38,1],[-177.6,-54.85,1],[2.4,-54.85,1],[157.93,82.01,1],[86.98,-7.4,1],[-22.07,82.01,1],[-7.41,2.99,1],[93.02,7.4,1],[7.41,-2.99,1],[-93.02,-7.4,1],[172.59,2.99,1],[-86.98,7.4,1],[-172.59,-2.99,1],[-157.93,-82.01,1],[22.07,-82.01,1],[42.48,-13.21,1],[-19.17,45.89,1],[-137.52,-13.21,1],[107.66,41.11,1],[-160.83,-45.89,1],[-107.66,-41.11,1],[160.83,45.89,1],[-72.34,41.11,1],[19.17,-45.89,1],[72.34,-41.11,1],[-42.48,13.21,1],[137.52,13.21,1],[28.48,10.9,1],[21.99,59.68,1],[-151.52,10.9,1],[77.65,27.92,1],[158.01,-59.68,1],[-77.65,-27.92,1],[-158.01,59.68,1],[-102.35,27.92,1],[-21.99,-59.68,1],[102.35,-27.92,1],[-28.48,-10.9,1],[151.52,-10.9,1],[-33.79,21.61,1],[144.53,50.59,1],[146.21,21.61,1],[64.51,-31.14,1],[35.47,-50.59,1],[-64.51,31.14,1],[-35.47,50.59,1],[-115.49,-31.14,1],[-144.53,-50.59,1],[115.49,31.14,1],[33.79,-21.61,1],[-146.21,-21.61,1],[-175.53,-31.74,1],[-97.19,-57.98,1],[4.47,-31.74,1],[-121.82,-3.8,1],[-82.81,57.98,1],[121.82,3.8,1],[82.81,-57.98,1],[58.18,-3.8,1],[97.19,57.98,1],[-58.18,3.8,1],[175.53,31.74,1],[-4.47,31.74,1],[89.4,19.43,1],[19.43,.56,1],[-90.6,19.43,1],[1.69,70.56,1],[160.57,-.56,1],[-1.69,-70.56,1],[-160.57,.56,1],[-178.31,70.56,1],[-19.43,-.56,1],[178.31,-70.56,1],[-89.4,-19.43,1],[90.6,-19.43,1],[-27.28,-27.88,1],[-130.91,51.78,1],[152.72,-27.88,1],[120.76,-23.9,1],[-49.09,-51.78,1],[-120.76,23.9,1],[49.09,51.78,1],[-59.24,-23.9,1],[130.91,-51.78,1],[59.24,23.9,1],[27.28,27.88,1],[-152.72,27.88,1],[139.9,-15.44,1],[-23.21,-47.5,1],[-40.1,-15.44,1],[-109.85,38.38,1],[-156.79,47.5,1],[109.85,-38.38,1],[156.79,-47.5,1],[70.15,38.38,1],[23.21,47.5,1],[-70.15,-38.38,1],[-139.9,15.44,1],[40.1,15.44,1],[-2.17,-43.33,1],[-92.29,46.62,1],[177.83,-43.33,1],[133.35,-1.58,1],[-87.71,-46.62,1],[-133.35,1.58,1],[87.71,46.62,1],[-46.65,-1.58,1],[92.29,-46.62,1],[46.65,1.58,1],[2.17,43.33,1],[-177.83,43.33,1],[41.12,27.96,1],[38.91,41.71,1],[-138.88,27.96,1],[54.83,35.51,1],[141.09,-41.71,1],[-54.83,-35.51,1],[-141.09,41.71,1],[-125.17,35.51,1],[-38.91,-41.71,1],[125.17,-35.51,1],[-41.12,-27.96,1],[138.88,-27.96,1],[-126.67,13.75,1],[163.04,-35.46,1],[53.33,13.75,1],[-67.73,-51.18,1],[16.96,35.46,1],[67.73,51.18,1],[-16.96,-35.46,1],[112.27,-51.18,1],[-163.04,35.46,1],[-112.27,51.18,1],[126.67,-13.75,1],[-53.33,-13.75,1],[6.02,-15.42,1],[-69.18,73.47,1],[-173.98,-15.42,1],[105.51,5.8,1],[-110.82,-73.47,1],[-105.51,-5.8,1],[110.82,73.47,1],[-74.49,5.8,1],[69.18,-73.47,1],[74.49,-5.8,1],[-6.02,15.42,1],[173.98,15.42,1],[160.08,33.45,1],[62.71,-51.67,1],[-19.92,33.45,1],[-54.9,16.52,1],[117.29,51.67,1],[54.9,-16.52,1],[-117.29,-51.67,1],[125.1,16.52,1],[-62.71,51.67,1],[-125.1,-16.52,1],[-160.08,-33.45,1],[19.92,-33.45,1],[80.34,6.51,1],[6.61,9.59,1],[-99.66,6.51,1],[55.76,78.37,1],[173.39,-9.59,1],[-55.76,-78.37,1],[-173.39,9.59,1],[-124.24,78.37,1],[-6.61,-9.59,1],[124.24,-78.37,1],[-80.34,-6.51,1],[99.66,-6.51,1],[6.25,24.64,1],[76.64,64.63,1],[-173.75,24.64,1],[65.23,5.68,1],[103.36,-64.63,1],[-65.23,-5.68,1],[-103.36,64.63,1],[-114.77,5.68,1],[-76.64,-64.63,1],[114.77,-5.68,1],[-6.25,-24.64,1],[173.75,-24.64,1],[51.41,-63.45,1],[-68.67,16.19,1],[-128.59,-63.45,1],[162.69,20.45,1],[-111.33,-16.19,1],[-162.69,-20.45,1],[111.33,16.19,1],[-17.31,20.45,1],[68.67,-16.19,1],[17.31,-20.45,1],[-51.41,63.45,1],[128.59,63.45,1],[-50.6,28.85,1],[144.51,33.77,1],[129.4,28.85,1],[49.04,-42.6,1],[35.49,-33.77,1],[-49.04,42.6,1],[-35.49,33.77,1],[-130.96,-42.6,1],[-144.51,-33.77,1],[130.96,42.6,1],[50.6,-28.85,1],[-129.4,-28.85,1]]][e-1]}Object.defineProperty(r,"__esModule",{value:!0}),r.deg2rad=n,r.rad2deg=i,r.getColumn=a,r.sampleCircle=o,r.getCircHarmonics=s,r.getAmbisonicDecMtx=u,r.createNearestLookup=c,r.findNearest=f,r.getTdesign=h;var l=e("numeric"),d=e("spherical-harmonic-transform"),m=e("convex-hull"),p=function(e,t,r,n){for(var i=e.length,a=n,o=t.length,s=new Array(i),u=d.convertSph2Cart(e),c=0;c<i;c++){var f=u[c],h=new Array(a);h.fill(0);for(var m=0;m<o;m++){var p=[],v=[r[m][0],r[m][1],r[m][2]];if(p[0]=l.dotVV(v,f),v=[r[m][3],r[m][4],r[m][5]],p[1]=l.dotVV(v,f),v=[r[m][6],r[m][7],r[m][8]],p[2]=l.dotVV(v,f),function(e){return Math.min.apply(null,e)}(p)>-.001){for(var g=Math.sqrt(l.sum(l.pow(p,2))),y=l.div(p,g),b=0;b<3;b++)h[t[m][b]]=y[b];break}}var M=Math.sqrt(l.sum(l.pow(h,2))),x=l.div(h,M);s[c]=x}return s}
;t.exports.getAmbisonicDecMtx=u,t.exports.getTdesign=h,t.exports.deg2rad=n,t.exports.rad2deg=i,t.exports.createNearestLookup=c,t.exports.findNearest=f},{"convex-hull":31,numeric:65,"spherical-harmonic-transform":83}],26:[function(e,t,r){"use strict";function n(e,t){for(var r=new Array(t+1),n=0;n<e.length;++n)r[n]=e[n];for(var n=0;n<=e.length;++n){for(var i=e.length;i<=t;++i){for(var o=new Array(t),s=0;s<t;++s)o[s]=Math.pow(i+1-n,s);r[i]=o}if(a.apply(void 0,r))return!0}return!1}function i(e){var t=e.length;if(0===t)return[];if(1===t)return[0];for(var r=e[0].length,i=[e[0]],a=[0],o=1;o<t;++o)if(i.push(e[o]),n(i,r)){if(a.push(o),a.length===r+1)return a}else i.pop();return a}t.exports=i;var a=e("robust-orientation")},{"robust-orientation":66}],27:[function(e,t,r){t.exports={default:e("core-js/library/fn/object/define-property"),__esModule:!0}},{"core-js/library/fn/object/define-property":35}],28:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},{}],29:[function(e,t,r){"use strict";r.__esModule=!0;var n=e("../core-js/object/define-property"),i=function(e){return e&&e.__esModule?e:{default:e}}(n);r.default=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),(0,i.default)(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}()},{"../core-js/object/define-property":27}],30:[function(e,t,r){"use strict";"use restrict";function n(e){var t=32;return e&=-e,e&&t--,65535&e&&(t-=16),16711935&e&&(t-=8),252645135&e&&(t-=4),858993459&e&&(t-=2),1431655765&e&&(t-=1),t}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(e){return(e>0)-(e<0)},r.abs=function(e){var t=e>>31;return(e^t)-t},r.min=function(e,t){return t^(e^t)&-(e<t)},r.max=function(e,t){return e^(e^t)&-(e<t)},r.isPow2=function(e){return!(e&e-1||!e)},r.log2=function(e){var t,r;return t=(e>65535)<<4,e>>>=t,r=(e>255)<<3,e>>>=r,t|=r,r=(e>15)<<2,e>>>=r,t|=r,r=(e>3)<<1,e>>>=r,(t|=r)|e>>1},r.log10=function(e){return e>=1e9?9:e>=1e8?8:e>=1e7?7:e>=1e6?6:e>=1e5?5:e>=1e4?4:e>=1e3?3:e>=100?2:e>=10?1:0},r.popCount=function(e){return e-=e>>>1&1431655765,16843009*((e=(858993459&e)+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(e){return e+=0===e,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)+1},r.prevPow2=function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},r.parity=function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1};var i=new Array(256);!function(e){for(var t=0;t<256;++t){var r=t,n=t,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;e[t]=n<<i&255}}(i),r.reverse=function(e){return i[255&e]<<24|i[e>>>8&255]<<16|i[e>>>16&255]<<8|i[e>>>24&255]},r.interleave2=function(e,t){return e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1},r.deinterleave2=function(e,t){return e=e>>>t&1431655765,e=858993459&(e|e>>>1),e=252645135&(e|e>>>2),e=16711935&(e|e>>>4),(e=65535&(e|e>>>16))<<16>>16},r.interleave3=function(e,t,r){return e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e|=t<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),e|r<<2},r.deinterleave3=function(e,t){return e=e>>>t&1227133513,e=3272356035&(e|e>>>2),e=251719695&(e|e>>>4),e=4278190335&(e|e>>>8),(e=1023&(e|e>>>16))<<22>>22},r.nextCombination=function(e){var t=e|e-1;return t+1|(~t&-~t)-1>>>n(e)+1}},{}],31:[function(e,t,r){"use strict";function n(e){var t=e.length;if(0===t)return[];if(1===t)return[[0]];var r=e[0].length;return 0===r?[]:1===r?i(e):2===r?a(e):o(e,r)}var i=e("./lib/ch1d"),a=e("./lib/ch2d"),o=e("./lib/chnd");t.exports=n},{"./lib/ch1d":32,"./lib/ch2d":33,"./lib/chnd":34}],32:[function(e,t,r){"use strict";function n(e){for(var t=0,r=0,n=1;n<e.length;++n)e[n][0]<e[t][0]&&(t=n),e[n][0]>e[r][0]&&(r=n);return t<r?[[t],[r]]:t>r?[[r],[t]]:[[t]]}t.exports=n},{}],33:[function(e,t,r){"use strict";function n(e){var t=i(e),r=t.length;if(r<=2)return[];for(var n=new Array(r),a=t[r-1],o=0;o<r;++o){var s=t[o];n[o]=[a,s],a=s}return n}t.exports=n;var i=e("monotone-convex-hull-2d")},{"monotone-convex-hull-2d":64}],34:[function(e,t,r){"use strict";function n(e,t){for(var r=e.length,n=new Array(r),i=0;i<t.length;++i)n[i]=e[t[i]];for(var a=t.length,i=0;i<r;++i)t.indexOf(i)<0&&(n[a++]=e[i]);return n}function i(e,t){for(var r=e.length,n=t.length,i=0;i<r;++i)for(var a=e[i],o=0;o<a.length;++o){var s=a[o];if(s<n)a[o]=t[s];else{s-=n;for(var u=0;u<n;++u)s>=t[u]&&(s+=1);a[o]=s}}return e}function a(e,t){try{return o(e,!0)}catch(c){var r=s(e);if(r.length<=t)return[];var a=n(e,r),u=o(a,!0);return i(u,r)}}t.exports=a;var o=e("incremental-convex-hull"),s=e("affine-hull")},{"affine-hull":26,"incremental-convex-hull":62}],35:[function(e,t,r){e("../../modules/es6.object.define-property");var n=e("../../modules/_core").Object;t.exports=function(e,t,r){return n.defineProperty(e,t,r)}},{"../../modules/_core":38,"../../modules/es6.object.define-property":52}],36:[function(e,t,r){t.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},{}],37:[function(e,t,r){var n=e("./_is-object");t.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},{"./_is-object":48}],38:[function(e,t,r){var n=t.exports={version:"2.6.10"};"number"==typeof __e&&(__e=n)},{}],39:[function(e,t,r){var n=e("./_a-function");t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{"./_a-function":36}],40:[function(e,t,r){t.exports=!e("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":43}],41:[function(e,t,r){var n=e("./_is-object"),i=e("./_global").document,a=n(i)&&n(i.createElement);t.exports=function(e){return a?i.createElement(e):{}}},{"./_global":44,"./_is-object":48}],42:[function(e,t,r){var n=e("./_global"),i=e("./_core"),a=e("./_ctx"),o=e("./_hide"),s=e("./_has"),u=function(e,t,r){var c,f,h,l=e&u.F,d=e&u.G,m=e&u.S,p=e&u.P,v=e&u.B,g=e&u.W,y=d?i:i[t]||(i[t]={}),b=y.prototype,M=d?n:m?n[t]:(n[t]||{}).prototype;d&&(r=t);for(c in r)(f=!l&&M&&void 0!==M[c])&&s(y,c)||(h=f?M[c]:r[c],y[c]=d&&"function"!=typeof M[c]?r[c]:v&&f?a(h,n):g&&M[c]==h?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(h):p&&"function"==typeof h?a(Function.call,h):h,p&&((y.virtual||(y.virtual={}))[c]=h,e&u.R&&b&&!b[c]&&o(b,c,h)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},{"./_core":38,"./_ctx":39,"./_global":44,"./_has":45,"./_hide":46}],43:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(e){return!0}}},{}],44:[function(e,t,r){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},{}],45:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],46:[function(e,t,r){var n=e("./_object-dp"),i=e("./_property-desc");t.exports=e("./_descriptors")?function(e,t,r){return n.f(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},{"./_descriptors":40,"./_object-dp":49,"./_property-desc":50}],47:[function(e,t,r){t.exports=!e("./_descriptors")&&!e("./_fails")(function(){return 7!=Object.defineProperty(e("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":40,"./_dom-create":41,"./_fails":43}],48:[function(e,t,r){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],49:[function(e,t,r){var n=e("./_an-object"),i=e("./_ie8-dom-define"),a=e("./_to-primitive"),o=Object.defineProperty;r.f=e("./_descriptors")?Object.defineProperty:function(e,t,r){if(n(e),t=a(t,!0),n(r),i)try{return o(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},{"./_an-object":37,"./_descriptors":40,"./_ie8-dom-define":47,"./_to-primitive":51}],50:[function(e,t,r){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],51:[function(e,t,r){var n=e("./_is-object");t.exports=function(e,t){if(!n(e))return e;var r,i;if(t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;if("function"==typeof(r=e.valueOf)&&!n(i=r.call(e)))return i;if(!t&&"function"==typeof(r=e.toString)&&!n(i=r.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":48}],52:[function(e,t,r){var n=e("./_export");n(n.S+n.F*!e("./_descriptors"),"Object",{defineProperty:e("./_object-dp").f})},{"./_descriptors":40,"./_export":42,"./_object-dp":49}],53:[function(e,t,r){"use strict";var n=e("babel-runtime/helpers/create-class").default,i=e("babel-runtime/helpers/class-call-check").default;Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(t,r){i(this,e),this.delayTime=0,this.posRead=0,this.posWrite=0,this.fracXi1=0,this.fracYi1=0,this.intDelay=0,this.fracDelay=0,this.a1=void 0,this.sampleRate=t,this.maxDelayTime=r||1,this.bufferSize=this.maxDelayTime*this.sampleRate,this.bufferSize%1!=0&&(this.bufferSize=parseInt(this.bufferSize)+1),this.buffer=new Float32Array(this.bufferSize)}return n(e,[{key:"setDelay",value:function(e){if(!(e<this.maxDelayTime))throw new Error("delayTime > maxDelayTime");this.delayTime=e;var t=e*this.sampleRate;this.intDelay=parseInt(t),this.fracDelay=t-this.intDelay,this.resample(),0!==this.fracDelay&&this.updateThiranCoefficient()}},{key:"getDelay",value:function(){return this.delayTime}},{key:"process",value:function(e){for(var t=new Float32Array(e.length),r=0;r<e.length;r+=1)this.buffer[this.posWrite]=e[r],t[r]=this.buffer[this.posRead],this.updatePointers();return 0===this.fracDelay?t:t=new Float32Array(this.fractionalThiranProcess(t))}},{key:"updatePointers",value:function(){this.posWrite===this.buffer.length-1?this.posWrite=0:this.posWrite=this.posWrite+1,this.posRead===this.buffer.length-1?this.posRead=0:this.posRead=this.posRead+1}},{key:"updateThiranCoefficient",value:function(){this.a1=(1-this.fracDelay)/(1+this.fracDelay)}},{key:"resample",value:function(){if(this.posWrite-this.intDelay<0){var e=this.intDelay-this.posWrite;this.posRead=this.buffer.length-e}else this.posRead=this.posWrite-this.intDelay}},{key:"fractionalThiranProcess",value:function(e){for(var t,r,n=new Float32Array(e.length),i=this.fracXi1,a=this.fracYi1,o=0;o<e.length;o+=1)t=e[o],r=this.a1*t+i-this.a1*a,i=t,a=r,n[o]=r;return this.fracXi1=i,this.fracYi1=a,n}}]),e}();r.default=a,t.exports=r.default},{"babel-runtime/helpers/class-call-check":56,"babel-runtime/helpers/create-class":57}],54:[function(e,t,r){t.exports=e("./dist/fractional-delay")},{"./dist/fractional-delay":53}],55:[function(e,t,r){arguments[4][27][0].apply(r,arguments)},{"core-js/library/fn/object/define-property":58,dup:27}],56:[function(e,t,r){"use strict";r.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r.__esModule=!0},{}],57:[function(e,t,r){"use strict";var n=e("babel-runtime/core-js/object/define-property").default;r.default=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),n(e,i.key,i)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),r.__esModule=!0},{"babel-runtime/core-js/object/define-property":55}],58:[function(e,t,r){var n=e("../../modules/$");t.exports=function(e,t,r){return n.setDesc(e,t,r)}},{"../../modules/$":59}],59:[function(e,t,r){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},{}],60:[function(e,t,r){(function(e){"use strict";if(e.AnalyserNode&&!e.AnalyserNode.prototype.getFloatTimeDomainData){var t=new Uint8Array(2048);e.AnalyserNode.prototype.getFloatTimeDomainData=function(e){this.getByteTimeDomainData(t);for(var r=0,n=e.length;r<n;r++)e[r]=.0078125*(t[r]-128)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],61:[function(e,t,r){!function(e,n){if("object"==typeof r&&"object"==typeof t)t.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var i=n();for(var a in i)("object"==typeof r?r:e)[a]=i[a]}}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)t.d(n,i,function(t){return e[t]}.bind(null,i));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=10)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setMatrixArrayType=function(e){t.ARRAY_TYPE=e},t.toRadian=function(e){return e*i},t.equals=function(e,t){return Math.abs(e-t)<=n*Math.max(1,Math.abs(e),Math.abs(t))};var n=t.EPSILON=1e-6;t.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,t.RANDOM=Math.random;var i=Math.PI/180},function(e,t,r){"use strict";function n(){var e=new h.ARRAY_TYPE(4);return h.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function i(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function a(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function o(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function s(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(r*r+n*n+i*i+a*a)}function u(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return r*r+n*n+i*i+a*a}function c(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function f(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}Object.defineProperty(t,"__esModule",{value:!0}),t.forEach=t.sqrLen=t.len=t.sqrDist=t.dist=t.div=t.mul=t.sub=void 0,t.create=n,t.clone=function(e){var t=new h.ARRAY_TYPE(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},t.fromValues=function(e,t,r,n){var i=new h.ARRAY_TYPE(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},t.set=function(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e},t.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},t.subtract=i,t.multiply=a,t.divide=o,t.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},t.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},t.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e},t.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e},t.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e},t.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},t.scaleAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e},t.distance=s,t.squaredDistance=u,t.length=c,t.squaredLength=f,t.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},t.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},t.normalize=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o),e},t.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},t.lerp=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e[3]=s+n*(r[3]-s),e},t.random=function(e,t){var r,n,i,a,o,s;t=t||1;do{r=2*h.RANDOM()-1,n=2*h.RANDOM()-1,o=r*r+n*n}while(o>=1);do{i=2*h.RANDOM()-1,a=2*h.RANDOM()-1,s=i*i+a*a}while(s>=1);var u=Math.sqrt((1-o)/s);return e[0]=t*r,e[1]=t*n,e[2]=t*i*u,e[3]=t*a*u,e},t.transformMat4=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e},t.transformQuat=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],f=c*n+s*a-u*i,h=c*i+u*n-o*a,l=c*a+o*i-s*n,d=-o*n-s*i-u*a;return e[0]=f*c+d*-o+h*-u-l*-s,e[1]=h*c+d*-s+l*-o-f*-u,e[2]=l*c+d*-u+f*-s-h*-o,e[3]=t[3],e},t.str=function(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},t.equals=function(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],o=t[0],s=t[1],u=t[2],c=t[3];return Math.abs(r-o)<=h.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=h.EPSILON*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=h.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=h.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))};var h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));t.sub=i,t.mul=a,t.div=o,t.dist=s,t.sqrDist=u,t.len=c,t.sqrLen=f,t.forEach=function(){var e=n();return function(t,r,n,i,a,o){var s=void 0,u=void 0;for(r||(r=4),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}}()},function(e,t,r){"use strict";function n(){var e=new m.ARRAY_TYPE(3);return m.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function i(e){var t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function a(e,t,r){var n=new m.ARRAY_TYPE(3);return n[0]=e,n[1]=t,n[2]=r,n}function o(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function s(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function u(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function c(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)}function f(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i}function h(e){var t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function l(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e}function d(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}Object.defineProperty(t,"__esModule",{value:!0}),t.forEach=t.sqrLen=t.len=t.sqrDist=t.dist=t.div=t.mul=t.sub=void 0,t.create=n,t.clone=function(e){var t=new m.ARRAY_TYPE(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},t.length=i,t.fromValues=a,t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.set=function(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e},t.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e},t.subtract=o,t.multiply=s,t.divide=u,t.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},t.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},t.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e},t.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e},t.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},t.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e},t.scaleAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e},t.distance=c,t.squaredDistance=f,t.squaredLength=h,t.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},t.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},t.normalize=l,t.dot=d,t.cross=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e},t.lerp=function(e,t,r,n){var i=t[0],a=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e},t.hermite=function(e,t,r,n,i,a){var o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,c=o*(a-1),f=o*(3-2*a);return e[0]=t[0]*s+r[0]*u+n[0]*c+i[0]*f,e[1]=t[1]*s+r[1]*u+n[1]*c+i[1]*f,e[2]=t[2]*s+r[2]*u+n[2]*c+i[2]*f,e},t.bezier=function(e,t,r,n,i,a){var o=1-a,s=o*o,u=a*a,c=s*o,f=3*a*s,h=3*u*o,l=u*a;return e[0]=t[0]*c+r[0]*f+n[0]*h+i[0]*l,e[1]=t[1]*c+r[1]*f+n[1]*h+i[1]*l,e[2]=t[2]*c+r[2]*f+n[2]*h+i[2]*l,e},t.random=function(e,t){t=t||1;var r=2*m.RANDOM()*Math.PI,n=2*m.RANDOM()-1,i=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*i,e[1]=Math.sin(r)*i,e[2]=n*t,e},t.transformMat4=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[3]*n+r[7]*i+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/o,e},t.transformMat3=function(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e},t.transformQuat=function(e,t,r){var n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],f=i*c-a*u,h=a*s-n*c,l=n*u-i*s,d=i*l-a*h,m=a*f-n*l,p=n*h-i*f,v=2*o;return f*=v,h*=v,l*=v,d*=2,m*=2,p*=2,e[0]=s+f+d,e[1]=u+h+m,e[2]=c+l+p,e},t.rotateX=function(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},t.rotateY=function(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},t.rotateZ=function(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},t.angle=function(e,t){var r=a(e[0],e[1],e[2]),n=a(t[0],t[1],t[2]);l(r,r),l(n,n);var i=d(r,n);return i>1?0:i<-1?Math.PI:Math.acos(i)},t.str=function(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},t.equals=function(e,t){var r=e[0],n=e[1],i=e[2],a=t[0],o=t[1],s=t[2];return Math.abs(r-a)<=m.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-o)<=m.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-s)<=m.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))};var m=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));t.sub=o,t.mul=s,t.div=u,t.dist=c,t.sqrDist=f,t.len=i,t.sqrLen=h,t.forEach=function(){var e=n();return function(t,r,n,i,a,o){var s=void 0,u=void 0;for(r||(r=3),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],a(e,e,o),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}}()},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(){var e=new c.ARRAY_TYPE(4);return c.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function a(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function o(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],f=r[3];return e[0]=n*f+o*s+i*c-a*u,e[1]=i*f+o*u+a*s-n*c,e[2]=a*f+o*c+n*u-i*s,e[3]=o*f-n*s-i*u-a*c,e}function s(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3],u=r[0],f=r[1],h=r[2],l=r[3],d=void 0,m=void 0,p=void 0,v=void 0,g=void 0;return(m=i*u+a*f+o*h+s*l)<0&&(m=-m,u=-u,f=-f,h=-h,l=-l),1-m>c.EPSILON?(d=Math.acos(m),p=Math.sin(d),v=Math.sin((1-n)*d)/p,g=Math.sin(n*d)/p):(v=1-n,g=n),e[0]=v*i+g*u,e[1]=v*a+g*f,e[2]=v*o+g*h,e[3]=v*s+g*l,e}function u(e,t){var r=t[0]+t[4]+t[8],n=void 0;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;n=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*n,n=.5/n,e[3]=(t[3*a+o]-t[3*o+a])*n,e[a]=(t[3*a+i]+t[3*i+a])*n,e[o]=(t[3*o+i]+t[3*i+o])*n}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.setAxes=t.sqlerp=t.rotationTo=t.equals=t.exactEquals=t.normalize=t.sqrLen=t.squaredLength=t.len=t.length=t.lerp=t.dot=t.scale=t.mul=t.add=t.set=t.copy=t.fromValues=t.clone=void 0,t.create=i,t.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},t.setAxisAngle=a,t.getAxisAngle=function(e,t){var r=2*Math.acos(t[3]),n=Math.sin(r/2);return n>c.EPSILON?(e[0]=t[0]/n,e[1]=t[1]/n,e[2]=t[2]/n):(e[0]=1,e[1]=0,e[2]=0),r},t.multiply=o,t.rotateX=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s,e},t.rotateY=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s,e},t.rotateZ=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s,e},t.calculateW=function(e,t){var r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e},t.slerp=s,t.random=function(e){var t=c.RANDOM(),r=c.RANDOM(),n=c.RANDOM(),i=Math.sqrt(1-t),a=Math.sqrt(t);return e[0]=i*Math.sin(2*Math.PI*r),e[1]=i*Math.cos(2*Math.PI*r),e[2]=a*Math.sin(2*Math.PI*n),e[3]=a*Math.cos(2*Math.PI*n),e},t.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e},t.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},t.fromMat3=u,t.fromEuler=function(e,t,r,n){var i=.5*Math.PI/180;t*=i,r*=i,n*=i;var a=Math.sin(t),o=Math.cos(t),s=Math.sin(r),u=Math.cos(r),c=Math.sin(n),f=Math.cos(n);return e[0]=a*u*f-o*s*c,e[1]=o*s*f+a*u*c,e[2]=o*u*c-a*s*f,e[3]=o*u*f+a*s*c,e},t.str=function(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"};var c=n(r(0)),f=n(r(5)),h=n(r(2)),l=n(r(1));t.clone=l.clone,t.fromValues=l.fromValues,t.copy=l.copy,t.set=l.set,t.add=l.add,t.mul=o,t.scale=l.scale,t.dot=l.dot,t.lerp=l.lerp;var d=t.length=l.length,m=(t.len=d,t.squaredLength=l.squaredLength),p=(t.sqrLen=m,t.normalize=l.normalize);t.exactEquals=l.exactEquals,t.equals=l.equals,t.rotationTo=function(){var e=h.create(),t=h.fromValues(1,0,0),r=h.fromValues(0,1,0);return function(n,i,o){var s=h.dot(i,o);return s<-.999999?(h.cross(e,t,i),h.len(e)<1e-6&&h.cross(e,r,i),h.normalize(e,e),a(n,e,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(h.cross(e,i,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+s,p(n,n))}}(),t.sqlerp=function(){var e=i(),t=i();return function(r,n,i,a,o,u){return s(e,n,o,u),s(t,i,a,u),s(r,e,t,2*u*(1-u)),r}}(),t.setAxes=function(){var e=f.create();return function(t,r,n,i){return e[0]=n[0],e[3]=n[1],e[6]=n[2],e[1]=i[0],e[4]=i[1],e[7]=i[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],p(t,u(t,e))}}()},function(e,t,r){"use strict";function n(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function i(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],f=t[7],h=t[8],l=t[9],d=t[10],m=t[11],p=t[12],v=t[13],g=t[14],y=t[15],b=r[0],M=r[1],x=r[2],w=r[3];return e[0]=b*n+M*s+x*h+w*p,e[1]=b*i+M*u+x*l+w*v,e[2]=b*a+M*c+x*d+w*g,e[3]=b*o+M*f+x*m+w*y,b=r[4],M=r[5],x=r[6],w=r[7],e[4]=b*n+M*s+x*h+w*p,e[5]=b*i+M*u+x*l+w*v,e[6]=b*a+M*c+x*d+w*g,e[7]=b*o+M*f+x*m+w*y,b=r[8],M=r[9],x=r[10],w=r[11],e[8]=b*n+M*s+x*h+w*p,e[9]=b*i+M*u+x*l+w*v,e[10]=b*a+M*c+x*d+w*g,e[11]=b*o+M*f+x*m+w*y,b=r[12],M=r[13],x=r[14],w=r[15],e[12]=b*n+M*s+x*h+w*p,e[13]=b*i+M*u+x*l+w*v,e[14]=b*a+M*c+x*d+w*g,e[15]=b*o+M*f+x*m+w*y,e}function a(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=n+n,u=i+i,c=a+a,f=n*s,h=n*u,l=n*c,d=i*u,m=i*c,p=a*c,v=o*s,g=o*u,y=o*c;return e[0]=1-(d+p),e[1]=h+y,e[2]=l-g,e[3]=0,e[4]=h-y,e[5]=1-(f+p),e[6]=m+v,e[7]=0,e[8]=l+g,e[9]=m-v,e[10]=1-(f+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function o(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}Object.defineProperty(t,"__esModule",{value:!0}),t.sub=t.mul=void 0,t.create=function(){var e=new s.ARRAY_TYPE(16);return s.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e},t.clone=function(e){var t=new s.ARRAY_TYPE(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.fromValues=function(e,t,r,n,i,a,o,u,c,f,h,l,d,m,p,v){var g=new s.ARRAY_TYPE(16);return g[0]=e,g[1]=t,g[2]=r,g[3]=n,g[4]=i,g[5]=a,g[6]=o,g[7]=u,g[8]=c,g[9]=f,g[10]=h,g[11]=l,g[12]=d,g[13]=m,g[14]=p,g[15]=v,g},t.set=function(e,t,r,n,i,a,o,s,u,c,f,h,l,d,m,p,v){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,e[5]=o,e[6]=s,e[7]=u,e[8]=c,e[9]=f,e[10]=h,e[11]=l,e[12]=d,e[13]=m,e[14]=p,e[15]=v,e},t.identity=n,t.transpose=function(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=a,e[11]=t[14],e[12]=i,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},t.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],f=t[8],h=t[9],l=t[10],d=t[11],m=t[12],p=t[13],v=t[14],g=t[15],y=r*s-n*o,b=r*u-i*o,M=r*c-a*o,x=n*u-i*s,w=n*c-a*s,_=i*c-a*u,S=f*p-h*m,C=f*v-l*m,P=f*g-d*m,A=h*v-l*p,k=h*g-d*p,j=l*g-d*v,T=y*j-b*k+M*A+x*P-w*C+_*S;return T?(T=1/T,e[0]=(s*j-u*k+c*A)*T,e[1]=(i*k-n*j-a*A)*T,e[2]=(p*_-v*w+g*x)*T,e[3]=(l*w-h*_-d*x)*T,e[4]=(u*P-o*j-c*C)*T,e[5]=(r*j-i*P+a*C)*T,e[6]=(v*M-m*_-g*b)*T,e[7]=(f*_-l*M+d*b)*T,e[8]=(o*k-s*P+c*S)*T,e[9]=(n*P-r*k-a*S)*T,e[10]=(m*w-p*M+g*y)*T,e[11]=(h*M-f*w-d*y)*T,e[12]=(s*C-o*A-u*S)*T,e[13]=(r*A-n*C+i*S)*T,e[14]=(p*b-m*x-v*y)*T,e[15]=(f*x-h*b+l*y)*T,e):null},t.adjoint=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],f=t[8],h=t[9],l=t[10],d=t[11],m=t[12],p=t[13],v=t[14],g=t[15];return e[0]=s*(l*g-d*v)-h*(u*g-c*v)+p*(u*d-c*l),e[1]=-(n*(l*g-d*v)-h*(i*g-a*v)+p*(i*d-a*l)),e[2]=n*(u*g-c*v)-s*(i*g-a*v)+p*(i*c-a*u),e[3]=-(n*(u*d-c*l)-s*(i*d-a*l)+h*(i*c-a*u)),e[4]=-(o*(l*g-d*v)-f*(u*g-c*v)+m*(u*d-c*l)),
e[5]=r*(l*g-d*v)-f*(i*g-a*v)+m*(i*d-a*l),e[6]=-(r*(u*g-c*v)-o*(i*g-a*v)+m*(i*c-a*u)),e[7]=r*(u*d-c*l)-o*(i*d-a*l)+f*(i*c-a*u),e[8]=o*(h*g-d*p)-f*(s*g-c*p)+m*(s*d-c*h),e[9]=-(r*(h*g-d*p)-f*(n*g-a*p)+m*(n*d-a*h)),e[10]=r*(s*g-c*p)-o*(n*g-a*p)+m*(n*c-a*s),e[11]=-(r*(s*d-c*h)-o*(n*d-a*h)+f*(n*c-a*s)),e[12]=-(o*(h*v-l*p)-f*(s*v-u*p)+m*(s*l-u*h)),e[13]=r*(h*v-l*p)-f*(n*v-i*p)+m*(n*l-i*h),e[14]=-(r*(s*v-u*p)-o*(n*v-i*p)+m*(n*u-i*s)),e[15]=r*(s*l-u*h)-o*(n*l-i*h)+f*(n*u-i*s),e},t.determinant=function(e){var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],f=e[9],h=e[10],l=e[11],d=e[12],m=e[13],p=e[14],v=e[15];return(t*o-r*a)*(h*v-l*p)-(t*s-n*a)*(f*v-l*m)+(t*u-i*a)*(f*p-h*m)+(r*s-n*o)*(c*v-l*d)-(r*u-i*o)*(c*p-h*d)+(n*u-i*s)*(c*m-f*d)},t.multiply=i,t.translate=function(e,t,r){var n=r[0],i=r[1],a=r[2],o=void 0,s=void 0,u=void 0,c=void 0,f=void 0,h=void 0,l=void 0,d=void 0,m=void 0,p=void 0,v=void 0,g=void 0;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*a+t[12],e[13]=t[1]*n+t[5]*i+t[9]*a+t[13],e[14]=t[2]*n+t[6]*i+t[10]*a+t[14],e[15]=t[3]*n+t[7]*i+t[11]*a+t[15]):(o=t[0],s=t[1],u=t[2],c=t[3],f=t[4],h=t[5],l=t[6],d=t[7],m=t[8],p=t[9],v=t[10],g=t[11],e[0]=o,e[1]=s,e[2]=u,e[3]=c,e[4]=f,e[5]=h,e[6]=l,e[7]=d,e[8]=m,e[9]=p,e[10]=v,e[11]=g,e[12]=o*n+f*i+m*a+t[12],e[13]=s*n+h*i+p*a+t[13],e[14]=u*n+l*i+v*a+t[14],e[15]=c*n+d*i+g*a+t[15]),e},t.scale=function(e,t,r){var n=r[0],i=r[1],a=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.rotate=function(e,t,r,n){var i=n[0],a=n[1],o=n[2],u=Math.sqrt(i*i+a*a+o*o),c=void 0,f=void 0,h=void 0,l=void 0,d=void 0,m=void 0,p=void 0,v=void 0,g=void 0,y=void 0,b=void 0,M=void 0,x=void 0,w=void 0,_=void 0,S=void 0,C=void 0,P=void 0,A=void 0,k=void 0,j=void 0,T=void 0,O=void 0,D=void 0;return u<s.EPSILON?null:(i*=u=1/u,a*=u,o*=u,c=Math.sin(r),f=Math.cos(r),h=1-f,l=t[0],d=t[1],m=t[2],p=t[3],v=t[4],g=t[5],y=t[6],b=t[7],M=t[8],x=t[9],w=t[10],_=t[11],S=i*i*h+f,C=a*i*h+o*c,P=o*i*h-a*c,A=i*a*h-o*c,k=a*a*h+f,j=o*a*h+i*c,T=i*o*h+a*c,O=a*o*h-i*c,D=o*o*h+f,e[0]=l*S+v*C+M*P,e[1]=d*S+g*C+x*P,e[2]=m*S+y*C+w*P,e[3]=p*S+b*C+_*P,e[4]=l*A+v*k+M*j,e[5]=d*A+g*k+x*j,e[6]=m*A+y*k+w*j,e[7]=p*A+b*k+_*j,e[8]=l*T+v*O+M*D,e[9]=d*T+g*O+x*D,e[10]=m*T+y*O+w*D,e[11]=p*T+b*O+_*D,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)},t.rotateX=function(e,t,r){var n=Math.sin(r),i=Math.cos(r),a=t[4],o=t[5],s=t[6],u=t[7],c=t[8],f=t[9],h=t[10],l=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*i+c*n,e[5]=o*i+f*n,e[6]=s*i+h*n,e[7]=u*i+l*n,e[8]=c*i-a*n,e[9]=f*i-o*n,e[10]=h*i-s*n,e[11]=l*i-u*n,e},t.rotateY=function(e,t,r){var n=Math.sin(r),i=Math.cos(r),a=t[0],o=t[1],s=t[2],u=t[3],c=t[8],f=t[9],h=t[10],l=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i-c*n,e[1]=o*i-f*n,e[2]=s*i-h*n,e[3]=u*i-l*n,e[8]=a*n+c*i,e[9]=o*n+f*i,e[10]=s*n+h*i,e[11]=u*n+l*i,e},t.rotateZ=function(e,t,r){var n=Math.sin(r),i=Math.cos(r),a=t[0],o=t[1],s=t[2],u=t[3],c=t[4],f=t[5],h=t[6],l=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i+c*n,e[1]=o*i+f*n,e[2]=s*i+h*n,e[3]=u*i+l*n,e[4]=c*i-a*n,e[5]=f*i-o*n,e[6]=h*i-s*n,e[7]=l*i-u*n,e},t.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e},t.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.fromRotation=function(e,t,r){var n=r[0],i=r[1],a=r[2],o=Math.sqrt(n*n+i*i+a*a),u=void 0,c=void 0,f=void 0;return o<s.EPSILON?null:(n*=o=1/o,i*=o,a*=o,u=Math.sin(t),c=Math.cos(t),f=1-c,e[0]=n*n*f+c,e[1]=i*n*f+a*u,e[2]=a*n*f-i*u,e[3]=0,e[4]=n*i*f-a*u,e[5]=i*i*f+c,e[6]=a*i*f+n*u,e[7]=0,e[8]=n*a*f+i*u,e[9]=i*a*f-n*u,e[10]=a*a*f+c,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},t.fromXRotation=function(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.fromYRotation=function(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.fromZRotation=function(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.fromRotationTranslation=a,t.fromQuat2=function(e,t){var r=new s.ARRAY_TYPE(3),n=-t[0],i=-t[1],o=-t[2],u=t[3],c=t[4],f=t[5],h=t[6],l=t[7],d=n*n+i*i+o*o+u*u;return d>0?(r[0]=2*(c*u+l*n+f*o-h*i)/d,r[1]=2*(f*u+l*i+h*n-c*o)/d,r[2]=2*(h*u+l*o+c*i-f*n)/d):(r[0]=2*(c*u+l*n+f*o-h*i),r[1]=2*(f*u+l*i+h*n-c*o),r[2]=2*(h*u+l*o+c*i-f*n)),a(e,t,r),e},t.getTranslation=function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},t.getScaling=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[4],o=t[5],s=t[6],u=t[8],c=t[9],f=t[10];return e[0]=Math.sqrt(r*r+n*n+i*i),e[1]=Math.sqrt(a*a+o*o+s*s),e[2]=Math.sqrt(u*u+c*c+f*f),e},t.getRotation=function(e,t){var r=t[0]+t[5]+t[10],n=0;return r>0?(n=2*Math.sqrt(r+1),e[3]=.25*n,e[0]=(t[6]-t[9])/n,e[1]=(t[8]-t[2])/n,e[2]=(t[1]-t[4])/n):t[0]>t[5]&&t[0]>t[10]?(n=2*Math.sqrt(1+t[0]-t[5]-t[10]),e[3]=(t[6]-t[9])/n,e[0]=.25*n,e[1]=(t[1]+t[4])/n,e[2]=(t[8]+t[2])/n):t[5]>t[10]?(n=2*Math.sqrt(1+t[5]-t[0]-t[10]),e[3]=(t[8]-t[2])/n,e[0]=(t[1]+t[4])/n,e[1]=.25*n,e[2]=(t[6]+t[9])/n):(n=2*Math.sqrt(1+t[10]-t[0]-t[5]),e[3]=(t[1]-t[4])/n,e[0]=(t[8]+t[2])/n,e[1]=(t[6]+t[9])/n,e[2]=.25*n),e},t.fromRotationTranslationScale=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=t[3],u=i+i,c=a+a,f=o+o,h=i*u,l=i*c,d=i*f,m=a*c,p=a*f,v=o*f,g=s*u,y=s*c,b=s*f,M=n[0],x=n[1],w=n[2];return e[0]=(1-(m+v))*M,e[1]=(l+b)*M,e[2]=(d-y)*M,e[3]=0,e[4]=(l-b)*x,e[5]=(1-(h+v))*x,e[6]=(p+g)*x,e[7]=0,e[8]=(d+y)*w,e[9]=(p-g)*w,e[10]=(1-(h+m))*w,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e},t.fromRotationTranslationScaleOrigin=function(e,t,r,n,i){var a=t[0],o=t[1],s=t[2],u=t[3],c=a+a,f=o+o,h=s+s,l=a*c,d=a*f,m=a*h,p=o*f,v=o*h,g=s*h,y=u*c,b=u*f,M=u*h,x=n[0],w=n[1],_=n[2],S=i[0],C=i[1],P=i[2],A=(1-(p+g))*x,k=(d+M)*x,j=(m-b)*x,T=(d-M)*w,O=(1-(l+g))*w,D=(v+y)*w,R=(m+b)*_,E=(v-y)*_,q=(1-(l+p))*_;return e[0]=A,e[1]=k,e[2]=j,e[3]=0,e[4]=T,e[5]=O,e[6]=D,e[7]=0,e[8]=R,e[9]=E,e[10]=q,e[11]=0,e[12]=r[0]+S-(A*S+T*C+R*P),e[13]=r[1]+C-(k*S+O*C+E*P),e[14]=r[2]+P-(j*S+D*C+q*P),e[15]=1,e},t.fromQuat=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,f=n*o,h=n*s,l=i*o,d=i*s,m=i*u,p=a*o,v=a*s,g=a*u;return e[0]=1-h-m,e[1]=f+g,e[2]=l-v,e[3]=0,e[4]=f-g,e[5]=1-c-m,e[6]=d+p,e[7]=0,e[8]=l+v,e[9]=d-p,e[10]=1-c-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},t.frustum=function(e,t,r,n,i,a,o){var s=1/(r-t),u=1/(i-n),c=1/(a-o);return e[0]=2*a*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*u,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*u,e[10]=(o+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=o*a*2*c,e[15]=0,e},t.perspective=function(e,t,r,n,i){var a=1/Math.tan(t/2),o=void 0;return e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0?(o=1/(n-i),e[10]=(i+n)*o,e[14]=2*i*n*o):(e[10]=-1,e[14]=-2*n),e},t.perspectiveFromFieldOfView=function(e,t,r,n){var i=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),o=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),u=2/(o+s),c=2/(i+a);return e[0]=u,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-(o-s)*u*.5,e[9]=(i-a)*c*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e},t.ortho=function(e,t,r,n,i,a,o){var s=1/(t-r),u=1/(n-i),c=1/(a-o);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*u,e[14]=(o+a)*c,e[15]=1,e},t.lookAt=function(e,t,r,i){var a=void 0,o=void 0,u=void 0,c=void 0,f=void 0,h=void 0,l=void 0,d=void 0,m=void 0,p=void 0,v=t[0],g=t[1],y=t[2],b=i[0],M=i[1],x=i[2],w=r[0],_=r[1],S=r[2];return Math.abs(v-w)<s.EPSILON&&Math.abs(g-_)<s.EPSILON&&Math.abs(y-S)<s.EPSILON?n(e):(l=v-w,d=g-_,m=y-S,p=1/Math.sqrt(l*l+d*d+m*m),a=M*(m*=p)-x*(d*=p),o=x*(l*=p)-b*m,u=b*d-M*l,(p=Math.sqrt(a*a+o*o+u*u))?(a*=p=1/p,o*=p,u*=p):(a=0,o=0,u=0),c=d*u-m*o,f=m*a-l*u,h=l*o-d*a,(p=Math.sqrt(c*c+f*f+h*h))?(c*=p=1/p,f*=p,h*=p):(c=0,f=0,h=0),e[0]=a,e[1]=c,e[2]=l,e[3]=0,e[4]=o,e[5]=f,e[6]=d,e[7]=0,e[8]=u,e[9]=h,e[10]=m,e[11]=0,e[12]=-(a*v+o*g+u*y),e[13]=-(c*v+f*g+h*y),e[14]=-(l*v+d*g+m*y),e[15]=1,e)},t.targetTo=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=n[0],u=n[1],c=n[2],f=i-r[0],h=a-r[1],l=o-r[2],d=f*f+h*h+l*l;d>0&&(d=1/Math.sqrt(d),f*=d,h*=d,l*=d);var m=u*l-c*h,p=c*f-s*l,v=s*h-u*f;return(d=m*m+p*p+v*v)>0&&(d=1/Math.sqrt(d),m*=d,p*=d,v*=d),e[0]=m,e[1]=p,e[2]=v,e[3]=0,e[4]=h*v-l*p,e[5]=l*m-f*v,e[6]=f*p-h*m,e[7]=0,e[8]=f,e[9]=h,e[10]=l,e[11]=0,e[12]=i,e[13]=a,e[14]=o,e[15]=1,e},t.str=function(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"},t.frob=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+Math.pow(e[6],2)+Math.pow(e[7],2)+Math.pow(e[8],2)+Math.pow(e[9],2)+Math.pow(e[10],2)+Math.pow(e[11],2)+Math.pow(e[12],2)+Math.pow(e[13],2)+Math.pow(e[14],2)+Math.pow(e[15],2))},t.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e},t.subtract=o,t.multiplyScalar=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e},t.multiplyScalarAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]},t.equals=function(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],u=e[5],c=e[6],f=e[7],h=e[8],l=e[9],d=e[10],m=e[11],p=e[12],v=e[13],g=e[14],y=e[15],b=t[0],M=t[1],x=t[2],w=t[3],_=t[4],S=t[5],C=t[6],P=t[7],A=t[8],k=t[9],j=t[10],T=t[11],O=t[12],D=t[13],R=t[14],E=t[15];return Math.abs(r-b)<=s.EPSILON*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(n-M)<=s.EPSILON*Math.max(1,Math.abs(n),Math.abs(M))&&Math.abs(i-x)<=s.EPSILON*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-w)<=s.EPSILON*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(o-_)<=s.EPSILON*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(u-S)<=s.EPSILON*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(c-C)<=s.EPSILON*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(f-P)<=s.EPSILON*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(h-A)<=s.EPSILON*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(l-k)<=s.EPSILON*Math.max(1,Math.abs(l),Math.abs(k))&&Math.abs(d-j)<=s.EPSILON*Math.max(1,Math.abs(d),Math.abs(j))&&Math.abs(m-T)<=s.EPSILON*Math.max(1,Math.abs(m),Math.abs(T))&&Math.abs(p-O)<=s.EPSILON*Math.max(1,Math.abs(p),Math.abs(O))&&Math.abs(v-D)<=s.EPSILON*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(g-R)<=s.EPSILON*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(y-E)<=s.EPSILON*Math.max(1,Math.abs(y),Math.abs(E))};var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));t.mul=i,t.sub=o},function(e,t,r){"use strict";function n(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],f=t[7],h=t[8],l=r[0],d=r[1],m=r[2],p=r[3],v=r[4],g=r[5],y=r[6],b=r[7],M=r[8];return e[0]=l*n+d*o+m*c,e[1]=l*i+d*s+m*f,e[2]=l*a+d*u+m*h,e[3]=p*n+v*o+g*c,e[4]=p*i+v*s+g*f,e[5]=p*a+v*u+g*h,e[6]=y*n+b*o+M*c,e[7]=y*i+b*s+M*f,e[8]=y*a+b*u+M*h,e}function i(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}Object.defineProperty(t,"__esModule",{value:!0}),t.sub=t.mul=void 0,t.create=function(){var e=new a.ARRAY_TYPE(9);return a.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e},t.fromMat4=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},t.clone=function(e){var t=new a.ARRAY_TYPE(9);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},t.fromValues=function(e,t,r,n,i,o,s,u,c){var f=new a.ARRAY_TYPE(9);return f[0]=e,f[1]=t,f[2]=r,f[3]=n,f[4]=i,f[5]=o,f[6]=s,f[7]=u,f[8]=c,f},t.set=function(e,t,r,n,i,a,o,s,u,c){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,e[5]=o,e[6]=s,e[7]=u,e[8]=c,e},t.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.transpose=function(e,t){if(e===t){var r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},t.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],f=t[8],h=f*o-s*c,l=-f*a+s*u,d=c*a-o*u,m=r*h+n*l+i*d;return m?(m=1/m,e[0]=h*m,e[1]=(-f*n+i*c)*m,e[2]=(s*n-i*o)*m,e[3]=l*m,e[4]=(f*r-i*u)*m,e[5]=(-s*r+i*a)*m,e[6]=d*m,e[7]=(-c*r+n*u)*m,e[8]=(o*r-n*a)*m,e):null},t.adjoint=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],f=t[8];return e[0]=o*f-s*c,e[1]=i*c-n*f,e[2]=n*s-i*o,e[3]=s*u-a*f,e[4]=r*f-i*u,e[5]=i*a-r*s,e[6]=a*c-o*u,e[7]=n*u-r*c,e[8]=r*o-n*a,e},t.determinant=function(e){var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8];return t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s)},t.multiply=n,t.translate=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],f=t[7],h=t[8],l=r[0],d=r[1];return e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=u,e[6]=l*n+d*o+c,e[7]=l*i+d*s+f,e[8]=l*a+d*u+h,e},t.rotate=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],f=t[7],h=t[8],l=Math.sin(r),d=Math.cos(r);return e[0]=d*n+l*o,e[1]=d*i+l*s,e[2]=d*a+l*u,e[3]=d*o-l*n,e[4]=d*s-l*i,e[5]=d*u-l*a,e[6]=c,e[7]=f,e[8]=h,e},t.scale=function(e,t,r){var n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},t.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e},t.fromRotation=function(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=-r,e[4]=n,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},t.fromMat2d=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e},t.fromQuat=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,f=n*o,h=n*s,l=i*o,d=i*s,m=i*u,p=a*o,v=a*s,g=a*u;return e[0]=1-h-m,e[3]=f-g,e[6]=l+v,e[1]=f+g,e[4]=1-c-m,e[7]=d-p,e[2]=l-v,e[5]=d+p,e[8]=1-c-h,e},t.normalFromMat4=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],f=t[8],h=t[9],l=t[10],d=t[11],m=t[12],p=t[13],v=t[14],g=t[15],y=r*s-n*o,b=r*u-i*o,M=r*c-a*o,x=n*u-i*s,w=n*c-a*s,_=i*c-a*u,S=f*p-h*m,C=f*v-l*m,P=f*g-d*m,A=h*v-l*p,k=h*g-d*p,j=l*g-d*v,T=y*j-b*k+M*A+x*P-w*C+_*S;return T?(T=1/T,e[0]=(s*j-u*k+c*A)*T,e[1]=(u*P-o*j-c*C)*T,e[2]=(o*k-s*P+c*S)*T,e[3]=(i*k-n*j-a*A)*T,e[4]=(r*j-i*P+a*C)*T,e[5]=(n*P-r*k-a*S)*T,e[6]=(p*_-v*w+g*x)*T,e[7]=(v*M-m*_-g*b)*T,e[8]=(m*w-p*M+g*y)*T,e):null},t.projection=function(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e},t.str=function(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"},t.frob=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+Math.pow(e[6],2)+Math.pow(e[7],2)+Math.pow(e[8],2))},t.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},t.subtract=i,t.multiplyScalar=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e},t.multiplyScalarAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]},t.equals=function(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],c=e[6],f=e[7],h=e[8],l=t[0],d=t[1],m=t[2],p=t[3],v=t[4],g=t[5],y=t[6],b=t[7],M=t[8];return Math.abs(r-l)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(n-d)<=a.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(i-m)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(m))&&Math.abs(o-p)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(s-v)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(v))&&Math.abs(u-g)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(g))&&Math.abs(c-y)<=a.EPSILON*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(f-b)<=a.EPSILON*Math.max(1,Math.abs(f),Math.abs(b))&&Math.abs(h-M)<=a.EPSILON*Math.max(1,Math.abs(h),Math.abs(M))};var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));t.mul=n,t.sub=i},function(e,t,r){"use strict";function n(){var e=new h.ARRAY_TYPE(2);return h.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0),e}function i(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function a(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function o(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function s(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function u(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function c(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function f(e){var t=e[0],r=e[1];return t*t+r*r}Object.defineProperty(t,"__esModule",{value:!0}),t.forEach=t.sqrLen=t.sqrDist=t.dist=t.div=t.mul=t.sub=t.len=void 0,t.create=n,t.clone=function(e){var t=new h.ARRAY_TYPE(2);return t[0]=e[0],t[1]=e[1],t},t.fromValues=function(e,t){var r=new h.ARRAY_TYPE(2);return r[0]=e,r[1]=t,r},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e},t.set=function(e,t,r){return e[0]=t,e[1]=r,e},t.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},t.subtract=i,t.multiply=a,t.divide=o,t.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},t.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},t.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e},t.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e},t.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e},t.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},t.scaleAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e},t.distance=s,t.squaredDistance=u,t.length=c,t.squaredLength=f,t.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e},t.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},t.normalize=function(e,t){var r=t[0],n=t[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),e[0]=t[0]*i,e[1]=t[1]*i),e},t.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},t.cross=function(e,t,r){var n=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=n,e},t.lerp=function(e,t,r,n){var i=t[0],a=t[1];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e},t.random=function(e,t){t=t||1;var r=2*h.RANDOM()*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e},t.transformMat2=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e},t.transformMat2d=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e},t.transformMat3=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e},t.transformMat4=function(e,t,r){var n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e},t.rotate=function(e,t,r,n){var i=t[0]-r[0],a=t[1]-r[1],o=Math.sin(n),s=Math.cos(n);return e[0]=i*s-a*o+r[0],e[1]=i*o+a*s+r[1],e},t.angle=function(e,t){var r=e[0],n=e[1],i=t[0],a=t[1],o=r*r+n*n;o>0&&(o=1/Math.sqrt(o));var s=i*i+a*a;s>0&&(s=1/Math.sqrt(s));var u=(r*i+n*a)*o*s;return u>1?0:u<-1?Math.PI:Math.acos(u)},t.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]},t.equals=function(e,t){var r=e[0],n=e[1],i=t[0],a=t[1];return Math.abs(r-i)<=h.EPSILON*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-a)<=h.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))};var h=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));t.len=c,t.sub=i,t.mul=a,t.div=o,t.dist=s,t.sqrDist=u,t.sqrLen=f,t.forEach=function(){var e=n();return function(t,r,n,i,a,o){var s=void 0,u=void 0;for(r||(r=2),n||(n=0),u=i?Math.min(i*r+n,t.length):t.length,s=n;s<u;s+=r)e[0]=t[s],e[1]=t[s+1],a(e,e,o),t[s]=e[0],t[s+1]=e[1];return t}}()},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function i(e,t,r){var n=.5*r[0],i=.5*r[1],a=.5*r[2],o=t[0],s=t[1],u=t[2],c=t[3];return e[0]=o,e[1]=s,e[2]=u,e[3]=c,e[4]=n*c+i*u-a*s,e[5]=i*c+a*o-n*u,e[6]=a*c+n*s-i*o,e[7]=-n*o-i*s-a*u,e}function a(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e}function o(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[4],u=r[5],c=r[6],f=r[7],h=t[4],l=t[5],d=t[6],m=t[7],p=r[0],v=r[1],g=r[2],y=r[3];return e[0]=n*y+o*p+i*g-a*v,e[1]=i*y+o*v+a*p-n*g,e[2]=a*y+o*g+n*v-i*p,e[3]=o*y-n*p-i*v-a*g,e[4]=n*f+o*s+i*c-a*u+h*y+m*p+l*g-d*v,e[5]=i*f+o*u+a*s-n*c+l*y+m*v+d*p-h*g,e[6]=a*f+o*c+n*u-i*s+d*y+m*g+h*v-l*p,e[7]=o*f-n*s-i*u-a*c+m*y-h*p-l*v-d*g,e}Object.defineProperty(t,"__esModule",{value:!0}),t.sqrLen=t.squaredLength=t.len=t.length=t.dot=t.mul=t.setReal=t.getReal=void 0,t.create=function(){var e=new s.ARRAY_TYPE(8);return s.ARRAY_TYPE!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[4]=0,e[5]=0,e[6]=0,e[7]=0),e[3]=1,e},t.clone=function(e){var t=new s.ARRAY_TYPE(8);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t},t.fromValues=function(e,t,r,n,i,a,o,u){var c=new s.ARRAY_TYPE(8);return c[0]=e,c[1]=t,c[2]=r,c[3]=n,c[4]=i,c[5]=a,c[6]=o,c[7]=u,c},t.fromRotationTranslationValues=function(e,t,r,n,i,a,o){var u=new s.ARRAY_TYPE(8);u[0]=e,u[1]=t,u[2]=r,u[3]=n;var c=.5*i,f=.5*a,h=.5*o;return u[4]=c*n+f*r-h*t,u[5]=f*n+h*e-c*r,u[6]=h*n+c*t-f*e,u[7]=-c*e-f*t-h*r,u},t.fromRotationTranslation=i,t.fromTranslation=function(e,t){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=.5*t[0],e[5]=.5*t[1],e[6]=.5*t[2],e[7]=0,e},t.fromRotation=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},t.fromMat4=function(e,t){var r=u.create();c.getRotation(r,t);var n=new s.ARRAY_TYPE(3);return c.getTranslation(n,t),i(e,r,n),e},t.copy=a,t.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e[6]=0,e[7]=0,e},t.set=function(e,t,r,n,i,a,o,s,u){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,e[5]=o,e[6]=s,e[7]=u,e},t.getDual=function(e,t){return e[0]=t[4],e[1]=t[5],e[2]=t[6],e[3]=t[7],e},t.setDual=function(e,t){return e[4]=t[0],e[5]=t[1],e[6]=t[2],e[7]=t[3],e},t.getTranslation=function(e,t){var r=t[4],n=t[5],i=t[6],a=t[7],o=-t[0],s=-t[1],u=-t[2],c=t[3];return e[0]=2*(r*c+a*o+n*u-i*s),e[1]=2*(n*c+a*s+i*o-r*u),e[2]=2*(i*c+a*u+r*s-n*o),e},t.translate=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=.5*r[0],u=.5*r[1],c=.5*r[2],f=t[4],h=t[5],l=t[6],d=t[7];return e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=o*s+i*c-a*u+f,e[5]=o*u+a*s-n*c+h,e[6]=o*c+n*u-i*s+l,e[7]=-n*s-i*u-a*c+d,e},t.rotateX=function(e,t,r){var n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],c=t[5],f=t[6],h=t[7],l=s*o+h*n+c*a-f*i,d=c*o+h*i+f*n-s*a,m=f*o+h*a+s*i-c*n,p=h*o-s*n-c*i-f*a;return u.rotateX(e,t,r),n=e[0],i=e[1],a=e[2],o=e[3],e[4]=l*o+p*n+d*a-m*i,e[5]=d*o+p*i+m*n-l*a,e[6]=m*o+p*a+l*i-d*n,e[7]=p*o-l*n-d*i-m*a,e},t.rotateY=function(e,t,r){var n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],c=t[5],f=t[6],h=t[7],l=s*o+h*n+c*a-f*i,d=c*o+h*i+f*n-s*a,m=f*o+h*a+s*i-c*n,p=h*o-s*n-c*i-f*a;return u.rotateY(e,t,r),n=e[0],i=e[1],a=e[2],o=e[3],e[4]=l*o+p*n+d*a-m*i,e[5]=d*o+p*i+m*n-l*a,e[6]=m*o+p*a+l*i-d*n,e[7]=p*o-l*n-d*i-m*a,e},t.rotateZ=function(e,t,r){var n=-t[0],i=-t[1],a=-t[2],o=t[3],s=t[4],c=t[5],f=t[6],h=t[7],l=s*o+h*n+c*a-f*i,d=c*o+h*i+f*n-s*a,m=f*o+h*a+s*i-c*n,p=h*o-s*n-c*i-f*a;return u.rotateZ(e,t,r),n=e[0],i=e[1],a=e[2],o=e[3],e[4]=l*o+p*n+d*a-m*i,e[5]=d*o+p*i+m*n-l*a,e[6]=m*o+p*a+l*i-d*n,e[7]=p*o-l*n-d*i-m*a,e},t.rotateByQuatAppend=function(e,t,r){var n=r[0],i=r[1],a=r[2],o=r[3],s=t[0],u=t[1],c=t[2],f=t[3];return e[0]=s*o+f*n+u*a-c*i,e[1]=u*o+f*i+c*n-s*a,e[2]=c*o+f*a+s*i-u*n,e[3]=f*o-s*n-u*i-c*a,s=t[4],u=t[5],c=t[6],f=t[7],e[4]=s*o+f*n+u*a-c*i,e[5]=u*o+f*i+c*n-s*a,e[6]=c*o+f*a+s*i-u*n,e[7]=f*o-s*n-u*i-c*a,e},t.rotateByQuatPrepend=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],f=r[3];return e[0]=n*f+o*s+i*c-a*u,e[1]=i*f+o*u+a*s-n*c,e[2]=a*f+o*c+n*u-i*s,e[3]=o*f-n*s-i*u-a*c,s=r[4],u=r[5],c=r[6],f=r[7],e[4]=n*f+o*s+i*c-a*u,e[5]=i*f+o*u+a*s-n*c,e[6]=a*f+o*c+n*u-i*s,e[7]=o*f-n*s-i*u-a*c,e},t.rotateAroundAxis=function(e,t,r,n){if(Math.abs(n)<s.EPSILON)return a(e,t);var i=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);n*=.5;var o=Math.sin(n),u=o*r[0]/i,c=o*r[1]/i,f=o*r[2]/i,h=Math.cos(n),l=t[0],d=t[1],m=t[2],p=t[3];e[0]=l*h+p*u+d*f-m*c,e[1]=d*h+p*c+m*u-l*f,e[2]=m*h+p*f+l*c-d*u,e[3]=p*h-l*u-d*c-m*f;var v=t[4],g=t[5],y=t[6],b=t[7];return e[4]=v*h+b*u+g*f-y*c,e[5]=g*h+b*c+y*u-v*f,e[6]=y*h+b*f+v*c-g*u,e[7]=b*h-v*u-g*c-y*f,e},t.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e},t.multiply=o,t.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e},t.lerp=function(e,t,r,n){var i=1-n;return f(t,r)<0&&(n=-n),e[0]=t[0]*i+r[0]*n,e[1]=t[1]*i+r[1]*n,e[2]=t[2]*i+r[2]*n,e[3]=t[3]*i+r[3]*n,e[4]=t[4]*i+r[4]*n,e[5]=t[5]*i+r[5]*n,e[6]=t[6]*i+r[6]*n,e[7]=t[7]*i+r[7]*n,e},t.invert=function(e,t){var r=l(t);return e[0]=-t[0]/r,e[1]=-t[1]/r,e[2]=-t[2]/r,e[3]=t[3]/r,e[4]=-t[4]/r,e[5]=-t[5]/r,e[6]=-t[6]/r,e[7]=t[7]/r,e},t.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=t[7],e},t.normalize=function(e,t){var r=l(t);if(r>0){r=Math.sqrt(r);var n=t[0]/r,i=t[1]/r,a=t[2]/r,o=t[3]/r,s=t[4],u=t[5],c=t[6],f=t[7],h=n*s+i*u+a*c+o*f;e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=(s-n*h)/r,e[5]=(u-i*h)/r,e[6]=(c-a*h)/r,e[7]=(f-o*h)/r}return e},t.str=function(e){return"quat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+")"},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]},t.equals=function(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],u=e[5],c=e[6],f=e[7],h=t[0],l=t[1],d=t[2],m=t[3],p=t[4],v=t[5],g=t[6],y=t[7];return Math.abs(r-h)<=s.EPSILON*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(n-l)<=s.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(i-d)<=s.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-m)<=s.EPSILON*Math.max(1,Math.abs(a),Math.abs(m))&&Math.abs(o-p)<=s.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(u-v)<=s.EPSILON*Math.max(1,Math.abs(u),Math.abs(v))&&Math.abs(c-g)<=s.EPSILON*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(f-y)<=s.EPSILON*Math.max(1,Math.abs(f),Math.abs(y))};var s=n(r(0)),u=n(r(3)),c=n(r(4));t.getReal=u.copy,t.setReal=u.copy,t.mul=o;var f=t.dot=u.dot,h=t.length=u.length,l=(t.len=h,t.squaredLength=u.squaredLength);t.sqrLen=l},function(e,t,r){"use strict";function n(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=r[0],f=r[1],h=r[2],l=r[3],d=r[4],m=r[5];return e[0]=n*c+a*f,e[1]=i*c+o*f,e[2]=n*h+a*l,e[3]=i*h+o*l,e[4]=n*d+a*m+s,e[5]=i*d+o*m+u,e}function i(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e}Object.defineProperty(t,"__esModule",{value:!0}),t.sub=t.mul=void 0,t.create=function(){var e=new a.ARRAY_TYPE(6);return a.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0,e[4]=0,e[5]=0),e[0]=1,e[3]=1,e},t.clone=function(e){var t=new a.ARRAY_TYPE(6);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},t.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=0,e[5]=0,e},t.fromValues=function(e,t,r,n,i,o){var s=new a.ARRAY_TYPE(6);return s[0]=e,s[1]=t,s[2]=r,s[3]=n,s[4]=i,s[5]=o,s},t.set=function(e,t,r,n,i,a,o){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=a,e[5]=o,e},t.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=r*a-n*i;return u?(u=1/u,e[0]=a*u,e[1]=-n*u,e[2]=-i*u,e[3]=r*u,e[4]=(i*s-a*o)*u,e[5]=(n*o-r*s)*u,e):null},t.determinant=function(e){return e[0]*e[3]-e[1]*e[2]},t.multiply=n,t.rotate=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=Math.sin(r),f=Math.cos(r);return e[0]=n*f+a*c,e[1]=i*f+o*c,e[2]=n*-c+a*f,e[3]=i*-c+o*f,e[4]=s,e[5]=u,e},t.scale=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=r[0],f=r[1];return e[0]=n*c,e[1]=i*c,e[2]=a*f,e[3]=o*f,e[4]=s,e[5]=u,e},t.translate=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=r[0],f=r[1];return e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=n*c+a*f+s,e[5]=i*c+o*f+u,e},t.fromRotation=function(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=-r,e[3]=n,e[4]=0,e[5]=0,e},t.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e[4]=0,e[5]=0,e},t.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e[4]=t[0],e[5]=t[1],e},t.str=function(e){return"mat2d("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+")"},t.frob=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2)+Math.pow(e[4],2)+Math.pow(e[5],2)+1)},t.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e},t.subtract=i,t.multiplyScalar=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e},t.multiplyScalarAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e},t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]},t.equals=function(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],s=e[4],u=e[5],c=t[0],f=t[1],h=t[2],l=t[3],d=t[4],m=t[5];return Math.abs(r-c)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(n-f)<=a.EPSILON*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(i-h)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(o-l)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(l))&&Math.abs(s-d)<=a.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))&&Math.abs(u-m)<=a.EPSILON*Math.max(1,Math.abs(u),Math.abs(m))}
;var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));t.mul=n,t.sub=i},function(e,t,r){"use strict";function n(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],f=r[3];return e[0]=n*s+a*u,e[1]=i*s+o*u,e[2]=n*c+a*f,e[3]=i*c+o*f,e}function i(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}Object.defineProperty(t,"__esModule",{value:!0}),t.sub=t.mul=void 0,t.create=function(){var e=new a.ARRAY_TYPE(4);return a.ARRAY_TYPE!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e},t.clone=function(e){var t=new a.ARRAY_TYPE(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},t.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},t.identity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e},t.fromValues=function(e,t,r,n){var i=new a.ARRAY_TYPE(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i},t.set=function(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e},t.transpose=function(e,t){if(e===t){var r=t[1];e[1]=t[2],e[2]=r}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e},t.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*a-i*n;return o?(o=1/o,e[0]=a*o,e[1]=-n*o,e[2]=-i*o,e[3]=r*o,e):null},t.adjoint=function(e,t){var r=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=r,e},t.determinant=function(e){return e[0]*e[3]-e[2]*e[1]},t.multiply=n,t.rotate=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+a*s,e[1]=i*u+o*s,e[2]=n*-s+a*u,e[3]=i*-s+o*u,e},t.scale=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1];return e[0]=n*s,e[1]=i*s,e[2]=a*u,e[3]=o*u,e},t.fromRotation=function(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=-r,e[3]=n,e},t.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e},t.str=function(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"},t.frob=function(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2)+Math.pow(e[3],2))},t.LDU=function(e,t,r,n){return e[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-e[2]*r[1],[e,t,r]},t.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},t.subtract=i,t.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},t.equals=function(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],s=t[0],u=t[1],c=t[2],f=t[3];return Math.abs(r-s)<=a.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(n-u)<=a.EPSILON*Math.max(1,Math.abs(n),Math.abs(u))&&Math.abs(i-c)<=a.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(o-f)<=a.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))},t.multiplyScalar=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},t.multiplyScalarAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e};var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(r(0));t.mul=n,t.sub=i},function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}Object.defineProperty(t,"__esModule",{value:!0}),t.vec4=t.vec3=t.vec2=t.quat2=t.quat=t.mat4=t.mat3=t.mat2d=t.mat2=t.glMatrix=void 0;var i=n(r(0)),a=n(r(9)),o=n(r(8)),s=n(r(5)),u=n(r(4)),c=n(r(3)),f=n(r(7)),h=n(r(6)),l=n(r(2)),d=n(r(1));t.glMatrix=i,t.mat2=a,t.mat2d=o,t.mat3=s,t.mat4=u,t.quat=c,t.quat2=f,t.vec2=h,t.vec3=l,t.vec4=d}])})},{}],62:[function(e,t,r){"use strict";function n(e,t,r){this.vertices=e,this.adjacent=t,this.boundary=r,this.lastVisited=-1}function i(e,t,r){this.vertices=e,this.cell=t,this.index=r}function a(e,t){return f(e.vertices,t.vertices)}function o(e){for(var t=["function orient(){var tuple=this.tuple;return test("],r=0;r<=e;++r)r>0&&t.push(","),t.push("tuple[",r,"]");t.push(")}return orient");var n=new Function("test",t.join("")),i=c[e+1];return i||(i=c),n(i)}function s(e,t,r){this.dimension=e,this.vertices=t,this.simplices=r,this.interior=r.filter(function(e){return!e.boundary}),this.tuple=new Array(e+1);for(var n=0;n<=e;++n)this.tuple[n]=this.vertices[n];var i=h[e];i||(i=h[e]=o(e)),this.orient=i}function u(e,t){var r=e.length;if(0===r)throw new Error("Must have at least d+1 points");var i=e[0].length;if(r<=i)throw new Error("Must input at least d+1 points");var a=e.slice(0,i+1),o=c.apply(void 0,a);if(0===o)throw new Error("Input not in general position");for(var u=new Array(i+1),f=0;f<=i;++f)u[f]=f;o<0&&(u[0]=1,u[1]=0);for(var h=new n(u,new Array(i+1),!1),l=h.adjacent,d=new Array(i+2),f=0;f<=i;++f){for(var m=u.slice(),p=0;p<=i;++p)p===f&&(m[p]=-1);var v=m[0];m[0]=m[1],m[1]=v;var g=new n(m,new Array(i+1),!0);l[f]=g,d[f]=g}d[i+1]=h;for(var f=0;f<=i;++f)for(var m=l[f].vertices,y=l[f].adjacent,p=0;p<=i;++p){var b=m[p];if(b<0)y[p]=h;else for(var M=0;M<=i;++M)l[M].vertices.indexOf(b)<0&&(y[p]=l[M])}for(var x=new s(i,a,d),w=!!t,f=i+1;f<r;++f)x.insert(e[f],w);return x.boundary()}t.exports=u;var c=e("robust-orientation"),f=e("simplicial-complex").compareCells;n.prototype.flip=function(){var e=this.vertices[0];this.vertices[0]=this.vertices[1],this.vertices[1]=e;var t=this.adjacent[0];this.adjacent[0]=this.adjacent[1],this.adjacent[1]=t};var h=[],l=s.prototype;l.handleBoundaryDegeneracy=function(e,t){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,a=this.vertices,o=[e];for(e.lastVisited=-n;o.length>0;){e=o.pop();for(var s=(e.vertices,e.adjacent),u=0;u<=r;++u){var c=s[u];if(c.boundary&&!(c.lastVisited<=-n)){for(var f=c.vertices,h=0;h<=r;++h){var l=f[h];i[h]=l<0?t:a[l]}var d=this.orient();if(d>0)return c;c.lastVisited=-n,0===d&&o.push(c)}}}return null},l.walk=function(e,t){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,a=this.tuple,o=t?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[o];e:for(;!s.boundary;){for(var u=s.vertices,c=s.adjacent,f=0;f<=n;++f)a[f]=i[u[f]];s.lastVisited=r;for(var f=0;f<=n;++f){var h=c[f];if(!(h.lastVisited>=r)){var l=a[f];a[f]=e;var d=this.orient();if(a[f]=l,d<0){s=h;continue e}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},l.addPeaks=function(e,t){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,u=this.tuple,c=this.interior,f=this.simplices,h=[t];t.lastVisited=r,t.vertices[t.vertices.indexOf(-1)]=r,t.boundary=!1,c.push(t);for(var l=[];h.length>0;){var t=h.pop(),d=t.vertices,m=t.adjacent,p=d.indexOf(r);if(!(p<0))for(var v=0;v<=o;++v)if(v!==p){var g=m[v];if(g.boundary&&!(g.lastVisited>=r)){var y=g.vertices;if(g.lastVisited!==-r){for(var b=0,M=0;M<=o;++M)y[M]<0?(b=M,u[M]=e):u[M]=s[y[M]];var x=this.orient();if(x>0){y[b]=r,g.boundary=!1,c.push(g),h.push(g),g.lastVisited=r;continue}g.lastVisited=-r}var w=g.adjacent,_=d.slice(),S=m.slice(),C=new n(_,S,!0);f.push(C);var P=w.indexOf(t);if(!(P<0)){w[P]=C,S[p]=g,_[v]=-1,S[v]=t,m[v]=C,C.flip();for(var M=0;M<=o;++M){var A=_[M];if(!(A<0||A===r)){for(var k=new Array(o-1),j=0,T=0;T<=o;++T){var O=_[T];O<0||T===M||(k[j++]=O)}l.push(new i(k,C,M))}}}}}}l.sort(a);for(var v=0;v+1<l.length;v+=2){var D=l[v],R=l[v+1],E=D.index,q=R.index;E<0||q<0||(D.cell.adjacent[D.index]=R.cell,R.cell.adjacent[R.index]=D.cell)}},l.insert=function(e,t){var r=this.vertices;r.push(e);var n=this.walk(e,t);if(n){for(var i=this.dimension,a=this.tuple,o=0;o<=i;++o){var s=n.vertices[o];a[o]=s<0?e:r[s]}var u=this.orient(a);u<0||(0!==u||(n=this.handleBoundaryDegeneracy(n,e)))&&this.addPeaks(e,n)}},l.boundary=function(){for(var e=this.dimension,t=[],r=this.simplices,n=r.length,i=0;i<n;++i){var a=r[i];if(a.boundary){for(var o=new Array(e),s=a.vertices,u=0,c=0,f=0;f<=e;++f)s[f]>=0?o[u++]=s[f]:c=1&f;if(c===(1&e)){var h=o[0];o[0]=o[1],o[1]=h}t.push(o)}}return t}},{"robust-orientation":66,"simplicial-complex":82}],63:[function(e,t,r){function n(e,t,r){this.obj=e,this.left=null,this.right=null,this.parent=r,this.dimension=t}function i(e,t,r){function i(e,t,a){var o,s,u=t%r.length;return 0===e.length?null:1===e.length?new n(e[0],u,a):(e.sort(function(e,t){return e[r[u]]-t[r[u]]}),o=Math.floor(e.length/2),s=new n(e[o],u,a),s.left=i(e.slice(0,o),t+1,s),s.right=i(e.slice(o+1),t+1,s),s)}var o=this;this.root=i(e,0,null),this.insert=function(e){function t(n,i){if(null===n)return i;var a=r[n.dimension];return e[a]<n.obj[a]?t(n.left,n):t(n.right,n)}var i,a,o=t(this.root,null);if(null===o)return void(this.root=new n(e,0,null));i=new n(e,(o.dimension+1)%r.length,o),a=r[o.dimension],e[a]<o.obj[a]?o.left=i:o.right=i},this.remove=function(e){function t(n){if(null===n)return null;if(n.obj===e)return n;var i=r[n.dimension];return e[i]<n.obj[i]?t(n.left,n):t(n.right,n)}function n(e){function t(e,n){var i,a,o,s,u;return null===e?null:(i=r[n],e.dimension===n?null!==e.right?t(e.right,n):e:(a=e.obj[i],o=t(e.left,n),s=t(e.right,n),u=e,null!==o&&o.obj[i]>a&&(u=o),null!==s&&s.obj[i]>u.obj[i]&&(u=s),u))}function i(e,t){var n,a,o,s,u;return null===e?null:(n=r[t],e.dimension===t?null!==e.left?i(e.left,t):e:(a=e.obj[n],o=i(e.left,t),s=i(e.right,t),u=e,null!==o&&o.obj[n]<a&&(u=o),null!==s&&s.obj[n]<u.obj[n]&&(u=s),u))}var a,s,u;if(null===e.left&&null===e.right)return null===e.parent?void(o.root=null):(u=r[e.parent.dimension],void(e.obj[u]<e.parent.obj[u]?e.parent.left=null:e.parent.right=null));a=null!==e.left?t(e.left,e.dimension):i(e.right,e.dimension),s=a.obj,n(a),e.obj=s}var i;null!==(i=t(o.root))&&n(i)},this.nearest=function(e,n,i){function s(i){function a(e,t){f.push([e,t]),f.size()>n&&f.pop()}if(!o.root)return[];var u,c,h,l,d=r[i.dimension],m=t(e,i.obj),p={};for(l=0;l<r.length;l+=1)l===i.dimension?p[r[l]]=e[r[l]]:p[r[l]]=i.obj[r[l]];if(c=t(p,i.obj),null===i.right&&null===i.left)return void((f.size()<n||m<f.peek()[1])&&a(i,m));u=null===i.right?i.left:null===i.left?i.right:e[d]<i.obj[d]?i.left:i.right,s(u),(f.size()<n||m<f.peek()[1])&&a(i,m),(f.size()<n||Math.abs(c)<f.peek()[1])&&null!==(h=u===i.left?i.right:i.left)&&s(h)}var u,c,f;if(f=new a(function(e){return-e[1]}),i)for(u=0;u<n;u+=1)f.push([null,i]);for(s(o.root),c=[],u=0;u<n&&u<f.content.length;u+=1)f.content[u][0]&&c.push([f.content[u][0].obj,f.content[u][1]]);return c},this.balanceFactor=function(){function e(t){return null===t?0:Math.max(e(t.left),e(t.right))+1}function t(e){return null===e?0:t(e.left)+t(e.right)+1}return e(o.root)/(Math.log(t(o.root))/Math.log(2))}}function a(e){this.content=[],this.scoreFunction=e}a.prototype={push:function(e){this.content.push(e),this.bubbleUp(this.content.length-1)},pop:function(){var e=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.sinkDown(0)),e},peek:function(){return this.content[0]},remove:function(e){for(var t=this.content.length,r=0;r<t;r++)if(this.content[r]==e){var n=this.content.pop();return void(r!=t-1&&(this.content[r]=n,this.scoreFunction(n)<this.scoreFunction(e)?this.bubbleUp(r):this.sinkDown(r)))}throw new Error("Node not found.")},size:function(){return this.content.length},bubbleUp:function(e){for(var t=this.content[e];e>0;){var r=Math.floor((e+1)/2)-1,n=this.content[r];if(!(this.scoreFunction(t)<this.scoreFunction(n)))break;this.content[r]=t,this.content[e]=n,e=r}},sinkDown:function(e){for(var t=this.content.length,r=this.content[e],n=this.scoreFunction(r);;){var i=2*(e+1),a=i-1,o=null;if(a<t){var s=this.content[a],u=this.scoreFunction(s);u<n&&(o=a)}if(i<t){var c=this.content[i];this.scoreFunction(c)<(null==o?n:u)&&(o=i)}if(null==o)break;this.content[e]=this.content[o],this.content[o]=r,e=o}}},t.exports={createKdTree:function(e,t,r){return new i(e,t,r)}}},{}],64:[function(e,t,r){"use strict";function n(e){var t=e.length;if(t<3){for(var r=new Array(t),n=0;n<t;++n)r[n]=n;return 2===t&&e[0][0]===e[1][0]&&e[0][1]===e[1][1]?[0]:r}for(var a=new Array(t),n=0;n<t;++n)a[n]=n;a.sort(function(t,r){var n=e[t][0]-e[r][0];return n||e[t][1]-e[r][1]});for(var o=[a[0],a[1]],s=[a[0],a[1]],n=2;n<t;++n){for(var u=a[n],c=e[u],f=o.length;f>1&&i(e[o[f-2]],e[o[f-1]],c)<=0;)f-=1,o.pop();for(o.push(u),f=s.length;f>1&&i(e[s[f-2]],e[s[f-1]],c)>=0;)f-=1,s.pop();s.push(u)}for(var r=new Array(s.length+o.length-2),h=0,n=0,l=o.length;n<l;++n)r[h++]=o[n];for(var d=s.length-2;d>0;--d)r[h++]=s[d];return r}t.exports=n;var i=e("robust-orientation")[3]},{"robust-orientation":66}],65:[function(require,module,exports){(function(global){"use strict";var numeric=void 0===exports?function(){}:exports;void 0!==global&&(global.numeric=numeric),numeric.version="1.2.6",numeric.bench=function(e,t){var r,n,i,a;for(void 0===t&&(t=15),i=.5,r=new Date;;){for(i*=2,a=i;a>3;a-=4)e(),e(),e(),e();for(;a>0;)e(),a--;if((n=new Date)-r>t)break}for(a=i;a>3;a-=4)e(),e(),e(),e();for(;a>0;)e(),a--;return n=new Date,1e3*(3*i-1)/(n-r)},numeric._myIndexOf=function(e){var t,r=this.length;for(t=0;t<r;++t)if(this[t]===e)return t;return-1},numeric.myIndexOf=Array.prototype.indexOf?Array.prototype.indexOf:numeric._myIndexOf,numeric.Function=Function,numeric.precision=4,numeric.largeArray=50,numeric.prettyPrint=function(e){function t(e){if(0===e)return"0";if(isNaN(e))return"NaN";if(e<0)return"-"+t(-e);if(isFinite(e)){var r=Math.floor(Math.log(e)/Math.log(10)),n=e/Math.pow(10,r),i=n.toPrecision(numeric.precision);return 10===parseFloat(i)&&(r++,n=1,i=n.toPrecision(numeric.precision)),parseFloat(i).toString()+"e"+r.toString()}return"Infinity"}function r(e){var i;if(void 0===e)return n.push(Array(numeric.precision+8).join(" ")),!1;if("string"==typeof e)return n.push('"'+e+'"'),!1;if("boolean"==typeof e)return n.push(e.toString()),!1;if("number"==typeof e){var a=t(e),o=e.toPrecision(numeric.precision),s=parseFloat(e.toString()).toString(),u=[a,o,s,parseFloat(o).toString(),parseFloat(s).toString()];for(i=1;i<u.length;i++)u[i].length<a.length&&(a=u[i]);return n.push(Array(numeric.precision+8-a.length).join(" ")+a),!1}if(null===e)return n.push("null"),!1;if("function"==typeof e){n.push(e.toString());var c=!1;for(i in e)e.hasOwnProperty(i)&&(c?n.push(",\n"):n.push("\n{"),c=!0,n.push(i),n.push(": \n"),r(e[i]));return c&&n.push("}\n"),!0}if(e instanceof Array){if(e.length>numeric.largeArray)return n.push("...Large Array..."),!0;var c=!1;for(n.push("["),i=0;i<e.length;i++)i>0&&(n.push(","),c&&n.push("\n ")),c=r(e[i]);return n.push("]"),!0}n.push("{");var c=!1;for(i in e)e.hasOwnProperty(i)&&(c&&n.push(",\n"),c=!0,n.push(i),n.push(": \n"),r(e[i]));return n.push("}"),!0}var n=[];return r(e),n.join("")},numeric.parseDate=function(e){function t(e){if("string"==typeof e)return Date.parse(e.replace(/-/g,"/"));if(!(e instanceof Array))throw new Error("parseDate: parameter must be arrays of strings");var r,n=[];for(r=0;r<e.length;r++)n[r]=t(e[r]);return n}return t(e)},numeric.parseFloat=function(e){function t(e){if("string"==typeof e)return parseFloat(e);if(!(e instanceof Array))throw new Error("parseFloat: parameter must be arrays of strings");var r,n=[];for(r=0;r<e.length;r++)n[r]=t(e[r]);return n}return t(e)},numeric.parseCSV=function(e){var t,r,n=e.split("\n"),i=[],a=/(([^'",]*)|('[^']*')|("[^"]*")),/g,o=/^\s*(([+-]?[0-9]+(\.[0-9]*)?(e[+-]?[0-9]+)?)|([+-]?[0-9]*(\.[0-9]+)?(e[+-]?[0-9]+)?))\s*$/,s=0;for(r=0;r<n.length;r++){var u,c=(n[r]+",").match(a);if(c.length>0){for(i[s]=[],t=0;t<c.length;t++)u=function(e){return e.substr(0,e.length-1)}(c[t]),o.test(u)?i[s][t]=parseFloat(u):i[s][t]=u;s++}}return i},numeric.toCSV=function(e){var t,r,n,i,a,o=numeric.dim(e);for(n=o[0],o[1],a=[],t=0;t<n;t++){for(i=[],r=0;r<n;r++)i[r]=e[t][r].toString();a[t]=i.join(", ")}return a.join("\n")+"\n"},numeric.getURL=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(),t},numeric.imageURL=function(e){function t(e,t,r){void 0===t&&(t=0),void 0===r&&(r=e.length);var n,i=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],a=-1,o=0;e.length;for(n=t;n<r;n++)o=255&(a^e[n]),a=a>>>8^i[o];return-1^a}var r,n,i,a,o,s,u,c,f,h,l=e[0].length,d=e[0][0].length,m=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,d>>24&255,d>>16&255,d>>8&255,255&d,l>>24&255,l>>16&255,l>>8&255,255&l,8,2,0,0,0,-1,-2,-3,-4,-5,-6,-7,-8,73,68,65,84,8,29];for(h=t(m,12,29),m[29]=h>>24&255,m[30]=h>>16&255,m[31]=h>>8&255,m[32]=255&h,r=1,n=0,u=0;u<l;u++){for(u<l-1?m.push(0):m.push(1),o=3*d+1+(0===u)&255,s=3*d+1+(0===u)>>8&255,m.push(o),m.push(s),m.push(255&~o),m.push(255&~s),0===u&&m.push(0),c=0;c<d;c++)for(i=0;i<3;i++)o=e[i][u][c],o=o>255?255:o<0?0:Math.round(o),r=(r+o)%65521,n=(n+r)%65521,m.push(o);m.push(0)}return f=(n<<16)+r,m.push(f>>24&255),m.push(f>>16&255),m.push(f>>8&255),m.push(255&f),a=m.length-41,m[33]=a>>24&255,m[34]=a>>16&255,m[35]=a>>8&255,m[36]=255&a,h=t(m,37),m.push(h>>24&255),m.push(h>>16&255),m.push(h>>8&255),m.push(255&h),m.push(0),m.push(0),m.push(0),m.push(0),m.push(73),m.push(69),m.push(78),m.push(68),m.push(174),m.push(66),m.push(96),m.push(130),"data:image/png;base64,"+function(e){var t,r,n,i,a,o,s,u,c=e.length,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h="";for(t=0;t<c;t+=3)r=e[t],n=e[t+1],i=e[t+2],a=r>>2,o=((3&r)<<4)+(n>>4),s=((15&n)<<2)+(i>>6),u=63&i,t+1>=c?s=u=64:t+2>=c&&(u=64),h+=f.charAt(a)+f.charAt(o)+f.charAt(s)+f.charAt(u);return h}(m)},numeric._dim=function(e){for(var t=[];"object"==typeof e;)t.push(e.length),e=e[0];return t},numeric.dim=function(e){var t,r;return"object"==typeof e?(t=e[0],"object"==typeof t?(r=t[0],"object"==typeof r?numeric._dim(e):[e.length,t.length]):[e.length]):[]},numeric.mapreduce=function(e,t){return Function("x","accum","_s","_k",'if(typeof accum === "undefined") accum = '+t+';\nif(typeof x === "number") { var xi = x; '+e+'; return accum; }\nif(typeof _s === "undefined") _s = numeric.dim(x);\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i,xi;\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) {\n accum = arguments.callee(x[i],accum,_s,_k+1);\n } return accum;\n}\nfor(i=_n-1;i>=1;i-=2) { \n xi = x[i];\n '+e+";\n xi = x[i-1];\n "+e+";\n}\nif(i === 0) {\n xi = x[i];\n "+e+"\n}\nreturn accum;")},numeric.mapreduce2=function(e,t){return Function("x","var n = x.length;\nvar i,xi;\n"+t+";\nfor(i=n-1;i!==-1;--i) { \n xi = x[i];\n "+e+";\n}\nreturn accum;")},numeric.same=function e(t,r){var n,i;if(!(t instanceof Array&&r instanceof Array))return!1;if((i=t.length)!==r.length)return!1;for(n=0;n<i;n++)if(t[n]!==r[n]){if("object"!=typeof t[n])return!1;if(!e(t[n],r[n]))return!1}return!0},numeric.rep=function(e,t,r){void 0===r&&(r=0);var n,i=e[r],a=Array(i);if(r===e.length-1){for(n=i-2;n>=0;n-=2)a[n+1]=t,a[n]=t;return-1===n&&(a[0]=t),a}for(n=i-1;n>=0;n--)a[n]=numeric.rep(e,t,r+1);return a},numeric.dotMMsmall=function(e,t){var r,n,i,a,o,s,u,c,f,h,l;for(a=e.length,o=t.length,s=t[0].length,u=Array(a),r=a-1;r>=0;r--){for(c=Array(s),f=e[r],i=s-1;i>=0;i--){for(h=f[o-1]*t[o-1][i],n=o-2;n>=1;n-=2)l=n-1,h+=f[n]*t[n][i]+f[l]*t[l][i];0===n&&(h+=f[0]*t[0][i]),c[i]=h}u[r]=c}return u},numeric._getCol=function(e,t,r){var n,i=e.length;for(n=i-1;n>0;--n)r[n]=e[n][t],--n,r[n]=e[n][t];0===n&&(r[0]=e[0][t])},numeric.dotMMbig=function(e,t){var r,n,i,a=numeric._getCol,o=t.length,s=Array(o),u=e.length,c=t[0].length,f=new Array(u),h=numeric.dotVV;for(--o,--u,n=u;-1!==n;--n)f[n]=Array(c);for(--c,n=c;-1!==n;--n)for(a(t,n,s),i=u;-1!==i;--i)0,r=e[i],f[i][n]=h(r,s);return f},numeric.dotMV=function(e,t){var r,n=e.length,i=(t.length,Array(n)),a=numeric.dotVV;for(r=n-1;r>=0;r--)i[r]=a(e[r],t);return i},numeric.dotVM=function(e,t){var r,n,i,a,o,s,u;for(i=e.length,a=t[0].length,o=Array(a),n=a-1;n>=0;n--){for(s=e[i-1]*t[i-1][n],r=i-2;r>=1;r-=2)u=r-1,s+=e[r]*t[r][n]+e[u]*t[u][n];0===r&&(s+=e[0]*t[0][n]),o[n]=s}return o},numeric.dotVV=function(e,t){var r,n,i=e.length,a=e[i-1]*t[i-1];for(r=i-2;r>=1;r-=2)n=r-1,a+=e[r]*t[r]+e[n]*t[n];return 0===r&&(a+=e[0]*t[0]),a},numeric.dot=function(e,t){var r=numeric.dim;switch(1e3*r(e).length+r(t).length){case 2002:return t.length<10?numeric.dotMMsmall(e,t):numeric.dotMMbig(e,t);case 2001:return numeric.dotMV(e,t);case 1002:return numeric.dotVM(e,t);case 1001:return numeric.dotVV(e,t);case 1e3:return numeric.mulVS(e,t);case 1:return numeric.mulSV(e,t);case 0:return e*t;default:throw new Error("numeric.dot only works on vectors and matrices")}},numeric.diag=function(e){var t,r,n,i,a=e.length,o=Array(a);for(t=a-1;t>=0;t--){for(i=Array(a),r=t+2,n=a-1;n>=r;n-=2)i[n]=0,i[n-1]=0;for(n>t&&(i[n]=0),i[t]=e[t],n=t-1;n>=1;n-=2)i[n]=0,i[n-1]=0;0===n&&(i[0]=0),o[t]=i}return o},numeric.getDiag=function(e){var t,r=Math.min(e.length,e[0].length),n=Array(r);for(t=r-1;t>=1;--t)n[t]=e[t][t],--t,n[t]=e[t][t];return 0===t&&(n[0]=e[0][0]),n},numeric.identity=function(e){return numeric.diag(numeric.rep([e],1))},numeric.pointwise=function(e,t,r){void 0===r&&(r="");var n,i,a=[],o=/\[i\]$/,s="",u=!1;for(n=0;n<e.length;n++)o.test(e[n])?(i=e[n].substring(0,e[n].length-3),s=i):i=e[n],"ret"===i&&(u=!0),a.push(i);return a[e.length]="_s",a[e.length+1]="_k",a[e.length+2]='if(typeof _s === "undefined") _s = numeric.dim('+s+');\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i'+(u?"":", ret = Array(_n)")+";\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) ret[i] = arguments.callee("+e.join(",")+",_s,_k+1);\n return ret;\n}\n"+r+"\nfor(i=_n-1;i!==-1;--i) {\n "+t+"\n}\nreturn ret;",Function.apply(null,a)},numeric.pointwise2=function(e,t,r){void 0===r&&(r="");var n,i,a=[],o=/\[i\]$/,s="",u=!1;for(n=0;n<e.length;n++)o.test(e[n])?(i=e[n].substring(0,e[n].length-3),s=i):i=e[n],"ret"===i&&(u=!0),a.push(i);return a[e.length]="var _n = "+s+".length;\nvar i"+(u?"":", ret = Array(_n)")+";\n"+r+"\nfor(i=_n-1;i!==-1;--i) {\n"+t+"\n}\nreturn ret;",Function.apply(null,a)},numeric._biforeach=function e(t,r,n,i,a){if(i===n.length-1)return void a(t,r);var o,s=n[i];for(o=s-1;o>=0;o--)e("object"==typeof t?t[o]:t,"object"==typeof r?r[o]:r,n,i+1,a)},numeric._biforeach2=function e(t,r,n,i,a){if(i===n.length-1)return a(t,r);var o,s=n[i],u=Array(s);for(o=s-1;o>=0;--o)u[o]=e("object"==typeof t?t[o]:t,"object"==typeof r?r[o]:r,n,i+1,a);return u},numeric._foreach=function e(t,r,n,i){if(n===r.length-1)return void i(t);var a,o=r[n];for(a=o-1;a>=0;a--)e(t[a],r,n+1,i)},numeric._foreach2=function e(t,r,n,i){if(n===r.length-1)return i(t);var a,o=r[n],s=Array(o);for(a=o-1;a>=0;a--)s[a]=e(t[a],r,n+1,i);return s},numeric.ops2={add:"+",sub:"-",mul:"*",div:"/",mod:"%",and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">=",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"},numeric.opseq={addeq:"+=",subeq:"-=",muleq:"*=",diveq:"/=",modeq:"%=",lshifteq:"<<=",rshifteq:">>=",rrshifteq:">>>=",bandeq:"&=",boreq:"|=",bxoreq:"^="},numeric.mathfuns=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","isNaN","isFinite"],numeric.mathfuns2=["atan2","pow","max","min"],numeric.ops1={neg:"-",not:"!",bnot:"~",clone:""},numeric.mapreducers={any:["if(xi) return true;","var accum = false;"],all:["if(!xi) return false;","var accum = true;"],sum:["accum += xi;","var accum = 0;"],prod:["accum *= xi;","var accum = 1;"],norm2Squared:["accum += xi*xi;","var accum = 0;"],norminf:["accum = max(accum,abs(xi));","var accum = 0, max = Math.max, abs = Math.abs;"],norm1:["accum += abs(xi)","var accum = 0, abs = Math.abs;"],sup:["accum = max(accum,xi);","var accum = -Infinity, max = Math.max;"],inf:["accum = min(accum,xi);","var accum = Infinity, min = Math.min;"]},function(){var e,t;for(e=0;e<numeric.mathfuns2.length;++e)t=numeric.mathfuns2[e],numeric.ops2[t]=t;for(e in numeric.ops2)if(numeric.ops2.hasOwnProperty(e)){t=numeric.ops2[e];var r,n,i="";-1!==numeric.myIndexOf.call(numeric.mathfuns2,e)?(i="var "+t+" = Math."+t+";\n",r=function(e,r,n){return e+" = "+t+"("+r+","+n+")"},n=function(e,r){return e+" = "+t+"("+e+","+r+")"}):(r=function(e,r,n){return e+" = "+r+" "+t+" "+n},n=numeric.opseq.hasOwnProperty(e+"eq")?function(e,r){return e+" "+t+"= "+r}:function(e,r){return e+" = "+e+" "+t+" "+r}),numeric[e+"VV"]=numeric.pointwise2(["x[i]","y[i]"],r("ret[i]","x[i]","y[i]"),i),numeric[e+"SV"]=numeric.pointwise2(["x","y[i]"],r("ret[i]","x","y[i]"),i),numeric[e+"VS"]=numeric.pointwise2(["x[i]","y"],r("ret[i]","x[i]","y"),i),numeric[e]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar VV = numeric."+e+"VV, VS = numeric."+e+"VS, SV = numeric."+e+'SV;\nvar dim = numeric.dim;\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof x === "object") {\n if(typeof y === "object") x = numeric._biforeach2(x,y,dim(x),0,VV);\n else x = numeric._biforeach2(x,y,dim(x),0,VS);\n } else if(typeof y === "object") x = numeric._biforeach2(x,y,dim(y),0,SV);\n else '+n("x","y")+"\n}\nreturn x;\n"),numeric[t]=numeric[e],numeric[e+"eqV"]=numeric.pointwise2(["ret[i]","x[i]"],n("ret[i]","x[i]"),i),numeric[e+"eqS"]=numeric.pointwise2(["ret[i]","x"],n("ret[i]","x"),i),numeric[e+"eq"]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar V = numeric."+e+"eqV, S = numeric."+e+'eqS\nvar s = numeric.dim(x);\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof y === "object") numeric._biforeach(x,y,s,0,V);\n else numeric._biforeach(x,y,s,0,S);\n}\nreturn x;\n')}for(e=0;e<numeric.mathfuns2.length;++e)t=numeric.mathfuns2[e],delete numeric.ops2[t];for(e=0;e<numeric.mathfuns.length;++e)t=numeric.mathfuns[e],numeric.ops1[t]=t;for(e in numeric.ops1)numeric.ops1.hasOwnProperty(e)&&(i="",t=numeric.ops1[e],-1!==numeric.myIndexOf.call(numeric.mathfuns,e)&&Math.hasOwnProperty(t)&&(i="var "+t+" = Math."+t+";\n"),numeric[e+"eqV"]=numeric.pointwise2(["ret[i]"],"ret[i] = "+t+"(ret[i]);",i),numeric[e+"eq"]=Function("x",'if(typeof x !== "object") return '+t+"x\nvar i;\nvar V = numeric."+e+"eqV;\nvar s = numeric.dim(x);\nnumeric._foreach(x,s,0,V);\nreturn x;\n"),numeric[e+"V"]=numeric.pointwise2(["x[i]"],"ret[i] = "+t+"(x[i]);",i),numeric[e]=Function("x",'if(typeof x !== "object") return '+t+"(x)\nvar i;\nvar V = numeric."+e+"V;\nvar s = numeric.dim(x);\nreturn numeric._foreach2(x,s,0,V);\n"));for(e=0;e<numeric.mathfuns.length;++e)t=numeric.mathfuns[e],delete numeric.ops1[t];for(e in numeric.mapreducers)numeric.mapreducers.hasOwnProperty(e)&&(t=numeric.mapreducers[e],numeric[e+"V"]=numeric.mapreduce2(t[0],t[1]),numeric[e]=Function("x","s","k",t[1]+'if(typeof x !== "object") { xi = x;\n'+t[0]+';\n return accum;\n}if(typeof s === "undefined") s = numeric.dim(x);\nif(typeof k === "undefined") k = 0;\nif(k === s.length-1) return numeric.'+e+"V(x);\nvar xi;\nvar n = x.length, i;\nfor(i=n-1;i!==-1;--i) {\n xi = arguments.callee(x[i]);\n"+t[0]+";\n}\nreturn accum;\n"))}(),numeric.truncVV=numeric.pointwise(["x[i]","y[i]"],"ret[i] = round(x[i]/y[i])*y[i];","var round = Math.round;"),numeric.truncVS=numeric.pointwise(["x[i]","y"],"ret[i] = round(x[i]/y)*y;","var round = Math.round;"),numeric.truncSV=numeric.pointwise(["x","y[i]"],"ret[i] = round(x/y[i])*y[i];","var round = Math.round;"),numeric.trunc=function(e,t){return"object"==typeof e?"object"==typeof t?numeric.truncVV(e,t):numeric.truncVS(e,t):"object"==typeof t?numeric.truncSV(e,t):Math.round(e/t)*t},numeric.inv=function(e){var t,r,n,i,a,o,s,e,u=numeric.dim(e),c=Math.abs,f=u[0],h=u[1],l=numeric.clone(e),d=numeric.identity(f);for(o=0;o<h;++o){var m=-1,p=-1;for(a=o;a!==f;++a)(s=c(l[a][o]))>p&&(m=a,p=s);for(r=l[m],l[m]=l[o],l[o]=r,i=d[m],d[m]=d[o],d[o]=i,e=r[o],s=o;s!==h;++s)r[s]/=e;for(s=h-1;-1!==s;--s)i[s]/=e;for(a=f-1;-1!==a;--a)if(a!==o){for(t=l[a],n=d[a],e=t[o],s=o+1;s!==h;++s)t[s]-=r[s]*e;for(s=h-1;s>0;--s)n[s]-=i[s]*e,--s,n[s]-=i[s]*e;0===s&&(n[0]-=i[0]*e)}}return d},numeric.det=function(e){var t=numeric.dim(e);if(2!==t.length||t[0]!==t[1])throw new Error("numeric: det() only works on square matrices");var r,n,i,a,o,s,u,c,f=t[0],h=1,l=numeric.clone(e);for(n=0;n<f-1;n++){for(i=n,r=n+1;r<f;r++)Math.abs(l[r][n])>Math.abs(l[i][n])&&(i=r);for(i!==n&&(u=l[i],l[i]=l[n],l[n]=u,h*=-1),a=l[n],r=n+1;r<f;r++){for(o=l[r],s=o[n]/a[n],i=n+1;i<f-1;i+=2)c=i+1,o[i]-=a[i]*s,o[c]-=a[c]*s;i!==f&&(o[i]-=a[i]*s)}if(0===a[n])return 0;h*=a[n]}return h*l[n][n]},numeric.transpose=function(e){var t,r,n,i,a,o=e.length,s=e[0].length,u=Array(s);for(r=0;r<s;r++)u[r]=Array(o);for(t=o-1;t>=1;t-=2){for(i=e[t],n=e[t-1],r=s-1;r>=1;--r)a=u[r],a[t]=i[r],a[t-1]=n[r],--r,a=u[r],a[t]=i[r],a[t-1]=n[r];0===r&&(a=u[0],a[t]=i[0],a[t-1]=n[0])}if(0===t){for(n=e[0],r=s-1;r>=1;--r)u[r][0]=n[r],--r,u[r][0]=n[r];0===r&&(u[0][0]=n[0])}return u},numeric.negtranspose=function(e){var t,r,n,i,a,o=e.length,s=e[0].length,u=Array(s);for(r=0;r<s;r++)u[r]=Array(o);for(t=o-1;t>=1;t-=2){for(i=e[t],n=e[t-1],r=s-1;r>=1;--r)a=u[r],a[t]=-i[r],a[t-1]=-n[r],--r,a=u[r],a[t]=-i[r],a[t-1]=-n[r];0===r&&(a=u[0],a[t]=-i[0],a[t-1]=-n[0])}if(0===t){for(n=e[0],r=s-1;r>=1;--r)u[r][0]=-n[r],--r,u[r][0]=-n[r];0===r&&(u[0][0]=-n[0])}return u},numeric._random=function e(t,r){var n,i,a=t[r],o=Array(a);if(r===t.length-1){for(i=Math.random,n=a-1;n>=1;n-=2)o[n]=i(),o[n-1]=i();return 0===n&&(o[0]=i()),o}for(n=a-1;n>=0;n--)o[n]=e(t,r+1);return o},numeric.random=function(e){return numeric._random(e,0)},numeric.norm2=function(e){return Math.sqrt(numeric.norm2Squared(e))},numeric.linspace=function(e,t,r){if(void 0===r&&(r=Math.max(Math.round(t-e)+1,1)),r<2)return 1===r?[e]:[];var n,i=Array(r);for(r--,n=r;n>=0;n--)i[n]=(n*t+(r-n)*e)/r;return i},numeric.getBlock=function(e,t,r){function n(e,a){var o,s=t[a],u=r[a]-s,c=Array(u);if(a===i.length-1){for(o=u;o>=0;o--)c[o]=e[o+s];return c}for(o=u;o>=0;o--)c[o]=n(e[o+s],a+1);return c}
var i=numeric.dim(e);return n(e,0)},numeric.setBlock=function(e,t,r,n){function i(e,n,o){var s,u=t[o],c=r[o]-u;if(o===a.length-1)for(s=c;s>=0;s--)e[s+u]=n[s];for(s=c;s>=0;s--)i(e[s+u],n[s],o+1)}var a=numeric.dim(e);return i(e,n,0),e},numeric.getRange=function(e,t,r){var n,i,a,o,s=t.length,u=r.length,c=Array(s);for(n=s-1;-1!==n;--n)for(c[n]=Array(u),a=c[n],o=e[t[n]],i=u-1;-1!==i;--i)a[i]=o[r[i]];return c},numeric.blockMatrix=function(e){var t=numeric.dim(e);if(t.length<4)return numeric.blockMatrix([e]);var r,n,i,a,o,s=t[0],u=t[1];for(r=0,n=0,i=0;i<s;++i)r+=e[i][0].length;for(a=0;a<u;++a)n+=e[0][a][0].length;var c=Array(r);for(i=0;i<r;++i)c[i]=Array(n);var f,h,l,d,m,p=0;for(i=0;i<s;++i){for(f=n,a=u-1;-1!==a;--a)for(o=e[i][a],f-=o[0].length,l=o.length-1;-1!==l;--l)for(m=o[l],h=c[p+l],d=m.length-1;-1!==d;--d)h[f+d]=m[d];p+=e[i][0].length}return c},numeric.tensor=function(e,t){if("number"==typeof e||"number"==typeof t)return numeric.mul(e,t);var r=numeric.dim(e),n=numeric.dim(t);if(1!==r.length||1!==n.length)throw new Error("numeric: tensor product is only defined for vectors");var i,a,o,s,u=r[0],c=n[0],f=Array(u);for(a=u-1;a>=0;a--){for(i=Array(c),s=e[a],o=c-1;o>=3;--o)i[o]=s*t[o],--o,i[o]=s*t[o],--o,i[o]=s*t[o],--o,i[o]=s*t[o];for(;o>=0;)i[o]=s*t[o],--o;f[a]=i}return f},numeric.T=function(e,t){this.x=e,this.y=t},numeric.t=function(e,t){return new numeric.T(e,t)},numeric.Tbinop=function(e,t,r,n,i){numeric.indexOf;if("string"!=typeof i){var a;i="";for(a in numeric)numeric.hasOwnProperty(a)&&(e.indexOf(a)>=0||t.indexOf(a)>=0||r.indexOf(a)>=0||n.indexOf(a)>=0)&&a.length>1&&(i+="var "+a+" = numeric."+a+";\n")}return Function(["y"],"var x = this;\nif(!(y instanceof numeric.T)) { y = new numeric.T(y); }\n"+i+"\nif(x.y) { if(y.y) { return new numeric.T("+n+");\n }\n return new numeric.T("+r+");\n}\nif(y.y) {\n return new numeric.T("+t+");\n}\nreturn new numeric.T("+e+");\n")},numeric.T.prototype.add=numeric.Tbinop("add(x.x,y.x)","add(x.x,y.x),y.y","add(x.x,y.x),x.y","add(x.x,y.x),add(x.y,y.y)"),numeric.T.prototype.sub=numeric.Tbinop("sub(x.x,y.x)","sub(x.x,y.x),neg(y.y)","sub(x.x,y.x),x.y","sub(x.x,y.x),sub(x.y,y.y)"),numeric.T.prototype.mul=numeric.Tbinop("mul(x.x,y.x)","mul(x.x,y.x),mul(x.x,y.y)","mul(x.x,y.x),mul(x.y,y.x)","sub(mul(x.x,y.x),mul(x.y,y.y)),add(mul(x.x,y.y),mul(x.y,y.x))"),numeric.T.prototype.reciprocal=function(){var e=numeric.mul,t=numeric.div;if(this.y){var r=numeric.add(e(this.x,this.x),e(this.y,this.y));return new numeric.T(t(this.x,r),t(numeric.neg(this.y),r))}return new T(t(1,this.x))},numeric.T.prototype.div=function(e){if(e instanceof numeric.T||(e=new numeric.T(e)),e.y)return this.mul(e.reciprocal());var t=numeric.div;return this.y?new numeric.T(t(this.x,e.x),t(this.y,e.x)):new numeric.T(t(this.x,e.x))},numeric.T.prototype.dot=numeric.Tbinop("dot(x.x,y.x)","dot(x.x,y.x),dot(x.x,y.y)","dot(x.x,y.x),dot(x.y,y.x)","sub(dot(x.x,y.x),dot(x.y,y.y)),add(dot(x.x,y.y),dot(x.y,y.x))"),numeric.T.prototype.transpose=function(){var e=numeric.transpose,t=this.x,r=this.y;return r?new numeric.T(e(t),e(r)):new numeric.T(e(t))},numeric.T.prototype.transjugate=function(){var e=numeric.transpose,t=this.x,r=this.y;return r?new numeric.T(e(t),numeric.negtranspose(r)):new numeric.T(e(t))},numeric.Tunop=function(e,t,r){return"string"!=typeof r&&(r=""),Function("var x = this;\n"+r+"\nif(x.y) { "+t+";\n}\n"+e+";\n")},numeric.T.prototype.exp=numeric.Tunop("return new numeric.T(ex)","return new numeric.T(mul(cos(x.y),ex),mul(sin(x.y),ex))","var ex = numeric.exp(x.x), cos = numeric.cos, sin = numeric.sin, mul = numeric.mul;"),numeric.T.prototype.conj=numeric.Tunop("return new numeric.T(x.x);","return new numeric.T(x.x,numeric.neg(x.y));"),numeric.T.prototype.neg=numeric.Tunop("return new numeric.T(neg(x.x));","return new numeric.T(neg(x.x),neg(x.y));","var neg = numeric.neg;"),numeric.T.prototype.sin=numeric.Tunop("return new numeric.T(numeric.sin(x.x))","return x.exp().sub(x.neg().exp()).div(new numeric.T(0,2));"),numeric.T.prototype.cos=numeric.Tunop("return new numeric.T(numeric.cos(x.x))","return x.exp().add(x.neg().exp()).div(2);"),numeric.T.prototype.abs=numeric.Tunop("return new numeric.T(numeric.abs(x.x));","return new numeric.T(numeric.sqrt(numeric.add(mul(x.x,x.x),mul(x.y,x.y))));","var mul = numeric.mul;"),numeric.T.prototype.log=numeric.Tunop("return new numeric.T(numeric.log(x.x));","var theta = new numeric.T(numeric.atan2(x.y,x.x)), r = x.abs();\nreturn new numeric.T(numeric.log(r.x),theta.x);"),numeric.T.prototype.norm2=numeric.Tunop("return numeric.norm2(x.x);","var f = numeric.norm2Squared;\nreturn Math.sqrt(f(x.x)+f(x.y));"),numeric.T.prototype.inv=function(){var e=this;if(void 0===e.y)return new numeric.T(numeric.inv(e.x));var t,r,n,i,a,o,s,u,c,f,h,t,r,n,l,d,m,p,v,g,y,b=e.x.length,M=numeric.identity(b),x=numeric.rep([b,b],0),w=numeric.clone(e.x),_=numeric.clone(e.y);for(t=0;t<b;t++){for(m=w[t][t],p=_[t][t],l=m*m+p*p,n=t,r=t+1;r<b;r++)m=w[r][t],p=_[r][t],(d=m*m+p*p)>l&&(n=r,l=d);for(n!==t&&(y=w[t],w[t]=w[n],w[n]=y,y=_[t],_[t]=_[n],_[n]=y,y=M[t],M[t]=M[n],M[n]=y,y=x[t],x[t]=x[n],x[n]=y),i=w[t],a=_[t],u=M[t],c=x[t],m=i[t],p=a[t],r=t+1;r<b;r++)v=i[r],g=a[r],i[r]=(v*m+g*p)/l,a[r]=(g*m-v*p)/l;for(r=0;r<b;r++)v=u[r],g=c[r],u[r]=(v*m+g*p)/l,c[r]=(g*m-v*p)/l;for(r=t+1;r<b;r++){for(o=w[r],s=_[r],f=M[r],h=x[r],m=o[t],p=s[t],n=t+1;n<b;n++)v=i[n],g=a[n],o[n]-=v*m-g*p,s[n]-=g*m+v*p;for(n=0;n<b;n++)v=u[n],g=c[n],f[n]-=v*m-g*p,h[n]-=g*m+v*p}}for(t=b-1;t>0;t--)for(u=M[t],c=x[t],r=t-1;r>=0;r--)for(f=M[r],h=x[r],m=w[r][t],p=_[r][t],n=b-1;n>=0;n--)v=u[n],g=c[n],f[n]-=m*v-p*g,h[n]-=m*g+p*v;return new numeric.T(M,x)},numeric.T.prototype.get=function(e){var t,r=this.x,n=this.y,i=0,a=e.length;if(n){for(;i<a;)t=e[i],r=r[t],n=n[t],i++;return new numeric.T(r,n)}for(;i<a;)t=e[i],r=r[t],i++;return new numeric.T(r)},numeric.T.prototype.set=function(e,t){var r,n=this.x,i=this.y,a=0,o=e.length,s=t.x,u=t.y;if(0===o)return u?this.y=u:i&&(this.y=void 0),this.x=n,this;if(u){for(i||(i=numeric.rep(numeric.dim(n),0),this.y=i);a<o-1;)r=e[a],n=n[r],i=i[r],a++;return r=e[a],n[r]=s,i[r]=u,this}if(i){for(;a<o-1;)r=e[a],n=n[r],i=i[r],a++;return r=e[a],n[r]=s,s instanceof Array?i[r]=numeric.rep(numeric.dim(s),0):i[r]=0,this}for(;a<o-1;)r=e[a],n=n[r],a++;return r=e[a],n[r]=s,this},numeric.T.prototype.getRows=function(e,t){var r,n,i=t-e+1,a=Array(i),o=this.x,s=this.y;for(r=e;r<=t;r++)a[r-e]=o[r];if(s){for(n=Array(i),r=e;r<=t;r++)n[r-e]=s[r];return new numeric.T(a,n)}return new numeric.T(a)},numeric.T.prototype.setRows=function(e,t,r){var n,i=this.x,a=this.y,o=r.x,s=r.y;for(n=e;n<=t;n++)i[n]=o[n-e];if(s)for(a||(a=numeric.rep(numeric.dim(i),0),this.y=a),n=e;n<=t;n++)a[n]=s[n-e];else if(a)for(n=e;n<=t;n++)a[n]=numeric.rep([o[n-e].length],0);return this},numeric.T.prototype.getRow=function(e){var t=this.x,r=this.y;return r?new numeric.T(t[e],r[e]):new numeric.T(t[e])},numeric.T.prototype.setRow=function(e,t){var r=this.x,n=this.y,i=t.x,a=t.y;return r[e]=i,a?(n||(n=numeric.rep(numeric.dim(r),0),this.y=n),n[e]=a):n&&(n=numeric.rep([i.length],0)),this},numeric.T.prototype.getBlock=function(e,t){var r=this.x,n=this.y,i=numeric.getBlock;return n?new numeric.T(i(r,e,t),i(n,e,t)):new numeric.T(i(r,e,t))},numeric.T.prototype.setBlock=function(e,t,r){r instanceof numeric.T||(r=new numeric.T(r));var n=this.x,i=this.y,a=numeric.setBlock,o=r.x,s=r.y;if(s)return i||(this.y=numeric.rep(numeric.dim(this),0),i=this.y),a(n,e,t,o),a(i,e,t,s),this;a(n,e,t,o),i&&a(i,e,t,numeric.rep(numeric.dim(o),0))},numeric.T.rep=function(e,t){var r=numeric.T;t instanceof r||(t=new r(t));var n=t.x,i=t.y,a=numeric.rep;return i?new r(a(e,n),a(e,i)):new r(a(e,n))},numeric.T.diag=function(e){e instanceof numeric.T||(e=new numeric.T(e));var t=e.x,r=e.y,n=numeric.diag;return r?new numeric.T(n(t),n(r)):new numeric.T(n(t))},numeric.T.eig=function(){if(this.y)throw new Error("eig: not implemented for complex matrices.");return numeric.eig(this.x)},numeric.T.identity=function(e){return new numeric.T(numeric.identity(e))},numeric.T.prototype.getDiag=function(){var e=numeric,t=this.x,r=this.y;return r?new e.T(e.getDiag(t),e.getDiag(r)):new e.T(e.getDiag(t))},numeric.house=function(e){var t=numeric.clone(e),r=e[0]>=0?1:-1,n=r*numeric.norm2(e);t[0]+=n;var i=numeric.norm2(t);if(0===i)throw new Error("eig: internal error");return numeric.div(t,i)},numeric.toUpperHessenberg=function(e){var t=numeric.dim(e);if(2!==t.length||t[0]!==t[1])throw new Error("numeric: toUpperHessenberg() only works on square matrices");var r,n,i,a,o,s,u,c,f,h,l=t[0],d=numeric.clone(e),m=numeric.identity(l);for(n=0;n<l-2;n++){for(a=Array(l-n-1),r=n+1;r<l;r++)a[r-n-1]=d[r][n];if(numeric.norm2(a)>0){for(o=numeric.house(a),s=numeric.getBlock(d,[n+1,n],[l-1,l-1]),u=numeric.tensor(o,numeric.dot(o,s)),r=n+1;r<l;r++)for(c=d[r],f=u[r-n-1],i=n;i<l;i++)c[i]-=2*f[i-n];for(s=numeric.getBlock(d,[0,n+1],[l-1,l-1]),u=numeric.tensor(numeric.dot(s,o),o),r=0;r<l;r++)for(c=d[r],f=u[r],i=n+1;i<l;i++)c[i]-=2*f[i-n-1];for(s=Array(l-n-1),r=n+1;r<l;r++)s[r-n-1]=m[r];for(u=numeric.tensor(o,numeric.dot(o,s)),r=n+1;r<l;r++)for(h=m[r],f=u[r-n-1],i=0;i<l;i++)h[i]-=2*f[i]}}return{H:d,Q:m}},numeric.epsilon=2.220446049250313e-16,numeric.QRFrancis=function(e,t){void 0===t&&(t=1e4),e=numeric.clone(e);var r,n,i,a,o,s,u,c,f,h,l,d,m,p,v,g,y,b,M=(numeric.clone(e),numeric.dim(e)),x=M[0],w=numeric.identity(x);if(x<3)return{Q:w,B:[[0,x-1]]};var _=numeric.epsilon;for(b=0;b<t;b++){for(g=0;g<x-1;g++)if(Math.abs(e[g+1][g])<_*(Math.abs(e[g][g])+Math.abs(e[g+1][g+1]))){var S=numeric.QRFrancis(numeric.getBlock(e,[0,0],[g,g]),t),C=numeric.QRFrancis(numeric.getBlock(e,[g+1,g+1],[x-1,x-1]),t);for(d=Array(g+1),v=0;v<=g;v++)d[v]=w[v];for(m=numeric.dot(S.Q,d),v=0;v<=g;v++)w[v]=m[v];for(d=Array(x-g-1),v=g+1;v<x;v++)d[v-g-1]=w[v];for(m=numeric.dot(C.Q,d),v=g+1;v<x;v++)w[v]=m[v-g-1];return{Q:w,B:S.B.concat(numeric.add(C.B,g+1))}}if(i=e[x-2][x-2],a=e[x-2][x-1],o=e[x-1][x-2],s=e[x-1][x-1],c=i+s,u=i*s-a*o,f=numeric.getBlock(e,[0,0],[2,2]),c*c>=4*u){var P,A;P=.5*(c+Math.sqrt(c*c-4*u)),A=.5*(c-Math.sqrt(c*c-4*u)),f=numeric.add(numeric.sub(numeric.dot(f,f),numeric.mul(f,P+A)),numeric.diag(numeric.rep([3],P*A)))}else f=numeric.add(numeric.sub(numeric.dot(f,f),numeric.mul(f,c)),numeric.diag(numeric.rep([3],u)));for(r=[f[0][0],f[1][0],f[2][0]],n=numeric.house(r),d=[e[0],e[1],e[2]],m=numeric.tensor(n,numeric.dot(n,d)),v=0;v<3;v++)for(l=e[v],p=m[v],y=0;y<x;y++)l[y]-=2*p[y];for(d=numeric.getBlock(e,[0,0],[x-1,2]),m=numeric.tensor(numeric.dot(d,n),n),v=0;v<x;v++)for(l=e[v],p=m[v],y=0;y<3;y++)l[y]-=2*p[y];for(d=[w[0],w[1],w[2]],m=numeric.tensor(n,numeric.dot(n,d)),v=0;v<3;v++)for(h=w[v],p=m[v],y=0;y<x;y++)h[y]-=2*p[y];var k;for(g=0;g<x-2;g++){for(y=g;y<=g+1;y++)if(Math.abs(e[y+1][y])<_*(Math.abs(e[y][y])+Math.abs(e[y+1][y+1]))){var S=numeric.QRFrancis(numeric.getBlock(e,[0,0],[y,y]),t),C=numeric.QRFrancis(numeric.getBlock(e,[y+1,y+1],[x-1,x-1]),t);for(d=Array(y+1),v=0;v<=y;v++)d[v]=w[v];for(m=numeric.dot(S.Q,d),v=0;v<=y;v++)w[v]=m[v];for(d=Array(x-y-1),v=y+1;v<x;v++)d[v-y-1]=w[v];for(m=numeric.dot(C.Q,d),v=y+1;v<x;v++)w[v]=m[v-y-1];return{Q:w,B:S.B.concat(numeric.add(C.B,y+1))}}for(k=Math.min(x-1,g+3),r=Array(k-g),v=g+1;v<=k;v++)r[v-g-1]=e[v][g];for(n=numeric.house(r),d=numeric.getBlock(e,[g+1,g],[k,x-1]),m=numeric.tensor(n,numeric.dot(n,d)),v=g+1;v<=k;v++)for(l=e[v],p=m[v-g-1],y=g;y<x;y++)l[y]-=2*p[y-g];for(d=numeric.getBlock(e,[0,g+1],[x-1,k]),m=numeric.tensor(numeric.dot(d,n),n),v=0;v<x;v++)for(l=e[v],p=m[v],y=g+1;y<=k;y++)l[y]-=2*p[y-g-1];for(d=Array(k-g),v=g+1;v<=k;v++)d[v-g-1]=w[v];for(m=numeric.tensor(n,numeric.dot(n,d)),v=g+1;v<=k;v++)for(h=w[v],p=m[v-g-1],y=0;y<x;y++)h[y]-=2*p[y]}}throw new Error("numeric: eigenvalue iteration does not converge -- increase maxiter?")},numeric.eig=function(e,t){var r,n,i,a,o,s,u,c,f,h,l,d,m,p,v,g,y,b=numeric.toUpperHessenberg(e),M=numeric.QRFrancis(b.H,t),x=numeric.T,w=e.length,_=M.B,S=numeric.dot(M.Q,numeric.dot(b.H,numeric.transpose(M.Q))),C=new x(numeric.dot(M.Q,b.Q)),P=_.length,A=Math.sqrt;for(n=0;n<P;n++)if((r=_[n][0])===_[n][1]);else{if(a=r+1,o=S[r][r],s=S[r][a],u=S[a][r],c=S[a][a],0===s&&0===u)continue;f=-o-c,h=o*c-s*u,l=f*f-4*h,l>=0?(d=f<0?-.5*(f-A(l)):-.5*(f+A(l)),g=(o-d)*(o-d)+s*s,y=u*u+(c-d)*(c-d),g>y?(g=A(g),p=(o-d)/g,v=s/g):(y=A(y),p=u/y,v=(c-d)/y),i=new x([[v,-p],[p,v]]),C.setRows(r,a,i.dot(C.getRows(r,a)))):(d=-.5*f,m=.5*A(-l),g=(o-d)*(o-d)+s*s,y=u*u+(c-d)*(c-d),g>y?(g=A(g+m*m),p=(o-d)/g,v=s/g,d=0,m/=g):(y=A(y+m*m),p=u/y,v=(c-d)/y,d=m/y,m=0),i=new x([[v,-p],[p,v]],[[d,m],[m,-d]]),C.setRows(r,a,i.dot(C.getRows(r,a))))}var k=C.dot(e).dot(C.transjugate()),w=e.length,j=numeric.T.identity(w);for(a=0;a<w;a++)if(a>0)for(n=a-1;n>=0;n--){var T=k.get([n,n]),O=k.get([a,a]);numeric.neq(T.x,O.x)||numeric.neq(T.y,O.y)?(d=k.getRow(n).getBlock([n],[a-1]),m=j.getRow(a).getBlock([n],[a-1]),j.set([a,n],k.get([n,a]).neg().sub(d.dot(m)).div(T.sub(O)))):j.setRow(a,j.getRow(n))}for(a=0;a<w;a++)d=j.getRow(a),j.setRow(a,d.div(d.norm2()));return j=j.transpose(),j=C.transjugate().dot(j),{lambda:k.getDiag(),E:j}},numeric.ccsSparse=function(e){var t,r,n,i,a=e.length,o=[];for(n=a-1;-1!==n;--n){r=e[n];for(i in r){for(i=parseInt(i);i>=o.length;)o[o.length]=0;0!==r[i]&&o[i]++}}var t=o.length,s=Array(t+1);for(s[0]=0,n=0;n<t;++n)s[n+1]=s[n]+o[n];var u=Array(s[t]),c=Array(s[t]);for(n=a-1;-1!==n;--n){r=e[n];for(i in r)0!==r[i]&&(o[i]--,u[s[i]+o[i]]=n,c[s[i]+o[i]]=r[i])}return[s,u,c]},numeric.ccsFull=function(e){var t,r,n,i,a=e[0],o=e[1],s=e[2],u=numeric.ccsDim(e),c=u[0],f=u[1],h=numeric.rep([c,f],0);for(t=0;t<f;t++)for(n=a[t],i=a[t+1],r=n;r<i;++r)h[o[r]][t]=s[r];return h},numeric.ccsTSolve=function(e,t,r,n,i){function a(e){var t;if(0===r[e]){for(r[e]=1,t=o[e];t<o[e+1];++t)a(s[t]);i[h]=e,++h}}var o=e[0],s=e[1],u=e[2],c=o.length-1,f=Math.max,h=0;void 0===n&&(r=numeric.rep([c],0)),void 0===n&&(n=numeric.linspace(0,r.length-1)),void 0===i&&(i=[]);var l,d,m,p,v,g,y;for(l=n.length-1;-1!==l;--l)a(n[l]);for(i.length=h,l=i.length-1;-1!==l;--l)r[i[l]]=0;for(l=n.length-1;-1!==l;--l)d=n[l],r[d]=t[d];for(l=i.length-1;-1!==l;--l){for(d=i[l],m=o[d],p=f(o[d+1],m),v=m;v!==p;++v)if(s[v]===d){r[d]/=u[v];break}for(y=r[d],v=m;v!==p;++v)(g=s[v])!==d&&(r[g]-=y*u[v])}return r},numeric.ccsDFS=function(e){this.k=Array(e),this.k1=Array(e),this.j=Array(e)},numeric.ccsDFS.prototype.dfs=function(e,t,r,n,i,a){var o,s,u,c=0,f=i.length,h=this.k,l=this.k1,d=this.j;if(0===n[e])for(n[e]=1,d[0]=e,h[0]=s=t[e],l[0]=u=t[e+1];;)if(s>=u){if(i[f]=d[c],0===c)return;++f,--c,s=h[c],u=l[c]}else o=a[r[s]],0===n[o]?(n[o]=1,h[c]=s,++c,d[c]=o,s=t[o],l[c]=u=t[o+1]):++s},numeric.ccsLPSolve=function(e,t,r,n,i,a,o){var s,u,c,f,h,l,d,m,p,v=e[0],g=e[1],y=e[2],b=(v.length,t[0]),M=t[1],x=t[2];for(u=b[i],c=b[i+1],n.length=0,s=u;s<c;++s)o.dfs(a[M[s]],v,g,r,n,a);for(s=n.length-1;-1!==s;--s)r[n[s]]=0;for(s=u;s!==c;++s)f=a[M[s]],r[f]=x[s];for(s=n.length-1;-1!==s;--s){for(f=n[s],h=v[f],l=v[f+1],d=h;d<l;++d)if(a[g[d]]===f){r[f]/=y[d];break}for(p=r[f],d=h;d<l;++d)(m=a[g[d]])!==f&&(r[m]-=p*y[d])}return r},numeric.ccsLUP1=function(e,t){var r,n,i,a,o,s,u,c=e[0].length-1,f=[numeric.rep([c+1],0),[],[]],h=[numeric.rep([c+1],0),[],[]],l=f[0],d=f[1],m=f[2],p=h[0],v=h[1],g=h[2],y=numeric.rep([c],0),b=numeric.rep([c],0),M=numeric.ccsLPSolve,x=(Math.max,Math.abs),w=numeric.linspace(0,c-1),_=numeric.linspace(0,c-1),S=new numeric.ccsDFS(c);for(void 0===t&&(t=1),r=0;r<c;++r){for(M(f,e,y,b,r,_,S),a=-1,o=-1,n=b.length-1;-1!==n;--n)(i=b[n])<=r||(s=x(y[i]))>a&&(o=i,a=s);for(x(y[r])<t*a&&(n=w[r],a=w[o],w[r]=a,_[a]=r,w[o]=n,_[n]=o,a=y[r],y[r]=y[o],y[o]=a),a=l[r],o=p[r],u=y[r],d[a]=w[r],m[a]=1,++a,n=b.length-1;-1!==n;--n)i=b[n],s=y[i],b[n]=0,y[i]=0,i<=r?(v[o]=i,g[o]=s,++o):(d[a]=w[i],m[a]=s/u,++a);l[r+1]=a,p[r+1]=o}for(n=d.length-1;-1!==n;--n)d[n]=_[d[n]];return{L:f,U:h,P:w,Pinv:_}},numeric.ccsDFS0=function(e){this.k=Array(e),this.k1=Array(e),this.j=Array(e)},numeric.ccsDFS0.prototype.dfs=function(e,t,r,n,i,a,o){var s,u,c,f=0,h=i.length,l=this.k,d=this.k1,m=this.j;if(0===n[e])for(n[e]=1,m[0]=e,l[0]=u=t[a[e]],d[0]=c=t[a[e]+1];;){if(isNaN(u))throw new Error("Ow!");if(u>=c){if(i[h]=a[m[f]],0===f)return;++h,--f,u=l[f],c=d[f]}else s=r[u],0===n[s]?(n[s]=1,l[f]=u,++f,m[f]=s,s=a[s],u=t[s],d[f]=c=t[s+1]):++u}},numeric.ccsLPSolve0=function(e,t,r,n,i,a,o,s){var u,c,f,h,l,d,m,p,v,g=e[0],y=e[1],b=e[2],M=(g.length,t[0]),x=t[1],w=t[2];for(c=M[i],f=M[i+1],n.length=0,u=c;u<f;++u)s.dfs(x[u],g,y,r,n,a,o);for(u=n.length-1;-1!==u;--u)h=n[u],r[o[h]]=0;for(u=c;u!==f;++u)h=x[u],r[h]=w[u];for(u=n.length-1;-1!==u;--u){for(h=n[u],p=o[h],l=g[h],d=g[h+1],m=l;m<d;++m)if(y[m]===p){r[p]/=b[m];break}for(v=r[p],m=l;m<d;++m)r[y[m]]-=v*b[m];r[p]=v}},numeric.ccsLUP0=function(e,t){var r,n,i,a,o,s,u,c=e[0].length-1,f=[numeric.rep([c+1],0),[],[]],h=[numeric.rep([c+1],0),[],[]],l=f[0],d=f[1],m=f[2],p=h[0],v=h[1],g=h[2],y=numeric.rep([c],0),b=numeric.rep([c],0),M=numeric.ccsLPSolve0,x=(Math.max,Math.abs),w=numeric.linspace(0,c-1),_=numeric.linspace(0,c-1),S=new numeric.ccsDFS0(c);for(void 0===t&&(t=1),r=0;r<c;++r){for(M(f,e,y,b,r,_,w,S),a=-1,o=-1,n=b.length-1;-1!==n;--n)(i=b[n])<=r||(s=x(y[w[i]]))>a&&(o=i,a=s);for(x(y[w[r]])<t*a&&(n=w[r],a=w[o],w[r]=a,_[a]=r,w[o]=n,_[n]=o),a=l[r],o=p[r],u=y[w[r]],d[a]=w[r],m[a]=1,++a,n=b.length-1;-1!==n;--n)i=b[n],s=y[w[i]],b[n]=0,y[w[i]]=0,i<=r?(v[o]=i,g[o]=s,++o):(d[a]=w[i],m[a]=s/u,++a);l[r+1]=a,p[r+1]=o}for(n=d.length-1;-1!==n;--n)d[n]=_[d[n]];return{L:f,U:h,P:w,Pinv:_}},numeric.ccsLUP=numeric.ccsLUP0,numeric.ccsDim=function(e){return[numeric.sup(e[1])+1,e[0].length-1]},numeric.ccsGetBlock=function(e,t,r){var n=numeric.ccsDim(e),i=n[0],a=n[1];void 0===t?t=numeric.linspace(0,i-1):"number"==typeof t&&(t=[t]),void 0===r?r=numeric.linspace(0,a-1):"number"==typeof r&&(r=[r]);var o,s,u,c,f,h=t.length,l=r.length,d=numeric.rep([a],0),m=[],p=[],v=[d,m,p],g=e[0],y=e[1],b=e[2],M=numeric.rep([i],0),x=0,w=numeric.rep([i],0);for(s=0;s<l;++s){c=r[s];var _=g[c],S=g[c+1];for(o=_;o<S;++o)u=y[o],w[u]=1,M[u]=b[o];for(o=0;o<h;++o)f=t[o],w[f]&&(m[x]=o,p[x]=M[t[o]],++x);for(o=_;o<S;++o)u=y[o],w[u]=0;d[s+1]=x}return v},numeric.ccsDot=function(e,t){var r,n,i,a,o,s,u,c,f,h,l,d=e[0],m=e[1],p=e[2],v=t[0],g=t[1],y=t[2],b=numeric.ccsDim(e),M=numeric.ccsDim(t),x=b[0],w=(b[1],M[1]),_=numeric.rep([x],0),S=numeric.rep([x],0),C=Array(x),P=numeric.rep([w],0),A=[],k=[],j=[P,A,k];for(i=0;i!==w;++i){for(a=v[i],o=v[i+1],f=0,n=a;n<o;++n)for(h=g[n],l=y[n],s=d[h],u=d[h+1],r=s;r<u;++r)c=m[r],0===S[c]&&(C[f]=c,S[c]=1,f+=1),_[c]=_[c]+p[r]*l;for(a=P[i],o=a+f,P[i+1]=o,n=f-1;-1!==n;--n)l=a+n,r=C[n],A[l]=r,k[l]=_[r],S[r]=0,_[r]=0;P[i+1]=P[i]+f}return j},numeric.ccsLUPSolve=function(e,t){var r=e.L,n=e.U,i=(e.P,t[0]),a=!1;"object"!=typeof i&&(t=[[0,t.length],numeric.linspace(0,t.length-1),t],i=t[0],a=!0);var o,s,u,c,f,h,l=t[1],d=t[2],m=r[0].length-1,p=i.length-1,v=numeric.rep([m],0),g=Array(m),y=numeric.rep([m],0),b=Array(m),M=numeric.rep([p+1],0),x=[],w=[],_=numeric.ccsTSolve,S=0;for(o=0;o<p;++o){for(f=0,u=i[o],c=i[o+1],s=u;s<c;++s)h=e.Pinv[l[s]],b[f]=h,y[h]=d[s],++f;for(b.length=f,_(r,y,v,b,g),s=b.length-1;-1!==s;--s)y[b[s]]=0;if(_(n,v,y,g,b),a)return y;for(s=g.length-1;-1!==s;--s)v[g[s]]=0;for(s=b.length-1;-1!==s;--s)h=b[s],x[S]=h,w[S]=y[h],y[h]=0,++S;M[o+1]=S}return[M,x,w]},numeric.ccsbinop=function(e,t){return void 0===t&&(t=""),Function("X","Y","var Xi = X[0], Xj = X[1], Xv = X[2];\nvar Yi = Y[0], Yj = Y[1], Yv = Y[2];\nvar n = Xi.length-1,m = Math.max(numeric.sup(Xj),numeric.sup(Yj))+1;\nvar Zi = numeric.rep([n+1],0), Zj = [], Zv = [];\nvar x = numeric.rep([m],0),y = numeric.rep([m],0);\nvar xk,yk,zk;\nvar i,j,j0,j1,k,p=0;\n"+t+"for(i=0;i<n;++i) {\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Xj[j];\n x[k] = 1;\n Zj[p] = k;\n ++p;\n }\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Yj[j];\n y[k] = Yv[j];\n if(x[k] === 0) {\n Zj[p] = k;\n ++p;\n }\n }\n Zi[i+1] = p;\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = Xv[j];\n j0 = Zi[i]; j1 = Zi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Zj[j];\n xk = x[k];\n yk = y[k];\n"+e+"\n Zv[j] = zk;\n }\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = 0;\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) y[Yj[j]] = 0;\n}\nreturn [Zi,Zj,Zv];")},function(){var k,A,B,C;for(k in numeric.ops2)A=isFinite(eval("1"+numeric.ops2[k]+"0"))?"[Y[0],Y[1],numeric."+k+"(X,Y[2])]":"NaN",B=isFinite(eval("0"+numeric.ops2[k]+"1"))?"[X[0],X[1],numeric."+k+"(X[2],Y)]":"NaN",C=isFinite(eval("1"+numeric.ops2[k]+"0"))&&isFinite(eval("0"+numeric.ops2[k]+"1"))?"numeric.ccs"+k+"MM(X,Y)":"NaN",numeric["ccs"+k+"MM"]=numeric.ccsbinop("zk = xk "+numeric.ops2[k]+"yk;"),numeric["ccs"+k]=Function("X","Y",'if(typeof X === "number") return '+A+';\nif(typeof Y === "number") return '+B+";\nreturn "+C+";\n")}(),numeric.ccsScatter=function(e){var t,r=e[0],n=e[1],i=e[2],a=numeric.sup(n)+1,o=r.length,s=numeric.rep([a],0),u=Array(o),c=Array(o),f=numeric.rep([a],0);for(t=0;t<o;++t)f[n[t]]++;for(t=0;t<a;++t)s[t+1]=s[t]+f[t];var h,l,d=s.slice(0);for(t=0;t<o;++t)l=n[t],h=d[l],u[h]=r[t],c[h]=i[t],d[l]=d[l]+1;return[s,u,c]},numeric.ccsGather=function(e){var t,r,n,i,a,o=e[0],s=e[1],u=e[2],c=o.length-1,f=s.length,h=Array(f),l=Array(f),d=Array(f);for(a=0,t=0;t<c;++t)for(n=o[t],i=o[t+1],r=n;r!==i;++r)l[a]=t,h[a]=s[r],d[a]=u[r],++a;return[h,l,d]},numeric.sdim=function e(t,r,n){if(void 0===r&&(r=[]),"object"!=typeof t)return r;void 0===n&&(n=0),n in r||(r[n]=0),t.length>r[n]&&(r[n]=t.length);var i;for(i in t)t.hasOwnProperty(i)&&e(t[i],r,n+1);return r},numeric.sclone=function e(t,r,n){void 0===r&&(r=0),void 0===n&&(n=numeric.sdim(t).length);var i,a=Array(t.length);if(r===n-1){for(i in t)t.hasOwnProperty(i)&&(a[i]=t[i]);return a}for(i in t)t.hasOwnProperty(i)&&(a[i]=e(t[i],r+1,n));return a},numeric.sdiag=function(e){var t,r,n=e.length,i=Array(n);for(t=n-1;t>=1;t-=2)r=t-1,i[t]=[],i[t][t]=e[t],i[r]=[],i[r][r]=e[r];return 0===t&&(i[0]=[],i[0][0]=e[t]),i},numeric.sidentity=function(e){return numeric.sdiag(numeric.rep([e],1))},numeric.stranspose=function(e){var t,r,n,i=[];e.length;for(t in e)if(e.hasOwnProperty(t)){n=e[t];for(r in n)n.hasOwnProperty(r)&&("object"!=typeof i[r]&&(i[r]=[]),i[r][t]=n[r])}return i},numeric.sLUP=function(e,t){throw new Error("The function numeric.sLUP had a bug in it and has been removed. Please use the new numeric.ccsLUP function instead.")},numeric.sdotMM=function(e,t){var r,n,i,a,o,s,u,c=e.length,f=(t.length,numeric.stranspose(t)),h=f.length,l=Array(c);for(i=c-1;i>=0;i--){for(u=[],r=e[i],o=h-1;o>=0;o--){s=0,n=f[o];for(a in r)r.hasOwnProperty(a)&&a in n&&(s+=r[a]*n[a]);s&&(u[o]=s)}l[i]=u}return l},numeric.sdotMV=function(e,t){var r,n,i,a,o=e.length,s=Array(o);for(n=o-1;n>=0;n--){r=e[n],a=0;for(i in r)r.hasOwnProperty(i)&&t[i]&&(a+=r[i]*t[i]);a&&(s[n]=a)}return s},numeric.sdotVM=function(e,t){var r,n,i,a,o=[];for(r in e)if(e.hasOwnProperty(r)){i=t[r],a=e[r];for(n in i)i.hasOwnProperty(n)&&(o[n]||(o[n]=0),o[n]+=a*i[n])}return o},numeric.sdotVV=function(e,t){var r,n=0;for(r in e)e[r]&&t[r]&&(n+=e[r]*t[r]);return n},numeric.sdot=function(e,t){var r=numeric.sdim(e).length,n=numeric.sdim(t).length;switch(1e3*r+n){case 0:return e*t;case 1001:return numeric.sdotVV(e,t);case 2001:return numeric.sdotMV(e,t);case 1002:return numeric.sdotVM(e,t);case 2002:return numeric.sdotMM(e,t);default:throw new Error("numeric.sdot not implemented for tensors of order "+r+" and "+n)}},numeric.sscatter=function(e){var t,r,n,i,a=e[0].length,o=e.length,s=[];for(r=a-1;r>=0;--r)if(e[o-1][r]){for(i=s,n=0;n<o-2;n++)t=e[n][r],i[t]||(i[t]=[]),i=i[t];i[e[n][r]]=e[n+1][r]}return s},numeric.sgather=function e(t,r,n){void 0===r&&(r=[]),void 0===n&&(n=[]);var i,a,o;i=n.length;for(a in t)if(t.hasOwnProperty(a))if(n[i]=parseInt(a),"number"==typeof(o=t[a])){if(o){if(0===r.length)for(a=i+1;a>=0;--a)r[a]=[];for(a=i;a>=0;--a)r[a].push(n[a]);r[i+1].push(o)}}else e(o,r,n);return n.length>i&&n.pop(),r},numeric.cLU=function(e){var t,r,n,i,a,o,s=e[0],u=e[1],c=e[2],f=s.length,h=0;for(t=0;t<f;t++)s[t]>h&&(h=s[t]);h++;var l,d,m,p=Array(h),v=Array(h),g=numeric.rep([h],1/0),y=numeric.rep([h],-1/0);for(n=0;n<f;n++)t=s[n],r=u[n],r<g[t]&&(g[t]=r),r>y[t]&&(y[t]=r);for(t=0;t<h-1;t++)y[t]>y[t+1]&&(y[t+1]=y[t]);for(t=h-1;t>=1;t--)g[t]<g[t-1]&&(g[t-1]=g[t]);var b=0,M=0;for(t=0;t<h;t++)v[t]=numeric.rep([y[t]-g[t]+1],0),p[t]=numeric.rep([t-g[t]],0),b+=t-g[t]+1,M+=y[t]-t+1;for(n=0;n<f;n++)t=s[n],v[t][u[n]-g[t]]=c[n];for(t=0;t<h-1;t++)for(i=t-g[t],l=v[t],r=t+1;g[r]<=t&&r<h;r++)if(a=t-g[r],o=y[t]-t,d=v[r],m=d[a]/l[i]){for(n=1;n<=o;n++)d[n+a]-=m*l[n+i];p[r][t-g[r]]=m}var f,x,w,l=[],d=[],_=[],S=[],C=[],P=[];for(f=0,x=0,t=0;t<h;t++){for(i=g[t],a=y[t],w=v[t],r=t;r<=a;r++)w[r-i]&&(l[f]=t,d[f]=r,_[f]=w[r-i],f++);for(w=p[t],r=i;r<t;r++)w[r-i]&&(S[x]=t,C[x]=r,P[x]=w[r-i],x++);S[x]=t,C[x]=t,P[x]=1,x++}return{U:[l,d,_],L:[S,C,P]}},numeric.cLUsolve=function(e,t){var r,n,i=e.L,a=e.U,o=numeric.clone(t),s=i[0],u=i[1],c=i[2],f=a[0],h=a[1],l=a[2],d=f.length,m=(s.length,o.length);for(n=0,r=0;r<m;r++){for(;u[n]<r;)o[r]-=c[n]*o[u[n]],n++;n++}for(n=d-1,r=m-1;r>=0;r--){for(;h[n]>r;)o[r]-=l[n]*o[h[n]],n--;o[r]/=l[n],n--}return o},numeric.cgrid=function(e,t){"number"==typeof e&&(e=[e,e]);var r,n,i,a=numeric.rep(e,-1);if("function"!=typeof t)switch(t){case"L":t=function(t,r){return t>=e[0]/2||r<e[1]/2};break;default:t=function(e,t){return!0}}for(i=0,r=1;r<e[0]-1;r++)for(n=1;n<e[1]-1;n++)t(r,n)&&(a[r][n]=i,i++);return a},numeric.cdelsq=function(e){var t,r,n,i,a,o=[[-1,0],[0,-1],[0,1],[1,0]],s=numeric.dim(e),u=s[0],c=s[1],f=[],h=[],l=[];for(t=1;t<u-1;t++)for(r=1;r<c-1;r++)if(!(e[t][r]<0)){for(n=0;n<4;n++)i=t+o[n][0],a=r+o[n][1],e[i][a]<0||(f.push(e[t][r]),h.push(e[i][a]),l.push(-1));f.push(e[t][r]),h.push(e[t][r]),l.push(4)}return[f,h,l]},numeric.cdotMV=function(e,t){var r,n,i,a=e[0],o=e[1],s=e[2],u=a.length;for(i=0,n=0;n<u;n++)a[n]>i&&(i=a[n]);for(i++,r=numeric.rep([i],0),n=0;n<u;n++)r[a[n]]+=s[n]*t[o[n]];return r},numeric.Spline=function(e,t,r,n,i){this.x=e,this.yl=t,this.yr=r,this.kl=n,this.kr=i},numeric.Spline.prototype._at=function(e,t){var e,r,n,i,a=this.x,o=this.yl,s=this.yr,u=this.kl,c=this.kr,f=numeric.add,h=numeric.sub,l=numeric.mul;r=h(l(u[t],a[t+1]-a[t]),h(s[t+1],o[t])),n=f(l(c[t+1],a[t]-a[t+1]),h(s[t+1],o[t])),i=(e-a[t])/(a[t+1]-a[t]);var d=i*(1-i);return f(f(f(l(1-i,o[t]),l(i,s[t+1])),l(r,d*(1-i))),l(n,d*i))},numeric.Spline.prototype.at=function(e){if("number"==typeof e){var t,r,n,i=this.x,a=i.length,o=Math.floor;for(t=0,r=a-1;r-t>1;)n=o((t+r)/2),i[n]<=e?t=n:r=n;return this._at(e,t)}var s,a=e.length,u=Array(a);for(s=a-1;-1!==s;--s)u[s]=this.at(e[s]);return u},numeric.Spline.prototype.diff=function(){var e,t,r,n=this.x,i=this.yl,a=this.yr,o=this.kl,s=this.kr,u=i.length,c=o,f=s,h=Array(u),l=Array(u),d=numeric.add,m=numeric.mul,p=numeric.div,v=numeric.sub;for(e=u-1;-1!==e;--e)t=n[e+1]-n[e],r=v(a[e+1],i[e]),h[e]=p(d(m(r,6),m(o[e],-4*t),m(s[e+1],-2*t)),t*t),l[e+1]=p(d(m(r,-6),m(o[e],2*t),m(s[e+1],4*t)),t*t);return new numeric.Spline(n,c,f,h,l)},numeric.Spline.prototype.roots=function(){var e=[],t=this.x,r=this.yl,n=this.yr,i=this.kl,a=this.kr;"number"==typeof r[0]&&(r=[r],n=[n],i=[i],a=[a]);var o,s,u,c,f,h,l,d,m,p,v,g,y,b,M,x,w,_,S,C,P,A,k,j=r.length,T=t.length-1,e=Array(j),O=Math.sqrt;for(o=0;o!==j;++o){for(c=r[o],f=n[o],h=i[o],l=a[o],d=[],s=0;s!==T;s++){for(s>0&&f[s]*c[s]<0&&d.push(t[s]),x=t[s+1]-t[s],t[s],v=c[s],g=f[s+1],m=h[s]/x,p=l[s+1]/x,M=function(e){return e*e}(m-p+3*(v-g))+12*p*v,y=p+3*v+2*m-3*g,b=3*(p+m+2*(v-g)),M<=0?(_=y/b,w=_>t[s]&&_<t[s+1]?[t[s],_,t[s+1]]:[t[s],t[s+1]]):(_=(y-O(M))/b,S=(y+O(M))/b,w=[t[s]],_>t[s]&&_<t[s+1]&&w.push(_),S>t[s]&&S<t[s+1]&&w.push(S),w.push(t[s+1])),P=w[0],_=this._at(P,s),u=0;u<w.length-1;u++)if(A=w[u+1],S=this._at(A,s),0!==_)if(0===S||_*S>0)P=A,_=S;else{for(var D=0;;){if((k=(_*A-S*P)/(_-S))<=P||k>=A)break;if((C=this._at(k,s))*S>0)A=k,S=C,-1===D&&(_*=.5),D=-1;else{if(!(C*_>0))break;P=k,_=C,1===D&&(S*=.5),D=1}}d.push(k),P=w[u+1],_=this._at(P,s)}else d.push(P),P=A,_=S;0===S&&d.push(A)}e[o]=d}return"number"==typeof this.yl[0]?e[0]:e},numeric.spline=function(e,t,r,n){var i,a=e.length,o=[],s=[],u=[],c=numeric.sub,f=numeric.mul,h=numeric.add;for(i=a-2;i>=0;i--)s[i]=e[i+1]-e[i],u[i]=c(t[i+1],t[i]);"string"!=typeof r&&"string"!=typeof n||(r=n="periodic");var l=[[],[],[]];switch(typeof r){case"undefined":o[0]=f(3/(s[0]*s[0]),u[0]),l[0].push(0,0),l[1].push(0,1),l[2].push(2/s[0],1/s[0]);break;case"string":o[0]=h(f(3/(s[a-2]*s[a-2]),u[a-2]),f(3/(s[0]*s[0]),u[0])),l[0].push(0,0,0),l[1].push(a-2,0,1),l[2].push(1/s[a-2],2/s[a-2]+2/s[0],1/s[0]);break;default:o[0]=r,l[0].push(0),l[1].push(0),l[2].push(1)}for(i=1;i<a-1;i++)o[i]=h(f(3/(s[i-1]*s[i-1]),u[i-1]),f(3/(s[i]*s[i]),u[i])),l[0].push(i,i,i),l[1].push(i-1,i,i+1),l[2].push(1/s[i-1],2/s[i-1]+2/s[i],1/s[i]);switch(typeof n){case"undefined":o[a-1]=f(3/(s[a-2]*s[a-2]),u[a-2]),l[0].push(a-1,a-1),l[1].push(a-2,a-1),l[2].push(1/s[a-2],2/s[a-2]);break;case"string":l[1][l[1].length-1]=0;break;default:o[a-1]=n,l[0].push(a-1),l[1].push(a-1),l[2].push(1)}o="number"!=typeof o[0]?numeric.transpose(o):[o];var d=Array(o.length);if("string"==typeof r)for(i=d.length-1;-1!==i;--i)d[i]=numeric.ccsLUPSolve(numeric.ccsLUP(numeric.ccsScatter(l)),o[i]),d[i][a-1]=d[i][0];else for(i=d.length-1;-1!==i;--i)d[i]=numeric.cLUsolve(numeric.cLU(l),o[i]);return d="number"==typeof t[0]?d[0]:numeric.transpose(d),new numeric.Spline(e,t,t,d,d)},numeric.fftpow2=function e(t,r){var n=t.length;if(1!==n){var i,a,o=Math.cos,s=Math.sin,u=Array(n/2),c=Array(n/2),f=Array(n/2),h=Array(n/2);for(a=n/2,i=n-1;-1!==i;--i)--a,f[a]=t[i],h[a]=r[i],--i,u[a]=t[i],c[a]=r[i];e(u,c),e(f,h),a=n/2;var l,d,m,p=-6.283185307179586/n;for(i=n-1;-1!==i;--i)--a,-1===a&&(a=n/2-1),l=p*i,d=o(l),m=s(l),t[i]=u[a]+d*f[a]-m*h[a],r[i]=c[a]+d*h[a]+m*f[a]}},numeric._ifftpow2=function e(t,r){var n=t.length;if(1!==n){var i,a,o=Math.cos,s=Math.sin,u=Array(n/2),c=Array(n/2),f=Array(n/2),h=Array(n/2);for(a=n/2,i=n-1;-1!==i;--i)--a,f[a]=t[i],h[a]=r[i],--i,u[a]=t[i],c[a]=r[i];e(u,c),e(f,h),a=n/2;var l,d,m,p=6.283185307179586/n;for(i=n-1;-1!==i;--i)--a,-1===a&&(a=n/2-1),l=p*i,d=o(l),m=s(l),t[i]=u[a]+d*f[a]-m*h[a],r[i]=c[a]+d*h[a]+m*f[a]}},numeric.ifftpow2=function(e,t){numeric._ifftpow2(e,t),numeric.diveq(e,e.length),numeric.diveq(t,t.length)},numeric.convpow2=function(e,t,r,n){numeric.fftpow2(e,t),numeric.fftpow2(r,n);var i,a,o,s,u,c=e.length;for(i=c-1;-1!==i;--i)a=e[i],s=t[i],o=r[i],u=n[i],e[i]=a*o-s*u,t[i]=a*u+s*o;numeric.ifftpow2(e,t)},numeric.T.prototype.fft=function(){var e,t,r=this.x,n=this.y,i=r.length,a=Math.log,o=a(2),s=Math.ceil(a(2*i-1)/o),u=Math.pow(2,s),c=numeric.rep([u],0),f=numeric.rep([u],0),h=Math.cos,l=Math.sin,d=-3.141592653589793/i,m=numeric.rep([u],0),p=numeric.rep([u],0);Math.floor(i/2);for(e=0;e<i;e++)m[e]=r[e];if(void 0!==n)for(e=0;e<i;e++)p[e]=n[e];for(c[0]=1,e=1;e<=u/2;e++)t=d*e*e,c[e]=h(t),f[e]=l(t),c[u-e]=h(t),f[u-e]=l(t);var v=new numeric.T(m,p),g=new numeric.T(c,f);return v=v.mul(g),numeric.convpow2(v.x,v.y,numeric.clone(g.x),numeric.neg(g.y)),v=v.mul(g),v.x.length=i,v.y.length=i,v},numeric.T.prototype.ifft=function(){var e,t,r=this.x,n=this.y,i=r.length,a=Math.log,o=a(2),s=Math.ceil(a(2*i-1)/o),u=Math.pow(2,s),c=numeric.rep([u],0),f=numeric.rep([u],0),h=Math.cos,l=Math.sin,d=3.141592653589793/i,m=numeric.rep([u],0),p=numeric.rep([u],0);Math.floor(i/2);for(e=0;e<i;e++)m[e]=r[e];if(void 0!==n)for(e=0;e<i;e++)p[e]=n[e];for(c[0]=1,e=1;e<=u/2;e++)t=d*e*e,c[e]=h(t),f[e]=l(t),c[u-e]=h(t),f[u-e]=l(t);var v=new numeric.T(m,p),g=new numeric.T(c,f);return v=v.mul(g),numeric.convpow2(v.x,v.y,numeric.clone(g.x),numeric.neg(g.y)),v=v.mul(g),v.x.length=i,v.y.length=i,v.div(i)},numeric.gradient=function(e,t){var r=t.length,n=e(t);if(isNaN(n))throw new Error("gradient: f(x) is a NaN!");var i,a,o,s,u,c,f,h,l,d=Math.max,m=numeric.clone(t),p=Array(r),d=(numeric.div,numeric.sub,Math.max),v=Math.abs,g=Math.min,y=0;for(i=0;i<r;i++)for(var b=d(1e-6*n,1e-8);;){if(++y>20)throw new Error("Numerical gradient fails");if(m[i]=t[i]+b,a=e(m),m[i]=t[i]-b,o=e(m),m[i]=t[i],isNaN(a)||isNaN(o))b/=16;else{if(p[i]=(a-o)/(2*b),s=t[i]-b,u=t[i],c=t[i]+b,f=(a-n)/b,
h=(n-o)/b,l=d(v(p[i]),v(n),v(a),v(o),v(s),v(u),v(c),1e-8),!(g(d(v(f-p[i]),v(h-p[i]),v(f-h))/l,b/l)>.001))break;b/=16}}return p},numeric.uncmin=function(e,t,r,n,i,a,o){var s=numeric.gradient;void 0===o&&(o={}),void 0===r&&(r=1e-8),void 0===n&&(n=function(t){return s(e,t)}),void 0===i&&(i=1e3),t=numeric.clone(t);var u,c,f=t.length,h=e(t);if(isNaN(h))throw new Error("uncmin: f(x0) is a NaN!");var l=Math.max,d=numeric.norm2;r=l(r,numeric.epsilon);var m,p,v,g,y,b,M,x,w,_,S=o.Hinv||numeric.identity(f),C=numeric.dot,P=(numeric.inv,numeric.sub),A=numeric.add,k=numeric.tensor,j=numeric.div,T=numeric.mul,O=numeric.all,D=numeric.isFinite,R=numeric.neg,E=0,q="";for(p=n(t);E<i;){if("function"==typeof a&&a(E,t,h,p,S)){q="Callback returned true";break}if(!O(D(p))){q="Gradient has Infinity or NaN";break}if(m=R(C(S,p)),!O(D(m))){q="Search direction has Infinity or NaN";break}if((_=d(m))<r){q="Newton step smaller than tol";break}for(w=1,c=C(p,m),y=t;E<i&&!(w*_<r)&&(g=T(m,w),y=A(t,g),(u=e(y))-h>=.1*w*c||isNaN(u));)w*=.5,++E;if(w*_<r){q="Line search step size smaller than tol";break}if(E===i){q="maxit reached during line search";break}v=n(y),b=P(v,p),x=C(b,g),M=C(S,b),S=P(A(S,T((x+C(b,M))/(x*x),k(g,g))),j(A(k(M,g),k(g,M)),x)),t=y,h=u,p=v,++E}return{solution:t,f:h,gradient:p,invHessian:S,iterations:E,message:q}},numeric.Dopri=function(e,t,r,n,i,a,o){this.x=e,this.y=t,this.f=r,this.ymid=n,this.iterations=i,this.events=o,this.message=a},numeric.Dopri.prototype._at=function(e,t){function r(e){return e*e}var n,i,a,o,s,u,e,c,f,h,l,d=this,m=d.x,p=d.y,v=d.f,g=d.ymid,y=(m.length,Math.floor,numeric.add),b=numeric.mul,M=numeric.sub;return n=m[t],i=m[t+1],o=p[t],s=p[t+1],c=i-n,a=n+.5*c,u=g[t],f=M(v[t],b(o,1/(n-a)+2/(n-i))),h=M(v[t+1],b(s,1/(i-a)+2/(i-n))),l=[r(e-i)*(e-a)/r(n-i)/(n-a),r(e-n)*r(e-i)/r(n-a)/r(i-a),r(e-n)*(e-a)/r(i-n)/(i-a),(e-n)*r(e-i)*(e-a)/r(n-i)/(n-a),(e-i)*r(e-n)*(e-a)/r(n-i)/(i-a)],y(y(y(y(b(o,l[0]),b(u,l[1])),b(s,l[2])),b(f,l[3])),b(h,l[4]))},numeric.Dopri.prototype.at=function(e){var t,r,n,i=Math.floor;if("number"!=typeof e){var a=e.length,o=Array(a);for(t=a-1;-1!==t;--t)o[t]=this.at(e[t]);return o}var s=this.x;for(t=0,r=s.length-1;r-t>1;)n=i(.5*(t+r)),s[n]<=e?t=n:r=n;return this._at(e,t)},numeric.dopri=function(e,t,r,n,i,a,o){void 0===i&&(i=1e-6),void 0===a&&(a=1e3);var s,u,c,f,h,l,d,m,p,v,g,y,b,M=[e],x=[r],w=[n(e,r)],_=[],S=[.075,.225],C=[44/45,-56/15,32/9],P=[19372/6561,-25360/2187,64448/6561,-212/729],A=[9017/3168,-355/33,46732/5247,49/176,-5103/18656],k=[35/384,0,500/1113,125/192,-2187/6784,11/84],j=[.10013431883002395,0,.3918321794184259,-.02982460176594817,.05893268337240795,-.04497888809104361,.023904308236133973],T=[.2,.3,.8,8/9,1,1],O=[-71/57600,0,71/16695,-71/1920,17253/339200,-22/525,.025],D=0,R=(t-e)/10,E=0,q=numeric.add,N=numeric.mul,L=(Math.max,Math.min),F=Math.abs,I=numeric.norminf,B=Math.pow,V=numeric.any,Y=numeric.lt,G=numeric.and,z=(numeric.sub,new numeric.Dopri(M,x,w,_,-1,""));for("function"==typeof o&&(g=o(e,r));e<t&&E<a;)if(++E,e+R>t&&(R=t-e),s=n(e+T[0]*R,q(r,N(.2*R,w[D]))),u=n(e+T[1]*R,q(q(r,N(S[0]*R,w[D])),N(S[1]*R,s))),c=n(e+T[2]*R,q(q(q(r,N(C[0]*R,w[D])),N(C[1]*R,s)),N(C[2]*R,u))),f=n(e+T[3]*R,q(q(q(q(r,N(P[0]*R,w[D])),N(P[1]*R,s)),N(P[2]*R,u)),N(P[3]*R,c))),h=n(e+T[4]*R,q(q(q(q(q(r,N(A[0]*R,w[D])),N(A[1]*R,s)),N(A[2]*R,u)),N(A[3]*R,c)),N(A[4]*R,f))),p=q(q(q(q(q(r,N(w[D],R*k[0])),N(u,R*k[2])),N(c,R*k[3])),N(f,R*k[4])),N(h,R*k[5])),l=n(e+R,p),d=q(q(q(q(q(N(w[D],R*O[0]),N(u,R*O[2])),N(c,R*O[3])),N(f,R*O[4])),N(h,R*O[5])),N(l,R*O[6])),(v="number"==typeof d?F(d):I(d))>i){if(R=.2*R*B(i/v,.25),e+R===e){z.msg="Step size became too small";break}}else{if(_[D]=q(q(q(q(q(q(r,N(w[D],R*j[0])),N(u,R*j[2])),N(c,R*j[3])),N(f,R*j[4])),N(h,R*j[5])),N(l,R*j[6])),++D,M[D]=e+R,x[D]=p,w[D]=l,"function"==typeof o){var H,U,X=e,Q=e+.5*R;if(y=o(Q,_[D-1]),b=G(Y(g,0),Y(0,y)),V(b)||(X=Q,Q=e+R,g=y,y=o(Q,p),b=G(Y(g,0),Y(0,y))),V(b)){for(var Z,W,J=0,K=1,$=1;;){if("number"==typeof g)U=($*y*X-K*g*Q)/($*y-K*g);else for(U=Q,m=g.length-1;-1!==m;--m)g[m]<0&&y[m]>0&&(U=L(U,($*y[m]*X-K*g[m]*Q)/($*y[m]-K*g[m])));if(U<=X||U>=Q)break;H=z._at(U,D-1),W=o(U,H),Z=G(Y(g,0),Y(0,W)),V(Z)?(Q=U,y=W,b=Z,$=1,-1===J?K*=.5:K=1,J=-1):(X=U,g=W,K=1,1===J?$*=.5:$=1,J=1)}return p=z._at(.5*(e+U),D-1),z.f[D]=n(U,H),z.x[D]=U,z.y[D]=H,z.ymid[D-1]=p,z.events=b,z.iterations=E,z}}e+=R,r=p,g=y,R=L(.8*R*B(i/v,.25),4*R)}return z.iterations=E,z},numeric.LU=function(e,t){t=t||!1;var r,n,i,a,o,s,u,c,f,h=Math.abs,l=e.length,d=l-1,m=new Array(l);for(t||(e=numeric.clone(e)),i=0;i<l;++i){for(u=i,s=e[i],f=h(s[i]),n=i+1;n<l;++n)a=h(e[n][i]),f<a&&(f=a,u=n);for(m[i]=u,u!=i&&(e[i]=e[u],e[u]=s,s=e[i]),o=s[i],r=i+1;r<l;++r)e[r][i]/=o;for(r=i+1;r<l;++r){for(c=e[r],n=i+1;n<d;++n)c[n]-=c[i]*s[n],++n,c[n]-=c[i]*s[n];n===d&&(c[n]-=c[i]*s[n])}}return{LU:e,P:m}},numeric.LUsolve=function(e,t){var r,n,i,a,o,s=e.LU,u=s.length,c=numeric.clone(t),f=e.P;for(r=u-1;-1!==r;--r)c[r]=t[r];for(r=0;r<u;++r)for(i=f[r],f[r]!==r&&(o=c[r],c[r]=c[i],c[i]=o),a=s[r],n=0;n<r;++n)c[r]-=c[n]*a[n];for(r=u-1;r>=0;--r){for(a=s[r],n=r+1;n<u;++n)c[r]-=c[n]*a[n];c[r]/=a[r]}return c},numeric.solve=function(e,t,r){return numeric.LUsolve(numeric.LU(e,r),t)},numeric.echelonize=function(e){var t,r,n,i,a,o,s,u,c=numeric.dim(e),f=c[0],h=c[1],l=numeric.identity(f),d=Array(f),m=Math.abs,p=numeric.diveq;for(e=numeric.clone(e),t=0;t<f;++t){for(n=0,a=e[t],o=l[t],r=1;r<h;++r)m(a[n])<m(a[r])&&(n=r);for(d[t]=n,p(o,a[n]),p(a,a[n]),r=0;r<f;++r)if(r!==t){for(s=e[r],u=s[n],i=h-1;-1!==i;--i)s[i]-=a[i]*u;for(s=l[r],i=f-1;-1!==i;--i)s[i]-=o[i]*u}}return{I:l,A:e,P:d}},numeric.__solveLP=function(e,t,r,n,i,a,o){var s,u,c,f,h=numeric.sum,l=(numeric.log,numeric.mul),d=numeric.sub,m=numeric.dot,p=numeric.div,v=numeric.add,g=e.length,y=r.length,b=!1,M=1,x=(numeric.transpose(t),numeric.svd,numeric.transpose),w=(numeric.leq,Math.sqrt),_=Math.abs,S=(numeric.muleq,numeric.norminf,numeric.any,Math.min),C=numeric.all,P=numeric.gt,A=Array(g),k=Array(y),j=(numeric.rep([y],1),numeric.solve),T=d(r,m(t,a)),O=m(e,e);for(c=0;c<i;++c){var D,R;for(D=y-1;-1!==D;--D)k[D]=p(t[D],T[D]);var E=x(k);for(D=g-1;-1!==D;--D)A[D]=h(E[D]);M=.25*_(O/m(e,A));var q=100*w(O/m(A,A));for((!isFinite(M)||M>q)&&(M=q),f=v(e,l(M,A)),u=m(E,k),D=g-1;-1!==D;--D)u[D][D]+=1;R=j(u,p(f,M),!0);var N=p(T,m(t,R)),L=1;for(D=y-1;-1!==D;--D)N[D]<0&&(L=S(L,-.999*N[D]));if(s=d(a,l(R,L)),T=d(r,m(t,s)),!C(P(T,0)))return{solution:a,message:"",iterations:c};if(a=s,M<n)return{solution:s,message:"",iterations:c};if(o){var F=m(e,f),I=m(t,f);for(b=!0,D=y-1;-1!==D;--D)if(F*I[D]<0){b=!1;break}}else b=!(a[g-1]>=0);if(b)return{solution:s,message:"Unbounded",iterations:c}}return{solution:a,message:"maximum iteration count exceeded",iterations:c}},numeric._solveLP=function(e,t,r,n,i){var a,o=e.length,s=r.length,u=(numeric.sum,numeric.log,numeric.mul,numeric.sub),c=numeric.dot,f=(numeric.div,numeric.add,numeric.rep([o],0).concat([1])),h=numeric.rep([s,1],-1),l=numeric.blockMatrix([[t,h]]),d=r,a=numeric.rep([o],0).concat(Math.max(0,numeric.sup(numeric.neg(r)))+1),m=numeric.__solveLP(f,l,d,n,i,a,!1),p=numeric.clone(m.solution);if(p.length=o,numeric.inf(u(r,c(t,p)))<0)return{solution:NaN,message:"Infeasible",iterations:m.iterations};var v=numeric.__solveLP(e,t,r,n,i-m.iterations,p,!0);return v.iterations+=m.iterations,v},numeric.solveLP=function(e,t,r,n,i,a,o){if(void 0===o&&(o=1e3),void 0===a&&(a=numeric.epsilon),void 0===n)return numeric._solveLP(e,t,r,a,o);var s,u=n.length,c=n[0].length,f=t.length,h=numeric.echelonize(n),l=numeric.rep([c],0),d=h.P,m=[];for(s=d.length-1;-1!==s;--s)l[d[s]]=1;for(s=c-1;-1!==s;--s)0===l[s]&&m.push(s);var p=numeric.getRange,v=numeric.linspace(0,u-1),g=numeric.linspace(0,f-1),y=p(n,v,m),b=p(t,g,d),M=p(t,g,m),x=numeric.dot,w=numeric.sub,_=x(b,h.I),S=w(M,x(_,y)),C=w(r,x(_,i)),P=Array(d.length),A=Array(m.length);for(s=d.length-1;-1!==s;--s)P[s]=e[d[s]];for(s=m.length-1;-1!==s;--s)A[s]=e[m[s]];var k=w(A,x(P,x(h.I,y))),j=numeric._solveLP(k,S,C,a,o),T=j.solution;if(T!==T)return j;var O=x(h.I,w(i,x(y,T))),D=Array(e.length);for(s=d.length-1;-1!==s;--s)D[d[s]]=O[s];for(s=m.length-1;-1!==s;--s)D[m[s]]=T[s];return{solution:D,message:j.message,iterations:j.iterations}},numeric.MPStoLP=function(e){function t(t){throw new Error("MPStoLP: "+t+"\nLine "+r+": "+e[r]+"\nCurrent state: "+s[o]+"\n")}e instanceof String&&e.split("\n");var r,n,i,a,o=0,s=["Initial state","NAME","ROWS","COLUMNS","RHS","BOUNDS","ENDATA"],u=e.length,c=0,f={},h=[],l=0,d={},m=0,p=[],v=[],g=[];for(r=0;r<u;++r){i=e[r];var y=i.match(/\S*/g),b=[];for(n=0;n<y.length;++n)""!==y[n]&&b.push(y[n]);if(0!==b.length){for(n=0;n<s.length&&i.substr(0,s[n].length)!==s[n];++n);if(n<s.length){if(o=n,1===n&&(a=b[1]),6===n)return{name:a,c:p,A:numeric.transpose(v),b:g,rows:f,vars:d}}else switch(o){case 0:case 1:t("Unexpected line");case 2:switch(b[0]){case"N":0===c?c=b[1]:t("Two or more N rows");break;case"L":f[b[1]]=l,h[l]=1,g[l]=0,++l;break;case"G":f[b[1]]=l,h[l]=-1,g[l]=0,++l;break;case"E":f[b[1]]=l,h[l]=0,g[l]=0,++l;break;default:t("Parse error "+numeric.prettyPrint(b))}break;case 3:d.hasOwnProperty(b[0])||(d[b[0]]=m,p[m]=0,v[m]=numeric.rep([l],0),++m);var M=d[b[0]];for(n=1;n<b.length;n+=2)if(b[n]!==c){var x=f[b[n]];v[M][x]=(h[x]<0?-1:1)*parseFloat(b[n+1])}else p[M]=parseFloat(b[n+1]);break;case 4:for(n=1;n<b.length;n+=2)g[f[b[n]]]=(h[f[b[n]]]<0?-1:1)*parseFloat(b[n+1]);break;case 5:break;case 6:t("Internal error")}}}t("Reached end of file without ENDATA")},numeric.seedrandom={pow:Math.pow,random:Math.random},function(e,t,r,n,i,a,o){function s(e){var t,n,i=this,a=e.length,o=0,s=i.i=i.j=i.m=0;for(i.S=[],i.c=[],a||(e=[a++]);o<r;)i.S[o]=o++;for(o=0;o<r;o++)t=i.S[o],s=f(s+t+e[o%a]),n=i.S[s],i.S[o]=n,i.S[s]=t;i.g=function(e){var t=i.S,n=f(i.i+1),a=t[n],o=f(i.j+a),s=t[o];t[n]=s,t[o]=a;for(var u=t[f(a+s)];--e;)n=f(n+1),a=t[n],o=f(o+a),s=t[o],t[n]=s,t[o]=a,u=u*r+t[f(a+s)];return i.i=n,i.j=o,u},i.g(r)}function u(e,t,r,n,i){if(r=[],i=typeof e,t&&"object"==i)for(n in e)if(n.indexOf("S")<5)try{r.push(u(e[n],t-1))}catch(e){}return r.length?r:e+("string"!=i?"\0":"")}function c(e,t,r,n){for(e+="",r=0,n=0;n<e.length;n++)t[f(n)]=f((r^=19*t[f(n)])+e.charCodeAt(n));e="";for(n in t)e+=String.fromCharCode(t[n]);return e}function f(e){return e&r-1}t.seedrandom=function(n,f){var h,l=[];return n=c(u(f?[n,e]:arguments.length?n:[(new Date).getTime(),e,window],3),l),h=new s(l),c(h.S,e),t.random=function(){for(var e=h.g(6),t=o,n=0;e<i;)e=(e+n)*r,t*=r,n=h.g(1);for(;e>=a;)e/=2,t/=2,n>>>=1;return(e+n)/t},n},o=t.pow(r,6),i=t.pow(2,i),a=2*i,c(t.random(),e)}([],numeric.seedrandom,256,0,52),function(e){function t(e){if("object"!=typeof e)return e;var r,n=[],i=e.length;for(r=0;r<i;r++)n[r+1]=t(e[r]);return n}function r(e){if("object"!=typeof e)return e;var t,n=[],i=e.length;for(t=1;t<i;t++)n[t-1]=r(e[t]);return n}function n(e,t,r){var n,i,a,o,s;for(a=1;a<=r;a+=1){for(e[a][a]=1/e[a][a],s=-e[a][a],n=1;n<a;n+=1)e[n][a]=s*e[n][a];if(o=a+1,r<o)break;for(i=o;i<=r;i+=1)for(s=e[a][i],e[a][i]=0,n=1;n<=a;n+=1)e[n][i]=e[n][i]+s*e[n][a]}}function i(e,t,r,n){var i,a,o,s;for(a=1;a<=r;a+=1){for(s=0,i=1;i<a;i+=1)s+=e[i][a]*n[i];n[a]=(n[a]-s)/e[a][a]}for(o=1;o<=r;o+=1)for(a=r+1-o,n[a]=n[a]/e[a][a],s=-n[a],i=1;i<a;i+=1)n[i]=n[i]+s*e[i][a]}function a(e,t,r,n){var i,a,o,s,u,c;for(a=1;a<=r;a+=1){if(n[1]=a,c=0,(o=a-1)<1){if((c=e[a][a]-c)<=0)break;e[a][a]=Math.sqrt(c)}else{for(s=1;s<=o;s+=1){for(u=e[s][a],i=1;i<s;i+=1)u-=e[i][a]*e[i][s];u/=e[s][s],e[s][a]=u,c+=u*u}if((c=e[a][a]-c)<=0)break;e[a][a]=Math.sqrt(c)}n[1]=0}}function o(e,t,r,o,s,u,c,f,h,l,d,m,p,v,g,y){function b(){return g[T+p]=g[T+p+1],g[T+p+1]=0,m[p]=0,p-=1,v[2]=v[2]+1,0}var M,x,w,_,S,C,P,A,k,j,T,O,D,R,E,q,N,L,F,I,B,V,Y,G,z,H,U;D=Math.min(o,l),w=2*o+D*(D+5)/2+2*l+1,G=1e-60;do{G+=G,z=1+.1*G,H=1+.2*G}while(z<=1||H<=1);for(M=1;M<=o;M+=1)g[M]=t[M];for(M=o+1;M<=w;M+=1)g[M]=0;for(M=1;M<=l;M+=1)m[M]=0;if(S=[],0===y[1]){if(a(e,r,o,S),0!==S[1])return void(y[1]=2);i(e,r,o,t),n(e,r,o)}else{for(x=1;x<=o;x+=1)for(s[x]=0,M=1;M<=x;M+=1)s[x]=s[x]+e[M][x]*t[M];for(x=1;x<=o;x+=1)for(t[x]=0,M=x;M<=o;M+=1)t[x]=t[x]+e[x][M]*s[M]}for(u[1]=0,x=1;x<=o;x+=1)for(s[x]=t[x],u[1]=u[1]+g[x]*s[x],g[x]=0,M=x+1;M<=o;M+=1)e[M][x]=0;for(u[1]=-u[1]/2,y[1]=0,P=o,A=P+o,T=A+D,k=T+D+1,j=k+D*(D+1)/2,R=j+l,M=1;M<=l;M+=1){for(q=0,x=1;x<=o;x+=1)q+=c[x][M]*c[x][M];g[R+M]=Math.sqrt(q)}for(p=0,v[1]=0,v[2]=0,U=0;;){if(999===(U=function(){for(v[1]=v[1]+1,w=j,M=1;M<=l;M+=1){for(w+=1,q=-f[M],x=1;x<=o;x+=1)q+=c[x][M]*s[x];if(Math.abs(q)<G&&(q=0),M>d)g[w]=q;else if(g[w]=-Math.abs(q),q>0){for(x=1;x<=o;x+=1)c[x][M]=-c[x][M];f[M]=-f[M]}}for(M=1;M<=p;M+=1)g[j+m[M]]=0;for(O=0,E=0,M=1;M<=l;M+=1)g[j+M]<E*g[R+M]&&(O=M,E=g[j+M]/g[R+M]);return 0===O?999:0}()))return;for(;;){if(0===(U=function(){for(M=1;M<=o;M+=1){for(q=0,x=1;x<=o;x+=1)q+=e[x][M]*c[x][O];g[M]=q}for(_=P,M=1;M<=o;M+=1)g[_+M]=0;for(x=p+1;x<=o;x+=1)for(M=1;M<=o;M+=1)g[_+M]=g[_+M]+e[M][x]*g[x];for(V=!0,M=p;M>=1;M-=1){for(q=g[M],w=k+M*(M+3)/2,_=w-M,x=M+1;x<=p;x+=1)q-=g[w]*g[A+x],w+=x;if(q/=g[_],g[A+M]=q,m[M]<d)break;if(q<0)break;V=!1,C=M}if(!V)for(N=g[T+C]/g[A+C],M=1;M<=p&&!(m[M]<d)&&!(g[A+M]<0);M+=1)(E=g[T+M]/g[A+M])<N&&(N=E,C=M);for(q=0,M=P+1;M<=P+o;M+=1)q+=g[M]*g[M];if(Math.abs(q)<=G){if(V)return y[1]=1,999;for(M=1;M<=p;M+=1)g[T+M]=g[T+M]-N*g[A+M];return g[T+p+1]=g[T+p+1]+N,700}for(q=0,M=1;M<=o;M+=1)q+=g[P+M]*c[M][O];for(L=-g[j+O]/q,Y=!0,V||N<L&&(L=N,Y=!1),M=1;M<=o;M+=1)s[M]=s[M]+L*g[P+M],Math.abs(s[M])<G&&(s[M]=0);for(u[1]=u[1]+L*q*(L/2+g[T+p+1]),M=1;M<=p;M+=1)g[T+M]=g[T+M]-L*g[A+M];if(g[T+p+1]=g[T+p+1]+L,!Y){for(q=-f[O],x=1;x<=o;x+=1)q+=s[x]*c[x][O];if(O>d)g[j+O]=q;else if(g[j+O]=-Math.abs(q),q>0){for(x=1;x<=o;x+=1)c[x][O]=-c[x][O];f[O]=-f[O]}return 700}for(p+=1,m[p]=O,w=k+(p-1)*p/2+1,M=1;M<=p-1;M+=1)g[w]=g[M],w+=1;if(p===o)g[w]=g[o];else{for(M=o;M>=p+1&&0!==g[M]&&(F=Math.max(Math.abs(g[M-1]),Math.abs(g[M])),I=Math.min(Math.abs(g[M-1]),Math.abs(g[M])),E=g[M-1]>=0?Math.abs(F*Math.sqrt(1+I*I/(F*F))):-Math.abs(F*Math.sqrt(1+I*I/(F*F))),F=g[M-1]/E,I=g[M]/E,1!==F);M-=1)if(0===F)for(g[M-1]=I*E,x=1;x<=o;x+=1)E=e[x][M-1],e[x][M-1]=e[x][M],e[x][M]=E;else for(g[M-1]=E,B=I/(1+F),x=1;x<=o;x+=1)E=F*e[x][M-1]+I*e[x][M],e[x][M]=B*(e[x][M-1]+E)-e[x][M],e[x][M-1]=E;g[w]=g[p]}return 0}()))break;if(999===U)return;if(700===U)if(C===p)b();else{for(;;)if(function(){if(w=k+C*(C+1)/2+1,_=w+C,0===g[_])return 798;if(F=Math.max(Math.abs(g[_-1]),Math.abs(g[_])),I=Math.min(Math.abs(g[_-1]),Math.abs(g[_])),E=g[_-1]>=0?Math.abs(F*Math.sqrt(1+I*I/(F*F))):-Math.abs(F*Math.sqrt(1+I*I/(F*F))),F=g[_-1]/E,I=g[_]/E,1===F)return 798;if(0===F){for(M=C+1;M<=p;M+=1)E=g[_-1],g[_-1]=g[_],g[_]=E,_+=M;for(M=1;M<=o;M+=1)E=e[M][C],e[M][C]=e[M][C+1],e[M][C+1]=E}else{for(B=I/(1+F),M=C+1;M<=p;M+=1)E=F*g[_-1]+I*g[_],g[_]=B*(g[_-1]+E)-g[_],g[_-1]=E,_+=M;for(M=1;M<=o;M+=1)E=F*e[M][C]+I*e[M][C+1],e[M][C+1]=B*(e[M][C]+E)-e[M][C+1],e[M][C]=E}}(),797!==(U=function(){for(_=w-C,M=1;M<=C;M+=1)g[_]=g[w],w+=1,_+=1;return g[T+C]=g[T+C+1],m[C]=m[C+1],C+=1,C<p?797:0}()))break;b()}}}}function s(e,n,i,a,s,u){e=t(e),n=t(n),i=t(i);var c,f,h,l,d,m,p=[],v=[],g=[],y=[],b=[];if(s=s||0,u=u?t(u):[void 0,0],a=a?t(a):[],f=e.length-1,h=i[1].length-1,!a)for(c=1;c<=h;c+=1)a[c]=0;for(c=1;c<=h;c+=1)v[c]=0;for(l=0,d=Math.min(f,h),c=1;c<=f;c+=1)g[c]=0;for(p[1]=0,c=1;c<=2*f+d*(d+5)/2+2*h+1;c+=1)y[c]=0;for(c=1;c<=2;c+=1)b[c]=0;return o(e,n,f,f,g,p,i,a,f,h,s,v,l,b,y,u),m="",1===u[1]&&(m="constraints are inconsistent, no solution!"),2===u[1]&&(m="matrix D in quadratic function is not positive definite!"),{solution:r(g),value:r(p),unconstrained_solution:r(n),iterations:r(b),iact:r(v),message:m}}e.solveQP=s}(numeric),numeric.svd=function(e){function t(e,t){return e=Math.abs(e),t=Math.abs(t),e>t?e*Math.sqrt(1+t*t/e/e):0==t?e:t*Math.sqrt(1+e*e/t/t)}var r,n=numeric.epsilon,i=1e-64/n,a=0,o=0,s=0,u=0,c=0,f=numeric.clone(e),h=f.length,l=f[0].length;if(h<l)throw"Need more rows than columns";var d=new Array(l),m=new Array(l);for(o=0;o<l;o++)d[o]=m[o]=0;var p=numeric.rep([l,l],0),v=0,g=0,y=0,b=0,M=0,x=0,w=0;for(o=0;o<l;o++){for(d[o]=g,w=0,c=o+1,s=o;s<h;s++)w+=f[s][o]*f[s][o];if(w<=i)g=0;else for(v=f[o][o],g=Math.sqrt(w),v>=0&&(g=-g),y=v*g-w,f[o][o]=v-g,s=c;s<l;s++){for(w=0,u=o;u<h;u++)w+=f[u][o]*f[u][s];for(v=w/y,u=o;u<h;u++)f[u][s]+=v*f[u][o]}for(m[o]=g,w=0,s=c;s<l;s++)w+=f[o][s]*f[o][s];if(w<=i)g=0;else{for(v=f[o][o+1],g=Math.sqrt(w),v>=0&&(g=-g),y=v*g-w,f[o][o+1]=v-g,s=c;s<l;s++)d[s]=f[o][s]/y;for(s=c;s<h;s++){for(w=0,u=c;u<l;u++)w+=f[s][u]*f[o][u];for(u=c;u<l;u++)f[s][u]+=w*d[u]}}M=Math.abs(m[o])+Math.abs(d[o]),M>b&&(b=M)}for(o=l-1;-1!=o;o+=-1){if(0!=g){for(y=g*f[o][o+1],s=c;s<l;s++)p[s][o]=f[o][s]/y;for(s=c;s<l;s++){for(w=0,u=c;u<l;u++)w+=f[o][u]*p[u][s];for(u=c;u<l;u++)p[u][s]+=w*p[u][o]}}for(s=c;s<l;s++)p[o][s]=0,p[s][o]=0;p[o][o]=1,g=d[o],c=o}for(o=l-1;-1!=o;o+=-1){for(c=o+1,g=m[o],s=c;s<l;s++)f[o][s]=0;if(0!=g){for(y=f[o][o]*g,s=c;s<l;s++){for(w=0,u=c;u<h;u++)w+=f[u][o]*f[u][s];for(v=w/y,u=o;u<h;u++)f[u][s]+=v*f[u][o]}for(s=o;s<h;s++)f[s][o]=f[s][o]/g}else for(s=o;s<h;s++)f[s][o]=0;f[o][o]+=1}for(n*=b,u=l-1;-1!=u;u+=-1)for(var _=0;_<50;_++){var S=!1;for(c=u;-1!=c;c+=-1){if(Math.abs(d[c])<=n){S=!0;break}if(Math.abs(m[c-1])<=n)break}if(!S){a=0,w=1;var C=c-1;for(o=c;o<u+1&&(v=w*d[o],d[o]=a*d[o],!(Math.abs(v)<=n));o++)for(g=m[o],y=t(v,g),m[o]=y,a=g/y,w=-v/y,s=0;s<h;s++)M=f[s][C],x=f[s][o],f[s][C]=M*a+x*w,f[s][o]=-M*w+x*a}if(x=m[u],c==u){if(x<0)for(m[u]=-x,s=0;s<l;s++)p[s][u]=-p[s][u];break}if(_>=49)throw"Error: no convergence.";for(b=m[c],M=m[u-1],g=d[u-1],y=d[u],v=((M-x)*(M+x)+(g-y)*(g+y))/(2*y*M),g=t(v,1),v=v<0?((b-x)*(b+x)+y*(M/(v-g)-y))/b:((b-x)*(b+x)+y*(M/(v+g)-y))/b,a=1,w=1,o=c+1;o<u+1;o++){for(g=d[o],M=m[o],y=w*g,g*=a,x=t(v,y),d[o-1]=x,a=v/x,w=y/x,v=b*a+g*w,g=-b*w+g*a,y=M*w,M*=a,s=0;s<l;s++)b=p[s][o-1],x=p[s][o],p[s][o-1]=b*a+x*w,p[s][o]=-b*w+x*a;for(x=t(v,y),m[o-1]=x,a=v/x,w=y/x,v=a*g+w*M,b=-w*g+a*M,s=0;s<h;s++)M=f[s][o-1],x=f[s][o],f[s][o-1]=M*a+x*w,f[s][o]=-M*w+x*a}d[c]=0,d[u]=v,m[u]=b}for(o=0;o<m.length;o++)m[o]<n&&(m[o]=0);for(o=0;o<l;o++)for(s=o-1;s>=0;s--)if(m[s]<m[o]){for(a=m[s],m[s]=m[o],m[o]=a,u=0;u<f.length;u++)r=f[u][o],f[u][o]=f[u][s],f[u][s]=r;for(u=0;u<p.length;u++)r=p[u][o],p[u][o]=p[u][s],p[u][s]=r;o=s}return{U:f,S:m,V:p}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],66:[function(e,t,r){"use strict";function n(e,t){for(var r=new Array(e.length-1),n=1;n<e.length;++n)for(var i=r[n-1]=new Array(e.length-1),a=0,o=0;a<e.length;++a)a!==t&&(i[o++]=e[n][a]);return r}function i(e){for(var t=new Array(e),r=0;r<e;++r){t[r]=new Array(e);for(var n=0;n<e;++n)t[r][n]=["m",n,"[",e-r-1,"]"].join("")}return t}function a(e){return 1&e?"-":""}function o(e){if(1===e.length)return e[0];if(2===e.length)return["sum(",e[0],",",e[1],")"].join("");var t=e.length>>1;return["sum(",o(e.slice(0,t)),",",o(e.slice(t)),")"].join("")}function s(e){if(2===e.length)return[["sum(prod(",e[0][0],",",e[1][1],"),prod(-",e[0][1],",",e[1][0],"))"].join("")];for(var t=[],r=0;r<e.length;++r)t.push(["scale(",o(s(n(e,r))),",",a(r),e[0][r],")"].join(""));return t}function u(e){for(var t=[],r=[],a=i(e),u=[],c=0;c<e;++c)0==(1&c)?t.push.apply(t,s(n(a,c))):r.push.apply(r,s(n(a,c))),u.push("m"+c);var m=o(t),p=o(r),v="orientation"+e+"Exact",g=["function ",v,"(",u.join(),"){var p=",m,",n=",p,",d=sub(p,n);return d[d.length-1];};return ",v].join("");return new Function("sum","prod","scale","sub",g)(h,f,l,d)}function c(e){var t=g[e.length];return t||(t=g[e.length]=u(e.length)),t.apply(void 0,e)}var f=e("two-product"),h=e("robust-sum"),l=e("robust-scale"),d=e("robust-subtract"),m=5,p=u(3),v=u(4),g=[function(){return 0},function(){return 0},function(e,t){return t[0]-e[0]},function(e,t,r){var n,i=(e[1]-r[1])*(t[0]-r[0]),a=(e[0]-r[0])*(t[1]-r[1]),o=i-a;if(i>0){if(a<=0)return o;n=i+a}else{if(!(i<0))return o;if(a>=0)return o;n=-(i+a)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:p(e,t,r)},function(e,t,r,n){var i=e[0]-n[0],a=t[0]-n[0],o=r[0]-n[0],s=e[1]-n[1],u=t[1]-n[1],c=r[1]-n[1],f=e[2]-n[2],h=t[2]-n[2],l=r[2]-n[2],d=a*c,m=o*u,p=o*s,g=i*c,y=i*u,b=a*s,M=f*(d-m)+h*(p-g)+l*(y-b),x=(Math.abs(d)+Math.abs(m))*Math.abs(f)+(Math.abs(p)+Math.abs(g))*Math.abs(h)+(Math.abs(y)+Math.abs(b))*Math.abs(l),w=7.771561172376103e-16*x;return M>w||-M>w?M:v(e,t,r,n)}];!function(){for(;g.length<=m;)g.push(u(g.length));for(var e=[],r=["slow"],n=0;n<=m;++n)e.push("a"+n),r.push("o"+n);for(var i=["function getOrientation(",e.join(),"){switch(arguments.length){case 0:case 1:return 0;"],n=2;n<=m;++n)i.push("case ",n,":return o",n,"(",e.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),r.push(i.join(""));var a=Function.apply(void 0,r);t.exports=a.apply(void 0,[c].concat(g));for(var n=0;n<=m;++n)t.exports[n]=g[n]}()},{"robust-scale":67,"robust-subtract":68,"robust-sum":69,"two-product":84}],67:[function(e,t,r){"use strict";function n(e,t){var r=e.length;if(1===r){var n=i(e[0],t);return n[0]?n:[n[1]]}var o=new Array(2*r),s=[.1,.1],u=[.1,.1],c=0;i(e[0],t,s),s[0]&&(o[c++]=s[0]);for(var f=1;f<r;++f){i(e[f],t,u);var h=s[1];a(h,u[0],s),s[0]&&(o[c++]=s[0]);var l=u[1],d=s[1],m=l+d,p=m-l,v=d-p;s[1]=m,v&&(o[c++]=v)}return s[1]&&(o[c++]=s[1]),0===c&&(o[c++]=0),o.length=c,o}var i=e("two-product"),a=e("two-sum");t.exports=n},{"two-product":84,"two-sum":85}],68:[function(e,t,r){"use strict";function n(e,t){var r=e+t,n=r-e,i=r-n,a=t-n,o=e-i,s=o+a;return s?[s,r]:[r]}function i(e,t){var r=0|e.length,i=0|t.length;if(1===r&&1===i)return n(e[0],-t[0]);var a,o,s=r+i,u=new Array(s),c=0,f=0,h=0,l=Math.abs,d=e[f],m=l(d),p=-t[h],v=l(p);m<v?(o=d,(f+=1)<r&&(d=e[f],m=l(d))):(o=p,(h+=1)<i&&(p=-t[h],v=l(p))),f<r&&m<v||h>=i?(a=d,(f+=1)<r&&(d=e[f],m=l(d))):(a=p,(h+=1)<i&&(p=-t[h],v=l(p)));for(var g,y,b,M,x,w=a+o,_=w-a,S=o-_,C=S,P=w;f<r&&h<i;)m<v?(a=d,(f+=1)<r&&(d=e[f],m=l(d))):(a=p,(h+=1)<i&&(p=-t[h],v=l(p))),o=C,w=a+o,_=w-a,S=o-_,S&&(u[c++]=S),g=P+w,y=g-P,b=g-y,M=w-y,x=P-b,C=x+M,P=g;for(;f<r;)a=d,o=C,w=a+o,_=w-a,S=o-_,S&&(u[c++]=S),g=P+w,y=g-P,b=g-y,M=w-y,x=P-b,C=x+M,P=g,(f+=1)<r&&(d=e[f]);for(;h<i;)a=p,o=C,w=a+o,_=w-a,S=o-_,S&&(u[c++]=S),g=P+w,y=g-P,b=g-y,M=w-y,x=P-b,C=x+M,P=g,(h+=1)<i&&(p=-t[h]);return C&&(u[c++]=C),P&&(u[c++]=P),c||(u[c++]=0),u.length=c,u}t.exports=i},{}],69:[function(e,t,r){"use strict";function n(e,t){var r=e+t,n=r-e,i=r-n,a=t-n,o=e-i,s=o+a;return s?[s,r]:[r]}function i(e,t){var r=0|e.length,i=0|t.length;if(1===r&&1===i)return n(e[0],t[0]);var a,o,s=r+i,u=new Array(s),c=0,f=0,h=0,l=Math.abs,d=e[f],m=l(d),p=t[h],v=l(p);m<v?(o=d,(f+=1)<r&&(d=e[f],m=l(d))):(o=p,(h+=1)<i&&(p=t[h],v=l(p))),f<r&&m<v||h>=i?(a=d,(f+=1)<r&&(d=e[f],m=l(d))):(a=p,(h+=1)<i&&(p=t[h],v=l(p)));for(var g,y,b,M,x,w=a+o,_=w-a,S=o-_,C=S,P=w;f<r&&h<i;)m<v?(a=d,(f+=1)<r&&(d=e[f],m=l(d))):(a=p,(h+=1)<i&&(p=t[h],v=l(p))),o=C,w=a+o,_=w-a,S=o-_,S&&(u[c++]=S),g=P+w,y=g-P,b=g-y,M=w-y,x=P-b,C=x+M,P=g;for(;f<r;)a=d,o=C,w=a+o,_=w-a,S=o-_,S&&(u[c++]=S),g=P+w,y=g-P,b=g-y,M=w-y,x=P-b,C=x+M,P=g,(f+=1)<r&&(d=e[f]);for(;h<i;)a=p,o=C,w=a+o,_=w-a,S=o-_,S&&(u[c++]=S),g=P+w,y=g-P,b=g-y,M=w-y,x=P-b,C=x+M,P=g,(h+=1)<i&&(p=t[h]);return C&&(u[c++]=C),P&&(u[c++]=P),c||(u[c++]=0),u.length=c,u}t.exports=i},{}],70:[function(e,t,r){"use strict";function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(function(t,r){var n=e.inputSamples,i=e.inputSampleRate,o=void 0!==e.inputDelay?e.inputDelay:0,s=void 0!==e.outputSampleRate?e.outputSampleRate:i;if(i===s&&0===o)t(new Float32Array(n));else try{var u=Math.ceil(n.length*s/i),c=new window.OfflineAudioContext(1,u,s),f=c.createBuffer(1,n.length,i),h=new a.default(i,1);h.setDelay(o/i),f.getChannelData(0).set(h.process(n));var l=c.createBufferSource();l.buffer=f,l.connect(c.destination),l.start(),c.oncomplete=function(e){var r=e.renderedBuffer.getChannelData(0);t(r)},c.startRendering()}catch(e){r(new Error("Unable to re-sample Float32Array. "+e.message))}})}Object.defineProperty(r,"__esModule",{value:!0}),r.resampleFloat32Array=n;var i=e("fractional-delay"),a=function(e){return e&&e.__esModule?e:{default:e}}(i);r.default={resampleFloat32Array:n}},{"fractional-delay":54}],71:[function(e,t,r){"use strict";function n(e,t){var r=t.x-e.x,n=t.y-e.y,i=t.z-e.z;return r*r+n*n+i*i}function i(e,t){return Math.sqrt(this.distanceSquared(e,t))}Object.defineProperty(r,"__esModule",{value:!0}),r.tree=void 0,r.distanceSquared=n,r.distance=i;var a=e("kd.tree"),o=function(e){return e&&e.__esModule?e:{default:e}}(a);r.tree=o.default,r.default={distance:i,distanceSquared:n,tree:o.default}},{"kd.tree":63}],72:[function(e,t,r){"use strict";function n(e,t){var r=t[0],n=t[1],i=t[2];return e[0]=0-n,e[1]=i,e[2]=0-r,e}function i(e,t){var r=t[0],n=t[1],i=t[2];return e[0]=0-i,e[1]=0-r,e[2]=n,e}function a(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n;return e[0]=(M.default.atan2(n,r)+360)%360,e[1]=M.default.atan2(i,Math.sqrt(a)),e[2]=Math.sqrt(a+i*i),e}function o(e,t){var r=t[0],n=t[1],i=t[2],a=M.default.cos(n);return e[0]=i*a*M.default.cos(r),e[1]=i*a*M.default.sin(r),e[2]=i*M.default.sin(n),e}function s(e,t){var r=t[0],n=t[1],i=t[2],a=M.default.cos(n);return e[0]=0-i*a*M.default.sin(r),e[1]=i*M.default.sin(n),e[2]=0-i*a*M.default.cos(r),e}function u(e,t){var r=0-t[2],n=0-t[0],i=t[1],a=r*r+n*n;return e[0]=(M.default.atan2(n,r)+360)%360,e[1]=M.default.atan2(i,Math.sqrt(a)),e[2]=Math.sqrt(a+i*i),e}function c(e,t,r){switch(r){case"sofaCartesian":e[0]=t[0],e[1]=t[1],e[2]=t[2];break;case"sofaSpherical":o(e,t);break;default:throw new Error("Bad coordinate system")}return e}function f(e,t){var r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=i,e[2]=0-n,e}function h(e,t){var r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=0-i,e[2]=n,e}function l(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n;return e[0]=M.default.atan2(r,n),e[1]=M.default.atan2(i,Math.sqrt(a)),e[2]=Math.sqrt(a+i*i),e}function d(e,t){var r=t[0],n=t[1],i=t[2],a=M.default.cos(n);return e[0]=i*a*M.default.sin(r),e[1]=i*a*M.default.cos(r),e[2]=i*M.default.sin(n),e}function m(e,t){var r=t[0],n=t[1],i=t[2],a=M.default.cos(n);return e[0]=i*a*M.default.sin(r),e[1]=i*M.default.sin(n),e[2]=0-i*a*M.default.cos(r),e}function p(e,t){var r=t[0],n=0-t[2],i=t[1],a=r*r+n*n;return e[0]=M.default.atan2(r,n),e[1]=M.default.atan2(i,Math.sqrt(a)),e[2]=Math.sqrt(a+i*i),e}function v(e){var t=void 0;if("sofaCartesian"===e||"spat4Cartesian"===e||"gl"===e)t="cartesian";else{if("sofaSpherical"!==e&&"spat4Spherical"!==e)throw new Error("Unknown coordinate system type "+e);t="spherical"}return t}function g(e,t,r){switch(r){case"gl":e[0]=t[0],e[1]=t[1],e[2]=t[2];break;case"sofaCartesian":n(e,t);break;case"sofaSpherical":s(e,t);break;case"spat4Cartesian":f(e,t);break;case"spat4Spherical":m(e,t);break;default:throw new Error("Bad coordinate system")}return e}function y(e,t,r){switch(r){case"gl":e[0]=t[0],e[1]=t[1],e[2]=t[2];break;case"sofaCartesian":i(e,t);break;case"sofaSpherical":u(e,t);break;case"spat4Cartesian":h(e,t);break;case"spat4Spherical":p(e,t);break;default:throw new Error("Bad coordinate system")}return e}Object.defineProperty(r,"__esModule",{value:!0}),r.sofaCartesianToGl=n,r.glToSofaCartesian=i,r.sofaCartesianToSofaSpherical=a,r.sofaSphericalToSofaCartesian=o,r.sofaSphericalToGl=s,r.glToSofaSpherical=u,r.sofaToSofaCartesian=c,r.spat4CartesianToGl=f,r.glToSpat4Cartesian=h,r.spat4CartesianToSpat4Spherical=l,r.spat4SphericalToSpat4Cartesian=d,r.spat4SphericalToGl=m,r.glToSpat4Spherical=p,r.systemType=v,r.systemToGl=g,r.glToSystem=y;var b=e("./degree"),M=function(e){return e&&e.__esModule?e:{default:e}}(b);r.default={glToSofaCartesian:i,glToSofaSpherical:u,glToSpat4Cartesian:h,glToSpat4Spherical:p,glToSystem:y,sofaCartesianToGl:n,sofaCartesianToSofaSpherical:a,sofaSphericalToGl:s,sofaSphericalToSofaCartesian:o,sofaToSofaCartesian:c,spat4CartesianToGl:f,spat4CartesianToSpat4Spherical:l,spat4SphericalToGl:m,spat4SphericalToSpat4Cartesian:d,systemToGl:g,systemType:v}},{"./degree":73}],73:[function(e,t,r){"use strict";function n(e){return e*u}function i(e){return e*c}function a(e){return Math.cos(e*u)}function o(e){return Math.sin(e*u)}function s(e,t){return Math.atan2(e,t)*c}Object.defineProperty(r,"__esModule",{value:!0}),r.toRadian=n,r.fromRadian=i,r.cos=a,r.sin=o,r.atan2=s;var u=r.toRadianFactor=Math.PI/180,c=r.fromRadianFactor=1/u;r.default={atan2:s,cos:a,fromRadian:i,fromRadianFactor:c,sin:o,toRadian:n,toRadianFactor:u}},{}],74:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(r,"__esModule",{value:!0}),r.ServerDataBase=r.HrtfSet=void 0;var i=e("./sofa/HrtfSet"),a=n(i),o=e("./sofa/ServerDataBase"),s=n(o);r.HrtfSet=a.default,r.ServerDataBase=s.default,r.default={HrtfSet:a.default,ServerDataBase:s.default}},{"./sofa/HrtfSet":76,"./sofa/ServerDataBase":77}],75:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.version=r.name=r.license=r.description=void 0;var n=e("../package.json"),i=function(e){return e&&e.__esModule?e:{default:e}}(n),a=i.default.description;r.description=a;var o=i.default.license;r.license=o;var s=i.default.name;r.name=s;var u=i.default.version;r.version=u,r.default={description:a,license:o,name:s,version:u}},{"../package.json":81}],76:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.HrtfSet=void 0;var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=e("gl-matrix"),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(s),c=e("../info"),f=n(c),h=e("./parseDataSet"),l=e("./parseSofa"),d=e("../geometry/coordinates"),m=n(d),p=e("../geometry/KdTree"),v=n(p),g=e("../audio/utilities"),y=r.HrtfSet=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),this._audioContext=t.audioContext,this._ready=!1,this.coordinateSystem=t.coordinateSystem,this.filterCoordinateSystem=t.filterCoordinateSystem,this.filterPositions=t.filterPositions,this.filterAfterLoad=t.filterAfterLoad}return o(e,[{key:"applyFilterPositions",value:function(){var e=this,t=this._filterPositions.map(function(t){return e._kdt.nearest({x:t[0],y:t[1],z:t[2]},1).pop()[0]});t=[].concat(i(new Set(t))),this._kdt=v.default.tree.createKdTree(t,v.default.distanceSquared,["x","y","z"])}},{key:"load",value:function(e){var t=this,r=e.split(".").pop(),n="sofa"===r?e+".json":e;return void 0===this._filterPositions||this.filterAfterLoad||"sofa"!==r?this._loadSofaFull(n).then(function(){return void 0!==t._filterPositions&&t.filterAfterLoad&&t.applyFilterPositions(),t._ready=!0,t}):Promise.all([this._loadMetaAndPositions(e),this._loadDataSet(e)]).then(function(r){var n=r[0],i=r[1];return t._loadSofaPartial(e,n,i).then(function(){return t._ready=!0,t})}).catch(function(){return t._loadSofaFull(n).then(function(){return t.applyFilterPositions(),t._ready=!0,t})})}},{key:"export",value:function(){var e=this,t=void 0,r=m.default.systemType(this.filterCoordinateSystem);switch(r){case"cartesian":t=this._sofaSourcePosition.map(function(e){return m.default.glToSofaCartesian([],e)});break;case"spherical":t=this._sofaSourcePosition.map(function(e){return m.default.glToSofaSpherical([],e)});break;default:throw new Error("Bad source position type "+r+" for export.")}var n=this._sofaSourcePosition.map(function(t){for(var r=e._kdt.nearest({x:t[0],y:t[1],z:t[2]},1).pop()[0].fir,n=[],a=0;a<r.numberOfChannels;++a)n.push([].concat(i(r.getChannelData(a))));return n});return(0,l.stringifySofa)({name:this._sofaName,metaData:this._sofaMetaData,ListenerPosition:[0,0,0],ListenerPositionType:"cartesian",ListenerUp:[0,0,1],ListenerUpType:"cartesian",
ListenerView:[1,0,0],ListenerViewType:"cartesian",SourcePositionType:r,SourcePosition:t,DataSamplingRate:this._audioContext.sampleRate,DataDelay:this._sofaDelay,DataIR:n,RoomVolume:this._sofaRoomVolume})}},{key:"nearest",value:function(e){var t=m.default.systemToGl([],e,this.coordinateSystem),r=this._kdt.nearest({x:t[0],y:t[1],z:t[2]},1).pop(),n=r[0];return m.default.glToSystem(t,[n.x,n.y,n.z],this.coordinateSystem),{distance:r[1],fir:n.fir,index:n.index,position:t}}},{key:"nearestFir",value:function(e){return this.nearest(e).fir}},{key:"_createKdTree",value:function(e){var t=this,r=e.map(function(e){var r=e[2],n=t._audioContext.createBuffer(r.length,r[0].length,t._audioContext.sampleRate);return r.forEach(function(e,t){n.getChannelData(t).set(e)}),{index:e[0],x:e[1][0],y:e[1][1],z:e[1][2],fir:n}});return this._sofaSourcePosition=r.map(function(e){return[e.x,e.y,e.z]}),this._kdt=v.default.tree.createKdTree(r,v.default.distanceSquared,["x","y","z"]),this}},{key:"_generateIndicesPositionsFirs",value:function(e,t,r,n){var i=this,a=r.map(function(r,a){var o=r.length;if(2!==o)throw new Error("Bad number of channels for IR index "+e[a]+" ("+o+" instead of 2)");if(2!==n[0].length)throw new Error("Bad delay format for IR index "+e[a]+" (first element in Data.Delay is "+n[0]+" instead of [[delayL, delayR]] )");var s=void 0!==n[a]?n[a]:n[0],u=r.map(function(t,r){if(s[r]<0)throw new Error("Negative delay detected (not handled at the moment): delay index "+e[a]+" channel "+r);return(0,g.resampleFloat32Array)({inputSamples:t,inputDelay:s[r],inputSampleRate:i._sofaSampleRate,outputSampleRate:i._audioContext.sampleRate})});return Promise.all(u).then(function(r){return[e[a],t[a],r]}).catch(function(e){throw new Error("Unable to re-sample impulse response "+a+". "+e.message)})});return Promise.all(a)}},{key:"_loadDataSet",value:function(e){return new Promise(function(t,r){var n=e+".dds",i=new window.XMLHttpRequest;i.open("GET",n),i.onerror=function(){r(new Error("Unable to GET "+n+", status "+i.status+" "+i.responseText))},i.onload=function(){if(i.status<200||i.status>=300)return void i.onerror();try{var e=(0,h.parseDataSet)(i.response);t(e)}catch(e){r(new Error("Unable to parse "+n+". "+e.message))}},i.send()})}},{key:"_loadMetaAndPositions",value:function(e){var t=this;return new Promise(function(r,n){var a=e+".json?ListenerPosition,ListenerUp,ListenerView,SourcePosition,Data.Delay,Data.SamplingRate,EmitterPosition,ReceiverPosition,RoomVolume",o=new window.XMLHttpRequest;o.open("GET",a),o.onerror=function(){n(new Error("Unable to GET "+a+", status "+o.status+" "+o.responseText))},o.onload=function(){if(o.status<200||o.status>=300)return void o.onerror();try{var s=(0,l.parseSofa)(o.response);t._setMetaData(s,e);var u=t._sourcePositionsToGl(s),c=u.map(function(e,t){return{x:e[0],y:e[1],z:e[2],index:t}}),f=v.default.tree.createKdTree(c,v.default.distanceSquared,["x","y","z"]),h=t._filterPositions.map(function(e){return f.nearest({x:e[0],y:e[1],z:e[2]},1).pop()[0].index});h=[].concat(i(new Set(h))),t._sofaUrl=e,r(h)}catch(e){n(new Error("Unable to parse "+a+". "+e.message))}},o.send()})}},{key:"_loadSofaFull",value:function(e){var t=this;return new Promise(function(r,n){var i=new window.XMLHttpRequest;i.open("GET",e),i.onerror=function(){n(new Error("Unable to GET "+e+", status "+i.status+" "+i.responseText))},i.onload=function(){if(i.status<200||i.status>=300)return void i.onerror();try{var a=(0,l.parseSofa)(i.response);t._setMetaData(a,e);var o=t._sourcePositionsToGl(a);t._generateIndicesPositionsFirs(o.map(function(e,t){return t}),o,a["Data.IR"].data,a["Data.Delay"].data).then(function(n){t._createKdTree(n),t._sofaUrl=e,r(t)})}catch(t){n(new Error("Unable to parse "+e+". "+t.message))}},i.send()})}},{key:"_loadSofaPartial",value:function(e,t,r){var n=this,i=t.map(function(t){return new Promise(function(i,a){var o=e+".json?SourcePosition["+t+"][0:1:"+(r.SourcePosition.C-1)+"],Data.IR["+t+"][0:1:"+(r["Data.IR"].R-1)+"][0:1:"+(r["Data.IR"].N-1)+"]",s=new window.XMLHttpRequest;s.open("GET",o),s.onerror=function(){a(new Error("Unable to GET "+o+", status "+s.status+" "+s.responseText))},s.onload=function(){(s.status<200||s.status>=300)&&s.onerror();try{var e=(0,l.parseSofa)(s.response),r=n._sourcePositionsToGl(e);n._generateIndicesPositionsFirs([t],r,e["Data.IR"].data,e["Data.Delay"].data).then(function(e){i(e[0])})}catch(e){a(new Error("Unable to parse "+o+". "+e.message))}},s.send()})});return Promise.all(i).then(function(e){return n._createKdTree(e),n})}},{key:"_setMetaData",value:function(e,t){if(void 0!==e.metaData.DataType&&"FIR"!==e.metaData.DataType)throw new Error("According to meta-data, SOFA data type is not FIR");var r=(new Date).toISOString();this._sofaName=void 0!==e.name?""+e.name:"HRTF.sofa",this._sofaMetaData=void 0!==e.metaData?e.metaData:{},void 0!==t&&(this._sofaMetaData.OriginalUrl=t),this._sofaMetaData.Converter="Ircam "+f.default.name+" "+f.default.version+" javascript API ",this._sofaMetaData.DateConverted=r,this._sofaSampleRate=void 0!==e["Data.SamplingRate"]?e["Data.SamplingRate"].data[0]:48e3,this._sofaSampleRate!==this._audioContext.sampleRate&&(this._sofaMetaData.OriginalSampleRate=this._sofaSampleRate),this._sofaDelay=void 0!==e["Data.Delay"]?e["Data.Delay"].data:[0,0],this._sofaRoomVolume=void 0!==e.RoomVolume?e.RoomVolume.data[0]:void 0;var n=m.default.sofaToSofaCartesian([],e.ListenerPosition.data[0],(0,l.conformSofaCoordinateSystem)(e.ListenerPosition.Type||"cartesian")),i=m.default.sofaToSofaCartesian([],e.ListenerView.data[0],(0,l.conformSofaCoordinateSystem)(e.ListenerView.Type||"cartesian")),a=m.default.sofaToSofaCartesian([],e.ListenerUp.data[0],(0,l.conformSofaCoordinateSystem)(e.ListenerUp.Type||"cartesian"));this._sofaToGl=u.mat4.lookAt([],n,i,a)}},{key:"_sourcePositionsToGl",value:function(e){var t=this,r=e.SourcePosition.data;switch(void 0!==e.SourcePosition.Type?e.SourcePosition.Type:"spherical"){case"cartesian":r.forEach(function(e){u.vec3.transformMat4(e,e,t._sofaToGl)});break;case"spherical":r.forEach(function(e){m.default.sofaSphericalToSofaCartesian(e,e),u.vec3.transformMat4(e,e,t._sofaToGl)});break;default:throw new Error("Bad source position type")}return r}},{key:"coordinateSystem",set:function(e){this._coordinateSystem=void 0!==e?e:"gl"},get:function(){return this._coordinateSystem}},{key:"filterCoordinateSystem",set:function(e){this._filterCoordinateSystem=void 0!==e?e:this.coordinateSystem},get:function(){return this._filterCoordinateSystem}},{key:"filterPositions",set:function(e){if(void 0===e)this._filterPositions=void 0;else switch(this.filterCoordinateSystem){case"gl":this._filterPositions=e.map(function(e){return e.slice(0)});break;case"sofaCartesian":this._filterPositions=e.map(function(e){return m.default.sofaCartesianToGl([],e)});break;case"sofaSpherical":this._filterPositions=e.map(function(e){return m.default.sofaSphericalToGl([],e)});break;default:throw new Error("Bad filter coordinate system")}},get:function(){var e=void 0;if(void 0!==this._filterPositions)switch(this.filterCoordinateSystem){case"gl":e=this._filterPositions.map(function(e){return e.slice(0)});break;case"sofaCartesian":e=this._filterPositions.map(function(e){return m.default.glToSofaCartesian([],e)});break;case"sofaSpherical":e=this._filterPositions.map(function(e){return m.default.glToSofaSpherical([],e)});break;default:throw new Error("Bad filter coordinate system")}return e}},{key:"filterAfterLoad",set:function(e){this._filterAfterLoad=void 0!==e&&e},get:function(){return this._filterAfterLoad}},{key:"isReady",get:function(){return this._ready}},{key:"sofaName",get:function(){return this._sofaName}},{key:"sofaUrl",get:function(){return this._sofaUrl}},{key:"sofaSampleRate",get:function(){return this._sofaSampleRate}},{key:"sofaMetaData",get:function(){return this._sofaMetaData}}]),e}();r.default=y},{"../audio/utilities":70,"../geometry/KdTree":71,"../geometry/coordinates":72,"../info":75,"./parseDataSet":78,"./parseSofa":79,"gl-matrix":61}],77:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0}),r.ServerDataBase=void 0;var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=e("./parseXml"),o=function(e){return e&&e.__esModule?e:{default:e}}(a),s=e("./parseDataSet"),u=r.ServerDataBase=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(n(this,e),this._server=t.serverUrl,void 0===this._server){var r="https:"===window.location.protocol?"https:":"http:";this._server=r+"//bili2.ircam.fr"}this._catalogue={},this._urls=[]}return i(e,[{key:"loadCatalogue",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._server+"/catalog.xml",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._catalogue;return new Promise(function(n,i){var a=new window.XMLHttpRequest;a.open("GET",t),a.onerror=function(){i(new Error("Unable to GET "+t+", status "+a.status+" "+a.responseText))},a.onload=function(){if(a.status<200||a.status>=300)return void a.onerror();var s=(0,o.default)(a.response),u=s.querySelector("dataset"),c=s.querySelectorAll("dataset > catalogRef");if(0===c.length){r.urls=[];for(var f=s.querySelectorAll("dataset > dataset"),h=0;h<f.length;++h){var l=e._server+u.getAttribute("name")+"/"+f[h].getAttribute("name");e._urls.push(l),r.urls.push(l)}n(t)}else{for(var d=[],m=0;m<c.length;++m){var p=c[m].getAttribute("name"),v=e._server+u.getAttribute("name")+"/"+c[m].getAttribute("xlink:href");r[p]={},d.push(e.loadCatalogue(v,r[p]))}Promise.all(d).then(function(){e._urls.sort(),n(t)}).catch(function(e){i(e)})}},a.send()})}},{key:"getUrls",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[e.convention,e.dataBase,e.equalisation,e.sampleRate,e.sosOrder],r="number"==typeof e.freePattern?e.freePattern.toString():e.freePattern,n=t.reduce(function(e,t){return e+"/"+(void 0!==t?"[^/]*(?:"+t+")[^/]*":"[^/]*")},""),i=new RegExp(n,"i"),a=this._urls.filter(function(e){return i.test(e)});if(void 0!==r){r.split(/\s+/).forEach(function(e){i=new RegExp(e,"i"),a=a.filter(function(e){return i.test(e)})})}return a}},{key:"getDataSetDefinitions",value:function(e){return new Promise(function(t,r){var n=e+".dds",i=new window.XMLHttpRequest;i.open("GET",n),i.onerror=function(){r(new Error("Unable to GET "+n+", status "+i.status+" "+i.responseText))},i.onload=function(){if(i.status<200||i.status>=300)return void i.onerror();t((0,s.parseDataSet)(i.response))},i.send()})}},{key:"getSourcePositions",value:function(e){return new Promise(function(t,r){var n=e+".json?SourcePosition",i=new window.XMLHttpRequest;i.open("GET",n),i.onerror=function(){r(new Error("Unable to GET "+n+", status "+i.status+" "+i.responseText))},i.onload=function(){if(i.status<200||i.status>=300)return void i.onerror();try{var e=JSON.parse(i.response);if("SourcePosition"!==e.leaves[0].name)throw new Error("SourcePosition not found");t(e.leaves[0].data)}catch(e){r(new Error("Unable to parse response from "+n+". "+e.message))}},i.send()})}}]),e}();r.default=u},{"./parseDataSet":78,"./parseXml":80}],78:[function(e,t,r){"use strict";function n(e){var t=[],r=e.match(o);return null!==r&&r.forEach(function(e){var r=s.exec(e);null!==r&&r.length>2&&t.push([r[1],Number(r[2])])}),t}function i(e){var t=[],r=e.match(c);return null!==r&&r.forEach(function(e){var r=f.exec(e);if(null!==r&&r.length>3){var i=[];i[0]=r[2],i[1]={},i[1].type=r[1],n(r[3]).forEach(function(e){i[1][e[0]]=e[1]}),t.push(i)}}),t}function a(e){var t={},r=h.exec(e);return null!==r&&r.length>1&&i(r[1]).forEach(function(e){t[e[0]]=e[1]}),t}Object.defineProperty(r,"__esModule",{value:!0}),r._parseDimension=n,r._parseDefinition=i,r.parseDataSet=a;var o=new RegExp("\\[\\s*(\\w+)\\s*=\\s*(\\d+)\\s*\\]","g"),s=new RegExp("\\[\\s*(\\w+)\\s*=\\s*(\\d+)\\s*\\]"),u="\\s*(\\w+)\\s*([\\w.]+)\\s*((?:\\[[^\\]]+\\]\\s*)+);\\s*",c=new RegExp(u,"g"),f=new RegExp(u),h=new RegExp("\\s*Dataset\\s*\\{\\s*((?:[^;]+;\\s*)*)\\s*\\}\\s*[\\w.]+\\s*;\\s*");r.default=a},{}],79:[function(e,t,r){"use strict";function n(e){try{var t=JSON.parse(e),r={};if(r.name=t.name,void 0!==t.attributes){r.metaData={};var n=t.attributes.find(function(e){return"NC_GLOBAL"===e.name});void 0!==n&&n.attributes.forEach(function(e){r.metaData[e.name]=e.value[0]})}if(void 0!==t.leaves){t.leaves.forEach(function(e){r[e.name]={},e.attributes.forEach(function(t){r[e.name][t.name]=t.value[0]}),r[e.name].shape=e.shape,r[e.name].data=e.data})}return r}catch(e){throw new Error("Unable to parse SOFA string. "+e.message)}}function i(e){var t={};if(void 0!==e.name&&(t.name=e.name),void 0!==e.metaData){t.attributes=[];var r={name:"NC_GLOBAL",attributes:[]};for(var n in e.metaData)e.metaData.hasOwnProperty(n)&&r.attributes.push({name:n,value:[e.metaData[n]]});t.attributes.push(r)}var i="Float64",a=void 0;if(t.leaves=[],[["ListenerPosition","ListenerPositionType"],["ListenerUp","ListenerUpType"],["ListenerView","ListenerViewType"]].forEach(function(r){var n=r[0],o=e[n],s=e[r[1]];if(void 0!==o){switch(s){case"cartesian":a=[{name:"Type",value:["cartesian"]},{name:"Units",value:["metre, metre, metre"]}];break;case"spherical":a=[{name:"Type",value:["spherical"]},{name:"Units",value:["degree, degree, metre"]}];break;default:throw new Error("Unknown coordinate system type "+s+" for "+o)}t.leaves.push({name:n,type:i,attributes:a,shape:[1,3],data:[o]})}}),void 0!==e.SourcePosition){switch(e.SourcePositionType){case"cartesian":a=[{name:"Type",value:["cartesian"]},{name:"Units",value:["metre, metre, metre"]}];break;case"spherical":a=[{name:"Type",value:["spherical"]},{name:"Units",value:["degree, degree, metre"]}];break;default:throw new Error("Unknown coordinate system type "+e.SourcePositionType)}t.leaves.push({name:"SourcePosition",type:i,attributes:a,shape:[e.SourcePosition.length,e.SourcePosition[0].length],data:e.SourcePosition})}if(void 0===e.DataSamplingRate)throw new Error("No data sampling-rate");if(t.leaves.push({name:"Data.SamplingRate",type:i,attributes:[{name:"Unit",value:"hertz"}],shape:[1],data:[e.DataSamplingRate]}),void 0!==e.DataDelay&&t.leaves.push({name:"Data.Delay",type:i,attributes:[],shape:[1,e.DataDelay.length],data:e.DataDelay}),void 0===e.DataIR)throw new Error("No data IR");return t.leaves.push({name:"Data.IR",type:i,attributes:[],shape:[e.DataIR.length,e.DataIR[0].length,e.DataIR[0][0].length],data:e.DataIR}),void 0!==e.RoomVolume&&t.leaves.push({name:"RoomVolume",type:i,attributes:[{name:"Units",value:["cubic metre"]}],shape:[1],data:[e.RoomVolume]}),t.nodes=[],JSON.stringify(t)}function a(e){var t=void 0;switch(e){case"cartesian":t="sofaCartesian";break;case"spherical":t="sofaSpherical";break;default:throw new Error("Bad SOFA type "+e)}return t}Object.defineProperty(r,"__esModule",{value:!0}),r.parseSofa=n,r.stringifySofa=i,r.conformSofaCoordinateSystem=a,r.default={parseSofa:n,conformSofaCoordinateSystem:a}},{}],80:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=r.parseXml=void 0;if(void 0!==window.DOMParser)r.parseXml=n=function(e){return(new window.DOMParser).parseFromString(e,"text/xml")};else{if(void 0===window.ActiveXObject||!new window.ActiveXObject("Microsoft.XMLDOM"))throw new Error("No XML parser found");r.parseXml=n=function(e){var t=new window.ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t}}r.default=n},{}],81:[function(e,t,r){t.exports={_from:"github:Ircam-RnD/serveSofaHrir",_id:"[email protected]",_inBundle:!1,_integrity:"",_location:"/serve-sofa-hrir",_phantomChildren:{},_requested:{type:"git",raw:"serve-sofa-hrir@github:Ircam-RnD/serveSofaHrir",name:"serve-sofa-hrir",escapedName:"serve-sofa-hrir",rawSpec:"github:Ircam-RnD/serveSofaHrir",saveSpec:"github:Ircam-RnD/serveSofaHrir",fetchSpec:null,gitCommittish:null},_requiredBy:["/"],_resolved:"github:Ircam-RnD/serveSofaHrir#71df5cec963f5f99482ee51b44814a4b7f504847",_spec:"serve-sofa-hrir@github:Ircam-RnD/serveSofaHrir",_where:"/Users/pyrus/Projects/Cosima/JSAmbisonics",authors:["[email protected]","Arnau Julià <[email protected]>","[email protected]","[email protected]"],bugs:{url:"https://github.com/Ircam-RnD/serveSofaHrir/issues"},bundleDependencies:!1,dependencies:{"fractional-delay":"git://github.com/Ircam-RnD/fractional-delay.git#gh-pages","gl-matrix":"^2.4.0","kd.tree":"github:akshaylive/node-kdt#39bc780704a324393bca68a17cf7bc71be8544c6"},deprecated:!1,description:"Utility to fetch and shape sofa formated HRIR from server",devDependencies:{"babel-cli":"^6.5.1","babel-eslint":"^4.1.8","babel-preset-es2015":"^6.5.0",babelify:"^7.2.0","blue-tape":"^0.1.11",browserify:"^12.0.2",esdoc:"^0.4.6",eslint:"^1.10.3","eslint-config-airbnb":"^1.0.2","eslint-plugin-html":"^1.4.0",jscs:"2.11.0","jscs-jsdoc":"^1.3.1",tape:"^4.4.0","tape-run":"^2.1.2",testling:"^1.7.1",watch:"^0.17.1"},engines:{node:"0.12 || 4",npm:">=1.0.0 <3.0.0"},exports:"serveSofaHrir",homepage:"https://github.com/Ircam-RnD/serveSofaHrir#readme",license:"BSD-3-Clause",main:"./dist/",name:"serve-sofa-hrir",repository:{type:"git",url:"git+https://github.com/Ircam-RnD/serveSofaHrir.git"},scripts:{browserify:"browserify ./src/index.js -t [ babelify ] --standalone serveSofaHrir > serveSofaHrir.js",bundle:"npm run lint && npm run test && npm run doc && npm run compile && npm run browserify",compile:"rm -rf ./dist && babel ./src/ --out-dir ./dist/",doc:"esdoc -c esdoc.json",lint:"eslint ./src/ ./test/ && jscs --verbose ./src/ ./test/","lint-examples":"eslint -c examples/.eslintrc ./examples/*.html",test:"browserify test/*/*.js -t [ babelify ] --exclude 'test/*/*_listen.js*' --exclude 'test/*/*_issues.js' | tape-run","test-browser":"browserify test/*/*.js -t [ babelify ] --exclude 'test/*/*_listen.js*' --exclude 'test/*/*_issues.js' | testling -u","test-issues":"browserify test/*/*_issues.js -t [ babelify ] | tape-run","test-listen":"browserify test/*/*_listen.js -t [ babelify ] | tape-run",watch:"watch 'npm run browserify && echo $( date ): browserified' ./src/"},standalone:"serveSofaHrir",version:"0.4.2",warnings:[{code:"ENOTSUP",required:{node:"0.12 || 4",npm:">=1.0.0 <3.0.0"},pkgid:"[email protected]"}]}},{}],82:[function(e,t,r){"use strict";"use restrict";function n(e){for(var t=0,r=Math.max,n=0,i=e.length;n<i;++n)t=r(t,e[n].length);return t-1}function i(e){for(var t=-1,r=Math.max,n=0,i=e.length;n<i;++n)for(var a=e[n],o=0,s=a.length;o<s;++o)t=r(t,a[o]);return t+1}function a(e){for(var t=new Array(e.length),r=0,n=e.length;r<n;++r)t[r]=e[r].slice(0);return t}function o(e,t){var r=e.length,n=e.length-t.length,i=Math.min;if(n)return n;switch(r){case 0:return 0;case 1:return e[0]-t[0];case 2:var a=e[0]+e[1]-t[0]-t[1];return a||i(e[0],e[1])-i(t[0],t[1]);case 3:var o=e[0]+e[1],s=t[0]+t[1];if(a=o+e[2]-(s+t[2]))return a;var u=i(e[0],e[1]),c=i(t[0],t[1]),a=i(u,e[2])-i(c,t[2]);return a||i(u+e[2],o)-i(c+t[2],s);default:var f=e.slice(0);f.sort();var h=t.slice(0);h.sort();for(var l=0;l<r;++l)if(n=f[l]-h[l])return n;return 0}}function s(e,t){return o(e[0],t[0])}function u(e,t){if(t){for(var r=e.length,n=new Array(r),i=0;i<r;++i)n[i]=[e[i],t[i]];n.sort(s);for(var i=0;i<r;++i)e[i]=n[i][0],t[i]=n[i][1];return e}return e.sort(o),e}function c(e){if(0===e.length)return[];for(var t=1,r=e.length,n=1;n<r;++n){var i=e[n];if(o(i,e[n-1])){if(n===t){t++;continue}e[t++]=i}}return e.length=t,e}function f(e,t){for(var r=0,n=e.length-1,i=-1;r<=n;){var a=r+n>>1,s=o(e[a],t);s<=0?(0===s&&(i=a),r=a+1):s>0&&(n=a-1)}return i}function h(e,t){for(var r=new Array(e.length),n=0,i=r.length;n<i;++n)r[n]=[];for(var a=[],n=0,s=t.length;n<s;++n)for(var u=t[n],c=u.length,h=1,l=1<<c;h<l;++h){a.length=b.popCount(h);for(var d=0,m=0;m<c;++m)h&1<<m&&(a[d++]=u[m]);var p=f(e,a);if(!(p<0))for(;;)if(r[p++].push(n),p>=e.length||0!==o(e[p],a))break}return r}function l(e,t){if(!t)return h(c(m(e,0)),e,0);for(var r=new Array(t),n=0;n<t;++n)r[n]=[];for(var n=0,i=e.length;n<i;++n)for(var a=e[n],o=0,s=a.length;o<s;++o)r[a[o]].push(n);return r}function d(e){for(var t=[],r=0,n=e.length;r<n;++r)for(var i=e[r],a=0|i.length,o=1,s=1<<a;o<s;++o){for(var c=[],f=0;f<a;++f)o>>>f&1&&c.push(i[f]);t.push(c)}return u(t)}function m(e,t){if(t<0)return[];for(var r=[],n=(1<<t+1)-1,i=0;i<e.length;++i)for(var a=e[i],o=n;o<1<<a.length;o=b.nextCombination(o)){for(var s=new Array(t+1),c=0,f=0;f<a.length;++f)o&1<<f&&(s[c++]=a[f]);r.push(s)}return u(r)}function p(e){for(var t=[],r=0,n=e.length;r<n;++r)for(var i=e[r],a=0,o=i.length;a<o;++a){for(var s=new Array(i.length-1),c=0,f=0;c<o;++c)c!==a&&(s[f++]=i[c]);t.push(s)}return u(t)}function v(e,t){for(var r=new M(t),n=0;n<e.length;++n)for(var i=e[n],a=0;a<i.length;++a)for(var o=a+1;o<i.length;++o)r.link(i[a],i[o]);for(var s=[],u=r.ranks,n=0;n<u.length;++n)u[n]=-1;for(var n=0;n<e.length;++n){var c=r.find(e[n][0]);u[c]<0?(u[c]=s.length,s.push([e[n].slice(0)])):s[u[c]].push(e[n].slice(0))}return s}function g(e){for(var t=c(u(m(e,0))),r=new M(t.length),n=0;n<e.length;++n)for(var i=e[n],a=0;a<i.length;++a)for(var o=f(t,[i[a]]),s=a+1;s<i.length;++s)r.link(o,f(t,[i[s]]));for(var h=[],l=r.ranks,n=0;n<l.length;++n)l[n]=-1;for(var n=0;n<e.length;++n){var d=r.find(f(t,[e[n][0]]));l[d]<0?(l[d]=h.length,h.push([e[n].slice(0)])):h[l[d]].push(e[n].slice(0))}return h}function y(e,t){return t?v(e,t):g(e)}var b=e("bit-twiddle"),M=e("union-find");r.dimension=n,r.countVertices=i,r.cloneCells=a,r.compareCells=o,r.normalize=u,r.unique=c,r.findCell=f,r.incidence=h,r.dual=l,r.explode=d,r.skeleton=m,r.boundary=p,r.connectedComponents=y},{"bit-twiddle":30,"union-find":86}],83:[function(e,t,r){function n(e,t,r,n,i){return o(0,e,t,r,n,i)}function i(e,t,r,n,i){var a,s,u,c;return 0==t?(a=o(1,e,1,r,n,i),s=o(-1,e,-1,r,n,i),u=a+s):t>0?(c=1==t?1:0,a=o(1,e,t-1,r,n,i),s=o(-1,e,1-t,r,n,i),u=a*Math.sqrt(1+c)-s*(1-c)):(c=-1==t?1:0,a=o(1,e,t+1,r,n,i),s=o(-1,e,-t-1,r,n,i),u=a*(1-c)+s*Math.sqrt(1+c)),u}function a(e,t,r,n,i){var a,s,u;return 0==t?console.error("should not be called"):t>0?(a=o(1,e,t+1,r,n,i),s=o(-1,e,-t-1,r,n,i),u=a+s):(a=o(1,e,t-1,r,n,i),s=o(-1,e,1-t,r,n,i),u=a-s),u}function o(e,t,r,n,i,a){var o,s,u;return o=i[e+1][2],s=i[e+1][0],u=i[e+1][1],n==-t?o*a[r+t-1][0]+s*a[r+t-1][2*t-2]:n==t?o*a[r+t-1][2*t-2]-s*a[r+t-1][0]:u*a[r+t-1][n+t-1]}var s=e("numeric"),u=function(e,t,r,n){var i,a=t.length,o=(e+1)*(e+1),u=[,];o>a&&console.log("The SHT degree is too high for the number of data points"),0==r&&(t=h(t));for(var c=0;c<t.length;c++)u[c]=t[c][2];return Y_N=d(e,t),i=0==n?s.mul(1/a,Y_N):g(s.transpose(Y_N)),s.dotMV(i,u)},c=function(e,t){for(var r=t,n=Math.sqrt(e.length)-1,i=d(n,t),a=s.dotVM(e,i),o=0;o<t.length;o++)r[o][2]=a[o];return r},f=function(e){for(var t=0;t<e.length;t++)console.log(e[t])},h=function(e,t){for(var r,n,i,a=new Array(e.length),o=0;o<e.length;o++)r=Math.atan2(e[o][1],e[o][0]),n=Math.atan2(e[o][2],Math.sqrt(e[o][0]*e[o][0]+e[o][1]*e[o][1])),1==t?a[o]=[r,n]:(i=Math.sqrt(e[o][0]*e[o][0]+e[o][1]*e[o][1]+e[o][2]*e[o][2]),a[o]=[r,n,i]);return a},l=function(e){for(var t,r,n,i=new Array(e.length),a=0;a<e.length;a++)t=Math.cos(e[a][0])*Math.cos(e[a][1]),r=Math.sin(e[a][0])*Math.cos(e[a][1]),n=Math.sin(e[a][1]),2==e[0].length?i[a]=[t,r,n]:3==e[0].length&&(i[a]=[e[a][2]*t,e[a][2]*r,e[a][2]*n]);return i},d=function(e,t){for(var r=new Array(t.length),n=new Array(t.length),i=0;i<t.length;i++)r[i]=t[i][0],n[i]=t[i][1];for(var a,o,u,c,f,h=new Array(2*e+1),l=(r.length,(e+1)*(e+1)),d=0,v=0,g=s.sin(n),y=0,b=new Array(l),i=0;i<2*e+1;i++)h[i]=m(i);for(var M=0;M<e+1;M++){if(0==M){var x=new Array(r.length);x.fill(1),b[M]=x,y=1}else{a=p(M,g,d,v),o=Math.sqrt(2*M+1);for(var w=0;w<M+1;w++)0==w?b[y+M]=s.mul(o,a[w]):(u=o*Math.sqrt(2*h[M-w]/h[M+w]),c=s.cos(s.mul(w,r)),f=s.sin(s.mul(w,r)),b[y+M-w]=s.mul(u,s.mul(a[w],f)),b[y+M+w]=s.mul(u,s.mul(a[w],c)));y=y+2*M+1}v=d,d=a}return b},m=function(e){return 0===e?1:e*m(e-1)},p=function(e,t,r,n){var i=new Array(e+1);switch(e){case 1:var a=s.mul(t,t),o=t,u=s.sqrt(s.sub(1,a));i[0]=o,i[1]=u;break;case 2:var a=s.mul(t,t),c=s.mul(3,a);c=s.sub(c,1),c=s.div(c,2);var f=s.sub(1,a);f=s.sqrt(f),f=s.mul(3,f),f=s.mul(f,t);var h=s.sub(1,a);h=s.mul(3,h),i[0]=c,i[1]=f,i[2]=h;break;default:var a=s.mul(t,t),l=s.sub(1,a),d=2*e-1,m=1;if(d%2==0)for(var p=1;p<d/2+1;p++)m=2*m*p;else for(var p=1;p<(d+1)/2+1;p++)m*=2*p-1;i[e]=s.mul(m,s.pow(l,e/2)),i[e-1]=s.mul(2*e-1,s.mul(t,r[e-1]));for(var v=0;v<e-1;v++){var g=s.mul(2*e-1,s.mul(t,r[v])),y=s.mul(e+v-1,n[v]);i[v]=s.div(s.sub(g,y),e-v)}}return i},v=function(e){for(var t=s.svd(e),r=t.S[0],n=t.U,i=t.S,a=t.V,o=e.length,u=e[0].length,c=Math.max(o,u)*s.epsilon*r,f=i.length,h=new Array(f),l=f-1;-1!==l;l--)i[l]>c?h[l]=1/i[l]:h[l]=0;return s.dot(s.dot(a,s.diag(h)),s.transpose(n))},g=function(e){var t=s.transpose(e);return s.dot(s.inv(s.dot(t,e)),t)},y=function(e,t){var r=(t+1)*(t+1),o=s.rep([r,r],0);o[0][0]=1;var u=s.rep([3,3],0);u[0][0]=e[1][1],u[0][1]=e[1][2],u[0][2]=e[1][0],u[1][0]=e[2][1],u[1][1]=e[2][2],u[1][2]=e[2][0],u[2][0]=e[0][1],u[2][1]=e[0][2],u[2][2]=e[0][0],o=s.setBlock(o,[1,1],[3,3],u);for(var c=u,f=3,h=2;h<t+1;h++){for(var l=s.rep([2*h+1,2*h+1],0),d=-h;d<h+1;d++)for(var m=-h;m<h+1;m++){var p,v,g,y,b;p=0==d?1:0,v=Math.abs(m)==h?2*h*(2*h-1):h*h-m*m,g=Math.sqrt((h*h-d*d)/v),y=Math.sqrt((1+p)*(h+Math.abs(d)-1)*(h+Math.abs(d))/v)*(1-2*p)*.5,b=Math.sqrt((h-Math.abs(d)-1)*(h-Math.abs(d))/v)*(1-p)*-.5,0!=g&&(g*=n(h,d,m,u,c)),0!=y&&(y*=i(h,d,m,u,c)),0!=b&&(b*=a(h,d,m,u,c)),l[d+h][m+h]=g+y+b}o=s.setBlock(o,[f+1,f+1],[f+2*h+1,f+2*h+1],l),c=l,f=f+2*h+1}return o},b=function(e,t,r){var n,i,a;n=0==r?[[1,0,0],[0,1,0],[0,0,1]]:[[1,0,0],[0,Math.cos(r),Math.sin(r)],[0,-Math.sin(r),Math.cos(r)]],i=0==t?[[1,0,0],[0,1,0],[0,0,1]]:[[Math.cos(t),0,-Math.sin(t)],[0,1,0],[Math.sin(t),0,Math.cos(t)]],a=0==e?[[1,0,0],[0,1,0],[0,0,1]]:[[Math.cos(e),Math.sin(e),0],[-Math.sin(e),Math.cos(e),0],[0,0,1]];var o=s.dotMMsmall(i,a);return o=s.dotMMsmall(n,o)};t.exports.forwardSHT=u,t.exports.inverseSHT=c,t.exports.print2Darray=f,t.exports.convertCart2Sph=h,t.exports.convertSph2Cart=l,t.exports.computeRealSH=d,t.exports.factorial=m,t.exports.recurseLegendrePoly=p,t.exports.pinv_svd=v,t.exports.pinv_direct=g,t.exports.getSHrotMtx=y,t.exports.yawPitchRoll2Rzyx=b},{numeric:65}],84:[function(e,t,r){"use strict";function n(e,t,r){var n=e*t,a=i*e,o=a-e,s=a-o,u=e-s,c=i*t,f=c-t,h=c-f,l=t-h,d=n-s*h,m=d-u*h,p=m-s*l,v=u*l-p;return r?(r[0]=v,r[1]=n,r):[v,n]}t.exports=n;var i=+(Math.pow(2,27)+1)},{}],85:[function(e,t,r){"use strict";function n(e,t,r){var n=e+t,i=n-e,a=n-i,o=t-i,s=e-a;return r?(r[0]=s+o,r[1]=n,r):[s+o,n]}t.exports=n},{}],86:[function(e,t,r){"use strict";"use restrict";function n(e){this.roots=new Array(e),this.ranks=new Array(e);for(var t=0;t<e;++t)this.roots[t]=t,this.ranks[t]=0}t.exports=n;var i=n.prototype;Object.defineProperty(i,"length",{get:function(){return this.roots.length}}),i.makeSet=function(){var e=this.roots.length;return this.roots.push(e),this.ranks.push(0),e},i.find=function(e){for(var t=e,r=this.roots;r[e]!==e;)e=r[e];for(;r[t]!==e;){var n=r[t];r[t]=e,t=n}return e},i.link=function(e,t){var r=this.find(e),n=this.find(t);if(r!==n){var i=this.ranks,a=this.roots,o=i[r],s=i[n];o<s?a[r]=n:s<o?a[n]=r:(a[n]=r,++i[r])}}},{}]},{},[24])(24)});