@kky42/pievo-server 1.0.0
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/.output/nitro.json +17 -0
- package/.output/public/assets/CodeField-dOzyFQNH.js +34 -0
- package/.output/public/assets/LoopView-B4H9QibC.js +55 -0
- package/.output/public/assets/Modal-D33gNSgx.js +1 -0
- package/.output/public/assets/SignIn-SHuRRyOv.js +1 -0
- package/.output/public/assets/actionUi-ChGGALzg.js +1 -0
- package/.output/public/assets/app-DElSo_jy.css +2 -0
- package/.output/public/assets/artifactView-DFuubXLJ.js +66 -0
- package/.output/public/assets/index-DfpTWRSz.js +12 -0
- package/.output/public/assets/invite._token-DJtd-XE2.js +1 -0
- package/.output/public/assets/invite._token-T8oo4Qtw.js +1 -0
- package/.output/public/assets/jsx-runtime-BseJUIpC.js +1 -0
- package/.output/public/assets/lifecycleUi-DKkChdnU.js +1 -0
- package/.output/public/assets/loopApi-BM2nj71x.js +3 -0
- package/.output/public/assets/loops._loopId-B19Jw7jC.js +5 -0
- package/.output/public/assets/loops._loopId_.runs._runId-_CflHV38.js +3 -0
- package/.output/public/assets/notifyFns-DCubjpRy.js +1 -0
- package/.output/public/assets/preload-helper-CKUiEq3b.js +3 -0
- package/.output/public/assets/routes-B9tgli5f.js +1 -0
- package/.output/public/assets/routes-CTtlM_qt.js +1 -0
- package/.output/public/assets/t._teamId-Bm21mngW.js +1 -0
- package/.output/public/assets/t._teamId-gR7BVKkR.js +1 -0
- package/.output/public/assets/ui-Dp88qUWh.js +1 -0
- package/.output/public/assets/useRouter-DsjH8G0p.js +1 -0
- package/.output/public/favicon.svg +12 -0
- package/.output/public/fonts/GeistPixel-Square.woff2 +0 -0
- package/.output/server/_chunks/ssr-renderer.mjs +26 -0
- package/.output/server/_libs/@aws-crypto/crc32+[...].mjs +419 -0
- package/.output/server/_libs/@aws-sdk/checksums+[...].mjs +10732 -0
- package/.output/server/_libs/@aws-sdk/client-s3+[...].mjs +9475 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-http+[...].mjs +137 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-ini+[...].mjs +440 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-process+[...].mjs +62 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-sso+[...].mjs +818 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-web-identity+[...].mjs +59 -0
- package/.output/server/_libs/@base-ui/react+[...].mjs +11125 -0
- package/.output/server/_libs/@codemirror/autocomplete+[...].mjs +19713 -0
- package/.output/server/_libs/@codemirror/lang-css+[...].mjs +2636 -0
- package/.output/server/_libs/@codemirror/lang-html+[...].mjs +2247 -0
- package/.output/server/_libs/@codemirror/lang-json+[...].mjs +79 -0
- package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +1736 -0
- package/.output/server/_libs/@smithy/credential-provider-imds+[...].mjs +342 -0
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +14300 -0
- package/.output/server/_libs/@uiw/codemirror-extensions-basic-setup+[...].mjs +76 -0
- package/.output/server/_libs/atomic-sleep.mjs +27 -0
- package/.output/server/_libs/aws-crypto__crc32c.mjs +314 -0
- package/.output/server/_libs/aws-sdk__nested-clients.mjs +2671 -0
- package/.output/server/_libs/babel__runtime.mjs +30 -0
- package/.output/server/_libs/clsx.mjs +16 -0
- package/.output/server/_libs/codemirror__commands.mjs +1725 -0
- package/.output/server/_libs/codemirror__lint.mjs +565 -0
- package/.output/server/_libs/codemirror__search.mjs +1138 -0
- package/.output/server/_libs/codemirror__theme-one-dark.mjs +161 -0
- package/.output/server/_libs/colorette.mjs +129 -0
- package/.output/server/_libs/croner.mjs +735 -0
- package/.output/server/_libs/d3-array.mjs +231 -0
- package/.output/server/_libs/d3-color.mjs +330 -0
- package/.output/server/_libs/d3-format.mjs +252 -0
- package/.output/server/_libs/d3-interpolate.mjs +163 -0
- package/.output/server/_libs/d3-path.mjs +77 -0
- package/.output/server/_libs/d3-scale+[...].mjs +1907 -0
- package/.output/server/_libs/d3-shape.mjs +689 -0
- package/.output/server/_libs/dateformat.mjs +341 -0
- package/.output/server/_libs/decimal.js-light.mjs +884 -0
- package/.output/server/_libs/diff.mjs +732 -0
- package/.output/server/_libs/dom-serializer+[...].mjs +708 -0
- package/.output/server/_libs/domhandler.mjs +461 -0
- package/.output/server/_libs/dompurify.mjs +2111 -0
- package/.output/server/_libs/domutils.mjs +868 -0
- package/.output/server/_libs/drizzle-orm+postgres.mjs +7689 -0
- package/.output/server/_libs/electric-sql__pglite.mjs +14674 -0
- package/.output/server/_libs/end-of-stream+once+wrappy.mjs +145 -0
- package/.output/server/_libs/es-toolkit.mjs +1737 -0
- package/.output/server/_libs/eventemitter3.mjs +236 -0
- package/.output/server/_libs/fast-copy.mjs +285 -0
- package/.output/server/_libs/fast-safe-stringify.mjs +172 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +1201 -0
- package/.output/server/_libs/html-dom-parser+htmlparser2.mjs +1560 -0
- package/.output/server/_libs/html-react-parser+[...].mjs +1360 -0
- package/.output/server/_libs/initdb.wasm +0 -0
- package/.output/server/_libs/marked.mjs +1548 -0
- package/.output/server/_libs/on-exit-leak-free.mjs +80 -0
- package/.output/server/_libs/pglite.data +37667 -8
- package/.output/server/_libs/pglite.wasm +0 -0
- package/.output/server/_libs/pino+[...].mjs +3196 -0
- package/.output/server/_libs/pino-abstract-transport+split2.mjs +194 -0
- package/.output/server/_libs/pino-pretty+[...].mjs +1623 -0
- package/.output/server/_libs/pinojs__redact.mjs +280 -0
- package/.output/server/_libs/react-redux+[...].mjs +205 -0
- package/.output/server/_libs/recharts+victory-vendor.mjs +15875 -0
- package/.output/server/_libs/tanstack__history.mjs +342 -0
- package/.output/server/_libs/ufo.mjs +64 -0
- package/.output/server/_libs/uiw__codemirror-themes.mjs +32 -0
- package/.output/server/_libs/uiw__react-codemirror.mjs +354 -0
- package/.output/server/_runtime.mjs +37 -0
- package/.output/server/_ssr/CodeField-tm4rr6G3.mjs +143 -0
- package/.output/server/_ssr/DashboardView-CC7htv28.mjs +2795 -0
- package/.output/server/_ssr/LoopPlaybook-BXH8mhiX.mjs +2105 -0
- package/.output/server/_ssr/LoopView-DCugEbHx.mjs +1106 -0
- package/.output/server/_ssr/Modal-DpKZHLZK.mjs +49 -0
- package/.output/server/_ssr/SignIn-dTndU6Hw.mjs +67 -0
- package/.output/server/_ssr/actionUi-CZbEixbf.mjs +119 -0
- package/.output/server/_ssr/adapters-BS8XosjF.mjs +130 -0
- package/.output/server/_ssr/artifactFiles-Cagtj7J0.mjs +61 -0
- package/.output/server/_ssr/artifactKind-BW0isV8L.mjs +37 -0
- package/.output/server/_ssr/artifactView-DS4O22wl.mjs +304 -0
- package/.output/server/_ssr/artifacts-DngKyW2u.mjs +2 -0
- package/.output/server/_ssr/auth-DY1DuYZd.mjs +38429 -0
- package/.output/server/_ssr/boot-BbtG0ImW.mjs +9010 -0
- package/.output/server/_ssr/boot-CMHTxQpJ.mjs +2 -0
- package/.output/server/_ssr/bun-sqlite-dialect-BW9W1_Ps-CU1Spd6z.mjs +162 -0
- package/.output/server/_ssr/core-RrmWoKne.mjs +5 -0
- package/.output/server/_ssr/createServerRpc-BD8Xn_0_.mjs +12 -0
- package/.output/server/_ssr/d1-sqlite-dialect-BLC8LXE6-DfG7tB8s.mjs +112 -0
- package/.output/server/_ssr/db-DWAuZq1o.mjs +2 -0
- package/.output/server/_ssr/dist-BIxFFVZg.mjs +342 -0
- package/.output/server/_ssr/empty-plugin-adapters-DKUlnwwl.mjs +5 -0
- package/.output/server/_ssr/factory-Blq0DYfT.mjs +6903 -0
- package/.output/server/_ssr/invite._token-BRCo9LGB.mjs +36 -0
- package/.output/server/_ssr/invite._token-DJxGLILJ.mjs +28 -0
- package/.output/server/_ssr/invite._token-NewFt27g.mjs +92 -0
- package/.output/server/_ssr/kysely-adapter-D3XTe64J.mjs +2 -0
- package/.output/server/_ssr/kysely-migration-tables-JkVUjPF_-bPAX9LR_.mjs +19 -0
- package/.output/server/_ssr/lifecycleUi-C9lg1r3r.mjs +38 -0
- package/.output/server/_ssr/logger-Dw82jNjH.mjs +2 -0
- package/.output/server/_ssr/loopApi-BtfkZQYK.mjs +532 -0
- package/.output/server/_ssr/loopApi-Cxe8WyOB.mjs +105 -0
- package/.output/server/_ssr/loops._loopId-7NQJPB9W.mjs +30 -0
- package/.output/server/_ssr/loops._loopId-DhnArGdL.mjs +1635 -0
- package/.output/server/_ssr/loops._loopId_.runs._runId-Bvuo2nki.mjs +29 -0
- package/.output/server/_ssr/loops._loopId_.runs._runId-Dip5Xk-q.mjs +674 -0
- package/.output/server/_ssr/machineFns-Dvr5ICUy.mjs +266 -0
- package/.output/server/_ssr/node-sqlite-dialect-DhyOpJTX.mjs +162 -0
- package/.output/server/_ssr/notifyFns-BcMRY5kP.mjs +118 -0
- package/.output/server/_ssr/notifyFns-Q458pZmE.mjs +580 -0
- package/.output/server/_ssr/router-J8KZ30xw.mjs +678 -0
- package/.output/server/_ssr/routes-Bcs4T1ox.mjs +28 -0
- package/.output/server/_ssr/routes-BoGrcf-b.mjs +43 -0
- package/.output/server/_ssr/routes-D4am3Zff.mjs +28 -0
- package/.output/server/_ssr/runDiff-CpEFqo7G.mjs +113 -0
- package/.output/server/_ssr/ssr.mjs +5837 -0
- package/.output/server/_ssr/start-4ifArtKx.mjs +4 -0
- package/.output/server/_ssr/store-b3JcQ08F.mjs +2 -0
- package/.output/server/_ssr/t._teamId-CeUhzgzT.mjs +32 -0
- package/.output/server/_ssr/t._teamId-DR-hQK7o.mjs +47 -0
- package/.output/server/_ssr/t._teamId-Dy_McbRt.mjs +31 -0
- package/.output/server/_ssr/teamCookie-B7hLOIie.mjs +10 -0
- package/.output/server/_ssr/teamFns-BIDnsg2A.mjs +473 -0
- package/.output/server/_ssr/teamFns-DA4ovI5g.mjs +33 -0
- package/.output/server/_ssr/tokens-ytd60FUt.mjs +2 -0
- package/.output/server/_ssr/ui-Dej2qjuS.mjs +267 -0
- package/.output/server/_tanstack-start-manifest_v-CVS6c7re.mjs +95 -0
- package/.output/server/drizzle/0000_round_marauders.sql +193 -0
- package/.output/server/drizzle/0001_naive_silver_fox.sql +25 -0
- package/.output/server/drizzle/0002_funny_sage.sql +12 -0
- package/.output/server/drizzle/0003_optimal_slapstick.sql +102 -0
- package/.output/server/drizzle/0004_remove_grok_agent.sql +5 -0
- package/.output/server/drizzle/0005_heavy_gauntlet.sql +8 -0
- package/.output/server/drizzle/0006_tranquil_sharon_carter.sql +1 -0
- package/.output/server/drizzle/0007_faulty_starbolt.sql +30 -0
- package/.output/server/drizzle/0008_durable_lifecycle_evidence.sql +15 -0
- package/.output/server/drizzle/meta/0000_snapshot.json +1333 -0
- package/.output/server/drizzle/meta/0001_snapshot.json +1498 -0
- package/.output/server/drizzle/meta/0002_snapshot.json +1576 -0
- package/.output/server/drizzle/meta/0003_snapshot.json +1666 -0
- package/.output/server/drizzle/meta/0005_snapshot.json +1666 -0
- package/.output/server/drizzle/meta/0006_snapshot.json +1672 -0
- package/.output/server/drizzle/meta/0007_snapshot.json +1787 -0
- package/.output/server/drizzle/meta/_journal.json +69 -0
- package/.output/server/index.mjs +464 -0
- package/.output/server/node_modules/tslib/modules/index.js +70 -0
- package/.output/server/node_modules/tslib/modules/package.json +3 -0
- package/.output/server/node_modules/tslib/package.json +47 -0
- package/.output/server/node_modules/tslib/tslib.js +484 -0
- package/.output/server/package.json +9 -0
- package/LICENSE +21 -0
- package/drizzle/0000_round_marauders.sql +193 -0
- package/drizzle/0001_naive_silver_fox.sql +25 -0
- package/drizzle/0002_funny_sage.sql +12 -0
- package/drizzle/0003_optimal_slapstick.sql +102 -0
- package/drizzle/0004_remove_grok_agent.sql +5 -0
- package/drizzle/0005_heavy_gauntlet.sql +8 -0
- package/drizzle/0006_tranquil_sharon_carter.sql +1 -0
- package/drizzle/0007_faulty_starbolt.sql +30 -0
- package/drizzle/0008_durable_lifecycle_evidence.sql +15 -0
- package/drizzle/meta/0000_snapshot.json +1333 -0
- package/drizzle/meta/0001_snapshot.json +1498 -0
- package/drizzle/meta/0002_snapshot.json +1576 -0
- package/drizzle/meta/0003_snapshot.json +1666 -0
- package/drizzle/meta/0005_snapshot.json +1666 -0
- package/drizzle/meta/0006_snapshot.json +1672 -0
- package/drizzle/meta/0007_snapshot.json +1787 -0
- package/drizzle/meta/_journal.json +69 -0
- package/package.json +84 -0
- package/scripts/pievo-server.mjs +390 -0
- package/scripts/prestart.mjs +66 -0
- package/scripts/server-cli-lib.mjs +451 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { o as __toESM, t as __commonJSMin } from "../_runtime.mjs";
|
|
2
|
+
var eventemitter3_default = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3
|
+
var has = Object.prototype.hasOwnProperty, prefix = "~";
|
|
4
|
+
/**
|
|
5
|
+
* Constructor to create a storage for our `EE` objects.
|
|
6
|
+
* An `Events` instance is a plain object whose properties are event names.
|
|
7
|
+
*
|
|
8
|
+
* @constructor
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
function Events() {}
|
|
12
|
+
if (Object.create) {
|
|
13
|
+
Events.prototype = Object.create(null);
|
|
14
|
+
if (!new Events().__proto__) prefix = false;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Representation of a single event listener.
|
|
18
|
+
*
|
|
19
|
+
* @param {Function} fn The listener function.
|
|
20
|
+
* @param {*} context The context to invoke the listener with.
|
|
21
|
+
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
22
|
+
* @constructor
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
function EE(fn, context, once) {
|
|
26
|
+
this.fn = fn;
|
|
27
|
+
this.context = context;
|
|
28
|
+
this.once = once || false;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Add a listener for a given event.
|
|
32
|
+
*
|
|
33
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
34
|
+
* @param {(String|Symbol)} event The event name.
|
|
35
|
+
* @param {Function} fn The listener function.
|
|
36
|
+
* @param {*} context The context to invoke the listener with.
|
|
37
|
+
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
38
|
+
* @returns {EventEmitter}
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
function addListener(emitter, event, fn, context, once) {
|
|
42
|
+
if (typeof fn !== "function") throw new TypeError("The listener must be a function");
|
|
43
|
+
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
44
|
+
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
45
|
+
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
46
|
+
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
47
|
+
return emitter;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Clear event by name.
|
|
51
|
+
*
|
|
52
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
53
|
+
* @param {(String|Symbol)} evt The Event name.
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
function clearEvent(emitter, evt) {
|
|
57
|
+
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
58
|
+
else delete emitter._events[evt];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
62
|
+
* `EventEmitter` interface.
|
|
63
|
+
*
|
|
64
|
+
* @constructor
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
function EventEmitter() {
|
|
68
|
+
this._events = new Events();
|
|
69
|
+
this._eventsCount = 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Return an array listing the events for which the emitter has registered
|
|
73
|
+
* listeners.
|
|
74
|
+
*
|
|
75
|
+
* @returns {Array}
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
79
|
+
var names = [], events, name;
|
|
80
|
+
if (this._eventsCount === 0) return names;
|
|
81
|
+
for (name in events = this._events) if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
82
|
+
if (Object.getOwnPropertySymbols) return names.concat(Object.getOwnPropertySymbols(events));
|
|
83
|
+
return names;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Return the listeners registered for a given event.
|
|
87
|
+
*
|
|
88
|
+
* @param {(String|Symbol)} event The event name.
|
|
89
|
+
* @returns {Array} The registered listeners.
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
EventEmitter.prototype.listeners = function listeners(event) {
|
|
93
|
+
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
94
|
+
if (!handlers) return [];
|
|
95
|
+
if (handlers.fn) return [handlers.fn];
|
|
96
|
+
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) ee[i] = handlers[i].fn;
|
|
97
|
+
return ee;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Return the number of listeners listening to a given event.
|
|
101
|
+
*
|
|
102
|
+
* @param {(String|Symbol)} event The event name.
|
|
103
|
+
* @returns {Number} The number of listeners.
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
107
|
+
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
108
|
+
if (!listeners) return 0;
|
|
109
|
+
if (listeners.fn) return 1;
|
|
110
|
+
return listeners.length;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Calls each of the listeners registered for a given event.
|
|
114
|
+
*
|
|
115
|
+
* @param {(String|Symbol)} event The event name.
|
|
116
|
+
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
120
|
+
var evt = prefix ? prefix + event : event;
|
|
121
|
+
if (!this._events[evt]) return false;
|
|
122
|
+
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
123
|
+
if (listeners.fn) {
|
|
124
|
+
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
|
|
125
|
+
switch (len) {
|
|
126
|
+
case 1: return listeners.fn.call(listeners.context), true;
|
|
127
|
+
case 2: return listeners.fn.call(listeners.context, a1), true;
|
|
128
|
+
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
|
129
|
+
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
130
|
+
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
131
|
+
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
132
|
+
}
|
|
133
|
+
for (i = 1, args = new Array(len - 1); i < len; i++) args[i - 1] = arguments[i];
|
|
134
|
+
listeners.fn.apply(listeners.context, args);
|
|
135
|
+
} else {
|
|
136
|
+
var length = listeners.length, j;
|
|
137
|
+
for (i = 0; i < length; i++) {
|
|
138
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
|
|
139
|
+
switch (len) {
|
|
140
|
+
case 1:
|
|
141
|
+
listeners[i].fn.call(listeners[i].context);
|
|
142
|
+
break;
|
|
143
|
+
case 2:
|
|
144
|
+
listeners[i].fn.call(listeners[i].context, a1);
|
|
145
|
+
break;
|
|
146
|
+
case 3:
|
|
147
|
+
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
148
|
+
break;
|
|
149
|
+
case 4:
|
|
150
|
+
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
151
|
+
break;
|
|
152
|
+
default:
|
|
153
|
+
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) args[j - 1] = arguments[j];
|
|
154
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Add a listener for a given event.
|
|
162
|
+
*
|
|
163
|
+
* @param {(String|Symbol)} event The event name.
|
|
164
|
+
* @param {Function} fn The listener function.
|
|
165
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
166
|
+
* @returns {EventEmitter} `this`.
|
|
167
|
+
* @public
|
|
168
|
+
*/
|
|
169
|
+
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
170
|
+
return addListener(this, event, fn, context, false);
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Add a one-time listener for a given event.
|
|
174
|
+
*
|
|
175
|
+
* @param {(String|Symbol)} event The event name.
|
|
176
|
+
* @param {Function} fn The listener function.
|
|
177
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
178
|
+
* @returns {EventEmitter} `this`.
|
|
179
|
+
* @public
|
|
180
|
+
*/
|
|
181
|
+
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
182
|
+
return addListener(this, event, fn, context, true);
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Remove the listeners of a given event.
|
|
186
|
+
*
|
|
187
|
+
* @param {(String|Symbol)} event The event name.
|
|
188
|
+
* @param {Function} fn Only remove the listeners that match this function.
|
|
189
|
+
* @param {*} context Only remove the listeners that have this context.
|
|
190
|
+
* @param {Boolean} once Only remove one-time listeners.
|
|
191
|
+
* @returns {EventEmitter} `this`.
|
|
192
|
+
* @public
|
|
193
|
+
*/
|
|
194
|
+
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
195
|
+
var evt = prefix ? prefix + event : event;
|
|
196
|
+
if (!this._events[evt]) return this;
|
|
197
|
+
if (!fn) {
|
|
198
|
+
clearEvent(this, evt);
|
|
199
|
+
return this;
|
|
200
|
+
}
|
|
201
|
+
var listeners = this._events[evt];
|
|
202
|
+
if (listeners.fn) {
|
|
203
|
+
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) clearEvent(this, evt);
|
|
204
|
+
} else {
|
|
205
|
+
for (var i = 0, events = [], length = listeners.length; i < length; i++) if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) events.push(listeners[i]);
|
|
206
|
+
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
207
|
+
else clearEvent(this, evt);
|
|
208
|
+
}
|
|
209
|
+
return this;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Remove all listeners, or those of the specified event.
|
|
213
|
+
*
|
|
214
|
+
* @param {(String|Symbol)} [event] The event name.
|
|
215
|
+
* @returns {EventEmitter} `this`.
|
|
216
|
+
* @public
|
|
217
|
+
*/
|
|
218
|
+
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
219
|
+
var evt;
|
|
220
|
+
if (event) {
|
|
221
|
+
evt = prefix ? prefix + event : event;
|
|
222
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
223
|
+
} else {
|
|
224
|
+
this._events = new Events();
|
|
225
|
+
this._eventsCount = 0;
|
|
226
|
+
}
|
|
227
|
+
return this;
|
|
228
|
+
};
|
|
229
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
230
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
231
|
+
EventEmitter.prefixed = prefix;
|
|
232
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
233
|
+
if ("undefined" !== typeof module) module.exports = EventEmitter;
|
|
234
|
+
})))(), 1)).default;
|
|
235
|
+
//#endregion
|
|
236
|
+
export { eventemitter3_default as t };
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { t as __commonJSMin } from "../_runtime.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/fast-copy@4.0.3/node_modules/fast-copy/dist/cjs/index.cjs
|
|
3
|
+
var require_cjs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4
|
+
var toStringFunction = Function.prototype.toString;
|
|
5
|
+
var toStringObject = Object.prototype.toString;
|
|
6
|
+
/**
|
|
7
|
+
* Get an empty version of the object with the same prototype it has.
|
|
8
|
+
*/
|
|
9
|
+
function getCleanClone(prototype) {
|
|
10
|
+
if (!prototype) return Object.create(null);
|
|
11
|
+
const Constructor = prototype.constructor;
|
|
12
|
+
if (Constructor === Object) return prototype === Object.prototype ? {} : Object.create(prototype);
|
|
13
|
+
if (Constructor && ~toStringFunction.call(Constructor).indexOf("[native code]")) try {
|
|
14
|
+
return new Constructor();
|
|
15
|
+
} catch (_a) {}
|
|
16
|
+
return Object.create(prototype);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get the tag of the value passed, so that the correct copier can be used.
|
|
20
|
+
*/
|
|
21
|
+
function getTag(value) {
|
|
22
|
+
const stringTag = value[Symbol.toStringTag];
|
|
23
|
+
if (stringTag) return stringTag;
|
|
24
|
+
const type = toStringObject.call(value);
|
|
25
|
+
return type.substring(8, type.length - 1);
|
|
26
|
+
}
|
|
27
|
+
var { hasOwnProperty, propertyIsEnumerable } = Object.prototype;
|
|
28
|
+
function copyOwnDescriptor(original, clone, property, state) {
|
|
29
|
+
const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {
|
|
30
|
+
configurable: true,
|
|
31
|
+
enumerable: true,
|
|
32
|
+
value: original[property],
|
|
33
|
+
writable: true
|
|
34
|
+
};
|
|
35
|
+
const descriptor = ownDescriptor.get || ownDescriptor.set ? ownDescriptor : {
|
|
36
|
+
configurable: ownDescriptor.configurable,
|
|
37
|
+
enumerable: ownDescriptor.enumerable,
|
|
38
|
+
value: state.copier(ownDescriptor.value, state),
|
|
39
|
+
writable: ownDescriptor.writable
|
|
40
|
+
};
|
|
41
|
+
try {
|
|
42
|
+
Object.defineProperty(clone, property, descriptor);
|
|
43
|
+
} catch (_a) {
|
|
44
|
+
clone[property] = descriptor.get ? descriptor.get() : descriptor.value;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Striclty copy all properties contained on the object.
|
|
49
|
+
*/
|
|
50
|
+
function copyOwnPropertiesStrict(value, clone, state) {
|
|
51
|
+
const names = Object.getOwnPropertyNames(value);
|
|
52
|
+
for (let index = 0; index < names.length; ++index) copyOwnDescriptor(value, clone, names[index], state);
|
|
53
|
+
const symbols = Object.getOwnPropertySymbols(value);
|
|
54
|
+
for (let index = 0; index < symbols.length; ++index) copyOwnDescriptor(value, clone, symbols[index], state);
|
|
55
|
+
return clone;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Deeply copy the indexed values in the array.
|
|
59
|
+
*/
|
|
60
|
+
function copyArrayLoose(array, state) {
|
|
61
|
+
const clone = new state.Constructor();
|
|
62
|
+
state.cache.set(array, clone);
|
|
63
|
+
for (let index = 0; index < array.length; ++index) clone[index] = state.copier(array[index], state);
|
|
64
|
+
return clone;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Deeply copy the indexed values in the array, as well as any custom properties.
|
|
68
|
+
*/
|
|
69
|
+
function copyArrayStrict(array, state) {
|
|
70
|
+
const clone = new state.Constructor();
|
|
71
|
+
state.cache.set(array, clone);
|
|
72
|
+
return copyOwnPropertiesStrict(array, clone, state);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Copy the contents of the ArrayBuffer.
|
|
76
|
+
*/
|
|
77
|
+
function copyArrayBuffer(arrayBuffer, _state) {
|
|
78
|
+
return arrayBuffer.slice(0);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Create a new Blob with the contents of the original.
|
|
82
|
+
*/
|
|
83
|
+
function copyBlob(blob, _state) {
|
|
84
|
+
return blob.slice(0, blob.size, blob.type);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Create a new DataView with the contents of the original.
|
|
88
|
+
*/
|
|
89
|
+
function copyDataView(dataView, state) {
|
|
90
|
+
return new state.Constructor(copyArrayBuffer(dataView.buffer));
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Create a new Date based on the time of the original.
|
|
94
|
+
*/
|
|
95
|
+
function copyDate(date, state) {
|
|
96
|
+
return new state.Constructor(date.getTime());
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Deeply copy the keys and values of the original.
|
|
100
|
+
*/
|
|
101
|
+
function copyMapLoose(map, state) {
|
|
102
|
+
const clone = new state.Constructor();
|
|
103
|
+
state.cache.set(map, clone);
|
|
104
|
+
map.forEach((value, key) => {
|
|
105
|
+
clone.set(key, state.copier(value, state));
|
|
106
|
+
});
|
|
107
|
+
return clone;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Deeply copy the keys and values of the original, as well as any custom properties.
|
|
111
|
+
*/
|
|
112
|
+
function copyMapStrict(map, state) {
|
|
113
|
+
return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Deeply copy the properties (keys and symbols) and values of the original.
|
|
117
|
+
*/
|
|
118
|
+
function copyObjectLoose(object, state) {
|
|
119
|
+
const clone = getCleanClone(state.prototype);
|
|
120
|
+
state.cache.set(object, clone);
|
|
121
|
+
for (const key in object) if (hasOwnProperty.call(object, key)) clone[key] = state.copier(object[key], state);
|
|
122
|
+
const symbols = Object.getOwnPropertySymbols(object);
|
|
123
|
+
for (let index = 0; index < symbols.length; ++index) {
|
|
124
|
+
const symbol = symbols[index];
|
|
125
|
+
if (propertyIsEnumerable.call(object, symbol)) clone[symbol] = state.copier(object[symbol], state);
|
|
126
|
+
}
|
|
127
|
+
return clone;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Deeply copy the properties (keys and symbols) and values of the original, as well
|
|
131
|
+
* as any hidden or non-enumerable properties.
|
|
132
|
+
*/
|
|
133
|
+
function copyObjectStrict(object, state) {
|
|
134
|
+
const clone = getCleanClone(state.prototype);
|
|
135
|
+
state.cache.set(object, clone);
|
|
136
|
+
return copyOwnPropertiesStrict(object, clone, state);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Create a new primitive wrapper from the value of the original.
|
|
140
|
+
*/
|
|
141
|
+
function copyPrimitiveWrapper(primitiveObject, state) {
|
|
142
|
+
return new state.Constructor(primitiveObject.valueOf());
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Create a new RegExp based on the value and flags of the original.
|
|
146
|
+
*/
|
|
147
|
+
function copyRegExp(regExp, state) {
|
|
148
|
+
const clone = new state.Constructor(regExp.source, regExp.flags);
|
|
149
|
+
clone.lastIndex = regExp.lastIndex;
|
|
150
|
+
return clone;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Return the original value (an identity function).
|
|
154
|
+
*
|
|
155
|
+
* @note
|
|
156
|
+
* THis is used for objects that cannot be copied, such as WeakMap.
|
|
157
|
+
*/
|
|
158
|
+
function copySelf(value, _state) {
|
|
159
|
+
return value;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Deeply copy the values of the original.
|
|
163
|
+
*/
|
|
164
|
+
function copySetLoose(set, state) {
|
|
165
|
+
const clone = new state.Constructor();
|
|
166
|
+
state.cache.set(set, clone);
|
|
167
|
+
set.forEach((value) => {
|
|
168
|
+
clone.add(state.copier(value, state));
|
|
169
|
+
});
|
|
170
|
+
return clone;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Deeply copy the values of the original, as well as any custom properties.
|
|
174
|
+
*/
|
|
175
|
+
function copySetStrict(set, state) {
|
|
176
|
+
return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);
|
|
177
|
+
}
|
|
178
|
+
function createDefaultCache() {
|
|
179
|
+
return /* @__PURE__ */ new WeakMap();
|
|
180
|
+
}
|
|
181
|
+
function getOptions({ createCache: createCacheOverride, methods: methodsOverride, strict }) {
|
|
182
|
+
const defaultMethods = {
|
|
183
|
+
array: strict ? copyArrayStrict : copyArrayLoose,
|
|
184
|
+
arrayBuffer: copyArrayBuffer,
|
|
185
|
+
asyncGenerator: copySelf,
|
|
186
|
+
blob: copyBlob,
|
|
187
|
+
dataView: copyDataView,
|
|
188
|
+
date: copyDate,
|
|
189
|
+
error: copySelf,
|
|
190
|
+
generator: copySelf,
|
|
191
|
+
map: strict ? copyMapStrict : copyMapLoose,
|
|
192
|
+
object: strict ? copyObjectStrict : copyObjectLoose,
|
|
193
|
+
regExp: copyRegExp,
|
|
194
|
+
set: strict ? copySetStrict : copySetLoose
|
|
195
|
+
};
|
|
196
|
+
const methods = methodsOverride ? Object.assign(defaultMethods, methodsOverride) : defaultMethods;
|
|
197
|
+
const copiers = getTagSpecificCopiers(methods);
|
|
198
|
+
const createCache = createCacheOverride || createDefaultCache;
|
|
199
|
+
if (!copiers.Object || !copiers.Array) throw new Error("An object and array copier must be provided.");
|
|
200
|
+
return {
|
|
201
|
+
createCache,
|
|
202
|
+
copiers,
|
|
203
|
+
methods,
|
|
204
|
+
strict: Boolean(strict)
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Get the copiers used for each specific object tag.
|
|
209
|
+
*/
|
|
210
|
+
function getTagSpecificCopiers(methods) {
|
|
211
|
+
return {
|
|
212
|
+
Arguments: methods.object,
|
|
213
|
+
Array: methods.array,
|
|
214
|
+
ArrayBuffer: methods.arrayBuffer,
|
|
215
|
+
AsyncGenerator: methods.asyncGenerator,
|
|
216
|
+
BigInt64Array: methods.arrayBuffer,
|
|
217
|
+
BigUint64Array: methods.arrayBuffer,
|
|
218
|
+
Blob: methods.blob,
|
|
219
|
+
Boolean: copyPrimitiveWrapper,
|
|
220
|
+
DataView: methods.dataView,
|
|
221
|
+
Date: methods.date,
|
|
222
|
+
Error: methods.error,
|
|
223
|
+
Float32Array: methods.arrayBuffer,
|
|
224
|
+
Float64Array: methods.arrayBuffer,
|
|
225
|
+
Generator: methods.generator,
|
|
226
|
+
Int8Array: methods.arrayBuffer,
|
|
227
|
+
Int16Array: methods.arrayBuffer,
|
|
228
|
+
Int32Array: methods.arrayBuffer,
|
|
229
|
+
Map: methods.map,
|
|
230
|
+
Number: copyPrimitiveWrapper,
|
|
231
|
+
Object: methods.object,
|
|
232
|
+
Promise: copySelf,
|
|
233
|
+
RegExp: methods.regExp,
|
|
234
|
+
Set: methods.set,
|
|
235
|
+
String: copyPrimitiveWrapper,
|
|
236
|
+
WeakMap: copySelf,
|
|
237
|
+
WeakSet: copySelf,
|
|
238
|
+
Uint8Array: methods.arrayBuffer,
|
|
239
|
+
Uint8ClampedArray: methods.arrayBuffer,
|
|
240
|
+
Uint16Array: methods.arrayBuffer,
|
|
241
|
+
Uint32Array: methods.arrayBuffer
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Create a custom copier based on custom options for any of the following:
|
|
246
|
+
* - `createCache` method to create a cache for copied objects
|
|
247
|
+
* - custom copier `methods` for specific object types
|
|
248
|
+
* - `strict` mode to copy all properties with their descriptors
|
|
249
|
+
*/
|
|
250
|
+
function createCopier(options = {}) {
|
|
251
|
+
const { createCache, copiers } = getOptions(options);
|
|
252
|
+
const { Array: copyArray, Object: copyObject } = copiers;
|
|
253
|
+
function copier(value, state) {
|
|
254
|
+
state.prototype = state.Constructor = void 0;
|
|
255
|
+
if (!value || typeof value !== "object") return value;
|
|
256
|
+
if (state.cache.has(value)) return state.cache.get(value);
|
|
257
|
+
state.prototype = Object.getPrototypeOf(value);
|
|
258
|
+
state.Constructor = state.prototype && state.prototype.constructor;
|
|
259
|
+
if (!state.Constructor || state.Constructor === Object) return copyObject(value, state);
|
|
260
|
+
if (Array.isArray(value)) return copyArray(value, state);
|
|
261
|
+
const tagSpecificCopier = copiers[getTag(value)];
|
|
262
|
+
if (tagSpecificCopier) return tagSpecificCopier(value, state);
|
|
263
|
+
return typeof value.then === "function" ? value : copyObject(value, state);
|
|
264
|
+
}
|
|
265
|
+
return function copy(value) {
|
|
266
|
+
return copier(value, {
|
|
267
|
+
Constructor: void 0,
|
|
268
|
+
cache: createCache(),
|
|
269
|
+
copier,
|
|
270
|
+
prototype: void 0
|
|
271
|
+
});
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Copy an value deeply as much as possible, where strict recreation of object properties
|
|
276
|
+
* are maintained. All properties (including non-enumerable ones) are copied with their
|
|
277
|
+
* original property descriptors on both objects and arrays.
|
|
278
|
+
*/
|
|
279
|
+
var copyStrict = createCopier({ strict: true });
|
|
280
|
+
exports.copy = createCopier();
|
|
281
|
+
exports.copyStrict = copyStrict;
|
|
282
|
+
exports.createCopier = createCopier;
|
|
283
|
+
}));
|
|
284
|
+
//#endregion
|
|
285
|
+
export { require_cjs as t };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { t as __commonJSMin } from "../_runtime.mjs";
|
|
2
|
+
//#region ../../node_modules/.pnpm/fast-safe-stringify@2.1.1/node_modules/fast-safe-stringify/index.js
|
|
3
|
+
var require_fast_safe_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4
|
+
module.exports = stringify;
|
|
5
|
+
stringify.default = stringify;
|
|
6
|
+
stringify.stable = deterministicStringify;
|
|
7
|
+
stringify.stableStringify = deterministicStringify;
|
|
8
|
+
var LIMIT_REPLACE_NODE = "[...]";
|
|
9
|
+
var CIRCULAR_REPLACE_NODE = "[Circular]";
|
|
10
|
+
var arr = [];
|
|
11
|
+
var replacerStack = [];
|
|
12
|
+
function defaultOptions() {
|
|
13
|
+
return {
|
|
14
|
+
depthLimit: Number.MAX_SAFE_INTEGER,
|
|
15
|
+
edgesLimit: Number.MAX_SAFE_INTEGER
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function stringify(obj, replacer, spacer, options) {
|
|
19
|
+
if (typeof options === "undefined") options = defaultOptions();
|
|
20
|
+
decirc(obj, "", 0, [], void 0, 0, options);
|
|
21
|
+
var res;
|
|
22
|
+
try {
|
|
23
|
+
if (replacerStack.length === 0) res = JSON.stringify(obj, replacer, spacer);
|
|
24
|
+
else res = JSON.stringify(obj, replaceGetterValues(replacer), spacer);
|
|
25
|
+
} catch (_) {
|
|
26
|
+
return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
|
|
27
|
+
} finally {
|
|
28
|
+
while (arr.length !== 0) {
|
|
29
|
+
var part = arr.pop();
|
|
30
|
+
if (part.length === 4) Object.defineProperty(part[0], part[1], part[3]);
|
|
31
|
+
else part[0][part[1]] = part[2];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return res;
|
|
35
|
+
}
|
|
36
|
+
function setReplace(replace, val, k, parent) {
|
|
37
|
+
var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
|
|
38
|
+
if (propertyDescriptor.get !== void 0) if (propertyDescriptor.configurable) {
|
|
39
|
+
Object.defineProperty(parent, k, { value: replace });
|
|
40
|
+
arr.push([
|
|
41
|
+
parent,
|
|
42
|
+
k,
|
|
43
|
+
val,
|
|
44
|
+
propertyDescriptor
|
|
45
|
+
]);
|
|
46
|
+
} else replacerStack.push([
|
|
47
|
+
val,
|
|
48
|
+
k,
|
|
49
|
+
replace
|
|
50
|
+
]);
|
|
51
|
+
else {
|
|
52
|
+
parent[k] = replace;
|
|
53
|
+
arr.push([
|
|
54
|
+
parent,
|
|
55
|
+
k,
|
|
56
|
+
val
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function decirc(val, k, edgeIndex, stack, parent, depth, options) {
|
|
61
|
+
depth += 1;
|
|
62
|
+
var i;
|
|
63
|
+
if (typeof val === "object" && val !== null) {
|
|
64
|
+
for (i = 0; i < stack.length; i++) if (stack[i] === val) {
|
|
65
|
+
setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (typeof options.depthLimit !== "undefined" && depth > options.depthLimit) {
|
|
69
|
+
setReplace(LIMIT_REPLACE_NODE, val, k, parent);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (typeof options.edgesLimit !== "undefined" && edgeIndex + 1 > options.edgesLimit) {
|
|
73
|
+
setReplace(LIMIT_REPLACE_NODE, val, k, parent);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
stack.push(val);
|
|
77
|
+
if (Array.isArray(val)) for (i = 0; i < val.length; i++) decirc(val[i], i, i, stack, val, depth, options);
|
|
78
|
+
else {
|
|
79
|
+
var keys = Object.keys(val);
|
|
80
|
+
for (i = 0; i < keys.length; i++) {
|
|
81
|
+
var key = keys[i];
|
|
82
|
+
decirc(val[key], key, i, stack, val, depth, options);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
stack.pop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function compareFunction(a, b) {
|
|
89
|
+
if (a < b) return -1;
|
|
90
|
+
if (a > b) return 1;
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
function deterministicStringify(obj, replacer, spacer, options) {
|
|
94
|
+
if (typeof options === "undefined") options = defaultOptions();
|
|
95
|
+
var tmp = deterministicDecirc(obj, "", 0, [], void 0, 0, options) || obj;
|
|
96
|
+
var res;
|
|
97
|
+
try {
|
|
98
|
+
if (replacerStack.length === 0) res = JSON.stringify(tmp, replacer, spacer);
|
|
99
|
+
else res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer);
|
|
100
|
+
} catch (_) {
|
|
101
|
+
return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]");
|
|
102
|
+
} finally {
|
|
103
|
+
while (arr.length !== 0) {
|
|
104
|
+
var part = arr.pop();
|
|
105
|
+
if (part.length === 4) Object.defineProperty(part[0], part[1], part[3]);
|
|
106
|
+
else part[0][part[1]] = part[2];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return res;
|
|
110
|
+
}
|
|
111
|
+
function deterministicDecirc(val, k, edgeIndex, stack, parent, depth, options) {
|
|
112
|
+
depth += 1;
|
|
113
|
+
var i;
|
|
114
|
+
if (typeof val === "object" && val !== null) {
|
|
115
|
+
for (i = 0; i < stack.length; i++) if (stack[i] === val) {
|
|
116
|
+
setReplace(CIRCULAR_REPLACE_NODE, val, k, parent);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
if (typeof val.toJSON === "function") return;
|
|
121
|
+
} catch (_) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (typeof options.depthLimit !== "undefined" && depth > options.depthLimit) {
|
|
125
|
+
setReplace(LIMIT_REPLACE_NODE, val, k, parent);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (typeof options.edgesLimit !== "undefined" && edgeIndex + 1 > options.edgesLimit) {
|
|
129
|
+
setReplace(LIMIT_REPLACE_NODE, val, k, parent);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
stack.push(val);
|
|
133
|
+
if (Array.isArray(val)) for (i = 0; i < val.length; i++) deterministicDecirc(val[i], i, i, stack, val, depth, options);
|
|
134
|
+
else {
|
|
135
|
+
var tmp = {};
|
|
136
|
+
var keys = Object.keys(val).sort(compareFunction);
|
|
137
|
+
for (i = 0; i < keys.length; i++) {
|
|
138
|
+
var key = keys[i];
|
|
139
|
+
deterministicDecirc(val[key], key, i, stack, val, depth, options);
|
|
140
|
+
tmp[key] = val[key];
|
|
141
|
+
}
|
|
142
|
+
if (typeof parent !== "undefined") {
|
|
143
|
+
arr.push([
|
|
144
|
+
parent,
|
|
145
|
+
k,
|
|
146
|
+
val
|
|
147
|
+
]);
|
|
148
|
+
parent[k] = tmp;
|
|
149
|
+
} else return tmp;
|
|
150
|
+
}
|
|
151
|
+
stack.pop();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function replaceGetterValues(replacer) {
|
|
155
|
+
replacer = typeof replacer !== "undefined" ? replacer : function(k, v) {
|
|
156
|
+
return v;
|
|
157
|
+
};
|
|
158
|
+
return function(key, val) {
|
|
159
|
+
if (replacerStack.length > 0) for (var i = 0; i < replacerStack.length; i++) {
|
|
160
|
+
var part = replacerStack[i];
|
|
161
|
+
if (part[1] === key && part[0] === val) {
|
|
162
|
+
val = part[2];
|
|
163
|
+
replacerStack.splice(i, 1);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return replacer.call(this, key, val);
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}));
|
|
171
|
+
//#endregion
|
|
172
|
+
export { require_fast_safe_stringify as t };
|