0% found this document useful (0 votes)
13 views24 pages

JavaScript Object Helper Functions

Uploaded by

ahepworth4home
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views24 pages

JavaScript Object Helper Functions

Uploaded by

ahepworth4home
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

var __create = Object.

create;
var __defProp = [Link];
var __defProps = [Link];
var __getOwnPropDesc = [Link];
var __getOwnPropDescs = [Link];
var __getOwnPropNames = [Link];
var __getOwnPropSymbols = [Link];
var __getProtoOf = [Link];
var __hasOwnProp = [Link];
var __propIsEnum = [Link];
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key,
{ enumerable: true, configurable: true, writable: true, value }) : obj[key] =
value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && [Link](prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if ([Link](prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[[Link](cb)[0]])((mod = { exports: {} }).exports, mod),
[Link];
};
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module, desc) => {
if (module && typeof module === "object" || typeof module === "function") {
for (let key of __getOwnPropNames(module))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module[key], enumerable: !(desc =
__getOwnPropDesc(module, key)) || [Link] });
}
return target;
};
var __toModule = (module) => {
return __reExport(__markAsModule(__defProp(module != null ?
__create(__getProtoOf(module)) : {}, "default", module && module.__esModule &&
"default" in module ? { get: () => [Link], enumerable: true } : { value:
module, enumerable: true })), module);
};
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step([Link](value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step([Link](value));
} catch (e) {
reject(e);
}
};
var step = (x) => [Link] ? resolve([Link]) :
[Link]([Link]).then(fulfilled, rejected);
step((generator = [Link](__this, __arguments)).next());
});
};

// node_modules/@babel/runtime/helpers/[Link]
var require_arrayWithHoles = __commonJS({
"node_modules/@babel/runtime/helpers/[Link]"(exports, module) {
function _arrayWithHoles(arr) {
if ([Link](arr))
return arr;
}
[Link] = _arrayWithHoles;
[Link]["default"] = [Link], [Link].__esModule = true;
}
});

// node_modules/@babel/runtime/helpers/[Link]
var require_iterableToArrayLimit = __commonJS({
"node_modules/@babel/runtime/helpers/[Link]"(exports, module) {
function _iterableToArrayLimit(arr, i) {
var _i = arr == null ? null : typeof Symbol !== "undefined" &&
arr[[Link]] || arr["@@iterator"];
if (_i == null)
return;
var _arr = [];
var _n = true;
var _d = false;
var _s, _e;
try {
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i)
break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null)
_i["return"]();
} finally {
if (_d)
throw _e;
}
}
return _arr;
}
[Link] = _iterableToArrayLimit;
[Link]["default"] = [Link], [Link].__esModule = true;
}
});

// node_modules/@babel/runtime/helpers/[Link]
var require_arrayLikeToArray = __commonJS({
"node_modules/@babel/runtime/helpers/[Link]"(exports, module) {
function _arrayLikeToArray(arr, len) {
if (len == null || len > [Link])
len = [Link];
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
[Link] = _arrayLikeToArray;
[Link]["default"] = [Link], [Link].__esModule = true;
}
});

// node_modules/@babel/runtime/helpers/[Link]
var require_unsupportedIterableToArray = __commonJS({
"node_modules/@babel/runtime/helpers/[Link]"(exports,
module) {
var arrayLikeToArray = require_arrayLikeToArray();
function _unsupportedIterableToArray(o, minLen) {
if (!o)
return;
if (typeof o === "string")
return arrayLikeToArray(o, minLen);
var n = [Link](o).slice(8, -1);
if (n === "Object" && [Link])
n = [Link];
if (n === "Map" || n === "Set")
return [Link](o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
return arrayLikeToArray(o, minLen);
}
[Link] = _unsupportedIterableToArray;
[Link]["default"] = [Link], [Link].__esModule = true;
}
});

// node_modules/@babel/runtime/helpers/[Link]
var require_nonIterableRest = __commonJS({
"node_modules/@babel/runtime/helpers/[Link]"(exports, module) {
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\
nIn order to be iterable, non-array objects must have a [[Link]]()
method.");
}
[Link] = _nonIterableRest;
[Link]["default"] = [Link], [Link].__esModule = true;
}
});

// node_modules/@babel/runtime/helpers/[Link]
var require_slicedToArray = __commonJS({
"node_modules/@babel/runtime/helpers/[Link]"(exports, module) {
var arrayWithHoles = require_arrayWithHoles();
var iterableToArrayLimit = require_iterableToArrayLimit();
var unsupportedIterableToArray = require_unsupportedIterableToArray();
var nonIterableRest = require_nonIterableRest();
function _slicedToArray(arr, i) {
return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) ||
unsupportedIterableToArray(arr, i) || nonIterableRest();
}
[Link] = _slicedToArray;
[Link]["default"] = [Link], [Link].__esModule = true;
}
});

// node_modules/@babel/runtime/helpers/[Link]
var require_classCallCheck = __commonJS({
"node_modules/@babel/runtime/helpers/[Link]"(exports, module) {
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
[Link] = _classCallCheck;
[Link]["default"] = [Link], [Link].__esModule = true;
}
});

