@livequery/react 2.0.92 → 2.0.93

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/index.js CHANGED
@@ -1,4120 +1,30 @@
1
- var __create = Object.create;
2
- var __getProtoOf = Object.getPrototypeOf;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- function __accessProp(key) {
7
- return this[key];
8
- }
9
- var __toESMCache_node;
10
- var __toESMCache_esm;
11
- var __toESM = (mod, isNodeMode, target) => {
12
- var canCache = mod != null && typeof mod === "object";
13
- if (canCache) {
14
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
15
- var cached = cache.get(mod);
16
- if (cached)
17
- return cached;
18
- }
19
- target = mod != null ? __create(__getProtoOf(mod)) : {};
20
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
21
- for (let key of __getOwnPropNames(mod))
22
- if (!__hasOwnProp.call(to, key))
23
- __defProp(to, key, {
24
- get: __accessProp.bind(mod, key),
25
- enumerable: true
26
- });
27
- if (canCache)
28
- cache.set(mod, to);
29
- return to;
30
- };
31
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
32
-
33
- // node_modules/react/cjs/react.development.js
34
- var require_react_development = __commonJS((exports, module) => {
35
- (function() {
36
- function defineDeprecationWarning(methodName, info) {
37
- Object.defineProperty(Component.prototype, methodName, {
38
- get: function() {
39
- console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
40
- }
41
- });
42
- }
43
- function getIteratorFn(maybeIterable) {
44
- if (maybeIterable === null || typeof maybeIterable !== "object")
45
- return null;
46
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
47
- return typeof maybeIterable === "function" ? maybeIterable : null;
48
- }
49
- function warnNoop(publicInstance, callerName) {
50
- publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
51
- var warningKey = publicInstance + "." + callerName;
52
- didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, publicInstance), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
53
- }
54
- function Component(props, context, updater) {
55
- this.props = props;
56
- this.context = context;
57
- this.refs = emptyObject;
58
- this.updater = updater || ReactNoopUpdateQueue;
59
- }
60
- function ComponentDummy() {}
61
- function PureComponent(props, context, updater) {
62
- this.props = props;
63
- this.context = context;
64
- this.refs = emptyObject;
65
- this.updater = updater || ReactNoopUpdateQueue;
66
- }
67
- function noop() {}
68
- function testStringCoercion(value) {
69
- return "" + value;
70
- }
71
- function checkKeyStringCoercion(value) {
72
- try {
73
- testStringCoercion(value);
74
- var JSCompiler_inline_result = false;
75
- } catch (e) {
76
- JSCompiler_inline_result = true;
77
- }
78
- if (JSCompiler_inline_result) {
79
- JSCompiler_inline_result = console;
80
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
81
- var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
82
- JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
83
- return testStringCoercion(value);
84
- }
85
- }
86
- function getComponentNameFromType(type) {
87
- if (type == null)
88
- return null;
89
- if (typeof type === "function")
90
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
91
- if (typeof type === "string")
92
- return type;
93
- switch (type) {
94
- case REACT_FRAGMENT_TYPE:
95
- return "Fragment";
96
- case REACT_PROFILER_TYPE:
97
- return "Profiler";
98
- case REACT_STRICT_MODE_TYPE:
99
- return "StrictMode";
100
- case REACT_SUSPENSE_TYPE:
101
- return "Suspense";
102
- case REACT_SUSPENSE_LIST_TYPE:
103
- return "SuspenseList";
104
- case REACT_ACTIVITY_TYPE:
105
- return "Activity";
106
- }
107
- if (typeof type === "object")
108
- switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
109
- case REACT_PORTAL_TYPE:
110
- return "Portal";
111
- case REACT_CONTEXT_TYPE:
112
- return type.displayName || "Context";
113
- case REACT_CONSUMER_TYPE:
114
- return (type._context.displayName || "Context") + ".Consumer";
115
- case REACT_FORWARD_REF_TYPE:
116
- var innerType = type.render;
117
- type = type.displayName;
118
- type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
119
- return type;
120
- case REACT_MEMO_TYPE:
121
- return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
122
- case REACT_LAZY_TYPE:
123
- innerType = type._payload;
124
- type = type._init;
125
- try {
126
- return getComponentNameFromType(type(innerType));
127
- } catch (x) {}
128
- }
129
- return null;
130
- }
131
- function getTaskName(type) {
132
- if (type === REACT_FRAGMENT_TYPE)
133
- return "<>";
134
- if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
135
- return "<...>";
136
- try {
137
- var name = getComponentNameFromType(type);
138
- return name ? "<" + name + ">" : "<...>";
139
- } catch (x) {
140
- return "<...>";
141
- }
142
- }
143
- function getOwner() {
144
- var dispatcher = ReactSharedInternals.A;
145
- return dispatcher === null ? null : dispatcher.getOwner();
146
- }
147
- function UnknownOwner() {
148
- return Error("react-stack-top-frame");
149
- }
150
- function hasValidKey(config) {
151
- if (hasOwnProperty.call(config, "key")) {
152
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
153
- if (getter && getter.isReactWarning)
154
- return false;
155
- }
156
- return config.key !== undefined;
157
- }
158
- function defineKeyPropWarningGetter(props, displayName) {
159
- function warnAboutAccessingKey() {
160
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
161
- }
162
- warnAboutAccessingKey.isReactWarning = true;
163
- Object.defineProperty(props, "key", {
164
- get: warnAboutAccessingKey,
165
- configurable: true
166
- });
167
- }
168
- function elementRefGetterWithDeprecationWarning() {
169
- var componentName = getComponentNameFromType(this.type);
170
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
171
- componentName = this.props.ref;
172
- return componentName !== undefined ? componentName : null;
173
- }
174
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
175
- var refProp = props.ref;
176
- type = {
177
- $$typeof: REACT_ELEMENT_TYPE,
178
- type,
179
- key,
180
- props,
181
- _owner: owner
182
- };
183
- (refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
184
- enumerable: false,
185
- get: elementRefGetterWithDeprecationWarning
186
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
187
- type._store = {};
188
- Object.defineProperty(type._store, "validated", {
189
- configurable: false,
190
- enumerable: false,
191
- writable: true,
192
- value: 0
193
- });
194
- Object.defineProperty(type, "_debugInfo", {
195
- configurable: false,
196
- enumerable: false,
197
- writable: true,
198
- value: null
199
- });
200
- Object.defineProperty(type, "_debugStack", {
201
- configurable: false,
202
- enumerable: false,
203
- writable: true,
204
- value: debugStack
205
- });
206
- Object.defineProperty(type, "_debugTask", {
207
- configurable: false,
208
- enumerable: false,
209
- writable: true,
210
- value: debugTask
211
- });
212
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
213
- return type;
214
- }
215
- function cloneAndReplaceKey(oldElement, newKey) {
216
- newKey = ReactElement(oldElement.type, newKey, oldElement.props, oldElement._owner, oldElement._debugStack, oldElement._debugTask);
217
- oldElement._store && (newKey._store.validated = oldElement._store.validated);
218
- return newKey;
219
- }
220
- function validateChildKeys(node) {
221
- isValidElement(node) ? node._store && (node._store.validated = 1) : typeof node === "object" && node !== null && node.$$typeof === REACT_LAZY_TYPE && (node._payload.status === "fulfilled" ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
222
- }
223
- function isValidElement(object) {
224
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
225
- }
226
- function escape(key) {
227
- var escaperLookup = { "=": "=0", ":": "=2" };
228
- return "$" + key.replace(/[=:]/g, function(match) {
229
- return escaperLookup[match];
230
- });
231
- }
232
- function getElementKey(element, index) {
233
- return typeof element === "object" && element !== null && element.key != null ? (checkKeyStringCoercion(element.key), escape("" + element.key)) : index.toString(36);
234
- }
235
- function resolveThenable(thenable) {
236
- switch (thenable.status) {
237
- case "fulfilled":
238
- return thenable.value;
239
- case "rejected":
240
- throw thenable.reason;
241
- default:
242
- switch (typeof thenable.status === "string" ? thenable.then(noop, noop) : (thenable.status = "pending", thenable.then(function(fulfilledValue) {
243
- thenable.status === "pending" && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
244
- }, function(error) {
245
- thenable.status === "pending" && (thenable.status = "rejected", thenable.reason = error);
246
- })), thenable.status) {
247
- case "fulfilled":
248
- return thenable.value;
249
- case "rejected":
250
- throw thenable.reason;
251
- }
252
- }
253
- throw thenable;
254
- }
255
- function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
256
- var type = typeof children;
257
- if (type === "undefined" || type === "boolean")
258
- children = null;
259
- var invokeCallback = false;
260
- if (children === null)
261
- invokeCallback = true;
262
- else
263
- switch (type) {
264
- case "bigint":
265
- case "string":
266
- case "number":
267
- invokeCallback = true;
268
- break;
269
- case "object":
270
- switch (children.$$typeof) {
271
- case REACT_ELEMENT_TYPE:
272
- case REACT_PORTAL_TYPE:
273
- invokeCallback = true;
274
- break;
275
- case REACT_LAZY_TYPE:
276
- return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array, escapedPrefix, nameSoFar, callback);
277
- }
278
- }
279
- if (invokeCallback) {
280
- invokeCallback = children;
281
- callback = callback(invokeCallback);
282
- var childKey = nameSoFar === "" ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
283
- isArrayImpl(callback) ? (escapedPrefix = "", childKey != null && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array, escapedPrefix, "", function(c) {
284
- return c;
285
- })) : callback != null && (isValidElement(callback) && (callback.key != null && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(callback, escapedPrefix + (callback.key == null || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + childKey), nameSoFar !== "" && invokeCallback != null && isValidElement(invokeCallback) && invokeCallback.key == null && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array.push(callback));
286
- return 1;
287
- }
288
- invokeCallback = 0;
289
- childKey = nameSoFar === "" ? "." : nameSoFar + ":";
290
- if (isArrayImpl(children))
291
- for (var i = 0;i < children.length; i++)
292
- nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
293
- else if (i = getIteratorFn(children), typeof i === "function")
294
- for (i === children.entries && (didWarnAboutMaps || console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = true), children = i.call(children), i = 0;!(nameSoFar = children.next()).done; )
295
- nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array, escapedPrefix, type, callback);
296
- else if (type === "object") {
297
- if (typeof children.then === "function")
298
- return mapIntoArray(resolveThenable(children), array, escapedPrefix, nameSoFar, callback);
299
- array = String(children);
300
- throw Error("Objects are not valid as a React child (found: " + (array === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : array) + "). If you meant to render a collection of children, use an array instead.");
301
- }
302
- return invokeCallback;
303
- }
304
- function mapChildren(children, func, context) {
305
- if (children == null)
306
- return children;
307
- var result = [], count = 0;
308
- mapIntoArray(children, result, "", "", function(child) {
309
- return func.call(context, child, count++);
310
- });
311
- return result;
312
- }
313
- function lazyInitializer(payload) {
314
- if (payload._status === -1) {
315
- var ioInfo = payload._ioInfo;
316
- ioInfo != null && (ioInfo.start = ioInfo.end = performance.now());
317
- ioInfo = payload._result;
318
- var thenable = ioInfo();
319
- thenable.then(function(moduleObject) {
320
- if (payload._status === 0 || payload._status === -1) {
321
- payload._status = 1;
322
- payload._result = moduleObject;
323
- var _ioInfo = payload._ioInfo;
324
- _ioInfo != null && (_ioInfo.end = performance.now());
325
- thenable.status === undefined && (thenable.status = "fulfilled", thenable.value = moduleObject);
326
- }
327
- }, function(error) {
328
- if (payload._status === 0 || payload._status === -1) {
329
- payload._status = 2;
330
- payload._result = error;
331
- var _ioInfo2 = payload._ioInfo;
332
- _ioInfo2 != null && (_ioInfo2.end = performance.now());
333
- thenable.status === undefined && (thenable.status = "rejected", thenable.reason = error);
334
- }
335
- });
336
- ioInfo = payload._ioInfo;
337
- if (ioInfo != null) {
338
- ioInfo.value = thenable;
339
- var displayName = thenable.displayName;
340
- typeof displayName === "string" && (ioInfo.name = displayName);
341
- }
342
- payload._status === -1 && (payload._status = 0, payload._result = thenable);
343
- }
344
- if (payload._status === 1)
345
- return ioInfo = payload._result, ioInfo === undefined && console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
346
-
347
- Your code should look like:
348
- const MyComponent = lazy(() => import('./MyComponent'))
349
-
350
- Did you accidentally put curly braces around the import?`, ioInfo), "default" in ioInfo || console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
351
-
352
- Your code should look like:
353
- const MyComponent = lazy(() => import('./MyComponent'))`, ioInfo), ioInfo.default;
354
- throw payload._result;
355
- }
356
- function resolveDispatcher() {
357
- var dispatcher = ReactSharedInternals.H;
358
- dispatcher === null && console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
359
- 1. You might have mismatching versions of React and the renderer (such as React DOM)
360
- 2. You might be breaking the Rules of Hooks
361
- 3. You might have more than one copy of React in the same app
362
- See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`);
363
- return dispatcher;
364
- }
365
- function releaseAsyncTransition() {
366
- ReactSharedInternals.asyncTransitions--;
367
- }
368
- function enqueueTask(task) {
369
- if (enqueueTaskImpl === null)
370
- try {
371
- var requireString = ("require" + Math.random()).slice(0, 7);
372
- enqueueTaskImpl = (module && module[requireString]).call(module, "timers").setImmediate;
373
- } catch (_err) {
374
- enqueueTaskImpl = function(callback) {
375
- didWarnAboutMessageChannel === false && (didWarnAboutMessageChannel = true, typeof MessageChannel === "undefined" && console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));
376
- var channel = new MessageChannel;
377
- channel.port1.onmessage = callback;
378
- channel.port2.postMessage(undefined);
379
- };
380
- }
381
- return enqueueTaskImpl(task);
382
- }
383
- function aggregateErrors(errors) {
384
- return 1 < errors.length && typeof AggregateError === "function" ? new AggregateError(errors) : errors[0];
385
- }
386
- function popActScope(prevActQueue, prevActScopeDepth) {
387
- prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
388
- actScopeDepth = prevActScopeDepth;
389
- }
390
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
391
- var queue = ReactSharedInternals.actQueue;
392
- if (queue !== null)
393
- if (queue.length !== 0)
394
- try {
395
- flushActQueue(queue);
396
- enqueueTask(function() {
397
- return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
398
- });
399
- return;
400
- } catch (error) {
401
- ReactSharedInternals.thrownErrors.push(error);
402
- }
403
- else
404
- ReactSharedInternals.actQueue = null;
405
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve(returnValue);
406
- }
407
- function flushActQueue(queue) {
408
- if (!isFlushing) {
409
- isFlushing = true;
410
- var i = 0;
411
- try {
412
- for (;i < queue.length; i++) {
413
- var callback = queue[i];
414
- do {
415
- ReactSharedInternals.didUsePromise = false;
416
- var continuation = callback(false);
417
- if (continuation !== null) {
418
- if (ReactSharedInternals.didUsePromise) {
419
- queue[i] = callback;
420
- queue.splice(0, i);
421
- return;
422
- }
423
- callback = continuation;
424
- } else
425
- break;
426
- } while (1);
427
- }
428
- queue.length = 0;
429
- } catch (error) {
430
- queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
431
- } finally {
432
- isFlushing = false;
433
- }
434
- }
435
- }
436
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
437
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
438
- isMounted: function() {
439
- return false;
440
- },
441
- enqueueForceUpdate: function(publicInstance) {
442
- warnNoop(publicInstance, "forceUpdate");
443
- },
444
- enqueueReplaceState: function(publicInstance) {
445
- warnNoop(publicInstance, "replaceState");
446
- },
447
- enqueueSetState: function(publicInstance) {
448
- warnNoop(publicInstance, "setState");
449
- }
450
- }, assign = Object.assign, emptyObject = {};
451
- Object.freeze(emptyObject);
452
- Component.prototype.isReactComponent = {};
453
- Component.prototype.setState = function(partialState, callback) {
454
- if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null)
455
- throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
456
- this.updater.enqueueSetState(this, partialState, callback, "setState");
457
- };
458
- Component.prototype.forceUpdate = function(callback) {
459
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
460
- };
461
- var deprecatedAPIs = {
462
- isMounted: [
463
- "isMounted",
464
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
465
- ],
466
- replaceState: [
467
- "replaceState",
468
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
469
- ]
470
- };
471
- for (fnName in deprecatedAPIs)
472
- deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
473
- ComponentDummy.prototype = Component.prototype;
474
- deprecatedAPIs = PureComponent.prototype = new ComponentDummy;
475
- deprecatedAPIs.constructor = PureComponent;
476
- assign(deprecatedAPIs, Component.prototype);
477
- deprecatedAPIs.isPureReactComponent = true;
478
- var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
479
- H: null,
480
- A: null,
481
- T: null,
482
- S: null,
483
- actQueue: null,
484
- asyncTransitions: 0,
485
- isBatchingLegacy: false,
486
- didScheduleLegacyUpdate: false,
487
- didUsePromise: false,
488
- thrownErrors: [],
489
- getCurrentStack: null,
490
- recentlyCreatedOwnerStacks: 0
491
- }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
492
- return null;
493
- };
494
- deprecatedAPIs = {
495
- react_stack_bottom_frame: function(callStackForError) {
496
- return callStackForError();
497
- }
498
- };
499
- var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
500
- var didWarnAboutElementRef = {};
501
- var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(deprecatedAPIs, UnknownOwner)();
502
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
503
- var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = typeof reportError === "function" ? reportError : function(error) {
504
- if (typeof window === "object" && typeof window.ErrorEvent === "function") {
505
- var event = new window.ErrorEvent("error", {
506
- bubbles: true,
507
- cancelable: true,
508
- message: typeof error === "object" && error !== null && typeof error.message === "string" ? String(error.message) : String(error),
509
- error
510
- });
511
- if (!window.dispatchEvent(event))
512
- return;
513
- } else if (typeof process === "object" && typeof process.emit === "function") {
514
- process.emit("uncaughtException", error);
515
- return;
516
- }
517
- console.error(error);
518
- }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = typeof queueMicrotask === "function" ? function(callback) {
519
- queueMicrotask(function() {
520
- return queueMicrotask(callback);
521
- });
522
- } : enqueueTask;
523
- deprecatedAPIs = Object.freeze({
524
- __proto__: null,
525
- c: function(size) {
526
- return resolveDispatcher().useMemoCache(size);
527
- }
528
- });
529
- var fnName = {
530
- map: mapChildren,
531
- forEach: function(children, forEachFunc, forEachContext) {
532
- mapChildren(children, function() {
533
- forEachFunc.apply(this, arguments);
534
- }, forEachContext);
535
- },
536
- count: function(children) {
537
- var n = 0;
538
- mapChildren(children, function() {
539
- n++;
540
- });
541
- return n;
542
- },
543
- toArray: function(children) {
544
- return mapChildren(children, function(child) {
545
- return child;
546
- }) || [];
547
- },
548
- only: function(children) {
549
- if (!isValidElement(children))
550
- throw Error("React.Children.only expected to receive a single React element child.");
551
- return children;
552
- }
553
- };
554
- exports.Activity = REACT_ACTIVITY_TYPE;
555
- exports.Children = fnName;
556
- exports.Component = Component;
557
- exports.Fragment = REACT_FRAGMENT_TYPE;
558
- exports.Profiler = REACT_PROFILER_TYPE;
559
- exports.PureComponent = PureComponent;
560
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
561
- exports.Suspense = REACT_SUSPENSE_TYPE;
562
- exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
563
- exports.__COMPILER_RUNTIME = deprecatedAPIs;
564
- exports.act = function(callback) {
565
- var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
566
- actScopeDepth++;
567
- var queue = ReactSharedInternals.actQueue = prevActQueue !== null ? prevActQueue : [], didAwaitActCall = false;
568
- try {
569
- var result = callback();
570
- } catch (error) {
571
- ReactSharedInternals.thrownErrors.push(error);
572
- }
573
- if (0 < ReactSharedInternals.thrownErrors.length)
574
- throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
575
- if (result !== null && typeof result === "object" && typeof result.then === "function") {
576
- var thenable = result;
577
- queueSeveralMicrotasks(function() {
578
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
579
- });
580
- return {
581
- then: function(resolve, reject) {
582
- didAwaitActCall = true;
583
- thenable.then(function(returnValue) {
584
- popActScope(prevActQueue, prevActScopeDepth);
585
- if (prevActScopeDepth === 0) {
586
- try {
587
- flushActQueue(queue), enqueueTask(function() {
588
- return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
589
- });
590
- } catch (error$0) {
591
- ReactSharedInternals.thrownErrors.push(error$0);
592
- }
593
- if (0 < ReactSharedInternals.thrownErrors.length) {
594
- var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
595
- ReactSharedInternals.thrownErrors.length = 0;
596
- reject(_thrownError);
597
- }
598
- } else
599
- resolve(returnValue);
600
- }, function(error) {
601
- popActScope(prevActQueue, prevActScopeDepth);
602
- 0 < ReactSharedInternals.thrownErrors.length ? (error = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error)) : reject(error);
603
- });
604
- }
605
- };
606
- }
607
- var returnValue$jscomp$0 = result;
608
- popActScope(prevActQueue, prevActScopeDepth);
609
- prevActScopeDepth === 0 && (flushActQueue(queue), queue.length !== 0 && queueSeveralMicrotasks(function() {
610
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));
611
- }), ReactSharedInternals.actQueue = null);
612
- if (0 < ReactSharedInternals.thrownErrors.length)
613
- throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
614
- return {
615
- then: function(resolve, reject) {
616
- didAwaitActCall = true;
617
- prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
618
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve, reject);
619
- })) : resolve(returnValue$jscomp$0);
620
- }
621
- };
622
- };
623
- exports.cache = function(fn) {
624
- return function() {
625
- return fn.apply(null, arguments);
626
- };
627
- };
628
- exports.cacheSignal = function() {
629
- return null;
630
- };
631
- exports.captureOwnerStack = function() {
632
- var getCurrentStack = ReactSharedInternals.getCurrentStack;
633
- return getCurrentStack === null ? null : getCurrentStack();
634
- };
635
- exports.cloneElement = function(element, config, children) {
636
- if (element === null || element === undefined)
637
- throw Error("The argument must be a React element, but you passed " + element + ".");
638
- var props = assign({}, element.props), key = element.key, owner = element._owner;
639
- if (config != null) {
640
- var JSCompiler_inline_result;
641
- a: {
642
- if (hasOwnProperty.call(config, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(config, "ref").get) && JSCompiler_inline_result.isReactWarning) {
643
- JSCompiler_inline_result = false;
644
- break a;
645
- }
646
- JSCompiler_inline_result = config.ref !== undefined;
647
- }
648
- JSCompiler_inline_result && (owner = getOwner());
649
- hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key);
650
- for (propName in config)
651
- !hasOwnProperty.call(config, propName) || propName === "key" || propName === "__self" || propName === "__source" || propName === "ref" && config.ref === undefined || (props[propName] = config[propName]);
652
- }
653
- var propName = arguments.length - 2;
654
- if (propName === 1)
655
- props.children = children;
656
- else if (1 < propName) {
657
- JSCompiler_inline_result = Array(propName);
658
- for (var i = 0;i < propName; i++)
659
- JSCompiler_inline_result[i] = arguments[i + 2];
660
- props.children = JSCompiler_inline_result;
661
- }
662
- props = ReactElement(element.type, key, props, owner, element._debugStack, element._debugTask);
663
- for (key = 2;key < arguments.length; key++)
664
- validateChildKeys(arguments[key]);
665
- return props;
666
- };
667
- exports.createContext = function(defaultValue) {
668
- defaultValue = {
669
- $$typeof: REACT_CONTEXT_TYPE,
670
- _currentValue: defaultValue,
671
- _currentValue2: defaultValue,
672
- _threadCount: 0,
673
- Provider: null,
674
- Consumer: null
675
- };
676
- defaultValue.Provider = defaultValue;
677
- defaultValue.Consumer = {
678
- $$typeof: REACT_CONSUMER_TYPE,
679
- _context: defaultValue
680
- };
681
- defaultValue._currentRenderer = null;
682
- defaultValue._currentRenderer2 = null;
683
- return defaultValue;
684
- };
685
- exports.createElement = function(type, config, children) {
686
- for (var i = 2;i < arguments.length; i++)
687
- validateChildKeys(arguments[i]);
688
- i = {};
689
- var key = null;
690
- if (config != null)
691
- for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")), hasValidKey(config) && (checkKeyStringCoercion(config.key), key = "" + config.key), config)
692
- hasOwnProperty.call(config, propName) && propName !== "key" && propName !== "__self" && propName !== "__source" && (i[propName] = config[propName]);
693
- var childrenLength = arguments.length - 2;
694
- if (childrenLength === 1)
695
- i.children = children;
696
- else if (1 < childrenLength) {
697
- for (var childArray = Array(childrenLength), _i = 0;_i < childrenLength; _i++)
698
- childArray[_i] = arguments[_i + 2];
699
- Object.freeze && Object.freeze(childArray);
700
- i.children = childArray;
701
- }
702
- if (type && type.defaultProps)
703
- for (propName in childrenLength = type.defaultProps, childrenLength)
704
- i[propName] === undefined && (i[propName] = childrenLength[propName]);
705
- key && defineKeyPropWarningGetter(i, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
706
- var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
707
- return ReactElement(type, key, i, getOwner(), propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
708
- };
709
- exports.createRef = function() {
710
- var refObject = { current: null };
711
- Object.seal(refObject);
712
- return refObject;
713
- };
714
- exports.forwardRef = function(render) {
715
- render != null && render.$$typeof === REACT_MEMO_TYPE ? console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).") : typeof render !== "function" ? console.error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render) : render.length !== 0 && render.length !== 2 && console.error("forwardRef render functions accept exactly two parameters: props and ref. %s", render.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
716
- render != null && render.defaultProps != null && console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");
717
- var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
718
- Object.defineProperty(elementType, "displayName", {
719
- enumerable: false,
720
- configurable: true,
721
- get: function() {
722
- return ownName;
723
- },
724
- set: function(name) {
725
- ownName = name;
726
- render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
727
- }
728
- });
729
- return elementType;
730
- };
731
- exports.isValidElement = isValidElement;
732
- exports.lazy = function(ctor) {
733
- ctor = { _status: -1, _result: ctor };
734
- var lazyType = {
735
- $$typeof: REACT_LAZY_TYPE,
736
- _payload: ctor,
737
- _init: lazyInitializer
738
- }, ioInfo = {
739
- name: "lazy",
740
- start: -1,
741
- end: -1,
742
- value: null,
743
- owner: null,
744
- debugStack: Error("react-stack-top-frame"),
745
- debugTask: console.createTask ? console.createTask("lazy()") : null
746
- };
747
- ctor._ioInfo = ioInfo;
748
- lazyType._debugInfo = [{ awaited: ioInfo }];
749
- return lazyType;
750
- };
751
- exports.memo = function(type, compare) {
752
- type == null && console.error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
753
- compare = {
754
- $$typeof: REACT_MEMO_TYPE,
755
- type,
756
- compare: compare === undefined ? null : compare
757
- };
758
- var ownName;
759
- Object.defineProperty(compare, "displayName", {
760
- enumerable: false,
761
- configurable: true,
762
- get: function() {
763
- return ownName;
764
- },
765
- set: function(name) {
766
- ownName = name;
767
- type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
768
- }
769
- });
770
- return compare;
771
- };
772
- exports.startTransition = function(scope) {
773
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
774
- currentTransition._updatedFibers = new Set;
775
- ReactSharedInternals.T = currentTransition;
776
- try {
777
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
778
- onStartTransitionFinish !== null && onStartTransitionFinish(currentTransition, returnValue);
779
- typeof returnValue === "object" && returnValue !== null && typeof returnValue.then === "function" && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop, reportGlobalError));
780
- } catch (error) {
781
- reportGlobalError(error);
782
- } finally {
783
- prevTransition === null && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")), prevTransition !== null && currentTransition.types !== null && (prevTransition.types !== null && prevTransition.types !== currentTransition.types && console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
784
- }
785
- };
786
- exports.unstable_useCacheRefresh = function() {
787
- return resolveDispatcher().useCacheRefresh();
788
- };
789
- exports.use = function(usable) {
790
- return resolveDispatcher().use(usable);
791
- };
792
- exports.useActionState = function(action, initialState, permalink) {
793
- return resolveDispatcher().useActionState(action, initialState, permalink);
794
- };
795
- exports.useCallback = function(callback, deps) {
796
- return resolveDispatcher().useCallback(callback, deps);
797
- };
798
- exports.useContext = function(Context) {
799
- var dispatcher = resolveDispatcher();
800
- Context.$$typeof === REACT_CONSUMER_TYPE && console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?");
801
- return dispatcher.useContext(Context);
802
- };
803
- exports.useDebugValue = function(value, formatterFn) {
804
- return resolveDispatcher().useDebugValue(value, formatterFn);
805
- };
806
- exports.useDeferredValue = function(value, initialValue) {
807
- return resolveDispatcher().useDeferredValue(value, initialValue);
808
- };
809
- exports.useEffect = function(create, deps) {
810
- create == null && console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");
811
- return resolveDispatcher().useEffect(create, deps);
812
- };
813
- exports.useEffectEvent = function(callback) {
814
- return resolveDispatcher().useEffectEvent(callback);
815
- };
816
- exports.useId = function() {
817
- return resolveDispatcher().useId();
818
- };
819
- exports.useImperativeHandle = function(ref, create, deps) {
820
- return resolveDispatcher().useImperativeHandle(ref, create, deps);
821
- };
822
- exports.useInsertionEffect = function(create, deps) {
823
- create == null && console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?");
824
- return resolveDispatcher().useInsertionEffect(create, deps);
825
- };
826
- exports.useLayoutEffect = function(create, deps) {
827
- create == null && console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?");
828
- return resolveDispatcher().useLayoutEffect(create, deps);
829
- };
830
- exports.useMemo = function(create, deps) {
831
- return resolveDispatcher().useMemo(create, deps);
832
- };
833
- exports.useOptimistic = function(passthrough, reducer) {
834
- return resolveDispatcher().useOptimistic(passthrough, reducer);
835
- };
836
- exports.useReducer = function(reducer, initialArg, init) {
837
- return resolveDispatcher().useReducer(reducer, initialArg, init);
838
- };
839
- exports.useRef = function(initialValue) {
840
- return resolveDispatcher().useRef(initialValue);
841
- };
842
- exports.useState = function(initialState) {
843
- return resolveDispatcher().useState(initialState);
844
- };
845
- exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
846
- return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
847
- };
848
- exports.useTransition = function() {
849
- return resolveDispatcher().useTransition();
850
- };
851
- exports.version = "19.2.5";
852
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
853
- })();
854
- });
855
-
856
- // node_modules/react/index.js
857
- var require_react = __commonJS((exports, module) => {
858
- var react_development = __toESM(require_react_development());
859
- if (false) {} else {
860
- module.exports = react_development;
861
- }
862
- });
863
-
864
- // node_modules/react/cjs/react-jsx-dev-runtime.development.js
865
- var require_react_jsx_dev_runtime_development = __commonJS((exports) => {
866
- var React = __toESM(require_react());
867
- (function() {
868
- function getComponentNameFromType(type) {
869
- if (type == null)
870
- return null;
871
- if (typeof type === "function")
872
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
873
- if (typeof type === "string")
874
- return type;
875
- switch (type) {
876
- case REACT_FRAGMENT_TYPE:
877
- return "Fragment";
878
- case REACT_PROFILER_TYPE:
879
- return "Profiler";
880
- case REACT_STRICT_MODE_TYPE:
881
- return "StrictMode";
882
- case REACT_SUSPENSE_TYPE:
883
- return "Suspense";
884
- case REACT_SUSPENSE_LIST_TYPE:
885
- return "SuspenseList";
886
- case REACT_ACTIVITY_TYPE:
887
- return "Activity";
888
- }
889
- if (typeof type === "object")
890
- switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
891
- case REACT_PORTAL_TYPE:
892
- return "Portal";
893
- case REACT_CONTEXT_TYPE:
894
- return type.displayName || "Context";
895
- case REACT_CONSUMER_TYPE:
896
- return (type._context.displayName || "Context") + ".Consumer";
897
- case REACT_FORWARD_REF_TYPE:
898
- var innerType = type.render;
899
- type = type.displayName;
900
- type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
901
- return type;
902
- case REACT_MEMO_TYPE:
903
- return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
904
- case REACT_LAZY_TYPE:
905
- innerType = type._payload;
906
- type = type._init;
907
- try {
908
- return getComponentNameFromType(type(innerType));
909
- } catch (x) {}
910
- }
911
- return null;
912
- }
913
- function testStringCoercion(value) {
914
- return "" + value;
915
- }
916
- function checkKeyStringCoercion(value) {
917
- try {
918
- testStringCoercion(value);
919
- var JSCompiler_inline_result = false;
920
- } catch (e) {
921
- JSCompiler_inline_result = true;
922
- }
923
- if (JSCompiler_inline_result) {
924
- JSCompiler_inline_result = console;
925
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
926
- var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
927
- JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
928
- return testStringCoercion(value);
929
- }
930
- }
931
- function getTaskName(type) {
932
- if (type === REACT_FRAGMENT_TYPE)
933
- return "<>";
934
- if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
935
- return "<...>";
936
- try {
937
- var name = getComponentNameFromType(type);
938
- return name ? "<" + name + ">" : "<...>";
939
- } catch (x) {
940
- return "<...>";
941
- }
942
- }
943
- function getOwner() {
944
- var dispatcher = ReactSharedInternals.A;
945
- return dispatcher === null ? null : dispatcher.getOwner();
946
- }
947
- function UnknownOwner() {
948
- return Error("react-stack-top-frame");
949
- }
950
- function hasValidKey(config) {
951
- if (hasOwnProperty.call(config, "key")) {
952
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
953
- if (getter && getter.isReactWarning)
954
- return false;
955
- }
956
- return config.key !== undefined;
957
- }
958
- function defineKeyPropWarningGetter(props, displayName) {
959
- function warnAboutAccessingKey() {
960
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
961
- }
962
- warnAboutAccessingKey.isReactWarning = true;
963
- Object.defineProperty(props, "key", {
964
- get: warnAboutAccessingKey,
965
- configurable: true
966
- });
967
- }
968
- function elementRefGetterWithDeprecationWarning() {
969
- var componentName = getComponentNameFromType(this.type);
970
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
971
- componentName = this.props.ref;
972
- return componentName !== undefined ? componentName : null;
973
- }
974
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
975
- var refProp = props.ref;
976
- type = {
977
- $$typeof: REACT_ELEMENT_TYPE,
978
- type,
979
- key,
980
- props,
981
- _owner: owner
982
- };
983
- (refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
984
- enumerable: false,
985
- get: elementRefGetterWithDeprecationWarning
986
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
987
- type._store = {};
988
- Object.defineProperty(type._store, "validated", {
989
- configurable: false,
990
- enumerable: false,
991
- writable: true,
992
- value: 0
993
- });
994
- Object.defineProperty(type, "_debugInfo", {
995
- configurable: false,
996
- enumerable: false,
997
- writable: true,
998
- value: null
999
- });
1000
- Object.defineProperty(type, "_debugStack", {
1001
- configurable: false,
1002
- enumerable: false,
1003
- writable: true,
1004
- value: debugStack
1005
- });
1006
- Object.defineProperty(type, "_debugTask", {
1007
- configurable: false,
1008
- enumerable: false,
1009
- writable: true,
1010
- value: debugTask
1011
- });
1012
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
1013
- return type;
1014
- }
1015
- function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
1016
- var children = config.children;
1017
- if (children !== undefined)
1018
- if (isStaticChildren)
1019
- if (isArrayImpl(children)) {
1020
- for (isStaticChildren = 0;isStaticChildren < children.length; isStaticChildren++)
1021
- validateChildKeys(children[isStaticChildren]);
1022
- Object.freeze && Object.freeze(children);
1023
- } else
1024
- console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
1025
- else
1026
- validateChildKeys(children);
1027
- if (hasOwnProperty.call(config, "key")) {
1028
- children = getComponentNameFromType(type);
1029
- var keys = Object.keys(config).filter(function(k) {
1030
- return k !== "key";
1031
- });
1032
- isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
1033
- didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(`A props object containing a "key" prop is being spread into JSX:
1034
- let props = %s;
1035
- <%s {...props} />
1036
- React keys must be passed directly to JSX without using spread:
1037
- let props = %s;
1038
- <%s key={someKey} {...props} />`, isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = true);
1039
- }
1040
- children = null;
1041
- maybeKey !== undefined && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
1042
- hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
1043
- if ("key" in config) {
1044
- maybeKey = {};
1045
- for (var propName in config)
1046
- propName !== "key" && (maybeKey[propName] = config[propName]);
1047
- } else
1048
- maybeKey = config;
1049
- children && defineKeyPropWarningGetter(maybeKey, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
1050
- return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
1051
- }
1052
- function validateChildKeys(node) {
1053
- isValidElement(node) ? node._store && (node._store.validated = 1) : typeof node === "object" && node !== null && node.$$typeof === REACT_LAZY_TYPE && (node._payload.status === "fulfilled" ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
1054
- }
1055
- function isValidElement(object) {
1056
- return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1057
- }
1058
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
1059
- return null;
1060
- };
1061
- React = {
1062
- react_stack_bottom_frame: function(callStackForError) {
1063
- return callStackForError();
1064
- }
1065
- };
1066
- var specialPropKeyWarningShown;
1067
- var didWarnAboutElementRef = {};
1068
- var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
1069
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
1070
- var didWarnAboutKeySpread = {};
1071
- exports.Fragment = REACT_FRAGMENT_TYPE;
1072
- exports.jsxDEV = function(type, config, maybeKey, isStaticChildren) {
1073
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
1074
- return jsxDEVImpl(type, config, maybeKey, isStaticChildren, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
1075
- };
1076
- })();
1077
- });
1078
-
1079
- // node_modules/react/jsx-dev-runtime.js
1080
- var require_jsx_dev_runtime = __commonJS((exports, module) => {
1081
- var react_jsx_dev_runtime_development = __toESM(require_react_jsx_dev_runtime_development());
1082
- if (false) {} else {
1083
- module.exports = react_jsx_dev_runtime_development;
1084
- }
1085
- });
1086
-
1087
1
  // src/createContextFromHook.tsx
1088
- var import_react = __toESM(require_react(), 1);
1089
- var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
2
+ import { createContext, useContext } from "react";
3
+ import { jsxDEV } from "react/jsx-dev-runtime";
1090
4
  var createContextFromHook = (fn) => {
1091
- const ctx = import_react.createContext(undefined);
5
+ const ctx = createContext(undefined);
1092
6
  const useState = () => {
1093
- return import_react.useContext(ctx);
7
+ return useContext(ctx);
1094
8
  };
1095
9
  const Provider = ({ children, ...props }) => {
1096
10
  const value = fn(props);
1097
- return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(ctx.Provider, {
11
+ return /* @__PURE__ */ jsxDEV(ctx.Provider, {
1098
12
  value,
1099
13
  children
1100
14
  }, undefined, false, undefined, this);
1101
15
  };
1102
16
  return [useState, Provider];
1103
17
  };
1104
- // node_modules/@livequery/core/dist/index.js
1105
- var extendStatics = function(d, b) {
1106
- extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
1107
- d2.__proto__ = b2;
1108
- } || function(d2, b2) {
1109
- for (var p in b2)
1110
- if (Object.prototype.hasOwnProperty.call(b2, p))
1111
- d2[p] = b2[p];
1112
- };
1113
- return extendStatics(d, b);
1114
- };
1115
- function __extends(d, b) {
1116
- if (typeof b !== "function" && b !== null)
1117
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1118
- extendStatics(d, b);
1119
- function __() {
1120
- this.constructor = d;
1121
- }
1122
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __);
1123
- }
1124
- function __awaiter(thisArg, _arguments, P, generator) {
1125
- function adopt(value) {
1126
- return value instanceof P ? value : new P(function(resolve) {
1127
- resolve(value);
1128
- });
1129
- }
1130
- return new (P || (P = Promise))(function(resolve, reject) {
1131
- function fulfilled(value) {
1132
- try {
1133
- step(generator.next(value));
1134
- } catch (e) {
1135
- reject(e);
1136
- }
1137
- }
1138
- function rejected(value) {
1139
- try {
1140
- step(generator["throw"](value));
1141
- } catch (e) {
1142
- reject(e);
1143
- }
1144
- }
1145
- function step(result) {
1146
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
1147
- }
1148
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1149
- });
1150
- }
1151
- function __generator(thisArg, body) {
1152
- var _ = { label: 0, sent: function() {
1153
- if (t[0] & 1)
1154
- throw t[1];
1155
- return t[1];
1156
- }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
1157
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
1158
- return this;
1159
- }), g;
1160
- function verb(n) {
1161
- return function(v) {
1162
- return step([n, v]);
1163
- };
1164
- }
1165
- function step(op) {
1166
- if (f)
1167
- throw new TypeError("Generator is already executing.");
1168
- while (g && (g = 0, op[0] && (_ = 0)), _)
1169
- try {
1170
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
1171
- return t;
1172
- if (y = 0, t)
1173
- op = [op[0] & 2, t.value];
1174
- switch (op[0]) {
1175
- case 0:
1176
- case 1:
1177
- t = op;
1178
- break;
1179
- case 4:
1180
- _.label++;
1181
- return { value: op[1], done: false };
1182
- case 5:
1183
- _.label++;
1184
- y = op[1];
1185
- op = [0];
1186
- continue;
1187
- case 7:
1188
- op = _.ops.pop();
1189
- _.trys.pop();
1190
- continue;
1191
- default:
1192
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1193
- _ = 0;
1194
- continue;
1195
- }
1196
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1197
- _.label = op[1];
1198
- break;
1199
- }
1200
- if (op[0] === 6 && _.label < t[1]) {
1201
- _.label = t[1];
1202
- t = op;
1203
- break;
1204
- }
1205
- if (t && _.label < t[2]) {
1206
- _.label = t[2];
1207
- _.ops.push(op);
1208
- break;
1209
- }
1210
- if (t[2])
1211
- _.ops.pop();
1212
- _.trys.pop();
1213
- continue;
1214
- }
1215
- op = body.call(thisArg, _);
1216
- } catch (e) {
1217
- op = [6, e];
1218
- y = 0;
1219
- } finally {
1220
- f = t = 0;
1221
- }
1222
- if (op[0] & 5)
1223
- throw op[1];
1224
- return { value: op[0] ? op[1] : undefined, done: true };
1225
- }
1226
- }
1227
- function __values(o) {
1228
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
1229
- if (m)
1230
- return m.call(o);
1231
- if (o && typeof o.length === "number")
1232
- return {
1233
- next: function() {
1234
- if (o && i >= o.length)
1235
- o = undefined;
1236
- return { value: o && o[i++], done: !o };
1237
- }
1238
- };
1239
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1240
- }
1241
- function __read(o, n) {
1242
- var m = typeof Symbol === "function" && o[Symbol.iterator];
1243
- if (!m)
1244
- return o;
1245
- var i = m.call(o), r, ar = [], e;
1246
- try {
1247
- while ((n === undefined || n-- > 0) && !(r = i.next()).done)
1248
- ar.push(r.value);
1249
- } catch (error) {
1250
- e = { error };
1251
- } finally {
1252
- try {
1253
- if (r && !r.done && (m = i["return"]))
1254
- m.call(i);
1255
- } finally {
1256
- if (e)
1257
- throw e.error;
1258
- }
1259
- }
1260
- return ar;
1261
- }
1262
- function __spreadArray(to, from, pack) {
1263
- if (pack || arguments.length === 2)
1264
- for (var i = 0, l = from.length, ar;i < l; i++) {
1265
- if (ar || !(i in from)) {
1266
- if (!ar)
1267
- ar = Array.prototype.slice.call(from, 0, i);
1268
- ar[i] = from[i];
1269
- }
1270
- }
1271
- return to.concat(ar || Array.prototype.slice.call(from));
1272
- }
1273
- function __await(v) {
1274
- return this instanceof __await ? (this.v = v, this) : new __await(v);
1275
- }
1276
- function __asyncGenerator(thisArg, _arguments, generator) {
1277
- if (!Symbol.asyncIterator)
1278
- throw new TypeError("Symbol.asyncIterator is not defined.");
1279
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
1280
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
1281
- return this;
1282
- }, i;
1283
- function awaitReturn(f) {
1284
- return function(v) {
1285
- return Promise.resolve(v).then(f, reject);
1286
- };
1287
- }
1288
- function verb(n, f) {
1289
- if (g[n]) {
1290
- i[n] = function(v) {
1291
- return new Promise(function(a, b) {
1292
- q.push([n, v, a, b]) > 1 || resume(n, v);
1293
- });
1294
- };
1295
- if (f)
1296
- i[n] = f(i[n]);
1297
- }
1298
- }
1299
- function resume(n, v) {
1300
- try {
1301
- step(g[n](v));
1302
- } catch (e) {
1303
- settle(q[0][3], e);
1304
- }
1305
- }
1306
- function step(r) {
1307
- r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
1308
- }
1309
- function fulfill(value) {
1310
- resume("next", value);
1311
- }
1312
- function reject(value) {
1313
- resume("throw", value);
1314
- }
1315
- function settle(f, v) {
1316
- if (f(v), q.shift(), q.length)
1317
- resume(q[0][0], q[0][1]);
1318
- }
1319
- }
1320
- function __asyncValues(o) {
1321
- if (!Symbol.asyncIterator)
1322
- throw new TypeError("Symbol.asyncIterator is not defined.");
1323
- var m = o[Symbol.asyncIterator], i;
1324
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
1325
- return this;
1326
- }, i);
1327
- function verb(n) {
1328
- i[n] = o[n] && function(v) {
1329
- return new Promise(function(resolve, reject) {
1330
- v = o[n](v), settle(resolve, reject, v.done, v.value);
1331
- });
1332
- };
1333
- }
1334
- function settle(resolve, reject, d, v) {
1335
- Promise.resolve(v).then(function(v2) {
1336
- resolve({ value: v2, done: d });
1337
- }, reject);
1338
- }
1339
- }
1340
- function isFunction(value) {
1341
- return typeof value === "function";
1342
- }
1343
- function createErrorClass(createImpl) {
1344
- var _super = function(instance) {
1345
- Error.call(instance);
1346
- instance.stack = new Error().stack;
1347
- };
1348
- var ctorFunc = createImpl(_super);
1349
- ctorFunc.prototype = Object.create(Error.prototype);
1350
- ctorFunc.prototype.constructor = ctorFunc;
1351
- return ctorFunc;
1352
- }
1353
- var UnsubscriptionError = createErrorClass(function(_super) {
1354
- return function UnsubscriptionErrorImpl(errors) {
1355
- _super(this);
1356
- this.message = errors ? errors.length + ` errors occurred during unsubscription:
1357
- ` + errors.map(function(err, i) {
1358
- return i + 1 + ") " + err.toString();
1359
- }).join(`
1360
- `) : "";
1361
- this.name = "UnsubscriptionError";
1362
- this.errors = errors;
1363
- };
1364
- });
1365
- function arrRemove(arr, item) {
1366
- if (arr) {
1367
- var index = arr.indexOf(item);
1368
- 0 <= index && arr.splice(index, 1);
1369
- }
1370
- }
1371
- var Subscription = function() {
1372
- function Subscription2(initialTeardown) {
1373
- this.initialTeardown = initialTeardown;
1374
- this.closed = false;
1375
- this._parentage = null;
1376
- this._finalizers = null;
1377
- }
1378
- Subscription2.prototype.unsubscribe = function() {
1379
- var e_1, _a, e_2, _b;
1380
- var errors;
1381
- if (!this.closed) {
1382
- this.closed = true;
1383
- var _parentage = this._parentage;
1384
- if (_parentage) {
1385
- this._parentage = null;
1386
- if (Array.isArray(_parentage)) {
1387
- try {
1388
- for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next();!_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
1389
- var parent_1 = _parentage_1_1.value;
1390
- parent_1.remove(this);
1391
- }
1392
- } catch (e_1_1) {
1393
- e_1 = { error: e_1_1 };
1394
- } finally {
1395
- try {
1396
- if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return))
1397
- _a.call(_parentage_1);
1398
- } finally {
1399
- if (e_1)
1400
- throw e_1.error;
1401
- }
1402
- }
1403
- } else {
1404
- _parentage.remove(this);
1405
- }
1406
- }
1407
- var initialFinalizer = this.initialTeardown;
1408
- if (isFunction(initialFinalizer)) {
1409
- try {
1410
- initialFinalizer();
1411
- } catch (e) {
1412
- errors = e instanceof UnsubscriptionError ? e.errors : [e];
1413
- }
1414
- }
1415
- var _finalizers = this._finalizers;
1416
- if (_finalizers) {
1417
- this._finalizers = null;
1418
- try {
1419
- for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next();!_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
1420
- var finalizer = _finalizers_1_1.value;
1421
- try {
1422
- execFinalizer(finalizer);
1423
- } catch (err) {
1424
- errors = errors !== null && errors !== undefined ? errors : [];
1425
- if (err instanceof UnsubscriptionError) {
1426
- errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
1427
- } else {
1428
- errors.push(err);
1429
- }
1430
- }
1431
- }
1432
- } catch (e_2_1) {
1433
- e_2 = { error: e_2_1 };
1434
- } finally {
1435
- try {
1436
- if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return))
1437
- _b.call(_finalizers_1);
1438
- } finally {
1439
- if (e_2)
1440
- throw e_2.error;
1441
- }
1442
- }
1443
- }
1444
- if (errors) {
1445
- throw new UnsubscriptionError(errors);
1446
- }
1447
- }
1448
- };
1449
- Subscription2.prototype.add = function(teardown) {
1450
- var _a;
1451
- if (teardown && teardown !== this) {
1452
- if (this.closed) {
1453
- execFinalizer(teardown);
1454
- } else {
1455
- if (teardown instanceof Subscription2) {
1456
- if (teardown.closed || teardown._hasParent(this)) {
1457
- return;
1458
- }
1459
- teardown._addParent(this);
1460
- }
1461
- (this._finalizers = (_a = this._finalizers) !== null && _a !== undefined ? _a : []).push(teardown);
1462
- }
1463
- }
1464
- };
1465
- Subscription2.prototype._hasParent = function(parent) {
1466
- var _parentage = this._parentage;
1467
- return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
1468
- };
1469
- Subscription2.prototype._addParent = function(parent) {
1470
- var _parentage = this._parentage;
1471
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
1472
- };
1473
- Subscription2.prototype._removeParent = function(parent) {
1474
- var _parentage = this._parentage;
1475
- if (_parentage === parent) {
1476
- this._parentage = null;
1477
- } else if (Array.isArray(_parentage)) {
1478
- arrRemove(_parentage, parent);
1479
- }
1480
- };
1481
- Subscription2.prototype.remove = function(teardown) {
1482
- var _finalizers = this._finalizers;
1483
- _finalizers && arrRemove(_finalizers, teardown);
1484
- if (teardown instanceof Subscription2) {
1485
- teardown._removeParent(this);
1486
- }
1487
- };
1488
- Subscription2.EMPTY = function() {
1489
- var empty = new Subscription2;
1490
- empty.closed = true;
1491
- return empty;
1492
- }();
1493
- return Subscription2;
1494
- }();
1495
- var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
1496
- function isSubscription(value) {
1497
- return value instanceof Subscription || value && "closed" in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);
1498
- }
1499
- function execFinalizer(finalizer) {
1500
- if (isFunction(finalizer)) {
1501
- finalizer();
1502
- } else {
1503
- finalizer.unsubscribe();
1504
- }
1505
- }
1506
- var config = {
1507
- onUnhandledError: null,
1508
- onStoppedNotification: null,
1509
- Promise: undefined,
1510
- useDeprecatedSynchronousErrorHandling: false,
1511
- useDeprecatedNextContext: false
1512
- };
1513
- var timeoutProvider = {
1514
- setTimeout: function(handler, timeout) {
1515
- var args = [];
1516
- for (var _i = 2;_i < arguments.length; _i++) {
1517
- args[_i - 2] = arguments[_i];
1518
- }
1519
- var delegate = timeoutProvider.delegate;
1520
- if (delegate === null || delegate === undefined ? undefined : delegate.setTimeout) {
1521
- return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
1522
- }
1523
- return setTimeout.apply(undefined, __spreadArray([handler, timeout], __read(args)));
1524
- },
1525
- clearTimeout: function(handle) {
1526
- var delegate = timeoutProvider.delegate;
1527
- return ((delegate === null || delegate === undefined ? undefined : delegate.clearTimeout) || clearTimeout)(handle);
1528
- },
1529
- delegate: undefined
1530
- };
1531
- function reportUnhandledError(err) {
1532
- timeoutProvider.setTimeout(function() {
1533
- var onUnhandledError = config.onUnhandledError;
1534
- if (onUnhandledError) {
1535
- onUnhandledError(err);
1536
- } else {
1537
- throw err;
1538
- }
1539
- });
1540
- }
1541
- function noop() {}
1542
- var COMPLETE_NOTIFICATION = function() {
1543
- return createNotification("C", undefined, undefined);
1544
- }();
1545
- function errorNotification(error) {
1546
- return createNotification("E", undefined, error);
1547
- }
1548
- function nextNotification(value) {
1549
- return createNotification("N", value, undefined);
1550
- }
1551
- function createNotification(kind, value, error) {
1552
- return {
1553
- kind,
1554
- value,
1555
- error
1556
- };
1557
- }
1558
- var context = null;
1559
- function errorContext(cb) {
1560
- if (config.useDeprecatedSynchronousErrorHandling) {
1561
- var isRoot = !context;
1562
- if (isRoot) {
1563
- context = { errorThrown: false, error: null };
1564
- }
1565
- cb();
1566
- if (isRoot) {
1567
- var _a = context, errorThrown = _a.errorThrown, error = _a.error;
1568
- context = null;
1569
- if (errorThrown) {
1570
- throw error;
1571
- }
1572
- }
1573
- } else {
1574
- cb();
1575
- }
1576
- }
1577
- function captureError(err) {
1578
- if (config.useDeprecatedSynchronousErrorHandling && context) {
1579
- context.errorThrown = true;
1580
- context.error = err;
1581
- }
1582
- }
1583
- var Subscriber = function(_super) {
1584
- __extends(Subscriber2, _super);
1585
- function Subscriber2(destination) {
1586
- var _this = _super.call(this) || this;
1587
- _this.isStopped = false;
1588
- if (destination) {
1589
- _this.destination = destination;
1590
- if (isSubscription(destination)) {
1591
- destination.add(_this);
1592
- }
1593
- } else {
1594
- _this.destination = EMPTY_OBSERVER;
1595
- }
1596
- return _this;
1597
- }
1598
- Subscriber2.create = function(next, error, complete) {
1599
- return new SafeSubscriber(next, error, complete);
1600
- };
1601
- Subscriber2.prototype.next = function(value) {
1602
- if (this.isStopped) {
1603
- handleStoppedNotification(nextNotification(value), this);
1604
- } else {
1605
- this._next(value);
1606
- }
1607
- };
1608
- Subscriber2.prototype.error = function(err) {
1609
- if (this.isStopped) {
1610
- handleStoppedNotification(errorNotification(err), this);
1611
- } else {
1612
- this.isStopped = true;
1613
- this._error(err);
1614
- }
1615
- };
1616
- Subscriber2.prototype.complete = function() {
1617
- if (this.isStopped) {
1618
- handleStoppedNotification(COMPLETE_NOTIFICATION, this);
1619
- } else {
1620
- this.isStopped = true;
1621
- this._complete();
1622
- }
1623
- };
1624
- Subscriber2.prototype.unsubscribe = function() {
1625
- if (!this.closed) {
1626
- this.isStopped = true;
1627
- _super.prototype.unsubscribe.call(this);
1628
- this.destination = null;
1629
- }
1630
- };
1631
- Subscriber2.prototype._next = function(value) {
1632
- this.destination.next(value);
1633
- };
1634
- Subscriber2.prototype._error = function(err) {
1635
- try {
1636
- this.destination.error(err);
1637
- } finally {
1638
- this.unsubscribe();
1639
- }
1640
- };
1641
- Subscriber2.prototype._complete = function() {
1642
- try {
1643
- this.destination.complete();
1644
- } finally {
1645
- this.unsubscribe();
1646
- }
1647
- };
1648
- return Subscriber2;
1649
- }(Subscription);
1650
- var _bind = Function.prototype.bind;
1651
- function bind(fn, thisArg) {
1652
- return _bind.call(fn, thisArg);
1653
- }
1654
- var ConsumerObserver = function() {
1655
- function ConsumerObserver2(partialObserver) {
1656
- this.partialObserver = partialObserver;
1657
- }
1658
- ConsumerObserver2.prototype.next = function(value) {
1659
- var partialObserver = this.partialObserver;
1660
- if (partialObserver.next) {
1661
- try {
1662
- partialObserver.next(value);
1663
- } catch (error) {
1664
- handleUnhandledError(error);
1665
- }
1666
- }
1667
- };
1668
- ConsumerObserver2.prototype.error = function(err) {
1669
- var partialObserver = this.partialObserver;
1670
- if (partialObserver.error) {
1671
- try {
1672
- partialObserver.error(err);
1673
- } catch (error) {
1674
- handleUnhandledError(error);
1675
- }
1676
- } else {
1677
- handleUnhandledError(err);
1678
- }
1679
- };
1680
- ConsumerObserver2.prototype.complete = function() {
1681
- var partialObserver = this.partialObserver;
1682
- if (partialObserver.complete) {
1683
- try {
1684
- partialObserver.complete();
1685
- } catch (error) {
1686
- handleUnhandledError(error);
1687
- }
1688
- }
1689
- };
1690
- return ConsumerObserver2;
1691
- }();
1692
- var SafeSubscriber = function(_super) {
1693
- __extends(SafeSubscriber2, _super);
1694
- function SafeSubscriber2(observerOrNext, error, complete) {
1695
- var _this = _super.call(this) || this;
1696
- var partialObserver;
1697
- if (isFunction(observerOrNext) || !observerOrNext) {
1698
- partialObserver = {
1699
- next: observerOrNext !== null && observerOrNext !== undefined ? observerOrNext : undefined,
1700
- error: error !== null && error !== undefined ? error : undefined,
1701
- complete: complete !== null && complete !== undefined ? complete : undefined
1702
- };
1703
- } else {
1704
- var context_1;
1705
- if (_this && config.useDeprecatedNextContext) {
1706
- context_1 = Object.create(observerOrNext);
1707
- context_1.unsubscribe = function() {
1708
- return _this.unsubscribe();
1709
- };
1710
- partialObserver = {
1711
- next: observerOrNext.next && bind(observerOrNext.next, context_1),
1712
- error: observerOrNext.error && bind(observerOrNext.error, context_1),
1713
- complete: observerOrNext.complete && bind(observerOrNext.complete, context_1)
1714
- };
1715
- } else {
1716
- partialObserver = observerOrNext;
1717
- }
1718
- }
1719
- _this.destination = new ConsumerObserver(partialObserver);
1720
- return _this;
1721
- }
1722
- return SafeSubscriber2;
1723
- }(Subscriber);
1724
- function handleUnhandledError(error) {
1725
- if (config.useDeprecatedSynchronousErrorHandling) {
1726
- captureError(error);
1727
- } else {
1728
- reportUnhandledError(error);
1729
- }
1730
- }
1731
- function defaultErrorHandler(err) {
1732
- throw err;
1733
- }
1734
- function handleStoppedNotification(notification, subscriber) {
1735
- var onStoppedNotification = config.onStoppedNotification;
1736
- onStoppedNotification && timeoutProvider.setTimeout(function() {
1737
- return onStoppedNotification(notification, subscriber);
1738
- });
1739
- }
1740
- var EMPTY_OBSERVER = {
1741
- closed: true,
1742
- next: noop,
1743
- error: defaultErrorHandler,
1744
- complete: noop
1745
- };
1746
- var observable = function() {
1747
- return typeof Symbol === "function" && Symbol.observable || "@@observable";
1748
- }();
1749
- function identity(x) {
1750
- return x;
1751
- }
1752
- function pipeFromArray(fns) {
1753
- if (fns.length === 0) {
1754
- return identity;
1755
- }
1756
- if (fns.length === 1) {
1757
- return fns[0];
1758
- }
1759
- return function piped(input) {
1760
- return fns.reduce(function(prev, fn) {
1761
- return fn(prev);
1762
- }, input);
1763
- };
1764
- }
1765
- var Observable = function() {
1766
- function Observable2(subscribe) {
1767
- if (subscribe) {
1768
- this._subscribe = subscribe;
1769
- }
1770
- }
1771
- Observable2.prototype.lift = function(operator) {
1772
- var observable2 = new Observable2;
1773
- observable2.source = this;
1774
- observable2.operator = operator;
1775
- return observable2;
1776
- };
1777
- Observable2.prototype.subscribe = function(observerOrNext, error, complete) {
1778
- var _this = this;
1779
- var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
1780
- errorContext(function() {
1781
- var _a = _this, operator = _a.operator, source = _a.source;
1782
- subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
1783
- });
1784
- return subscriber;
1785
- };
1786
- Observable2.prototype._trySubscribe = function(sink) {
1787
- try {
1788
- return this._subscribe(sink);
1789
- } catch (err) {
1790
- sink.error(err);
1791
- }
1792
- };
1793
- Observable2.prototype.forEach = function(next, promiseCtor) {
1794
- var _this = this;
1795
- promiseCtor = getPromiseCtor(promiseCtor);
1796
- return new promiseCtor(function(resolve, reject) {
1797
- var subscriber = new SafeSubscriber({
1798
- next: function(value) {
1799
- try {
1800
- next(value);
1801
- } catch (err) {
1802
- reject(err);
1803
- subscriber.unsubscribe();
1804
- }
1805
- },
1806
- error: reject,
1807
- complete: resolve
1808
- });
1809
- _this.subscribe(subscriber);
1810
- });
1811
- };
1812
- Observable2.prototype._subscribe = function(subscriber) {
1813
- var _a;
1814
- return (_a = this.source) === null || _a === undefined ? undefined : _a.subscribe(subscriber);
1815
- };
1816
- Observable2.prototype[observable] = function() {
1817
- return this;
1818
- };
1819
- Observable2.prototype.pipe = function() {
1820
- var operations = [];
1821
- for (var _i = 0;_i < arguments.length; _i++) {
1822
- operations[_i] = arguments[_i];
1823
- }
1824
- return pipeFromArray(operations)(this);
1825
- };
1826
- Observable2.prototype.toPromise = function(promiseCtor) {
1827
- var _this = this;
1828
- promiseCtor = getPromiseCtor(promiseCtor);
1829
- return new promiseCtor(function(resolve, reject) {
1830
- var value;
1831
- _this.subscribe(function(x) {
1832
- return value = x;
1833
- }, function(err) {
1834
- return reject(err);
1835
- }, function() {
1836
- return resolve(value);
1837
- });
1838
- });
1839
- };
1840
- Observable2.create = function(subscribe) {
1841
- return new Observable2(subscribe);
1842
- };
1843
- return Observable2;
1844
- }();
1845
- function getPromiseCtor(promiseCtor) {
1846
- var _a;
1847
- return (_a = promiseCtor !== null && promiseCtor !== undefined ? promiseCtor : config.Promise) !== null && _a !== undefined ? _a : Promise;
1848
- }
1849
- function isObserver(value) {
1850
- return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
1851
- }
1852
- function isSubscriber(value) {
1853
- return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
1854
- }
1855
- var ObjectUnsubscribedError = createErrorClass(function(_super) {
1856
- return function ObjectUnsubscribedErrorImpl() {
1857
- _super(this);
1858
- this.name = "ObjectUnsubscribedError";
1859
- this.message = "object unsubscribed";
1860
- };
1861
- });
1862
- var Subject = function(_super) {
1863
- __extends(Subject2, _super);
1864
- function Subject2() {
1865
- var _this = _super.call(this) || this;
1866
- _this.closed = false;
1867
- _this.currentObservers = null;
1868
- _this.observers = [];
1869
- _this.isStopped = false;
1870
- _this.hasError = false;
1871
- _this.thrownError = null;
1872
- return _this;
1873
- }
1874
- Subject2.prototype.lift = function(operator) {
1875
- var subject = new AnonymousSubject(this, this);
1876
- subject.operator = operator;
1877
- return subject;
1878
- };
1879
- Subject2.prototype._throwIfClosed = function() {
1880
- if (this.closed) {
1881
- throw new ObjectUnsubscribedError;
1882
- }
1883
- };
1884
- Subject2.prototype.next = function(value) {
1885
- var _this = this;
1886
- errorContext(function() {
1887
- var e_1, _a;
1888
- _this._throwIfClosed();
1889
- if (!_this.isStopped) {
1890
- if (!_this.currentObservers) {
1891
- _this.currentObservers = Array.from(_this.observers);
1892
- }
1893
- try {
1894
- for (var _b = __values(_this.currentObservers), _c = _b.next();!_c.done; _c = _b.next()) {
1895
- var observer = _c.value;
1896
- observer.next(value);
1897
- }
1898
- } catch (e_1_1) {
1899
- e_1 = { error: e_1_1 };
1900
- } finally {
1901
- try {
1902
- if (_c && !_c.done && (_a = _b.return))
1903
- _a.call(_b);
1904
- } finally {
1905
- if (e_1)
1906
- throw e_1.error;
1907
- }
1908
- }
1909
- }
1910
- });
1911
- };
1912
- Subject2.prototype.error = function(err) {
1913
- var _this = this;
1914
- errorContext(function() {
1915
- _this._throwIfClosed();
1916
- if (!_this.isStopped) {
1917
- _this.hasError = _this.isStopped = true;
1918
- _this.thrownError = err;
1919
- var observers = _this.observers;
1920
- while (observers.length) {
1921
- observers.shift().error(err);
1922
- }
1923
- }
1924
- });
1925
- };
1926
- Subject2.prototype.complete = function() {
1927
- var _this = this;
1928
- errorContext(function() {
1929
- _this._throwIfClosed();
1930
- if (!_this.isStopped) {
1931
- _this.isStopped = true;
1932
- var observers = _this.observers;
1933
- while (observers.length) {
1934
- observers.shift().complete();
1935
- }
1936
- }
1937
- });
1938
- };
1939
- Subject2.prototype.unsubscribe = function() {
1940
- this.isStopped = this.closed = true;
1941
- this.observers = this.currentObservers = null;
1942
- };
1943
- Object.defineProperty(Subject2.prototype, "observed", {
1944
- get: function() {
1945
- var _a;
1946
- return ((_a = this.observers) === null || _a === undefined ? undefined : _a.length) > 0;
1947
- },
1948
- enumerable: false,
1949
- configurable: true
1950
- });
1951
- Subject2.prototype._trySubscribe = function(subscriber) {
1952
- this._throwIfClosed();
1953
- return _super.prototype._trySubscribe.call(this, subscriber);
1954
- };
1955
- Subject2.prototype._subscribe = function(subscriber) {
1956
- this._throwIfClosed();
1957
- this._checkFinalizedStatuses(subscriber);
1958
- return this._innerSubscribe(subscriber);
1959
- };
1960
- Subject2.prototype._innerSubscribe = function(subscriber) {
1961
- var _this = this;
1962
- var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
1963
- if (hasError || isStopped) {
1964
- return EMPTY_SUBSCRIPTION;
1965
- }
1966
- this.currentObservers = null;
1967
- observers.push(subscriber);
1968
- return new Subscription(function() {
1969
- _this.currentObservers = null;
1970
- arrRemove(observers, subscriber);
1971
- });
1972
- };
1973
- Subject2.prototype._checkFinalizedStatuses = function(subscriber) {
1974
- var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
1975
- if (hasError) {
1976
- subscriber.error(thrownError);
1977
- } else if (isStopped) {
1978
- subscriber.complete();
1979
- }
1980
- };
1981
- Subject2.prototype.asObservable = function() {
1982
- var observable2 = new Observable;
1983
- observable2.source = this;
1984
- return observable2;
1985
- };
1986
- Subject2.create = function(destination, source) {
1987
- return new AnonymousSubject(destination, source);
1988
- };
1989
- return Subject2;
1990
- }(Observable);
1991
- var AnonymousSubject = function(_super) {
1992
- __extends(AnonymousSubject2, _super);
1993
- function AnonymousSubject2(destination, source) {
1994
- var _this = _super.call(this) || this;
1995
- _this.destination = destination;
1996
- _this.source = source;
1997
- return _this;
1998
- }
1999
- AnonymousSubject2.prototype.next = function(value) {
2000
- var _a, _b;
2001
- (_b = (_a = this.destination) === null || _a === undefined ? undefined : _a.next) === null || _b === undefined || _b.call(_a, value);
2002
- };
2003
- AnonymousSubject2.prototype.error = function(err) {
2004
- var _a, _b;
2005
- (_b = (_a = this.destination) === null || _a === undefined ? undefined : _a.error) === null || _b === undefined || _b.call(_a, err);
2006
- };
2007
- AnonymousSubject2.prototype.complete = function() {
2008
- var _a, _b;
2009
- (_b = (_a = this.destination) === null || _a === undefined ? undefined : _a.complete) === null || _b === undefined || _b.call(_a);
2010
- };
2011
- AnonymousSubject2.prototype._subscribe = function(subscriber) {
2012
- var _a, _b;
2013
- return (_b = (_a = this.source) === null || _a === undefined ? undefined : _a.subscribe(subscriber)) !== null && _b !== undefined ? _b : EMPTY_SUBSCRIPTION;
2014
- };
2015
- return AnonymousSubject2;
2016
- }(Subject);
2017
- var BehaviorSubject = function(_super) {
2018
- __extends(BehaviorSubject2, _super);
2019
- function BehaviorSubject2(_value) {
2020
- var _this = _super.call(this) || this;
2021
- _this._value = _value;
2022
- return _this;
2023
- }
2024
- Object.defineProperty(BehaviorSubject2.prototype, "value", {
2025
- get: function() {
2026
- return this.getValue();
2027
- },
2028
- enumerable: false,
2029
- configurable: true
2030
- });
2031
- BehaviorSubject2.prototype._subscribe = function(subscriber) {
2032
- var subscription = _super.prototype._subscribe.call(this, subscriber);
2033
- !subscription.closed && subscriber.next(this._value);
2034
- return subscription;
2035
- };
2036
- BehaviorSubject2.prototype.getValue = function() {
2037
- var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;
2038
- if (hasError) {
2039
- throw thrownError;
2040
- }
2041
- this._throwIfClosed();
2042
- return _value;
2043
- };
2044
- BehaviorSubject2.prototype.next = function(value) {
2045
- _super.prototype.next.call(this, this._value = value);
2046
- };
2047
- return BehaviorSubject2;
2048
- }(Subject);
2049
- var EmptyError = createErrorClass(function(_super) {
2050
- return function EmptyErrorImpl() {
2051
- _super(this);
2052
- this.name = "EmptyError";
2053
- this.message = "no elements in sequence";
2054
- };
2055
- });
2056
- function lastValueFrom(source, config2) {
2057
- var hasConfig = typeof config2 === "object";
2058
- return new Promise(function(resolve, reject) {
2059
- var _hasValue = false;
2060
- var _value;
2061
- source.subscribe({
2062
- next: function(value) {
2063
- _value = value;
2064
- _hasValue = true;
2065
- },
2066
- error: reject,
2067
- complete: function() {
2068
- if (_hasValue) {
2069
- resolve(_value);
2070
- } else if (hasConfig) {
2071
- resolve(config2.defaultValue);
2072
- } else {
2073
- reject(new EmptyError);
2074
- }
2075
- }
2076
- });
2077
- });
2078
- }
2079
- var isArrayLike = function(x) {
2080
- return x && typeof x.length === "number" && typeof x !== "function";
2081
- };
2082
- function isPromise(value) {
2083
- return isFunction(value === null || value === undefined ? undefined : value.then);
2084
- }
2085
- function isInteropObservable(input) {
2086
- return isFunction(input[observable]);
2087
- }
2088
- function isAsyncIterable(obj) {
2089
- return Symbol.asyncIterator && isFunction(obj === null || obj === undefined ? undefined : obj[Symbol.asyncIterator]);
2090
- }
2091
- function createInvalidObservableTypeError(input) {
2092
- return new TypeError("You provided " + (input !== null && typeof input === "object" ? "an invalid object" : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
2093
- }
2094
- function getSymbolIterator() {
2095
- if (typeof Symbol !== "function" || !Symbol.iterator) {
2096
- return "@@iterator";
2097
- }
2098
- return Symbol.iterator;
2099
- }
2100
- var iterator = getSymbolIterator();
2101
- function isIterable(input) {
2102
- return isFunction(input === null || input === undefined ? undefined : input[iterator]);
2103
- }
2104
- function readableStreamLikeToAsyncGenerator(readableStream) {
2105
- return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
2106
- var reader, _a, value, done;
2107
- return __generator(this, function(_b) {
2108
- switch (_b.label) {
2109
- case 0:
2110
- reader = readableStream.getReader();
2111
- _b.label = 1;
2112
- case 1:
2113
- _b.trys.push([1, , 9, 10]);
2114
- _b.label = 2;
2115
- case 2:
2116
- if (false)
2117
- ;
2118
- return [4, __await(reader.read())];
2119
- case 3:
2120
- _a = _b.sent(), value = _a.value, done = _a.done;
2121
- if (!done)
2122
- return [3, 5];
2123
- return [4, __await(undefined)];
2124
- case 4:
2125
- return [2, _b.sent()];
2126
- case 5:
2127
- return [4, __await(value)];
2128
- case 6:
2129
- return [4, _b.sent()];
2130
- case 7:
2131
- _b.sent();
2132
- return [3, 2];
2133
- case 8:
2134
- return [3, 10];
2135
- case 9:
2136
- reader.releaseLock();
2137
- return [7];
2138
- case 10:
2139
- return [2];
2140
- }
2141
- });
2142
- });
2143
- }
2144
- function isReadableStreamLike(obj) {
2145
- return isFunction(obj === null || obj === undefined ? undefined : obj.getReader);
2146
- }
2147
- function innerFrom(input) {
2148
- if (input instanceof Observable) {
2149
- return input;
2150
- }
2151
- if (input != null) {
2152
- if (isInteropObservable(input)) {
2153
- return fromInteropObservable(input);
2154
- }
2155
- if (isArrayLike(input)) {
2156
- return fromArrayLike(input);
2157
- }
2158
- if (isPromise(input)) {
2159
- return fromPromise(input);
2160
- }
2161
- if (isAsyncIterable(input)) {
2162
- return fromAsyncIterable(input);
2163
- }
2164
- if (isIterable(input)) {
2165
- return fromIterable(input);
2166
- }
2167
- if (isReadableStreamLike(input)) {
2168
- return fromReadableStreamLike(input);
2169
- }
2170
- }
2171
- throw createInvalidObservableTypeError(input);
2172
- }
2173
- function fromInteropObservable(obj) {
2174
- return new Observable(function(subscriber) {
2175
- var obs = obj[observable]();
2176
- if (isFunction(obs.subscribe)) {
2177
- return obs.subscribe(subscriber);
2178
- }
2179
- throw new TypeError("Provided object does not correctly implement Symbol.observable");
2180
- });
2181
- }
2182
- function fromArrayLike(array) {
2183
- return new Observable(function(subscriber) {
2184
- for (var i = 0;i < array.length && !subscriber.closed; i++) {
2185
- subscriber.next(array[i]);
2186
- }
2187
- subscriber.complete();
2188
- });
2189
- }
2190
- function fromPromise(promise) {
2191
- return new Observable(function(subscriber) {
2192
- promise.then(function(value) {
2193
- if (!subscriber.closed) {
2194
- subscriber.next(value);
2195
- subscriber.complete();
2196
- }
2197
- }, function(err) {
2198
- return subscriber.error(err);
2199
- }).then(null, reportUnhandledError);
2200
- });
2201
- }
2202
- function fromIterable(iterable) {
2203
- return new Observable(function(subscriber) {
2204
- var e_1, _a;
2205
- try {
2206
- for (var iterable_1 = __values(iterable), iterable_1_1 = iterable_1.next();!iterable_1_1.done; iterable_1_1 = iterable_1.next()) {
2207
- var value = iterable_1_1.value;
2208
- subscriber.next(value);
2209
- if (subscriber.closed) {
2210
- return;
2211
- }
2212
- }
2213
- } catch (e_1_1) {
2214
- e_1 = { error: e_1_1 };
2215
- } finally {
2216
- try {
2217
- if (iterable_1_1 && !iterable_1_1.done && (_a = iterable_1.return))
2218
- _a.call(iterable_1);
2219
- } finally {
2220
- if (e_1)
2221
- throw e_1.error;
2222
- }
2223
- }
2224
- subscriber.complete();
2225
- });
2226
- }
2227
- function fromAsyncIterable(asyncIterable) {
2228
- return new Observable(function(subscriber) {
2229
- process2(asyncIterable, subscriber).catch(function(err) {
2230
- return subscriber.error(err);
2231
- });
2232
- });
2233
- }
2234
- function fromReadableStreamLike(readableStream) {
2235
- return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
2236
- }
2237
- function process2(asyncIterable, subscriber) {
2238
- var asyncIterable_1, asyncIterable_1_1;
2239
- var e_2, _a;
2240
- return __awaiter(this, undefined, undefined, function() {
2241
- var value, e_2_1;
2242
- return __generator(this, function(_b) {
2243
- switch (_b.label) {
2244
- case 0:
2245
- _b.trys.push([0, 5, 6, 11]);
2246
- asyncIterable_1 = __asyncValues(asyncIterable);
2247
- _b.label = 1;
2248
- case 1:
2249
- return [4, asyncIterable_1.next()];
2250
- case 2:
2251
- if (!(asyncIterable_1_1 = _b.sent(), !asyncIterable_1_1.done))
2252
- return [3, 4];
2253
- value = asyncIterable_1_1.value;
2254
- subscriber.next(value);
2255
- if (subscriber.closed) {
2256
- return [2];
2257
- }
2258
- _b.label = 3;
2259
- case 3:
2260
- return [3, 1];
2261
- case 4:
2262
- return [3, 11];
2263
- case 5:
2264
- e_2_1 = _b.sent();
2265
- e_2 = { error: e_2_1 };
2266
- return [3, 11];
2267
- case 6:
2268
- _b.trys.push([6, , 9, 10]);
2269
- if (!(asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)))
2270
- return [3, 8];
2271
- return [4, _a.call(asyncIterable_1)];
2272
- case 7:
2273
- _b.sent();
2274
- _b.label = 8;
2275
- case 8:
2276
- return [3, 10];
2277
- case 9:
2278
- if (e_2)
2279
- throw e_2.error;
2280
- return [7];
2281
- case 10:
2282
- return [7];
2283
- case 11:
2284
- subscriber.complete();
2285
- return [2];
2286
- }
2287
- });
2288
- });
2289
- }
2290
- function defer(observableFactory) {
2291
- return new Observable(function(subscriber) {
2292
- innerFrom(observableFactory()).subscribe(subscriber);
2293
- });
2294
- }
2295
- var isArray = Array.isArray;
2296
- var getPrototypeOf = Object.getPrototypeOf;
2297
- var objectProto = Object.prototype;
2298
- var getKeys = Object.keys;
2299
- function argsArgArrayOrObject(args) {
2300
- if (args.length === 1) {
2301
- var first_1 = args[0];
2302
- if (isArray(first_1)) {
2303
- return { args: first_1, keys: null };
2304
- }
2305
- if (isPOJO(first_1)) {
2306
- var keys = getKeys(first_1);
2307
- return {
2308
- args: keys.map(function(key) {
2309
- return first_1[key];
2310
- }),
2311
- keys
2312
- };
2313
- }
2314
- }
2315
- return { args, keys: null };
2316
- }
2317
- function isPOJO(obj) {
2318
- return obj && typeof obj === "object" && getPrototypeOf(obj) === objectProto;
2319
- }
2320
- function isScheduler(value) {
2321
- return value && isFunction(value.schedule);
2322
- }
2323
- function last(arr) {
2324
- return arr[arr.length - 1];
2325
- }
2326
- function popResultSelector(args) {
2327
- return isFunction(last(args)) ? args.pop() : undefined;
2328
- }
2329
- function popScheduler(args) {
2330
- return isScheduler(last(args)) ? args.pop() : undefined;
2331
- }
2332
- function popNumber(args, defaultValue) {
2333
- return typeof last(args) === "number" ? args.pop() : defaultValue;
2334
- }
2335
- function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
2336
- return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
2337
- }
2338
- var OperatorSubscriber = function(_super) {
2339
- __extends(OperatorSubscriber2, _super);
2340
- function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
2341
- var _this = _super.call(this, destination) || this;
2342
- _this.onFinalize = onFinalize;
2343
- _this.shouldUnsubscribe = shouldUnsubscribe;
2344
- _this._next = onNext ? function(value) {
2345
- try {
2346
- onNext(value);
2347
- } catch (err) {
2348
- destination.error(err);
2349
- }
2350
- } : _super.prototype._next;
2351
- _this._error = onError ? function(err) {
2352
- try {
2353
- onError(err);
2354
- } catch (err2) {
2355
- destination.error(err2);
2356
- } finally {
2357
- this.unsubscribe();
2358
- }
2359
- } : _super.prototype._error;
2360
- _this._complete = onComplete ? function() {
2361
- try {
2362
- onComplete();
2363
- } catch (err) {
2364
- destination.error(err);
2365
- } finally {
2366
- this.unsubscribe();
2367
- }
2368
- } : _super.prototype._complete;
2369
- return _this;
2370
- }
2371
- OperatorSubscriber2.prototype.unsubscribe = function() {
2372
- var _a;
2373
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
2374
- var closed_1 = this.closed;
2375
- _super.prototype.unsubscribe.call(this);
2376
- !closed_1 && ((_a = this.onFinalize) === null || _a === undefined || _a.call(this));
2377
- }
2378
- };
2379
- return OperatorSubscriber2;
2380
- }(Subscriber);
2381
- function hasLift(source) {
2382
- return isFunction(source === null || source === undefined ? undefined : source.lift);
2383
- }
2384
- function operate(init) {
2385
- return function(source) {
2386
- if (hasLift(source)) {
2387
- return source.lift(function(liftedSource) {
2388
- try {
2389
- return init(liftedSource, this);
2390
- } catch (err) {
2391
- this.error(err);
2392
- }
2393
- });
2394
- }
2395
- throw new TypeError("Unable to lift unknown Observable type");
2396
- };
2397
- }
2398
- function map(project, thisArg) {
2399
- return operate(function(source, subscriber) {
2400
- var index = 0;
2401
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
2402
- subscriber.next(project.call(thisArg, value, index++));
2403
- }));
2404
- });
2405
- }
2406
- var isArray2 = Array.isArray;
2407
- function callOrApply(fn, args) {
2408
- return isArray2(args) ? fn.apply(undefined, __spreadArray([], __read(args))) : fn(args);
2409
- }
2410
- function mapOneOrManyArgs(fn) {
2411
- return map(function(args) {
2412
- return callOrApply(fn, args);
2413
- });
2414
- }
2415
- function createObject(keys, values) {
2416
- return keys.reduce(function(result, key, i) {
2417
- return result[key] = values[i], result;
2418
- }, {});
2419
- }
2420
- function forkJoin() {
2421
- var args = [];
2422
- for (var _i = 0;_i < arguments.length; _i++) {
2423
- args[_i] = arguments[_i];
2424
- }
2425
- var resultSelector = popResultSelector(args);
2426
- var _a = argsArgArrayOrObject(args), sources = _a.args, keys = _a.keys;
2427
- var result = new Observable(function(subscriber) {
2428
- var length = sources.length;
2429
- if (!length) {
2430
- subscriber.complete();
2431
- return;
2432
- }
2433
- var values = new Array(length);
2434
- var remainingCompletions = length;
2435
- var remainingEmissions = length;
2436
- var _loop_1 = function(sourceIndex2) {
2437
- var hasValue = false;
2438
- innerFrom(sources[sourceIndex2]).subscribe(createOperatorSubscriber(subscriber, function(value) {
2439
- if (!hasValue) {
2440
- hasValue = true;
2441
- remainingEmissions--;
2442
- }
2443
- values[sourceIndex2] = value;
2444
- }, function() {
2445
- return remainingCompletions--;
2446
- }, undefined, function() {
2447
- if (!remainingCompletions || !hasValue) {
2448
- if (!remainingEmissions) {
2449
- subscriber.next(keys ? createObject(keys, values) : values);
2450
- }
2451
- subscriber.complete();
2452
- }
2453
- }));
2454
- };
2455
- for (var sourceIndex = 0;sourceIndex < length; sourceIndex++) {
2456
- _loop_1(sourceIndex);
2457
- }
2458
- });
2459
- return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;
2460
- }
2461
- function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
2462
- if (delay === undefined) {
2463
- delay = 0;
2464
- }
2465
- if (repeat === undefined) {
2466
- repeat = false;
2467
- }
2468
- var scheduleSubscription = scheduler.schedule(function() {
2469
- work();
2470
- if (repeat) {
2471
- parentSubscription.add(this.schedule(null, delay));
2472
- } else {
2473
- this.unsubscribe();
2474
- }
2475
- }, delay);
2476
- parentSubscription.add(scheduleSubscription);
2477
- if (!repeat) {
2478
- return scheduleSubscription;
2479
- }
2480
- }
2481
- function observeOn(scheduler, delay) {
2482
- if (delay === undefined) {
2483
- delay = 0;
2484
- }
2485
- return operate(function(source, subscriber) {
2486
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
2487
- return executeSchedule(subscriber, scheduler, function() {
2488
- return subscriber.next(value);
2489
- }, delay);
2490
- }, function() {
2491
- return executeSchedule(subscriber, scheduler, function() {
2492
- return subscriber.complete();
2493
- }, delay);
2494
- }, function(err) {
2495
- return executeSchedule(subscriber, scheduler, function() {
2496
- return subscriber.error(err);
2497
- }, delay);
2498
- }));
2499
- });
2500
- }
2501
- function subscribeOn(scheduler, delay) {
2502
- if (delay === undefined) {
2503
- delay = 0;
2504
- }
2505
- return operate(function(source, subscriber) {
2506
- subscriber.add(scheduler.schedule(function() {
2507
- return source.subscribe(subscriber);
2508
- }, delay));
2509
- });
2510
- }
2511
- function scheduleObservable(input, scheduler) {
2512
- return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
2513
- }
2514
- function schedulePromise(input, scheduler) {
2515
- return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));
2516
- }
2517
- function scheduleArray(input, scheduler) {
2518
- return new Observable(function(subscriber) {
2519
- var i = 0;
2520
- return scheduler.schedule(function() {
2521
- if (i === input.length) {
2522
- subscriber.complete();
2523
- } else {
2524
- subscriber.next(input[i++]);
2525
- if (!subscriber.closed) {
2526
- this.schedule();
2527
- }
2528
- }
2529
- });
2530
- });
2531
- }
2532
- function scheduleIterable(input, scheduler) {
2533
- return new Observable(function(subscriber) {
2534
- var iterator2;
2535
- executeSchedule(subscriber, scheduler, function() {
2536
- iterator2 = input[iterator]();
2537
- executeSchedule(subscriber, scheduler, function() {
2538
- var _a;
2539
- var value;
2540
- var done;
2541
- try {
2542
- _a = iterator2.next(), value = _a.value, done = _a.done;
2543
- } catch (err) {
2544
- subscriber.error(err);
2545
- return;
2546
- }
2547
- if (done) {
2548
- subscriber.complete();
2549
- } else {
2550
- subscriber.next(value);
2551
- }
2552
- }, 0, true);
2553
- });
2554
- return function() {
2555
- return isFunction(iterator2 === null || iterator2 === undefined ? undefined : iterator2.return) && iterator2.return();
2556
- };
2557
- });
2558
- }
2559
- function scheduleAsyncIterable(input, scheduler) {
2560
- if (!input) {
2561
- throw new Error("Iterable cannot be null");
2562
- }
2563
- return new Observable(function(subscriber) {
2564
- executeSchedule(subscriber, scheduler, function() {
2565
- var iterator2 = input[Symbol.asyncIterator]();
2566
- executeSchedule(subscriber, scheduler, function() {
2567
- iterator2.next().then(function(result) {
2568
- if (result.done) {
2569
- subscriber.complete();
2570
- } else {
2571
- subscriber.next(result.value);
2572
- }
2573
- });
2574
- }, 0, true);
2575
- });
2576
- });
2577
- }
2578
- function scheduleReadableStreamLike(input, scheduler) {
2579
- return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
2580
- }
2581
- function scheduled(input, scheduler) {
2582
- if (input != null) {
2583
- if (isInteropObservable(input)) {
2584
- return scheduleObservable(input, scheduler);
2585
- }
2586
- if (isArrayLike(input)) {
2587
- return scheduleArray(input, scheduler);
2588
- }
2589
- if (isPromise(input)) {
2590
- return schedulePromise(input, scheduler);
2591
- }
2592
- if (isAsyncIterable(input)) {
2593
- return scheduleAsyncIterable(input, scheduler);
2594
- }
2595
- if (isIterable(input)) {
2596
- return scheduleIterable(input, scheduler);
2597
- }
2598
- if (isReadableStreamLike(input)) {
2599
- return scheduleReadableStreamLike(input, scheduler);
2600
- }
2601
- }
2602
- throw createInvalidObservableTypeError(input);
2603
- }
2604
- function from(input, scheduler) {
2605
- return scheduler ? scheduled(input, scheduler) : innerFrom(input);
2606
- }
2607
- function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
2608
- var buffer = [];
2609
- var active = 0;
2610
- var index = 0;
2611
- var isComplete = false;
2612
- var checkComplete = function() {
2613
- if (isComplete && !buffer.length && !active) {
2614
- subscriber.complete();
2615
- }
2616
- };
2617
- var outerNext = function(value) {
2618
- return active < concurrent ? doInnerSub(value) : buffer.push(value);
2619
- };
2620
- var doInnerSub = function(value) {
2621
- expand && subscriber.next(value);
2622
- active++;
2623
- var innerComplete = false;
2624
- innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function(innerValue) {
2625
- onBeforeNext === null || onBeforeNext === undefined || onBeforeNext(innerValue);
2626
- if (expand) {
2627
- outerNext(innerValue);
2628
- } else {
2629
- subscriber.next(innerValue);
2630
- }
2631
- }, function() {
2632
- innerComplete = true;
2633
- }, undefined, function() {
2634
- if (innerComplete) {
2635
- try {
2636
- active--;
2637
- var _loop_1 = function() {
2638
- var bufferedValue = buffer.shift();
2639
- if (innerSubScheduler) {
2640
- executeSchedule(subscriber, innerSubScheduler, function() {
2641
- return doInnerSub(bufferedValue);
2642
- });
2643
- } else {
2644
- doInnerSub(bufferedValue);
2645
- }
2646
- };
2647
- while (buffer.length && active < concurrent) {
2648
- _loop_1();
2649
- }
2650
- checkComplete();
2651
- } catch (err) {
2652
- subscriber.error(err);
2653
- }
2654
- }
2655
- }));
2656
- };
2657
- source.subscribe(createOperatorSubscriber(subscriber, outerNext, function() {
2658
- isComplete = true;
2659
- checkComplete();
2660
- }));
2661
- return function() {
2662
- additionalFinalizer === null || additionalFinalizer === undefined || additionalFinalizer();
2663
- };
2664
- }
2665
- function mergeMap(project, resultSelector, concurrent) {
2666
- if (concurrent === undefined) {
2667
- concurrent = Infinity;
2668
- }
2669
- if (isFunction(resultSelector)) {
2670
- return mergeMap(function(a, i) {
2671
- return map(function(b, ii) {
2672
- return resultSelector(a, b, i, ii);
2673
- })(innerFrom(project(a, i)));
2674
- }, concurrent);
2675
- } else if (typeof resultSelector === "number") {
2676
- concurrent = resultSelector;
2677
- }
2678
- return operate(function(source, subscriber) {
2679
- return mergeInternals(source, subscriber, project, concurrent);
2680
- });
2681
- }
2682
- function mergeAll(concurrent) {
2683
- if (concurrent === undefined) {
2684
- concurrent = Infinity;
2685
- }
2686
- return mergeMap(identity, concurrent);
2687
- }
2688
- var EMPTY = new Observable(function(subscriber) {
2689
- return subscriber.complete();
2690
- });
2691
- function merge() {
2692
- var args = [];
2693
- for (var _i = 0;_i < arguments.length; _i++) {
2694
- args[_i] = arguments[_i];
2695
- }
2696
- var scheduler = popScheduler(args);
2697
- var concurrent = popNumber(args, Infinity);
2698
- var sources = args;
2699
- return !sources.length ? EMPTY : sources.length === 1 ? innerFrom(sources[0]) : mergeAll(concurrent)(from(sources, scheduler));
2700
- }
2701
- function of() {
2702
- var args = [];
2703
- for (var _i = 0;_i < arguments.length; _i++) {
2704
- args[_i] = arguments[_i];
2705
- }
2706
- var scheduler = popScheduler(args);
2707
- return from(args, scheduler);
2708
- }
2709
- function concatMap(project, resultSelector) {
2710
- return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
2711
- }
2712
- var Action = function(_super) {
2713
- __extends(Action2, _super);
2714
- function Action2(scheduler, work) {
2715
- return _super.call(this) || this;
2716
- }
2717
- Action2.prototype.schedule = function(state, delay) {
2718
- if (delay === undefined) {
2719
- delay = 0;
2720
- }
2721
- return this;
2722
- };
2723
- return Action2;
2724
- }(Subscription);
2725
- var intervalProvider = {
2726
- setInterval: function(handler, timeout) {
2727
- var args = [];
2728
- for (var _i = 2;_i < arguments.length; _i++) {
2729
- args[_i - 2] = arguments[_i];
2730
- }
2731
- var delegate = intervalProvider.delegate;
2732
- if (delegate === null || delegate === undefined ? undefined : delegate.setInterval) {
2733
- return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
2734
- }
2735
- return setInterval.apply(undefined, __spreadArray([handler, timeout], __read(args)));
2736
- },
2737
- clearInterval: function(handle) {
2738
- var delegate = intervalProvider.delegate;
2739
- return ((delegate === null || delegate === undefined ? undefined : delegate.clearInterval) || clearInterval)(handle);
2740
- },
2741
- delegate: undefined
2742
- };
2743
- var AsyncAction = function(_super) {
2744
- __extends(AsyncAction2, _super);
2745
- function AsyncAction2(scheduler, work) {
2746
- var _this = _super.call(this, scheduler, work) || this;
2747
- _this.scheduler = scheduler;
2748
- _this.work = work;
2749
- _this.pending = false;
2750
- return _this;
2751
- }
2752
- AsyncAction2.prototype.schedule = function(state, delay) {
2753
- var _a;
2754
- if (delay === undefined) {
2755
- delay = 0;
2756
- }
2757
- if (this.closed) {
2758
- return this;
2759
- }
2760
- this.state = state;
2761
- var id = this.id;
2762
- var scheduler = this.scheduler;
2763
- if (id != null) {
2764
- this.id = this.recycleAsyncId(scheduler, id, delay);
2765
- }
2766
- this.pending = true;
2767
- this.delay = delay;
2768
- this.id = (_a = this.id) !== null && _a !== undefined ? _a : this.requestAsyncId(scheduler, this.id, delay);
2769
- return this;
2770
- };
2771
- AsyncAction2.prototype.requestAsyncId = function(scheduler, _id, delay) {
2772
- if (delay === undefined) {
2773
- delay = 0;
2774
- }
2775
- return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
2776
- };
2777
- AsyncAction2.prototype.recycleAsyncId = function(_scheduler, id, delay) {
2778
- if (delay === undefined) {
2779
- delay = 0;
2780
- }
2781
- if (delay != null && this.delay === delay && this.pending === false) {
2782
- return id;
2783
- }
2784
- if (id != null) {
2785
- intervalProvider.clearInterval(id);
2786
- }
2787
- return;
2788
- };
2789
- AsyncAction2.prototype.execute = function(state, delay) {
2790
- if (this.closed) {
2791
- return new Error("executing a cancelled action");
2792
- }
2793
- this.pending = false;
2794
- var error = this._execute(state, delay);
2795
- if (error) {
2796
- return error;
2797
- } else if (this.pending === false && this.id != null) {
2798
- this.id = this.recycleAsyncId(this.scheduler, this.id, null);
2799
- }
2800
- };
2801
- AsyncAction2.prototype._execute = function(state, _delay) {
2802
- var errored = false;
2803
- var errorValue;
2804
- try {
2805
- this.work(state);
2806
- } catch (e) {
2807
- errored = true;
2808
- errorValue = e ? e : new Error("Scheduled action threw falsy error");
2809
- }
2810
- if (errored) {
2811
- this.unsubscribe();
2812
- return errorValue;
2813
- }
2814
- };
2815
- AsyncAction2.prototype.unsubscribe = function() {
2816
- if (!this.closed) {
2817
- var _a = this, id = _a.id, scheduler = _a.scheduler;
2818
- var actions = scheduler.actions;
2819
- this.work = this.state = this.scheduler = null;
2820
- this.pending = false;
2821
- arrRemove(actions, this);
2822
- if (id != null) {
2823
- this.id = this.recycleAsyncId(scheduler, id, null);
2824
- }
2825
- this.delay = null;
2826
- _super.prototype.unsubscribe.call(this);
2827
- }
2828
- };
2829
- return AsyncAction2;
2830
- }(Action);
2831
- var dateTimestampProvider = {
2832
- now: function() {
2833
- return (dateTimestampProvider.delegate || Date).now();
2834
- },
2835
- delegate: undefined
2836
- };
2837
- var Scheduler = function() {
2838
- function Scheduler2(schedulerActionCtor, now) {
2839
- if (now === undefined) {
2840
- now = Scheduler2.now;
2841
- }
2842
- this.schedulerActionCtor = schedulerActionCtor;
2843
- this.now = now;
2844
- }
2845
- Scheduler2.prototype.schedule = function(work, delay, state) {
2846
- if (delay === undefined) {
2847
- delay = 0;
2848
- }
2849
- return new this.schedulerActionCtor(this, work).schedule(state, delay);
2850
- };
2851
- Scheduler2.now = dateTimestampProvider.now;
2852
- return Scheduler2;
2853
- }();
2854
- var AsyncScheduler = function(_super) {
2855
- __extends(AsyncScheduler2, _super);
2856
- function AsyncScheduler2(SchedulerAction, now) {
2857
- if (now === undefined) {
2858
- now = Scheduler.now;
2859
- }
2860
- var _this = _super.call(this, SchedulerAction, now) || this;
2861
- _this.actions = [];
2862
- _this._active = false;
2863
- return _this;
2864
- }
2865
- AsyncScheduler2.prototype.flush = function(action) {
2866
- var actions = this.actions;
2867
- if (this._active) {
2868
- actions.push(action);
2869
- return;
2870
- }
2871
- var error;
2872
- this._active = true;
2873
- do {
2874
- if (error = action.execute(action.state, action.delay)) {
2875
- break;
2876
- }
2877
- } while (action = actions.shift());
2878
- this._active = false;
2879
- if (error) {
2880
- while (action = actions.shift()) {
2881
- action.unsubscribe();
2882
- }
2883
- throw error;
2884
- }
2885
- };
2886
- return AsyncScheduler2;
2887
- }(Scheduler);
2888
- var asyncScheduler = new AsyncScheduler(AsyncAction);
2889
- function debounceTime(dueTime, scheduler) {
2890
- if (scheduler === undefined) {
2891
- scheduler = asyncScheduler;
2892
- }
2893
- return operate(function(source, subscriber) {
2894
- var activeTask = null;
2895
- var lastValue = null;
2896
- var lastTime = null;
2897
- var emit = function() {
2898
- if (activeTask) {
2899
- activeTask.unsubscribe();
2900
- activeTask = null;
2901
- var value = lastValue;
2902
- lastValue = null;
2903
- subscriber.next(value);
2904
- }
2905
- };
2906
- function emitWhenIdle() {
2907
- var targetTime = lastTime + dueTime;
2908
- var now = scheduler.now();
2909
- if (now < targetTime) {
2910
- activeTask = this.schedule(undefined, targetTime - now);
2911
- subscriber.add(activeTask);
2912
- return;
2913
- }
2914
- emit();
2915
- }
2916
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
2917
- lastValue = value;
2918
- lastTime = scheduler.now();
2919
- if (!activeTask) {
2920
- activeTask = scheduler.schedule(emitWhenIdle, dueTime);
2921
- subscriber.add(activeTask);
2922
- }
2923
- }, function() {
2924
- emit();
2925
- subscriber.complete();
2926
- }, undefined, function() {
2927
- lastValue = activeTask = null;
2928
- }));
2929
- });
2930
- }
2931
- function expand(project, concurrent, scheduler) {
2932
- if (concurrent === undefined) {
2933
- concurrent = Infinity;
2934
- }
2935
- concurrent = (concurrent || 0) < 1 ? Infinity : concurrent;
2936
- return operate(function(source, subscriber) {
2937
- return mergeInternals(source, subscriber, project, concurrent, undefined, true, scheduler);
2938
- });
2939
- }
2940
- function filter(predicate, thisArg) {
2941
- return operate(function(source, subscriber) {
2942
- var index = 0;
2943
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
2944
- return predicate.call(thisArg, value, index++) && subscriber.next(value);
2945
- }));
2946
- });
2947
- }
2948
- function finalize(callback) {
2949
- return operate(function(source, subscriber) {
2950
- try {
2951
- source.subscribe(subscriber);
2952
- } finally {
2953
- subscriber.add(callback);
2954
- }
2955
- });
2956
- }
2957
- function groupBy(keySelector, elementOrOptions, duration, connector) {
2958
- return operate(function(source, subscriber) {
2959
- var element;
2960
- if (!elementOrOptions || typeof elementOrOptions === "function") {
2961
- element = elementOrOptions;
2962
- } else {
2963
- duration = elementOrOptions.duration, element = elementOrOptions.element, connector = elementOrOptions.connector;
2964
- }
2965
- var groups = new Map;
2966
- var notify = function(cb) {
2967
- groups.forEach(cb);
2968
- cb(subscriber);
2969
- };
2970
- var handleError = function(err) {
2971
- return notify(function(consumer) {
2972
- return consumer.error(err);
2973
- });
2974
- };
2975
- var activeGroups = 0;
2976
- var teardownAttempted = false;
2977
- var groupBySourceSubscriber = new OperatorSubscriber(subscriber, function(value) {
2978
- try {
2979
- var key_1 = keySelector(value);
2980
- var group_1 = groups.get(key_1);
2981
- if (!group_1) {
2982
- groups.set(key_1, group_1 = connector ? connector() : new Subject);
2983
- var grouped = createGroupedObservable(key_1, group_1);
2984
- subscriber.next(grouped);
2985
- if (duration) {
2986
- var durationSubscriber_1 = createOperatorSubscriber(group_1, function() {
2987
- group_1.complete();
2988
- durationSubscriber_1 === null || durationSubscriber_1 === undefined || durationSubscriber_1.unsubscribe();
2989
- }, undefined, undefined, function() {
2990
- return groups.delete(key_1);
2991
- });
2992
- groupBySourceSubscriber.add(innerFrom(duration(grouped)).subscribe(durationSubscriber_1));
2993
- }
2994
- }
2995
- group_1.next(element ? element(value) : value);
2996
- } catch (err) {
2997
- handleError(err);
2998
- }
2999
- }, function() {
3000
- return notify(function(consumer) {
3001
- return consumer.complete();
3002
- });
3003
- }, handleError, function() {
3004
- return groups.clear();
3005
- }, function() {
3006
- teardownAttempted = true;
3007
- return activeGroups === 0;
3008
- });
3009
- source.subscribe(groupBySourceSubscriber);
3010
- function createGroupedObservable(key, groupSubject) {
3011
- var result = new Observable(function(groupSubscriber) {
3012
- activeGroups++;
3013
- var innerSub = groupSubject.subscribe(groupSubscriber);
3014
- return function() {
3015
- innerSub.unsubscribe();
3016
- --activeGroups === 0 && teardownAttempted && groupBySourceSubscriber.unsubscribe();
3017
- };
3018
- });
3019
- result.key = key;
3020
- return result;
3021
- }
3022
- });
3023
- }
3024
- function throwError(errorOrErrorFactory, scheduler) {
3025
- var errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : function() {
3026
- return errorOrErrorFactory;
3027
- };
3028
- var init = function(subscriber) {
3029
- return subscriber.error(errorFactory());
3030
- };
3031
- return new Observable(scheduler ? function(subscriber) {
3032
- return scheduler.schedule(init, 0, subscriber);
3033
- } : init);
3034
- }
3035
- var NotificationKind;
3036
- (function(NotificationKind2) {
3037
- NotificationKind2["NEXT"] = "N";
3038
- NotificationKind2["ERROR"] = "E";
3039
- NotificationKind2["COMPLETE"] = "C";
3040
- })(NotificationKind || (NotificationKind = {}));
3041
- var Notification = function() {
3042
- function Notification2(kind, value, error) {
3043
- this.kind = kind;
3044
- this.value = value;
3045
- this.error = error;
3046
- this.hasValue = kind === "N";
3047
- }
3048
- Notification2.prototype.observe = function(observer) {
3049
- return observeNotification(this, observer);
3050
- };
3051
- Notification2.prototype.do = function(nextHandler, errorHandler, completeHandler) {
3052
- var _a = this, kind = _a.kind, value = _a.value, error = _a.error;
3053
- return kind === "N" ? nextHandler === null || nextHandler === undefined ? undefined : nextHandler(value) : kind === "E" ? errorHandler === null || errorHandler === undefined ? undefined : errorHandler(error) : completeHandler === null || completeHandler === undefined ? undefined : completeHandler();
3054
- };
3055
- Notification2.prototype.accept = function(nextOrObserver, error, complete) {
3056
- var _a;
3057
- return isFunction((_a = nextOrObserver) === null || _a === undefined ? undefined : _a.next) ? this.observe(nextOrObserver) : this.do(nextOrObserver, error, complete);
3058
- };
3059
- Notification2.prototype.toObservable = function() {
3060
- var _a = this, kind = _a.kind, value = _a.value, error = _a.error;
3061
- var result = kind === "N" ? of(value) : kind === "E" ? throwError(function() {
3062
- return error;
3063
- }) : kind === "C" ? EMPTY : 0;
3064
- if (!result) {
3065
- throw new TypeError("Unexpected notification kind " + kind);
3066
- }
3067
- return result;
3068
- };
3069
- Notification2.createNext = function(value) {
3070
- return new Notification2("N", value);
3071
- };
3072
- Notification2.createError = function(err) {
3073
- return new Notification2("E", undefined, err);
3074
- };
3075
- Notification2.createComplete = function() {
3076
- return Notification2.completeNotification;
3077
- };
3078
- Notification2.completeNotification = new Notification2("C");
3079
- return Notification2;
3080
- }();
3081
- function observeNotification(notification, observer) {
3082
- var _a, _b, _c;
3083
- var _d = notification, kind = _d.kind, value = _d.value, error = _d.error;
3084
- if (typeof kind !== "string") {
3085
- throw new TypeError('Invalid notification, missing "kind"');
3086
- }
3087
- kind === "N" ? (_a = observer.next) === null || _a === undefined || _a.call(observer, value) : kind === "E" ? (_b = observer.error) === null || _b === undefined || _b.call(observer, error) : (_c = observer.complete) === null || _c === undefined || _c.call(observer);
3088
- }
3089
- function materialize() {
3090
- return operate(function(source, subscriber) {
3091
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
3092
- subscriber.next(Notification.createNext(value));
3093
- }, function() {
3094
- subscriber.next(Notification.createComplete());
3095
- subscriber.complete();
3096
- }, function(err) {
3097
- subscriber.next(Notification.createError(err));
3098
- subscriber.complete();
3099
- }));
3100
- });
3101
- }
3102
- function pairwise() {
3103
- return operate(function(source, subscriber) {
3104
- var prev;
3105
- var hasPrev = false;
3106
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
3107
- var p = prev;
3108
- prev = value;
3109
- hasPrev && subscriber.next([p, value]);
3110
- hasPrev = true;
3111
- }));
3112
- });
3113
- }
3114
- function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {
3115
- return function(source, subscriber) {
3116
- var hasState = hasSeed;
3117
- var state = seed;
3118
- var index = 0;
3119
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
3120
- var i = index++;
3121
- state = hasState ? accumulator(state, value, i) : (hasState = true, value);
3122
- emitOnNext && subscriber.next(state);
3123
- }, emitBeforeComplete && function() {
3124
- hasState && subscriber.next(state);
3125
- subscriber.complete();
3126
- }));
3127
- };
3128
- }
3129
- function scan(accumulator, seed) {
3130
- return operate(scanInternals(accumulator, seed, arguments.length >= 2, true));
3131
- }
3132
- var ReplaySubject = function(_super) {
3133
- __extends(ReplaySubject2, _super);
3134
- function ReplaySubject2(_bufferSize, _windowTime, _timestampProvider) {
3135
- if (_bufferSize === undefined) {
3136
- _bufferSize = Infinity;
3137
- }
3138
- if (_windowTime === undefined) {
3139
- _windowTime = Infinity;
3140
- }
3141
- if (_timestampProvider === undefined) {
3142
- _timestampProvider = dateTimestampProvider;
3143
- }
3144
- var _this = _super.call(this) || this;
3145
- _this._bufferSize = _bufferSize;
3146
- _this._windowTime = _windowTime;
3147
- _this._timestampProvider = _timestampProvider;
3148
- _this._buffer = [];
3149
- _this._infiniteTimeWindow = true;
3150
- _this._infiniteTimeWindow = _windowTime === Infinity;
3151
- _this._bufferSize = Math.max(1, _bufferSize);
3152
- _this._windowTime = Math.max(1, _windowTime);
3153
- return _this;
3154
- }
3155
- ReplaySubject2.prototype.next = function(value) {
3156
- var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime;
3157
- if (!isStopped) {
3158
- _buffer.push(value);
3159
- !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
3160
- }
3161
- this._trimBuffer();
3162
- _super.prototype.next.call(this, value);
3163
- };
3164
- ReplaySubject2.prototype._subscribe = function(subscriber) {
3165
- this._throwIfClosed();
3166
- this._trimBuffer();
3167
- var subscription = this._innerSubscribe(subscriber);
3168
- var _a = this, _infiniteTimeWindow = _a._infiniteTimeWindow, _buffer = _a._buffer;
3169
- var copy = _buffer.slice();
3170
- for (var i = 0;i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
3171
- subscriber.next(copy[i]);
3172
- }
3173
- this._checkFinalizedStatuses(subscriber);
3174
- return subscription;
3175
- };
3176
- ReplaySubject2.prototype._trimBuffer = function() {
3177
- var _a = this, _bufferSize = _a._bufferSize, _timestampProvider = _a._timestampProvider, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow;
3178
- var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
3179
- _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
3180
- if (!_infiniteTimeWindow) {
3181
- var now = _timestampProvider.now();
3182
- var last2 = 0;
3183
- for (var i = 1;i < _buffer.length && _buffer[i] <= now; i += 2) {
3184
- last2 = i;
3185
- }
3186
- last2 && _buffer.splice(0, last2 + 1);
3187
- }
3188
- };
3189
- return ReplaySubject2;
3190
- }(Subject);
3191
- function share(options) {
3192
- if (options === undefined) {
3193
- options = {};
3194
- }
3195
- var _a = options.connector, connector = _a === undefined ? function() {
3196
- return new Subject;
3197
- } : _a, _b = options.resetOnError, resetOnError = _b === undefined ? true : _b, _c = options.resetOnComplete, resetOnComplete = _c === undefined ? true : _c, _d = options.resetOnRefCountZero, resetOnRefCountZero = _d === undefined ? true : _d;
3198
- return function(wrapperSource) {
3199
- var connection;
3200
- var resetConnection;
3201
- var subject;
3202
- var refCount = 0;
3203
- var hasCompleted = false;
3204
- var hasErrored = false;
3205
- var cancelReset = function() {
3206
- resetConnection === null || resetConnection === undefined || resetConnection.unsubscribe();
3207
- resetConnection = undefined;
3208
- };
3209
- var reset = function() {
3210
- cancelReset();
3211
- connection = subject = undefined;
3212
- hasCompleted = hasErrored = false;
3213
- };
3214
- var resetAndUnsubscribe = function() {
3215
- var conn = connection;
3216
- reset();
3217
- conn === null || conn === undefined || conn.unsubscribe();
3218
- };
3219
- return operate(function(source, subscriber) {
3220
- refCount++;
3221
- if (!hasErrored && !hasCompleted) {
3222
- cancelReset();
3223
- }
3224
- var dest = subject = subject !== null && subject !== undefined ? subject : connector();
3225
- subscriber.add(function() {
3226
- refCount--;
3227
- if (refCount === 0 && !hasErrored && !hasCompleted) {
3228
- resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);
3229
- }
3230
- });
3231
- dest.subscribe(subscriber);
3232
- if (!connection && refCount > 0) {
3233
- connection = new SafeSubscriber({
3234
- next: function(value) {
3235
- return dest.next(value);
3236
- },
3237
- error: function(err) {
3238
- hasErrored = true;
3239
- cancelReset();
3240
- resetConnection = handleReset(reset, resetOnError, err);
3241
- dest.error(err);
3242
- },
3243
- complete: function() {
3244
- hasCompleted = true;
3245
- cancelReset();
3246
- resetConnection = handleReset(reset, resetOnComplete);
3247
- dest.complete();
3248
- }
3249
- });
3250
- innerFrom(source).subscribe(connection);
3251
- }
3252
- })(wrapperSource);
3253
- };
3254
- }
3255
- function handleReset(reset, on) {
3256
- var args = [];
3257
- for (var _i = 2;_i < arguments.length; _i++) {
3258
- args[_i - 2] = arguments[_i];
3259
- }
3260
- if (on === true) {
3261
- reset();
3262
- return;
3263
- }
3264
- if (on === false) {
3265
- return;
3266
- }
3267
- var onSubscriber = new SafeSubscriber({
3268
- next: function() {
3269
- onSubscriber.unsubscribe();
3270
- reset();
3271
- }
3272
- });
3273
- return innerFrom(on.apply(undefined, __spreadArray([], __read(args)))).subscribe(onSubscriber);
3274
- }
3275
- function shareReplay(configOrBufferSize, windowTime, scheduler) {
3276
- var _a, _b, _c;
3277
- var bufferSize;
3278
- var refCount = false;
3279
- if (configOrBufferSize && typeof configOrBufferSize === "object") {
3280
- _a = configOrBufferSize.bufferSize, bufferSize = _a === undefined ? Infinity : _a, _b = configOrBufferSize.windowTime, windowTime = _b === undefined ? Infinity : _b, _c = configOrBufferSize.refCount, refCount = _c === undefined ? false : _c, scheduler = configOrBufferSize.scheduler;
3281
- } else {
3282
- bufferSize = configOrBufferSize !== null && configOrBufferSize !== undefined ? configOrBufferSize : Infinity;
3283
- }
3284
- return share({
3285
- connector: function() {
3286
- return new ReplaySubject(bufferSize, windowTime, scheduler);
3287
- },
3288
- resetOnError: true,
3289
- resetOnComplete: false,
3290
- resetOnRefCountZero: refCount
3291
- });
3292
- }
3293
- function switchMap(project, resultSelector) {
3294
- return operate(function(source, subscriber) {
3295
- var innerSubscriber = null;
3296
- var index = 0;
3297
- var isComplete = false;
3298
- var checkComplete = function() {
3299
- return isComplete && !innerSubscriber && subscriber.complete();
3300
- };
3301
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
3302
- innerSubscriber === null || innerSubscriber === undefined || innerSubscriber.unsubscribe();
3303
- var innerIndex = 0;
3304
- var outerIndex = index++;
3305
- innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, function(innerValue) {
3306
- return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue);
3307
- }, function() {
3308
- innerSubscriber = null;
3309
- checkComplete();
3310
- }));
3311
- }, function() {
3312
- isComplete = true;
3313
- checkComplete();
3314
- }));
3315
- });
3316
- }
3317
- function takeUntil(notifier) {
3318
- return operate(function(source, subscriber) {
3319
- innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, function() {
3320
- return subscriber.complete();
3321
- }, noop));
3322
- !subscriber.closed && source.subscribe(subscriber);
3323
- });
3324
- }
3325
- function takeWhile(predicate, inclusive) {
3326
- if (inclusive === undefined) {
3327
- inclusive = false;
3328
- }
3329
- return operate(function(source, subscriber) {
3330
- var index = 0;
3331
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
3332
- var result = predicate(value, index++);
3333
- (result || inclusive) && subscriber.next(value);
3334
- !result && subscriber.complete();
3335
- }));
3336
- });
3337
- }
3338
- function tap(observerOrNext, error, complete) {
3339
- var tapObserver = isFunction(observerOrNext) || error || complete ? { next: observerOrNext, error, complete } : observerOrNext;
3340
- return tapObserver ? operate(function(source, subscriber) {
3341
- var _a;
3342
- (_a = tapObserver.subscribe) === null || _a === undefined || _a.call(tapObserver);
3343
- var isUnsub = true;
3344
- source.subscribe(createOperatorSubscriber(subscriber, function(value) {
3345
- var _a2;
3346
- (_a2 = tapObserver.next) === null || _a2 === undefined || _a2.call(tapObserver, value);
3347
- subscriber.next(value);
3348
- }, function() {
3349
- var _a2;
3350
- isUnsub = false;
3351
- (_a2 = tapObserver.complete) === null || _a2 === undefined || _a2.call(tapObserver);
3352
- subscriber.complete();
3353
- }, function(err) {
3354
- var _a2;
3355
- isUnsub = false;
3356
- (_a2 = tapObserver.error) === null || _a2 === undefined || _a2.call(tapObserver, err);
3357
- subscriber.error(err);
3358
- }, function() {
3359
- var _a2, _b;
3360
- if (isUnsub) {
3361
- (_a2 = tapObserver.unsubscribe) === null || _a2 === undefined || _a2.call(tapObserver);
3362
- }
3363
- (_b = tapObserver.finalize) === null || _b === undefined || _b.call(tapObserver);
3364
- }));
3365
- }) : identity;
3366
- }
3367
-
3368
- class LivequeryDocument extends BehaviorSubject {
3369
- collection;
3370
- document;
3371
- constructor(collection, document) {
3372
- super(document);
3373
- this.collection = collection;
3374
- this.document = document;
3375
- }
3376
- update(data) {
3377
- const id = this.value.id;
3378
- return this.collection.update(id, data);
3379
- }
3380
- del() {
3381
- const id = this.value.id;
3382
- return this.collection.delete(id);
3383
- }
3384
- trigger(action, payload) {
3385
- return this.collection.trigger(action, payload);
3386
- }
3387
- }
3388
-
3389
- class LivequeryCollection {
3390
- options;
3391
- id = (Math.random() * 1000000000000000000).toString(36);
3392
- #keys = new Map;
3393
- #indexes;
3394
- #core;
3395
- #filters = new Subject;
3396
- ref;
3397
- collection_ref;
3398
- items;
3399
- summary;
3400
- metadata;
3401
- loading;
3402
- filters;
3403
- paging;
3404
- error;
3405
- constructor(options = {}) {
3406
- this.options = options;
3407
- this.#indexes = new Map;
3408
- this.items = new BehaviorSubject([]);
3409
- this.summary = new BehaviorSubject({});
3410
- this.loading = new BehaviorSubject(null);
3411
- this.filters = new BehaviorSubject(options?.filters || {});
3412
- this.paging = new BehaviorSubject({
3413
- total: 0,
3414
- current: 0
3415
- });
3416
- this.error = new BehaviorSubject(null);
3417
- if (options) {
3418
- this.options = options;
3419
- }
3420
- }
3421
- #commit(items) {
3422
- this.items.next(items);
3423
- this.#indexes = items.reduce((p, c, index) => {
3424
- p.set(c.value.id, index);
3425
- return p;
3426
- }, new Map);
3427
- }
3428
- #subscription = null;
3429
- initialize(core, ref) {
3430
- if (typeof window == "undefined")
3431
- return;
3432
- this.ref = ref;
3433
- const refs = ref.split("/");
3434
- this.collection_ref = refs.length % 2 == 0 ? refs.slice(0, -1).join("/") : ref;
3435
- this.#core = core;
3436
- const timer2 = this.options.lazy !== true && setTimeout(() => !ref.includes("undefined") && this.query(this.filters.value || {}));
3437
- this.#subscription?.unsubscribe();
3438
- this.#subscription = merge(this.options.debounce ? merge(this.#filters.pipe(debounceTime(this.options.debounce), switchMap((filters) => this.query(filters)))) : EMPTY, core.watch(this.ref, this.id, this.options.mode || "server-first").pipe(finalize(() => {
3439
- timer2 && clearTimeout(timer2);
3440
- }), tap((event) => {
3441
- event.loading !== undefined && event.loading !== this.loading.value && this.loading.next(event.loading);
3442
- event.summary && this.summary.next(event.summary);
3443
- event.metadata && this.metadata.next(event.metadata);
3444
- event.paging && this.paging.next(event.paging);
3445
- event.error && this.error.next(event.error);
3446
- if (!event.changes || event.changes.length == 0)
3447
- return;
3448
- const chaos = event.changes && event.changes.some((change) => {
3449
- if (change.type == "added" || change.type == "removed")
3450
- return true;
3451
- if (change.data && change.data.id != change.id)
3452
- return true;
3453
- return Object.keys(change.data || {}).some((k) => this.#keys.has(k));
3454
- });
3455
- const sorter = (a, b) => {
3456
- for (const [key, order] of this.#keys) {
3457
- const va = a.value[key];
3458
- const vb = b.value[key];
3459
- if (typeof va === "number" && typeof vb === "number") {
3460
- if (va < vb)
3461
- return -order;
3462
- if (va > vb)
3463
- return order;
3464
- }
3465
- if (typeof va === "string" && typeof vb === "string") {
3466
- if (va < vb)
3467
- return -order;
3468
- if (va > vb)
3469
- return order;
3470
- }
3471
- }
3472
- return 0;
3473
- };
3474
- const events = event.changes.reduce((p, c) => {
3475
- return {
3476
- ...p,
3477
- [c.type]: [
3478
- ...p[c.type] || [],
3479
- c
3480
- ]
3481
- };
3482
- }, {
3483
- added: [],
3484
- modified: [],
3485
- removed: []
3486
- });
3487
- const updated_items = events.modified.reduce((p, { data, id }) => {
3488
- const index = this.#indexes.get(id);
3489
- const target = index != null && index >= 0 ? p[index] : null;
3490
- target && target.next({ ...target.value, ...data });
3491
- return p;
3492
- }, this.items.value);
3493
- const new_items = events.added.filter((a) => a.data).reduce((p, c) => {
3494
- if (!p.indexes.has(c.id)) {
3495
- const doc = new LivequeryDocument(this, { id: c.id, ...c.data });
3496
- p.list.push(doc);
3497
- p.indexes.add(c.id);
3498
- }
3499
- return p;
3500
- }, {
3501
- list: [],
3502
- indexes: new Set(this.#indexes.keys())
3503
- });
3504
- const remove_indexes = events.removed.map((r) => this.#indexes.get(r.id)).filter((i) => i != null).sort((a, b) => b - a);
3505
- const unsort_items = remove_indexes.reduce((p, index) => {
3506
- return [
3507
- ...p.slice(0, index),
3508
- ...p.slice(index + 1)
3509
- ];
3510
- }, [
3511
- ...updated_items,
3512
- ...new_items.list
3513
- ]);
3514
- const items = chaos ? unsort_items.sort(sorter) : unsort_items;
3515
- chaos && this.#commit(items);
3516
- event.paging && this.paging.next(event.paging);
3517
- }))).subscribe();
3518
- return this.#subscription;
3519
- }
3520
- async#query(filters, flush) {
3521
- if (!this.#core)
3522
- return;
3523
- if (!this.ref)
3524
- return;
3525
- this.error.next(null);
3526
- flush && this.#commit([]);
3527
- this.#keys = Object.entries(filters).reduce((p, [k, v]) => {
3528
- if (k.endsWith(":sort")) {
3529
- const field = k.split(":")[0];
3530
- p.set(field, v === "asc" ? 1 : -1);
3531
- }
3532
- return p;
3533
- }, new Map);
3534
- this.filters.next(filters);
3535
- const cache = await this.#core.query({
3536
- ref: this.ref,
3537
- filters,
3538
- collection_id: this.id
3539
- });
3540
- if (cache && cache.documents && flush) {
3541
- this.#commit(cache.documents.map((i) => new LivequeryDocument(this, i)));
3542
- }
3543
- }
3544
- async query(filters) {
3545
- await this.#query(filters, true);
3546
- }
3547
- async debounceQuery(filters) {
3548
- this.#filters.next(filters);
3549
- }
3550
- async loadMore() {
3551
- const next = this.paging.value.next;
3552
- if (!next)
3553
- return;
3554
- const filters = {
3555
- ...this.filters.value,
3556
- ":after": next.cursor
3557
- };
3558
- await this.#query(filters || {}, false);
3559
- }
3560
- async loadPrev() {
3561
- const prev = this.paging.value.prev;
3562
- if (!prev)
3563
- return;
3564
- const filters = {
3565
- ...this.filters.value,
3566
- ":before": prev.cursor
3567
- };
3568
- await this.#query(filters || {}, false);
3569
- }
3570
- async loadAround(cursor) {
3571
- const filters = {
3572
- ...this.filters.value,
3573
- ":after": cursor,
3574
- ":before": cursor
3575
- };
3576
- await this.#query(filters || {}, false);
3577
- }
3578
- add(payload) {
3579
- if (!this.#core)
3580
- throw new Error("LivequeryCollection is not initialized with a core instance");
3581
- if (!this.collection_ref)
3582
- throw new Error("LivequeryCollection is not initialized with a ref");
3583
- return this.#core.add(this.collection_ref, payload);
3584
- }
3585
- update(id, payload) {
3586
- if (!this.#core)
3587
- throw new Error("LivequeryCollection is not initialized with a core instance");
3588
- if (!this.collection_ref)
3589
- throw new Error("LivequeryCollection is not initialized with a ref");
3590
- return this.#core.update(this.collection_ref, id, payload);
3591
- }
3592
- delete(id) {
3593
- if (!this.#core)
3594
- throw new Error("LivequeryCollection is not initialized with a core instance");
3595
- if (!this.collection_ref)
3596
- throw new Error("LivequeryCollection is not initialized with a ref");
3597
- return this.#core.delete(this.collection_ref, id);
3598
- }
3599
- trigger(action, payload) {
3600
- if (!this.#core)
3601
- throw new Error("LivequeryCollection is not initialized with a core instance");
3602
- if (!this.ref)
3603
- throw new Error("LivequeryCollection is not initialized with a ref");
3604
- return this.#core.trigger({
3605
- action,
3606
- payload,
3607
- ref: this.ref
3608
- });
3609
- }
3610
- resetError() {
3611
- this.error.next(null);
3612
- }
3613
- watch(check) {
3614
- return this.items.pipe(switchMap((items) => merge(...items.map((item) => item.pipe(pairwise(), filter(([p, n]) => {
3615
- return check(p, n);
3616
- }))))));
3617
- }
3618
- }
3619
- var tryCatch = async (fn) => {
3620
- try {
3621
- const result = await fn();
3622
- return [undefined, result];
3623
- } catch (error) {
3624
- return [error, undefined];
3625
- }
3626
- };
3627
- function whenCompleted(stream) {
3628
- return stream.pipe(materialize(), filter((n) => n.kind === "C" || n.kind === "E"), map(() => {
3629
- return;
3630
- }), shareReplay(1));
3631
- }
3632
- function filterDocs(documents, filters) {
3633
- if (!filters)
3634
- return documents;
3635
- const normalized = filters;
3636
- return documents.filter((doc) => matchesAllFilters(doc, normalized));
3637
- }
3638
- function matchesAllFilters(doc, filters) {
3639
- for (const [key, expected] of Object.entries(filters)) {
3640
- if (key.startsWith(":") || key.endsWith(":sort"))
3641
- continue;
3642
- const split = key.split(":");
3643
- const fieldPath = split[0];
3644
- if (!fieldPath)
3645
- continue;
3646
- const op = split[1] || "eq";
3647
- const actual = getByPath(doc, fieldPath);
3648
- if (!matchByOperator(actual, op, expected)) {
3649
- return false;
3650
- }
3651
- }
3652
- return true;
3653
- }
3654
- function matchByOperator(actual, op, expected) {
3655
- switch (op) {
3656
- case "gt":
3657
- return asNumber(actual) > asNumber(expected);
3658
- case "gte":
3659
- return asNumber(actual) >= asNumber(expected);
3660
- case "lt":
3661
- return asNumber(actual) < asNumber(expected);
3662
- case "lte":
3663
- return asNumber(actual) <= asNumber(expected);
3664
- case "eq-number":
3665
- return asNumber(actual) === asNumber(expected);
3666
- case "in":
3667
- return Array.isArray(expected) ? expected.includes(actual) : false;
3668
- case "nin":
3669
- return Array.isArray(expected) ? !expected.includes(actual) : true;
3670
- case "include":
3671
- return Array.isArray(actual) ? actual.includes(expected) : false;
3672
- case "boolean":
3673
- return matchBoolean(actual, expected);
3674
- case "like":
3675
- return String(actual || "").toLowerCase().includes(String(expected || "").toLowerCase());
3676
- case "null":
3677
- return expected === "null-only" ? actual === null || typeof actual === "undefined" : actual !== null && typeof actual !== "undefined";
3678
- case "eq":
3679
- default:
3680
- return actual === expected;
3681
- }
3682
- }
3683
- function matchBoolean(actual, expected) {
3684
- switch (expected) {
3685
- case "true":
3686
- return actual === true;
3687
- case "false":
3688
- return actual === false;
3689
- case "not-true":
3690
- return actual !== true;
3691
- case "not-false":
3692
- return actual !== false;
3693
- default:
3694
- return false;
3695
- }
3696
- }
3697
- function getByPath(obj, path) {
3698
- if (!path.includes("."))
3699
- return obj[path];
3700
- return path.split(".").reduce((acc, key) => {
3701
- if (!acc || typeof acc !== "object")
3702
- return;
3703
- return acc[key];
3704
- }, obj);
3705
- }
3706
- function asNumber(value) {
3707
- return Number(value);
3708
- }
3709
-
3710
- class LivequeryCore {
3711
- config;
3712
- #collections = new Map;
3713
- #refs = new Map;
3714
- #queries$ = new Subject;
3715
- #adding = new Map;
3716
- constructor(config3) {
3717
- this.config = config3;
3718
- this.#start();
3719
- }
3720
- #cache = new Map;
3721
- #query(e, deduplicate_key) {
3722
- const clear = () => deduplicate_key && this.#cache.delete(deduplicate_key);
3723
- const cached = deduplicate_key && this.#cache.get(deduplicate_key);
3724
- if (cached)
3725
- return Object.assign(cached, { clear });
3726
- const $ = from(Object.values(this.config.transporters)).pipe(mergeMap((transporter) => transporter.query(e).pipe(tap((result) => {
3727
- for (const change of result.changes || []) {
3728
- change.type == "added" && change.data && this.config.storage.add(change.collection_ref, {
3729
- id: change.data.id,
3730
- ...change.data
3731
- });
3732
- change.type == "modified" && change.data && this.config.storage.update(change.collection_ref, change.id, change.data);
3733
- change.type == "removed" && this.config.storage.delete(change.collection_ref, change.id);
3734
- }
3735
- }), map((result, index) => ({ result, index })), mergeMap(({ result, index }) => {
3736
- if (index == 0)
3737
- return of(result);
3738
- const changes = result.changes || [];
3739
- if (changes.length === 0)
3740
- return EMPTY;
3741
- const lock$ = this.#adding.get(e.collection.collection_ref);
3742
- if (!lock$) {
3743
- this.#broadcast(e.collection.collection_ref, "realtime", changes);
3744
- return EMPTY;
3745
- }
3746
- const ok_changes = changes.filter((c) => c.type != "added");
3747
- const delay_changes = changes.filter((c) => c.type == "added");
3748
- this.#broadcast(e.collection.collection_ref, "realtime", ok_changes);
3749
- return lock$.pipe(tap(() => this.#broadcast(e.collection.collection_ref, "realtime", delay_changes)), switchMap(() => EMPTY));
3750
- }))), finalize(clear), shareReplay());
3751
- deduplicate_key && this.#cache.set(deduplicate_key, $);
3752
- return Object.assign($, { clear });
3753
- }
3754
- #start() {
3755
- lastValueFrom(merge(this.#queries$.pipe(filter((req) => req.collection.mode == "server-first" || req.collection.mode == "cache-first"), mergeMap((e) => {
3756
- const deduplicate_key = `${e.collection.collection_id}:${JSON.stringify(e.filters)}`;
3757
- const before = e.filters?.[":before"];
3758
- const after = e.filters?.[":after"];
3759
- const around = e.filters?.[":around"];
3760
- const loading = !before && !after || before && after || around ? "all" : before ? "prev" : "next";
3761
- e.collection.data$.next({
3762
- from: "query",
3763
- loading: e.collection.document_id ? "all" : loading
3764
- });
3765
- return this.#query(e, deduplicate_key).pipe(takeUntil(whenCompleted(e.collection.data$)), tap((result) => {
3766
- e.collection.data$.next({
3767
- ...result,
3768
- from: "query",
3769
- loading: null
3770
- });
3771
- }));
3772
- })), this.#queries$.pipe(filter((req) => req.collection.mode == "local-first"), groupBy((e) => `${e.collection.collection_ref}/${e.collection.document_id || "::"}`), mergeMap(($) => $.pipe(mergeMap((e, index) => {
3773
- index == 0 && e.collection.data$.next({
3774
- from: "query",
3775
- loading: "all"
3776
- });
3777
- return merge(of(e), index > 0 ? EMPTY : defer(() => {
3778
- return this.#query(e).pipe(expand((res) => {
3779
- const next = res.paging?.next;
3780
- if (!next)
3781
- return EMPTY;
3782
- return this.#query({
3783
- ...e,
3784
- filters: { ":after": next.cursor }
3785
- });
3786
- }), tap((result) => {
3787
- this.#broadcast(e.collection.collection_ref, "query", result.changes || []);
3788
- }));
3789
- }).pipe(switchMap(() => EMPTY)));
3790
- }), scan((p, c) => new Set([...p, c.collection.data$].filter(($2) => !$2.closed)), new Set), map((set) => [...set].map(($2) => whenCompleted($2))), switchMap((list) => forkJoin(list)), takeWhile(() => false))))));
3791
- }
3792
- watch(ref, collection_id, mode) {
3793
- const refs = ref.split("/");
3794
- const document_id = refs.length % 2 == 0 ? refs[refs.length - 1] : undefined;
3795
- const collection_ref = refs.length % 2 == 0 ? refs.slice(0, -1).join("/") : ref;
3796
- const collections = this.#refs.get(collection_ref) || new Set;
3797
- collections.add(collection_id);
3798
- this.#refs.set(collection_ref, collections);
3799
- const data$ = new Subject;
3800
- this.#collections.set(collection_id, {
3801
- data$,
3802
- document_id,
3803
- collection_id,
3804
- collection_ref,
3805
- mode,
3806
- filters: {}
3807
- });
3808
- return data$.pipe(finalize(() => {
3809
- this.#collections.delete(collection_id);
3810
- collections.delete(collection_id);
3811
- if (collections.size === 0) {
3812
- this.#refs.delete(collection_ref);
3813
- }
3814
- }));
3815
- }
3816
- async query(req) {
3817
- const collection = this.#collections.get(req.collection_id);
3818
- if (!collection)
3819
- throw new Error(`Collection with id ${req.collection_id} not found`);
3820
- if (collection.document_id) {
3821
- const ids = this.#refs.get(collection.collection_ref);
3822
- const collections = ids ? [...ids].map((id) => this.#collections.get(id)).filter((c) => c && c.document_id) : [];
3823
- const doc = await this.config.storage.get(collection.collection_ref, collection.document_id);
3824
- if (collections.length > 0 && doc)
3825
- return {
3826
- documents: [doc]
3827
- };
3828
- }
3829
- setTimeout(() => this.#queries$.next({
3830
- ...req,
3831
- filters: collection.mode == "local-first" ? {} : req.filters,
3832
- collection
3833
- }));
3834
- collection.filters = req.filters || {};
3835
- if (collection.mode == "local-first") {
3836
- return await this.config.storage.query(req.ref, req.filters);
3837
- }
3838
- if (collection.mode == "cache-first") {
3839
- const before = req.filters?.[":before"];
3840
- const after = req.filters?.[":after"];
3841
- const is_first_query = !before && !after;
3842
- if (is_first_query) {
3843
- return await this.config.storage.query(req.ref, req.filters);
3844
- }
3845
- }
3846
- }
3847
- #broadcast(collection_ref, from2, events) {
3848
- const collections = this.#refs.get(collection_ref) || new Set;
3849
- for (const collection_id of collections) {
3850
- const collection = this.#collections.get(collection_id);
3851
- if (!collection)
3852
- continue;
3853
- if (collection.document_id) {
3854
- const change = events.find((c) => c.id == collection.document_id);
3855
- change && collection.data$.next({
3856
- changes: [change],
3857
- from: from2,
3858
- loading: null
3859
- });
3860
- continue;
3861
- }
3862
- if (collection.mode == "local-first") {
3863
- const changes = events.filter((e) => {
3864
- if (e.type == "added")
3865
- return e.data && matchesAllFilters(e.data, collection.filters);
3866
- return true;
3867
- });
3868
- collection.data$.next({
3869
- changes,
3870
- from: from2,
3871
- ...from2 == "query" ? { loading: null } : {}
3872
- });
3873
- continue;
3874
- }
3875
- collection.data$.next({
3876
- changes: events,
3877
- from: from2,
3878
- ...from2 == "query" ? { loading: null } : {}
3879
- });
3880
- }
3881
- }
3882
- #push(collection_ref, id, doc) {
3883
- const cleanDoc = Object.entries(doc).reduce((p, [k, v]) => {
3884
- if (k.startsWith("_"))
3885
- return p;
3886
- return { ...p, [k]: v };
3887
- }, {});
3888
- return lastValueFrom(from(Object.entries(this.config.transporters)).pipe(concatMap(async ([_transporterId, transporter]) => {
3889
- if (String(id).startsWith("local:")) {
3890
- const o = new Subject;
3891
- this.#adding.set(collection_ref, o);
3892
- const [e, data] = await tryCatch(() => transporter.add(collection_ref, cleanDoc));
3893
- if (data && data.id) {
3894
- const fnd = {
3895
- ...data,
3896
- _adding: undefined,
3897
- ...e ? { _adding_error: e } : {}
3898
- };
3899
- await this.config.storage.update(collection_ref, id, fnd);
3900
- this.#broadcast(collection_ref, "action", [{
3901
- collection_ref,
3902
- type: "modified",
3903
- id,
3904
- data: fnd
3905
- }]);
3906
- }
3907
- o.next();
3908
- o.complete();
3909
- this.#adding.delete(collection_ref);
3910
- }
3911
- if (doc._deleting) {
3912
- const [e] = await tryCatch(() => transporter.delete(collection_ref, id));
3913
- if (e) {
3914
- const fnd = {
3915
- _deleting: undefined,
3916
- _deleting_error: e
3917
- };
3918
- await this.config.storage.update(collection_ref, id, fnd);
3919
- this.#broadcast(collection_ref, "action", [{
3920
- collection_ref,
3921
- type: "modified",
3922
- id,
3923
- data: fnd
3924
- }]);
3925
- } else {
3926
- await this.config.storage.delete(collection_ref, id);
3927
- this.#broadcast(collection_ref, "action", [{
3928
- collection_ref,
3929
- type: "removed",
3930
- id
3931
- }]);
3932
- }
3933
- }
3934
- if (doc._prev && Object.keys(doc._prev).length > 0) {
3935
- const changedFields = Object.keys(doc._prev).reduce((acc, key) => ({
3936
- ...acc,
3937
- [key]: doc[key]
3938
- }), {});
3939
- const [e] = await tryCatch(() => transporter.update(collection_ref, id, changedFields));
3940
- const fnd = {
3941
- _prev: undefined,
3942
- _updating: undefined,
3943
- _updating_error: e
3944
- };
3945
- await this.config.storage.update(collection_ref, id, fnd);
3946
- this.#broadcast(collection_ref, "action", [{
3947
- collection_ref,
3948
- type: "modified",
3949
- id,
3950
- data: fnd
3951
- }]);
3952
- }
3953
- return EMPTY;
3954
- })), { defaultValue: undefined });
3955
- }
3956
- async add(collection_ref, doc) {
3957
- const data = await this.config.storage.add(collection_ref, { ...doc, _adding: true });
3958
- this.#broadcast(collection_ref, "action", [{
3959
- collection_ref,
3960
- id: data.id,
3961
- type: "added",
3962
- data
3963
- }]);
3964
- await this.#push(collection_ref, data.id, data);
3965
- return data;
3966
- }
3967
- async update(collection_ref, id, data) {
3968
- const old = await this.config.storage.get(collection_ref, id);
3969
- if (!old)
3970
- return;
3971
- const _prev = Object.keys(data).reduce((acc, key) => {
3972
- if (key in (old._prev || {}))
3973
- return acc;
3974
- return {
3975
- ...acc,
3976
- [key]: old[key]
3977
- };
3978
- }, old._prev || {});
3979
- await this.config.storage.update(collection_ref, id, { _prev, _updating: true, ...data });
3980
- const doc = await this.#broadcast(collection_ref, "action", [{
3981
- collection_ref,
3982
- id,
3983
- type: "modified",
3984
- data: {
3985
- _prev,
3986
- _updating: true,
3987
- ...data
3988
- }
3989
- }]);
3990
- await this.#push(collection_ref, id, { ...data, _prev, _updating: true });
3991
- return doc;
3992
- }
3993
- async delete(collection_ref, id) {
3994
- const soft = Object.keys(this.config.transporters).length > 0;
3995
- const is_local_doc = id.startsWith("local:");
3996
- if (!soft || is_local_doc) {
3997
- await this.config.storage.delete(collection_ref, id);
3998
- await this.#broadcast(collection_ref, "action", [{
3999
- collection_ref,
4000
- id,
4001
- type: "removed"
4002
- }]);
4003
- return;
4004
- }
4005
- await this.config.storage.update(collection_ref, id, { _deleting: true });
4006
- const doc = await this.#broadcast(collection_ref, "action", [{
4007
- collection_ref,
4008
- id,
4009
- type: "modified",
4010
- data: {
4011
- _deleting: true
4012
- }
4013
- }]);
4014
- await this.#push(collection_ref, id, { _deleting: true });
4015
- return doc;
4016
- }
4017
- trigger(action) {
4018
- return from(Object.values(this.config.transporters)).pipe(mergeMap((transporter) => transporter.trigger(action)));
4019
- }
4020
- }
4021
-
4022
- class LivequeryMemoryStorage {
4023
- #collections = new Map;
4024
- async query(collection, filters) {
4025
- const sources = Array.from((this.#collections.get(collection) || new Map).values());
4026
- const f = filters || {};
4027
- const sorters = Object.entries(f).filter(([k]) => k.endsWith(":sort"));
4028
- const items = filterDocs(sources, f);
4029
- const sorted = this.#sortItems(items, sorters);
4030
- return {
4031
- documents: sorted,
4032
- paging: {
4033
- total: items.length,
4034
- current: sorted.length
4035
- }
4036
- };
4037
- }
4038
- get(ref, id) {
4039
- const docs = this.#collections.get(ref);
4040
- if (!docs)
4041
- return Promise.resolve(null);
4042
- const doc = docs.get(id) || null;
4043
- return Promise.resolve(doc);
4044
- }
4045
- async add(collection, document) {
4046
- const docs = this.#collections.get(collection) || new Map;
4047
- const doc = {
4048
- ...document,
4049
- id: document.id || `local:${crypto.randomUUID()}`
4050
- };
4051
- docs.set(doc.id, doc);
4052
- this.#collections.set(collection, docs);
4053
- return doc;
4054
- }
4055
- async update(collection, id, document) {
4056
- const docs = this.#collections.get(collection);
4057
- if (!docs)
4058
- return null;
4059
- const existing = docs.get(id);
4060
- if (!existing)
4061
- return null;
4062
- const next = {
4063
- ...existing,
4064
- ...document
4065
- };
4066
- if (document.id && document.id !== id) {
4067
- docs.delete(id);
4068
- docs.set(document.id, next);
4069
- } else {
4070
- docs.set(id, next);
4071
- }
4072
- return next;
4073
- }
4074
- async delete(collection, id) {
4075
- const docs = this.#collections.get(collection);
4076
- if (!docs)
4077
- return null;
4078
- const deleted = docs.get(id) || null;
4079
- docs.delete(id);
4080
- return deleted;
4081
- }
4082
- #sortItems(items, sorters) {
4083
- if (sorters.length === 0)
4084
- return [...items];
4085
- return [...items].sort((a, b) => {
4086
- for (const [sortKey, direction] of sorters) {
4087
- const fieldPath = sortKey.slice(0, -5);
4088
- const va = this.#getByPath(a, fieldPath);
4089
- const vb = this.#getByPath(b, fieldPath);
4090
- if (va === vb)
4091
- continue;
4092
- const order = va < vb ? -1 : 1;
4093
- return direction === "asc" ? order : -order;
4094
- }
4095
- return 0;
4096
- });
4097
- }
4098
- #getByPath(obj, path) {
4099
- if (!path.includes("."))
4100
- return obj[path];
4101
- return path.split(".").reduce((acc, key) => {
4102
- if (!acc || typeof acc !== "object")
4103
- return;
4104
- return acc[key];
4105
- }, obj);
4106
- }
4107
- }
4108
-
4109
18
  // src/useCollection.ts
4110
- var import_react2 = __toESM(require_react(), 1);
19
+ import { LivequeryCollection } from "@livequery/core";
20
+ import { useMemo, useEffect } from "react";
4111
21
  var livequeryCoreContext = createContextFromHook((props) => props.core);
4112
22
  var useLivequeryCore = livequeryCoreContext[0];
4113
23
  var LivequeryCoreProvider = livequeryCoreContext[1];
4114
24
  var useCollection = (ref, options = {}) => {
4115
25
  const core = useLivequeryCore();
4116
- const collection = import_react2.useMemo(() => new LivequeryCollection(options), []);
4117
- import_react2.useEffect(() => {
26
+ const collection = useMemo(() => new LivequeryCollection(options), []);
27
+ useEffect(() => {
4118
28
  if (!ref || !core)
4119
29
  return;
4120
30
  const linker = collection.initialize(core, ref);
@@ -4125,732 +35,18 @@ var useCollection = (ref, options = {}) => {
4125
35
  return collection;
4126
36
  };
4127
37
  // src/useDocument.ts
4128
- var import_react4 = __toESM(require_react(), 1);
4129
-
4130
- // src/useObservable.ts
4131
- var import_react3 = __toESM(require_react(), 1);
4132
- // node_modules/tslib/tslib.es6.mjs
4133
- var extendStatics2 = function(d, b) {
4134
- extendStatics2 = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
4135
- d2.__proto__ = b2;
4136
- } || function(d2, b2) {
4137
- for (var p in b2)
4138
- if (Object.prototype.hasOwnProperty.call(b2, p))
4139
- d2[p] = b2[p];
4140
- };
4141
- return extendStatics2(d, b);
4142
- };
4143
- function __extends2(d, b) {
4144
- if (typeof b !== "function" && b !== null)
4145
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
4146
- extendStatics2(d, b);
4147
- function __() {
4148
- this.constructor = d;
4149
- }
4150
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __);
4151
- }
4152
- function __values2(o) {
4153
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4154
- if (m)
4155
- return m.call(o);
4156
- if (o && typeof o.length === "number")
4157
- return {
4158
- next: function() {
4159
- if (o && i >= o.length)
4160
- o = undefined;
4161
- return { value: o && o[i++], done: !o };
4162
- }
4163
- };
4164
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
4165
- }
4166
- function __read2(o, n) {
4167
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4168
- if (!m)
4169
- return o;
4170
- var i = m.call(o), r, ar = [], e;
4171
- try {
4172
- while ((n === undefined || n-- > 0) && !(r = i.next()).done)
4173
- ar.push(r.value);
4174
- } catch (error) {
4175
- e = { error };
4176
- } finally {
4177
- try {
4178
- if (r && !r.done && (m = i["return"]))
4179
- m.call(i);
4180
- } finally {
4181
- if (e)
4182
- throw e.error;
4183
- }
4184
- }
4185
- return ar;
4186
- }
4187
- function __spreadArray2(to, from2, pack) {
4188
- if (pack || arguments.length === 2)
4189
- for (var i = 0, l = from2.length, ar;i < l; i++) {
4190
- if (ar || !(i in from2)) {
4191
- if (!ar)
4192
- ar = Array.prototype.slice.call(from2, 0, i);
4193
- ar[i] = from2[i];
4194
- }
4195
- }
4196
- return to.concat(ar || Array.prototype.slice.call(from2));
4197
- }
4198
-
4199
- // node_modules/rxjs/dist/esm5/internal/util/isFunction.js
4200
- function isFunction2(value) {
4201
- return typeof value === "function";
4202
- }
4203
-
4204
- // node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js
4205
- function createErrorClass2(createImpl) {
4206
- var _super = function(instance) {
4207
- Error.call(instance);
4208
- instance.stack = new Error().stack;
4209
- };
4210
- var ctorFunc = createImpl(_super);
4211
- ctorFunc.prototype = Object.create(Error.prototype);
4212
- ctorFunc.prototype.constructor = ctorFunc;
4213
- return ctorFunc;
4214
- }
4215
-
4216
- // node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js
4217
- var UnsubscriptionError2 = createErrorClass2(function(_super) {
4218
- return function UnsubscriptionErrorImpl(errors) {
4219
- _super(this);
4220
- this.message = errors ? errors.length + ` errors occurred during unsubscription:
4221
- ` + errors.map(function(err, i) {
4222
- return i + 1 + ") " + err.toString();
4223
- }).join(`
4224
- `) : "";
4225
- this.name = "UnsubscriptionError";
4226
- this.errors = errors;
4227
- };
4228
- });
4229
-
4230
- // node_modules/rxjs/dist/esm5/internal/util/arrRemove.js
4231
- function arrRemove2(arr, item) {
4232
- if (arr) {
4233
- var index = arr.indexOf(item);
4234
- 0 <= index && arr.splice(index, 1);
4235
- }
4236
- }
4237
-
4238
- // node_modules/rxjs/dist/esm5/internal/Subscription.js
4239
- var Subscription2 = function() {
4240
- function Subscription3(initialTeardown) {
4241
- this.initialTeardown = initialTeardown;
4242
- this.closed = false;
4243
- this._parentage = null;
4244
- this._finalizers = null;
4245
- }
4246
- Subscription3.prototype.unsubscribe = function() {
4247
- var e_1, _a, e_2, _b;
4248
- var errors;
4249
- if (!this.closed) {
4250
- this.closed = true;
4251
- var _parentage = this._parentage;
4252
- if (_parentage) {
4253
- this._parentage = null;
4254
- if (Array.isArray(_parentage)) {
4255
- try {
4256
- for (var _parentage_1 = __values2(_parentage), _parentage_1_1 = _parentage_1.next();!_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
4257
- var parent_1 = _parentage_1_1.value;
4258
- parent_1.remove(this);
4259
- }
4260
- } catch (e_1_1) {
4261
- e_1 = { error: e_1_1 };
4262
- } finally {
4263
- try {
4264
- if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return))
4265
- _a.call(_parentage_1);
4266
- } finally {
4267
- if (e_1)
4268
- throw e_1.error;
4269
- }
4270
- }
4271
- } else {
4272
- _parentage.remove(this);
4273
- }
4274
- }
4275
- var initialFinalizer = this.initialTeardown;
4276
- if (isFunction2(initialFinalizer)) {
4277
- try {
4278
- initialFinalizer();
4279
- } catch (e) {
4280
- errors = e instanceof UnsubscriptionError2 ? e.errors : [e];
4281
- }
4282
- }
4283
- var _finalizers = this._finalizers;
4284
- if (_finalizers) {
4285
- this._finalizers = null;
4286
- try {
4287
- for (var _finalizers_1 = __values2(_finalizers), _finalizers_1_1 = _finalizers_1.next();!_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
4288
- var finalizer = _finalizers_1_1.value;
4289
- try {
4290
- execFinalizer2(finalizer);
4291
- } catch (err) {
4292
- errors = errors !== null && errors !== undefined ? errors : [];
4293
- if (err instanceof UnsubscriptionError2) {
4294
- errors = __spreadArray2(__spreadArray2([], __read2(errors)), __read2(err.errors));
4295
- } else {
4296
- errors.push(err);
4297
- }
4298
- }
4299
- }
4300
- } catch (e_2_1) {
4301
- e_2 = { error: e_2_1 };
4302
- } finally {
4303
- try {
4304
- if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return))
4305
- _b.call(_finalizers_1);
4306
- } finally {
4307
- if (e_2)
4308
- throw e_2.error;
4309
- }
4310
- }
4311
- }
4312
- if (errors) {
4313
- throw new UnsubscriptionError2(errors);
4314
- }
4315
- }
4316
- };
4317
- Subscription3.prototype.add = function(teardown) {
4318
- var _a;
4319
- if (teardown && teardown !== this) {
4320
- if (this.closed) {
4321
- execFinalizer2(teardown);
4322
- } else {
4323
- if (teardown instanceof Subscription3) {
4324
- if (teardown.closed || teardown._hasParent(this)) {
4325
- return;
4326
- }
4327
- teardown._addParent(this);
4328
- }
4329
- (this._finalizers = (_a = this._finalizers) !== null && _a !== undefined ? _a : []).push(teardown);
4330
- }
4331
- }
4332
- };
4333
- Subscription3.prototype._hasParent = function(parent) {
4334
- var _parentage = this._parentage;
4335
- return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
4336
- };
4337
- Subscription3.prototype._addParent = function(parent) {
4338
- var _parentage = this._parentage;
4339
- this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
4340
- };
4341
- Subscription3.prototype._removeParent = function(parent) {
4342
- var _parentage = this._parentage;
4343
- if (_parentage === parent) {
4344
- this._parentage = null;
4345
- } else if (Array.isArray(_parentage)) {
4346
- arrRemove2(_parentage, parent);
4347
- }
4348
- };
4349
- Subscription3.prototype.remove = function(teardown) {
4350
- var _finalizers = this._finalizers;
4351
- _finalizers && arrRemove2(_finalizers, teardown);
4352
- if (teardown instanceof Subscription3) {
4353
- teardown._removeParent(this);
4354
- }
4355
- };
4356
- Subscription3.EMPTY = function() {
4357
- var empty = new Subscription3;
4358
- empty.closed = true;
4359
- return empty;
4360
- }();
4361
- return Subscription3;
4362
- }();
4363
- var EMPTY_SUBSCRIPTION2 = Subscription2.EMPTY;
4364
- function isSubscription2(value) {
4365
- return value instanceof Subscription2 || value && "closed" in value && isFunction2(value.remove) && isFunction2(value.add) && isFunction2(value.unsubscribe);
4366
- }
4367
- function execFinalizer2(finalizer) {
4368
- if (isFunction2(finalizer)) {
4369
- finalizer();
4370
- } else {
4371
- finalizer.unsubscribe();
4372
- }
4373
- }
4374
-
4375
- // node_modules/rxjs/dist/esm5/internal/config.js
4376
- var config2 = {
4377
- onUnhandledError: null,
4378
- onStoppedNotification: null,
4379
- Promise: undefined,
4380
- useDeprecatedSynchronousErrorHandling: false,
4381
- useDeprecatedNextContext: false
4382
- };
4383
-
4384
- // node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js
4385
- var timeoutProvider2 = {
4386
- setTimeout: function(handler, timeout) {
4387
- var args = [];
4388
- for (var _i = 2;_i < arguments.length; _i++) {
4389
- args[_i - 2] = arguments[_i];
4390
- }
4391
- var delegate = timeoutProvider2.delegate;
4392
- if (delegate === null || delegate === undefined ? undefined : delegate.setTimeout) {
4393
- return delegate.setTimeout.apply(delegate, __spreadArray2([handler, timeout], __read2(args)));
4394
- }
4395
- return setTimeout.apply(undefined, __spreadArray2([handler, timeout], __read2(args)));
4396
- },
4397
- clearTimeout: function(handle) {
4398
- var delegate = timeoutProvider2.delegate;
4399
- return ((delegate === null || delegate === undefined ? undefined : delegate.clearTimeout) || clearTimeout)(handle);
4400
- },
4401
- delegate: undefined
4402
- };
4403
-
4404
- // node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js
4405
- function reportUnhandledError2(err) {
4406
- timeoutProvider2.setTimeout(function() {
4407
- var onUnhandledError = config2.onUnhandledError;
4408
- if (onUnhandledError) {
4409
- onUnhandledError(err);
4410
- } else {
4411
- throw err;
4412
- }
4413
- });
4414
- }
4415
-
4416
- // node_modules/rxjs/dist/esm5/internal/util/noop.js
4417
- function noop2() {}
4418
-
4419
- // node_modules/rxjs/dist/esm5/internal/NotificationFactories.js
4420
- var COMPLETE_NOTIFICATION2 = function() {
4421
- return createNotification2("C", undefined, undefined);
4422
- }();
4423
- function errorNotification2(error) {
4424
- return createNotification2("E", undefined, error);
4425
- }
4426
- function nextNotification2(value) {
4427
- return createNotification2("N", value, undefined);
4428
- }
4429
- function createNotification2(kind, value, error) {
4430
- return {
4431
- kind,
4432
- value,
4433
- error
4434
- };
4435
- }
4436
-
4437
- // node_modules/rxjs/dist/esm5/internal/util/errorContext.js
4438
- var context2 = null;
4439
- function errorContext2(cb) {
4440
- if (config2.useDeprecatedSynchronousErrorHandling) {
4441
- var isRoot = !context2;
4442
- if (isRoot) {
4443
- context2 = { errorThrown: false, error: null };
4444
- }
4445
- cb();
4446
- if (isRoot) {
4447
- var _a = context2, errorThrown = _a.errorThrown, error = _a.error;
4448
- context2 = null;
4449
- if (errorThrown) {
4450
- throw error;
4451
- }
4452
- }
4453
- } else {
4454
- cb();
4455
- }
4456
- }
4457
- function captureError2(err) {
4458
- if (config2.useDeprecatedSynchronousErrorHandling && context2) {
4459
- context2.errorThrown = true;
4460
- context2.error = err;
4461
- }
4462
- }
4463
-
4464
- // node_modules/rxjs/dist/esm5/internal/Subscriber.js
4465
- var Subscriber2 = function(_super) {
4466
- __extends2(Subscriber3, _super);
4467
- function Subscriber3(destination) {
4468
- var _this = _super.call(this) || this;
4469
- _this.isStopped = false;
4470
- if (destination) {
4471
- _this.destination = destination;
4472
- if (isSubscription2(destination)) {
4473
- destination.add(_this);
4474
- }
4475
- } else {
4476
- _this.destination = EMPTY_OBSERVER2;
4477
- }
4478
- return _this;
4479
- }
4480
- Subscriber3.create = function(next, error, complete) {
4481
- return new SafeSubscriber2(next, error, complete);
4482
- };
4483
- Subscriber3.prototype.next = function(value) {
4484
- if (this.isStopped) {
4485
- handleStoppedNotification2(nextNotification2(value), this);
4486
- } else {
4487
- this._next(value);
4488
- }
4489
- };
4490
- Subscriber3.prototype.error = function(err) {
4491
- if (this.isStopped) {
4492
- handleStoppedNotification2(errorNotification2(err), this);
4493
- } else {
4494
- this.isStopped = true;
4495
- this._error(err);
4496
- }
4497
- };
4498
- Subscriber3.prototype.complete = function() {
4499
- if (this.isStopped) {
4500
- handleStoppedNotification2(COMPLETE_NOTIFICATION2, this);
4501
- } else {
4502
- this.isStopped = true;
4503
- this._complete();
4504
- }
4505
- };
4506
- Subscriber3.prototype.unsubscribe = function() {
4507
- if (!this.closed) {
4508
- this.isStopped = true;
4509
- _super.prototype.unsubscribe.call(this);
4510
- this.destination = null;
4511
- }
4512
- };
4513
- Subscriber3.prototype._next = function(value) {
4514
- this.destination.next(value);
4515
- };
4516
- Subscriber3.prototype._error = function(err) {
4517
- try {
4518
- this.destination.error(err);
4519
- } finally {
4520
- this.unsubscribe();
4521
- }
4522
- };
4523
- Subscriber3.prototype._complete = function() {
4524
- try {
4525
- this.destination.complete();
4526
- } finally {
4527
- this.unsubscribe();
4528
- }
4529
- };
4530
- return Subscriber3;
4531
- }(Subscription2);
4532
- var _bind2 = Function.prototype.bind;
4533
- function bind2(fn, thisArg) {
4534
- return _bind2.call(fn, thisArg);
4535
- }
4536
- var ConsumerObserver2 = function() {
4537
- function ConsumerObserver3(partialObserver) {
4538
- this.partialObserver = partialObserver;
4539
- }
4540
- ConsumerObserver3.prototype.next = function(value) {
4541
- var partialObserver = this.partialObserver;
4542
- if (partialObserver.next) {
4543
- try {
4544
- partialObserver.next(value);
4545
- } catch (error) {
4546
- handleUnhandledError2(error);
4547
- }
4548
- }
4549
- };
4550
- ConsumerObserver3.prototype.error = function(err) {
4551
- var partialObserver = this.partialObserver;
4552
- if (partialObserver.error) {
4553
- try {
4554
- partialObserver.error(err);
4555
- } catch (error) {
4556
- handleUnhandledError2(error);
4557
- }
4558
- } else {
4559
- handleUnhandledError2(err);
4560
- }
4561
- };
4562
- ConsumerObserver3.prototype.complete = function() {
4563
- var partialObserver = this.partialObserver;
4564
- if (partialObserver.complete) {
4565
- try {
4566
- partialObserver.complete();
4567
- } catch (error) {
4568
- handleUnhandledError2(error);
4569
- }
4570
- }
4571
- };
4572
- return ConsumerObserver3;
4573
- }();
4574
- var SafeSubscriber2 = function(_super) {
4575
- __extends2(SafeSubscriber3, _super);
4576
- function SafeSubscriber3(observerOrNext, error, complete) {
4577
- var _this = _super.call(this) || this;
4578
- var partialObserver;
4579
- if (isFunction2(observerOrNext) || !observerOrNext) {
4580
- partialObserver = {
4581
- next: observerOrNext !== null && observerOrNext !== undefined ? observerOrNext : undefined,
4582
- error: error !== null && error !== undefined ? error : undefined,
4583
- complete: complete !== null && complete !== undefined ? complete : undefined
4584
- };
4585
- } else {
4586
- var context_1;
4587
- if (_this && config2.useDeprecatedNextContext) {
4588
- context_1 = Object.create(observerOrNext);
4589
- context_1.unsubscribe = function() {
4590
- return _this.unsubscribe();
4591
- };
4592
- partialObserver = {
4593
- next: observerOrNext.next && bind2(observerOrNext.next, context_1),
4594
- error: observerOrNext.error && bind2(observerOrNext.error, context_1),
4595
- complete: observerOrNext.complete && bind2(observerOrNext.complete, context_1)
4596
- };
4597
- } else {
4598
- partialObserver = observerOrNext;
4599
- }
4600
- }
4601
- _this.destination = new ConsumerObserver2(partialObserver);
4602
- return _this;
4603
- }
4604
- return SafeSubscriber3;
4605
- }(Subscriber2);
4606
- function handleUnhandledError2(error) {
4607
- if (config2.useDeprecatedSynchronousErrorHandling) {
4608
- captureError2(error);
4609
- } else {
4610
- reportUnhandledError2(error);
4611
- }
4612
- }
4613
- function defaultErrorHandler2(err) {
4614
- throw err;
4615
- }
4616
- function handleStoppedNotification2(notification, subscriber) {
4617
- var onStoppedNotification = config2.onStoppedNotification;
4618
- onStoppedNotification && timeoutProvider2.setTimeout(function() {
4619
- return onStoppedNotification(notification, subscriber);
4620
- });
4621
- }
4622
- var EMPTY_OBSERVER2 = {
4623
- closed: true,
4624
- next: noop2,
4625
- error: defaultErrorHandler2,
4626
- complete: noop2
4627
- };
4628
-
4629
- // node_modules/rxjs/dist/esm5/internal/symbol/observable.js
4630
- var observable2 = function() {
4631
- return typeof Symbol === "function" && Symbol.observable || "@@observable";
4632
- }();
4633
-
4634
- // node_modules/rxjs/dist/esm5/internal/util/identity.js
4635
- function identity2(x) {
4636
- return x;
4637
- }
4638
-
4639
- // node_modules/rxjs/dist/esm5/internal/util/pipe.js
4640
- function pipeFromArray2(fns) {
4641
- if (fns.length === 0) {
4642
- return identity2;
4643
- }
4644
- if (fns.length === 1) {
4645
- return fns[0];
4646
- }
4647
- return function piped(input) {
4648
- return fns.reduce(function(prev, fn) {
4649
- return fn(prev);
4650
- }, input);
4651
- };
4652
- }
4653
-
4654
- // node_modules/rxjs/dist/esm5/internal/Observable.js
4655
- var Observable2 = function() {
4656
- function Observable3(subscribe) {
4657
- if (subscribe) {
4658
- this._subscribe = subscribe;
4659
- }
4660
- }
4661
- Observable3.prototype.lift = function(operator) {
4662
- var observable3 = new Observable3;
4663
- observable3.source = this;
4664
- observable3.operator = operator;
4665
- return observable3;
4666
- };
4667
- Observable3.prototype.subscribe = function(observerOrNext, error, complete) {
4668
- var _this = this;
4669
- var subscriber = isSubscriber2(observerOrNext) ? observerOrNext : new SafeSubscriber2(observerOrNext, error, complete);
4670
- errorContext2(function() {
4671
- var _a = _this, operator = _a.operator, source = _a.source;
4672
- subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber));
4673
- });
4674
- return subscriber;
4675
- };
4676
- Observable3.prototype._trySubscribe = function(sink) {
4677
- try {
4678
- return this._subscribe(sink);
4679
- } catch (err) {
4680
- sink.error(err);
4681
- }
4682
- };
4683
- Observable3.prototype.forEach = function(next, promiseCtor) {
4684
- var _this = this;
4685
- promiseCtor = getPromiseCtor2(promiseCtor);
4686
- return new promiseCtor(function(resolve, reject) {
4687
- var subscriber = new SafeSubscriber2({
4688
- next: function(value) {
4689
- try {
4690
- next(value);
4691
- } catch (err) {
4692
- reject(err);
4693
- subscriber.unsubscribe();
4694
- }
4695
- },
4696
- error: reject,
4697
- complete: resolve
4698
- });
4699
- _this.subscribe(subscriber);
4700
- });
4701
- };
4702
- Observable3.prototype._subscribe = function(subscriber) {
4703
- var _a;
4704
- return (_a = this.source) === null || _a === undefined ? undefined : _a.subscribe(subscriber);
4705
- };
4706
- Observable3.prototype[observable2] = function() {
4707
- return this;
4708
- };
4709
- Observable3.prototype.pipe = function() {
4710
- var operations = [];
4711
- for (var _i = 0;_i < arguments.length; _i++) {
4712
- operations[_i] = arguments[_i];
4713
- }
4714
- return pipeFromArray2(operations)(this);
4715
- };
4716
- Observable3.prototype.toPromise = function(promiseCtor) {
4717
- var _this = this;
4718
- promiseCtor = getPromiseCtor2(promiseCtor);
4719
- return new promiseCtor(function(resolve, reject) {
4720
- var value;
4721
- _this.subscribe(function(x) {
4722
- return value = x;
4723
- }, function(err) {
4724
- return reject(err);
4725
- }, function() {
4726
- return resolve(value);
4727
- });
4728
- });
4729
- };
4730
- Observable3.create = function(subscribe) {
4731
- return new Observable3(subscribe);
4732
- };
4733
- return Observable3;
4734
- }();
4735
- function getPromiseCtor2(promiseCtor) {
4736
- var _a;
4737
- return (_a = promiseCtor !== null && promiseCtor !== undefined ? promiseCtor : config2.Promise) !== null && _a !== undefined ? _a : Promise;
4738
- }
4739
- function isObserver2(value) {
4740
- return value && isFunction2(value.next) && isFunction2(value.error) && isFunction2(value.complete);
4741
- }
4742
- function isSubscriber2(value) {
4743
- return value && value instanceof Subscriber2 || isObserver2(value) && isSubscription2(value);
4744
- }
4745
-
4746
- // node_modules/rxjs/dist/esm5/internal/observable/empty.js
4747
- var EMPTY2 = new Observable2(function(subscriber) {
4748
- return subscriber.complete();
4749
- });
4750
- // node_modules/rxjs/dist/esm5/internal/util/lift.js
4751
- function hasLift2(source) {
4752
- return isFunction2(source === null || source === undefined ? undefined : source.lift);
4753
- }
4754
- function operate2(init) {
4755
- return function(source) {
4756
- if (hasLift2(source)) {
4757
- return source.lift(function(liftedSource) {
4758
- try {
4759
- return init(liftedSource, this);
4760
- } catch (err) {
4761
- this.error(err);
4762
- }
4763
- });
4764
- }
4765
- throw new TypeError("Unable to lift unknown Observable type");
4766
- };
4767
- }
4768
-
4769
- // node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js
4770
- function createOperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize) {
4771
- return new OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize);
4772
- }
4773
- var OperatorSubscriber2 = function(_super) {
4774
- __extends2(OperatorSubscriber3, _super);
4775
- function OperatorSubscriber3(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
4776
- var _this = _super.call(this, destination) || this;
4777
- _this.onFinalize = onFinalize;
4778
- _this.shouldUnsubscribe = shouldUnsubscribe;
4779
- _this._next = onNext ? function(value) {
4780
- try {
4781
- onNext(value);
4782
- } catch (err) {
4783
- destination.error(err);
4784
- }
4785
- } : _super.prototype._next;
4786
- _this._error = onError ? function(err) {
4787
- try {
4788
- onError(err);
4789
- } catch (err2) {
4790
- destination.error(err2);
4791
- } finally {
4792
- this.unsubscribe();
4793
- }
4794
- } : _super.prototype._error;
4795
- _this._complete = onComplete ? function() {
4796
- try {
4797
- onComplete();
4798
- } catch (err) {
4799
- destination.error(err);
4800
- } finally {
4801
- this.unsubscribe();
4802
- }
4803
- } : _super.prototype._complete;
4804
- return _this;
4805
- }
4806
- OperatorSubscriber3.prototype.unsubscribe = function() {
4807
- var _a;
4808
- if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
4809
- var closed_1 = this.closed;
4810
- _super.prototype.unsubscribe.call(this);
4811
- !closed_1 && ((_a = this.onFinalize) === null || _a === undefined || _a.call(this));
4812
- }
4813
- };
4814
- return OperatorSubscriber3;
4815
- }(Subscriber2);
38
+ import { LivequeryCollection as LivequeryCollection2 } from "@livequery/core";
39
+ import { useMemo as useMemo2, useEffect as useEffect3 } from "react";
4816
40
 
4817
- // node_modules/rxjs/dist/esm5/internal/operators/tap.js
4818
- function tap2(observerOrNext, error, complete) {
4819
- var tapObserver = isFunction2(observerOrNext) || error || complete ? { next: observerOrNext, error, complete } : observerOrNext;
4820
- return tapObserver ? operate2(function(source, subscriber) {
4821
- var _a;
4822
- (_a = tapObserver.subscribe) === null || _a === undefined || _a.call(tapObserver);
4823
- var isUnsub = true;
4824
- source.subscribe(createOperatorSubscriber2(subscriber, function(value) {
4825
- var _a2;
4826
- (_a2 = tapObserver.next) === null || _a2 === undefined || _a2.call(tapObserver, value);
4827
- subscriber.next(value);
4828
- }, function() {
4829
- var _a2;
4830
- isUnsub = false;
4831
- (_a2 = tapObserver.complete) === null || _a2 === undefined || _a2.call(tapObserver);
4832
- subscriber.complete();
4833
- }, function(err) {
4834
- var _a2;
4835
- isUnsub = false;
4836
- (_a2 = tapObserver.error) === null || _a2 === undefined || _a2.call(tapObserver, err);
4837
- subscriber.error(err);
4838
- }, function() {
4839
- var _a2, _b;
4840
- if (isUnsub) {
4841
- (_a2 = tapObserver.unsubscribe) === null || _a2 === undefined || _a2.call(tapObserver);
4842
- }
4843
- (_b = tapObserver.finalize) === null || _b === undefined || _b.call(tapObserver);
4844
- }));
4845
- }) : identity2;
4846
- }
4847
41
  // src/useObservable.ts
42
+ import { useEffect as useEffect2, useState } from "react";
43
+ import { tap, EMPTY } from "rxjs";
4848
44
  var useObservable = (o, default_value) => {
4849
- const [v, s] = import_react3.useState(typeof o?.["getValue"] === "function" ? o.getValue() : default_value);
4850
- import_react3.useEffect(() => {
45
+ const [v, s] = useState(typeof o?.["getValue"] === "function" ? o.getValue() : default_value);
46
+ useEffect2(() => {
4851
47
  try {
4852
- const target = (typeof o === "function" ? o() : o) || EMPTY2;
4853
- const subscription = target.pipe(tap2((value) => {
48
+ const target = (typeof o === "function" ? o() : o) || EMPTY;
49
+ const subscription = target.pipe(tap((value) => {
4854
50
  s(value);
4855
51
  })).subscribe();
4856
52
  return () => {
@@ -4864,8 +60,8 @@ var useObservable = (o, default_value) => {
4864
60
  // src/useDocument.ts
4865
61
  var useDocument = (ref, options = {}) => {
4866
62
  const core = useLivequeryCore();
4867
- const collection = import_react4.useMemo(() => new LivequeryCollection(options), []);
4868
- import_react4.useEffect(() => {
63
+ const collection = useMemo2(() => new LivequeryCollection2(options), []);
64
+ useEffect3(() => {
4869
65
  if (!ref || !core)
4870
66
  return;
4871
67
  const linker = collection.initialize(core, ref);
@@ -4895,5 +91,5 @@ export {
4895
91
  LivequeryCoreProvider
4896
92
  };
4897
93
 
4898
- //# debugId=3B2251B5742CE81E64756E2164756E21
94
+ //# debugId=05EC7BC94672323A64756E2164756E21
4899
95
  //# sourceMappingURL=index.js.map