summaryrefslogtreecommitdiff
path: root/school/node_modules/ranges-apply/dist
diff options
context:
space:
mode:
Diffstat (limited to 'school/node_modules/ranges-apply/dist')
-rw-r--r--school/node_modules/ranges-apply/dist/ranges-apply.cjs.js117
-rw-r--r--school/node_modules/ranges-apply/dist/ranges-apply.dev.umd.js294
-rw-r--r--school/node_modules/ranges-apply/dist/ranges-apply.esm.js103
-rw-r--r--school/node_modules/ranges-apply/dist/ranges-apply.umd.js26
4 files changed, 540 insertions, 0 deletions
diff --git a/school/node_modules/ranges-apply/dist/ranges-apply.cjs.js b/school/node_modules/ranges-apply/dist/ranges-apply.cjs.js
new file mode 100644
index 0000000..e0e1278
--- /dev/null
+++ b/school/node_modules/ranges-apply/dist/ranges-apply.cjs.js
@@ -0,0 +1,117 @@
+/**
+ * @name ranges-apply
+ * @fileoverview Take an array of string index ranges, delete/replace the string according to them
+ * @version 5.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-apply/}
+ */
+
+'use strict';
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+var _typeof = require('@babel/runtime/helpers/typeof');
+var rangesMerge = require('ranges-merge');
+
+function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
+
+var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
+
+var version$1 = "5.1.0";
+
+var version = version$1;
+function rApply(str, originalRangesArr, _progressFn) {
+ var percentageDone = 0;
+ var lastPercentageDone = 0;
+ if (arguments.length === 0) {
+ throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");
+ }
+ if (typeof str !== "string") {
+ throw new TypeError("ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ".concat(_typeof__default['default'](str), ", equal to: ").concat(JSON.stringify(str, null, 4)));
+ }
+ if (originalRangesArr && !Array.isArray(originalRangesArr)) {
+ throw new TypeError("ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ".concat(_typeof__default['default'](originalRangesArr), ", equal to: ").concat(JSON.stringify(originalRangesArr, null, 4)));
+ }
+ if (_progressFn && typeof _progressFn !== "function") {
+ throw new TypeError("ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ".concat(_typeof__default['default'](_progressFn), ", equal to: ").concat(JSON.stringify(_progressFn, null, 4)));
+ }
+ if (!originalRangesArr || !originalRangesArr.filter(function (range) {
+ return range;
+ }).length) {
+ return str;
+ }
+ var rangesArr;
+ if (Array.isArray(originalRangesArr) && Number.isInteger(originalRangesArr[0]) && Number.isInteger(originalRangesArr[1])) {
+ rangesArr = [Array.from(originalRangesArr)];
+ } else {
+ rangesArr = Array.from(originalRangesArr);
+ }
+ var len = rangesArr.length;
+ var counter = 0;
+ rangesArr.filter(function (range) {
+ return range;
+ }).forEach(function (el, i) {
+ if (_progressFn) {
+ percentageDone = Math.floor(counter / len * 10);
+ /* istanbul ignore else */
+ if (percentageDone !== lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ _progressFn(percentageDone);
+ }
+ }
+ if (!Array.isArray(el)) {
+ throw new TypeError("ranges-apply: [THROW_ID_05] ranges array, second input arg., has ".concat(i, "th element not an array: ").concat(JSON.stringify(el, null, 4), ", which is ").concat(_typeof__default['default'](el)));
+ }
+ if (!Number.isInteger(el[0])) {
+ if (!Number.isInteger(+el[0]) || +el[0] < 0) {
+ throw new TypeError("ranges-apply: [THROW_ID_06] ranges array, second input arg. has ".concat(i, "th element, array ").concat(JSON.stringify(el, null, 0), ". Its first element is not an integer, string index, but ").concat(_typeof__default['default'](el[0]), ", equal to: ").concat(JSON.stringify(el[0], null, 4), "."));
+ } else {
+ rangesArr[i][0] = +rangesArr[i][0];
+ }
+ }
+ if (!Number.isInteger(el[1])) {
+ if (!Number.isInteger(+el[1]) || +el[1] < 0) {
+ throw new TypeError("ranges-apply: [THROW_ID_07] ranges array, second input arg. has ".concat(i, "th element, array ").concat(JSON.stringify(el, null, 0), ". Its second element is not an integer, string index, but ").concat(_typeof__default['default'](el[1]), ", equal to: ").concat(JSON.stringify(el[1], null, 4), "."));
+ } else {
+ rangesArr[i][1] = +rangesArr[i][1];
+ }
+ }
+ counter += 1;
+ });
+ var workingRanges = rangesMerge.rMerge(rangesArr, {
+ progressFn: function progressFn(perc) {
+ if (_progressFn) {
+ percentageDone = 10 + Math.floor(perc / 10);
+ /* istanbul ignore else */
+ if (percentageDone !== lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ _progressFn(percentageDone);
+ }
+ }
+ }
+ });
+ var len2 = Array.isArray(workingRanges) ? workingRanges.length : 0;
+ /* istanbul ignore else */
+ if (len2 > 0) {
+ var tails = str.slice(workingRanges[len2 - 1][1]);
+ str = workingRanges.reduce(function (acc, _val, i, arr) {
+ if (_progressFn) {
+ percentageDone = 20 + Math.floor(i / len2 * 80);
+ /* istanbul ignore else */
+ if (percentageDone !== lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ _progressFn(percentageDone);
+ }
+ }
+ var beginning = i === 0 ? 0 : arr[i - 1][1];
+ var ending = arr[i][0];
+ return acc + str.slice(beginning, ending) + (arr[i][2] || "");
+ }, "");
+ str += tails;
+ }
+ return str;
+}
+
+exports.rApply = rApply;
+exports.version = version;
diff --git a/school/node_modules/ranges-apply/dist/ranges-apply.dev.umd.js b/school/node_modules/ranges-apply/dist/ranges-apply.dev.umd.js
new file mode 100644
index 0000000..03cc17b
--- /dev/null
+++ b/school/node_modules/ranges-apply/dist/ranges-apply.dev.umd.js
@@ -0,0 +1,294 @@
+/**
+ * @name ranges-apply
+ * @fileoverview Take an array of string index ranges, delete/replace the string according to them
+ * @version 5.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-apply/}
+ */
+
+(function (global, factory) {
+typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
+typeof define === 'function' && define.amd ? define(['exports'], factory) :
+(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.rangesApply = {}));
+}(this, (function (exports) { 'use strict';
+
+/**
+ * @name ranges-sort
+ * @fileoverview Sort string index ranges
+ * @version 4.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-sort/}
+ */
+const defaults$1 = {
+ strictlyTwoElementsInRangeArrays: false,
+ progressFn: null
+};
+function rSort(arrOfRanges, originalOptions) {
+ if (!Array.isArray(arrOfRanges) || !arrOfRanges.length) {
+ return arrOfRanges;
+ }
+ const opts = { ...defaults$1,
+ ...originalOptions
+ };
+ let culpritsIndex;
+ let culpritsLen;
+ if (opts.strictlyTwoElementsInRangeArrays && !arrOfRanges.filter(range => range).every((rangeArr, indx) => {
+ if (rangeArr.length !== 2) {
+ culpritsIndex = indx;
+ culpritsLen = rangeArr.length;
+ return false;
+ }
+ return true;
+ })) {
+ throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${culpritsIndex}th range (${JSON.stringify(arrOfRanges[culpritsIndex], null, 4)}) has not two but ${culpritsLen} elements!`);
+ }
+ if (!arrOfRanges.filter(range => range).every((rangeArr, indx) => {
+ if (!Number.isInteger(rangeArr[0]) || rangeArr[0] < 0 || !Number.isInteger(rangeArr[1]) || rangeArr[1] < 0) {
+ culpritsIndex = indx;
+ return false;
+ }
+ return true;
+ })) {
+ throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${culpritsIndex}th range (${JSON.stringify(arrOfRanges[culpritsIndex], null, 4)}) does not consist of only natural numbers!`);
+ }
+ const maxPossibleIterations = arrOfRanges.filter(range => range).length ** 2;
+ let counter = 0;
+ return Array.from(arrOfRanges).filter(range => range).sort((range1, range2) => {
+ if (opts.progressFn) {
+ counter += 1;
+ opts.progressFn(Math.floor(counter * 100 / maxPossibleIterations));
+ }
+ if (range1[0] === range2[0]) {
+ if (range1[1] < range2[1]) {
+ return -1;
+ }
+ if (range1[1] > range2[1]) {
+ return 1;
+ }
+ return 0;
+ }
+ if (range1[0] < range2[0]) {
+ return -1;
+ }
+ return 1;
+ });
+}
+
+/**
+ * @name ranges-merge
+ * @fileoverview Merge and sort string index ranges
+ * @version 7.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-merge/}
+ */
+const defaults = {
+ mergeType: 1,
+ progressFn: null,
+ joinRangesThatTouchEdges: true
+};
+function rMerge(arrOfRanges, originalOpts) {
+ function isObj(something) {
+ return something && typeof something === "object" && !Array.isArray(something);
+ }
+ if (!Array.isArray(arrOfRanges) || !arrOfRanges.length) {
+ return null;
+ }
+ let opts;
+ if (originalOpts) {
+ if (isObj(originalOpts)) {
+ opts = { ...defaults,
+ ...originalOpts
+ };
+ if (opts.progressFn && isObj(opts.progressFn) && !Object.keys(opts.progressFn).length) {
+ opts.progressFn = null;
+ } else if (opts.progressFn && typeof opts.progressFn !== "function") {
+ throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof opts.progressFn}", equal to ${JSON.stringify(opts.progressFn, null, 4)}`);
+ }
+ if (opts.mergeType && +opts.mergeType !== 1 && +opts.mergeType !== 2) {
+ throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof opts.mergeType}", equal to ${JSON.stringify(opts.mergeType, null, 4)}`);
+ }
+ if (typeof opts.joinRangesThatTouchEdges !== "boolean") {
+ throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof opts.joinRangesThatTouchEdges}", equal to ${JSON.stringify(opts.joinRangesThatTouchEdges, null, 4)}`);
+ }
+ } else {
+ throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:\n${JSON.stringify(originalOpts, null, 4)} (type ${typeof originalOpts})`);
+ }
+ } else {
+ opts = { ...defaults
+ };
+ }
+ const filtered = arrOfRanges
+ .filter(range => range).map(subarr => [...subarr]).filter(
+ rangeArr => rangeArr[2] !== undefined || rangeArr[0] !== rangeArr[1]);
+ let sortedRanges;
+ let lastPercentageDone;
+ let percentageDone;
+ if (opts.progressFn) {
+ sortedRanges = rSort(filtered, {
+ progressFn: percentage => {
+ percentageDone = Math.floor(percentage / 5);
+ if (percentageDone !== lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ opts.progressFn(percentageDone);
+ }
+ }
+ });
+ } else {
+ sortedRanges = rSort(filtered);
+ }
+ if (!sortedRanges) {
+ return null;
+ }
+ const len = sortedRanges.length - 1;
+ for (let i = len; i > 0; i--) {
+ if (opts.progressFn) {
+ percentageDone = Math.floor((1 - i / len) * 78) + 21;
+ if (percentageDone !== lastPercentageDone && percentageDone > lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ opts.progressFn(percentageDone);
+ }
+ }
+ if (sortedRanges[i][0] <= sortedRanges[i - 1][0] || !opts.joinRangesThatTouchEdges && sortedRanges[i][0] < sortedRanges[i - 1][1] || opts.joinRangesThatTouchEdges && sortedRanges[i][0] <= sortedRanges[i - 1][1]) {
+ sortedRanges[i - 1][0] = Math.min(sortedRanges[i][0], sortedRanges[i - 1][0]);
+ sortedRanges[i - 1][1] = Math.max(sortedRanges[i][1], sortedRanges[i - 1][1]);
+ if (sortedRanges[i][2] !== undefined && (sortedRanges[i - 1][0] >= sortedRanges[i][0] || sortedRanges[i - 1][1] <= sortedRanges[i][1])) {
+ if (sortedRanges[i - 1][2] !== null) {
+ if (sortedRanges[i][2] === null && sortedRanges[i - 1][2] !== null) {
+ sortedRanges[i - 1][2] = null;
+ } else if (sortedRanges[i - 1][2] != null) {
+ if (+opts.mergeType === 2 && sortedRanges[i - 1][0] === sortedRanges[i][0]) {
+ sortedRanges[i - 1][2] = sortedRanges[i][2];
+ } else {
+ sortedRanges[i - 1][2] += sortedRanges[i][2];
+ }
+ } else {
+ sortedRanges[i - 1][2] = sortedRanges[i][2];
+ }
+ }
+ }
+ sortedRanges.splice(i, 1);
+ i = sortedRanges.length;
+ }
+ }
+ return sortedRanges.length ? sortedRanges : null;
+}
+
+var version$1 = "5.1.0";
+
+const version = version$1;
+function rApply(str, originalRangesArr, progressFn) {
+ let percentageDone = 0;
+ let lastPercentageDone = 0;
+ if (arguments.length === 0) {
+ throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");
+ }
+ if (typeof str !== "string") {
+ throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof str}, equal to: ${JSON.stringify(str, null, 4)}`);
+ }
+ if (originalRangesArr && !Array.isArray(originalRangesArr)) {
+ throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof originalRangesArr}, equal to: ${JSON.stringify(originalRangesArr, null, 4)}`);
+ }
+ if (progressFn && typeof progressFn !== "function") {
+ throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof progressFn}, equal to: ${JSON.stringify(progressFn, null, 4)}`);
+ }
+ if (!originalRangesArr ||
+ !originalRangesArr.filter((range) => range).length) {
+ // quick ending - no ranges passed
+ return str;
+ }
+ let rangesArr;
+ if (Array.isArray(originalRangesArr) &&
+ Number.isInteger(originalRangesArr[0]) &&
+ Number.isInteger(originalRangesArr[1])) {
+ // if single array was passed, wrap it into an array
+ rangesArr = [Array.from(originalRangesArr)];
+ }
+ else {
+ rangesArr = Array.from(originalRangesArr);
+ }
+ // allocate first 10% of progress to this stage
+ const len = rangesArr.length;
+ let counter = 0;
+ rangesArr
+ .filter((range) => range)
+ .forEach((el, i) => {
+ if (progressFn) {
+ percentageDone = Math.floor((counter / len) * 10);
+ /* istanbul ignore else */
+ if (percentageDone !== lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ progressFn(percentageDone);
+ }
+ }
+ if (!Array.isArray(el)) {
+ throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${i}th element not an array: ${JSON.stringify(el, null, 4)}, which is ${typeof el}`);
+ }
+ if (!Number.isInteger(el[0])) {
+ if (!Number.isInteger(+el[0]) || +el[0] < 0) {
+ throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${i}th element, array ${JSON.stringify(el, null, 0)}. Its first element is not an integer, string index, but ${typeof el[0]}, equal to: ${JSON.stringify(el[0], null, 4)}.`);
+ }
+ else {
+ rangesArr[i][0] = +rangesArr[i][0];
+ }
+ }
+ if (!Number.isInteger(el[1])) {
+ if (!Number.isInteger(+el[1]) || +el[1] < 0) {
+ throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${i}th element, array ${JSON.stringify(el, null, 0)}. Its second element is not an integer, string index, but ${typeof el[1]}, equal to: ${JSON.stringify(el[1], null, 4)}.`);
+ }
+ else {
+ rangesArr[i][1] = +rangesArr[i][1];
+ }
+ }
+ counter += 1;
+ });
+ // allocate another 10% of the progress indicator length to the rangesMerge step:
+ const workingRanges = rMerge(rangesArr, {
+ progressFn: (perc) => {
+ if (progressFn) {
+ // since "perc" is already from zero to hundred, we just divide by 10 and
+ // get the range from zero to ten:
+ percentageDone = 10 + Math.floor(perc / 10);
+ /* istanbul ignore else */
+ if (percentageDone !== lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ progressFn(percentageDone);
+ }
+ }
+ },
+ });
+ // allocate the rest 80% to the actual string assembly:
+ const len2 = Array.isArray(workingRanges) ? workingRanges.length : 0;
+ /* istanbul ignore else */
+ if (len2 > 0) {
+ const tails = str.slice(workingRanges[len2 - 1][1]);
+ // eslint-disable-next-line no-param-reassign
+ str = workingRanges.reduce((acc, _val, i, arr) => {
+ if (progressFn) {
+ // since "perc" is already from zero to hundred, we just divide by 10 and
+ // get the range from zero to ten:
+ percentageDone = 20 + Math.floor((i / len2) * 80);
+ /* istanbul ignore else */
+ if (percentageDone !== lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ progressFn(percentageDone);
+ }
+ }
+ const beginning = i === 0 ? 0 : arr[i - 1][1];
+ const ending = arr[i][0];
+ return acc + str.slice(beginning, ending) + (arr[i][2] || "");
+ }, "");
+ // eslint-disable-next-line no-param-reassign
+ str += tails;
+ }
+ return str;
+}
+
+exports.rApply = rApply;
+exports.version = version;
+
+Object.defineProperty(exports, '__esModule', { value: true });
+
+})));
diff --git a/school/node_modules/ranges-apply/dist/ranges-apply.esm.js b/school/node_modules/ranges-apply/dist/ranges-apply.esm.js
new file mode 100644
index 0000000..16073b1
--- /dev/null
+++ b/school/node_modules/ranges-apply/dist/ranges-apply.esm.js
@@ -0,0 +1,103 @@
+/**
+ * @name ranges-apply
+ * @fileoverview Take an array of string index ranges, delete/replace the string according to them
+ * @version 5.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-apply/}
+ */
+
+import { rMerge } from 'ranges-merge';
+
+var version$1 = "5.1.0";
+
+const version = version$1;
+function rApply(str, originalRangesArr, progressFn) {
+ let percentageDone = 0;
+ let lastPercentageDone = 0;
+ if (arguments.length === 0) {
+ throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");
+ }
+ if (typeof str !== "string") {
+ throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof str}, equal to: ${JSON.stringify(str, null, 4)}`);
+ }
+ if (originalRangesArr && !Array.isArray(originalRangesArr)) {
+ throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof originalRangesArr}, equal to: ${JSON.stringify(originalRangesArr, null, 4)}`);
+ }
+ if (progressFn && typeof progressFn !== "function") {
+ throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof progressFn}, equal to: ${JSON.stringify(progressFn, null, 4)}`);
+ }
+ if (!originalRangesArr || !originalRangesArr.filter(range => range).length) {
+ return str;
+ }
+ let rangesArr;
+ if (Array.isArray(originalRangesArr) && Number.isInteger(originalRangesArr[0]) && Number.isInteger(originalRangesArr[1])) {
+ rangesArr = [Array.from(originalRangesArr)];
+ } else {
+ rangesArr = Array.from(originalRangesArr);
+ }
+ const len = rangesArr.length;
+ let counter = 0;
+ rangesArr.filter(range => range).forEach((el, i) => {
+ if (progressFn) {
+ percentageDone = Math.floor(counter / len * 10);
+ /* istanbul ignore else */
+ if (percentageDone !== lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ progressFn(percentageDone);
+ }
+ }
+ if (!Array.isArray(el)) {
+ throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${i}th element not an array: ${JSON.stringify(el, null, 4)}, which is ${typeof el}`);
+ }
+ if (!Number.isInteger(el[0])) {
+ if (!Number.isInteger(+el[0]) || +el[0] < 0) {
+ throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${i}th element, array ${JSON.stringify(el, null, 0)}. Its first element is not an integer, string index, but ${typeof el[0]}, equal to: ${JSON.stringify(el[0], null, 4)}.`);
+ } else {
+ rangesArr[i][0] = +rangesArr[i][0];
+ }
+ }
+ if (!Number.isInteger(el[1])) {
+ if (!Number.isInteger(+el[1]) || +el[1] < 0) {
+ throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${i}th element, array ${JSON.stringify(el, null, 0)}. Its second element is not an integer, string index, but ${typeof el[1]}, equal to: ${JSON.stringify(el[1], null, 4)}.`);
+ } else {
+ rangesArr[i][1] = +rangesArr[i][1];
+ }
+ }
+ counter += 1;
+ });
+ const workingRanges = rMerge(rangesArr, {
+ progressFn: perc => {
+ if (progressFn) {
+ percentageDone = 10 + Math.floor(perc / 10);
+ /* istanbul ignore else */
+ if (percentageDone !== lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ progressFn(percentageDone);
+ }
+ }
+ }
+ });
+ const len2 = Array.isArray(workingRanges) ? workingRanges.length : 0;
+ /* istanbul ignore else */
+ if (len2 > 0) {
+ const tails = str.slice(workingRanges[len2 - 1][1]);
+ str = workingRanges.reduce((acc, _val, i, arr) => {
+ if (progressFn) {
+ percentageDone = 20 + Math.floor(i / len2 * 80);
+ /* istanbul ignore else */
+ if (percentageDone !== lastPercentageDone) {
+ lastPercentageDone = percentageDone;
+ progressFn(percentageDone);
+ }
+ }
+ const beginning = i === 0 ? 0 : arr[i - 1][1];
+ const ending = arr[i][0];
+ return acc + str.slice(beginning, ending) + (arr[i][2] || "");
+ }, "");
+ str += tails;
+ }
+ return str;
+}
+
+export { rApply, version };
diff --git a/school/node_modules/ranges-apply/dist/ranges-apply.umd.js b/school/node_modules/ranges-apply/dist/ranges-apply.umd.js
new file mode 100644
index 0000000..33ef9fc
--- /dev/null
+++ b/school/node_modules/ranges-apply/dist/ranges-apply.umd.js
@@ -0,0 +1,26 @@
+/**
+ * @name ranges-apply
+ * @fileoverview Take an array of string index ranges, delete/replace the string according to them
+ * @version 5.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-apply/}
+ */
+
+!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).rangesApply={})}(this,(function(e){"use strict";
+/**
+ * @name ranges-sort
+ * @fileoverview Sort string index ranges
+ * @version 4.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-sort/}
+ */const r={strictlyTwoElementsInRangeArrays:!1,progressFn:null};function n(e,n){if(!Array.isArray(e)||!e.length)return e;const t={...r,...n};let s,o;if(t.strictlyTwoElementsInRangeArrays&&!e.filter((e=>e)).every(((e,r)=>2===e.length||(s=r,o=e.length,!1))))throw new TypeError(`ranges-sort: [THROW_ID_03] The first argument should be an array and must consist of arrays which are natural number indexes representing TWO string index ranges. However, ${s}th range (${JSON.stringify(e[s],null,4)}) has not two but ${o} elements!`);if(!e.filter((e=>e)).every(((e,r)=>!(!Number.isInteger(e[0])||e[0]<0||!Number.isInteger(e[1])||e[1]<0)||(s=r,!1))))throw new TypeError(`ranges-sort: [THROW_ID_04] The first argument should be an array and must consist of arrays which are natural number indexes representing string index ranges. However, ${s}th range (${JSON.stringify(e[s],null,4)}) does not consist of only natural numbers!`);const i=e.filter((e=>e)).length**2;let a=0;return Array.from(e).filter((e=>e)).sort(((e,r)=>(t.progressFn&&(a+=1,t.progressFn(Math.floor(100*a/i))),e[0]===r[0]?e[1]<r[1]?-1:e[1]>r[1]?1:0:e[0]<r[0]?-1:1)))}
+/**
+ * @name ranges-merge
+ * @fileoverview Merge and sort string index ranges
+ * @version 7.1.0
+ * @author Roy Revelt, Codsen Ltd
+ * @license MIT
+ * {@link https://codsen.com/os/ranges-merge/}
+ */const t={mergeType:1,progressFn:null,joinRangesThatTouchEdges:!0};function s(e,r){function s(e){return e&&"object"==typeof e&&!Array.isArray(e)}if(!Array.isArray(e)||!e.length)return null;let o;if(r){if(!s(r))throw new Error(`emlint: [THROW_ID_03] the second input argument must be a plain object. It was given as:\n${JSON.stringify(r,null,4)} (type ${typeof r})`);if(o={...t,...r},o.progressFn&&s(o.progressFn)&&!Object.keys(o.progressFn).length)o.progressFn=null;else if(o.progressFn&&"function"!=typeof o.progressFn)throw new Error(`ranges-merge: [THROW_ID_01] opts.progressFn must be a function! It was given of a type: "${typeof o.progressFn}", equal to ${JSON.stringify(o.progressFn,null,4)}`);if(o.mergeType&&1!=+o.mergeType&&2!=+o.mergeType)throw new Error(`ranges-merge: [THROW_ID_02] opts.mergeType was customised to a wrong thing! It was given of a type: "${typeof o.mergeType}", equal to ${JSON.stringify(o.mergeType,null,4)}`);if("boolean"!=typeof o.joinRangesThatTouchEdges)throw new Error(`ranges-merge: [THROW_ID_04] opts.joinRangesThatTouchEdges was customised to a wrong thing! It was given of a type: "${typeof o.joinRangesThatTouchEdges}", equal to ${JSON.stringify(o.joinRangesThatTouchEdges,null,4)}`)}else o={...t};const i=e.filter((e=>e)).map((e=>[...e])).filter((e=>void 0!==e[2]||e[0]!==e[1]));let a,l,g;if(a=o.progressFn?n(i,{progressFn:e=>{g=Math.floor(e/5),g!==l&&(l=g,o.progressFn(g))}}):n(i),!a)return null;const u=a.length-1;for(let e=u;e>0;e--)o.progressFn&&(g=Math.floor(78*(1-e/u))+21,g!==l&&g>l&&(l=g,o.progressFn(g))),(a[e][0]<=a[e-1][0]||!o.joinRangesThatTouchEdges&&a[e][0]<a[e-1][1]||o.joinRangesThatTouchEdges&&a[e][0]<=a[e-1][1])&&(a[e-1][0]=Math.min(a[e][0],a[e-1][0]),a[e-1][1]=Math.max(a[e][1],a[e-1][1]),void 0!==a[e][2]&&(a[e-1][0]>=a[e][0]||a[e-1][1]<=a[e][1])&&null!==a[e-1][2]&&(null===a[e][2]&&null!==a[e-1][2]?a[e-1][2]=null:null!=a[e-1][2]?2==+o.mergeType&&a[e-1][0]===a[e][0]?a[e-1][2]=a[e][2]:a[e-1][2]+=a[e][2]:a[e-1][2]=a[e][2]),a.splice(e,1),e=a.length);return a.length?a:null}e.rApply=function(e,r,n){let t,o=0,i=0;if(0===arguments.length)throw new Error("ranges-apply: [THROW_ID_01] inputs missing!");if("string"!=typeof e)throw new TypeError(`ranges-apply: [THROW_ID_02] first input argument must be a string! Currently it's: ${typeof e}, equal to: ${JSON.stringify(e,null,4)}`);if(r&&!Array.isArray(r))throw new TypeError(`ranges-apply: [THROW_ID_03] second input argument must be an array (or null)! Currently it's: ${typeof r}, equal to: ${JSON.stringify(r,null,4)}`);if(n&&"function"!=typeof n)throw new TypeError(`ranges-apply: [THROW_ID_04] the third input argument must be a function (or falsey)! Currently it's: ${typeof n}, equal to: ${JSON.stringify(n,null,4)}`);if(!r||!r.filter((e=>e)).length)return e;t=Array.isArray(r)&&Number.isInteger(r[0])&&Number.isInteger(r[1])?[Array.from(r)]:Array.from(r);const a=t.length;let l=0;t.filter((e=>e)).forEach(((e,r)=>{if(n&&(o=Math.floor(l/a*10),o!==i&&(i=o,n(o))),!Array.isArray(e))throw new TypeError(`ranges-apply: [THROW_ID_05] ranges array, second input arg., has ${r}th element not an array: ${JSON.stringify(e,null,4)}, which is ${typeof e}`);if(!Number.isInteger(e[0])){if(!Number.isInteger(+e[0])||+e[0]<0)throw new TypeError(`ranges-apply: [THROW_ID_06] ranges array, second input arg. has ${r}th element, array ${JSON.stringify(e,null,0)}. Its first element is not an integer, string index, but ${typeof e[0]}, equal to: ${JSON.stringify(e[0],null,4)}.`);t[r][0]=+t[r][0]}if(!Number.isInteger(e[1])){if(!Number.isInteger(+e[1])||+e[1]<0)throw new TypeError(`ranges-apply: [THROW_ID_07] ranges array, second input arg. has ${r}th element, array ${JSON.stringify(e,null,0)}. Its second element is not an integer, string index, but ${typeof e[1]}, equal to: ${JSON.stringify(e[1],null,4)}.`);t[r][1]=+t[r][1]}l+=1}));const g=s(t,{progressFn:e=>{n&&(o=10+Math.floor(e/10),o!==i&&(i=o,n(o)))}}),u=Array.isArray(g)?g.length:0;if(u>0){const r=e.slice(g[u-1][1]);e=g.reduce(((r,t,s,a)=>{n&&(o=20+Math.floor(s/u*80),o!==i&&(i=o,n(o)));return r+e.slice(0===s?0:a[s-1][1],a[s][0])+(a[s][2]||"")}),""),e+=r}return e},e.version="5.1.0",Object.defineProperty(e,"__esModule",{value:!0})}));