// node_modules/@babel/runtime/helpers/[Link]
var require_createClass = __commonJS({
"node_modules/@babel/runtime/helpers/[Link]"(exports, module) {
function _defineProperties(target, props) {
for (var i = 0; i < [Link]; i++) {
var descriptor = props[i];
[Link] = [Link] || false;
[Link] = true;
if ("value" in descriptor)
[Link] = true;
[Link](target, [Link], descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps)
_defineProperties([Link], protoProps);
if (staticProps)
_defineProperties(Constructor, staticProps);
return Constructor;
}
[Link] = _createClass;
[Link]["default"] = [Link], [Link].__esModule = true;
}
});

// node_modules/automation-events/build/es5/[Link]
var require_bundle = __commonJS({
"node_modules/automation-events/build/es5/[Link]"(exports, module) {
(function(global2, factory) {
typeof exports === "object" && typeof module !== "undefined" ?
factory(exports, require_slicedToArray(), require_classCallCheck(),
require_createClass()) : typeof define === "function" && [Link] ?
define(["exports", "@babel/runtime/helpers/slicedToArray",
"@babel/runtime/helpers/classCallCheck", "@babel/runtime/helpers/createClass"],
factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 ||
self, factory([Link] = {}, global2._slicedToArray,
global2._classCallCheck, global2._createClass));
})(exports, function(exports2, _slicedToArray, _classCallCheck, _createClass) {
"use strict";
function _interopDefaultLegacy(e) {
return e && typeof e === "object" && "default" in e ? e : { "default": e };
}
var _slicedToArray__default = /* @__PURE__ */
_interopDefaultLegacy(_slicedToArray);
var _classCallCheck__default = /* @__PURE__ */
_interopDefaultLegacy(_classCallCheck);
var _createClass__default = /* @__PURE__ */
_interopDefaultLegacy(_createClass);
var createExtendedExponentialRampToValueAutomationEvent = function
createExtendedExponentialRampToValueAutomationEvent2(value, endTime, insertTime) {
return {
endTime,
insertTime,
type: "exponentialRampToValue",
value
};
};
var createExtendedLinearRampToValueAutomationEvent = function
createExtendedLinearRampToValueAutomationEvent2(value, endTime, insertTime) {
return {
endTime,
insertTime,
type: "linearRampToValue",
value
};
};
var createSetValueAutomationEvent2 = function
createSetValueAutomationEvent3(value, startTime) {
return {
startTime,
type: "setValue",
value
};
};
var createSetValueCurveAutomationEvent2 = function
createSetValueCurveAutomationEvent3(values, startTime, duration) {
return {
duration,
startTime,
type: "setValueCurve",
values
};
};
var getTargetValueAtTime = function getTargetValueAtTime2(time,
valueAtStartTime, _ref) {
var startTime = _ref.startTime, target = _ref.target, timeConstant =
_ref.timeConstant;
return target + (valueAtStartTime - target) * [Link]((startTime - time) /
timeConstant);
};
var isExponentialRampToValueAutomationEvent = function
isExponentialRampToValueAutomationEvent2(automationEvent) {
return [Link] === "exponentialRampToValue";
};
var isLinearRampToValueAutomationEvent = function
isLinearRampToValueAutomationEvent2(automationEvent) {
return [Link] === "linearRampToValue";
};
var isAnyRampToValueAutomationEvent = function
isAnyRampToValueAutomationEvent2(automationEvent) {
return isExponentialRampToValueAutomationEvent(automationEvent) ||
isLinearRampToValueAutomationEvent(automationEvent);
};
var isSetValueAutomationEvent = function
isSetValueAutomationEvent2(automationEvent) {
return [Link] === "setValue";
};
var isSetValueCurveAutomationEvent = function
isSetValueCurveAutomationEvent2(automationEvent) {
return [Link] === "setValueCurve";
};
var getValueOfAutomationEventAtIndexAtTime = function
getValueOfAutomationEventAtIndexAtTime2(automationEvents, index, time,
defaultValue) {
var automationEvent = automationEvents[index];
return automationEvent === void 0 ? defaultValue :
isAnyRampToValueAutomationEvent(automationEvent) ||
isSetValueAutomationEvent(automationEvent) ? [Link] :
isSetValueCurveAutomationEvent(automationEvent) ?
[Link][[Link] - 1] :
getTargetValueAtTime(time,
getValueOfAutomationEventAtIndexAtTime2(automationEvents, index - 1,
[Link], defaultValue), automationEvent);
};
var getEndTimeAndValueOfPreviousAutomationEvent = function
getEndTimeAndValueOfPreviousAutomationEvent2(automationEvents, index,
currentAutomationEvent, nextAutomationEvent, defaultValue) {
return currentAutomationEvent === void 0 ? [[Link],
defaultValue] : isAnyRampToValueAutomationEvent(currentAutomationEvent) ?
[[Link], [Link]] :
isSetValueAutomationEvent(currentAutomationEvent) ?
[[Link], [Link]] :
isSetValueCurveAutomationEvent(currentAutomationEvent) ?
[[Link] + [Link],
[Link][[Link] - 1]] :
[[Link],
getValueOfAutomationEventAtIndexAtTime(automationEvents, index - 1,
[Link], defaultValue)];
};
var isCancelAndHoldAutomationEvent = function
isCancelAndHoldAutomationEvent2(automationEvent) {
return [Link] === "cancelAndHold";
};
var isCancelScheduledValuesAutomationEvent = function
isCancelScheduledValuesAutomationEvent2(automationEvent) {
return [Link] === "cancelScheduledValues";
};
var getEventTime = function getEventTime2(automationEvent) {
if (isCancelAndHoldAutomationEvent(automationEvent) ||
isCancelScheduledValuesAutomationEvent(automationEvent)) {
return [Link];
}
if (isExponentialRampToValueAutomationEvent(automationEvent) ||
isLinearRampToValueAutomationEvent(automationEvent)) {
return [Link];
}
return [Link];
};
var getExponentialRampValueAtTime = function
getExponentialRampValueAtTime2(time, startTime, valueAtStartTime, _ref) {
var endTime = _ref.endTime, value = _ref.value;
if (valueAtStartTime === value) {
return value;
}
if (0 < valueAtStartTime && 0 < value || valueAtStartTime < 0 && value < 0)
{
return valueAtStartTime * [Link](value / valueAtStartTime, (time -
startTime) / (endTime - startTime));
}
return 0;
};
var getLinearRampValueAtTime = function getLinearRampValueAtTime2(time,
startTime, valueAtStartTime, _ref) {
var endTime = _ref.endTime, value = _ref.value;
return valueAtStartTime + (time - startTime) / (endTime - startTime) *
(value - valueAtStartTime);
};
var interpolateValue = function interpolateValue2(values, theoreticIndex) {
var lowerIndex = [Link](theoreticIndex);
var upperIndex = [Link](theoreticIndex);
if (lowerIndex === upperIndex) {
return values[lowerIndex];
}
return (1 - (theoreticIndex - lowerIndex)) * values[lowerIndex] + (1 -
(upperIndex - theoreticIndex)) * values[upperIndex];
};
var getValueCurveValueAtTime = function getValueCurveValueAtTime2(time, _ref)
{
var duration = _ref.duration, startTime = _ref.startTime, values =
_ref.values;
var theoreticIndex = (time - startTime) / duration * ([Link] - 1);
return interpolateValue(values, theoreticIndex);
};
var isSetTargetAutomationEvent = function
isSetTargetAutomationEvent2(automationEvent) {
return [Link] === "setTarget";
};
var AutomationEventList2 = /* @__PURE__ */ function(_Symbol$iterator) {
function AutomationEventList3(defaultValue) {
_classCallCheck__default["default"](this, AutomationEventList3);
this._automationEvents = [];
this._currenTime = 0;
this._defaultValue = defaultValue;
}
_createClass__default["default"](AutomationEventList3, [{
key: _Symbol$iterator,
value: function value() {
return this._automationEvents[[Link]]();
}
}, {
key: "add",
value: function add(automationEvent) {
var eventTime = getEventTime(automationEvent);
if (isCancelAndHoldAutomationEvent(automationEvent) ||
isCancelScheduledValuesAutomationEvent(automationEvent)) {
var index =
this._automationEvents.findIndex(function(currentAutomationEvent) {
if (isCancelScheduledValuesAutomationEvent(automationEvent) &&
isSetValueCurveAutomationEvent(currentAutomationEvent)) {
return [Link] +
[Link] >= eventTime;
}
return getEventTime(currentAutomationEvent) >= eventTime;
});
var removedAutomationEvent = this._automationEvents[index];
if (index !== -1) {
this._automationEvents = this._automationEvents.slice(0, index);
}
if (isCancelAndHoldAutomationEvent(automationEvent)) {
var lastAutomationEvent =
this._automationEvents[this._automationEvents.length - 1];
if (removedAutomationEvent !== void 0 &&
isAnyRampToValueAutomationEvent(removedAutomationEvent)) {
if (isSetTargetAutomationEvent(lastAutomationEvent)) {
throw new Error("The internal list is malformed.");
}
var startTime =
isSetValueCurveAutomationEvent(lastAutomationEvent) ? [Link]
+ [Link] : getEventTime(lastAutomationEvent);
var startValue =
isSetValueCurveAutomationEvent(lastAutomationEvent) ?
[Link][[Link] - 1] :
[Link];
var value =
isExponentialRampToValueAutomationEvent(removedAutomationEvent) ?
getExponentialRampValueAtTime(eventTime, startTime, startValue,
removedAutomationEvent) : getLinearRampValueAtTime(eventTime, startTime,
startValue, removedAutomationEvent);
var truncatedAutomationEvent =
isExponentialRampToValueAutomationEvent(removedAutomationEvent) ?
createExtendedExponentialRampToValueAutomationEvent(value, eventTime,
this._currenTime) : createExtendedLinearRampToValueAutomationEvent(value,
eventTime, this._currenTime);
this._automationEvents.push(truncatedAutomationEvent);
}
if (lastAutomationEvent !== void 0 &&
isSetTargetAutomationEvent(lastAutomationEvent)) {

this._automationEvents.push(createSetValueAutomationEvent2([Link](eventTime)
, eventTime));
}
if (lastAutomationEvent !== void 0 &&
isSetValueCurveAutomationEvent(lastAutomationEvent) &&
[Link] + [Link] > eventTime) {
this._automationEvents[this._automationEvents.length - 1] =
createSetValueCurveAutomationEvent2(new Float32Array([6, 7]),
[Link], eventTime - [Link]);
}
}
} else {
var _index =
this._automationEvents.findIndex(function(currentAutomationEvent) {
return getEventTime(currentAutomationEvent) > eventTime;
});
var previousAutomationEvent = _index === -1 ?
this._automationEvents[this._automationEvents.length - 1] :
this._automationEvents[_index - 1];
if (previousAutomationEvent !== void 0 &&
isSetValueCurveAutomationEvent(previousAutomationEvent) &&
getEventTime(previousAutomationEvent) + [Link] >
eventTime) {
return false;
}
var persistentAutomationEvent =
isExponentialRampToValueAutomationEvent(automationEvent) ?
createExtendedExponentialRampToValueAutomationEvent([Link],
[Link], this._currenTime) :
isLinearRampToValueAutomationEvent(automationEvent) ?
createExtendedLinearRampToValueAutomationEvent([Link], eventTime,
this._currenTime) : automationEvent;
if (_index === -1) {
this._automationEvents.push(persistentAutomationEvent);
} else {
if (isSetValueCurveAutomationEvent(automationEvent) && eventTime +
[Link] > getEventTime(this._automationEvents[_index])) {
return false;
}
this._automationEvents.splice(_index, 0,
persistentAutomationEvent);
}
}
return true;
}
}, {
key: "flush",
value: function flush(time) {
var index =
this._automationEvents.findIndex(function(currentAutomationEvent) {
return getEventTime(currentAutomationEvent) > time;
});
if (index > 1) {
var remainingAutomationEvents = this._automationEvents.slice(index -
1);
var firstRemainingAutomationEvent = remainingAutomationEvents[0];
if (isSetTargetAutomationEvent(firstRemainingAutomationEvent)) {

[Link](createSetValueAutomationEvent2(getValueOfAutomati
onEventAtIndexAtTime(this._automationEvents, index - 2,
[Link], this._defaultValue),
[Link]));
}
this._automationEvents = remainingAutomationEvents;
}
}
}, {
key: "getValue",
value: function getValue(time) {
if (this._automationEvents.length === 0) {
return this._defaultValue;
}
var indexOfNextEvent =
this._automationEvents.findIndex(function(automationEvent) {
return getEventTime(automationEvent) > time;
});
var nextAutomationEvent = this._automationEvents[indexOfNextEvent];
var indexOfCurrentEvent = (indexOfNextEvent === -1 ?
this._automationEvents.length : indexOfNextEvent) - 1;
var currentAutomationEvent =
this._automationEvents[indexOfCurrentEvent];
if (currentAutomationEvent !== void 0 &&
isSetTargetAutomationEvent(currentAutomationEvent) && (nextAutomationEvent === void
0 || !isAnyRampToValueAutomationEvent(nextAutomationEvent) ||
[Link] > time)) {
return getTargetValueAtTime(time,
getValueOfAutomationEventAtIndexAtTime(this._automationEvents, indexOfCurrentEvent
- 1, [Link], this._defaultValue),
currentAutomationEvent);
}
if (currentAutomationEvent !== void 0 &&
isSetValueAutomationEvent(currentAutomationEvent) && (nextAutomationEvent === void
0 || !isAnyRampToValueAutomationEvent(nextAutomationEvent))) {
return [Link];
}
if (currentAutomationEvent !== void 0 &&
isSetValueCurveAutomationEvent(currentAutomationEvent) && (nextAutomationEvent ===
void 0 || !isAnyRampToValueAutomationEvent(nextAutomationEvent) ||
[Link] + [Link] > time)) {
if (time < [Link] +
[Link]) {
return getValueCurveValueAtTime(time, currentAutomationEvent);
}
return
[Link][[Link] - 1];
}
if (currentAutomationEvent !== void 0 &&
isAnyRampToValueAutomationEvent(currentAutomationEvent) && (nextAutomationEvent ===
void 0 || !isAnyRampToValueAutomationEvent(nextAutomationEvent))) {
return [Link];
}
if (nextAutomationEvent !== void 0 &&
isExponentialRampToValueAutomationEvent(nextAutomationEvent)) {
var _getEndTimeAndValueOf =
getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents,
indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent,
this._defaultValue), _getEndTimeAndValueOf2 = _slicedToArray__default["default"]
(_getEndTimeAndValueOf, 2), startTime = _getEndTimeAndValueOf2[0], value =
_getEndTimeAndValueOf2[1];
return getExponentialRampValueAtTime(time, startTime, value,
nextAutomationEvent);
}
if (nextAutomationEvent !== void 0 &&
isLinearRampToValueAutomationEvent(nextAutomationEvent)) {
var _getEndTimeAndValueOf3 =
getEndTimeAndValueOfPreviousAutomationEvent(this._automationEvents,
indexOfCurrentEvent, currentAutomationEvent, nextAutomationEvent,
this._defaultValue), _getEndTimeAndValueOf4 = _slicedToArray__default["default"]
(_getEndTimeAndValueOf3, 2), _startTime = _getEndTimeAndValueOf4[0], _value =
_getEndTimeAndValueOf4[1];
return getLinearRampValueAtTime(time, _startTime, _value,
nextAutomationEvent);
}
return this._defaultValue;
}
}]);
return AutomationEventList3;
}([Link]);
var createCancelAndHoldAutomationEvent2 = function
createCancelAndHoldAutomationEvent3(cancelTime) {
return {
cancelTime,
type: "cancelAndHold"
};
};
var createCancelScheduledValuesAutomationEvent2 = function
createCancelScheduledValuesAutomationEvent3(cancelTime) {
return {
cancelTime,
type: "cancelScheduledValues"
};
};
var createExponentialRampToValueAutomationEvent2 = function
createExponentialRampToValueAutomationEvent3(value, endTime) {
return {
endTime,
type: "exponentialRampToValue",
value
};
};
var createLinearRampToValueAutomationEvent2 = function
createLinearRampToValueAutomationEvent3(value, endTime) {
return {
endTime,
type: "linearRampToValue",
value
};
};
var createSetTargetAutomationEvent2 = function
createSetTargetAutomationEvent3(target, startTime, timeConstant) {
return {
startTime,
target,
timeConstant,
type: "setTarget"
};
};
[Link] = AutomationEventList2;
[Link] =
createCancelAndHoldAutomationEvent2;
[Link] =
createCancelScheduledValuesAutomationEvent2;
[Link] =
createExponentialRampToValueAutomationEvent2;
[Link] =
createLinearRampToValueAutomationEvent2;
[Link] = createSetTargetAutomationEvent2;
[Link] = createSetValueAutomationEvent2;
[Link] =
createSetValueCurveAutomationEvent2;
[Link](exports2, "__esModule", { value: true });
});
}
});

