sygnal 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -623,12 +623,13 @@ RootComponent.model = {
623
623
 
624
624
  Another very common task in web pages and browser applications is to work with form inputs. Unfortunately, the logic and stream plumbing required to do this routine task can be challenging to developers new to observables (and is frustrating even for most veterans). Sygnal's processForm() helper function takes any HTML form element, and automatically extracts the values from all input fields contained within it. By default processForm() listens to both 'input' and 'submit' events, but can be configured to listen to any combination of standard or custom events on the form itself or its inputs.
625
625
 
626
- The Observable from `processForm` always returns objects with the current value of every field in the form, so the following will print something like:
626
+ The Observable from `processForm` always returns objects with the current value of every field in the form along with the name of the JS event that initiated it, so the following will print something like:
627
627
 
628
628
  ```javascript
629
629
  {
630
- 'first-name': 'First',
631
- 'last-name': 'Last'
630
+ 'first-name': 'Bob',
631
+ 'last-name': 'Smith',
632
+ eventType: 'submit'
632
633
  }
633
634
  ```
634
635
 
@@ -683,7 +684,7 @@ npm run build
683
684
  The results will be in the 'dist' folder, and you can serve it locally by running:
684
685
 
685
686
  ```bash
686
- npm preview
687
+ npm run preview
687
688
  ```
688
689
 
689
690
  Alternatively, you can use any other bundler of your choice (Webpack, Babel, Rollup, etc.). To use JSX in your components while using alternative bundlers, you will need to configure your bundler to use Sygnal's JSX pragma. This is slightly different for each bundler, but looks generally like:
package/dist/index.cjs.js CHANGED
@@ -3154,7 +3154,7 @@ const CHILD_SOURCE_NAME = 'CHILD';
3154
3154
  let COMPONENT_COUNT = 0;
3155
3155
 
3156
3156
 
3157
- const ABORT = '~#~#~ABORT~#~#~';
3157
+ const ABORT$1 = '~#~#~ABORT~#~#~';
3158
3158
 
3159
3159
  function component (opts) {
3160
3160
  const { name, sources, isolateOpts, stateSourceName='STATE' } = opts;
@@ -3239,13 +3239,14 @@ class Component {
3239
3239
  // [ OUTPUT ]
3240
3240
  // sinks
3241
3241
 
3242
- constructor({ name='NO NAME', sources, intent, model, context, response, view, peers={}, components={}, initialState, calculated, storeCalculatedInState=true, DOMSourceName='DOM', stateSourceName='STATE', requestSourceName='HTTP', debug=false }) {
3242
+ constructor({ name='NO NAME', sources, intent, model, hmrActions, context, response, view, peers={}, components={}, initialState, calculated, storeCalculatedInState=true, DOMSourceName='DOM', stateSourceName='STATE', requestSourceName='HTTP', debug=false }) {
3243
3243
  if (!sources || !isObj(sources)) throw new Error('Missing or invalid sources')
3244
3244
 
3245
3245
  this.name = name;
3246
3246
  this.sources = sources;
3247
3247
  this.intent = intent;
3248
3248
  this.model = model;
3249
+ this.hmrActions = hmrActions;
3249
3250
  this.context = context;
3250
3251
  this.response = response;
3251
3252
  this.view = view;
@@ -3306,6 +3307,7 @@ class Component {
3306
3307
 
3307
3308
  this.initChildSources$();
3308
3309
  this.initIntent$();
3310
+ this.initHmrActions();
3309
3311
  this.initAction$();
3310
3312
  this.initState();
3311
3313
  this.initContext();
@@ -3340,6 +3342,23 @@ class Component {
3340
3342
  }
3341
3343
  }
3342
3344
 
3345
+ initHmrActions() {
3346
+ if (typeof this.hmrActions === 'undefined') {
3347
+ this.hmrAction$ = xs$1.of().filter(_ => false);
3348
+ return
3349
+ }
3350
+ if (typeof this.hmrActions === 'string') {
3351
+ this.hmrActions = [this.hmrActions];
3352
+ }
3353
+ if (!Array.isArray(this.hmrActions)) {
3354
+ throw new Error(`[${ this.name }] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`)
3355
+ }
3356
+ if (this.hmrActions.some(action => typeof action !== 'string')) {
3357
+ throw new Error(`[${ this.name }] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`)
3358
+ }
3359
+ this.hmrAction$ = xs$1.fromArray(this.hmrActions.map(action => ({ type: action })));
3360
+ }
3361
+
3343
3362
  initAction$() {
3344
3363
  const requestSource = (this.sources && this.sources[this.requestSourceName]) || null;
3345
3364
 
@@ -3359,11 +3378,12 @@ class Component {
3359
3378
 
3360
3379
  const action$ = ((runner instanceof xs$1.Stream) ? runner : (runner.apply && runner(this.sources) || xs$1.never()));
3361
3380
  const bootstrap$ = xs$1.of({ type: BOOTSTRAP_ACTION }).compose(_default$4(10));
3362
- const wrapped$ = this.model[BOOTSTRAP_ACTION] ? _default$3(bootstrap$, action$) : action$;
3381
+ const hmrAction$ = window?.__SYGNAL_HMR_UPDATING === true ? this.hmrAction$ : xs$1.of().filter(_ => false);
3382
+ const wrapped$ = (this.model[BOOTSTRAP_ACTION] && window?.__SYGNAL_HMR_UPDATING !== true) ? _default$3(bootstrap$, action$) : _default$3(xs$1.of().compose(_default$4(1)).filter(_ => false), hmrAction$, action$);
3363
3383
 
3364
3384
 
3365
3385
  let initialApiData;
3366
- if (requestSource && typeof requestSource.select == 'function') {
3386
+ if (window?.__SYGNAL_HMR_UPDATING !== true && requestSource && typeof requestSource.select == 'function') {
3367
3387
  initialApiData = requestSource.select('initial')
3368
3388
  .flatten();
3369
3389
  } else {
@@ -3377,12 +3397,12 @@ class Component {
3377
3397
  }
3378
3398
 
3379
3399
  initState() {
3380
- if (this.model != undefined) {
3400
+ if (this.model !== undefined) {
3381
3401
  if (this.model[INITIALIZE_ACTION] === undefined) {
3382
3402
  this.model[INITIALIZE_ACTION] = {
3383
3403
  [this.stateSourceName]: (_, data) => ({ ...this.addCalculated(data) })
3384
3404
  };
3385
- } else {
3405
+ } else if (isObj(this.model[INITIALIZE_ACTION])) {
3386
3406
  Object.keys(this.model[INITIALIZE_ACTION]).forEach(name => {
3387
3407
  if (name !== this.stateSourceName) {
3388
3408
  console.warn(`${ INITIALIZE_ACTION } can only be used with the ${ this.stateSourceName } source... disregarding ${ name }`);
@@ -3448,7 +3468,7 @@ class Component {
3448
3468
  if (this.isSubComponent && this.initialState) {
3449
3469
  console.warn(`[${ this.name }] Initial state provided to sub-component. This will overwrite any state provided by the parent component.`);
3450
3470
  }
3451
- const shimmed$ = this.initialState ? _default$3(xs$1.of(initial), this.action$).compose(_default$4(0)) : this.action$;
3471
+ const shimmed$ = (this.initialState && window?.__SYGNAL_HMR_UPDATING !== true) ? _default$3(xs$1.of(initial), this.action$).compose(_default$4(0)) : this.action$;
3452
3472
  const onState = () => this.makeOnAction(shimmed$, true, this.action$);
3453
3473
  const onNormal = () => this.makeOnAction(this.action$, false, this.action$);
3454
3474
 
@@ -3542,8 +3562,6 @@ class Component {
3542
3562
  }
3543
3563
  }).map(sources => xs$1.merge(...sources)).flatten();
3544
3564
 
3545
- // childSources$.subscribe({ next: _ => _})
3546
-
3547
3565
  this.sources[CHILD_SOURCE_NAME] = {
3548
3566
  select: (name) => {
3549
3567
  const all$ = childSources$;
@@ -3643,7 +3661,7 @@ class Component {
3643
3661
  const _state = this.isSubComponent ? this.currentState : state;
3644
3662
  const enhancedState = this.addCalculated(_state);
3645
3663
  const newState = reducer(enhancedState, data, next, extra);
3646
- if (newState == ABORT) return _state
3664
+ if (newState == ABORT$1) return _state
3647
3665
  return this.cleanupCalculated(newState)
3648
3666
  }
3649
3667
  } else {
@@ -3657,7 +3675,7 @@ class Component {
3657
3675
  }
3658
3676
  throw new Error(`Invalid reducer type for ${ name } ${ type }`)
3659
3677
  }
3660
- }).filter(result => result != ABORT);
3678
+ }).filter(result => result != ABORT$1);
3661
3679
  } else if (reducer === undefined || reducer === true) {
3662
3680
  returnStream$ = filtered$.map(({data}) => data);
3663
3681
  } else {
@@ -3916,8 +3934,8 @@ class Component {
3916
3934
  } else {
3917
3935
  const name = collectionOf.componentName || collectionOf.label || collectionOf.name || 'FUNCTION_COMPONENT';
3918
3936
  const view = collectionOf;
3919
- const { model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = collectionOf;
3920
- const options = { name, view, model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
3937
+ const { model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = collectionOf;
3938
+ const options = { name, view, model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
3921
3939
  factory = component(options);
3922
3940
  }
3923
3941
  } else if (this.components[collectionOf]) {
@@ -4068,8 +4086,8 @@ class Component {
4068
4086
  if (!current.isSygnalComponent) {
4069
4087
  const name = current.componentName || current.label || current.name || 'FUNCTION_COMPONENT';
4070
4088
  const view = current;
4071
- const { model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = current;
4072
- const options = { name, view, model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
4089
+ const { model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = current;
4090
+ const options = { name, view, model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
4073
4091
  switchableComponents[key] = component(options);
4074
4092
  }
4075
4093
  });
@@ -4684,27 +4702,59 @@ function logDriver(out$) {
4684
4702
  }
4685
4703
 
4686
4704
  function run(app, drivers={}, options={}) {
4687
- const { mountPoint='#root', fragments=true } = options;
4705
+ const { mountPoint='#root', fragments=true, useDefaultDrivers=true } = options;
4688
4706
  if (!app.isSygnalComponent) {
4689
4707
  const name = app.name || app.componentName || app.label || "FUNCTIONAL_COMPONENT";
4690
4708
  const view = app;
4691
- const { model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = app;
4692
- const options = { name, view, model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
4709
+ const { model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = app;
4710
+ const options = { name, view, model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
4693
4711
 
4694
4712
  app = component(options);
4695
4713
  }
4696
4714
 
4697
4715
  const wrapped = state.withState(app, 'STATE');
4698
4716
 
4699
- const baseDrivers = {
4717
+ const baseDrivers = useDefaultDrivers ? {
4700
4718
  EVENTS: eventBusDriver,
4701
4719
  DOM: dom.makeDOMDriver(mountPoint, { snabbdomOptions: { experimental: { fragments } } }),
4702
4720
  LOG: logDriver
4703
- };
4721
+ } : {};
4704
4722
 
4705
4723
  const combinedDrivers = { ...baseDrivers, ...drivers };
4706
4724
 
4707
- return run$1.run(wrapped, combinedDrivers)
4725
+ const { sources, sinks, run: _run } = run$1.setup(wrapped, combinedDrivers);
4726
+ const dispose = _run();
4727
+
4728
+ const exposed = { sources, sinks, dispose };
4729
+
4730
+ const hmr = (newComponent) => {
4731
+ exposed.sinks.STATE.shamefullySendNext((state) => {
4732
+ window.__SYGNAL_HMR_UPDATING = true;
4733
+ exposed.dispose();
4734
+ const App = newComponent.default;
4735
+ App.initialState = state;
4736
+ const updated = run(App, drivers);
4737
+ exposed.sources = updated.sources;
4738
+ exposed.sinks = updated.sinks;
4739
+ exposed.dispose = updated.dispose;
4740
+ updated.sinks.STATE.shamefullySendNext(() => {
4741
+ return { ...state }
4742
+ });
4743
+ updated.sources.STATE.stream.setDebugListener({
4744
+ next: () => {
4745
+ exposed.sources.STATE.stream.setDebugListener(null);
4746
+ setTimeout(() => {
4747
+ window.__SYGNAL_HMR_UPDATING = false;
4748
+ }, 100);
4749
+ }
4750
+ });
4751
+ return ABORT
4752
+ });
4753
+ };
4754
+
4755
+ exposed.hmr = hmr;
4756
+
4757
+ return exposed
4708
4758
  }
4709
4759
 
4710
4760
  /**
@@ -5073,7 +5123,7 @@ sampleCombine = function sampleCombine() {
5073
5123
  var _default = sampleCombine$1.default = sampleCombine;
5074
5124
 
5075
5125
  exports.xs = xs$1;
5076
- exports.ABORT = ABORT;
5126
+ exports.ABORT = ABORT$1;
5077
5127
  exports.classes = classes;
5078
5128
  exports.collection = collection;
5079
5129
  exports.component = component;
package/dist/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import isolate from '@cycle/isolate';
2
2
  import { makeCollection, StateSource, withState } from '@cycle/state';
3
3
  import xs$1, { Stream as Stream$1 } from 'xstream';
4
4
  export { default as xs } from 'xstream';
5
- import { run as run$1 } from '@cycle/run';
5
+ import { setup } from '@cycle/run';
6
6
  import { makeDOMDriver } from '@cycle/dom';
7
7
  export * from '@cycle/dom';
8
8
 
@@ -3154,7 +3154,7 @@ const CHILD_SOURCE_NAME = 'CHILD';
3154
3154
  let COMPONENT_COUNT = 0;
3155
3155
 
3156
3156
 
3157
- const ABORT = '~#~#~ABORT~#~#~';
3157
+ const ABORT$1 = '~#~#~ABORT~#~#~';
3158
3158
 
3159
3159
  function component (opts) {
3160
3160
  const { name, sources, isolateOpts, stateSourceName='STATE' } = opts;
@@ -3239,13 +3239,14 @@ class Component {
3239
3239
  // [ OUTPUT ]
3240
3240
  // sinks
3241
3241
 
3242
- constructor({ name='NO NAME', sources, intent, model, context, response, view, peers={}, components={}, initialState, calculated, storeCalculatedInState=true, DOMSourceName='DOM', stateSourceName='STATE', requestSourceName='HTTP', debug=false }) {
3242
+ constructor({ name='NO NAME', sources, intent, model, hmrActions, context, response, view, peers={}, components={}, initialState, calculated, storeCalculatedInState=true, DOMSourceName='DOM', stateSourceName='STATE', requestSourceName='HTTP', debug=false }) {
3243
3243
  if (!sources || !isObj(sources)) throw new Error('Missing or invalid sources')
3244
3244
 
3245
3245
  this.name = name;
3246
3246
  this.sources = sources;
3247
3247
  this.intent = intent;
3248
3248
  this.model = model;
3249
+ this.hmrActions = hmrActions;
3249
3250
  this.context = context;
3250
3251
  this.response = response;
3251
3252
  this.view = view;
@@ -3306,6 +3307,7 @@ class Component {
3306
3307
 
3307
3308
  this.initChildSources$();
3308
3309
  this.initIntent$();
3310
+ this.initHmrActions();
3309
3311
  this.initAction$();
3310
3312
  this.initState();
3311
3313
  this.initContext();
@@ -3340,6 +3342,23 @@ class Component {
3340
3342
  }
3341
3343
  }
3342
3344
 
3345
+ initHmrActions() {
3346
+ if (typeof this.hmrActions === 'undefined') {
3347
+ this.hmrAction$ = xs$1.of().filter(_ => false);
3348
+ return
3349
+ }
3350
+ if (typeof this.hmrActions === 'string') {
3351
+ this.hmrActions = [this.hmrActions];
3352
+ }
3353
+ if (!Array.isArray(this.hmrActions)) {
3354
+ throw new Error(`[${ this.name }] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`)
3355
+ }
3356
+ if (this.hmrActions.some(action => typeof action !== 'string')) {
3357
+ throw new Error(`[${ this.name }] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`)
3358
+ }
3359
+ this.hmrAction$ = xs$1.fromArray(this.hmrActions.map(action => ({ type: action })));
3360
+ }
3361
+
3343
3362
  initAction$() {
3344
3363
  const requestSource = (this.sources && this.sources[this.requestSourceName]) || null;
3345
3364
 
@@ -3359,11 +3378,12 @@ class Component {
3359
3378
 
3360
3379
  const action$ = ((runner instanceof Stream$1) ? runner : (runner.apply && runner(this.sources) || xs$1.never()));
3361
3380
  const bootstrap$ = xs$1.of({ type: BOOTSTRAP_ACTION }).compose(_default$4(10));
3362
- const wrapped$ = this.model[BOOTSTRAP_ACTION] ? _default$3(bootstrap$, action$) : action$;
3381
+ const hmrAction$ = window?.__SYGNAL_HMR_UPDATING === true ? this.hmrAction$ : xs$1.of().filter(_ => false);
3382
+ const wrapped$ = (this.model[BOOTSTRAP_ACTION] && window?.__SYGNAL_HMR_UPDATING !== true) ? _default$3(bootstrap$, action$) : _default$3(xs$1.of().compose(_default$4(1)).filter(_ => false), hmrAction$, action$);
3363
3383
 
3364
3384
 
3365
3385
  let initialApiData;
3366
- if (requestSource && typeof requestSource.select == 'function') {
3386
+ if (window?.__SYGNAL_HMR_UPDATING !== true && requestSource && typeof requestSource.select == 'function') {
3367
3387
  initialApiData = requestSource.select('initial')
3368
3388
  .flatten();
3369
3389
  } else {
@@ -3377,12 +3397,12 @@ class Component {
3377
3397
  }
3378
3398
 
3379
3399
  initState() {
3380
- if (this.model != undefined) {
3400
+ if (this.model !== undefined) {
3381
3401
  if (this.model[INITIALIZE_ACTION] === undefined) {
3382
3402
  this.model[INITIALIZE_ACTION] = {
3383
3403
  [this.stateSourceName]: (_, data) => ({ ...this.addCalculated(data) })
3384
3404
  };
3385
- } else {
3405
+ } else if (isObj(this.model[INITIALIZE_ACTION])) {
3386
3406
  Object.keys(this.model[INITIALIZE_ACTION]).forEach(name => {
3387
3407
  if (name !== this.stateSourceName) {
3388
3408
  console.warn(`${ INITIALIZE_ACTION } can only be used with the ${ this.stateSourceName } source... disregarding ${ name }`);
@@ -3448,7 +3468,7 @@ class Component {
3448
3468
  if (this.isSubComponent && this.initialState) {
3449
3469
  console.warn(`[${ this.name }] Initial state provided to sub-component. This will overwrite any state provided by the parent component.`);
3450
3470
  }
3451
- const shimmed$ = this.initialState ? _default$3(xs$1.of(initial), this.action$).compose(_default$4(0)) : this.action$;
3471
+ const shimmed$ = (this.initialState && window?.__SYGNAL_HMR_UPDATING !== true) ? _default$3(xs$1.of(initial), this.action$).compose(_default$4(0)) : this.action$;
3452
3472
  const onState = () => this.makeOnAction(shimmed$, true, this.action$);
3453
3473
  const onNormal = () => this.makeOnAction(this.action$, false, this.action$);
3454
3474
 
@@ -3542,8 +3562,6 @@ class Component {
3542
3562
  }
3543
3563
  }).map(sources => xs$1.merge(...sources)).flatten();
3544
3564
 
3545
- // childSources$.subscribe({ next: _ => _})
3546
-
3547
3565
  this.sources[CHILD_SOURCE_NAME] = {
3548
3566
  select: (name) => {
3549
3567
  const all$ = childSources$;
@@ -3643,7 +3661,7 @@ class Component {
3643
3661
  const _state = this.isSubComponent ? this.currentState : state;
3644
3662
  const enhancedState = this.addCalculated(_state);
3645
3663
  const newState = reducer(enhancedState, data, next, extra);
3646
- if (newState == ABORT) return _state
3664
+ if (newState == ABORT$1) return _state
3647
3665
  return this.cleanupCalculated(newState)
3648
3666
  }
3649
3667
  } else {
@@ -3657,7 +3675,7 @@ class Component {
3657
3675
  }
3658
3676
  throw new Error(`Invalid reducer type for ${ name } ${ type }`)
3659
3677
  }
3660
- }).filter(result => result != ABORT);
3678
+ }).filter(result => result != ABORT$1);
3661
3679
  } else if (reducer === undefined || reducer === true) {
3662
3680
  returnStream$ = filtered$.map(({data}) => data);
3663
3681
  } else {
@@ -3916,8 +3934,8 @@ class Component {
3916
3934
  } else {
3917
3935
  const name = collectionOf.componentName || collectionOf.label || collectionOf.name || 'FUNCTION_COMPONENT';
3918
3936
  const view = collectionOf;
3919
- const { model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = collectionOf;
3920
- const options = { name, view, model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
3937
+ const { model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = collectionOf;
3938
+ const options = { name, view, model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
3921
3939
  factory = component(options);
3922
3940
  }
3923
3941
  } else if (this.components[collectionOf]) {
@@ -4068,8 +4086,8 @@ class Component {
4068
4086
  if (!current.isSygnalComponent) {
4069
4087
  const name = current.componentName || current.label || current.name || 'FUNCTION_COMPONENT';
4070
4088
  const view = current;
4071
- const { model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = current;
4072
- const options = { name, view, model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
4089
+ const { model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = current;
4090
+ const options = { name, view, model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
4073
4091
  switchableComponents[key] = component(options);
4074
4092
  }
4075
4093
  });
@@ -4684,27 +4702,59 @@ function logDriver(out$) {
4684
4702
  }
4685
4703
 
4686
4704
  function run(app, drivers={}, options={}) {
4687
- const { mountPoint='#root', fragments=true } = options;
4705
+ const { mountPoint='#root', fragments=true, useDefaultDrivers=true } = options;
4688
4706
  if (!app.isSygnalComponent) {
4689
4707
  const name = app.name || app.componentName || app.label || "FUNCTIONAL_COMPONENT";
4690
4708
  const view = app;
4691
- const { model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = app;
4692
- const options = { name, view, model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
4709
+ const { model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = app;
4710
+ const options = { name, view, model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
4693
4711
 
4694
4712
  app = component(options);
4695
4713
  }
4696
4714
 
4697
4715
  const wrapped = withState(app, 'STATE');
4698
4716
 
4699
- const baseDrivers = {
4717
+ const baseDrivers = useDefaultDrivers ? {
4700
4718
  EVENTS: eventBusDriver,
4701
4719
  DOM: makeDOMDriver(mountPoint, { snabbdomOptions: { experimental: { fragments } } }),
4702
4720
  LOG: logDriver
4703
- };
4721
+ } : {};
4704
4722
 
4705
4723
  const combinedDrivers = { ...baseDrivers, ...drivers };
4706
4724
 
4707
- return run$1(wrapped, combinedDrivers)
4725
+ const { sources, sinks, run: _run } = setup(wrapped, combinedDrivers);
4726
+ const dispose = _run();
4727
+
4728
+ const exposed = { sources, sinks, dispose };
4729
+
4730
+ const hmr = (newComponent) => {
4731
+ exposed.sinks.STATE.shamefullySendNext((state) => {
4732
+ window.__SYGNAL_HMR_UPDATING = true;
4733
+ exposed.dispose();
4734
+ const App = newComponent.default;
4735
+ App.initialState = state;
4736
+ const updated = run(App, drivers);
4737
+ exposed.sources = updated.sources;
4738
+ exposed.sinks = updated.sinks;
4739
+ exposed.dispose = updated.dispose;
4740
+ updated.sinks.STATE.shamefullySendNext(() => {
4741
+ return { ...state }
4742
+ });
4743
+ updated.sources.STATE.stream.setDebugListener({
4744
+ next: () => {
4745
+ exposed.sources.STATE.stream.setDebugListener(null);
4746
+ setTimeout(() => {
4747
+ window.__SYGNAL_HMR_UPDATING = false;
4748
+ }, 100);
4749
+ }
4750
+ });
4751
+ return ABORT
4752
+ });
4753
+ };
4754
+
4755
+ exposed.hmr = hmr;
4756
+
4757
+ return exposed
4708
4758
  }
4709
4759
 
4710
4760
  /**
@@ -5072,4 +5122,4 @@ sampleCombine = function sampleCombine() {
5072
5122
  };
5073
5123
  var _default = sampleCombine$1.default = sampleCombine;
5074
5124
 
5075
- export { ABORT, classes, collection, component, _default$2 as debounce, _default$4 as delay, driverFromAsync, _default$5 as dropRepeats, processForm, run, _default as sampleCombine, switchable, _default$1 as throttle };
5125
+ export { ABORT$1 as ABORT, classes, collection, component, _default$2 as debounce, _default$4 as delay, driverFromAsync, _default$5 as dropRepeats, processForm, run, _default as sampleCombine, switchable, _default$1 as throttle };
package/dist/jsx.cjs.js CHANGED
@@ -158,8 +158,8 @@ const createElementWithModules = (modules) => {
158
158
  if (!sel.isSygnalComponent) {
159
159
  const name = sel.componentName || sel.label || sel.name || 'FUNCTION_COMPONENT';
160
160
  const view = sel;
161
- const { model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = sel;
162
- const options = { name, view, model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
161
+ const { model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = sel;
162
+ const options = { name, view, model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
163
163
  data.sygnalOptions = options;
164
164
  sel = name;
165
165
  } else {
package/dist/jsx.esm.js CHANGED
@@ -156,8 +156,8 @@ const createElementWithModules = (modules) => {
156
156
  if (!sel.isSygnalComponent) {
157
157
  const name = sel.componentName || sel.label || sel.name || 'FUNCTION_COMPONENT';
158
158
  const view = sel;
159
- const { model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = sel;
160
- const options = { name, view, model, intent, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
159
+ const { model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug } = sel;
160
+ const options = { name, view, model, intent, hmrActions, context, peers, components, initialState, calculated, storeCalculatedInState, DOMSourceName, stateSourceName, debug };
161
161
  data.sygnalOptions = options;
162
162
  sel = name;
163
163
  } else {
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Sygnal={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var e,n=t.Symbol;if("function"==typeof n)if(n.observable)e=n.observable;else{e=n.for("https://github.com/benlesh/symbol-observable");try{n.observable=e}catch(t){}}else e="@@observable";return e}}(r);var o,i,s=r,a=Object.prototype.toString,c=function(t){var e=a.call(t),n="[object Arguments]"===e;return n||(n="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===a.call(t.callee)),n};var u=Array.prototype.slice,l=c,p=Object.keys,f=p?function(t){return p(t)}:function(){if(i)return o;var t;if(i=1,!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=c,s=Object.prototype.propertyIsEnumerable,a=!s.call({toString:null},"toString"),u=s.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],p=function(t){var e=t.constructor;return e&&e.prototype===t},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!f["$"+t]&&e.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{p(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();t=function(t){var o=null!==t&&"object"==typeof t,i="[object Function]"===n.call(t),s=r(t),c=o&&"[object String]"===n.call(t),f=[];if(!o&&!i&&!s)throw new TypeError("Object.keys called on a non-object");var d=u&&i;if(c&&t.length>0&&!e.call(t,0))for(var y=0;y<t.length;++y)f.push(String(y));if(s&&t.length>0)for(var m=0;m<t.length;++m)f.push(String(m));else for(var v in t)d&&"prototype"===v||!e.call(t,v)||f.push(String(v));if(a)for(var g=function(t){if("undefined"==typeof window||!h)return p(t);try{return p(t)}catch(t){return!1}}(t),b=0;b<l.length;++b)g&&"constructor"===l[b]||!e.call(t,l[b])||f.push(l[b]);return f}}return o=t}(),h=Object.keys;f.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return l(t)?h(u.call(t)):h(t)})}else Object.keys=f;return Object.keys||f};var d,y=f,m="undefined"!=typeof Symbol&&Symbol,v=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),n=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0},g={foo:{}},b=Object,_=Array.prototype.slice,w=Object.prototype.toString,S=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==w.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var n,r=_.call(arguments,1),o=Math.max(0,e.length-r.length),i=[],s=0;s<o;s++)i.push("$"+s);if(n=Function("binder","return function ("+i.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var o=e.apply(this,r.concat(_.call(arguments)));return Object(o)===o?o:this}return e.apply(t,r.concat(_.call(arguments)))})),e.prototype){var a=function(){};a.prototype=e.prototype,n.prototype=new a,a.prototype=null}return n},A=Function.prototype.bind||S,O=A.call(Function.call,Object.prototype.hasOwnProperty),E=SyntaxError,C=Function,$=TypeError,N=function(t){try{return C('"use strict"; return ('+t+").constructor;")()}catch(t){}},j=Object.getOwnPropertyDescriptor;if(j)try{j({},"")}catch(t){j=null}var x=function(){throw new $},k=j?function(){try{return x}catch(t){try{return j(arguments,"callee").get}catch(t){return x}}}():x,P="function"==typeof m&&"function"==typeof Symbol&&"symbol"==typeof m("foo")&&"symbol"==typeof Symbol("bar")&&v(),M={__proto__:g}.foo===g.foo&&!({__proto__:null}instanceof b),T=Object.getPrototypeOf||(M?function(t){return t.__proto__}:null),I={},D="undefined"!=typeof Uint8Array&&T?T(Uint8Array):d,L={"%AggregateError%":"undefined"==typeof AggregateError?d:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?d:ArrayBuffer,"%ArrayIteratorPrototype%":P&&T?T([][Symbol.iterator]()):d,"%AsyncFromSyncIteratorPrototype%":d,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%Atomics%":"undefined"==typeof Atomics?d:Atomics,"%BigInt%":"undefined"==typeof BigInt?d:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?d:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?d:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?d:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?d:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?d:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?d:FinalizationRegistry,"%Function%":C,"%GeneratorFunction%":I,"%Int8Array%":"undefined"==typeof Int8Array?d:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?d:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?d:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":P&&T?T(T([][Symbol.iterator]())):d,"%JSON%":"object"==typeof JSON?JSON:d,"%Map%":"undefined"==typeof Map?d:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&P&&T?T((new Map)[Symbol.iterator]()):d,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?d:Promise,"%Proxy%":"undefined"==typeof Proxy?d:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?d:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?d:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&P&&T?T((new Set)[Symbol.iterator]()):d,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?d:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":P&&T?T(""[Symbol.iterator]()):d,"%Symbol%":P?Symbol:d,"%SyntaxError%":E,"%ThrowTypeError%":k,"%TypedArray%":D,"%TypeError%":$,"%Uint8Array%":"undefined"==typeof Uint8Array?d:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?d:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?d:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?d:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?d:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?d:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?d:WeakSet};if(T)try{null.error}catch(t){var F=T(T(t));L["%Error.prototype%"]=F}var B=function t(e){var n;if("%AsyncFunction%"===e)n=N("async function () {}");else if("%GeneratorFunction%"===e)n=N("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=N("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var o=t("%AsyncGenerator%");o&&T&&(n=T(o.prototype))}return L[e]=n,n},R={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},U=A,W=O,G=U.call(Function.call,Array.prototype.concat),q=U.call(Function.apply,Array.prototype.splice),V=U.call(Function.call,String.prototype.replace),z=U.call(Function.call,String.prototype.slice),H=U.call(Function.call,RegExp.prototype.exec),J=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Y=/\\(\\)?/g,X=function(t,e){var n,r=t;if(W(R,r)&&(r="%"+(n=R[r])[0]+"%"),W(L,r)){var o=L[r];if(o===I&&(o=B(r)),void 0===o&&!e)throw new $("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:o}}throw new E("intrinsic "+t+" does not exist!")},Z=function(t,e){if("string"!=typeof t||0===t.length)throw new $("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new $('"allowMissing" argument must be a boolean');if(null===H(/^%?[^%]*%?$/,t))throw new E("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(t){var e=z(t,0,1),n=z(t,-1);if("%"===e&&"%"!==n)throw new E("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new E("invalid intrinsic syntax, expected opening `%`");var r=[];return V(t,J,(function(t,e,n,o){r[r.length]=n?V(o,Y,"$1"):e||t})),r}(t),r=n.length>0?n[0]:"",o=X("%"+r+"%",e),i=o.name,s=o.value,a=!1,c=o.alias;c&&(r=c[0],q(n,G([0,1],c)));for(var u=1,l=!0;u<n.length;u+=1){var p=n[u],f=z(p,0,1),h=z(p,-1);if(('"'===f||"'"===f||"`"===f||'"'===h||"'"===h||"`"===h)&&f!==h)throw new E("property names with quotes must have matching quotes");if("constructor"!==p&&l||(a=!0),W(L,i="%"+(r+="."+p)+"%"))s=L[i];else if(null!=s){if(!(p in s)){if(!e)throw new $("base intrinsic for "+t+" exists, but the property is not available.");return}if(j&&u+1>=n.length){var d=j(s,p);s=(l=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:s[p]}else l=W(s,p),s=s[p];l&&!a&&(L[i]=s)}}return s},K=Z("%Object.defineProperty%",!0),Q=function(){if(K)try{return K({},"a",{value:1}),!0}catch(t){return!1}return!1};Q.hasArrayLengthDefineBug=function(){if(!Q())return null;try{return 1!==K([],"length",{value:1}).length}catch(t){return!0}};var tt=Q,et=y,nt="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),rt=Object.prototype.toString,ot=Array.prototype.concat,it=Object.defineProperty,st=tt(),at=it&&st,ct=function(t,e,n,r){if(e in t)if(!0===r){if(t[e]===n)return}else if("function"!=typeof(o=r)||"[object Function]"!==rt.call(o)||!r())return;var o;at?it(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n},ut=function(t,e){var n=arguments.length>2?arguments[2]:{},r=et(e);nt&&(r=ot.call(r,Object.getOwnPropertySymbols(e)));for(var o=0;o<r.length;o+=1)ct(t,r[o],e[r[o]],n[r[o]])};ut.supportsDescriptors=!!at;var lt=e,pt=function(){return"object"==typeof e&&e&&e.Math===Math&&e.Array===Array?e:lt},ft=ut,ht=pt,dt=ut,yt=e,mt=pt,vt=function(){var t=ht();if(ft.supportsDescriptors){var e=Object.getOwnPropertyDescriptor(t,"globalThis");e&&(!e.configurable||!e.enumerable&&e.writable&&globalThis===t)||Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else"object"==typeof globalThis&&globalThis===t||(t.globalThis=t);return t},gt=mt(),bt=function(){return gt};dt(bt,{getPolyfill:mt,implementation:yt,shim:vt});var _t,wt=bt,St=e&&e.__extends||(_t=function(t,e){return _t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},_t(t,e)},function(t,e){function n(){this.constructor=t}_t(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0}),n.NO_IL=n.NO=n.MemoryStream=ee=n.Stream=void 0;var At=s.default(wt.getPolyfill()),Ot={},Et=n.NO=Ot;function Ct(){}function $t(t){for(var e=t.length,n=Array(e),r=0;r<e;++r)n[r]=t[r];return n}function Nt(t,e,n){try{return t.f(e)}catch(t){return n._e(t),Ot}}var jt={_n:Ct,_e:Ct,_c:Ct};function xt(t){t._start=function(t){t.next=t._n,t.error=t._e,t.complete=t._c,this.start(t)},t._stop=t.stop}n.NO_IL=jt;var kt=function(){function t(t,e){this._stream=t,this._listener=e}return t.prototype.unsubscribe=function(){this._stream._remove(this._listener)},t}(),Pt=function(){function t(t){this._listener=t}return t.prototype.next=function(t){this._listener._n(t)},t.prototype.error=function(t){this._listener._e(t)},t.prototype.complete=function(){this._listener._c()},t}(),Mt=function(){function t(t){this.type="fromObservable",this.ins=t,this.active=!1}return t.prototype._start=function(t){this.out=t,this.active=!0,this._sub=this.ins.subscribe(new Pt(t)),this.active||this._sub.unsubscribe()},t.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},t}(),Tt=function(){function t(t){this.type="merge",this.insArr=t,this.out=Ot,this.ac=0}return t.prototype._start=function(t){this.out=t;var e=this.insArr,n=e.length;this.ac=n;for(var r=0;r<n;r++)e[r]._add(this)},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=0;n<e;n++)t[n]._remove(this);this.out=Ot},t.prototype._n=function(t){var e=this.out;e!==Ot&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){if(--this.ac<=0){var t=this.out;if(t===Ot)return;t._c()}},t}(),It=function(){function t(t,e,n){this.i=t,this.out=e,this.p=n,n.ils.push(this)}return t.prototype._n=function(t){var e=this.p,n=this.out;if(n!==Ot&&e.up(t,this.i)){var r=$t(e.vals);n._n(r)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.p;t.out!==Ot&&0==--t.Nc&&t.out._c()},t}(),Dt=function(){function t(t){this.type="combine",this.insArr=t,this.out=Ot,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return t.prototype.up=function(t,e){var n=this.vals[e],r=this.Nn?n===Ot?--this.Nn:this.Nn:0;return this.vals[e]=t,0===r},t.prototype._start=function(t){this.out=t;var e=this.insArr,n=this.Nc=this.Nn=e.length,r=this.vals=new Array(n);if(0===n)t._n([]),t._c();else for(var o=0;o<n;o++)r[o]=Ot,e[o]._add(new It(o,t,this))},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=this.ils,r=0;r<e;r++)t[r]._remove(n[r]);this.out=Ot,this.ils=[],this.vals=[]},t}(),Lt=function(){function t(t){this.type="fromArray",this.a=t}return t.prototype._start=function(t){for(var e=this.a,n=0,r=e.length;n<r;n++)t._n(e[n]);t._c()},t.prototype._stop=function(){},t}(),Ft=function(){function t(t){this.type="fromPromise",this.on=!1,this.p=t}return t.prototype._start=function(t){var e=this;this.on=!0,this.p.then((function(n){e.on&&(t._n(n),t._c())}),(function(e){t._e(e)})).then(Ct,(function(t){setTimeout((function(){throw t}))}))},t.prototype._stop=function(){this.on=!1},t}(),Bt=function(){function t(t){this.type="periodic",this.period=t,this.intervalID=-1,this.i=0}return t.prototype._start=function(t){var e=this;this.intervalID=setInterval((function(){t._n(e.i++)}),this.period)},t.prototype._stop=function(){-1!==this.intervalID&&clearInterval(this.intervalID),this.intervalID=-1,this.i=0},t}(),Rt=function(){function t(t,e){this.type="debug",this.ins=t,this.out=Ot,this.s=Ct,this.l="","string"==typeof e?this.l=e:"function"==typeof e&&(this.s=e)}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=this.s,r=this.l;if(n!==Ct)try{n(t)}catch(t){e._e(t)}else r?console.log(r+":",t):console.log(t);e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Ut=function(){function t(t,e){this.type="drop",this.ins=e,this.out=Ot,this.max=t,this.dropped=0}return t.prototype._start=function(t){this.out=t,this.dropped=0,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;e!==Ot&&this.dropped++>=this.max&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Wt=function(){function t(t,e){this.out=t,this.op=e}return t.prototype._n=function(){this.op.end()},t.prototype._e=function(t){this.out._e(t)},t.prototype._c=function(){this.op.end()},t}(),Gt=function(){function t(t,e){this.type="endWhen",this.ins=e,this.out=Ot,this.o=t,this.oil=jt}return t.prototype._start=function(t){this.out=t,this.o._add(this.oil=new Wt(t,this)),this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.o._remove(this.oil),this.out=Ot,this.oil=jt},t.prototype.end=function(){var t=this.out;t!==Ot&&t._c()},t.prototype._n=function(t){var e=this.out;e!==Ot&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){this.end()},t}(),qt=function(){function t(t,e){this.type="filter",this.ins=e,this.out=Ot,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=Nt(this,t,e);n!==Ot&&n&&e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Vt=function(){function t(t,e){this.out=t,this.op=e}return t.prototype._n=function(t){this.out._n(t)},t.prototype._e=function(t){this.out._e(t)},t.prototype._c=function(){this.op.inner=Ot,this.op.less()},t}(),zt=function(){function t(t){this.type="flatten",this.ins=t,this.out=Ot,this.open=!0,this.inner=Ot,this.il=jt}return t.prototype._start=function(t){this.out=t,this.open=!0,this.inner=Ot,this.il=jt,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.inner!==Ot&&this.inner._remove(this.il),this.out=Ot,this.open=!0,this.inner=Ot,this.il=jt},t.prototype.less=function(){var t=this.out;t!==Ot&&(this.open||this.inner!==Ot||t._c())},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=this.inner,r=this.il;n!==Ot&&r!==jt&&n._remove(r),(this.inner=t)._add(this.il=new Vt(e,this))}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){this.open=!1,this.less()},t}(),Ht=function(){function t(t,e,n){var r=this;this.type="fold",this.ins=n,this.out=Ot,this.f=function(e){return t(r.acc,e)},this.acc=this.seed=e}return t.prototype._start=function(t){this.out=t,this.acc=this.seed,t._n(this.acc),this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot,this.acc=this.seed},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=Nt(this,t,e);n!==Ot&&e._n(this.acc=n)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Jt=function(){function t(t){this.type="last",this.ins=t,this.out=Ot,this.has=!1,this.val=Ot}return t.prototype._start=function(t){this.out=t,this.has=!1,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot,this.val=Ot},t.prototype._n=function(t){this.has=!0,this.val=t},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&(this.has?(t._n(this.val),t._c()):t._e(new Error("last() failed because input stream completed")))},t}(),Yt=function(){function t(t,e){this.type="map",this.ins=e,this.out=Ot,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=Nt(this,t,e);n!==Ot&&e._n(n)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Xt=function(){function t(t){this.type="remember",this.ins=t,this.out=Ot}return t.prototype._start=function(t){this.out=t,this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=Ot},t}(),Zt=function(){function t(t,e){this.type="replaceError",this.ins=e,this.out=Ot,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;e!==Ot&&e._n(t)},t.prototype._e=function(t){var e=this.out;if(e!==Ot)try{this.ins._remove(this),(this.ins=this.f(t))._add(this)}catch(t){e._e(t)}},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Kt=function(){function t(t,e){this.type="startWith",this.ins=t,this.out=Ot,this.val=e}return t.prototype._start=function(t){this.out=t,this.out._n(this.val),this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=Ot},t}(),Qt=function(){function t(t,e){this.type="take",this.ins=e,this.out=Ot,this.max=t,this.taken=0}return t.prototype._start=function(t){this.out=t,this.taken=0,this.max<=0?t._c():this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=++this.taken;n<this.max?e._n(t):n===this.max&&(e._n(t),e._c())}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),te=function(){function t(t){this._prod=t||Ot,this._ils=[],this._stopID=Ot,this._dl=Ot,this._d=!1,this._target=null,this._err=Ot}return t.prototype._n=function(t){var e=this._ils,n=e.length;if(this._d&&this._dl._n(t),1==n)e[0]._n(t);else{if(0==n)return;for(var r=$t(e),o=0;o<n;o++)r[o]._n(t)}},t.prototype._e=function(t){if(this._err===Ot){this._err=t;var e=this._ils,n=e.length;if(this._x(),this._d&&this._dl._e(t),1==n)e[0]._e(t);else{if(0==n)return;for(var r=$t(e),o=0;o<n;o++)r[o]._e(t)}if(!this._d&&0==n)throw this._err}},t.prototype._c=function(){var t=this._ils,e=t.length;if(this._x(),this._d&&this._dl._c(),1==e)t[0]._c();else{if(0==e)return;for(var n=$t(t),r=0;r<e;r++)n[r]._c()}},t.prototype._x=function(){0!==this._ils.length&&(this._prod!==Ot&&this._prod._stop(),this._err=Ot,this._ils=[])},t.prototype._stopNow=function(){this._prod._stop(),this._err=Ot,this._stopID=Ot},t.prototype._add=function(t){var e=this._target;if(e)return e._add(t);var n=this._ils;if(n.push(t),!(n.length>1))if(this._stopID!==Ot)clearTimeout(this._stopID),this._stopID=Ot;else{var r=this._prod;r!==Ot&&r._start(this)}},t.prototype._remove=function(t){var e=this,n=this._target;if(n)return n._remove(t);var r=this._ils,o=r.indexOf(t);o>-1&&(r.splice(o,1),this._prod!==Ot&&r.length<=0?(this._err=Ot,this._stopID=setTimeout((function(){return e._stopNow()}))):1===r.length&&this._pruneCycles())},t.prototype._pruneCycles=function(){this._hasNoSinks(this,[])&&this._remove(this._ils[0])},t.prototype._hasNoSinks=function(t,e){if(-1!==e.indexOf(t))return!0;if(t.out===this)return!0;if(t.out&&t.out!==Ot)return this._hasNoSinks(t.out,e.concat(t));if(t._ils){for(var n=0,r=t._ils.length;n<r;n++)if(!this._hasNoSinks(t._ils[n],e.concat(t)))return!1;return!0}return!1},t.prototype.ctor=function(){return this instanceof ne?ne:t},t.prototype.addListener=function(t){t._n=t.next||Ct,t._e=t.error||Ct,t._c=t.complete||Ct,this._add(t)},t.prototype.removeListener=function(t){this._remove(t)},t.prototype.subscribe=function(t){return this.addListener(t),new kt(this,t)},t.prototype[At]=function(){return this},t.create=function(e){if(e){if("function"!=typeof e.start||"function"!=typeof e.stop)throw new Error("producer requires both start and stop functions");xt(e)}return new t(e)},t.createWithMemory=function(t){return t&&xt(t),new ne(t)},t.never=function(){return new t({_start:Ct,_stop:Ct})},t.empty=function(){return new t({_start:function(t){t._c()},_stop:Ct})},t.throw=function(e){return new t({_start:function(t){t._e(e)},_stop:Ct})},t.from=function(e){if("function"==typeof e[At])return t.fromObservable(e);if("function"==typeof e.then)return t.fromPromise(e);if(Array.isArray(e))return t.fromArray(e);throw new TypeError("Type of input to from() must be an Array, Promise, or Observable")},t.of=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.fromArray(e)},t.fromArray=function(e){return new t(new Lt(e))},t.fromPromise=function(e){return new t(new Ft(e))},t.fromObservable=function(e){if(void 0!==e.endWhen)return e;var n="function"==typeof e[At]?e[At]():e;return new t(new Mt(n))},t.periodic=function(e){return new t(new Bt(e))},t.prototype._map=function(t){return new(this.ctor())(new Yt(t,this))},t.prototype.map=function(t){return this._map(t)},t.prototype.mapTo=function(t){var e=this.map((function(){return t}));return e._prod.type="mapTo",e},t.prototype.filter=function(e){var n,r,o=this._prod;return new t(o instanceof qt?new qt((n=o.f,r=e,function(t){return n(t)&&r(t)}),o.ins):new qt(e,this))},t.prototype.take=function(t){return new(this.ctor())(new Qt(t,this))},t.prototype.drop=function(e){return new t(new Ut(e,this))},t.prototype.last=function(){return new t(new Jt(this))},t.prototype.startWith=function(t){return new ne(new Kt(this,t))},t.prototype.endWhen=function(t){return new(this.ctor())(new Gt(t,this))},t.prototype.fold=function(t,e){return new ne(new Ht(t,e,this))},t.prototype.replaceError=function(t){return new(this.ctor())(new Zt(t,this))},t.prototype.flatten=function(){return new t(new zt(this))},t.prototype.compose=function(t){return t(this)},t.prototype.remember=function(){return new ne(new Xt(this))},t.prototype.debug=function(t){return new(this.ctor())(new Rt(this,t))},t.prototype.imitate=function(t){if(t instanceof ne)throw new Error("A MemoryStream was given to imitate(), but it only supports a Stream. Read more about this restriction here: https://github.com/staltz/xstream#faq");this._target=t;for(var e=this._ils,n=e.length,r=0;r<n;r++)t._add(e[r]);this._ils=[]},t.prototype.shamefullySendNext=function(t){this._n(t)},t.prototype.shamefullySendError=function(t){this._e(t)},t.prototype.shamefullySendComplete=function(){this._c()},t.prototype.setDebugListener=function(t){t?(this._d=!0,t._n=t.next||Ct,t._e=t.error||Ct,t._c=t.complete||Ct,this._dl=t):(this._d=!1,this._dl=Ot)},t.merge=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Tt(e))},t.combine=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Dt(e))},t}(),ee=n.Stream=te,ne=function(t){function e(e){var n=t.call(this,e)||this;return n._has=!1,n}return St(e,t),e.prototype._n=function(e){this._v=e,this._has=!0,t.prototype._n.call(this,e)},e.prototype._add=function(t){var e=this._target;if(e)return e._add(t);var n=this._ils;if(n.push(t),n.length>1)this._has&&t._n(this._v);else if(this._stopID!==Ot)this._has&&t._n(this._v),clearTimeout(this._stopID),this._stopID=Ot;else if(this._has)t._n(this._v);else{var r=this._prod;r!==Ot&&r._start(this)}},e.prototype._stopNow=function(){this._has=!1,t.prototype._stopNow.call(this)},e.prototype._x=function(){this._has=!1,t.prototype._x.call(this)},e.prototype.map=function(t){return this._map(t)},e.prototype.mapTo=function(e){return t.prototype.mapTo.call(this,e)},e.prototype.take=function(e){return t.prototype.take.call(this,e)},e.prototype.endWhen=function(e){return t.prototype.endWhen.call(this,e)},e.prototype.replaceError=function(e){return t.prototype.replaceError.call(this,e)},e.prototype.remember=function(){return this},e.prototype.debug=function(e){return t.prototype.debug.call(this,e)},e}(te);n.MemoryStream=ne;var re=te,oe=n.default=re,ie={};function se(){var t;return(t="undefined"!=typeof window?window:void 0!==e?e:this).Cyclejs=t.Cyclejs||{},(t=t.Cyclejs).adaptStream=t.adaptStream||function(t){return t},t}Object.defineProperty(ie,"__esModule",{value:!0}),ie.setAdapt=function(t){se().adaptStream=t};var ae=ie.adapt=function(t){return se().adaptStream(t)};var ce=0;function ue(){return"cycle"+ ++ce}function le(t,e){void 0===e&&(e=ue()),function(t,e){if("function"!=typeof t)throw new Error("First argument given to isolate() must be a 'dataflowComponent' function");if(null===e)throw new Error("Second argument given to isolate() must not be null")}(t,e);var n="object"==typeof e?ue():"",r="string"==typeof e||"object"==typeof e?e:e.toString();return function(e){for(var o=[],i=1;i<arguments.length;i++)o[i-1]=arguments[i];var s=function(t,e,n){var r={};return Object.keys(t).forEach((function(t){if("string"!=typeof e){var o=e[t];if(void 0===o){var i=e["*"];r[t]=void 0===i?n:i}else r[t]=o}else r[t]=e})),r}(e,r,n),a=function(t,e){var n={};for(var r in t){var o=t[r];t.hasOwnProperty(r)&&o&&null!==e[r]&&"function"==typeof o.isolateSource?n[r]=o.isolateSource(o,e[r]):t.hasOwnProperty(r)&&(n[r]=t[r])}return n}(e,s),c=function(t,e,n){var r={};for(var o in e){var i=t[o],s=e[o];e.hasOwnProperty(o)&&i&&null!==n[o]&&"function"==typeof i.isolateSink?r[o]=ae(i.isolateSink(oe.fromObservable(s),n[o])):e.hasOwnProperty(o)&&(r[o]=e[o])}return r}(e,t.apply(void 0,[a].concat(o)),s);return c}}le.reset=function(){return ce=0};var pe={};Object.defineProperty(pe,"__esModule",{value:!0}),pe.DropRepeatsOperator=void 0;var fe=n,he={},de=function(){function t(t,e){this.ins=t,this.type="dropRepeats",this.out=null,this.v=he,this.isEq=e||function(t,e){return t===e}}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.v=he},t.prototype._n=function(t){var e=this.out;if(e){var n=this.v;n!==he&&this.isEq(t,n)||(this.v=t,e._n(t))}},t.prototype._e=function(t){var e=this.out;e&&e._e(t)},t.prototype._c=function(){var t=this.out;t&&t._c()},t}();pe.DropRepeatsOperator=de;var ye=pe.default=function(t){return void 0===t&&(t=void 0),function(e){return new fe.Stream(new de(e,t))}},me=function(){return me=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},me.apply(this,arguments)};function ve(t){return"string"==typeof t||"number"==typeof t?function(e){return void 0===e?void 0:e[t]}:t.get}function ge(t){return"string"==typeof t||"number"==typeof t?function(e,n){var r,o;return Array.isArray(e)?function(t,e,n){if(n===t[e])return t;var r=parseInt(e);return void 0===n?t.filter((function(t,e){return e!==r})):t.map((function(t,e){return e===r?n:t}))}(e,t,n):void 0===e?((r={})[t]=n,r):me({},e,((o={})[t]=n,o))}:t.set}function be(t,e){return t.select(e)}function _e(t,e){var n=ve(e),r=ge(e);return t.map((function(t){return function(e){var o=n(e),i=t(o);return o===i?e:r(e,i)}}))}var we=function(){function t(t,e){this.isolateSource=be,this.isolateSink=_e,this._stream=t.filter((function(t){return void 0!==t})).compose(ye()).remember(),this._name=e,this.stream=ae(this._stream),this._stream._isCycleSource=e}return t.prototype.select=function(e){var n=ve(e);return new t(this._stream.map(n),this._name)},t}(),Se=function(){function t(t,e,n){this.ins=n,this.out=t,this.p=e}return t.prototype._n=function(t){this.p;var e=this.out;null!==e&&e._n(t)},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){},t}(),Ae=function(){function t(t,e){this.type="pickMerge",this.ins=e,this.out=null,this.sel=t,this.ils=new Map,this.inst=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this);var t=this.ils;t.forEach((function(e,n){e.ins._remove(e),e.ins=null,e.out=null,t.delete(n)})),t.clear(),this.out=null,this.ils=new Map,this.inst=null},t.prototype._n=function(t){this.inst=t;for(var e=t.arr,n=this.ils,r=this.out,o=this.sel,i=e.length,s=0;s<i;++s){var a=e[s],c=a._key,u=oe.fromObservable(a[o]||oe.never());n.has(c)||(n.set(c,new Se(r,this,u)),u._add(n.get(c)))}n.forEach((function(e,r){t.dict.has(r)&&t.dict.get(r)||(e.ins._remove(e),e.ins=null,e.out=null,n.delete(r))}))},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){var t=this.out;null!==t&&t._c()},t}();var Oe=function(){function t(t,e,n,r){this.key=t,this.out=e,this.p=n,this.val=Et,this.ins=r}return t.prototype._n=function(t){this.p;var e=this.out;this.val=t,null!==e&&this.p.up()},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){},t}(),Ee=function(){function t(t,e){this.type="combine",this.ins=e,this.sel=t,this.out=null,this.ils=new Map,this.inst=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this);var t=this.ils;t.forEach((function(t){t.ins._remove(t),t.ins=null,t.out=null,t.val=null})),t.clear(),this.out=null,this.ils=new Map,this.inst=null},t.prototype.up=function(){for(var t=this.inst.arr,e=t.length,n=this.ils,r=Array(e),o=0;o<e;++o){var i=t[o]._key;if(!n.has(i))return;var s=n.get(i).val;if(s===Et)return;r[o]=s}this.out._n(r)},t.prototype._n=function(t){this.inst=t;var e=t.arr,n=this.ils,r=this.out,o=this.sel,i=t.dict,s=e.length,a=!1;if(n.forEach((function(t,e){i.has(e)||(t.ins._remove(t),t.ins=null,t.out=null,t.val=null,n.delete(e),a=!0)})),0!==s){for(var c=0;c<s;++c){var u=e[c],l=u._key;if(!u[o])throw new Error("pickCombine found an undefined child sink stream");var p=oe.fromObservable(u[o]);n.has(l)||(n.set(l,new Oe(l,r,this,p)),p._add(n.get(l)))}a&&this.up()}else r._n([])},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){var t=this.out;null!==t&&t._c()},t}();var Ce=function(){return Ce=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ce.apply(this,arguments)},$e=function(){function t(t){this._instances$=t}return t.prototype.pickMerge=function(t){return ae(this._instances$.compose(function(t){return function(e){return new ee(new Ae(t,e))}}(t)))},t.prototype.pickCombine=function(t){return ae(this._instances$.compose(function(t){return function(e){return new ee(new Ee(t,e))}}(t)))},t}();function Ne(t){return{"*":null}}function je(t,e){return{get:function(n){if(void 0!==n)for(var r=0,o=n.length;r<o;++r)if(""+t(n[r],r)===e)return n[r]},set:function(n,r){return void 0===n?[r]:void 0===r?n.filter((function(n,r){return""+t(n,r)!==e})):n.map((function(n,o){return""+t(n,o)===e?r:n}))}}}var xe={get:function(t){return t},set:function(t,e){return e}};var ke={};Object.defineProperty(ke,"__esModule",{value:!0});var Pe=n,Me=function(){function t(t){this.streams=t,this.type="concat",this.out=null,this.i=0}return t.prototype._start=function(t){this.out=t,this.streams[this.i]._add(this)},t.prototype._stop=function(){var t=this.streams;this.i<t.length&&t[this.i]._remove(this),this.i=0,this.out=null},t.prototype._n=function(t){var e=this.out;e&&e._n(t)},t.prototype._e=function(t){var e=this.out;e&&e._e(t)},t.prototype._c=function(){var t=this.out;if(t){var e=this.streams;e[this.i]._remove(this),++this.i<e.length?e[this.i]._add(this):t._c()}},t}();var Te=ke.default=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Pe.Stream(new Me(t))},Ie={};Object.defineProperty(Ie,"__esModule",{value:!0});var De=Ie.default=function(){return"undefined"!=typeof queueMicrotask?queueMicrotask:"undefined"!=typeof setImmediate?setImmediate:"undefined"!=typeof process?process.nextTick:setTimeout},Le=De();function Fe(t,e,n={}){const{combineList:r=["DOM"],globalList:o=["EVENTS"],stateSourceName:i="STATE",domSourceName:s="DOM",container:a="div",containerClass:c}=n;return n=>{const u=Date.now(),l={item:t,itemKey:(t,e)=>void 0!==t.id?t.id:e,itemScope:t=>t,channel:i,collectSinks:t=>Object.entries(n).reduce(((e,[n,o])=>{if(r.includes(n)){const r=t.pickCombine(n);n===s&&a?e[s]=r.map((t=>({sel:a,data:c?{props:{className:c}}:{},children:t,key:u,text:void 0,elm:void 0}))):e[n]=r}else e[n]=t.pickMerge(n);return e}),{})},p={[i]:e};return o.forEach((t=>p[t]=null)),r.forEach((t=>p[t]=null)),function(t,e,n){return le(function(t){return function(e){var n=t.channel||"state",r=t.itemKey,o=t.itemScope||Ne,i=oe.fromObservable(e[n].stream).fold((function(i,s){var a,c,u,l,p,f=i.dict;if(Array.isArray(s)){for(var h=Array(s.length),d=new Set,y=0,m=s.length;y<m;++y){var v=""+(r?r(s[y],y):y);if(d.add(v),f.has(v))h[y]=f.get(v);else{var g=r?je(r,v):""+y,b="string"==typeof(p=o(v))?((a={"*":p})[n]=g,a):Ce({},p,((c={})[n]=g,c)),_=le(t.itemFactory?t.itemFactory(s[y],y):t.item,b)(e);f.set(v,_),h[y]=_}h[y]._key=v}return f.forEach((function(t,e){d.has(e)||f.delete(e)})),d.clear(),{dict:f,arr:h}}return f.clear(),v=""+(r?r(s,0):"this"),g=xe,b="string"==typeof(p=o(v))?((u={"*":p})[n]=g,u):Ce({},p,((l={})[n]=g,l)),_=le(t.itemFactory?t.itemFactory(s,0):t.item,b)(e),f.set(v,_),{dict:f,arr:[_]}}),{dict:new Map,arr:[]});return t.collectSinks(new $e(i))}}(t),e)(n)}(l,p,n)}}function Be(t,e,n,r={}){const{switched:o=["DOM"],stateSourceName:i="STATE"}=r,s=typeof e;if(!e)throw new Error("Missing 'name$' parameter for switchable()");if(!("string"===s||"function"===s||e instanceof ee))throw new Error("Invalid 'name$' parameter for switchable(): expects Stream, String, or Function");if(e instanceof ee){const r=e.compose(ye()).startWith(n).remember();return e=>Re(t,e,r,o)}{const r="function"===s&&e||(t=>t[e]);return e=>{const s=e&&("string"==typeof i&&e[i]||e.STATE||e.state).stream;if(!s instanceof ee)throw new Error(`Could not find the state source: ${i}`);const a=s.map(r).filter((t=>"string"==typeof t)).compose(ye()).startWith(n).remember();return Re(t,e,a,o,i)}}}function Re(t,e,n,r=["DOM"],o="STATE"){"string"==typeof r&&(r=[r]);const i=Object.entries(t).map((([t,r])=>{if(e[o]){const i=e[o].stream,s=oe.combine(n,i).filter((([e,n])=>e==t)).map((([t,e])=>e)).remember(),a=new e[o].constructor(s,e[o]._name);return[t,r({...e,state:a})]}return[t,r(e)]}));return Object.keys(e).reduce(((t,e)=>{if(r.includes(e))t[e]=n.map((t=>{const n=i.find((([e,n])=>e===t));return n&&n[1][e]||oe.never()})).flatten().remember().startWith(void 0);else{const n=i.filter((([t,n])=>void 0!==n[e])).map((([t,n])=>n[e]));t[e]=oe.merge(...n)}return t}),{})}var Ue={};Object.defineProperty(Ue,"__esModule",{value:!0});var We=n,Ge=function(){function t(t,e){this.dt=t,this.ins=e,this.type="delay",this.out=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null},t.prototype._n=function(t){var e=this.out;if(e)var n=setInterval((function(){e._n(t),clearInterval(n)}),this.dt)},t.prototype._e=function(t){var e=this.out;if(e)var n=setInterval((function(){e._e(t),clearInterval(n)}),this.dt)},t.prototype._c=function(){var t=this.out;if(t)var e=setInterval((function(){t._c(),clearInterval(e)}),this.dt)},t}();var qe=Ue.default=function(t){return function(e){return new We.Stream(new Ge(t,e))}},Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});var ze=n,He=function(){function t(t,e){this.dt=t,this.ins=e,this.type="debounce",this.out=null,this.id=null,this.t=ze.NO}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.clearInterval()},t.prototype.clearInterval=function(){var t=this.id;null!==t&&clearInterval(t),this.id=null},t.prototype._n=function(t){var e=this,n=this.out;n&&(this.clearInterval(),this.t=t,this.id=setInterval((function(){e.clearInterval(),n._n(t),e.t=ze.NO}),this.dt))},t.prototype._e=function(t){var e=this.out;e&&(this.clearInterval(),e._e(t))},t.prototype._c=function(){var t=this.out;t&&(this.clearInterval(),this.t!=ze.NO&&t._n(this.t),this.t=ze.NO,t._c())},t}();var Je=Ve.default=function(t){return function(e){return new ze.Stream(new He(t,e))}};const Ye="undefined"!=typeof window&&window||process&&process.env||{},Xe="BOOTSTRAP",Ze="INITIALIZE",Ke="PARENT";let Qe=0;const tn="~#~#~ABORT~#~#~";function en(t){const{name:e,sources:n,isolateOpts:r,stateSourceName:o="STATE"}=t;if(n&&!ln(n))throw new Error("Sources must be a Cycle.js sources object:",e);let i;i="string"==typeof r?{[o]:r}:!0===r?{}:r;const s=void 0===n;let a;if(ln(i)){const e=e=>{const n={...t,sources:e};return new nn(n).sinks};a=s?le(e,i):le(e,i)(n)}else a=s?e=>new nn({...t,sources:e}).sinks:new nn(t).sinks;return a.componentName=e,a.isSygnalComponent=!0,a}class nn{constructor({name:t="NO NAME",sources:e,intent:n,model:r,context:o,response:i,view:s,peers:a={},components:c={},initialState:u,calculated:l,storeCalculatedInState:p=!0,DOMSourceName:f="DOM",stateSourceName:h="STATE",requestSourceName:d="HTTP",debug:y=!1}){if(!e||!ln(e))throw new Error("Missing or invalid sources");this.name=t,this.sources=e,this.intent=n,this.model=r,this.context=o,this.response=i,this.view=s,this.peers=a,this.components=c,this.initialState=u,this.calculated=l,this.storeCalculatedInState=p,this.DOMSourceName=f,this.stateSourceName=h,this.requestSourceName=d,this.sourceNames=Object.keys(e),this._debug=y,this.isSubComponent=this.sourceNames.includes("props$");const m=e[h]&&e[h].stream;m&&(this.currentState=u||{},this.sources[h]=new we(m.map((t=>(this.currentState=t,t)))));const v=e.props$;v&&(this.sources.props$=v.map((t=>(this.currentProps=t,t))));const g=e.children$;g&&(this.sources.children$=g.map((t=>(this.currentChildren=t,t)))),this.isSubComponent||void 0!==this.intent||void 0!==this.model||(this.initialState=u||!0,this.intent=t=>({__NOOP_ACTION__:oe.never()}),this.model={__NOOP_ACTION__:t=>t});const b=Qe++;this.addCalculated=this.createMemoizedAddCalculated(),this.log=function(t){return function(e,n=!1){const r="function"==typeof e?e:t=>e;return n?void(this.debug&&console.log(`[${t}] ${r(e)}`)):e=>e.debug((e=>{this.debug&&console.log(`[${t}] ${r(e)}`)}))}}(`${b} | ${t}`),this.initChildSources$(),this.initIntent$(),this.initAction$(),this.initState(),this.initContext(),this.initModel$(),this.initPeers$(),this.initSubComponentSink$(),this.initSubComponentsRendered$(),this.initVdom$(),this.initSinks(),this.sinks.__index=b,this.log("Instantiated",!0)}get debug(){return this._debug||"true"===Ye.SYGNAL_DEBUG||!0===Ye.SYGNAL_DEBUG}initIntent$(){if(this.intent){if("function"!=typeof this.intent)throw new Error("Intent must be a function");if(this.intent$=this.intent(this.sources),!(this.intent$ instanceof ee||ln(this.intent$)))throw new Error("Intent must return either an action$ stream or map of event streams")}}initAction$(){const t=this.sources&&this.sources[this.requestSourceName]||null;if(!this.intent$)return void(this.action$=oe.never());let e;if(this.intent$ instanceof ee)e=this.intent$;else{const t=Object.entries(this.intent$).map((([t,e])=>e.map((e=>({type:t,data:e})))));e=oe.merge(oe.never(),...t)}const n=e instanceof ee?e:e.apply&&e(this.sources)||oe.never(),r=oe.of({type:Xe}).compose(qe(10)),o=this.model[Xe]?Te(r,n):n;let i;i=t&&"function"==typeof t.select?t.select("initial").flatten():oe.never();const s=i.map((t=>({type:"HYDRATE",data:t})));this.action$=oe.merge(o,s).compose(this.log((({type:t})=>`<${t}> Action triggered`)))}initState(){null!=this.model&&(void 0===this.model[Ze]?this.model[Ze]={[this.stateSourceName]:(t,e)=>({...this.addCalculated(e)})}:Object.keys(this.model[Ze]).forEach((t=>{t!==this.stateSourceName&&(console.warn(`${Ze} can only be used with the ${this.stateSourceName} source... disregarding ${t}`),delete this.model[Ze][t])})))}initContext(){if(!this.context&&!this.sources.__parentContext$)return void(this.context$=oe.of({}));const t=this.sources[this.stateSourceName]?.stream.startWith({}).compose(ye(un))||oe.never(),e=this.sources.__parentContext$.startWith({}).compose(ye(un))||oe.of({});this.context&&!ln(this.context)&&console.error(`[${this.name}] Context must be an object mapping names to values of functions: ignoring provided ${typeof this.context}`),this.context$=oe.combine(t,e).map((([t,e])=>{const n=ln(e)?e:{},r=ln(this.context)?this.context:{},o=this.currentState,i={...n,...Object.entries(r).reduce(((t,e)=>{const[n,r]=e;let i;const s=typeof r;if("string"===s)i=o[r];else if("boolean"===s)i=o[n];else{if("function"!==s)return console.error(`[${this.name}] Invalid context entry '${n}': must be the name of a state property or a function returning a value to use`),t;i=r(o)}return t[n]=i,t}),{})};return this.currentContext=i,i})).compose(ye(un)).startWith({}),this.context$.subscribe({next:t=>t})}initModel$(){if(void 0===this.model)return void(this.model$=this.sourceNames.reduce(((t,e)=>(t[e]=oe.never(),t)),{}));const t={type:Ze,data:this.initialState};this.isSubComponent&&this.initialState&&console.warn(`[${this.name}] Initial state provided to sub-component. This will overwrite any state provided by the parent component.`);const e=this.initialState?Te(oe.of(t),this.action$).compose(qe(0)):this.action$,n=()=>this.makeOnAction(e,!0,this.action$),r=()=>this.makeOnAction(this.action$,!1,this.action$),o=Object.entries(this.model),i={};o.forEach((t=>{let[e,o]=t;if("function"==typeof o&&(o={[this.stateSourceName]:o}),!ln(o))throw new Error(`Entry for each action must be an object: ${this.name} ${e}`);Object.entries(o).forEach((t=>{const[o,s]=t,a=o===this.stateSourceName,c=o===Ke,u=a?n():r(),l=(c?u(e,s).map((t=>({name:this.name,value:t}))):u(e,s)).compose(this.log((t=>{if(a)return`<${e}> State reducer added`;if(c)return`<${e}> Data sent to parent component: ${JSON.stringify(t.value).replaceAll('"',"")}`;{const n=t&&(t.type||t.command||t.name||t.key||Array.isArray(t)&&"Array"||t);return`<${e}> Data sent to [${o}]: ${JSON.stringify(n).replaceAll('"',"")}`}})));Array.isArray(i[o])?i[o].push(l):i[o]=[l]}))}));const s=Object.entries(i).reduce(((t,e)=>{const[n,r]=e;return t[n]=oe.merge(oe.never(),...r),t}),{});this.model$=s}initPeers$(){const t=this.sourceNames.reduce(((t,e)=>(e==this.DOMSourceName?t[e]={}:t[e]=[],t)),{});this.peers$=Object.entries(this.peers).reduce(((t,[e,n])=>{const r=n(this.sources);return this.sourceNames.forEach((n=>{n==this.DOMSourceName?t[n][e]=r[n]:t[n].push(r[n])})),t}),t)}initChildSources$(){let t;const e=oe.create({start:e=>{t=e.next.bind(e)},stop:t=>{}}).map((t=>oe.merge(...t))).flatten();this.sources.CHILD={select:t=>{const n=e;return(t?n.filter((e=>e.name===t)):n).map((t=>t.value))}},this.newChildSources=e=>{"function"==typeof t&&t(e)}}initSubComponentSink$(){const t=oe.create({start:t=>{this.newSubComponentSinks=t.next.bind(t)},stop:t=>{}});t.subscribe({next:t=>t}),this.subComponentSink$=t.filter((t=>Object.keys(t).length>0))}initSubComponentsRendered$(){const t=oe.create({start:t=>{this.triggerSubComponentsRendered=t.next.bind(t)},stop:t=>{}});this.subComponentsRendered$=t.startWith(null)}initVdom$(){if("function"!=typeof this.view)return void(this.vdom$=oe.of(null));const t=this.collectRenderParameters();this.vdom$=t.map(this.view).compose(this.log("View rendered")).map((t=>t||{sel:"div",data:{},children:[]})).compose(this.instantiateSubComponents.bind(this)).filter((t=>void 0!==t)).compose(this.renderVdom.bind(this))}initSinks(){this.sinks=this.sourceNames.reduce(((t,e)=>{if(e==this.DOMSourceName)return t;const n=this.subComponentSink$&&e!==Ke?this.subComponentSink$.map((t=>t[e])).filter((t=>!!t)).flatten():oe.never();return e===this.stateSourceName?t[e]=oe.merge(this.model$[e]||oe.never(),n,this.sources[this.stateSourceName].stream.filter((t=>!1)),...this.peers$[e]||[]):t[e]=oe.merge(this.model$[e]||oe.never(),n,...this.peers$[e]||[]),t}),{}),this.sinks[this.DOMSourceName]=this.vdom$,this.sinks[Ke]=this.model$[Ke]||oe.never()}makeOnAction(t,e=!0,n){return n=n||t,(r,o)=>{const i=t.filter((({type:t})=>t==r));let s;if("function"==typeof o)s=i.map((t=>{const i=(t,e,o=10)=>{if("number"!=typeof o)throw new Error(`[${this.name} ] Invalid delay value provided to next() function in model action '${r}'. Must be a number in ms.`);setTimeout((()=>{n.shamefullySendNext({type:t,data:e})}),o),this.log(`<${r}> Triggered a next() action: <${t}> ${o}ms delay`,!0)},s={props:this.currentProps,children:this.currentChildren,context:this.currentContext};let a=t.data;if(e)return t=>{const e=this.isSubComponent?this.currentState:t,n=this.addCalculated(e),r=o(n,a,i,s);return r==tn?e:this.cleanupCalculated(r)};{const t=this.addCalculated(this.currentState),e=o(t,a,i,s),n=typeof e;if(ln(e)||["string","number","boolean","function"].includes(n))return e;if("undefined"==n)return console.warn(`'undefined' value sent to ${r}`),e;throw new Error(`Invalid reducer type for ${r} ${n}`)}})).filter((t=>t!=tn));else if(void 0===o||!0===o)s=i.map((({data:t})=>t));else{const t=o;s=i.mapTo(t)}return s}}createMemoizedAddCalculated(){let t,e;return function(n){if(!this.calculated||!ln(n)||Array.isArray(n))return n;if(n===t)return e;if(!ln(this.calculated))throw new Error("'calculated' parameter must be an object mapping calculated state field named to functions");const r=this.getCalculatedValues(n);if(!r)return t=n,e=n,n;const o={...n,...r};return t=n,e=o,o}}getCalculatedValues(t){const e=Object.entries(this.calculated||{});if(0!==e.length)return e.reduce(((e,[n,r])=>{if("function"!=typeof r)throw new Error(`Missing or invalid calculator function for calculated field '${n}`);try{e[n]=r(t)}catch(t){console.warn(`Calculated field '${n}' threw an error during calculation: ${t.message}`)}return e}),{})}cleanupCalculated(t){if(!t||!ln(t)||Array.isArray(t))return t;const e={...this.storeCalculatedInState?this.addCalculated(t):t};if(!this.calculated||this.storeCalculatedInState)return e;return Object.keys(this.calculated).forEach((t=>{this.initialState&&void 0!==this.initialState[t]?e[t]=this.initialState[t]:delete e[t]})),e}collectRenderParameters(){const t=this.sources[this.stateSourceName],e={...this.peers$[this.DOMSourceName]},n=t&&t.isolateSource(t,{get:t=>this.addCalculated(t)}),r=n&&n.stream||oe.never();e.state=r.compose(ye(un)),this.sources.props$&&(e.props=this.sources.props$.compose(ye(cn))),this.sources.children$&&(e.children=this.sources.children$.compose(ye(un))),this.context$&&(e.context=this.context$.compose(ye(un)));const o=[],i=[];Object.entries(e).forEach((([t,e])=>{o.push(t),i.push(e)}));return oe.combine(...i).compose(Je(1)).map((t=>o.reduce(((e,n,r)=>(e[n]=t[r],"state"===n&&(e[this.stateSourceName]=t[r],e.calculated=t[r]&&this.getCalculatedValues(t[r])||{}),e)),{})))}instantiateSubComponents(t){return t.fold(((t,e)=>{const n=rn(e,Object.keys(this.components)),r=Object.entries(n),o={"::ROOT::":e};if(0===r.length)return o;const i={},s=[];let a=0;const c=r.reduce(((e,[n,r])=>{const o=r.data,c=o.props||{},u=r.children||[],l=o.isCollection||!1,p=o.isSwitchable||!1,f=t=>{Object.entries(t).forEach((([t,e])=>{i[t]||=[],t===Ke?s.push(e):t!==this.DOMSourceName&&i[t].push(e)}))};if(t[n]){const r=t[n];return e[n]=r,r.props$.shamefullySendNext(c),r.children$.shamefullySendNext(u),f(r.sink$),e}const h=oe.create().startWith(c),d=oe.create().startWith(u);let y;y=l?this.instantiateCollection.bind(this):p?this.instantiateSwitchable.bind(this):this.instantiateCustomComponent.bind(this),a++;const m=y(r,h,d);return m[this.DOMSourceName]=m[this.DOMSourceName]?this.makeCoordinatedSubComponentDomSink(m[this.DOMSourceName]):oe.never(),e[n]={sink$:m,props$:h,children$:d},f(m),e}),o),u=Object.entries(i).reduce(((t,[e,n])=>(0===n.length||(t[e]=1===n.length?n[0]:oe.merge(...n)),t)),{});return this.newSubComponentSinks(u),this.newChildSources(s),a>0&&this.log(`New sub components instantiated: ${a}`,!0),c}),{})}makeCoordinatedSubComponentDomSink(t){const e=t.remember();return this.sources[this.stateSourceName].stream.compose(ye(un)).map((t=>e)).flatten().debug((t=>this.triggerSubComponentsRendered())).remember()}instantiateCollection(t,e,n){const r=t.data.props||{};const o={filter:"function"==typeof r.filter?r.filter:void 0,sort:hn(r.sort)},i=oe.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState),e.startWith(r)).compose(Je(1)).map((([t,e])=>(e.filter!==o.filter&&(o.filter="function"==typeof e.filter?e.filter:void 0),e.sort!==o.sort&&(o.sort=hn(e.sort)),ln(t)?this.addCalculated(t):t))),s=new we(i),a=r.from,c=r.of,u=r.idfield||"id";let l,p;if("function"==typeof c)if(c.isSygnalComponent)p=c;else{const t=c.componentName||c.label||c.name||"FUNCTION_COMPONENT",e=c,{model:n,intent:r,context:o,peers:i,components:s,initialState:a,calculated:u,storeCalculatedInState:l,DOMSourceName:f,stateSourceName:h,debug:d}=c;p=en({name:t,view:e,model:n,intent:r,context:o,peers:i,components:s,initialState:a,calculated:u,storeCalculatedInState:l,DOMSourceName:f,stateSourceName:h,debug:d})}else{if(!this.components[c])throw new Error(`[${this.name}] Invalid 'of' propery in collection: ${c}`);p=this.components[c]}const f={get:t=>{if(!Array.isArray(t[a]))return[];const e=t[a],n="function"==typeof o.filter?e.filter(o.filter):e;return(o.sort,n.sort(o.sort)).map(((t,e)=>ln(t)?{...t,[u]:t[u]||e}:{value:t,[u]:e}))},set:(t,e)=>{if(this.calculated&&a in this.calculated)return console.warn(`Collection sub-component of ${this.name} attempted to update state on a calculated field '${a}': Update ignored`),t;const n=[];for(const r of t[a].map(((t,e)=>ln(t)?{...t,[u]:t[u]||e}:{__primitive:!0,value:t,[u]:e})))if("function"!=typeof o.filter||o.filter(r)){const t=e.find((t=>t[u]===r[u]));void 0!==t&&n.push(r.__primitive?t.value:t)}else n.push(r.__primitive?r.value:r);return{...t,[a]:n}}};void 0===a?l={get:t=>!(t instanceof Array)&&t.value&&t.value instanceof Array?t.value:t,set:(t,e)=>e}:"string"==typeof a?ln(this.currentState)?this.currentState&&a in this.currentState||this.calculated&&a in this.calculated?(Array.isArray(this.currentState[a])||console.warn(`State property '${a}' in collection comopnent of ${this.name} is not an array: No components will be instantiated in the collection.`),l=f):(console.error(`Collection component in ${this.name} is attempting to use non-existent state property '${a}': To fix this error, specify a valid array property on the state. Attempting to use parent component state.`),l=void 0):(Array.isArray(this.currentState[a])||console.warn(`State property '${a}' in collection component of ${this.name} is not an array: No components will be instantiated in the collection.`),l=f):ln(a)?"function"!=typeof a.get?(console.error(`Collection component in ${this.name} has an invalid 'from' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting child state from the current state. Attempting to use parent component state.`),l=void 0):l={get:t=>{const e=a.get(t);return Array.isArray(e)?e:(console.warn(`State getter function in collection component of ${this.name} did not return an array: No components will be instantiated in the collection. Returned value:`,e),[])},set:a.set}:(console.error(`Collection component in ${this.name} has an invalid 'from' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting child state from the current state. Attempting to use parent component state.`),l=void 0);const h={...this.sources,[this.stateSourceName]:s,props$:e,children$:n,__parentContext$:this.context$,PARENT:null},d=Fe(p,l,{container:null})(h);if(!ln(d))throw new Error("Invalid sinks returned from component factory of collection element");return d}instantiateSwitchable(t,e,n){const r=t.data.props||{},o=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>ln(t)?this.addCalculated(t):t)),i=new we(o),s=r.state;let a;const c={get:t=>t,set:(t,e)=>e};void 0===s?a=c:"string"==typeof s?a={get:t=>t[s],set:(t,e)=>this.calculated&&s in this.calculated?(console.warn(`Switchable sub-component of ${this.name} attempted to update state on a calculated field '${s}': Update ignored`),t):!ln(e)||Array.isArray(e)?{...t,[s]:e}:{...t,[s]:e}}:ln(s)?"function"!=typeof s.get?(console.error(`Switchable component in ${this.name} has an invalid 'state' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting sub-component state from the current state. Attempting to use parent component state.`),a=c):a={get:s.get,set:s.set}:(console.error(`Invalid state provided to switchable sub-component of ${this.name}: Expecting string, object, or undefined, but found ${typeof s}. Attempting to use parent component state.`),a=c);const u=r.of;Object.keys(u).forEach((t=>{const e=u[t];if(!e.isSygnalComponent){const n=e.componentName||e.label||e.name||"FUNCTION_COMPONENT",r=e,{model:o,intent:i,context:s,peers:a,components:c,initialState:l,calculated:p,storeCalculatedInState:f,DOMSourceName:h,stateSourceName:d,debug:y}=e,m={name:n,view:r,model:o,intent:i,context:s,peers:a,components:c,initialState:l,calculated:p,storeCalculatedInState:f,DOMSourceName:h,stateSourceName:d,debug:y};u[t]=en(m)}}));const l={...this.sources,[this.stateSourceName]:i,props$:e,children$:n,__parentContext$:this.context$},p=le(Be(u,e.map((t=>t.current))),{[this.stateSourceName]:a})(l);if(!ln(p))throw new Error("Invalid sinks returned from component factory of switchable element");return p}instantiateCustomComponent(t,e,n){const r=t.sel,o=t.data.props||{},i=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>ln(t)?this.addCalculated(t):t)),s=new we(i),a=o.state;"function"!=typeof o.sygnalFactory&&ln(o.sygnalOptions)&&(o.sygnalFactory=en(o.sygnalOptions));const c="sygnal-factory"===r?o.sygnalFactory:this.components[r]||o.sygnalFactory;if(!c){if("sygnal-factory"===r)throw new Error("Component not found on element with Capitalized selector and nameless function: JSX transpilation replaces selectors starting with upper case letters with functions in-scope with the same name, Sygnal cannot see the name of the resulting component.");throw new Error(`Component not found: ${r}`)}let u;const l={get:t=>t,set:(t,e)=>e};void 0===a?u=l:"string"==typeof a?u={get:t=>t[a],set:(t,e)=>this.calculated&&a in this.calculated?(console.warn(`Sub-component of ${this.name} attempted to update state on a calculated field '${a}': Update ignored`),t):{...t,[a]:e}}:ln(a)?"function"!=typeof a.get?(console.error(`Sub-component in ${this.name} has an invalid 'state' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting sub-component state from the current state. Attempting to use parent component state.`),u=l):u={get:a.get,set:a.set}:(console.error(`Invalid state provided to sub-component of ${this.name}: Expecting string, object, or undefined, but found ${typeof a}. Attempting to use parent component state.`),u=l);const p={...this.sources,[this.stateSourceName]:s,props$:e,children$:n,__parentContext$:this.context$},f=le(c,{[this.stateSourceName]:u})(p);if(!ln(f)){throw new Error("Invalid sinks returned from component factory:","sygnal-factory"===r?"custom element":r)}return f}renderVdom(t){return oe.combine(this.subComponentsRendered$,t).compose(Je(1)).map((([t,e])=>{const n=Object.keys(this.components),r=e["::ROOT::"],o=Object.entries(e).filter((([t])=>"::ROOT::"!==t));if(0===o.length)return oe.of(r);const i=[],s=o.map((([t,e])=>(i.push(t),e.sink$[this.DOMSourceName].startWith(void 0))));return 0===s.length?oe.of(r):oe.combine(...s).compose(Je(1)).map((t=>{const e=t.reduce(((t,e,n)=>(t[i[n]]=e,t)),{});return on(an(r),e,n)}))})).flatten().filter((t=>!!t)).remember()}}function rn(t,e,n=0,r=0,o){if(!t)return{};if(t.data?.componentsProcessed)return{};0===n&&(t.data.componentsProcessed=!0);const i=t.sel,s=i&&"collection"===i.toLowerCase(),a=i&&"switchable"===i.toLowerCase(),c=i&&["collection","switchable","sygnal-factory",...e].includes(i)||"function"==typeof t.data?.props?.sygnalFactory||ln(t.data?.props?.sygnalOptions),u=t.data&&t.data.props||{};t.data&&t.data.attrs;const l=t.children||[];let p={},f=o;if(c){if(f=sn(t,n,r,o),s){if(!u.of)throw new Error("Collection element missing required 'component' property");if("string"!=typeof u.of&&"function"!=typeof u.of)throw new Error(`Invalid 'component' property of collection element: found ${typeof u.of} requires string or component factory function`);if("function"!=typeof u.of&&!e.includes(u.of))throw new Error(`Specified component for collection not found: ${u.of}`);void 0===u.from||"string"==typeof u.from||Array.isArray(u.from)||"function"==typeof u.from.get||console.warn(`No valid array found for collection ${"string"==typeof u.of?u.of:"function component"}: no collection components will be created`,u.from),t.data.isCollection=!0,t.data.props||={}}else if(a){if(!u.of)throw new Error("Switchable element missing required 'of' property");if(!ln(u.of))throw new Error(`Invalid 'of' property of switchable element: found ${typeof u.of} requires object mapping names to component factories`);if(!Object.values(u.of).every((t=>"function"==typeof t)))throw new Error("One or more components provided to switchable element is not a valid component factory");if(!u.current||"string"!=typeof u.current&&"function"!=typeof u.current)throw new Error(`Missing or invalid 'current' property for switchable element: found '${typeof u.current}' requires string or function`);if(!Object.keys(u.of).includes(u.current))throw new Error(`Component '${u.current}' not found in switchable element`);t.data.isSwitchable=!0}void 0===u.key&&(t.data.props.key=f),p[f]=t}return l.length>0&&l.map(((t,o)=>rn(t,e,n+1,r+o,f))).forEach((t=>{Object.entries(t).forEach((([t,e])=>p[t]=e))})),p}function on(t,e,n,r=0,o=0,i){if(!t)return;if(t.data?.componentsInjected)return t;0===r&&t.data&&(t.data.componentsInjected=!0);const s=t.sel||"NO SELECTOR",a=["collection","switchable","sygnal-factory",...n].includes(s)||"function"==typeof t.data?.props?.sygnalFactory||ln(t.data?.props?.sygnalOptions),c=t?.data?.isCollection;t.data&&t.data.props;const u=t.children||[];let l=i;if(a){l=sn(t,r,o,i);const n=e[l];return c?(t.sel="div",t.children=Array.isArray(n)?n:[n],t):n}return u.length>0?(t.children=u.map(((t,i)=>on(t,e,n,r+1,o+i,l))).flat(),t):t}function sn(t,e,n,r){const o=t.sel,i="string"==typeof o?o:"functionComponent",s=`${e}:${n}`,a=t.data?.props||{};return`${r?`${r}|`:""}${i}::${a.id&&JSON.stringify(a.id).replaceAll('"',"")||s}`}function an(t){return void 0===t?t:{...t,children:Array.isArray(t.children)?t.children.map(an):void 0,data:t.data&&{...t.data,componentsInjected:!1}}}function cn(t,e){return un(function(t){if(!ln(t))return t;const{state:e,of:n,from:r,filter:o,...i}=t;return i}(t))}function un(t,e,n=5,r=0){if(r>n)return!1;if(t===e)return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(!un(t[o],e[o],n,r+1))return!1;return!0}const o=Object.keys(t),i=Object.keys(e);if(o.length!==i.length)return!1;for(const s of o){if(!i.includes(s))return!1;if(!un(t[s],e[s],n,r+1))return!1}return!0}function ln(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function pn(t,e,n=!0){const r=n?1:-1;switch(!0){case t>e:return 1*r;case t<e:return-1*r;default:return 0}}function fn(t){const e=Object.entries(t);if(e.length>1)return void console.error("Sort objects can only have one key:",t);const n=e[0],[r,o]=n;if(!["string","number"].includes(typeof o))return void console.error("Sort object properties must be a string or number:",t);let i=!0;if("string"==typeof o){if(!["asc","dec"].includes(o.toLowerCase()))return void console.error("Sort object string values must be asc or dec:",t);i="asc"===o.toLowerCase()}if("number"==typeof o){if(1!==o&&-1!==o)return void console.error("Sort object number values must be 1 or -1:",t);i=1===o}return(t,e)=>pn(t[r],e[r],i)}function hn(t){if(!t)return;const e=typeof t;if("function"===e)return t;if("string"===e){if("asc"===t.toLowerCase()||"dec"===t.toLowerCase()){const e="asc"===t.toLowerCase();return(t,n)=>pn(t,n,e)}const e=t;return(t,n)=>pn(t[e],n[e],!0)}if(Array.isArray(t)){const e=t.map((t=>"function"==typeof t?t:"string"!=typeof t||["asc","dec"].includes(t.toLowerCase())?ln(t)?fn(t):void 0:(e,n)=>pn(e[t],n[t],!0)));return(t,n)=>e.filter((t=>"function"==typeof t)).reduce(((e,r)=>0!==e?e:r(t,n)),0)}return ln(t)?fn(t):void console.error("Invalid sort option (ignoring):",item)}function dn(t){return function(){var t;return(t="undefined"!=typeof window?window:"undefined"!=typeof global?global:this).Cyclejs=t.Cyclejs||{},(t=t.Cyclejs).adaptStream=t.adaptStream||function(t){return t},t}().adaptStream(t)}function yn(t){return 0===Object.keys(t).length}function mn(t,e){if("function"!=typeof t)throw new Error("First argument given to Cycle must be the 'main' function.");if("object"!=typeof e||null===e)throw new Error("Second argument given to Cycle must be an object with driver functions as properties.");if(yn(e))throw new Error("Second argument given to Cycle must be an object with at least one driver function declared as a property.");var n=function(t){if("object"!=typeof t||null===t)throw new Error("Argument given to setupReusable must be an object with driver functions as properties.");if(yn(t))throw new Error("Argument given to setupReusable must be an object with at least one driver function declared as a property.");var e=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=oe.create());return e}(t),n=function(t,e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r](e[r],r),n[r]&&"object"==typeof n[r]&&(n[r]._isCycleSource=r));return n}(t,e),r=function(t){for(var e in t)t.hasOwnProperty(e)&&t[e]&&"function"==typeof t[e].shamefullySendNext&&(t[e]=dn(t[e]));return t}(n);function o(t){return function(t,e){var n=De(),r=Object.keys(t).filter((function(t){return!!e[t]})),o={},i={};r.forEach((function(t){o[t]={_n:[],_e:[]},i[t]={next:function(e){return o[t]._n.push(e)},error:function(e){return o[t]._e.push(e)},complete:function(){}}}));var s=r.map((function(e){return oe.fromObservable(t[e]).subscribe(i[e])}));return r.forEach((function(t){var r=e[t],s=function(t){n((function(){return r._n(t)}))},a=function(t){n((function(){(console.error||console.log)(t),r._e(t)}))};o[t]._n.forEach(s),o[t]._e.forEach(a),i[t].next=s,i[t].error=a,i[t]._n=s,i[t]._e=a})),o=null,function(){s.forEach((function(t){return t.unsubscribe()}))}}(t,e)}function i(){!function(t){for(var e in t)t.hasOwnProperty(e)&&t[e]&&t[e].dispose&&t[e].dispose()}(r),function(t){Object.keys(t).forEach((function(e){return t[e]._c()}))}(e)}return{sources:r,run:o,dispose:i}}(e),r=t(n.sources);return"undefined"!=typeof window&&(window.Cyclejs=window.Cyclejs||{},window.Cyclejs.sinks=r),{sinks:r,sources:n.sources,run:function(){var t=n.run(r);return function(){t(),n.dispose()}}}}function vn(t){if(gn(t)){for(;t&&gn(t);){t=bn(t).parent}return null!=t?t:null}return t.parentNode}function gn(t){return 11===t.nodeType}function bn(t,e){var n,r,o;const i=t;return null!==(n=i.parent)&&void 0!==n||(i.parent=null!=e?e:null),null!==(r=i.firstChildNode)&&void 0!==r||(i.firstChildNode=t.firstChild),null!==(o=i.lastChildNode)&&void 0!==o||(i.lastChildNode=t.lastChild),i}const _n={createElement:function(t,e){return document.createElement(t,e)},createElementNS:function(t,e,n){return document.createElementNS(t,e,n)},createTextNode:function(t){return document.createTextNode(t)},createDocumentFragment:function(){return bn(document.createDocumentFragment())},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){if(gn(t)){let e=t;for(;e&&gn(e);){e=bn(e).parent}t=null!=e?e:t}gn(e)&&(e=bn(e,t)),n&&gn(n)&&(n=bn(n).firstChildNode),t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){gn(e)&&(e=bn(e,t)),t.appendChild(e)},parentNode:vn,nextSibling:function(t){var e;if(gn(t)){const n=bn(t),r=vn(n);if(r&&n.lastChildNode){const t=Array.from(r.childNodes),o=t.indexOf(n.lastChildNode);return null!==(e=t[o+1])&&void 0!==e?e:null}return null}return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},getTextContent:function(t){return t.textContent},isElement:function(t){return 1===t.nodeType},isText:function(t){return 3===t.nodeType},isComment:function(t){return 8===t.nodeType},isDocumentFragment:gn};function wn(t,e,n,r,o){return{sel:t,data:e,children:n,text:r,elm:o,key:void 0===e?void 0:e.key}}const Sn=Array.isArray;function An(t){return"string"==typeof t||"number"==typeof t||t instanceof String||t instanceof Number}function On(t){return void 0===t}function En(t){return void 0!==t}const Cn=wn("",{},[],void 0,void 0);function $n(t,e){var n,r;const o=t.key===e.key,i=(null===(n=t.data)||void 0===n?void 0:n.is)===(null===(r=e.data)||void 0===r?void 0:r.is),s=t.sel===e.sel,a=!(!t.sel&&t.sel===e.sel)||typeof t.text==typeof e.text;return s&&o&&i&&a}function Nn(){throw new Error("The document fragment is not supported on this platform.")}function jn(t,e,n){var r;const o={};for(let i=e;i<=n;++i){const e=null===(r=t[i])||void 0===r?void 0:r.key;void 0!==e&&(o[e]=i)}return o}const xn=["create","update","remove","destroy","pre","post"];function kn(t,e,n){const r={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},o=void 0!==e?e:_n;for(const e of xn)for(const n of t){const t=n[e];void 0!==t&&r[e].push(t)}function i(t){const e=t.id?"#"+t.id:"",n=t.getAttribute("class"),r=n?"."+n.split(" ").join("."):"";return wn(o.tagName(t).toLowerCase()+e+r,{},[],void 0,t)}function s(t){return wn(void 0,{},[],void 0,t)}function a(t,e){return function(){if(0==--e){const e=o.parentNode(t);o.removeChild(e,t)}}}function c(t,e){var i,s,a,u;let l,p=t.data;if(void 0!==p){const e=null===(i=p.hook)||void 0===i?void 0:i.init;En(e)&&(e(t),p=t.data)}const f=t.children,h=t.sel;if("!"===h)On(t.text)&&(t.text=""),t.elm=o.createComment(t.text);else if(void 0!==h){const n=h.indexOf("#"),i=h.indexOf(".",n),a=n>0?n:h.length,u=i>0?i:h.length,d=-1!==n||-1!==i?h.slice(0,Math.min(a,u)):h,y=t.elm=En(p)&&En(l=p.ns)?o.createElementNS(l,d,p):o.createElement(d,p);for(a<u&&y.setAttribute("id",h.slice(a+1,u)),i>0&&y.setAttribute("class",h.slice(u+1).replace(/\./g," ")),l=0;l<r.create.length;++l)r.create[l](Cn,t);if(Sn(f))for(l=0;l<f.length;++l){const t=f[l];null!=t&&o.appendChild(y,c(t,e))}else An(t.text)&&o.appendChild(y,o.createTextNode(t.text));const m=t.data.hook;En(m)&&(null===(s=m.create)||void 0===s||s.call(m,Cn,t),m.insert&&e.push(t))}else if((null===(a=null==n?void 0:n.experimental)||void 0===a?void 0:a.fragments)&&t.children){for(t.elm=(null!==(u=o.createDocumentFragment)&&void 0!==u?u:Nn)(),l=0;l<r.create.length;++l)r.create[l](Cn,t);for(l=0;l<t.children.length;++l){const n=t.children[l];null!=n&&o.appendChild(t.elm,c(n,e))}}else t.elm=o.createTextNode(t.text);return t.elm}function u(t,e,n,r,i,s){for(;r<=i;++r){const i=n[r];null!=i&&o.insertBefore(t,c(i,s),e)}}function l(t){var e,n;const o=t.data;if(void 0!==o){null===(n=null===(e=null==o?void 0:o.hook)||void 0===e?void 0:e.destroy)||void 0===n||n.call(e,t);for(let e=0;e<r.destroy.length;++e)r.destroy[e](t);if(void 0!==t.children)for(let e=0;e<t.children.length;++e){const n=t.children[e];null!=n&&"string"!=typeof n&&l(n)}}}function p(t,e,n,i){for(var s,c;n<=i;++n){let i,u;const f=e[n];if(null!=f)if(En(f.sel)){l(f),i=r.remove.length+1,u=a(f.elm,i);for(let t=0;t<r.remove.length;++t)r.remove[t](f,u);const t=null===(c=null===(s=null==f?void 0:f.data)||void 0===s?void 0:s.hook)||void 0===c?void 0:c.remove;En(t)?t(f,u):u()}else f.children?(l(f),p(t,f.children,0,f.children.length-1)):o.removeChild(t,f.elm)}}function f(t,e,n){var i,s,a,l,h,d,y,m;const v=null===(i=e.data)||void 0===i?void 0:i.hook;null===(s=null==v?void 0:v.prepatch)||void 0===s||s.call(v,t,e);const g=e.elm=t.elm;if(t===e)return;if(void 0!==e.data||En(e.text)&&e.text!==t.text){null!==(a=e.data)&&void 0!==a||(e.data={}),null!==(l=t.data)&&void 0!==l||(t.data={});for(let n=0;n<r.update.length;++n)r.update[n](t,e);null===(y=null===(d=null===(h=e.data)||void 0===h?void 0:h.hook)||void 0===d?void 0:d.update)||void 0===y||y.call(d,t,e)}const b=t.children,_=e.children;On(e.text)?En(b)&&En(_)?b!==_&&function(t,e,n,r){let i,s,a,l,h=0,d=0,y=e.length-1,m=e[0],v=e[y],g=n.length-1,b=n[0],_=n[g];for(;h<=y&&d<=g;)null==m?m=e[++h]:null==v?v=e[--y]:null==b?b=n[++d]:null==_?_=n[--g]:$n(m,b)?(f(m,b,r),m=e[++h],b=n[++d]):$n(v,_)?(f(v,_,r),v=e[--y],_=n[--g]):$n(m,_)?(f(m,_,r),o.insertBefore(t,m.elm,o.nextSibling(v.elm)),m=e[++h],_=n[--g]):$n(v,b)?(f(v,b,r),o.insertBefore(t,v.elm,m.elm),v=e[--y],b=n[++d]):(void 0===i&&(i=jn(e,h,y)),s=i[b.key],On(s)?o.insertBefore(t,c(b,r),m.elm):(a=e[s],a.sel!==b.sel?o.insertBefore(t,c(b,r),m.elm):(f(a,b,r),e[s]=void 0,o.insertBefore(t,a.elm,m.elm))),b=n[++d]);d<=g&&(l=null==n[g+1]?null:n[g+1].elm,u(t,l,n,d,g,r)),h<=y&&p(t,e,h,y)}(g,b,_,n):En(_)?(En(t.text)&&o.setTextContent(g,""),u(g,null,_,0,_.length-1,n)):En(b)?p(g,b,0,b.length-1):En(t.text)&&o.setTextContent(g,""):t.text!==e.text&&(En(b)&&p(g,b,0,b.length-1),o.setTextContent(g,e.text)),null===(m=null==v?void 0:v.postpatch)||void 0===m||m.call(v,t,e)}return function(t,e){let n,a,u;const l=[];for(n=0;n<r.pre.length;++n)r.pre[n]();for(!function(t,e){return t.isElement(e)}(o,t)?function(t,e){return t.isDocumentFragment(e)}(o,t)&&(t=s(t)):t=i(t),$n(t,e)?f(t,e,l):(a=t.elm,u=o.parentNode(a),c(e,l),null!==u&&(o.insertBefore(u,e.elm,o.nextSibling(a)),p(u,[t],0,0))),n=0;n<l.length;++n)l[n].data.hook.insert(l[n]);for(n=0;n<r.post.length;++n)r.post[n]();return e}}function Pn(t,e,n){if(t.ns="http://www.w3.org/2000/svg","foreignObject"!==n&&void 0!==e)for(let t=0;t<e.length;++t){const n=e[t];if("string"==typeof n)continue;const r=n.data;void 0!==r&&Pn(r,n.children,n.sel)}}function Mn(t,e,n){let r,o,i,s={};if(void 0!==n?(null!==e&&(s=e),Sn(n)?r=n:An(n)?o=n.toString():n&&n.sel&&(r=[n])):null!=e&&(Sn(e)?r=e:An(e)?o=e.toString():e&&e.sel?r=[e]:s=e),void 0!==r)for(i=0;i<r.length;++i)An(r[i])&&(r[i]=wn(void 0,void 0,void 0,r[i],void 0));return"s"!==t[0]||"v"!==t[1]||"g"!==t[2]||3!==t.length&&"."!==t[3]&&"#"!==t[3]||Pn(s,r,t),wn(t,s,r,o,void 0)}function Tn(t,e){const n=void 0!==e?e:_n;let r;if(n.isElement(t)){const r=t.id?"#"+t.id:"",o=t.getAttribute("class"),i=o?"."+o.split(" ").join("."):"",s=n.tagName(t).toLowerCase()+r+i,a={},c={},u={},l=[];let p,f,h;const d=t.attributes,y=t.childNodes;for(f=0,h=d.length;f<h;f++)p=d[f].nodeName,"d"===p[0]&&"a"===p[1]&&"t"===p[2]&&"a"===p[3]&&"-"===p[4]?c[p.slice(5)]=d[f].nodeValue||"":"id"!==p&&"class"!==p&&(a[p]=d[f].nodeValue);for(f=0,h=y.length;f<h;f++)l.push(Tn(y[f],e));return Object.keys(a).length>0&&(u.attrs=a),Object.keys(c).length>0&&(u.dataset=c),"s"!==s[0]||"v"!==s[1]||"g"!==s[2]||3!==s.length&&"."!==s[3]&&"#"!==s[3]||Pn(u,l,s),wn(s,u,l,void 0,t)}return n.isText(t)?(r=n.getTextContent(t),wn(void 0,void 0,void 0,r,t)):n.isComment(t)?(r=n.getTextContent(t),wn("!",{},[],r,t)):wn("",{},[],void 0,t)}function In(t,e){let n;const r=e.elm;let o=t.data.attrs,i=e.data.attrs;if((o||i)&&o!==i){for(n in o=o||{},i=i||{},i){const t=i[n];o[n]!==t&&(!0===t?r.setAttribute(n,""):!1===t?r.removeAttribute(n):120!==n.charCodeAt(0)?r.setAttribute(n,t):58===n.charCodeAt(3)?r.setAttributeNS("http://www.w3.org/XML/1998/namespace",n,t):58===n.charCodeAt(5)?r.setAttributeNS("http://www.w3.org/1999/xlink",n,t):r.setAttribute(n,t))}for(n in o)n in i||r.removeAttribute(n)}}const Dn={create:In,update:In};function Ln(t,e){let n,r;const o=e.elm;let i=t.data.class,s=e.data.class;if((i||s)&&i!==s){for(r in i=i||{},s=s||{},i)i[r]&&!Object.prototype.hasOwnProperty.call(s,r)&&o.classList.remove(r);for(r in s)n=s[r],n!==i[r]&&o.classList[n?"add":"remove"](r)}}const Fn={create:Ln,update:Ln},Bn=/[A-Z]/g;function Rn(t,e){const n=e.elm;let r,o=t.data.dataset,i=e.data.dataset;if(!o&&!i)return;if(o===i)return;o=o||{},i=i||{};const s=n.dataset;for(r in o)i[r]||(s?r in s&&delete s[r]:n.removeAttribute("data-"+r.replace(Bn,"-$&").toLowerCase()));for(r in i)o[r]!==i[r]&&(s?s[r]=i[r]:n.setAttribute("data-"+r.replace(Bn,"-$&").toLowerCase(),i[r]))}const Un={create:Rn,update:Rn};function Wn(t,e){let n,r,o;const i=e.elm;let s=t.data.props,a=e.data.props;if((s||a)&&s!==a)for(n in s=s||{},a=a||{},a)r=a[n],o=s[n],o===r||"value"===n&&i[n]===r||(i[n]=r)}const Gn={create:Wn,update:Wn},qn="undefined"!=typeof window&&window.requestAnimationFrame.bind(window)||setTimeout,Vn=function(t){qn((function(){qn(t)}))};let zn=!1;function Hn(t,e,n){Vn((function(){t[e]=n}))}function Jn(t,e){let n,r;const o=e.elm;let i=t.data.style,s=e.data.style;if(!i&&!s)return;if(i===s)return;i=i||{},s=s||{};const a="delayed"in i;for(r in i)s[r]||("-"===r[0]&&"-"===r[1]?o.style.removeProperty(r):o.style[r]="");for(r in s)if(n=s[r],"delayed"===r&&s.delayed)for(const t in s.delayed)n=s.delayed[t],a&&n===i.delayed[t]||Hn(o.style,t,n);else"remove"!==r&&n!==i[r]&&("-"===r[0]&&"-"===r[1]?o.style.setProperty(r,n):o.style[r]=n)}const Yn={pre:function(){zn=!1},create:Jn,update:Jn,destroy:function(t){let e,n;const r=t.elm,o=t.data.style;if(o&&(e=o.destroy))for(n in e)r.style[n]=e[n]},remove:function(t,e){const n=t.data.style;if(!n||!n.remove)return void e();let r;zn||(t.elm.offsetLeft,zn=!0);const o=t.elm;let i=0;const s=n.remove;let a=0;const c=[];for(r in s)c.push(r),o.style[r]=s[r];const u=getComputedStyle(o)["transition-property"].split(", ");for(;i<u.length;++i)-1!==c.indexOf(u[i])&&a++;o.addEventListener("transitionend",(function(t){t.target===o&&--a,0===a&&e()}))}};function Xn(t,e){e.elm=t.elm,t.data.fn=e.data.fn,t.data.args=e.data.args,t.data.isolate=e.data.isolate,e.data=t.data,e.children=t.children,e.text=t.text,e.elm=t.elm}function Zn(t){var e=t.data;Xn(e.fn.apply(void 0,e.args),t)}function Kn(t,e){var n,r=t.data,o=e.data,i=r.args,s=o.args;for(r.fn===o.fn&&i.length===s.length||Xn(o.fn.apply(void 0,s),e),n=0;n<s.length;++n)if(i[n]!==s[n])return void Xn(o.fn.apply(void 0,s),e);Xn(t,e)}function Qn(t,e,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1);var i=null;return ee.create({start:function(s){i=r?function(t){er(t,r),s.next(t)}:function(t){s.next(t)},t.addEventListener(e,i,{capture:n,passive:o})},stop:function(){t.removeEventListener(e,i,n),i=null}})}function tr(t,e){for(var n=Object.keys(t),r=n.length,o=0;o<r;o++){var i=n[o];if("object"==typeof t[i]&&"object"==typeof e[i]){if(!tr(t[i],e[i]))return!1}else if(t[i]!==e[i])return!1}return!0}function er(t,e){if(e)if("boolean"==typeof e)t.preventDefault();else if("function"==typeof e)e(t)&&t.preventDefault();else{if("object"!=typeof e)throw new Error("preventDefault has to be either a boolean, predicate function or object");tr(e,t)&&t.preventDefault()}}var nr=function(){function t(t){this._name=t}return t.prototype.select=function(t){return this},t.prototype.elements=function(){var t=ae(oe.of([document]));return t._isCycleSource=this._name,t},t.prototype.element=function(){var t=ae(oe.of(document));return t._isCycleSource=this._name,t},t.prototype.events=function(t,e,n){var r;void 0===e&&(e={}),r=Qn(document,t,e.useCapture,e.preventDefault);var o=ae(r);return o._isCycleSource=this._name,o},t}(),rr=function(){function t(t){this._name=t}return t.prototype.select=function(t){return this},t.prototype.elements=function(){var t=ae(oe.of([document.body]));return t._isCycleSource=this._name,t},t.prototype.element=function(){var t=ae(oe.of(document.body));return t._isCycleSource=this._name,t},t.prototype.events=function(t,e,n){var r;void 0===e&&(e={}),r=Qn(document.body,t,e.useCapture,e.preventDefault);var o=ae(r);return o._isCycleSource=this._name,o},t}();function or(t){if("string"!=typeof t&&(e=t,!("object"==typeof HTMLElement?e instanceof HTMLElement||e instanceof DocumentFragment:e&&"object"==typeof e&&null!==e&&(1===e.nodeType||11===e.nodeType)&&"string"==typeof e.nodeName)))throw new Error("Given container is not a DOM element neither a selector string.");var e}function ir(t){for(var e="",n=t.length-1;n>=0&&"selector"===t[n].type;n--)e=t[n].scope+" "+e;return e.trim()}function sr(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n].type!==e[n].type||t[n].scope!==e[n].scope)return!1;return!0}var ar=function(){function t(t,e){this.namespace=t,this.isolateModule=e,this._namespace=t.filter((function(t){return"selector"!==t.type}))}return t.prototype.isDirectlyInScope=function(t){var e=this.isolateModule.getNamespace(t);if(!e)return!1;if(this._namespace.length>e.length||!sr(this._namespace,e.slice(0,this._namespace.length)))return!1;for(var n=this._namespace.length;n<e.length;n++)if("total"===e[n].type)return!1;return!0},t}();var cr=function(){function t(t,e){this.namespace=t,this.isolateModule=e}return t.prototype.call=function(){var t=this.namespace,e=ir(t),n=new ar(t,this.isolateModule),r=this.isolateModule.getElement(t.filter((function(t){return"selector"!==t.type})));return void 0===r?[]:""===e?[r]:function(t){return Array.prototype.slice.call(t)}(r.querySelectorAll(e)).filter(n.isDirectlyInScope,n).concat(r.matches(e)?[r]:[])},t}(),ur=function(){return ur=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},ur.apply(this,arguments)};function lr(t){return{type:(e=t,e.length>1&&("."===e[0]||"#"===e[0])?"sibling":"total"),scope:t};var e}var pr=function(){function t(e,n,r,o,i,s){var a;void 0===r&&(r=[]),this._rootElement$=e,this._sanitation$=n,this._namespace=r,this._isolateModule=o,this._eventDelegator=i,this._name=s,this.isolateSource=function(e,n){return new t(e._rootElement$,e._sanitation$,e._namespace.concat(lr(n)),e._isolateModule,e._eventDelegator,e._name)},this.isolateSink=(a=this._namespace,function(t,e){return":root"===e?t:t.map((function(t){if(!t)return t;var n=lr(e),r=ur({},t,{data:ur({},t.data,{isolate:t.data&&Array.isArray(t.data.isolate)?t.data.isolate:a.concat([n])})});return ur({},r,{key:void 0!==r.key?r.key:JSON.stringify(r.data.isolate)})}))})}return t.prototype._elements=function(){if(0===this._namespace.length)return this._rootElement$.map((function(t){return[t]}));var t=new cr(this._namespace,this._isolateModule);return this._rootElement$.map((function(){return t.call()}))},t.prototype.elements=function(){var t=ae(this._elements().remember());return t._isCycleSource=this._name,t},t.prototype.element=function(){var t=ae(this._elements().filter((function(t){return t.length>0})).map((function(t){return t[0]})).remember());return t._isCycleSource=this._name,t},Object.defineProperty(t.prototype,"namespace",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),t.prototype.select=function(e){if("string"!=typeof e)throw new Error("DOM driver's select() expects the argument to be a string as a CSS selector");if("document"===e)return new nr(this._name);if("body"===e)return new rr(this._name);var n=":root"===e?[]:this._namespace.concat({type:"selector",scope:e.trim()});return new t(this._rootElement$,this._sanitation$,n,this._isolateModule,this._eventDelegator,this._name)},t.prototype.events=function(t,e,n){if(void 0===e&&(e={}),"string"!=typeof t)throw new Error("DOM driver's events() expects argument to be a string representing the event type to listen for.");var r=this._eventDelegator.addEventListener(t,this._namespace,e,n),o=ae(r);return o._isCycleSource=this._name,o},t.prototype.dispose=function(){this._sanitation$.shamefullySendNext(null)},t}(),fr={},hr=e&&e.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r};Object.defineProperty(fr,"__esModule",{value:!0}),fr.SampleCombineOperator=fr.SampleCombineListener=void 0;var dr=n,yr={},mr=function(){function t(t,e){this.i=t,this.p=e,e.ils[t]=this}return t.prototype._n=function(t){var e=this.p;e.out!==yr&&e.up(t,this.i)},t.prototype._e=function(t){this.p._e(t)},t.prototype._c=function(){this.p.down(this.i,this)},t}();fr.SampleCombineListener=mr;var vr,gr=function(){function t(t,e){this.type="sampleCombine",this.ins=t,this.others=e,this.out=yr,this.ils=[],this.Nn=0,this.vals=[]}return t.prototype._start=function(t){this.out=t;for(var e=this.others,n=this.Nn=e.length,r=this.vals=new Array(n),o=0;o<n;o++)r[o]=yr,e[o]._add(new mr(o,this));this.ins._add(this)},t.prototype._stop=function(){var t=this.others,e=t.length,n=this.ils;this.ins._remove(this);for(var r=0;r<e;r++)t[r]._remove(n[r]);this.out=yr,this.vals=[],this.ils=[]},t.prototype._n=function(t){var e=this.out;e!==yr&&(this.Nn>0||e._n(hr([t],this.vals)))},t.prototype._e=function(t){var e=this.out;e!==yr&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==yr&&t._c()},t.prototype.up=function(t,e){var n=this.vals[e];this.Nn>0&&n===yr&&this.Nn--,this.vals[e]=t},t.prototype.down=function(t,e){this.others[t]._remove(e)},t}();fr.SampleCombineOperator=gr,vr=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return new dr.Stream(new gr(e,t))}};var br=fr.default=vr;function _r(t){if(!t.sel)return{tagName:"",id:"",className:""};var e=t.sel,n=e.indexOf("#"),r=e.indexOf(".",n),o=n>0?n:e.length,i=r>0?r:e.length;return{tagName:-1!==n||-1!==r?e.slice(0,Math.min(o,i)):e,id:o<i?e.slice(o+1,i):void 0,className:r>0?e.slice(i+1).replace(/\./g," "):void 0}}Object.assign;var wr=("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")()).Symbol;"function"==typeof wr&&wr("parent");var Sr=function(){function t(t){this.rootElement=t}return t.prototype.call=function(t){if(11===this.rootElement.nodeType)return this.wrapDocFrag(null===t?[]:[t]);if(null===t)return this.wrap([]);var e=_r(t),n=e.tagName,r=e.id,o=function(t){var e=_r(t).className,n=void 0===e?"":e;if(!t.data)return n;var r=t.data,o=r.class,i=r.props;return o&&(n+=" "+Object.keys(o).filter((function(t){return o[t]})).join(" ")),i&&i.className&&(n+=" "+i.className),n&&n.trim()}(t),i=((t.data||{}).props||{}).id,s=void 0===i?r:i;return"string"==typeof s&&s.toUpperCase()===this.rootElement.id.toUpperCase()&&n.toUpperCase()===this.rootElement.tagName.toUpperCase()&&o.toUpperCase()===this.rootElement.className.toUpperCase()?t:this.wrap([t])},t.prototype.wrapDocFrag=function(t){return wn("",{isolate:[]},t,void 0,this.rootElement)},t.prototype.wrap=function(t){var e=this.rootElement,n=e.tagName,r=e.id,o=e.className,i=r?"#"+r:"",s=o?"."+o.split(" ").join("."):"",a=Mn(""+n.toLowerCase()+i+s,{},t);return a.data=a.data||{},a.data.isolate=a.data.isolate||[],a},t}(),Ar=[Yn,Fn,Gn,Dn,Un],Or=function(){function t(t){this.mapper=t,this.tree=[void 0,{}]}return t.prototype.set=function(t,e,n){for(var r=this.tree,o=void 0!==n?n:t.length,i=0;i<o;i++){var s=this.mapper(t[i]),a=r[1][s];a||(a=[void 0,{}],r[1][s]=a),r=a}r[0]=e},t.prototype.getDefault=function(t,e,n){return this.get(t,e,n)},t.prototype.get=function(t,e,n){for(var r=this.tree,o=void 0!==n?n:t.length,i=0;i<o;i++){var s=this.mapper(t[i]),a=r[1][s];if(!a){if(!e)return;a=[void 0,{}],r[1][s]=a}r=a}return e&&!r[0]&&(r[0]=e()),r[0]},t.prototype.delete=function(t){for(var e=this.tree,n=0;n<t.length-1;n++){var r=e[1][this.mapper(t[n])];if(!r)return;e=r}delete e[1][this.mapper(t[t.length-1])]},t}(),Er=function(){function t(){this.namespaceTree=new Or((function(t){return t.scope})),this.namespaceByElement=new Map,this.vnodesBeingRemoved=[]}return t.prototype.setEventDelegator=function(t){this.eventDelegator=t},t.prototype.insertElement=function(t,e){this.namespaceByElement.set(e,t),this.namespaceTree.set(t,e)},t.prototype.removeElement=function(t){this.namespaceByElement.delete(t);var e=this.getNamespace(t);e&&this.namespaceTree.delete(e)},t.prototype.getElement=function(t,e){return this.namespaceTree.get(t,void 0,e)},t.prototype.getRootElement=function(t){if(this.namespaceByElement.has(t))return t;for(var e=t;!this.namespaceByElement.has(e);){if(!(e=e.parentNode))return;if("HTML"===e.tagName)throw new Error("No root element found, this should not happen at all")}return e},t.prototype.getNamespace=function(t){var e=this.getRootElement(t);if(e)return this.namespaceByElement.get(e)},t.prototype.createModule=function(){var t=this;return{create:function(e,n){var r=n.elm,o=n.data,i=(void 0===o?{}:o).isolate;Array.isArray(i)&&t.insertElement(i,r)},update:function(e,n){var r=e.elm,o=e.data,i=void 0===o?{}:o,s=n.elm,a=n.data,c=void 0===a?{}:a,u=i.isolate,l=c.isolate;sr(u,l)||Array.isArray(u)&&t.removeElement(r),Array.isArray(l)&&t.insertElement(l,s)},destroy:function(e){t.vnodesBeingRemoved.push(e)},remove:function(e,n){t.vnodesBeingRemoved.push(e),n()},post:function(){for(var e=t.vnodesBeingRemoved,n=e.length-1;n>=0;n--){var r=e[n],o=void 0!==r.data?r.data.isolation:void 0;void 0!==o&&t.removeElement(o),t.eventDelegator.removeElement(r.elm,o)}t.vnodesBeingRemoved=[]}}},t}(),Cr=function(){function t(){this.arr=[],this.prios=[]}return t.prototype.add=function(t,e){for(var n=0;n<this.arr.length;n++)if(this.prios[n]<e)return this.arr.splice(n,0,t),void this.prios.splice(n,0,e);this.arr.push(t),this.prios.push(e)},t.prototype.forEach=function(t){for(var e=0;e<this.arr.length;e++)t(this.arr[e],e,this.arr)},t.prototype.delete=function(t){for(var e=0;e<this.arr.length;e++)if(this.arr[e]===t)return this.arr.splice(e,1),void this.prios.splice(e,1)},t}(),$r=function(){return $r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},$r.apply(this,arguments)},Nr=["blur","canplay","canplaythrough","durationchange","emptied","ended","focus","load","loadeddata","loadedmetadata","mouseenter","mouseleave","pause","play","playing","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","unload","volumechange","waiting"],jr=function(){function t(t,e){var n=this;this.rootElement$=t,this.isolateModule=e,this.virtualListeners=new Or((function(t){return t.scope})),this.nonBubblingListenersToAdd=new Set,this.virtualNonBubblingListener=[],this.isolateModule.setEventDelegator(this),this.domListeners=new Map,this.domListenersToAdd=new Map,this.nonBubblingListeners=new Map,t.addListener({next:function(t){n.origin!==t&&(n.origin=t,n.resetEventListeners(),n.domListenersToAdd.forEach((function(t,e){return n.setupDOMListener(e,t)})),n.domListenersToAdd.clear()),n.nonBubblingListenersToAdd.forEach((function(t){n.setupNonBubblingListener(t)}))}})}return t.prototype.addEventListener=function(t,e,n,r){var o,i=oe.never(),s=new ar(e,this.isolateModule);if(void 0===r?-1===Nr.indexOf(t):r)return this.domListeners.has(t)||this.setupDOMListener(t,!!n.passive),o=this.insertListener(i,s,t,n),i;var a=[];this.nonBubblingListenersToAdd.forEach((function(t){return a.push(t)}));for(var c=void 0,u=0,l=a.length,p=function(n){n[0];var r=n[1],o=n[2];return n[3],t===r&&sr(o.namespace,e)};!c&&u<l;){var f=a[u];c=p(f)?f:c,u++}var h,d=c;if(d){var y=d[0];h=y}else{var m=new cr(e,this.isolateModule);o=this.insertListener(i,s,t,n),d=[i,t,m,o],h=i,this.nonBubblingListenersToAdd.add(d),this.setupNonBubblingListener(d)}var v=this,g=null;return oe.create({start:function(t){g=h.subscribe(t)},stop:function(){d[0];var t=d[1],e=d[2];d[3],e.call().forEach((function(e){var n=e.subs;n&&n[t]&&(n[t].unsubscribe(),delete n[t])})),v.nonBubblingListenersToAdd.delete(d),g.unsubscribe()}})},t.prototype.removeElement=function(t,e){void 0!==e&&this.virtualListeners.delete(e);var n=[];this.nonBubblingListeners.forEach((function(e,r){if(e.has(t)){n.push([r,t]);var o=t.subs;o&&Object.keys(o).forEach((function(t){o[t].unsubscribe()}))}}));for(var r=0;r<n.length;r++){var o=this.nonBubblingListeners.get(n[r][0]);o&&(o.delete(n[r][1]),0===o.size?this.nonBubblingListeners.delete(n[r][0]):this.nonBubblingListeners.set(n[r][0],o))}},t.prototype.insertListener=function(t,e,n,r){var o=[],i=e._namespace,s=i.length;do{o.push(this.getVirtualListeners(n,i,!0,s)),s--}while(s>=0&&"total"!==i[s].type);for(var a=$r({},r,{scopeChecker:e,subject:t,bubbles:!!r.bubbles,useCapture:!!r.useCapture,passive:!!r.passive}),c=0;c<o.length;c++)o[c].add(a,i.length);return a},t.prototype.getVirtualListeners=function(t,e,n,r){void 0===n&&(n=!1);var o=void 0!==r?r:e.length;if(!n)for(var i=o-1;i>=0;i--){if("total"===e[i].type){o=i+1;break}o=i}var s=this.virtualListeners.getDefault(e,(function(){return new Map}),o);return s.has(t)||s.set(t,new Cr),s.get(t)},t.prototype.setupDOMListener=function(t,e){var n=this;if(this.origin){var r=Qn(this.origin,t,!1,!1,e).subscribe({next:function(r){return n.onEvent(t,r,e)},error:function(){},complete:function(){}});this.domListeners.set(t,{sub:r,passive:e})}else this.domListenersToAdd.set(t,e)},t.prototype.setupNonBubblingListener=function(t){t[0];var e=t[1],n=t[2],r=t[3];if(this.origin){var o=n.call();if(o.length){var i=this;o.forEach((function(t){var n,o=t.subs;if(!o||!o[e]){var s=Qn(t,e,!1,!1,r.passive).subscribe({next:function(t){return i.onEvent(e,t,!!r.passive,!1)},error:function(){},complete:function(){}});i.nonBubblingListeners.has(e)||i.nonBubblingListeners.set(e,new Map);var a=i.nonBubblingListeners.get(e);if(!a)return;a.set(t,{sub:s,destination:r}),t.subs=$r({},o,((n={})[e]=s,n))}}))}}},t.prototype.resetEventListeners=function(){for(var t=this.domListeners.entries(),e=t.next();!e.done;){var n=e.value,r=n[0],o=n[1],i=o.sub,s=o.passive;i.unsubscribe(),this.setupDOMListener(r,s),e=t.next()}},t.prototype.putNonBubblingListener=function(t,e,n,r){var o=this.nonBubblingListeners.get(t);if(o){var i=o.get(e);i&&i.destination.passive===r&&i.destination.useCapture===n&&(this.virtualNonBubblingListener[0]=i.destination)}},t.prototype.onEvent=function(t,e,n,r){void 0===r&&(r=!0);var o=this.patchEvent(e),i=this.isolateModule.getRootElement(e.target);if(r){var s=this.isolateModule.getNamespace(e.target);if(!s)return;var a=this.getVirtualListeners(t,s);this.bubble(t,e.target,i,o,a,s,s.length-1,!0,n),this.bubble(t,e.target,i,o,a,s,s.length-1,!1,n)}else this.putNonBubblingListener(t,e.target,!0,n),this.doBubbleStep(t,e.target,i,o,this.virtualNonBubblingListener,!0,n),this.putNonBubblingListener(t,e.target,!1,n),this.doBubbleStep(t,e.target,i,o,this.virtualNonBubblingListener,!1,n),e.stopPropagation()},t.prototype.bubble=function(t,e,n,r,o,i,s,a,c){a||r.propagationHasBeenStopped||this.doBubbleStep(t,e,n,r,o,a,c);var u=n,l=s;if(e===n){if(!(s>=0&&"sibling"===i[s].type))return;u=this.isolateModule.getElement(i,s),l--}e.parentNode&&u&&this.bubble(t,e.parentNode,u,r,o,i,l,a,c),a&&!r.propagationHasBeenStopped&&this.doBubbleStep(t,e,n,r,o,a,c)},t.prototype.doBubbleStep=function(t,e,n,r,o,i,s){n&&(this.mutateEventCurrentTarget(r,e),o.forEach((function(t){if(t.passive===s&&t.useCapture===i){var o=ir(t.scopeChecker.namespace);!r.propagationHasBeenStopped&&t.scopeChecker.isDirectlyInScope(e)&&(""!==o&&e.matches(o)||""===o&&e===n)&&(er(r,t.preventDefault),t.subject.shamefullySendNext(r))}})))},t.prototype.patchEvent=function(t){var e=t;e.propagationHasBeenStopped=!1;var n=e.stopPropagation;return e.stopPropagation=function(){n.call(this),this.propagationHasBeenStopped=!0},e},t.prototype.mutateEventCurrentTarget=function(t,e){try{Object.defineProperty(t,"currentTarget",{value:e,configurable:!0})}catch(t){console.log("please use event.ownerTarget")}t.ownerTarget=e},t}();function xr(t){return oe.merge(t,oe.never())}function kr(t){return t.elm}function Pr(t){(console.error||console.log)(t)}function Mr(t,e){void 0===e&&(e={}),or(t);var n=e.modules||Ar;!function(t){if(!Array.isArray(t))throw new Error("Optional modules option must be an array for snabbdom modules")}(n);var r,o,i=new Er,s=e&&e.snabbdomOptions||void 0,a=kn([i.createModule()].concat(n),void 0,s),c=oe.create({start:function(t){"loading"===document.readyState?document.addEventListener("readystatechange",(function(){var e=document.readyState;"interactive"!==e&&"complete"!==e||(t.next(null),t.complete())})):(t.next(null),t.complete())},stop:function(){}}),u=oe.create({start:function(t){o=new MutationObserver((function(){return t.next(null)}))},stop:function(){o.disconnect()}});return function(n,s){void 0===s&&(s="DOM"),function(t){if(!t||"function"!=typeof t.addListener||"function"!=typeof t.fold)throw new Error("The DOM driver function expects as input a Stream of virtual DOM elements")}(n);var l=oe.create(),p=c.map((function(){var e=function(t){var e="string"==typeof t?document.querySelector(t):t;if("string"==typeof t&&null===e)throw new Error("Cannot render into unknown element `"+t+"`");return e}(t)||document.body;return r=new Sr(e),e})),f=n.remember();f.addListener({}),u.addListener({});var h=p.map((function(t){return oe.merge(f.endWhen(l),l).map((function(t){return r.call(t)})).startWith(function(t){return t.data=t.data||{},t.data.isolate=[],t}(Tn(t))).fold(a,Tn(t)).drop(1).map(kr).startWith(t).map((function(t){return o.observe(t,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),t})).compose(xr)})).flatten(),d=Te(c,u).endWhen(l).compose(br(h)).map((function(t){return t[1]})).remember();d.addListener({error:e.reportSnabbdomError||Pr});var y=new jr(d,i);return new pr(d,l,[],i,y,s)}}var Tr="___",Ir=function(){function t(t){this._mockConfig=t,t.elements?this._elements=t.elements:this._elements=ae(oe.empty())}return t.prototype.elements=function(){var t=this._elements;return t._isCycleSource="MockedDOM",t},t.prototype.element=function(){var t=this.elements().filter((function(t){return t.length>0})).map((function(t){return t[0]})).remember(),e=ae(t);return e._isCycleSource="MockedDOM",e},t.prototype.events=function(t,e,n){var r=this._mockConfig[t],o=ae(r||oe.empty());return o._isCycleSource="MockedDOM",o},t.prototype.select=function(e){return new t(this._mockConfig[e]||{})},t.prototype.isolateSource=function(t,e){return t.select("."+Tr+e)},t.prototype.isolateSink=function(t,e){return ae(oe.fromObservable(t).map((function(t){return t.sel&&-1!==t.sel.indexOf(Tr+e)||(t.sel+="."+Tr+e),t})))},t}();function Dr(t){return function(t){return"string"==typeof t&&t.length>0}(t)&&("."===t[0]||"#"===t[0])}function Lr(t){return function(e,n,r){var o=void 0!==e,i=void 0!==n,s=void 0!==r;return Dr(e)?i&&s?Mn(t+e,n,r):Mn(t+e,i?n:{}):s?Mn(t+e,n,r):i?Mn(t,e,n):Mn(t,o?e:{})}}var Fr=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","colorProfile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotlight","feTile","feTurbulence","filter","font","fontFace","fontFaceFormat","fontFaceName","fontFaceSrc","fontFaceUri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missingGlyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Br=Lr("svg");Fr.forEach((function(t){Br[t]=Lr(t)}));var Rr=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","meta","nav","noscript","object","ol","optgroup","option","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","u","ul","video"],Ur={SVG_TAG_NAMES:Fr,TAG_NAMES:Rr,svg:Br,isSelector:Dr,createTagFunction:Lr};Rr.forEach((function(t){Ur[t]=Lr(t)}));var Wr=Ur.svg,Gr=Ur.a,qr=Ur.abbr,Vr=Ur.address,zr=Ur.area,Hr=Ur.article,Jr=Ur.aside,Yr=Ur.audio,Xr=Ur.b,Zr=Ur.base,Kr=Ur.bdi,Qr=Ur.bdo,to=Ur.blockquote,eo=Ur.body,no=Ur.br,ro=Ur.button,oo=Ur.canvas,io=Ur.caption,so=Ur.cite,ao=Ur.code,co=Ur.col,uo=Ur.colgroup,lo=Ur.dd,po=Ur.del,fo=Ur.dfn,ho=Ur.dir,yo=Ur.div,mo=Ur.dl,vo=Ur.dt,go=Ur.em,bo=Ur.embed,_o=Ur.fieldset,wo=Ur.figcaption,So=Ur.figure,Ao=Ur.footer,Oo=Ur.form,Eo=Ur.h1,Co=Ur.h2,$o=Ur.h3,No=Ur.h4,jo=Ur.h5,xo=Ur.h6,ko=Ur.head,Po=Ur.header,Mo=Ur.hgroup,To=Ur.hr,Io=Ur.html,Do=Ur.i,Lo=Ur.iframe,Fo=Ur.img,Bo=Ur.input,Ro=Ur.ins,Uo=Ur.kbd,Wo=Ur.keygen,Go=Ur.label,qo=Ur.legend,Vo=Ur.li,zo=Ur.link,Ho=Ur.main,Jo=Ur.map,Yo=Ur.mark,Xo=Ur.menu,Zo=Ur.meta,Ko=Ur.nav,Qo=Ur.noscript,ti=Ur.object,ei=Ur.ol,ni=Ur.optgroup,ri=Ur.option,oi=Ur.p,ii=Ur.param,si=Ur.pre,ai=Ur.progress,ci=Ur.q,ui=Ur.rp,li=Ur.rt,pi=Ur.ruby,fi=Ur.s,hi=Ur.samp,di=Ur.script,yi=Ur.section,mi=Ur.select,vi=Ur.small,gi=Ur.source,bi=Ur.span,_i=Ur.strong,wi=Ur.style,Si=Ur.sub,Ai=Ur.sup,Oi=Ur.table,Ei=Ur.tbody,Ci=Ur.td,$i=Ur.textarea,Ni=Ur.tfoot,ji=Ur.th,xi=Ur.thead,ki=Ur.title,Pi=Ur.tr,Mi=Ur.u,Ti=Ur.ul,Ii=Ur.video;function Di(t){const e=new EventTarget;return t.subscribe({next:t=>e.dispatchEvent(new CustomEvent("data",{detail:t}))}),{select:t=>{const n=!t,r=Array.isArray(t)?t:[t];let o;const i=oe.create({start:t=>{o=({detail:e})=>{const o=e&&e.data||null;(n||r.includes(e.type))&&t.next(o)},e.addEventListener("data",o)},stop:t=>e.removeEventListener("data",o)});return ae(i)}}}function Li(t){t.addListener({next:t=>{console.log(t)}})}function Fi(t){return/^[a-zA-Z0-9-_]+$/.test(t)}function Bi(t){if("string"!=typeof t)throw new Error("Class name must be a string");return t.trim().split(" ").reduce(((t,e)=>{if(0===e.trim().length)return t;if(!Fi(e))throw new Error(`${e} is not a valid CSS class name`);return t.push(e),t}),[])}var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});var Ui=n,Wi=function(){function t(t,e){this.dt=t,this.ins=e,this.type="throttle",this.out=null,this.id=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.id=null},t.prototype.clearInterval=function(){var t=this.id;null!==t&&clearInterval(t),this.id=null},t.prototype._n=function(t){var e=this,n=this.out;n&&(this.id||(n._n(t),this.id=setInterval((function(){e.clearInterval()}),this.dt)))},t.prototype._e=function(t){var e=this.out;e&&(this.clearInterval(),e._e(t))},t.prototype._c=function(){var t=this.out;t&&(this.clearInterval(),t._c())},t}();var Gi=Ri.default=function(t){return function(e){return new Ui.Stream(new Wi(t,e))}};t.ABORT=tn,t.MainDOMSource=pr,t.MockedDOMSource=Ir,t.a=Gr,t.abbr=qr,t.address=Vr,t.area=zr,t.article=Hr,t.aside=Jr,t.audio=Yr,t.b=Xr,t.base=Zr,t.bdi=Kr,t.bdo=Qr,t.blockquote=to,t.body=eo,t.br=no,t.button=ro,t.canvas=oo,t.caption=io,t.cite=so,t.classes=function(...t){return t.reduce(((t,e)=>{var n,r;return"string"!=typeof e||t.includes(e)?Array.isArray(e)?t.push(...(r=e,r.map(Bi).flat())):"object"==typeof e&&t.push(...(n=e,Object.entries(n).filter((([t,e])=>"function"==typeof e?e():!!e)).map((([t,e])=>{const n=t.trim();if(!Fi(n))throw new Error(`${n} is not a valid CSS class name`);return n})))):t.push(...Bi(e)),t}),[]).join(" ")},t.code=ao,t.col=co,t.colgroup=uo,t.collection=Fe,t.component=en,t.dd=lo,t.debounce=Je,t.del=po,t.delay=qe,t.dfn=fo,t.dir=ho,t.div=yo,t.dl=mo,t.driverFromAsync=function(t,e={}){const{selector:n="category",args:r="value",return:o="value",pre:i=(t=>t),post:s=(t=>t)}=e,a=t.name||"[anonymous function]",c=typeof r;if(!("string"===c||"function"===c||Array.isArray(r)&&r.every((t=>"string"==typeof t))))throw new Error(`The 'args' option for driverFromAsync(${a}) must be a string, array of strings, or a function. Received ${c}`);if("string"!=typeof n)throw new Error(`The 'selector' option for driverFromAsync(${a}) must be a string. Received ${typeof n}`);return e=>{let c=null;const u=oe.create({start:t=>{c=t.next.bind(t)},stop:()=>{}});return e.addListener({next:e=>{const u=i(e);let l=[];if("object"==typeof u&&null!==u){if("function"==typeof r){const t=r(u);l=Array.isArray(t)?t:[t]}"string"==typeof r&&(l=[u[r]]),Array.isArray(r)&&(l=r.map((t=>u[t])))}const p=`Error in driver created using driverFromAsync(${a})`;t(...l).then((t=>{const r=t=>{let r;if(void 0===o)r=t,"object"==typeof r&&null!==r?r[n]=e[n]:console.warn(`The 'return' option for driverFromAsync(${a}) was not set, but the promise returned an non-object. The result will be returned as-is, but the '${n}' property will not be set, so will not be filtered by the 'select' method of the driver.`);else{if("string"!=typeof o)throw new Error(`The 'return' option for driverFromAsync(${a}) must be a string. Received ${typeof o}`);r={[o]:t,[n]:e[n]}}return r};if("function"==typeof t.then)t.then((t=>{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(r(t))})).catch((t=>console.error(`${p}: ${t}`))):c(r(rocessedOutgoing))})).catch((t=>console.error(`${p}: ${t}`)));else{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(r(t))})).catch((t=>console.error(`${p}: ${t}`))):c(r(n))}})).catch((t=>console.error(`${p}: ${t}`)))},error:t=>{console.error(`Error recieved from sink stream in driver created using driverFromAsync(${a}): ${t}`)},complete:()=>{console.warn(`Unexpected completion of sink stream to driver created using driverFromAsync(${a})`)}}),{select:t=>void 0===t?u:"function"==typeof t?u.filter(t):u.filter((e=>e?.[n]===t))}}},t.dropRepeats=ye,t.dt=vo,t.em=go,t.embed=bo,t.fieldset=_o,t.figcaption=wo,t.figure=So,t.footer=Ao,t.form=Oo,t.h=Mn,t.h1=Eo,t.h2=Co,t.h3=$o,t.h4=No,t.h5=jo,t.h6=xo,t.head=ko,t.header=Po,t.hgroup=Mo,t.hr=To,t.html=Io,t.i=Do,t.iframe=Lo,t.img=Fo,t.input=Bo,t.ins=Ro,t.kbd=Uo,t.keygen=Wo,t.label=Go,t.legend=qo,t.li=Vo,t.link=zo,t.main=Ho,t.makeDOMDriver=Mr,t.map=Jo,t.mark=Yo,t.menu=Xo,t.meta=Zo,t.mockDOMSource=function(t){return new Ir(t)},t.nav=Ko,t.noscript=Qo,t.object=ti,t.ol=ei,t.optgroup=ni,t.option=ri,t.p=oi,t.param=ii,t.pre=si,t.processForm=function(t,e={}){let{events:n=["input","submit"],preventDefault:r=!0}=e;"string"==typeof n&&(n=[n]);const o=n.map((e=>t.events(e)));return oe.merge(...o).map((t=>{r&&t.preventDefault();const e="submit"===t.type?t.srcElement:t.currentTarget,n=new FormData(e);let o={};o.event=t,o.eventType=t.type;const i=e.querySelector("input[type=submit]:focus");if(i){const{name:t,value:e}=i;o[t||"submit"]=e}for(let[t,e]of n.entries())o[t]=e;return o}))},t.progress=ai,t.q=ci,t.rp=ui,t.rt=li,t.ruby=pi,t.run=function(t,e={},n={}){const{mountPoint:r="#root",fragments:o=!0}=n;if(!t.isSygnalComponent){const e=t.name||t.componentName||t.label||"FUNCTIONAL_COMPONENT",n=t,{model:r,intent:o,context:i,peers:s,components:a,initialState:c,calculated:u,storeCalculatedInState:l,DOMSourceName:p,stateSourceName:f,debug:h}=t;t=en({name:e,view:n,model:r,intent:o,context:i,peers:s,components:a,initialState:c,calculated:u,storeCalculatedInState:l,DOMSourceName:p,stateSourceName:f,debug:h})}const i=function(t,e){return void 0===e&&(e="state"),function(n){var r=oe.create(),o=r.fold((function(t,e){return e(t)}),void 0).drop(1),i=n;i[e]=new we(o,e);var s=t(i);return s[e]&&Te(oe.fromObservable(s[e]),oe.never()).subscribe({next:function(t){return Le((function(){return r._n(t)}))},error:function(t){return Le((function(){return r._e(t)}))},complete:function(){return Le((function(){return r._c()}))}}),s}}(t,"STATE");return function(t,e){var n=mn(t,e);return"undefined"!=typeof window&&window.CyclejsDevTool_startGraphSerializer&&window.CyclejsDevTool_startGraphSerializer(n.sinks),n.run()}(i,{...{EVENTS:Di,DOM:Mr(r,{snabbdomOptions:{experimental:{fragments:o}}}),LOG:Li},...e})},t.s=fi,t.samp=hi,t.sampleCombine=br,t.script=di,t.section=yi,t.select=mi,t.small=vi,t.source=gi,t.span=bi,t.strong=_i,t.style=wi,t.sub=Si,t.sup=Ai,t.svg=Wr,t.switchable=Be,t.table=Oi,t.tbody=Ei,t.td=Ci,t.textarea=$i,t.tfoot=Ni,t.th=ji,t.thead=xi,t.throttle=Gi,t.thunk=function(t,e,n,r){return void 0===r&&(r=n,n=e,e=void 0),Mn(t,{key:e,hook:{init:Zn,prepatch:Kn},fn:n,args:r})},t.title=ki,t.tr=Pi,t.u=Mi,t.ul=Ti,t.video=Ii,t.xs=oe}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Sygnal={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n={},r={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){var e,n=t.Symbol;if("function"==typeof n)if(n.observable)e=n.observable;else{e=n.for("https://github.com/benlesh/symbol-observable");try{n.observable=e}catch(t){}}else e="@@observable";return e}}(r);var o,i,s=r,a=Object.prototype.toString,c=function(t){var e=a.call(t),n="[object Arguments]"===e;return n||(n="[object Array]"!==e&&null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===a.call(t.callee)),n};var u=Array.prototype.slice,l=c,p=Object.keys,f=p?function(t){return p(t)}:function(){if(i)return o;var t;if(i=1,!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=c,s=Object.prototype.propertyIsEnumerable,a=!s.call({toString:null},"toString"),u=s.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],p=function(t){var e=t.constructor;return e&&e.prototype===t},f={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!f["$"+t]&&e.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{p(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();t=function(t){var o=null!==t&&"object"==typeof t,i="[object Function]"===n.call(t),s=r(t),c=o&&"[object String]"===n.call(t),f=[];if(!o&&!i&&!s)throw new TypeError("Object.keys called on a non-object");var d=u&&i;if(c&&t.length>0&&!e.call(t,0))for(var y=0;y<t.length;++y)f.push(String(y));if(s&&t.length>0)for(var m=0;m<t.length;++m)f.push(String(m));else for(var v in t)d&&"prototype"===v||!e.call(t,v)||f.push(String(v));if(a)for(var g=function(t){if("undefined"==typeof window||!h)return p(t);try{return p(t)}catch(t){return!1}}(t),b=0;b<l.length;++b)g&&"constructor"===l[b]||!e.call(t,l[b])||f.push(l[b]);return f}}return o=t}(),h=Object.keys;f.shim=function(){if(Object.keys){var t=function(){var t=Object.keys(arguments);return t&&t.length===arguments.length}(1,2);t||(Object.keys=function(t){return l(t)?h(u.call(t)):h(t)})}else Object.keys=f;return Object.keys||f};var d,y=f,m="undefined"!=typeof Symbol&&Symbol,v=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},e=Symbol("test"),n=Object(e);if("string"==typeof e)return!1;if("[object Symbol]"!==Object.prototype.toString.call(e))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(e in t[e]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var r=Object.getOwnPropertySymbols(t);if(1!==r.length||r[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(t,e);if(42!==o.value||!0!==o.enumerable)return!1}return!0},g={foo:{}},b=Object,_=Array.prototype.slice,w=Object.prototype.toString,S=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==w.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var n,r=_.call(arguments,1),o=Math.max(0,e.length-r.length),i=[],s=0;s<o;s++)i.push("$"+s);if(n=Function("binder","return function ("+i.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var o=e.apply(this,r.concat(_.call(arguments)));return Object(o)===o?o:this}return e.apply(t,r.concat(_.call(arguments)))})),e.prototype){var a=function(){};a.prototype=e.prototype,n.prototype=new a,a.prototype=null}return n},A=Function.prototype.bind||S,O=A.call(Function.call,Object.prototype.hasOwnProperty),E=SyntaxError,C=Function,N=TypeError,$=function(t){try{return C('"use strict"; return ('+t+").constructor;")()}catch(t){}},j=Object.getOwnPropertyDescriptor;if(j)try{j({},"")}catch(t){j=null}var x=function(){throw new N},k=j?function(){try{return x}catch(t){try{return j(arguments,"callee").get}catch(t){return x}}}():x,P="function"==typeof m&&"function"==typeof Symbol&&"symbol"==typeof m("foo")&&"symbol"==typeof Symbol("bar")&&v(),T={__proto__:g}.foo===g.foo&&!({__proto__:null}instanceof b),M=Object.getPrototypeOf||(T?function(t){return t.__proto__}:null),I={},D="undefined"!=typeof Uint8Array&&M?M(Uint8Array):d,L={"%AggregateError%":"undefined"==typeof AggregateError?d:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?d:ArrayBuffer,"%ArrayIteratorPrototype%":P&&M?M([][Symbol.iterator]()):d,"%AsyncFromSyncIteratorPrototype%":d,"%AsyncFunction%":I,"%AsyncGenerator%":I,"%AsyncGeneratorFunction%":I,"%AsyncIteratorPrototype%":I,"%Atomics%":"undefined"==typeof Atomics?d:Atomics,"%BigInt%":"undefined"==typeof BigInt?d:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?d:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?d:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?d:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?d:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?d:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?d:FinalizationRegistry,"%Function%":C,"%GeneratorFunction%":I,"%Int8Array%":"undefined"==typeof Int8Array?d:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?d:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?d:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":P&&M?M(M([][Symbol.iterator]())):d,"%JSON%":"object"==typeof JSON?JSON:d,"%Map%":"undefined"==typeof Map?d:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&P&&M?M((new Map)[Symbol.iterator]()):d,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?d:Promise,"%Proxy%":"undefined"==typeof Proxy?d:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?d:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?d:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&P&&M?M((new Set)[Symbol.iterator]()):d,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?d:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":P&&M?M(""[Symbol.iterator]()):d,"%Symbol%":P?Symbol:d,"%SyntaxError%":E,"%ThrowTypeError%":k,"%TypedArray%":D,"%TypeError%":N,"%Uint8Array%":"undefined"==typeof Uint8Array?d:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?d:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?d:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?d:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?d:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?d:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?d:WeakSet};if(M)try{null.error}catch(t){var F=M(M(t));L["%Error.prototype%"]=F}var B=function t(e){var n;if("%AsyncFunction%"===e)n=$("async function () {}");else if("%GeneratorFunction%"===e)n=$("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=$("async function* () {}");else if("%AsyncGenerator%"===e){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===e){var o=t("%AsyncGenerator%");o&&M&&(n=M(o.prototype))}return L[e]=n,n},R={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},U=A,G=O,W=U.call(Function.call,Array.prototype.concat),q=U.call(Function.apply,Array.prototype.splice),V=U.call(Function.call,String.prototype.replace),H=U.call(Function.call,String.prototype.slice),J=U.call(Function.call,RegExp.prototype.exec),z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Y=/\\(\\)?/g,X=function(t,e){var n,r=t;if(G(R,r)&&(r="%"+(n=R[r])[0]+"%"),G(L,r)){var o=L[r];if(o===I&&(o=B(r)),void 0===o&&!e)throw new N("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:r,value:o}}throw new E("intrinsic "+t+" does not exist!")},Z=function(t,e){if("string"!=typeof t||0===t.length)throw new N("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new N('"allowMissing" argument must be a boolean');if(null===J(/^%?[^%]*%?$/,t))throw new E("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(t){var e=H(t,0,1),n=H(t,-1);if("%"===e&&"%"!==n)throw new E("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new E("invalid intrinsic syntax, expected opening `%`");var r=[];return V(t,z,(function(t,e,n,o){r[r.length]=n?V(o,Y,"$1"):e||t})),r}(t),r=n.length>0?n[0]:"",o=X("%"+r+"%",e),i=o.name,s=o.value,a=!1,c=o.alias;c&&(r=c[0],q(n,W([0,1],c)));for(var u=1,l=!0;u<n.length;u+=1){var p=n[u],f=H(p,0,1),h=H(p,-1);if(('"'===f||"'"===f||"`"===f||'"'===h||"'"===h||"`"===h)&&f!==h)throw new E("property names with quotes must have matching quotes");if("constructor"!==p&&l||(a=!0),G(L,i="%"+(r+="."+p)+"%"))s=L[i];else if(null!=s){if(!(p in s)){if(!e)throw new N("base intrinsic for "+t+" exists, but the property is not available.");return}if(j&&u+1>=n.length){var d=j(s,p);s=(l=!!d)&&"get"in d&&!("originalValue"in d.get)?d.get:s[p]}else l=G(s,p),s=s[p];l&&!a&&(L[i]=s)}}return s},K=Z("%Object.defineProperty%",!0),Q=function(){if(K)try{return K({},"a",{value:1}),!0}catch(t){return!1}return!1};Q.hasArrayLengthDefineBug=function(){if(!Q())return null;try{return 1!==K([],"length",{value:1}).length}catch(t){return!0}};var tt=Q,et=y,nt="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),rt=Object.prototype.toString,ot=Array.prototype.concat,it=Object.defineProperty,st=tt(),at=it&&st,ct=function(t,e,n,r){if(e in t)if(!0===r){if(t[e]===n)return}else if("function"!=typeof(o=r)||"[object Function]"!==rt.call(o)||!r())return;var o;at?it(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n},ut=function(t,e){var n=arguments.length>2?arguments[2]:{},r=et(e);nt&&(r=ot.call(r,Object.getOwnPropertySymbols(e)));for(var o=0;o<r.length;o+=1)ct(t,r[o],e[r[o]],n[r[o]])};ut.supportsDescriptors=!!at;var lt=e,pt=function(){return"object"==typeof e&&e&&e.Math===Math&&e.Array===Array?e:lt},ft=ut,ht=pt,dt=ut,yt=e,mt=pt,vt=function(){var t=ht();if(ft.supportsDescriptors){var e=Object.getOwnPropertyDescriptor(t,"globalThis");e&&(!e.configurable||!e.enumerable&&e.writable&&globalThis===t)||Object.defineProperty(t,"globalThis",{configurable:!0,enumerable:!1,value:t,writable:!0})}else"object"==typeof globalThis&&globalThis===t||(t.globalThis=t);return t},gt=mt(),bt=function(){return gt};dt(bt,{getPolyfill:mt,implementation:yt,shim:vt});var _t,wt=bt,St=e&&e.__extends||(_t=function(t,e){return _t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},_t(t,e)},function(t,e){function n(){this.constructor=t}_t(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0}),n.NO_IL=n.NO=n.MemoryStream=ee=n.Stream=void 0;var At=s.default(wt.getPolyfill()),Ot={},Et=n.NO=Ot;function Ct(){}function Nt(t){for(var e=t.length,n=Array(e),r=0;r<e;++r)n[r]=t[r];return n}function $t(t,e,n){try{return t.f(e)}catch(t){return n._e(t),Ot}}var jt={_n:Ct,_e:Ct,_c:Ct};function xt(t){t._start=function(t){t.next=t._n,t.error=t._e,t.complete=t._c,this.start(t)},t._stop=t.stop}n.NO_IL=jt;var kt=function(){function t(t,e){this._stream=t,this._listener=e}return t.prototype.unsubscribe=function(){this._stream._remove(this._listener)},t}(),Pt=function(){function t(t){this._listener=t}return t.prototype.next=function(t){this._listener._n(t)},t.prototype.error=function(t){this._listener._e(t)},t.prototype.complete=function(){this._listener._c()},t}(),Tt=function(){function t(t){this.type="fromObservable",this.ins=t,this.active=!1}return t.prototype._start=function(t){this.out=t,this.active=!0,this._sub=this.ins.subscribe(new Pt(t)),this.active||this._sub.unsubscribe()},t.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},t}(),Mt=function(){function t(t){this.type="merge",this.insArr=t,this.out=Ot,this.ac=0}return t.prototype._start=function(t){this.out=t;var e=this.insArr,n=e.length;this.ac=n;for(var r=0;r<n;r++)e[r]._add(this)},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=0;n<e;n++)t[n]._remove(this);this.out=Ot},t.prototype._n=function(t){var e=this.out;e!==Ot&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){if(--this.ac<=0){var t=this.out;if(t===Ot)return;t._c()}},t}(),It=function(){function t(t,e,n){this.i=t,this.out=e,this.p=n,n.ils.push(this)}return t.prototype._n=function(t){var e=this.p,n=this.out;if(n!==Ot&&e.up(t,this.i)){var r=Nt(e.vals);n._n(r)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.p;t.out!==Ot&&0==--t.Nc&&t.out._c()},t}(),Dt=function(){function t(t){this.type="combine",this.insArr=t,this.out=Ot,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return t.prototype.up=function(t,e){var n=this.vals[e],r=this.Nn?n===Ot?--this.Nn:this.Nn:0;return this.vals[e]=t,0===r},t.prototype._start=function(t){this.out=t;var e=this.insArr,n=this.Nc=this.Nn=e.length,r=this.vals=new Array(n);if(0===n)t._n([]),t._c();else for(var o=0;o<n;o++)r[o]=Ot,e[o]._add(new It(o,t,this))},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=this.ils,r=0;r<e;r++)t[r]._remove(n[r]);this.out=Ot,this.ils=[],this.vals=[]},t}(),Lt=function(){function t(t){this.type="fromArray",this.a=t}return t.prototype._start=function(t){for(var e=this.a,n=0,r=e.length;n<r;n++)t._n(e[n]);t._c()},t.prototype._stop=function(){},t}(),Ft=function(){function t(t){this.type="fromPromise",this.on=!1,this.p=t}return t.prototype._start=function(t){var e=this;this.on=!0,this.p.then((function(n){e.on&&(t._n(n),t._c())}),(function(e){t._e(e)})).then(Ct,(function(t){setTimeout((function(){throw t}))}))},t.prototype._stop=function(){this.on=!1},t}(),Bt=function(){function t(t){this.type="periodic",this.period=t,this.intervalID=-1,this.i=0}return t.prototype._start=function(t){var e=this;this.intervalID=setInterval((function(){t._n(e.i++)}),this.period)},t.prototype._stop=function(){-1!==this.intervalID&&clearInterval(this.intervalID),this.intervalID=-1,this.i=0},t}(),Rt=function(){function t(t,e){this.type="debug",this.ins=t,this.out=Ot,this.s=Ct,this.l="","string"==typeof e?this.l=e:"function"==typeof e&&(this.s=e)}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=this.s,r=this.l;if(n!==Ct)try{n(t)}catch(t){e._e(t)}else r?console.log(r+":",t):console.log(t);e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Ut=function(){function t(t,e){this.type="drop",this.ins=e,this.out=Ot,this.max=t,this.dropped=0}return t.prototype._start=function(t){this.out=t,this.dropped=0,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;e!==Ot&&this.dropped++>=this.max&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Gt=function(){function t(t,e){this.out=t,this.op=e}return t.prototype._n=function(){this.op.end()},t.prototype._e=function(t){this.out._e(t)},t.prototype._c=function(){this.op.end()},t}(),Wt=function(){function t(t,e){this.type="endWhen",this.ins=e,this.out=Ot,this.o=t,this.oil=jt}return t.prototype._start=function(t){this.out=t,this.o._add(this.oil=new Gt(t,this)),this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.o._remove(this.oil),this.out=Ot,this.oil=jt},t.prototype.end=function(){var t=this.out;t!==Ot&&t._c()},t.prototype._n=function(t){var e=this.out;e!==Ot&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){this.end()},t}(),qt=function(){function t(t,e){this.type="filter",this.ins=e,this.out=Ot,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=$t(this,t,e);n!==Ot&&n&&e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Vt=function(){function t(t,e){this.out=t,this.op=e}return t.prototype._n=function(t){this.out._n(t)},t.prototype._e=function(t){this.out._e(t)},t.prototype._c=function(){this.op.inner=Ot,this.op.less()},t}(),Ht=function(){function t(t){this.type="flatten",this.ins=t,this.out=Ot,this.open=!0,this.inner=Ot,this.il=jt}return t.prototype._start=function(t){this.out=t,this.open=!0,this.inner=Ot,this.il=jt,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.inner!==Ot&&this.inner._remove(this.il),this.out=Ot,this.open=!0,this.inner=Ot,this.il=jt},t.prototype.less=function(){var t=this.out;t!==Ot&&(this.open||this.inner!==Ot||t._c())},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=this.inner,r=this.il;n!==Ot&&r!==jt&&n._remove(r),(this.inner=t)._add(this.il=new Vt(e,this))}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){this.open=!1,this.less()},t}(),Jt=function(){function t(t,e,n){var r=this;this.type="fold",this.ins=n,this.out=Ot,this.f=function(e){return t(r.acc,e)},this.acc=this.seed=e}return t.prototype._start=function(t){this.out=t,this.acc=this.seed,t._n(this.acc),this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot,this.acc=this.seed},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=$t(this,t,e);n!==Ot&&e._n(this.acc=n)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),zt=function(){function t(t){this.type="last",this.ins=t,this.out=Ot,this.has=!1,this.val=Ot}return t.prototype._start=function(t){this.out=t,this.has=!1,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot,this.val=Ot},t.prototype._n=function(t){this.has=!0,this.val=t},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&(this.has?(t._n(this.val),t._c()):t._e(new Error("last() failed because input stream completed")))},t}(),Yt=function(){function t(t,e){this.type="map",this.ins=e,this.out=Ot,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=$t(this,t,e);n!==Ot&&e._n(n)}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Xt=function(){function t(t){this.type="remember",this.ins=t,this.out=Ot}return t.prototype._start=function(t){this.out=t,this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=Ot},t}(),Zt=function(){function t(t,e){this.type="replaceError",this.ins=e,this.out=Ot,this.f=t}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;e!==Ot&&e._n(t)},t.prototype._e=function(t){var e=this.out;if(e!==Ot)try{this.ins._remove(this),(this.ins=this.f(t))._add(this)}catch(t){e._e(t)}},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),Kt=function(){function t(t,e){this.type="startWith",this.ins=t,this.out=Ot,this.val=e}return t.prototype._start=function(t){this.out=t,this.out._n(this.val),this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=Ot},t}(),Qt=function(){function t(t,e){this.type="take",this.ins=e,this.out=Ot,this.max=t,this.taken=0}return t.prototype._start=function(t){this.out=t,this.taken=0,this.max<=0?t._c():this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=Ot},t.prototype._n=function(t){var e=this.out;if(e!==Ot){var n=++this.taken;n<this.max?e._n(t):n===this.max&&(e._n(t),e._c())}},t.prototype._e=function(t){var e=this.out;e!==Ot&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ot&&t._c()},t}(),te=function(){function t(t){this._prod=t||Ot,this._ils=[],this._stopID=Ot,this._dl=Ot,this._d=!1,this._target=null,this._err=Ot}return t.prototype._n=function(t){var e=this._ils,n=e.length;if(this._d&&this._dl._n(t),1==n)e[0]._n(t);else{if(0==n)return;for(var r=Nt(e),o=0;o<n;o++)r[o]._n(t)}},t.prototype._e=function(t){if(this._err===Ot){this._err=t;var e=this._ils,n=e.length;if(this._x(),this._d&&this._dl._e(t),1==n)e[0]._e(t);else{if(0==n)return;for(var r=Nt(e),o=0;o<n;o++)r[o]._e(t)}if(!this._d&&0==n)throw this._err}},t.prototype._c=function(){var t=this._ils,e=t.length;if(this._x(),this._d&&this._dl._c(),1==e)t[0]._c();else{if(0==e)return;for(var n=Nt(t),r=0;r<e;r++)n[r]._c()}},t.prototype._x=function(){0!==this._ils.length&&(this._prod!==Ot&&this._prod._stop(),this._err=Ot,this._ils=[])},t.prototype._stopNow=function(){this._prod._stop(),this._err=Ot,this._stopID=Ot},t.prototype._add=function(t){var e=this._target;if(e)return e._add(t);var n=this._ils;if(n.push(t),!(n.length>1))if(this._stopID!==Ot)clearTimeout(this._stopID),this._stopID=Ot;else{var r=this._prod;r!==Ot&&r._start(this)}},t.prototype._remove=function(t){var e=this,n=this._target;if(n)return n._remove(t);var r=this._ils,o=r.indexOf(t);o>-1&&(r.splice(o,1),this._prod!==Ot&&r.length<=0?(this._err=Ot,this._stopID=setTimeout((function(){return e._stopNow()}))):1===r.length&&this._pruneCycles())},t.prototype._pruneCycles=function(){this._hasNoSinks(this,[])&&this._remove(this._ils[0])},t.prototype._hasNoSinks=function(t,e){if(-1!==e.indexOf(t))return!0;if(t.out===this)return!0;if(t.out&&t.out!==Ot)return this._hasNoSinks(t.out,e.concat(t));if(t._ils){for(var n=0,r=t._ils.length;n<r;n++)if(!this._hasNoSinks(t._ils[n],e.concat(t)))return!1;return!0}return!1},t.prototype.ctor=function(){return this instanceof ne?ne:t},t.prototype.addListener=function(t){t._n=t.next||Ct,t._e=t.error||Ct,t._c=t.complete||Ct,this._add(t)},t.prototype.removeListener=function(t){this._remove(t)},t.prototype.subscribe=function(t){return this.addListener(t),new kt(this,t)},t.prototype[At]=function(){return this},t.create=function(e){if(e){if("function"!=typeof e.start||"function"!=typeof e.stop)throw new Error("producer requires both start and stop functions");xt(e)}return new t(e)},t.createWithMemory=function(t){return t&&xt(t),new ne(t)},t.never=function(){return new t({_start:Ct,_stop:Ct})},t.empty=function(){return new t({_start:function(t){t._c()},_stop:Ct})},t.throw=function(e){return new t({_start:function(t){t._e(e)},_stop:Ct})},t.from=function(e){if("function"==typeof e[At])return t.fromObservable(e);if("function"==typeof e.then)return t.fromPromise(e);if(Array.isArray(e))return t.fromArray(e);throw new TypeError("Type of input to from() must be an Array, Promise, or Observable")},t.of=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.fromArray(e)},t.fromArray=function(e){return new t(new Lt(e))},t.fromPromise=function(e){return new t(new Ft(e))},t.fromObservable=function(e){if(void 0!==e.endWhen)return e;var n="function"==typeof e[At]?e[At]():e;return new t(new Tt(n))},t.periodic=function(e){return new t(new Bt(e))},t.prototype._map=function(t){return new(this.ctor())(new Yt(t,this))},t.prototype.map=function(t){return this._map(t)},t.prototype.mapTo=function(t){var e=this.map((function(){return t}));return e._prod.type="mapTo",e},t.prototype.filter=function(e){var n,r,o=this._prod;return new t(o instanceof qt?new qt((n=o.f,r=e,function(t){return n(t)&&r(t)}),o.ins):new qt(e,this))},t.prototype.take=function(t){return new(this.ctor())(new Qt(t,this))},t.prototype.drop=function(e){return new t(new Ut(e,this))},t.prototype.last=function(){return new t(new zt(this))},t.prototype.startWith=function(t){return new ne(new Kt(this,t))},t.prototype.endWhen=function(t){return new(this.ctor())(new Wt(t,this))},t.prototype.fold=function(t,e){return new ne(new Jt(t,e,this))},t.prototype.replaceError=function(t){return new(this.ctor())(new Zt(t,this))},t.prototype.flatten=function(){return new t(new Ht(this))},t.prototype.compose=function(t){return t(this)},t.prototype.remember=function(){return new ne(new Xt(this))},t.prototype.debug=function(t){return new(this.ctor())(new Rt(this,t))},t.prototype.imitate=function(t){if(t instanceof ne)throw new Error("A MemoryStream was given to imitate(), but it only supports a Stream. Read more about this restriction here: https://github.com/staltz/xstream#faq");this._target=t;for(var e=this._ils,n=e.length,r=0;r<n;r++)t._add(e[r]);this._ils=[]},t.prototype.shamefullySendNext=function(t){this._n(t)},t.prototype.shamefullySendError=function(t){this._e(t)},t.prototype.shamefullySendComplete=function(){this._c()},t.prototype.setDebugListener=function(t){t?(this._d=!0,t._n=t.next||Ct,t._e=t.error||Ct,t._c=t.complete||Ct,this._dl=t):(this._d=!1,this._dl=Ot)},t.merge=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Mt(e))},t.combine=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Dt(e))},t}(),ee=n.Stream=te,ne=function(t){function e(e){var n=t.call(this,e)||this;return n._has=!1,n}return St(e,t),e.prototype._n=function(e){this._v=e,this._has=!0,t.prototype._n.call(this,e)},e.prototype._add=function(t){var e=this._target;if(e)return e._add(t);var n=this._ils;if(n.push(t),n.length>1)this._has&&t._n(this._v);else if(this._stopID!==Ot)this._has&&t._n(this._v),clearTimeout(this._stopID),this._stopID=Ot;else if(this._has)t._n(this._v);else{var r=this._prod;r!==Ot&&r._start(this)}},e.prototype._stopNow=function(){this._has=!1,t.prototype._stopNow.call(this)},e.prototype._x=function(){this._has=!1,t.prototype._x.call(this)},e.prototype.map=function(t){return this._map(t)},e.prototype.mapTo=function(e){return t.prototype.mapTo.call(this,e)},e.prototype.take=function(e){return t.prototype.take.call(this,e)},e.prototype.endWhen=function(e){return t.prototype.endWhen.call(this,e)},e.prototype.replaceError=function(e){return t.prototype.replaceError.call(this,e)},e.prototype.remember=function(){return this},e.prototype.debug=function(e){return t.prototype.debug.call(this,e)},e}(te);n.MemoryStream=ne;var re=te,oe=n.default=re,ie={};function se(){var t;return(t="undefined"!=typeof window?window:void 0!==e?e:this).Cyclejs=t.Cyclejs||{},(t=t.Cyclejs).adaptStream=t.adaptStream||function(t){return t},t}Object.defineProperty(ie,"__esModule",{value:!0}),ie.setAdapt=function(t){se().adaptStream=t};var ae=ie.adapt=function(t){return se().adaptStream(t)};var ce=0;function ue(){return"cycle"+ ++ce}function le(t,e){void 0===e&&(e=ue()),function(t,e){if("function"!=typeof t)throw new Error("First argument given to isolate() must be a 'dataflowComponent' function");if(null===e)throw new Error("Second argument given to isolate() must not be null")}(t,e);var n="object"==typeof e?ue():"",r="string"==typeof e||"object"==typeof e?e:e.toString();return function(e){for(var o=[],i=1;i<arguments.length;i++)o[i-1]=arguments[i];var s=function(t,e,n){var r={};return Object.keys(t).forEach((function(t){if("string"!=typeof e){var o=e[t];if(void 0===o){var i=e["*"];r[t]=void 0===i?n:i}else r[t]=o}else r[t]=e})),r}(e,r,n),a=function(t,e){var n={};for(var r in t){var o=t[r];t.hasOwnProperty(r)&&o&&null!==e[r]&&"function"==typeof o.isolateSource?n[r]=o.isolateSource(o,e[r]):t.hasOwnProperty(r)&&(n[r]=t[r])}return n}(e,s),c=function(t,e,n){var r={};for(var o in e){var i=t[o],s=e[o];e.hasOwnProperty(o)&&i&&null!==n[o]&&"function"==typeof i.isolateSink?r[o]=ae(i.isolateSink(oe.fromObservable(s),n[o])):e.hasOwnProperty(o)&&(r[o]=e[o])}return r}(e,t.apply(void 0,[a].concat(o)),s);return c}}le.reset=function(){return ce=0};var pe={};Object.defineProperty(pe,"__esModule",{value:!0}),pe.DropRepeatsOperator=void 0;var fe=n,he={},de=function(){function t(t,e){this.ins=t,this.type="dropRepeats",this.out=null,this.v=he,this.isEq=e||function(t,e){return t===e}}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.v=he},t.prototype._n=function(t){var e=this.out;if(e){var n=this.v;n!==he&&this.isEq(t,n)||(this.v=t,e._n(t))}},t.prototype._e=function(t){var e=this.out;e&&e._e(t)},t.prototype._c=function(){var t=this.out;t&&t._c()},t}();pe.DropRepeatsOperator=de;var ye=pe.default=function(t){return void 0===t&&(t=void 0),function(e){return new fe.Stream(new de(e,t))}},me=function(){return me=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},me.apply(this,arguments)};function ve(t){return"string"==typeof t||"number"==typeof t?function(e){return void 0===e?void 0:e[t]}:t.get}function ge(t){return"string"==typeof t||"number"==typeof t?function(e,n){var r,o;return Array.isArray(e)?function(t,e,n){if(n===t[e])return t;var r=parseInt(e);return void 0===n?t.filter((function(t,e){return e!==r})):t.map((function(t,e){return e===r?n:t}))}(e,t,n):void 0===e?((r={})[t]=n,r):me({},e,((o={})[t]=n,o))}:t.set}function be(t,e){return t.select(e)}function _e(t,e){var n=ve(e),r=ge(e);return t.map((function(t){return function(e){var o=n(e),i=t(o);return o===i?e:r(e,i)}}))}var we=function(){function t(t,e){this.isolateSource=be,this.isolateSink=_e,this._stream=t.filter((function(t){return void 0!==t})).compose(ye()).remember(),this._name=e,this.stream=ae(this._stream),this._stream._isCycleSource=e}return t.prototype.select=function(e){var n=ve(e);return new t(this._stream.map(n),this._name)},t}(),Se=function(){function t(t,e,n){this.ins=n,this.out=t,this.p=e}return t.prototype._n=function(t){this.p;var e=this.out;null!==e&&e._n(t)},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){},t}(),Ae=function(){function t(t,e){this.type="pickMerge",this.ins=e,this.out=null,this.sel=t,this.ils=new Map,this.inst=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this);var t=this.ils;t.forEach((function(e,n){e.ins._remove(e),e.ins=null,e.out=null,t.delete(n)})),t.clear(),this.out=null,this.ils=new Map,this.inst=null},t.prototype._n=function(t){this.inst=t;for(var e=t.arr,n=this.ils,r=this.out,o=this.sel,i=e.length,s=0;s<i;++s){var a=e[s],c=a._key,u=oe.fromObservable(a[o]||oe.never());n.has(c)||(n.set(c,new Se(r,this,u)),u._add(n.get(c)))}n.forEach((function(e,r){t.dict.has(r)&&t.dict.get(r)||(e.ins._remove(e),e.ins=null,e.out=null,n.delete(r))}))},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){var t=this.out;null!==t&&t._c()},t}();var Oe=function(){function t(t,e,n,r){this.key=t,this.out=e,this.p=n,this.val=Et,this.ins=r}return t.prototype._n=function(t){this.p;var e=this.out;this.val=t,null!==e&&this.p.up()},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){},t}(),Ee=function(){function t(t,e){this.type="combine",this.ins=e,this.sel=t,this.out=null,this.ils=new Map,this.inst=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this);var t=this.ils;t.forEach((function(t){t.ins._remove(t),t.ins=null,t.out=null,t.val=null})),t.clear(),this.out=null,this.ils=new Map,this.inst=null},t.prototype.up=function(){for(var t=this.inst.arr,e=t.length,n=this.ils,r=Array(e),o=0;o<e;++o){var i=t[o]._key;if(!n.has(i))return;var s=n.get(i).val;if(s===Et)return;r[o]=s}this.out._n(r)},t.prototype._n=function(t){this.inst=t;var e=t.arr,n=this.ils,r=this.out,o=this.sel,i=t.dict,s=e.length,a=!1;if(n.forEach((function(t,e){i.has(e)||(t.ins._remove(t),t.ins=null,t.out=null,t.val=null,n.delete(e),a=!0)})),0!==s){for(var c=0;c<s;++c){var u=e[c],l=u._key;if(!u[o])throw new Error("pickCombine found an undefined child sink stream");var p=oe.fromObservable(u[o]);n.has(l)||(n.set(l,new Oe(l,r,this,p)),p._add(n.get(l)))}a&&this.up()}else r._n([])},t.prototype._e=function(t){var e=this.out;null!==e&&e._e(t)},t.prototype._c=function(){var t=this.out;null!==t&&t._c()},t}();var Ce=function(){return Ce=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Ce.apply(this,arguments)},Ne=function(){function t(t){this._instances$=t}return t.prototype.pickMerge=function(t){return ae(this._instances$.compose(function(t){return function(e){return new ee(new Ae(t,e))}}(t)))},t.prototype.pickCombine=function(t){return ae(this._instances$.compose(function(t){return function(e){return new ee(new Ee(t,e))}}(t)))},t}();function $e(t){return{"*":null}}function je(t,e){return{get:function(n){if(void 0!==n)for(var r=0,o=n.length;r<o;++r)if(""+t(n[r],r)===e)return n[r]},set:function(n,r){return void 0===n?[r]:void 0===r?n.filter((function(n,r){return""+t(n,r)!==e})):n.map((function(n,o){return""+t(n,o)===e?r:n}))}}}var xe={get:function(t){return t},set:function(t,e){return e}};var ke={};Object.defineProperty(ke,"__esModule",{value:!0});var Pe=n,Te=function(){function t(t){this.streams=t,this.type="concat",this.out=null,this.i=0}return t.prototype._start=function(t){this.out=t,this.streams[this.i]._add(this)},t.prototype._stop=function(){var t=this.streams;this.i<t.length&&t[this.i]._remove(this),this.i=0,this.out=null},t.prototype._n=function(t){var e=this.out;e&&e._n(t)},t.prototype._e=function(t){var e=this.out;e&&e._e(t)},t.prototype._c=function(){var t=this.out;if(t){var e=this.streams;e[this.i]._remove(this),++this.i<e.length?e[this.i]._add(this):t._c()}},t}();var Me=ke.default=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Pe.Stream(new Te(t))},Ie={};Object.defineProperty(Ie,"__esModule",{value:!0});var De=Ie.default=function(){return"undefined"!=typeof queueMicrotask?queueMicrotask:"undefined"!=typeof setImmediate?setImmediate:"undefined"!=typeof process?process.nextTick:setTimeout},Le=De();function Fe(t,e,n={}){const{combineList:r=["DOM"],globalList:o=["EVENTS"],stateSourceName:i="STATE",domSourceName:s="DOM",container:a="div",containerClass:c}=n;return n=>{const u=Date.now(),l={item:t,itemKey:(t,e)=>void 0!==t.id?t.id:e,itemScope:t=>t,channel:i,collectSinks:t=>Object.entries(n).reduce(((e,[n,o])=>{if(r.includes(n)){const r=t.pickCombine(n);n===s&&a?e[s]=r.map((t=>({sel:a,data:c?{props:{className:c}}:{},children:t,key:u,text:void 0,elm:void 0}))):e[n]=r}else e[n]=t.pickMerge(n);return e}),{})},p={[i]:e};return o.forEach((t=>p[t]=null)),r.forEach((t=>p[t]=null)),function(t,e,n){return le(function(t){return function(e){var n=t.channel||"state",r=t.itemKey,o=t.itemScope||$e,i=oe.fromObservable(e[n].stream).fold((function(i,s){var a,c,u,l,p,f=i.dict;if(Array.isArray(s)){for(var h=Array(s.length),d=new Set,y=0,m=s.length;y<m;++y){var v=""+(r?r(s[y],y):y);if(d.add(v),f.has(v))h[y]=f.get(v);else{var g=r?je(r,v):""+y,b="string"==typeof(p=o(v))?((a={"*":p})[n]=g,a):Ce({},p,((c={})[n]=g,c)),_=le(t.itemFactory?t.itemFactory(s[y],y):t.item,b)(e);f.set(v,_),h[y]=_}h[y]._key=v}return f.forEach((function(t,e){d.has(e)||f.delete(e)})),d.clear(),{dict:f,arr:h}}return f.clear(),v=""+(r?r(s,0):"this"),g=xe,b="string"==typeof(p=o(v))?((u={"*":p})[n]=g,u):Ce({},p,((l={})[n]=g,l)),_=le(t.itemFactory?t.itemFactory(s,0):t.item,b)(e),f.set(v,_),{dict:f,arr:[_]}}),{dict:new Map,arr:[]});return t.collectSinks(new Ne(i))}}(t),e)(n)}(l,p,n)}}function Be(t,e,n,r={}){const{switched:o=["DOM"],stateSourceName:i="STATE"}=r,s=typeof e;if(!e)throw new Error("Missing 'name$' parameter for switchable()");if(!("string"===s||"function"===s||e instanceof ee))throw new Error("Invalid 'name$' parameter for switchable(): expects Stream, String, or Function");if(e instanceof ee){const r=e.compose(ye()).startWith(n).remember();return e=>Re(t,e,r,o)}{const r="function"===s&&e||(t=>t[e]);return e=>{const s=e&&("string"==typeof i&&e[i]||e.STATE||e.state).stream;if(!s instanceof ee)throw new Error(`Could not find the state source: ${i}`);const a=s.map(r).filter((t=>"string"==typeof t)).compose(ye()).startWith(n).remember();return Re(t,e,a,o,i)}}}function Re(t,e,n,r=["DOM"],o="STATE"){"string"==typeof r&&(r=[r]);const i=Object.entries(t).map((([t,r])=>{if(e[o]){const i=e[o].stream,s=oe.combine(n,i).filter((([e,n])=>e==t)).map((([t,e])=>e)).remember(),a=new e[o].constructor(s,e[o]._name);return[t,r({...e,state:a})]}return[t,r(e)]}));return Object.keys(e).reduce(((t,e)=>{if(r.includes(e))t[e]=n.map((t=>{const n=i.find((([e,n])=>e===t));return n&&n[1][e]||oe.never()})).flatten().remember().startWith(void 0);else{const n=i.filter((([t,n])=>void 0!==n[e])).map((([t,n])=>n[e]));t[e]=oe.merge(...n)}return t}),{})}var Ue={};Object.defineProperty(Ue,"__esModule",{value:!0});var Ge=n,We=function(){function t(t,e){this.dt=t,this.ins=e,this.type="delay",this.out=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null},t.prototype._n=function(t){var e=this.out;if(e)var n=setInterval((function(){e._n(t),clearInterval(n)}),this.dt)},t.prototype._e=function(t){var e=this.out;if(e)var n=setInterval((function(){e._e(t),clearInterval(n)}),this.dt)},t.prototype._c=function(){var t=this.out;if(t)var e=setInterval((function(){t._c(),clearInterval(e)}),this.dt)},t}();var qe=Ue.default=function(t){return function(e){return new Ge.Stream(new We(t,e))}},Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});var He=n,Je=function(){function t(t,e){this.dt=t,this.ins=e,this.type="debounce",this.out=null,this.id=null,this.t=He.NO}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.clearInterval()},t.prototype.clearInterval=function(){var t=this.id;null!==t&&clearInterval(t),this.id=null},t.prototype._n=function(t){var e=this,n=this.out;n&&(this.clearInterval(),this.t=t,this.id=setInterval((function(){e.clearInterval(),n._n(t),e.t=He.NO}),this.dt))},t.prototype._e=function(t){var e=this.out;e&&(this.clearInterval(),e._e(t))},t.prototype._c=function(){var t=this.out;t&&(this.clearInterval(),this.t!=He.NO&&t._n(this.t),this.t=He.NO,t._c())},t}();var ze=Ve.default=function(t){return function(e){return new He.Stream(new Je(t,e))}};const Ye="undefined"!=typeof window&&window||process&&process.env||{},Xe="BOOTSTRAP",Ze="INITIALIZE",Ke="PARENT";let Qe=0;const tn="~#~#~ABORT~#~#~";function en(t){const{name:e,sources:n,isolateOpts:r,stateSourceName:o="STATE"}=t;if(n&&!ln(n))throw new Error("Sources must be a Cycle.js sources object:",e);let i;i="string"==typeof r?{[o]:r}:!0===r?{}:r;const s=void 0===n;let a;if(ln(i)){const e=e=>{const n={...t,sources:e};return new nn(n).sinks};a=s?le(e,i):le(e,i)(n)}else a=s?e=>new nn({...t,sources:e}).sinks:new nn(t).sinks;return a.componentName=e,a.isSygnalComponent=!0,a}class nn{constructor({name:t="NO NAME",sources:e,intent:n,model:r,hmrActions:o,context:i,response:s,view:a,peers:c={},components:u={},initialState:l,calculated:p,storeCalculatedInState:f=!0,DOMSourceName:h="DOM",stateSourceName:d="STATE",requestSourceName:y="HTTP",debug:m=!1}){if(!e||!ln(e))throw new Error("Missing or invalid sources");this.name=t,this.sources=e,this.intent=n,this.model=r,this.hmrActions=o,this.context=i,this.response=s,this.view=a,this.peers=c,this.components=u,this.initialState=l,this.calculated=p,this.storeCalculatedInState=f,this.DOMSourceName=h,this.stateSourceName=d,this.requestSourceName=y,this.sourceNames=Object.keys(e),this._debug=m,this.isSubComponent=this.sourceNames.includes("props$");const v=e[d]&&e[d].stream;v&&(this.currentState=l||{},this.sources[d]=new we(v.map((t=>(this.currentState=t,t)))));const g=e.props$;g&&(this.sources.props$=g.map((t=>(this.currentProps=t,t))));const b=e.children$;b&&(this.sources.children$=b.map((t=>(this.currentChildren=t,t)))),this.isSubComponent||void 0!==this.intent||void 0!==this.model||(this.initialState=l||!0,this.intent=t=>({__NOOP_ACTION__:oe.never()}),this.model={__NOOP_ACTION__:t=>t});const _=Qe++;this.addCalculated=this.createMemoizedAddCalculated(),this.log=function(t){return function(e,n=!1){const r="function"==typeof e?e:t=>e;return n?void(this.debug&&console.log(`[${t}] ${r(e)}`)):e=>e.debug((e=>{this.debug&&console.log(`[${t}] ${r(e)}`)}))}}(`${_} | ${t}`),this.initChildSources$(),this.initIntent$(),this.initHmrActions(),this.initAction$(),this.initState(),this.initContext(),this.initModel$(),this.initPeers$(),this.initSubComponentSink$(),this.initSubComponentsRendered$(),this.initVdom$(),this.initSinks(),this.sinks.__index=_,this.log("Instantiated",!0)}get debug(){return this._debug||"true"===Ye.SYGNAL_DEBUG||!0===Ye.SYGNAL_DEBUG}initIntent$(){if(this.intent){if("function"!=typeof this.intent)throw new Error("Intent must be a function");if(this.intent$=this.intent(this.sources),!(this.intent$ instanceof ee||ln(this.intent$)))throw new Error("Intent must return either an action$ stream or map of event streams")}}initHmrActions(){if(void 0!==this.hmrActions){if("string"==typeof this.hmrActions&&(this.hmrActions=[this.hmrActions]),!Array.isArray(this.hmrActions))throw new Error(`[${this.name}] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`);if(this.hmrActions.some((t=>"string"!=typeof t)))throw new Error(`[${this.name}] hmrActions must be the name of an action or an array of names of actions to run when a component is hot-reloaded`);this.hmrAction$=oe.fromArray(this.hmrActions.map((t=>({type:t}))))}else this.hmrAction$=oe.of().filter((t=>!1))}initAction$(){const t=this.sources&&this.sources[this.requestSourceName]||null;if(!this.intent$)return void(this.action$=oe.never());let e;if(this.intent$ instanceof ee)e=this.intent$;else{const t=Object.entries(this.intent$).map((([t,e])=>e.map((e=>({type:t,data:e})))));e=oe.merge(oe.never(),...t)}const n=e instanceof ee?e:e.apply&&e(this.sources)||oe.never(),r=oe.of({type:Xe}).compose(qe(10)),o=!0===window?.__SYGNAL_HMR_UPDATING?this.hmrAction$:oe.of().filter((t=>!1)),i=this.model[Xe]&&!0!==window?.__SYGNAL_HMR_UPDATING?Me(r,n):Me(oe.of().compose(qe(1)).filter((t=>!1)),o,n);let s;s=!0!==window?.__SYGNAL_HMR_UPDATING&&t&&"function"==typeof t.select?t.select("initial").flatten():oe.never();const a=s.map((t=>({type:"HYDRATE",data:t})));this.action$=oe.merge(i,a).compose(this.log((({type:t})=>`<${t}> Action triggered`)))}initState(){void 0!==this.model&&(void 0===this.model[Ze]?this.model[Ze]={[this.stateSourceName]:(t,e)=>({...this.addCalculated(e)})}:ln(this.model[Ze])&&Object.keys(this.model[Ze]).forEach((t=>{t!==this.stateSourceName&&(console.warn(`${Ze} can only be used with the ${this.stateSourceName} source... disregarding ${t}`),delete this.model[Ze][t])})))}initContext(){if(!this.context&&!this.sources.__parentContext$)return void(this.context$=oe.of({}));const t=this.sources[this.stateSourceName]?.stream.startWith({}).compose(ye(un))||oe.never(),e=this.sources.__parentContext$.startWith({}).compose(ye(un))||oe.of({});this.context&&!ln(this.context)&&console.error(`[${this.name}] Context must be an object mapping names to values of functions: ignoring provided ${typeof this.context}`),this.context$=oe.combine(t,e).map((([t,e])=>{const n=ln(e)?e:{},r=ln(this.context)?this.context:{},o=this.currentState,i={...n,...Object.entries(r).reduce(((t,e)=>{const[n,r]=e;let i;const s=typeof r;if("string"===s)i=o[r];else if("boolean"===s)i=o[n];else{if("function"!==s)return console.error(`[${this.name}] Invalid context entry '${n}': must be the name of a state property or a function returning a value to use`),t;i=r(o)}return t[n]=i,t}),{})};return this.currentContext=i,i})).compose(ye(un)).startWith({}),this.context$.subscribe({next:t=>t})}initModel$(){if(void 0===this.model)return void(this.model$=this.sourceNames.reduce(((t,e)=>(t[e]=oe.never(),t)),{}));const t={type:Ze,data:this.initialState};this.isSubComponent&&this.initialState&&console.warn(`[${this.name}] Initial state provided to sub-component. This will overwrite any state provided by the parent component.`);const e=this.initialState&&!0!==window?.__SYGNAL_HMR_UPDATING?Me(oe.of(t),this.action$).compose(qe(0)):this.action$,n=()=>this.makeOnAction(e,!0,this.action$),r=()=>this.makeOnAction(this.action$,!1,this.action$),o=Object.entries(this.model),i={};o.forEach((t=>{let[e,o]=t;if("function"==typeof o&&(o={[this.stateSourceName]:o}),!ln(o))throw new Error(`Entry for each action must be an object: ${this.name} ${e}`);Object.entries(o).forEach((t=>{const[o,s]=t,a=o===this.stateSourceName,c=o===Ke,u=a?n():r(),l=(c?u(e,s).map((t=>({name:this.name,value:t}))):u(e,s)).compose(this.log((t=>{if(a)return`<${e}> State reducer added`;if(c)return`<${e}> Data sent to parent component: ${JSON.stringify(t.value).replaceAll('"',"")}`;{const n=t&&(t.type||t.command||t.name||t.key||Array.isArray(t)&&"Array"||t);return`<${e}> Data sent to [${o}]: ${JSON.stringify(n).replaceAll('"',"")}`}})));Array.isArray(i[o])?i[o].push(l):i[o]=[l]}))}));const s=Object.entries(i).reduce(((t,e)=>{const[n,r]=e;return t[n]=oe.merge(oe.never(),...r),t}),{});this.model$=s}initPeers$(){const t=this.sourceNames.reduce(((t,e)=>(e==this.DOMSourceName?t[e]={}:t[e]=[],t)),{});this.peers$=Object.entries(this.peers).reduce(((t,[e,n])=>{const r=n(this.sources);return this.sourceNames.forEach((n=>{n==this.DOMSourceName?t[n][e]=r[n]:t[n].push(r[n])})),t}),t)}initChildSources$(){let t;const e=oe.create({start:e=>{t=e.next.bind(e)},stop:t=>{}}).map((t=>oe.merge(...t))).flatten();this.sources.CHILD={select:t=>{const n=e;return(t?n.filter((e=>e.name===t)):n).map((t=>t.value))}},this.newChildSources=e=>{"function"==typeof t&&t(e)}}initSubComponentSink$(){const t=oe.create({start:t=>{this.newSubComponentSinks=t.next.bind(t)},stop:t=>{}});t.subscribe({next:t=>t}),this.subComponentSink$=t.filter((t=>Object.keys(t).length>0))}initSubComponentsRendered$(){const t=oe.create({start:t=>{this.triggerSubComponentsRendered=t.next.bind(t)},stop:t=>{}});this.subComponentsRendered$=t.startWith(null)}initVdom$(){if("function"!=typeof this.view)return void(this.vdom$=oe.of(null));const t=this.collectRenderParameters();this.vdom$=t.map(this.view).compose(this.log("View rendered")).map((t=>t||{sel:"div",data:{},children:[]})).compose(this.instantiateSubComponents.bind(this)).filter((t=>void 0!==t)).compose(this.renderVdom.bind(this))}initSinks(){this.sinks=this.sourceNames.reduce(((t,e)=>{if(e==this.DOMSourceName)return t;const n=this.subComponentSink$&&e!==Ke?this.subComponentSink$.map((t=>t[e])).filter((t=>!!t)).flatten():oe.never();return e===this.stateSourceName?t[e]=oe.merge(this.model$[e]||oe.never(),n,this.sources[this.stateSourceName].stream.filter((t=>!1)),...this.peers$[e]||[]):t[e]=oe.merge(this.model$[e]||oe.never(),n,...this.peers$[e]||[]),t}),{}),this.sinks[this.DOMSourceName]=this.vdom$,this.sinks[Ke]=this.model$[Ke]||oe.never()}makeOnAction(t,e=!0,n){return n=n||t,(r,o)=>{const i=t.filter((({type:t})=>t==r));let s;if("function"==typeof o)s=i.map((t=>{const i=(t,e,o=10)=>{if("number"!=typeof o)throw new Error(`[${this.name} ] Invalid delay value provided to next() function in model action '${r}'. Must be a number in ms.`);setTimeout((()=>{n.shamefullySendNext({type:t,data:e})}),o),this.log(`<${r}> Triggered a next() action: <${t}> ${o}ms delay`,!0)},s={props:this.currentProps,children:this.currentChildren,context:this.currentContext};let a=t.data;if(e)return t=>{const e=this.isSubComponent?this.currentState:t,n=this.addCalculated(e),r=o(n,a,i,s);return r==tn?e:this.cleanupCalculated(r)};{const t=this.addCalculated(this.currentState),e=o(t,a,i,s),n=typeof e;if(ln(e)||["string","number","boolean","function"].includes(n))return e;if("undefined"==n)return console.warn(`'undefined' value sent to ${r}`),e;throw new Error(`Invalid reducer type for ${r} ${n}`)}})).filter((t=>t!=tn));else if(void 0===o||!0===o)s=i.map((({data:t})=>t));else{const t=o;s=i.mapTo(t)}return s}}createMemoizedAddCalculated(){let t,e;return function(n){if(!this.calculated||!ln(n)||Array.isArray(n))return n;if(n===t)return e;if(!ln(this.calculated))throw new Error("'calculated' parameter must be an object mapping calculated state field named to functions");const r=this.getCalculatedValues(n);if(!r)return t=n,e=n,n;const o={...n,...r};return t=n,e=o,o}}getCalculatedValues(t){const e=Object.entries(this.calculated||{});if(0!==e.length)return e.reduce(((e,[n,r])=>{if("function"!=typeof r)throw new Error(`Missing or invalid calculator function for calculated field '${n}`);try{e[n]=r(t)}catch(t){console.warn(`Calculated field '${n}' threw an error during calculation: ${t.message}`)}return e}),{})}cleanupCalculated(t){if(!t||!ln(t)||Array.isArray(t))return t;const e={...this.storeCalculatedInState?this.addCalculated(t):t};if(!this.calculated||this.storeCalculatedInState)return e;return Object.keys(this.calculated).forEach((t=>{this.initialState&&void 0!==this.initialState[t]?e[t]=this.initialState[t]:delete e[t]})),e}collectRenderParameters(){const t=this.sources[this.stateSourceName],e={...this.peers$[this.DOMSourceName]},n=t&&t.isolateSource(t,{get:t=>this.addCalculated(t)}),r=n&&n.stream||oe.never();e.state=r.compose(ye(un)),this.sources.props$&&(e.props=this.sources.props$.compose(ye(cn))),this.sources.children$&&(e.children=this.sources.children$.compose(ye(un))),this.context$&&(e.context=this.context$.compose(ye(un)));const o=[],i=[];Object.entries(e).forEach((([t,e])=>{o.push(t),i.push(e)}));return oe.combine(...i).compose(ze(1)).map((t=>o.reduce(((e,n,r)=>(e[n]=t[r],"state"===n&&(e[this.stateSourceName]=t[r],e.calculated=t[r]&&this.getCalculatedValues(t[r])||{}),e)),{})))}instantiateSubComponents(t){return t.fold(((t,e)=>{const n=rn(e,Object.keys(this.components)),r=Object.entries(n),o={"::ROOT::":e};if(0===r.length)return o;const i={},s=[];let a=0;const c=r.reduce(((e,[n,r])=>{const o=r.data,c=o.props||{},u=r.children||[],l=o.isCollection||!1,p=o.isSwitchable||!1,f=t=>{Object.entries(t).forEach((([t,e])=>{i[t]||=[],t===Ke?s.push(e):t!==this.DOMSourceName&&i[t].push(e)}))};if(t[n]){const r=t[n];return e[n]=r,r.props$.shamefullySendNext(c),r.children$.shamefullySendNext(u),f(r.sink$),e}const h=oe.create().startWith(c),d=oe.create().startWith(u);let y;y=l?this.instantiateCollection.bind(this):p?this.instantiateSwitchable.bind(this):this.instantiateCustomComponent.bind(this),a++;const m=y(r,h,d);return m[this.DOMSourceName]=m[this.DOMSourceName]?this.makeCoordinatedSubComponentDomSink(m[this.DOMSourceName]):oe.never(),e[n]={sink$:m,props$:h,children$:d},f(m),e}),o),u=Object.entries(i).reduce(((t,[e,n])=>(0===n.length||(t[e]=1===n.length?n[0]:oe.merge(...n)),t)),{});return this.newSubComponentSinks(u),this.newChildSources(s),a>0&&this.log(`New sub components instantiated: ${a}`,!0),c}),{})}makeCoordinatedSubComponentDomSink(t){const e=t.remember();return this.sources[this.stateSourceName].stream.compose(ye(un)).map((t=>e)).flatten().debug((t=>this.triggerSubComponentsRendered())).remember()}instantiateCollection(t,e,n){const r=t.data.props||{};const o={filter:"function"==typeof r.filter?r.filter:void 0,sort:hn(r.sort)},i=oe.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState),e.startWith(r)).compose(ze(1)).map((([t,e])=>(e.filter!==o.filter&&(o.filter="function"==typeof e.filter?e.filter:void 0),e.sort!==o.sort&&(o.sort=hn(e.sort)),ln(t)?this.addCalculated(t):t))),s=new we(i),a=r.from,c=r.of,u=r.idfield||"id";let l,p;if("function"==typeof c)if(c.isSygnalComponent)p=c;else{const t=c.componentName||c.label||c.name||"FUNCTION_COMPONENT",e=c,{model:n,intent:r,hmrActions:o,context:i,peers:s,components:a,initialState:u,calculated:l,storeCalculatedInState:f,DOMSourceName:h,stateSourceName:d,debug:y}=c;p=en({name:t,view:e,model:n,intent:r,hmrActions:o,context:i,peers:s,components:a,initialState:u,calculated:l,storeCalculatedInState:f,DOMSourceName:h,stateSourceName:d,debug:y})}else{if(!this.components[c])throw new Error(`[${this.name}] Invalid 'of' propery in collection: ${c}`);p=this.components[c]}const f={get:t=>{if(!Array.isArray(t[a]))return[];const e=t[a],n="function"==typeof o.filter?e.filter(o.filter):e;return(o.sort,n.sort(o.sort)).map(((t,e)=>ln(t)?{...t,[u]:t[u]||e}:{value:t,[u]:e}))},set:(t,e)=>{if(this.calculated&&a in this.calculated)return console.warn(`Collection sub-component of ${this.name} attempted to update state on a calculated field '${a}': Update ignored`),t;const n=[];for(const r of t[a].map(((t,e)=>ln(t)?{...t,[u]:t[u]||e}:{__primitive:!0,value:t,[u]:e})))if("function"!=typeof o.filter||o.filter(r)){const t=e.find((t=>t[u]===r[u]));void 0!==t&&n.push(r.__primitive?t.value:t)}else n.push(r.__primitive?r.value:r);return{...t,[a]:n}}};void 0===a?l={get:t=>!(t instanceof Array)&&t.value&&t.value instanceof Array?t.value:t,set:(t,e)=>e}:"string"==typeof a?ln(this.currentState)?this.currentState&&a in this.currentState||this.calculated&&a in this.calculated?(Array.isArray(this.currentState[a])||console.warn(`State property '${a}' in collection comopnent of ${this.name} is not an array: No components will be instantiated in the collection.`),l=f):(console.error(`Collection component in ${this.name} is attempting to use non-existent state property '${a}': To fix this error, specify a valid array property on the state. Attempting to use parent component state.`),l=void 0):(Array.isArray(this.currentState[a])||console.warn(`State property '${a}' in collection component of ${this.name} is not an array: No components will be instantiated in the collection.`),l=f):ln(a)?"function"!=typeof a.get?(console.error(`Collection component in ${this.name} has an invalid 'from' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting child state from the current state. Attempting to use parent component state.`),l=void 0):l={get:t=>{const e=a.get(t);return Array.isArray(e)?e:(console.warn(`State getter function in collection component of ${this.name} did not return an array: No components will be instantiated in the collection. Returned value:`,e),[])},set:a.set}:(console.error(`Collection component in ${this.name} has an invalid 'from' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting child state from the current state. Attempting to use parent component state.`),l=void 0);const h={...this.sources,[this.stateSourceName]:s,props$:e,children$:n,__parentContext$:this.context$,PARENT:null},d=Fe(p,l,{container:null})(h);if(!ln(d))throw new Error("Invalid sinks returned from component factory of collection element");return d}instantiateSwitchable(t,e,n){const r=t.data.props||{},o=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>ln(t)?this.addCalculated(t):t)),i=new we(o),s=r.state;let a;const c={get:t=>t,set:(t,e)=>e};void 0===s?a=c:"string"==typeof s?a={get:t=>t[s],set:(t,e)=>this.calculated&&s in this.calculated?(console.warn(`Switchable sub-component of ${this.name} attempted to update state on a calculated field '${s}': Update ignored`),t):!ln(e)||Array.isArray(e)?{...t,[s]:e}:{...t,[s]:e}}:ln(s)?"function"!=typeof s.get?(console.error(`Switchable component in ${this.name} has an invalid 'state' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting sub-component state from the current state. Attempting to use parent component state.`),a=c):a={get:s.get,set:s.set}:(console.error(`Invalid state provided to switchable sub-component of ${this.name}: Expecting string, object, or undefined, but found ${typeof s}. Attempting to use parent component state.`),a=c);const u=r.of;Object.keys(u).forEach((t=>{const e=u[t];if(!e.isSygnalComponent){const n=e.componentName||e.label||e.name||"FUNCTION_COMPONENT",r=e,{model:o,intent:i,hmrActions:s,context:a,peers:c,components:l,initialState:p,calculated:f,storeCalculatedInState:h,DOMSourceName:d,stateSourceName:y,debug:m}=e,v={name:n,view:r,model:o,intent:i,hmrActions:s,context:a,peers:c,components:l,initialState:p,calculated:f,storeCalculatedInState:h,DOMSourceName:d,stateSourceName:y,debug:m};u[t]=en(v)}}));const l={...this.sources,[this.stateSourceName]:i,props$:e,children$:n,__parentContext$:this.context$},p=le(Be(u,e.map((t=>t.current))),{[this.stateSourceName]:a})(l);if(!ln(p))throw new Error("Invalid sinks returned from component factory of switchable element");return p}instantiateCustomComponent(t,e,n){const r=t.sel,o=t.data.props||{},i=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>ln(t)?this.addCalculated(t):t)),s=new we(i),a=o.state;"function"!=typeof o.sygnalFactory&&ln(o.sygnalOptions)&&(o.sygnalFactory=en(o.sygnalOptions));const c="sygnal-factory"===r?o.sygnalFactory:this.components[r]||o.sygnalFactory;if(!c){if("sygnal-factory"===r)throw new Error("Component not found on element with Capitalized selector and nameless function: JSX transpilation replaces selectors starting with upper case letters with functions in-scope with the same name, Sygnal cannot see the name of the resulting component.");throw new Error(`Component not found: ${r}`)}let u;const l={get:t=>t,set:(t,e)=>e};void 0===a?u=l:"string"==typeof a?u={get:t=>t[a],set:(t,e)=>this.calculated&&a in this.calculated?(console.warn(`Sub-component of ${this.name} attempted to update state on a calculated field '${a}': Update ignored`),t):{...t,[a]:e}}:ln(a)?"function"!=typeof a.get?(console.error(`Sub-component in ${this.name} has an invalid 'state' field: Expecting 'undefined', a string indicating an array property in the state, or an object with 'get' and 'set' functions for retrieving and setting sub-component state from the current state. Attempting to use parent component state.`),u=l):u={get:a.get,set:a.set}:(console.error(`Invalid state provided to sub-component of ${this.name}: Expecting string, object, or undefined, but found ${typeof a}. Attempting to use parent component state.`),u=l);const p={...this.sources,[this.stateSourceName]:s,props$:e,children$:n,__parentContext$:this.context$},f=le(c,{[this.stateSourceName]:u})(p);if(!ln(f)){throw new Error("Invalid sinks returned from component factory:","sygnal-factory"===r?"custom element":r)}return f}renderVdom(t){return oe.combine(this.subComponentsRendered$,t).compose(ze(1)).map((([t,e])=>{const n=Object.keys(this.components),r=e["::ROOT::"],o=Object.entries(e).filter((([t])=>"::ROOT::"!==t));if(0===o.length)return oe.of(r);const i=[],s=o.map((([t,e])=>(i.push(t),e.sink$[this.DOMSourceName].startWith(void 0))));return 0===s.length?oe.of(r):oe.combine(...s).compose(ze(1)).map((t=>{const e=t.reduce(((t,e,n)=>(t[i[n]]=e,t)),{});return on(an(r),e,n)}))})).flatten().filter((t=>!!t)).remember()}}function rn(t,e,n=0,r=0,o){if(!t)return{};if(t.data?.componentsProcessed)return{};0===n&&(t.data.componentsProcessed=!0);const i=t.sel,s=i&&"collection"===i.toLowerCase(),a=i&&"switchable"===i.toLowerCase(),c=i&&["collection","switchable","sygnal-factory",...e].includes(i)||"function"==typeof t.data?.props?.sygnalFactory||ln(t.data?.props?.sygnalOptions),u=t.data&&t.data.props||{};t.data&&t.data.attrs;const l=t.children||[];let p={},f=o;if(c){if(f=sn(t,n,r,o),s){if(!u.of)throw new Error("Collection element missing required 'component' property");if("string"!=typeof u.of&&"function"!=typeof u.of)throw new Error(`Invalid 'component' property of collection element: found ${typeof u.of} requires string or component factory function`);if("function"!=typeof u.of&&!e.includes(u.of))throw new Error(`Specified component for collection not found: ${u.of}`);void 0===u.from||"string"==typeof u.from||Array.isArray(u.from)||"function"==typeof u.from.get||console.warn(`No valid array found for collection ${"string"==typeof u.of?u.of:"function component"}: no collection components will be created`,u.from),t.data.isCollection=!0,t.data.props||={}}else if(a){if(!u.of)throw new Error("Switchable element missing required 'of' property");if(!ln(u.of))throw new Error(`Invalid 'of' property of switchable element: found ${typeof u.of} requires object mapping names to component factories`);if(!Object.values(u.of).every((t=>"function"==typeof t)))throw new Error("One or more components provided to switchable element is not a valid component factory");if(!u.current||"string"!=typeof u.current&&"function"!=typeof u.current)throw new Error(`Missing or invalid 'current' property for switchable element: found '${typeof u.current}' requires string or function`);if(!Object.keys(u.of).includes(u.current))throw new Error(`Component '${u.current}' not found in switchable element`);t.data.isSwitchable=!0}void 0===u.key&&(t.data.props.key=f),p[f]=t}return l.length>0&&l.map(((t,o)=>rn(t,e,n+1,r+o,f))).forEach((t=>{Object.entries(t).forEach((([t,e])=>p[t]=e))})),p}function on(t,e,n,r=0,o=0,i){if(!t)return;if(t.data?.componentsInjected)return t;0===r&&t.data&&(t.data.componentsInjected=!0);const s=t.sel||"NO SELECTOR",a=["collection","switchable","sygnal-factory",...n].includes(s)||"function"==typeof t.data?.props?.sygnalFactory||ln(t.data?.props?.sygnalOptions),c=t?.data?.isCollection;t.data&&t.data.props;const u=t.children||[];let l=i;if(a){l=sn(t,r,o,i);const n=e[l];return c?(t.sel="div",t.children=Array.isArray(n)?n:[n],t):n}return u.length>0?(t.children=u.map(((t,i)=>on(t,e,n,r+1,o+i,l))).flat(),t):t}function sn(t,e,n,r){const o=t.sel,i="string"==typeof o?o:"functionComponent",s=`${e}:${n}`,a=t.data?.props||{};return`${r?`${r}|`:""}${i}::${a.id&&JSON.stringify(a.id).replaceAll('"',"")||s}`}function an(t){return void 0===t?t:{...t,children:Array.isArray(t.children)?t.children.map(an):void 0,data:t.data&&{...t.data,componentsInjected:!1}}}function cn(t,e){return un(function(t){if(!ln(t))return t;const{state:e,of:n,from:r,filter:o,...i}=t;return i}(t))}function un(t,e,n=5,r=0){if(r>n)return!1;if(t===e)return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return!1;for(let o=0;o<t.length;o++)if(!un(t[o],e[o],n,r+1))return!1;return!0}const o=Object.keys(t),i=Object.keys(e);if(o.length!==i.length)return!1;for(const s of o){if(!i.includes(s))return!1;if(!un(t[s],e[s],n,r+1))return!1}return!0}function ln(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function pn(t,e,n=!0){const r=n?1:-1;switch(!0){case t>e:return 1*r;case t<e:return-1*r;default:return 0}}function fn(t){const e=Object.entries(t);if(e.length>1)return void console.error("Sort objects can only have one key:",t);const n=e[0],[r,o]=n;if(!["string","number"].includes(typeof o))return void console.error("Sort object properties must be a string or number:",t);let i=!0;if("string"==typeof o){if(!["asc","dec"].includes(o.toLowerCase()))return void console.error("Sort object string values must be asc or dec:",t);i="asc"===o.toLowerCase()}if("number"==typeof o){if(1!==o&&-1!==o)return void console.error("Sort object number values must be 1 or -1:",t);i=1===o}return(t,e)=>pn(t[r],e[r],i)}function hn(t){if(!t)return;const e=typeof t;if("function"===e)return t;if("string"===e){if("asc"===t.toLowerCase()||"dec"===t.toLowerCase()){const e="asc"===t.toLowerCase();return(t,n)=>pn(t,n,e)}const e=t;return(t,n)=>pn(t[e],n[e],!0)}if(Array.isArray(t)){const e=t.map((t=>"function"==typeof t?t:"string"!=typeof t||["asc","dec"].includes(t.toLowerCase())?ln(t)?fn(t):void 0:(e,n)=>pn(e[t],n[t],!0)));return(t,n)=>e.filter((t=>"function"==typeof t)).reduce(((e,r)=>0!==e?e:r(t,n)),0)}return ln(t)?fn(t):void console.error("Invalid sort option (ignoring):",item)}function dn(t){return function(){var t;return(t="undefined"!=typeof window?window:"undefined"!=typeof global?global:this).Cyclejs=t.Cyclejs||{},(t=t.Cyclejs).adaptStream=t.adaptStream||function(t){return t},t}().adaptStream(t)}function yn(t){return 0===Object.keys(t).length}function mn(t,e){if("function"!=typeof t)throw new Error("First argument given to Cycle must be the 'main' function.");if("object"!=typeof e||null===e)throw new Error("Second argument given to Cycle must be an object with driver functions as properties.");if(yn(e))throw new Error("Second argument given to Cycle must be an object with at least one driver function declared as a property.");var n=function(t){if("object"!=typeof t||null===t)throw new Error("Argument given to setupReusable must be an object with driver functions as properties.");if(yn(t))throw new Error("Argument given to setupReusable must be an object with at least one driver function declared as a property.");var e=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=oe.create());return e}(t),n=function(t,e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r](e[r],r),n[r]&&"object"==typeof n[r]&&(n[r]._isCycleSource=r));return n}(t,e),r=function(t){for(var e in t)t.hasOwnProperty(e)&&t[e]&&"function"==typeof t[e].shamefullySendNext&&(t[e]=dn(t[e]));return t}(n);function o(t){return function(t,e){var n=De(),r=Object.keys(t).filter((function(t){return!!e[t]})),o={},i={};r.forEach((function(t){o[t]={_n:[],_e:[]},i[t]={next:function(e){return o[t]._n.push(e)},error:function(e){return o[t]._e.push(e)},complete:function(){}}}));var s=r.map((function(e){return oe.fromObservable(t[e]).subscribe(i[e])}));return r.forEach((function(t){var r=e[t],s=function(t){n((function(){return r._n(t)}))},a=function(t){n((function(){(console.error||console.log)(t),r._e(t)}))};o[t]._n.forEach(s),o[t]._e.forEach(a),i[t].next=s,i[t].error=a,i[t]._n=s,i[t]._e=a})),o=null,function(){s.forEach((function(t){return t.unsubscribe()}))}}(t,e)}function i(){!function(t){for(var e in t)t.hasOwnProperty(e)&&t[e]&&t[e].dispose&&t[e].dispose()}(r),function(t){Object.keys(t).forEach((function(e){return t[e]._c()}))}(e)}return{sources:r,run:o,dispose:i}}(e),r=t(n.sources);return"undefined"!=typeof window&&(window.Cyclejs=window.Cyclejs||{},window.Cyclejs.sinks=r),{sinks:r,sources:n.sources,run:function(){var t=n.run(r);return function(){t(),n.dispose()}}}}function vn(t){if(gn(t)){for(;t&&gn(t);){t=bn(t).parent}return null!=t?t:null}return t.parentNode}function gn(t){return 11===t.nodeType}function bn(t,e){var n,r,o;const i=t;return null!==(n=i.parent)&&void 0!==n||(i.parent=null!=e?e:null),null!==(r=i.firstChildNode)&&void 0!==r||(i.firstChildNode=t.firstChild),null!==(o=i.lastChildNode)&&void 0!==o||(i.lastChildNode=t.lastChild),i}const _n={createElement:function(t,e){return document.createElement(t,e)},createElementNS:function(t,e,n){return document.createElementNS(t,e,n)},createTextNode:function(t){return document.createTextNode(t)},createDocumentFragment:function(){return bn(document.createDocumentFragment())},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){if(gn(t)){let e=t;for(;e&&gn(e);){e=bn(e).parent}t=null!=e?e:t}gn(e)&&(e=bn(e,t)),n&&gn(n)&&(n=bn(n).firstChildNode),t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){gn(e)&&(e=bn(e,t)),t.appendChild(e)},parentNode:vn,nextSibling:function(t){var e;if(gn(t)){const n=bn(t),r=vn(n);if(r&&n.lastChildNode){const t=Array.from(r.childNodes),o=t.indexOf(n.lastChildNode);return null!==(e=t[o+1])&&void 0!==e?e:null}return null}return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},getTextContent:function(t){return t.textContent},isElement:function(t){return 1===t.nodeType},isText:function(t){return 3===t.nodeType},isComment:function(t){return 8===t.nodeType},isDocumentFragment:gn};function wn(t,e,n,r,o){return{sel:t,data:e,children:n,text:r,elm:o,key:void 0===e?void 0:e.key}}const Sn=Array.isArray;function An(t){return"string"==typeof t||"number"==typeof t||t instanceof String||t instanceof Number}function On(t){return void 0===t}function En(t){return void 0!==t}const Cn=wn("",{},[],void 0,void 0);function Nn(t,e){var n,r;const o=t.key===e.key,i=(null===(n=t.data)||void 0===n?void 0:n.is)===(null===(r=e.data)||void 0===r?void 0:r.is),s=t.sel===e.sel,a=!(!t.sel&&t.sel===e.sel)||typeof t.text==typeof e.text;return s&&o&&i&&a}function $n(){throw new Error("The document fragment is not supported on this platform.")}function jn(t,e,n){var r;const o={};for(let i=e;i<=n;++i){const e=null===(r=t[i])||void 0===r?void 0:r.key;void 0!==e&&(o[e]=i)}return o}const xn=["create","update","remove","destroy","pre","post"];function kn(t,e,n){const r={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},o=void 0!==e?e:_n;for(const e of xn)for(const n of t){const t=n[e];void 0!==t&&r[e].push(t)}function i(t){const e=t.id?"#"+t.id:"",n=t.getAttribute("class"),r=n?"."+n.split(" ").join("."):"";return wn(o.tagName(t).toLowerCase()+e+r,{},[],void 0,t)}function s(t){return wn(void 0,{},[],void 0,t)}function a(t,e){return function(){if(0==--e){const e=o.parentNode(t);o.removeChild(e,t)}}}function c(t,e){var i,s,a,u;let l,p=t.data;if(void 0!==p){const e=null===(i=p.hook)||void 0===i?void 0:i.init;En(e)&&(e(t),p=t.data)}const f=t.children,h=t.sel;if("!"===h)On(t.text)&&(t.text=""),t.elm=o.createComment(t.text);else if(void 0!==h){const n=h.indexOf("#"),i=h.indexOf(".",n),a=n>0?n:h.length,u=i>0?i:h.length,d=-1!==n||-1!==i?h.slice(0,Math.min(a,u)):h,y=t.elm=En(p)&&En(l=p.ns)?o.createElementNS(l,d,p):o.createElement(d,p);for(a<u&&y.setAttribute("id",h.slice(a+1,u)),i>0&&y.setAttribute("class",h.slice(u+1).replace(/\./g," ")),l=0;l<r.create.length;++l)r.create[l](Cn,t);if(Sn(f))for(l=0;l<f.length;++l){const t=f[l];null!=t&&o.appendChild(y,c(t,e))}else An(t.text)&&o.appendChild(y,o.createTextNode(t.text));const m=t.data.hook;En(m)&&(null===(s=m.create)||void 0===s||s.call(m,Cn,t),m.insert&&e.push(t))}else if((null===(a=null==n?void 0:n.experimental)||void 0===a?void 0:a.fragments)&&t.children){for(t.elm=(null!==(u=o.createDocumentFragment)&&void 0!==u?u:$n)(),l=0;l<r.create.length;++l)r.create[l](Cn,t);for(l=0;l<t.children.length;++l){const n=t.children[l];null!=n&&o.appendChild(t.elm,c(n,e))}}else t.elm=o.createTextNode(t.text);return t.elm}function u(t,e,n,r,i,s){for(;r<=i;++r){const i=n[r];null!=i&&o.insertBefore(t,c(i,s),e)}}function l(t){var e,n;const o=t.data;if(void 0!==o){null===(n=null===(e=null==o?void 0:o.hook)||void 0===e?void 0:e.destroy)||void 0===n||n.call(e,t);for(let e=0;e<r.destroy.length;++e)r.destroy[e](t);if(void 0!==t.children)for(let e=0;e<t.children.length;++e){const n=t.children[e];null!=n&&"string"!=typeof n&&l(n)}}}function p(t,e,n,i){for(var s,c;n<=i;++n){let i,u;const f=e[n];if(null!=f)if(En(f.sel)){l(f),i=r.remove.length+1,u=a(f.elm,i);for(let t=0;t<r.remove.length;++t)r.remove[t](f,u);const t=null===(c=null===(s=null==f?void 0:f.data)||void 0===s?void 0:s.hook)||void 0===c?void 0:c.remove;En(t)?t(f,u):u()}else f.children?(l(f),p(t,f.children,0,f.children.length-1)):o.removeChild(t,f.elm)}}function f(t,e,n){var i,s,a,l,h,d,y,m;const v=null===(i=e.data)||void 0===i?void 0:i.hook;null===(s=null==v?void 0:v.prepatch)||void 0===s||s.call(v,t,e);const g=e.elm=t.elm;if(t===e)return;if(void 0!==e.data||En(e.text)&&e.text!==t.text){null!==(a=e.data)&&void 0!==a||(e.data={}),null!==(l=t.data)&&void 0!==l||(t.data={});for(let n=0;n<r.update.length;++n)r.update[n](t,e);null===(y=null===(d=null===(h=e.data)||void 0===h?void 0:h.hook)||void 0===d?void 0:d.update)||void 0===y||y.call(d,t,e)}const b=t.children,_=e.children;On(e.text)?En(b)&&En(_)?b!==_&&function(t,e,n,r){let i,s,a,l,h=0,d=0,y=e.length-1,m=e[0],v=e[y],g=n.length-1,b=n[0],_=n[g];for(;h<=y&&d<=g;)null==m?m=e[++h]:null==v?v=e[--y]:null==b?b=n[++d]:null==_?_=n[--g]:Nn(m,b)?(f(m,b,r),m=e[++h],b=n[++d]):Nn(v,_)?(f(v,_,r),v=e[--y],_=n[--g]):Nn(m,_)?(f(m,_,r),o.insertBefore(t,m.elm,o.nextSibling(v.elm)),m=e[++h],_=n[--g]):Nn(v,b)?(f(v,b,r),o.insertBefore(t,v.elm,m.elm),v=e[--y],b=n[++d]):(void 0===i&&(i=jn(e,h,y)),s=i[b.key],On(s)?o.insertBefore(t,c(b,r),m.elm):(a=e[s],a.sel!==b.sel?o.insertBefore(t,c(b,r),m.elm):(f(a,b,r),e[s]=void 0,o.insertBefore(t,a.elm,m.elm))),b=n[++d]);d<=g&&(l=null==n[g+1]?null:n[g+1].elm,u(t,l,n,d,g,r)),h<=y&&p(t,e,h,y)}(g,b,_,n):En(_)?(En(t.text)&&o.setTextContent(g,""),u(g,null,_,0,_.length-1,n)):En(b)?p(g,b,0,b.length-1):En(t.text)&&o.setTextContent(g,""):t.text!==e.text&&(En(b)&&p(g,b,0,b.length-1),o.setTextContent(g,e.text)),null===(m=null==v?void 0:v.postpatch)||void 0===m||m.call(v,t,e)}return function(t,e){let n,a,u;const l=[];for(n=0;n<r.pre.length;++n)r.pre[n]();for(!function(t,e){return t.isElement(e)}(o,t)?function(t,e){return t.isDocumentFragment(e)}(o,t)&&(t=s(t)):t=i(t),Nn(t,e)?f(t,e,l):(a=t.elm,u=o.parentNode(a),c(e,l),null!==u&&(o.insertBefore(u,e.elm,o.nextSibling(a)),p(u,[t],0,0))),n=0;n<l.length;++n)l[n].data.hook.insert(l[n]);for(n=0;n<r.post.length;++n)r.post[n]();return e}}function Pn(t,e,n){if(t.ns="http://www.w3.org/2000/svg","foreignObject"!==n&&void 0!==e)for(let t=0;t<e.length;++t){const n=e[t];if("string"==typeof n)continue;const r=n.data;void 0!==r&&Pn(r,n.children,n.sel)}}function Tn(t,e,n){let r,o,i,s={};if(void 0!==n?(null!==e&&(s=e),Sn(n)?r=n:An(n)?o=n.toString():n&&n.sel&&(r=[n])):null!=e&&(Sn(e)?r=e:An(e)?o=e.toString():e&&e.sel?r=[e]:s=e),void 0!==r)for(i=0;i<r.length;++i)An(r[i])&&(r[i]=wn(void 0,void 0,void 0,r[i],void 0));return"s"!==t[0]||"v"!==t[1]||"g"!==t[2]||3!==t.length&&"."!==t[3]&&"#"!==t[3]||Pn(s,r,t),wn(t,s,r,o,void 0)}function Mn(t,e){const n=void 0!==e?e:_n;let r;if(n.isElement(t)){const r=t.id?"#"+t.id:"",o=t.getAttribute("class"),i=o?"."+o.split(" ").join("."):"",s=n.tagName(t).toLowerCase()+r+i,a={},c={},u={},l=[];let p,f,h;const d=t.attributes,y=t.childNodes;for(f=0,h=d.length;f<h;f++)p=d[f].nodeName,"d"===p[0]&&"a"===p[1]&&"t"===p[2]&&"a"===p[3]&&"-"===p[4]?c[p.slice(5)]=d[f].nodeValue||"":"id"!==p&&"class"!==p&&(a[p]=d[f].nodeValue);for(f=0,h=y.length;f<h;f++)l.push(Mn(y[f],e));return Object.keys(a).length>0&&(u.attrs=a),Object.keys(c).length>0&&(u.dataset=c),"s"!==s[0]||"v"!==s[1]||"g"!==s[2]||3!==s.length&&"."!==s[3]&&"#"!==s[3]||Pn(u,l,s),wn(s,u,l,void 0,t)}return n.isText(t)?(r=n.getTextContent(t),wn(void 0,void 0,void 0,r,t)):n.isComment(t)?(r=n.getTextContent(t),wn("!",{},[],r,t)):wn("",{},[],void 0,t)}function In(t,e){let n;const r=e.elm;let o=t.data.attrs,i=e.data.attrs;if((o||i)&&o!==i){for(n in o=o||{},i=i||{},i){const t=i[n];o[n]!==t&&(!0===t?r.setAttribute(n,""):!1===t?r.removeAttribute(n):120!==n.charCodeAt(0)?r.setAttribute(n,t):58===n.charCodeAt(3)?r.setAttributeNS("http://www.w3.org/XML/1998/namespace",n,t):58===n.charCodeAt(5)?r.setAttributeNS("http://www.w3.org/1999/xlink",n,t):r.setAttribute(n,t))}for(n in o)n in i||r.removeAttribute(n)}}const Dn={create:In,update:In};function Ln(t,e){let n,r;const o=e.elm;let i=t.data.class,s=e.data.class;if((i||s)&&i!==s){for(r in i=i||{},s=s||{},i)i[r]&&!Object.prototype.hasOwnProperty.call(s,r)&&o.classList.remove(r);for(r in s)n=s[r],n!==i[r]&&o.classList[n?"add":"remove"](r)}}const Fn={create:Ln,update:Ln},Bn=/[A-Z]/g;function Rn(t,e){const n=e.elm;let r,o=t.data.dataset,i=e.data.dataset;if(!o&&!i)return;if(o===i)return;o=o||{},i=i||{};const s=n.dataset;for(r in o)i[r]||(s?r in s&&delete s[r]:n.removeAttribute("data-"+r.replace(Bn,"-$&").toLowerCase()));for(r in i)o[r]!==i[r]&&(s?s[r]=i[r]:n.setAttribute("data-"+r.replace(Bn,"-$&").toLowerCase(),i[r]))}const Un={create:Rn,update:Rn};function Gn(t,e){let n,r,o;const i=e.elm;let s=t.data.props,a=e.data.props;if((s||a)&&s!==a)for(n in s=s||{},a=a||{},a)r=a[n],o=s[n],o===r||"value"===n&&i[n]===r||(i[n]=r)}const Wn={create:Gn,update:Gn},qn="undefined"!=typeof window&&window.requestAnimationFrame.bind(window)||setTimeout,Vn=function(t){qn((function(){qn(t)}))};let Hn=!1;function Jn(t,e,n){Vn((function(){t[e]=n}))}function zn(t,e){let n,r;const o=e.elm;let i=t.data.style,s=e.data.style;if(!i&&!s)return;if(i===s)return;i=i||{},s=s||{};const a="delayed"in i;for(r in i)s[r]||("-"===r[0]&&"-"===r[1]?o.style.removeProperty(r):o.style[r]="");for(r in s)if(n=s[r],"delayed"===r&&s.delayed)for(const t in s.delayed)n=s.delayed[t],a&&n===i.delayed[t]||Jn(o.style,t,n);else"remove"!==r&&n!==i[r]&&("-"===r[0]&&"-"===r[1]?o.style.setProperty(r,n):o.style[r]=n)}const Yn={pre:function(){Hn=!1},create:zn,update:zn,destroy:function(t){let e,n;const r=t.elm,o=t.data.style;if(o&&(e=o.destroy))for(n in e)r.style[n]=e[n]},remove:function(t,e){const n=t.data.style;if(!n||!n.remove)return void e();let r;Hn||(t.elm.offsetLeft,Hn=!0);const o=t.elm;let i=0;const s=n.remove;let a=0;const c=[];for(r in s)c.push(r),o.style[r]=s[r];const u=getComputedStyle(o)["transition-property"].split(", ");for(;i<u.length;++i)-1!==c.indexOf(u[i])&&a++;o.addEventListener("transitionend",(function(t){t.target===o&&--a,0===a&&e()}))}};function Xn(t,e){e.elm=t.elm,t.data.fn=e.data.fn,t.data.args=e.data.args,t.data.isolate=e.data.isolate,e.data=t.data,e.children=t.children,e.text=t.text,e.elm=t.elm}function Zn(t){var e=t.data;Xn(e.fn.apply(void 0,e.args),t)}function Kn(t,e){var n,r=t.data,o=e.data,i=r.args,s=o.args;for(r.fn===o.fn&&i.length===s.length||Xn(o.fn.apply(void 0,s),e),n=0;n<s.length;++n)if(i[n]!==s[n])return void Xn(o.fn.apply(void 0,s),e);Xn(t,e)}function Qn(t,e,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1);var i=null;return ee.create({start:function(s){i=r?function(t){er(t,r),s.next(t)}:function(t){s.next(t)},t.addEventListener(e,i,{capture:n,passive:o})},stop:function(){t.removeEventListener(e,i,n),i=null}})}function tr(t,e){for(var n=Object.keys(t),r=n.length,o=0;o<r;o++){var i=n[o];if("object"==typeof t[i]&&"object"==typeof e[i]){if(!tr(t[i],e[i]))return!1}else if(t[i]!==e[i])return!1}return!0}function er(t,e){if(e)if("boolean"==typeof e)t.preventDefault();else if("function"==typeof e)e(t)&&t.preventDefault();else{if("object"!=typeof e)throw new Error("preventDefault has to be either a boolean, predicate function or object");tr(e,t)&&t.preventDefault()}}var nr=function(){function t(t){this._name=t}return t.prototype.select=function(t){return this},t.prototype.elements=function(){var t=ae(oe.of([document]));return t._isCycleSource=this._name,t},t.prototype.element=function(){var t=ae(oe.of(document));return t._isCycleSource=this._name,t},t.prototype.events=function(t,e,n){var r;void 0===e&&(e={}),r=Qn(document,t,e.useCapture,e.preventDefault);var o=ae(r);return o._isCycleSource=this._name,o},t}(),rr=function(){function t(t){this._name=t}return t.prototype.select=function(t){return this},t.prototype.elements=function(){var t=ae(oe.of([document.body]));return t._isCycleSource=this._name,t},t.prototype.element=function(){var t=ae(oe.of(document.body));return t._isCycleSource=this._name,t},t.prototype.events=function(t,e,n){var r;void 0===e&&(e={}),r=Qn(document.body,t,e.useCapture,e.preventDefault);var o=ae(r);return o._isCycleSource=this._name,o},t}();function or(t){if("string"!=typeof t&&(e=t,!("object"==typeof HTMLElement?e instanceof HTMLElement||e instanceof DocumentFragment:e&&"object"==typeof e&&null!==e&&(1===e.nodeType||11===e.nodeType)&&"string"==typeof e.nodeName)))throw new Error("Given container is not a DOM element neither a selector string.");var e}function ir(t){for(var e="",n=t.length-1;n>=0&&"selector"===t[n].type;n--)e=t[n].scope+" "+e;return e.trim()}function sr(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n].type!==e[n].type||t[n].scope!==e[n].scope)return!1;return!0}var ar=function(){function t(t,e){this.namespace=t,this.isolateModule=e,this._namespace=t.filter((function(t){return"selector"!==t.type}))}return t.prototype.isDirectlyInScope=function(t){var e=this.isolateModule.getNamespace(t);if(!e)return!1;if(this._namespace.length>e.length||!sr(this._namespace,e.slice(0,this._namespace.length)))return!1;for(var n=this._namespace.length;n<e.length;n++)if("total"===e[n].type)return!1;return!0},t}();var cr=function(){function t(t,e){this.namespace=t,this.isolateModule=e}return t.prototype.call=function(){var t=this.namespace,e=ir(t),n=new ar(t,this.isolateModule),r=this.isolateModule.getElement(t.filter((function(t){return"selector"!==t.type})));return void 0===r?[]:""===e?[r]:function(t){return Array.prototype.slice.call(t)}(r.querySelectorAll(e)).filter(n.isDirectlyInScope,n).concat(r.matches(e)?[r]:[])},t}(),ur=function(){return ur=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},ur.apply(this,arguments)};function lr(t){return{type:(e=t,e.length>1&&("."===e[0]||"#"===e[0])?"sibling":"total"),scope:t};var e}var pr=function(){function t(e,n,r,o,i,s){var a;void 0===r&&(r=[]),this._rootElement$=e,this._sanitation$=n,this._namespace=r,this._isolateModule=o,this._eventDelegator=i,this._name=s,this.isolateSource=function(e,n){return new t(e._rootElement$,e._sanitation$,e._namespace.concat(lr(n)),e._isolateModule,e._eventDelegator,e._name)},this.isolateSink=(a=this._namespace,function(t,e){return":root"===e?t:t.map((function(t){if(!t)return t;var n=lr(e),r=ur({},t,{data:ur({},t.data,{isolate:t.data&&Array.isArray(t.data.isolate)?t.data.isolate:a.concat([n])})});return ur({},r,{key:void 0!==r.key?r.key:JSON.stringify(r.data.isolate)})}))})}return t.prototype._elements=function(){if(0===this._namespace.length)return this._rootElement$.map((function(t){return[t]}));var t=new cr(this._namespace,this._isolateModule);return this._rootElement$.map((function(){return t.call()}))},t.prototype.elements=function(){var t=ae(this._elements().remember());return t._isCycleSource=this._name,t},t.prototype.element=function(){var t=ae(this._elements().filter((function(t){return t.length>0})).map((function(t){return t[0]})).remember());return t._isCycleSource=this._name,t},Object.defineProperty(t.prototype,"namespace",{get:function(){return this._namespace},enumerable:!0,configurable:!0}),t.prototype.select=function(e){if("string"!=typeof e)throw new Error("DOM driver's select() expects the argument to be a string as a CSS selector");if("document"===e)return new nr(this._name);if("body"===e)return new rr(this._name);var n=":root"===e?[]:this._namespace.concat({type:"selector",scope:e.trim()});return new t(this._rootElement$,this._sanitation$,n,this._isolateModule,this._eventDelegator,this._name)},t.prototype.events=function(t,e,n){if(void 0===e&&(e={}),"string"!=typeof t)throw new Error("DOM driver's events() expects argument to be a string representing the event type to listen for.");var r=this._eventDelegator.addEventListener(t,this._namespace,e,n),o=ae(r);return o._isCycleSource=this._name,o},t.prototype.dispose=function(){this._sanitation$.shamefullySendNext(null)},t}(),fr={},hr=e&&e.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r};Object.defineProperty(fr,"__esModule",{value:!0}),fr.SampleCombineOperator=fr.SampleCombineListener=void 0;var dr=n,yr={},mr=function(){function t(t,e){this.i=t,this.p=e,e.ils[t]=this}return t.prototype._n=function(t){var e=this.p;e.out!==yr&&e.up(t,this.i)},t.prototype._e=function(t){this.p._e(t)},t.prototype._c=function(){this.p.down(this.i,this)},t}();fr.SampleCombineListener=mr;var vr,gr=function(){function t(t,e){this.type="sampleCombine",this.ins=t,this.others=e,this.out=yr,this.ils=[],this.Nn=0,this.vals=[]}return t.prototype._start=function(t){this.out=t;for(var e=this.others,n=this.Nn=e.length,r=this.vals=new Array(n),o=0;o<n;o++)r[o]=yr,e[o]._add(new mr(o,this));this.ins._add(this)},t.prototype._stop=function(){var t=this.others,e=t.length,n=this.ils;this.ins._remove(this);for(var r=0;r<e;r++)t[r]._remove(n[r]);this.out=yr,this.vals=[],this.ils=[]},t.prototype._n=function(t){var e=this.out;e!==yr&&(this.Nn>0||e._n(hr([t],this.vals)))},t.prototype._e=function(t){var e=this.out;e!==yr&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==yr&&t._c()},t.prototype.up=function(t,e){var n=this.vals[e];this.Nn>0&&n===yr&&this.Nn--,this.vals[e]=t},t.prototype.down=function(t,e){this.others[t]._remove(e)},t}();fr.SampleCombineOperator=gr,vr=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return new dr.Stream(new gr(e,t))}};var br=fr.default=vr;function _r(t){if(!t.sel)return{tagName:"",id:"",className:""};var e=t.sel,n=e.indexOf("#"),r=e.indexOf(".",n),o=n>0?n:e.length,i=r>0?r:e.length;return{tagName:-1!==n||-1!==r?e.slice(0,Math.min(o,i)):e,id:o<i?e.slice(o+1,i):void 0,className:r>0?e.slice(i+1).replace(/\./g," "):void 0}}Object.assign;var wr=("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:Function("return this")()).Symbol;"function"==typeof wr&&wr("parent");var Sr=function(){function t(t){this.rootElement=t}return t.prototype.call=function(t){if(11===this.rootElement.nodeType)return this.wrapDocFrag(null===t?[]:[t]);if(null===t)return this.wrap([]);var e=_r(t),n=e.tagName,r=e.id,o=function(t){var e=_r(t).className,n=void 0===e?"":e;if(!t.data)return n;var r=t.data,o=r.class,i=r.props;return o&&(n+=" "+Object.keys(o).filter((function(t){return o[t]})).join(" ")),i&&i.className&&(n+=" "+i.className),n&&n.trim()}(t),i=((t.data||{}).props||{}).id,s=void 0===i?r:i;return"string"==typeof s&&s.toUpperCase()===this.rootElement.id.toUpperCase()&&n.toUpperCase()===this.rootElement.tagName.toUpperCase()&&o.toUpperCase()===this.rootElement.className.toUpperCase()?t:this.wrap([t])},t.prototype.wrapDocFrag=function(t){return wn("",{isolate:[]},t,void 0,this.rootElement)},t.prototype.wrap=function(t){var e=this.rootElement,n=e.tagName,r=e.id,o=e.className,i=r?"#"+r:"",s=o?"."+o.split(" ").join("."):"",a=Tn(""+n.toLowerCase()+i+s,{},t);return a.data=a.data||{},a.data.isolate=a.data.isolate||[],a},t}(),Ar=[Yn,Fn,Wn,Dn,Un],Or=function(){function t(t){this.mapper=t,this.tree=[void 0,{}]}return t.prototype.set=function(t,e,n){for(var r=this.tree,o=void 0!==n?n:t.length,i=0;i<o;i++){var s=this.mapper(t[i]),a=r[1][s];a||(a=[void 0,{}],r[1][s]=a),r=a}r[0]=e},t.prototype.getDefault=function(t,e,n){return this.get(t,e,n)},t.prototype.get=function(t,e,n){for(var r=this.tree,o=void 0!==n?n:t.length,i=0;i<o;i++){var s=this.mapper(t[i]),a=r[1][s];if(!a){if(!e)return;a=[void 0,{}],r[1][s]=a}r=a}return e&&!r[0]&&(r[0]=e()),r[0]},t.prototype.delete=function(t){for(var e=this.tree,n=0;n<t.length-1;n++){var r=e[1][this.mapper(t[n])];if(!r)return;e=r}delete e[1][this.mapper(t[t.length-1])]},t}(),Er=function(){function t(){this.namespaceTree=new Or((function(t){return t.scope})),this.namespaceByElement=new Map,this.vnodesBeingRemoved=[]}return t.prototype.setEventDelegator=function(t){this.eventDelegator=t},t.prototype.insertElement=function(t,e){this.namespaceByElement.set(e,t),this.namespaceTree.set(t,e)},t.prototype.removeElement=function(t){this.namespaceByElement.delete(t);var e=this.getNamespace(t);e&&this.namespaceTree.delete(e)},t.prototype.getElement=function(t,e){return this.namespaceTree.get(t,void 0,e)},t.prototype.getRootElement=function(t){if(this.namespaceByElement.has(t))return t;for(var e=t;!this.namespaceByElement.has(e);){if(!(e=e.parentNode))return;if("HTML"===e.tagName)throw new Error("No root element found, this should not happen at all")}return e},t.prototype.getNamespace=function(t){var e=this.getRootElement(t);if(e)return this.namespaceByElement.get(e)},t.prototype.createModule=function(){var t=this;return{create:function(e,n){var r=n.elm,o=n.data,i=(void 0===o?{}:o).isolate;Array.isArray(i)&&t.insertElement(i,r)},update:function(e,n){var r=e.elm,o=e.data,i=void 0===o?{}:o,s=n.elm,a=n.data,c=void 0===a?{}:a,u=i.isolate,l=c.isolate;sr(u,l)||Array.isArray(u)&&t.removeElement(r),Array.isArray(l)&&t.insertElement(l,s)},destroy:function(e){t.vnodesBeingRemoved.push(e)},remove:function(e,n){t.vnodesBeingRemoved.push(e),n()},post:function(){for(var e=t.vnodesBeingRemoved,n=e.length-1;n>=0;n--){var r=e[n],o=void 0!==r.data?r.data.isolation:void 0;void 0!==o&&t.removeElement(o),t.eventDelegator.removeElement(r.elm,o)}t.vnodesBeingRemoved=[]}}},t}(),Cr=function(){function t(){this.arr=[],this.prios=[]}return t.prototype.add=function(t,e){for(var n=0;n<this.arr.length;n++)if(this.prios[n]<e)return this.arr.splice(n,0,t),void this.prios.splice(n,0,e);this.arr.push(t),this.prios.push(e)},t.prototype.forEach=function(t){for(var e=0;e<this.arr.length;e++)t(this.arr[e],e,this.arr)},t.prototype.delete=function(t){for(var e=0;e<this.arr.length;e++)if(this.arr[e]===t)return this.arr.splice(e,1),void this.prios.splice(e,1)},t}(),Nr=function(){return Nr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Nr.apply(this,arguments)},$r=["blur","canplay","canplaythrough","durationchange","emptied","ended","focus","load","loadeddata","loadedmetadata","mouseenter","mouseleave","pause","play","playing","ratechange","reset","scroll","seeked","seeking","stalled","submit","suspend","timeupdate","unload","volumechange","waiting"],jr=function(){function t(t,e){var n=this;this.rootElement$=t,this.isolateModule=e,this.virtualListeners=new Or((function(t){return t.scope})),this.nonBubblingListenersToAdd=new Set,this.virtualNonBubblingListener=[],this.isolateModule.setEventDelegator(this),this.domListeners=new Map,this.domListenersToAdd=new Map,this.nonBubblingListeners=new Map,t.addListener({next:function(t){n.origin!==t&&(n.origin=t,n.resetEventListeners(),n.domListenersToAdd.forEach((function(t,e){return n.setupDOMListener(e,t)})),n.domListenersToAdd.clear()),n.nonBubblingListenersToAdd.forEach((function(t){n.setupNonBubblingListener(t)}))}})}return t.prototype.addEventListener=function(t,e,n,r){var o,i=oe.never(),s=new ar(e,this.isolateModule);if(void 0===r?-1===$r.indexOf(t):r)return this.domListeners.has(t)||this.setupDOMListener(t,!!n.passive),o=this.insertListener(i,s,t,n),i;var a=[];this.nonBubblingListenersToAdd.forEach((function(t){return a.push(t)}));for(var c=void 0,u=0,l=a.length,p=function(n){n[0];var r=n[1],o=n[2];return n[3],t===r&&sr(o.namespace,e)};!c&&u<l;){var f=a[u];c=p(f)?f:c,u++}var h,d=c;if(d){var y=d[0];h=y}else{var m=new cr(e,this.isolateModule);o=this.insertListener(i,s,t,n),d=[i,t,m,o],h=i,this.nonBubblingListenersToAdd.add(d),this.setupNonBubblingListener(d)}var v=this,g=null;return oe.create({start:function(t){g=h.subscribe(t)},stop:function(){d[0];var t=d[1],e=d[2];d[3],e.call().forEach((function(e){var n=e.subs;n&&n[t]&&(n[t].unsubscribe(),delete n[t])})),v.nonBubblingListenersToAdd.delete(d),g.unsubscribe()}})},t.prototype.removeElement=function(t,e){void 0!==e&&this.virtualListeners.delete(e);var n=[];this.nonBubblingListeners.forEach((function(e,r){if(e.has(t)){n.push([r,t]);var o=t.subs;o&&Object.keys(o).forEach((function(t){o[t].unsubscribe()}))}}));for(var r=0;r<n.length;r++){var o=this.nonBubblingListeners.get(n[r][0]);o&&(o.delete(n[r][1]),0===o.size?this.nonBubblingListeners.delete(n[r][0]):this.nonBubblingListeners.set(n[r][0],o))}},t.prototype.insertListener=function(t,e,n,r){var o=[],i=e._namespace,s=i.length;do{o.push(this.getVirtualListeners(n,i,!0,s)),s--}while(s>=0&&"total"!==i[s].type);for(var a=Nr({},r,{scopeChecker:e,subject:t,bubbles:!!r.bubbles,useCapture:!!r.useCapture,passive:!!r.passive}),c=0;c<o.length;c++)o[c].add(a,i.length);return a},t.prototype.getVirtualListeners=function(t,e,n,r){void 0===n&&(n=!1);var o=void 0!==r?r:e.length;if(!n)for(var i=o-1;i>=0;i--){if("total"===e[i].type){o=i+1;break}o=i}var s=this.virtualListeners.getDefault(e,(function(){return new Map}),o);return s.has(t)||s.set(t,new Cr),s.get(t)},t.prototype.setupDOMListener=function(t,e){var n=this;if(this.origin){var r=Qn(this.origin,t,!1,!1,e).subscribe({next:function(r){return n.onEvent(t,r,e)},error:function(){},complete:function(){}});this.domListeners.set(t,{sub:r,passive:e})}else this.domListenersToAdd.set(t,e)},t.prototype.setupNonBubblingListener=function(t){t[0];var e=t[1],n=t[2],r=t[3];if(this.origin){var o=n.call();if(o.length){var i=this;o.forEach((function(t){var n,o=t.subs;if(!o||!o[e]){var s=Qn(t,e,!1,!1,r.passive).subscribe({next:function(t){return i.onEvent(e,t,!!r.passive,!1)},error:function(){},complete:function(){}});i.nonBubblingListeners.has(e)||i.nonBubblingListeners.set(e,new Map);var a=i.nonBubblingListeners.get(e);if(!a)return;a.set(t,{sub:s,destination:r}),t.subs=Nr({},o,((n={})[e]=s,n))}}))}}},t.prototype.resetEventListeners=function(){for(var t=this.domListeners.entries(),e=t.next();!e.done;){var n=e.value,r=n[0],o=n[1],i=o.sub,s=o.passive;i.unsubscribe(),this.setupDOMListener(r,s),e=t.next()}},t.prototype.putNonBubblingListener=function(t,e,n,r){var o=this.nonBubblingListeners.get(t);if(o){var i=o.get(e);i&&i.destination.passive===r&&i.destination.useCapture===n&&(this.virtualNonBubblingListener[0]=i.destination)}},t.prototype.onEvent=function(t,e,n,r){void 0===r&&(r=!0);var o=this.patchEvent(e),i=this.isolateModule.getRootElement(e.target);if(r){var s=this.isolateModule.getNamespace(e.target);if(!s)return;var a=this.getVirtualListeners(t,s);this.bubble(t,e.target,i,o,a,s,s.length-1,!0,n),this.bubble(t,e.target,i,o,a,s,s.length-1,!1,n)}else this.putNonBubblingListener(t,e.target,!0,n),this.doBubbleStep(t,e.target,i,o,this.virtualNonBubblingListener,!0,n),this.putNonBubblingListener(t,e.target,!1,n),this.doBubbleStep(t,e.target,i,o,this.virtualNonBubblingListener,!1,n),e.stopPropagation()},t.prototype.bubble=function(t,e,n,r,o,i,s,a,c){a||r.propagationHasBeenStopped||this.doBubbleStep(t,e,n,r,o,a,c);var u=n,l=s;if(e===n){if(!(s>=0&&"sibling"===i[s].type))return;u=this.isolateModule.getElement(i,s),l--}e.parentNode&&u&&this.bubble(t,e.parentNode,u,r,o,i,l,a,c),a&&!r.propagationHasBeenStopped&&this.doBubbleStep(t,e,n,r,o,a,c)},t.prototype.doBubbleStep=function(t,e,n,r,o,i,s){n&&(this.mutateEventCurrentTarget(r,e),o.forEach((function(t){if(t.passive===s&&t.useCapture===i){var o=ir(t.scopeChecker.namespace);!r.propagationHasBeenStopped&&t.scopeChecker.isDirectlyInScope(e)&&(""!==o&&e.matches(o)||""===o&&e===n)&&(er(r,t.preventDefault),t.subject.shamefullySendNext(r))}})))},t.prototype.patchEvent=function(t){var e=t;e.propagationHasBeenStopped=!1;var n=e.stopPropagation;return e.stopPropagation=function(){n.call(this),this.propagationHasBeenStopped=!0},e},t.prototype.mutateEventCurrentTarget=function(t,e){try{Object.defineProperty(t,"currentTarget",{value:e,configurable:!0})}catch(t){console.log("please use event.ownerTarget")}t.ownerTarget=e},t}();function xr(t){return oe.merge(t,oe.never())}function kr(t){return t.elm}function Pr(t){(console.error||console.log)(t)}function Tr(t,e){void 0===e&&(e={}),or(t);var n=e.modules||Ar;!function(t){if(!Array.isArray(t))throw new Error("Optional modules option must be an array for snabbdom modules")}(n);var r,o,i=new Er,s=e&&e.snabbdomOptions||void 0,a=kn([i.createModule()].concat(n),void 0,s),c=oe.create({start:function(t){"loading"===document.readyState?document.addEventListener("readystatechange",(function(){var e=document.readyState;"interactive"!==e&&"complete"!==e||(t.next(null),t.complete())})):(t.next(null),t.complete())},stop:function(){}}),u=oe.create({start:function(t){o=new MutationObserver((function(){return t.next(null)}))},stop:function(){o.disconnect()}});return function(n,s){void 0===s&&(s="DOM"),function(t){if(!t||"function"!=typeof t.addListener||"function"!=typeof t.fold)throw new Error("The DOM driver function expects as input a Stream of virtual DOM elements")}(n);var l=oe.create(),p=c.map((function(){var e=function(t){var e="string"==typeof t?document.querySelector(t):t;if("string"==typeof t&&null===e)throw new Error("Cannot render into unknown element `"+t+"`");return e}(t)||document.body;return r=new Sr(e),e})),f=n.remember();f.addListener({}),u.addListener({});var h=p.map((function(t){return oe.merge(f.endWhen(l),l).map((function(t){return r.call(t)})).startWith(function(t){return t.data=t.data||{},t.data.isolate=[],t}(Mn(t))).fold(a,Mn(t)).drop(1).map(kr).startWith(t).map((function(t){return o.observe(t,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),t})).compose(xr)})).flatten(),d=Me(c,u).endWhen(l).compose(br(h)).map((function(t){return t[1]})).remember();d.addListener({error:e.reportSnabbdomError||Pr});var y=new jr(d,i);return new pr(d,l,[],i,y,s)}}var Mr="___",Ir=function(){function t(t){this._mockConfig=t,t.elements?this._elements=t.elements:this._elements=ae(oe.empty())}return t.prototype.elements=function(){var t=this._elements;return t._isCycleSource="MockedDOM",t},t.prototype.element=function(){var t=this.elements().filter((function(t){return t.length>0})).map((function(t){return t[0]})).remember(),e=ae(t);return e._isCycleSource="MockedDOM",e},t.prototype.events=function(t,e,n){var r=this._mockConfig[t],o=ae(r||oe.empty());return o._isCycleSource="MockedDOM",o},t.prototype.select=function(e){return new t(this._mockConfig[e]||{})},t.prototype.isolateSource=function(t,e){return t.select("."+Mr+e)},t.prototype.isolateSink=function(t,e){return ae(oe.fromObservable(t).map((function(t){return t.sel&&-1!==t.sel.indexOf(Mr+e)||(t.sel+="."+Mr+e),t})))},t}();function Dr(t){return function(t){return"string"==typeof t&&t.length>0}(t)&&("."===t[0]||"#"===t[0])}function Lr(t){return function(e,n,r){var o=void 0!==e,i=void 0!==n,s=void 0!==r;return Dr(e)?i&&s?Tn(t+e,n,r):Tn(t+e,i?n:{}):s?Tn(t+e,n,r):i?Tn(t,e,n):Tn(t,o?e:{})}}var Fr=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","colorProfile","cursor","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotlight","feTile","feTurbulence","filter","font","fontFace","fontFaceFormat","fontFaceName","fontFaceSrc","fontFaceUri","foreignObject","g","glyph","glyphRef","hkern","image","line","linearGradient","marker","mask","metadata","missingGlyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Br=Lr("svg");Fr.forEach((function(t){Br[t]=Lr(t)}));var Rr=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dir","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","meta","nav","noscript","object","ol","optgroup","option","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","u","ul","video"],Ur={SVG_TAG_NAMES:Fr,TAG_NAMES:Rr,svg:Br,isSelector:Dr,createTagFunction:Lr};Rr.forEach((function(t){Ur[t]=Lr(t)}));var Gr=Ur.svg,Wr=Ur.a,qr=Ur.abbr,Vr=Ur.address,Hr=Ur.area,Jr=Ur.article,zr=Ur.aside,Yr=Ur.audio,Xr=Ur.b,Zr=Ur.base,Kr=Ur.bdi,Qr=Ur.bdo,to=Ur.blockquote,eo=Ur.body,no=Ur.br,ro=Ur.button,oo=Ur.canvas,io=Ur.caption,so=Ur.cite,ao=Ur.code,co=Ur.col,uo=Ur.colgroup,lo=Ur.dd,po=Ur.del,fo=Ur.dfn,ho=Ur.dir,yo=Ur.div,mo=Ur.dl,vo=Ur.dt,go=Ur.em,bo=Ur.embed,_o=Ur.fieldset,wo=Ur.figcaption,So=Ur.figure,Ao=Ur.footer,Oo=Ur.form,Eo=Ur.h1,Co=Ur.h2,No=Ur.h3,$o=Ur.h4,jo=Ur.h5,xo=Ur.h6,ko=Ur.head,Po=Ur.header,To=Ur.hgroup,Mo=Ur.hr,Io=Ur.html,Do=Ur.i,Lo=Ur.iframe,Fo=Ur.img,Bo=Ur.input,Ro=Ur.ins,Uo=Ur.kbd,Go=Ur.keygen,Wo=Ur.label,qo=Ur.legend,Vo=Ur.li,Ho=Ur.link,Jo=Ur.main,zo=Ur.map,Yo=Ur.mark,Xo=Ur.menu,Zo=Ur.meta,Ko=Ur.nav,Qo=Ur.noscript,ti=Ur.object,ei=Ur.ol,ni=Ur.optgroup,ri=Ur.option,oi=Ur.p,ii=Ur.param,si=Ur.pre,ai=Ur.progress,ci=Ur.q,ui=Ur.rp,li=Ur.rt,pi=Ur.ruby,fi=Ur.s,hi=Ur.samp,di=Ur.script,yi=Ur.section,mi=Ur.select,vi=Ur.small,gi=Ur.source,bi=Ur.span,_i=Ur.strong,wi=Ur.style,Si=Ur.sub,Ai=Ur.sup,Oi=Ur.table,Ei=Ur.tbody,Ci=Ur.td,Ni=Ur.textarea,$i=Ur.tfoot,ji=Ur.th,xi=Ur.thead,ki=Ur.title,Pi=Ur.tr,Ti=Ur.u,Mi=Ur.ul,Ii=Ur.video;function Di(t){const e=new EventTarget;return t.subscribe({next:t=>e.dispatchEvent(new CustomEvent("data",{detail:t}))}),{select:t=>{const n=!t,r=Array.isArray(t)?t:[t];let o;const i=oe.create({start:t=>{o=({detail:e})=>{const o=e&&e.data||null;(n||r.includes(e.type))&&t.next(o)},e.addEventListener("data",o)},stop:t=>e.removeEventListener("data",o)});return ae(i)}}}function Li(t){t.addListener({next:t=>{console.log(t)}})}function Fi(t){return/^[a-zA-Z0-9-_]+$/.test(t)}function Bi(t){if("string"!=typeof t)throw new Error("Class name must be a string");return t.trim().split(" ").reduce(((t,e)=>{if(0===e.trim().length)return t;if(!Fi(e))throw new Error(`${e} is not a valid CSS class name`);return t.push(e),t}),[])}var Ri={};Object.defineProperty(Ri,"__esModule",{value:!0});var Ui=n,Gi=function(){function t(t,e){this.dt=t,this.ins=e,this.type="throttle",this.out=null,this.id=null}return t.prototype._start=function(t){this.out=t,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.out=null,this.id=null},t.prototype.clearInterval=function(){var t=this.id;null!==t&&clearInterval(t),this.id=null},t.prototype._n=function(t){var e=this,n=this.out;n&&(this.id||(n._n(t),this.id=setInterval((function(){e.clearInterval()}),this.dt)))},t.prototype._e=function(t){var e=this.out;e&&(this.clearInterval(),e._e(t))},t.prototype._c=function(){var t=this.out;t&&(this.clearInterval(),t._c())},t}();var Wi=Ri.default=function(t){return function(e){return new Ui.Stream(new Gi(t,e))}};t.ABORT=tn,t.MainDOMSource=pr,t.MockedDOMSource=Ir,t.a=Wr,t.abbr=qr,t.address=Vr,t.area=Hr,t.article=Jr,t.aside=zr,t.audio=Yr,t.b=Xr,t.base=Zr,t.bdi=Kr,t.bdo=Qr,t.blockquote=to,t.body=eo,t.br=no,t.button=ro,t.canvas=oo,t.caption=io,t.cite=so,t.classes=function(...t){return t.reduce(((t,e)=>{var n,r;return"string"!=typeof e||t.includes(e)?Array.isArray(e)?t.push(...(r=e,r.map(Bi).flat())):"object"==typeof e&&t.push(...(n=e,Object.entries(n).filter((([t,e])=>"function"==typeof e?e():!!e)).map((([t,e])=>{const n=t.trim();if(!Fi(n))throw new Error(`${n} is not a valid CSS class name`);return n})))):t.push(...Bi(e)),t}),[]).join(" ")},t.code=ao,t.col=co,t.colgroup=uo,t.collection=Fe,t.component=en,t.dd=lo,t.debounce=ze,t.del=po,t.delay=qe,t.dfn=fo,t.dir=ho,t.div=yo,t.dl=mo,t.driverFromAsync=function(t,e={}){const{selector:n="category",args:r="value",return:o="value",pre:i=(t=>t),post:s=(t=>t)}=e,a=t.name||"[anonymous function]",c=typeof r;if(!("string"===c||"function"===c||Array.isArray(r)&&r.every((t=>"string"==typeof t))))throw new Error(`The 'args' option for driverFromAsync(${a}) must be a string, array of strings, or a function. Received ${c}`);if("string"!=typeof n)throw new Error(`The 'selector' option for driverFromAsync(${a}) must be a string. Received ${typeof n}`);return e=>{let c=null;const u=oe.create({start:t=>{c=t.next.bind(t)},stop:()=>{}});return e.addListener({next:e=>{const u=i(e);let l=[];if("object"==typeof u&&null!==u){if("function"==typeof r){const t=r(u);l=Array.isArray(t)?t:[t]}"string"==typeof r&&(l=[u[r]]),Array.isArray(r)&&(l=r.map((t=>u[t])))}const p=`Error in driver created using driverFromAsync(${a})`;t(...l).then((t=>{const r=t=>{let r;if(void 0===o)r=t,"object"==typeof r&&null!==r?r[n]=e[n]:console.warn(`The 'return' option for driverFromAsync(${a}) was not set, but the promise returned an non-object. The result will be returned as-is, but the '${n}' property will not be set, so will not be filtered by the 'select' method of the driver.`);else{if("string"!=typeof o)throw new Error(`The 'return' option for driverFromAsync(${a}) must be a string. Received ${typeof o}`);r={[o]:t,[n]:e[n]}}return r};if("function"==typeof t.then)t.then((t=>{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(r(t))})).catch((t=>console.error(`${p}: ${t}`))):c(r(rocessedOutgoing))})).catch((t=>console.error(`${p}: ${t}`)));else{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(r(t))})).catch((t=>console.error(`${p}: ${t}`))):c(r(n))}})).catch((t=>console.error(`${p}: ${t}`)))},error:t=>{console.error(`Error recieved from sink stream in driver created using driverFromAsync(${a}): ${t}`)},complete:()=>{console.warn(`Unexpected completion of sink stream to driver created using driverFromAsync(${a})`)}}),{select:t=>void 0===t?u:"function"==typeof t?u.filter(t):u.filter((e=>e?.[n]===t))}}},t.dropRepeats=ye,t.dt=vo,t.em=go,t.embed=bo,t.fieldset=_o,t.figcaption=wo,t.figure=So,t.footer=Ao,t.form=Oo,t.h=Tn,t.h1=Eo,t.h2=Co,t.h3=No,t.h4=$o,t.h5=jo,t.h6=xo,t.head=ko,t.header=Po,t.hgroup=To,t.hr=Mo,t.html=Io,t.i=Do,t.iframe=Lo,t.img=Fo,t.input=Bo,t.ins=Ro,t.kbd=Uo,t.keygen=Go,t.label=Wo,t.legend=qo,t.li=Vo,t.link=Ho,t.main=Jo,t.makeDOMDriver=Tr,t.map=zo,t.mark=Yo,t.menu=Xo,t.meta=Zo,t.mockDOMSource=function(t){return new Ir(t)},t.nav=Ko,t.noscript=Qo,t.object=ti,t.ol=ei,t.optgroup=ni,t.option=ri,t.p=oi,t.param=ii,t.pre=si,t.processForm=function(t,e={}){let{events:n=["input","submit"],preventDefault:r=!0}=e;"string"==typeof n&&(n=[n]);const o=n.map((e=>t.events(e)));return oe.merge(...o).map((t=>{r&&t.preventDefault();const e="submit"===t.type?t.srcElement:t.currentTarget,n=new FormData(e);let o={};o.event=t,o.eventType=t.type;const i=e.querySelector("input[type=submit]:focus");if(i){const{name:t,value:e}=i;o[t||"submit"]=e}for(let[t,e]of n.entries())o[t]=e;return o}))},t.progress=ai,t.q=ci,t.rp=ui,t.rt=li,t.ruby=pi,t.run=function t(e,n={},r={}){const{mountPoint:o="#root",fragments:i=!0,useDefaultDrivers:s=!0}=r;if(!e.isSygnalComponent){const t=e.name||e.componentName||e.label||"FUNCTIONAL_COMPONENT",n=e,{model:r,intent:o,hmrActions:i,context:s,peers:a,components:c,initialState:u,calculated:l,storeCalculatedInState:p,DOMSourceName:f,stateSourceName:h,debug:d}=e;e=en({name:t,view:n,model:r,intent:o,hmrActions:i,context:s,peers:a,components:c,initialState:u,calculated:l,storeCalculatedInState:p,DOMSourceName:f,stateSourceName:h,debug:d})}const a=function(t,e){return void 0===e&&(e="state"),function(n){var r=oe.create(),o=r.fold((function(t,e){return e(t)}),void 0).drop(1),i=n;i[e]=new we(o,e);var s=t(i);return s[e]&&Me(oe.fromObservable(s[e]),oe.never()).subscribe({next:function(t){return Le((function(){return r._n(t)}))},error:function(t){return Le((function(){return r._e(t)}))},complete:function(){return Le((function(){return r._c()}))}}),s}}(e,"STATE"),c={...s?{EVENTS:Di,DOM:Tr(o,{snabbdomOptions:{experimental:{fragments:i}}}),LOG:Li}:{},...n},{sources:u,sinks:l,run:p}=mn(a,c),f={sources:u,sinks:l,dispose:p()};return f.hmr=e=>{f.sinks.STATE.shamefullySendNext((r=>{window.__SYGNAL_HMR_UPDATING=!0,f.dispose();const o=e.default;o.initialState=r;const i=t(o,n);return f.sources=i.sources,f.sinks=i.sinks,f.dispose=i.dispose,i.sinks.STATE.shamefullySendNext((()=>({...r}))),i.sources.STATE.stream.setDebugListener({next:()=>{f.sources.STATE.stream.setDebugListener(null),setTimeout((()=>{window.__SYGNAL_HMR_UPDATING=!1}),100)}}),ABORT}))},f},t.s=fi,t.samp=hi,t.sampleCombine=br,t.script=di,t.section=yi,t.select=mi,t.small=vi,t.source=gi,t.span=bi,t.strong=_i,t.style=wi,t.sub=Si,t.sup=Ai,t.svg=Gr,t.switchable=Be,t.table=Oi,t.tbody=Ei,t.td=Ci,t.textarea=Ni,t.tfoot=$i,t.th=ji,t.thead=xi,t.throttle=Wi,t.thunk=function(t,e,n,r){return void 0===r&&(r=n,n=e,e=void 0),Tn(t,{key:e,hook:{init:Zn,prepatch:Kn},fn:n,args:r})},t.title=ki,t.tr=Pi,t.u=Ti,t.ul=Mi,t.video=Ii,t.xs=oe}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sygnal",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "An intuitive framework for building fast and small components or applications based on Cycle.js",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",