@putkoff/abstract-utilities 1.0.71 ā 1.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +296 -341
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server.js +342 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/esm/index.js +537 -1141
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server.js +305 -0
- package/dist/esm/server.js.map +1 -0
- package/dist/types/functions/auth_utils/imports.d.ts +0 -0
- package/dist/types/functions/auth_utils/index.d.ts +0 -0
- package/dist/types/functions/auth_utils/src/index.d.ts +0 -0
- package/dist/types/functions/auth_utils/src/token_utils.d.ts +0 -0
- package/dist/types/functions/config_utils/imports.d.ts +0 -0
- package/dist/types/functions/config_utils/index.d.ts +0 -0
- package/dist/types/functions/config_utils/src/config_utils.d.ts +0 -0
- package/dist/types/functions/config_utils/src/index.d.ts +0 -0
- package/dist/types/functions/constants_utils/index.d.ts +0 -0
- package/dist/types/functions/constants_utils/src/constants.d.ts +0 -0
- package/dist/types/functions/constants_utils/src/index.d.ts +0 -0
- package/dist/types/functions/env_utils/imports.d.ts +0 -0
- package/dist/types/functions/env_utils/index.d.ts +0 -0
- package/dist/types/functions/env_utils/src/index.d.ts +0 -0
- package/dist/types/functions/env_utils/src/window_utils.d.ts +0 -0
- package/dist/types/functions/fetch_utils/imports.d.ts +0 -0
- package/dist/types/functions/fetch_utils/index.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/fetch_utils.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/index.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/url_utils.d.ts +0 -0
- package/dist/types/functions/fetch_utils/src/utils.d.ts +0 -0
- package/dist/types/functions/index.d.ts +2 -0
- package/dist/types/functions/inspect_utils/imports.d.ts +1 -0
- package/dist/types/functions/inspect_utils/index.d.ts +2 -0
- package/dist/types/functions/inspect_utils/src/caller_utils.d.ts +6 -0
- package/dist/types/functions/inspect_utils/src/index.d.ts +1 -0
- package/dist/types/functions/math_utils/constants.d.ts +0 -0
- package/dist/types/functions/math_utils/conversions.d.ts +0 -0
- package/dist/types/functions/math_utils/index.d.ts +0 -0
- package/dist/types/functions/math_utils/safe_math.d.ts +0 -0
- package/dist/types/functions/math_utils/scaleInterfaces.d.ts +0 -0
- package/dist/types/functions/path_utils/imports.d.ts +0 -0
- package/dist/types/functions/path_utils/index.d.ts +0 -0
- package/dist/types/functions/path_utils/src/base_dirs.d.ts +0 -0
- package/dist/types/functions/path_utils/src/function_dirs.d.ts +0 -0
- package/dist/types/functions/path_utils/src/index.d.ts +0 -0
- package/dist/types/functions/path_utils/src/misc_dirs.d.ts +0 -0
- package/dist/types/functions/path_utils/src/path_utils.d.ts +0 -0
- package/dist/types/functions/path_utils/src/paths.d.ts +0 -0
- package/dist/types/functions/path_utils/src/src_dirs.d.ts +0 -0
- package/dist/types/functions/print_utils/imports.d.ts +1 -0
- package/dist/types/functions/{ui_utils ā print_utils}/index.d.ts +0 -0
- package/dist/types/functions/print_utils/src/index.d.ts +1 -0
- package/dist/types/functions/print_utils/src/print_utils.d.ts +1 -0
- package/dist/types/functions/read_utils/imports.d.ts +0 -0
- package/dist/types/functions/read_utils/index.d.ts +0 -0
- package/dist/types/functions/read_utils/src/index.d.ts +3 -1
- package/dist/types/functions/read_utils/src/readJsonFile.browser.d.ts +1 -0
- package/dist/types/functions/read_utils/src/readJsonFile.d.ts +2 -0
- package/dist/types/functions/read_utils/src/readJsonFile.node.d.ts +1 -0
- package/dist/types/functions/rndm_utils/imports.d.ts +0 -0
- package/dist/types/functions/rndm_utils/index.d.ts +0 -0
- package/dist/types/functions/rndm_utils/src/index.d.ts +0 -0
- package/dist/types/functions/rndm_utils/src/utils.d.ts +0 -0
- package/dist/types/functions/safe_utils/imports.d.ts +0 -0
- package/dist/types/functions/safe_utils/index.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/index.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_document.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_globals.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_storage.d.ts +0 -0
- package/dist/types/functions/safe_utils/src/safe_window.d.ts +0 -0
- package/dist/types/functions/string_utils/index.d.ts +0 -0
- package/dist/types/functions/string_utils/src/index.d.ts +0 -0
- package/dist/types/functions/string_utils/src/string_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/imports.d.ts +0 -0
- package/dist/types/functions/type_utils/index.d.ts +0 -0
- package/dist/types/functions/type_utils/src/clean_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/ensure_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/imports.d.ts +0 -0
- package/dist/types/functions/type_utils/src/index.d.ts +0 -0
- package/dist/types/functions/type_utils/src/json_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/list_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/mime_utils.d.ts +0 -0
- package/dist/types/functions/type_utils/src/type_utils.d.ts +0 -0
- package/dist/types/functions/variable_utils/imports.d.ts +0 -0
- package/dist/types/functions/variable_utils/index.d.ts +0 -0
- package/dist/types/functions/variable_utils/src/index.d.ts +0 -0
- package/dist/types/functions/variable_utils/src/variable_utils.d.ts +0 -0
- package/dist/types/index.d.ts +0 -0
- package/dist/types/types/index.d.ts +0 -0
- package/dist/types/types/src/Files.d.ts +0 -0
- package/dist/types/types/src/index.d.ts +0 -0
- package/dist/types/types/src/login.d.ts +0 -0
- package/dist/types/types/src/logout.d.ts +0 -0
- package/dist/types/types/src/utils.d.ts +0 -0
- package/dist/types/utils/imports.d.ts +0 -0
- package/dist/types/utils/index.d.ts +0 -0
- package/dist/types/utils/src/Input.d.ts +0 -0
- package/dist/types/utils/src/config.d.ts +0 -0
- package/dist/types/utils/src/index.d.ts +0 -0
- package/package.json +2 -17
- package/dist/index.d.ts +0 -813
- package/dist/types/functions/read_utils/src/utils.d.ts +0 -8
- package/dist/types/functions/ui_utils/imports.d.ts +0 -4
- package/dist/types/functions/ui_utils/src/button.d.ts +0 -5
- package/dist/types/functions/ui_utils/src/checkbox.d.ts +0 -4
- package/dist/types/functions/ui_utils/src/index.d.ts +0 -4
- package/dist/types/functions/ui_utils/src/input.d.ts +0 -5
- package/dist/types/functions/ui_utils/src/spinner.d.ts +0 -1
- package/dist/types/types/src/ChangePassword.d.ts +0 -16
- package/dist/types/ui/Navbar/DropDowns/DropDownElements.d.ts +0 -8
- package/dist/types/ui/Navbar/DropDowns/ForumsDropdown.d.ts +0 -2
- package/dist/types/ui/Navbar/DropDowns/index.d.ts +0 -3
- package/dist/types/ui/Navbar/NavBar.d.ts +0 -8
- package/dist/types/ui/Navbar/index.d.ts +0 -3
- package/dist/types/ui/index.d.ts +0 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
import
|
|
1
|
+
import path$1 from 'path';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import * as fsp from 'node:fs/promises';
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
7
|
+
import require$$0$2, { inspect } from 'util';
|
|
8
|
+
export { inspect } from 'util';
|
|
2
9
|
import require$$0$1 from 'os';
|
|
3
10
|
import require$$0$3 from 'stream';
|
|
4
11
|
import require$$0$4 from 'buffer';
|
|
5
12
|
import require$$0$5 from 'events';
|
|
13
|
+
import require$$0$6 from 'fs';
|
|
6
14
|
import require$$3 from 'zlib';
|
|
7
15
|
import require$$1 from 'tty';
|
|
8
16
|
import require$$1$1 from 'string_decoder';
|
|
9
17
|
import require$$0$7 from 'http';
|
|
10
18
|
import require$$1$3 from 'https';
|
|
11
19
|
|
|
12
|
-
function _mergeNamespaces(n, m) {
|
|
13
|
-
m.forEach(function (e) {
|
|
14
|
-
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
15
|
-
if (k !== 'default' && !(k in n)) {
|
|
16
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () { return e[k]; }
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
return Object.freeze(n);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
20
|
/** True if token is structurally bad or its exp ⤠now. */
|
|
28
21
|
function isTokenExpired(token) {
|
|
29
22
|
try {
|
|
30
23
|
const payload = decodeJwt(token);
|
|
31
24
|
return Date.now() / 1000 >= payload.exp;
|
|
32
25
|
}
|
|
33
|
-
catch
|
|
26
|
+
catch {
|
|
34
27
|
return true; // treat malformed token as expired
|
|
35
28
|
}
|
|
36
29
|
}
|
|
@@ -105,50 +98,6 @@ function get_window_parts() {
|
|
|
105
98
|
return null;
|
|
106
99
|
}
|
|
107
100
|
|
|
108
|
-
/******************************************************************************
|
|
109
|
-
Copyright (c) Microsoft Corporation.
|
|
110
|
-
|
|
111
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
112
|
-
purpose with or without fee is hereby granted.
|
|
113
|
-
|
|
114
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
115
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
116
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
117
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
118
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
119
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
120
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
121
|
-
***************************************************************************** */
|
|
122
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
function __rest(s, e) {
|
|
126
|
-
var t = {};
|
|
127
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
128
|
-
t[p] = s[p];
|
|
129
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
130
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
131
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
132
|
-
t[p[i]] = s[p[i]];
|
|
133
|
-
}
|
|
134
|
-
return t;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
138
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
139
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
140
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
141
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
142
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
143
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
148
|
-
var e = new Error(message);
|
|
149
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
101
|
/**
|
|
153
102
|
* Unwraps nested { result } fields until you hit a non-object or no more "result" keys.
|
|
154
103
|
*/
|
|
@@ -172,13 +121,13 @@ function getMethod(method = null, body = null) {
|
|
|
172
121
|
}
|
|
173
122
|
// Gets headers, skips JSON headers when body is FormData
|
|
174
123
|
function getHeaders(headers = {}, method = null, body = null) {
|
|
175
|
-
const result =
|
|
124
|
+
const result = { ...headers };
|
|
176
125
|
// let browser set boundary
|
|
177
126
|
if (body instanceof FormData) {
|
|
178
127
|
return result;
|
|
179
128
|
}
|
|
180
|
-
const upper = method
|
|
181
|
-
if (['POST', 'PUT', 'PATCH'].includes(upper
|
|
129
|
+
const upper = method?.toUpperCase();
|
|
130
|
+
if (['POST', 'PUT', 'PATCH'].includes(upper ?? '') &&
|
|
182
131
|
!result['Content-Type']) {
|
|
183
132
|
result['Content-Type'] = 'application/json';
|
|
184
133
|
}
|
|
@@ -214,18 +163,16 @@ function getFetchVars(headers = null, method = null, body = null) {
|
|
|
214
163
|
* parseResult no longer needs to worry about JSON vs HTML redirect errors;
|
|
215
164
|
* all 401/403 have already been handled above.
|
|
216
165
|
*/
|
|
217
|
-
function parseResult(res) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return res.json();
|
|
228
|
-
});
|
|
166
|
+
async function parseResult(res) {
|
|
167
|
+
// runs checkResponse first, will throw if session is expired
|
|
168
|
+
res = checkResponse(res);
|
|
169
|
+
if (!res.ok) {
|
|
170
|
+
// for any other non-401 errors, you can still surface them
|
|
171
|
+
const errorText = await res.text();
|
|
172
|
+
throw new Error(errorText || res.statusText);
|
|
173
|
+
}
|
|
174
|
+
// now safely parse JSON
|
|
175
|
+
return res.json();
|
|
229
176
|
}
|
|
230
177
|
/**
|
|
231
178
|
* Intercept 401/403 and force a clean redirect to login
|
|
@@ -243,77 +190,155 @@ function checkResponse(res) {
|
|
|
243
190
|
return res;
|
|
244
191
|
}
|
|
245
192
|
|
|
246
|
-
function fetchIt(
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
193
|
+
async function fetchIt(endpoint, body = null, method = null, headers = null, blob = false, configUrl = false, withCredentials = true, returnJson = true, returnReult = true) {
|
|
194
|
+
method = (method || "GET").toUpperCase();
|
|
195
|
+
// 2) choose the URL
|
|
196
|
+
const url = endpoint;
|
|
197
|
+
// 3) prepare headers & body
|
|
198
|
+
headers = {
|
|
199
|
+
...(body instanceof FormData ? {} : { "Content-Type": "application/json" }),
|
|
200
|
+
...headers,
|
|
201
|
+
};
|
|
202
|
+
const opts = {
|
|
203
|
+
method,
|
|
204
|
+
credentials: withCredentials ? "include" : "same-origin",
|
|
205
|
+
headers,
|
|
206
|
+
body: body instanceof FormData
|
|
207
|
+
? body
|
|
208
|
+
: body != null && method !== "GET"
|
|
209
|
+
? JSON.stringify(body)
|
|
210
|
+
: undefined,
|
|
211
|
+
};
|
|
212
|
+
console.debug("ā”ļø secureFetchIt ā", url, opts);
|
|
213
|
+
const res = await fetch(url, opts);
|
|
214
|
+
if (!res.ok) {
|
|
215
|
+
const err = await res.text();
|
|
216
|
+
throw new Error(`HTTP ${res.status}: ${err}`);
|
|
217
|
+
}
|
|
218
|
+
if (blob)
|
|
219
|
+
return res.blob();
|
|
220
|
+
if (returnReult)
|
|
221
|
+
return getResult(res.json());
|
|
222
|
+
if (returnJson)
|
|
223
|
+
return res.json();
|
|
224
|
+
return res;
|
|
277
225
|
}
|
|
278
226
|
// Constructs HTML directory path
|
|
279
227
|
function getHtmlDirectory(directory, filename) {
|
|
280
228
|
return `${directory}/${filename}.html`;
|
|
281
229
|
}
|
|
282
230
|
// Fetches HTML content
|
|
283
|
-
function fetchIndexHtml(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
return yield response.text();
|
|
288
|
-
});
|
|
231
|
+
async function fetchIndexHtml(filename, directory = 'sf_index', base = 'html') {
|
|
232
|
+
const url = `/${base}/${directory}/${filename}.html`;
|
|
233
|
+
const response = await fetch(url);
|
|
234
|
+
return await response.text();
|
|
289
235
|
}
|
|
290
236
|
// Fetches and injects HTML content into container
|
|
291
|
-
function fetchIndexHtmlContainer(
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
237
|
+
async function fetchIndexHtmlContainer(filename, doc = document, directory = 'html') {
|
|
238
|
+
const container = `${filename}-container`;
|
|
239
|
+
const html = await fetchIndexHtml(filename, directory);
|
|
240
|
+
const el = doc.getElementById(container);
|
|
241
|
+
if (el) {
|
|
242
|
+
el.innerHTML = html;
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
console.warn(`ā ļø No container found for: #${container}`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function urlJoin(...parts) {
|
|
250
|
+
const s = (parts.length === 1 && Array.isArray(parts[0]) ? parts[0] : parts);
|
|
251
|
+
let r = "";
|
|
252
|
+
for (let i = 0; i < s.length; i++) {
|
|
253
|
+
let d = (s[i] ?? "").toString();
|
|
254
|
+
if (!d)
|
|
255
|
+
continue;
|
|
256
|
+
if (i === 0)
|
|
257
|
+
r = d;
|
|
299
258
|
else {
|
|
300
|
-
|
|
259
|
+
d = d.replace(/^\/+/, "");
|
|
260
|
+
r = r.replace(/\/+$/, "");
|
|
261
|
+
r = `${r}/${d}`;
|
|
301
262
|
}
|
|
302
|
-
}
|
|
263
|
+
}
|
|
264
|
+
return r;
|
|
303
265
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
266
|
+
/**
|
|
267
|
+
* Returns a full URL.
|
|
268
|
+
* If partial_url is already absolute (starts with http), it is returned as is.
|
|
269
|
+
* Otherwise, it is combined with the base URL.
|
|
270
|
+
*/
|
|
271
|
+
function get_full_url(partial_url, domain = null) {
|
|
272
|
+
if (typeof partial_url !== 'string') {
|
|
273
|
+
throw new Error('partial_url must be a string');
|
|
274
|
+
}
|
|
275
|
+
// If it already starts with http, assume it is absolute.
|
|
276
|
+
if (partial_url.startsWith('http')) {
|
|
277
|
+
return partial_url;
|
|
278
|
+
}
|
|
279
|
+
return urlJoin(domain, partial_url);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Returns a full file system path.
|
|
283
|
+
* If partial_path is already absolute, it is returned as is.
|
|
284
|
+
* Otherwise, it is joined with the base directory.
|
|
285
|
+
*/
|
|
286
|
+
function get_full_path(partial_path, parent_dir = null) {
|
|
287
|
+
if (typeof partial_path !== 'string') {
|
|
288
|
+
throw new Error('partial_path must be a string');
|
|
289
|
+
}
|
|
290
|
+
if (path$1.isAbsolute(partial_path)) {
|
|
291
|
+
return partial_path;
|
|
292
|
+
}
|
|
293
|
+
return urlJoin(parent_dir, partial_path);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Converts a local file system path into its corresponding URL.
|
|
297
|
+
* It checks against the known directories in all_paths and replaces the matching base.
|
|
298
|
+
*/
|
|
299
|
+
function path_to_url(filePath, all_paths) {
|
|
300
|
+
if (typeof filePath !== 'string') {
|
|
301
|
+
throw new Error('filePath must be a string');
|
|
302
|
+
}
|
|
303
|
+
for (const key in all_paths) {
|
|
304
|
+
const mapping = all_paths[key];
|
|
305
|
+
const normalizedBase = path$1.normalize(mapping.path);
|
|
306
|
+
if (filePath.startsWith(normalizedBase)) {
|
|
307
|
+
const relativePath = filePath.substring(normalizedBase.length);
|
|
308
|
+
return urlJoin(mapping.url, relativePath.replace(/\\/g, '/'));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Converts a URL into its corresponding local file system path.
|
|
315
|
+
* It checks against the known URL prefixes in all_paths and replaces the matching base.
|
|
316
|
+
*/
|
|
317
|
+
function url_to_path(urlStr, all_paths) {
|
|
318
|
+
if (typeof urlStr !== 'string') {
|
|
319
|
+
throw new Error('urlStr must be a string');
|
|
320
|
+
}
|
|
321
|
+
for (const key in all_paths) {
|
|
322
|
+
const mapping = all_paths[key];
|
|
323
|
+
if (urlStr.startsWith(mapping.url)) {
|
|
324
|
+
const relativeUrl = urlStr.substring(mapping.url.length);
|
|
325
|
+
return urlJoin(mapping.path, relativeUrl);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
function urljoin(...parts) {
|
|
331
|
+
return urlJoin(...parts);
|
|
307
332
|
}
|
|
308
333
|
|
|
309
|
-
function assertPath
|
|
334
|
+
function assertPath(path) {
|
|
310
335
|
if (typeof path !== 'string') {
|
|
311
336
|
throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
|
|
312
337
|
}
|
|
313
338
|
}
|
|
314
339
|
|
|
315
340
|
// Resolves . and .. elements in a path with directory names
|
|
316
|
-
function normalizeStringPosix
|
|
341
|
+
function normalizeStringPosix(path, allowAboveRoot) {
|
|
317
342
|
var res = '';
|
|
318
343
|
var lastSegmentLength = 0;
|
|
319
344
|
var lastSlash = -1;
|
|
@@ -376,7 +401,7 @@ function normalizeStringPosix$1(path, allowAboveRoot) {
|
|
|
376
401
|
return res;
|
|
377
402
|
}
|
|
378
403
|
|
|
379
|
-
function _format
|
|
404
|
+
function _format(sep, pathObject) {
|
|
380
405
|
var dir = pathObject.dir || pathObject.root;
|
|
381
406
|
var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
|
|
382
407
|
if (!dir) {
|
|
@@ -388,7 +413,7 @@ function _format$1(sep, pathObject) {
|
|
|
388
413
|
return dir + sep + base;
|
|
389
414
|
}
|
|
390
415
|
|
|
391
|
-
var posix
|
|
416
|
+
var posix = {
|
|
392
417
|
// path.resolve([from ...], to)
|
|
393
418
|
resolve: function resolve() {
|
|
394
419
|
var resolvedPath = '';
|
|
@@ -405,7 +430,7 @@ var posix$1 = {
|
|
|
405
430
|
path = cwd;
|
|
406
431
|
}
|
|
407
432
|
|
|
408
|
-
assertPath
|
|
433
|
+
assertPath(path);
|
|
409
434
|
|
|
410
435
|
// Skip empty entries
|
|
411
436
|
if (path.length === 0) {
|
|
@@ -420,7 +445,7 @@ var posix$1 = {
|
|
|
420
445
|
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
421
446
|
|
|
422
447
|
// Normalize the path
|
|
423
|
-
resolvedPath = normalizeStringPosix
|
|
448
|
+
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
424
449
|
|
|
425
450
|
if (resolvedAbsolute) {
|
|
426
451
|
if (resolvedPath.length > 0)
|
|
@@ -435,7 +460,7 @@ var posix$1 = {
|
|
|
435
460
|
},
|
|
436
461
|
|
|
437
462
|
normalize: function normalize(path) {
|
|
438
|
-
assertPath
|
|
463
|
+
assertPath(path);
|
|
439
464
|
|
|
440
465
|
if (path.length === 0) return '.';
|
|
441
466
|
|
|
@@ -443,7 +468,7 @@ var posix$1 = {
|
|
|
443
468
|
var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
|
|
444
469
|
|
|
445
470
|
// Normalize the path
|
|
446
|
-
path = normalizeStringPosix
|
|
471
|
+
path = normalizeStringPosix(path, !isAbsolute);
|
|
447
472
|
|
|
448
473
|
if (path.length === 0 && !isAbsolute) path = '.';
|
|
449
474
|
if (path.length > 0 && trailingSeparator) path += '/';
|
|
@@ -453,7 +478,7 @@ var posix$1 = {
|
|
|
453
478
|
},
|
|
454
479
|
|
|
455
480
|
isAbsolute: function isAbsolute(path) {
|
|
456
|
-
assertPath
|
|
481
|
+
assertPath(path);
|
|
457
482
|
return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
|
|
458
483
|
},
|
|
459
484
|
|
|
@@ -463,7 +488,7 @@ var posix$1 = {
|
|
|
463
488
|
var joined;
|
|
464
489
|
for (var i = 0; i < arguments.length; ++i) {
|
|
465
490
|
var arg = arguments[i];
|
|
466
|
-
assertPath
|
|
491
|
+
assertPath(arg);
|
|
467
492
|
if (arg.length > 0) {
|
|
468
493
|
if (joined === undefined)
|
|
469
494
|
joined = arg;
|
|
@@ -473,17 +498,17 @@ var posix$1 = {
|
|
|
473
498
|
}
|
|
474
499
|
if (joined === undefined)
|
|
475
500
|
return '.';
|
|
476
|
-
return posix
|
|
501
|
+
return posix.normalize(joined);
|
|
477
502
|
},
|
|
478
503
|
|
|
479
504
|
relative: function relative(from, to) {
|
|
480
|
-
assertPath
|
|
481
|
-
assertPath
|
|
505
|
+
assertPath(from);
|
|
506
|
+
assertPath(to);
|
|
482
507
|
|
|
483
508
|
if (from === to) return '';
|
|
484
509
|
|
|
485
|
-
from = posix
|
|
486
|
-
to = posix
|
|
510
|
+
from = posix.resolve(from);
|
|
511
|
+
to = posix.resolve(to);
|
|
487
512
|
|
|
488
513
|
if (from === to) return '';
|
|
489
514
|
|
|
@@ -571,7 +596,7 @@ var posix$1 = {
|
|
|
571
596
|
},
|
|
572
597
|
|
|
573
598
|
dirname: function dirname(path) {
|
|
574
|
-
assertPath
|
|
599
|
+
assertPath(path);
|
|
575
600
|
if (path.length === 0) return '.';
|
|
576
601
|
var code = path.charCodeAt(0);
|
|
577
602
|
var hasRoot = code === 47 /*/*/;
|
|
@@ -597,7 +622,7 @@ var posix$1 = {
|
|
|
597
622
|
|
|
598
623
|
basename: function basename(path, ext) {
|
|
599
624
|
if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
|
|
600
|
-
assertPath
|
|
625
|
+
assertPath(path);
|
|
601
626
|
|
|
602
627
|
var start = 0;
|
|
603
628
|
var end = -1;
|
|
@@ -667,7 +692,7 @@ var posix$1 = {
|
|
|
667
692
|
},
|
|
668
693
|
|
|
669
694
|
extname: function extname(path) {
|
|
670
|
-
assertPath
|
|
695
|
+
assertPath(path);
|
|
671
696
|
var startDot = -1;
|
|
672
697
|
var startPart = 0;
|
|
673
698
|
var end = -1;
|
|
@@ -719,11 +744,11 @@ var posix$1 = {
|
|
|
719
744
|
if (pathObject === null || typeof pathObject !== 'object') {
|
|
720
745
|
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
721
746
|
}
|
|
722
|
-
return _format
|
|
747
|
+
return _format('/', pathObject);
|
|
723
748
|
},
|
|
724
749
|
|
|
725
750
|
parse: function parse(path) {
|
|
726
|
-
assertPath
|
|
751
|
+
assertPath(path);
|
|
727
752
|
|
|
728
753
|
var ret = { root: '', dir: '', base: '', ext: '', name: '' };
|
|
729
754
|
if (path.length === 0) return ret;
|
|
@@ -804,102 +829,9 @@ var posix$1 = {
|
|
|
804
829
|
posix: null
|
|
805
830
|
};
|
|
806
831
|
|
|
807
|
-
posix
|
|
808
|
-
|
|
809
|
-
var pathBrowserify$1 = posix$1;
|
|
810
|
-
|
|
811
|
-
var path$1 = /*@__PURE__*/getDefaultExportFromCjs(pathBrowserify$1);
|
|
812
|
-
|
|
813
|
-
var path$2 = /*#__PURE__*/_mergeNamespaces({
|
|
814
|
-
__proto__: null,
|
|
815
|
-
default: path$1
|
|
816
|
-
}, [pathBrowserify$1]);
|
|
832
|
+
posix.posix = posix;
|
|
817
833
|
|
|
818
|
-
|
|
819
|
-
var _a;
|
|
820
|
-
const s = (parts.length === 1 && Array.isArray(parts[0]) ? parts[0] : parts);
|
|
821
|
-
let r = "";
|
|
822
|
-
for (let i = 0; i < s.length; i++) {
|
|
823
|
-
let d = ((_a = s[i]) !== null && _a !== void 0 ? _a : "").toString();
|
|
824
|
-
if (!d)
|
|
825
|
-
continue;
|
|
826
|
-
if (i === 0)
|
|
827
|
-
r = d;
|
|
828
|
-
else {
|
|
829
|
-
d = d.replace(/^\/+/, "");
|
|
830
|
-
r = r.replace(/\/+$/, "");
|
|
831
|
-
r = `${r}/${d}`;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
return r;
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* Returns a full URL.
|
|
838
|
-
* If partial_url is already absolute (starts with http), it is returned as is.
|
|
839
|
-
* Otherwise, it is combined with the base URL.
|
|
840
|
-
*/
|
|
841
|
-
function get_full_url(partial_url, domain = null) {
|
|
842
|
-
if (typeof partial_url !== 'string') {
|
|
843
|
-
throw new Error('partial_url must be a string');
|
|
844
|
-
}
|
|
845
|
-
// If it already starts with http, assume it is absolute.
|
|
846
|
-
if (partial_url.startsWith('http')) {
|
|
847
|
-
return partial_url;
|
|
848
|
-
}
|
|
849
|
-
return urlJoin(domain, partial_url);
|
|
850
|
-
}
|
|
851
|
-
/**
|
|
852
|
-
* Returns a full file system path.
|
|
853
|
-
* If partial_path is already absolute, it is returned as is.
|
|
854
|
-
* Otherwise, it is joined with the base directory.
|
|
855
|
-
*/
|
|
856
|
-
function get_full_path(partial_path, parent_dir = null) {
|
|
857
|
-
if (typeof partial_path !== 'string') {
|
|
858
|
-
throw new Error('partial_path must be a string');
|
|
859
|
-
}
|
|
860
|
-
if (path$1.isAbsolute(partial_path)) {
|
|
861
|
-
return partial_path;
|
|
862
|
-
}
|
|
863
|
-
return urlJoin(parent_dir, partial_path);
|
|
864
|
-
}
|
|
865
|
-
/**
|
|
866
|
-
* Converts a local file system path into its corresponding URL.
|
|
867
|
-
* It checks against the known directories in all_paths and replaces the matching base.
|
|
868
|
-
*/
|
|
869
|
-
function path_to_url(filePath, all_paths) {
|
|
870
|
-
if (typeof filePath !== 'string') {
|
|
871
|
-
throw new Error('filePath must be a string');
|
|
872
|
-
}
|
|
873
|
-
for (const key in all_paths) {
|
|
874
|
-
const mapping = all_paths[key];
|
|
875
|
-
const normalizedBase = path$1.normalize(mapping.path);
|
|
876
|
-
if (filePath.startsWith(normalizedBase)) {
|
|
877
|
-
const relativePath = filePath.substring(normalizedBase.length);
|
|
878
|
-
return urlJoin(mapping.url, relativePath.replace(/\\/g, '/'));
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
return null;
|
|
882
|
-
}
|
|
883
|
-
/**
|
|
884
|
-
* Converts a URL into its corresponding local file system path.
|
|
885
|
-
* It checks against the known URL prefixes in all_paths and replaces the matching base.
|
|
886
|
-
*/
|
|
887
|
-
function url_to_path(urlStr, all_paths) {
|
|
888
|
-
if (typeof urlStr !== 'string') {
|
|
889
|
-
throw new Error('urlStr must be a string');
|
|
890
|
-
}
|
|
891
|
-
for (const key in all_paths) {
|
|
892
|
-
const mapping = all_paths[key];
|
|
893
|
-
if (urlStr.startsWith(mapping.url)) {
|
|
894
|
-
const relativeUrl = urlStr.substring(mapping.url.length);
|
|
895
|
-
return urlJoin(mapping.path, relativeUrl);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
return null;
|
|
899
|
-
}
|
|
900
|
-
function urljoin(...parts) {
|
|
901
|
-
return urlJoin(...parts);
|
|
902
|
-
}
|
|
834
|
+
var pathBrowserify = posix;
|
|
903
835
|
|
|
904
836
|
function split_outside_brackets(s) {
|
|
905
837
|
let depth = 0;
|
|
@@ -1054,7 +986,7 @@ function formatNumber(value) {
|
|
|
1054
986
|
return value;
|
|
1055
987
|
return US_DECIMAL_FORMATTER.format(num);
|
|
1056
988
|
}
|
|
1057
|
-
catch
|
|
989
|
+
catch {
|
|
1058
990
|
// if anything goes wrong, return the original
|
|
1059
991
|
return value;
|
|
1060
992
|
}
|
|
@@ -1095,7 +1027,7 @@ function findKeyValue(obj, keyToFind) {
|
|
|
1095
1027
|
return undefined;
|
|
1096
1028
|
}
|
|
1097
1029
|
function omitKeys(obj, ...keys) {
|
|
1098
|
-
const newObj =
|
|
1030
|
+
const newObj = { ...obj };
|
|
1099
1031
|
keys.forEach(key => {
|
|
1100
1032
|
delete newObj[key];
|
|
1101
1033
|
});
|
|
@@ -1111,7 +1043,7 @@ function extractInsertData(insertValue) {
|
|
|
1111
1043
|
// Example: Suppose you only need certain fields from the transaction
|
|
1112
1044
|
// Modify this function based on your actual data structure
|
|
1113
1045
|
if (insertValue && typeof insertValue === 'object') {
|
|
1114
|
-
const { transaction
|
|
1046
|
+
const { transaction, ...rest } = insertValue; // Exclude 'transaction' property
|
|
1115
1047
|
return rest;
|
|
1116
1048
|
}
|
|
1117
1049
|
return insertValue;
|
|
@@ -1181,36 +1113,7 @@ function getAlphas() {
|
|
|
1181
1113
|
return 'abcdefghijklmnopqrstuvwxyz';
|
|
1182
1114
|
}
|
|
1183
1115
|
|
|
1184
|
-
//
|
|
1185
|
-
// Fake Node APIs for browser builds ā every fn is a harmless noop.
|
|
1186
|
-
|
|
1187
|
-
function statSync() {
|
|
1188
|
-
throw new Error("fs.statSync is not available in browser");
|
|
1189
|
-
}
|
|
1190
|
-
function readdirSync() {
|
|
1191
|
-
return [];
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
// For async fs/promises
|
|
1195
|
-
async function stat() {
|
|
1196
|
-
throw new Error("fs.promises.stat is not available in browser");
|
|
1197
|
-
}
|
|
1198
|
-
async function readdir() {
|
|
1199
|
-
return [];
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
// Export default empty object for wildcard imports
|
|
1203
|
-
var require$$0$6 = {};
|
|
1204
|
-
|
|
1205
|
-
var fsp = /*#__PURE__*/Object.freeze({
|
|
1206
|
-
__proto__: null,
|
|
1207
|
-
default: require$$0$6,
|
|
1208
|
-
readdir: readdir,
|
|
1209
|
-
readdirSync: readdirSync,
|
|
1210
|
-
stat: stat,
|
|
1211
|
-
statSync: statSync
|
|
1212
|
-
});
|
|
1213
|
-
|
|
1116
|
+
// mediaTypes.ts
|
|
1214
1117
|
/** ---- Data: large but explicit, mirrors your Python mapping ---- */
|
|
1215
1118
|
const MIME_TYPES = {
|
|
1216
1119
|
image: {
|
|
@@ -1362,13 +1265,12 @@ function toCategorySet(categories) {
|
|
|
1362
1265
|
return out.size ? out : new Set(allCats);
|
|
1363
1266
|
}
|
|
1364
1267
|
function normalizeCategories(categories, opts) {
|
|
1365
|
-
|
|
1366
|
-
const selected = (_a = categories !== null && categories !== void 0 ? categories : opts === null || opts === void 0 ? void 0 : opts.media_types) !== null && _a !== void 0 ? _a : null;
|
|
1268
|
+
const selected = categories ?? opts?.media_types ?? null;
|
|
1367
1269
|
return toCategorySet(selected);
|
|
1368
1270
|
}
|
|
1369
1271
|
function extOf(input) {
|
|
1370
1272
|
// Behaves like pathlib.Path(...).suffix.lower(): last extension only; lowercased.
|
|
1371
|
-
let ext =
|
|
1273
|
+
let ext = path.extname(input || "");
|
|
1372
1274
|
if (!ext && input && input.startsWith(".")) {
|
|
1373
1275
|
// user passed ".jpg" directly
|
|
1374
1276
|
ext = input;
|
|
@@ -1439,24 +1341,24 @@ function getMimeType(pathOrExt) {
|
|
|
1439
1341
|
}
|
|
1440
1342
|
function getAllFileTypesSync(directory, categories, opts) {
|
|
1441
1343
|
// š§© Skip entirely if fs isn't available
|
|
1442
|
-
if (!
|
|
1344
|
+
if (!fs || !path)
|
|
1443
1345
|
return [];
|
|
1444
1346
|
try {
|
|
1445
|
-
const stat = statSync(directory);
|
|
1347
|
+
const stat = fs.statSync(directory);
|
|
1446
1348
|
if (!stat.isDirectory())
|
|
1447
1349
|
return [];
|
|
1448
1350
|
const cats = normalizeCategories(categories, opts);
|
|
1449
1351
|
const wanted = unionExts(cats);
|
|
1450
1352
|
const results = [];
|
|
1451
1353
|
function walkSync(dir) {
|
|
1452
|
-
const entries = readdirSync(dir, { withFileTypes: true });
|
|
1354
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
1453
1355
|
for (const ent of entries) {
|
|
1454
|
-
const full =
|
|
1356
|
+
const full = path.join(dir, ent.name);
|
|
1455
1357
|
if (ent.isDirectory()) {
|
|
1456
1358
|
walkSync(full);
|
|
1457
1359
|
}
|
|
1458
1360
|
else if (ent.isFile()) {
|
|
1459
|
-
const ext =
|
|
1361
|
+
const ext = path.extname(ent.name).toLowerCase();
|
|
1460
1362
|
if (wanted.has(ext))
|
|
1461
1363
|
results.push(full);
|
|
1462
1364
|
}
|
|
@@ -1465,45 +1367,41 @@ function getAllFileTypesSync(directory, categories, opts) {
|
|
|
1465
1367
|
walkSync(directory);
|
|
1466
1368
|
return results;
|
|
1467
1369
|
}
|
|
1468
|
-
catch
|
|
1370
|
+
catch {
|
|
1469
1371
|
return [];
|
|
1470
1372
|
}
|
|
1471
1373
|
}
|
|
1472
|
-
function getAllFileTypes(directory, categories, opts) {
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1374
|
+
async function getAllFileTypes(directory, categories, opts) {
|
|
1375
|
+
// š§© Skip entirely if fsp isn't available
|
|
1376
|
+
if (!fsp || !path)
|
|
1377
|
+
return [];
|
|
1378
|
+
try {
|
|
1379
|
+
const stat = await fsp.stat(directory);
|
|
1380
|
+
if (!stat.isDirectory())
|
|
1476
1381
|
return [];
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
const
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
else if (ent.isFile()) {
|
|
1493
|
-
const ext = pathBrowserify$1.extname(ent.name).toLowerCase();
|
|
1494
|
-
if (wanted.has(ext))
|
|
1495
|
-
results.push(full);
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
});
|
|
1382
|
+
const cats = normalizeCategories(categories, opts);
|
|
1383
|
+
const wanted = unionExts(cats);
|
|
1384
|
+
const results = [];
|
|
1385
|
+
async function walkAsync(dir) {
|
|
1386
|
+
const entries = await fsp.readdir(dir, { withFileTypes: true });
|
|
1387
|
+
for (const ent of entries) {
|
|
1388
|
+
const full = path.join(dir, ent.name);
|
|
1389
|
+
if (ent.isDirectory()) {
|
|
1390
|
+
await walkAsync(full);
|
|
1391
|
+
}
|
|
1392
|
+
else if (ent.isFile()) {
|
|
1393
|
+
const ext = path.extname(ent.name).toLowerCase();
|
|
1394
|
+
if (wanted.has(ext))
|
|
1395
|
+
results.push(full);
|
|
1396
|
+
}
|
|
1499
1397
|
}
|
|
1500
|
-
yield walkAsync(directory);
|
|
1501
|
-
return results;
|
|
1502
|
-
}
|
|
1503
|
-
catch (_a) {
|
|
1504
|
-
return [];
|
|
1505
1398
|
}
|
|
1506
|
-
|
|
1399
|
+
await walkAsync(directory);
|
|
1400
|
+
return results;
|
|
1401
|
+
}
|
|
1402
|
+
catch {
|
|
1403
|
+
return [];
|
|
1404
|
+
}
|
|
1507
1405
|
}
|
|
1508
1406
|
/** Optional convenience re-exports that mirror your Python names */
|
|
1509
1407
|
const get_all_file_types = getAllFileTypes;
|
|
@@ -1521,10 +1419,9 @@ function getIfNone(obj, fallback) {
|
|
|
1521
1419
|
* Merges non-null values from multiple dictionaries.
|
|
1522
1420
|
*/
|
|
1523
1421
|
function mergeNotNullValues(dictA, dictB, dictC, dictD, dictE) {
|
|
1524
|
-
var _a, _b, _c, _d;
|
|
1525
1422
|
const result = {};
|
|
1526
1423
|
for (const key of Object.keys(dictA)) {
|
|
1527
|
-
result[key] =
|
|
1424
|
+
result[key] = dictA[key] ?? dictB?.[key] ?? dictC?.[key] ?? dictD?.[key] ?? dictE?.[key];
|
|
1528
1425
|
}
|
|
1529
1426
|
return result;
|
|
1530
1427
|
}
|
|
@@ -1537,8 +1434,8 @@ function emptyObjectToNull(value) {
|
|
|
1537
1434
|
|
|
1538
1435
|
function getSubstring(obj, maxLength = null, minLength = null) {
|
|
1539
1436
|
const objLength = obj.length;
|
|
1540
|
-
const effectiveMaxLength = maxLength
|
|
1541
|
-
const effectiveMinLength = minLength
|
|
1437
|
+
const effectiveMaxLength = maxLength ?? objLength; // Use nullish coalescing for clarity
|
|
1438
|
+
const effectiveMinLength = minLength ?? 0;
|
|
1542
1439
|
// Ensure bounds are valid
|
|
1543
1440
|
const clampedMaxLength = Math.min(Math.max(effectiveMaxLength, 0), objLength);
|
|
1544
1441
|
const clampedMinLength = Math.min(Math.max(effectiveMinLength, 0), objLength);
|
|
@@ -1746,7 +1643,7 @@ function fileURLToPath(fileUrl) {
|
|
|
1746
1643
|
const u = new URL(fileUrl);
|
|
1747
1644
|
return u.pathname;
|
|
1748
1645
|
}
|
|
1749
|
-
catch
|
|
1646
|
+
catch {
|
|
1750
1647
|
// fallback: just strip file://
|
|
1751
1648
|
return fileUrl.replace(/^file:\/\//, '');
|
|
1752
1649
|
}
|
|
@@ -1758,30 +1655,30 @@ function getAbsolutePath() {
|
|
|
1758
1655
|
function get_dirname(filePath) {
|
|
1759
1656
|
if (!filePath)
|
|
1760
1657
|
return '';
|
|
1761
|
-
return pathBrowserify
|
|
1658
|
+
return pathBrowserify.dirname(filePath);
|
|
1762
1659
|
}
|
|
1763
1660
|
function get_basename(filePath) {
|
|
1764
1661
|
if (!filePath)
|
|
1765
1662
|
return '';
|
|
1766
|
-
return pathBrowserify
|
|
1663
|
+
return pathBrowserify.basename(filePath);
|
|
1767
1664
|
}
|
|
1768
1665
|
function get_filename(filePath) {
|
|
1769
1666
|
if (!filePath)
|
|
1770
1667
|
return '';
|
|
1771
|
-
const ext = pathBrowserify
|
|
1772
|
-
return pathBrowserify
|
|
1668
|
+
const ext = pathBrowserify.extname(filePath);
|
|
1669
|
+
return pathBrowserify.basename(filePath, ext);
|
|
1773
1670
|
}
|
|
1774
1671
|
function get_extname(filePath) {
|
|
1775
1672
|
if (!filePath)
|
|
1776
1673
|
return '';
|
|
1777
|
-
return pathBrowserify
|
|
1674
|
+
return pathBrowserify.extname(filePath);
|
|
1778
1675
|
}
|
|
1779
1676
|
function get_splitext(filePath) {
|
|
1780
1677
|
if (!filePath)
|
|
1781
1678
|
return { filename: '', extname: '' };
|
|
1782
|
-
const ext = pathBrowserify
|
|
1679
|
+
const ext = pathBrowserify.extname(filePath);
|
|
1783
1680
|
// Get the basename without the extension
|
|
1784
|
-
const filename = pathBrowserify
|
|
1681
|
+
const filename = pathBrowserify.basename(filePath, ext);
|
|
1785
1682
|
return { filename, ext };
|
|
1786
1683
|
}
|
|
1787
1684
|
/**
|
|
@@ -1795,9 +1692,9 @@ function get_splitext(filePath) {
|
|
|
1795
1692
|
function get_relative_path(basePath, targetPath) {
|
|
1796
1693
|
try {
|
|
1797
1694
|
// Compute the relative path using Node's native path.relative
|
|
1798
|
-
let rel = pathBrowserify
|
|
1695
|
+
let rel = pathBrowserify.relative(basePath, targetPath);
|
|
1799
1696
|
// Normalize to POSIX-style slashes for consistency (especially on Windows)
|
|
1800
|
-
rel = rel.split(pathBrowserify
|
|
1697
|
+
rel = rel.split(pathBrowserify.sep).join('/');
|
|
1801
1698
|
// Avoid empty string (happens if both paths are identical)
|
|
1802
1699
|
return rel || '.';
|
|
1803
1700
|
}
|
|
@@ -2006,7 +1903,7 @@ function alertit(obj = null) {
|
|
|
2006
1903
|
try {
|
|
2007
1904
|
msg = JSON.stringify(obj);
|
|
2008
1905
|
}
|
|
2009
|
-
catch
|
|
1906
|
+
catch {
|
|
2010
1907
|
// If JSON.stringify fails (circular refs, etc.), fall back to a simple string
|
|
2011
1908
|
msg = String(obj);
|
|
2012
1909
|
}
|
|
@@ -2062,665 +1959,161 @@ const MINUTE = 60 * SECOND;
|
|
|
2062
1959
|
const HOUR = 60 * MINUTE;
|
|
2063
1960
|
const DAY = 24 * HOUR;
|
|
2064
1961
|
const YEAR = 365 * DAY;
|
|
2065
|
-
const MONTH = YEAR / 12;
|
|
2066
|
-
// Derived: explicit names
|
|
2067
|
-
const SECONDS_PER_MINUTE = MINUTE;
|
|
2068
|
-
const SECONDS_PER_HOUR = HOUR;
|
|
2069
|
-
const SECONDS_PER_DAY = DAY;
|
|
2070
|
-
//math
|
|
2071
|
-
const PI = Math.PI;
|
|
2072
|
-
const PI2 = 2 * PI;
|
|
2073
|
-
// Distance
|
|
2074
|
-
const METERS_PER_KM = 1000;
|
|
2075
|
-
const METERS_PER_MILE = 1609.34;
|
|
2076
|
-
const METERS_PER_FOOT = 0.3048;
|
|
2077
|
-
const KMS_PER_METER = 1 / METERS_PER_KM;
|
|
2078
|
-
const MILES_PER_METER = 1 / METERS_PER_MILE;
|
|
2079
|
-
const FEET_PER_METER = 1 / METERS_PER_FOOT;
|
|
2080
|
-
const MIN_IN_S = 1 / MINUTE;
|
|
2081
|
-
const HOUR_IN_S = 1 / HOUR;
|
|
2082
|
-
const DAY_IN_S = 1 / DAY;
|
|
2083
|
-
const YEAR_IN_S = 1 / YEAR;
|
|
2084
|
-
const MONTH_IN_S = 1 / MONTH;
|
|
2085
|
-
const MiPerH_TO_MPerS = METERS_PER_MILE * HOUR_IN_S;
|
|
2086
|
-
const MPerS_TO_MiPerH = 1 / MiPerH_TO_MPerS;
|
|
2087
|
-
|
|
2088
|
-
// conversions.ts
|
|
2089
|
-
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2090
|
-
š§ CANONICAL MAPPINGS
|
|
2091
|
-
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2092
|
-
const DIST_ALIASES = {
|
|
2093
|
-
m: "m", meter: "m", meters: "m",
|
|
2094
|
-
km: "km", kms: "km", kilometer: "km", kilometers: "km",
|
|
2095
|
-
mi: "mi", mile: "mi", miles: "mi",
|
|
2096
|
-
ft: "ft", f: "ft", foot: "ft", feet: "ft",
|
|
2097
|
-
};
|
|
2098
|
-
const TIME_ALIASES = {
|
|
2099
|
-
s: "s", sec: "s", second: "s", seconds: "s",
|
|
2100
|
-
min: "min", m: "min", minute: "min", minutes: "min",
|
|
2101
|
-
h: "h", hr: "h", hour: "h", hours: "h",
|
|
2102
|
-
day: "day", d: "day", days: "day",
|
|
2103
|
-
};
|
|
2104
|
-
const DIST_FACTORS = {
|
|
2105
|
-
m: 1,
|
|
2106
|
-
km: METERS_PER_KM,
|
|
2107
|
-
mi: METERS_PER_MILE,
|
|
2108
|
-
ft: METERS_PER_FOOT,
|
|
2109
|
-
};
|
|
2110
|
-
const TIME_FACTORS = {
|
|
2111
|
-
s: 1,
|
|
2112
|
-
min: MINUTE,
|
|
2113
|
-
h: HOUR,
|
|
2114
|
-
day: DAY,
|
|
2115
|
-
};
|
|
2116
|
-
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2117
|
-
š CANONICALIZATION HELPERS
|
|
2118
|
-
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2119
|
-
function canonDist(u) {
|
|
2120
|
-
const key = (u !== null && u !== void 0 ? u : "m").toString().toLowerCase();
|
|
2121
|
-
const canon = DIST_ALIASES[key];
|
|
2122
|
-
if (!canon)
|
|
2123
|
-
throw new Error(`Unknown distance unit: ${u}`);
|
|
2124
|
-
return canon;
|
|
2125
|
-
}
|
|
2126
|
-
function canonTime(u) {
|
|
2127
|
-
const key = (u !== null && u !== void 0 ? u : "s").toString().toLowerCase();
|
|
2128
|
-
const canon = TIME_ALIASES[key];
|
|
2129
|
-
if (!canon)
|
|
2130
|
-
throw new Error(`Unknown time unit: ${u}`);
|
|
2131
|
-
return canon;
|
|
2132
|
-
}
|
|
2133
|
-
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2134
|
-
āļø NORMALIZATION HELPERS
|
|
2135
|
-
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2136
|
-
function distanceToMeters(d, unit) {
|
|
2137
|
-
const u = canonDist(unit);
|
|
2138
|
-
return safeMultiply(d, DIST_FACTORS[u]);
|
|
2139
|
-
}
|
|
2140
|
-
function metersToDistance(v, unit) {
|
|
2141
|
-
const u = canonDist(unit);
|
|
2142
|
-
return safeDivide(v, DIST_FACTORS[u]);
|
|
2143
|
-
}
|
|
2144
|
-
function timeToSeconds(t, unit) {
|
|
2145
|
-
const u = canonTime(unit);
|
|
2146
|
-
return safeMultiply(t, TIME_FACTORS[u]);
|
|
2147
|
-
}
|
|
2148
|
-
function secondsToTime(v, unit) {
|
|
2149
|
-
const u = canonTime(unit);
|
|
2150
|
-
return safeDivide(v, TIME_FACTORS[u]);
|
|
2151
|
-
}
|
|
2152
|
-
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2153
|
-
š SPEED CONVERSIONS (normalize / unnormalize)
|
|
2154
|
-
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2155
|
-
function speedToMps(v, distUnit, timeUnit) {
|
|
2156
|
-
const du = canonDist(distUnit);
|
|
2157
|
-
const tu = canonTime(timeUnit);
|
|
2158
|
-
return v * (DIST_FACTORS[du] / TIME_FACTORS[tu]);
|
|
2159
|
-
}
|
|
2160
|
-
function mpsToSpeed(vMps, distUnit, timeUnit) {
|
|
2161
|
-
const du = canonDist(distUnit);
|
|
2162
|
-
const tu = canonTime(timeUnit);
|
|
2163
|
-
return vMps * (TIME_FACTORS[tu] / DIST_FACTORS[du]);
|
|
2164
|
-
}
|
|
2165
|
-
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2166
|
-
šÆ UNIVERSAL CONVERTERS
|
|
2167
|
-
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2168
|
-
function convertDistance({ d, fromDist, toDist, vOnly = true, }) {
|
|
2169
|
-
const m = distanceToMeters(d, fromDist);
|
|
2170
|
-
const D = canonDist(toDist !== null && toDist !== void 0 ? toDist : "m");
|
|
2171
|
-
const out = metersToDistance(m, D);
|
|
2172
|
-
return vOnly ? out : { d: out, D };
|
|
2173
|
-
}
|
|
2174
|
-
function convertTime({ t, fromTime, toTime, vOnly = true, }) {
|
|
2175
|
-
const sec = timeToSeconds(t, fromTime);
|
|
2176
|
-
const T = canonTime(toTime !== null && toTime !== void 0 ? toTime : "s");
|
|
2177
|
-
const out = secondsToTime(sec, T);
|
|
2178
|
-
return vOnly ? out : { t: out, T };
|
|
2179
|
-
}
|
|
2180
|
-
function convertSpeed({ v, fromDist, fromTime, toDist, toTime, vOnly = true, }) {
|
|
2181
|
-
const mps = speedToMps(v, fromDist, fromTime);
|
|
2182
|
-
const d = canonDist(toDist !== null && toDist !== void 0 ? toDist : "m");
|
|
2183
|
-
const t = canonTime(toTime !== null && toTime !== void 0 ? toTime : "s");
|
|
2184
|
-
const out = mpsToSpeed(mps, d, t);
|
|
2185
|
-
return vOnly ? out : { v: out, d, t };
|
|
2186
|
-
}
|
|
2187
|
-
const DistanceConverter = {
|
|
2188
|
-
normalize: distanceToMeters,
|
|
2189
|
-
unnormalize: metersToDistance,
|
|
2190
|
-
};
|
|
2191
|
-
const TimeConverter = {
|
|
2192
|
-
normalize: timeToSeconds,
|
|
2193
|
-
unnormalize: secondsToTime,
|
|
2194
|
-
};
|
|
2195
|
-
const SpeedConverter = {
|
|
2196
|
-
normalize: (v, [du, tu]) => speedToMps(v, du, tu),
|
|
2197
|
-
unnormalize: (v, [du, tu]) => mpsToSpeed(v, du, tu),
|
|
2198
|
-
};
|
|
2199
|
-
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2200
|
-
š§© COMPATIBILITY WRAPPERS (legacy aliases)
|
|
2201
|
-
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2202
|
-
const toMeters = distanceToMeters;
|
|
2203
|
-
const fromMeters = metersToDistance;
|
|
2204
|
-
const toSeconds = timeToSeconds;
|
|
2205
|
-
const fromSeconds = secondsToTime;
|
|
2206
|
-
const velocityToMs = (value, unit) => speedToMps(value, unit, "s");
|
|
2207
|
-
const velocityFromMs = (value, unit) => mpsToSpeed(value, unit, "s");
|
|
2208
|
-
/** Non-canonical helper for arbitrary rate conversion, e.g. ft/day ā m/s */
|
|
2209
|
-
const fromMps = (v, dist_unit, time_unit) => mpsToSpeed(v, dist_unit, time_unit);
|
|
2210
|
-
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2211
|
-
š UTILITIES
|
|
2212
|
-
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2213
|
-
const isFiniteNum = (x) => Number.isFinite(x);
|
|
2214
|
-
const fmt = (n, digits = 2) => isFiniteNum(n) ? n.toFixed(digits) : "N/A";
|
|
2215
|
-
|
|
2216
|
-
// Function to check time interval
|
|
2217
|
-
function isTimeInterval(timeObj, interval) {
|
|
2218
|
-
return (Date.now() / 1000 - timeObj) < (interval - 1);
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
function assertPath(path) {
|
|
2222
|
-
if (typeof path !== 'string') {
|
|
2223
|
-
throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
|
|
2224
|
-
}
|
|
2225
|
-
}
|
|
2226
|
-
|
|
2227
|
-
// Resolves . and .. elements in a path with directory names
|
|
2228
|
-
function normalizeStringPosix(path, allowAboveRoot) {
|
|
2229
|
-
var res = '';
|
|
2230
|
-
var lastSegmentLength = 0;
|
|
2231
|
-
var lastSlash = -1;
|
|
2232
|
-
var dots = 0;
|
|
2233
|
-
var code;
|
|
2234
|
-
for (var i = 0; i <= path.length; ++i) {
|
|
2235
|
-
if (i < path.length)
|
|
2236
|
-
code = path.charCodeAt(i);
|
|
2237
|
-
else if (code === 47 /*/*/)
|
|
2238
|
-
break;
|
|
2239
|
-
else
|
|
2240
|
-
code = 47 /*/*/;
|
|
2241
|
-
if (code === 47 /*/*/) {
|
|
2242
|
-
if (lastSlash === i - 1 || dots === 1) ; else if (lastSlash !== i - 1 && dots === 2) {
|
|
2243
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
|
|
2244
|
-
if (res.length > 2) {
|
|
2245
|
-
var lastSlashIndex = res.lastIndexOf('/');
|
|
2246
|
-
if (lastSlashIndex !== res.length - 1) {
|
|
2247
|
-
if (lastSlashIndex === -1) {
|
|
2248
|
-
res = '';
|
|
2249
|
-
lastSegmentLength = 0;
|
|
2250
|
-
} else {
|
|
2251
|
-
res = res.slice(0, lastSlashIndex);
|
|
2252
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
|
|
2253
|
-
}
|
|
2254
|
-
lastSlash = i;
|
|
2255
|
-
dots = 0;
|
|
2256
|
-
continue;
|
|
2257
|
-
}
|
|
2258
|
-
} else if (res.length === 2 || res.length === 1) {
|
|
2259
|
-
res = '';
|
|
2260
|
-
lastSegmentLength = 0;
|
|
2261
|
-
lastSlash = i;
|
|
2262
|
-
dots = 0;
|
|
2263
|
-
continue;
|
|
2264
|
-
}
|
|
2265
|
-
}
|
|
2266
|
-
if (allowAboveRoot) {
|
|
2267
|
-
if (res.length > 0)
|
|
2268
|
-
res += '/..';
|
|
2269
|
-
else
|
|
2270
|
-
res = '..';
|
|
2271
|
-
lastSegmentLength = 2;
|
|
2272
|
-
}
|
|
2273
|
-
} else {
|
|
2274
|
-
if (res.length > 0)
|
|
2275
|
-
res += '/' + path.slice(lastSlash + 1, i);
|
|
2276
|
-
else
|
|
2277
|
-
res = path.slice(lastSlash + 1, i);
|
|
2278
|
-
lastSegmentLength = i - lastSlash - 1;
|
|
2279
|
-
}
|
|
2280
|
-
lastSlash = i;
|
|
2281
|
-
dots = 0;
|
|
2282
|
-
} else if (code === 46 /*.*/ && dots !== -1) {
|
|
2283
|
-
++dots;
|
|
2284
|
-
} else {
|
|
2285
|
-
dots = -1;
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
return res;
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
function _format(sep, pathObject) {
|
|
2292
|
-
var dir = pathObject.dir || pathObject.root;
|
|
2293
|
-
var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
|
|
2294
|
-
if (!dir) {
|
|
2295
|
-
return base;
|
|
2296
|
-
}
|
|
2297
|
-
if (dir === pathObject.root) {
|
|
2298
|
-
return dir + base;
|
|
2299
|
-
}
|
|
2300
|
-
return dir + sep + base;
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
|
-
var posix = {
|
|
2304
|
-
// path.resolve([from ...], to)
|
|
2305
|
-
resolve: function resolve() {
|
|
2306
|
-
var resolvedPath = '';
|
|
2307
|
-
var resolvedAbsolute = false;
|
|
2308
|
-
var cwd;
|
|
2309
|
-
|
|
2310
|
-
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
2311
|
-
var path;
|
|
2312
|
-
if (i >= 0)
|
|
2313
|
-
path = arguments[i];
|
|
2314
|
-
else {
|
|
2315
|
-
if (cwd === undefined)
|
|
2316
|
-
cwd = process.cwd();
|
|
2317
|
-
path = cwd;
|
|
2318
|
-
}
|
|
2319
|
-
|
|
2320
|
-
assertPath(path);
|
|
2321
|
-
|
|
2322
|
-
// Skip empty entries
|
|
2323
|
-
if (path.length === 0) {
|
|
2324
|
-
continue;
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
resolvedPath = path + '/' + resolvedPath;
|
|
2328
|
-
resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
|
2329
|
-
}
|
|
2330
|
-
|
|
2331
|
-
// At this point the path should be resolved to a full absolute path, but
|
|
2332
|
-
// handle relative paths to be safe (might happen when process.cwd() fails)
|
|
2333
|
-
|
|
2334
|
-
// Normalize the path
|
|
2335
|
-
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
|
|
2336
|
-
|
|
2337
|
-
if (resolvedAbsolute) {
|
|
2338
|
-
if (resolvedPath.length > 0)
|
|
2339
|
-
return '/' + resolvedPath;
|
|
2340
|
-
else
|
|
2341
|
-
return '/';
|
|
2342
|
-
} else if (resolvedPath.length > 0) {
|
|
2343
|
-
return resolvedPath;
|
|
2344
|
-
} else {
|
|
2345
|
-
return '.';
|
|
2346
|
-
}
|
|
2347
|
-
},
|
|
2348
|
-
|
|
2349
|
-
normalize: function normalize(path) {
|
|
2350
|
-
assertPath(path);
|
|
2351
|
-
|
|
2352
|
-
if (path.length === 0) return '.';
|
|
2353
|
-
|
|
2354
|
-
var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
|
|
2355
|
-
var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
|
|
2356
|
-
|
|
2357
|
-
// Normalize the path
|
|
2358
|
-
path = normalizeStringPosix(path, !isAbsolute);
|
|
2359
|
-
|
|
2360
|
-
if (path.length === 0 && !isAbsolute) path = '.';
|
|
2361
|
-
if (path.length > 0 && trailingSeparator) path += '/';
|
|
2362
|
-
|
|
2363
|
-
if (isAbsolute) return '/' + path;
|
|
2364
|
-
return path;
|
|
2365
|
-
},
|
|
2366
|
-
|
|
2367
|
-
isAbsolute: function isAbsolute(path) {
|
|
2368
|
-
assertPath(path);
|
|
2369
|
-
return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
|
|
2370
|
-
},
|
|
2371
|
-
|
|
2372
|
-
join: function join() {
|
|
2373
|
-
if (arguments.length === 0)
|
|
2374
|
-
return '.';
|
|
2375
|
-
var joined;
|
|
2376
|
-
for (var i = 0; i < arguments.length; ++i) {
|
|
2377
|
-
var arg = arguments[i];
|
|
2378
|
-
assertPath(arg);
|
|
2379
|
-
if (arg.length > 0) {
|
|
2380
|
-
if (joined === undefined)
|
|
2381
|
-
joined = arg;
|
|
2382
|
-
else
|
|
2383
|
-
joined += '/' + arg;
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
if (joined === undefined)
|
|
2387
|
-
return '.';
|
|
2388
|
-
return posix.normalize(joined);
|
|
2389
|
-
},
|
|
2390
|
-
|
|
2391
|
-
relative: function relative(from, to) {
|
|
2392
|
-
assertPath(from);
|
|
2393
|
-
assertPath(to);
|
|
2394
|
-
|
|
2395
|
-
if (from === to) return '';
|
|
2396
|
-
|
|
2397
|
-
from = posix.resolve(from);
|
|
2398
|
-
to = posix.resolve(to);
|
|
2399
|
-
|
|
2400
|
-
if (from === to) return '';
|
|
2401
|
-
|
|
2402
|
-
// Trim any leading backslashes
|
|
2403
|
-
var fromStart = 1;
|
|
2404
|
-
for (; fromStart < from.length; ++fromStart) {
|
|
2405
|
-
if (from.charCodeAt(fromStart) !== 47 /*/*/)
|
|
2406
|
-
break;
|
|
2407
|
-
}
|
|
2408
|
-
var fromEnd = from.length;
|
|
2409
|
-
var fromLen = fromEnd - fromStart;
|
|
2410
|
-
|
|
2411
|
-
// Trim any leading backslashes
|
|
2412
|
-
var toStart = 1;
|
|
2413
|
-
for (; toStart < to.length; ++toStart) {
|
|
2414
|
-
if (to.charCodeAt(toStart) !== 47 /*/*/)
|
|
2415
|
-
break;
|
|
2416
|
-
}
|
|
2417
|
-
var toEnd = to.length;
|
|
2418
|
-
var toLen = toEnd - toStart;
|
|
2419
|
-
|
|
2420
|
-
// Compare paths to find the longest common path from root
|
|
2421
|
-
var length = fromLen < toLen ? fromLen : toLen;
|
|
2422
|
-
var lastCommonSep = -1;
|
|
2423
|
-
var i = 0;
|
|
2424
|
-
for (; i <= length; ++i) {
|
|
2425
|
-
if (i === length) {
|
|
2426
|
-
if (toLen > length) {
|
|
2427
|
-
if (to.charCodeAt(toStart + i) === 47 /*/*/) {
|
|
2428
|
-
// We get here if `from` is the exact base path for `to`.
|
|
2429
|
-
// For example: from='/foo/bar'; to='/foo/bar/baz'
|
|
2430
|
-
return to.slice(toStart + i + 1);
|
|
2431
|
-
} else if (i === 0) {
|
|
2432
|
-
// We get here if `from` is the root
|
|
2433
|
-
// For example: from='/'; to='/foo'
|
|
2434
|
-
return to.slice(toStart + i);
|
|
2435
|
-
}
|
|
2436
|
-
} else if (fromLen > length) {
|
|
2437
|
-
if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
|
|
2438
|
-
// We get here if `to` is the exact base path for `from`.
|
|
2439
|
-
// For example: from='/foo/bar/baz'; to='/foo/bar'
|
|
2440
|
-
lastCommonSep = i;
|
|
2441
|
-
} else if (i === 0) {
|
|
2442
|
-
// We get here if `to` is the root.
|
|
2443
|
-
// For example: from='/foo'; to='/'
|
|
2444
|
-
lastCommonSep = 0;
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
break;
|
|
2448
|
-
}
|
|
2449
|
-
var fromCode = from.charCodeAt(fromStart + i);
|
|
2450
|
-
var toCode = to.charCodeAt(toStart + i);
|
|
2451
|
-
if (fromCode !== toCode)
|
|
2452
|
-
break;
|
|
2453
|
-
else if (fromCode === 47 /*/*/)
|
|
2454
|
-
lastCommonSep = i;
|
|
2455
|
-
}
|
|
2456
|
-
|
|
2457
|
-
var out = '';
|
|
2458
|
-
// Generate the relative path based on the path difference between `to`
|
|
2459
|
-
// and `from`
|
|
2460
|
-
for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
|
|
2461
|
-
if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
|
|
2462
|
-
if (out.length === 0)
|
|
2463
|
-
out += '..';
|
|
2464
|
-
else
|
|
2465
|
-
out += '/..';
|
|
2466
|
-
}
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
|
-
// Lastly, append the rest of the destination (`to`) path that comes after
|
|
2470
|
-
// the common path parts
|
|
2471
|
-
if (out.length > 0)
|
|
2472
|
-
return out + to.slice(toStart + lastCommonSep);
|
|
2473
|
-
else {
|
|
2474
|
-
toStart += lastCommonSep;
|
|
2475
|
-
if (to.charCodeAt(toStart) === 47 /*/*/)
|
|
2476
|
-
++toStart;
|
|
2477
|
-
return to.slice(toStart);
|
|
2478
|
-
}
|
|
2479
|
-
},
|
|
2480
|
-
|
|
2481
|
-
_makeLong: function _makeLong(path) {
|
|
2482
|
-
return path;
|
|
2483
|
-
},
|
|
2484
|
-
|
|
2485
|
-
dirname: function dirname(path) {
|
|
2486
|
-
assertPath(path);
|
|
2487
|
-
if (path.length === 0) return '.';
|
|
2488
|
-
var code = path.charCodeAt(0);
|
|
2489
|
-
var hasRoot = code === 47 /*/*/;
|
|
2490
|
-
var end = -1;
|
|
2491
|
-
var matchedSlash = true;
|
|
2492
|
-
for (var i = path.length - 1; i >= 1; --i) {
|
|
2493
|
-
code = path.charCodeAt(i);
|
|
2494
|
-
if (code === 47 /*/*/) {
|
|
2495
|
-
if (!matchedSlash) {
|
|
2496
|
-
end = i;
|
|
2497
|
-
break;
|
|
2498
|
-
}
|
|
2499
|
-
} else {
|
|
2500
|
-
// We saw the first non-path separator
|
|
2501
|
-
matchedSlash = false;
|
|
2502
|
-
}
|
|
2503
|
-
}
|
|
2504
|
-
|
|
2505
|
-
if (end === -1) return hasRoot ? '/' : '.';
|
|
2506
|
-
if (hasRoot && end === 1) return '//';
|
|
2507
|
-
return path.slice(0, end);
|
|
2508
|
-
},
|
|
2509
|
-
|
|
2510
|
-
basename: function basename(path, ext) {
|
|
2511
|
-
if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
|
|
2512
|
-
assertPath(path);
|
|
2513
|
-
|
|
2514
|
-
var start = 0;
|
|
2515
|
-
var end = -1;
|
|
2516
|
-
var matchedSlash = true;
|
|
2517
|
-
var i;
|
|
2518
|
-
|
|
2519
|
-
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
|
2520
|
-
if (ext.length === path.length && ext === path) return '';
|
|
2521
|
-
var extIdx = ext.length - 1;
|
|
2522
|
-
var firstNonSlashEnd = -1;
|
|
2523
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
2524
|
-
var code = path.charCodeAt(i);
|
|
2525
|
-
if (code === 47 /*/*/) {
|
|
2526
|
-
// If we reached a path separator that was not part of a set of path
|
|
2527
|
-
// separators at the end of the string, stop now
|
|
2528
|
-
if (!matchedSlash) {
|
|
2529
|
-
start = i + 1;
|
|
2530
|
-
break;
|
|
2531
|
-
}
|
|
2532
|
-
} else {
|
|
2533
|
-
if (firstNonSlashEnd === -1) {
|
|
2534
|
-
// We saw the first non-path separator, remember this index in case
|
|
2535
|
-
// we need it if the extension ends up not matching
|
|
2536
|
-
matchedSlash = false;
|
|
2537
|
-
firstNonSlashEnd = i + 1;
|
|
2538
|
-
}
|
|
2539
|
-
if (extIdx >= 0) {
|
|
2540
|
-
// Try to match the explicit extension
|
|
2541
|
-
if (code === ext.charCodeAt(extIdx)) {
|
|
2542
|
-
if (--extIdx === -1) {
|
|
2543
|
-
// We matched the extension, so mark this as the end of our path
|
|
2544
|
-
// component
|
|
2545
|
-
end = i;
|
|
2546
|
-
}
|
|
2547
|
-
} else {
|
|
2548
|
-
// Extension does not match, so our result is the entire path
|
|
2549
|
-
// component
|
|
2550
|
-
extIdx = -1;
|
|
2551
|
-
end = firstNonSlashEnd;
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
}
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
|
|
2558
|
-
return path.slice(start, end);
|
|
2559
|
-
} else {
|
|
2560
|
-
for (i = path.length - 1; i >= 0; --i) {
|
|
2561
|
-
if (path.charCodeAt(i) === 47 /*/*/) {
|
|
2562
|
-
// If we reached a path separator that was not part of a set of path
|
|
2563
|
-
// separators at the end of the string, stop now
|
|
2564
|
-
if (!matchedSlash) {
|
|
2565
|
-
start = i + 1;
|
|
2566
|
-
break;
|
|
2567
|
-
}
|
|
2568
|
-
} else if (end === -1) {
|
|
2569
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
2570
|
-
// path component
|
|
2571
|
-
matchedSlash = false;
|
|
2572
|
-
end = i + 1;
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
|
|
2576
|
-
if (end === -1) return '';
|
|
2577
|
-
return path.slice(start, end);
|
|
2578
|
-
}
|
|
2579
|
-
},
|
|
2580
|
-
|
|
2581
|
-
extname: function extname(path) {
|
|
2582
|
-
assertPath(path);
|
|
2583
|
-
var startDot = -1;
|
|
2584
|
-
var startPart = 0;
|
|
2585
|
-
var end = -1;
|
|
2586
|
-
var matchedSlash = true;
|
|
2587
|
-
// Track the state of characters (if any) we see before our first dot and
|
|
2588
|
-
// after any path separator we find
|
|
2589
|
-
var preDotState = 0;
|
|
2590
|
-
for (var i = path.length - 1; i >= 0; --i) {
|
|
2591
|
-
var code = path.charCodeAt(i);
|
|
2592
|
-
if (code === 47 /*/*/) {
|
|
2593
|
-
// If we reached a path separator that was not part of a set of path
|
|
2594
|
-
// separators at the end of the string, stop now
|
|
2595
|
-
if (!matchedSlash) {
|
|
2596
|
-
startPart = i + 1;
|
|
2597
|
-
break;
|
|
2598
|
-
}
|
|
2599
|
-
continue;
|
|
2600
|
-
}
|
|
2601
|
-
if (end === -1) {
|
|
2602
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
2603
|
-
// extension
|
|
2604
|
-
matchedSlash = false;
|
|
2605
|
-
end = i + 1;
|
|
2606
|
-
}
|
|
2607
|
-
if (code === 46 /*.*/) {
|
|
2608
|
-
// If this is our first dot, mark it as the start of our extension
|
|
2609
|
-
if (startDot === -1)
|
|
2610
|
-
startDot = i;
|
|
2611
|
-
else if (preDotState !== 1)
|
|
2612
|
-
preDotState = 1;
|
|
2613
|
-
} else if (startDot !== -1) {
|
|
2614
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
|
2615
|
-
// have a good chance at having a non-empty extension
|
|
2616
|
-
preDotState = -1;
|
|
2617
|
-
}
|
|
2618
|
-
}
|
|
2619
|
-
|
|
2620
|
-
if (startDot === -1 || end === -1 ||
|
|
2621
|
-
// We saw a non-dot character immediately before the dot
|
|
2622
|
-
preDotState === 0 ||
|
|
2623
|
-
// The (right-most) trimmed path component is exactly '..'
|
|
2624
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
2625
|
-
return '';
|
|
2626
|
-
}
|
|
2627
|
-
return path.slice(startDot, end);
|
|
2628
|
-
},
|
|
2629
|
-
|
|
2630
|
-
format: function format(pathObject) {
|
|
2631
|
-
if (pathObject === null || typeof pathObject !== 'object') {
|
|
2632
|
-
throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
2633
|
-
}
|
|
2634
|
-
return _format('/', pathObject);
|
|
2635
|
-
},
|
|
2636
|
-
|
|
2637
|
-
parse: function parse(path) {
|
|
2638
|
-
assertPath(path);
|
|
2639
|
-
|
|
2640
|
-
var ret = { root: '', dir: '', base: '', ext: '', name: '' };
|
|
2641
|
-
if (path.length === 0) return ret;
|
|
2642
|
-
var code = path.charCodeAt(0);
|
|
2643
|
-
var isAbsolute = code === 47 /*/*/;
|
|
2644
|
-
var start;
|
|
2645
|
-
if (isAbsolute) {
|
|
2646
|
-
ret.root = '/';
|
|
2647
|
-
start = 1;
|
|
2648
|
-
} else {
|
|
2649
|
-
start = 0;
|
|
2650
|
-
}
|
|
2651
|
-
var startDot = -1;
|
|
2652
|
-
var startPart = 0;
|
|
2653
|
-
var end = -1;
|
|
2654
|
-
var matchedSlash = true;
|
|
2655
|
-
var i = path.length - 1;
|
|
2656
|
-
|
|
2657
|
-
// Track the state of characters (if any) we see before our first dot and
|
|
2658
|
-
// after any path separator we find
|
|
2659
|
-
var preDotState = 0;
|
|
2660
|
-
|
|
2661
|
-
// Get non-dir info
|
|
2662
|
-
for (; i >= start; --i) {
|
|
2663
|
-
code = path.charCodeAt(i);
|
|
2664
|
-
if (code === 47 /*/*/) {
|
|
2665
|
-
// If we reached a path separator that was not part of a set of path
|
|
2666
|
-
// separators at the end of the string, stop now
|
|
2667
|
-
if (!matchedSlash) {
|
|
2668
|
-
startPart = i + 1;
|
|
2669
|
-
break;
|
|
2670
|
-
}
|
|
2671
|
-
continue;
|
|
2672
|
-
}
|
|
2673
|
-
if (end === -1) {
|
|
2674
|
-
// We saw the first non-path separator, mark this as the end of our
|
|
2675
|
-
// extension
|
|
2676
|
-
matchedSlash = false;
|
|
2677
|
-
end = i + 1;
|
|
2678
|
-
}
|
|
2679
|
-
if (code === 46 /*.*/) {
|
|
2680
|
-
// If this is our first dot, mark it as the start of our extension
|
|
2681
|
-
if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
|
|
2682
|
-
} else if (startDot !== -1) {
|
|
2683
|
-
// We saw a non-dot and non-path separator before our dot, so we should
|
|
2684
|
-
// have a good chance at having a non-empty extension
|
|
2685
|
-
preDotState = -1;
|
|
2686
|
-
}
|
|
2687
|
-
}
|
|
2688
|
-
|
|
2689
|
-
if (startDot === -1 || end === -1 ||
|
|
2690
|
-
// We saw a non-dot character immediately before the dot
|
|
2691
|
-
preDotState === 0 ||
|
|
2692
|
-
// The (right-most) trimmed path component is exactly '..'
|
|
2693
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
2694
|
-
if (end !== -1) {
|
|
2695
|
-
if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
|
|
2696
|
-
}
|
|
2697
|
-
} else {
|
|
2698
|
-
if (startPart === 0 && isAbsolute) {
|
|
2699
|
-
ret.name = path.slice(1, startDot);
|
|
2700
|
-
ret.base = path.slice(1, end);
|
|
2701
|
-
} else {
|
|
2702
|
-
ret.name = path.slice(startPart, startDot);
|
|
2703
|
-
ret.base = path.slice(startPart, end);
|
|
2704
|
-
}
|
|
2705
|
-
ret.ext = path.slice(startDot, end);
|
|
2706
|
-
}
|
|
2707
|
-
|
|
2708
|
-
if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
|
|
2709
|
-
|
|
2710
|
-
return ret;
|
|
2711
|
-
},
|
|
1962
|
+
const MONTH = YEAR / 12;
|
|
1963
|
+
// Derived: explicit names
|
|
1964
|
+
const SECONDS_PER_MINUTE = MINUTE;
|
|
1965
|
+
const SECONDS_PER_HOUR = HOUR;
|
|
1966
|
+
const SECONDS_PER_DAY = DAY;
|
|
1967
|
+
//math
|
|
1968
|
+
const PI = Math.PI;
|
|
1969
|
+
const PI2 = 2 * PI;
|
|
1970
|
+
// Distance
|
|
1971
|
+
const METERS_PER_KM = 1000;
|
|
1972
|
+
const METERS_PER_MILE = 1609.34;
|
|
1973
|
+
const METERS_PER_FOOT = 0.3048;
|
|
1974
|
+
const KMS_PER_METER = 1 / METERS_PER_KM;
|
|
1975
|
+
const MILES_PER_METER = 1 / METERS_PER_MILE;
|
|
1976
|
+
const FEET_PER_METER = 1 / METERS_PER_FOOT;
|
|
1977
|
+
const MIN_IN_S = 1 / MINUTE;
|
|
1978
|
+
const HOUR_IN_S = 1 / HOUR;
|
|
1979
|
+
const DAY_IN_S = 1 / DAY;
|
|
1980
|
+
const YEAR_IN_S = 1 / YEAR;
|
|
1981
|
+
const MONTH_IN_S = 1 / MONTH;
|
|
1982
|
+
const MiPerH_TO_MPerS = METERS_PER_MILE * HOUR_IN_S;
|
|
1983
|
+
const MPerS_TO_MiPerH = 1 / MiPerH_TO_MPerS;
|
|
2712
1984
|
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
1985
|
+
// conversions.ts
|
|
1986
|
+
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
1987
|
+
š§ CANONICAL MAPPINGS
|
|
1988
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
1989
|
+
const DIST_ALIASES = {
|
|
1990
|
+
m: "m", meter: "m", meters: "m",
|
|
1991
|
+
km: "km", kms: "km", kilometer: "km", kilometers: "km",
|
|
1992
|
+
mi: "mi", mile: "mi", miles: "mi",
|
|
1993
|
+
ft: "ft", f: "ft", foot: "ft", feet: "ft",
|
|
2717
1994
|
};
|
|
1995
|
+
const TIME_ALIASES = {
|
|
1996
|
+
s: "s", sec: "s", second: "s", seconds: "s",
|
|
1997
|
+
min: "min", m: "min", minute: "min", minutes: "min",
|
|
1998
|
+
h: "h", hr: "h", hour: "h", hours: "h",
|
|
1999
|
+
day: "day", d: "day", days: "day",
|
|
2000
|
+
};
|
|
2001
|
+
const DIST_FACTORS = {
|
|
2002
|
+
m: 1,
|
|
2003
|
+
km: METERS_PER_KM,
|
|
2004
|
+
mi: METERS_PER_MILE,
|
|
2005
|
+
ft: METERS_PER_FOOT,
|
|
2006
|
+
};
|
|
2007
|
+
const TIME_FACTORS = {
|
|
2008
|
+
s: 1,
|
|
2009
|
+
min: MINUTE,
|
|
2010
|
+
h: HOUR,
|
|
2011
|
+
day: DAY,
|
|
2012
|
+
};
|
|
2013
|
+
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2014
|
+
š CANONICALIZATION HELPERS
|
|
2015
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2016
|
+
function canonDist(u) {
|
|
2017
|
+
const key = (u ?? "m").toString().toLowerCase();
|
|
2018
|
+
const canon = DIST_ALIASES[key];
|
|
2019
|
+
if (!canon)
|
|
2020
|
+
throw new Error(`Unknown distance unit: ${u}`);
|
|
2021
|
+
return canon;
|
|
2022
|
+
}
|
|
2023
|
+
function canonTime(u) {
|
|
2024
|
+
const key = (u ?? "s").toString().toLowerCase();
|
|
2025
|
+
const canon = TIME_ALIASES[key];
|
|
2026
|
+
if (!canon)
|
|
2027
|
+
throw new Error(`Unknown time unit: ${u}`);
|
|
2028
|
+
return canon;
|
|
2029
|
+
}
|
|
2030
|
+
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2031
|
+
āļø NORMALIZATION HELPERS
|
|
2032
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2033
|
+
function distanceToMeters(d, unit) {
|
|
2034
|
+
const u = canonDist(unit);
|
|
2035
|
+
return safeMultiply(d, DIST_FACTORS[u]);
|
|
2036
|
+
}
|
|
2037
|
+
function metersToDistance(v, unit) {
|
|
2038
|
+
const u = canonDist(unit);
|
|
2039
|
+
return safeDivide(v, DIST_FACTORS[u]);
|
|
2040
|
+
}
|
|
2041
|
+
function timeToSeconds(t, unit) {
|
|
2042
|
+
const u = canonTime(unit);
|
|
2043
|
+
return safeMultiply(t, TIME_FACTORS[u]);
|
|
2044
|
+
}
|
|
2045
|
+
function secondsToTime(v, unit) {
|
|
2046
|
+
const u = canonTime(unit);
|
|
2047
|
+
return safeDivide(v, TIME_FACTORS[u]);
|
|
2048
|
+
}
|
|
2049
|
+
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2050
|
+
š SPEED CONVERSIONS (normalize / unnormalize)
|
|
2051
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2052
|
+
function speedToMps(v, distUnit, timeUnit) {
|
|
2053
|
+
const du = canonDist(distUnit);
|
|
2054
|
+
const tu = canonTime(timeUnit);
|
|
2055
|
+
return v * (DIST_FACTORS[du] / TIME_FACTORS[tu]);
|
|
2056
|
+
}
|
|
2057
|
+
function mpsToSpeed(vMps, distUnit, timeUnit) {
|
|
2058
|
+
const du = canonDist(distUnit);
|
|
2059
|
+
const tu = canonTime(timeUnit);
|
|
2060
|
+
return vMps * (TIME_FACTORS[tu] / DIST_FACTORS[du]);
|
|
2061
|
+
}
|
|
2062
|
+
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2063
|
+
šÆ UNIVERSAL CONVERTERS
|
|
2064
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2065
|
+
function convertDistance({ d, fromDist, toDist, vOnly = true, }) {
|
|
2066
|
+
const m = distanceToMeters(d, fromDist);
|
|
2067
|
+
const D = canonDist(toDist ?? "m");
|
|
2068
|
+
const out = metersToDistance(m, D);
|
|
2069
|
+
return vOnly ? out : { d: out, D };
|
|
2070
|
+
}
|
|
2071
|
+
function convertTime({ t, fromTime, toTime, vOnly = true, }) {
|
|
2072
|
+
const sec = timeToSeconds(t, fromTime);
|
|
2073
|
+
const T = canonTime(toTime ?? "s");
|
|
2074
|
+
const out = secondsToTime(sec, T);
|
|
2075
|
+
return vOnly ? out : { t: out, T };
|
|
2076
|
+
}
|
|
2077
|
+
function convertSpeed({ v, fromDist, fromTime, toDist, toTime, vOnly = true, }) {
|
|
2078
|
+
const mps = speedToMps(v, fromDist, fromTime);
|
|
2079
|
+
const d = canonDist(toDist ?? "m");
|
|
2080
|
+
const t = canonTime(toTime ?? "s");
|
|
2081
|
+
const out = mpsToSpeed(mps, d, t);
|
|
2082
|
+
return vOnly ? out : { v: out, d, t };
|
|
2083
|
+
}
|
|
2084
|
+
const DistanceConverter = {
|
|
2085
|
+
normalize: distanceToMeters,
|
|
2086
|
+
unnormalize: metersToDistance,
|
|
2087
|
+
};
|
|
2088
|
+
const TimeConverter = {
|
|
2089
|
+
normalize: timeToSeconds,
|
|
2090
|
+
unnormalize: secondsToTime,
|
|
2091
|
+
};
|
|
2092
|
+
const SpeedConverter = {
|
|
2093
|
+
normalize: (v, [du, tu]) => speedToMps(v, du, tu),
|
|
2094
|
+
unnormalize: (v, [du, tu]) => mpsToSpeed(v, du, tu),
|
|
2095
|
+
};
|
|
2096
|
+
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2097
|
+
š§© COMPATIBILITY WRAPPERS (legacy aliases)
|
|
2098
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2099
|
+
const toMeters = distanceToMeters;
|
|
2100
|
+
const fromMeters = metersToDistance;
|
|
2101
|
+
const toSeconds = timeToSeconds;
|
|
2102
|
+
const fromSeconds = secondsToTime;
|
|
2103
|
+
const velocityToMs = (value, unit) => speedToMps(value, unit, "s");
|
|
2104
|
+
const velocityFromMs = (value, unit) => mpsToSpeed(value, unit, "s");
|
|
2105
|
+
/** Non-canonical helper for arbitrary rate conversion, e.g. ft/day ā m/s */
|
|
2106
|
+
const fromMps = (v, dist_unit, time_unit) => mpsToSpeed(v, dist_unit, time_unit);
|
|
2107
|
+
/*āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
2108
|
+
š UTILITIES
|
|
2109
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā*/
|
|
2110
|
+
const isFiniteNum = (x) => Number.isFinite(x);
|
|
2111
|
+
const fmt = (n, digits = 2) => isFiniteNum(n) ? n.toFixed(digits) : "N/A";
|
|
2718
2112
|
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
var require$$1$2 = /*@__PURE__*/getDefaultExportFromCjs(pathBrowserify);
|
|
2113
|
+
// Function to check time interval
|
|
2114
|
+
function isTimeInterval(timeObj, interval) {
|
|
2115
|
+
return (Date.now() / 1000 - timeObj) < (interval - 1);
|
|
2116
|
+
}
|
|
2724
2117
|
|
|
2725
2118
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2726
2119
|
|
|
@@ -13577,7 +12970,7 @@ function requireFile () {
|
|
|
13577
12970
|
hasRequiredFile = 1;
|
|
13578
12971
|
|
|
13579
12972
|
const fs = require$$0$6;
|
|
13580
|
-
const path =
|
|
12973
|
+
const path = path$1;
|
|
13581
12974
|
const asyncSeries = requireSeries();
|
|
13582
12975
|
const zlib = require$$3;
|
|
13583
12976
|
const { MESSAGE } = tripleBeam;
|
|
@@ -17278,7 +16671,7 @@ function resolveLogger(candidate) {
|
|
|
17278
16671
|
return null;
|
|
17279
16672
|
}
|
|
17280
16673
|
/* ------------------------------------------------------------------ */
|
|
17281
|
-
/*
|
|
16674
|
+
/* IMPLEMENTATION */
|
|
17282
16675
|
/* ------------------------------------------------------------------ */
|
|
17283
16676
|
function getLogString(messageOrOptions, logType = null, details = null, function_name = null, file_location = null, consumerLogger = null) {
|
|
17284
16677
|
// ---------------- Normalize inputs ----------------
|
|
@@ -17441,7 +16834,7 @@ function getSafeLocalStorage() {
|
|
|
17441
16834
|
try {
|
|
17442
16835
|
return window.localStorage;
|
|
17443
16836
|
}
|
|
17444
|
-
catch
|
|
16837
|
+
catch {
|
|
17445
16838
|
return undefined; // e.g. Safari private-mode block
|
|
17446
16839
|
}
|
|
17447
16840
|
}
|
|
@@ -17462,7 +16855,7 @@ function callStorage(method, ...args) {
|
|
|
17462
16855
|
try {
|
|
17463
16856
|
return fn.apply(storage, args);
|
|
17464
16857
|
}
|
|
17465
|
-
catch
|
|
16858
|
+
catch {
|
|
17466
16859
|
return undefined;
|
|
17467
16860
|
}
|
|
17468
16861
|
}
|
|
@@ -17477,7 +16870,7 @@ function safeStorage(storageName, method, ...args) {
|
|
|
17477
16870
|
return undefined;
|
|
17478
16871
|
return store[method](...args);
|
|
17479
16872
|
}
|
|
17480
|
-
catch
|
|
16873
|
+
catch {
|
|
17481
16874
|
return undefined;
|
|
17482
16875
|
}
|
|
17483
16876
|
}
|
|
@@ -17507,7 +16900,7 @@ function callWindowMethod(method, ...args) {
|
|
|
17507
16900
|
// cast to any so TS doesnāt complain about apply/invoke
|
|
17508
16901
|
return fn(...args);
|
|
17509
16902
|
}
|
|
17510
|
-
catch
|
|
16903
|
+
catch {
|
|
17511
16904
|
return undefined;
|
|
17512
16905
|
}
|
|
17513
16906
|
}
|
|
@@ -17525,172 +16918,132 @@ function getWindowHost() {
|
|
|
17525
16918
|
return getWindowProp('location', 'host');
|
|
17526
16919
|
}
|
|
17527
16920
|
|
|
17528
|
-
|
|
17529
|
-
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
|
|
17534
|
-
if (!
|
|
17535
|
-
try {
|
|
17536
|
-
// prevent bundlers from resolving these at build time
|
|
17537
|
-
fs = (new Function("return require('fs')"))();
|
|
17538
|
-
path = (new Function("return require('path')"))();
|
|
17539
|
-
}
|
|
17540
|
-
catch (_b) {
|
|
17541
|
-
fs = null;
|
|
17542
|
-
path = null;
|
|
17543
|
-
}
|
|
17544
|
-
}
|
|
17545
|
-
return { fs, path };
|
|
17546
|
-
});
|
|
17547
|
-
}
|
|
17548
|
-
/**
|
|
17549
|
-
* Reads a JSON file, either via Nodeās fs (if available)
|
|
17550
|
-
* or via window.fetch in the browser. Never throws ā returns
|
|
17551
|
-
* the parsed object or null on any error.
|
|
17552
|
-
*/
|
|
17553
|
-
function readJsonFile(relativeOrAbsolutePath) {
|
|
17554
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17555
|
-
var _a;
|
|
17556
|
-
// 1) Try Node.js fs (only at runtime, not bundled)
|
|
17557
|
-
if (typeof process !== "undefined" && ((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node)) {
|
|
17558
|
-
try {
|
|
17559
|
-
const { fs, path } = yield getFsModules();
|
|
17560
|
-
if (fs && path) {
|
|
17561
|
-
const filePath = path.isAbsolute(relativeOrAbsolutePath)
|
|
17562
|
-
? relativeOrAbsolutePath
|
|
17563
|
-
: path.resolve(process.cwd(), relativeOrAbsolutePath);
|
|
17564
|
-
const text = fs.readFileSync(filePath, "utf8");
|
|
17565
|
-
return JSON.parse(text);
|
|
17566
|
-
}
|
|
17567
|
-
}
|
|
17568
|
-
catch (_b) {
|
|
17569
|
-
// swallow and fall back
|
|
17570
|
-
}
|
|
17571
|
-
}
|
|
17572
|
-
// 2) Try browser fetch
|
|
17573
|
-
const fetchFn = safeGlobalProp("fetch");
|
|
17574
|
-
if (typeof fetchFn !== "function") {
|
|
17575
|
-
return null;
|
|
17576
|
-
}
|
|
17577
|
-
let url = relativeOrAbsolutePath;
|
|
17578
|
-
const baseURI = safeGlobalProp("document", "baseURI");
|
|
17579
|
-
if (baseURI) {
|
|
17580
|
-
try {
|
|
17581
|
-
url = new URL(relativeOrAbsolutePath, baseURI).href;
|
|
17582
|
-
}
|
|
17583
|
-
catch (_c) {
|
|
17584
|
-
/* keep url as-is */
|
|
17585
|
-
}
|
|
17586
|
-
}
|
|
17587
|
-
try {
|
|
17588
|
-
const res = yield fetchFn(url);
|
|
17589
|
-
if (!res.ok)
|
|
17590
|
-
return null;
|
|
17591
|
-
return (yield res.json());
|
|
17592
|
-
}
|
|
17593
|
-
catch (_d) {
|
|
16921
|
+
async function readJsonFileBrowser(url) {
|
|
16922
|
+
const fetchFn = safeGlobalProp("fetch");
|
|
16923
|
+
if (typeof fetchFn !== "function")
|
|
16924
|
+
return null;
|
|
16925
|
+
try {
|
|
16926
|
+
const res = await fetchFn(url);
|
|
16927
|
+
if (!res.ok)
|
|
17594
16928
|
return null;
|
|
17595
|
-
|
|
17596
|
-
}
|
|
16929
|
+
return (await res.json());
|
|
16930
|
+
}
|
|
16931
|
+
catch {
|
|
16932
|
+
return null;
|
|
16933
|
+
}
|
|
17597
16934
|
}
|
|
17598
|
-
|
|
17599
|
-
|
|
17600
|
-
|
|
17601
|
-
|
|
17602
|
-
|
|
17603
|
-
|
|
17604
|
-
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
|
|
16935
|
+
|
|
16936
|
+
var readJsonFile_browser = /*#__PURE__*/Object.freeze({
|
|
16937
|
+
__proto__: null,
|
|
16938
|
+
readJsonFileBrowser: readJsonFileBrowser
|
|
16939
|
+
});
|
|
16940
|
+
|
|
16941
|
+
function readJsonFileNode(relativeOrAbsolutePath) {
|
|
16942
|
+
try {
|
|
16943
|
+
const filePath = isAbsolute(relativeOrAbsolutePath)
|
|
16944
|
+
? relativeOrAbsolutePath
|
|
16945
|
+
: resolve(process.cwd(), relativeOrAbsolutePath);
|
|
16946
|
+
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
16947
|
+
}
|
|
16948
|
+
catch {
|
|
16949
|
+
return null;
|
|
16950
|
+
}
|
|
17610
16951
|
}
|
|
17611
|
-
|
|
17612
|
-
|
|
17613
|
-
|
|
17614
|
-
|
|
17615
|
-
|
|
17616
|
-
|
|
17617
|
-
|
|
17618
|
-
|
|
17619
|
-
|
|
16952
|
+
|
|
16953
|
+
var readJsonFile_node = /*#__PURE__*/Object.freeze({
|
|
16954
|
+
__proto__: null,
|
|
16955
|
+
readJsonFileNode: readJsonFileNode
|
|
16956
|
+
});
|
|
16957
|
+
|
|
16958
|
+
async function readJsonFile(relativeOrAbsolutePath) {
|
|
16959
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
16960
|
+
const mod = await Promise.resolve().then(function () { return readJsonFile_node; });
|
|
16961
|
+
return mod.readJsonFileNode(relativeOrAbsolutePath);
|
|
16962
|
+
}
|
|
16963
|
+
else {
|
|
16964
|
+
const mod = await Promise.resolve().then(function () { return readJsonFile_browser; });
|
|
16965
|
+
return mod.readJsonFileBrowser(relativeOrAbsolutePath);
|
|
16966
|
+
}
|
|
16967
|
+
}
|
|
16968
|
+
async function getConfigContent() {
|
|
16969
|
+
try {
|
|
16970
|
+
// `readJsonFile` should throw if the file isnāt there or isnāt valid JSON
|
|
16971
|
+
const cfg = await readJsonFile('./config.json');
|
|
16972
|
+
return cfg;
|
|
16973
|
+
}
|
|
16974
|
+
catch {
|
|
16975
|
+
// swallow errors & return null so callers can detect āno configā
|
|
16976
|
+
return null;
|
|
16977
|
+
}
|
|
17620
16978
|
}
|
|
17621
16979
|
|
|
17622
16980
|
// src/functions/config_utils/src/config_utils.ts
|
|
17623
16981
|
let _cachedConfig = null;
|
|
17624
|
-
function loadConfig() {
|
|
17625
|
-
|
|
17626
|
-
|
|
17627
|
-
|
|
16982
|
+
async function loadConfig(filePath = null) {
|
|
16983
|
+
if (_cachedConfig) {
|
|
16984
|
+
return _cachedConfig;
|
|
16985
|
+
}
|
|
16986
|
+
// 1) figure out where config.json lives
|
|
16987
|
+
let configUrl;
|
|
16988
|
+
if (filePath) {
|
|
16989
|
+
configUrl = filePath;
|
|
16990
|
+
}
|
|
16991
|
+
else if (typeof import.meta !== 'undefined' && typeof import.meta.url === 'string') {
|
|
16992
|
+
// ES module: resolve relative to this file
|
|
16993
|
+
try {
|
|
16994
|
+
const mod = await (new Function("return import('./config.json').catch(() => ({}))"))();
|
|
16995
|
+
_cachedConfig = mod.default ?? {};
|
|
17628
16996
|
return _cachedConfig;
|
|
17629
16997
|
}
|
|
17630
|
-
|
|
17631
|
-
|
|
17632
|
-
if (filePath) {
|
|
17633
|
-
configUrl = filePath;
|
|
17634
|
-
}
|
|
17635
|
-
else if (typeof import.meta !== 'undefined' && typeof import.meta.url === 'string') {
|
|
17636
|
-
// ES module: resolve relative to this file
|
|
17637
|
-
try {
|
|
17638
|
-
const mod = yield (new Function("return import('./config.json').catch(() => ({}))"))();
|
|
17639
|
-
_cachedConfig = (_a = mod.default) !== null && _a !== void 0 ? _a : {};
|
|
17640
|
-
return _cachedConfig;
|
|
17641
|
-
}
|
|
17642
|
-
catch (_c) {
|
|
17643
|
-
configUrl = 'config.json';
|
|
17644
|
-
}
|
|
16998
|
+
catch {
|
|
16999
|
+
configUrl = 'config.json';
|
|
17645
17000
|
}
|
|
17646
|
-
|
|
17647
|
-
|
|
17648
|
-
|
|
17649
|
-
|
|
17650
|
-
|
|
17651
|
-
|
|
17652
|
-
|
|
17653
|
-
|
|
17654
|
-
|
|
17655
|
-
catch (_d) {
|
|
17656
|
-
configUrl = 'config.json';
|
|
17657
|
-
}
|
|
17001
|
+
}
|
|
17002
|
+
else {
|
|
17003
|
+
// browser fallback
|
|
17004
|
+
const baseURI = safeGlobalProp('document', 'baseURI');
|
|
17005
|
+
try {
|
|
17006
|
+
configUrl =
|
|
17007
|
+
typeof baseURI === 'string'
|
|
17008
|
+
? new URL('config.json', baseURI).href
|
|
17009
|
+
: 'config.json';
|
|
17658
17010
|
}
|
|
17659
|
-
|
|
17660
|
-
|
|
17661
|
-
if (typeof fetchFn === 'function') {
|
|
17662
|
-
try {
|
|
17663
|
-
const res = yield fetchFn(configUrl);
|
|
17664
|
-
if (res.ok) {
|
|
17665
|
-
const json = yield res.json();
|
|
17666
|
-
// cache & return
|
|
17667
|
-
_cachedConfig = (_b = json) !== null && _b !== void 0 ? _b : {};
|
|
17668
|
-
return _cachedConfig;
|
|
17669
|
-
}
|
|
17670
|
-
}
|
|
17671
|
-
catch (_e) {
|
|
17672
|
-
/* swallow */
|
|
17673
|
-
}
|
|
17011
|
+
catch {
|
|
17012
|
+
configUrl = 'config.json';
|
|
17674
17013
|
}
|
|
17675
|
-
|
|
17014
|
+
}
|
|
17015
|
+
// 2) if we have a fetch, try HTTP(S)
|
|
17016
|
+
const fetchFn = safeGlobalProp('fetch');
|
|
17017
|
+
if (typeof fetchFn === 'function') {
|
|
17676
17018
|
try {
|
|
17677
|
-
const
|
|
17678
|
-
|
|
17679
|
-
|
|
17019
|
+
const res = await fetchFn(configUrl);
|
|
17020
|
+
if (res.ok) {
|
|
17021
|
+
const json = await res.json();
|
|
17022
|
+
// cache & return
|
|
17023
|
+
_cachedConfig = json ?? {};
|
|
17024
|
+
return _cachedConfig;
|
|
17025
|
+
}
|
|
17680
17026
|
}
|
|
17681
|
-
catch
|
|
17027
|
+
catch {
|
|
17682
17028
|
/* swallow */
|
|
17683
17029
|
}
|
|
17684
|
-
|
|
17685
|
-
|
|
17030
|
+
}
|
|
17031
|
+
// 3) Node fallback: try reading from disk (requires your readJsonFile util)
|
|
17032
|
+
try {
|
|
17033
|
+
const disk = await readJsonFile(configUrl);
|
|
17034
|
+
_cachedConfig = disk ?? {};
|
|
17686
17035
|
return _cachedConfig;
|
|
17687
|
-
}
|
|
17036
|
+
}
|
|
17037
|
+
catch {
|
|
17038
|
+
/* swallow */
|
|
17039
|
+
}
|
|
17040
|
+
// 4) if all else fails, return an empty config
|
|
17041
|
+
_cachedConfig = {};
|
|
17042
|
+
return _cachedConfig;
|
|
17688
17043
|
}
|
|
17689
|
-
function getConfig(key) {
|
|
17690
|
-
|
|
17691
|
-
|
|
17692
|
-
return key != null ? cfg[key] : cfg;
|
|
17693
|
-
});
|
|
17044
|
+
async function getConfig(key) {
|
|
17045
|
+
const cfg = await loadConfig();
|
|
17046
|
+
return key != null ? cfg[key] : cfg;
|
|
17694
17047
|
}
|
|
17695
17048
|
|
|
17696
17049
|
/**
|
|
@@ -17772,5 +17125,48 @@ function dataSize(data) {
|
|
|
17772
17125
|
return size / 1000; // Convert to kilobytes
|
|
17773
17126
|
}
|
|
17774
17127
|
|
|
17775
|
-
|
|
17128
|
+
function getLastCaller(skip = ["debugPrint"]) {
|
|
17129
|
+
const stack = new Error().stack;
|
|
17130
|
+
if (!stack)
|
|
17131
|
+
return null;
|
|
17132
|
+
const lines = stack
|
|
17133
|
+
.split("\n")
|
|
17134
|
+
.map(l => l.trim())
|
|
17135
|
+
.slice(1); // drop "Error"
|
|
17136
|
+
for (const line of lines) {
|
|
17137
|
+
// Example:
|
|
17138
|
+
// at processSingleAddress (/path/file.ts:142:7)
|
|
17139
|
+
const match = line.match(/at (.+?) \((.+?):(\d+):(\d+)\)/) ||
|
|
17140
|
+
line.match(/at (.+?):(\d+):(\d+)/);
|
|
17141
|
+
if (!match)
|
|
17142
|
+
continue;
|
|
17143
|
+
const functionName = match[1] ?? "anonymous";
|
|
17144
|
+
if (skip.includes(functionName))
|
|
17145
|
+
continue;
|
|
17146
|
+
return {
|
|
17147
|
+
functionName,
|
|
17148
|
+
file: match[2],
|
|
17149
|
+
line: Number(match[3]),
|
|
17150
|
+
column: Number(match[4]),
|
|
17151
|
+
};
|
|
17152
|
+
}
|
|
17153
|
+
return null;
|
|
17154
|
+
}
|
|
17155
|
+
|
|
17156
|
+
function debugPrint(value, label = null) {
|
|
17157
|
+
const caller = getLastCaller();
|
|
17158
|
+
const header = label ??
|
|
17159
|
+
(caller
|
|
17160
|
+
? `${caller.functionName} @ ${caller.file}:${caller.line}`
|
|
17161
|
+
: "object");
|
|
17162
|
+
console.log(`\nš ${header}`);
|
|
17163
|
+
console.log(inspect(value, {
|
|
17164
|
+
depth: null,
|
|
17165
|
+
colors: true,
|
|
17166
|
+
compact: false,
|
|
17167
|
+
maxArrayLength: null,
|
|
17168
|
+
}));
|
|
17169
|
+
}
|
|
17170
|
+
|
|
17171
|
+
export { API_PREFIX, ATTOSECOND, BASE_URL, CENTISECOND, DAY, DAY_IN_S, DECISECOND, DEV_PREFIX, DIST_ALIASES, DIST_FACTORS, DOMAIN_NAME, DistanceConverter, FEET_PER_METER, FEMTOSECOND, HOUR, HOUR_IN_S, KMS_PER_METER, MEDIA_TYPES, METERS_PER_FOOT, METERS_PER_KM, METERS_PER_MILE, MICROSECOND, MILES_PER_METER, MILISECOND, MIME_TYPES, MINUTE, MIN_IN_S, MONTH, MONTH_IN_S, MPerS_TO_MiPerH, MiPerH_TO_MPerS, NANOSECOND, PI, PI2, PICOSECOND, PROD_PREFIX, PROTOCOL, SECOND, SECONDS_PER_DAY, SECONDS_PER_HOUR, SECONDS_PER_MINUTE, SUB_DIR, SpeedConverter, TIME_ALIASES, TIME_FACTORS, TimeConverter, YEAR, YEAR_IN_S, ZEPTOSECOND, alertit, assureArray, assureList, assureNumber, assureString, assure_array, assure_list, assure_number, assure_string, assurearray, assurelist, assurenumber, assurestring, callStorage, callWindowMethod, canonDist, canonTime, capitalize, capitalize_str, checkResponse, cleanArray, cleanText, confirmType, confirm_type, convertBigInts, convertDistance, convertSpeed, convertTime, create_list_string, dataSize, dataSizeInMb, debugPrint, decodeJwt, distanceToMeters, eatAll, eatElse, eatInner, eatOuter, eatall, eatinner, eatouter, emptyObjectToNull, ends_in_quotes, ensureArray, ensureList, ensureNumber, ensureString, ensure_array, ensure_list, ensure_number, ensure_string, ensurearray, ensurelist, ensurenumber, ensurestring, exceedsMbLimit, exponential, extractInsertData, fetchIndexHtml, fetchIndexHtmlContainer, fetchIt, findKeyValue, fmt, formatNumber, fromMeters, fromMps, fromSeconds, geAuthsUtilsDirectory, geBackupsUtilsDirectory, geConstantsUtilsDirectory, geEnvUtilsDirectory, geFetchUtilsDirectory, geFileUtilsDirectory, gePathUtilsDirectory, geStaticDirectory, geStringUtilsDirectory, geTypeUtilsDirectory, get, getAbsDir, getAbsPath, getAllFileTypes, getAllFileTypesSync, getAlphaNum, getAlphas, getBaseDir, getBasename, getBody, getChar, getCleanArray, getComponentsUtilsDirectory, getConfig, getConfigContent, getDbConfigsPath, getDirname, getDistDir, getDocumentProp, getEnvDir, getEnvPath, getExtname, getFetchVars, getFilename, getFunctionsDir, getFunctionsUtilsDirectory, getHeaders, getHooksUtilsDirectory, getHtmlDirectory, getIfNone, getJsonSizeInMb, getLastCaller, getLibUtilsDirectory, getMediaExts, getMediaMap, getMethod, getMimeType, getNums, getPublicDir, getResult, getSafeDocument, getSafeLocalStorage, getSafeWindow, getSchemasDirPath, getSchemasPath, getSplitext, getSrcDir, getSubstring, getWindowHost, getWindowProp, get_all_file_types, get_basename, get_dirname, get_extname, get_filename, get_full_path, get_full_url, get_key_value, get_keyword_string, get_media_exts, get_media_map, get_mime_type, get_relative_path, get_splitext, get_window, get_window_location, get_window_parts, get_window_pathname, getbasename, getdirname, getextname, getfilename, getsplitext, isFiniteNum, isMediaType, isNum, isStrInString, isTimeInterval, isTokenExpired, isType, isZero, is_media_type, loadConfig, loadInnerJson, makePath, make_path, make_sanitized_path, makepath, mergeNotNullValues, metersToDistance, mpsToSpeed, normalizeUrl, omitKeys, parseResult, pathJoin, path_join, path_to_url, pathjoin, processKeywords, readJsonFile, readJsonFileBrowser, readJsonFileNode, roundPercentage, safeDivide, safeGlobalProp, safeJsonSizeInMb, safeMultiply, safeNums, safeStorage, sanitizeFilename, sanitizeString, secondsToTime, speedToMps, stripPrefixes, stripQuotes, timeToSeconds, toMeters, toSeconds, truncateString, tryEatPrefix, tryParse, urlJoin, url_to_path, urljoin, velocityFromMs, velocityToMs };
|
|
17776
17172
|
//# sourceMappingURL=index.js.map
|