@omniviewdev/runtime 0.2.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/api.cjs +1 -1
  2. package/dist/api.d.ts +15 -14
  3. package/dist/api.js +110 -125
  4. package/dist/bindings/encoding/json/index.d.ts +1 -0
  5. package/dist/bindings/encoding/json/models.d.ts +6 -0
  6. package/dist/bindings/github.com/omniviewdev/omniview/appservice.d.ts +18 -0
  7. package/dist/bindings/github.com/omniviewdev/omniview/backend/diagnostics/diagnosticsclient.d.ts +51 -0
  8. package/dist/bindings/github.com/omniviewdev/omniview/backend/diagnostics/index.d.ts +2 -0
  9. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/data/index.d.ts +2 -0
  10. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/data/servicewrapper.d.ts +5 -0
  11. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/devserver/index.d.ts +3 -0
  12. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/devserver/models.d.ts +132 -0
  13. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/devserver/servicewrapper.d.ts +12 -0
  14. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/exec/index.d.ts +2 -0
  15. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/exec/servicewrapper.d.ts +22 -0
  16. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/index.d.ts +3 -0
  17. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/lifecycle/index.d.ts +1 -0
  18. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/lifecycle/models.d.ts +29 -0
  19. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/logs/index.d.ts +2 -0
  20. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/logs/servicewrapper.d.ts +11 -0
  21. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/metric/index.d.ts +3 -0
  22. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/metric/models.d.ts +39 -0
  23. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/metric/servicewrapper.d.ts +16 -0
  24. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/models.d.ts +72 -0
  25. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/networker/index.d.ts +2 -0
  26. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/networker/servicewrapper.d.ts +11 -0
  27. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/pluginlog/index.d.ts +3 -0
  28. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/pluginlog/models.d.ts +24 -0
  29. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/pluginlog/servicewrapper.d.ts +7 -0
  30. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/registry/index.d.ts +1 -0
  31. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/registry/models.d.ts +94 -0
  32. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/index.d.ts +2 -0
  33. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/models.d.ts +53 -0
  34. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graphservice.d.ts +14 -0
  35. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/index.d.ts +4 -0
  36. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/models.d.ts +61 -0
  37. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/servicewrapper.d.ts +92 -0
  38. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/servicewrapper.d.ts +24 -0
  39. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/settings/index.d.ts +2 -0
  40. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/settings/servicewrapper.d.ts +18 -0
  41. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/types/index.d.ts +1 -0
  42. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/types/models.d.ts +22 -0
  43. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/ui/index.d.ts +3 -0
  44. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/ui/models.d.ts +55 -0
  45. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/ui/servicewrapper.d.ts +7 -0
  46. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/utils/client.d.ts +6 -0
  47. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/utils/index.d.ts +3 -0
  48. package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/utils/models.d.ts +10 -0
  49. package/dist/bindings/github.com/omniviewdev/omniview/index.d.ts +3 -0
  50. package/dist/bindings/github.com/omniviewdev/omniview/internal/settings/index.d.ts +2 -0
  51. package/dist/bindings/github.com/omniviewdev/omniview/internal/settings/servicewrapper.d.ts +48 -0
  52. package/dist/bindings/github.com/omniviewdev/omniview/internal/telemetry/index.d.ts +2 -0
  53. package/dist/bindings/github.com/omniviewdev/omniview/internal/telemetry/telemetrybinding.d.ts +7 -0
  54. package/dist/bindings/github.com/omniviewdev/omniview/models.d.ts +38 -0
  55. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/config/index.d.ts +1 -0
  56. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/config/models.d.ts +101 -0
  57. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/types/index.d.ts +1 -0
  58. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/types/models.d.ts +199 -0
  59. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/v1/exec/index.d.ts +1 -0
  60. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/v1/exec/models.d.ts +79 -0
  61. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/v1/logs/index.d.ts +1 -0
  62. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/v1/logs/models.d.ts +133 -0
  63. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/v1/metric/index.d.ts +1 -0
  64. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/v1/metric/models.d.ts +207 -0
  65. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/v1/networker/index.d.ts +2 -0
  66. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/v1/networker/models.d.ts +96 -0
  67. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/v1/resource/index.d.ts +2 -0
  68. package/dist/bindings/github.com/omniviewdev/plugin-sdk/pkg/v1/resource/models.d.ts +1199 -0
  69. package/dist/bindings/github.com/omniviewdev/plugin-sdk/settings/index.d.ts +2 -0
  70. package/dist/bindings/github.com/omniviewdev/plugin-sdk/settings/models.d.ts +169 -0
  71. package/dist/bindings/github.com/wailsapp/wails/v3/internal/eventcreate.d.ts +1 -0
  72. package/dist/bindings/time/index.d.ts +1 -0
  73. package/dist/bindings/time/models.d.ts +33 -0
  74. package/dist/calls-BmUnjINC.js +677 -0
  75. package/dist/calls-DZctVyoQ.cjs +1 -0
  76. package/dist/compat/legacyEnum.d.ts +10 -0
  77. package/dist/compat/resource.d.ts +4 -0
  78. package/dist/compat/types.d.ts +4 -0
  79. package/dist/context/plugins/PluginContext.d.ts +2 -2
  80. package/dist/events-BTiuwc-0.cjs +1 -0
  81. package/dist/events-DDTGFACO.js +371 -0
  82. package/dist/extensions/provider.d.ts +12 -6
  83. package/dist/extensions/registry.d.ts +37 -18
  84. package/dist/hooks/connection/useConnection.d.ts +5 -5
  85. package/dist/hooks/connection/useConnectionStatus.d.ts +7 -0
  86. package/dist/hooks/connection/useConnections.d.ts +4 -4
  87. package/dist/hooks/exec/useExecSession.d.ts +2 -2
  88. package/dist/hooks/logs/useLogSession.d.ts +1 -2
  89. package/dist/hooks/metric/useMetricProviders.d.ts +3 -3
  90. package/dist/hooks/metric/useMetricStream.d.ts +2 -2
  91. package/dist/hooks/metric/useResourceMetrics.d.ts +4 -3
  92. package/dist/hooks/networker/types.d.ts +3 -3
  93. package/dist/hooks/networker/usePortForwardSessions.d.ts +4 -4
  94. package/dist/hooks/networker/useResourcePortForwarder.d.ts +3 -4
  95. package/dist/hooks/resource/useEditorSchemas.d.ts +2 -2
  96. package/dist/hooks/resource/useEventBatcher.d.ts +3 -0
  97. package/dist/hooks/resource/useResource.d.ts +3 -4
  98. package/dist/hooks/resource/useResourceActions.d.ts +2 -3
  99. package/dist/hooks/resource/useResourceAreaComponent.d.ts +3 -3
  100. package/dist/hooks/resource/useResourceGroups.d.ts +6 -6
  101. package/dist/hooks/resource/useResourceMutations.d.ts +3 -4
  102. package/dist/hooks/resource/useResourceType.d.ts +1 -1
  103. package/dist/hooks/resource/useResourceTypes.d.ts +6 -6
  104. package/dist/hooks/resource/useResources.d.ts +3 -4
  105. package/dist/index-D2mKAO8s.js +1069 -0
  106. package/dist/index-D_aIcqH0.cjs +6 -0
  107. package/dist/index.cjs +2 -2
  108. package/dist/index.js +1371 -1778
  109. package/dist/legacyEnum-DORXlU_y.js +13 -0
  110. package/dist/legacyEnum-DkV5yRdA.cjs +1 -0
  111. package/dist/models-B8OVRhdT.js +159 -0
  112. package/dist/models-BVKsY9u1.js +2285 -0
  113. package/dist/models-CExSuVU2.cjs +1 -0
  114. package/dist/models-DdAWPDgz.cjs +1 -0
  115. package/dist/models.cjs +1 -1
  116. package/dist/models.d.ts +27 -1
  117. package/dist/models.js +259 -2244
  118. package/dist/runtime.cjs +1 -1
  119. package/dist/runtime.d.ts +1 -1
  120. package/dist/runtime.js +198 -205
  121. package/dist/servicewrapper-BH5omp-N.js +708 -0
  122. package/dist/servicewrapper-dDhyC68C.cjs +1 -0
  123. package/dist/types/app.d.ts +1 -1
  124. package/dist/types/extensions.d.ts +107 -161
  125. package/dist/types/watch.d.ts +4 -5
  126. package/package.json +17 -9
  127. package/LICENSE +0 -661
  128. package/dist/Client-D4njqvNH.js +0 -632
  129. package/dist/Client-DHqavZ6d.cjs +0 -1
  130. package/dist/wailsjs/go/data/Client.d.ts +0 -10
  131. package/dist/wailsjs/go/devserver/DevServerManager.d.ts +0 -24
  132. package/dist/wailsjs/go/diagnostics/DiagnosticsClient.d.ts +0 -18
  133. package/dist/wailsjs/go/exec/Client.d.ts +0 -26
  134. package/dist/wailsjs/go/logs/Client.d.ts +0 -16
  135. package/dist/wailsjs/go/main/App.d.ts +0 -8
  136. package/dist/wailsjs/go/metric/Client.d.ts +0 -12
  137. package/dist/wailsjs/go/models.d.ts +0 -1060
  138. package/dist/wailsjs/go/networker/Client.d.ts +0 -14
  139. package/dist/wailsjs/go/plugin/pluginManager.d.ts +0 -52
  140. package/dist/wailsjs/go/pluginlog/Manager.d.ts +0 -18
  141. package/dist/wailsjs/go/resource/Client.d.ts +0 -90
  142. package/dist/wailsjs/go/settings/Client.d.ts +0 -14
  143. package/dist/wailsjs/go/settings/provider.d.ts +0 -46
  144. package/dist/wailsjs/go/ui/Client.d.ts +0 -6
  145. package/dist/wailsjs/go/utils/Client.d.ts +0 -2
  146. package/dist/wailsjs/runtime/runtime.d.ts +0 -249
