UNPKG

@arction/xydata

Version:

A random data generation library.

15 lines (13 loc) 22.4 kB
var xydata=function(t){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */var n=function(t,i){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])})(t,i)};function i(t,i){function r(){this.constructor=t}n(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}var r=function(){return(r=Object.assign||function(t){for(var n,i=1,r=arguments.length;i<r;i++)for(var e in n=arguments[i])Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t}).apply(this,arguments)};function e(t,n,i,r){return new(i||(i=Promise))((function(e,u){function s(t){try{h(r.next(t))}catch(t){u(t)}}function o(t){try{h(r.throw(t))}catch(t){u(t)}}function h(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(t){t(n)}))).then(s,o)}h((r=r.apply(t,n||[])).next())}))}function u(t,n){var i,r,e,u,s={label:0,sent:function(){if(1&e[0])throw e[1];return e[1]},trys:[],ops:[]};return u={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u;function o(u){return function(o){return function(u){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,r&&(e=2&u[0]?r.return:u[0]?r.throw||((e=r.return)&&e.call(r),0):r.next)&&!(e=e.call(r,u[1])).done)return e;switch(r=0,e&&(u=[2&u[0],e.value]),u[0]){case 0:case 1:e=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,r=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(e=s.trys,(e=e.length>0&&e[e.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!e||u[1]>e[0]&&u[1]<e[3])){s.label=u[1];break}if(6===u[0]&&s.label<e[1]){s.label=e[1],e=u;break}if(e&&s.label<e[2]){s.label=e[2],s.ops.push(u);break}e[2]&&s.ops.pop(),s.trys.pop();continue}u=n.call(t,s)}catch(t){u=[6,t],r=0}finally{i=e=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,o])}}}var s,o=function(){function t(t,n){this.options=t,this.streamActive=!1,this.data=[],this.interval=this.options.interval||1e3,this.batchSize=this.options.batchSize||1,this.batchesLeft=-2,this.runStream=this.runStream.bind(this),this.infiniteReset=n,void 0!==t.repeat&&("boolean"==typeof t.repeat?this.batchesLeft=t.repeat?-1:-2:"number"==typeof t.repeat?this.batchesLeft=t.repeat+1:"function"==typeof t.repeat&&(this.continueHandler=t.repeat))}return t.prototype.consume=function(){var t=this,n=this.batchSize;this.data.length<this.batchSize&&(n=this.data.length);var i=this.data.splice(0,n);if((this.batchesLeft>0||-1===this.batchesLeft)&&i.length>0&&(this.data=this.data.concat(i.map((function(n){return t.infiniteReset(n)}))),i.length<this.batchSize))for(;i.length<this.batchSize;){var r=this.data.splice(0,1)[0];this.data=this.data.concat(this.infiniteReset(r)),i.push(r)}return i},t.prototype.checkStreamContinue=function(){var t=this.batchesLeft>0||-1===this.batchesLeft||-2===this.batchesLeft&&this.data.length>0;return this.continueHandler&&(t=!0===this.continueHandler()),t},t.prototype.runStream=function(){var t=this.checkStreamContinue();if(this.data&&this.data.length>0&&t){if(this.streamHandler){var n=this.consume();this.streamHandler(n)}setTimeout(this.runStream,this.interval)}else this.streamActive=!1;this.batchesLeft>0&&this.batchesLeft--},t.prototype.activateStream=function(){this.streamActive||(this.streamActive=!0,this.runStream())},t.prototype.push=function(t){Array.isArray(t)?this.data=this.data.concat(t):this.data.push(t),this.activateStream()},t.prototype.map=function(n){return this.outputStream=new t(r(r({},this.options),{repeat:!1}),this.infiniteReset),this.mapHandler=n,this.streamHandler=this.i,this.activateStream(),this.outputStream},t.prototype.i=function(t){if(this.mapHandler&&this.outputStream){var n=t.map(this.mapHandler);this.outputStream.push(n)}},t.prototype.forEach=function(t){this.forEachHandler=t,this.streamHandler=this.u,this.activateStream()},t.prototype.u=function(t){this.forEachHandler&&t.forEach(this.forEachHandler)},t}(),h=function(){function t(t,n){this.data=[],this.derivativeDataHosts=[],this.promisesToResolve=[],this.streamsToPush=[],this.infiniteReset=this.infiniteReset.bind(this),this.infiniteResetHandler=t;var i={interval:n.interval,batchSize:n.batchSize,repeat:void 0!==n.repeat&&n.repeat};this.streamOptions=Object.freeze(i)}return t.prototype.toStream=function(){var t=new o(this.streamOptions,this.infiniteReset);return this.frozenData?t.push(this.frozenData):this.streamsToPush.push(t),t},t.prototype.toPromise=function(){var t=this;return this.frozenData?Promise.resolve(this.frozenData):new Promise((function(n){t.promisesToResolve.push(n)}))},t.prototype.infiniteReset=function(t){return this.infiniteResetHandler(t,this.frozenData?this.frozenData:[])},t.prototype.push=function(t){var n,i;if(!this.frozenData)if(Array.isArray(t))try{for(var r=function(t){var n="function"==typeof Symbol&&Symbol.iterator,i=n&&t[n],r=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}(t),e=r.next();!e.done;e=r.next()){var u=e.value;this.data.push(u)}}catch(t){n={error:t}}finally{try{e&&!e.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}else this.data.push(t)},t.prototype.setData=function(t){this.data=t},t.prototype.freeze=function(){var t=this;this.frozenData||(this.frozenData=this.data,setTimeout((function(){t.promisesToResolve.forEach((function(n){return n(t.frozenData)})),t.promisesToResolve=[]}),0),setTimeout((function(){t.streamsToPush.forEach((function(n){return n.push(t.frozenData||[])})),t.streamsToPush=[]}),0),setTimeout((function(){t.handleDerivativeDataHosts()}),0),this.data=[])},t.prototype.getPointCount=function(){return this.frozenData?this.frozenData.length:0},t.prototype.handleDerivativeDataHosts=function(){var t=this;this.frozenData&&this.derivativeDataHosts.length>0&&(this.derivativeDataHosts.forEach((function(n){t.frozenData&&n.setData(t.frozenData),n.freeze()})),this.derivativeDataHosts=[])},t.prototype.setStreamInterval=function(n){var i=new t(this.infiniteResetHandler,r(r({},this.streamOptions),{interval:n}));return this.derivativeDataHosts.push(i),this.handleDerivativeDataHosts(),i},t.prototype.setStreamBatchSize=function(n){var i=new t(this.infiniteResetHandler,r(r({},this.streamOptions),{batchSize:n}));return this.derivativeDataHosts.push(i),this.handleDerivativeDataHosts(),i},t.prototype.setStreamRepeat=function(n){var i=new t(this.infiniteResetHandler,r(r({},this.streamOptions),{repeat:n}));return this.derivativeDataHosts.push(i),this.handleDerivativeDataHosts(),i},t}();if("undefined"!=typeof window&&window.performance&&window.performance.now)s=window.performance.now.bind(window.performance);else try{if("undefined"==typeof require)throw new Error;s=require("perf_hooks").performance.now}catch(t){throw new Error('Failed to detect "performance.now" API')}var f=function(){function t(t){this.options=t}return t.prototype.generate=function(){var t=new h(this.infiniteReset,{interval:500,batchSize:10,repeat:!1}),n=this.getPointCount(),i=this.generateChunks.bind(this,0,n,t);return setTimeout(i,0),t},t.prototype.generateChunks=function(t,n,i){for(var r=s(),e=[],u=0;s()-r<15&&t<n;u++){var o=this.generateDataPoint(t);t++,e.push(o)}if(i.push(e),t<n){var h=this.generateChunks.bind(this,t,n,i);setTimeout(h,0)}else i.freeze()},t}();var a=function(t){function n(n){var i=t.call(this,n)||this;i.offset=.5;var r={numberOfPoints:n.numberOfPoints,offsetStep:0===n.offsetStep?0:n.offsetStep,offsetDeltaMax:Math.min(n.offsetDeltaMax,1),offsetDeltaMin:Math.max(0===n.offsetDeltaMin?0:n.offsetDeltaMin,0),dataMax:Math.min(n.dataMax,1)};return i.options=Object.freeze(r),i}return i(n,t),n.prototype.setNumberOfPoints=function(t){return new n(r(r({},this.options),{numberOfPoints:t}))},n.prototype.setOffsetStep=function(t){return new n(r(r({},this.options),{offsetStep:t}))},n.prototype.setOffsetDeltaMax=function(t){return new n(r(r({},this.options),{offsetDeltaMax:t}))},n.prototype.setOffsetDeltaMin=function(t){return new n(r(r({},this.options),{offsetDeltaMin:t}))},n.prototype.setDataMax=function(t){return new n(r(r({},this.options),{dataMax:t}))},n.prototype.getPointCount=function(){return this.options.numberOfPoints},n.prototype.generateDataPoint=function(t){if(t%this.options.offsetStep==0||0===t){var n=Math.random()*(this.options.offsetDeltaMax-this.options.offsetDeltaMin)+this.options.offsetDeltaMin;this.offset=Math.random()>.5?this.offset+n:this.offset-n}return this.offset+this.options.dataMax>1?this.offset=1-this.options.dataMax:this.offset<0&&(this.offset=0),{x:t,y:this.offset+Math.random()*this.options.dataMax}},n.prototype.infiniteReset=function(t,n){return{x:t.x+n.length,y:t.y}},n}(f);var c=function(t){function n(n){var i=t.call(this,n)||this;i.previousPoint={x:0,y:0};var r={numberOfPoints:n.numberOfPoints};return i.options=Object.freeze(r),i}return i(n,t),n.prototype.setNumberOfPoints=function(t){return new n(r(r({},this.options),{numberOfPoints:t}))},n.prototype.getPointCount=function(){return this.options.numberOfPoints},n.prototype.generateDataPoint=function(t){var n={x:t,y:this.previousPoint.y+2*(Math.random()-.5)};return this.previousPoint=n,n},n.prototype.infiniteReset=function(t,n){return{x:t.x+n.length,y:t.y}},n}(f);var v=function(t){function n(n){var i=t.call(this,n)||this;i.x=i.options.start;var r={samplingFunction:n.samplingFunction,start:n.start,end:n.end,step:n.step};return i.options=Object.freeze(r),i.numberOfPoints=Math.ceil(Math.abs(r.end-r.start)/r.step),i}return i(n,t),n.prototype.setSamplingFunction=function(t){return new n(r(r({},this.options),{samplingFunction:t}))},n.prototype.setStart=function(t){return new n(r(r({},this.options),{start:t}))},n.prototype.setEnd=function(t){return new n(r(r({},this.options),{end:t}))},n.prototype.setStep=function(t){return new n(r(r({},this.options),{step:t}))},n.prototype.getPointCount=function(){return this.numberOfPoints},n.prototype.generateDataPoint=function(){var t={x:this.x,y:this.options.samplingFunction(this.x)};return this.x=this.x+this.options.step,t},n.prototype.infiniteReset=function(t,n){return{x:t.x+n.length*(n[n.length-1].x-n[n.length-2].x),y:t.y}},n}(f);var w=function(t){function n(n){var i=t.call(this,n)||this;i.previous={x:0,y:0};var r={numberOfPoints:n.numberOfPoints};return i.options=Object.freeze(r),i}return i(n,t),n.prototype.setNumberOfPoints=function(t){return new n(r(r({},this.options),{numberOfPoints:t}))},n.prototype.getPointCount=function(){return this.options.numberOfPoints},n.prototype.generateDataPoint=function(){var t={x:this.previous.x+2*(Math.random()-.5),y:this.previous.y+2*(Math.random()-.5)};return this.previous=t,t},n.prototype.infiniteReset=function(t,n){return{x:t.x+n[n.length-1].x,y:t.y+n[n.length-1].y}},n}(f);var m=function(t){function n(n){var i=t.call(this,n)||this;return i.prevPoint=[i.options.startTimestamp,i.options.start,i.options.start,i.options.start,i.options.start],i}return i(n,t),n.prototype.setNumberOfPoints=function(t){return new n(r(r({},this.options),{numberOfPoints:t}))},n.prototype.setStartTimestamp=function(t){return new n(r(r({},this.options),{startTimestamp:t}))},n.prototype.setDataFrequency=function(t){return new n(r(r({},this.options),{dataFreq:t}))},n.prototype.setStart=function(t){return new n(r(r({},this.options),{start:t}))},n.prototype.setVolatility=function(t){return new n(r(r({},this.options),{volatility:t}))},n.prototype.getPointCount=function(){return this.options.numberOfPoints},n.prototype.generateDataPoint=function(t){var n,i=this,r=this.options.startTimestamp+this.options.dataFreq*t,e=Math.random()>.5?1:-1,u=Array.from(Array(4)).map((function(t){var n=Math.random()*i.options.volatility*e;return i.prevPoint[4]+n<0&&(n*=-1),i.prevPoint[4]+n})).sort((function(t,n){return t-n}));return-1===e&&(u=[u[0],u[2],u[1],u[3]]),n=[r,u[1],u[3],u[0],u[2]],this.prevPoint=n,n},n.prototype.infiniteReset=function(t,n){return[t[0]+n.length*(n[n.length-1][0]-n[n.length-2][0]),t[1],t[2],t[3],t[4]]},n}(f);var l=function(t){function n(n){var i=t.call(this,n)||this;i.lastSpike=0;var r={numberOfPoints:n.numberOfPoints,minGap:n.minGap,maxGap:n.maxGap,minAmplitude:n.minAmplitude,maxAmplitude:n.maxAmplitude,probability:n.probability};return i.options=Object.freeze(r),i}return i(n,t),n.prototype.setNumberOfPoints=function(t){return new n(r(r({},this.options),{numberOfPoints:t}))},n.prototype.setMinGap=function(t){return new n(r(r({},this.options),{minGap:t}))},n.prototype.setMaxGap=function(t){return new n(r(r({},this.options),{maxGap:t}))},n.prototype.setMinAmplitude=function(t){return new n(r(r({},this.options),{minAmplitude:t}))},n.prototype.setMaxAmplitude=function(t){return new n(r(r({},this.options),{maxAmplitude:t}))},n.prototype.setProbability=function(t){return new n(r(r({},this.options),{probability:t}))},n.prototype.getPointCount=function(){return this.options.numberOfPoints},n.prototype.generateDataPoint=function(t){var n=t-this.lastSpike,i={x:t,y:0};(n>this.options.minGap||-1===this.options.minGap)&&(n<this.options.maxGap||-1===this.options.maxGap?Math.random()>1-this.options.probability&&(i.y=Math.random()*(this.options.maxAmplitude-this.options.minAmplitude)+this.options.minAmplitude,this.lastSpike=t):n>=this.options.maxGap&&(i.y=Math.random()*(this.options.maxAmplitude-this.options.minAmplitude)+this.options.minAmplitude,this.lastSpike=t));return i},n.prototype.infiniteReset=function(t,n){return{x:t.x+n.length,y:t.y}},n}(f);var y=function(t){function n(n){var i=t.call(this,n)||this,r={numberOfPoints:n.numberOfPoints};return i.options=Object.freeze(r),i}return i(n,t),n.prototype.setNumberOfPoints=function(t){return new n(this.options?r(r({},this.options),{numberOfPoints:t}):{numberOfPoints:t})},n.prototype.getPointCount=function(){return this.options.numberOfPoints},n.prototype.generateDataPoint=function(t){return{x:t,y:2*(Math.random()-.5)}},n.prototype.infiniteReset=function(t,n){return{x:t.x+n[n.length-1].x,y:t.y+n[n.length-1].y}},n}(f);var p=function(t){function n(n){var i=t.call(this,n)||this;i.interval=1/(i.options.samplingFrequency||10);var r={inputData:n.inputData,samplingFrequency:n.samplingFrequency,step:n.step};return i.options=Object.freeze(r),i}return i(n,t),n.prototype.setInputData=function(t){return new n(r(r({},this.options),{inputData:t}))},n.prototype.setSamplingFrequency=function(t){return new n(r(r({},this.options),{samplingFrequency:t}))},n.prototype.setStep=function(t){return new n(r(r({},this.options),{step:t}))},n.prototype.getPointCount=function(){return this.options.inputData.length},n.prototype.generateDataPoint=function(t){return{timestamp:t*this.interval+t*this.options.step,data:this.options.inputData[t]}},n.prototype.infiniteReset=function(t,n){return{timestamp:t.timestamp+n[n.length-1].timestamp,data:t.data}},n}(f);var d=function(t){function n(n){var i=t.call(this,n)||this;i.t=i.options.start;var r={xFunction:n.xFunction,yFunction:n.yFunction,start:n.start,end:n.end,step:n.step};return i.options=Object.freeze(r),i.numberOfPoints=Math.ceil(Math.abs(r.end-r.start)/r.step),i}return i(n,t),n.prototype.setXFunction=function(t){return new n(r(r({},this.options),{xFunction:t}))},n.prototype.setYFunction=function(t){return new n(r(r({},this.options),{yFunction:t}))},n.prototype.setStart=function(t){return new n(r(r({},this.options),{start:t}))},n.prototype.setEnd=function(t){return new n(r(r({},this.options),{end:t}))},n.prototype.setStep=function(t){return new n(r(r({},this.options),{step:t}))},n.prototype.getPointCount=function(){return this.numberOfPoints},n.prototype.generateDataPoint=function(){var t={x:this.options.xFunction(this.t),y:this.options.yFunction(this.t)};return this.t=this.t+this.options.step,t},n.prototype.infiniteReset=function(t,n){return{x:t.x,y:t.y}},n}(f),b={numberOfSamples:1e3,sampleSize:10,variation:10,frequencyStability:1,narrowFactor1:8,narrowFactor2:24};var O=function(t){function n(n){var i=t.call(this,n)||this,r={sampleSize:void 0!==n.sampleSize?n.sampleSize:b.sampleSize,numberOfSamples:void 0!==n.numberOfSamples?n.numberOfSamples:b.numberOfSamples,variation:void 0!==n.variation?n.variation:b.variation,frequencyStability:void 0!==n.frequencyStability?n.frequencyStability:b.frequencyStability,narrowFactor1:void 0!==n.narrowFactor1?n.narrowFactor1:b.narrowFactor1,narrowFactor2:void 0!==n.narrowFactor2?n.narrowFactor2:b.narrowFactor2};return i.options=Object.freeze(r),i}return i(n,t),n.prototype.setNumberOfSamples=function(t){return new n(r(r({},this.options),{numberOfSamples:t}))},n.prototype.setSampleSize=function(t){return new n(r(r({},this.options),{sampleSize:t}))},n.prototype.setVariation=function(t){return new n(r(r({},this.options),{variation:t}))},n.prototype.setFrequencyStability=function(t){return new n(r(r({},this.options),{frequencyStability:t}))},n.prototype.setNarrowFactor1=function(t){return new n(r(r({},this.options),{narrowFactor1:t}))},n.prototype.setNarrowFactor2=function(t){return new n(r(r({},this.options),{narrowFactor2:t}))},n.prototype.getPointCount=function(){return this.options.numberOfSamples},n.prototype.generateDataPoint=function(t){for(var n=100,i=this.options.variation,r=this.options.sampleSize,e=this.options.frequencyStability,u=r/8,s=r/2,o=new Array(r),h=0;h<r;h++)o[h]=10;var f,a,c,v,w=r/2;(u+=(Math.random()-.5)*i/e/100*r/2)<0&&(u=0),u>r&&(u=r),(s+=(Math.random()-.5)*i/e/100*r)<0&&(s=0),s>r&&(s=r);var m,l=n/3*2,y=l/(w*w)*this.options.narrowFactor1,p=50/(w*w)*this.options.narrowFactor2;for(h=0;h<r;h++)(f=l-(c=.8*h-u)*c*y)<0&&(f=0),f>n&&(f=n),(a=50-(v=.8*h-s)*v*p)<0&&(a=0),a>n&&(a=n),m=f+a,m+=m*(Math.random()-.5)*i/10,o[h]=(o[h]+m)/2,o[h]<0&&(o[h]=0),o[h]>n&&(o[h]=n),o[h]=.02*o[h];return o},n.prototype.infiniteReset=function(t,n){return t.slice()},n}(f),M={rows:10,columns:10,rowPositionsNormalized:[.2,.5,.7],columnPositionsNormalized:[.6,.5,.3],amplitudes:[15,50,3],offsetLevel:47,volatility:25};var x=function(){function t(t){var n={rows:void 0!==t.rows?t.rows:M.rows,columns:void 0!==t.columns?t.columns:M.columns,rowPositionsNormalized:void 0!==t.rowPositionsNormalized?t.rowPositionsNormalized:M.rowPositionsNormalized,columnPositionsNormalized:void 0!==t.columnPositionsNormalized?t.columnPositionsNormalized:M.columnPositionsNormalized,amplitudes:void 0!==t.amplitudes?t.amplitudes:M.amplitudes,offsetLevel:void 0!==t.offsetLevel?t.offsetLevel:M.offsetLevel,volatility:void 0!==t.volatility?t.volatility:M.volatility};this.options=Object.freeze(n)}return t.prototype.setRows=function(n){return new t(r(r({},this.options),{rows:n}))},t.prototype.setColumns=function(n){return new t(r(r({},this.options),{columns:n}))},t.prototype.setWaterDrops=function(n){var i=n.map((function(t){return t.rowNormalized})),e=n.map((function(t){return t.columnNormalized})),u=n.map((function(t){return t.amplitude}));return new t(r(r({},this.options),{rowPositionsNormalized:i,columnPositionsNormalized:e,amplitudes:u}))},t.prototype.setOffsetLevel=function(n){return new t(r(r({},this.options),{offsetLevel:n}))},t.prototype.setVolatility=function(n){return new t(r(r({},this.options),{volatility:n}))},t.prototype.generate=function(){var t=this;return new Promise((function(n){return e(t,void 0,void 0,(function(){var t,i,r,e,s,o,h,f,a,c,v,w,m,l,y,p,d,b,O;return u(this,(function(u){switch(u.label){case 0:for(t=this.options.rows,i=this.options.columns,r=this.options.rowPositionsNormalized,e=this.options.columnPositionsNormalized,s=this.options.amplitudes,o=this.options.offsetLevel,h=this.options.volatility,f=s.length,a=Array(f),c=0;c<f;c++)a[c]={amplitude:s[c],centerX:r[c],centerZ:e[c],gain:1,offsetY:0};v=Array.from(Array(t)).map((function(){return Array(i)})),1,1,w=1/t,m=1/i,l=Date.now(),y=0,p=0,d=0,u.label=1;case 1:if(!(p<i))return[3,6];b=0,O=0,u.label=2;case 2:return b<t?(v[b][p]=function(t,n){for(var i=0,r=a.length,e=0;e<r;e++){var u=a[e],s=t-u.centerX,o=n-u.centerZ,f=Math.sqrt(s*s+o*o);i+=u.gain*u.amplitude*Math.cos(f*h)*Math.exp(3*-f)}return i}(O,d)+o,++y>0&&y%1e3==0&&Date.now()-l>=15?[4,new Promise((function(t){return setTimeout(t,0)}))]:[3,4]):[3,5];case 3:u.sent(),l=Date.now(),u.label=4;case 4:return b++,O+=w,[3,2];case 5:return p++,d+=m,[3,1];case 6:return n(v),[2]}}))}))}))},t}();return t.DataGenerator=f,t.DataHost=h,t.Stream=o,t.createDeltaFunctionGenerator=function(){return new l({numberOfPoints:1e3,minGap:1,maxGap:-1,minAmplitude:.1,maxAmplitude:1,probability:.02})},t.createOHLCGenerator=function(){return new m({numberOfPoints:1e3,startTimestamp:0,dataFreq:1,start:100,volatility:.1})},t.createParametricFunctionGenerator=function(){return new d({xFunction:function(t){return 3*Math.cos(3*t)},yFunction:function(t){return 3*Math.sin(4*t)},start:0,end:1e3,step:.5})},t.createProgressiveFunctionGenerator=function(){return new v({samplingFunction:function(t){return t*t},start:0,end:100,step:1})},t.createProgressiveRandomGenerator=function(){return new a({numberOfPoints:1e3,offsetStep:10,offsetDeltaMax:.3,offsetDeltaMin:.1,dataMax:.5})},t.createProgressiveTraceGenerator=function(){return new c({numberOfPoints:1e3})},t.createSampledDataGenerator=function(){return new p({inputData:[],samplingFrequency:50,step:0})},t.createSpectrumDataGenerator=function(){return new O(b)},t.createTraceGenerator=function(){return new w({numberOfPoints:1e3})},t.createWaterDropDataGenerator=function(){return new x(M)},t.createWhiteNoiseGenerator=function(){return new y({numberOfPoints:1e3})},Object.defineProperty(t,"o",{value:!0}),t}({});