// node_modules/tone/node_modules/tslib/[Link]
var require_tslib = __commonJS({
"node_modules/tone/node_modules/tslib/[Link]"(exports, module) {
var __extends2;
var __assign2;
var __rest2;
var __decorate2;
var __param2;
var __metadata2;
var __awaiter2;
var __generator2;
var __exportStar2;
var __values2;
var __read2;
var __spread2;
var __spreadArrays2;
var __spreadArray2;
var __await2;
var __asyncGenerator2;
var __asyncDelegator2;
var __asyncValues2;
var __makeTemplateObject2;
var __importStar2;
var __importDefault2;
var __classPrivateFieldGet2;
var __classPrivateFieldSet2;
var __createBinding2;
(function(factory) {
var root = typeof global === "object" ? global : typeof self === "object" ?
self : typeof this === "object" ? this : {};
if (typeof define === "function" && [Link]) {
define("tslib", ["exports"], function(exports2) {
factory(createExporter(root, createExporter(exports2)));
});
} else if (typeof module === "object" && typeof [Link] === "object")
{
factory(createExporter(root, createExporter([Link])));
} else {
factory(createExporter(root));
}
function createExporter(exports2, previous) {
if (exports2 !== root) {
if (typeof [Link] === "function") {
[Link](exports2, "__esModule", { value: true });
} else {
exports2.__esModule = true;
}
}
return function(id, v) {
return exports2[id] = previous ? previous(id, v) : v;
};
}
})(function(exporter) {
var extendStatics = [Link] || { __proto__: [] } instanceof
Array && function(d, b) {
d.__proto__ = b;
} || function(d, b) {
for (var p in b)
if ([Link](b, p))
d[p] = b[p];
};
__extends2 = function(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a
constructor or null");
extendStatics(d, b);
function __() {
[Link] = d;
}
[Link] = b === null ? [Link](b) : (__.prototype = [Link],
new __());
};
__assign2 = [Link] || function(t) {
for (var s, i = 1, n = [Link]; i < n; i++) {
s = arguments[i];
for (var p in s)
if ([Link](s, p))
t[p] = s[p];
}
return t;
};
__rest2 = function(s, e) {
var t = {};
for (var p in s)
if ([Link](s, p) && [Link](p) < 0)
t[p] = s[p];
if (s != null && typeof [Link] === "function")
for (var i = 0, p = [Link](s); i < [Link]; i++) {
if ([Link](p[i]) < 0 &&
[Link](s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
__decorate2 = function(decorators, target, key, desc) {
var c = [Link], r = c < 3 ? target : desc === null ? desc =
[Link](target, key) : desc, d;
if (typeof Reflect === "object" && typeof [Link] === "function")
r = [Link](decorators, target, key, desc);
else
for (var i = [Link] - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && [Link](target, key, r), r;
};
__param2 = function(paramIndex, decorator) {
return function(target, key) {
decorator(target, key, paramIndex);
};
};
__metadata2 = function(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof [Link] === "function")
return [Link](metadataKey, metadataValue);
};
__awaiter2 = function(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step([Link](value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
[Link] ? resolve([Link]) :
adopt([Link]).then(fulfilled, rejected);
}
step((generator = [Link](thisArg, _arguments || [])).next());
});
};
__generator2 = function(thisArg, body) {
var _ = { label: 0, sent: function() {
if (t[0] & 1)
throw t[1];
return t[1];
}, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof
Symbol === "function" && (g[[Link]] = function() {
return this;
}), g;
function verb(n) {
return function(v) {
return step([n, v]);
};
}
function step(op) {
if (f)
throw new TypeError("Generator is already executing.");
while (_)
try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] ||
((t = y["return"]) && [Link](y), 0) : [Link]) && !(t = [Link](y, op[1])).done)
return t;
if (y = 0, t)
op = [op[0] & 2, [Link]];
switch (op[0]) {
case 0:
case 1:
t = op;
break;
case 4:
_.label++;
return { value: op[1], done: false };
case 5:
_.label++;
y = op[1];
op = [0];
continue;
case 7:
op = _.[Link]();
_.[Link]();
continue;
default:
if (!(t = _.trys, t = [Link] > 0 && t[[Link] - 1]) && (op[0]
=== 6 || op[0] === 2)) {
_ = 0;
continue;
}
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
_.label = op[1];
break;
}
if (op[0] === 6 && _.label < t[1]) {
_.label = t[1];
t = op;
break;
}
if (t && _.label < t[2]) {
_.label = t[2];
_.[Link](op);
break;
}
if (t[2])
_.[Link]();
_.[Link]();
continue;
}
op = [Link](thisArg, _);
} catch (e) {
op = [6, e];
y = 0;
} finally {
f = t = 0;
}
if (op[0] & 5)
throw op[1];
return { value: op[0] ? op[1] : void 0, done: true };
}
};
__exportStar2 = function(m, o) {
for (var p in m)
if (p !== "default" && ![Link](o, p))
__createBinding2(o, m, p);
};
__createBinding2 = [Link] ? function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
[Link](o, k2, { enumerable: true, get: function() {
return m[k];
} });
} : function(o, m, k, k2) {
if (k2 === void 0)
k2 = k;
o[k2] = m[k];
};
__values2 = function(o) {
var s = typeof Symbol === "function" && [Link], m = s && o[s], i =
0;
if (m)
return [Link](o);
if (o && typeof [Link] === "number")
return {
next: function() {
if (o && i >= [Link])
o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "[Link] is not
defined.");
};
__read2 = function(o, n) {
var m = typeof Symbol === "function" && o[[Link]];
if (!m)
return o;
var i = [Link](o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = [Link]()).done)
[Link]([Link]);
} catch (error) {
e = { error };
} finally {
try {
if (r && ![Link] && (m = i["return"]))
[Link](i);
} finally {
if (e)
throw [Link];
}
}
return ar;
};
__spread2 = function() {
for (var ar = [], i = 0; i < [Link]; i++)
ar = [Link](__read2(arguments[i]));
return ar;
};
__spreadArrays2 = function() {
for (var s = 0, i = 0, il = [Link]; i < il; i++)
s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = [Link]; j < jl; j++, k++)
r[k] = a[j];
return r;
};
__spreadArray2 = function(to, from, pack) {
if (pack || [Link] === 2)
for (var i = 0, l = [Link], ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar)
ar = [Link](from, 0, i);
ar[i] = from[i];
}
}
return [Link](ar || [Link](from));
};
__await2 = function(v) {
return this instanceof __await2 ? (this.v = v, this) : new __await2(v);
};
__asyncGenerator2 = function(thisArg, _arguments, generator) {
if (![Link])
throw new TypeError("[Link] is not defined.");
var g = [Link](thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"),
i[[Link]] = function() {
return this;
}, i;
function verb(n) {
if (g[n])
i[n] = function(v) {
return new Promise(function(a, b) {
[Link]([n, v, a, b]) > 1 || resume(n, v);
});
};
}
function resume(n, v) {
try {
step(g[n](v));
} catch (e) {
settle(q[0][3], e);
}
}
function step(r) {
[Link] instanceof __await2 ? [Link]([Link].v).then(fulfill,
reject) : settle(q[0][2], r);
}
function fulfill(value) {
resume("next", value);
}
function reject(value) {
resume("throw", value);
}
function settle(f, v) {
if (f(v), [Link](), [Link])
resume(q[0][0], q[0][1]);
}
};
__asyncDelegator2 = function(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function(e) {
throw e;
}), verb("return"), i[[Link]] = function() {
return this;
}, i;
function verb(n, f) {
i[n] = o[n] ? function(v) {
return (p = !p) ? { value: __await2(o[n](v)), done: n === "return" } :
f ? f(v) : v;
} : f;
}
};
__asyncValues2 = function(o) {
if (![Link])
throw new TypeError("[Link] is not defined.");
var m = o[[Link]], i;
return m ? [Link](o) : (o = typeof __values2 === "function" ?
__values2(o) : o[[Link]](), i = {}, verb("next"), verb("throw"),
verb("return"), i[[Link]] = function() {
return this;
}, i);
function verb(n) {
i[n] = o[n] && function(v) {
return new Promise(function(resolve, reject) {
v = o[n](v), settle(resolve, reject, [Link], [Link]);
});
};
}
function settle(resolve, reject, d, v) {
[Link](v).then(function(v2) {
resolve({ value: v2, done: d });
}, reject);
}
};
__makeTemplateObject2 = function(cooked, raw) {
if ([Link]) {
[Link](cooked, "raw", { value: raw });
} else {
[Link] = raw;
}
return cooked;
};
var __setModuleDefault = [Link] ? function(o, v) {
[Link](o, "default", { enumerable: true, value: v });
} : function(o, v) {
o["default"] = v;
};
__importStar2 = function(mod) {
if (mod && mod.__esModule)
return mod;
var result = {};
if (mod != null) {
for (var k in mod)
if (k !== "default" && [Link](mod, k))
__createBinding2(result, mod, k);
}
__setModuleDefault(result, mod);
return result;
};
__importDefault2 = function(mod) {
return mod && mod.__esModule ? mod : { "default": mod };
};
__classPrivateFieldGet2 = function(receiver, state, kind, f) {
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !
[Link](receiver))
throw new TypeError("Cannot read private member from an object whose
class did not declare it");
return kind === "m" ? f : kind === "a" ? [Link](receiver) : f ? [Link] :
[Link](receiver);
};
__classPrivateFieldSet2 = function(receiver, state, value, kind, f) {
if (kind === "m")
throw new TypeError("Private method is not writable");
if (kind === "a" && !f)
throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !
[Link](receiver))
throw new TypeError("Cannot write private member to an object whose class
did not declare it");
return kind === "a" ? [Link](receiver, value) : f ? [Link] = value :
[Link](receiver, value), value;
};
exporter("__extends", __extends2);
exporter("__assign", __assign2);
exporter("__rest", __rest2);
exporter("__decorate", __decorate2);
exporter("__param", __param2);
exporter("__metadata", __metadata2);
exporter("__awaiter", __awaiter2);
exporter("__generator", __generator2);
exporter("__exportStar", __exportStar2);
exporter("__createBinding", __createBinding2);
exporter("__values", __values2);
exporter("__read", __read2);
exporter("__spread", __spread2);
exporter("__spreadArrays", __spreadArrays2);
exporter("__spreadArray", __spreadArray2);
exporter("__await", __await2);
exporter("__asyncGenerator", __asyncGenerator2);
exporter("__asyncDelegator", __asyncDelegator2);
exporter("__asyncValues", __asyncValues2);
exporter("__makeTemplateObject", __makeTemplateObject2);
exporter("__importStar", __importStar2);
exporter("__importDefault", __importDefault2);
exporter("__classPrivateFieldGet", __classPrivateFieldGet2);
exporter("__classPrivateFieldSet", __classPrivateFieldSet2);
});
}
});

