@nil-/xit 0.0.8 → 0.1.1

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.
@@ -0,0 +1,3757 @@
1
+ var U = (t) => {
2
+ throw TypeError(t);
3
+ };
4
+ var L = (t, e, r) => e.has(t) || U("Cannot " + r);
5
+ var w = (t, e, r) => (L(t, e, "read from private field"), r ? r.call(t) : e.get(t)), D = (t, e, r) => e.has(t) ? U("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), k = (t, e, r, s) => (L(t, e, "write to private field"), s ? s.call(t, r) : e.set(t, r), r), j = (t, e, r) => (L(t, e, "access private method"), r);
6
+ const PUBLIC_VERSION = "5";
7
+ typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);
8
+ const TEMPLATE_USE_IMPORT_NODE = 2, DEV = !1;
9
+ var is_array = Array.isArray, array_from = Array.from, define_property = Object.defineProperty, get_descriptor = Object.getOwnPropertyDescriptor;
10
+ const noop$1 = () => {
11
+ };
12
+ function is_promise(t) {
13
+ return typeof (t == null ? void 0 : t.then) == "function";
14
+ }
15
+ function run_all(t) {
16
+ for (var e = 0; e < t.length; e++)
17
+ t[e]();
18
+ }
19
+ const DERIVED = 2, EFFECT = 4, RENDER_EFFECT = 8, BLOCK_EFFECT = 16, BRANCH_EFFECT = 32, ROOT_EFFECT = 64, UNOWNED = 128, DISCONNECTED = 256, CLEAN = 512, DIRTY = 1024, MAYBE_DIRTY = 2048, INERT = 4096, DESTROYED = 8192, EFFECT_RAN = 16384, EFFECT_TRANSPARENT = 32768, HEAD_EFFECT = 1 << 18, EFFECT_HAS_DERIVED = 1 << 19;
20
+ function equals(t) {
21
+ return t === this.v;
22
+ }
23
+ function safe_not_equal(t, e) {
24
+ return t != t ? e == e : t !== e || t !== null && typeof t == "object" || typeof t == "function";
25
+ }
26
+ function safe_equals(t) {
27
+ return !safe_not_equal(t, this.v);
28
+ }
29
+ function effect_update_depth_exceeded() {
30
+ throw new Error("effect_update_depth_exceeded");
31
+ }
32
+ function state_unsafe_local_read() {
33
+ throw new Error("state_unsafe_local_read");
34
+ }
35
+ function state_unsafe_mutation() {
36
+ throw new Error("state_unsafe_mutation");
37
+ }
38
+ function source(t) {
39
+ return {
40
+ f: 0,
41
+ // TODO ideally we could skip this altogether, but it causes type errors
42
+ v: t,
43
+ reactions: null,
44
+ equals,
45
+ version: 0
46
+ };
47
+ }
48
+ // @__NO_SIDE_EFFECTS__
49
+ function mutable_source(t) {
50
+ var r;
51
+ const e = source(t);
52
+ return e.equals = safe_equals, component_context !== null && component_context.l !== null && ((r = component_context.l).s ?? (r.s = [])).push(e), e;
53
+ }
54
+ function set(t, e) {
55
+ return active_reaction !== null && is_runes() && active_reaction.f & DERIVED && // If the source was created locally within the current derived, then
56
+ // we allow the mutation.
57
+ (derived_sources === null || !derived_sources.includes(t)) && state_unsafe_mutation(), t.equals(e) || (t.v = e, t.version = increment_version(), mark_reactions(t, DIRTY), is_runes() && active_effect !== null && active_effect.f & CLEAN && !(active_effect.f & BRANCH_EFFECT) && (new_deps !== null && new_deps.includes(t) ? (set_signal_status(active_effect, DIRTY), schedule_effect(active_effect)) : untracked_writes === null ? set_untracked_writes([t]) : untracked_writes.push(t))), e;
58
+ }
59
+ function mark_reactions(t, e) {
60
+ var r = t.reactions;
61
+ if (r !== null)
62
+ for (var s = is_runes(), o = r.length, u = 0; u < o; u++) {
63
+ var n = r[u], a = n.f;
64
+ a & DIRTY || !s && n === active_effect || (set_signal_status(n, e), a & (CLEAN | UNOWNED) && (a & DERIVED ? mark_reactions(
65
+ /** @type {Derived} */
66
+ n,
67
+ MAYBE_DIRTY
68
+ ) : schedule_effect(
69
+ /** @type {Effect} */
70
+ n
71
+ )));
72
+ }
73
+ }
74
+ function push_effect(t, e) {
75
+ var r = e.last;
76
+ r === null ? e.last = e.first = t : (r.next = t, t.prev = r, e.last = t);
77
+ }
78
+ function create_effect(t, e, r, s = !0) {
79
+ var o = (t & ROOT_EFFECT) !== 0, u = active_effect, n = {
80
+ ctx: component_context,
81
+ deps: null,
82
+ nodes_start: null,
83
+ nodes_end: null,
84
+ f: t | DIRTY,
85
+ first: null,
86
+ fn: e,
87
+ last: null,
88
+ next: null,
89
+ parent: o ? null : u,
90
+ prev: null,
91
+ teardown: null,
92
+ transitions: null,
93
+ version: 0
94
+ };
95
+ if (r) {
96
+ var a = is_flushing_effect;
97
+ try {
98
+ set_is_flushing_effect(!0), update_effect(n), n.f |= EFFECT_RAN;
99
+ } catch (l) {
100
+ throw destroy_effect(n), l;
101
+ } finally {
102
+ set_is_flushing_effect(a);
103
+ }
104
+ } else e !== null && schedule_effect(n);
105
+ var f = r && n.deps === null && n.first === null && n.nodes_start === null && n.teardown === null && (n.f & EFFECT_HAS_DERIVED) === 0;
106
+ if (!f && !o && s && (u !== null && push_effect(n, u), active_reaction !== null && active_reaction.f & DERIVED)) {
107
+ var i = (
108
+ /** @type {Derived} */
109
+ active_reaction
110
+ );
111
+ (i.children ?? (i.children = [])).push(n);
112
+ }
113
+ return n;
114
+ }
115
+ function effect_root(t) {
116
+ const e = create_effect(ROOT_EFFECT, t, !0);
117
+ return () => {
118
+ destroy_effect(e);
119
+ };
120
+ }
121
+ function effect(t) {
122
+ return create_effect(EFFECT, t, !1);
123
+ }
124
+ function render_effect(t) {
125
+ return create_effect(RENDER_EFFECT, t, !0);
126
+ }
127
+ function template_effect(t) {
128
+ return render_effect(t);
129
+ }
130
+ function block(t, e = 0) {
131
+ return create_effect(RENDER_EFFECT | BLOCK_EFFECT | e, t, !0);
132
+ }
133
+ function branch(t, e = !0) {
134
+ return create_effect(RENDER_EFFECT | BRANCH_EFFECT, t, !0, e);
135
+ }
136
+ function execute_effect_teardown(t) {
137
+ var e = t.teardown;
138
+ if (e !== null) {
139
+ const r = active_reaction;
140
+ set_active_reaction(null);
141
+ try {
142
+ e.call(null);
143
+ } finally {
144
+ set_active_reaction(r);
145
+ }
146
+ }
147
+ }
148
+ function destroy_effect(t, e = !0) {
149
+ var r = !1;
150
+ if ((e || t.f & HEAD_EFFECT) && t.nodes_start !== null) {
151
+ for (var s = t.nodes_start, o = t.nodes_end; s !== null; ) {
152
+ var u = s === o ? null : (
153
+ /** @type {TemplateNode} */
154
+ /* @__PURE__ */ get_next_sibling(s)
155
+ );
156
+ s.remove(), s = u;
157
+ }
158
+ r = !0;
159
+ }
160
+ destroy_effect_children(t, e && !r), remove_reactions(t, 0), set_signal_status(t, DESTROYED);
161
+ var n = t.transitions;
162
+ if (n !== null)
163
+ for (const f of n)
164
+ f.stop();
165
+ execute_effect_teardown(t);
166
+ var a = t.parent;
167
+ a !== null && a.first !== null && unlink_effect(t), t.next = t.prev = t.teardown = t.ctx = t.deps = t.parent = t.fn = t.nodes_start = t.nodes_end = null;
168
+ }
169
+ function unlink_effect(t) {
170
+ var e = t.parent, r = t.prev, s = t.next;
171
+ r !== null && (r.next = s), s !== null && (s.prev = r), e !== null && (e.first === t && (e.first = s), e.last === t && (e.last = r));
172
+ }
173
+ function pause_effect(t, e) {
174
+ var r = [];
175
+ pause_children(t, r, !0), run_out_transitions(r, () => {
176
+ destroy_effect(t), e && e();
177
+ });
178
+ }
179
+ function run_out_transitions(t, e) {
180
+ var r = t.length;
181
+ if (r > 0) {
182
+ var s = () => --r || e();
183
+ for (var o of t)
184
+ o.out(s);
185
+ } else
186
+ e();
187
+ }
188
+ function pause_children(t, e, r) {
189
+ if (!(t.f & INERT)) {
190
+ if (t.f ^= INERT, t.transitions !== null)
191
+ for (const n of t.transitions)
192
+ (n.is_global || r) && e.push(n);
193
+ for (var s = t.first; s !== null; ) {
194
+ var o = s.next, u = (s.f & EFFECT_TRANSPARENT) !== 0 || (s.f & BRANCH_EFFECT) !== 0;
195
+ pause_children(s, e, u ? r : !1), s = o;
196
+ }
197
+ }
198
+ }
199
+ function resume_effect(t) {
200
+ resume_children(t, !0);
201
+ }
202
+ function resume_children(t, e) {
203
+ if (t.f & INERT) {
204
+ t.f ^= INERT, check_dirtiness(t) && update_effect(t);
205
+ for (var r = t.first; r !== null; ) {
206
+ var s = r.next, o = (r.f & EFFECT_TRANSPARENT) !== 0 || (r.f & BRANCH_EFFECT) !== 0;
207
+ resume_children(r, o ? e : !1), r = s;
208
+ }
209
+ if (t.transitions !== null)
210
+ for (const u of t.transitions)
211
+ (u.is_global || e) && u.in();
212
+ }
213
+ }
214
+ let is_micro_task_queued$1 = !1, current_queued_micro_tasks = [];
215
+ function process_micro_tasks() {
216
+ is_micro_task_queued$1 = !1;
217
+ const t = current_queued_micro_tasks.slice();
218
+ current_queued_micro_tasks = [], run_all(t);
219
+ }
220
+ function queue_micro_task(t) {
221
+ is_micro_task_queued$1 || (is_micro_task_queued$1 = !0, queueMicrotask(process_micro_tasks)), current_queued_micro_tasks.push(t);
222
+ }
223
+ function flush_tasks() {
224
+ is_micro_task_queued$1 && process_micro_tasks();
225
+ }
226
+ // @__NO_SIDE_EFFECTS__
227
+ function derived(t) {
228
+ let e = DERIVED | DIRTY;
229
+ active_effect === null ? e |= UNOWNED : active_effect.f |= EFFECT_HAS_DERIVED;
230
+ const r = {
231
+ children: null,
232
+ deps: null,
233
+ equals,
234
+ f: e,
235
+ fn: t,
236
+ reactions: null,
237
+ v: (
238
+ /** @type {V} */
239
+ null
240
+ ),
241
+ version: 0,
242
+ parent: active_effect
243
+ };
244
+ if (active_reaction !== null && active_reaction.f & DERIVED) {
245
+ var s = (
246
+ /** @type {Derived} */
247
+ active_reaction
248
+ );
249
+ (s.children ?? (s.children = [])).push(r);
250
+ }
251
+ return r;
252
+ }
253
+ function destroy_derived_children(t) {
254
+ var e = t.children;
255
+ if (e !== null) {
256
+ t.children = null;
257
+ for (var r = 0; r < e.length; r += 1) {
258
+ var s = e[r];
259
+ s.f & DERIVED ? destroy_derived(
260
+ /** @type {Derived} */
261
+ s
262
+ ) : destroy_effect(
263
+ /** @type {Effect} */
264
+ s
265
+ );
266
+ }
267
+ }
268
+ }
269
+ function update_derived(t) {
270
+ var e, r = active_effect;
271
+ set_active_effect(t.parent);
272
+ try {
273
+ destroy_derived_children(t), e = update_reaction(t);
274
+ } finally {
275
+ set_active_effect(r);
276
+ }
277
+ var s = (skip_reaction || t.f & UNOWNED) && t.deps !== null ? MAYBE_DIRTY : CLEAN;
278
+ set_signal_status(t, s), t.equals(e) || (t.v = e, t.version = increment_version());
279
+ }
280
+ function destroy_derived(t) {
281
+ destroy_derived_children(t), remove_reactions(t, 0), set_signal_status(t, DESTROYED), t.children = t.deps = t.reactions = // @ts-expect-error `signal.fn` cannot be `null` while the signal is alive
282
+ t.fn = null;
283
+ }
284
+ const FLUSH_MICROTASK = 0, FLUSH_SYNC = 1;
285
+ let scheduler_mode = FLUSH_MICROTASK, is_micro_task_queued = !1, is_flushing_effect = !1;
286
+ function set_is_flushing_effect(t) {
287
+ is_flushing_effect = t;
288
+ }
289
+ let queued_root_effects = [], flush_count = 0, dev_effect_stack = [], active_reaction = null;
290
+ function set_active_reaction(t) {
291
+ active_reaction = t;
292
+ }
293
+ let active_effect = null;
294
+ function set_active_effect(t) {
295
+ active_effect = t;
296
+ }
297
+ let derived_sources = null, new_deps = null, skipped_deps = 0, untracked_writes = null;
298
+ function set_untracked_writes(t) {
299
+ untracked_writes = t;
300
+ }
301
+ let current_version = 0, skip_reaction = !1, component_context = null;
302
+ function set_component_context(t) {
303
+ component_context = t;
304
+ }
305
+ function increment_version() {
306
+ return ++current_version;
307
+ }
308
+ function is_runes() {
309
+ return component_context !== null && component_context.l === null;
310
+ }
311
+ function check_dirtiness(t) {
312
+ var n, a;
313
+ var e = t.f;
314
+ if (e & DIRTY)
315
+ return !0;
316
+ if (e & MAYBE_DIRTY) {
317
+ var r = t.deps, s = (e & UNOWNED) !== 0;
318
+ if (r !== null) {
319
+ var o;
320
+ if (e & DISCONNECTED) {
321
+ for (o = 0; o < r.length; o++)
322
+ ((n = r[o]).reactions ?? (n.reactions = [])).push(t);
323
+ t.f ^= DISCONNECTED;
324
+ }
325
+ for (o = 0; o < r.length; o++) {
326
+ var u = r[o];
327
+ if (check_dirtiness(
328
+ /** @type {Derived} */
329
+ u
330
+ ) && update_derived(
331
+ /** @type {Derived} */
332
+ u
333
+ ), s && active_effect !== null && !skip_reaction && !((a = u == null ? void 0 : u.reactions) != null && a.includes(t)) && (u.reactions ?? (u.reactions = [])).push(t), u.version > t.version)
334
+ return !0;
335
+ }
336
+ }
337
+ s || set_signal_status(t, CLEAN);
338
+ }
339
+ return !1;
340
+ }
341
+ function handle_error(t, e, r) {
342
+ throw t;
343
+ }
344
+ function update_reaction(t) {
345
+ var l;
346
+ var e = new_deps, r = skipped_deps, s = untracked_writes, o = active_reaction, u = skip_reaction, n = derived_sources;
347
+ new_deps = /** @type {null | Value[]} */
348
+ null, skipped_deps = 0, untracked_writes = null, active_reaction = t.f & (BRANCH_EFFECT | ROOT_EFFECT) ? null : t, skip_reaction = !is_flushing_effect && (t.f & UNOWNED) !== 0, derived_sources = null;
349
+ try {
350
+ var a = (
351
+ /** @type {Function} */
352
+ (0, t.fn)()
353
+ ), f = t.deps;
354
+ if (new_deps !== null) {
355
+ var i;
356
+ if (remove_reactions(t, skipped_deps), f !== null && skipped_deps > 0)
357
+ for (f.length = skipped_deps + new_deps.length, i = 0; i < new_deps.length; i++)
358
+ f[skipped_deps + i] = new_deps[i];
359
+ else
360
+ t.deps = f = new_deps;
361
+ if (!skip_reaction)
362
+ for (i = skipped_deps; i < f.length; i++)
363
+ ((l = f[i]).reactions ?? (l.reactions = [])).push(t);
364
+ } else f !== null && skipped_deps < f.length && (remove_reactions(t, skipped_deps), f.length = skipped_deps);
365
+ return a;
366
+ } finally {
367
+ new_deps = e, skipped_deps = r, untracked_writes = s, active_reaction = o, skip_reaction = u, derived_sources = n;
368
+ }
369
+ }
370
+ function remove_reaction(t, e) {
371
+ let r = e.reactions;
372
+ if (r !== null) {
373
+ var s = r.indexOf(t);
374
+ if (s !== -1) {
375
+ var o = r.length - 1;
376
+ o === 0 ? r = e.reactions = null : (r[s] = r[o], r.pop());
377
+ }
378
+ }
379
+ r === null && e.f & DERIVED && // Destroying a child effect while updating a parent effect can cause a dependency to appear
380
+ // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps`
381
+ // allows us to skip the expensive work of disconnecting and immediately reconnecting it
382
+ (new_deps === null || !new_deps.includes(e)) && (set_signal_status(e, MAYBE_DIRTY), e.f & (UNOWNED | DISCONNECTED) || (e.f ^= DISCONNECTED), remove_reactions(
383
+ /** @type {Derived} **/
384
+ e,
385
+ 0
386
+ ));
387
+ }
388
+ function remove_reactions(t, e) {
389
+ var r = t.deps;
390
+ if (r !== null)
391
+ for (var s = e; s < r.length; s++)
392
+ remove_reaction(t, r[s]);
393
+ }
394
+ function destroy_effect_children(t, e = !1) {
395
+ var r = t.first;
396
+ for (t.first = t.last = null; r !== null; ) {
397
+ var s = r.next;
398
+ destroy_effect(r, e), r = s;
399
+ }
400
+ }
401
+ function update_effect(t) {
402
+ var e = t.f;
403
+ if (!(e & DESTROYED)) {
404
+ set_signal_status(t, CLEAN);
405
+ var r = active_effect, s = component_context;
406
+ active_effect = t, component_context = t.ctx;
407
+ try {
408
+ e & BLOCK_EFFECT || destroy_effect_children(t), execute_effect_teardown(t);
409
+ var o = update_reaction(t);
410
+ t.teardown = typeof o == "function" ? o : null, t.version = current_version;
411
+ } catch (u) {
412
+ handle_error(
413
+ /** @type {Error} */
414
+ u
415
+ );
416
+ } finally {
417
+ active_effect = r, component_context = s;
418
+ }
419
+ }
420
+ }
421
+ function infinite_loop_guard() {
422
+ flush_count > 1e3 && (flush_count = 0, effect_update_depth_exceeded()), flush_count++;
423
+ }
424
+ function flush_queued_root_effects(t) {
425
+ var e = t.length;
426
+ if (e !== 0) {
427
+ infinite_loop_guard();
428
+ var r = is_flushing_effect;
429
+ is_flushing_effect = !0;
430
+ try {
431
+ for (var s = 0; s < e; s++) {
432
+ var o = t[s];
433
+ o.f & CLEAN || (o.f ^= CLEAN);
434
+ var u = [];
435
+ process_effects(o, u), flush_queued_effects(u);
436
+ }
437
+ } finally {
438
+ is_flushing_effect = r;
439
+ }
440
+ }
441
+ }
442
+ function flush_queued_effects(t) {
443
+ var e = t.length;
444
+ if (e !== 0)
445
+ for (var r = 0; r < e; r++) {
446
+ var s = t[r];
447
+ !(s.f & (DESTROYED | INERT)) && check_dirtiness(s) && (update_effect(s), s.deps === null && s.first === null && s.nodes_start === null && (s.teardown === null ? unlink_effect(s) : s.fn = null));
448
+ }
449
+ }
450
+ function process_deferred() {
451
+ if (is_micro_task_queued = !1, flush_count > 1001)
452
+ return;
453
+ const t = queued_root_effects;
454
+ queued_root_effects = [], flush_queued_root_effects(t), is_micro_task_queued || (flush_count = 0);
455
+ }
456
+ function schedule_effect(t) {
457
+ scheduler_mode === FLUSH_MICROTASK && (is_micro_task_queued || (is_micro_task_queued = !0, queueMicrotask(process_deferred)));
458
+ for (var e = t; e.parent !== null; ) {
459
+ e = e.parent;
460
+ var r = e.f;
461
+ if (r & (ROOT_EFFECT | BRANCH_EFFECT)) {
462
+ if (!(r & CLEAN)) return;
463
+ e.f ^= CLEAN;
464
+ }
465
+ }
466
+ queued_root_effects.push(e);
467
+ }
468
+ function process_effects(t, e) {
469
+ var r = t.first, s = [];
470
+ e: for (; r !== null; ) {
471
+ var o = r.f, u = (o & BRANCH_EFFECT) !== 0, n = u && (o & CLEAN) !== 0;
472
+ if (!n && !(o & INERT))
473
+ if (o & RENDER_EFFECT) {
474
+ u ? r.f ^= CLEAN : check_dirtiness(r) && update_effect(r);
475
+ var a = r.first;
476
+ if (a !== null) {
477
+ r = a;
478
+ continue;
479
+ }
480
+ } else o & EFFECT && s.push(r);
481
+ var f = r.next;
482
+ if (f === null) {
483
+ let c = r.parent;
484
+ for (; c !== null; ) {
485
+ if (t === c)
486
+ break e;
487
+ var i = c.next;
488
+ if (i !== null) {
489
+ r = i;
490
+ continue e;
491
+ }
492
+ c = c.parent;
493
+ }
494
+ }
495
+ r = f;
496
+ }
497
+ for (var l = 0; l < s.length; l++)
498
+ a = s[l], e.push(a), process_effects(a, e);
499
+ }
500
+ function flush_sync(t) {
501
+ var e = scheduler_mode, r = queued_root_effects;
502
+ try {
503
+ infinite_loop_guard();
504
+ const o = [];
505
+ scheduler_mode = FLUSH_SYNC, queued_root_effects = o, is_micro_task_queued = !1, flush_queued_root_effects(r);
506
+ var s = t == null ? void 0 : t();
507
+ return flush_tasks(), (queued_root_effects.length > 0 || o.length > 0) && flush_sync(), flush_count = 0, s;
508
+ } finally {
509
+ scheduler_mode = e, queued_root_effects = r;
510
+ }
511
+ }
512
+ function get$1(t) {
513
+ var e = t.f;
514
+ if (e & DESTROYED)
515
+ return t.v;
516
+ if (active_reaction !== null) {
517
+ derived_sources !== null && derived_sources.includes(t) && state_unsafe_local_read();
518
+ var r = active_reaction.deps;
519
+ new_deps === null && r !== null && r[skipped_deps] === t ? skipped_deps++ : new_deps === null ? new_deps = [t] : new_deps.push(t), untracked_writes !== null && active_effect !== null && active_effect.f & CLEAN && !(active_effect.f & BRANCH_EFFECT) && untracked_writes.includes(t) && (set_signal_status(active_effect, DIRTY), schedule_effect(active_effect));
520
+ }
521
+ if (e & DERIVED) {
522
+ var s = (
523
+ /** @type {Derived} */
524
+ t
525
+ );
526
+ check_dirtiness(s) && update_derived(s);
527
+ }
528
+ return t.v;
529
+ }
530
+ function untrack(t) {
531
+ const e = active_reaction;
532
+ try {
533
+ return active_reaction = null, t();
534
+ } finally {
535
+ active_reaction = e;
536
+ }
537
+ }
538
+ const STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
539
+ function set_signal_status(t, e) {
540
+ t.f = t.f & STATUS_MASK | e;
541
+ }
542
+ function push(t, e = !1, r) {
543
+ component_context = {
544
+ p: component_context,
545
+ c: null,
546
+ e: null,
547
+ m: !1,
548
+ s: t,
549
+ x: null,
550
+ l: null
551
+ }, e || (component_context.l = {
552
+ s: null,
553
+ u: null,
554
+ r1: [],
555
+ r2: source(!1)
556
+ });
557
+ }
558
+ function pop(t) {
559
+ const e = component_context;
560
+ if (e !== null) {
561
+ const n = e.e;
562
+ if (n !== null) {
563
+ var r = active_effect, s = active_reaction;
564
+ e.e = null;
565
+ try {
566
+ for (var o = 0; o < n.length; o++) {
567
+ var u = n[o];
568
+ set_active_effect(u.effect), set_active_reaction(u.reaction), effect(u.fn);
569
+ }
570
+ } finally {
571
+ set_active_effect(r), set_active_reaction(s);
572
+ }
573
+ }
574
+ component_context = e.p, e.m = !0;
575
+ }
576
+ return (
577
+ /** @type {T} */
578
+ {}
579
+ );
580
+ }
581
+ var $window, first_child_getter, next_sibling_getter;
582
+ function init_operations() {
583
+ if ($window === void 0) {
584
+ $window = window;
585
+ var t = Element.prototype, e = Node.prototype;
586
+ first_child_getter = get_descriptor(e, "firstChild").get, next_sibling_getter = get_descriptor(e, "nextSibling").get, t.__click = void 0, t.__className = "", t.__attributes = null, t.__e = void 0, Text.prototype.__t = void 0;
587
+ }
588
+ }
589
+ function create_text(t = "") {
590
+ return document.createTextNode(t);
591
+ }
592
+ // @__NO_SIDE_EFFECTS__
593
+ function get_first_child(t) {
594
+ return first_child_getter.call(t);
595
+ }
596
+ // @__NO_SIDE_EFFECTS__
597
+ function get_next_sibling(t) {
598
+ return next_sibling_getter.call(t);
599
+ }
600
+ function child(t) {
601
+ return /* @__PURE__ */ get_first_child(t);
602
+ }
603
+ function first_child(t, e) {
604
+ {
605
+ var r = (
606
+ /** @type {DocumentFragment} */
607
+ /* @__PURE__ */ get_first_child(
608
+ /** @type {Node} */
609
+ t
610
+ )
611
+ );
612
+ return r instanceof Comment && r.data === "" ? /* @__PURE__ */ get_next_sibling(r) : r;
613
+ }
614
+ }
615
+ const all_registered_events = /* @__PURE__ */ new Set(), root_event_handles = /* @__PURE__ */ new Set();
616
+ function handle_event_propagation(t) {
617
+ var g;
618
+ var e = this, r = (
619
+ /** @type {Node} */
620
+ e.ownerDocument
621
+ ), s = t.type, o = ((g = t.composedPath) == null ? void 0 : g.call(t)) || [], u = (
622
+ /** @type {null | Element} */
623
+ o[0] || t.target
624
+ ), n = 0, a = t.__root;
625
+ if (a) {
626
+ var f = o.indexOf(a);
627
+ if (f !== -1 && (e === document || e === /** @type {any} */
628
+ window)) {
629
+ t.__root = e;
630
+ return;
631
+ }
632
+ var i = o.indexOf(e);
633
+ if (i === -1)
634
+ return;
635
+ f <= i && (n = f);
636
+ }
637
+ if (u = /** @type {Element} */
638
+ o[n] || t.target, u !== e) {
639
+ define_property(t, "currentTarget", {
640
+ configurable: !0,
641
+ get() {
642
+ return u || r;
643
+ }
644
+ });
645
+ try {
646
+ for (var l, c = []; u !== null; ) {
647
+ var h = u.assignedSlot || u.parentNode || /** @type {any} */
648
+ u.host || null;
649
+ try {
650
+ var d = u["__" + s];
651
+ if (d !== void 0 && !/** @type {any} */
652
+ u.disabled)
653
+ if (is_array(d)) {
654
+ var [p, ...v] = d;
655
+ p.apply(u, [t, ...v]);
656
+ } else
657
+ d.call(u, t);
658
+ } catch (m) {
659
+ l ? c.push(m) : l = m;
660
+ }
661
+ if (t.cancelBubble || h === e || h === null)
662
+ break;
663
+ u = h;
664
+ }
665
+ if (l) {
666
+ for (let m of c)
667
+ queueMicrotask(() => {
668
+ throw m;
669
+ });
670
+ throw l;
671
+ }
672
+ } finally {
673
+ t.__root = e, delete t.currentTarget;
674
+ }
675
+ }
676
+ }
677
+ function create_fragment_from_html(t) {
678
+ var e = document.createElement("template");
679
+ return e.innerHTML = t, e.content;
680
+ }
681
+ function assign_nodes(t, e) {
682
+ var r = (
683
+ /** @type {Effect} */
684
+ active_effect
685
+ );
686
+ r.nodes_start === null && (r.nodes_start = t, r.nodes_end = e);
687
+ }
688
+ // @__NO_SIDE_EFFECTS__
689
+ function template(t, e) {
690
+ var r = (e & TEMPLATE_USE_IMPORT_NODE) !== 0, s, o = !t.startsWith("<!>");
691
+ return () => {
692
+ s === void 0 && (s = create_fragment_from_html(o ? t : "<!>" + t), s = /** @type {Node} */
693
+ /* @__PURE__ */ get_first_child(s));
694
+ var u = (
695
+ /** @type {TemplateNode} */
696
+ r ? document.importNode(s, !0) : s.cloneNode(!0)
697
+ );
698
+ return assign_nodes(u, u), u;
699
+ };
700
+ }
701
+ function comment() {
702
+ var t = document.createDocumentFragment(), e = document.createComment(""), r = create_text();
703
+ return t.append(e, r), assign_nodes(e, r), t;
704
+ }
705
+ function append(t, e) {
706
+ t !== null && t.before(
707
+ /** @type {Node} */
708
+ e
709
+ );
710
+ }
711
+ const PASSIVE_EVENTS = ["touchstart", "touchmove"];
712
+ function is_passive_event(t) {
713
+ return PASSIVE_EVENTS.includes(t);
714
+ }
715
+ function set_text(t, e) {
716
+ e !== (t.__t ?? (t.__t = t.nodeValue)) && (t.__t = e, t.nodeValue = e == null ? "" : e + "");
717
+ }
718
+ function mount(t, e) {
719
+ return _mount(t, e);
720
+ }
721
+ const document_listeners = /* @__PURE__ */ new Map();
722
+ function _mount(t, { target: e, anchor: r, props: s = {}, events: o, context: u, intro: n = !0 }) {
723
+ init_operations();
724
+ var a = /* @__PURE__ */ new Set(), f = (c) => {
725
+ for (var h = 0; h < c.length; h++) {
726
+ var d = c[h];
727
+ if (!a.has(d)) {
728
+ a.add(d);
729
+ var p = is_passive_event(d);
730
+ e.addEventListener(d, handle_event_propagation, { passive: p });
731
+ var v = document_listeners.get(d);
732
+ v === void 0 ? (document.addEventListener(d, handle_event_propagation, { passive: p }), document_listeners.set(d, 1)) : document_listeners.set(d, v + 1);
733
+ }
734
+ }
735
+ };
736
+ f(array_from(all_registered_events)), root_event_handles.add(f);
737
+ var i = void 0, l = effect_root(() => {
738
+ var c = r ?? e.appendChild(create_text());
739
+ return branch(() => {
740
+ if (u) {
741
+ push({});
742
+ var h = (
743
+ /** @type {ComponentContext} */
744
+ component_context
745
+ );
746
+ h.c = u;
747
+ }
748
+ o && (s.$$events = o), i = t(c, s) || {}, u && pop();
749
+ }), () => {
750
+ var p;
751
+ for (var h of a) {
752
+ e.removeEventListener(h, handle_event_propagation);
753
+ var d = (
754
+ /** @type {number} */
755
+ document_listeners.get(h)
756
+ );
757
+ --d === 0 ? (document.removeEventListener(h, handle_event_propagation), document_listeners.delete(h)) : document_listeners.set(h, d);
758
+ }
759
+ root_event_handles.delete(f), mounted_components.delete(i), c !== r && ((p = c.parentNode) == null || p.removeChild(c));
760
+ };
761
+ });
762
+ return mounted_components.set(i, l), i;
763
+ }
764
+ let mounted_components = /* @__PURE__ */ new WeakMap();
765
+ function unmount(t) {
766
+ const e = mounted_components.get(t);
767
+ e && e();
768
+ }
769
+ const PENDING = 0, THEN = 1, CATCH = 2;
770
+ function await_block(t, e, r, s, o) {
771
+ var u = t, n = is_runes(), a = component_context, f, i, l, c, h = (n ? source : mutable_source)(
772
+ /** @type {V} */
773
+ void 0
774
+ ), d = (n ? source : mutable_source)(void 0), p = !1;
775
+ function v(m, _) {
776
+ p = !0, _ && (set_active_effect(g), set_active_reaction(g), set_component_context(a)), m === PENDING && r && (i ? resume_effect(i) : i = branch(() => r(u))), m === THEN && s && (l ? resume_effect(l) : l = branch(() => s(u, h))), m === CATCH && o && (c ? resume_effect(c) : c = branch(() => o(u, d))), m !== PENDING && i && pause_effect(i, () => i = null), m !== THEN && l && pause_effect(l, () => l = null), m !== CATCH && c && pause_effect(c, () => c = null), _ && (set_component_context(null), set_active_reaction(null), set_active_effect(null), flush_sync());
777
+ }
778
+ var g = block(() => {
779
+ if (f !== (f = e())) {
780
+ if (is_promise(f)) {
781
+ var m = f;
782
+ p = !1, m.then(
783
+ (_) => {
784
+ m === f && (set(h, _), v(THEN, !0));
785
+ },
786
+ (_) => {
787
+ m === f && (set(d, _), v(CATCH, !0));
788
+ }
789
+ ), queue_micro_task(() => {
790
+ p || v(PENDING, !0);
791
+ });
792
+ } else
793
+ set(h, f), v(THEN, !1);
794
+ return () => f = null;
795
+ }
796
+ });
797
+ }
798
+ function action(t, e, r) {
799
+ effect(() => {
800
+ var s = untrack(() => e(t, r == null ? void 0 : r()) || {});
801
+ if (s != null && s.destroy)
802
+ return () => (
803
+ /** @type {Function} */
804
+ s.destroy()
805
+ );
806
+ });
807
+ }
808
+ function subscribe_to_store(t, e, r) {
809
+ if (t == null)
810
+ return e(void 0), noop$1;
811
+ const s = t.subscribe(
812
+ e,
813
+ // @ts-expect-error
814
+ r
815
+ );
816
+ return s.unsubscribe ? () => s.unsubscribe() : s;
817
+ }
818
+ var I, W, S, B, C, M, $, T, V;
819
+ let Service$1 = (V = class {
820
+ constructor({ host: e, port: r }) {
821
+ D(this, I);
822
+ D(this, S);
823
+ // 0 idle, 1 has connected, 2 keep reconnecting, 3 stopped
824
+ D(this, B);
825
+ D(this, C);
826
+ D(this, M);
827
+ D(this, $);
828
+ D(this, T);
829
+ k(this, $, `${e ?? "localhost"}${r != null ? `:${r}` : ""}`), k(this, S, 0), k(this, B, null), k(this, C, null), k(this, M, null), k(this, T, null);
830
+ }
831
+ on_message(e) {
832
+ k(this, M, e);
833
+ }
834
+ on_connect(e) {
835
+ k(this, B, e);
836
+ }
837
+ on_disconnect(e) {
838
+ k(this, C, e);
839
+ }
840
+ // non-blocking (run is blocking in c++)
841
+ // calling it again should not do anything
842
+ start() {
843
+ w(this, T) == null && w(this, S) !== 1 && w(this, S) !== 3 && (k(this, T, new WebSocket(`ws://${w(this, $)}`)), w(this, T).binaryType = "arraybuffer", w(this, T).onopen = () => {
844
+ k(this, S, 1), w(this, B) && w(this, B).call(this, w(this, $));
845
+ }, w(this, T).onclose = () => {
846
+ w(this, S) === 1 && (w(this, C) && w(this, C).call(this, w(this, $)), k(this, S, 2), j(this, I, W).call(this));
847
+ }, w(this, T).onerror = () => {
848
+ w(this, S) !== 1 && w(this, S) !== 3 && (k(this, S, 2), j(this, I, W).call(this));
849
+ }, w(this, T).onmessage = (e) => {
850
+ w(this, M) && w(this, M).call(this, w(this, $), new Uint8Array(e.data));
851
+ });
852
+ }
853
+ stop() {
854
+ k(this, S, 3), w(this, T) != null && (w(this, T).close(), k(this, T, null));
855
+ }
856
+ restart() {
857
+ k(this, S, 0);
858
+ }
859
+ publish(e) {
860
+ w(this, T) != null && w(this, S) == 1 && w(this, T).send(e);
861
+ }
862
+ send(e, r) {
863
+ e === w(this, $) && this.publish(r);
864
+ }
865
+ }, I = new WeakSet(), W = function() {
866
+ w(this, T) != null && (w(this, T).close(), k(this, T, null)), setTimeout(() => this.start(), 1e3);
867
+ }, S = new WeakMap(), B = new WeakMap(), C = new WeakMap(), M = new WeakMap(), $ = new WeakMap(), T = new WeakMap(), V);
868
+ const header = (t) => {
869
+ const e = new Uint8Array(4);
870
+ return new DataView(e.buffer).setUint32(0, t, !1), e;
871
+ }, concat = (t) => {
872
+ const e = new Uint8Array(t.reduce((s, o) => s + o.length, 0));
873
+ let r = 0;
874
+ for (const s of t)
875
+ e.set(s, r), r += s.length;
876
+ return e;
877
+ }, test_connection = async (t) => new Promise((e, r) => {
878
+ const s = new Service$1(t), o = setTimeout(() => {
879
+ s.stop(), r("connection failed... stopping");
880
+ }, 2500);
881
+ s.on_connect(() => {
882
+ console.log("connection tested... proceeding"), clearTimeout(o), s.stop(), e();
883
+ }), s.start();
884
+ }), service_fetch = async (t, e, r) => new Promise((s, o) => {
885
+ const u = new Service$1(t), n = setTimeout(() => {
886
+ o("timed out, cancelled");
887
+ }, 2500);
888
+ u.on_connect(() => u.publish(e)), u.on_message((a, f) => {
889
+ const i = new DataView(f.buffer).getUint32(0, !1), l = f.slice(4), c = r(i, l);
890
+ c != null && (s(c), clearTimeout(n), u.stop());
891
+ }), u.start();
892
+ }), service_publish = (t, e) => {
893
+ const r = new Service$1(t), s = setTimeout(() => {
894
+ r.stop();
895
+ }, 2500);
896
+ r.on_connect(() => {
897
+ clearTimeout(s), r.publish(e), r.stop();
898
+ }), r.start();
899
+ };
900
+ function WorkerWrapper(t) {
901
+ return new Worker(
902
+ "@nil-/xit/assets/bundler.js",
903
+ {
904
+ name: t == null ? void 0 : t.name
905
+ }
906
+ );
907
+ }
908
+ var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
909
+ function getDefaultExportFromCjs(t) {
910
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
911
+ }
912
+ var indexLight = { exports: {} }, indexMinimal = {}, minimal = {}, aspromise = asPromise$1;
913
+ function asPromise$1(t, e) {
914
+ for (var r = new Array(arguments.length - 1), s = 0, o = 2, u = !0; o < arguments.length; )
915
+ r[s++] = arguments[o++];
916
+ return new Promise(function(a, f) {
917
+ r[s] = function(l) {
918
+ if (u)
919
+ if (u = !1, l)
920
+ f(l);
921
+ else {
922
+ for (var c = new Array(arguments.length - 1), h = 0; h < c.length; )
923
+ c[h++] = arguments[h];
924
+ a.apply(null, c);
925
+ }
926
+ };
927
+ try {
928
+ t.apply(e || null, r);
929
+ } catch (i) {
930
+ u && (u = !1, f(i));
931
+ }
932
+ });
933
+ }
934
+ var base64$1 = {};
935
+ (function(t) {
936
+ var e = t;
937
+ e.length = function(a) {
938
+ var f = a.length;
939
+ if (!f)
940
+ return 0;
941
+ for (var i = 0; --f % 4 > 1 && a.charAt(f) === "="; )
942
+ ++i;
943
+ return Math.ceil(a.length * 3) / 4 - i;
944
+ };
945
+ for (var r = new Array(64), s = new Array(123), o = 0; o < 64; )
946
+ s[r[o] = o < 26 ? o + 65 : o < 52 ? o + 71 : o < 62 ? o - 4 : o - 59 | 43] = o++;
947
+ e.encode = function(a, f, i) {
948
+ for (var l = null, c = [], h = 0, d = 0, p; f < i; ) {
949
+ var v = a[f++];
950
+ switch (d) {
951
+ case 0:
952
+ c[h++] = r[v >> 2], p = (v & 3) << 4, d = 1;
953
+ break;
954
+ case 1:
955
+ c[h++] = r[p | v >> 4], p = (v & 15) << 2, d = 2;
956
+ break;
957
+ case 2:
958
+ c[h++] = r[p | v >> 6], c[h++] = r[v & 63], d = 0;
959
+ break;
960
+ }
961
+ h > 8191 && ((l || (l = [])).push(String.fromCharCode.apply(String, c)), h = 0);
962
+ }
963
+ return d && (c[h++] = r[p], c[h++] = 61, d === 1 && (c[h++] = 61)), l ? (h && l.push(String.fromCharCode.apply(String, c.slice(0, h))), l.join("")) : String.fromCharCode.apply(String, c.slice(0, h));
964
+ };
965
+ var u = "invalid encoding";
966
+ e.decode = function(a, f, i) {
967
+ for (var l = i, c = 0, h, d = 0; d < a.length; ) {
968
+ var p = a.charCodeAt(d++);
969
+ if (p === 61 && c > 1)
970
+ break;
971
+ if ((p = s[p]) === void 0)
972
+ throw Error(u);
973
+ switch (c) {
974
+ case 0:
975
+ h = p, c = 1;
976
+ break;
977
+ case 1:
978
+ f[i++] = h << 2 | (p & 48) >> 4, h = p, c = 2;
979
+ break;
980
+ case 2:
981
+ f[i++] = (h & 15) << 4 | (p & 60) >> 2, h = p, c = 3;
982
+ break;
983
+ case 3:
984
+ f[i++] = (h & 3) << 6 | p, c = 0;
985
+ break;
986
+ }
987
+ }
988
+ if (c === 1)
989
+ throw Error(u);
990
+ return i - l;
991
+ }, e.test = function(a) {
992
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(a);
993
+ };
994
+ })(base64$1);
995
+ var eventemitter = EventEmitter;
996
+ function EventEmitter() {
997
+ this._listeners = {};
998
+ }
999
+ EventEmitter.prototype.on = function(e, r, s) {
1000
+ return (this._listeners[e] || (this._listeners[e] = [])).push({
1001
+ fn: r,
1002
+ ctx: s || this
1003
+ }), this;
1004
+ };
1005
+ EventEmitter.prototype.off = function(e, r) {
1006
+ if (e === void 0)
1007
+ this._listeners = {};
1008
+ else if (r === void 0)
1009
+ this._listeners[e] = [];
1010
+ else
1011
+ for (var s = this._listeners[e], o = 0; o < s.length; )
1012
+ s[o].fn === r ? s.splice(o, 1) : ++o;
1013
+ return this;
1014
+ };
1015
+ EventEmitter.prototype.emit = function(e) {
1016
+ var r = this._listeners[e];
1017
+ if (r) {
1018
+ for (var s = [], o = 1; o < arguments.length; )
1019
+ s.push(arguments[o++]);
1020
+ for (o = 0; o < r.length; )
1021
+ r[o].fn.apply(r[o++].ctx, s);
1022
+ }
1023
+ return this;
1024
+ };
1025
+ var float = factory(factory);
1026
+ function factory(t) {
1027
+ return typeof Float32Array < "u" ? function() {
1028
+ var e = new Float32Array([-0]), r = new Uint8Array(e.buffer), s = r[3] === 128;
1029
+ function o(f, i, l) {
1030
+ e[0] = f, i[l] = r[0], i[l + 1] = r[1], i[l + 2] = r[2], i[l + 3] = r[3];
1031
+ }
1032
+ function u(f, i, l) {
1033
+ e[0] = f, i[l] = r[3], i[l + 1] = r[2], i[l + 2] = r[1], i[l + 3] = r[0];
1034
+ }
1035
+ t.writeFloatLE = s ? o : u, t.writeFloatBE = s ? u : o;
1036
+ function n(f, i) {
1037
+ return r[0] = f[i], r[1] = f[i + 1], r[2] = f[i + 2], r[3] = f[i + 3], e[0];
1038
+ }
1039
+ function a(f, i) {
1040
+ return r[3] = f[i], r[2] = f[i + 1], r[1] = f[i + 2], r[0] = f[i + 3], e[0];
1041
+ }
1042
+ t.readFloatLE = s ? n : a, t.readFloatBE = s ? a : n;
1043
+ }() : function() {
1044
+ function e(s, o, u, n) {
1045
+ var a = o < 0 ? 1 : 0;
1046
+ if (a && (o = -o), o === 0)
1047
+ s(1 / o > 0 ? (
1048
+ /* positive */
1049
+ 0
1050
+ ) : (
1051
+ /* negative 0 */
1052
+ 2147483648
1053
+ ), u, n);
1054
+ else if (isNaN(o))
1055
+ s(2143289344, u, n);
1056
+ else if (o > 34028234663852886e22)
1057
+ s((a << 31 | 2139095040) >>> 0, u, n);
1058
+ else if (o < 11754943508222875e-54)
1059
+ s((a << 31 | Math.round(o / 1401298464324817e-60)) >>> 0, u, n);
1060
+ else {
1061
+ var f = Math.floor(Math.log(o) / Math.LN2), i = Math.round(o * Math.pow(2, -f) * 8388608) & 8388607;
1062
+ s((a << 31 | f + 127 << 23 | i) >>> 0, u, n);
1063
+ }
1064
+ }
1065
+ t.writeFloatLE = e.bind(null, writeUintLE), t.writeFloatBE = e.bind(null, writeUintBE);
1066
+ function r(s, o, u) {
1067
+ var n = s(o, u), a = (n >> 31) * 2 + 1, f = n >>> 23 & 255, i = n & 8388607;
1068
+ return f === 255 ? i ? NaN : a * (1 / 0) : f === 0 ? a * 1401298464324817e-60 * i : a * Math.pow(2, f - 150) * (i + 8388608);
1069
+ }
1070
+ t.readFloatLE = r.bind(null, readUintLE), t.readFloatBE = r.bind(null, readUintBE);
1071
+ }(), typeof Float64Array < "u" ? function() {
1072
+ var e = new Float64Array([-0]), r = new Uint8Array(e.buffer), s = r[7] === 128;
1073
+ function o(f, i, l) {
1074
+ e[0] = f, i[l] = r[0], i[l + 1] = r[1], i[l + 2] = r[2], i[l + 3] = r[3], i[l + 4] = r[4], i[l + 5] = r[5], i[l + 6] = r[6], i[l + 7] = r[7];
1075
+ }
1076
+ function u(f, i, l) {
1077
+ e[0] = f, i[l] = r[7], i[l + 1] = r[6], i[l + 2] = r[5], i[l + 3] = r[4], i[l + 4] = r[3], i[l + 5] = r[2], i[l + 6] = r[1], i[l + 7] = r[0];
1078
+ }
1079
+ t.writeDoubleLE = s ? o : u, t.writeDoubleBE = s ? u : o;
1080
+ function n(f, i) {
1081
+ return r[0] = f[i], r[1] = f[i + 1], r[2] = f[i + 2], r[3] = f[i + 3], r[4] = f[i + 4], r[5] = f[i + 5], r[6] = f[i + 6], r[7] = f[i + 7], e[0];
1082
+ }
1083
+ function a(f, i) {
1084
+ return r[7] = f[i], r[6] = f[i + 1], r[5] = f[i + 2], r[4] = f[i + 3], r[3] = f[i + 4], r[2] = f[i + 5], r[1] = f[i + 6], r[0] = f[i + 7], e[0];
1085
+ }
1086
+ t.readDoubleLE = s ? n : a, t.readDoubleBE = s ? a : n;
1087
+ }() : function() {
1088
+ function e(s, o, u, n, a, f) {
1089
+ var i = n < 0 ? 1 : 0;
1090
+ if (i && (n = -n), n === 0)
1091
+ s(0, a, f + o), s(1 / n > 0 ? (
1092
+ /* positive */
1093
+ 0
1094
+ ) : (
1095
+ /* negative 0 */
1096
+ 2147483648
1097
+ ), a, f + u);
1098
+ else if (isNaN(n))
1099
+ s(0, a, f + o), s(2146959360, a, f + u);
1100
+ else if (n > 17976931348623157e292)
1101
+ s(0, a, f + o), s((i << 31 | 2146435072) >>> 0, a, f + u);
1102
+ else {
1103
+ var l;
1104
+ if (n < 22250738585072014e-324)
1105
+ l = n / 5e-324, s(l >>> 0, a, f + o), s((i << 31 | l / 4294967296) >>> 0, a, f + u);
1106
+ else {
1107
+ var c = Math.floor(Math.log(n) / Math.LN2);
1108
+ c === 1024 && (c = 1023), l = n * Math.pow(2, -c), s(l * 4503599627370496 >>> 0, a, f + o), s((i << 31 | c + 1023 << 20 | l * 1048576 & 1048575) >>> 0, a, f + u);
1109
+ }
1110
+ }
1111
+ }
1112
+ t.writeDoubleLE = e.bind(null, writeUintLE, 0, 4), t.writeDoubleBE = e.bind(null, writeUintBE, 4, 0);
1113
+ function r(s, o, u, n, a) {
1114
+ var f = s(n, a + o), i = s(n, a + u), l = (i >> 31) * 2 + 1, c = i >>> 20 & 2047, h = 4294967296 * (i & 1048575) + f;
1115
+ return c === 2047 ? h ? NaN : l * (1 / 0) : c === 0 ? l * 5e-324 * h : l * Math.pow(2, c - 1075) * (h + 4503599627370496);
1116
+ }
1117
+ t.readDoubleLE = r.bind(null, readUintLE, 0, 4), t.readDoubleBE = r.bind(null, readUintBE, 4, 0);
1118
+ }(), t;
1119
+ }
1120
+ function writeUintLE(t, e, r) {
1121
+ e[r] = t & 255, e[r + 1] = t >>> 8 & 255, e[r + 2] = t >>> 16 & 255, e[r + 3] = t >>> 24;
1122
+ }
1123
+ function writeUintBE(t, e, r) {
1124
+ e[r] = t >>> 24, e[r + 1] = t >>> 16 & 255, e[r + 2] = t >>> 8 & 255, e[r + 3] = t & 255;
1125
+ }
1126
+ function readUintLE(t, e) {
1127
+ return (t[e] | t[e + 1] << 8 | t[e + 2] << 16 | t[e + 3] << 24) >>> 0;
1128
+ }
1129
+ function readUintBE(t, e) {
1130
+ return (t[e] << 24 | t[e + 1] << 16 | t[e + 2] << 8 | t[e + 3]) >>> 0;
1131
+ }
1132
+ var inquire_1 = inquire$1;
1133
+ function inquire$1(moduleName) {
1134
+ try {
1135
+ var mod = eval("quire".replace(/^/, "re"))(moduleName);
1136
+ if (mod && (mod.length || Object.keys(mod).length))
1137
+ return mod;
1138
+ } catch (t) {
1139
+ }
1140
+ return null;
1141
+ }
1142
+ var utf8$2 = {};
1143
+ (function(t) {
1144
+ var e = t;
1145
+ e.length = function(s) {
1146
+ for (var o = 0, u = 0, n = 0; n < s.length; ++n)
1147
+ u = s.charCodeAt(n), u < 128 ? o += 1 : u < 2048 ? o += 2 : (u & 64512) === 55296 && (s.charCodeAt(n + 1) & 64512) === 56320 ? (++n, o += 4) : o += 3;
1148
+ return o;
1149
+ }, e.read = function(s, o, u) {
1150
+ var n = u - o;
1151
+ if (n < 1)
1152
+ return "";
1153
+ for (var a = null, f = [], i = 0, l; o < u; )
1154
+ l = s[o++], l < 128 ? f[i++] = l : l > 191 && l < 224 ? f[i++] = (l & 31) << 6 | s[o++] & 63 : l > 239 && l < 365 ? (l = ((l & 7) << 18 | (s[o++] & 63) << 12 | (s[o++] & 63) << 6 | s[o++] & 63) - 65536, f[i++] = 55296 + (l >> 10), f[i++] = 56320 + (l & 1023)) : f[i++] = (l & 15) << 12 | (s[o++] & 63) << 6 | s[o++] & 63, i > 8191 && ((a || (a = [])).push(String.fromCharCode.apply(String, f)), i = 0);
1155
+ return a ? (i && a.push(String.fromCharCode.apply(String, f.slice(0, i))), a.join("")) : String.fromCharCode.apply(String, f.slice(0, i));
1156
+ }, e.write = function(s, o, u) {
1157
+ for (var n = u, a, f, i = 0; i < s.length; ++i)
1158
+ a = s.charCodeAt(i), a < 128 ? o[u++] = a : a < 2048 ? (o[u++] = a >> 6 | 192, o[u++] = a & 63 | 128) : (a & 64512) === 55296 && ((f = s.charCodeAt(i + 1)) & 64512) === 56320 ? (a = 65536 + ((a & 1023) << 10) + (f & 1023), ++i, o[u++] = a >> 18 | 240, o[u++] = a >> 12 & 63 | 128, o[u++] = a >> 6 & 63 | 128, o[u++] = a & 63 | 128) : (o[u++] = a >> 12 | 224, o[u++] = a >> 6 & 63 | 128, o[u++] = a & 63 | 128);
1159
+ return u - n;
1160
+ };
1161
+ })(utf8$2);
1162
+ var pool_1 = pool;
1163
+ function pool(t, e, r) {
1164
+ var s = r || 8192, o = s >>> 1, u = null, n = s;
1165
+ return function(f) {
1166
+ if (f < 1 || f > o)
1167
+ return t(f);
1168
+ n + f > s && (u = t(s), n = 0);
1169
+ var i = e.call(u, n, n += f);
1170
+ return n & 7 && (n = (n | 7) + 1), i;
1171
+ };
1172
+ }
1173
+ var longbits, hasRequiredLongbits;
1174
+ function requireLongbits() {
1175
+ if (hasRequiredLongbits) return longbits;
1176
+ hasRequiredLongbits = 1, longbits = e;
1177
+ var t = requireMinimal();
1178
+ function e(u, n) {
1179
+ this.lo = u >>> 0, this.hi = n >>> 0;
1180
+ }
1181
+ var r = e.zero = new e(0, 0);
1182
+ r.toNumber = function() {
1183
+ return 0;
1184
+ }, r.zzEncode = r.zzDecode = function() {
1185
+ return this;
1186
+ }, r.length = function() {
1187
+ return 1;
1188
+ };
1189
+ var s = e.zeroHash = "\0\0\0\0\0\0\0\0";
1190
+ e.fromNumber = function(n) {
1191
+ if (n === 0)
1192
+ return r;
1193
+ var a = n < 0;
1194
+ a && (n = -n);
1195
+ var f = n >>> 0, i = (n - f) / 4294967296 >>> 0;
1196
+ return a && (i = ~i >>> 0, f = ~f >>> 0, ++f > 4294967295 && (f = 0, ++i > 4294967295 && (i = 0))), new e(f, i);
1197
+ }, e.from = function(n) {
1198
+ if (typeof n == "number")
1199
+ return e.fromNumber(n);
1200
+ if (t.isString(n))
1201
+ if (t.Long)
1202
+ n = t.Long.fromString(n);
1203
+ else
1204
+ return e.fromNumber(parseInt(n, 10));
1205
+ return n.low || n.high ? new e(n.low >>> 0, n.high >>> 0) : r;
1206
+ }, e.prototype.toNumber = function(n) {
1207
+ if (!n && this.hi >>> 31) {
1208
+ var a = ~this.lo + 1 >>> 0, f = ~this.hi >>> 0;
1209
+ return a || (f = f + 1 >>> 0), -(a + f * 4294967296);
1210
+ }
1211
+ return this.lo + this.hi * 4294967296;
1212
+ }, e.prototype.toLong = function(n) {
1213
+ return t.Long ? new t.Long(this.lo | 0, this.hi | 0, !!n) : { low: this.lo | 0, high: this.hi | 0, unsigned: !!n };
1214
+ };
1215
+ var o = String.prototype.charCodeAt;
1216
+ return e.fromHash = function(n) {
1217
+ return n === s ? r : new e(
1218
+ (o.call(n, 0) | o.call(n, 1) << 8 | o.call(n, 2) << 16 | o.call(n, 3) << 24) >>> 0,
1219
+ (o.call(n, 4) | o.call(n, 5) << 8 | o.call(n, 6) << 16 | o.call(n, 7) << 24) >>> 0
1220
+ );
1221
+ }, e.prototype.toHash = function() {
1222
+ return String.fromCharCode(
1223
+ this.lo & 255,
1224
+ this.lo >>> 8 & 255,
1225
+ this.lo >>> 16 & 255,
1226
+ this.lo >>> 24,
1227
+ this.hi & 255,
1228
+ this.hi >>> 8 & 255,
1229
+ this.hi >>> 16 & 255,
1230
+ this.hi >>> 24
1231
+ );
1232
+ }, e.prototype.zzEncode = function() {
1233
+ var n = this.hi >> 31;
1234
+ return this.hi = ((this.hi << 1 | this.lo >>> 31) ^ n) >>> 0, this.lo = (this.lo << 1 ^ n) >>> 0, this;
1235
+ }, e.prototype.zzDecode = function() {
1236
+ var n = -(this.lo & 1);
1237
+ return this.lo = ((this.lo >>> 1 | this.hi << 31) ^ n) >>> 0, this.hi = (this.hi >>> 1 ^ n) >>> 0, this;
1238
+ }, e.prototype.length = function() {
1239
+ var n = this.lo, a = (this.lo >>> 28 | this.hi << 4) >>> 0, f = this.hi >>> 24;
1240
+ return f === 0 ? a === 0 ? n < 16384 ? n < 128 ? 1 : 2 : n < 2097152 ? 3 : 4 : a < 16384 ? a < 128 ? 5 : 6 : a < 2097152 ? 7 : 8 : f < 128 ? 9 : 10;
1241
+ }, longbits;
1242
+ }
1243
+ var hasRequiredMinimal;
1244
+ function requireMinimal() {
1245
+ return hasRequiredMinimal || (hasRequiredMinimal = 1, function(t) {
1246
+ var e = t;
1247
+ e.asPromise = aspromise, e.base64 = base64$1, e.EventEmitter = eventemitter, e.float = float, e.inquire = inquire_1, e.utf8 = utf8$2, e.pool = pool_1, e.LongBits = requireLongbits(), e.isNode = !!(typeof commonjsGlobal < "u" && commonjsGlobal && commonjsGlobal.process && commonjsGlobal.process.versions && commonjsGlobal.process.versions.node), e.global = e.isNode && commonjsGlobal || typeof window < "u" && window || typeof self < "u" && self || commonjsGlobal, e.emptyArray = Object.freeze ? Object.freeze([]) : (
1248
+ /* istanbul ignore next */
1249
+ []
1250
+ ), e.emptyObject = Object.freeze ? Object.freeze({}) : (
1251
+ /* istanbul ignore next */
1252
+ {}
1253
+ ), e.isInteger = Number.isInteger || /* istanbul ignore next */
1254
+ function(u) {
1255
+ return typeof u == "number" && isFinite(u) && Math.floor(u) === u;
1256
+ }, e.isString = function(u) {
1257
+ return typeof u == "string" || u instanceof String;
1258
+ }, e.isObject = function(u) {
1259
+ return u && typeof u == "object";
1260
+ }, e.isset = /**
1261
+ * Checks if a property on a message is considered to be present.
1262
+ * @param {Object} obj Plain object or message instance
1263
+ * @param {string} prop Property name
1264
+ * @returns {boolean} `true` if considered to be present, otherwise `false`
1265
+ */
1266
+ e.isSet = function(u, n) {
1267
+ var a = u[n];
1268
+ return a != null && u.hasOwnProperty(n) ? typeof a != "object" || (Array.isArray(a) ? a.length : Object.keys(a).length) > 0 : !1;
1269
+ }, e.Buffer = function() {
1270
+ try {
1271
+ var o = e.inquire("buffer").Buffer;
1272
+ return o.prototype.utf8Write ? o : (
1273
+ /* istanbul ignore next */
1274
+ null
1275
+ );
1276
+ } catch {
1277
+ return null;
1278
+ }
1279
+ }(), e._Buffer_from = null, e._Buffer_allocUnsafe = null, e.newBuffer = function(u) {
1280
+ return typeof u == "number" ? e.Buffer ? e._Buffer_allocUnsafe(u) : new e.Array(u) : e.Buffer ? e._Buffer_from(u) : typeof Uint8Array > "u" ? u : new Uint8Array(u);
1281
+ }, e.Array = typeof Uint8Array < "u" ? Uint8Array : Array, e.Long = /* istanbul ignore next */
1282
+ e.global.dcodeIO && /* istanbul ignore next */
1283
+ e.global.dcodeIO.Long || /* istanbul ignore next */
1284
+ e.global.Long || e.inquire("long"), e.key2Re = /^true|false|0|1$/, e.key32Re = /^-?(?:0|[1-9][0-9]*)$/, e.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/, e.longToHash = function(u) {
1285
+ return u ? e.LongBits.from(u).toHash() : e.LongBits.zeroHash;
1286
+ }, e.longFromHash = function(u, n) {
1287
+ var a = e.LongBits.fromHash(u);
1288
+ return e.Long ? e.Long.fromBits(a.lo, a.hi, n) : a.toNumber(!!n);
1289
+ };
1290
+ function r(o, u, n) {
1291
+ for (var a = Object.keys(u), f = 0; f < a.length; ++f)
1292
+ (o[a[f]] === void 0 || !n) && (o[a[f]] = u[a[f]]);
1293
+ return o;
1294
+ }
1295
+ e.merge = r, e.lcFirst = function(u) {
1296
+ return u.charAt(0).toLowerCase() + u.substring(1);
1297
+ };
1298
+ function s(o) {
1299
+ function u(n, a) {
1300
+ if (!(this instanceof u))
1301
+ return new u(n, a);
1302
+ Object.defineProperty(this, "message", { get: function() {
1303
+ return n;
1304
+ } }), Error.captureStackTrace ? Error.captureStackTrace(this, u) : Object.defineProperty(this, "stack", { value: new Error().stack || "" }), a && r(this, a);
1305
+ }
1306
+ return u.prototype = Object.create(Error.prototype, {
1307
+ constructor: {
1308
+ value: u,
1309
+ writable: !0,
1310
+ enumerable: !1,
1311
+ configurable: !0
1312
+ },
1313
+ name: {
1314
+ get: function() {
1315
+ return o;
1316
+ },
1317
+ set: void 0,
1318
+ enumerable: !1,
1319
+ // configurable: false would accurately preserve the behavior of
1320
+ // the original, but I'm guessing that was not intentional.
1321
+ // For an actual error subclass, this property would
1322
+ // be configurable.
1323
+ configurable: !0
1324
+ },
1325
+ toString: {
1326
+ value: function() {
1327
+ return this.name + ": " + this.message;
1328
+ },
1329
+ writable: !0,
1330
+ enumerable: !1,
1331
+ configurable: !0
1332
+ }
1333
+ }), u;
1334
+ }
1335
+ e.newError = s, e.ProtocolError = s("ProtocolError"), e.oneOfGetter = function(u) {
1336
+ for (var n = {}, a = 0; a < u.length; ++a)
1337
+ n[u[a]] = 1;
1338
+ return function() {
1339
+ for (var f = Object.keys(this), i = f.length - 1; i > -1; --i)
1340
+ if (n[f[i]] === 1 && this[f[i]] !== void 0 && this[f[i]] !== null)
1341
+ return f[i];
1342
+ };
1343
+ }, e.oneOfSetter = function(u) {
1344
+ return function(n) {
1345
+ for (var a = 0; a < u.length; ++a)
1346
+ u[a] !== n && delete this[u[a]];
1347
+ };
1348
+ }, e.toJSONOptions = {
1349
+ longs: String,
1350
+ enums: String,
1351
+ bytes: String,
1352
+ json: !0
1353
+ }, e._configure = function() {
1354
+ var o = e.Buffer;
1355
+ if (!o) {
1356
+ e._Buffer_from = e._Buffer_allocUnsafe = null;
1357
+ return;
1358
+ }
1359
+ e._Buffer_from = o.from !== Uint8Array.from && o.from || /* istanbul ignore next */
1360
+ function(n, a) {
1361
+ return new o(n, a);
1362
+ }, e._Buffer_allocUnsafe = o.allocUnsafe || /* istanbul ignore next */
1363
+ function(n) {
1364
+ return new o(n);
1365
+ };
1366
+ };
1367
+ }(minimal)), minimal;
1368
+ }
1369
+ var writer = Writer$1, util$6 = requireMinimal(), BufferWriter$1, LongBits$1 = util$6.LongBits, base64 = util$6.base64, utf8$1 = util$6.utf8;
1370
+ function Op(t, e, r) {
1371
+ this.fn = t, this.len = e, this.next = void 0, this.val = r;
1372
+ }
1373
+ function noop() {
1374
+ }
1375
+ function State(t) {
1376
+ this.head = t.head, this.tail = t.tail, this.len = t.len, this.next = t.states;
1377
+ }
1378
+ function Writer$1() {
1379
+ this.len = 0, this.head = new Op(noop, 0, 0), this.tail = this.head, this.states = null;
1380
+ }
1381
+ var create$1 = function t() {
1382
+ return util$6.Buffer ? function() {
1383
+ return (Writer$1.create = function() {
1384
+ return new BufferWriter$1();
1385
+ })();
1386
+ } : function() {
1387
+ return new Writer$1();
1388
+ };
1389
+ };
1390
+ Writer$1.create = create$1();
1391
+ Writer$1.alloc = function t(e) {
1392
+ return new util$6.Array(e);
1393
+ };
1394
+ util$6.Array !== Array && (Writer$1.alloc = util$6.pool(Writer$1.alloc, util$6.Array.prototype.subarray));
1395
+ Writer$1.prototype._push = function t(e, r, s) {
1396
+ return this.tail = this.tail.next = new Op(e, r, s), this.len += r, this;
1397
+ };
1398
+ function writeByte(t, e, r) {
1399
+ e[r] = t & 255;
1400
+ }
1401
+ function writeVarint32(t, e, r) {
1402
+ for (; t > 127; )
1403
+ e[r++] = t & 127 | 128, t >>>= 7;
1404
+ e[r] = t;
1405
+ }
1406
+ function VarintOp(t, e) {
1407
+ this.len = t, this.next = void 0, this.val = e;
1408
+ }
1409
+ VarintOp.prototype = Object.create(Op.prototype);
1410
+ VarintOp.prototype.fn = writeVarint32;
1411
+ Writer$1.prototype.uint32 = function t(e) {
1412
+ return this.len += (this.tail = this.tail.next = new VarintOp(
1413
+ (e = e >>> 0) < 128 ? 1 : e < 16384 ? 2 : e < 2097152 ? 3 : e < 268435456 ? 4 : 5,
1414
+ e
1415
+ )).len, this;
1416
+ };
1417
+ Writer$1.prototype.int32 = function t(e) {
1418
+ return e < 0 ? this._push(writeVarint64, 10, LongBits$1.fromNumber(e)) : this.uint32(e);
1419
+ };
1420
+ Writer$1.prototype.sint32 = function t(e) {
1421
+ return this.uint32((e << 1 ^ e >> 31) >>> 0);
1422
+ };
1423
+ function writeVarint64(t, e, r) {
1424
+ for (; t.hi; )
1425
+ e[r++] = t.lo & 127 | 128, t.lo = (t.lo >>> 7 | t.hi << 25) >>> 0, t.hi >>>= 7;
1426
+ for (; t.lo > 127; )
1427
+ e[r++] = t.lo & 127 | 128, t.lo = t.lo >>> 7;
1428
+ e[r++] = t.lo;
1429
+ }
1430
+ Writer$1.prototype.uint64 = function t(e) {
1431
+ var r = LongBits$1.from(e);
1432
+ return this._push(writeVarint64, r.length(), r);
1433
+ };
1434
+ Writer$1.prototype.int64 = Writer$1.prototype.uint64;
1435
+ Writer$1.prototype.sint64 = function t(e) {
1436
+ var r = LongBits$1.from(e).zzEncode();
1437
+ return this._push(writeVarint64, r.length(), r);
1438
+ };
1439
+ Writer$1.prototype.bool = function t(e) {
1440
+ return this._push(writeByte, 1, e ? 1 : 0);
1441
+ };
1442
+ function writeFixed32(t, e, r) {
1443
+ e[r] = t & 255, e[r + 1] = t >>> 8 & 255, e[r + 2] = t >>> 16 & 255, e[r + 3] = t >>> 24;
1444
+ }
1445
+ Writer$1.prototype.fixed32 = function t(e) {
1446
+ return this._push(writeFixed32, 4, e >>> 0);
1447
+ };
1448
+ Writer$1.prototype.sfixed32 = Writer$1.prototype.fixed32;
1449
+ Writer$1.prototype.fixed64 = function t(e) {
1450
+ var r = LongBits$1.from(e);
1451
+ return this._push(writeFixed32, 4, r.lo)._push(writeFixed32, 4, r.hi);
1452
+ };
1453
+ Writer$1.prototype.sfixed64 = Writer$1.prototype.fixed64;
1454
+ Writer$1.prototype.float = function t(e) {
1455
+ return this._push(util$6.float.writeFloatLE, 4, e);
1456
+ };
1457
+ Writer$1.prototype.double = function t(e) {
1458
+ return this._push(util$6.float.writeDoubleLE, 8, e);
1459
+ };
1460
+ var writeBytes = util$6.Array.prototype.set ? function t(e, r, s) {
1461
+ r.set(e, s);
1462
+ } : function t(e, r, s) {
1463
+ for (var o = 0; o < e.length; ++o)
1464
+ r[s + o] = e[o];
1465
+ };
1466
+ Writer$1.prototype.bytes = function t(e) {
1467
+ var r = e.length >>> 0;
1468
+ if (!r)
1469
+ return this._push(writeByte, 1, 0);
1470
+ if (util$6.isString(e)) {
1471
+ var s = Writer$1.alloc(r = base64.length(e));
1472
+ base64.decode(e, s, 0), e = s;
1473
+ }
1474
+ return this.uint32(r)._push(writeBytes, r, e);
1475
+ };
1476
+ Writer$1.prototype.string = function t(e) {
1477
+ var r = utf8$1.length(e);
1478
+ return r ? this.uint32(r)._push(utf8$1.write, r, e) : this._push(writeByte, 1, 0);
1479
+ };
1480
+ Writer$1.prototype.fork = function t() {
1481
+ return this.states = new State(this), this.head = this.tail = new Op(noop, 0, 0), this.len = 0, this;
1482
+ };
1483
+ Writer$1.prototype.reset = function t() {
1484
+ return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new Op(noop, 0, 0), this.len = 0), this;
1485
+ };
1486
+ Writer$1.prototype.ldelim = function t() {
1487
+ var e = this.head, r = this.tail, s = this.len;
1488
+ return this.reset().uint32(s), s && (this.tail.next = e.next, this.tail = r, this.len += s), this;
1489
+ };
1490
+ Writer$1.prototype.finish = function t() {
1491
+ for (var e = this.head.next, r = this.constructor.alloc(this.len), s = 0; e; )
1492
+ e.fn(e.val, r, s), s += e.len, e = e.next;
1493
+ return r;
1494
+ };
1495
+ Writer$1._configure = function(t) {
1496
+ BufferWriter$1 = t, Writer$1.create = create$1(), BufferWriter$1._configure();
1497
+ };
1498
+ var writer_buffer = BufferWriter, Writer = writer;
1499
+ (BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter;
1500
+ var util$5 = requireMinimal();
1501
+ function BufferWriter() {
1502
+ Writer.call(this);
1503
+ }
1504
+ BufferWriter._configure = function() {
1505
+ BufferWriter.alloc = util$5._Buffer_allocUnsafe, BufferWriter.writeBytesBuffer = util$5.Buffer && util$5.Buffer.prototype instanceof Uint8Array && util$5.Buffer.prototype.set.name === "set" ? function(e, r, s) {
1506
+ r.set(e, s);
1507
+ } : function(e, r, s) {
1508
+ if (e.copy)
1509
+ e.copy(r, s, 0, e.length);
1510
+ else for (var o = 0; o < e.length; )
1511
+ r[s++] = e[o++];
1512
+ };
1513
+ };
1514
+ BufferWriter.prototype.bytes = function t(e) {
1515
+ util$5.isString(e) && (e = util$5._Buffer_from(e, "base64"));
1516
+ var r = e.length >>> 0;
1517
+ return this.uint32(r), r && this._push(BufferWriter.writeBytesBuffer, r, e), this;
1518
+ };
1519
+ function writeStringBuffer(t, e, r) {
1520
+ t.length < 40 ? util$5.utf8.write(t, e, r) : e.utf8Write ? e.utf8Write(t, r) : e.write(t, r);
1521
+ }
1522
+ BufferWriter.prototype.string = function t(e) {
1523
+ var r = util$5.Buffer.byteLength(e);
1524
+ return this.uint32(r), r && this._push(writeStringBuffer, r, e), this;
1525
+ };
1526
+ BufferWriter._configure();
1527
+ var reader = Reader$1, util$4 = requireMinimal(), BufferReader$1, LongBits = util$4.LongBits, utf8 = util$4.utf8;
1528
+ function indexOutOfRange(t, e) {
1529
+ return RangeError("index out of range: " + t.pos + " + " + (e || 1) + " > " + t.len);
1530
+ }
1531
+ function Reader$1(t) {
1532
+ this.buf = t, this.pos = 0, this.len = t.length;
1533
+ }
1534
+ var create_array = typeof Uint8Array < "u" ? function t(e) {
1535
+ if (e instanceof Uint8Array || Array.isArray(e))
1536
+ return new Reader$1(e);
1537
+ throw Error("illegal buffer");
1538
+ } : function t(e) {
1539
+ if (Array.isArray(e))
1540
+ return new Reader$1(e);
1541
+ throw Error("illegal buffer");
1542
+ }, create = function t() {
1543
+ return util$4.Buffer ? function(r) {
1544
+ return (Reader$1.create = function(o) {
1545
+ return util$4.Buffer.isBuffer(o) ? new BufferReader$1(o) : create_array(o);
1546
+ })(r);
1547
+ } : create_array;
1548
+ };
1549
+ Reader$1.create = create();
1550
+ Reader$1.prototype._slice = util$4.Array.prototype.subarray || /* istanbul ignore next */
1551
+ util$4.Array.prototype.slice;
1552
+ Reader$1.prototype.uint32 = /* @__PURE__ */ function t() {
1553
+ var e = 4294967295;
1554
+ return function() {
1555
+ if (e = (this.buf[this.pos] & 127) >>> 0, this.buf[this.pos++] < 128 || (e = (e | (this.buf[this.pos] & 127) << 7) >>> 0, this.buf[this.pos++] < 128) || (e = (e | (this.buf[this.pos] & 127) << 14) >>> 0, this.buf[this.pos++] < 128) || (e = (e | (this.buf[this.pos] & 127) << 21) >>> 0, this.buf[this.pos++] < 128) || (e = (e | (this.buf[this.pos] & 15) << 28) >>> 0, this.buf[this.pos++] < 128)) return e;
1556
+ if ((this.pos += 5) > this.len)
1557
+ throw this.pos = this.len, indexOutOfRange(this, 10);
1558
+ return e;
1559
+ };
1560
+ }();
1561
+ Reader$1.prototype.int32 = function t() {
1562
+ return this.uint32() | 0;
1563
+ };
1564
+ Reader$1.prototype.sint32 = function t() {
1565
+ var e = this.uint32();
1566
+ return e >>> 1 ^ -(e & 1) | 0;
1567
+ };
1568
+ function readLongVarint() {
1569
+ var t = new LongBits(0, 0), e = 0;
1570
+ if (this.len - this.pos > 4) {
1571
+ for (; e < 4; ++e)
1572
+ if (t.lo = (t.lo | (this.buf[this.pos] & 127) << e * 7) >>> 0, this.buf[this.pos++] < 128)
1573
+ return t;
1574
+ if (t.lo = (t.lo | (this.buf[this.pos] & 127) << 28) >>> 0, t.hi = (t.hi | (this.buf[this.pos] & 127) >> 4) >>> 0, this.buf[this.pos++] < 128)
1575
+ return t;
1576
+ e = 0;
1577
+ } else {
1578
+ for (; e < 3; ++e) {
1579
+ if (this.pos >= this.len)
1580
+ throw indexOutOfRange(this);
1581
+ if (t.lo = (t.lo | (this.buf[this.pos] & 127) << e * 7) >>> 0, this.buf[this.pos++] < 128)
1582
+ return t;
1583
+ }
1584
+ return t.lo = (t.lo | (this.buf[this.pos++] & 127) << e * 7) >>> 0, t;
1585
+ }
1586
+ if (this.len - this.pos > 4) {
1587
+ for (; e < 5; ++e)
1588
+ if (t.hi = (t.hi | (this.buf[this.pos] & 127) << e * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
1589
+ return t;
1590
+ } else
1591
+ for (; e < 5; ++e) {
1592
+ if (this.pos >= this.len)
1593
+ throw indexOutOfRange(this);
1594
+ if (t.hi = (t.hi | (this.buf[this.pos] & 127) << e * 7 + 3) >>> 0, this.buf[this.pos++] < 128)
1595
+ return t;
1596
+ }
1597
+ throw Error("invalid varint encoding");
1598
+ }
1599
+ Reader$1.prototype.bool = function t() {
1600
+ return this.uint32() !== 0;
1601
+ };
1602
+ function readFixed32_end(t, e) {
1603
+ return (t[e - 4] | t[e - 3] << 8 | t[e - 2] << 16 | t[e - 1] << 24) >>> 0;
1604
+ }
1605
+ Reader$1.prototype.fixed32 = function t() {
1606
+ if (this.pos + 4 > this.len)
1607
+ throw indexOutOfRange(this, 4);
1608
+ return readFixed32_end(this.buf, this.pos += 4);
1609
+ };
1610
+ Reader$1.prototype.sfixed32 = function t() {
1611
+ if (this.pos + 4 > this.len)
1612
+ throw indexOutOfRange(this, 4);
1613
+ return readFixed32_end(this.buf, this.pos += 4) | 0;
1614
+ };
1615
+ function readFixed64() {
1616
+ if (this.pos + 8 > this.len)
1617
+ throw indexOutOfRange(this, 8);
1618
+ return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
1619
+ }
1620
+ Reader$1.prototype.float = function t() {
1621
+ if (this.pos + 4 > this.len)
1622
+ throw indexOutOfRange(this, 4);
1623
+ var e = util$4.float.readFloatLE(this.buf, this.pos);
1624
+ return this.pos += 4, e;
1625
+ };
1626
+ Reader$1.prototype.double = function t() {
1627
+ if (this.pos + 8 > this.len)
1628
+ throw indexOutOfRange(this, 4);
1629
+ var e = util$4.float.readDoubleLE(this.buf, this.pos);
1630
+ return this.pos += 8, e;
1631
+ };
1632
+ Reader$1.prototype.bytes = function t() {
1633
+ var e = this.uint32(), r = this.pos, s = this.pos + e;
1634
+ if (s > this.len)
1635
+ throw indexOutOfRange(this, e);
1636
+ if (this.pos += e, Array.isArray(this.buf))
1637
+ return this.buf.slice(r, s);
1638
+ if (r === s) {
1639
+ var o = util$4.Buffer;
1640
+ return o ? o.alloc(0) : new this.buf.constructor(0);
1641
+ }
1642
+ return this._slice.call(this.buf, r, s);
1643
+ };
1644
+ Reader$1.prototype.string = function t() {
1645
+ var e = this.bytes();
1646
+ return utf8.read(e, 0, e.length);
1647
+ };
1648
+ Reader$1.prototype.skip = function t(e) {
1649
+ if (typeof e == "number") {
1650
+ if (this.pos + e > this.len)
1651
+ throw indexOutOfRange(this, e);
1652
+ this.pos += e;
1653
+ } else
1654
+ do
1655
+ if (this.pos >= this.len)
1656
+ throw indexOutOfRange(this);
1657
+ while (this.buf[this.pos++] & 128);
1658
+ return this;
1659
+ };
1660
+ Reader$1.prototype.skipType = function(t) {
1661
+ switch (t) {
1662
+ case 0:
1663
+ this.skip();
1664
+ break;
1665
+ case 1:
1666
+ this.skip(8);
1667
+ break;
1668
+ case 2:
1669
+ this.skip(this.uint32());
1670
+ break;
1671
+ case 3:
1672
+ for (; (t = this.uint32() & 7) !== 4; )
1673
+ this.skipType(t);
1674
+ break;
1675
+ case 5:
1676
+ this.skip(4);
1677
+ break;
1678
+ default:
1679
+ throw Error("invalid wire type " + t + " at offset " + this.pos);
1680
+ }
1681
+ return this;
1682
+ };
1683
+ Reader$1._configure = function(t) {
1684
+ BufferReader$1 = t, Reader$1.create = create(), BufferReader$1._configure();
1685
+ var e = util$4.Long ? "toLong" : (
1686
+ /* istanbul ignore next */
1687
+ "toNumber"
1688
+ );
1689
+ util$4.merge(Reader$1.prototype, {
1690
+ int64: function() {
1691
+ return readLongVarint.call(this)[e](!1);
1692
+ },
1693
+ uint64: function() {
1694
+ return readLongVarint.call(this)[e](!0);
1695
+ },
1696
+ sint64: function() {
1697
+ return readLongVarint.call(this).zzDecode()[e](!1);
1698
+ },
1699
+ fixed64: function() {
1700
+ return readFixed64.call(this)[e](!0);
1701
+ },
1702
+ sfixed64: function() {
1703
+ return readFixed64.call(this)[e](!1);
1704
+ }
1705
+ });
1706
+ };
1707
+ var reader_buffer = BufferReader, Reader = reader;
1708
+ (BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader;
1709
+ var util$3 = requireMinimal();
1710
+ function BufferReader(t) {
1711
+ Reader.call(this, t);
1712
+ }
1713
+ BufferReader._configure = function() {
1714
+ util$3.Buffer && (BufferReader.prototype._slice = util$3.Buffer.prototype.slice);
1715
+ };
1716
+ BufferReader.prototype.string = function t() {
1717
+ var e = this.uint32();
1718
+ return this.buf.utf8Slice ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + e, this.len)) : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + e, this.len));
1719
+ };
1720
+ BufferReader._configure();
1721
+ var rpc = {}, service$1 = Service, util$2 = requireMinimal();
1722
+ (Service.prototype = Object.create(util$2.EventEmitter.prototype)).constructor = Service;
1723
+ function Service(t, e, r) {
1724
+ if (typeof t != "function")
1725
+ throw TypeError("rpcImpl must be a function");
1726
+ util$2.EventEmitter.call(this), this.rpcImpl = t, this.requestDelimited = !!e, this.responseDelimited = !!r;
1727
+ }
1728
+ Service.prototype.rpcCall = function t(e, r, s, o, u) {
1729
+ if (!o)
1730
+ throw TypeError("request must be specified");
1731
+ var n = this;
1732
+ if (!u)
1733
+ return util$2.asPromise(t, n, e, r, s, o);
1734
+ if (!n.rpcImpl) {
1735
+ setTimeout(function() {
1736
+ u(Error("already ended"));
1737
+ }, 0);
1738
+ return;
1739
+ }
1740
+ try {
1741
+ return n.rpcImpl(
1742
+ e,
1743
+ r[n.requestDelimited ? "encodeDelimited" : "encode"](o).finish(),
1744
+ function(f, i) {
1745
+ if (f)
1746
+ return n.emit("error", f, e), u(f);
1747
+ if (i === null) {
1748
+ n.end(
1749
+ /* endedByRPC */
1750
+ !0
1751
+ );
1752
+ return;
1753
+ }
1754
+ if (!(i instanceof s))
1755
+ try {
1756
+ i = s[n.responseDelimited ? "decodeDelimited" : "decode"](i);
1757
+ } catch (l) {
1758
+ return n.emit("error", l, e), u(l);
1759
+ }
1760
+ return n.emit("data", i, e), u(null, i);
1761
+ }
1762
+ );
1763
+ } catch (a) {
1764
+ n.emit("error", a, e), setTimeout(function() {
1765
+ u(a);
1766
+ }, 0);
1767
+ return;
1768
+ }
1769
+ };
1770
+ Service.prototype.end = function t(e) {
1771
+ return this.rpcImpl && (e || this.rpcImpl(null, null, null), this.rpcImpl = null, this.emit("end").off()), this;
1772
+ };
1773
+ (function(t) {
1774
+ var e = t;
1775
+ e.Service = service$1;
1776
+ })(rpc);
1777
+ var roots = {};
1778
+ (function(t) {
1779
+ var e = t;
1780
+ e.build = "minimal", e.Writer = writer, e.BufferWriter = writer_buffer, e.Reader = reader, e.BufferReader = reader_buffer, e.util = requireMinimal(), e.rpc = rpc, e.roots = roots, e.configure = r;
1781
+ function r() {
1782
+ e.util._configure(), e.Writer._configure(e.BufferWriter), e.Reader._configure(e.BufferReader);
1783
+ }
1784
+ r();
1785
+ })(indexMinimal);
1786
+ var util$1 = { exports: {} }, codegen_1 = codegen;
1787
+ function codegen(t, e) {
1788
+ typeof t == "string" && (e = t, t = void 0);
1789
+ var r = [];
1790
+ function s(u) {
1791
+ if (typeof u != "string") {
1792
+ var n = o();
1793
+ if (codegen.verbose && console.log("codegen: " + n), n = "return " + n, u) {
1794
+ for (var a = Object.keys(u), f = new Array(a.length + 1), i = new Array(a.length), l = 0; l < a.length; )
1795
+ f[l] = a[l], i[l] = u[a[l++]];
1796
+ return f[l] = n, Function.apply(null, f).apply(null, i);
1797
+ }
1798
+ return Function(n)();
1799
+ }
1800
+ for (var c = new Array(arguments.length - 1), h = 0; h < c.length; )
1801
+ c[h] = arguments[++h];
1802
+ if (h = 0, u = u.replace(/%([%dfijs])/g, function(p, v) {
1803
+ var g = c[h++];
1804
+ switch (v) {
1805
+ case "d":
1806
+ case "f":
1807
+ return String(Number(g));
1808
+ case "i":
1809
+ return String(Math.floor(g));
1810
+ case "j":
1811
+ return JSON.stringify(g);
1812
+ case "s":
1813
+ return String(g);
1814
+ }
1815
+ return "%";
1816
+ }), h !== c.length)
1817
+ throw Error("parameter count mismatch");
1818
+ return r.push(u), s;
1819
+ }
1820
+ function o(u) {
1821
+ return "function " + (u || e || "") + "(" + (t && t.join(",") || "") + `){
1822
+ ` + r.join(`
1823
+ `) + `
1824
+ }`;
1825
+ }
1826
+ return s.toString = o, s;
1827
+ }
1828
+ codegen.verbose = !1;
1829
+ var fetch_1 = fetch, asPromise = aspromise, inquire = inquire_1, fs = inquire("fs");
1830
+ function fetch(t, e, r) {
1831
+ return typeof e == "function" ? (r = e, e = {}) : e || (e = {}), r ? !e.xhr && fs && fs.readFile ? fs.readFile(t, function(o, u) {
1832
+ return o && typeof XMLHttpRequest < "u" ? fetch.xhr(t, e, r) : o ? r(o) : r(null, e.binary ? u : u.toString("utf8"));
1833
+ }) : fetch.xhr(t, e, r) : asPromise(fetch, this, t, e);
1834
+ }
1835
+ fetch.xhr = function t(e, r, s) {
1836
+ var o = new XMLHttpRequest();
1837
+ o.onreadystatechange = function() {
1838
+ if (o.readyState === 4) {
1839
+ if (o.status !== 0 && o.status !== 200)
1840
+ return s(Error("status " + o.status));
1841
+ if (r.binary) {
1842
+ var n = o.response;
1843
+ if (!n) {
1844
+ n = [];
1845
+ for (var a = 0; a < o.responseText.length; ++a)
1846
+ n.push(o.responseText.charCodeAt(a) & 255);
1847
+ }
1848
+ return s(null, typeof Uint8Array < "u" ? new Uint8Array(n) : n);
1849
+ }
1850
+ return s(null, o.responseText);
1851
+ }
1852
+ }, r.binary && ("overrideMimeType" in o && o.overrideMimeType("text/plain; charset=x-user-defined"), o.responseType = "arraybuffer"), o.open("GET", e), o.send();
1853
+ };
1854
+ var path = {};
1855
+ (function(t) {
1856
+ var e = t, r = (
1857
+ /**
1858
+ * Tests if the specified path is absolute.
1859
+ * @param {string} path Path to test
1860
+ * @returns {boolean} `true` if path is absolute
1861
+ */
1862
+ e.isAbsolute = function(u) {
1863
+ return /^(?:\/|\w+:)/.test(u);
1864
+ }
1865
+ ), s = (
1866
+ /**
1867
+ * Normalizes the specified path.
1868
+ * @param {string} path Path to normalize
1869
+ * @returns {string} Normalized path
1870
+ */
1871
+ e.normalize = function(u) {
1872
+ u = u.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
1873
+ var n = u.split("/"), a = r(u), f = "";
1874
+ a && (f = n.shift() + "/");
1875
+ for (var i = 0; i < n.length; )
1876
+ n[i] === ".." ? i > 0 && n[i - 1] !== ".." ? n.splice(--i, 2) : a ? n.splice(i, 1) : ++i : n[i] === "." ? n.splice(i, 1) : ++i;
1877
+ return f + n.join("/");
1878
+ }
1879
+ );
1880
+ e.resolve = function(u, n, a) {
1881
+ return a || (n = s(n)), r(n) ? n : (a || (u = s(u)), (u = u.replace(/(?:\/|^)[^/]+$/, "")).length ? s(u + "/" + n) : n);
1882
+ };
1883
+ })(path);
1884
+ var types = {}, hasRequiredTypes;
1885
+ function requireTypes() {
1886
+ return hasRequiredTypes || (hasRequiredTypes = 1, function(t) {
1887
+ var e = t, r = requireUtil(), s = [
1888
+ "double",
1889
+ // 0
1890
+ "float",
1891
+ // 1
1892
+ "int32",
1893
+ // 2
1894
+ "uint32",
1895
+ // 3
1896
+ "sint32",
1897
+ // 4
1898
+ "fixed32",
1899
+ // 5
1900
+ "sfixed32",
1901
+ // 6
1902
+ "int64",
1903
+ // 7
1904
+ "uint64",
1905
+ // 8
1906
+ "sint64",
1907
+ // 9
1908
+ "fixed64",
1909
+ // 10
1910
+ "sfixed64",
1911
+ // 11
1912
+ "bool",
1913
+ // 12
1914
+ "string",
1915
+ // 13
1916
+ "bytes"
1917
+ // 14
1918
+ ];
1919
+ function o(u, n) {
1920
+ var a = 0, f = {};
1921
+ for (n |= 0; a < u.length; ) f[s[a + n]] = u[a++];
1922
+ return f;
1923
+ }
1924
+ e.basic = o([
1925
+ /* double */
1926
+ 1,
1927
+ /* float */
1928
+ 5,
1929
+ /* int32 */
1930
+ 0,
1931
+ /* uint32 */
1932
+ 0,
1933
+ /* sint32 */
1934
+ 0,
1935
+ /* fixed32 */
1936
+ 5,
1937
+ /* sfixed32 */
1938
+ 5,
1939
+ /* int64 */
1940
+ 0,
1941
+ /* uint64 */
1942
+ 0,
1943
+ /* sint64 */
1944
+ 0,
1945
+ /* fixed64 */
1946
+ 1,
1947
+ /* sfixed64 */
1948
+ 1,
1949
+ /* bool */
1950
+ 0,
1951
+ /* string */
1952
+ 2,
1953
+ /* bytes */
1954
+ 2
1955
+ ]), e.defaults = o([
1956
+ /* double */
1957
+ 0,
1958
+ /* float */
1959
+ 0,
1960
+ /* int32 */
1961
+ 0,
1962
+ /* uint32 */
1963
+ 0,
1964
+ /* sint32 */
1965
+ 0,
1966
+ /* fixed32 */
1967
+ 0,
1968
+ /* sfixed32 */
1969
+ 0,
1970
+ /* int64 */
1971
+ 0,
1972
+ /* uint64 */
1973
+ 0,
1974
+ /* sint64 */
1975
+ 0,
1976
+ /* fixed64 */
1977
+ 0,
1978
+ /* sfixed64 */
1979
+ 0,
1980
+ /* bool */
1981
+ !1,
1982
+ /* string */
1983
+ "",
1984
+ /* bytes */
1985
+ r.emptyArray,
1986
+ /* message */
1987
+ null
1988
+ ]), e.long = o([
1989
+ /* int64 */
1990
+ 0,
1991
+ /* uint64 */
1992
+ 0,
1993
+ /* sint64 */
1994
+ 0,
1995
+ /* fixed64 */
1996
+ 1,
1997
+ /* sfixed64 */
1998
+ 1
1999
+ ], 7), e.mapKey = o([
2000
+ /* int32 */
2001
+ 0,
2002
+ /* uint32 */
2003
+ 0,
2004
+ /* sint32 */
2005
+ 0,
2006
+ /* fixed32 */
2007
+ 5,
2008
+ /* sfixed32 */
2009
+ 5,
2010
+ /* int64 */
2011
+ 0,
2012
+ /* uint64 */
2013
+ 0,
2014
+ /* sint64 */
2015
+ 0,
2016
+ /* fixed64 */
2017
+ 1,
2018
+ /* sfixed64 */
2019
+ 1,
2020
+ /* bool */
2021
+ 0,
2022
+ /* string */
2023
+ 2
2024
+ ], 2), e.packed = o([
2025
+ /* double */
2026
+ 1,
2027
+ /* float */
2028
+ 5,
2029
+ /* int32 */
2030
+ 0,
2031
+ /* uint32 */
2032
+ 0,
2033
+ /* sint32 */
2034
+ 0,
2035
+ /* fixed32 */
2036
+ 5,
2037
+ /* sfixed32 */
2038
+ 5,
2039
+ /* int64 */
2040
+ 0,
2041
+ /* uint64 */
2042
+ 0,
2043
+ /* sint64 */
2044
+ 0,
2045
+ /* fixed64 */
2046
+ 1,
2047
+ /* sfixed64 */
2048
+ 1,
2049
+ /* bool */
2050
+ 0
2051
+ ]);
2052
+ }(types)), types;
2053
+ }
2054
+ var field, hasRequiredField;
2055
+ function requireField() {
2056
+ if (hasRequiredField) return field;
2057
+ hasRequiredField = 1, field = n;
2058
+ var t = requireObject();
2059
+ ((n.prototype = Object.create(t.prototype)).constructor = n).className = "Field";
2060
+ var e = require_enum(), r = requireTypes(), s = requireUtil(), o, u = /^required|optional|repeated$/;
2061
+ n.fromJSON = function(f, i) {
2062
+ return new n(f, i.id, i.type, i.rule, i.extend, i.options, i.comment);
2063
+ };
2064
+ function n(a, f, i, l, c, h, d) {
2065
+ if (s.isObject(l) ? (d = c, h = l, l = c = void 0) : s.isObject(c) && (d = h, h = c, c = void 0), t.call(this, a, h), !s.isInteger(f) || f < 0)
2066
+ throw TypeError("id must be a non-negative integer");
2067
+ if (!s.isString(i))
2068
+ throw TypeError("type must be a string");
2069
+ if (l !== void 0 && !u.test(l = l.toString().toLowerCase()))
2070
+ throw TypeError("rule must be a string rule");
2071
+ if (c !== void 0 && !s.isString(c))
2072
+ throw TypeError("extend must be a string");
2073
+ l === "proto3_optional" && (l = "optional"), this.rule = l && l !== "optional" ? l : void 0, this.type = i, this.id = f, this.extend = c || void 0, this.required = l === "required", this.optional = !this.required, this.repeated = l === "repeated", this.map = !1, this.message = null, this.partOf = null, this.typeDefault = null, this.defaultValue = null, this.long = s.Long ? r.long[i] !== void 0 : (
2074
+ /* istanbul ignore next */
2075
+ !1
2076
+ ), this.bytes = i === "bytes", this.resolvedType = null, this.extensionField = null, this.declaringField = null, this._packed = null, this.comment = d;
2077
+ }
2078
+ return Object.defineProperty(n.prototype, "packed", {
2079
+ get: function() {
2080
+ return this._packed === null && (this._packed = this.getOption("packed") !== !1), this._packed;
2081
+ }
2082
+ }), n.prototype.setOption = function(f, i, l) {
2083
+ return f === "packed" && (this._packed = null), t.prototype.setOption.call(this, f, i, l);
2084
+ }, n.prototype.toJSON = function(f) {
2085
+ var i = f ? !!f.keepComments : !1;
2086
+ return s.toObject([
2087
+ "rule",
2088
+ this.rule !== "optional" && this.rule || void 0,
2089
+ "type",
2090
+ this.type,
2091
+ "id",
2092
+ this.id,
2093
+ "extend",
2094
+ this.extend,
2095
+ "options",
2096
+ this.options,
2097
+ "comment",
2098
+ i ? this.comment : void 0
2099
+ ]);
2100
+ }, n.prototype.resolve = function() {
2101
+ if (this.resolved)
2102
+ return this;
2103
+ if ((this.typeDefault = r.defaults[this.type]) === void 0 ? (this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type), this.resolvedType instanceof o ? this.typeDefault = null : this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]) : this.options && this.options.proto3_optional && (this.typeDefault = null), this.options && this.options.default != null && (this.typeDefault = this.options.default, this.resolvedType instanceof e && typeof this.typeDefault == "string" && (this.typeDefault = this.resolvedType.values[this.typeDefault])), this.options && ((this.options.packed === !0 || this.options.packed !== void 0 && this.resolvedType && !(this.resolvedType instanceof e)) && delete this.options.packed, Object.keys(this.options).length || (this.options = void 0)), this.long)
2104
+ this.typeDefault = s.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"), Object.freeze && Object.freeze(this.typeDefault);
2105
+ else if (this.bytes && typeof this.typeDefault == "string") {
2106
+ var f;
2107
+ s.base64.test(this.typeDefault) ? s.base64.decode(this.typeDefault, f = s.newBuffer(s.base64.length(this.typeDefault)), 0) : s.utf8.write(this.typeDefault, f = s.newBuffer(s.utf8.length(this.typeDefault)), 0), this.typeDefault = f;
2108
+ }
2109
+ return this.map ? this.defaultValue = s.emptyObject : this.repeated ? this.defaultValue = s.emptyArray : this.defaultValue = this.typeDefault, this.parent instanceof o && (this.parent.ctor.prototype[this.name] = this.defaultValue), t.prototype.resolve.call(this);
2110
+ }, n.d = function(f, i, l, c) {
2111
+ return typeof i == "function" ? i = s.decorateType(i).name : i && typeof i == "object" && (i = s.decorateEnum(i).name), function(d, p) {
2112
+ s.decorateType(d.constructor).add(new n(p, f, i, l, { default: c }));
2113
+ };
2114
+ }, n._configure = function(f) {
2115
+ o = f;
2116
+ }, field;
2117
+ }
2118
+ var oneof, hasRequiredOneof;
2119
+ function requireOneof() {
2120
+ if (hasRequiredOneof) return oneof;
2121
+ hasRequiredOneof = 1, oneof = s;
2122
+ var t = requireObject();
2123
+ ((s.prototype = Object.create(t.prototype)).constructor = s).className = "OneOf";
2124
+ var e = requireField(), r = requireUtil();
2125
+ function s(u, n, a, f) {
2126
+ if (Array.isArray(n) || (a = n, n = void 0), t.call(this, u, a), !(n === void 0 || Array.isArray(n)))
2127
+ throw TypeError("fieldNames must be an Array");
2128
+ this.oneof = n || [], this.fieldsArray = [], this.comment = f;
2129
+ }
2130
+ s.fromJSON = function(n, a) {
2131
+ return new s(n, a.oneof, a.options, a.comment);
2132
+ }, s.prototype.toJSON = function(n) {
2133
+ var a = n ? !!n.keepComments : !1;
2134
+ return r.toObject([
2135
+ "options",
2136
+ this.options,
2137
+ "oneof",
2138
+ this.oneof,
2139
+ "comment",
2140
+ a ? this.comment : void 0
2141
+ ]);
2142
+ };
2143
+ function o(u) {
2144
+ if (u.parent)
2145
+ for (var n = 0; n < u.fieldsArray.length; ++n)
2146
+ u.fieldsArray[n].parent || u.parent.add(u.fieldsArray[n]);
2147
+ }
2148
+ return s.prototype.add = function(n) {
2149
+ if (!(n instanceof e))
2150
+ throw TypeError("field must be a Field");
2151
+ return n.parent && n.parent !== this.parent && n.parent.remove(n), this.oneof.push(n.name), this.fieldsArray.push(n), n.partOf = this, o(this), this;
2152
+ }, s.prototype.remove = function(n) {
2153
+ if (!(n instanceof e))
2154
+ throw TypeError("field must be a Field");
2155
+ var a = this.fieldsArray.indexOf(n);
2156
+ if (a < 0)
2157
+ throw Error(n + " is not a member of " + this);
2158
+ return this.fieldsArray.splice(a, 1), a = this.oneof.indexOf(n.name), a > -1 && this.oneof.splice(a, 1), n.partOf = null, this;
2159
+ }, s.prototype.onAdd = function(n) {
2160
+ t.prototype.onAdd.call(this, n);
2161
+ for (var a = this, f = 0; f < this.oneof.length; ++f) {
2162
+ var i = n.get(this.oneof[f]);
2163
+ i && !i.partOf && (i.partOf = a, a.fieldsArray.push(i));
2164
+ }
2165
+ o(this);
2166
+ }, s.prototype.onRemove = function(n) {
2167
+ for (var a = 0, f; a < this.fieldsArray.length; ++a)
2168
+ (f = this.fieldsArray[a]).parent && f.parent.remove(f);
2169
+ t.prototype.onRemove.call(this, n);
2170
+ }, s.d = function() {
2171
+ for (var n = new Array(arguments.length), a = 0; a < arguments.length; )
2172
+ n[a] = arguments[a++];
2173
+ return function(i, l) {
2174
+ r.decorateType(i.constructor).add(new s(l, n)), Object.defineProperty(i, l, {
2175
+ get: r.oneOfGetter(n),
2176
+ set: r.oneOfSetter(n)
2177
+ });
2178
+ };
2179
+ }, oneof;
2180
+ }
2181
+ var namespace, hasRequiredNamespace;
2182
+ function requireNamespace() {
2183
+ if (hasRequiredNamespace) return namespace;
2184
+ hasRequiredNamespace = 1, namespace = f;
2185
+ var t = requireObject();
2186
+ ((f.prototype = Object.create(t.prototype)).constructor = f).className = "Namespace";
2187
+ var e = requireField(), r = requireUtil(), s = requireOneof(), o, u, n;
2188
+ f.fromJSON = function(c, h) {
2189
+ return new f(c, h.options).addJSON(h.nested);
2190
+ };
2191
+ function a(l, c) {
2192
+ if (l && l.length) {
2193
+ for (var h = {}, d = 0; d < l.length; ++d)
2194
+ h[l[d].name] = l[d].toJSON(c);
2195
+ return h;
2196
+ }
2197
+ }
2198
+ f.arrayToJSON = a, f.isReservedId = function(c, h) {
2199
+ if (c) {
2200
+ for (var d = 0; d < c.length; ++d)
2201
+ if (typeof c[d] != "string" && c[d][0] <= h && c[d][1] > h)
2202
+ return !0;
2203
+ }
2204
+ return !1;
2205
+ }, f.isReservedName = function(c, h) {
2206
+ if (c) {
2207
+ for (var d = 0; d < c.length; ++d)
2208
+ if (c[d] === h)
2209
+ return !0;
2210
+ }
2211
+ return !1;
2212
+ };
2213
+ function f(l, c) {
2214
+ t.call(this, l, c), this.nested = void 0, this._nestedArray = null;
2215
+ }
2216
+ function i(l) {
2217
+ return l._nestedArray = null, l;
2218
+ }
2219
+ return Object.defineProperty(f.prototype, "nestedArray", {
2220
+ get: function() {
2221
+ return this._nestedArray || (this._nestedArray = r.toArray(this.nested));
2222
+ }
2223
+ }), f.prototype.toJSON = function(c) {
2224
+ return r.toObject([
2225
+ "options",
2226
+ this.options,
2227
+ "nested",
2228
+ a(this.nestedArray, c)
2229
+ ]);
2230
+ }, f.prototype.addJSON = function(c) {
2231
+ var h = this;
2232
+ if (c)
2233
+ for (var d = Object.keys(c), p = 0, v; p < d.length; ++p)
2234
+ v = c[d[p]], h.add(
2235
+ // most to least likely
2236
+ (v.fields !== void 0 ? o.fromJSON : v.values !== void 0 ? n.fromJSON : v.methods !== void 0 ? u.fromJSON : v.id !== void 0 ? e.fromJSON : f.fromJSON)(d[p], v)
2237
+ );
2238
+ return this;
2239
+ }, f.prototype.get = function(c) {
2240
+ return this.nested && this.nested[c] || null;
2241
+ }, f.prototype.getEnum = function(c) {
2242
+ if (this.nested && this.nested[c] instanceof n)
2243
+ return this.nested[c].values;
2244
+ throw Error("no such enum: " + c);
2245
+ }, f.prototype.add = function(c) {
2246
+ if (!(c instanceof e && c.extend !== void 0 || c instanceof o || c instanceof s || c instanceof n || c instanceof u || c instanceof f))
2247
+ throw TypeError("object must be a valid nested object");
2248
+ if (!this.nested)
2249
+ this.nested = {};
2250
+ else {
2251
+ var h = this.get(c.name);
2252
+ if (h)
2253
+ if (h instanceof f && c instanceof f && !(h instanceof o || h instanceof u)) {
2254
+ for (var d = h.nestedArray, p = 0; p < d.length; ++p)
2255
+ c.add(d[p]);
2256
+ this.remove(h), this.nested || (this.nested = {}), c.setOptions(h.options, !0);
2257
+ } else
2258
+ throw Error("duplicate name '" + c.name + "' in " + this);
2259
+ }
2260
+ return this.nested[c.name] = c, c.onAdd(this), i(this);
2261
+ }, f.prototype.remove = function(c) {
2262
+ if (!(c instanceof t))
2263
+ throw TypeError("object must be a ReflectionObject");
2264
+ if (c.parent !== this)
2265
+ throw Error(c + " is not a member of " + this);
2266
+ return delete this.nested[c.name], Object.keys(this.nested).length || (this.nested = void 0), c.onRemove(this), i(this);
2267
+ }, f.prototype.define = function(c, h) {
2268
+ if (r.isString(c))
2269
+ c = c.split(".");
2270
+ else if (!Array.isArray(c))
2271
+ throw TypeError("illegal path");
2272
+ if (c && c.length && c[0] === "")
2273
+ throw Error("path must be relative");
2274
+ for (var d = this; c.length > 0; ) {
2275
+ var p = c.shift();
2276
+ if (d.nested && d.nested[p]) {
2277
+ if (d = d.nested[p], !(d instanceof f))
2278
+ throw Error("path conflicts with non-namespace objects");
2279
+ } else
2280
+ d.add(d = new f(p));
2281
+ }
2282
+ return h && d.addJSON(h), d;
2283
+ }, f.prototype.resolveAll = function() {
2284
+ for (var c = this.nestedArray, h = 0; h < c.length; )
2285
+ c[h] instanceof f ? c[h++].resolveAll() : c[h++].resolve();
2286
+ return this.resolve();
2287
+ }, f.prototype.lookup = function(c, h, d) {
2288
+ if (typeof h == "boolean" ? (d = h, h = void 0) : h && !Array.isArray(h) && (h = [h]), r.isString(c) && c.length) {
2289
+ if (c === ".")
2290
+ return this.root;
2291
+ c = c.split(".");
2292
+ } else if (!c.length)
2293
+ return this;
2294
+ if (c[0] === "")
2295
+ return this.root.lookup(c.slice(1), h);
2296
+ var p = this.get(c[0]);
2297
+ if (p) {
2298
+ if (c.length === 1) {
2299
+ if (!h || h.indexOf(p.constructor) > -1)
2300
+ return p;
2301
+ } else if (p instanceof f && (p = p.lookup(c.slice(1), h, !0)))
2302
+ return p;
2303
+ } else
2304
+ for (var v = 0; v < this.nestedArray.length; ++v)
2305
+ if (this._nestedArray[v] instanceof f && (p = this._nestedArray[v].lookup(c, h, !0)))
2306
+ return p;
2307
+ return this.parent === null || d ? null : this.parent.lookup(c, h);
2308
+ }, f.prototype.lookupType = function(c) {
2309
+ var h = this.lookup(c, [o]);
2310
+ if (!h)
2311
+ throw Error("no such type: " + c);
2312
+ return h;
2313
+ }, f.prototype.lookupEnum = function(c) {
2314
+ var h = this.lookup(c, [n]);
2315
+ if (!h)
2316
+ throw Error("no such Enum '" + c + "' in " + this);
2317
+ return h;
2318
+ }, f.prototype.lookupTypeOrEnum = function(c) {
2319
+ var h = this.lookup(c, [o, n]);
2320
+ if (!h)
2321
+ throw Error("no such Type or Enum '" + c + "' in " + this);
2322
+ return h;
2323
+ }, f.prototype.lookupService = function(c) {
2324
+ var h = this.lookup(c, [u]);
2325
+ if (!h)
2326
+ throw Error("no such Service '" + c + "' in " + this);
2327
+ return h;
2328
+ }, f._configure = function(l, c, h) {
2329
+ o = l, u = c, n = h;
2330
+ }, namespace;
2331
+ }
2332
+ var mapfield, hasRequiredMapfield;
2333
+ function requireMapfield() {
2334
+ if (hasRequiredMapfield) return mapfield;
2335
+ hasRequiredMapfield = 1, mapfield = s;
2336
+ var t = requireField();
2337
+ ((s.prototype = Object.create(t.prototype)).constructor = s).className = "MapField";
2338
+ var e = requireTypes(), r = requireUtil();
2339
+ function s(o, u, n, a, f, i) {
2340
+ if (t.call(this, o, u, a, void 0, void 0, f, i), !r.isString(n))
2341
+ throw TypeError("keyType must be a string");
2342
+ this.keyType = n, this.resolvedKeyType = null, this.map = !0;
2343
+ }
2344
+ return s.fromJSON = function(u, n) {
2345
+ return new s(u, n.id, n.keyType, n.type, n.options, n.comment);
2346
+ }, s.prototype.toJSON = function(u) {
2347
+ var n = u ? !!u.keepComments : !1;
2348
+ return r.toObject([
2349
+ "keyType",
2350
+ this.keyType,
2351
+ "type",
2352
+ this.type,
2353
+ "id",
2354
+ this.id,
2355
+ "extend",
2356
+ this.extend,
2357
+ "options",
2358
+ this.options,
2359
+ "comment",
2360
+ n ? this.comment : void 0
2361
+ ]);
2362
+ }, s.prototype.resolve = function() {
2363
+ if (this.resolved)
2364
+ return this;
2365
+ if (e.mapKey[this.keyType] === void 0)
2366
+ throw Error("invalid key type: " + this.keyType);
2367
+ return t.prototype.resolve.call(this);
2368
+ }, s.d = function(u, n, a) {
2369
+ return typeof a == "function" ? a = r.decorateType(a).name : a && typeof a == "object" && (a = r.decorateEnum(a).name), function(i, l) {
2370
+ r.decorateType(i.constructor).add(new s(l, u, n, a));
2371
+ };
2372
+ }, mapfield;
2373
+ }
2374
+ var method, hasRequiredMethod;
2375
+ function requireMethod() {
2376
+ if (hasRequiredMethod) return method;
2377
+ hasRequiredMethod = 1, method = r;
2378
+ var t = requireObject();
2379
+ ((r.prototype = Object.create(t.prototype)).constructor = r).className = "Method";
2380
+ var e = requireUtil();
2381
+ function r(s, o, u, n, a, f, i, l, c) {
2382
+ if (e.isObject(a) ? (i = a, a = f = void 0) : e.isObject(f) && (i = f, f = void 0), !(o === void 0 || e.isString(o)))
2383
+ throw TypeError("type must be a string");
2384
+ if (!e.isString(u))
2385
+ throw TypeError("requestType must be a string");
2386
+ if (!e.isString(n))
2387
+ throw TypeError("responseType must be a string");
2388
+ t.call(this, s, i), this.type = o || "rpc", this.requestType = u, this.requestStream = a ? !0 : void 0, this.responseType = n, this.responseStream = f ? !0 : void 0, this.resolvedRequestType = null, this.resolvedResponseType = null, this.comment = l, this.parsedOptions = c;
2389
+ }
2390
+ return r.fromJSON = function(o, u) {
2391
+ return new r(o, u.type, u.requestType, u.responseType, u.requestStream, u.responseStream, u.options, u.comment, u.parsedOptions);
2392
+ }, r.prototype.toJSON = function(o) {
2393
+ var u = o ? !!o.keepComments : !1;
2394
+ return e.toObject([
2395
+ "type",
2396
+ this.type !== "rpc" && /* istanbul ignore next */
2397
+ this.type || void 0,
2398
+ "requestType",
2399
+ this.requestType,
2400
+ "requestStream",
2401
+ this.requestStream,
2402
+ "responseType",
2403
+ this.responseType,
2404
+ "responseStream",
2405
+ this.responseStream,
2406
+ "options",
2407
+ this.options,
2408
+ "comment",
2409
+ u ? this.comment : void 0,
2410
+ "parsedOptions",
2411
+ this.parsedOptions
2412
+ ]);
2413
+ }, r.prototype.resolve = function() {
2414
+ return this.resolved ? this : (this.resolvedRequestType = this.parent.lookupType(this.requestType), this.resolvedResponseType = this.parent.lookupType(this.responseType), t.prototype.resolve.call(this));
2415
+ }, method;
2416
+ }
2417
+ var service, hasRequiredService;
2418
+ function requireService() {
2419
+ if (hasRequiredService) return service;
2420
+ hasRequiredService = 1, service = o;
2421
+ var t = requireNamespace();
2422
+ ((o.prototype = Object.create(t.prototype)).constructor = o).className = "Service";
2423
+ var e = requireMethod(), r = requireUtil(), s = rpc;
2424
+ function o(n, a) {
2425
+ t.call(this, n, a), this.methods = {}, this._methodsArray = null;
2426
+ }
2427
+ o.fromJSON = function(a, f) {
2428
+ var i = new o(a, f.options);
2429
+ if (f.methods)
2430
+ for (var l = Object.keys(f.methods), c = 0; c < l.length; ++c)
2431
+ i.add(e.fromJSON(l[c], f.methods[l[c]]));
2432
+ return f.nested && i.addJSON(f.nested), i.comment = f.comment, i;
2433
+ }, o.prototype.toJSON = function(a) {
2434
+ var f = t.prototype.toJSON.call(this, a), i = a ? !!a.keepComments : !1;
2435
+ return r.toObject([
2436
+ "options",
2437
+ f && f.options || void 0,
2438
+ "methods",
2439
+ t.arrayToJSON(this.methodsArray, a) || /* istanbul ignore next */
2440
+ {},
2441
+ "nested",
2442
+ f && f.nested || void 0,
2443
+ "comment",
2444
+ i ? this.comment : void 0
2445
+ ]);
2446
+ }, Object.defineProperty(o.prototype, "methodsArray", {
2447
+ get: function() {
2448
+ return this._methodsArray || (this._methodsArray = r.toArray(this.methods));
2449
+ }
2450
+ });
2451
+ function u(n) {
2452
+ return n._methodsArray = null, n;
2453
+ }
2454
+ return o.prototype.get = function(a) {
2455
+ return this.methods[a] || t.prototype.get.call(this, a);
2456
+ }, o.prototype.resolveAll = function() {
2457
+ for (var a = this.methodsArray, f = 0; f < a.length; ++f)
2458
+ a[f].resolve();
2459
+ return t.prototype.resolve.call(this);
2460
+ }, o.prototype.add = function(a) {
2461
+ if (this.get(a.name))
2462
+ throw Error("duplicate name '" + a.name + "' in " + this);
2463
+ return a instanceof e ? (this.methods[a.name] = a, a.parent = this, u(this)) : t.prototype.add.call(this, a);
2464
+ }, o.prototype.remove = function(a) {
2465
+ if (a instanceof e) {
2466
+ if (this.methods[a.name] !== a)
2467
+ throw Error(a + " is not a member of " + this);
2468
+ return delete this.methods[a.name], a.parent = null, u(this);
2469
+ }
2470
+ return t.prototype.remove.call(this, a);
2471
+ }, o.prototype.create = function(a, f, i) {
2472
+ for (var l = new s.Service(a, f, i), c = 0, h; c < /* initializes */
2473
+ this.methodsArray.length; ++c) {
2474
+ var d = r.lcFirst((h = this._methodsArray[c]).resolve().name).replace(/[^$\w_]/g, "");
2475
+ l[d] = r.codegen(["r", "c"], r.isReserved(d) ? d + "_" : d)("return this.rpcCall(m,q,s,r,c)")({
2476
+ m: h,
2477
+ q: h.resolvedRequestType.ctor,
2478
+ s: h.resolvedResponseType.ctor
2479
+ });
2480
+ }
2481
+ return l;
2482
+ }, service;
2483
+ }
2484
+ var message = Message, util = requireMinimal();
2485
+ function Message(t) {
2486
+ if (t)
2487
+ for (var e = Object.keys(t), r = 0; r < e.length; ++r)
2488
+ this[e[r]] = t[e[r]];
2489
+ }
2490
+ Message.create = function t(e) {
2491
+ return this.$type.create(e);
2492
+ };
2493
+ Message.encode = function t(e, r) {
2494
+ return this.$type.encode(e, r);
2495
+ };
2496
+ Message.encodeDelimited = function t(e, r) {
2497
+ return this.$type.encodeDelimited(e, r);
2498
+ };
2499
+ Message.decode = function t(e) {
2500
+ return this.$type.decode(e);
2501
+ };
2502
+ Message.decodeDelimited = function t(e) {
2503
+ return this.$type.decodeDelimited(e);
2504
+ };
2505
+ Message.verify = function t(e) {
2506
+ return this.$type.verify(e);
2507
+ };
2508
+ Message.fromObject = function t(e) {
2509
+ return this.$type.fromObject(e);
2510
+ };
2511
+ Message.toObject = function t(e, r) {
2512
+ return this.$type.toObject(e, r);
2513
+ };
2514
+ Message.prototype.toJSON = function t() {
2515
+ return this.$type.toObject(this, util.toJSONOptions);
2516
+ };
2517
+ var decoder_1, hasRequiredDecoder;
2518
+ function requireDecoder() {
2519
+ if (hasRequiredDecoder) return decoder_1;
2520
+ hasRequiredDecoder = 1, decoder_1 = o;
2521
+ var t = require_enum(), e = requireTypes(), r = requireUtil();
2522
+ function s(u) {
2523
+ return "missing required '" + u.name + "'";
2524
+ }
2525
+ function o(u) {
2526
+ var n = r.codegen(["r", "l"], u.name + "$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (u.fieldsArray.filter(function(h) {
2527
+ return h.map;
2528
+ }).length ? ",k,value" : ""))("while(r.pos<c){")("var t=r.uint32()");
2529
+ u.group && n("if((t&7)===4)")("break"), n("switch(t>>>3){");
2530
+ for (var a = 0; a < /* initializes */
2531
+ u.fieldsArray.length; ++a) {
2532
+ var f = u._fieldsArray[a].resolve(), i = f.resolvedType instanceof t ? "int32" : f.type, l = "m" + r.safeProp(f.name);
2533
+ n("case %i: {", f.id), f.map ? (n("if(%s===util.emptyObject)", l)("%s={}", l)("var c2 = r.uint32()+r.pos"), e.defaults[f.keyType] !== void 0 ? n("k=%j", e.defaults[f.keyType]) : n("k=null"), e.defaults[i] !== void 0 ? n("value=%j", e.defaults[i]) : n("value=null"), n("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break", f.keyType)("case 2:"), e.basic[i] === void 0 ? n("value=types[%i].decode(r,r.uint32())", a) : n("value=r.%s()", i), n("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"), e.long[f.keyType] !== void 0 ? n('%s[typeof k==="object"?util.longToHash(k):k]=value', l) : n("%s[k]=value", l)) : f.repeated ? (n("if(!(%s&&%s.length))", l, l)("%s=[]", l), e.packed[i] !== void 0 && n("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())", l, i)("}else"), e.basic[i] === void 0 ? n(f.resolvedType.group ? "%s.push(types[%i].decode(r))" : "%s.push(types[%i].decode(r,r.uint32()))", l, a) : n("%s.push(r.%s())", l, i)) : e.basic[i] === void 0 ? n(f.resolvedType.group ? "%s=types[%i].decode(r)" : "%s=types[%i].decode(r,r.uint32())", l, a) : n("%s=r.%s()", l, i), n("break")("}");
2534
+ }
2535
+ for (n("default:")("r.skipType(t&7)")("break")("}")("}"), a = 0; a < u._fieldsArray.length; ++a) {
2536
+ var c = u._fieldsArray[a];
2537
+ c.required && n("if(!m.hasOwnProperty(%j))", c.name)("throw util.ProtocolError(%j,{instance:m})", s(c));
2538
+ }
2539
+ return n("return m");
2540
+ }
2541
+ return decoder_1;
2542
+ }
2543
+ var verifier_1, hasRequiredVerifier;
2544
+ function requireVerifier() {
2545
+ if (hasRequiredVerifier) return verifier_1;
2546
+ hasRequiredVerifier = 1, verifier_1 = u;
2547
+ var t = require_enum(), e = requireUtil();
2548
+ function r(n, a) {
2549
+ return n.name + ": " + a + (n.repeated && a !== "array" ? "[]" : n.map && a !== "object" ? "{k:" + n.keyType + "}" : "") + " expected";
2550
+ }
2551
+ function s(n, a, f, i) {
2552
+ if (a.resolvedType)
2553
+ if (a.resolvedType instanceof t) {
2554
+ n("switch(%s){", i)("default:")("return%j", r(a, "enum value"));
2555
+ for (var l = Object.keys(a.resolvedType.values), c = 0; c < l.length; ++c) n("case %i:", a.resolvedType.values[l[c]]);
2556
+ n("break")("}");
2557
+ } else
2558
+ n("{")("var e=types[%i].verify(%s);", f, i)("if(e)")("return%j+e", a.name + ".")("}");
2559
+ else
2560
+ switch (a.type) {
2561
+ case "int32":
2562
+ case "uint32":
2563
+ case "sint32":
2564
+ case "fixed32":
2565
+ case "sfixed32":
2566
+ n("if(!util.isInteger(%s))", i)("return%j", r(a, "integer"));
2567
+ break;
2568
+ case "int64":
2569
+ case "uint64":
2570
+ case "sint64":
2571
+ case "fixed64":
2572
+ case "sfixed64":
2573
+ n("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", i, i, i, i)("return%j", r(a, "integer|Long"));
2574
+ break;
2575
+ case "float":
2576
+ case "double":
2577
+ n('if(typeof %s!=="number")', i)("return%j", r(a, "number"));
2578
+ break;
2579
+ case "bool":
2580
+ n('if(typeof %s!=="boolean")', i)("return%j", r(a, "boolean"));
2581
+ break;
2582
+ case "string":
2583
+ n("if(!util.isString(%s))", i)("return%j", r(a, "string"));
2584
+ break;
2585
+ case "bytes":
2586
+ n('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))', i, i, i)("return%j", r(a, "buffer"));
2587
+ break;
2588
+ }
2589
+ return n;
2590
+ }
2591
+ function o(n, a, f) {
2592
+ switch (a.keyType) {
2593
+ case "int32":
2594
+ case "uint32":
2595
+ case "sint32":
2596
+ case "fixed32":
2597
+ case "sfixed32":
2598
+ n("if(!util.key32Re.test(%s))", f)("return%j", r(a, "integer key"));
2599
+ break;
2600
+ case "int64":
2601
+ case "uint64":
2602
+ case "sint64":
2603
+ case "fixed64":
2604
+ case "sfixed64":
2605
+ n("if(!util.key64Re.test(%s))", f)("return%j", r(a, "integer|Long key"));
2606
+ break;
2607
+ case "bool":
2608
+ n("if(!util.key2Re.test(%s))", f)("return%j", r(a, "boolean key"));
2609
+ break;
2610
+ }
2611
+ return n;
2612
+ }
2613
+ function u(n) {
2614
+ var a = e.codegen(["m"], n.name + "$verify")('if(typeof m!=="object"||m===null)')("return%j", "object expected"), f = n.oneofsArray, i = {};
2615
+ f.length && a("var p={}");
2616
+ for (var l = 0; l < /* initializes */
2617
+ n.fieldsArray.length; ++l) {
2618
+ var c = n._fieldsArray[l].resolve(), h = "m" + e.safeProp(c.name);
2619
+ if (c.optional && a("if(%s!=null&&m.hasOwnProperty(%j)){", h, c.name), c.map)
2620
+ a("if(!util.isObject(%s))", h)("return%j", r(c, "object"))("var k=Object.keys(%s)", h)("for(var i=0;i<k.length;++i){"), o(a, c, "k[i]"), s(a, c, l, h + "[k[i]]")("}");
2621
+ else if (c.repeated)
2622
+ a("if(!Array.isArray(%s))", h)("return%j", r(c, "array"))("for(var i=0;i<%s.length;++i){", h), s(a, c, l, h + "[i]")("}");
2623
+ else {
2624
+ if (c.partOf) {
2625
+ var d = e.safeProp(c.partOf.name);
2626
+ i[c.partOf.name] === 1 && a("if(p%s===1)", d)("return%j", c.partOf.name + ": multiple values"), i[c.partOf.name] = 1, a("p%s=1", d);
2627
+ }
2628
+ s(a, c, l, h);
2629
+ }
2630
+ c.optional && a("}");
2631
+ }
2632
+ return a("return null");
2633
+ }
2634
+ return verifier_1;
2635
+ }
2636
+ var converter = {}, hasRequiredConverter;
2637
+ function requireConverter() {
2638
+ return hasRequiredConverter || (hasRequiredConverter = 1, function(t) {
2639
+ var e = t, r = require_enum(), s = requireUtil();
2640
+ function o(n, a, f, i) {
2641
+ var l = !1;
2642
+ if (a.resolvedType)
2643
+ if (a.resolvedType instanceof r) {
2644
+ n("switch(d%s){", i);
2645
+ for (var c = a.resolvedType.values, h = Object.keys(c), d = 0; d < h.length; ++d)
2646
+ c[h[d]] === a.typeDefault && !l && (n("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}', i, i, i), a.repeated || n("break"), l = !0), n("case%j:", h[d])("case %i:", c[h[d]])("m%s=%j", i, c[h[d]])("break");
2647
+ n("}");
2648
+ } else n('if(typeof d%s!=="object")', i)("throw TypeError(%j)", a.fullName + ": object expected")("m%s=types[%i].fromObject(d%s)", i, f, i);
2649
+ else {
2650
+ var p = !1;
2651
+ switch (a.type) {
2652
+ case "double":
2653
+ case "float":
2654
+ n("m%s=Number(d%s)", i, i);
2655
+ break;
2656
+ case "uint32":
2657
+ case "fixed32":
2658
+ n("m%s=d%s>>>0", i, i);
2659
+ break;
2660
+ case "int32":
2661
+ case "sint32":
2662
+ case "sfixed32":
2663
+ n("m%s=d%s|0", i, i);
2664
+ break;
2665
+ case "uint64":
2666
+ p = !0;
2667
+ case "int64":
2668
+ case "sint64":
2669
+ case "fixed64":
2670
+ case "sfixed64":
2671
+ n("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j", i, i, p)('else if(typeof d%s==="string")', i)("m%s=parseInt(d%s,10)", i, i)('else if(typeof d%s==="number")', i)("m%s=d%s", i, i)('else if(typeof d%s==="object")', i)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", i, i, i, p ? "true" : "");
2672
+ break;
2673
+ case "bytes":
2674
+ n('if(typeof d%s==="string")', i)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", i, i, i)("else if(d%s.length >= 0)", i)("m%s=d%s", i, i);
2675
+ break;
2676
+ case "string":
2677
+ n("m%s=String(d%s)", i, i);
2678
+ break;
2679
+ case "bool":
2680
+ n("m%s=Boolean(d%s)", i, i);
2681
+ break;
2682
+ }
2683
+ }
2684
+ return n;
2685
+ }
2686
+ e.fromObject = function(a) {
2687
+ var f = a.fieldsArray, i = s.codegen(["d"], a.name + "$fromObject")("if(d instanceof this.ctor)")("return d");
2688
+ if (!f.length) return i("return new this.ctor");
2689
+ i("var m=new this.ctor");
2690
+ for (var l = 0; l < f.length; ++l) {
2691
+ var c = f[l].resolve(), h = s.safeProp(c.name);
2692
+ c.map ? (i("if(d%s){", h)('if(typeof d%s!=="object")', h)("throw TypeError(%j)", c.fullName + ": object expected")("m%s={}", h)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){", h), o(
2693
+ i,
2694
+ c,
2695
+ /* not sorted */
2696
+ l,
2697
+ h + "[ks[i]]"
2698
+ )("}")("}")) : c.repeated ? (i("if(d%s){", h)("if(!Array.isArray(d%s))", h)("throw TypeError(%j)", c.fullName + ": array expected")("m%s=[]", h)("for(var i=0;i<d%s.length;++i){", h), o(
2699
+ i,
2700
+ c,
2701
+ /* not sorted */
2702
+ l,
2703
+ h + "[i]"
2704
+ )("}")("}")) : (c.resolvedType instanceof r || i("if(d%s!=null){", h), o(
2705
+ i,
2706
+ c,
2707
+ /* not sorted */
2708
+ l,
2709
+ h
2710
+ ), c.resolvedType instanceof r || i("}"));
2711
+ }
2712
+ return i("return m");
2713
+ };
2714
+ function u(n, a, f, i) {
2715
+ if (a.resolvedType)
2716
+ a.resolvedType instanceof r ? n("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s", i, f, i, i, f, i, i) : n("d%s=types[%i].toObject(m%s,o)", i, f, i);
2717
+ else {
2718
+ var l = !1;
2719
+ switch (a.type) {
2720
+ case "double":
2721
+ case "float":
2722
+ n("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s", i, i, i, i);
2723
+ break;
2724
+ case "uint64":
2725
+ l = !0;
2726
+ case "int64":
2727
+ case "sint64":
2728
+ case "fixed64":
2729
+ case "sfixed64":
2730
+ n('if(typeof m%s==="number")', i)("d%s=o.longs===String?String(m%s):m%s", i, i, i)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s", i, i, i, i, l ? "true" : "", i);
2731
+ break;
2732
+ case "bytes":
2733
+ n("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", i, i, i, i, i);
2734
+ break;
2735
+ default:
2736
+ n("d%s=m%s", i, i);
2737
+ break;
2738
+ }
2739
+ }
2740
+ return n;
2741
+ }
2742
+ e.toObject = function(a) {
2743
+ var f = a.fieldsArray.slice().sort(s.compareFieldsById);
2744
+ if (!f.length)
2745
+ return s.codegen()("return {}");
2746
+ for (var i = s.codegen(["m", "o"], a.name + "$toObject")("if(!o)")("o={}")("var d={}"), l = [], c = [], h = [], d = 0; d < f.length; ++d)
2747
+ f[d].partOf || (f[d].resolve().repeated ? l : f[d].map ? c : h).push(f[d]);
2748
+ if (l.length) {
2749
+ for (i("if(o.arrays||o.defaults){"), d = 0; d < l.length; ++d) i("d%s=[]", s.safeProp(l[d].name));
2750
+ i("}");
2751
+ }
2752
+ if (c.length) {
2753
+ for (i("if(o.objects||o.defaults){"), d = 0; d < c.length; ++d) i("d%s={}", s.safeProp(c[d].name));
2754
+ i("}");
2755
+ }
2756
+ if (h.length) {
2757
+ for (i("if(o.defaults){"), d = 0; d < h.length; ++d) {
2758
+ var p = h[d], v = s.safeProp(p.name);
2759
+ if (p.resolvedType instanceof r) i("d%s=o.enums===String?%j:%j", v, p.resolvedType.valuesById[p.typeDefault], p.typeDefault);
2760
+ else if (p.long) i("if(util.Long){")("var n=new util.Long(%i,%i,%j)", p.typeDefault.low, p.typeDefault.high, p.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", v)("}else")("d%s=o.longs===String?%j:%i", v, p.typeDefault.toString(), p.typeDefault.toNumber());
2761
+ else if (p.bytes) {
2762
+ var g = "[" + Array.prototype.slice.call(p.typeDefault).join(",") + "]";
2763
+ i("if(o.bytes===String)d%s=%j", v, String.fromCharCode.apply(String, p.typeDefault))("else{")("d%s=%s", v, g)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", v, v)("}");
2764
+ } else i("d%s=%j", v, p.typeDefault);
2765
+ }
2766
+ i("}");
2767
+ }
2768
+ var m = !1;
2769
+ for (d = 0; d < f.length; ++d) {
2770
+ var p = f[d], _ = a._fieldsArray.indexOf(p), v = s.safeProp(p.name);
2771
+ p.map ? (m || (m = !0, i("var ks2")), i("if(m%s&&(ks2=Object.keys(m%s)).length){", v, v)("d%s={}", v)("for(var j=0;j<ks2.length;++j){"), u(
2772
+ i,
2773
+ p,
2774
+ /* sorted */
2775
+ _,
2776
+ v + "[ks2[j]]"
2777
+ )("}")) : p.repeated ? (i("if(m%s&&m%s.length){", v, v)("d%s=[]", v)("for(var j=0;j<m%s.length;++j){", v), u(
2778
+ i,
2779
+ p,
2780
+ /* sorted */
2781
+ _,
2782
+ v + "[j]"
2783
+ )("}")) : (i("if(m%s!=null&&m.hasOwnProperty(%j)){", v, p.name), u(
2784
+ i,
2785
+ p,
2786
+ /* sorted */
2787
+ _,
2788
+ v
2789
+ ), p.partOf && i("if(o.oneofs)")("d%s=%j", s.safeProp(p.partOf.name), p.name)), i("}");
2790
+ }
2791
+ return i("return d");
2792
+ };
2793
+ }(converter)), converter;
2794
+ }
2795
+ var wrappers = {};
2796
+ (function(t) {
2797
+ var e = t, r = message;
2798
+ e[".google.protobuf.Any"] = {
2799
+ fromObject: function(s) {
2800
+ if (s && s["@type"]) {
2801
+ var o = s["@type"].substring(s["@type"].lastIndexOf("/") + 1), u = this.lookup(o);
2802
+ if (u) {
2803
+ var n = s["@type"].charAt(0) === "." ? s["@type"].slice(1) : s["@type"];
2804
+ return n.indexOf("/") === -1 && (n = "/" + n), this.create({
2805
+ type_url: n,
2806
+ value: u.encode(u.fromObject(s)).finish()
2807
+ });
2808
+ }
2809
+ }
2810
+ return this.fromObject(s);
2811
+ },
2812
+ toObject: function(s, o) {
2813
+ var u = "type.googleapis.com/", n = "", a = "";
2814
+ if (o && o.json && s.type_url && s.value) {
2815
+ a = s.type_url.substring(s.type_url.lastIndexOf("/") + 1), n = s.type_url.substring(0, s.type_url.lastIndexOf("/") + 1);
2816
+ var f = this.lookup(a);
2817
+ f && (s = f.decode(s.value));
2818
+ }
2819
+ if (!(s instanceof this.ctor) && s instanceof r) {
2820
+ var i = s.$type.toObject(s, o), l = s.$type.fullName[0] === "." ? s.$type.fullName.slice(1) : s.$type.fullName;
2821
+ return n === "" && (n = u), a = n + l, i["@type"] = a, i;
2822
+ }
2823
+ return this.toObject(s, o);
2824
+ }
2825
+ };
2826
+ })(wrappers);
2827
+ var type, hasRequiredType;
2828
+ function requireType() {
2829
+ if (hasRequiredType) return type;
2830
+ hasRequiredType = 1, type = v;
2831
+ var t = requireNamespace();
2832
+ ((v.prototype = Object.create(t.prototype)).constructor = v).className = "Type";
2833
+ var e = require_enum(), r = requireOneof(), s = requireField(), o = requireMapfield(), u = requireService(), n = message, a = reader, f = writer, i = requireUtil(), l = requireEncoder(), c = requireDecoder(), h = requireVerifier(), d = requireConverter(), p = wrappers;
2834
+ function v(m, _) {
2835
+ t.call(this, m, _), this.fields = {}, this.oneofs = void 0, this.extensions = void 0, this.reserved = void 0, this.group = void 0, this._fieldsById = null, this._fieldsArray = null, this._oneofsArray = null, this._ctor = null;
2836
+ }
2837
+ Object.defineProperties(v.prototype, {
2838
+ /**
2839
+ * Message fields by id.
2840
+ * @name Type#fieldsById
2841
+ * @type {Object.<number,Field>}
2842
+ * @readonly
2843
+ */
2844
+ fieldsById: {
2845
+ get: function() {
2846
+ if (this._fieldsById)
2847
+ return this._fieldsById;
2848
+ this._fieldsById = {};
2849
+ for (var m = Object.keys(this.fields), _ = 0; _ < m.length; ++_) {
2850
+ var y = this.fields[m[_]], b = y.id;
2851
+ if (this._fieldsById[b])
2852
+ throw Error("duplicate id " + b + " in " + this);
2853
+ this._fieldsById[b] = y;
2854
+ }
2855
+ return this._fieldsById;
2856
+ }
2857
+ },
2858
+ /**
2859
+ * Fields of this message as an array for iteration.
2860
+ * @name Type#fieldsArray
2861
+ * @type {Field[]}
2862
+ * @readonly
2863
+ */
2864
+ fieldsArray: {
2865
+ get: function() {
2866
+ return this._fieldsArray || (this._fieldsArray = i.toArray(this.fields));
2867
+ }
2868
+ },
2869
+ /**
2870
+ * Oneofs of this message as an array for iteration.
2871
+ * @name Type#oneofsArray
2872
+ * @type {OneOf[]}
2873
+ * @readonly
2874
+ */
2875
+ oneofsArray: {
2876
+ get: function() {
2877
+ return this._oneofsArray || (this._oneofsArray = i.toArray(this.oneofs));
2878
+ }
2879
+ },
2880
+ /**
2881
+ * The registered constructor, if any registered, otherwise a generic constructor.
2882
+ * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor.
2883
+ * @name Type#ctor
2884
+ * @type {Constructor<{}>}
2885
+ */
2886
+ ctor: {
2887
+ get: function() {
2888
+ return this._ctor || (this.ctor = v.generateConstructor(this)());
2889
+ },
2890
+ set: function(m) {
2891
+ var _ = m.prototype;
2892
+ _ instanceof n || ((m.prototype = new n()).constructor = m, i.merge(m.prototype, _)), m.$type = m.prototype.$type = this, i.merge(m, n, !0), this._ctor = m;
2893
+ for (var y = 0; y < /* initializes */
2894
+ this.fieldsArray.length; ++y)
2895
+ this._fieldsArray[y].resolve();
2896
+ var b = {};
2897
+ for (y = 0; y < /* initializes */
2898
+ this.oneofsArray.length; ++y)
2899
+ b[this._oneofsArray[y].resolve().name] = {
2900
+ get: i.oneOfGetter(this._oneofsArray[y].oneof),
2901
+ set: i.oneOfSetter(this._oneofsArray[y].oneof)
2902
+ };
2903
+ y && Object.defineProperties(m.prototype, b);
2904
+ }
2905
+ }
2906
+ }), v.generateConstructor = function(_) {
2907
+ for (var y = i.codegen(["p"], _.name), b = 0, O; b < _.fieldsArray.length; ++b)
2908
+ (O = _._fieldsArray[b]).map ? y("this%s={}", i.safeProp(O.name)) : O.repeated && y("this%s=[]", i.safeProp(O.name));
2909
+ return y("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]");
2910
+ };
2911
+ function g(m) {
2912
+ return m._fieldsById = m._fieldsArray = m._oneofsArray = null, delete m.encode, delete m.decode, delete m.verify, m;
2913
+ }
2914
+ return v.fromJSON = function(_, y) {
2915
+ var b = new v(_, y.options);
2916
+ b.extensions = y.extensions, b.reserved = y.reserved;
2917
+ for (var O = Object.keys(y.fields), E = 0; E < O.length; ++E)
2918
+ b.add(
2919
+ (typeof y.fields[O[E]].keyType < "u" ? o.fromJSON : s.fromJSON)(O[E], y.fields[O[E]])
2920
+ );
2921
+ if (y.oneofs)
2922
+ for (O = Object.keys(y.oneofs), E = 0; E < O.length; ++E)
2923
+ b.add(r.fromJSON(O[E], y.oneofs[O[E]]));
2924
+ if (y.nested)
2925
+ for (O = Object.keys(y.nested), E = 0; E < O.length; ++E) {
2926
+ var x = y.nested[O[E]];
2927
+ b.add(
2928
+ // most to least likely
2929
+ (x.id !== void 0 ? s.fromJSON : x.fields !== void 0 ? v.fromJSON : x.values !== void 0 ? e.fromJSON : x.methods !== void 0 ? u.fromJSON : t.fromJSON)(O[E], x)
2930
+ );
2931
+ }
2932
+ return y.extensions && y.extensions.length && (b.extensions = y.extensions), y.reserved && y.reserved.length && (b.reserved = y.reserved), y.group && (b.group = !0), y.comment && (b.comment = y.comment), b;
2933
+ }, v.prototype.toJSON = function(_) {
2934
+ var y = t.prototype.toJSON.call(this, _), b = _ ? !!_.keepComments : !1;
2935
+ return i.toObject([
2936
+ "options",
2937
+ y && y.options || void 0,
2938
+ "oneofs",
2939
+ t.arrayToJSON(this.oneofsArray, _),
2940
+ "fields",
2941
+ t.arrayToJSON(this.fieldsArray.filter(function(O) {
2942
+ return !O.declaringField;
2943
+ }), _) || {},
2944
+ "extensions",
2945
+ this.extensions && this.extensions.length ? this.extensions : void 0,
2946
+ "reserved",
2947
+ this.reserved && this.reserved.length ? this.reserved : void 0,
2948
+ "group",
2949
+ this.group || void 0,
2950
+ "nested",
2951
+ y && y.nested || void 0,
2952
+ "comment",
2953
+ b ? this.comment : void 0
2954
+ ]);
2955
+ }, v.prototype.resolveAll = function() {
2956
+ for (var _ = this.fieldsArray, y = 0; y < _.length; )
2957
+ _[y++].resolve();
2958
+ var b = this.oneofsArray;
2959
+ for (y = 0; y < b.length; )
2960
+ b[y++].resolve();
2961
+ return t.prototype.resolveAll.call(this);
2962
+ }, v.prototype.get = function(_) {
2963
+ return this.fields[_] || this.oneofs && this.oneofs[_] || this.nested && this.nested[_] || null;
2964
+ }, v.prototype.add = function(_) {
2965
+ if (this.get(_.name))
2966
+ throw Error("duplicate name '" + _.name + "' in " + this);
2967
+ if (_ instanceof s && _.extend === void 0) {
2968
+ if (this._fieldsById ? (
2969
+ /* istanbul ignore next */
2970
+ this._fieldsById[_.id]
2971
+ ) : this.fieldsById[_.id])
2972
+ throw Error("duplicate id " + _.id + " in " + this);
2973
+ if (this.isReservedId(_.id))
2974
+ throw Error("id " + _.id + " is reserved in " + this);
2975
+ if (this.isReservedName(_.name))
2976
+ throw Error("name '" + _.name + "' is reserved in " + this);
2977
+ return _.parent && _.parent.remove(_), this.fields[_.name] = _, _.message = this, _.onAdd(this), g(this);
2978
+ }
2979
+ return _ instanceof r ? (this.oneofs || (this.oneofs = {}), this.oneofs[_.name] = _, _.onAdd(this), g(this)) : t.prototype.add.call(this, _);
2980
+ }, v.prototype.remove = function(_) {
2981
+ if (_ instanceof s && _.extend === void 0) {
2982
+ if (!this.fields || this.fields[_.name] !== _)
2983
+ throw Error(_ + " is not a member of " + this);
2984
+ return delete this.fields[_.name], _.parent = null, _.onRemove(this), g(this);
2985
+ }
2986
+ if (_ instanceof r) {
2987
+ if (!this.oneofs || this.oneofs[_.name] !== _)
2988
+ throw Error(_ + " is not a member of " + this);
2989
+ return delete this.oneofs[_.name], _.parent = null, _.onRemove(this), g(this);
2990
+ }
2991
+ return t.prototype.remove.call(this, _);
2992
+ }, v.prototype.isReservedId = function(_) {
2993
+ return t.isReservedId(this.reserved, _);
2994
+ }, v.prototype.isReservedName = function(_) {
2995
+ return t.isReservedName(this.reserved, _);
2996
+ }, v.prototype.create = function(_) {
2997
+ return new this.ctor(_);
2998
+ }, v.prototype.setup = function() {
2999
+ for (var _ = this.fullName, y = [], b = 0; b < /* initializes */
3000
+ this.fieldsArray.length; ++b)
3001
+ y.push(this._fieldsArray[b].resolve().resolvedType);
3002
+ this.encode = l(this)({
3003
+ Writer: f,
3004
+ types: y,
3005
+ util: i
3006
+ }), this.decode = c(this)({
3007
+ Reader: a,
3008
+ types: y,
3009
+ util: i
3010
+ }), this.verify = h(this)({
3011
+ types: y,
3012
+ util: i
3013
+ }), this.fromObject = d.fromObject(this)({
3014
+ types: y,
3015
+ util: i
3016
+ }), this.toObject = d.toObject(this)({
3017
+ types: y,
3018
+ util: i
3019
+ });
3020
+ var O = p[_];
3021
+ if (O) {
3022
+ var E = Object.create(this);
3023
+ E.fromObject = this.fromObject, this.fromObject = O.fromObject.bind(E), E.toObject = this.toObject, this.toObject = O.toObject.bind(E);
3024
+ }
3025
+ return this;
3026
+ }, v.prototype.encode = function(_, y) {
3027
+ return this.setup().encode(_, y);
3028
+ }, v.prototype.encodeDelimited = function(_, y) {
3029
+ return this.encode(_, y && y.len ? y.fork() : y).ldelim();
3030
+ }, v.prototype.decode = function(_, y) {
3031
+ return this.setup().decode(_, y);
3032
+ }, v.prototype.decodeDelimited = function(_) {
3033
+ return _ instanceof a || (_ = a.create(_)), this.decode(_, _.uint32());
3034
+ }, v.prototype.verify = function(_) {
3035
+ return this.setup().verify(_);
3036
+ }, v.prototype.fromObject = function(_) {
3037
+ return this.setup().fromObject(_);
3038
+ }, v.prototype.toObject = function(_, y) {
3039
+ return this.setup().toObject(_, y);
3040
+ }, v.d = function(_) {
3041
+ return function(b) {
3042
+ i.decorateType(b, _);
3043
+ };
3044
+ }, type;
3045
+ }
3046
+ var root, hasRequiredRoot;
3047
+ function requireRoot() {
3048
+ if (hasRequiredRoot) return root;
3049
+ hasRequiredRoot = 1, root = f;
3050
+ var t = requireNamespace();
3051
+ ((f.prototype = Object.create(t.prototype)).constructor = f).className = "Root";
3052
+ var e = requireField(), r = require_enum(), s = requireOneof(), o = requireUtil(), u, n, a;
3053
+ function f(h) {
3054
+ t.call(this, "", h), this.deferred = [], this.files = [];
3055
+ }
3056
+ f.fromJSON = function(d, p) {
3057
+ return p || (p = new f()), d.options && p.setOptions(d.options), p.addJSON(d.nested);
3058
+ }, f.prototype.resolvePath = o.path.resolve, f.prototype.fetch = o.fetch;
3059
+ function i() {
3060
+ }
3061
+ f.prototype.load = function h(d, p, v) {
3062
+ typeof p == "function" && (v = p, p = void 0);
3063
+ var g = this;
3064
+ if (!v)
3065
+ return o.asPromise(h, g, d, p);
3066
+ var m = v === i;
3067
+ function _(R, q) {
3068
+ if (v) {
3069
+ if (m)
3070
+ throw R;
3071
+ var A = v;
3072
+ v = null, A(R, q);
3073
+ }
3074
+ }
3075
+ function y(R) {
3076
+ var q = R.lastIndexOf("google/protobuf/");
3077
+ if (q > -1) {
3078
+ var A = R.substring(q);
3079
+ if (A in a) return A;
3080
+ }
3081
+ return null;
3082
+ }
3083
+ function b(R, q) {
3084
+ try {
3085
+ if (o.isString(q) && q.charAt(0) === "{" && (q = JSON.parse(q)), !o.isString(q))
3086
+ g.setOptions(q.options).addJSON(q.nested);
3087
+ else {
3088
+ n.filename = R;
3089
+ var A = n(q, g, p), F, N = 0;
3090
+ if (A.imports)
3091
+ for (; N < A.imports.length; ++N)
3092
+ (F = y(A.imports[N]) || g.resolvePath(R, A.imports[N])) && O(F);
3093
+ if (A.weakImports)
3094
+ for (N = 0; N < A.weakImports.length; ++N)
3095
+ (F = y(A.weakImports[N]) || g.resolvePath(R, A.weakImports[N])) && O(F, !0);
3096
+ }
3097
+ } catch (J) {
3098
+ _(J);
3099
+ }
3100
+ !m && !E && _(null, g);
3101
+ }
3102
+ function O(R, q) {
3103
+ if (R = y(R) || R, !(g.files.indexOf(R) > -1)) {
3104
+ if (g.files.push(R), R in a) {
3105
+ m ? b(R, a[R]) : (++E, setTimeout(function() {
3106
+ --E, b(R, a[R]);
3107
+ }));
3108
+ return;
3109
+ }
3110
+ if (m) {
3111
+ var A;
3112
+ try {
3113
+ A = o.fs.readFileSync(R).toString("utf8");
3114
+ } catch (F) {
3115
+ q || _(F);
3116
+ return;
3117
+ }
3118
+ b(R, A);
3119
+ } else
3120
+ ++E, g.fetch(R, function(F, N) {
3121
+ if (--E, !!v) {
3122
+ if (F) {
3123
+ q ? E || _(null, g) : _(F);
3124
+ return;
3125
+ }
3126
+ b(R, N);
3127
+ }
3128
+ });
3129
+ }
3130
+ }
3131
+ var E = 0;
3132
+ o.isString(d) && (d = [d]);
3133
+ for (var x = 0, P; x < d.length; ++x)
3134
+ (P = g.resolvePath("", d[x])) && O(P);
3135
+ if (m)
3136
+ return g;
3137
+ E || _(null, g);
3138
+ }, f.prototype.loadSync = function(d, p) {
3139
+ if (!o.isNode)
3140
+ throw Error("not supported");
3141
+ return this.load(d, p, i);
3142
+ }, f.prototype.resolveAll = function() {
3143
+ if (this.deferred.length)
3144
+ throw Error("unresolvable extensions: " + this.deferred.map(function(d) {
3145
+ return "'extend " + d.extend + "' in " + d.parent.fullName;
3146
+ }).join(", "));
3147
+ return t.prototype.resolveAll.call(this);
3148
+ };
3149
+ var l = /^[A-Z]/;
3150
+ function c(h, d) {
3151
+ var p = d.parent.lookup(d.extend);
3152
+ if (p) {
3153
+ var v = new e(d.fullName, d.id, d.type, d.rule, void 0, d.options);
3154
+ return p.get(v.name) || (v.declaringField = d, d.extensionField = v, p.add(v)), !0;
3155
+ }
3156
+ return !1;
3157
+ }
3158
+ return f.prototype._handleAdd = function(d) {
3159
+ if (d instanceof e)
3160
+ /* an extension field (implies not part of a oneof) */
3161
+ d.extend !== void 0 && /* not already handled */
3162
+ !d.extensionField && (c(this, d) || this.deferred.push(d));
3163
+ else if (d instanceof r)
3164
+ l.test(d.name) && (d.parent[d.name] = d.values);
3165
+ else if (!(d instanceof s)) {
3166
+ if (d instanceof u)
3167
+ for (var p = 0; p < this.deferred.length; )
3168
+ c(this, this.deferred[p]) ? this.deferred.splice(p, 1) : ++p;
3169
+ for (var v = 0; v < /* initializes */
3170
+ d.nestedArray.length; ++v)
3171
+ this._handleAdd(d._nestedArray[v]);
3172
+ l.test(d.name) && (d.parent[d.name] = d);
3173
+ }
3174
+ }, f.prototype._handleRemove = function(d) {
3175
+ if (d instanceof e) {
3176
+ if (
3177
+ /* an extension field */
3178
+ d.extend !== void 0
3179
+ )
3180
+ if (
3181
+ /* already handled */
3182
+ d.extensionField
3183
+ )
3184
+ d.extensionField.parent.remove(d.extensionField), d.extensionField = null;
3185
+ else {
3186
+ var p = this.deferred.indexOf(d);
3187
+ p > -1 && this.deferred.splice(p, 1);
3188
+ }
3189
+ } else if (d instanceof r)
3190
+ l.test(d.name) && delete d.parent[d.name];
3191
+ else if (d instanceof t) {
3192
+ for (var v = 0; v < /* initializes */
3193
+ d.nestedArray.length; ++v)
3194
+ this._handleRemove(d._nestedArray[v]);
3195
+ l.test(d.name) && delete d.parent[d.name];
3196
+ }
3197
+ }, f._configure = function(h, d, p) {
3198
+ u = h, n = d, a = p;
3199
+ }, root;
3200
+ }
3201
+ var hasRequiredUtil;
3202
+ function requireUtil() {
3203
+ if (hasRequiredUtil) return util$1.exports;
3204
+ hasRequiredUtil = 1;
3205
+ var t = util$1.exports = requireMinimal(), e = roots, r, s;
3206
+ t.codegen = codegen_1, t.fetch = fetch_1, t.path = path, t.fs = t.inquire("fs"), t.toArray = function(i) {
3207
+ if (i) {
3208
+ for (var l = Object.keys(i), c = new Array(l.length), h = 0; h < l.length; )
3209
+ c[h] = i[l[h++]];
3210
+ return c;
3211
+ }
3212
+ return [];
3213
+ }, t.toObject = function(i) {
3214
+ for (var l = {}, c = 0; c < i.length; ) {
3215
+ var h = i[c++], d = i[c++];
3216
+ d !== void 0 && (l[h] = d);
3217
+ }
3218
+ return l;
3219
+ };
3220
+ var o = /\\/g, u = /"/g;
3221
+ t.isReserved = function(i) {
3222
+ return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(i);
3223
+ }, t.safeProp = function(i) {
3224
+ return !/^[$\w_]+$/.test(i) || t.isReserved(i) ? '["' + i.replace(o, "\\\\").replace(u, '\\"') + '"]' : "." + i;
3225
+ }, t.ucFirst = function(i) {
3226
+ return i.charAt(0).toUpperCase() + i.substring(1);
3227
+ };
3228
+ var n = /_([a-z])/g;
3229
+ t.camelCase = function(i) {
3230
+ return i.substring(0, 1) + i.substring(1).replace(n, function(l, c) {
3231
+ return c.toUpperCase();
3232
+ });
3233
+ }, t.compareFieldsById = function(i, l) {
3234
+ return i.id - l.id;
3235
+ }, t.decorateType = function(i, l) {
3236
+ if (i.$type)
3237
+ return l && i.$type.name !== l && (t.decorateRoot.remove(i.$type), i.$type.name = l, t.decorateRoot.add(i.$type)), i.$type;
3238
+ r || (r = requireType());
3239
+ var c = new r(l || i.name);
3240
+ return t.decorateRoot.add(c), c.ctor = i, Object.defineProperty(i, "$type", { value: c, enumerable: !1 }), Object.defineProperty(i.prototype, "$type", { value: c, enumerable: !1 }), c;
3241
+ };
3242
+ var a = 0;
3243
+ return t.decorateEnum = function(i) {
3244
+ if (i.$type)
3245
+ return i.$type;
3246
+ s || (s = require_enum());
3247
+ var l = new s("Enum" + a++, i);
3248
+ return t.decorateRoot.add(l), Object.defineProperty(i, "$type", { value: l, enumerable: !1 }), l;
3249
+ }, t.setProperty = function(i, l, c) {
3250
+ function h(d, p, v) {
3251
+ var g = p.shift();
3252
+ if (g === "__proto__" || g === "prototype")
3253
+ return d;
3254
+ if (p.length > 0)
3255
+ d[g] = h(d[g] || {}, p, v);
3256
+ else {
3257
+ var m = d[g];
3258
+ m && (v = [].concat(m).concat(v)), d[g] = v;
3259
+ }
3260
+ return d;
3261
+ }
3262
+ if (typeof i != "object")
3263
+ throw TypeError("dst must be an object");
3264
+ if (!l)
3265
+ throw TypeError("path must be specified");
3266
+ return l = l.split("."), h(i, l, c);
3267
+ }, Object.defineProperty(t, "decorateRoot", {
3268
+ get: function() {
3269
+ return e.decorated || (e.decorated = new (requireRoot())());
3270
+ }
3271
+ }), util$1.exports;
3272
+ }
3273
+ var object, hasRequiredObject;
3274
+ function requireObject() {
3275
+ if (hasRequiredObject) return object;
3276
+ hasRequiredObject = 1, object = r, r.className = "ReflectionObject";
3277
+ var t = requireUtil(), e;
3278
+ function r(s, o) {
3279
+ if (!t.isString(s))
3280
+ throw TypeError("name must be a string");
3281
+ if (o && !t.isObject(o))
3282
+ throw TypeError("options must be an object");
3283
+ this.options = o, this.parsedOptions = null, this.name = s, this.parent = null, this.resolved = !1, this.comment = null, this.filename = null;
3284
+ }
3285
+ return Object.defineProperties(r.prototype, {
3286
+ /**
3287
+ * Reference to the root namespace.
3288
+ * @name ReflectionObject#root
3289
+ * @type {Root}
3290
+ * @readonly
3291
+ */
3292
+ root: {
3293
+ get: function() {
3294
+ for (var s = this; s.parent !== null; )
3295
+ s = s.parent;
3296
+ return s;
3297
+ }
3298
+ },
3299
+ /**
3300
+ * Full name including leading dot.
3301
+ * @name ReflectionObject#fullName
3302
+ * @type {string}
3303
+ * @readonly
3304
+ */
3305
+ fullName: {
3306
+ get: function() {
3307
+ for (var s = [this.name], o = this.parent; o; )
3308
+ s.unshift(o.name), o = o.parent;
3309
+ return s.join(".");
3310
+ }
3311
+ }
3312
+ }), r.prototype.toJSON = /* istanbul ignore next */
3313
+ function() {
3314
+ throw Error();
3315
+ }, r.prototype.onAdd = function(o) {
3316
+ this.parent && this.parent !== o && this.parent.remove(this), this.parent = o, this.resolved = !1;
3317
+ var u = o.root;
3318
+ u instanceof e && u._handleAdd(this);
3319
+ }, r.prototype.onRemove = function(o) {
3320
+ var u = o.root;
3321
+ u instanceof e && u._handleRemove(this), this.parent = null, this.resolved = !1;
3322
+ }, r.prototype.resolve = function() {
3323
+ return this.resolved ? this : (this.root instanceof e && (this.resolved = !0), this);
3324
+ }, r.prototype.getOption = function(o) {
3325
+ if (this.options)
3326
+ return this.options[o];
3327
+ }, r.prototype.setOption = function(o, u, n) {
3328
+ return (!n || !this.options || this.options[o] === void 0) && ((this.options || (this.options = {}))[o] = u), this;
3329
+ }, r.prototype.setParsedOption = function(o, u, n) {
3330
+ this.parsedOptions || (this.parsedOptions = []);
3331
+ var a = this.parsedOptions;
3332
+ if (n) {
3333
+ var f = a.find(function(c) {
3334
+ return Object.prototype.hasOwnProperty.call(c, o);
3335
+ });
3336
+ if (f) {
3337
+ var i = f[o];
3338
+ t.setProperty(i, n, u);
3339
+ } else
3340
+ f = {}, f[o] = t.setProperty({}, n, u), a.push(f);
3341
+ } else {
3342
+ var l = {};
3343
+ l[o] = u, a.push(l);
3344
+ }
3345
+ return this;
3346
+ }, r.prototype.setOptions = function(o, u) {
3347
+ if (o)
3348
+ for (var n = Object.keys(o), a = 0; a < n.length; ++a)
3349
+ this.setOption(n[a], o[n[a]], u);
3350
+ return this;
3351
+ }, r.prototype.toString = function() {
3352
+ var o = this.constructor.className, u = this.fullName;
3353
+ return u.length ? o + " " + u : o;
3354
+ }, r._configure = function(s) {
3355
+ e = s;
3356
+ }, object;
3357
+ }
3358
+ var _enum, hasRequired_enum;
3359
+ function require_enum() {
3360
+ if (hasRequired_enum) return _enum;
3361
+ hasRequired_enum = 1, _enum = s;
3362
+ var t = requireObject();
3363
+ ((s.prototype = Object.create(t.prototype)).constructor = s).className = "Enum";
3364
+ var e = requireNamespace(), r = requireUtil();
3365
+ function s(o, u, n, a, f, i) {
3366
+ if (t.call(this, o, n), u && typeof u != "object")
3367
+ throw TypeError("values must be an object");
3368
+ if (this.valuesById = {}, this.values = Object.create(this.valuesById), this.comment = a, this.comments = f || {}, this.valuesOptions = i, this.reserved = void 0, u)
3369
+ for (var l = Object.keys(u), c = 0; c < l.length; ++c)
3370
+ typeof u[l[c]] == "number" && (this.valuesById[this.values[l[c]] = u[l[c]]] = l[c]);
3371
+ }
3372
+ return s.fromJSON = function(u, n) {
3373
+ var a = new s(u, n.values, n.options, n.comment, n.comments);
3374
+ return a.reserved = n.reserved, a;
3375
+ }, s.prototype.toJSON = function(u) {
3376
+ var n = u ? !!u.keepComments : !1;
3377
+ return r.toObject([
3378
+ "options",
3379
+ this.options,
3380
+ "valuesOptions",
3381
+ this.valuesOptions,
3382
+ "values",
3383
+ this.values,
3384
+ "reserved",
3385
+ this.reserved && this.reserved.length ? this.reserved : void 0,
3386
+ "comment",
3387
+ n ? this.comment : void 0,
3388
+ "comments",
3389
+ n ? this.comments : void 0
3390
+ ]);
3391
+ }, s.prototype.add = function(u, n, a, f) {
3392
+ if (!r.isString(u))
3393
+ throw TypeError("name must be a string");
3394
+ if (!r.isInteger(n))
3395
+ throw TypeError("id must be an integer");
3396
+ if (this.values[u] !== void 0)
3397
+ throw Error("duplicate name '" + u + "' in " + this);
3398
+ if (this.isReservedId(n))
3399
+ throw Error("id " + n + " is reserved in " + this);
3400
+ if (this.isReservedName(u))
3401
+ throw Error("name '" + u + "' is reserved in " + this);
3402
+ if (this.valuesById[n] !== void 0) {
3403
+ if (!(this.options && this.options.allow_alias))
3404
+ throw Error("duplicate id " + n + " in " + this);
3405
+ this.values[u] = n;
3406
+ } else
3407
+ this.valuesById[this.values[u] = n] = u;
3408
+ return f && (this.valuesOptions === void 0 && (this.valuesOptions = {}), this.valuesOptions[u] = f || null), this.comments[u] = a || null, this;
3409
+ }, s.prototype.remove = function(u) {
3410
+ if (!r.isString(u))
3411
+ throw TypeError("name must be a string");
3412
+ var n = this.values[u];
3413
+ if (n == null)
3414
+ throw Error("name '" + u + "' does not exist in " + this);
3415
+ return delete this.valuesById[n], delete this.values[u], delete this.comments[u], this.valuesOptions && delete this.valuesOptions[u], this;
3416
+ }, s.prototype.isReservedId = function(u) {
3417
+ return e.isReservedId(this.reserved, u);
3418
+ }, s.prototype.isReservedName = function(u) {
3419
+ return e.isReservedName(this.reserved, u);
3420
+ }, _enum;
3421
+ }
3422
+ var encoder_1, hasRequiredEncoder;
3423
+ function requireEncoder() {
3424
+ if (hasRequiredEncoder) return encoder_1;
3425
+ hasRequiredEncoder = 1, encoder_1 = o;
3426
+ var t = require_enum(), e = requireTypes(), r = requireUtil();
3427
+ function s(u, n, a, f) {
3428
+ return n.resolvedType.group ? u("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", a, f, (n.id << 3 | 3) >>> 0, (n.id << 3 | 4) >>> 0) : u("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", a, f, (n.id << 3 | 2) >>> 0);
3429
+ }
3430
+ function o(u) {
3431
+ for (var n = r.codegen(["m", "w"], u.name + "$encode")("if(!w)")("w=Writer.create()"), a, f, i = (
3432
+ /* initializes */
3433
+ u.fieldsArray.slice().sort(r.compareFieldsById)
3434
+ ), a = 0; a < i.length; ++a) {
3435
+ var l = i[a].resolve(), c = u._fieldsArray.indexOf(l), h = l.resolvedType instanceof t ? "int32" : l.type, d = e.basic[h];
3436
+ f = "m" + r.safeProp(l.name), l.map ? (n("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", f, l.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){", f)("w.uint32(%i).fork().uint32(%i).%s(ks[i])", (l.id << 3 | 2) >>> 0, 8 | e.mapKey[l.keyType], l.keyType), d === void 0 ? n("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", c, f) : n(".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | d, h, f), n("}")("}")) : l.repeated ? (n("if(%s!=null&&%s.length){", f, f), l.packed && e.packed[h] !== void 0 ? n("w.uint32(%i).fork()", (l.id << 3 | 2) >>> 0)("for(var i=0;i<%s.length;++i)", f)("w.%s(%s[i])", h, f)("w.ldelim()") : (n("for(var i=0;i<%s.length;++i)", f), d === void 0 ? s(n, l, c, f + "[i]") : n("w.uint32(%i).%s(%s[i])", (l.id << 3 | d) >>> 0, h, f)), n("}")) : (l.optional && n("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", f, l.name), d === void 0 ? s(n, l, c, f) : n("w.uint32(%i).%s(%s)", (l.id << 3 | d) >>> 0, h, f));
3437
+ }
3438
+ return n("return w");
3439
+ }
3440
+ return encoder_1;
3441
+ }
3442
+ var protobuf = indexLight.exports = indexMinimal;
3443
+ protobuf.build = "light";
3444
+ function load(t, e, r) {
3445
+ return typeof e == "function" ? (r = e, e = new protobuf.Root()) : e || (e = new protobuf.Root()), e.load(t, r);
3446
+ }
3447
+ protobuf.load = load;
3448
+ function loadSync(t, e) {
3449
+ return e || (e = new protobuf.Root()), e.loadSync(t);
3450
+ }
3451
+ protobuf.loadSync = loadSync;
3452
+ protobuf.encoder = requireEncoder();
3453
+ protobuf.decoder = requireDecoder();
3454
+ protobuf.verifier = requireVerifier();
3455
+ protobuf.converter = requireConverter();
3456
+ protobuf.ReflectionObject = requireObject();
3457
+ protobuf.Namespace = requireNamespace();
3458
+ protobuf.Root = requireRoot();
3459
+ protobuf.Enum = require_enum();
3460
+ protobuf.Type = requireType();
3461
+ protobuf.Field = requireField();
3462
+ protobuf.OneOf = requireOneof();
3463
+ protobuf.MapField = requireMapfield();
3464
+ protobuf.Service = requireService();
3465
+ protobuf.Method = requireMethod();
3466
+ protobuf.Message = message;
3467
+ protobuf.wrappers = wrappers;
3468
+ protobuf.types = requireTypes();
3469
+ protobuf.util = requireUtil();
3470
+ protobuf.ReflectionObject._configure(protobuf.Root);
3471
+ protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum);
3472
+ protobuf.Root._configure(protobuf.Type);
3473
+ protobuf.Field._configure(protobuf.Type);
3474
+ var indexLightExports = indexLight.exports, light = indexLightExports;
3475
+ const protobufjs = /* @__PURE__ */ getDefaultExportFromCjs(light), proto_data = { options: { syntax: "proto3", optimize_for: "LITE_RUNTIME" }, nested: { nil: { nested: { xit: { nested: { proto: { nested: { MessageType: { values: { MessageType_FrameRequest: 0, MessageType_FrameResponse: 1, MessageType_FrameCache: 2, MessageType_ValueRequest: 3, MessageType_ValueResponse: 4, MessageType_ValueUpdate: 5, MessageType_SignalRequest: 6, MessageType_SignalResponse: 7, MessageType_SignalNotify: 8, MessageType_FileRequest: 9, MessageType_FileResponse: 10 } }, FrameRequest: { fields: { id: { type: "string", id: 1 } } }, FrameResponse: { oneofs: { value: { oneof: ["file", "content"] } }, fields: { id: { type: "string", id: 1 }, file: { type: "string", id: 2 }, content: { type: "string", id: 3 } } }, Value: { oneofs: { value: { oneof: ["value_boolean", "value_number", "value_double", "value_string", "value_buffer"] } }, fields: { id: { type: "string", id: 1 }, value_boolean: { type: "bool", id: 2 }, value_number: { type: "int64", id: 3 }, value_double: { type: "double", id: 4 }, value_string: { type: "string", id: 5 }, value_buffer: { type: "bytes", id: 6 } } }, ValueRequest: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, ValueResponse: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, values: { rule: "repeated", type: "Value", id: 3 } } }, ValueUpdate: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, value: { type: "Value", id: 3 } } }, SignalRequest: { fields: { id: { type: "string", id: 1 } } }, Signal: { oneofs: { _type: { oneof: ["type"] } }, fields: { id: { type: "string", id: 1 }, type: { type: "string", id: 2, options: { proto3_optional: !0 } } } }, SignalResponse: { oneofs: { _tag: { oneof: ["tag"] } }, fields: { id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, signals: { rule: "repeated", type: "Signal", id: 3 } } }, SignalNotify: { oneofs: { _tag: { oneof: ["tag"] }, arg: { oneof: ["arg_boolean", "arg_number", "arg_double", "arg_string", "arg_buffer"] } }, fields: { frame_id: { type: "string", id: 1 }, tag: { type: "string", id: 2, options: { proto3_optional: !0 } }, signal_id: { type: "string", id: 3 }, arg_boolean: { type: "bool", id: 4 }, arg_number: { type: "int64", id: 5 }, arg_double: { type: "double", id: 6 }, arg_string: { type: "string", id: 7 }, arg_buffer: { type: "bytes", id: 8 } } }, FileRequest: { fields: { target: { type: "string", id: 1 } } }, FileResponse: { fields: { target: { type: "string", id: 1 }, content: { type: "string", id: 2 }, metadata: { type: "bytes", id: 3 } } }, FileInfo: { fields: { target: { type: "string", id: 1 }, metadata: { type: "bytes", id: 2 } } }, FrameCache: { fields: { id: { type: "string", id: 1 }, content: { type: "string", id: 2 }, files: { rule: "repeated", type: "FileInfo", id: 3 } } } } } } } } } } }, nil_xit_proto = protobufjs.Root.fromJSON(proto_data).lookup(
3476
+ "nil.xit.proto"
3477
+ ), bundle = async (t) => new Promise((e, r) => {
3478
+ const s = new WorkerWrapper();
3479
+ s.postMessage({ type: "init", host: t.host, id: t.id, cdn_url: t.cdn_url }), s.addEventListener("message", async (o) => {
3480
+ if (o.data.ok) {
3481
+ if (o.data.files) {
3482
+ const u = concat([
3483
+ header(nil_xit_proto.MessageType.MessageType_FrameCache),
3484
+ nil_xit_proto.FrameCache.encode({
3485
+ id: t.id,
3486
+ content: o.data.code,
3487
+ files: o.data.files
3488
+ }).finish()
3489
+ ]);
3490
+ service_publish({ host: t.host }, u);
3491
+ }
3492
+ e(
3493
+ await import(
3494
+ /* @vite-ignore */
3495
+ "data:text/javascript;base64," + btoa(unescape(encodeURIComponent(o.data.code)))
3496
+ )
3497
+ );
3498
+ } else
3499
+ r(o.data.err);
3500
+ s.terminate();
3501
+ });
3502
+ }), subscriber_queue = [];
3503
+ function writable(t, e = noop$1) {
3504
+ let r = null;
3505
+ const s = /* @__PURE__ */ new Set();
3506
+ function o(a) {
3507
+ if (safe_not_equal(t, a) && (t = a, r)) {
3508
+ const f = !subscriber_queue.length;
3509
+ for (const i of s)
3510
+ i[1](), subscriber_queue.push(i, t);
3511
+ if (f) {
3512
+ for (let i = 0; i < subscriber_queue.length; i += 2)
3513
+ subscriber_queue[i][0](subscriber_queue[i + 1]);
3514
+ subscriber_queue.length = 0;
3515
+ }
3516
+ }
3517
+ }
3518
+ function u(a) {
3519
+ o(a(
3520
+ /** @type {T} */
3521
+ t
3522
+ ));
3523
+ }
3524
+ function n(a, f = noop$1) {
3525
+ const i = [a, f];
3526
+ return s.add(i), s.size === 1 && (r = e(o, u) || noop$1), a(
3527
+ /** @type {T} */
3528
+ t
3529
+ ), () => {
3530
+ s.delete(i), s.size === 0 && r && (r(), r = null);
3531
+ };
3532
+ }
3533
+ return { set: o, update: u, subscribe: n };
3534
+ }
3535
+ function get(t) {
3536
+ let e;
3537
+ return subscribe_to_store(t, (r) => e = r)(), e;
3538
+ }
3539
+ const make_values = async ({
3540
+ id: t,
3541
+ tag: e,
3542
+ host: r,
3543
+ service: s
3544
+ }) => {
3545
+ const o = await service_fetch(
3546
+ { host: r },
3547
+ concat([
3548
+ header(nil_xit_proto.MessageType.MessageType_ValueRequest),
3549
+ nil_xit_proto.ValueRequest.encode({ id: t, tag: e }).finish()
3550
+ ]),
3551
+ (n, a) => {
3552
+ if (n === nil_xit_proto.MessageType.MessageType_ValueResponse) {
3553
+ const f = nil_xit_proto.ValueResponse.decode(a);
3554
+ if (f.id === t && (e == null || e === f.tag))
3555
+ return f.values;
3556
+ }
3557
+ }
3558
+ ), u = {
3559
+ value_boolean: /* @__PURE__ */ new Map(),
3560
+ value_double: /* @__PURE__ */ new Map(),
3561
+ value_number: /* @__PURE__ */ new Map(),
3562
+ value_string: /* @__PURE__ */ new Map(),
3563
+ value_buffer: /* @__PURE__ */ new Map()
3564
+ };
3565
+ for (const n of o) {
3566
+ const a = writable(n[n.value]);
3567
+ a.subscribe((f) => {
3568
+ const i = { id: n.id, [n.value]: f, value: n.value }, l = { id: t, tag: e, value: i }, c = concat([
3569
+ header(nil_xit_proto.MessageType.MessageType_ValueUpdate),
3570
+ nil_xit_proto.ValueUpdate.encode(l).finish()
3571
+ ]);
3572
+ s.publish(c);
3573
+ }), u[n.value].set(n.id, a);
3574
+ }
3575
+ return s.on_message((n, a) => {
3576
+ var l;
3577
+ const f = new DataView(a.buffer).getUint32(0, !1), i = a.slice(4);
3578
+ if (f === nil_xit_proto.MessageType.MessageType_ValueUpdate) {
3579
+ const c = nil_xit_proto.ValueUpdate.decode(i), h = c.value.value;
3580
+ u[h].get(c.value.id), (l = u[h].get(c.value.id)) == null || l.set(c.value[h]);
3581
+ }
3582
+ }), u;
3583
+ }, make_signals = async ({
3584
+ id: t,
3585
+ tag: e,
3586
+ host: r,
3587
+ service: s
3588
+ }) => {
3589
+ const o = await service_fetch(
3590
+ { host: r },
3591
+ concat([
3592
+ header(nil_xit_proto.MessageType.MessageType_SignalRequest),
3593
+ nil_xit_proto.SignalRequest.encode({ id: t }).finish()
3594
+ ]),
3595
+ (n, a) => {
3596
+ if (n === nil_xit_proto.MessageType.MessageType_SignalResponse) {
3597
+ const f = nil_xit_proto.SignalResponse.decode(a);
3598
+ if (f.id === t)
3599
+ return f.signals;
3600
+ }
3601
+ }
3602
+ ), u = {
3603
+ arg_none: /* @__PURE__ */ new Map(),
3604
+ arg_boolean: /* @__PURE__ */ new Map(),
3605
+ arg_double: /* @__PURE__ */ new Map(),
3606
+ arg_number: /* @__PURE__ */ new Map(),
3607
+ arg_string: /* @__PURE__ */ new Map(),
3608
+ arg_buffer: /* @__PURE__ */ new Map()
3609
+ };
3610
+ for (const { id: n, type: a } of o)
3611
+ a == null ? u.arg_none.set(n, () => {
3612
+ const f = { frame_id: t, signal_id: n, tag: e }, i = concat([
3613
+ header(nil_xit_proto.MessageType.MessageType_SignalNotify),
3614
+ nil_xit_proto.SignalNotify.encode(f).finish()
3615
+ ]);
3616
+ s.publish(i);
3617
+ }) : u[a].set(n, (f) => {
3618
+ const i = { frame_id: t, signal_id: n, tag: e, [a]: f }, l = concat([
3619
+ header(nil_xit_proto.MessageType.MessageType_SignalNotify),
3620
+ nil_xit_proto.SignalNotify.encode(i).finish()
3621
+ ]);
3622
+ s.publish(l);
3623
+ });
3624
+ return u;
3625
+ }, create_context = (t, e, r) => ({
3626
+ values: {
3627
+ boolean: (s, o) => t.value_boolean.get(s) ?? writable(o),
3628
+ double: (s, o) => t.value_double.get(s) ?? writable(o),
3629
+ string: (s, o) => t.value_string.get(s) ?? writable(o),
3630
+ number: (s, o) => t.value_number.get(s) ?? writable(o),
3631
+ buffer: (s, o) => t.value_buffer.get(s) ?? writable(o),
3632
+ json: (s, o, u) => {
3633
+ const n = t.value_buffer.get(s) ?? writable(u.encode(o));
3634
+ let a = t.value_buffer.has(s) ? u.decode(get(n)) : o;
3635
+ return {
3636
+ set: (f) => {
3637
+ a = f, n.set(u.encode(a));
3638
+ },
3639
+ subscribe: (f) => n.subscribe((i) => f(a)),
3640
+ update: (f) => {
3641
+ n.update((i) => (a = f(i), u.encode(a)));
3642
+ }
3643
+ };
3644
+ }
3645
+ },
3646
+ signals: {
3647
+ none: (s) => e.arg_none.get(s) ?? (() => {
3648
+ }),
3649
+ boolean: (s) => e.arg_boolean.get(s) ?? ((o) => {
3650
+ }),
3651
+ double: (s) => e.arg_double.get(s) ?? ((o) => {
3652
+ }),
3653
+ number: (s) => e.arg_number.get(s) ?? ((o) => {
3654
+ }),
3655
+ string: (s) => e.arg_string.get(s) ?? ((o) => {
3656
+ }),
3657
+ buffer: (s) => e.arg_buffer.get(s) ?? ((o) => {
3658
+ }),
3659
+ json: (s, o) => {
3660
+ const u = e.arg_buffer.get(s) ?? ((n) => {
3661
+ });
3662
+ return (n) => u(o(n));
3663
+ }
3664
+ },
3665
+ loader: r
3666
+ }), create_app = async (t, e, r, s, o) => {
3667
+ await test_connection({ host: t });
3668
+ const u = new Service$1({ host: t }), [n, a, { action: f }] = await Promise.all([
3669
+ make_values({ id: e, tag: r, host: t, service: u }),
3670
+ make_signals({ id: e, tag: r, host: t, service: u }),
3671
+ bundle({ host: t, cdn_url: s, id: e })
3672
+ ]);
3673
+ return (i) => {
3674
+ const l = /* @__PURE__ */ new Map();
3675
+ l.set("nil.xit", create_context(n, a, o));
3676
+ const { destroy: c } = f(i, l);
3677
+ return u.start(), {
3678
+ destroy: () => {
3679
+ u.stop(), c();
3680
+ }
3681
+ };
3682
+ };
3683
+ };
3684
+ var root_1 = /* @__PURE__ */ template('<div style="display: contents"></div>'), root_2 = /* @__PURE__ */ template("<div> </div>"), root_3 = /* @__PURE__ */ template("<div> </div>");
3685
+ function Client(t, e) {
3686
+ push(e, !0);
3687
+ var r = comment(), s = first_child(r);
3688
+ await_block(
3689
+ s,
3690
+ () => create_app(e.host, e.frame, e.tag, e.cdn_url, e.loader),
3691
+ (o) => {
3692
+ var u = root_3(), n = child(u);
3693
+ template_effect(() => set_text(n, `Loading ${(e.tag ? `${e.frame}-${e.tag}` : e.frame) ?? ""}...`)), append(o, u);
3694
+ },
3695
+ (o, u) => {
3696
+ var n = root_1();
3697
+ action(n, (a) => get$1(u)(a)), append(o, n);
3698
+ },
3699
+ (o, u) => {
3700
+ var n = root_2(), a = child(n);
3701
+ template_effect(() => set_text(a, (console.log(get$1(u)), "Something went wrong..."))), append(o, n);
3702
+ }
3703
+ ), append(t, r), pop();
3704
+ }
3705
+ function Component(t, e) {
3706
+ push(e, !0);
3707
+ const r = (o) => {
3708
+ const u = {
3709
+ one: (n, a) => r([{ frame: n, tag: a }]),
3710
+ all: (n) => r(n)
3711
+ };
3712
+ return (n) => {
3713
+ n.style.display = "contents";
3714
+ const a = o.map(({ frame: f, tag: i }) => mount(Client, {
3715
+ target: n,
3716
+ props: {
3717
+ loader: u,
3718
+ host: e.data.server,
3719
+ frame: f,
3720
+ tag: i,
3721
+ cdn_url: e.data.cdn_url
3722
+ }
3723
+ }));
3724
+ return {
3725
+ destroy: () => a.forEach((f) => unmount(f))
3726
+ };
3727
+ };
3728
+ };
3729
+ var s = /* @__PURE__ */ derived(() => ({
3730
+ one: (o, u) => r([{ frame: o, tag: u }]),
3731
+ all: (o) => r(o)
3732
+ }));
3733
+ Client(t, {
3734
+ get loader() {
3735
+ return get$1(s);
3736
+ },
3737
+ get host() {
3738
+ return e.data.server;
3739
+ },
3740
+ get frame() {
3741
+ return e.data.frame;
3742
+ },
3743
+ get tag() {
3744
+ return e.data.tag;
3745
+ },
3746
+ get cdn_url() {
3747
+ return e.data.cdn_url;
3748
+ }
3749
+ }), pop();
3750
+ }
3751
+ const create_component = (t, e) => {
3752
+ const r = mount(Component, { target: t, props: { data: { ...e } } });
3753
+ return () => unmount(r);
3754
+ };
3755
+ export {
3756
+ create_component
3757
+ };