@@ -0,0 +1,677 @@
1
+ import { n as M, b as I, o as x, h as k, R as H } from "./index-D2mKAO8s.js";
2
+ var D = Function.prototype.toString, h = typeof Reflect == "object" && Reflect !== null && Reflect.apply, g, j;
3
+ if (typeof h == "function" && typeof Object.defineProperty == "function")
4
+ try {
5
+ g = Object.defineProperty({}, "length", {
6
+ get: function() {
7
+ throw j;
8
+ }
9
+ }), j = {}, h(function() {
10
+ throw 42;
11
+ }, null, g);
12
+ } catch (r) {
13
+ r !== j && (h = null);
14
+ }
15
+ else
16
+ h = null;
17
+ var N = /^\s*class\b/, A = function(e) {
18
+ try {
19
+ var t = D.call(e);
20
+ return N.test(t);
21
+ } catch {
22
+ return !1;
23
+ }
24
+ }, S = function(e) {
25
+ try {
26
+ return A(e) ? !1 : (D.call(e), !0);
27
+ } catch {
28
+ return !1;
29
+ }
30
+ }, m = Object.prototype.toString, q = "[object Object]", z = "[object Function]", G = "[object GeneratorFunction]", J = "[object HTMLAllCollection]", W = "[object HTML document.all class]", K = "[object HTMLCollection]", Q = typeof Symbol == "function" && !!Symbol.toStringTag, V = !(0 in [,]), E = function() {
31
+ return !1;
32
+ };
33
+ if (typeof document == "object") {
34
+ var X = document.all;
35
+ m.call(X) === m.call(document.all) && (E = function(e) {
36
+ if ((V || !e) && (typeof e > "u" || typeof e == "object"))
37
+ try {
38
+ var t = m.call(e);
39
+ return (t === J || t === W || t === K || t === q) && e("") == null;
40
+ } catch {
41
+ }
42
+ return !1;
43
+ });
44
+ }
45
+ function Y(r) {
46
+ if (E(r))
47
+ return !0;
48
+ if (!r || typeof r != "function" && typeof r != "object")
49
+ return !1;
50
+ try {
51
+ h(r, null, g);
52
+ } catch (e) {
53
+ if (e !== j)
54
+ return !1;
55
+ }
56
+ return !A(r) && S(r);
57
+ }
58
+ function Z(r) {
59
+ if (E(r))
60
+ return !0;
61
+ if (!r || typeof r != "function" && typeof r != "object")
62
+ return !1;
63
+ if (Q)
64
+ return S(r);
65
+ if (A(r))
66
+ return !1;
67
+ var e = m.call(r);
68
+ return e !== z && e !== G && !/^\[object HTML/.test(e) ? !1 : S(r);
69
+ }
70
+ const f = h ? Y : Z;
71
+ var w;
72
+ class R extends Error {
73
+ /**
74
+ * Constructs a new `CancelError` instance.
75
+ * @param message - The error message.
76
+ * @param options - Options to be forwarded to the Error constructor.
77
+ */
78
+ constructor(e, t) {
79
+ super(e, t), this.name = "CancelError";
80
+ }
81
+ }
82
+ class v extends Error {
83
+ /**
84
+ * Constructs a new `CancelledRejectionError` instance.
85
+ * @param promise - The promise that caused the error originally.
86
+ * @param reason - The rejection reason.
87
+ * @param info - An optional informative message specifying the circumstances in which the error was thrown.
88
+ * Defaults to the string `"Unhandled rejection in cancelled promise."`.
89
+ */
90
+ constructor(e, t, n) {
91
+ super((n ?? "Unhandled rejection in cancelled promise.") + " Reason: " + $(t), { cause: t }), this.promise = e, this.name = "CancelledRejectionError";
92
+ }
93
+ }
94
+ const u = Symbol("barrier"), T = Symbol("cancelImpl"), P = (w = Symbol.species) !== null && w !== void 0 ? w : Symbol("speciesPolyfill");
95
+ class l extends Promise {
96
+ /**
97
+ * Creates a new `CancellablePromise`.
98
+ *
99
+ * @param executor - A callback used to initialize the promise. This callback is passed two arguments:
100
+ * a `resolve` callback used to resolve the promise with a value
101
+ * or the result of another promise (possibly cancellable),
102
+ * and a `reject` callback used to reject the promise with a provided reason or error.
103
+ * If the value provided to the `resolve` callback is a thenable _and_ cancellable object
104
+ * (it has a `then` _and_ a `cancel` method),
105
+ * cancellation requests will be forwarded to that object and the oncancelled will not be invoked anymore.
106
+ * If any one of the two callbacks is called _after_ the promise has been cancelled,
107
+ * the provided values will be cancelled and resolved as usual,
108
+ * but their results will be discarded.
109
+ * However, if the resolution process ultimately ends up in a rejection
110
+ * that is not due to cancellation, the rejection reason
111
+ * will be wrapped in a {@link CancelledRejectionError}
112
+ * and bubbled up as an unhandled rejection.
113
+ * @param oncancelled - It is the caller's responsibility to ensure that any operation
114
+ * started by the executor is properly halted upon cancellation.
115
+ * This optional callback can be used to that purpose.
116
+ * It will be called _synchronously_ with a cancellation cause
117
+ * when cancellation is requested, _after_ the promise has already rejected
118
+ * with a {@link CancelError}, but _before_
119
+ * any {@link then}/{@link catch}/{@link finally} callback runs.
120
+ * If the callback returns a thenable, the promise returned from {@link cancel}
121
+ * will only fulfill after the former has settled.
122
+ * Unhandled exceptions or rejections from the callback will be wrapped
123
+ * in a {@link CancelledRejectionError} and bubbled up as unhandled rejections.
124
+ * If the `resolve` callback is called before cancellation with a cancellable promise,
125
+ * cancellation requests on this promise will be diverted to that promise,
126
+ * and the original `oncancelled` callback will be discarded.
127
+ */
128
+ constructor(e, t) {
129
+ let n, o;
130
+ if (super((s, p) => {
131
+ n = s, o = p;
132
+ }), this.constructor[P] !== Promise)
133
+ throw new TypeError("CancellablePromise does not support transparent subclassing. Please refrain from overriding the [Symbol.species] static property.");
134
+ let c = {
135
+ promise: this,
136
+ resolve: n,
137
+ reject: o,
138
+ get oncancelled() {
139
+ return t ?? null;
140
+ },
141
+ set oncancelled(s) {
142
+ t = s ?? void 0;
143
+ }
144
+ };
145
+ const i = {
146
+ get root() {
147
+ return i;
148
+ },
149
+ resolving: !1,
150
+ settled: !1
151
+ };
152
+ Object.defineProperties(this, {
153
+ [u]: {
154
+ configurable: !1,
155
+ enumerable: !1,
156
+ writable: !0,
157
+ value: null
158
+ },
159
+ [T]: {
160
+ configurable: !1,
161
+ enumerable: !1,
162
+ writable: !1,
163
+ value: L(c, i)
164
+ }
165
+ });
166
+ const a = B(c, i);
167
+ try {
168
+ e(U(c, i), a);
169
+ } catch (s) {
170
+ i.resolving ? console.log("Unhandled exception in CancellablePromise executor.", s) : a(s);
171
+ }
172
+ }
173
+ /**
174
+ * Cancels immediately the execution of the operation associated with this promise.
175
+ * The promise rejects with a {@link CancelError} instance as reason,
176
+ * with the {@link CancelError#cause} property set to the given argument, if any.
177
+ *
178
+ * Has no effect if called after the promise has already settled;
179
+ * repeated calls in particular are safe, but only the first one
180
+ * will set the cancellation cause.
181
+ *
182
+ * The `CancelError` exception _need not_ be handled explicitly _on the promises that are being cancelled:_
183
+ * cancelling a promise with no attached rejection handler does not trigger an unhandled rejection event.
184
+ * Therefore, the following idioms are all equally correct:
185
+ * ```ts
186
+ * new CancellablePromise((resolve, reject) => { ... }).cancel();
187
+ * new CancellablePromise((resolve, reject) => { ... }).then(...).cancel();
188
+ * new CancellablePromise((resolve, reject) => { ... }).then(...).catch(...).cancel();
189
+ * ```
190
+ * Whenever some cancelled promise in a chain rejects with a `CancelError`
191
+ * with the same cancellation cause as itself, the error will be discarded silently.
192
+ * However, the `CancelError` _will still be delivered_ to all attached rejection handlers
193
+ * added by {@link then} and related methods:
194
+ * ```ts
195
+ * let cancellable = new CancellablePromise((resolve, reject) => { ... });
196
+ * cancellable.then(() => { ... }).catch(console.log);
197
+ * cancellable.cancel(); // A CancelError is printed to the console.
198
+ * ```
199
+ * If the `CancelError` is not handled downstream by the time it reaches
200
+ * a _non-cancelled_ promise, it _will_ trigger an unhandled rejection event,
201
+ * just like normal rejections would:
202
+ * ```ts
203
+ * let cancellable = new CancellablePromise((resolve, reject) => { ... });
204
+ * let chained = cancellable.then(() => { ... }).then(() => { ... }); // No catch...
205
+ * cancellable.cancel(); // Unhandled rejection event on chained!
206
+ * ```
207
+ * Therefore, it is important to either cancel whole promise chains from their tail,
208
+ * as shown in the correct idioms above, or take care of handling errors everywhere.
209
+ *
210
+ * @returns A cancellable promise that _fulfills_ after the cancel callback (if any)
211
+ * and all handlers attached up to the call to cancel have run.
212
+ * If the cancel callback returns a thenable, the promise returned by `cancel`
213
+ * will also wait for that thenable to settle.
214
+ * This enables callers to wait for the cancelled operation to terminate
215
+ * without being forced to handle potential errors at the call site.
216
+ * ```ts
217
+ * cancellable.cancel().then(() => {
218
+ * // Cleanup finished, it's safe to do something else.
219
+ * }, (err) => {
220
+ * // Unreachable: the promise returned from cancel will never reject.
221
+ * });
222
+ * ```
223
+ * Note that the returned promise will _not_ handle implicitly any rejection
224
+ * that might have occurred already in the cancelled chain.
225
+ * It will just track whether registered handlers have been executed or not.
226
+ * Therefore, unhandled rejections will never be silently handled by calling cancel.
227
+ */
228
+ cancel(e) {
229
+ return new l((t) => {
230
+ Promise.all([
231
+ this[T](new R("Promise cancelled.", { cause: e })),
232
+ _(this)
233
+ ]).then(() => t(), () => t());
234
+ });
235
+ }
236
+ /**
237
+ * Binds promise cancellation to the abort event of the given {@link AbortSignal}.
238
+ * If the signal has already aborted, the promise will be cancelled immediately.
239
+ * When either condition is verified, the cancellation cause will be set
240
+ * to the signal's abort reason (see {@link AbortSignal#reason}).
241
+ *
242
+ * Has no effect if called (or if the signal aborts) _after_ the promise has already settled.
243
+ * Only the first signal to abort will set the cancellation cause.
244
+ *
245
+ * For more details about the cancellation process,
246
+ * see {@link cancel} and the `CancellablePromise` constructor.
247
+ *
248
+ * This method enables `await`ing cancellable promises without having
249
+ * to store them for future cancellation, e.g.:
250
+ * ```ts
251
+ * await longRunningOperation().cancelOn(signal);
252
+ * ```
253
+ * instead of:
254
+ * ```ts
255
+ * let promiseToBeCancelled = longRunningOperation();
256
+ * await promiseToBeCancelled;
257
+ * ```
258
+ *
259
+ * @returns This promise, for method chaining.
260
+ */
261
+ cancelOn(e) {
262
+ return e.aborted ? this.cancel(e.reason) : e.addEventListener("abort", () => void this.cancel(e.reason), { capture: !0 }), this;
263
+ }
264
+ /**
265
+ * Attaches callbacks for the resolution and/or rejection of the `CancellablePromise`.
266
+ *
267
+ * The optional `oncancelled` argument will be invoked when the returned promise is cancelled,
268
+ * with the same semantics as the `oncancelled` argument of the constructor.
269
+ * When the parent promise rejects or is cancelled, the `onrejected` callback will run,
270
+ * _even after the returned promise has been cancelled:_
271
+ * in that case, should it reject or throw, the reason will be wrapped
272
+ * in a {@link CancelledRejectionError} and bubbled up as an unhandled rejection.
273
+ *
274
+ * @param onfulfilled The callback to execute when the Promise is resolved.
275
+ * @param onrejected The callback to execute when the Promise is rejected.
276
+ * @returns A `CancellablePromise` for the completion of whichever callback is executed.
277
+ * The returned promise is hooked up to propagate cancellation requests up the chain, but not down:
278
+ *
279
+ * - if the parent promise is cancelled, the `onrejected` handler will be invoked with a `CancelError`
280
+ * and the returned promise _will resolve regularly_ with its result;
281
+ * - conversely, if the returned promise is cancelled, _the parent promise is cancelled too;_
282
+ * the `onrejected` handler will still be invoked with the parent's `CancelError`,
283
+ * but its result will be discarded
284
+ * and the returned promise will reject with a `CancelError` as well.
285
+ *
286
+ * The promise returned from {@link cancel} will fulfill only after all attached handlers
287
+ * up the entire promise chain have been run.
288
+ *
289
+ * If either callback returns a cancellable promise,
290
+ * cancellation requests will be diverted to it,
291
+ * and the specified `oncancelled` callback will be discarded.
292
+ */
293
+ then(e, t, n) {
294
+ if (!(this instanceof l))
295
+ throw new TypeError("CancellablePromise.prototype.then called on an invalid object.");
296
+ if (f(e) || (e = C), f(t) || (t = F), e === C && t == F)
297
+ return new l((c) => c(this));
298
+ const o = {};
299
+ return this[u] = o, new l((c, i) => {
300
+ super.then((a) => {
301
+ var s;
302
+ this[u] === o && (this[u] = null), (s = o.resolve) === null || s === void 0 || s.call(o);
303
+ try {
304
+ c(e(a));
305
+ } catch (p) {
306
+ i(p);
307
+ }
308
+ }, (a) => {
309
+ var s;
310
+ this[u] === o && (this[u] = null), (s = o.resolve) === null || s === void 0 || s.call(o);
311
+ try {
312
+ c(t(a));
313
+ } catch (p) {
314
+ i(p);
315
+ }
316
+ });
317
+ }, async (c) => {
318
+ try {
319
+ return n == null ? void 0 : n(c);
320
+ } finally {
321
+ await this.cancel(c);
322
+ }
323
+ });
324
+ }
325
+ /**
326
+ * Attaches a callback for only the rejection of the Promise.
327
+ *
328
+ * The optional `oncancelled` argument will be invoked when the returned promise is cancelled,
329
+ * with the same semantics as the `oncancelled` argument of the constructor.
330
+ * When the parent promise rejects or is cancelled, the `onrejected` callback will run,
331
+ * _even after the returned promise has been cancelled:_
332
+ * in that case, should it reject or throw, the reason will be wrapped
333
+ * in a {@link CancelledRejectionError} and bubbled up as an unhandled rejection.
334
+ *
335
+ * It is equivalent to
336
+ * ```ts
337
+ * cancellablePromise.then(undefined, onrejected, oncancelled);
338
+ * ```
339
+ * and the same caveats apply.
340
+ *
341
+ * @returns A Promise for the completion of the callback.
342
+ * Cancellation requests on the returned promise
343
+ * will propagate up the chain to the parent promise,
344
+ * but not in the other direction.
345
+ *
346
+ * The promise returned from {@link cancel} will fulfill only after all attached handlers
347
+ * up the entire promise chain have been run.
348
+ *
349
+ * If `onrejected` returns a cancellable promise,
350
+ * cancellation requests will be diverted to it,
351
+ * and the specified `oncancelled` callback will be discarded.
352
+ * See {@link then} for more details.
353
+ */
354
+ catch(e, t) {
355
+ return this.then(void 0, e, t);
356
+ }
357
+ /**
358
+ * Attaches a callback that is invoked when the CancellablePromise is settled (fulfilled or rejected). The
359
+ * resolved value cannot be accessed or modified from the callback.
360
+ * The returned promise will settle in the same state as the original one
361
+ * after the provided callback has completed execution,
362
+ * unless the callback throws or returns a rejecting promise,
363
+ * in which case the returned promise will reject as well.
364
+ *
365
+ * The optional `oncancelled` argument will be invoked when the returned promise is cancelled,
366
+ * with the same semantics as the `oncancelled` argument of the constructor.
367
+ * Once the parent promise settles, the `onfinally` callback will run,
368
+ * _even after the returned promise has been cancelled:_
369
+ * in that case, should it reject or throw, the reason will be wrapped
370
+ * in a {@link CancelledRejectionError} and bubbled up as an unhandled rejection.
371
+ *
372
+ * This method is implemented in terms of {@link then} and the same caveats apply.
373
+ * It is polyfilled, hence available in every OS/webview version.
374
+ *
375
+ * @returns A Promise for the completion of the callback.
376
+ * Cancellation requests on the returned promise
377
+ * will propagate up the chain to the parent promise,
378
+ * but not in the other direction.
379
+ *
380
+ * The promise returned from {@link cancel} will fulfill only after all attached handlers
381
+ * up the entire promise chain have been run.
382
+ *
383
+ * If `onfinally` returns a cancellable promise,
384
+ * cancellation requests will be diverted to it,
385
+ * and the specified `oncancelled` callback will be discarded.
386
+ * See {@link then} for more details.
387
+ */
388
+ finally(e, t) {
389
+ if (!(this instanceof l))
390
+ throw new TypeError("CancellablePromise.prototype.finally called on an invalid object.");
391
+ return f(e) ? this.then((n) => l.resolve(e()).then(() => n), (n) => l.resolve(e()).then(() => {
392
+ throw n;
393
+ }), t) : this.then(e, e, t);
394
+ }
395
+ /**
396
+ * We use the `[Symbol.species]` static property, if available,
397
+ * to disable the built-in automatic subclassing features from {@link Promise}.
398
+ * It is critical for performance reasons that extenders do not override this.
399
+ * Once the proposal at https://github.com/tc39/proposal-rm-builtin-subclassing
400
+ * is either accepted or retired, this implementation will have to be revised accordingly.
401
+ *
402
+ * @ignore
403
+ * @internal
404
+ */
405
+ static get [P]() {
406
+ return Promise;
407
+ }
408
+ static all(e) {
409
+ let t = Array.from(e);
410
+ const n = t.length === 0 ? l.resolve(t) : new l((o, c) => {
411
+ Promise.all(t).then(o, c);
412
+ }, (o) => b(n, t, o));
413
+ return n;
414
+ }
415
+ static allSettled(e) {
416
+ let t = Array.from(e);
417
+ const n = t.length === 0 ? l.resolve(t) : new l((o, c) => {
418
+ Promise.allSettled(t).then(o, c);
419
+ }, (o) => b(n, t, o));
420
+ return n;
421
+ }
422
+ static any(e) {
423
+ let t = Array.from(e);
424
+ const n = t.length === 0 ? l.resolve(t) : new l((o, c) => {
425
+ Promise.any(t).then(o, c);
426
+ }, (o) => b(n, t, o));
427
+ return n;
428
+ }
429
+ static race(e) {
430
+ let t = Array.from(e);
431
+ const n = new l((o, c) => {
432
+ Promise.race(t).then(o, c);
433
+ }, (o) => b(n, t, o));
434
+ return n;
435
+ }
436
+ /**
437
+ * Creates a new cancelled CancellablePromise for the provided cause.
438
+ *
439
+ * @group Static Methods
440
+ */
441
+ static cancel(e) {
442
+ const t = new l(() => {
443
+ });
444
+ return t.cancel(e), t;
445
+ }
446
+ /**
447
+ * Creates a new CancellablePromise that cancels
448
+ * after the specified timeout, with the provided cause.
449
+ *
450
+ * If the {@link AbortSignal.timeout} factory method is available,
451
+ * it is used to base the timeout on _active_ time rather than _elapsed_ time.
452
+ * Otherwise, `timeout` falls back to {@link setTimeout}.
453
+ *
454
+ * @group Static Methods
455
+ */
456
+ static timeout(e, t) {
457
+ const n = new l(() => {
458
+ });
459
+ return AbortSignal && typeof AbortSignal == "function" && AbortSignal.timeout && typeof AbortSignal.timeout == "function" ? AbortSignal.timeout(e).addEventListener("abort", () => void n.cancel(t)) : setTimeout(() => void n.cancel(t), e), n;
460
+ }
461
+ static sleep(e, t) {
462
+ return new l((n) => {
463
+ setTimeout(() => n(t), e);
464
+ });
465
+ }
466
+ /**
467
+ * Creates a new rejected CancellablePromise for the provided reason.
468
+ *
469
+ * @group Static Methods
470
+ */
471
+ static reject(e) {
472
+ return new l((t, n) => n(e));
473
+ }
474
+ static resolve(e) {
475
+ return e instanceof l ? e : new l((t) => t(e));
476
+ }
477
+ /**
478
+ * Creates a new CancellablePromise and returns it in an object, along with its resolve and reject functions
479
+ * and a getter/setter for the cancellation callback.
480
+ *
481
+ * This method is polyfilled, hence available in every OS/webview version.
482
+ *
483
+ * @group Static Methods
484
+ */
485
+ static withResolvers() {
486
+ let e = { oncancelled: null };
487
+ return e.promise = new l((t, n) => {
488
+ e.resolve = t, e.reject = n;
489
+ }, (t) => {
490
+ var n;
491
+ (n = e.oncancelled) === null || n === void 0 || n.call(e, t);
492
+ }), e;
493
+ }
494
+ }
495
+ function L(r, e) {
496
+ let t;
497
+ return (n) => {
498
+ if (e.settled || (e.settled = !0, e.reason = n, r.reject(n), Promise.prototype.then.call(r.promise, void 0, (o) => {
499
+ if (o !== n)
500
+ throw o;
501
+ })), !(!e.reason || !r.oncancelled))
502
+ return t = new Promise((o) => {
503
+ try {
504
+ o(r.oncancelled(e.reason.cause));
505
+ } catch (c) {
506
+ Promise.reject(new v(r.promise, c, "Unhandled exception in oncancelled callback."));
507
+ }
508
+ }).catch((o) => {
509
+ Promise.reject(new v(r.promise, o, "Unhandled rejection in oncancelled callback."));
510
+ }), r.oncancelled = null, t;
511
+ };
512
+ }
513
+ function U(r, e) {
514
+ return (t) => {
515
+ if (!e.resolving) {
516
+ if (e.resolving = !0, t === r.promise) {
517
+ if (e.settled)
518
+ return;
519
+ e.settled = !0, r.reject(new TypeError("A promise cannot be resolved with itself."));
520
+ return;
521
+ }
522
+ if (t != null && (typeof t == "object" || typeof t == "function")) {
523
+ let n;
524
+ try {
525
+ n = t.then;
526
+ } catch (o) {
527
+ e.settled = !0, r.reject(o);
528
+ return;
529
+ }
530
+ if (f(n)) {
531
+ try {
532
+ let i = t.cancel;
533
+ if (f(i)) {
534
+ const a = (s) => {
535
+ Reflect.apply(i, t, [s]);
536
+ };
537
+ e.reason ? L(Object.assign(Object.assign({}, r), { oncancelled: a }), e)(e.reason) : r.oncancelled = a;
538
+ }
539
+ } catch {
540
+ }
541
+ const o = {
542
+ root: e.root,
543
+ resolving: !1,
544
+ get settled() {
545
+ return this.root.settled;
546
+ },
547
+ set settled(i) {
548
+ this.root.settled = i;
549
+ },
550
+ get reason() {
551
+ return this.root.reason;
552
+ }
553
+ }, c = B(r, o);
554
+ try {
555
+ Reflect.apply(n, t, [U(r, o), c]);
556
+ } catch (i) {
557
+ c(i);
558
+ }
559
+ return;
560
+ }
561
+ }
562
+ e.settled || (e.settled = !0, r.resolve(t));
563
+ }
564
+ };
565
+ }
566
+ function B(r, e) {
567
+ return (t) => {
568
+ if (!e.resolving)
569
+ if (e.resolving = !0, e.settled) {
570
+ try {
571
+ if (t instanceof R && e.reason instanceof R && Object.is(t.cause, e.reason.cause))
572
+ return;
573
+ } catch {
574
+ }
575
+ Promise.reject(new v(r.promise, t));
576
+ } else
577
+ e.settled = !0, r.reject(t);
578
+ };
579
+ }
580
+ function b(r, e, t) {
581
+ const n = [];
582
+ for (const o of e) {
583
+ let c;
584
+ try {
585
+ if (!f(o.then) || (c = o.cancel, !f(c)))
586
+ continue;
587
+ } catch {
588
+ continue;
589
+ }
590
+ let i;
591
+ try {
592
+ i = Reflect.apply(c, o, [t]);
593
+ } catch (a) {
594
+ Promise.reject(new v(r, a, "Unhandled exception in cancel method."));
595
+ continue;
596
+ }
597
+ i && n.push((i instanceof Promise ? i : Promise.resolve(i)).catch((a) => {
598
+ Promise.reject(new v(r, a, "Unhandled rejection in cancel method."));
599
+ }));
600
+ }
601
+ return Promise.all(n);
602
+ }
603
+ function C(r) {
604
+ return r;
605
+ }
606
+ function F(r) {
607
+ throw r;
608
+ }
609
+ function $(r) {
610
+ try {
611
+ if (r instanceof Error || typeof r != "object" || r.toString !== Object.prototype.toString)
612
+ return "" + r;
613
+ } catch {
614
+ }
615
+ try {
616
+ return JSON.stringify(r);
617
+ } catch {
618
+ }
619
+ try {
620
+ return Object.prototype.toString.call(r);
621
+ } catch {
622
+ }
623
+ return "<could not convert error to string>";
624
+ }
625
+ function _(r) {
626
+ var e;
627
+ let t = (e = r[u]) !== null && e !== void 0 ? e : {};
628
+ return "promise" in t || Object.assign(t, d()), r[u] == null && (t.resolve(), r[u] = t), t.promise;
629
+ }
630
+ let d = Promise.withResolvers;
631
+ d && typeof d == "function" ? d = d.bind(Promise) : d = function() {
632
+ let r, e;
633
+ return { promise: new Promise((n, o) => {
634
+ r = n, e = o;
635
+ }), resolve: r, reject: e };
636
+ };
637
+ k && (window._wails = window._wails || {});
638
+ const ee = M(x.Call), te = M(x.CancelCall), y = /* @__PURE__ */ new Map(), re = 0, ne = 0;
639
+ function oe() {
640
+ let r;
641
+ do
642
+ r = I();
643
+ while (y.has(r));
644
+ return r;
645
+ }
646
+ function O(r) {
647
+ const e = oe(), t = l.withResolvers();
648
+ y.set(e, { resolve: t.resolve, reject: t.reject });
649
+ const n = ee(re, Object.assign({ "call-id": e }, r));
650
+ let o = !0;
651
+ n.then((i) => {
652
+ o = !1, y.delete(e), t.resolve(i);
653
+ }, (i) => {
654
+ o = !1, y.delete(e), t.reject(i);
655
+ });
656
+ const c = () => (y.delete(e), te(ne, { "call-id": e }).catch((i) => {
657
+ console.error("Error while requesting binding call cancellation:", i);
658
+ }));
659
+ return t.oncancelled = () => o ? c() : n.then(c), t.promise;
660
+ }
661
+ function ce(r, ...e) {
662
+ return O({ methodName: r, args: e });
663
+ }
664
+ function ie(r, ...e) {
665
+ return O({ methodID: r, args: e });
666
+ }
667
+ const se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
668
+ __proto__: null,
669
+ ByID: ie,
670
+ ByName: ce,
671
+ Call: O,
672
+ RuntimeError: H
673
+ }, Symbol.toStringTag, { value: "Module" }));
674
+ export {
675
+ ie as B,
676
+ se as c
677
+ };
@@ -0,0 +1 @@
1
+ "use strict";const d=require("./index-D_aIcqH0.cjs");var M=Function.prototype.toString,p=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,S,m;if(typeof p=="function"&&typeof Object.defineProperty=="function")try{S=Object.defineProperty({},"length",{get:function(){throw m}}),m={},p(function(){throw 42},null,S)}catch(r){r!==m&&(p=null)}else p=null;var B=/^\s*class\b/,E=function(e){try{var t=M.call(e);return B.test(t)}catch{return!1}},R=function(e){try{return E(e)?!1:(M.call(e),!0)}catch{return!1}},w=Object.prototype.toString,N="[object Object]",k="[object Function]",H="[object GeneratorFunction]",q="[object HTMLAllCollection]",z="[object HTML document.all class]",G="[object HTMLCollection]",J=typeof Symbol=="function"&&!!Symbol.toStringTag,W=!(0 in[,]),O=function(){return!1};if(typeof document=="object"){var K=document.all;w.call(K)===w.call(document.all)&&(O=function(e){if((W||!e)&&(typeof e>"u"||typeof e=="object"))try{var t=w.call(e);return(t===q||t===z||t===G||t===N)&&e("")==null}catch{}return!1})}function Q(r){if(O(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;try{p(r,null,S)}catch(e){if(e!==m)return!1}return!E(r)&&R(r)}function V(r){if(O(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;if(J)return R(r);if(E(r))return!1;var e=w.call(r);return e!==k&&e!==H&&!/^\[object HTML/.test(e)?!1:R(r)}const f=p?Q:V;var g;class A extends Error{constructor(e,t){super(e,t),this.name="CancelError"}}class b extends Error{constructor(e,t,n){super((n??"Unhandled rejection in cancelled promise.")+" Reason: "+X(t),{cause:t}),this.promise=e,this.name="CancelledRejectionError"}}const u=Symbol("barrier"),P=Symbol("cancelImpl"),C=(g=Symbol.species)!==null&&g!==void 0?g:Symbol("speciesPolyfill");class l extends Promise{constructor(e,t){let n,o;if(super((s,y)=>{n=s,o=y}),this.constructor[C]!==Promise)throw new TypeError("CancellablePromise does not support transparent subclassing. Please refrain from overriding the [Symbol.species] static property.");let c={promise:this,resolve:n,reject:o,get oncancelled(){return t??null},set oncancelled(s){t=s??void 0}};const i={get root(){return i},resolving:!1,settled:!1};Object.defineProperties(this,{[u]:{configurable:!1,enumerable:!1,writable:!0,value:null},[P]:{configurable:!1,enumerable:!1,writable:!1,value:x(c,i)}});const a=I(c,i);try{e(L(c,i),a)}catch(s){i.resolving?console.log("Unhandled exception in CancellablePromise executor.",s):a(s)}}cancel(e){return new l(t=>{Promise.all([this[P](new A("Promise cancelled.",{cause:e})),Y(this)]).then(()=>t(),()=>t())})}cancelOn(e){return e.aborted?this.cancel(e.reason):e.addEventListener("abort",()=>void this.cancel(e.reason),{capture:!0}),this}then(e,t,n){if(!(this instanceof l))throw new TypeError("CancellablePromise.prototype.then called on an invalid object.");if(f(e)||(e=D),f(t)||(t=F),e===D&&t==F)return new l(c=>c(this));const o={};return this[u]=o,new l((c,i)=>{super.then(a=>{var s;this[u]===o&&(this[u]=null),(s=o.resolve)===null||s===void 0||s.call(o);try{c(e(a))}catch(y){i(y)}},a=>{var s;this[u]===o&&(this[u]=null),(s=o.resolve)===null||s===void 0||s.call(o);try{c(t(a))}catch(y){i(y)}})},async c=>{try{return n==null?void 0:n(c)}finally{await this.cancel(c)}})}catch(e,t){return this.then(void 0,e,t)}finally(e,t){if(!(this instanceof l))throw new TypeError("CancellablePromise.prototype.finally called on an invalid object.");return f(e)?this.then(n=>l.resolve(e()).then(()=>n),n=>l.resolve(e()).then(()=>{throw n}),t):this.then(e,e,t)}static get[C](){return Promise}static all(e){let t=Array.from(e);const n=t.length===0?l.resolve(t):new l((o,c)=>{Promise.all(t).then(o,c)},o=>j(n,t,o));return n}static allSettled(e){let t=Array.from(e);const n=t.length===0?l.resolve(t):new l((o,c)=>{Promise.allSettled(t).then(o,c)},o=>j(n,t,o));return n}static any(e){let t=Array.from(e);const n=t.length===0?l.resolve(t):new l((o,c)=>{Promise.any(t).then(o,c)},o=>j(n,t,o));return n}static race(e){let t=Array.from(e);const n=new l((o,c)=>{Promise.race(t).then(o,c)},o=>j(n,t,o));return n}static cancel(e){const t=new l(()=>{});return t.cancel(e),t}static timeout(e,t){const n=new l(()=>{});return AbortSignal&&typeof AbortSignal=="function"&&AbortSignal.timeout&&typeof AbortSignal.timeout=="function"?AbortSignal.timeout(e).addEventListener("abort",()=>void n.cancel(t)):setTimeout(()=>void n.cancel(t),e),n}static sleep(e,t){return new l(n=>{setTimeout(()=>n(t),e)})}static reject(e){return new l((t,n)=>n(e))}static resolve(e){return e instanceof l?e:new l(t=>t(e))}static withResolvers(){let e={oncancelled:null};return e.promise=new l((t,n)=>{e.resolve=t,e.reject=n},t=>{var n;(n=e.oncancelled)===null||n===void 0||n.call(e,t)}),e}}function x(r,e){let t;return n=>{if(e.settled||(e.settled=!0,e.reason=n,r.reject(n),Promise.prototype.then.call(r.promise,void 0,o=>{if(o!==n)throw o})),!(!e.reason||!r.oncancelled))return t=new Promise(o=>{try{o(r.oncancelled(e.reason.cause))}catch(c){Promise.reject(new b(r.promise,c,"Unhandled exception in oncancelled callback."))}}).catch(o=>{Promise.reject(new b(r.promise,o,"Unhandled rejection in oncancelled callback."))}),r.oncancelled=null,t}}function L(r,e){return t=>{if(!e.resolving){if(e.resolving=!0,t===r.promise){if(e.settled)return;e.settled=!0,r.reject(new TypeError("A promise cannot be resolved with itself."));return}if(t!=null&&(typeof t=="object"||typeof t=="function")){let n;try{n=t.then}catch(o){e.settled=!0,r.reject(o);return}if(f(n)){try{let i=t.cancel;if(f(i)){const a=s=>{Reflect.apply(i,t,[s])};e.reason?x(Object.assign(Object.assign({},r),{oncancelled:a}),e)(e.reason):r.oncancelled=a}}catch{}const o={root:e.root,resolving:!1,get settled(){return this.root.settled},set settled(i){this.root.settled=i},get reason(){return this.root.reason}},c=I(r,o);try{Reflect.apply(n,t,[L(r,o),c])}catch(i){c(i)}return}}e.settled||(e.settled=!0,r.resolve(t))}}}function I(r,e){return t=>{if(!e.resolving)if(e.resolving=!0,e.settled){try{if(t instanceof A&&e.reason instanceof A&&Object.is(t.cause,e.reason.cause))return}catch{}Promise.reject(new b(r.promise,t))}else e.settled=!0,r.reject(t)}}function j(r,e,t){const n=[];for(const o of e){let c;try{if(!f(o.then)||(c=o.cancel,!f(c)))continue}catch{continue}let i;try{i=Reflect.apply(c,o,[t])}catch(a){Promise.reject(new b(r,a,"Unhandled exception in cancel method."));continue}i&&n.push((i instanceof Promise?i:Promise.resolve(i)).catch(a=>{Promise.reject(new b(r,a,"Unhandled rejection in cancel method."))}))}return Promise.all(n)}function D(r){return r}function F(r){throw r}function X(r){try{if(r instanceof Error||typeof r!="object"||r.toString!==Object.prototype.toString)return""+r}catch{}try{return JSON.stringify(r)}catch{}try{return Object.prototype.toString.call(r)}catch{}return"<could not convert error to string>"}function Y(r){var e;let t=(e=r[u])!==null&&e!==void 0?e:{};return"promise"in t||Object.assign(t,h()),r[u]==null&&(t.resolve(),r[u]=t),t.promise}let h=Promise.withResolvers;h&&typeof h=="function"?h=h.bind(Promise):h=function(){let r,e;return{promise:new Promise((n,o)=>{r=n,e=o}),resolve:r,reject:e}};d.hasDOM&&(window._wails=window._wails||{});const Z=d.newRuntimeCaller(d.objectNames.Call),$=d.newRuntimeCaller(d.objectNames.CancelCall),v=new Map,_=0,ee=0;function te(){let r;do r=d.nanoid();while(v.has(r));return r}function T(r){const e=te(),t=l.withResolvers();v.set(e,{resolve:t.resolve,reject:t.reject});const n=Z(_,Object.assign({"call-id":e},r));let o=!0;n.then(i=>{o=!1,v.delete(e),t.resolve(i)},i=>{o=!1,v.delete(e),t.reject(i)});const c=()=>(v.delete(e),$(ee,{"call-id":e}).catch(i=>{console.error("Error while requesting binding call cancellation:",i)}));return t.oncancelled=()=>o?c():n.then(c),t.promise}function re(r,...e){return T({methodName:r,args:e})}function U(r,...e){return T({methodID:r,args:e})}const ne=Object.freeze(Object.defineProperty({__proto__:null,ByID:U,ByName:re,Call:T,RuntimeError:d.RuntimeError},Symbol.toStringTag,{value:"Module"}));exports.ByID=U;exports.calls=ne;