// src/console/[Link]
var Console = class {
constructor(options = {}) {
__publicField(this, "onInput", (promptString) => __async(this, null, function*
() {
return yield prompt(promptString);
}));
__publicField(this, "onOutput", [Link]([Link]));
__publicField(this, "onClear", [Link]([Link]));
var _a3, _b, _c, _d;
[Link] = (_a3 = [Link]) != null ? _a3 : (promptString) =>
__async(this, null, function* () {
return yield prompt(promptString);
});
[Link] = (_b = [Link]) != null ? _b :
[Link]([Link]);
[Link] = (_c = [Link]) != null ? _c :
[Link]([Link]);
[Link] = (_d = [Link]) != null ? _d : (promptString,
defaultValue) => {
return promptString;
};
}
configure(options = {}) {
var _a3, _b, _c, _d;
[Link] = (_a3 = [Link]) != null ? _a3 : [Link];
[Link] = (_b = [Link]) != null ? _b : [Link];
[Link] = (_c = [Link]) != null ? _c : [Link];
[Link] = (_d = [Link]) != null ? _d :
[Link];
}
readLinePrivate(promptString) {
const input = prompt([Link](promptString));
return input;
}
readLinePrivateAsync(promptString) {
const input = [Link](promptString);
return input;
}
clear() {
[Link]();
}
print(...args) {
if ([Link] < 1) {
throw new Error("You should pass at least 1 argument to print");
}
[Link](...args);
}
println(value) {
if ([Link] === 0) {
value = "";
} else if ([Link] !== 1) {
throw new Error("You should pass exactly 1 argument to println");
}
[Link](value, "\n");
}
readNumber(str, parseFn, errorMsgType, asynchronous) {
const DEFAULT = Symbol();
const MAX_RECURSION_DEPTH = 100;
const ABORT = Symbol("ABORT");
let promptString = str;
let parsedResult;
const parseInput = (result2) => {
if (result2 === null) {
return ABORT;
}
parsedResult = parseFn(result2);
if (!isNaN(parsedResult)) {
return parsedResult;
}
return null;
};
const attemptInput = (promptString2, depth, asynchronous2) => {
if (depth >= MAX_RECURSION_DEPTH) {
return DEFAULT;
}
const result2 = asynchronous2 ? [Link](promptString2) :
[Link](promptString2);
const next = (result3) => {
return attemptInput(`'${result3}' was not ${errorMsgType}. Please try
again.
${str}`, depth + 1, asynchronous2);
};
if ([Link](result2) === result2) {
return [Link]((result3) => {
const parsedResult2 = parseInput(result3);
if (parsedResult2 === ABORT) {
return null;
}
if (parsedResult2 === null) {
return next(result3);
} else {
return parsedResult2;
}
});
} else {
const parsedResult2 = parseInput(result2);
if (parsedResult2 === ABORT) {
return null;
}
if (parsedResult2 === null) {
return next(result2);
} else {
return parsedResult2;
}
}
};
const result = attemptInput(promptString, 0, asynchronous);
if (result === DEFAULT) {
return 0;
}
if (result === null) {
return null;
}
if (!asynchronous) {
[Link](str);
[Link](result);
}
return result;
}
readLine(str) {
if ([Link] !== 1) {
throw new Error("You should pass exactly 1 argument to readLine");
}
const result = [Link](str);
[Link](str);
[Link](result);
return result;
}
readLineAsync(_0) {
return __async(this, arguments, function* (str) {
if ([Link] !== 1) {
throw new Error("You should pass exactly 1 argument to readLineAsync");
}
const result = yield [Link](str);
return result;
});
}
readBoolean(str) {
if ([Link] !== 1) {
throw new Error("You should pass exactly 1 argument to readBoolean");
}
return [Link](str, (line) => {
if (line === null) {
return NaN;
}
line = [Link]();
if (line === "true" || line === "yes") {
return true;
}
if (line === "false" || line === "no") {
return false;
}
return NaN;
}, "a boolean (true/false)");
}
readBooleanAsync(_0) {
return __async(this, arguments, function* (str) {
if ([Link] !== 1) {
throw new Error("You should pass exactly 1 argument to readBooleanAsync");
}
return yield [Link](str, (line) => {
if (line === null) {
return NaN;
}
line = [Link]();
if (line === "true" || line === "yes") {
return true;
}
if (line === "false" || line === "no") {
return false;
}
return NaN;
}, "a boolean (true/false)", true);
});
}
readInt(str) {
if ([Link] !== 1) {
throw new Error("You should pass exactly 1 argument to readInt");
}
return [Link](str, function(x) {
var resultInt = parseInt(x);
var resultFloat = parseFloat(x);
if (resultInt === resultFloat) {
return resultInt;
}
return NaN;
}, "an integer");
}
readIntAsync(_0) {
return __async(this, arguments, function* (str) {
if ([Link] !== 1) {
throw new Error("You should pass exactly 1 argument to readIntAsync");
}
return yield [Link](str, function(x) {
var resultInt = parseInt(x);
var resultFloat = parseFloat(x);
if (resultInt === resultFloat) {
return resultInt;
}
return NaN;
}, "an integer", true);
});
}
readFloat(str) {
if ([Link] !== 1) {
throw new Error("You should pass exactly 1 argument to readFloat");
}
return [Link](str, parseFloat, "a float");
}
readFloatAsync(_0) {
return __async(this, arguments, function* (str) {
if ([Link] !== 1) {
throw new Error("You should pass exactly 1 argument to readFloatAsync");
}
return yield [Link](str, parseFloat, "a float", true);
});
}
};
var console_default = Console;

// src/datastructures/[Link]
var Grid = class {
constructor(rows, cols) {
__publicField(this, "type", "Grid");
if ([Link] !== 2) {
throw new Error("You should pass exactly 2 arguments to `new Grid(rows,
cols)`");
}
if (typeof rows !== "number" || !isFinite(rows)) {
throw new TypeError("Invalid value for `rows`. Make sure you are passing
finite numbers to `new Grid(rows, cols)`.");
}
if (typeof cols !== "number" || !isFinite(cols)) {
throw new TypeError("Invalid value for `cols`. Make sure you are passing
finite numbers to `new Grid(rows, cols)`.");
}
rows = [Link](0, rows);
cols = [Link](0, cols);
[Link] = new Array(rows);
for (let i = 0; i < rows; i++) {
[Link][i] = new Array(cols);
}
}
initFromArray(arr) {
if ([Link] !== 1) {
throw new Error("You should pass exactly 1 argument to `initFromArray`");
}

Common questions

Powered by AI

The system calculates the value of an exponential ramp to value automation event at a particular time by determining the exponential growth between the start and end values over the time period. It uses a formula where the value at the current time is given by multiplying the initial value by the exponent of the ratio of the difference between end and start times divided by the overall duration. This calculation assumes both initial and final values are non-zero and have the same sign for the formula to remain valid .

When a cancel and hold automation event occurs, it identifies the point in the list of automation events where the cancelation should take place, removing events from that point onward. If the prior removed event was a ramp event, the process requires creating a truncated version of that ramp event up to the cancel time using current values and potentially incorporating a setValue event to hold the last value reached. This ensures no future automation affects the state past the cancelation point, effectively freezing the automation at that level of modification .

Having a default value in an automation event list is crucial because it provides a baseline from which all event-driven changes begin and against which future changes are measured. In scenarios where no events are present or when events are canceled, the system reverts to this default, ensuring continuity and preventing undefined states. The default value serves as a fallback to guarantee stability in calculations and smooth transitions between scheduled automation operations .

Automation events are structured with distinct types and properties that allow for efficient sorting and modification based on their unique time stamps and types. By maintaining a well-ordered list, the system can find the insertion or removal points quickly using time-based look-ups, ensuring events can be seamlessly integrated without reprocessing the entire sequence. Methods like splice allow for precise control over modifications, ensuring that changes affect only the desired subset of events, thus optimizing performance and allowing flexible real-time adjustments .

Handling asynchronous generator functions in the automation event system presents challenges such as managing asynchrony while ensuring backward compatibility with synchronous iterator protocols. Ensuring that promises are resolved without blocking execution and allowing for subsequent values to be asynchronously delivered requires careful orchestration. The system must handle potential errors gracefully and continue iteration, maintaining the correct sequence of operations and state without compromising the overall event logic .

Using a cancel scheduled values automation event within an automation event list implies the removal of any scheduled automation events beyond the specified cancelTime that would potentially affect the automation parameter's future values. This cancelation ensures that the controlled parameter holds its value up to the point of cancelation and future automation changes won't be applied past this point unless new events are added. It effectively cleans up future unrequired events, maintaining the desired state or modifying the behavior immediately once a new automation sequence starts .

Distinguishing between different automation event types is critical as each type demands unique handling logic and affects the automation curve differently. For example, ramp events require careful calculation to transition correctly between start and end points, while setting values only needs direct application. Misclassification could lead to incorrect parameter changes, affecting the overall application smoothly. The system's capability to correctly identify and process each event type ensures precision and effectiveness in achieving expected audio or parameter changes over time .

Linear interpolation differs from value curve interpolation in its simplicity and directness, as it calculates intermediate values by directly interpolating between two set points over a linear span, resulting in a straight line. In contrast, value curve interpolation involves an array of values, calculating positions between multiple value points over time to generate a curve. This method offers a richer, smoother transition suitable for more complex automated parameter changes, resulting in more nuanced and intricate time-value relationships .

Exponential ramp to value automation events are characterized by a value change that follows an exponential curve, where the rate of change increases or decreases multiplicatively over time. In contrast, linear ramp to value automation events change at a constant rate, producing a straight line when plotted. The exponential ramp depends on the beginning and end values being either both positive or both negative for the function to work correctly; otherwise, the value will be zero. Meanwhile, linear ramp simply interpolates directly between two values over a set duration .

The setValueCurve automation event is distinct because it involves applying an array of values over a specified duration, which allows for the recreation of complex curves. This is unlike other types such as setValue or any ramp events, which deal with single values at given times or simple interpolations over time. The setValueCurve uses interpolation to transition between the given values over the specified period, which allows for smooth curves that are not supported by linear or exponential ramps .

You might also like