sygnal 5.3.5 → 5.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astro/server.cjs.js +11 -0
- package/dist/astro/server.mjs +11 -0
- package/dist/index.cjs.js +11 -0
- package/dist/index.esm.js +11 -0
- package/dist/sygnal.min.js +1 -1
- package/package.json +1 -1
- package/src/extra/ssr.ts +12 -0
package/dist/astro/server.cjs.js
CHANGED
|
@@ -132,6 +132,13 @@ function processSSRTree(vnode, context, parentState) {
|
|
|
132
132
|
if (typeof vnode === 'string' || vnode.text != null)
|
|
133
133
|
return vnode;
|
|
134
134
|
const sel = vnode.sel;
|
|
135
|
+
// Fragment: no selector, recurse into children
|
|
136
|
+
if (!sel && vnode.children && Array.isArray(vnode.children)) {
|
|
137
|
+
vnode.children = vnode.children
|
|
138
|
+
.map((c) => processSSRTree(c, context, parentState))
|
|
139
|
+
.filter((c) => c != null);
|
|
140
|
+
return vnode;
|
|
141
|
+
}
|
|
135
142
|
// Portal: render children inline (no target container on server)
|
|
136
143
|
if (sel === 'portal') {
|
|
137
144
|
const children = vnode.children || [];
|
|
@@ -511,6 +518,10 @@ function vnodeToHtml(vnode) {
|
|
|
511
518
|
if (!sel) {
|
|
512
519
|
if (vnode.text != null)
|
|
513
520
|
return escapeHtml(String(vnode.text));
|
|
521
|
+
// Fragment: no selector, but has children — concatenate child HTML
|
|
522
|
+
if (vnode.children && Array.isArray(vnode.children)) {
|
|
523
|
+
return vnode.children.map((c) => vnodeToHtml(c)).join('');
|
|
524
|
+
}
|
|
514
525
|
return '';
|
|
515
526
|
}
|
|
516
527
|
// Parse selector: tag#id.class1.class2
|
package/dist/astro/server.mjs
CHANGED
|
@@ -128,6 +128,13 @@ function processSSRTree(vnode, context, parentState) {
|
|
|
128
128
|
if (typeof vnode === 'string' || vnode.text != null)
|
|
129
129
|
return vnode;
|
|
130
130
|
const sel = vnode.sel;
|
|
131
|
+
// Fragment: no selector, recurse into children
|
|
132
|
+
if (!sel && vnode.children && Array.isArray(vnode.children)) {
|
|
133
|
+
vnode.children = vnode.children
|
|
134
|
+
.map((c) => processSSRTree(c, context, parentState))
|
|
135
|
+
.filter((c) => c != null);
|
|
136
|
+
return vnode;
|
|
137
|
+
}
|
|
131
138
|
// Portal: render children inline (no target container on server)
|
|
132
139
|
if (sel === 'portal') {
|
|
133
140
|
const children = vnode.children || [];
|
|
@@ -507,6 +514,10 @@ function vnodeToHtml(vnode) {
|
|
|
507
514
|
if (!sel) {
|
|
508
515
|
if (vnode.text != null)
|
|
509
516
|
return escapeHtml(String(vnode.text));
|
|
517
|
+
// Fragment: no selector, but has children — concatenate child HTML
|
|
518
|
+
if (vnode.children && Array.isArray(vnode.children)) {
|
|
519
|
+
return vnode.children.map((c) => vnodeToHtml(c)).join('');
|
|
520
|
+
}
|
|
510
521
|
return '';
|
|
511
522
|
}
|
|
512
523
|
// Parse selector: tag#id.class1.class2
|
package/dist/index.cjs.js
CHANGED
|
@@ -6505,6 +6505,13 @@ function processSSRTree(vnode, context, parentState) {
|
|
|
6505
6505
|
if (typeof vnode === 'string' || vnode.text != null)
|
|
6506
6506
|
return vnode;
|
|
6507
6507
|
const sel = vnode.sel;
|
|
6508
|
+
// Fragment: no selector, recurse into children
|
|
6509
|
+
if (!sel && vnode.children && Array.isArray(vnode.children)) {
|
|
6510
|
+
vnode.children = vnode.children
|
|
6511
|
+
.map((c) => processSSRTree(c, context, parentState))
|
|
6512
|
+
.filter((c) => c != null);
|
|
6513
|
+
return vnode;
|
|
6514
|
+
}
|
|
6508
6515
|
// Portal: render children inline (no target container on server)
|
|
6509
6516
|
if (sel === 'portal') {
|
|
6510
6517
|
const children = vnode.children || [];
|
|
@@ -6884,6 +6891,10 @@ function vnodeToHtml(vnode) {
|
|
|
6884
6891
|
if (!sel) {
|
|
6885
6892
|
if (vnode.text != null)
|
|
6886
6893
|
return escapeHtml(String(vnode.text));
|
|
6894
|
+
// Fragment: no selector, but has children — concatenate child HTML
|
|
6895
|
+
if (vnode.children && Array.isArray(vnode.children)) {
|
|
6896
|
+
return vnode.children.map((c) => vnodeToHtml(c)).join('');
|
|
6897
|
+
}
|
|
6887
6898
|
return '';
|
|
6888
6899
|
}
|
|
6889
6900
|
// Parse selector: tag#id.class1.class2
|
package/dist/index.esm.js
CHANGED
|
@@ -6488,6 +6488,13 @@ function processSSRTree(vnode, context, parentState) {
|
|
|
6488
6488
|
if (typeof vnode === 'string' || vnode.text != null)
|
|
6489
6489
|
return vnode;
|
|
6490
6490
|
const sel = vnode.sel;
|
|
6491
|
+
// Fragment: no selector, recurse into children
|
|
6492
|
+
if (!sel && vnode.children && Array.isArray(vnode.children)) {
|
|
6493
|
+
vnode.children = vnode.children
|
|
6494
|
+
.map((c) => processSSRTree(c, context, parentState))
|
|
6495
|
+
.filter((c) => c != null);
|
|
6496
|
+
return vnode;
|
|
6497
|
+
}
|
|
6491
6498
|
// Portal: render children inline (no target container on server)
|
|
6492
6499
|
if (sel === 'portal') {
|
|
6493
6500
|
const children = vnode.children || [];
|
|
@@ -6867,6 +6874,10 @@ function vnodeToHtml(vnode) {
|
|
|
6867
6874
|
if (!sel) {
|
|
6868
6875
|
if (vnode.text != null)
|
|
6869
6876
|
return escapeHtml(String(vnode.text));
|
|
6877
|
+
// Fragment: no selector, but has children — concatenate child HTML
|
|
6878
|
+
if (vnode.children && Array.isArray(vnode.children)) {
|
|
6879
|
+
return vnode.children.map((c) => vnodeToHtml(c)).join('');
|
|
6880
|
+
}
|
|
6870
6881
|
return '';
|
|
6871
6882
|
}
|
|
6872
6883
|
// Parse selector: tag#id.class1.class2
|
package/dist/sygnal.min.js
CHANGED
|
@@ -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";function e(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(n){if("default"!==n&&!(n in t)){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}))})),Object.freeze(t)}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r={},i={};!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}}(i);var s,a,c=i,l=Object.prototype.toString,u=function(t){var e=l.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]"===l.call(t.callee)),n};var d=Array.prototype.slice,p=u,h=Object.keys,f=h?function(t){return h(t)}:function(){if(a)return s;var t;if(a=1,!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,o=u,r=Object.prototype.propertyIsEnumerable,i=!r.call({toString:null},"toString"),c=r.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(t){var e=t.constructor;return e&&e.prototype===t},p={$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(!p["$"+t]&&e.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{d(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();t=function(t){var r=null!==t&&"object"==typeof t,s="[object Function]"===n.call(t),a=o(t),u=r&&"[object String]"===n.call(t),p=[];if(!r&&!s&&!a)throw new TypeError("Object.keys called on a non-object");var f=c&&s;if(u&&t.length>0&&!e.call(t,0))for(var m=0;m<t.length;++m)p.push(String(m));if(a&&t.length>0)for(var y=0;y<t.length;++y)p.push(String(y));else for(var _ in t)f&&"prototype"===_||!e.call(t,_)||p.push(String(_));if(i)for(var v=function(t){if("undefined"==typeof window||!h)return d(t);try{return d(t)}catch(t){return!1}}(t),g=0;g<l.length;++g)v&&"constructor"===l[g]||!e.call(t,l[g])||p.push(l[g]);return p}}return s=t}(),m=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 p(t)?m(d.call(t)):m(t)})}else Object.keys=f;return Object.keys||f};var y,_=f,v="undefined"!=typeof Symbol&&Symbol,g=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 o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var r=Object.getOwnPropertyDescriptor(t,e);if(42!==r.value||!0!==r.enumerable)return!1}return!0},b={foo:{}},w=Object,S=Array.prototype.slice,E=Object.prototype.toString,A=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==E.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var n,o=S.call(arguments,1),r=Math.max(0,e.length-o.length),i=[],s=0;s<r;s++)i.push("$"+s);if(n=Function("binder","return function ("+i.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var r=e.apply(this,o.concat(S.call(arguments)));return Object(r)===r?r:this}return e.apply(t,o.concat(S.call(arguments)))})),e.prototype){var a=function(){};a.prototype=e.prototype,n.prototype=new a,a.prototype=null}return n},O=Function.prototype.bind||A,N=O.call(Function.call,Object.prototype.hasOwnProperty),C=SyntaxError,T=Function,$=TypeError,x=function(t){try{return T('"use strict"; return ('+t+").constructor;")()}catch(t){}},k=Object.getOwnPropertyDescriptor;if(k)try{k({},"")}catch(t){k=null}var L=function(){throw new $},D=k?function(){try{return L}catch(t){try{return k(arguments,"callee").get}catch(t){return L}}}():L,j="function"==typeof v&&"function"==typeof Symbol&&"symbol"==typeof v("foo")&&"symbol"==typeof Symbol("bar")&&g(),I={__proto__:b}.foo===b.foo&&!({__proto__:null}instanceof w),M=Object.getPrototypeOf||(I?function(t){return t.__proto__}:null),P={},R="undefined"!=typeof Uint8Array&&M?M(Uint8Array):y,F={"%AggregateError%":"undefined"==typeof AggregateError?y:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?y:ArrayBuffer,"%ArrayIteratorPrototype%":j&&M?M([][Symbol.iterator]()):y,"%AsyncFromSyncIteratorPrototype%":y,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%Atomics%":"undefined"==typeof Atomics?y:Atomics,"%BigInt%":"undefined"==typeof BigInt?y:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?y:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?y:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?y:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?y:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?y:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?y:FinalizationRegistry,"%Function%":T,"%GeneratorFunction%":P,"%Int8Array%":"undefined"==typeof Int8Array?y:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?y:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":j&&M?M(M([][Symbol.iterator]())):y,"%JSON%":"object"==typeof JSON?JSON:y,"%Map%":"undefined"==typeof Map?y:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&j&&M?M((new Map)[Symbol.iterator]()):y,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?y:Promise,"%Proxy%":"undefined"==typeof Proxy?y:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?y:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?y:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&j&&M?M((new Set)[Symbol.iterator]()):y,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":j&&M?M(""[Symbol.iterator]()):y,"%Symbol%":j?Symbol:y,"%SyntaxError%":C,"%ThrowTypeError%":D,"%TypedArray%":R,"%TypeError%":$,"%Uint8Array%":"undefined"==typeof Uint8Array?y:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?y:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?y:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?y:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?y:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?y:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?y:WeakSet};if(M)try{null.error}catch(t){var G=M(M(t));F["%Error.prototype%"]=G}var B=function t(e){var n;if("%AsyncFunction%"===e)n=x("async function () {}");else if("%GeneratorFunction%"===e)n=x("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=x("async function* () {}");else if("%AsyncGenerator%"===e){var o=t("%AsyncGeneratorFunction%");o&&(n=o.prototype)}else if("%AsyncIteratorPrototype%"===e){var r=t("%AsyncGenerator%");r&&M&&(n=M(r.prototype))}return F[e]=n,n},U={"%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"]},V=O,H=N,W=V.call(Function.call,Array.prototype.concat),Y=V.call(Function.apply,Array.prototype.splice),z=V.call(Function.call,String.prototype.replace),q=V.call(Function.call,String.prototype.slice),J=V.call(Function.call,RegExp.prototype.exec),Z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,X=/\\(\\)?/g,K=function(t,e){var n,o=t;if(H(U,o)&&(o="%"+(n=U[o])[0]+"%"),H(F,o)){var r=F[o];if(r===P&&(r=B(o)),void 0===r&&!e)throw new $("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:o,value:r}}throw new C("intrinsic "+t+" does not exist!")},Q=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===J(/^%?[^%]*%?$/,t))throw new C("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(t){var e=q(t,0,1),n=q(t,-1);if("%"===e&&"%"!==n)throw new C("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new C("invalid intrinsic syntax, expected opening `%`");var o=[];return z(t,Z,(function(t,e,n,r){o[o.length]=n?z(r,X,"$1"):e||t})),o}(t),o=n.length>0?n[0]:"",r=K("%"+o+"%",e),i=r.name,s=r.value,a=!1,c=r.alias;c&&(o=c[0],Y(n,W([0,1],c)));for(var l=1,u=!0;l<n.length;l+=1){var d=n[l],p=q(d,0,1),h=q(d,-1);if(('"'===p||"'"===p||"`"===p||'"'===h||"'"===h||"`"===h)&&p!==h)throw new C("property names with quotes must have matching quotes");if("constructor"!==d&&u||(a=!0),H(F,i="%"+(o+="."+d)+"%"))s=F[i];else if(null!=s){if(!(d in s)){if(!e)throw new $("base intrinsic for "+t+" exists, but the property is not available.");return}if(k&&l+1>=n.length){var f=k(s,d);s=(u=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:s[d]}else u=H(s,d),s=s[d];u&&!a&&(F[i]=s)}}return s},tt=Q("%Object.defineProperty%",!0),et=function(){if(tt)try{return tt({},"a",{value:1}),!0}catch(t){return!1}return!1};et.hasArrayLengthDefineBug=function(){if(!et())return null;try{return 1!==tt([],"length",{value:1}).length}catch(t){return!0}};var nt=et,ot=_,rt="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),it=Object.prototype.toString,st=Array.prototype.concat,at=Object.defineProperty,ct=nt(),lt=at&&ct,ut=function(t,e,n,o){if(e in t)if(!0===o){if(t[e]===n)return}else if("function"!=typeof(r=o)||"[object Function]"!==it.call(r)||!o())return;var r;lt?at(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n},dt=function(t,e){var n=arguments.length>2?arguments[2]:{},o=ot(e);rt&&(o=st.call(o,Object.getOwnPropertySymbols(e)));for(var r=0;r<o.length;r+=1)ut(t,o[r],e[o[r]],n[o[r]])};dt.supportsDescriptors=!!lt;var pt=n,ht=function(){return"object"==typeof n&&n&&n.Math===Math&&n.Array===Array?n:pt},ft=dt,mt=ht,yt=dt,_t=n,vt=ht,gt=function(){var t=mt();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},bt=vt(),wt=function(){return bt};yt(wt,{getPolyfill:vt,implementation:_t,shim:gt});var St,Et=wt,At=n&&n.__extends||(St=function(t,e){return St=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])},St(t,e)},function(t,e){function n(){this.constructor=t}St(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(r,"__esModule",{value:!0});var Ot=r.NO_IL=r.NO=r.MemoryStream=re=r.Stream=void 0,Nt=c.default(Et.getPolyfill()),Ct={},Tt=r.NO=Ct;function $t(){}function xt(t){for(var e=t.length,n=Array(e),o=0;o<e;++o)n[o]=t[o];return n}function kt(t,e,n){try{return t.f(e)}catch(t){return n._e(t),Ct}}var Lt={_n:$t,_e:$t,_c:$t};function Dt(t){t._start=function(t){t.next=t._n,t.error=t._e,t.complete=t._c,this.start(t)},t._stop=t.stop}Ot=r.NO_IL=Lt;var jt=function(){function t(t,e){this._stream=t,this._listener=e}return t.prototype.unsubscribe=function(){this._stream._remove(this._listener)},t}(),It=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 It(t)),this.active||this._sub.unsubscribe()},t.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},t}(),Pt=function(){function t(t){this.type="merge",this.insArr=t,this.out=Ct,this.ac=0}return t.prototype._start=function(t){this.out=t;var e=this.insArr,n=e.length;this.ac=n;for(var o=0;o<n;o++)e[o]._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=Ct},t.prototype._n=function(t){var e=this.out;e!==Ct&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){if(--this.ac<=0){var t=this.out;if(t===Ct)return;t._c()}},t}(),Rt=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!==Ct&&e.up(t,this.i)){var o=xt(e.vals);n._n(o)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.p;t.out!==Ct&&0==--t.Nc&&t.out._c()},t}(),Ft=function(){function t(t){this.type="combine",this.insArr=t,this.out=Ct,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return t.prototype.up=function(t,e){var n=this.vals[e],o=this.Nn?n===Ct?--this.Nn:this.Nn:0;return this.vals[e]=t,0===o},t.prototype._start=function(t){this.out=t;var e=this.insArr,n=this.Nc=this.Nn=e.length,o=this.vals=new Array(n);if(0===n)t._n([]),t._c();else for(var r=0;r<n;r++)o[r]=Ct,e[r]._add(new Rt(r,t,this))},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=this.ils,o=0;o<e;o++)t[o]._remove(n[o]);this.out=Ct,this.ils=[],this.vals=[]},t}(),Gt=function(){function t(t){this.type="fromArray",this.a=t}return t.prototype._start=function(t){for(var e=this.a,n=0,o=e.length;n<o;n++)t._n(e[n]);t._c()},t.prototype._stop=function(){},t}(),Bt=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($t,(function(t){setTimeout((function(){throw t}))}))},t.prototype._stop=function(){this.on=!1},t}(),Ut=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}(),Vt=function(){function t(t,e){this.type="debug",this.ins=t,this.out=Ct,this.s=$t,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=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=this.s,o=this.l;if(n!==$t)try{n(t)}catch(t){e._e(t)}else o?console.log(o+":",t):console.log(t);e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),Ht=function(){function t(t,e){this.type="drop",this.ins=e,this.out=Ct,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=Ct},t.prototype._n=function(t){var e=this.out;e!==Ct&&this.dropped++>=this.max&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&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}(),Yt=function(){function t(t,e){this.type="endWhen",this.ins=e,this.out=Ct,this.o=t,this.oil=Lt}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=Ct,this.oil=Lt},t.prototype.end=function(){var t=this.out;t!==Ct&&t._c()},t.prototype._n=function(t){var e=this.out;e!==Ct&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){this.end()},t}(),zt=function(){function t(t,e){this.type="filter",this.ins=e,this.out=Ct,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=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=kt(this,t,e);n!==Ct&&n&&e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),qt=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=Ct,this.op.less()},t}(),Jt=function(){function t(t){this.type="flatten",this.ins=t,this.out=Ct,this.open=!0,this.inner=Ct,this.il=Lt}return t.prototype._start=function(t){this.out=t,this.open=!0,this.inner=Ct,this.il=Lt,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.inner!==Ct&&this.inner._remove(this.il),this.out=Ct,this.open=!0,this.inner=Ct,this.il=Lt},t.prototype.less=function(){var t=this.out;t!==Ct&&(this.open||this.inner!==Ct||t._c())},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=this.inner,o=this.il;n!==Ct&&o!==Lt&&n._remove(o),(this.inner=t)._add(this.il=new qt(e,this))}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){this.open=!1,this.less()},t}(),Zt=function(){function t(t,e,n){var o=this;this.type="fold",this.ins=n,this.out=Ct,this.f=function(e){return t(o.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=Ct,this.acc=this.seed},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=kt(this,t,e);n!==Ct&&e._n(this.acc=n)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),Xt=function(){function t(t){this.type="last",this.ins=t,this.out=Ct,this.has=!1,this.val=Ct}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=Ct,this.val=Ct},t.prototype._n=function(t){this.has=!0,this.val=t},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&(this.has?(t._n(this.val),t._c()):t._e(new Error("last() failed because input stream completed")))},t}(),Kt=function(){function t(t,e){this.type="map",this.ins=e,this.out=Ct,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=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=kt(this,t,e);n!==Ct&&e._n(n)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),Qt=function(){function t(t){this.type="remember",this.ins=t,this.out=Ct}return t.prototype._start=function(t){this.out=t,this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=Ct},t}(),te=function(){function t(t,e){this.type="replaceError",this.ins=e,this.out=Ct,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=Ct},t.prototype._n=function(t){var e=this.out;e!==Ct&&e._n(t)},t.prototype._e=function(t){var e=this.out;if(e!==Ct)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!==Ct&&t._c()},t}(),ee=function(){function t(t,e){this.type="startWith",this.ins=t,this.out=Ct,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=Ct},t}(),ne=function(){function t(t,e){this.type="take",this.ins=e,this.out=Ct,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=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){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!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),oe=function(){function t(t){this._prod=t||Ct,this._ils=[],this._stopID=Ct,this._dl=Ct,this._d=!1,this._target=null,this._err=Ct}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 o=xt(e),r=0;r<n;r++)o[r]._n(t)}},t.prototype._e=function(t){if(this._err===Ct){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 o=xt(e),r=0;r<n;r++)o[r]._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=xt(t),o=0;o<e;o++)n[o]._c()}},t.prototype._x=function(){0!==this._ils.length&&(this._prod!==Ct&&this._prod._stop(),this._err=Ct,this._ils=[])},t.prototype._stopNow=function(){this._prod._stop(),this._err=Ct,this._stopID=Ct},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!==Ct)clearTimeout(this._stopID),this._stopID=Ct;else{var o=this._prod;o!==Ct&&o._start(this)}},t.prototype._remove=function(t){var e=this,n=this._target;if(n)return n._remove(t);var o=this._ils,r=o.indexOf(t);r>-1&&(o.splice(r,1),this._prod!==Ct&&o.length<=0?(this._err=Ct,this._stopID=setTimeout((function(){return e._stopNow()}))):1===o.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!==Ct)return this._hasNoSinks(t.out,e.concat(t));if(t._ils){for(var n=0,o=t._ils.length;n<o;n++)if(!this._hasNoSinks(t._ils[n],e.concat(t)))return!1;return!0}return!1},t.prototype.ctor=function(){return this instanceof ie?ie:t},t.prototype.addListener=function(t){t._n=t.next||$t,t._e=t.error||$t,t._c=t.complete||$t,this._add(t)},t.prototype.removeListener=function(t){this._remove(t)},t.prototype.subscribe=function(t){return this.addListener(t),new jt(this,t)},t.prototype[Nt]=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");Dt(e)}return new t(e)},t.createWithMemory=function(t){return t&&Dt(t),new ie(t)},t.never=function(){return new t({_start:$t,_stop:$t})},t.empty=function(){return new t({_start:function(t){t._c()},_stop:$t})},t.throw=function(e){return new t({_start:function(t){t._e(e)},_stop:$t})},t.from=function(e){if("function"==typeof e[Nt])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 Gt(e))},t.fromPromise=function(e){return new t(new Bt(e))},t.fromObservable=function(e){if(void 0!==e.endWhen)return e;var n="function"==typeof e[Nt]?e[Nt]():e;return new t(new Mt(n))},t.periodic=function(e){return new t(new Ut(e))},t.prototype._map=function(t){return new(this.ctor())(new Kt(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,o,r=this._prod;return new t(r instanceof zt?new zt((n=r.f,o=e,function(t){return n(t)&&o(t)}),r.ins):new zt(e,this))},t.prototype.take=function(t){return new(this.ctor())(new ne(t,this))},t.prototype.drop=function(e){return new t(new Ht(e,this))},t.prototype.last=function(){return new t(new Xt(this))},t.prototype.startWith=function(t){return new ie(new ee(this,t))},t.prototype.endWhen=function(t){return new(this.ctor())(new Yt(t,this))},t.prototype.fold=function(t,e){return new ie(new Zt(t,e,this))},t.prototype.replaceError=function(t){return new(this.ctor())(new te(t,this))},t.prototype.flatten=function(){return new t(new Jt(this))},t.prototype.compose=function(t){return t(this)},t.prototype.remember=function(){return new ie(new Qt(this))},t.prototype.debug=function(t){return new(this.ctor())(new Vt(this,t))},t.prototype.imitate=function(t){if(t instanceof ie)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,o=0;o<n;o++)t._add(e[o]);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||$t,t._e=t.error||$t,t._c=t.complete||$t,this._dl=t):(this._d=!1,this._dl=Ct)},t.merge=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Pt(e))},t.combine=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Ft(e))},t}(),re=r.Stream=oe,ie=function(t){function e(e){var n=t.call(this,e)||this;return n._has=!1,n}return At(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!==Ct)this._has&&t._n(this._v),clearTimeout(this._stopID),this._stopID=Ct;else if(this._has)t._n(this._v);else{var o=this._prod;o!==Ct&&o._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}(oe),se=r.MemoryStream=ie,ae=oe,ce=r.default=ae,le=e({__proto__:null,get MemoryStream(){return se},get NO(){return Tt},get NO_IL(){return Ot},get Stream(){return re},default:ce},[r]);function ue(t){return function(){let t;return t="undefined"!=typeof window?window:"undefined"!=typeof global?global:this,t.Cyclejs=t.Cyclejs||{},t=t.Cyclejs,t.adaptStream=t.adaptStream||(t=>t),t}().adaptStream(t)}let de=0;function pe(){return"cycle"+ ++de}function he(t,e=pe()){!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);const n="object"==typeof e?pe():"",o="string"==typeof e||"object"==typeof e?e:e.toString();return function(e,...r){const i=function(t,e,n){const o={};return Object.keys(t).forEach((t=>{if("string"==typeof e)return void(o[t]=e);const r=e[t];if(void 0!==r)return void(o[t]=r);const i=e["*"];o[t]=void 0===i?n:i})),o}(e,o,n),s=function(t,e){const n={};for(const o in t){const r=t[o];Object.prototype.hasOwnProperty.call(t,o)&&r&&null!==e[o]&&"function"==typeof r.isolateSource?n[o]=r.isolateSource(r,e[o]):Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n}(e,i),a=function(t,e,n){const o={};for(const r in e){const i=t[r],s=e[r];Object.prototype.hasOwnProperty.call(e,r)&&i&&null!==n[r]&&"function"==typeof i.isolateSink?o[r]=ue(i.isolateSink(ce.fromObservable(s),n[r])):Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r])}return o}(e,t(s,...r),i);return a}}he.reset=()=>de=0;var fe={};Object.defineProperty(fe,"__esModule",{value:!0});var me=fe.DropRepeatsOperator=void 0,ye=r,_e={},ve=function(){function t(t,e){this.ins=t,this.type="dropRepeats",this.out=null,this.v=_e,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=_e},t.prototype._n=function(t){var e=this.out;if(e){var n=this.v;n!==_e&&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}();me=fe.DropRepeatsOperator=ve;var ge=fe.default=function(t){return void 0===t&&(t=void 0),function(e){return new ye.Stream(new ve(e,t))}},be=e({__proto__:null,get DropRepeatsOperator(){return me},default:ge},[fe]);function we(t){return"string"==typeof t||"number"==typeof t?function(e){return null==e?void 0:e[t]}:t.get}function Se(t){return"string"==typeof t||"number"==typeof t?function(e,n){return Array.isArray(e)?function(t,e,n){if(n===t[e])return t;const o=parseInt(e);return void 0===n?t.filter(((t,e)=>e!==o)):t.map(((t,e)=>e===o?n:t))}(e,t,n):void 0===e?{[t]:n}:{...e,[t]:n}}:t.set}function Ee(t,e){return t.select(e)}function Ae(t,e){const n=we(e),o=Se(e);return t.map((t=>function(e){const r=n(e),i=t(r);return r===i?e:o(e,i)}))}class Oe{constructor(t,e){this.isolateSource=Ee,this.isolateSink=Ae,this._stream=t.filter((t=>void 0!==t)).compose(ge()).remember(),this._name=e,this.stream=ue(this._stream),this._stream._isCycleSource=e}select(t){const e=we(t);return new Oe(this._stream.map(e),this._name)}}class Ne{constructor(t,e,n){this.ins=n,this.out=t,this.p=e}_n(t){this.p;const e=this.out;null!==e&&e._n(t)}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){}}class Ce{constructor(t,e){this.type="pickMerge",this.ins=e,this.out=null,this.sel=t,this.ils=new Map,this.inst=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this);const t=this.ils;t.forEach(((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}_n(t){this.inst=t;const e=t.arr,n=this.ils,o=this.out,r=this.sel,i=e.length;for(let t=0;t<i;++t){const i=e[t],s=i._key,a=ce.fromObservable(i[r]||ce.never());n.has(s)||(n.set(s,new Ne(o,this,a)),a._add(n.get(s)))}n.forEach(((e,o)=>{t.dict.has(o)&&t.dict.get(o)||(e.ins._remove(e),e.ins=null,e.out=null,n.delete(o))}))}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){const t=this.out;null!==t&&t._c()}}class Te{constructor(t,e,n,o){this.key=t,this.out=e,this.p=n,this.val=Tt,this.ins=o}_n(t){this.p;const e=this.out;this.val=t,null!==e&&this.p.up()}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){}}class $e{constructor(t,e){this.type="combine",this.ins=e,this.sel=t,this.out=null,this.ils=new Map,this.inst=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this);const t=this.ils;t.forEach((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}up(){const t=this.inst.arr,e=t.length,n=this.ils,o=Array(e);for(let r=0;r<e;++r){const e=t[r]._key;if(!n.has(e))return;const i=n.get(e).val;if(i===Tt)return;o[r]=i}this.out._n(o)}_n(t){this.inst=t;const e=t.arr,n=this.ils,o=this.out,r=this.sel,i=t.dict,s=e.length;let a=!1;if(n.forEach(((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(let t=0;t<s;++t){const i=e[t],s=i._key;if(!i[r])throw new Error("pickCombine found an undefined child sink stream");const a=ce.fromObservable(i[r]);n.has(s)||(n.set(s,new Te(s,o,this,a)),a._add(n.get(s)))}a&&this.up()}else o._n([])}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){const t=this.out;null!==t&&t._c()}}class xe{constructor(t){this._instances$=t}pickMerge(t){return ue(this._instances$.compose(function(t){return function(e){return new re(new Ce(t,e))}}(t)))}pickCombine(t){return ue(this._instances$.compose(function(t){return function(e){return new re(new $e(t,e))}}(t)))}}function ke(t){return{"*":null}}function Le(t,e){return{get(n){if(void 0!==n)for(let o=0,r=n.length;o<r;++o)if(`${t(n[o],o)}`===e)return n[o]},set:(n,o)=>void 0===n?[o]:void 0===o?n.filter(((n,o)=>`${t(n,o)}`!==e)):n.map(((n,r)=>`${t(n,r)}`===e?o:n))}}const De={get:t=>t,set:(t,e)=>e};var je={};Object.defineProperty(je,"__esModule",{value:!0});var Ie=r,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 Pe=je.default=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Ie.Stream(new Me(t))},Re=e({__proto__:null,default:Pe},[je]);function Fe(t,e="state"){return function(n){const o=ce.create(),r=o.fold(((t,e)=>e(t)),void 0).drop(1),i=n;i[e]=new Oe(r,e);const s=t(i);if(s[e]){Pe(ce.fromObservable(s[e]),ce.never()).subscribe({next:t=>queueMicrotask((()=>o._n(t))),error:t=>queueMicrotask((()=>o._e(t))),complete:()=>queueMicrotask((()=>o._c()))})}return s}}function Ge(t,e,n,o,r){return{sel:t,data:e,children:n,text:o,elm:r,key:void 0===e?void 0:e.key}}const Be=Array.isArray;function Ue(t){return"string"==typeof t||"number"==typeof t||t instanceof String||t instanceof Number}function Ve(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 o=n.data;void 0!==o&&Ve(o,n.children,n.sel)}}function He(t,e,n){let o,r,i,s={};if(void 0!==n?(null!==e&&(s=e),Be(n)?o=n:Ue(n)?r=n.toString():n&&n.sel&&(o=[n])):null!=e&&(Be(e)?o=e:Ue(e)?r=e.toString():e&&e.sel?o=[e]:s=e),void 0!==o)for(i=0;i<o.length;++i)Ue(o[i])&&(o[i]=Ge(void 0,void 0,void 0,o[i],void 0));return!t.startsWith("svg")||3!==t.length&&"."!==t[3]&&"#"!==t[3]||Ve(s,o,t),Ge(t,s,o,r,void 0)}function We(t){if(Ye(t)){for(;t&&Ye(t);){t=ze(t).parent}return null!=t?t:null}return t.parentNode}function Ye(t){return 11===t.nodeType}function ze(t,e){var n,o,r;const i=t;return null!==(n=i.parent)&&void 0!==n||(i.parent=null!=e?e:null),null!==(o=i.firstChildNode)&&void 0!==o||(i.firstChildNode=t.firstChild),null!==(r=i.lastChildNode)&&void 0!==r||(i.lastChildNode=t.lastChild),i}const qe={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 ze(document.createDocumentFragment())},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){if(Ye(t)){let e=t;for(;e&&Ye(e);){e=ze(e).parent}t=null!=e?e:t}Ye(e)&&(e=ze(e,t)),n&&Ye(n)&&(n=ze(n).firstChildNode),t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){Ye(e)&&(e=ze(e,t)),t.appendChild(e)},parentNode:We,nextSibling:function(t){var e;if(Ye(t)){const n=ze(t),o=We(n);if(o&&n.lastChildNode){const t=Array.from(o.childNodes),r=t.indexOf(n.lastChildNode);return null!==(e=t[r+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:Ye},Je=Ge("",{},[],void 0,void 0);function Ze(t,e){var n,o;const r=t.key===e.key,i=(null===(n=t.data)||void 0===n?void 0:n.is)===(null===(o=e.data)||void 0===o?void 0:o.is),s=t.sel===e.sel,a=!(!t.sel&&t.sel===e.sel)||typeof t.text==typeof e.text;return s&&r&&i&&a}function Xe(){throw new Error("The document fragment is not supported on this platform.")}function Ke(t,e,n){var o;const r={};for(let i=e;i<=n;++i){const e=null===(o=t[i])||void 0===o?void 0:o.key;void 0!==e&&(r[e]=i)}return r}const Qe=["create","update","remove","destroy","pre","post"];function tn(t,e,n){const o={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},r=void 0!==e?e:qe;for(const e of Qe)for(const n of t){const t=n[e];void 0!==t&&o[e].push(t)}function i(t,e){return function(){if(0==--e){const e=r.parentNode(t);null!==e&&r.removeChild(e,t)}}}function s(t,e){var i,a,c,l,u;let d;const p=t.data,h=null==p?void 0:p.hook;null===(i=null==h?void 0:h.init)||void 0===i||i.call(h,t);const f=t.children,m=t.sel;if("!"===m)null!==(a=t.text)&&void 0!==a||(t.text=""),t.elm=r.createComment(t.text);else if(""===m)t.elm=r.createTextNode(t.text);else if(void 0!==m){const n=m.indexOf("#"),i=m.indexOf(".",n),a=n>0?n:m.length,l=i>0?i:m.length,u=-1!==n||-1!==i?m.slice(0,Math.min(a,l)):m,y=null==p?void 0:p.ns,_=void 0===y?r.createElement(u,p):r.createElementNS(y,u,p);for(t.elm=_,a<l&&_.setAttribute("id",m.slice(a+1,l)),i>0&&_.setAttribute("class",m.slice(l+1).replace(/\./g," ")),d=0;d<o.create.length;++d)o.create[d](Je,t);if(!Ue(t.text)||Be(f)&&0!==f.length||r.appendChild(_,r.createTextNode(t.text)),Be(f))for(d=0;d<f.length;++d){const t=f[d];null!=t&&r.appendChild(_,s(t,e))}void 0!==h&&(null===(c=h.create)||void 0===c||c.call(h,Je,t),void 0!==h.insert&&e.push(t))}else if((null===(l=null==n?void 0:n.experimental)||void 0===l?void 0:l.fragments)&&t.children){for(t.elm=(null!==(u=r.createDocumentFragment)&&void 0!==u?u:Xe)(),d=0;d<o.create.length;++d)o.create[d](Je,t);for(d=0;d<t.children.length;++d){const n=t.children[d];null!=n&&r.appendChild(t.elm,s(n,e))}}else t.elm=r.createTextNode(t.text);return t.elm}function a(t,e,n,o,i,a){for(;o<=i;++o){const i=n[o];null!=i&&r.insertBefore(t,s(i,a),e)}}function c(t){var e,n;const r=t.data;if(void 0!==r){null===(n=null===(e=null==r?void 0:r.hook)||void 0===e?void 0:e.destroy)||void 0===n||n.call(e,t);for(let e=0;e<o.destroy.length;++e)o.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&&c(n)}}}function l(t,e,n,s){for(var a,u;n<=s;++n){let s;const d=e[n];if(null!=d)if(void 0!==d.sel){c(d),s=o.remove.length+1;const t=i(d.elm,s);for(let e=0;e<o.remove.length;++e)o.remove[e](d,t);const e=null===(u=null===(a=null==d?void 0:d.data)||void 0===a?void 0:a.hook)||void 0===u?void 0:u.remove;void 0!==e?e(d,t):t()}else d.children?(c(d),l(t,d.children,0,d.children.length-1)):r.removeChild(t,d.elm)}}function u(t,e,n){var i,c,d,p,h,f,m,y;const _=null===(i=e.data)||void 0===i?void 0:i.hook;null===(c=null==_?void 0:_.prepatch)||void 0===c||c.call(_,t,e);const v=e.elm=t.elm;if(t===e)return;if(void 0!==e.data||void 0!==e.text&&e.text!==t.text){null!==(d=e.data)&&void 0!==d||(e.data={}),null!==(p=t.data)&&void 0!==p||(t.data={});for(let n=0;n<o.update.length;++n)o.update[n](t,e);null===(m=null===(f=null===(h=e.data)||void 0===h?void 0:h.hook)||void 0===f?void 0:f.update)||void 0===m||m.call(f,t,e)}const g=t.children,b=e.children;void 0===e.text?void 0!==g&&void 0!==b?g!==b&&function(t,e,n,o){let i,c,d,p,h=0,f=0,m=e.length-1,y=e[0],_=e[m],v=n.length-1,g=n[0],b=n[v];for(;h<=m&&f<=v;)null==y?y=e[++h]:null==_?_=e[--m]:null==g?g=n[++f]:null==b?b=n[--v]:Ze(y,g)?(u(y,g,o),y=e[++h],g=n[++f]):Ze(_,b)?(u(_,b,o),_=e[--m],b=n[--v]):Ze(y,b)?(u(y,b,o),r.insertBefore(t,y.elm,r.nextSibling(_.elm)),y=e[++h],b=n[--v]):Ze(_,g)?(u(_,g,o),r.insertBefore(t,_.elm,y.elm),_=e[--m],g=n[++f]):(void 0===i&&(i=Ke(e,h,m)),c=i[g.key],void 0===c?(r.insertBefore(t,s(g,o),y.elm),g=n[++f]):void 0===i[b.key]?(r.insertBefore(t,s(b,o),r.nextSibling(_.elm)),b=n[--v]):(d=e[c],d.sel!==g.sel?r.insertBefore(t,s(g,o),y.elm):(u(d,g,o),e[c]=void 0,r.insertBefore(t,d.elm,y.elm)),g=n[++f]));f<=v&&(p=null==n[v+1]?null:n[v+1].elm,a(t,p,n,f,v,o)),h<=m&&l(t,e,h,m)}(v,g,b,n):void 0!==b?(void 0!==t.text&&r.setTextContent(v,""),a(v,null,b,0,b.length-1,n)):void 0!==g?l(v,g,0,g.length-1):void 0!==t.text&&r.setTextContent(v,""):t.text!==e.text&&(void 0!==g&&l(v,g,0,g.length-1),r.setTextContent(v,e.text)),null===(y=null==_?void 0:_.postpatch)||void 0===y||y.call(_,t,e)}return function(t,e){let n,i,a;const c=[];for(n=0;n<o.pre.length;++n)o.pre[n]();for(!function(t,e){return t.isElement(e)}(r,t)?function(t,e){return t.isDocumentFragment(e)}(r,t)&&(t=Ge(void 0,{},[],void 0,t)):t=function(t){const e=t.id?"#"+t.id:"",n=t.getAttribute("class"),o=n?"."+n.split(" ").join("."):"";return Ge(r.tagName(t).toLowerCase()+e+o,{},[],void 0,t)}(t),Ze(t,e)?u(t,e,c):(i=t.elm,a=r.parentNode(i),s(e,c),null!==a&&(r.insertBefore(a,e.elm,r.nextSibling(i)),l(a,[t],0,0))),n=0;n<c.length;++n)c[n].data.hook.insert(c[n]);for(n=0;n<o.post.length;++n)o.post[n]();return e}}function en(t,e){var n;const o=void 0!==e?e:qe;let r;if(o.isElement(t)){const r=t.id?"#"+t.id:"",s=null===(n=t.getAttribute("class"))||void 0===n?void 0:n.match(/[^\t\r\n\f ]+/g),a=s?"."+s.join("."):"",c=o.tagName(t).toLowerCase()+r+a,l={},u={},d={},p=[];let h,f,m;const y=t.attributes,_=t.childNodes;for(f=0,m=y.length;f<m;f++)h=y[f].nodeName,h.startsWith("data-")?u[(i=h,i.slice(5).replace(/-([a-z])/g,((t,e)=>e.toUpperCase())))]=y[f].nodeValue||"":"id"!==h&&"class"!==h&&(l[h]=y[f].nodeValue);for(f=0,m=_.length;f<m;f++)p.push(en(_[f],e));return Object.keys(l).length>0&&(d.attrs=l),Object.keys(u).length>0&&(d.dataset=u),!c.startsWith("svg")||3!==c.length&&"."!==c[3]&&"#"!==c[3]||Ve(d,p,c),Ge(c,d,p,void 0,t)}return o.isText(t)?(r=o.getTextContent(t),Ge(void 0,void 0,void 0,r,t)):o.isComment(t)?(r=o.getTextContent(t),Ge("!",{},[],r,t)):Ge("",{},[],void 0,t);var i}function nn(t,e){let n,o;const r=e.elm;let i=t.data.class,s=e.data.class;if((i||s)&&i!==s){for(o in i=i||{},s=s||{},i)i[o]&&!Object.prototype.hasOwnProperty.call(s,o)&&r.classList.remove(o);for(o in s)n=s[o],n!==i[o]&&r.classList[n?"add":"remove"](o)}}const on={create:nn,update:nn};function rn(t,e){let n,o,r;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)o=a[n],r=s[n],r===o||"value"===n&&i[n]===o||(i[n]=o)}const sn={create:rn,update:rn};function an(t,e){let n;const o=e.elm;let r=t.data.attrs,i=e.data.attrs;if((r||i)&&r!==i){for(n in r=r||{},i=i||{},i){const t=i[n];r[n]!==t&&(!0===t?o.setAttribute(n,""):!1===t?o.removeAttribute(n):120!==n.charCodeAt(0)?o.setAttribute(n,t):58===n.charCodeAt(3)?o.setAttributeNS("http://www.w3.org/XML/1998/namespace",n,t):58===n.charCodeAt(5)?109===n.charCodeAt(1)?o.setAttributeNS("http://www.w3.org/2000/xmlns/",n,t):o.setAttributeNS("http://www.w3.org/1999/xlink",n,t):o.setAttribute(n,t))}for(n in r)n in i||o.removeAttribute(n)}}const cn={create:an,update:an},ln=/[A-Z]/g;function un(t,e){const n=e.elm;let o,r=t.data.dataset,i=e.data.dataset;if(!r&&!i)return;if(r===i)return;r=r||{},i=i||{};const s=n.dataset;for(o in r)o in i||(s?o in s&&delete s[o]:n.removeAttribute("data-"+o.replace(ln,"-$&").toLowerCase()));for(o in i)r[o]!==i[o]&&(s?s[o]=i[o]:n.setAttribute("data-"+o.replace(ln,"-$&").toLowerCase(),i[o]))}const dn={create:un,update:un};function pn(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 hn(t){const e=t.data;pn(e.fn.apply(void 0,e.args),t)}function fn(t,e){const n=t.data,o=e.data;let r;const i=n.args,s=o.args;for(n.fn===o.fn&&i.length===s.length||pn(o.fn.apply(void 0,s),e),r=0;r<s.length;++r)if(i[r]!==s[r])return void pn(o.fn.apply(void 0,s),e);pn(t,e)}function mn(t,e,n=!1,o=!1,r=!1){let i=null;return re.create({start:function(s){i=o?function(t){_n(t,o),s.next(t)}:function(t){s.next(t)},t.addEventListener(e,i,{capture:n,passive:r})},stop:function(){t.removeEventListener(e,i,n),i=null}})}function yn(t,e){const n=Object.keys(t),o=n.length;for(let r=0;r<o;r++){const o=n[r];if("object"==typeof t[o]&&null!==t[o]&&"object"==typeof e[o]&&null!==e[o]){if(!yn(t[o],e[o]))return!1}else if(t[o]!==e[o])return!1}return!0}function _n(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");yn(e,t)&&t.preventDefault()}}function vn(t){return t.value=function(e){return vn(t.map((t=>{const n=t?.target?.value;return e?e(n):n})))},t.checked=function(e){return vn(t.map((t=>{const n=!!t?.target?.checked;return e?e(n):n})))},t.data=function(e,n){return vn(t.map((t=>{const o=t?.target instanceof Element?t.target.closest(`[data-${e}]`)||t.target:t?.target,r=o?.dataset?.[e];return n?n(r):r})))},t.target=function(e){return vn(t.map((t=>{const n=t?.target;return e?e(n):n})))},t.key=function(e){return vn(t.map((t=>{const n=t?.key;return e?e(n):n})))},t}class gn{constructor(t,e){this._name=t,this._selector=e||null}select(t){return new gn(this._name,t)}elements(){if(this._selector){const t=ue(ce.of(Array.from(document.querySelectorAll(this._selector))));return t._isCycleSource=this._name,t}const t=ue(ce.of([document]));return t._isCycleSource=this._name,t}element(){if(this._selector){const t=ue(ce.of(document.querySelector(this._selector)));return t._isCycleSource=this._name,t}const t=ue(ce.of(document));return t._isCycleSource=this._name,t}events(t,e={},n){let o;if(o=mn(document,t,e.useCapture,e.preventDefault),this._selector){const t=this._selector;o=o.filter((e=>{const n=e.target;return n instanceof Element&&(n.matches(t)||null!==n.closest(t))}))}const r=vn(ue(o));return r._isCycleSource=this._name,r}}class bn{constructor(t){this._name=t}select(t){return this}elements(){const t=ue(ce.of([document.body]));return t._isCycleSource=this._name,t}element(){const t=ue(ce.of(document.body));return t._isCycleSource=this._name,t}events(t,e={},n){let o;o=mn(document.body,t,e.useCapture,e.preventDefault);const r=ue(o);return r._isCycleSource=this._name,r}}function wn(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 Sn(t){let e="";for(let n=t.length-1;n>=0&&"selector"===t[n].type;n--)e=t[n].scope+" "+e;return e.trim()}function En(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n].type!==e[n].type||t[n].scope!==e[n].scope)return!1;return!0}class An{constructor(t,e){this.namespace=t,this.isolateModule=e,this._namespace=t.filter((t=>"selector"!==t.type))}isDirectlyInScope(t){const e=this.isolateModule.getNamespace(t);if(!e)return!1;if(this._namespace.length>e.length||!En(this._namespace,e.slice(0,this._namespace.length)))return!1;for(let t=this._namespace.length;t<e.length;t++)if("total"===e[t].type)return!1;return!0}}class On{constructor(t,e){this.namespace=t,this.isolateModule=e}call(){const t=this.namespace,e=Sn(t),n=new An(t,this.isolateModule),o=this.isolateModule.getElement(t.filter((t=>"selector"!==t.type)));return void 0===o?[]:""===e?[o]:(r=o.querySelectorAll(e),Array.prototype.slice.call(r)).filter(n.isDirectlyInScope,n).concat(o.matches(e)?[o]:[]);var r}}function Nn(t){return{type:(e=t,e.length>1&&("."===e[0]||"#"===e[0])?"sibling":"total"),scope:t};var e}class Cn{constructor(t,e,n=[],o,r,i){var s;this._rootElement$=t,this._sanitation$=e,this._namespace=n,this._isolateModule=o,this._eventDelegator=r,this._name=i,this.isolateSource=(t,e)=>new Cn(t._rootElement$,t._sanitation$,t._namespace.concat(Nn(e)),t._isolateModule,t._eventDelegator,t._name),this.isolateSink=(s=this._namespace,(t,e)=>":root"===e?t:t.map((t=>{if(!t)return t;const n=Nn(e),o={...t,data:{...t.data,isolate:t.data&&Array.isArray(t.data.isolate)?t.data.isolate:s.concat([n])}};return{...o,key:void 0!==o.key?o.key:JSON.stringify(o.data.isolate)}})))}_elements(){if(0===this._namespace.length)return this._rootElement$.map((t=>[t]));{const t=new On(this._namespace,this._isolateModule);return this._rootElement$.map((()=>t.call()))}}elements(){const t=ue(this._elements().remember());return t._isCycleSource=this._name,t}element(){const t=ue(this._elements().filter((t=>t.length>0)).map((t=>t[0])).remember());return t._isCycleSource=this._name,t}get namespace(){return this._namespace}select(t){if("string"!=typeof t)throw new Error("DOM driver's select() expects the argument to be a string as a CSS selector");if("document"===t)return new gn(this._name);if("body"===t)return new bn(this._name);const e=":root"===t?[]:this._namespace.concat({type:"selector",scope:t.trim()});return new Cn(this._rootElement$,this._sanitation$,e,this._isolateModule,this._eventDelegator,this._name)}events(t,e={},n){if("string"!=typeof t)throw new Error("DOM driver's events() expects argument to be a string representing the event type to listen for.");const o=vn(ue(this._eventDelegator.addEventListener(t,this._namespace,e,n)));return o._isCycleSource=this._name,o}dispose(){this._sanitation$.shamefullySendNext(null)}}var Tn={},$n=n&&n.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var o=Array(t),r=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,r++)o[r]=i[s];return o};Object.defineProperty(Tn,"__esModule",{value:!0}),Tn.SampleCombineOperator=Tn.SampleCombineListener=void 0;var xn=r,kn={},Ln=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!==kn&&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}();Tn.SampleCombineListener=Ln;var Dn,jn=function(){function t(t,e){this.type="sampleCombine",this.ins=t,this.others=e,this.out=kn,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,o=this.vals=new Array(n),r=0;r<n;r++)o[r]=kn,e[r]._add(new Ln(r,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 o=0;o<e;o++)t[o]._remove(n[o]);this.out=kn,this.vals=[],this.ils=[]},t.prototype._n=function(t){var e=this.out;e!==kn&&(this.Nn>0||e._n($n([t],this.vals)))},t.prototype._e=function(t){var e=this.out;e!==kn&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==kn&&t._c()},t.prototype.up=function(t,e){var n=this.vals[e];this.Nn>0&&n===kn&&this.Nn--,this.vals[e]=t},t.prototype.down=function(t,e){this.others[t]._remove(e)},t}();Tn.SampleCombineOperator=jn,Dn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return new xn.Stream(new jn(e,t))}};var In=Tn.default=Dn;function Mn(t){if(!t.sel)return{tagName:"",id:"",className:""};const e=t.sel,n=e.indexOf("#"),o=e.indexOf(".",n),r=n>0?n:e.length,i=o>0?o:e.length;return{tagName:-1!==n||-1!==o?e.slice(0,Math.min(r,i)):e,id:r<i?e.slice(r+1,i):void 0,className:o>0?e.slice(i+1).replace(/\./g," "):void 0}}class Pn{constructor(t){this.rootElement=t}call(t){if(11===this.rootElement.nodeType)return this.wrapDocFrag(null===t?[]:[t]);if(null===t)return this.wrap([]);const{tagName:e,id:n}=Mn(t),o=function(t){let{className:e=""}=Mn(t);if(!t.data)return e;const{class:n,props:o}=t.data;n&&(e+=` ${Object.keys(n).filter((t=>n[t])).join(" ")}`);return o&&o.className&&(e+=` ${o.className}`),e&&e.trim()}(t),r=(t.data||{}).props||{},{id:i=n}=r;return"string"==typeof i&&i.toUpperCase()===this.rootElement.id.toUpperCase()&&e.toUpperCase()===this.rootElement.tagName.toUpperCase()&&o.toUpperCase()===this.rootElement.className.toUpperCase()?t:this.wrap([t])}wrapDocFrag(t){return Ge("",{isolate:[]},t,void 0,this.rootElement)}wrap(t){const{tagName:e,id:n,className:o}=this.rootElement,r=n?`#${n}`:"",i=o?`.${o.split(" ").join(".")}`:"",s=He(`${e.toLowerCase()}${r}${i}`,{},t);return s.data=s.data||{},s.data.isolate=s.data.isolate||[],s}}const Rn="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||setTimeout,Fn=t=>{Rn((()=>{Rn(t)}))};let Gn=!1;function Bn(t,e,n){Fn((()=>{t[e]=n}))}function Un(t,e){let n,o;const r=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(o in i)o in s||("-"===o[0]&&"-"===o[1]?r.style.removeProperty(o):r.style[o]="");for(o in s)if(n=s[o],"delayed"===o&&s.delayed)for(const t in s.delayed)n=s.delayed[t],a&&n===i.delayed[t]||Bn(r.style,t,n);else"remove"!==o&&n!==i[o]&&("-"===o[0]&&"-"===o[1]?r.style.setProperty(o,n):r.style[o]=n)}const Vn={pre:function(){Gn=!1},create:Un,update:Un,destroy:function(t){let e,n;const o=t.elm,r=t.data.style;if(r&&(e=r.destroy))for(n in e)o.style[n]=e[n]},remove:function(t,e){const n=t.data.style;if(!n||!n.remove)return void e();let o;Gn||(t.elm.offsetLeft,Gn=!0);const r=t.elm;let i=0;const s=n.remove;let a=0;const c=[];for(o in s)c.push(o),r.style[o]=s[o];const l=getComputedStyle(r)["transition-property"].split(", ");for(;i<l.length;++i)-1!==c.indexOf(l[i])&&a++;r.addEventListener("transitionend",(t=>{t.target===r&&--a,0===a&&e()}))}};let Hn=[];const Wn={create:function(t,e){const n=e.elm;n&&"SELECT"===n.tagName&&void 0!==e.data?.props?.value&&Hn.push({elm:n,value:e.data.props.value})},post:function(){for(let t=0;t<Hn.length;t++){const{elm:e,value:n}=Hn[t];e.value=n}Hn=[]}},Yn=[Vn,on,sn,cn,dn,Wn];class zn{constructor(t){this.mapper=t,this.tree=[void 0,{}]}set(t,e,n){let o=this.tree;const r=void 0!==n?n:t.length;for(let e=0;e<r;e++){const n=this.mapper(t[e]);let r=o[1][n];r||(r=[void 0,{}],o[1][n]=r),o=r}o[0]=e}getDefault(t,e,n){return this.get(t,e,n)}get(t,e,n){let o=this.tree;const r=void 0!==n?n:t.length;for(let n=0;n<r;n++){const r=this.mapper(t[n]);let i=o[1][r];if(!i){if(!e)return;i=[void 0,{}],o[1][r]=i}o=i}return e&&!o[0]&&(o[0]=e()),o[0]}delete(t){let e=this.tree;for(let n=0;n<t.length-1;n++){const o=e[1][this.mapper(t[n])];if(!o)return;e=o}delete e[1][this.mapper(t[t.length-1])]}}class qn{constructor(){this.namespaceTree=new zn((t=>t.scope)),this.namespaceByElement=new Map,this.vnodesBeingRemoved=[]}setEventDelegator(t){this.eventDelegator=t}insertElement(t,e){this.namespaceByElement.set(e,t),this.namespaceTree.set(t,e)}removeElement(t){this.namespaceByElement.delete(t);const e=this.getNamespace(t);e&&this.namespaceTree.delete(e)}getElement(t,e){return this.namespaceTree.get(t,void 0,e)}getRootElement(t){if(this.namespaceByElement.has(t))return t;let e=t;for(;!this.namespaceByElement.has(e);){if(e=e.parentNode,!e)return;if("HTML"===e.tagName)throw new Error("No root element found, this should not happen at all")}return e}getNamespace(t){const e=this.getRootElement(t);if(e)return this.namespaceByElement.get(e)}createModule(){const t=this;return{create(e,n){const{elm:o,data:r={}}=n,i=r.isolate;Array.isArray(i)&&t.insertElement(i,o)},update(e,n){const{elm:o,data:r={}}=e,{elm:i,data:s={}}=n,a=r.isolate,c=s.isolate;En(a,c)||Array.isArray(a)&&t.removeElement(o),Array.isArray(c)&&t.insertElement(c,i)},destroy(e){t.vnodesBeingRemoved.push(e)},remove(e,n){t.vnodesBeingRemoved.push(e),n()},post(){const e=t.vnodesBeingRemoved;for(let n=e.length-1;n>=0;n--){const o=e[n],r=void 0!==o.data?o.data.isolation:void 0;void 0!==r&&t.removeElement(r),t.eventDelegator.removeElement(o.elm,r)}t.vnodesBeingRemoved=[]}}}}class Jn{constructor(){this.arr=[],this.prios=[]}add(t,e){for(let 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)}forEach(t){for(let e=0;e<this.arr.length;e++)t(this.arr[e],e,this.arr)}delete(t){for(let e=0;e<this.arr.length;e++)if(this.arr[e]===t)return this.arr.splice(e,1),void this.prios.splice(e,1)}}const Zn=["blur","focus","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture","canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","pause","play","playing","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","load","unload","invalid","reset","submit","formdata","toggle","animationstart","animationend","animationiteration","transitionrun","transitionstart","transitionend","scroll","scrollend"];class Xn{constructor(t,e){this.rootElement$=t,this.isolateModule=e,this.virtualListeners=new zn((t=>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:t=>{this.origin!==t&&(this.origin=t,this.resetEventListeners(),this.domListenersToAdd.forEach(((t,e)=>this.setupDOMListener(e,t))),this.domListenersToAdd.clear()),this.nonBubblingListenersToAdd.forEach((t=>{this.setupNonBubblingListener(t)}))}})}addEventListener(t,e,n,o){const r=ce.never();let i;const s=new An(e,this.isolateModule);if(void 0===o?-1===Zn.indexOf(t):o)return this.domListeners.has(t)||this.setupDOMListener(t,!!n.passive),i=this.insertListener(r,s,t,n),r;{const o=[];this.nonBubblingListenersToAdd.forEach((t=>o.push(t)));let a,c=0;const l=o.length,u=n=>{const[o,r,i,s]=n;return t===r&&En(i.namespace,e)};for(;!a&&c<l;){const t=o[c];a=u(t)?t:a,c++}let d,p=a;if(p){const[t]=p;d=t}else{const o=new On(e,this.isolateModule);i=this.insertListener(r,s,t,n),p=[r,t,o,i],d=r,this.nonBubblingListenersToAdd.add(p),this.setupNonBubblingListener(p)}const h=this;let f=null;return ce.create({start:t=>{f=d.subscribe(t)},stop:()=>{const[t,e,n,o]=p;n.call().forEach((function(t){const n=t.subs;n&&n[e]&&(n[e].unsubscribe(),delete n[e])})),h.nonBubblingListenersToAdd.delete(p),f.unsubscribe()}})}}removeElement(t,e){void 0!==e&&this.virtualListeners.delete(e);const n=[];this.nonBubblingListeners.forEach(((e,o)=>{if(e.has(t)){n.push([o,t]);const e=t.subs;e&&Object.keys(e).forEach((t=>{e[t].unsubscribe()}))}}));for(let t=0;t<n.length;t++){const e=this.nonBubblingListeners.get(n[t][0]);e&&(e.delete(n[t][1]),0===e.size?this.nonBubblingListeners.delete(n[t][0]):this.nonBubblingListeners.set(n[t][0],e))}}insertListener(t,e,n,o){const r=[],i=e._namespace;let s=i.length;do{r.push(this.getVirtualListeners(n,i,!0,s)),s--}while(s>=0&&"total"!==i[s].type);const a={...o,scopeChecker:e,subject:t,bubbles:!!o.bubbles,useCapture:!!o.useCapture,passive:!!o.passive};for(let t=0;t<r.length;t++)r[t].add(a,i.length);return a}getVirtualListeners(t,e,n=!1,o){let r=void 0!==o?o:e.length;if(!n)for(let t=r-1;t>=0;t--){if("total"===e[t].type){r=t+1;break}r=t}const i=this.virtualListeners.getDefault(e,(()=>new Map),r);return i.has(t)||i.set(t,new Jn),i.get(t)}setupDOMListener(t,e){if(this.origin){const n=mn(this.origin,t,!1,!1,e).subscribe({next:n=>this.onEvent(t,n,e),error:()=>{},complete:()=>{}});this.domListeners.set(t,{sub:n,passive:e})}else this.domListenersToAdd.set(t,e)}setupNonBubblingListener(t){const[e,n,o,r]=t;if(!this.origin)return;const i=o.call();if(i.length){const t=this;i.forEach((e=>{const o=e.subs;if(!o||!o[n]){const i=mn(e,n,!1,!1,r.passive).subscribe({next:e=>t.onEvent(n,e,!!r.passive,!1),error:()=>{},complete:()=>{}});t.nonBubblingListeners.has(n)||t.nonBubblingListeners.set(n,new Map);const s=t.nonBubblingListeners.get(n);if(!s)return;s.set(e,{sub:i,destination:r}),e.subs={...o,[n]:i}}}))}}resetEventListeners(){const t=this.domListeners.entries();let e=t.next();for(;!e.done;){const[n,{sub:o,passive:r}]=e.value;o.unsubscribe(),this.setupDOMListener(n,r),e=t.next()}}putNonBubblingListener(t,e,n,o){const r=this.nonBubblingListeners.get(t);if(!r)return;const i=r.get(e);i&&i.destination.passive===o&&i.destination.useCapture===n&&(this.virtualNonBubblingListener[0]=i.destination)}onEvent(t,e,n,o=!0){const r=this.patchEvent(e),i=this.isolateModule.getRootElement(e.target);if(o){const o=this.isolateModule.getNamespace(e.target);if(!o)return;const s=this.getVirtualListeners(t,o);this.bubble(t,e.target,i,r,s,o,o.length-1,!0,n),this.bubble(t,e.target,i,r,s,o,o.length-1,!1,n)}else this.putNonBubblingListener(t,e.target,!0,n),this.doBubbleStep(t,e.target,i,r,this.virtualNonBubblingListener,!0,n),this.putNonBubblingListener(t,e.target,!1,n),this.doBubbleStep(t,e.target,i,r,this.virtualNonBubblingListener,!1,n),e.stopPropagation()}bubble(t,e,n,o,r,i,s,a,c){a||o.propagationHasBeenStopped||this.doBubbleStep(t,e,n,o,r,a,c);let l=n,u=s;if(e===n){if(!(s>=0&&"sibling"===i[s].type))return;l=this.isolateModule.getElement(i,s),u--}e.parentNode&&l&&this.bubble(t,e.parentNode,l,o,r,i,u,a,c),a&&!o.propagationHasBeenStopped&&this.doBubbleStep(t,e,n,o,r,a,c)}doBubbleStep(t,e,n,o,r,i,s){n&&(this.mutateEventCurrentTarget(o,e),r.forEach((t=>{if(t.passive===s&&t.useCapture===i){const r=Sn(t.scopeChecker.namespace);!o.propagationHasBeenStopped&&t.scopeChecker.isDirectlyInScope(e)&&(""!==r&&e.matches(r)||""===r&&e===n)&&(_n(o,t.preventDefault),t.subject.shamefullySendNext(o))}})))}patchEvent(t){const e=t;e.propagationHasBeenStopped=!1;const n=e.stopPropagation;return e.stopPropagation=function(){n.call(this),this.propagationHasBeenStopped=!0},e}mutateEventCurrentTarget(t,e){try{Object.defineProperty(t,"currentTarget",{value:e,configurable:!0})}catch(t){}t.ownerTarget=e}}function Kn(t){return ce.merge(t,ce.never())}function Qn(t){return t.elm}function to(t){(console.error||console.log)(t)}function eo(t,e={}){wn(t);const n=e.modules||Yn;!function(t){if(!Array.isArray(t))throw new Error("Optional modules option must be an array for snabbdom modules")}(n);const o=new qn,r=e&&e.snabbdomOptions||void 0,i=tn([o.createModule()].concat(n),void 0,r),s=ce.create({start(t){"loading"===document.readyState?document.addEventListener("readystatechange",(()=>{const e=document.readyState;"interactive"!==e&&"complete"!==e||(t.next(null),t.complete())})):(t.next(null),t.complete())},stop(){}});let a,c;const l=ce.create({start(t){c=new MutationObserver((()=>t.next(null)))},stop(){c.disconnect()}});return function(n,r="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);const u=ce.create(),d=s.map((()=>{const e=function(t){const 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 a=new Pn(e),e})),p=n.remember();p.addListener({}),l.addListener({});const h=d.map((t=>ce.merge(p.endWhen(u),u).map((t=>a.call(t))).startWith(function(t){return t.data=t.data||{},t.data.isolate=[],t}(en(t))).fold(i,en(t)).drop(1).map(Qn).startWith(t).map((t=>(c.observe(t,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),t))).compose(Kn))).flatten(),f=Pe(s,l).endWhen(u).compose(In(h)).map((t=>t[1])).remember();f.addListener({error:e.reportSnabbdomError||to});const m=new Xn(f,o);return new Cn(f,u,[],o,m,r)}}const no="___";class oo{constructor(t){this._mockConfig=t,t.elements?this._elements=t.elements:this._elements=ue(ce.empty())}elements(){const t=this._elements;return t._isCycleSource="MockedDOM",t}element(){const t=ue(this.elements().filter((t=>t.length>0)).map((t=>t[0])).remember());return t._isCycleSource="MockedDOM",t}events(t,e,n){const o=ue(this._mockConfig[t]||ce.empty());return o._isCycleSource="MockedDOM",o}select(t){const e=this._mockConfig[t]||{};return new oo(e)}isolateSource(t,e){return t.select("."+no+e)}isolateSink(t,e){return ue(ce.fromObservable(t).map((t=>(t.sel&&-1!==t.sel.indexOf(no+e)||(t.sel+=`.${no}${e}`),t))))}}function ro(t){return new oo(t)}let io=0;function so(t,e,n={}){if("function"!=typeof t)throw new Error("collection: first argument (component) must be a function");const{combineList:o=["DOM"],globalList:r=["EVENTS"],stateSourceName:i="STATE",domSourceName:s="DOM",container:a="div",containerClass:c}=n;return n=>{const l="sygnal-collection-"+io++,u={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])=>{if(o.includes(n)){const o=t.pickCombine(n);n===s&&a?e[s]=o.map((t=>({sel:a,data:c?{props:{className:c}}:{},children:t,key:l,text:void 0,elm:void 0}))):e[n]=o}else e[n]=t.pickMerge(n);return e}),{})},d={[i]:e};return r.forEach((t=>d[t]=null)),o.forEach((t=>d[t]=null)),function(t,e,n){return he(function(t){return function(e){const n=t.channel||"state",o=t.itemKey,r=t.itemScope||ke,i=ce.fromObservable(e[n].stream).fold(((i,s)=>{const a=i.dict;if(Array.isArray(s)){const i=Array(s.length),c=new Set;for(let l=0,u=s.length;l<u;++l){const u=`${o?o(s[l],l):l}`;if(c.add(u),a.has(u))i[l]=a.get(u);else{const c=o?Le(o,u):`${l}`,d=r(u),p="string"==typeof d?{"*":d,[n]:c}:{...d,[n]:c},h=he(t.itemFactory?t.itemFactory(s[l],l):t.item,p)(e);a.set(u,h),i[l]=h}i[l]._key=u}return a.forEach(((t,e)=>{c.has(e)||(t&&"function"==typeof t.__dispose&&t.__dispose(),a.delete(e))})),c.clear(),{dict:a,arr:i}}{a.forEach((t=>{t&&"function"==typeof t.__dispose&&t.__dispose()})),a.clear();const i=`${o?o(s,0):"this"}`,c=De,l=r(i),u="string"==typeof l?{"*":l,[n]:c}:{...l,[n]:c},d=he(t.itemFactory?t.itemFactory(s,0):t.item,u)(e);return a.set(i,d),{dict:a,arr:[d]}}}),{dict:new Map,arr:[]});return t.collectSinks(new xe(i))}}(t),e)(n)}(u,d,n)}}const ao=t=>{const{children:e,...n}=t;return He("collection",{props:n},e)};function co(t){return t&&t.default&&t.default.default&&"function"==typeof t.default.default?t.default.default:t&&t.default?t.default:t}ao.label="collection",ao.preventInstantiation=!0;const lo=function(t){const e=co(t);return e&&e.default&&"function"==typeof e.default.create?e.default:e}(le),uo=re||ce&&ce.Stream||lo&&lo.Stream,po=co(be);function ho(t,e,n,o={}){const{switched:r=["DOM"],stateSourceName:i="STATE"}=o,s=typeof e;if(!e)throw new Error("Missing 'name$' parameter for switchable()");if(!("string"===s||"function"===s||e instanceof uo))throw new Error("Invalid 'name$' parameter for switchable(): expects Stream, String, or Function");if(e instanceof uo){const o=e.compose(po()).startWith(n).remember();return e=>fo(t,e,o,r)}{const o="function"===s&&e||(t=>t[e]);return e=>{const s=e&&("string"==typeof i&&e[i]||e.STATE||e.state).stream;if(!(s instanceof uo))throw new Error(`Could not find the state source: ${i}`);const a=s.map(o).filter((t=>"string"==typeof t)).compose(po()).startWith(n).remember();return fo(t,e,a,r,i)}}}function fo(t,e,n,o=["DOM"],r="STATE"){"string"==typeof o&&(o=[o]);const i=Object.entries(t).map((([t,o])=>{if(e[r]){const i=e[r].stream,s=lo.combine(n,i).filter((([e])=>e==t)).map((([,t])=>t)).remember(),a=new e[r].constructor(s,e[r]._name);return[t,o({...e,state:a})]}return[t,o(e)]}));return Object.keys(e).reduce(((t,e)=>{if(o.includes(e))t[e]=n.map((t=>{const n=i.find((([e])=>e===t));return n&&n[1][e]||lo.never()})).flatten().remember().startWith(void 0);else{const n=i.filter((([,t])=>void 0!==t[e])).map((([,t])=>t[e]));t[e]=lo.merge(...n)}return t}),{})}const mo=t=>{const{children:e,...n}=t;return He("switchable",{props:n},e)};function yo(t){return{select:e=>t._stream.filter((t=>t.type===e)).map((t=>t.data))}}mo.label="switchable",mo.preventInstantiation=!0;var _o={};Object.defineProperty(_o,"__esModule",{value:!0});var vo=r,go=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 bo=_o.default=function(t){return function(e){return new vo.Stream(new go(t,e))}},wo=e({__proto__:null,default:bo},[_o]),So={};Object.defineProperty(So,"__esModule",{value:!0});var Eo=r,Ao=function(){function t(t,e){this.dt=t,this.ins=e,this.type="debounce",this.out=null,this.id=null,this.t=Eo.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=Eo.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!=Eo.NO&&t._n(this.t),this.t=Eo.NO,t._c())},t}();var Oo=So.default=function(t){return function(e){return new Eo.Stream(new Ao(t,e))}},No=e({__proto__:null,default:Oo},[So]);const Co=co(wo),To=co(Re),$o=co(No),xo=co(be),ko="undefined"!=typeof window&&window||"undefined"!=typeof process&&process.env||{},Lo="BOOTSTRAP",Do="INITIALIZE",jo="DISPOSE",Io="PARENT",Mo="READY",Po="EFFECT";let Ro=0;const Fo=Symbol.for("sygnal.ABORT");function Go(t){return t===Fo||"symbol"==typeof t&&"sygnal.ABORT"===t.description}function Bo(t,e){if("function"==typeof e)return{fn:e,deps:null};if(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&"function"==typeof e[1])return{fn:e[1],deps:e[0]};throw new Error(`Invalid calculated field '${t}': expected a function or [depsArray, function]`)}function Uo(t){const{name:e,sources:n,isolateOpts:o,stateSourceName:r="STATE"}=t;if(n&&!ir(n))throw new Error(`[${e}] Sources must be a Cycle.js sources object`);let i;i="string"==typeof o?{[r]:o}:!0===o?{}:o;const s=void 0===n;let a;if(ir(i)){const e=e=>{const n={...t,sources:e},o=new Vo(n);return o.sinks.__dispose=()=>o.dispose(),o.sinks};a=s?he(e,i):he(e,i)(n)}else if(s)a=e=>{const n=new Vo({...t,sources:e});return n.sinks.__dispose=()=>n.dispose(),n.sinks};else{const e=new Vo(t);e.sinks.__dispose=()=>e.dispose(),a=e.sinks}return a.componentName=e,a.isSygnalComponent=!0,a}class Vo{constructor({name:t="NO NAME",sources:e,intent:n,model:o,hmrActions:r,context:i,response:s,view:a,peers:c={},components:l={},initialState:u,calculated:d,storeCalculatedInState:p=!0,DOMSourceName:h="DOM",stateSourceName:f="STATE",requestSourceName:m="HTTP",isolatedState:y=!1,onError:_,debug:v=!1}){if(!e||!ir(e))throw new Error(`[${t}] Missing or invalid sources`);if(this._componentNumber=Ro++,this.name=t,this.sources=e,this.intent=n,this.model=o,this.hmrActions=r,this.context=i,this.response=s,this.view=a,this.peers=c,this.components=l,this.initialState=u,this.calculated=d,this.storeCalculatedInState=p,this.DOMSourceName=h,this.stateSourceName=f,this.requestSourceName=m,this.sourceNames=Object.keys(e),this.onError=_,this.isolatedState=y,this._debug=v,this.calculated&&this.initialState&&ir(this.calculated)&&ir(this.initialState))for(const e of Object.keys(this.calculated))e in this.initialState&&console.warn(`[${t}] Calculated field '${e}' shadows a key in initialState. The initialState value will be overwritten on every state update.`);if(this.calculated&&ir(this.calculated)){const e=Object.entries(this.calculated);this._calculatedNormalized={};for(const[t,n]of e)this._calculatedNormalized[t]=Bo(t,n);this._calculatedFieldNames=new Set(Object.keys(this._calculatedNormalized));for(const[e,{deps:n}]of Object.entries(this._calculatedNormalized))if(null!==n)for(const o of n)this._calculatedFieldNames.has(o)||!this.initialState||o in this.initialState||console.warn(`[${t}] Calculated field '${e}' declares dependency '${o}' which is not in initialState or calculated fields`);const n={};for(const[t,{deps:e}]of Object.entries(this._calculatedNormalized))n[t]=null===e?[]:e.filter((t=>this._calculatedFieldNames.has(t)));const o={},r={};for(const t of this._calculatedFieldNames)o[t]=0,r[t]=[];for(const[t,e]of Object.entries(n)){o[t]=e.length;for(const n of e)r[n].push(t)}const i=[];for(const[t,e]of Object.entries(o))0===e&&i.push(t);const s=[];for(;i.length>0;){const t=i.shift();s.push(t);for(const e of r[t])o[e]--,0===o[e]&&i.push(e)}if(s.length!==this._calculatedFieldNames.size){const t=[...this._calculatedFieldNames].filter((t=>!s.includes(t))),e=new Set,o=[],r=i=>{if(e.has(i))return o.push(i),!0;e.add(i),o.push(i);for(const e of n[i])if(t.includes(e)&&r(e))return!0;return o.pop(),e.delete(i),!1};r(t[0]);const i=o[o.length-1],a=o.slice(o.indexOf(i));throw new Error(`Circular calculated dependency: ${a.join(" → ")}`)}this._calculatedOrder=s.map((t=>[t,this._calculatedNormalized[t]])),this._calculatedFieldCache={};for(const[t,{deps:e}]of this._calculatedOrder)null!==e&&(this._calculatedFieldCache[t]={lastDepValues:void 0,lastResult:void 0})}else this._calculatedOrder=null,this._calculatedNormalized=null,this._calculatedFieldNames=null,this._calculatedFieldCache=null;this.isSubComponent=this.sourceNames.includes("props$");const g=e[f]&&e[f].stream;this.currentSlots={},g&&(this.currentState=u||{},this.sources[f]=new Oe(g.map((t=>(this.currentState=t,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onStateChanged(this._componentNumber,this.name,t),t))),f));const b=e.props$;b&&(this.sources.props$=b.map((t=>{const{sygnalFactory:e,sygnalOptions:n,...o}=t;return this.currentProps=o,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onPropsChanged(this._componentNumber,this.name,o),t})));const w=e.children$;var S;if(w&&(this.sources.children$=w.map((t=>{if(Array.isArray(t)){const{slots:e,defaultChildren:n}=lr(t);this.currentSlots=e,this.currentChildren=n}else this.currentSlots={},this.currentChildren=t;return t}))),this.sources[h]&&(this.sources[h]=(S=this.sources[h],new Proxy(S,{get:(t,e,n)=>"symbol"==typeof e||e in t?Reflect.get(t,e,n):n=>t.select(n).events(e)}))),this.isSubComponent||void 0!==this.intent||void 0!==this.model||(this.initialState=u||!0,this.intent=t=>({__NOOP_ACTION__:lo.never()}),this.model={__NOOP_ACTION__:t=>t}),this._subscriptions=[],this._activeSubComponents=new Map,this._childReadyState={},this._readyChangedListener=null,this._readyChanged$=lo.create({start:t=>{this._readyChangedListener=t},stop:()=>{}}),this._disposeListener=null,this._dispose$=lo.create({start:t=>{this._disposeListener=t},stop:()=>{}}),this.sources.dispose$=this._dispose$,this.addCalculated=this.createMemoizedAddCalculated(),this.log=function(t){return function(e,n=!1){const o="function"==typeof e?e:t=>e;if(!n)return e=>e.debug((e=>{if(this.debug){const n=`[${t}] ${o(e)}`;console.log(n),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onDebugLog(this._componentNumber,n)}}));if(this.debug){const n=`[${t}] ${o(e)}`;console.log(n),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onDebugLog(this._componentNumber,n)}}}(`${this._componentNumber} | ${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._componentNumber,this.log("Instantiated",!0),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__){window.__SYGNAL_DEVTOOLS__.onComponentCreated(this._componentNumber,t,this);const n=e?.__parentComponentNumber;"number"==typeof n&&window.__SYGNAL_DEVTOOLS__.onSubComponentRegistered(n,this._componentNumber)}}dispose(){"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onComponentDisposed(this._componentNumber,this.name);if(this.model&&(this.model[jo]||Object.keys(this.model).some((t=>t.includes("|")&&t.split("|")[0].trim()===jo)))&&this.action$&&"function"==typeof this.action$.shamefullySendNext)try{this.action$.shamefullySendNext({type:jo})}catch(t){}if(this._disposeListener){try{this._disposeListener.next(!0),this._disposeListener.complete()}catch(t){}this._disposeListener=null}setTimeout((()=>{if(this.action$&&"function"==typeof this.action$.shamefullySendComplete)try{this.action$.shamefullySendComplete()}catch(t){}if(this.vdom$&&"function"==typeof this.vdom$.shamefullySendComplete)try{this.vdom$.shamefullySendComplete()}catch(t){}for(const t of this._subscriptions)if(t&&"function"==typeof t.unsubscribe)try{t.unsubscribe()}catch(t){}this._subscriptions=[],this._activeSubComponents.forEach((t=>{t?.sink$?.__dispose&&t.sink$.__dispose()})),this._activeSubComponents.clear()}),0)}get debug(){return this._debug||"true"===ko.SYGNAL_DEBUG||!0===ko.SYGNAL_DEBUG}initIntent$(){if(this.intent){if("function"!=typeof this.intent)throw new Error(`[${this.name}] Intent must be a function`);if(this.intent$=this.intent(this.sources),!(this.intent$ instanceof uo||ir(this.intent$)))throw new Error(`[${this.name}] 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$=lo.fromArray(this.hmrActions.map((t=>({type:t}))))}else this.hmrAction$=lo.of().filter((t=>!1))}initAction$(){const t=this.sources&&this.sources[this.requestSourceName]||null;if(!this.intent$)return void(this.action$=lo.never());let e;if(this.intent$ instanceof uo)e=this.intent$;else{for(const t of Object.keys(this.intent$))if(t.includes("|"))throw new Error(`[${this.name}] Intent action name '${t}' contains '|', which is reserved for the model shorthand syntax (e.g., 'ACTION | DRIVER'). Rename this action.`);const t=Object.entries(this.intent$).map((([t,e])=>e.map((e=>({type:t,data:e})))));e=lo.merge(lo.never(),...t)}const n=e instanceof uo?e:e.apply&&e(this.sources)||lo.never(),o=lo.of({type:Lo}).compose(Co(10)),r="undefined"!=typeof window&&!0===window.__SYGNAL_HMR_UPDATING,i=r?this.hmrAction$:lo.of().filter((t=>!1)),s=this.model[Lo]&&!r?To(o,n):To(lo.of().compose(Co(1)).filter((t=>!1)),i,n);let a;a=!r&&t&&"function"==typeof t.select?t.select("initial").flatten():lo.never();const c=a.map((t=>({type:"HYDRATE",data:t})));this.action$=lo.merge(s,c).compose(this.log((({type:t})=>`<${t}> Action triggered`))).map((t=>("undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onActionDispatched(this._componentNumber,this.name,t.type,t.data),t)))}initState(){void 0!==this.model&&(void 0===this.model[Do]?this.model[Do]={[this.stateSourceName]:(t,e)=>({...this.addCalculated(e)})}:ir(this.model[Do])&&Object.keys(this.model[Do]).forEach((t=>{t!==this.stateSourceName&&(console.warn(`${Do} can only be used with the ${this.stateSourceName} source... disregarding ${t}`),delete this.model[Do][t])})))}initContext(){if(!this.context&&!this.sources.__parentContext$)return void(this.context$=lo.of({}));const t=this.sources[this.stateSourceName]?.stream.startWith({}).compose(xo(or))||lo.never(),e=this.sources.__parentContext$?.startWith({}).compose(xo(or))||lo.of({});this.context&&!ir(this.context)&&console.error(`[${this.name}] Context must be an object mapping names to values of functions: ignoring provided ${typeof this.context}`),this.context$=lo.combine(t,e).map((([t,e])=>{const n=ir(e)?e:{},o=ir(this.context)?this.context:{},r=this.currentState,i={...n,...Object.entries(o).reduce(((t,e)=>{const[n,o]=e;let i;const s=typeof o;if("string"===s)i=r[o];else if("boolean"===s)i=r[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=o(r)}return t[n]=i,t}),{})};return this.currentContext=i,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onContextChanged(this._componentNumber,this.name,i),i})).compose(xo(or)).startWith({}),this._subscriptions.push(this.context$.subscribe({next:t=>t,error:t=>console.error(`[${this.name}] Error in context stream:`,t)}))}initModel$(){if(void 0===this.model)return void(this.model$=this.sourceNames.reduce(((t,e)=>(t[e]=lo.never(),t)),{}));const t=ko?.__SYGNAL_HMR_STATE,e=void 0!==t?t:this.initialState,n={type:Do,data:e};this.isSubComponent&&this.initialState&&!this.isolatedState&&console.warn(`[${this.name}] Initial state provided to sub-component. This will overwrite any state provided by the parent component.`);const o=void 0!==e&&(!0!==ko?.__SYGNAL_HMR_UPDATING||void 0!==t)?To(lo.of(n),this.action$).compose(Co(0)):this.action$,r=()=>this.makeOnAction(o,!0,this.action$),i=()=>this.makeOnAction(this.action$,!1,this.action$),s=Object.entries(this.model),a={},c=new Set;s.forEach((t=>{let[e,n]=t;if(e.includes("|")){const t=e.split("|").map((t=>t.trim()));if(2!==t.length||!t[0]||!t[1])throw new Error(`[${this.name}] Invalid shorthand model entry '${e}'. Expected 'ACTION | DRIVER' format.`);e=t[0],n={[t[1]]:n}}if("function"==typeof n&&(n={[this.stateSourceName]:n}),!ir(n))throw new Error(`[${this.name}] Entry for each action must be an object: ${e}`);Object.entries(n).forEach((t=>{const[n,o]=t,s=`${e}::${n}`;if(c.has(s)&&console.warn(`[${this.name}] Duplicate model entry for action '${e}' on sink '${n}'. Only the last definition will take effect.`),c.add(s),n===Po){const t=this.makeEffectHandler(this.action$,e,o);return void(Array.isArray(a[n])?a[n].push(t):a[n]=[t])}const l=n===this.stateSourceName,u=n===Io,d=l?r():i(),p=(u?d(e,o).map((t=>({name:this.name,component:this.view,value:t}))):d(e,o)).compose(this.log((t=>{if(l)return`<${e}> State reducer added`;if(u)return`<${e}> Data sent to parent component: ${JSON.stringify(t.value).replaceAll('"',"")}`;{const o=t&&(t.type||t.command||t.name||t.key||Array.isArray(t)&&"Array"||t);return`<${e}> Data sent to [${n}]: ${JSON.stringify(o).replaceAll('"',"")}`}})));Array.isArray(a[n])?a[n].push(p):a[n]=[p]}))}));const l=Object.entries(a).reduce(((t,e)=>{const[n,o]=e;return t[n]=lo.merge(lo.never(),...o),t}),{});this.model$=l}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 o=n(this.sources);return this.sourceNames.forEach((n=>{n==this.DOMSourceName?t[n][e]=o[n]:t[n].push(o[n])})),t}),t)}initChildSources$(){let t;const e=lo.create({start:e=>{t=e.next.bind(e)},stop:t=>{}}).map((t=>lo.merge(...t))).flatten();this.sources.CHILD={select:t=>{const n=e;return("function"==typeof t?n.filter((e=>e.component===t)):t?n.filter((e=>e.name===t)):n).map((t=>t.value))}},this.newChildSources=e=>{"function"==typeof t&&t(e)}}initSubComponentSink$(){const t=lo.create({start:t=>{this.newSubComponentSinks=t.next.bind(t)},stop:t=>{}});this._subscriptions.push(t.subscribe({next:t=>t,error:t=>console.error(`[${this.name}] Error in sub-component sink stream:`,t)})),this.subComponentSink$=t.filter((t=>Object.keys(t).length>0))}initSubComponentsRendered$(){const t=lo.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$=lo.of(null));const t=this.collectRenderParameters();this.vdom$=t.map((t=>{const{props:e,state:n,children:o,slots:r,context:i,...s}=t,{sygnalFactory:a,sygnalOptions:c,...l}=e||{};try{return this.view({...l,state:n,children:o,slots:r||{},context:i,peers:s},n,i,s)}catch(t){const e=t instanceof Error?t:new Error(String(t));if(console.error(`[${this.name}] Error in view:`,e),"function"==typeof this.onError)try{return this.onError(e,{componentName:this.name})}catch(t){console.error(`[${this.name}] Error in onError handler:`,t)}return{sel:"div",data:{attrs:{"data-sygnal-error":this.name}},children:[]}}})).compose(this.log("View rendered")).map((t=>t||{sel:"div",data:{},children:[]})).map((t=>Qo(t,this))).map(Zo).map(Xo).map(Ko).compose(this.instantiateSubComponents.bind(this)).filter((t=>void 0!==t)).compose(this.renderVdom.bind(this))}initSinks(){if(this.sinks=this.sourceNames.reduce(((t,e)=>{if(e==this.DOMSourceName)return t;const n=this.subComponentSink$&&e!==Io?this.subComponentSink$.map((t=>t[e])).filter((t=>!!t)).flatten():lo.never();if(e===this.stateSourceName?t[e]=lo.merge(this.model$[e]||lo.never(),n,this.sources[this.stateSourceName].stream.filter((t=>!1)),...this.peers$[e]||[]):t[e]=lo.merge(this.model$[e]||lo.never(),n,...this.peers$[e]||[]),"EVENTS"===e&&t[e]){const n=this._componentNumber,o=this.name;t[e]=t[e].map((t=>({...t,__emitterId:n,__emitterName:o})))}return t}),{}),this.sinks[this.DOMSourceName]=this.vdom$,this.sinks[Io]=this.model$[Io]||lo.never(),this.model$[Po]){const t=this.model$[Po].subscribe({next:()=>{},error:t=>console.error(`[${this.name}] Uncaught error in EFFECT stream:`,t)});this._subscriptions.push(t),delete this.sinks[Po]}this.model&&ir(this.model)&&Object.values(this.model).some((t=>!(!ir(t)||!(Mo in t))))?(this.sinks[Mo]=this.model$[Mo],this.sinks[Mo].__explicitReady=!0):this.sinks[Mo]=lo.of(!0)}makeOnAction(t,e=!0,n){return n=n||t,(o,r)=>{const i=t.filter((({type:t})=>t==o));let s;if("function"==typeof r)s=i.map((t=>{const i=(t,e,r=10)=>{if("number"!=typeof r)throw new Error(`[${this.name}] Invalid delay value provided to next() function in model action '${o}'. Must be a number in ms.`);setTimeout((()=>{n.shamefullySendNext({type:t,data:e})}),r),this.log(`<${o}> Triggered a next() action: <${t}> ${r}ms delay`,!0)},s={...this.currentProps,children:this.currentChildren,slots:this.currentSlots||{},context:this.currentContext};let a=t.data;if(e)return t=>{const e=this.isSubComponent?this.currentState:t;try{const t=this.addCalculated(e);s.state=t;const n=r(t,a,i,s);return Go(n)?e:this.cleanupCalculated(n)}catch(t){return console.error(`[${this.name}] Error in model reducer '${o}':`,t),e}};try{const t=this.addCalculated(this.currentState);s.state=t;const e=r(t,a,i,s),n=typeof e;if(ir(e)||["string","number","boolean","function"].includes(n))return e;if("undefined"===n)return console.warn(`[${this.name}] 'undefined' value sent to ${o}`),e;throw new Error(`[${this.name}] Invalid reducer type for action '${o}': ${n}`)}catch(t){return console.error(`[${this.name}] Error in model reducer '${o}':`,t),Fo}})).filter((t=>!Go(t)));else if(void 0===r||!0===r)s=i.map((({data:t})=>t));else{const t=r;s=i.mapTo(t)}return s}}makeEffectHandler(t,e,n){return t.filter((({type:t})=>t==e)).map((o=>{if("function"==typeof n){const r=(n,o,r=10)=>{if("number"!=typeof r)throw new Error(`[${this.name}] Invalid delay value provided to next() function in EFFECT handler '${e}'. Must be a number in ms.`);setTimeout((()=>{t.shamefullySendNext({type:n,data:o})}),r),this.log(`<${e}> EFFECT triggered a next() action: <${n}> ${r}ms delay`,!0)};try{const t=this.addCalculated(this.currentState),i={...this.currentProps,children:this.currentChildren,slots:this.currentSlots||{},context:this.currentContext,state:t};void 0!==n(t,o.data,r,i)&&console.warn(`[${this.name}] EFFECT handler '${e}' returned a value. EFFECT handlers are for side effects only — return values are ignored.`)}catch(t){console.error(`[${this.name}] Error in EFFECT handler '${e}':`,t)}}return null})).filter((t=>!1))}createMemoizedAddCalculated(){let t,e;return function(n){if(!this.calculated||!ir(n)||Array.isArray(n))return n;if(n===t)return e;if(!ir(this.calculated))throw new Error(`[${this.name}] 'calculated' parameter must be an object mapping calculated state field names to functions`);const o=this.getCalculatedValues(n);if(!o)return t=n,e=n,n;const r={...n,...o};return t=n,e=r,r}}getCalculatedValues(t){if(!this._calculatedOrder||0===this._calculatedOrder.length)return;const e={...t},n={};for(const[t,{fn:o,deps:r}]of this._calculatedOrder)if(null!==r&&this._calculatedFieldCache){const i=this._calculatedFieldCache[t],s=r.map((t=>e[t]));if(void 0!==i.lastDepValues){let o=!0;for(let t=0;t<s.length;t++)if(s[t]!==i.lastDepValues[t]){o=!1;break}if(o){n[t]=i.lastResult,e[t]=i.lastResult;continue}}try{const r=o(e);i.lastDepValues=s,i.lastResult=r,n[t]=r,e[t]=r}catch(e){console.warn(`Calculated field '${t}' threw an error during calculation: ${e instanceof Error?e.message:e}`)}}else try{const r=o(e);n[t]=r,e[t]=r}catch(e){console.warn(`Calculated field '${t}' threw an error during calculation: ${e instanceof Error?e.message:e}`)}return n}cleanupCalculated(t){if(!t||!ir(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)}),o=n&&n.stream||lo.never();if(e.state=o.compose(xo(or)),this.sources.props$&&(e.props=this.sources.props$.compose(xo(nr))),this.sources.children$){const t=this.sources.children$.map((t=>{if(!Array.isArray(t))return{children:t,slots:{}};const{slots:e,defaultChildren:n}=lr(t);return{children:n,slots:e}}));e.children=t.map((t=>t.children)).compose(xo(or)),e.slots=t.map((t=>t.slots)).compose(xo(or))}this.context$&&(e.context=this.context$.compose(xo(or)));const r=[],i=[];Object.entries(e).forEach((([t,e])=>{r.push(t),i.push(e)}));return lo.combine(...i).compose($o(1)).map((t=>r.reduce(((e,n,o)=>(e[n]=t[o],"state"===n&&(e[this.stateSourceName]=t[o],e.calculated=t[o]&&this.getCalculatedValues(t[o])||{}),e)),{})))}instantiateSubComponents(t){return t.fold(((t,e)=>{const n=Ho(e,Object.keys(this.components)),o=Object.entries(n),r={"::ROOT::":e};if(0===o.length)return this._activeSubComponents.forEach((t=>{t?.sink$?.__dispose&&t.sink$.__dispose()})),this._activeSubComponents.clear(),r;const i={},s=[];let a=0;const c=o.reduce(((e,[n,o])=>{const r=o.data,c=r.props||{},l=o.children||[],u=r.isCollection||!1,d=r.isSwitchable||!1,p=t=>{Object.entries(t).forEach((([t,e])=>{i[t]||(i[t]=[]),t===Io?s.push(e):t!==this.DOMSourceName&&t!==Mo&&i[t].push(e)}))};if(t[n]){const o=t[n];return e[n]=o,o.props$.shamefullySendNext(c),o.children$.shamefullySendNext(l),p(o.sink$),e}const h=lo.create().startWith(c),f=lo.create().startWith(l);let m,y;m=u?this.instantiateCollection.bind(this):d?this.instantiateSwitchable.bind(this):this.instantiateCustomComponent.bind(this),a++;try{y=m(o,h,f)}catch(t){const e=t instanceof Error?t:new Error(String(t));console.error(`[${this.name}] Error instantiating sub-component:`,e);let n={sel:"div",data:{attrs:{"data-sygnal-error":this.name}},children:[]};if("function"==typeof this.onError)try{n=this.onError(e,{componentName:this.name})||n}catch(t){console.error(`[${this.name}] Error in onError handler:`,t)}y={[this.DOMSourceName]:lo.of(n)}}return y[this.DOMSourceName]=y[this.DOMSourceName]?this.makeCoordinatedSubComponentDomSink(y[this.DOMSourceName]):lo.never(),e[n]={sink$:y,props$:h,children$:f},this._activeSubComponents.set(n,e[n]),p(y),e}),r),l=Object.entries(i).reduce(((t,[e,n])=>(0===n.length||(t[e]=1===n.length?n[0]:lo.merge(...n)),t)),{}),u=new Set(Object.keys(c));return this._activeSubComponents.forEach(((t,e)=>{u.has(e)||(t?.sink$?.__dispose&&t.sink$.__dispose(),this._activeSubComponents.delete(e),delete this._childReadyState[e])})),this.newSubComponentSinks(l),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(xo(or)).map((t=>e)).flatten().debug((t=>this.triggerSubComponentsRendered())).remember()}instantiateCollection(t,e,n){const o=t.data.props||{};const r={filter:"function"==typeof o.filter?o.filter:void 0,sort:cr(o.sort)},i=lo.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState),e.startWith(o)).compose($o(1)).map((([t,e])=>(e.filter!==r.filter&&(r.filter="function"==typeof e.filter?e.filter:void 0),e.sort!==r.sort&&(r.sort=cr(e.sort)),ir(t)?this.addCalculated(t):t))),s=new Oe(i,this.stateSourceName),a=o.from,c=o.of,l=o.idfield||"id";let u,d;if("function"==typeof c)if(c.isSygnalComponent)d=c;else{const t=c.componentName||c.label||c.name||"FUNCTION_COMPONENT",e=c,{model:n,intent:o,hmrActions:r,context:i,peers:s,components:a,initialState:l,calculated:u,storeCalculatedInState:p,DOMSourceName:h,stateSourceName:f,onError:m,debug:y}=c;d=Uo({name:t,view:e,model:n,intent:o,hmrActions:r,context:i,peers:s,components:a,initialState:l,calculated:u,storeCalculatedInState:p,DOMSourceName:h,stateSourceName:f,onError:m,debug:y})}else{if(!this.components[c])throw new Error(`[${this.name}] Invalid 'of' property in collection: ${c}`);d=this.components[c]}const p={get:t=>{if(!Array.isArray(t[a]))return[];const e=t[a],n="function"==typeof r.filter?e.filter(r.filter):e;return("function"==typeof r.sort?n.sort(r.sort):n).map(((t,e)=>ir(t)?{...t,[l]:t[l]||e}:{value:t,[l]: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 o of t[a].map(((t,e)=>ir(t)?{...t,[l]:t[l]||e}:{__primitive:!0,value:t,[l]:e})))if("function"!=typeof r.filter||r.filter(o)){const t=e.find((t=>t[l]===o[l]));void 0!==t&&n.push(o.__primitive?t.value:t)}else n.push(o.__primitive?o.value:o);return{...t,[a]:n}}};void 0===a?u={get:t=>!(t instanceof Array)&&t.value&&t.value instanceof Array?t.value:t,set:(t,e)=>e}:"string"==typeof a?ir(this.currentState)?this.currentState&&a in this.currentState||this.calculated&&a in this.calculated?(Array.isArray(this.currentState[a])||console.warn(`[${this.name}] State property '${a}' in collection component is not an array: No components will be instantiated in the collection.`),u=p):(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.`),u=void 0):(Array.isArray(this.currentState[a])||console.warn(`[${this.name}] State property '${a}' in collection component is not an array: No components will be instantiated in the collection.`),u=p):ir(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.`),u=void 0):u={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.`),u=void 0);const h=["of","from","filter","sort","idfield","className"],f=e.map((t=>{if(!t||"object"!=typeof t)return{};const e={};for(const n in t)h.includes(n)||(e[n]=t[n]);return e})),m={...this.sources,[this.stateSourceName]:s,props$:f,children$:n,__parentContext$:this.context$,PARENT:null,__parentComponentNumber:this._componentNumber},y=so(d,u,{container:null})(m);if(!ir(y))throw new Error(`[${this.name}] Invalid sinks returned from component factory of collection element`);if("undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected){const t="function"==typeof c?c.componentName||c.label||c.name||"anonymous":String(c);window.__SYGNAL_DEVTOOLS__.onCollectionMounted(this._componentNumber,this.name,t,"string"==typeof a?a:null)}return y}instantiateSwitchable(t,e,n){const o=t.data.props||{},r=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>ir(t)?this.addCalculated(t):t)),i=new Oe(r,this.stateSourceName),s=o.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):!ir(e)||Array.isArray(e)?{...t,[s]:e}:{...t,[s]:e}}:ir(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 l=o.of;Object.keys(l).forEach((t=>{const e=l[t];if(!e.isSygnalComponent){const n=e.componentName||e.label||e.name||"FUNCTION_COMPONENT",o=e,{model:r,intent:i,hmrActions:s,context:a,peers:c,components:u,initialState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_}=e,v={name:n,view:o,model:r,intent:i,hmrActions:s,context:a,peers:c,components:u,initialState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_};l[t]=Uo(v)}}));const u={...this.sources,[this.stateSourceName]:i,props$:e,children$:n,__parentContext$:this.context$,__parentComponentNumber:this._componentNumber},d=he(ho(l,e.map((t=>t.current)),""),{[this.stateSourceName]:a})(u);if(!ir(d))throw new Error(`[${this.name}] Invalid sinks returned from component factory of switchable element`);return d}instantiateCustomComponent(t,e,n){const o=t.sel,r=t.data.props||{},i=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>ir(t)?this.addCalculated(t):t)),s=new Oe(i,this.stateSourceName),a=r.state;"function"!=typeof r.sygnalFactory&&ir(r.sygnalOptions)&&(r.sygnalFactory=Uo(r.sygnalOptions));const c="sygnal-factory"===o?r.sygnalFactory:this.components[o]||r.sygnalFactory;if(!c){if("sygnal-factory"===o)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: ${o}`)}const l=r.sygnalOptions?.initialState,u=r.sygnalOptions?.isolatedState;if(l&&!u){const t=r.sygnalOptions?.name||o;throw new Error(`[${t}] Sub-component has .initialState but no .isolatedState = true. This will overwrite parent state. If this is intentional, add .isolatedState = true to the component.`)}let d;const p=u?l:void 0,h={get:t=>{const e=t[a];return void 0===e&&p?p:e},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}},f={get:t=>t,set:(t,e)=>e};void 0===a?d=f:"string"==typeof a?d=h:ir(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.`),d=f):d={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.`),d=f);const m={...this.sources,[this.stateSourceName]:s,props$:e,children$:n,__parentContext$:this.context$,__parentComponentNumber:this._componentNumber};for(const t of Object.keys(r)){const e=r[t];if(e&&e.__sygnalCommand){e._targetComponentName=o,m.commands$=yo(e);break}}const y=he(c,{[this.stateSourceName]:d})(m);if(!ir(y)){throw new Error(`Invalid sinks returned from component factory: ${"sygnal-factory"===o?"custom element":o}`)}return y}renderVdom(t){return lo.combine(this.subComponentsRendered$,t,this._readyChanged$.startWith(null)).compose($o(1)).map((([t,e])=>{const n=Object.keys(this.components),o=e["::ROOT::"],r=Object.entries(e).filter((([t])=>"::ROOT::"!==t));if(0===r.length)return lo.of(qo(o));const i=[],s=r.map((([t,e])=>(i.push(t),e.sink$[this.DOMSourceName].startWith(void 0))));if(0===s.length)return lo.of(o);for(const[t,e]of r){if(void 0!==this._childReadyState[t])continue;const n=e.sink$[Mo];if(n){const e=n.__explicitReady;this._childReadyState[t]=!e,n.addListener({next:e=>{const n=this._childReadyState[t];this._childReadyState[t]=!!e,n!==!!e&&(this._readyChangedListener&&setTimeout((()=>{this._readyChangedListener?.next(null)}),0),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onReadyChanged(this._componentNumber,this.name,t,!!e))},error:()=>{},complete:()=>{}})}else this._childReadyState[t]=!0}return lo.combine(...s).compose($o(1)).map((t=>{const e=t.reduce(((t,e,n)=>(t[i[n]]=e,t)),{});return qo(Wo(er(o),e,n,"r",void 0,this._childReadyState))}))})).flatten().filter((t=>!!t)).remember()}}function Ho(t,e,n="r",o){var r;if(!t)return{};if(t.data?.componentsProcessed)return{};"r"===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||ir(t.data?.props?.sygnalOptions),l=t.data&&t.data.props||{};t.data&&t.data.attrs;const u=t.children||[];let d={},p=o;if(c){if(p=Yo(t,n,o),s){if(!l.of)throw new Error("Collection element missing required 'component' property");if("string"!=typeof l.of&&"function"!=typeof l.of)throw new Error(`Invalid 'component' property of collection element: found ${typeof l.of} requires string or component factory function`);if("function"!=typeof l.of&&!e.includes(l.of))throw new Error(`Specified component for collection not found: ${l.of}`);void 0===l.from||"string"==typeof l.from||Array.isArray(l.from)||"function"==typeof l.from.get||console.warn(`No valid array found for collection ${"string"==typeof l.of?l.of:"function component"}: no collection components will be created`,l.from),t.data.isCollection=!0,(r=t.data).props||(r.props={})}else if(a){if(!l.of)throw new Error("Switchable element missing required 'of' property");if(!ir(l.of))throw new Error(`Invalid 'of' property of switchable element: found ${typeof l.of} requires object mapping names to component factories`);if(!Object.values(l.of).every((t=>"function"==typeof t)))throw new Error("One or more components provided to switchable element is not a valid component factory");if(!l.current||"string"!=typeof l.current&&"function"!=typeof l.current)throw new Error(`Missing or invalid 'current' property for switchable element: found '${typeof l.current}' requires string or function`);if(!Object.keys(l.of).includes(l.current))throw new Error(`Component '${l.current}' not found in switchable element`);t.data.isSwitchable=!0}void 0===l.key&&(t.data.props.key=p),d[p]=t}return u.length>0&&u.map(((t,o)=>Ho(t,e,`${n}.${o}`,p))).forEach((t=>{Object.entries(t).forEach((([t,e])=>d[t]=e))})),d}function Wo(t,e,n,o="r",r,i){if(!t)return;if(t.data?.componentsInjected)return t;"r"===o&&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||ir(t.data?.props?.sygnalOptions),c=t?.data?.isCollection;t.data&&t.data.props;const l=t.children||[];let u=r;if(a){u=Yo(t,o,r);let n=e[u];return i&&u&&n&&"object"==typeof n&&n.sel&&(n.data=n.data||{},n.data.attrs=n.data.attrs||{},n.data.attrs["data-sygnal-ready"]=!1!==i[u]?"true":"false"),c?(t.sel="div",t.children=Array.isArray(n)?n:[n],t):n}return l.length>0?(t.children=l.map(((t,r)=>Wo(t,e,n,`${o}.${r}`,u,i))).flat(),t):t}function Yo(t,e,n){const o=t.sel,r="string"==typeof o?o:"functionComponent",i=t.data?.props||{};return`${n?`${n}|`:""}${r}::${i.id&&JSON.stringify(i.id).replaceAll('"',"")||e}`}function zo(t){if(!t||!t.sel)return!1;if("false"===t.data?.attrs?.["data-sygnal-ready"])return!0;if("loading"===t.data?.attrs?.["data-sygnal-lazy"])return!0;if("suspense"===t.sel)return!1;if(Array.isArray(t.children))for(const e of t.children)if(zo(e))return!0;return!1}function qo(t){if(!t||!t.sel)return t;if("suspense"===t.sel){const e=(t.data?.props||{}).fallback,n=t.children||[];return n.some(zo)&&e?"string"==typeof e?{sel:"div",data:{attrs:{"data-sygnal-suspense":"pending"}},children:[{text:e}],text:void 0,elm:void 0,key:void 0}:{sel:"div",data:{attrs:{"data-sygnal-suspense":"pending"}},children:[e],text:void 0,elm:void 0,key:void 0}:1===n.length?qo(n[0]):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:n.map((t=>qo(t))),text:void 0,elm:void 0,key:void 0}}return t.children&&t.children.length>0&&(t.children=t.children.map((t=>qo(t)))),t}const Jo=tn(Yn);function Zo(t){if(!t||!t.sel)return t;if("portal"===t.sel){const e=t.data?.props?.target;return function(t,e){const n=e||[];return{sel:"div",data:{style:{display:"none"},attrs:{"data-sygnal-portal":t},portalChildren:n,hook:{insert:e=>{const o=document.querySelector(t);if(!o)return void console.warn(`[Portal] Target "${t}" not found in DOM`);const r=document.createElement("div");o.appendChild(r),e.data._portalVnode=Jo(r,{sel:"div",data:{},children:n,text:void 0,elm:void 0,key:void 0}),e.data._portalContainer=o},postpatch:(t,e)=>{const n=t.data?._portalVnode,o=t.data?._portalContainer;if(!n||!o)return;const r=e.data?.portalChildren||[];e.data._portalVnode=Jo(n,{sel:"div",data:{},children:r,text:void 0,elm:void 0,key:void 0}),e.data._portalContainer=o},destroy:t=>{const e=t.data?._portalVnode;e&&e.elm&&e.elm.parentNode&&e.elm.parentNode.removeChild(e.elm)}}},children:[],text:void 0,elm:void 0,key:void 0}}(e,t.children||[])}return t.children&&t.children.length>0&&(t.children=t.children.map(Zo)),t}function Xo(t){if(!t||!t.sel)return t;if("transition"===t.sel){const e=t.data?.props||{},n=e.name||"v",o=e.duration,r=(t.children||[])[0];return r&&r.sel?function(t,e,n){const o=t.data?.hook?.insert,r=t.data?.hook?.remove;return t.data=t.data||{},t.data.hook=t.data.hook||{},t.data.hook.insert=t=>{o&&o(t);const r=t.elm;r&&r.classList&&(r.classList.add(`${e}-enter-from`,`${e}-enter-active`),requestAnimationFrame((()=>{requestAnimationFrame((()=>{r.classList.remove(`${e}-enter-from`),r.classList.add(`${e}-enter-to`),tr(r,n,(()=>{r.classList.remove(`${e}-enter-active`,`${e}-enter-to`)}))}))})))},t.data.hook.remove=(t,o)=>{r&&r(t,(()=>{}));const i=t.elm;i&&i.classList?(i.classList.add(`${e}-leave-from`,`${e}-leave-active`),requestAnimationFrame((()=>{requestAnimationFrame((()=>{i.classList.remove(`${e}-leave-from`),i.classList.add(`${e}-leave-to`),tr(i,n,(()=>{i.classList.remove(`${e}-leave-active`,`${e}-leave-to`),o()}))}))}))):o()},t}(Xo(r),n,o):r||t}return t.children&&t.children.length>0&&(t.children=t.children.map(Xo)),t}function Ko(t){if(!t||!t.sel)return t;if("clientonly"===t.sel){const e=t.children||[];return 0===e.length?{sel:"div",data:{},children:[]}:1===e.length?Ko(e[0]):{sel:"div",data:{},children:e.map(Ko),text:void 0,elm:void 0,key:void 0}}return t.children&&t.children.length>0&&(t.children=t.children.map(Ko)),t}function Qo(t,e){if(!t||!t.sel)return t;const n=t.data?.props?.sygnalOptions?.view;if(n&&n.__sygnalLazy)if(n.__sygnalLazyLoaded()){const e=n.__sygnalLazyLoadedComponent;if(e){const n=t.data?.props||{},o=e.componentName||e.label||e.name||"LazyLoaded",{model:r,intent:i,hmrActions:s,context:a,peers:c,components:l,initialState:u,isolatedState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_}=e,v={name:o,view:e,model:r,intent:i,hmrActions:s,context:a,peers:c,components:l,initialState:u,isolatedState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_},g={...n};return delete g.sygnalOptions,{sel:o,data:{props:{...g,sygnalOptions:v}},children:t.children||[],text:void 0,elm:void 0,key:void 0}}}else!n.__sygnalLazyReRenderScheduled&&n.__sygnalLazyPromise&&e&&(n.__sygnalLazyReRenderScheduled=!0,n.__sygnalLazyPromise.then((()=>{setTimeout((()=>{const t=e.sources?.[e.stateSourceName];if(t&&t.stream){const n={...e.currentState,__sygnalLazyTick:Date.now()};t.stream.shamefullySendNext(n)}}),0)})));return t.children&&t.children.length>0&&(t.children=t.children.map((t=>Qo(t,e)))),t}function tr(t,e,n){if("number"==typeof e)setTimeout(n,e);else{const e=()=>{t.removeEventListener("transitionend",e),n()};t.addEventListener("transitionend",e)}}function er(t){return void 0===t?t:{...t,children:Array.isArray(t.children)?t.children.map(er):void 0,data:t.data&&{...t.data,componentsInjected:!1}}}function nr(t,e){return or(rr(t),rr(e))}function or(t,e,n=5,o=0){if(o>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 r=0;r<t.length;r++)if(!or(t[r],e[r],n,o+1))return!1;return!0}const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(const s of r){if(!i.includes(s))return!1;if(!or(t[s],e[s],n,o+1))return!1}return!0}function rr(t){if(!ir(t))return t;const{state:e,of:n,from:o,filter:r,...i}=t;return i}function ir(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function sr(t,e,n=!0){const o=n?1:-1;switch(!0){case t>e:return 1*o;case t<e:return-1*o;default:return 0}}function ar(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],[o,r]=n;if(!["string","number"].includes(typeof r))return void console.error("Sort object properties must be a string or number:",t);let i=!0;if("string"==typeof r){if(!["asc","desc"].includes(r.toLowerCase()))return void console.error("Sort object string values must be asc or desc:",t);i="desc"!==r.toLowerCase()}if("number"==typeof r){if(1!==r&&-1!==r)return void console.error("Sort object number values must be 1 or -1:",t);i=1===r}return(t,e)=>sr(t[o],e[o],i)}function cr(t){if(!t)return;const e=typeof t;if("function"===e)return t;if("string"===e){if("asc"===t.toLowerCase()||"desc"===t.toLowerCase()){const e="desc"!==t.toLowerCase();return(t,n)=>sr(t,n,e)}const e=t;return(t,n)=>sr(t[e],n[e],!0)}if(Array.isArray(t)){const e=t.map((t=>"function"==typeof t?t:"string"!=typeof t||["asc","desc"].includes(t.toLowerCase())?ir(t)?ar(t):void 0:(e,n)=>sr(e[t],n[t],!0)));return(t,n)=>e.filter((t=>"function"==typeof t)).reduce(((e,o)=>0!==e?e:o(t,n)),0)}return ir(t)?ar(t):void console.error("Invalid sort option (ignoring):",t)}function lr(t){const e={},n=[];for(const o of t)if(o&&"slot"===o.sel){const t=o.data?.props?.name||"default";e[t]||(e[t]=[]);const n=Array.isArray(o.children)?o.children:o.children?[o.children]:[];e[t].push(...n)}else n.push(o);return n.length>0&&(e.default||(e.default=[]),e.default.push(...n)),{slots:e,defaultChildren:e.default||[]}}const ur=t=>{const{children:e,...n}=t;return He("portal",{props:n},e)};ur.label="portal",ur.preventInstantiation=!0;const dr=t=>{const{children:e,...n}=t;return He("transition",{props:n},e)};dr.label="transition",dr.preventInstantiation=!0;const pr=t=>{const{children:e,...n}=t;return He("suspense",{props:n},e)};pr.label="suspense",pr.preventInstantiation=!0;const hr=t=>{const{children:e,...n}=t;return He("slot",{props:n},e)};function fr(t){return t.data=function(e,n){return fr(t.map((t=>{const o=t?.dataset?.[e]??t?.dropZone?.dataset?.[e]??t?.element?.dataset?.[e];return n?n(o):o})))},t.element=function(e){return fr(t.map((t=>{const n=t?.element??t?.dropZone??null;return e?e(n):n})))},t}function mr(t){return 0===Object.keys(t).length}function yr(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(mr(e))throw new Error("Second argument given to Cycle must be an object with at least one driver function declared as a property.");const 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(mr(t))throw new Error("Argument given to setupReusable must be an object with at least one driver function declared as a property.");const e=function(t){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=ce.create());return e}(t),n=function(t,e){const n={};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o](e[o],o),n[o]&&"object"==typeof n[o]&&(n[o]._isCycleSource=o));return n}(t,e),o=function(t){for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e]&&"function"==typeof t[e].shamefullySendNext&&(t[e]=ue(t[e]));return t}(n);function r(t){return function(t,e){const n=Object.keys(t).filter((t=>!!e[t]));let o={};const r={};n.forEach((t=>{o[t]={_n:[],_e:[]},r[t]={next:e=>o[t]._n.push(e),error:e=>o[t]._e.push(e),complete:()=>{}}}));const i=n.map((e=>ce.fromObservable(t[e]).subscribe(r[e])));return n.forEach((t=>{const n=e[t],i=t=>{queueMicrotask((()=>n._n(t)))},s=t=>{queueMicrotask((()=>{(console.error||console.log)(t),n._e(t)}))};o[t]._n.forEach(i),o[t]._e.forEach(s),r[t].next=i,r[t].error=s,r[t]._n=i,r[t]._e=s})),o=null,function(){i.forEach((t=>t.unsubscribe()))}}(t,e)}function i(){!function(t){for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e]&&t[e].dispose&&t[e].dispose()}(o),function(t){Object.keys(t).forEach((e=>t[e]._c()))}(e)}return{sources:o,run:r,dispose:i}}(e),o=t(n.sources);return"undefined"!=typeof window&&(window.Cyclejs=window.Cyclejs||{},window.Cyclejs.sinks=o),{sinks:o,sources:n.sources,run:function(){const t=n.run(o);return function(){t(),n.dispose()}}}}function _r(t){const e=new EventTarget;return t.subscribe({next:t=>{e.dispatchEvent(new CustomEvent("data",{detail:t})),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onBusEvent(t)},error:t=>console.error("[EVENTS driver] Error in sink stream:",t)}),{select:t=>{const n=!t,o=Array.isArray(t)?t:[t];let r;return ue(ce.create({start:t=>{r=({detail:e})=>{const r=e&&e.data||null;(n||o.includes(e.type))&&t.next(r)},e.addEventListener("data",r)},stop:()=>{r&&e.removeEventListener("data",r)}}))}}}function vr(t){t.addListener({next:t=>{console.log(t)},error:t=>{console.error("[LOG driver] Error in sink stream:",t)}})}hr.label="slot",hr.preventInstantiation=!0;class gr{constructor(){this._connected=!1,this._components=new Map,this._stateHistory=[],this._maxHistory=200}get connected(){return this._connected&&"undefined"!=typeof window}init(){"undefined"!=typeof window&&(window.__SYGNAL_DEVTOOLS__=this,window.addEventListener("message",(t=>{t.source===window&&"__SYGNAL_DEVTOOLS_EXTENSION__"===t.data?.source&&this._handleExtensionMessage(t.data)})))}_handleExtensionMessage(t){switch(t.type){case"CONNECT":this._connected=!0,t.payload?.maxHistory&&(this._maxHistory=t.payload.maxHistory),this._sendFullTree();break;case"DISCONNECT":this._connected=!1;break;case"SET_DEBUG":this._setDebug(t.payload);break;case"TIME_TRAVEL":this._timeTravel(t.payload);break;case"SNAPSHOT":this._takeSnapshot();break;case"RESTORE_SNAPSHOT":this._restoreSnapshot(t.payload);break;case"GET_STATE":this._sendComponentState(t.payload.componentId)}}onComponentCreated(t,e,n){const o={id:t,name:e,isSubComponent:n.isSubComponent,hasModel:!!n.model,hasIntent:!!n.intent,hasContext:!!n.context,hasCalculated:!!n.calculated,components:Object.keys(n.components||{}),parentId:null,children:[],debug:n._debug,createdAt:Date.now(),mviGraph:this._extractMviGraph(n),_instanceRef:new WeakRef(n)};this._components.set(t,o),this.connected&&this._post("COMPONENT_CREATED",this._serializeMeta(o))}onStateChanged(t,e,n){if(!this.connected)return;const o={componentId:t,componentName:e,timestamp:Date.now(),state:this._safeClone(n)};this._stateHistory.push(o),this._stateHistory.length>this._maxHistory&&this._stateHistory.shift(),this._post("STATE_CHANGED",{componentId:t,componentName:e,state:o.state})}onActionDispatched(t,e,n,o){this.connected&&this._post("ACTION_DISPATCHED",{componentId:t,componentName:e,actionType:n,data:this._safeClone(o),timestamp:Date.now()})}onSubComponentRegistered(t,e){const n=this._components.get(t),o=this._components.get(e);n&&o&&(o.parentId=t,n.children.includes(e)||n.children.push(e)),this.connected&&this._post("TREE_UPDATED",{parentId:t,childId:e})}onContextChanged(t,e,n){this.connected&&this._post("CONTEXT_CHANGED",{componentId:t,componentName:e,context:this._safeClone(n),contextTrace:this._buildContextTrace(t,n)})}onPropsChanged(t,e,n){this.connected&&this._post("PROPS_CHANGED",{componentId:t,componentName:e,props:this._safeClone(n)})}onBusEvent(t){this.connected&&this._post("BUS_EVENT",{type:t.type,data:this._safeClone(t.data),componentId:t.__emitterId??null,componentName:t.__emitterName??null,timestamp:Date.now()})}onCommandSent(t,e,n,o){this.connected&&this._post("COMMAND_SENT",{type:t,data:this._safeClone(e),targetComponentName:o??null,timestamp:Date.now()})}onReadyChanged(t,e,n,o){this.connected&&this._post("READY_CHANGED",{parentId:t,parentName:e,childKey:n,ready:o,timestamp:Date.now()})}onCollectionMounted(t,e,n,o){const r=this._components.get(t);r&&(r.collection={itemComponent:n,stateField:o}),this.connected&&this._post("COLLECTION_MOUNTED",{parentId:t,parentName:e,itemComponent:n,stateField:o})}onComponentDisposed(t,e){const n=this._components.get(t);n&&(n.disposed=!0,n.disposedAt=Date.now()),this.connected&&this._post("COMPONENT_DISPOSED",{componentId:t,componentName:e,timestamp:Date.now()})}onDebugLog(t,e){this.connected&&this._post("DEBUG_LOG",{componentId:t,message:e,timestamp:Date.now()})}_setDebug({componentId:t,enabled:e}){if(null==t)return"undefined"!=typeof window&&(window.SYGNAL_DEBUG=!!e&&"true"),void this._post("DEBUG_TOGGLED",{global:!0,enabled:e});const n=this._components.get(t);if(n&&n._instanceRef){const o=n._instanceRef.deref();o&&(o._debug=e,n.debug=e,this._post("DEBUG_TOGGLED",{componentId:t,enabled:e}))}}_timeTravel({componentId:t,componentName:e,state:n}){if(null==t||!n)return void console.warn("[Sygnal DevTools] _timeTravel: missing componentId or state",{componentId:t,hasState:!!n});if("undefined"==typeof window)return;const o=this._safeClone(n),r=this._components.get(t);if(r){const n=r._instanceRef?.deref();if(n){const r=n.stateSourceName||"STATE",i=n.sinks?.[r];if(i?.shamefullySendNext)return i.shamefullySendNext((()=>({...o}))),void this._post("TIME_TRAVEL_APPLIED",{componentId:t,componentName:e,state:o});console.warn(`[Sygnal DevTools] _timeTravel: component #${t} (${e}) has no STATE sink with shamefullySendNext. sinkName=${r}, hasSinks=${!!n.sinks}, sinkKeys=${n.sinks?Object.keys(n.sinks).join(","):"none"}`)}else console.warn(`[Sygnal DevTools] _timeTravel: WeakRef for component #${t} (${e}) has been GC'd`)}else console.warn(`[Sygnal DevTools] _timeTravel: no meta for componentId ${t}`);const i=window.__SYGNAL_DEVTOOLS_APP__;i?.sinks?.STATE?.shamefullySendNext?(i.sinks.STATE.shamefullySendNext((()=>({...o}))),this._post("TIME_TRAVEL_APPLIED",{componentId:t,componentName:e,state:o})):console.warn("[Sygnal DevTools] _timeTravel: no fallback root STATE sink available")}_takeSnapshot(){const t=[];for(const[e,n]of this._components){if(n.disposed)continue;const o=n._instanceRef?.deref();null!=o?.currentState&&t.push({componentId:e,componentName:n.name,state:this._safeClone(o.currentState)})}this._post("SNAPSHOT_TAKEN",{entries:t,timestamp:Date.now()})}_restoreSnapshot(t){if(t?.entries)for(const e of t.entries)this._timeTravel(e)}_sendComponentState(t){const e=this._components.get(t);if(e&&e._instanceRef){const n=e._instanceRef.deref();n&&this._post("COMPONENT_STATE",{componentId:t,state:this._safeClone(n.currentState),context:this._safeClone(n.currentContext),contextTrace:this._buildContextTrace(t,n.currentContext),props:this._safeClone(n.currentProps)})}}_buildContextTrace(t,e){if(!e||"object"!=typeof e)return[];const n=[],o=Object.keys(e);for(const e of o){let o=t,r=!1;for(;null!=o;){const t=this._components.get(o);if(!t)break;if(t.mviGraph?.contextProvides?.includes(e)){n.push({field:e,providerId:t.id,providerName:t.name}),r=!0;break}o=t.parentId}r||n.push({field:e,providerId:-1,providerName:"unknown"})}return n}_sendFullTree(){const t=[];for(const[,e]of this._components){const n=e._instanceRef?.deref();t.push({...this._serializeMeta(e),state:n?this._safeClone(n.currentState):null,context:n?this._safeClone(n.currentContext):null})}this._post("FULL_TREE",{components:t,history:this._stateHistory})}_post(t,e){"undefined"!=typeof window&&window.postMessage({source:"__SYGNAL_DEVTOOLS_PAGE__",type:t,payload:e},"*")}_safeClone(t){if(null==t)return t;try{return JSON.parse(JSON.stringify(t))}catch(t){return"[unserializable]"}}_extractMviGraph(t){if(!t.model)return null;try{const e=t.sourceNames?[...t.sourceNames]:[],n=[],o=t.model;for(const e of Object.keys(o)){let r=e,i=o[e];if(e.includes("|")){const t=e.split("|").map((t=>t.trim()));if(2===t.length&&t[0]&&t[1]){r=t[0],n.push({name:r,sinks:[t[1]]});continue}}"function"!=typeof i?i&&"object"==typeof i&&n.push({name:r,sinks:Object.keys(i)}):n.push({name:r,sinks:[t.stateSourceName||"STATE"]})}return{sources:e,actions:n,contextProvides:t.context&&"object"==typeof t.context?Object.keys(t.context):[]}}catch(t){return null}}_serializeMeta(t){const{_instanceRef:e,...n}=t;return n}}let br=null;function wr(){return br||(br=new gr),br}function Sr(t){if(!t)return null;const e=t.default||t;return"function"!=typeof e?null:t.default?t:{default:e}}function Er(t){return/^[a-zA-Z0-9-_]+$/.test(t)}function Ar(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(!Er(e))throw new Error(`${e} is not a valid CSS class name`);return t.push(e),t}),[])}const Or=t=>(t=>"string"==typeof t)(t)||(t=>"number"==typeof t)(t),Nr={svg:1,g:1,defs:1,symbol:1,use:1,circle:1,ellipse:1,line:1,path:1,polygon:1,polyline:1,rect:1,text:1,tspan:1,textPath:1,linearGradient:1,radialGradient:1,stop:1,pattern:1,clipPath:1,mask:1,marker:1,filter:1,feBlend:1,feColorMatrix:1,feComponentTransfer:1,feComposite:1,feConvolveMatrix:1,feDiffuseLighting:1,feDisplacementMap:1,feDropShadow:1,feFlood:1,feGaussianBlur:1,feImage:1,feMerge:1,feMergeNode:1,feMorphology:1,feOffset:1,fePointLight:1,feSpecularLighting:1,feSpotLight:1,feTile:1,feTurbulence:1,feFuncR:1,feFuncG:1,feFuncB:1,feFuncA:1,desc:1,metadata:1,foreignObject:1,switch:1,animate:1,animateMotion:1,animateTransform:1,set:1,mpath:1};var Cr=Object.prototype.hasOwnProperty,Tr=Object.prototype.toString,$r=Object.defineProperty,xr=Object.getOwnPropertyDescriptor,kr=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Tr.call(t)},Lr=function(t){if(!t||"[object Object]"!==Tr.call(t))return!1;var e,n=Cr.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&Cr.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!o)return!1;for(e in t);return void 0===e||Cr.call(t,e)},Dr=function(t,e){$r&&"__proto__"===e.name?$r(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},jr=function(t,e){if("__proto__"===e){if(!Cr.call(t,e))return;if(xr)return xr(t,e).value}return t[e]},Ir=function t(){var e,n,o,r,i,s,a=arguments[0],c=1,l=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[1]||{},c=2),(null==a||"object"!=typeof a&&"function"!=typeof a)&&(a={});c<l;++c)if(null!=(e=arguments[c]))for(n in e)o=jr(a,n),a!==(r=jr(e,n))&&(u&&r&&(Lr(r)||(i=kr(r)))?(i?(i=!1,s=o&&kr(o)?o:[]):s=o&&Lr(o)?o:{},Dr(a,{name:n,newValue:t(u,s,r)})):void 0!==r&&Dr(a,{name:n,newValue:r}));return a},Mr=o(Ir);const Pr=(...t)=>Mr(!1,...t),Rr=(t,e,n)=>{let o=n;for(let n=0;n<t.length;n++){const i=t[n];r=i,o=Array.isArray(r)?Rr(i,e,o):e(o,i)}var r;return o},Fr=(t,e)=>Object.keys(t).map((n=>e(n,t[n]))).reduce(((t,e)=>((...t)=>Mr(!0,...t))(t,e)),{}),Gr=(t,e)=>Fr(e,((e,n)=>e!==t?{[e]:n}:{})),Br=t=>Or(t)?{text:t,sel:void 0,data:void 0,children:void 0,elm:void 0,key:void 0}:void 0,Ur=t=>{if(!t||void 0===t.sel)return t;const e=t.data||{},n=e.props||{},o=Gr("className",n),r=void 0!==n.className?{class:n.className}:{},i=Pr({},o,r,e.attrs||{});return Pr(t,{data:Gr("props",Pr({},e,{ns:"http://www.w3.org/2000/svg",attrs:i}))},{children:Array.isArray(t.children)&&"foreignObject"!==t.sel?t.children.map((t=>Ur(t))):t.children})},Vr=t=>t.sel in Nr?Ur(t):t,Hr={for:"attrs",role:"attrs",tabindex:"attrs","aria-*":"attrs",key:null},Wr=(t,e)=>{const{ref:n,...o}=t,r=(t=>{if(!t.props)return t;const{autoFocus:e,autoSelect:n,...o}=t.props;if(!e&&!n)return t;t.props=o,t._autoFocus=!!e,t._autoSelect=!!n;const r=t=>{t&&"function"==typeof t.focus&&requestAnimationFrame((()=>{t.focus(),n&&"function"==typeof t.select&&t.select()}))},i=t.hook?.insert,s=t.hook?.postpatch;return t.hook={...t.hook,insert:t=>{i&&i(t),(e||n)&&r(t.elm)},postpatch:(t,e)=>{s&&s(t,e);const n=t.data?._autoFocus,o=e.data?._autoFocus;!n&&o&&r(e.elm)}},t})(((t,e)=>Fr(t,((t,n)=>{const o={[t]:n};if(Hr[t]&&void 0!==e[Hr[t]])return{[Hr[t]]:o};if(null===Hr[t])return{};const r=Object.keys(Hr);for(let n=0;n<r.length;n++){const i=r[n];if("*"===i.charAt(i.length-1)&&0===t.indexOf(i.slice(0,-1))&&void 0!==e[Hr[i]])return{[Hr[i]]:o}}return void 0!==e[t]?{[e[t]?e[t]:t]:n}:void 0!==e.props?{props:o}:o})))(((t,e)=>Fr(t,((t,n)=>{const o=t.indexOf("-");if(o>-1&&void 0!==e[t.slice(0,o)]){const e={[t.slice(o+1)]:n};return{[t.slice(0,o)]:e}}return{[t]:n}})))(o,e),e));return((t,e)=>{if(!e)return t;const n=t=>{"function"==typeof e?e(t):e&&"object"==typeof e&&"current"in e&&(e.current=t)},o=t.hook?.insert,r=t.hook?.destroy,i=t.hook?.postpatch;return t.hook={...t.hook,insert:t=>{o&&o(t),n(t.elm)},postpatch:(t,e)=>{i&&i(t,e),n(e.elm)},destroy:t=>{r&&r(t),n(null)}},t})(r,n)},Yr=t=>t.length>1||!Or(t[0])?void 0:t[0].toString(),zr=t=>Rr(t,((t,e)=>{const n=(t=>"object"==typeof t&&null!==t)(o=e)&&"sel"in o&&"data"in o&&"children"in o&&"text"in o?e:Br(e);var o;return t.push(n),t}),[]),qr=(t=>(e,n,...o)=>{if(void 0===e&&(e="UNDEFINED",console.error("JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component's file scope.")),"function"==typeof e){if(e.__sygnalFragment||"Fragment"===e.name)return e(n||{},o);if(n||(n={}),e.isSygnalComponent){const t=e;e=e.componentName||e.label||e.name||"sygnal-factory",n.sygnalFactory=t}else{const r=e.componentName||e.label||e.name||"FUNCTION_COMPONENT",i=e,{model:s,intent:a,hmrActions:c,context:l,peers:u,components:d,initialState:p,isolatedState:h,calculated:f,storeCalculatedInState:m,DOMSourceName:y,stateSourceName:_,onError:v,debug:g,preventInstantiation:b}=e;if(b){const e=Yr(o),i=n?Wr(n,t):{};return Vr({sel:r,data:i,children:void 0!==e?Br(e):zr(o),text:e,elm:void 0,key:n?n.key:void 0})}const w={name:r,view:i,model:s,intent:a,hmrActions:c,context:l,peers:u,components:d,initialState:p,isolatedState:h,calculated:f,storeCalculatedInState:m,DOMSourceName:y,stateSourceName:_,onError:v,debug:g};n.sygnalOptions=w,e=r}}const r=Yr(o);return Vr({sel:e,data:n?Wr(n,t):{},children:void 0!==r?Br(r):zr(o),text:r,elm:void 0,key:n?n.key:void 0})})({attrs:"",props:"",class:"",data:"dataset",style:"",hook:"",on:""});const Jr=lo;function Zr(t,e){const n=(t,n)=>e.dispatchEvent(new CustomEvent("data",{detail:{type:t,data:n}}));t.addEventListener("statechange",(()=>{"installed"===t.state&&n("installed",!0),"activated"===t.state&&n("activated",!0)})),"installed"===t.state&&n("waiting",t),"activated"===t.state&&n("activated",!0)}let Xr;const Kr=Jr.create({start(t){if("undefined"==typeof window)return void t.next(!0);t.next(navigator.onLine);const e=()=>t.next(!0),n=()=>t.next(!1);window.addEventListener("online",e),window.addEventListener("offline",n),Xr=()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}},stop(){Xr?.(),Xr=void 0}});const Qr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ti={"&":"&","<":"<",">":">",'"':""","'":"'"};function ei(t){return String(t).replace(/[&<>"']/g,(t=>ti[t]))}function ni(t){return t.replace(/^(Webkit|Moz|Ms|O)/,(t=>"-"+t.toLowerCase())).replace(/([A-Z])/g,"-$1").toLowerCase()}function oi(t,e,n){if(!t)return t;if("string"==typeof t||null!=t.text)return t;const o=t.sel;if("portal"===o){const o=t.children||[];return 0===o.length?null:1===o.length?oi(o[0],e,n):{sel:"div",data:{attrs:{"data-sygnal-portal":""}},children:o.map((t=>oi(t,e,n))),text:void 0,elm:void 0,key:void 0}}if("transition"===o){const o=(t.children||[])[0];return o?oi(o,e,n):null}if("suspense"===o){const o=t.children||[];return 0===o.length?null:1===o.length?oi(o[0],e,n):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:o.map((t=>oi(t,e,n))),text:void 0,elm:void 0,key:void 0}}if("clientonly"===o){const o=(t.data?.props||{}).fallback;return o?oi(o,e,n):{sel:"div",data:{attrs:{"data-sygnal-clientonly":""}},children:[],text:void 0,elm:void 0,key:void 0}}if("slot"===o){const o=t.children||[];return 0===o.length?null:1===o.length?oi(o[0],e,n):{sel:"div",data:{},children:o.map((t=>oi(t,e,n))),text:void 0,elm:void 0,key:void 0}}const r=t.data?.props||{};return r.sygnalOptions||"function"==typeof r.sygnalFactory?function(t,e,n){const o=t.data?.props||{},{sygnalOptions:r,sygnalFactory:i,...s}=o;let a;if(r)a=r.view,!a.initialState&&r.initialState&&(a=Object.assign(a,{initialState:r.initialState,model:r.model,intent:r.intent,context:r.context,onError:r.onError,calculated:r.calculated}));else if(i&&i.componentName)return{sel:"div",data:{attrs:{"data-sygnal-ssr":t.sel||"component"}},children:t.children||[],text:void 0,elm:void 0,key:void 0};if(!a||"function"!=typeof a)return{sel:"div",data:{attrs:{"data-sygnal-ssr":t.sel||"component"}},children:t.children||[],text:void 0,elm:void 0,key:void 0};let c=a.initialState;const l=s.state;"string"==typeof l&&null!=n&&null!=n[l]?c=n[l]:null!=l&&"string"!=typeof l&&(c=l);const u={...e},d=a.context||{};for(const t of Object.keys(d)){const e=d[t];if("function"==typeof e&&null!=c)try{u[t]=e(c)}catch(t){}}const p={},h=[],f=t.children||[];for(const t of f)if(t&&"slot"===t.sel){const e=t.data?.props?.name||"default";p[e]||(p[e]=[]);const n=t.children||[];p[e].push(...n)}else h.push(t);h.length>0&&(p.default||(p.default=[]),p.default.push(...h));let m;try{m=a({...s,state:c,children:p.default||f,slots:p,context:u,peers:{}},c,u,{})}catch(t){if("function"==typeof a.onError){const e=a.componentName||a.name||"Component";try{m=a.onError(t,{componentName:e})}catch(t){m={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}}else m={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}m||(m={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0});return oi(m,u,c)}(t,e,n):"collection"===o?function(t,e,n){const o=t.data?.props||{},{of:r,from:i,className:s}=o;if(!r||!i||!n)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};const a=n[i];if(!Array.isArray(a))return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};const c=a.map(((t,n)=>{const o={...e},i=r.context||{};for(const e of Object.keys(i)){const n=i[e];if("function"==typeof n)try{o[e]=n(t)}catch(t){}}let s;try{s=r({state:t,children:[],slots:{},context:o,peers:{}},t,o,{})}catch(t){if("function"==typeof r.onError)try{s=r.onError(t,{componentName:r.name||"CollectionItem"})}catch(t){s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}else s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}return oi(s,o,t)})).filter((t=>null!=t)),l={};s&&(l.props={className:s});return{sel:"div",data:l,children:c,text:void 0,elm:void 0,key:void 0}}(t,e,n):"switchable"===o?function(t,e,n){const o=t.data?.props||{},{components:r,active:i,initial:s}=o;if(!r)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};let a;"string"==typeof i&&(r[i]?a=i:n&&"string"==typeof n[i]&&(a=n[i]));!a&&s&&(a=s);a||(a=Object.keys(r)[0]);const c=r[a];if(!c||"function"!=typeof c)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};return function(t,e,n){const o=void 0!==e?e:t.initialState,r=t.context||{},i={...n};for(const t of Object.keys(r)){const e=r[t];if("function"==typeof e&&null!=o)try{i[t]=e(o)}catch(t){}}let s;try{s=t({state:o,children:[],slots:{},context:i,peers:{}},o,i,{})}catch(e){if("function"==typeof t.onError)try{s=t.onError(e,{componentName:t.name||"Component"})}catch(t){s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}else s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}s||(s={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0});return oi(s,i,o)}(c,n,e)}(t,e,n):(t.children&&(Array.isArray(t.children)?t.children.length>0&&(t.children=t.children.map((t=>oi(t,e,n))).filter((t=>null!=t))):t.children&&"object"==typeof t.children&&(t.children=oi(t.children,e,n))),t)}function ri(t){if(null==t)return"";if("string"==typeof t)return ei(t);if(null!=t.text&&!t.sel)return ei(String(t.text));const e=t.sel;if(!e)return null!=t.text?ei(String(t.text)):"";const{tag:n,id:o,selectorClasses:r}=function(t){let e=t,n=null;const o=[],r=t.indexOf("#");if(-1!==r){const i=t.slice(r+1),s=i.indexOf(".");if(-1!==s){n=i.slice(0,s),e=t.slice(0,r);const a=i.slice(s+1);a&&o.push(...a.split("."))}else n=i,e=t.slice(0,r)}else{const n=t.indexOf(".");if(-1!==n){e=t.slice(0,n);const r=t.slice(n+1);r&&o.push(...r.split("."))}}e||(e="div");return{tag:e,id:n,selectorClasses:o}}(e),i=function(t,e,n){const o=[],r=[...n];if(t.props)for(const[e,n]of Object.entries(t.props))"className"===e?"string"==typeof n&&n&&r.push(n):"htmlFor"===e?o.push(["for",n]):"innerHTML"===e||"textContent"===e||"sygnalOptions"===e||"sygnalFactory"===e||("boolean"==typeof n?n&&o.push([e,!0]):null!=n&&o.push([e,n]));if(t.attrs)for(const[e,n]of Object.entries(t.attrs))"class"===e?"string"==typeof n&&n&&r.push(n):"boolean"==typeof n?n&&o.push([e,!0]):null!=n&&o.push([e,n]);if(t.class)for(const[e,n]of Object.entries(t.class))n&&r.push(e);if(t.dataset)for(const[e,n]of Object.entries(t.dataset))null!=n&&o.push([`data-${ni(e)}`,n]);e&&o.unshift(["id",e]);if(r.length>0){const t=[...new Set(r)];o.unshift(["class",t.join(" ")])}if(t.style&&"object"==typeof t.style){const e=function(t){const e=[];for(const n of Object.keys(t)){const o=t[n];if(null==o||""===o)continue;if("delayed"===n||"remove"===n||"destroy"===n)continue;const r=ni(n);e.push(`${r}: ${o}`)}return e.join("; ")}(t.style);e&&o.push(["style",e])}return o}(t.data||{},o,r);let s=`<${n}`;for(const[t,e]of i)!0===e?s+=` ${t}`:!1!==e&&null!=e&&(s+=` ${t}="${ei(String(e))}"`);if(s+=">",Qr.has(n))return s;if(null!=t.data?.props?.innerHTML)return s+=String(t.data.props.innerHTML),s+=`</${n}>`,s;if(null!=t.text)s+=ei(String(t.text));else if(t.children){const e=Array.isArray(t.children)?t.children:[t.children];for(const t of e)s+=ri(t)}return s+=`</${n}>`,s}var ii={};Object.defineProperty(ii,"__esModule",{value:!0});var si=r,ai=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 ci=ii.default=function(t){return function(e){return new si.Stream(new ai(t,e))}};t.ABORT=Fo,t.Collection=ao,t.MainDOMSource=Cn,t.MockedDOMSource=oo,t.Portal=ur,t.Slot=hr,t.Suspense=pr,t.Switchable=mo,t.Transition=dr,t.classes=function(...t){return t.reduce(((t,e)=>{var n,o;return"string"!=typeof e||t.includes(e)?Array.isArray(e)?t.push(...(o=e,o.map(Ar).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(!Er(n))throw new Error(`${n} is not a valid CSS class name`);return n})))):t.push(...Ar(e)),t}),[]).join(" ")},t.collection=so,t.component=Uo,t.createCommand=function(){const t={next:()=>{}},e={send:(n,o)=>{t.next({type:n,data:o}),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onCommandSent(n,o,e._targetComponentId,e._targetComponentName)},_stream:lo.create({start(e){t.next=t=>e.next(t)},stop(){t.next=()=>{}}}),__sygnalCommand:!0};return e},t.createElement=qr,t.createInstallPrompt=function(){let t=null;const e=new EventTarget;return"undefined"!=typeof window&&(window.addEventListener("beforeinstallprompt",(n=>{n.preventDefault(),t=n,e.dispatchEvent(new CustomEvent("data",{detail:{type:"beforeinstallprompt",data:!0}}))})),window.addEventListener("appinstalled",(()=>{t=null,e.dispatchEvent(new CustomEvent("data",{detail:{type:"appinstalled",data:!0}}))}))),{select(t){let n;return ue(Jr.create({start:o=>{n=({detail:e})=>{e.type===t&&o.next(e.data)},e.addEventListener("data",n)},stop:()=>{n&&e.removeEventListener("data",n)}}))},prompt:()=>t?.prompt()}},t.createRef=function(){return{current:null}},t.createRef$=function(){const t={next:()=>{}},e=lo.createWithMemory({start(e){t.next=t=>e.next(t)},stop(){t.next=()=>{}}});return new Proxy({current:null,stream:e},{set:(e,n,o)=>"current"===n?(e.current=o,t.next(o),!0):(e[n]=o,!0)})},t.debounce=Oo,t.delay=bo,t.driverFromAsync=function(t,e={}){const{selector:n="category",args:o="value",return:r="value",pre:i=(t=>t),post:s=(t=>t)}=e,a=t.name||"[anonymous function]",c=typeof o;if(!("string"===c||"function"===c||Array.isArray(o)&&o.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 l=ce.create({start:t=>{c=t.next.bind(t)},stop:()=>{}});return e.addListener({next:e=>{const l=i(e);let u=[];if("object"==typeof l&&null!==l){if("function"==typeof o){const t=o(l);u=Array.isArray(t)?t:[t]}"string"==typeof o&&(u=[l[o]]),Array.isArray(o)&&(u=o.map((t=>l[t])))}const d=`Error in driver created using driverFromAsync(${a})`;t(...u).then((t=>{const o=t=>{let o;if(void 0===r)o=t,"object"==typeof o&&null!==o?o[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 r)throw new Error(`The 'return' option for driverFromAsync(${a}) must be a string. Received ${typeof r}`);o={[r]:t,[n]:e[n]}}return o};if("function"==typeof t.then)t.then((t=>{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(o(t))})).catch((t=>console.error(`${d}: ${t}`))):c(o(n))})).catch((t=>console.error(`${d}: ${t}`)));else{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(o(t))})).catch((t=>console.error(`${d}: ${t}`))):c(o(n))}})).catch((t=>console.error(`${d}: ${t}`)))},error:t=>{console.error(`Error received 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?l:"function"==typeof t?l.filter(t):l.filter((e=>e?.[n]===t))}}},t.dropRepeats=ge,t.emit=function(t,e){return{EVENTS:"function"==typeof e?(n,o,r,i)=>({type:t,data:e(n,o,r,i)}):()=>({type:t,data:e})}},t.enableHMR=function(t,e,n,o){if(!t||"function"!=typeof t.hmr)return t;if(!e||"function"!=typeof e.accept)return t;let r=!1;const i=e=>{Promise.resolve((async e=>{if(r)return;r=!0;const o=Array.isArray(e)?e.find(Boolean):e;try{let e=Sr(o);if(e||"function"!=typeof n||(e=Sr(await n())),e){const n=t?.sources?.STATE?.stream?._v;t.hmr(e,n)}}finally{r=!1}})(e)).catch((()=>{}))};return void 0!==o&&e.accept(o,i),e.accept(i),"function"==typeof e.dispose&&"function"==typeof t.dispose&&e.dispose((()=>t.dispose())),t},t.exactState=function(){return t=>t},t.getDevTools=wr,t.h=He,t.lazy=function(t){let e=null,n=null;function o(t){return n?{sel:"div",data:{attrs:{"data-sygnal-error":"lazy"}},children:[],text:void 0,elm:void 0,key:void 0}:e?e(t):{sel:"div",data:{attrs:{"data-sygnal-lazy":"loading"}},children:[],text:void 0,elm:void 0,key:void 0}}const r=t().then((t=>{e=t.default||t,o.__sygnalLazyLoadedComponent=e;const n=["model","intent","hmrActions","context","peers","components","initialState","calculated","storeCalculatedInState","DOMSourceName","stateSourceName","onError","debug","componentName"];for(const t of n)void 0!==e[t]&&void 0===o[t]&&(o[t]=e[t])})).catch((t=>{n=t,console.error("[lazy] Failed to load component:",t)}));return o.__sygnalLazy=!0,o.__sygnalLazyLoaded=()=>null!==e,o.__sygnalLazyLoadedComponent=null,o.__sygnalLazyPromise=r,o.__sygnalLazyReRenderScheduled=!1,o},t.makeDOMDriver=eo,t.makeDragDriver=function(){return function(t){const e=new Map,n=new EventTarget,o=[];let r=null;const i=t=>{if(!t?.category)return;const n=e.get(t.category)??{};e.set(t.category,{...n,...t})};t.subscribe({next(t){(t?.configs??(Array.isArray(t)?t:[t])).forEach(i)},error(){},complete(){}});const s=(t,e)=>n.dispatchEvent(new CustomEvent(t,{detail:e})),a=(t,e)=>{document.addEventListener(t,e),o.push([t,e])};a("dragstart",(t=>{const n=t;for(const[t,o]of e){if(!o.draggable)continue;const e=n.target.closest(o.draggable);if(e){if(r=t,n.dataTransfer.effectAllowed="move",o.dragImage){const t=e.closest(o.dragImage);if(t){const e=t.getBoundingClientRect();n.dataTransfer.setDragImage(t,n.clientX-e.left,n.clientY-e.top)}}return void s(`${t}:dragstart`,{element:e,dataset:{...e.dataset}})}}})),a("dragend",(()=>{r&&(s(`${r}:dragend`,null),r=null)})),a("dragover",(t=>{const n=t;for(const[,t]of e)if(t.dropZone&&(!r||!t.accepts||t.accepts===r)&&n.target.closest(t.dropZone))return void n.preventDefault()})),a("drop",(t=>{const n=t;for(const[t,o]of e){if(!o.dropZone)continue;if(r&&o.accepts&&o.accepts!==r)continue;const i=n.target.closest(o.dropZone);if(!i)continue;n.preventDefault();let a=null;const c=r?e.get(r):null;return c?.draggable&&(a=n.target.closest(c.draggable)??null),void s(`${t}:drop`,{dropZone:i,insertBefore:a})}}));const c={select:t=>({events(e){const o=`${t}:${e}`;let r;return fr(ce.create({start(t){r=({detail:e})=>t.next(e),n.addEventListener(o,r)},stop(){r&&n.removeEventListener(o,r)}}))}}),dragstart:t=>c.select(t).events("dragstart"),dragend:t=>c.select(t).events("dragend"),drop:t=>c.select(t).events("drop"),dragover:t=>c.select(t).events("dragover"),dispose(){o.forEach((([t,e])=>document.removeEventListener(t,e)))}};return c}},t.makeServiceWorkerDriver=function(t,e={}){return function(n){const o=new EventTarget;return"undefined"!=typeof navigator&&"serviceWorker"in navigator&&(navigator.serviceWorker.register(t,{scope:e.scope}).then((t=>{const e=(t,e)=>o.dispatchEvent(new CustomEvent("data",{detail:{type:t,data:e}}));t.installing&&Zr(t.installing,o),t.waiting&&e("waiting",t.waiting),t.active&&e("activated",!0),t.addEventListener("updatefound",(()=>{t.installing&&Zr(t.installing,o)})),navigator.serviceWorker.addEventListener("controllerchange",(()=>{e("controlling",!0)})),navigator.serviceWorker.addEventListener("message",(t=>{e("message",t.data)}))})).catch((t=>{o.dispatchEvent(new CustomEvent("data",{detail:{type:"error",data:t}}))})),n.addListener({next:t=>{"skipWaiting"===t.action?navigator.serviceWorker.ready.then((t=>{t.waiting&&t.waiting.postMessage({type:"SKIP_WAITING"})})):"postMessage"===t.action?navigator.serviceWorker.ready.then((e=>{e.active&&e.active.postMessage(t.data)})):"unregister"===t.action&&navigator.serviceWorker.ready.then((t=>t.unregister()))},error:t=>console.error("[SW driver] Error in sink stream:",t)})),{select(t){let e;return ue(Jr.create({start:n=>{e=({detail:e})=>{t&&e.type!==t||n.next(e.data)},o.addEventListener("data",e)},stop:()=>{e&&o.removeEventListener("data",e)}}))}}}},t.mockDOMSource=ro,t.onlineStatus$=Kr,t.portal=ur,t.processDrag=function({draggable:t,dropZone:e}={},n={}){if(t&&"function"!=typeof t.events)throw new Error("processDrag: draggable must have an .events() method (e.g. DOM.select(...))");if(e&&"function"!=typeof e.events)throw new Error("processDrag: dropZone must have an .events() method (e.g. DOM.select(...))");const{effectAllowed:o="move"}=n;return{dragStart$:t?t.events("dragstart").map((t=>(t.dataTransfer.effectAllowed=o,t))):ce.never(),dragEnd$:t?t.events("dragend").mapTo(null):ce.never(),dragOver$:e?e.events("dragover").map((t=>(t.preventDefault(),null))):ce.never(),drop$:e?e.events("drop").map((t=>(t.preventDefault(),t))):ce.never()}},t.processForm=function(t,e={}){if(!t||"function"!=typeof t.events)throw new Error("processForm: first argument must have an .events() method (e.g. DOM.select(...))");let{events:n=["input","submit"],preventDefault:o=!0}=e;"string"==typeof n&&(n=[n]);const r=n.map((e=>t.events(e)));return ce.merge(...r).map((t=>{o&&t.preventDefault();const e="submit"===t.type?t.srcElement:t.currentTarget,n=new FormData(e),r={event:t,eventType:t.type},i=e.querySelector("input[type=submit]:focus");if(i){const{name:t,value:e}=i;r[t||"submit"]=e}for(const[t,e]of n.entries())r[t]=e;return r}))},t.renderComponent=function(t,e={}){const{initialState:n,mockConfig:o={},drivers:r={}}=e,i=t.name||t.componentName||"TestComponent",s=t,{intent:a,model:c,context:l,calculated:u,storeCalculatedInState:d,onError:p}=t,h=void 0!==n?n:t.initialState,f={next:()=>{}},m=lo.create({start(t){f.next=e=>t.next(e)},stop(){f.next=()=>{}}}),y={...c||{},__TEST_ACTION__:{STATE:(t,e)=>{if(!e||!e.type)return t;const{type:n,data:o}=e;let r=c?.[n];if(!r)for(const t of Object.keys(c||{}))if(t.includes("|")){const e=t.split("|").map((t=>t.trim()));if(e[0]===n){r={[e[1]]:c[t]};break}}if(!r)return t;if("function"==typeof r){const e=r(t,o);return"symbol"==typeof e?t:void 0!==e?e:t}if("object"==typeof r){const e=r.STATE||r[_];if("function"==typeof e){const n=e(t,o);return"symbol"==typeof n?t:void 0!==n?n:t}const n=r.EFFECT;if("function"==typeof n){n(t,o,((t,e)=>{setTimeout((()=>f.next({type:t,data:e})),10)}),{})}}return t}}},_="STATE",v=Fe(Uo({name:i,view:s,intent:a?t=>({...a(t),__TEST_ACTION__:m}):t=>({__TEST_ACTION__:m}),model:y,context:l,initialState:h,calculated:u,storeCalculatedInState:d,onError:p}),_),g={DOM:()=>ro(o),EVENTS:_r,LOG:vr,...r},{sources:b,sinks:w,run:S}=yr(v,g),E=S(),A=[];let O=null;const N=b.STATE&&b.STATE.stream?b.STATE.stream:lo.never();return O={next:t=>A.push(t),error:()=>{},complete:()=>{}},N.addListener(O),{state$:N,dom$:w.DOM||lo.never(),events$:b.EVENTS||{select:()=>lo.never()},sinks:w,sources:b,simulateAction:(t,e)=>{f.next({type:t,data:e})},waitForState:(t,e=2e3)=>new Promise(((n,o)=>{for(const e of A)try{if(t(e))return n(e)}catch(t){}const r=setTimeout((()=>{try{N.removeListener(i)}catch(t){}o(new Error(`waitForState timed out after ${e}ms`))}),e),i={next:e=>{try{t(e)&&(clearTimeout(r),N.removeListener(i),n(e))}catch(t){}},error:t=>{clearTimeout(r),o(t)},complete:()=>{clearTimeout(r),o(new Error("waitForState: state stream completed without matching"))}};N.addListener(i)})),states:A,dispose:()=>{if(O){try{N.removeListener(O)}catch(t){}O=null}if("function"==typeof w.__dispose)try{w.__dispose()}catch(t){}E()}}},t.renderToString=function(t,e={}){const{state:n,props:o={},context:r={},hydrateState:i}=e,s=void 0!==n?n:t.initialState,a=t.context||{},c={...r};for(const t of Object.keys(a)){const e=a[t];if("function"==typeof e&&null!=s)try{c[t]=e(s)}catch(t){}}let l;try{l=t({...o,state:s,children:o.children||[],slots:o.slots||{},context:c,peers:{}},s,c,{})}catch(e){if("function"==typeof t.onError){const n=t.componentName||t.name||"Component";try{l=t.onError(e,{componentName:n})}catch(t){l={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}}else l={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}l||(l={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0}),l=oi(l,c,s);let u=ri(l);if(i&&null!=s){const t="string"==typeof i?i:"__SYGNAL_STATE__";ei(JSON.stringify(s)),u+=`<script>window.${t}=${JSON.stringify(s)}<\/script>`}return u},t.run=function t(e,n={},o={}){if("undefined"!=typeof window){wr().init()}const{mountPoint:r="#root",fragments:i=!0,useDefaultDrivers:s=!0}=o;if(!e.isSygnalComponent){const t=e.name||e.componentName||e.label||"FUNCTIONAL_COMPONENT",n=e,{model:o,intent:r,hmrActions:i,context:s,peers:a,components:c,initialState:l,calculated:u,storeCalculatedInState:d,DOMSourceName:p,stateSourceName:h,onError:f,debug:m}=e;e=Uo({name:t,view:n,model:o,intent:r,hmrActions:i,context:s,peers:a,components:c,initialState:l,calculated:u,storeCalculatedInState:d,DOMSourceName:p,stateSourceName:h,onError:f,debug:m})}"undefined"!=typeof window&&!0===window.__SYGNAL_HMR_UPDATING&&void 0!==window.__SYGNAL_HMR_PERSISTED_STATE&&(e.initialState=window.__SYGNAL_HMR_PERSISTED_STATE);const a=Fe(e,"STATE"),c={...s?{EVENTS:_r,DOM:eo(r,{snabbdomOptions:{experimental:{fragments:i}}}),LOG:vr}:{},...n},{sources:l,sinks:u,run:d}=yr(a,c),p=d();let h=null;"undefined"!=typeof window&&l?.STATE?.stream&&"function"==typeof l.STATE.stream.addListener&&(h={next:t=>{window.__SYGNAL_HMR_PERSISTED_STATE=t},error:()=>{},complete:()=>{}},l.STATE.stream.addListener(h));const f={sources:l,sinks:u,dispose:()=>{if(h&&l?.STATE?.stream&&"function"==typeof l.STATE.stream.removeListener&&(l.STATE.stream.removeListener(h),h=null),"function"==typeof u.__dispose)try{u.__dispose()}catch(t){}p()}};"undefined"!=typeof window&&(window.__SYGNAL_DEVTOOLS_APP__=f);const m=(r,i)=>{const s="undefined"!=typeof window?window.__SYGNAL_HMR_PERSISTED_STATE:void 0,a=void 0!==s?s:e.initialState,c=void 0===i?a:i;"undefined"!=typeof window&&(window.__SYGNAL_HMR_UPDATING=!0,window.__SYGNAL_HMR_STATE=c,window.__SYGNAL_HMR_PERSISTED_STATE=c),f.dispose();const l=r.default||r;l.initialState=c;const u=t(l,n,o);if(f.sources=u.sources,f.sinks=u.sinks,f.dispose=u.dispose,void 0!==c&&u?.sinks?.STATE&&"function"==typeof u.sinks.STATE.shamefullySendNext){const t=()=>u.sinks.STATE.shamefullySendNext((()=>({...c})));setTimeout(t,0),setTimeout(t,20)}"undefined"!=typeof window&&u?.sources?.STATE?.stream&&"function"==typeof u.sources.STATE.stream.setDebugListener?u.sources.STATE.stream.setDebugListener({next:()=>{u.sources.STATE.stream.setDebugListener(null),window.__SYGNAL_HMR_STATE=void 0,setTimeout((()=>{window.__SYGNAL_HMR_UPDATING=!1}),100)}}):"undefined"!=typeof window&&(window.__SYGNAL_HMR_STATE=void 0,window.__SYGNAL_HMR_UPDATING=!1)},y=t=>t?Array.isArray(t)?y(t.find(Boolean)):t.default&&"function"==typeof t.default?t:"function"==typeof t?{default:t}:null:null;return f.hmr=(t,n)=>{const o=y(t)||{default:e};if(void 0!==n)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=n),void m(o,n);const r="undefined"!=typeof window?window.__SYGNAL_HMR_PERSISTED_STATE:void 0;if(void 0!==r)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=r),void m(o,r);const i=f?.sources?.STATE?.stream?._v;if(void 0!==i)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=i),void m(o,i);f?.sinks?.STATE&&"function"==typeof f.sinks.STATE.shamefullySendNext?f.sinks.STATE.shamefullySendNext((t=>("undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=t),m(o,t),Fo))):m(o)},f},t.sampleCombine=In,t.set=function(t){return"function"==typeof t?(e,n,o,r)=>({...e,...t(e,n,o,r)}):e=>({...e,...t})},t.switchable=ho,t.throttle=ci,t.thunk=function(t,e,n,o){return void 0===o&&(o=n,n=e,e=void 0),He(t,{key:e,hook:{init:hn,prepatch:fn},fn:n,args:o})},t.toggle=function(t){return e=>({...e,[t]:!e[t]})},t.xs=lo}));
|
|
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";function e(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(n){if("default"!==n&&!(n in t)){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}))})),Object.freeze(t)}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var r={},i={};!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}}(i);var s,a,c=i,l=Object.prototype.toString,u=function(t){var e=l.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]"===l.call(t.callee)),n};var d=Array.prototype.slice,p=u,h=Object.keys,f=h?function(t){return h(t)}:function(){if(a)return s;var t;if(a=1,!Object.keys){var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,o=u,r=Object.prototype.propertyIsEnumerable,i=!r.call({toString:null},"toString"),c=r.call((function(){}),"prototype"),l=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=function(t){var e=t.constructor;return e&&e.prototype===t},p={$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(!p["$"+t]&&e.call(window,t)&&null!==window[t]&&"object"==typeof window[t])try{d(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();t=function(t){var r=null!==t&&"object"==typeof t,s="[object Function]"===n.call(t),a=o(t),u=r&&"[object String]"===n.call(t),p=[];if(!r&&!s&&!a)throw new TypeError("Object.keys called on a non-object");var f=c&&s;if(u&&t.length>0&&!e.call(t,0))for(var m=0;m<t.length;++m)p.push(String(m));if(a&&t.length>0)for(var y=0;y<t.length;++y)p.push(String(y));else for(var _ in t)f&&"prototype"===_||!e.call(t,_)||p.push(String(_));if(i)for(var v=function(t){if("undefined"==typeof window||!h)return d(t);try{return d(t)}catch(t){return!1}}(t),g=0;g<l.length;++g)v&&"constructor"===l[g]||!e.call(t,l[g])||p.push(l[g]);return p}}return s=t}(),m=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 p(t)?m(d.call(t)):m(t)})}else Object.keys=f;return Object.keys||f};var y,_=f,v="undefined"!=typeof Symbol&&Symbol,g=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 o=Object.getOwnPropertySymbols(t);if(1!==o.length||o[0]!==e)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var r=Object.getOwnPropertyDescriptor(t,e);if(42!==r.value||!0!==r.enumerable)return!1}return!0},b={foo:{}},w=Object,S=Array.prototype.slice,E=Object.prototype.toString,A=function(t){var e=this;if("function"!=typeof e||"[object Function]"!==E.call(e))throw new TypeError("Function.prototype.bind called on incompatible "+e);for(var n,o=S.call(arguments,1),r=Math.max(0,e.length-o.length),i=[],s=0;s<r;s++)i.push("$"+s);if(n=Function("binder","return function ("+i.join(",")+"){ return binder.apply(this,arguments); }")((function(){if(this instanceof n){var r=e.apply(this,o.concat(S.call(arguments)));return Object(r)===r?r:this}return e.apply(t,o.concat(S.call(arguments)))})),e.prototype){var a=function(){};a.prototype=e.prototype,n.prototype=new a,a.prototype=null}return n},O=Function.prototype.bind||A,N=O.call(Function.call,Object.prototype.hasOwnProperty),C=SyntaxError,T=Function,$=TypeError,x=function(t){try{return T('"use strict"; return ('+t+").constructor;")()}catch(t){}},k=Object.getOwnPropertyDescriptor;if(k)try{k({},"")}catch(t){k=null}var L=function(){throw new $},D=k?function(){try{return L}catch(t){try{return k(arguments,"callee").get}catch(t){return L}}}():L,j="function"==typeof v&&"function"==typeof Symbol&&"symbol"==typeof v("foo")&&"symbol"==typeof Symbol("bar")&&g(),I={__proto__:b}.foo===b.foo&&!({__proto__:null}instanceof w),M=Object.getPrototypeOf||(I?function(t){return t.__proto__}:null),P={},R="undefined"!=typeof Uint8Array&&M?M(Uint8Array):y,F={"%AggregateError%":"undefined"==typeof AggregateError?y:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?y:ArrayBuffer,"%ArrayIteratorPrototype%":j&&M?M([][Symbol.iterator]()):y,"%AsyncFromSyncIteratorPrototype%":y,"%AsyncFunction%":P,"%AsyncGenerator%":P,"%AsyncGeneratorFunction%":P,"%AsyncIteratorPrototype%":P,"%Atomics%":"undefined"==typeof Atomics?y:Atomics,"%BigInt%":"undefined"==typeof BigInt?y:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?y:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?y:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?y:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?y:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?y:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?y:FinalizationRegistry,"%Function%":T,"%GeneratorFunction%":P,"%Int8Array%":"undefined"==typeof Int8Array?y:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?y:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?y:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":j&&M?M(M([][Symbol.iterator]())):y,"%JSON%":"object"==typeof JSON?JSON:y,"%Map%":"undefined"==typeof Map?y:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&j&&M?M((new Map)[Symbol.iterator]()):y,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?y:Promise,"%Proxy%":"undefined"==typeof Proxy?y:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?y:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?y:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&j&&M?M((new Set)[Symbol.iterator]()):y,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?y:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":j&&M?M(""[Symbol.iterator]()):y,"%Symbol%":j?Symbol:y,"%SyntaxError%":C,"%ThrowTypeError%":D,"%TypedArray%":R,"%TypeError%":$,"%Uint8Array%":"undefined"==typeof Uint8Array?y:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?y:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?y:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?y:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?y:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?y:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?y:WeakSet};if(M)try{null.error}catch(t){var G=M(M(t));F["%Error.prototype%"]=G}var B=function t(e){var n;if("%AsyncFunction%"===e)n=x("async function () {}");else if("%GeneratorFunction%"===e)n=x("function* () {}");else if("%AsyncGeneratorFunction%"===e)n=x("async function* () {}");else if("%AsyncGenerator%"===e){var o=t("%AsyncGeneratorFunction%");o&&(n=o.prototype)}else if("%AsyncIteratorPrototype%"===e){var r=t("%AsyncGenerator%");r&&M&&(n=M(r.prototype))}return F[e]=n,n},U={"%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"]},V=O,H=N,W=V.call(Function.call,Array.prototype.concat),Y=V.call(Function.apply,Array.prototype.splice),z=V.call(Function.call,String.prototype.replace),q=V.call(Function.call,String.prototype.slice),J=V.call(Function.call,RegExp.prototype.exec),Z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,X=/\\(\\)?/g,K=function(t,e){var n,o=t;if(H(U,o)&&(o="%"+(n=U[o])[0]+"%"),H(F,o)){var r=F[o];if(r===P&&(r=B(o)),void 0===r&&!e)throw new $("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:o,value:r}}throw new C("intrinsic "+t+" does not exist!")},Q=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===J(/^%?[^%]*%?$/,t))throw new C("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(t){var e=q(t,0,1),n=q(t,-1);if("%"===e&&"%"!==n)throw new C("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new C("invalid intrinsic syntax, expected opening `%`");var o=[];return z(t,Z,(function(t,e,n,r){o[o.length]=n?z(r,X,"$1"):e||t})),o}(t),o=n.length>0?n[0]:"",r=K("%"+o+"%",e),i=r.name,s=r.value,a=!1,c=r.alias;c&&(o=c[0],Y(n,W([0,1],c)));for(var l=1,u=!0;l<n.length;l+=1){var d=n[l],p=q(d,0,1),h=q(d,-1);if(('"'===p||"'"===p||"`"===p||'"'===h||"'"===h||"`"===h)&&p!==h)throw new C("property names with quotes must have matching quotes");if("constructor"!==d&&u||(a=!0),H(F,i="%"+(o+="."+d)+"%"))s=F[i];else if(null!=s){if(!(d in s)){if(!e)throw new $("base intrinsic for "+t+" exists, but the property is not available.");return}if(k&&l+1>=n.length){var f=k(s,d);s=(u=!!f)&&"get"in f&&!("originalValue"in f.get)?f.get:s[d]}else u=H(s,d),s=s[d];u&&!a&&(F[i]=s)}}return s},tt=Q("%Object.defineProperty%",!0),et=function(){if(tt)try{return tt({},"a",{value:1}),!0}catch(t){return!1}return!1};et.hasArrayLengthDefineBug=function(){if(!et())return null;try{return 1!==tt([],"length",{value:1}).length}catch(t){return!0}};var nt=et,ot=_,rt="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),it=Object.prototype.toString,st=Array.prototype.concat,at=Object.defineProperty,ct=nt(),lt=at&&ct,ut=function(t,e,n,o){if(e in t)if(!0===o){if(t[e]===n)return}else if("function"!=typeof(r=o)||"[object Function]"!==it.call(r)||!o())return;var r;lt?at(t,e,{configurable:!0,enumerable:!1,value:n,writable:!0}):t[e]=n},dt=function(t,e){var n=arguments.length>2?arguments[2]:{},o=ot(e);rt&&(o=st.call(o,Object.getOwnPropertySymbols(e)));for(var r=0;r<o.length;r+=1)ut(t,o[r],e[o[r]],n[o[r]])};dt.supportsDescriptors=!!lt;var pt=n,ht=function(){return"object"==typeof n&&n&&n.Math===Math&&n.Array===Array?n:pt},ft=dt,mt=ht,yt=dt,_t=n,vt=ht,gt=function(){var t=mt();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},bt=vt(),wt=function(){return bt};yt(wt,{getPolyfill:vt,implementation:_t,shim:gt});var St,Et=wt,At=n&&n.__extends||(St=function(t,e){return St=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])},St(t,e)},function(t,e){function n(){this.constructor=t}St(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(r,"__esModule",{value:!0});var Ot=r.NO_IL=r.NO=r.MemoryStream=re=r.Stream=void 0,Nt=c.default(Et.getPolyfill()),Ct={},Tt=r.NO=Ct;function $t(){}function xt(t){for(var e=t.length,n=Array(e),o=0;o<e;++o)n[o]=t[o];return n}function kt(t,e,n){try{return t.f(e)}catch(t){return n._e(t),Ct}}var Lt={_n:$t,_e:$t,_c:$t};function Dt(t){t._start=function(t){t.next=t._n,t.error=t._e,t.complete=t._c,this.start(t)},t._stop=t.stop}Ot=r.NO_IL=Lt;var jt=function(){function t(t,e){this._stream=t,this._listener=e}return t.prototype.unsubscribe=function(){this._stream._remove(this._listener)},t}(),It=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 It(t)),this.active||this._sub.unsubscribe()},t.prototype._stop=function(){this._sub&&this._sub.unsubscribe(),this.active=!1},t}(),Pt=function(){function t(t){this.type="merge",this.insArr=t,this.out=Ct,this.ac=0}return t.prototype._start=function(t){this.out=t;var e=this.insArr,n=e.length;this.ac=n;for(var o=0;o<n;o++)e[o]._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=Ct},t.prototype._n=function(t){var e=this.out;e!==Ct&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){if(--this.ac<=0){var t=this.out;if(t===Ct)return;t._c()}},t}(),Rt=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!==Ct&&e.up(t,this.i)){var o=xt(e.vals);n._n(o)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.p;t.out!==Ct&&0==--t.Nc&&t.out._c()},t}(),Ft=function(){function t(t){this.type="combine",this.insArr=t,this.out=Ct,this.ils=[],this.Nc=this.Nn=0,this.vals=[]}return t.prototype.up=function(t,e){var n=this.vals[e],o=this.Nn?n===Ct?--this.Nn:this.Nn:0;return this.vals[e]=t,0===o},t.prototype._start=function(t){this.out=t;var e=this.insArr,n=this.Nc=this.Nn=e.length,o=this.vals=new Array(n);if(0===n)t._n([]),t._c();else for(var r=0;r<n;r++)o[r]=Ct,e[r]._add(new Rt(r,t,this))},t.prototype._stop=function(){for(var t=this.insArr,e=t.length,n=this.ils,o=0;o<e;o++)t[o]._remove(n[o]);this.out=Ct,this.ils=[],this.vals=[]},t}(),Gt=function(){function t(t){this.type="fromArray",this.a=t}return t.prototype._start=function(t){for(var e=this.a,n=0,o=e.length;n<o;n++)t._n(e[n]);t._c()},t.prototype._stop=function(){},t}(),Bt=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($t,(function(t){setTimeout((function(){throw t}))}))},t.prototype._stop=function(){this.on=!1},t}(),Ut=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}(),Vt=function(){function t(t,e){this.type="debug",this.ins=t,this.out=Ct,this.s=$t,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=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=this.s,o=this.l;if(n!==$t)try{n(t)}catch(t){e._e(t)}else o?console.log(o+":",t):console.log(t);e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),Ht=function(){function t(t,e){this.type="drop",this.ins=e,this.out=Ct,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=Ct},t.prototype._n=function(t){var e=this.out;e!==Ct&&this.dropped++>=this.max&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&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}(),Yt=function(){function t(t,e){this.type="endWhen",this.ins=e,this.out=Ct,this.o=t,this.oil=Lt}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=Ct,this.oil=Lt},t.prototype.end=function(){var t=this.out;t!==Ct&&t._c()},t.prototype._n=function(t){var e=this.out;e!==Ct&&e._n(t)},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){this.end()},t}(),zt=function(){function t(t,e){this.type="filter",this.ins=e,this.out=Ct,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=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=kt(this,t,e);n!==Ct&&n&&e._n(t)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),qt=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=Ct,this.op.less()},t}(),Jt=function(){function t(t){this.type="flatten",this.ins=t,this.out=Ct,this.open=!0,this.inner=Ct,this.il=Lt}return t.prototype._start=function(t){this.out=t,this.open=!0,this.inner=Ct,this.il=Lt,this.ins._add(this)},t.prototype._stop=function(){this.ins._remove(this),this.inner!==Ct&&this.inner._remove(this.il),this.out=Ct,this.open=!0,this.inner=Ct,this.il=Lt},t.prototype.less=function(){var t=this.out;t!==Ct&&(this.open||this.inner!==Ct||t._c())},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=this.inner,o=this.il;n!==Ct&&o!==Lt&&n._remove(o),(this.inner=t)._add(this.il=new qt(e,this))}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){this.open=!1,this.less()},t}(),Zt=function(){function t(t,e,n){var o=this;this.type="fold",this.ins=n,this.out=Ct,this.f=function(e){return t(o.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=Ct,this.acc=this.seed},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=kt(this,t,e);n!==Ct&&e._n(this.acc=n)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),Xt=function(){function t(t){this.type="last",this.ins=t,this.out=Ct,this.has=!1,this.val=Ct}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=Ct,this.val=Ct},t.prototype._n=function(t){this.has=!0,this.val=t},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&(this.has?(t._n(this.val),t._c()):t._e(new Error("last() failed because input stream completed")))},t}(),Kt=function(){function t(t,e){this.type="map",this.ins=e,this.out=Ct,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=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){var n=kt(this,t,e);n!==Ct&&e._n(n)}},t.prototype._e=function(t){var e=this.out;e!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),Qt=function(){function t(t){this.type="remember",this.ins=t,this.out=Ct}return t.prototype._start=function(t){this.out=t,this.ins._add(t)},t.prototype._stop=function(){this.ins._remove(this.out),this.out=Ct},t}(),te=function(){function t(t,e){this.type="replaceError",this.ins=e,this.out=Ct,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=Ct},t.prototype._n=function(t){var e=this.out;e!==Ct&&e._n(t)},t.prototype._e=function(t){var e=this.out;if(e!==Ct)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!==Ct&&t._c()},t}(),ee=function(){function t(t,e){this.type="startWith",this.ins=t,this.out=Ct,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=Ct},t}(),ne=function(){function t(t,e){this.type="take",this.ins=e,this.out=Ct,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=Ct},t.prototype._n=function(t){var e=this.out;if(e!==Ct){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!==Ct&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==Ct&&t._c()},t}(),oe=function(){function t(t){this._prod=t||Ct,this._ils=[],this._stopID=Ct,this._dl=Ct,this._d=!1,this._target=null,this._err=Ct}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 o=xt(e),r=0;r<n;r++)o[r]._n(t)}},t.prototype._e=function(t){if(this._err===Ct){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 o=xt(e),r=0;r<n;r++)o[r]._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=xt(t),o=0;o<e;o++)n[o]._c()}},t.prototype._x=function(){0!==this._ils.length&&(this._prod!==Ct&&this._prod._stop(),this._err=Ct,this._ils=[])},t.prototype._stopNow=function(){this._prod._stop(),this._err=Ct,this._stopID=Ct},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!==Ct)clearTimeout(this._stopID),this._stopID=Ct;else{var o=this._prod;o!==Ct&&o._start(this)}},t.prototype._remove=function(t){var e=this,n=this._target;if(n)return n._remove(t);var o=this._ils,r=o.indexOf(t);r>-1&&(o.splice(r,1),this._prod!==Ct&&o.length<=0?(this._err=Ct,this._stopID=setTimeout((function(){return e._stopNow()}))):1===o.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!==Ct)return this._hasNoSinks(t.out,e.concat(t));if(t._ils){for(var n=0,o=t._ils.length;n<o;n++)if(!this._hasNoSinks(t._ils[n],e.concat(t)))return!1;return!0}return!1},t.prototype.ctor=function(){return this instanceof ie?ie:t},t.prototype.addListener=function(t){t._n=t.next||$t,t._e=t.error||$t,t._c=t.complete||$t,this._add(t)},t.prototype.removeListener=function(t){this._remove(t)},t.prototype.subscribe=function(t){return this.addListener(t),new jt(this,t)},t.prototype[Nt]=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");Dt(e)}return new t(e)},t.createWithMemory=function(t){return t&&Dt(t),new ie(t)},t.never=function(){return new t({_start:$t,_stop:$t})},t.empty=function(){return new t({_start:function(t){t._c()},_stop:$t})},t.throw=function(e){return new t({_start:function(t){t._e(e)},_stop:$t})},t.from=function(e){if("function"==typeof e[Nt])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 Gt(e))},t.fromPromise=function(e){return new t(new Bt(e))},t.fromObservable=function(e){if(void 0!==e.endWhen)return e;var n="function"==typeof e[Nt]?e[Nt]():e;return new t(new Mt(n))},t.periodic=function(e){return new t(new Ut(e))},t.prototype._map=function(t){return new(this.ctor())(new Kt(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,o,r=this._prod;return new t(r instanceof zt?new zt((n=r.f,o=e,function(t){return n(t)&&o(t)}),r.ins):new zt(e,this))},t.prototype.take=function(t){return new(this.ctor())(new ne(t,this))},t.prototype.drop=function(e){return new t(new Ht(e,this))},t.prototype.last=function(){return new t(new Xt(this))},t.prototype.startWith=function(t){return new ie(new ee(this,t))},t.prototype.endWhen=function(t){return new(this.ctor())(new Yt(t,this))},t.prototype.fold=function(t,e){return new ie(new Zt(t,e,this))},t.prototype.replaceError=function(t){return new(this.ctor())(new te(t,this))},t.prototype.flatten=function(){return new t(new Jt(this))},t.prototype.compose=function(t){return t(this)},t.prototype.remember=function(){return new ie(new Qt(this))},t.prototype.debug=function(t){return new(this.ctor())(new Vt(this,t))},t.prototype.imitate=function(t){if(t instanceof ie)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,o=0;o<n;o++)t._add(e[o]);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||$t,t._e=t.error||$t,t._c=t.complete||$t,this._dl=t):(this._d=!1,this._dl=Ct)},t.merge=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Pt(e))},t.combine=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return new t(new Ft(e))},t}(),re=r.Stream=oe,ie=function(t){function e(e){var n=t.call(this,e)||this;return n._has=!1,n}return At(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!==Ct)this._has&&t._n(this._v),clearTimeout(this._stopID),this._stopID=Ct;else if(this._has)t._n(this._v);else{var o=this._prod;o!==Ct&&o._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}(oe),se=r.MemoryStream=ie,ae=oe,ce=r.default=ae,le=e({__proto__:null,get MemoryStream(){return se},get NO(){return Tt},get NO_IL(){return Ot},get Stream(){return re},default:ce},[r]);function ue(t){return function(){let t;return t="undefined"!=typeof window?window:"undefined"!=typeof global?global:this,t.Cyclejs=t.Cyclejs||{},t=t.Cyclejs,t.adaptStream=t.adaptStream||(t=>t),t}().adaptStream(t)}let de=0;function pe(){return"cycle"+ ++de}function he(t,e=pe()){!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);const n="object"==typeof e?pe():"",o="string"==typeof e||"object"==typeof e?e:e.toString();return function(e,...r){const i=function(t,e,n){const o={};return Object.keys(t).forEach((t=>{if("string"==typeof e)return void(o[t]=e);const r=e[t];if(void 0!==r)return void(o[t]=r);const i=e["*"];o[t]=void 0===i?n:i})),o}(e,o,n),s=function(t,e){const n={};for(const o in t){const r=t[o];Object.prototype.hasOwnProperty.call(t,o)&&r&&null!==e[o]&&"function"==typeof r.isolateSource?n[o]=r.isolateSource(r,e[o]):Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o])}return n}(e,i),a=function(t,e,n){const o={};for(const r in e){const i=t[r],s=e[r];Object.prototype.hasOwnProperty.call(e,r)&&i&&null!==n[r]&&"function"==typeof i.isolateSink?o[r]=ue(i.isolateSink(ce.fromObservable(s),n[r])):Object.prototype.hasOwnProperty.call(e,r)&&(o[r]=e[r])}return o}(e,t(s,...r),i);return a}}he.reset=()=>de=0;var fe={};Object.defineProperty(fe,"__esModule",{value:!0});var me=fe.DropRepeatsOperator=void 0,ye=r,_e={},ve=function(){function t(t,e){this.ins=t,this.type="dropRepeats",this.out=null,this.v=_e,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=_e},t.prototype._n=function(t){var e=this.out;if(e){var n=this.v;n!==_e&&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}();me=fe.DropRepeatsOperator=ve;var ge=fe.default=function(t){return void 0===t&&(t=void 0),function(e){return new ye.Stream(new ve(e,t))}},be=e({__proto__:null,get DropRepeatsOperator(){return me},default:ge},[fe]);function we(t){return"string"==typeof t||"number"==typeof t?function(e){return null==e?void 0:e[t]}:t.get}function Se(t){return"string"==typeof t||"number"==typeof t?function(e,n){return Array.isArray(e)?function(t,e,n){if(n===t[e])return t;const o=parseInt(e);return void 0===n?t.filter(((t,e)=>e!==o)):t.map(((t,e)=>e===o?n:t))}(e,t,n):void 0===e?{[t]:n}:{...e,[t]:n}}:t.set}function Ee(t,e){return t.select(e)}function Ae(t,e){const n=we(e),o=Se(e);return t.map((t=>function(e){const r=n(e),i=t(r);return r===i?e:o(e,i)}))}class Oe{constructor(t,e){this.isolateSource=Ee,this.isolateSink=Ae,this._stream=t.filter((t=>void 0!==t)).compose(ge()).remember(),this._name=e,this.stream=ue(this._stream),this._stream._isCycleSource=e}select(t){const e=we(t);return new Oe(this._stream.map(e),this._name)}}class Ne{constructor(t,e,n){this.ins=n,this.out=t,this.p=e}_n(t){this.p;const e=this.out;null!==e&&e._n(t)}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){}}class Ce{constructor(t,e){this.type="pickMerge",this.ins=e,this.out=null,this.sel=t,this.ils=new Map,this.inst=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this);const t=this.ils;t.forEach(((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}_n(t){this.inst=t;const e=t.arr,n=this.ils,o=this.out,r=this.sel,i=e.length;for(let t=0;t<i;++t){const i=e[t],s=i._key,a=ce.fromObservable(i[r]||ce.never());n.has(s)||(n.set(s,new Ne(o,this,a)),a._add(n.get(s)))}n.forEach(((e,o)=>{t.dict.has(o)&&t.dict.get(o)||(e.ins._remove(e),e.ins=null,e.out=null,n.delete(o))}))}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){const t=this.out;null!==t&&t._c()}}class Te{constructor(t,e,n,o){this.key=t,this.out=e,this.p=n,this.val=Tt,this.ins=o}_n(t){this.p;const e=this.out;this.val=t,null!==e&&this.p.up()}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){}}class $e{constructor(t,e){this.type="combine",this.ins=e,this.sel=t,this.out=null,this.ils=new Map,this.inst=null}_start(t){this.out=t,this.ins._add(this)}_stop(){this.ins._remove(this);const t=this.ils;t.forEach((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}up(){const t=this.inst.arr,e=t.length,n=this.ils,o=Array(e);for(let r=0;r<e;++r){const e=t[r]._key;if(!n.has(e))return;const i=n.get(e).val;if(i===Tt)return;o[r]=i}this.out._n(o)}_n(t){this.inst=t;const e=t.arr,n=this.ils,o=this.out,r=this.sel,i=t.dict,s=e.length;let a=!1;if(n.forEach(((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(let t=0;t<s;++t){const i=e[t],s=i._key;if(!i[r])throw new Error("pickCombine found an undefined child sink stream");const a=ce.fromObservable(i[r]);n.has(s)||(n.set(s,new Te(s,o,this,a)),a._add(n.get(s)))}a&&this.up()}else o._n([])}_e(t){const e=this.out;null!==e&&e._e(t)}_c(){const t=this.out;null!==t&&t._c()}}class xe{constructor(t){this._instances$=t}pickMerge(t){return ue(this._instances$.compose(function(t){return function(e){return new re(new Ce(t,e))}}(t)))}pickCombine(t){return ue(this._instances$.compose(function(t){return function(e){return new re(new $e(t,e))}}(t)))}}function ke(t){return{"*":null}}function Le(t,e){return{get(n){if(void 0!==n)for(let o=0,r=n.length;o<r;++o)if(`${t(n[o],o)}`===e)return n[o]},set:(n,o)=>void 0===n?[o]:void 0===o?n.filter(((n,o)=>`${t(n,o)}`!==e)):n.map(((n,r)=>`${t(n,r)}`===e?o:n))}}const De={get:t=>t,set:(t,e)=>e};var je={};Object.defineProperty(je,"__esModule",{value:!0});var Ie=r,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 Pe=je.default=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new Ie.Stream(new Me(t))},Re=e({__proto__:null,default:Pe},[je]);function Fe(t,e="state"){return function(n){const o=ce.create(),r=o.fold(((t,e)=>e(t)),void 0).drop(1),i=n;i[e]=new Oe(r,e);const s=t(i);if(s[e]){Pe(ce.fromObservable(s[e]),ce.never()).subscribe({next:t=>queueMicrotask((()=>o._n(t))),error:t=>queueMicrotask((()=>o._e(t))),complete:()=>queueMicrotask((()=>o._c()))})}return s}}function Ge(t,e,n,o,r){return{sel:t,data:e,children:n,text:o,elm:r,key:void 0===e?void 0:e.key}}const Be=Array.isArray;function Ue(t){return"string"==typeof t||"number"==typeof t||t instanceof String||t instanceof Number}function Ve(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 o=n.data;void 0!==o&&Ve(o,n.children,n.sel)}}function He(t,e,n){let o,r,i,s={};if(void 0!==n?(null!==e&&(s=e),Be(n)?o=n:Ue(n)?r=n.toString():n&&n.sel&&(o=[n])):null!=e&&(Be(e)?o=e:Ue(e)?r=e.toString():e&&e.sel?o=[e]:s=e),void 0!==o)for(i=0;i<o.length;++i)Ue(o[i])&&(o[i]=Ge(void 0,void 0,void 0,o[i],void 0));return!t.startsWith("svg")||3!==t.length&&"."!==t[3]&&"#"!==t[3]||Ve(s,o,t),Ge(t,s,o,r,void 0)}function We(t){if(Ye(t)){for(;t&&Ye(t);){t=ze(t).parent}return null!=t?t:null}return t.parentNode}function Ye(t){return 11===t.nodeType}function ze(t,e){var n,o,r;const i=t;return null!==(n=i.parent)&&void 0!==n||(i.parent=null!=e?e:null),null!==(o=i.firstChildNode)&&void 0!==o||(i.firstChildNode=t.firstChild),null!==(r=i.lastChildNode)&&void 0!==r||(i.lastChildNode=t.lastChild),i}const qe={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 ze(document.createDocumentFragment())},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){if(Ye(t)){let e=t;for(;e&&Ye(e);){e=ze(e).parent}t=null!=e?e:t}Ye(e)&&(e=ze(e,t)),n&&Ye(n)&&(n=ze(n).firstChildNode),t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){Ye(e)&&(e=ze(e,t)),t.appendChild(e)},parentNode:We,nextSibling:function(t){var e;if(Ye(t)){const n=ze(t),o=We(n);if(o&&n.lastChildNode){const t=Array.from(o.childNodes),r=t.indexOf(n.lastChildNode);return null!==(e=t[r+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:Ye},Je=Ge("",{},[],void 0,void 0);function Ze(t,e){var n,o;const r=t.key===e.key,i=(null===(n=t.data)||void 0===n?void 0:n.is)===(null===(o=e.data)||void 0===o?void 0:o.is),s=t.sel===e.sel,a=!(!t.sel&&t.sel===e.sel)||typeof t.text==typeof e.text;return s&&r&&i&&a}function Xe(){throw new Error("The document fragment is not supported on this platform.")}function Ke(t,e,n){var o;const r={};for(let i=e;i<=n;++i){const e=null===(o=t[i])||void 0===o?void 0:o.key;void 0!==e&&(r[e]=i)}return r}const Qe=["create","update","remove","destroy","pre","post"];function tn(t,e,n){const o={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},r=void 0!==e?e:qe;for(const e of Qe)for(const n of t){const t=n[e];void 0!==t&&o[e].push(t)}function i(t,e){return function(){if(0==--e){const e=r.parentNode(t);null!==e&&r.removeChild(e,t)}}}function s(t,e){var i,a,c,l,u;let d;const p=t.data,h=null==p?void 0:p.hook;null===(i=null==h?void 0:h.init)||void 0===i||i.call(h,t);const f=t.children,m=t.sel;if("!"===m)null!==(a=t.text)&&void 0!==a||(t.text=""),t.elm=r.createComment(t.text);else if(""===m)t.elm=r.createTextNode(t.text);else if(void 0!==m){const n=m.indexOf("#"),i=m.indexOf(".",n),a=n>0?n:m.length,l=i>0?i:m.length,u=-1!==n||-1!==i?m.slice(0,Math.min(a,l)):m,y=null==p?void 0:p.ns,_=void 0===y?r.createElement(u,p):r.createElementNS(y,u,p);for(t.elm=_,a<l&&_.setAttribute("id",m.slice(a+1,l)),i>0&&_.setAttribute("class",m.slice(l+1).replace(/\./g," ")),d=0;d<o.create.length;++d)o.create[d](Je,t);if(!Ue(t.text)||Be(f)&&0!==f.length||r.appendChild(_,r.createTextNode(t.text)),Be(f))for(d=0;d<f.length;++d){const t=f[d];null!=t&&r.appendChild(_,s(t,e))}void 0!==h&&(null===(c=h.create)||void 0===c||c.call(h,Je,t),void 0!==h.insert&&e.push(t))}else if((null===(l=null==n?void 0:n.experimental)||void 0===l?void 0:l.fragments)&&t.children){for(t.elm=(null!==(u=r.createDocumentFragment)&&void 0!==u?u:Xe)(),d=0;d<o.create.length;++d)o.create[d](Je,t);for(d=0;d<t.children.length;++d){const n=t.children[d];null!=n&&r.appendChild(t.elm,s(n,e))}}else t.elm=r.createTextNode(t.text);return t.elm}function a(t,e,n,o,i,a){for(;o<=i;++o){const i=n[o];null!=i&&r.insertBefore(t,s(i,a),e)}}function c(t){var e,n;const r=t.data;if(void 0!==r){null===(n=null===(e=null==r?void 0:r.hook)||void 0===e?void 0:e.destroy)||void 0===n||n.call(e,t);for(let e=0;e<o.destroy.length;++e)o.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&&c(n)}}}function l(t,e,n,s){for(var a,u;n<=s;++n){let s;const d=e[n];if(null!=d)if(void 0!==d.sel){c(d),s=o.remove.length+1;const t=i(d.elm,s);for(let e=0;e<o.remove.length;++e)o.remove[e](d,t);const e=null===(u=null===(a=null==d?void 0:d.data)||void 0===a?void 0:a.hook)||void 0===u?void 0:u.remove;void 0!==e?e(d,t):t()}else d.children?(c(d),l(t,d.children,0,d.children.length-1)):r.removeChild(t,d.elm)}}function u(t,e,n){var i,c,d,p,h,f,m,y;const _=null===(i=e.data)||void 0===i?void 0:i.hook;null===(c=null==_?void 0:_.prepatch)||void 0===c||c.call(_,t,e);const v=e.elm=t.elm;if(t===e)return;if(void 0!==e.data||void 0!==e.text&&e.text!==t.text){null!==(d=e.data)&&void 0!==d||(e.data={}),null!==(p=t.data)&&void 0!==p||(t.data={});for(let n=0;n<o.update.length;++n)o.update[n](t,e);null===(m=null===(f=null===(h=e.data)||void 0===h?void 0:h.hook)||void 0===f?void 0:f.update)||void 0===m||m.call(f,t,e)}const g=t.children,b=e.children;void 0===e.text?void 0!==g&&void 0!==b?g!==b&&function(t,e,n,o){let i,c,d,p,h=0,f=0,m=e.length-1,y=e[0],_=e[m],v=n.length-1,g=n[0],b=n[v];for(;h<=m&&f<=v;)null==y?y=e[++h]:null==_?_=e[--m]:null==g?g=n[++f]:null==b?b=n[--v]:Ze(y,g)?(u(y,g,o),y=e[++h],g=n[++f]):Ze(_,b)?(u(_,b,o),_=e[--m],b=n[--v]):Ze(y,b)?(u(y,b,o),r.insertBefore(t,y.elm,r.nextSibling(_.elm)),y=e[++h],b=n[--v]):Ze(_,g)?(u(_,g,o),r.insertBefore(t,_.elm,y.elm),_=e[--m],g=n[++f]):(void 0===i&&(i=Ke(e,h,m)),c=i[g.key],void 0===c?(r.insertBefore(t,s(g,o),y.elm),g=n[++f]):void 0===i[b.key]?(r.insertBefore(t,s(b,o),r.nextSibling(_.elm)),b=n[--v]):(d=e[c],d.sel!==g.sel?r.insertBefore(t,s(g,o),y.elm):(u(d,g,o),e[c]=void 0,r.insertBefore(t,d.elm,y.elm)),g=n[++f]));f<=v&&(p=null==n[v+1]?null:n[v+1].elm,a(t,p,n,f,v,o)),h<=m&&l(t,e,h,m)}(v,g,b,n):void 0!==b?(void 0!==t.text&&r.setTextContent(v,""),a(v,null,b,0,b.length-1,n)):void 0!==g?l(v,g,0,g.length-1):void 0!==t.text&&r.setTextContent(v,""):t.text!==e.text&&(void 0!==g&&l(v,g,0,g.length-1),r.setTextContent(v,e.text)),null===(y=null==_?void 0:_.postpatch)||void 0===y||y.call(_,t,e)}return function(t,e){let n,i,a;const c=[];for(n=0;n<o.pre.length;++n)o.pre[n]();for(!function(t,e){return t.isElement(e)}(r,t)?function(t,e){return t.isDocumentFragment(e)}(r,t)&&(t=Ge(void 0,{},[],void 0,t)):t=function(t){const e=t.id?"#"+t.id:"",n=t.getAttribute("class"),o=n?"."+n.split(" ").join("."):"";return Ge(r.tagName(t).toLowerCase()+e+o,{},[],void 0,t)}(t),Ze(t,e)?u(t,e,c):(i=t.elm,a=r.parentNode(i),s(e,c),null!==a&&(r.insertBefore(a,e.elm,r.nextSibling(i)),l(a,[t],0,0))),n=0;n<c.length;++n)c[n].data.hook.insert(c[n]);for(n=0;n<o.post.length;++n)o.post[n]();return e}}function en(t,e){var n;const o=void 0!==e?e:qe;let r;if(o.isElement(t)){const r=t.id?"#"+t.id:"",s=null===(n=t.getAttribute("class"))||void 0===n?void 0:n.match(/[^\t\r\n\f ]+/g),a=s?"."+s.join("."):"",c=o.tagName(t).toLowerCase()+r+a,l={},u={},d={},p=[];let h,f,m;const y=t.attributes,_=t.childNodes;for(f=0,m=y.length;f<m;f++)h=y[f].nodeName,h.startsWith("data-")?u[(i=h,i.slice(5).replace(/-([a-z])/g,((t,e)=>e.toUpperCase())))]=y[f].nodeValue||"":"id"!==h&&"class"!==h&&(l[h]=y[f].nodeValue);for(f=0,m=_.length;f<m;f++)p.push(en(_[f],e));return Object.keys(l).length>0&&(d.attrs=l),Object.keys(u).length>0&&(d.dataset=u),!c.startsWith("svg")||3!==c.length&&"."!==c[3]&&"#"!==c[3]||Ve(d,p,c),Ge(c,d,p,void 0,t)}return o.isText(t)?(r=o.getTextContent(t),Ge(void 0,void 0,void 0,r,t)):o.isComment(t)?(r=o.getTextContent(t),Ge("!",{},[],r,t)):Ge("",{},[],void 0,t);var i}function nn(t,e){let n,o;const r=e.elm;let i=t.data.class,s=e.data.class;if((i||s)&&i!==s){for(o in i=i||{},s=s||{},i)i[o]&&!Object.prototype.hasOwnProperty.call(s,o)&&r.classList.remove(o);for(o in s)n=s[o],n!==i[o]&&r.classList[n?"add":"remove"](o)}}const on={create:nn,update:nn};function rn(t,e){let n,o,r;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)o=a[n],r=s[n],r===o||"value"===n&&i[n]===o||(i[n]=o)}const sn={create:rn,update:rn};function an(t,e){let n;const o=e.elm;let r=t.data.attrs,i=e.data.attrs;if((r||i)&&r!==i){for(n in r=r||{},i=i||{},i){const t=i[n];r[n]!==t&&(!0===t?o.setAttribute(n,""):!1===t?o.removeAttribute(n):120!==n.charCodeAt(0)?o.setAttribute(n,t):58===n.charCodeAt(3)?o.setAttributeNS("http://www.w3.org/XML/1998/namespace",n,t):58===n.charCodeAt(5)?109===n.charCodeAt(1)?o.setAttributeNS("http://www.w3.org/2000/xmlns/",n,t):o.setAttributeNS("http://www.w3.org/1999/xlink",n,t):o.setAttribute(n,t))}for(n in r)n in i||o.removeAttribute(n)}}const cn={create:an,update:an},ln=/[A-Z]/g;function un(t,e){const n=e.elm;let o,r=t.data.dataset,i=e.data.dataset;if(!r&&!i)return;if(r===i)return;r=r||{},i=i||{};const s=n.dataset;for(o in r)o in i||(s?o in s&&delete s[o]:n.removeAttribute("data-"+o.replace(ln,"-$&").toLowerCase()));for(o in i)r[o]!==i[o]&&(s?s[o]=i[o]:n.setAttribute("data-"+o.replace(ln,"-$&").toLowerCase(),i[o]))}const dn={create:un,update:un};function pn(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 hn(t){const e=t.data;pn(e.fn.apply(void 0,e.args),t)}function fn(t,e){const n=t.data,o=e.data;let r;const i=n.args,s=o.args;for(n.fn===o.fn&&i.length===s.length||pn(o.fn.apply(void 0,s),e),r=0;r<s.length;++r)if(i[r]!==s[r])return void pn(o.fn.apply(void 0,s),e);pn(t,e)}function mn(t,e,n=!1,o=!1,r=!1){let i=null;return re.create({start:function(s){i=o?function(t){_n(t,o),s.next(t)}:function(t){s.next(t)},t.addEventListener(e,i,{capture:n,passive:r})},stop:function(){t.removeEventListener(e,i,n),i=null}})}function yn(t,e){const n=Object.keys(t),o=n.length;for(let r=0;r<o;r++){const o=n[r];if("object"==typeof t[o]&&null!==t[o]&&"object"==typeof e[o]&&null!==e[o]){if(!yn(t[o],e[o]))return!1}else if(t[o]!==e[o])return!1}return!0}function _n(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");yn(e,t)&&t.preventDefault()}}function vn(t){return t.value=function(e){return vn(t.map((t=>{const n=t?.target?.value;return e?e(n):n})))},t.checked=function(e){return vn(t.map((t=>{const n=!!t?.target?.checked;return e?e(n):n})))},t.data=function(e,n){return vn(t.map((t=>{const o=t?.target instanceof Element?t.target.closest(`[data-${e}]`)||t.target:t?.target,r=o?.dataset?.[e];return n?n(r):r})))},t.target=function(e){return vn(t.map((t=>{const n=t?.target;return e?e(n):n})))},t.key=function(e){return vn(t.map((t=>{const n=t?.key;return e?e(n):n})))},t}class gn{constructor(t,e){this._name=t,this._selector=e||null}select(t){return new gn(this._name,t)}elements(){if(this._selector){const t=ue(ce.of(Array.from(document.querySelectorAll(this._selector))));return t._isCycleSource=this._name,t}const t=ue(ce.of([document]));return t._isCycleSource=this._name,t}element(){if(this._selector){const t=ue(ce.of(document.querySelector(this._selector)));return t._isCycleSource=this._name,t}const t=ue(ce.of(document));return t._isCycleSource=this._name,t}events(t,e={},n){let o;if(o=mn(document,t,e.useCapture,e.preventDefault),this._selector){const t=this._selector;o=o.filter((e=>{const n=e.target;return n instanceof Element&&(n.matches(t)||null!==n.closest(t))}))}const r=vn(ue(o));return r._isCycleSource=this._name,r}}class bn{constructor(t){this._name=t}select(t){return this}elements(){const t=ue(ce.of([document.body]));return t._isCycleSource=this._name,t}element(){const t=ue(ce.of(document.body));return t._isCycleSource=this._name,t}events(t,e={},n){let o;o=mn(document.body,t,e.useCapture,e.preventDefault);const r=ue(o);return r._isCycleSource=this._name,r}}function wn(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 Sn(t){let e="";for(let n=t.length-1;n>=0&&"selector"===t[n].type;n--)e=t[n].scope+" "+e;return e.trim()}function En(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n].type!==e[n].type||t[n].scope!==e[n].scope)return!1;return!0}class An{constructor(t,e){this.namespace=t,this.isolateModule=e,this._namespace=t.filter((t=>"selector"!==t.type))}isDirectlyInScope(t){const e=this.isolateModule.getNamespace(t);if(!e)return!1;if(this._namespace.length>e.length||!En(this._namespace,e.slice(0,this._namespace.length)))return!1;for(let t=this._namespace.length;t<e.length;t++)if("total"===e[t].type)return!1;return!0}}class On{constructor(t,e){this.namespace=t,this.isolateModule=e}call(){const t=this.namespace,e=Sn(t),n=new An(t,this.isolateModule),o=this.isolateModule.getElement(t.filter((t=>"selector"!==t.type)));return void 0===o?[]:""===e?[o]:(r=o.querySelectorAll(e),Array.prototype.slice.call(r)).filter(n.isDirectlyInScope,n).concat(o.matches(e)?[o]:[]);var r}}function Nn(t){return{type:(e=t,e.length>1&&("."===e[0]||"#"===e[0])?"sibling":"total"),scope:t};var e}class Cn{constructor(t,e,n=[],o,r,i){var s;this._rootElement$=t,this._sanitation$=e,this._namespace=n,this._isolateModule=o,this._eventDelegator=r,this._name=i,this.isolateSource=(t,e)=>new Cn(t._rootElement$,t._sanitation$,t._namespace.concat(Nn(e)),t._isolateModule,t._eventDelegator,t._name),this.isolateSink=(s=this._namespace,(t,e)=>":root"===e?t:t.map((t=>{if(!t)return t;const n=Nn(e),o={...t,data:{...t.data,isolate:t.data&&Array.isArray(t.data.isolate)?t.data.isolate:s.concat([n])}};return{...o,key:void 0!==o.key?o.key:JSON.stringify(o.data.isolate)}})))}_elements(){if(0===this._namespace.length)return this._rootElement$.map((t=>[t]));{const t=new On(this._namespace,this._isolateModule);return this._rootElement$.map((()=>t.call()))}}elements(){const t=ue(this._elements().remember());return t._isCycleSource=this._name,t}element(){const t=ue(this._elements().filter((t=>t.length>0)).map((t=>t[0])).remember());return t._isCycleSource=this._name,t}get namespace(){return this._namespace}select(t){if("string"!=typeof t)throw new Error("DOM driver's select() expects the argument to be a string as a CSS selector");if("document"===t)return new gn(this._name);if("body"===t)return new bn(this._name);const e=":root"===t?[]:this._namespace.concat({type:"selector",scope:t.trim()});return new Cn(this._rootElement$,this._sanitation$,e,this._isolateModule,this._eventDelegator,this._name)}events(t,e={},n){if("string"!=typeof t)throw new Error("DOM driver's events() expects argument to be a string representing the event type to listen for.");const o=vn(ue(this._eventDelegator.addEventListener(t,this._namespace,e,n)));return o._isCycleSource=this._name,o}dispose(){this._sanitation$.shamefullySendNext(null)}}var Tn={},$n=n&&n.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var o=Array(t),r=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,r++)o[r]=i[s];return o};Object.defineProperty(Tn,"__esModule",{value:!0}),Tn.SampleCombineOperator=Tn.SampleCombineListener=void 0;var xn=r,kn={},Ln=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!==kn&&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}();Tn.SampleCombineListener=Ln;var Dn,jn=function(){function t(t,e){this.type="sampleCombine",this.ins=t,this.others=e,this.out=kn,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,o=this.vals=new Array(n),r=0;r<n;r++)o[r]=kn,e[r]._add(new Ln(r,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 o=0;o<e;o++)t[o]._remove(n[o]);this.out=kn,this.vals=[],this.ils=[]},t.prototype._n=function(t){var e=this.out;e!==kn&&(this.Nn>0||e._n($n([t],this.vals)))},t.prototype._e=function(t){var e=this.out;e!==kn&&e._e(t)},t.prototype._c=function(){var t=this.out;t!==kn&&t._c()},t.prototype.up=function(t,e){var n=this.vals[e];this.Nn>0&&n===kn&&this.Nn--,this.vals[e]=t},t.prototype.down=function(t,e){this.others[t]._remove(e)},t}();Tn.SampleCombineOperator=jn,Dn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(e){return new xn.Stream(new jn(e,t))}};var In=Tn.default=Dn;function Mn(t){if(!t.sel)return{tagName:"",id:"",className:""};const e=t.sel,n=e.indexOf("#"),o=e.indexOf(".",n),r=n>0?n:e.length,i=o>0?o:e.length;return{tagName:-1!==n||-1!==o?e.slice(0,Math.min(r,i)):e,id:r<i?e.slice(r+1,i):void 0,className:o>0?e.slice(i+1).replace(/\./g," "):void 0}}class Pn{constructor(t){this.rootElement=t}call(t){if(11===this.rootElement.nodeType)return this.wrapDocFrag(null===t?[]:[t]);if(null===t)return this.wrap([]);const{tagName:e,id:n}=Mn(t),o=function(t){let{className:e=""}=Mn(t);if(!t.data)return e;const{class:n,props:o}=t.data;n&&(e+=` ${Object.keys(n).filter((t=>n[t])).join(" ")}`);return o&&o.className&&(e+=` ${o.className}`),e&&e.trim()}(t),r=(t.data||{}).props||{},{id:i=n}=r;return"string"==typeof i&&i.toUpperCase()===this.rootElement.id.toUpperCase()&&e.toUpperCase()===this.rootElement.tagName.toUpperCase()&&o.toUpperCase()===this.rootElement.className.toUpperCase()?t:this.wrap([t])}wrapDocFrag(t){return Ge("",{isolate:[]},t,void 0,this.rootElement)}wrap(t){const{tagName:e,id:n,className:o}=this.rootElement,r=n?`#${n}`:"",i=o?`.${o.split(" ").join(".")}`:"",s=He(`${e.toLowerCase()}${r}${i}`,{},t);return s.data=s.data||{},s.data.isolate=s.data.isolate||[],s}}const Rn="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame&&window.requestAnimationFrame.bind(window)||setTimeout,Fn=t=>{Rn((()=>{Rn(t)}))};let Gn=!1;function Bn(t,e,n){Fn((()=>{t[e]=n}))}function Un(t,e){let n,o;const r=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(o in i)o in s||("-"===o[0]&&"-"===o[1]?r.style.removeProperty(o):r.style[o]="");for(o in s)if(n=s[o],"delayed"===o&&s.delayed)for(const t in s.delayed)n=s.delayed[t],a&&n===i.delayed[t]||Bn(r.style,t,n);else"remove"!==o&&n!==i[o]&&("-"===o[0]&&"-"===o[1]?r.style.setProperty(o,n):r.style[o]=n)}const Vn={pre:function(){Gn=!1},create:Un,update:Un,destroy:function(t){let e,n;const o=t.elm,r=t.data.style;if(r&&(e=r.destroy))for(n in e)o.style[n]=e[n]},remove:function(t,e){const n=t.data.style;if(!n||!n.remove)return void e();let o;Gn||(t.elm.offsetLeft,Gn=!0);const r=t.elm;let i=0;const s=n.remove;let a=0;const c=[];for(o in s)c.push(o),r.style[o]=s[o];const l=getComputedStyle(r)["transition-property"].split(", ");for(;i<l.length;++i)-1!==c.indexOf(l[i])&&a++;r.addEventListener("transitionend",(t=>{t.target===r&&--a,0===a&&e()}))}};let Hn=[];const Wn={create:function(t,e){const n=e.elm;n&&"SELECT"===n.tagName&&void 0!==e.data?.props?.value&&Hn.push({elm:n,value:e.data.props.value})},post:function(){for(let t=0;t<Hn.length;t++){const{elm:e,value:n}=Hn[t];e.value=n}Hn=[]}},Yn=[Vn,on,sn,cn,dn,Wn];class zn{constructor(t){this.mapper=t,this.tree=[void 0,{}]}set(t,e,n){let o=this.tree;const r=void 0!==n?n:t.length;for(let e=0;e<r;e++){const n=this.mapper(t[e]);let r=o[1][n];r||(r=[void 0,{}],o[1][n]=r),o=r}o[0]=e}getDefault(t,e,n){return this.get(t,e,n)}get(t,e,n){let o=this.tree;const r=void 0!==n?n:t.length;for(let n=0;n<r;n++){const r=this.mapper(t[n]);let i=o[1][r];if(!i){if(!e)return;i=[void 0,{}],o[1][r]=i}o=i}return e&&!o[0]&&(o[0]=e()),o[0]}delete(t){let e=this.tree;for(let n=0;n<t.length-1;n++){const o=e[1][this.mapper(t[n])];if(!o)return;e=o}delete e[1][this.mapper(t[t.length-1])]}}class qn{constructor(){this.namespaceTree=new zn((t=>t.scope)),this.namespaceByElement=new Map,this.vnodesBeingRemoved=[]}setEventDelegator(t){this.eventDelegator=t}insertElement(t,e){this.namespaceByElement.set(e,t),this.namespaceTree.set(t,e)}removeElement(t){this.namespaceByElement.delete(t);const e=this.getNamespace(t);e&&this.namespaceTree.delete(e)}getElement(t,e){return this.namespaceTree.get(t,void 0,e)}getRootElement(t){if(this.namespaceByElement.has(t))return t;let e=t;for(;!this.namespaceByElement.has(e);){if(e=e.parentNode,!e)return;if("HTML"===e.tagName)throw new Error("No root element found, this should not happen at all")}return e}getNamespace(t){const e=this.getRootElement(t);if(e)return this.namespaceByElement.get(e)}createModule(){const t=this;return{create(e,n){const{elm:o,data:r={}}=n,i=r.isolate;Array.isArray(i)&&t.insertElement(i,o)},update(e,n){const{elm:o,data:r={}}=e,{elm:i,data:s={}}=n,a=r.isolate,c=s.isolate;En(a,c)||Array.isArray(a)&&t.removeElement(o),Array.isArray(c)&&t.insertElement(c,i)},destroy(e){t.vnodesBeingRemoved.push(e)},remove(e,n){t.vnodesBeingRemoved.push(e),n()},post(){const e=t.vnodesBeingRemoved;for(let n=e.length-1;n>=0;n--){const o=e[n],r=void 0!==o.data?o.data.isolation:void 0;void 0!==r&&t.removeElement(r),t.eventDelegator.removeElement(o.elm,r)}t.vnodesBeingRemoved=[]}}}}class Jn{constructor(){this.arr=[],this.prios=[]}add(t,e){for(let 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)}forEach(t){for(let e=0;e<this.arr.length;e++)t(this.arr[e],e,this.arr)}delete(t){for(let e=0;e<this.arr.length;e++)if(this.arr[e]===t)return this.arr.splice(e,1),void this.prios.splice(e,1)}}const Zn=["blur","focus","mouseenter","mouseleave","pointerenter","pointerleave","gotpointercapture","lostpointercapture","canplay","canplaythrough","durationchange","emptied","ended","loadeddata","loadedmetadata","pause","play","playing","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","load","unload","invalid","reset","submit","formdata","toggle","animationstart","animationend","animationiteration","transitionrun","transitionstart","transitionend","scroll","scrollend"];class Xn{constructor(t,e){this.rootElement$=t,this.isolateModule=e,this.virtualListeners=new zn((t=>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:t=>{this.origin!==t&&(this.origin=t,this.resetEventListeners(),this.domListenersToAdd.forEach(((t,e)=>this.setupDOMListener(e,t))),this.domListenersToAdd.clear()),this.nonBubblingListenersToAdd.forEach((t=>{this.setupNonBubblingListener(t)}))}})}addEventListener(t,e,n,o){const r=ce.never();let i;const s=new An(e,this.isolateModule);if(void 0===o?-1===Zn.indexOf(t):o)return this.domListeners.has(t)||this.setupDOMListener(t,!!n.passive),i=this.insertListener(r,s,t,n),r;{const o=[];this.nonBubblingListenersToAdd.forEach((t=>o.push(t)));let a,c=0;const l=o.length,u=n=>{const[o,r,i,s]=n;return t===r&&En(i.namespace,e)};for(;!a&&c<l;){const t=o[c];a=u(t)?t:a,c++}let d,p=a;if(p){const[t]=p;d=t}else{const o=new On(e,this.isolateModule);i=this.insertListener(r,s,t,n),p=[r,t,o,i],d=r,this.nonBubblingListenersToAdd.add(p),this.setupNonBubblingListener(p)}const h=this;let f=null;return ce.create({start:t=>{f=d.subscribe(t)},stop:()=>{const[t,e,n,o]=p;n.call().forEach((function(t){const n=t.subs;n&&n[e]&&(n[e].unsubscribe(),delete n[e])})),h.nonBubblingListenersToAdd.delete(p),f.unsubscribe()}})}}removeElement(t,e){void 0!==e&&this.virtualListeners.delete(e);const n=[];this.nonBubblingListeners.forEach(((e,o)=>{if(e.has(t)){n.push([o,t]);const e=t.subs;e&&Object.keys(e).forEach((t=>{e[t].unsubscribe()}))}}));for(let t=0;t<n.length;t++){const e=this.nonBubblingListeners.get(n[t][0]);e&&(e.delete(n[t][1]),0===e.size?this.nonBubblingListeners.delete(n[t][0]):this.nonBubblingListeners.set(n[t][0],e))}}insertListener(t,e,n,o){const r=[],i=e._namespace;let s=i.length;do{r.push(this.getVirtualListeners(n,i,!0,s)),s--}while(s>=0&&"total"!==i[s].type);const a={...o,scopeChecker:e,subject:t,bubbles:!!o.bubbles,useCapture:!!o.useCapture,passive:!!o.passive};for(let t=0;t<r.length;t++)r[t].add(a,i.length);return a}getVirtualListeners(t,e,n=!1,o){let r=void 0!==o?o:e.length;if(!n)for(let t=r-1;t>=0;t--){if("total"===e[t].type){r=t+1;break}r=t}const i=this.virtualListeners.getDefault(e,(()=>new Map),r);return i.has(t)||i.set(t,new Jn),i.get(t)}setupDOMListener(t,e){if(this.origin){const n=mn(this.origin,t,!1,!1,e).subscribe({next:n=>this.onEvent(t,n,e),error:()=>{},complete:()=>{}});this.domListeners.set(t,{sub:n,passive:e})}else this.domListenersToAdd.set(t,e)}setupNonBubblingListener(t){const[e,n,o,r]=t;if(!this.origin)return;const i=o.call();if(i.length){const t=this;i.forEach((e=>{const o=e.subs;if(!o||!o[n]){const i=mn(e,n,!1,!1,r.passive).subscribe({next:e=>t.onEvent(n,e,!!r.passive,!1),error:()=>{},complete:()=>{}});t.nonBubblingListeners.has(n)||t.nonBubblingListeners.set(n,new Map);const s=t.nonBubblingListeners.get(n);if(!s)return;s.set(e,{sub:i,destination:r}),e.subs={...o,[n]:i}}}))}}resetEventListeners(){const t=this.domListeners.entries();let e=t.next();for(;!e.done;){const[n,{sub:o,passive:r}]=e.value;o.unsubscribe(),this.setupDOMListener(n,r),e=t.next()}}putNonBubblingListener(t,e,n,o){const r=this.nonBubblingListeners.get(t);if(!r)return;const i=r.get(e);i&&i.destination.passive===o&&i.destination.useCapture===n&&(this.virtualNonBubblingListener[0]=i.destination)}onEvent(t,e,n,o=!0){const r=this.patchEvent(e),i=this.isolateModule.getRootElement(e.target);if(o){const o=this.isolateModule.getNamespace(e.target);if(!o)return;const s=this.getVirtualListeners(t,o);this.bubble(t,e.target,i,r,s,o,o.length-1,!0,n),this.bubble(t,e.target,i,r,s,o,o.length-1,!1,n)}else this.putNonBubblingListener(t,e.target,!0,n),this.doBubbleStep(t,e.target,i,r,this.virtualNonBubblingListener,!0,n),this.putNonBubblingListener(t,e.target,!1,n),this.doBubbleStep(t,e.target,i,r,this.virtualNonBubblingListener,!1,n),e.stopPropagation()}bubble(t,e,n,o,r,i,s,a,c){a||o.propagationHasBeenStopped||this.doBubbleStep(t,e,n,o,r,a,c);let l=n,u=s;if(e===n){if(!(s>=0&&"sibling"===i[s].type))return;l=this.isolateModule.getElement(i,s),u--}e.parentNode&&l&&this.bubble(t,e.parentNode,l,o,r,i,u,a,c),a&&!o.propagationHasBeenStopped&&this.doBubbleStep(t,e,n,o,r,a,c)}doBubbleStep(t,e,n,o,r,i,s){n&&(this.mutateEventCurrentTarget(o,e),r.forEach((t=>{if(t.passive===s&&t.useCapture===i){const r=Sn(t.scopeChecker.namespace);!o.propagationHasBeenStopped&&t.scopeChecker.isDirectlyInScope(e)&&(""!==r&&e.matches(r)||""===r&&e===n)&&(_n(o,t.preventDefault),t.subject.shamefullySendNext(o))}})))}patchEvent(t){const e=t;e.propagationHasBeenStopped=!1;const n=e.stopPropagation;return e.stopPropagation=function(){n.call(this),this.propagationHasBeenStopped=!0},e}mutateEventCurrentTarget(t,e){try{Object.defineProperty(t,"currentTarget",{value:e,configurable:!0})}catch(t){}t.ownerTarget=e}}function Kn(t){return ce.merge(t,ce.never())}function Qn(t){return t.elm}function to(t){(console.error||console.log)(t)}function eo(t,e={}){wn(t);const n=e.modules||Yn;!function(t){if(!Array.isArray(t))throw new Error("Optional modules option must be an array for snabbdom modules")}(n);const o=new qn,r=e&&e.snabbdomOptions||void 0,i=tn([o.createModule()].concat(n),void 0,r),s=ce.create({start(t){"loading"===document.readyState?document.addEventListener("readystatechange",(()=>{const e=document.readyState;"interactive"!==e&&"complete"!==e||(t.next(null),t.complete())})):(t.next(null),t.complete())},stop(){}});let a,c;const l=ce.create({start(t){c=new MutationObserver((()=>t.next(null)))},stop(){c.disconnect()}});return function(n,r="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);const u=ce.create(),d=s.map((()=>{const e=function(t){const 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 a=new Pn(e),e})),p=n.remember();p.addListener({}),l.addListener({});const h=d.map((t=>ce.merge(p.endWhen(u),u).map((t=>a.call(t))).startWith(function(t){return t.data=t.data||{},t.data.isolate=[],t}(en(t))).fold(i,en(t)).drop(1).map(Qn).startWith(t).map((t=>(c.observe(t,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!0,characterDataOldValue:!0}),t))).compose(Kn))).flatten(),f=Pe(s,l).endWhen(u).compose(In(h)).map((t=>t[1])).remember();f.addListener({error:e.reportSnabbdomError||to});const m=new Xn(f,o);return new Cn(f,u,[],o,m,r)}}const no="___";class oo{constructor(t){this._mockConfig=t,t.elements?this._elements=t.elements:this._elements=ue(ce.empty())}elements(){const t=this._elements;return t._isCycleSource="MockedDOM",t}element(){const t=ue(this.elements().filter((t=>t.length>0)).map((t=>t[0])).remember());return t._isCycleSource="MockedDOM",t}events(t,e,n){const o=ue(this._mockConfig[t]||ce.empty());return o._isCycleSource="MockedDOM",o}select(t){const e=this._mockConfig[t]||{};return new oo(e)}isolateSource(t,e){return t.select("."+no+e)}isolateSink(t,e){return ue(ce.fromObservable(t).map((t=>(t.sel&&-1!==t.sel.indexOf(no+e)||(t.sel+=`.${no}${e}`),t))))}}function ro(t){return new oo(t)}let io=0;function so(t,e,n={}){if("function"!=typeof t)throw new Error("collection: first argument (component) must be a function");const{combineList:o=["DOM"],globalList:r=["EVENTS"],stateSourceName:i="STATE",domSourceName:s="DOM",container:a="div",containerClass:c}=n;return n=>{const l="sygnal-collection-"+io++,u={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])=>{if(o.includes(n)){const o=t.pickCombine(n);n===s&&a?e[s]=o.map((t=>({sel:a,data:c?{props:{className:c}}:{},children:t,key:l,text:void 0,elm:void 0}))):e[n]=o}else e[n]=t.pickMerge(n);return e}),{})},d={[i]:e};return r.forEach((t=>d[t]=null)),o.forEach((t=>d[t]=null)),function(t,e,n){return he(function(t){return function(e){const n=t.channel||"state",o=t.itemKey,r=t.itemScope||ke,i=ce.fromObservable(e[n].stream).fold(((i,s)=>{const a=i.dict;if(Array.isArray(s)){const i=Array(s.length),c=new Set;for(let l=0,u=s.length;l<u;++l){const u=`${o?o(s[l],l):l}`;if(c.add(u),a.has(u))i[l]=a.get(u);else{const c=o?Le(o,u):`${l}`,d=r(u),p="string"==typeof d?{"*":d,[n]:c}:{...d,[n]:c},h=he(t.itemFactory?t.itemFactory(s[l],l):t.item,p)(e);a.set(u,h),i[l]=h}i[l]._key=u}return a.forEach(((t,e)=>{c.has(e)||(t&&"function"==typeof t.__dispose&&t.__dispose(),a.delete(e))})),c.clear(),{dict:a,arr:i}}{a.forEach((t=>{t&&"function"==typeof t.__dispose&&t.__dispose()})),a.clear();const i=`${o?o(s,0):"this"}`,c=De,l=r(i),u="string"==typeof l?{"*":l,[n]:c}:{...l,[n]:c},d=he(t.itemFactory?t.itemFactory(s,0):t.item,u)(e);return a.set(i,d),{dict:a,arr:[d]}}}),{dict:new Map,arr:[]});return t.collectSinks(new xe(i))}}(t),e)(n)}(u,d,n)}}const ao=t=>{const{children:e,...n}=t;return He("collection",{props:n},e)};function co(t){return t&&t.default&&t.default.default&&"function"==typeof t.default.default?t.default.default:t&&t.default?t.default:t}ao.label="collection",ao.preventInstantiation=!0;const lo=function(t){const e=co(t);return e&&e.default&&"function"==typeof e.default.create?e.default:e}(le),uo=re||ce&&ce.Stream||lo&&lo.Stream,po=co(be);function ho(t,e,n,o={}){const{switched:r=["DOM"],stateSourceName:i="STATE"}=o,s=typeof e;if(!e)throw new Error("Missing 'name$' parameter for switchable()");if(!("string"===s||"function"===s||e instanceof uo))throw new Error("Invalid 'name$' parameter for switchable(): expects Stream, String, or Function");if(e instanceof uo){const o=e.compose(po()).startWith(n).remember();return e=>fo(t,e,o,r)}{const o="function"===s&&e||(t=>t[e]);return e=>{const s=e&&("string"==typeof i&&e[i]||e.STATE||e.state).stream;if(!(s instanceof uo))throw new Error(`Could not find the state source: ${i}`);const a=s.map(o).filter((t=>"string"==typeof t)).compose(po()).startWith(n).remember();return fo(t,e,a,r,i)}}}function fo(t,e,n,o=["DOM"],r="STATE"){"string"==typeof o&&(o=[o]);const i=Object.entries(t).map((([t,o])=>{if(e[r]){const i=e[r].stream,s=lo.combine(n,i).filter((([e])=>e==t)).map((([,t])=>t)).remember(),a=new e[r].constructor(s,e[r]._name);return[t,o({...e,state:a})]}return[t,o(e)]}));return Object.keys(e).reduce(((t,e)=>{if(o.includes(e))t[e]=n.map((t=>{const n=i.find((([e])=>e===t));return n&&n[1][e]||lo.never()})).flatten().remember().startWith(void 0);else{const n=i.filter((([,t])=>void 0!==t[e])).map((([,t])=>t[e]));t[e]=lo.merge(...n)}return t}),{})}const mo=t=>{const{children:e,...n}=t;return He("switchable",{props:n},e)};function yo(t){return{select:e=>t._stream.filter((t=>t.type===e)).map((t=>t.data))}}mo.label="switchable",mo.preventInstantiation=!0;var _o={};Object.defineProperty(_o,"__esModule",{value:!0});var vo=r,go=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 bo=_o.default=function(t){return function(e){return new vo.Stream(new go(t,e))}},wo=e({__proto__:null,default:bo},[_o]),So={};Object.defineProperty(So,"__esModule",{value:!0});var Eo=r,Ao=function(){function t(t,e){this.dt=t,this.ins=e,this.type="debounce",this.out=null,this.id=null,this.t=Eo.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=Eo.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!=Eo.NO&&t._n(this.t),this.t=Eo.NO,t._c())},t}();var Oo=So.default=function(t){return function(e){return new Eo.Stream(new Ao(t,e))}},No=e({__proto__:null,default:Oo},[So]);const Co=co(wo),To=co(Re),$o=co(No),xo=co(be),ko="undefined"!=typeof window&&window||"undefined"!=typeof process&&process.env||{},Lo="BOOTSTRAP",Do="INITIALIZE",jo="DISPOSE",Io="PARENT",Mo="READY",Po="EFFECT";let Ro=0;const Fo=Symbol.for("sygnal.ABORT");function Go(t){return t===Fo||"symbol"==typeof t&&"sygnal.ABORT"===t.description}function Bo(t,e){if("function"==typeof e)return{fn:e,deps:null};if(Array.isArray(e)&&2===e.length&&Array.isArray(e[0])&&"function"==typeof e[1])return{fn:e[1],deps:e[0]};throw new Error(`Invalid calculated field '${t}': expected a function or [depsArray, function]`)}function Uo(t){const{name:e,sources:n,isolateOpts:o,stateSourceName:r="STATE"}=t;if(n&&!ir(n))throw new Error(`[${e}] Sources must be a Cycle.js sources object`);let i;i="string"==typeof o?{[r]:o}:!0===o?{}:o;const s=void 0===n;let a;if(ir(i)){const e=e=>{const n={...t,sources:e},o=new Vo(n);return o.sinks.__dispose=()=>o.dispose(),o.sinks};a=s?he(e,i):he(e,i)(n)}else if(s)a=e=>{const n=new Vo({...t,sources:e});return n.sinks.__dispose=()=>n.dispose(),n.sinks};else{const e=new Vo(t);e.sinks.__dispose=()=>e.dispose(),a=e.sinks}return a.componentName=e,a.isSygnalComponent=!0,a}class Vo{constructor({name:t="NO NAME",sources:e,intent:n,model:o,hmrActions:r,context:i,response:s,view:a,peers:c={},components:l={},initialState:u,calculated:d,storeCalculatedInState:p=!0,DOMSourceName:h="DOM",stateSourceName:f="STATE",requestSourceName:m="HTTP",isolatedState:y=!1,onError:_,debug:v=!1}){if(!e||!ir(e))throw new Error(`[${t}] Missing or invalid sources`);if(this._componentNumber=Ro++,this.name=t,this.sources=e,this.intent=n,this.model=o,this.hmrActions=r,this.context=i,this.response=s,this.view=a,this.peers=c,this.components=l,this.initialState=u,this.calculated=d,this.storeCalculatedInState=p,this.DOMSourceName=h,this.stateSourceName=f,this.requestSourceName=m,this.sourceNames=Object.keys(e),this.onError=_,this.isolatedState=y,this._debug=v,this.calculated&&this.initialState&&ir(this.calculated)&&ir(this.initialState))for(const e of Object.keys(this.calculated))e in this.initialState&&console.warn(`[${t}] Calculated field '${e}' shadows a key in initialState. The initialState value will be overwritten on every state update.`);if(this.calculated&&ir(this.calculated)){const e=Object.entries(this.calculated);this._calculatedNormalized={};for(const[t,n]of e)this._calculatedNormalized[t]=Bo(t,n);this._calculatedFieldNames=new Set(Object.keys(this._calculatedNormalized));for(const[e,{deps:n}]of Object.entries(this._calculatedNormalized))if(null!==n)for(const o of n)this._calculatedFieldNames.has(o)||!this.initialState||o in this.initialState||console.warn(`[${t}] Calculated field '${e}' declares dependency '${o}' which is not in initialState or calculated fields`);const n={};for(const[t,{deps:e}]of Object.entries(this._calculatedNormalized))n[t]=null===e?[]:e.filter((t=>this._calculatedFieldNames.has(t)));const o={},r={};for(const t of this._calculatedFieldNames)o[t]=0,r[t]=[];for(const[t,e]of Object.entries(n)){o[t]=e.length;for(const n of e)r[n].push(t)}const i=[];for(const[t,e]of Object.entries(o))0===e&&i.push(t);const s=[];for(;i.length>0;){const t=i.shift();s.push(t);for(const e of r[t])o[e]--,0===o[e]&&i.push(e)}if(s.length!==this._calculatedFieldNames.size){const t=[...this._calculatedFieldNames].filter((t=>!s.includes(t))),e=new Set,o=[],r=i=>{if(e.has(i))return o.push(i),!0;e.add(i),o.push(i);for(const e of n[i])if(t.includes(e)&&r(e))return!0;return o.pop(),e.delete(i),!1};r(t[0]);const i=o[o.length-1],a=o.slice(o.indexOf(i));throw new Error(`Circular calculated dependency: ${a.join(" → ")}`)}this._calculatedOrder=s.map((t=>[t,this._calculatedNormalized[t]])),this._calculatedFieldCache={};for(const[t,{deps:e}]of this._calculatedOrder)null!==e&&(this._calculatedFieldCache[t]={lastDepValues:void 0,lastResult:void 0})}else this._calculatedOrder=null,this._calculatedNormalized=null,this._calculatedFieldNames=null,this._calculatedFieldCache=null;this.isSubComponent=this.sourceNames.includes("props$");const g=e[f]&&e[f].stream;this.currentSlots={},g&&(this.currentState=u||{},this.sources[f]=new Oe(g.map((t=>(this.currentState=t,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onStateChanged(this._componentNumber,this.name,t),t))),f));const b=e.props$;b&&(this.sources.props$=b.map((t=>{const{sygnalFactory:e,sygnalOptions:n,...o}=t;return this.currentProps=o,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onPropsChanged(this._componentNumber,this.name,o),t})));const w=e.children$;var S;if(w&&(this.sources.children$=w.map((t=>{if(Array.isArray(t)){const{slots:e,defaultChildren:n}=lr(t);this.currentSlots=e,this.currentChildren=n}else this.currentSlots={},this.currentChildren=t;return t}))),this.sources[h]&&(this.sources[h]=(S=this.sources[h],new Proxy(S,{get:(t,e,n)=>"symbol"==typeof e||e in t?Reflect.get(t,e,n):n=>t.select(n).events(e)}))),this.isSubComponent||void 0!==this.intent||void 0!==this.model||(this.initialState=u||!0,this.intent=t=>({__NOOP_ACTION__:lo.never()}),this.model={__NOOP_ACTION__:t=>t}),this._subscriptions=[],this._activeSubComponents=new Map,this._childReadyState={},this._readyChangedListener=null,this._readyChanged$=lo.create({start:t=>{this._readyChangedListener=t},stop:()=>{}}),this._disposeListener=null,this._dispose$=lo.create({start:t=>{this._disposeListener=t},stop:()=>{}}),this.sources.dispose$=this._dispose$,this.addCalculated=this.createMemoizedAddCalculated(),this.log=function(t){return function(e,n=!1){const o="function"==typeof e?e:t=>e;if(!n)return e=>e.debug((e=>{if(this.debug){const n=`[${t}] ${o(e)}`;console.log(n),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onDebugLog(this._componentNumber,n)}}));if(this.debug){const n=`[${t}] ${o(e)}`;console.log(n),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onDebugLog(this._componentNumber,n)}}}(`${this._componentNumber} | ${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._componentNumber,this.log("Instantiated",!0),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__){window.__SYGNAL_DEVTOOLS__.onComponentCreated(this._componentNumber,t,this);const n=e?.__parentComponentNumber;"number"==typeof n&&window.__SYGNAL_DEVTOOLS__.onSubComponentRegistered(n,this._componentNumber)}}dispose(){"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onComponentDisposed(this._componentNumber,this.name);if(this.model&&(this.model[jo]||Object.keys(this.model).some((t=>t.includes("|")&&t.split("|")[0].trim()===jo)))&&this.action$&&"function"==typeof this.action$.shamefullySendNext)try{this.action$.shamefullySendNext({type:jo})}catch(t){}if(this._disposeListener){try{this._disposeListener.next(!0),this._disposeListener.complete()}catch(t){}this._disposeListener=null}setTimeout((()=>{if(this.action$&&"function"==typeof this.action$.shamefullySendComplete)try{this.action$.shamefullySendComplete()}catch(t){}if(this.vdom$&&"function"==typeof this.vdom$.shamefullySendComplete)try{this.vdom$.shamefullySendComplete()}catch(t){}for(const t of this._subscriptions)if(t&&"function"==typeof t.unsubscribe)try{t.unsubscribe()}catch(t){}this._subscriptions=[],this._activeSubComponents.forEach((t=>{t?.sink$?.__dispose&&t.sink$.__dispose()})),this._activeSubComponents.clear()}),0)}get debug(){return this._debug||"true"===ko.SYGNAL_DEBUG||!0===ko.SYGNAL_DEBUG}initIntent$(){if(this.intent){if("function"!=typeof this.intent)throw new Error(`[${this.name}] Intent must be a function`);if(this.intent$=this.intent(this.sources),!(this.intent$ instanceof uo||ir(this.intent$)))throw new Error(`[${this.name}] 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$=lo.fromArray(this.hmrActions.map((t=>({type:t}))))}else this.hmrAction$=lo.of().filter((t=>!1))}initAction$(){const t=this.sources&&this.sources[this.requestSourceName]||null;if(!this.intent$)return void(this.action$=lo.never());let e;if(this.intent$ instanceof uo)e=this.intent$;else{for(const t of Object.keys(this.intent$))if(t.includes("|"))throw new Error(`[${this.name}] Intent action name '${t}' contains '|', which is reserved for the model shorthand syntax (e.g., 'ACTION | DRIVER'). Rename this action.`);const t=Object.entries(this.intent$).map((([t,e])=>e.map((e=>({type:t,data:e})))));e=lo.merge(lo.never(),...t)}const n=e instanceof uo?e:e.apply&&e(this.sources)||lo.never(),o=lo.of({type:Lo}).compose(Co(10)),r="undefined"!=typeof window&&!0===window.__SYGNAL_HMR_UPDATING,i=r?this.hmrAction$:lo.of().filter((t=>!1)),s=this.model[Lo]&&!r?To(o,n):To(lo.of().compose(Co(1)).filter((t=>!1)),i,n);let a;a=!r&&t&&"function"==typeof t.select?t.select("initial").flatten():lo.never();const c=a.map((t=>({type:"HYDRATE",data:t})));this.action$=lo.merge(s,c).compose(this.log((({type:t})=>`<${t}> Action triggered`))).map((t=>("undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onActionDispatched(this._componentNumber,this.name,t.type,t.data),t)))}initState(){void 0!==this.model&&(void 0===this.model[Do]?this.model[Do]={[this.stateSourceName]:(t,e)=>({...this.addCalculated(e)})}:ir(this.model[Do])&&Object.keys(this.model[Do]).forEach((t=>{t!==this.stateSourceName&&(console.warn(`${Do} can only be used with the ${this.stateSourceName} source... disregarding ${t}`),delete this.model[Do][t])})))}initContext(){if(!this.context&&!this.sources.__parentContext$)return void(this.context$=lo.of({}));const t=this.sources[this.stateSourceName]?.stream.startWith({}).compose(xo(or))||lo.never(),e=this.sources.__parentContext$?.startWith({}).compose(xo(or))||lo.of({});this.context&&!ir(this.context)&&console.error(`[${this.name}] Context must be an object mapping names to values of functions: ignoring provided ${typeof this.context}`),this.context$=lo.combine(t,e).map((([t,e])=>{const n=ir(e)?e:{},o=ir(this.context)?this.context:{},r=this.currentState,i={...n,...Object.entries(o).reduce(((t,e)=>{const[n,o]=e;let i;const s=typeof o;if("string"===s)i=r[o];else if("boolean"===s)i=r[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=o(r)}return t[n]=i,t}),{})};return this.currentContext=i,"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onContextChanged(this._componentNumber,this.name,i),i})).compose(xo(or)).startWith({}),this._subscriptions.push(this.context$.subscribe({next:t=>t,error:t=>console.error(`[${this.name}] Error in context stream:`,t)}))}initModel$(){if(void 0===this.model)return void(this.model$=this.sourceNames.reduce(((t,e)=>(t[e]=lo.never(),t)),{}));const t=ko?.__SYGNAL_HMR_STATE,e=void 0!==t?t:this.initialState,n={type:Do,data:e};this.isSubComponent&&this.initialState&&!this.isolatedState&&console.warn(`[${this.name}] Initial state provided to sub-component. This will overwrite any state provided by the parent component.`);const o=void 0!==e&&(!0!==ko?.__SYGNAL_HMR_UPDATING||void 0!==t)?To(lo.of(n),this.action$).compose(Co(0)):this.action$,r=()=>this.makeOnAction(o,!0,this.action$),i=()=>this.makeOnAction(this.action$,!1,this.action$),s=Object.entries(this.model),a={},c=new Set;s.forEach((t=>{let[e,n]=t;if(e.includes("|")){const t=e.split("|").map((t=>t.trim()));if(2!==t.length||!t[0]||!t[1])throw new Error(`[${this.name}] Invalid shorthand model entry '${e}'. Expected 'ACTION | DRIVER' format.`);e=t[0],n={[t[1]]:n}}if("function"==typeof n&&(n={[this.stateSourceName]:n}),!ir(n))throw new Error(`[${this.name}] Entry for each action must be an object: ${e}`);Object.entries(n).forEach((t=>{const[n,o]=t,s=`${e}::${n}`;if(c.has(s)&&console.warn(`[${this.name}] Duplicate model entry for action '${e}' on sink '${n}'. Only the last definition will take effect.`),c.add(s),n===Po){const t=this.makeEffectHandler(this.action$,e,o);return void(Array.isArray(a[n])?a[n].push(t):a[n]=[t])}const l=n===this.stateSourceName,u=n===Io,d=l?r():i(),p=(u?d(e,o).map((t=>({name:this.name,component:this.view,value:t}))):d(e,o)).compose(this.log((t=>{if(l)return`<${e}> State reducer added`;if(u)return`<${e}> Data sent to parent component: ${JSON.stringify(t.value).replaceAll('"',"")}`;{const o=t&&(t.type||t.command||t.name||t.key||Array.isArray(t)&&"Array"||t);return`<${e}> Data sent to [${n}]: ${JSON.stringify(o).replaceAll('"',"")}`}})));Array.isArray(a[n])?a[n].push(p):a[n]=[p]}))}));const l=Object.entries(a).reduce(((t,e)=>{const[n,o]=e;return t[n]=lo.merge(lo.never(),...o),t}),{});this.model$=l}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 o=n(this.sources);return this.sourceNames.forEach((n=>{n==this.DOMSourceName?t[n][e]=o[n]:t[n].push(o[n])})),t}),t)}initChildSources$(){let t;const e=lo.create({start:e=>{t=e.next.bind(e)},stop:t=>{}}).map((t=>lo.merge(...t))).flatten();this.sources.CHILD={select:t=>{const n=e;return("function"==typeof t?n.filter((e=>e.component===t)):t?n.filter((e=>e.name===t)):n).map((t=>t.value))}},this.newChildSources=e=>{"function"==typeof t&&t(e)}}initSubComponentSink$(){const t=lo.create({start:t=>{this.newSubComponentSinks=t.next.bind(t)},stop:t=>{}});this._subscriptions.push(t.subscribe({next:t=>t,error:t=>console.error(`[${this.name}] Error in sub-component sink stream:`,t)})),this.subComponentSink$=t.filter((t=>Object.keys(t).length>0))}initSubComponentsRendered$(){const t=lo.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$=lo.of(null));const t=this.collectRenderParameters();this.vdom$=t.map((t=>{const{props:e,state:n,children:o,slots:r,context:i,...s}=t,{sygnalFactory:a,sygnalOptions:c,...l}=e||{};try{return this.view({...l,state:n,children:o,slots:r||{},context:i,peers:s},n,i,s)}catch(t){const e=t instanceof Error?t:new Error(String(t));if(console.error(`[${this.name}] Error in view:`,e),"function"==typeof this.onError)try{return this.onError(e,{componentName:this.name})}catch(t){console.error(`[${this.name}] Error in onError handler:`,t)}return{sel:"div",data:{attrs:{"data-sygnal-error":this.name}},children:[]}}})).compose(this.log("View rendered")).map((t=>t||{sel:"div",data:{},children:[]})).map((t=>Qo(t,this))).map(Zo).map(Xo).map(Ko).compose(this.instantiateSubComponents.bind(this)).filter((t=>void 0!==t)).compose(this.renderVdom.bind(this))}initSinks(){if(this.sinks=this.sourceNames.reduce(((t,e)=>{if(e==this.DOMSourceName)return t;const n=this.subComponentSink$&&e!==Io?this.subComponentSink$.map((t=>t[e])).filter((t=>!!t)).flatten():lo.never();if(e===this.stateSourceName?t[e]=lo.merge(this.model$[e]||lo.never(),n,this.sources[this.stateSourceName].stream.filter((t=>!1)),...this.peers$[e]||[]):t[e]=lo.merge(this.model$[e]||lo.never(),n,...this.peers$[e]||[]),"EVENTS"===e&&t[e]){const n=this._componentNumber,o=this.name;t[e]=t[e].map((t=>({...t,__emitterId:n,__emitterName:o})))}return t}),{}),this.sinks[this.DOMSourceName]=this.vdom$,this.sinks[Io]=this.model$[Io]||lo.never(),this.model$[Po]){const t=this.model$[Po].subscribe({next:()=>{},error:t=>console.error(`[${this.name}] Uncaught error in EFFECT stream:`,t)});this._subscriptions.push(t),delete this.sinks[Po]}this.model&&ir(this.model)&&Object.values(this.model).some((t=>!(!ir(t)||!(Mo in t))))?(this.sinks[Mo]=this.model$[Mo],this.sinks[Mo].__explicitReady=!0):this.sinks[Mo]=lo.of(!0)}makeOnAction(t,e=!0,n){return n=n||t,(o,r)=>{const i=t.filter((({type:t})=>t==o));let s;if("function"==typeof r)s=i.map((t=>{const i=(t,e,r=10)=>{if("number"!=typeof r)throw new Error(`[${this.name}] Invalid delay value provided to next() function in model action '${o}'. Must be a number in ms.`);setTimeout((()=>{n.shamefullySendNext({type:t,data:e})}),r),this.log(`<${o}> Triggered a next() action: <${t}> ${r}ms delay`,!0)},s={...this.currentProps,children:this.currentChildren,slots:this.currentSlots||{},context:this.currentContext};let a=t.data;if(e)return t=>{const e=this.isSubComponent?this.currentState:t;try{const t=this.addCalculated(e);s.state=t;const n=r(t,a,i,s);return Go(n)?e:this.cleanupCalculated(n)}catch(t){return console.error(`[${this.name}] Error in model reducer '${o}':`,t),e}};try{const t=this.addCalculated(this.currentState);s.state=t;const e=r(t,a,i,s),n=typeof e;if(ir(e)||["string","number","boolean","function"].includes(n))return e;if("undefined"===n)return console.warn(`[${this.name}] 'undefined' value sent to ${o}`),e;throw new Error(`[${this.name}] Invalid reducer type for action '${o}': ${n}`)}catch(t){return console.error(`[${this.name}] Error in model reducer '${o}':`,t),Fo}})).filter((t=>!Go(t)));else if(void 0===r||!0===r)s=i.map((({data:t})=>t));else{const t=r;s=i.mapTo(t)}return s}}makeEffectHandler(t,e,n){return t.filter((({type:t})=>t==e)).map((o=>{if("function"==typeof n){const r=(n,o,r=10)=>{if("number"!=typeof r)throw new Error(`[${this.name}] Invalid delay value provided to next() function in EFFECT handler '${e}'. Must be a number in ms.`);setTimeout((()=>{t.shamefullySendNext({type:n,data:o})}),r),this.log(`<${e}> EFFECT triggered a next() action: <${n}> ${r}ms delay`,!0)};try{const t=this.addCalculated(this.currentState),i={...this.currentProps,children:this.currentChildren,slots:this.currentSlots||{},context:this.currentContext,state:t};void 0!==n(t,o.data,r,i)&&console.warn(`[${this.name}] EFFECT handler '${e}' returned a value. EFFECT handlers are for side effects only — return values are ignored.`)}catch(t){console.error(`[${this.name}] Error in EFFECT handler '${e}':`,t)}}return null})).filter((t=>!1))}createMemoizedAddCalculated(){let t,e;return function(n){if(!this.calculated||!ir(n)||Array.isArray(n))return n;if(n===t)return e;if(!ir(this.calculated))throw new Error(`[${this.name}] 'calculated' parameter must be an object mapping calculated state field names to functions`);const o=this.getCalculatedValues(n);if(!o)return t=n,e=n,n;const r={...n,...o};return t=n,e=r,r}}getCalculatedValues(t){if(!this._calculatedOrder||0===this._calculatedOrder.length)return;const e={...t},n={};for(const[t,{fn:o,deps:r}]of this._calculatedOrder)if(null!==r&&this._calculatedFieldCache){const i=this._calculatedFieldCache[t],s=r.map((t=>e[t]));if(void 0!==i.lastDepValues){let o=!0;for(let t=0;t<s.length;t++)if(s[t]!==i.lastDepValues[t]){o=!1;break}if(o){n[t]=i.lastResult,e[t]=i.lastResult;continue}}try{const r=o(e);i.lastDepValues=s,i.lastResult=r,n[t]=r,e[t]=r}catch(e){console.warn(`Calculated field '${t}' threw an error during calculation: ${e instanceof Error?e.message:e}`)}}else try{const r=o(e);n[t]=r,e[t]=r}catch(e){console.warn(`Calculated field '${t}' threw an error during calculation: ${e instanceof Error?e.message:e}`)}return n}cleanupCalculated(t){if(!t||!ir(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)}),o=n&&n.stream||lo.never();if(e.state=o.compose(xo(or)),this.sources.props$&&(e.props=this.sources.props$.compose(xo(nr))),this.sources.children$){const t=this.sources.children$.map((t=>{if(!Array.isArray(t))return{children:t,slots:{}};const{slots:e,defaultChildren:n}=lr(t);return{children:n,slots:e}}));e.children=t.map((t=>t.children)).compose(xo(or)),e.slots=t.map((t=>t.slots)).compose(xo(or))}this.context$&&(e.context=this.context$.compose(xo(or)));const r=[],i=[];Object.entries(e).forEach((([t,e])=>{r.push(t),i.push(e)}));return lo.combine(...i).compose($o(1)).map((t=>r.reduce(((e,n,o)=>(e[n]=t[o],"state"===n&&(e[this.stateSourceName]=t[o],e.calculated=t[o]&&this.getCalculatedValues(t[o])||{}),e)),{})))}instantiateSubComponents(t){return t.fold(((t,e)=>{const n=Ho(e,Object.keys(this.components)),o=Object.entries(n),r={"::ROOT::":e};if(0===o.length)return this._activeSubComponents.forEach((t=>{t?.sink$?.__dispose&&t.sink$.__dispose()})),this._activeSubComponents.clear(),r;const i={},s=[];let a=0;const c=o.reduce(((e,[n,o])=>{const r=o.data,c=r.props||{},l=o.children||[],u=r.isCollection||!1,d=r.isSwitchable||!1,p=t=>{Object.entries(t).forEach((([t,e])=>{i[t]||(i[t]=[]),t===Io?s.push(e):t!==this.DOMSourceName&&t!==Mo&&i[t].push(e)}))};if(t[n]){const o=t[n];return e[n]=o,o.props$.shamefullySendNext(c),o.children$.shamefullySendNext(l),p(o.sink$),e}const h=lo.create().startWith(c),f=lo.create().startWith(l);let m,y;m=u?this.instantiateCollection.bind(this):d?this.instantiateSwitchable.bind(this):this.instantiateCustomComponent.bind(this),a++;try{y=m(o,h,f)}catch(t){const e=t instanceof Error?t:new Error(String(t));console.error(`[${this.name}] Error instantiating sub-component:`,e);let n={sel:"div",data:{attrs:{"data-sygnal-error":this.name}},children:[]};if("function"==typeof this.onError)try{n=this.onError(e,{componentName:this.name})||n}catch(t){console.error(`[${this.name}] Error in onError handler:`,t)}y={[this.DOMSourceName]:lo.of(n)}}return y[this.DOMSourceName]=y[this.DOMSourceName]?this.makeCoordinatedSubComponentDomSink(y[this.DOMSourceName]):lo.never(),e[n]={sink$:y,props$:h,children$:f},this._activeSubComponents.set(n,e[n]),p(y),e}),r),l=Object.entries(i).reduce(((t,[e,n])=>(0===n.length||(t[e]=1===n.length?n[0]:lo.merge(...n)),t)),{}),u=new Set(Object.keys(c));return this._activeSubComponents.forEach(((t,e)=>{u.has(e)||(t?.sink$?.__dispose&&t.sink$.__dispose(),this._activeSubComponents.delete(e),delete this._childReadyState[e])})),this.newSubComponentSinks(l),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(xo(or)).map((t=>e)).flatten().debug((t=>this.triggerSubComponentsRendered())).remember()}instantiateCollection(t,e,n){const o=t.data.props||{};const r={filter:"function"==typeof o.filter?o.filter:void 0,sort:cr(o.sort)},i=lo.combine(this.sources[this.stateSourceName].stream.startWith(this.currentState),e.startWith(o)).compose($o(1)).map((([t,e])=>(e.filter!==r.filter&&(r.filter="function"==typeof e.filter?e.filter:void 0),e.sort!==r.sort&&(r.sort=cr(e.sort)),ir(t)?this.addCalculated(t):t))),s=new Oe(i,this.stateSourceName),a=o.from,c=o.of,l=o.idfield||"id";let u,d;if("function"==typeof c)if(c.isSygnalComponent)d=c;else{const t=c.componentName||c.label||c.name||"FUNCTION_COMPONENT",e=c,{model:n,intent:o,hmrActions:r,context:i,peers:s,components:a,initialState:l,calculated:u,storeCalculatedInState:p,DOMSourceName:h,stateSourceName:f,onError:m,debug:y}=c;d=Uo({name:t,view:e,model:n,intent:o,hmrActions:r,context:i,peers:s,components:a,initialState:l,calculated:u,storeCalculatedInState:p,DOMSourceName:h,stateSourceName:f,onError:m,debug:y})}else{if(!this.components[c])throw new Error(`[${this.name}] Invalid 'of' property in collection: ${c}`);d=this.components[c]}const p={get:t=>{if(!Array.isArray(t[a]))return[];const e=t[a],n="function"==typeof r.filter?e.filter(r.filter):e;return("function"==typeof r.sort?n.sort(r.sort):n).map(((t,e)=>ir(t)?{...t,[l]:t[l]||e}:{value:t,[l]: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 o of t[a].map(((t,e)=>ir(t)?{...t,[l]:t[l]||e}:{__primitive:!0,value:t,[l]:e})))if("function"!=typeof r.filter||r.filter(o)){const t=e.find((t=>t[l]===o[l]));void 0!==t&&n.push(o.__primitive?t.value:t)}else n.push(o.__primitive?o.value:o);return{...t,[a]:n}}};void 0===a?u={get:t=>!(t instanceof Array)&&t.value&&t.value instanceof Array?t.value:t,set:(t,e)=>e}:"string"==typeof a?ir(this.currentState)?this.currentState&&a in this.currentState||this.calculated&&a in this.calculated?(Array.isArray(this.currentState[a])||console.warn(`[${this.name}] State property '${a}' in collection component is not an array: No components will be instantiated in the collection.`),u=p):(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.`),u=void 0):(Array.isArray(this.currentState[a])||console.warn(`[${this.name}] State property '${a}' in collection component is not an array: No components will be instantiated in the collection.`),u=p):ir(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.`),u=void 0):u={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.`),u=void 0);const h=["of","from","filter","sort","idfield","className"],f=e.map((t=>{if(!t||"object"!=typeof t)return{};const e={};for(const n in t)h.includes(n)||(e[n]=t[n]);return e})),m={...this.sources,[this.stateSourceName]:s,props$:f,children$:n,__parentContext$:this.context$,PARENT:null,__parentComponentNumber:this._componentNumber},y=so(d,u,{container:null})(m);if(!ir(y))throw new Error(`[${this.name}] Invalid sinks returned from component factory of collection element`);if("undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected){const t="function"==typeof c?c.componentName||c.label||c.name||"anonymous":String(c);window.__SYGNAL_DEVTOOLS__.onCollectionMounted(this._componentNumber,this.name,t,"string"==typeof a?a:null)}return y}instantiateSwitchable(t,e,n){const o=t.data.props||{},r=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>ir(t)?this.addCalculated(t):t)),i=new Oe(r,this.stateSourceName),s=o.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):!ir(e)||Array.isArray(e)?{...t,[s]:e}:{...t,[s]:e}}:ir(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 l=o.of;Object.keys(l).forEach((t=>{const e=l[t];if(!e.isSygnalComponent){const n=e.componentName||e.label||e.name||"FUNCTION_COMPONENT",o=e,{model:r,intent:i,hmrActions:s,context:a,peers:c,components:u,initialState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_}=e,v={name:n,view:o,model:r,intent:i,hmrActions:s,context:a,peers:c,components:u,initialState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_};l[t]=Uo(v)}}));const u={...this.sources,[this.stateSourceName]:i,props$:e,children$:n,__parentContext$:this.context$,__parentComponentNumber:this._componentNumber},d=he(ho(l,e.map((t=>t.current)),""),{[this.stateSourceName]:a})(u);if(!ir(d))throw new Error(`[${this.name}] Invalid sinks returned from component factory of switchable element`);return d}instantiateCustomComponent(t,e,n){const o=t.sel,r=t.data.props||{},i=this.sources[this.stateSourceName].stream.startWith(this.currentState).map((t=>ir(t)?this.addCalculated(t):t)),s=new Oe(i,this.stateSourceName),a=r.state;"function"!=typeof r.sygnalFactory&&ir(r.sygnalOptions)&&(r.sygnalFactory=Uo(r.sygnalOptions));const c="sygnal-factory"===o?r.sygnalFactory:this.components[o]||r.sygnalFactory;if(!c){if("sygnal-factory"===o)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: ${o}`)}const l=r.sygnalOptions?.initialState,u=r.sygnalOptions?.isolatedState;if(l&&!u){const t=r.sygnalOptions?.name||o;throw new Error(`[${t}] Sub-component has .initialState but no .isolatedState = true. This will overwrite parent state. If this is intentional, add .isolatedState = true to the component.`)}let d;const p=u?l:void 0,h={get:t=>{const e=t[a];return void 0===e&&p?p:e},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}},f={get:t=>t,set:(t,e)=>e};void 0===a?d=f:"string"==typeof a?d=h:ir(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.`),d=f):d={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.`),d=f);const m={...this.sources,[this.stateSourceName]:s,props$:e,children$:n,__parentContext$:this.context$,__parentComponentNumber:this._componentNumber};for(const t of Object.keys(r)){const e=r[t];if(e&&e.__sygnalCommand){e._targetComponentName=o,m.commands$=yo(e);break}}const y=he(c,{[this.stateSourceName]:d})(m);if(!ir(y)){throw new Error(`Invalid sinks returned from component factory: ${"sygnal-factory"===o?"custom element":o}`)}return y}renderVdom(t){return lo.combine(this.subComponentsRendered$,t,this._readyChanged$.startWith(null)).compose($o(1)).map((([t,e])=>{const n=Object.keys(this.components),o=e["::ROOT::"],r=Object.entries(e).filter((([t])=>"::ROOT::"!==t));if(0===r.length)return lo.of(qo(o));const i=[],s=r.map((([t,e])=>(i.push(t),e.sink$[this.DOMSourceName].startWith(void 0))));if(0===s.length)return lo.of(o);for(const[t,e]of r){if(void 0!==this._childReadyState[t])continue;const n=e.sink$[Mo];if(n){const e=n.__explicitReady;this._childReadyState[t]=!e,n.addListener({next:e=>{const n=this._childReadyState[t];this._childReadyState[t]=!!e,n!==!!e&&(this._readyChangedListener&&setTimeout((()=>{this._readyChangedListener?.next(null)}),0),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onReadyChanged(this._componentNumber,this.name,t,!!e))},error:()=>{},complete:()=>{}})}else this._childReadyState[t]=!0}return lo.combine(...s).compose($o(1)).map((t=>{const e=t.reduce(((t,e,n)=>(t[i[n]]=e,t)),{});return qo(Wo(er(o),e,n,"r",void 0,this._childReadyState))}))})).flatten().filter((t=>!!t)).remember()}}function Ho(t,e,n="r",o){var r;if(!t)return{};if(t.data?.componentsProcessed)return{};"r"===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||ir(t.data?.props?.sygnalOptions),l=t.data&&t.data.props||{};t.data&&t.data.attrs;const u=t.children||[];let d={},p=o;if(c){if(p=Yo(t,n,o),s){if(!l.of)throw new Error("Collection element missing required 'component' property");if("string"!=typeof l.of&&"function"!=typeof l.of)throw new Error(`Invalid 'component' property of collection element: found ${typeof l.of} requires string or component factory function`);if("function"!=typeof l.of&&!e.includes(l.of))throw new Error(`Specified component for collection not found: ${l.of}`);void 0===l.from||"string"==typeof l.from||Array.isArray(l.from)||"function"==typeof l.from.get||console.warn(`No valid array found for collection ${"string"==typeof l.of?l.of:"function component"}: no collection components will be created`,l.from),t.data.isCollection=!0,(r=t.data).props||(r.props={})}else if(a){if(!l.of)throw new Error("Switchable element missing required 'of' property");if(!ir(l.of))throw new Error(`Invalid 'of' property of switchable element: found ${typeof l.of} requires object mapping names to component factories`);if(!Object.values(l.of).every((t=>"function"==typeof t)))throw new Error("One or more components provided to switchable element is not a valid component factory");if(!l.current||"string"!=typeof l.current&&"function"!=typeof l.current)throw new Error(`Missing or invalid 'current' property for switchable element: found '${typeof l.current}' requires string or function`);if(!Object.keys(l.of).includes(l.current))throw new Error(`Component '${l.current}' not found in switchable element`);t.data.isSwitchable=!0}void 0===l.key&&(t.data.props.key=p),d[p]=t}return u.length>0&&u.map(((t,o)=>Ho(t,e,`${n}.${o}`,p))).forEach((t=>{Object.entries(t).forEach((([t,e])=>d[t]=e))})),d}function Wo(t,e,n,o="r",r,i){if(!t)return;if(t.data?.componentsInjected)return t;"r"===o&&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||ir(t.data?.props?.sygnalOptions),c=t?.data?.isCollection;t.data&&t.data.props;const l=t.children||[];let u=r;if(a){u=Yo(t,o,r);let n=e[u];return i&&u&&n&&"object"==typeof n&&n.sel&&(n.data=n.data||{},n.data.attrs=n.data.attrs||{},n.data.attrs["data-sygnal-ready"]=!1!==i[u]?"true":"false"),c?(t.sel="div",t.children=Array.isArray(n)?n:[n],t):n}return l.length>0?(t.children=l.map(((t,r)=>Wo(t,e,n,`${o}.${r}`,u,i))).flat(),t):t}function Yo(t,e,n){const o=t.sel,r="string"==typeof o?o:"functionComponent",i=t.data?.props||{};return`${n?`${n}|`:""}${r}::${i.id&&JSON.stringify(i.id).replaceAll('"',"")||e}`}function zo(t){if(!t||!t.sel)return!1;if("false"===t.data?.attrs?.["data-sygnal-ready"])return!0;if("loading"===t.data?.attrs?.["data-sygnal-lazy"])return!0;if("suspense"===t.sel)return!1;if(Array.isArray(t.children))for(const e of t.children)if(zo(e))return!0;return!1}function qo(t){if(!t||!t.sel)return t;if("suspense"===t.sel){const e=(t.data?.props||{}).fallback,n=t.children||[];return n.some(zo)&&e?"string"==typeof e?{sel:"div",data:{attrs:{"data-sygnal-suspense":"pending"}},children:[{text:e}],text:void 0,elm:void 0,key:void 0}:{sel:"div",data:{attrs:{"data-sygnal-suspense":"pending"}},children:[e],text:void 0,elm:void 0,key:void 0}:1===n.length?qo(n[0]):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:n.map((t=>qo(t))),text:void 0,elm:void 0,key:void 0}}return t.children&&t.children.length>0&&(t.children=t.children.map((t=>qo(t)))),t}const Jo=tn(Yn);function Zo(t){if(!t||!t.sel)return t;if("portal"===t.sel){const e=t.data?.props?.target;return function(t,e){const n=e||[];return{sel:"div",data:{style:{display:"none"},attrs:{"data-sygnal-portal":t},portalChildren:n,hook:{insert:e=>{const o=document.querySelector(t);if(!o)return void console.warn(`[Portal] Target "${t}" not found in DOM`);const r=document.createElement("div");o.appendChild(r),e.data._portalVnode=Jo(r,{sel:"div",data:{},children:n,text:void 0,elm:void 0,key:void 0}),e.data._portalContainer=o},postpatch:(t,e)=>{const n=t.data?._portalVnode,o=t.data?._portalContainer;if(!n||!o)return;const r=e.data?.portalChildren||[];e.data._portalVnode=Jo(n,{sel:"div",data:{},children:r,text:void 0,elm:void 0,key:void 0}),e.data._portalContainer=o},destroy:t=>{const e=t.data?._portalVnode;e&&e.elm&&e.elm.parentNode&&e.elm.parentNode.removeChild(e.elm)}}},children:[],text:void 0,elm:void 0,key:void 0}}(e,t.children||[])}return t.children&&t.children.length>0&&(t.children=t.children.map(Zo)),t}function Xo(t){if(!t||!t.sel)return t;if("transition"===t.sel){const e=t.data?.props||{},n=e.name||"v",o=e.duration,r=(t.children||[])[0];return r&&r.sel?function(t,e,n){const o=t.data?.hook?.insert,r=t.data?.hook?.remove;return t.data=t.data||{},t.data.hook=t.data.hook||{},t.data.hook.insert=t=>{o&&o(t);const r=t.elm;r&&r.classList&&(r.classList.add(`${e}-enter-from`,`${e}-enter-active`),requestAnimationFrame((()=>{requestAnimationFrame((()=>{r.classList.remove(`${e}-enter-from`),r.classList.add(`${e}-enter-to`),tr(r,n,(()=>{r.classList.remove(`${e}-enter-active`,`${e}-enter-to`)}))}))})))},t.data.hook.remove=(t,o)=>{r&&r(t,(()=>{}));const i=t.elm;i&&i.classList?(i.classList.add(`${e}-leave-from`,`${e}-leave-active`),requestAnimationFrame((()=>{requestAnimationFrame((()=>{i.classList.remove(`${e}-leave-from`),i.classList.add(`${e}-leave-to`),tr(i,n,(()=>{i.classList.remove(`${e}-leave-active`,`${e}-leave-to`),o()}))}))}))):o()},t}(Xo(r),n,o):r||t}return t.children&&t.children.length>0&&(t.children=t.children.map(Xo)),t}function Ko(t){if(!t||!t.sel)return t;if("clientonly"===t.sel){const e=t.children||[];return 0===e.length?{sel:"div",data:{},children:[]}:1===e.length?Ko(e[0]):{sel:"div",data:{},children:e.map(Ko),text:void 0,elm:void 0,key:void 0}}return t.children&&t.children.length>0&&(t.children=t.children.map(Ko)),t}function Qo(t,e){if(!t||!t.sel)return t;const n=t.data?.props?.sygnalOptions?.view;if(n&&n.__sygnalLazy)if(n.__sygnalLazyLoaded()){const e=n.__sygnalLazyLoadedComponent;if(e){const n=t.data?.props||{},o=e.componentName||e.label||e.name||"LazyLoaded",{model:r,intent:i,hmrActions:s,context:a,peers:c,components:l,initialState:u,isolatedState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_}=e,v={name:o,view:e,model:r,intent:i,hmrActions:s,context:a,peers:c,components:l,initialState:u,isolatedState:d,calculated:p,storeCalculatedInState:h,DOMSourceName:f,stateSourceName:m,onError:y,debug:_},g={...n};return delete g.sygnalOptions,{sel:o,data:{props:{...g,sygnalOptions:v}},children:t.children||[],text:void 0,elm:void 0,key:void 0}}}else!n.__sygnalLazyReRenderScheduled&&n.__sygnalLazyPromise&&e&&(n.__sygnalLazyReRenderScheduled=!0,n.__sygnalLazyPromise.then((()=>{setTimeout((()=>{const t=e.sources?.[e.stateSourceName];if(t&&t.stream){const n={...e.currentState,__sygnalLazyTick:Date.now()};t.stream.shamefullySendNext(n)}}),0)})));return t.children&&t.children.length>0&&(t.children=t.children.map((t=>Qo(t,e)))),t}function tr(t,e,n){if("number"==typeof e)setTimeout(n,e);else{const e=()=>{t.removeEventListener("transitionend",e),n()};t.addEventListener("transitionend",e)}}function er(t){return void 0===t?t:{...t,children:Array.isArray(t.children)?t.children.map(er):void 0,data:t.data&&{...t.data,componentsInjected:!1}}}function nr(t,e){return or(rr(t),rr(e))}function or(t,e,n=5,o=0){if(o>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 r=0;r<t.length;r++)if(!or(t[r],e[r],n,o+1))return!1;return!0}const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(const s of r){if(!i.includes(s))return!1;if(!or(t[s],e[s],n,o+1))return!1}return!0}function rr(t){if(!ir(t))return t;const{state:e,of:n,from:o,filter:r,...i}=t;return i}function ir(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function sr(t,e,n=!0){const o=n?1:-1;switch(!0){case t>e:return 1*o;case t<e:return-1*o;default:return 0}}function ar(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],[o,r]=n;if(!["string","number"].includes(typeof r))return void console.error("Sort object properties must be a string or number:",t);let i=!0;if("string"==typeof r){if(!["asc","desc"].includes(r.toLowerCase()))return void console.error("Sort object string values must be asc or desc:",t);i="desc"!==r.toLowerCase()}if("number"==typeof r){if(1!==r&&-1!==r)return void console.error("Sort object number values must be 1 or -1:",t);i=1===r}return(t,e)=>sr(t[o],e[o],i)}function cr(t){if(!t)return;const e=typeof t;if("function"===e)return t;if("string"===e){if("asc"===t.toLowerCase()||"desc"===t.toLowerCase()){const e="desc"!==t.toLowerCase();return(t,n)=>sr(t,n,e)}const e=t;return(t,n)=>sr(t[e],n[e],!0)}if(Array.isArray(t)){const e=t.map((t=>"function"==typeof t?t:"string"!=typeof t||["asc","desc"].includes(t.toLowerCase())?ir(t)?ar(t):void 0:(e,n)=>sr(e[t],n[t],!0)));return(t,n)=>e.filter((t=>"function"==typeof t)).reduce(((e,o)=>0!==e?e:o(t,n)),0)}return ir(t)?ar(t):void console.error("Invalid sort option (ignoring):",t)}function lr(t){const e={},n=[];for(const o of t)if(o&&"slot"===o.sel){const t=o.data?.props?.name||"default";e[t]||(e[t]=[]);const n=Array.isArray(o.children)?o.children:o.children?[o.children]:[];e[t].push(...n)}else n.push(o);return n.length>0&&(e.default||(e.default=[]),e.default.push(...n)),{slots:e,defaultChildren:e.default||[]}}const ur=t=>{const{children:e,...n}=t;return He("portal",{props:n},e)};ur.label="portal",ur.preventInstantiation=!0;const dr=t=>{const{children:e,...n}=t;return He("transition",{props:n},e)};dr.label="transition",dr.preventInstantiation=!0;const pr=t=>{const{children:e,...n}=t;return He("suspense",{props:n},e)};pr.label="suspense",pr.preventInstantiation=!0;const hr=t=>{const{children:e,...n}=t;return He("slot",{props:n},e)};function fr(t){return t.data=function(e,n){return fr(t.map((t=>{const o=t?.dataset?.[e]??t?.dropZone?.dataset?.[e]??t?.element?.dataset?.[e];return n?n(o):o})))},t.element=function(e){return fr(t.map((t=>{const n=t?.element??t?.dropZone??null;return e?e(n):n})))},t}function mr(t){return 0===Object.keys(t).length}function yr(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(mr(e))throw new Error("Second argument given to Cycle must be an object with at least one driver function declared as a property.");const 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(mr(t))throw new Error("Argument given to setupReusable must be an object with at least one driver function declared as a property.");const e=function(t){const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=ce.create());return e}(t),n=function(t,e){const n={};for(const o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o](e[o],o),n[o]&&"object"==typeof n[o]&&(n[o]._isCycleSource=o));return n}(t,e),o=function(t){for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e]&&"function"==typeof t[e].shamefullySendNext&&(t[e]=ue(t[e]));return t}(n);function r(t){return function(t,e){const n=Object.keys(t).filter((t=>!!e[t]));let o={};const r={};n.forEach((t=>{o[t]={_n:[],_e:[]},r[t]={next:e=>o[t]._n.push(e),error:e=>o[t]._e.push(e),complete:()=>{}}}));const i=n.map((e=>ce.fromObservable(t[e]).subscribe(r[e])));return n.forEach((t=>{const n=e[t],i=t=>{queueMicrotask((()=>n._n(t)))},s=t=>{queueMicrotask((()=>{(console.error||console.log)(t),n._e(t)}))};o[t]._n.forEach(i),o[t]._e.forEach(s),r[t].next=i,r[t].error=s,r[t]._n=i,r[t]._e=s})),o=null,function(){i.forEach((t=>t.unsubscribe()))}}(t,e)}function i(){!function(t){for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e]&&t[e].dispose&&t[e].dispose()}(o),function(t){Object.keys(t).forEach((e=>t[e]._c()))}(e)}return{sources:o,run:r,dispose:i}}(e),o=t(n.sources);return"undefined"!=typeof window&&(window.Cyclejs=window.Cyclejs||{},window.Cyclejs.sinks=o),{sinks:o,sources:n.sources,run:function(){const t=n.run(o);return function(){t(),n.dispose()}}}}function _r(t){const e=new EventTarget;return t.subscribe({next:t=>{e.dispatchEvent(new CustomEvent("data",{detail:t})),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onBusEvent(t)},error:t=>console.error("[EVENTS driver] Error in sink stream:",t)}),{select:t=>{const n=!t,o=Array.isArray(t)?t:[t];let r;return ue(ce.create({start:t=>{r=({detail:e})=>{const r=e&&e.data||null;(n||o.includes(e.type))&&t.next(r)},e.addEventListener("data",r)},stop:()=>{r&&e.removeEventListener("data",r)}}))}}}function vr(t){t.addListener({next:t=>{console.log(t)},error:t=>{console.error("[LOG driver] Error in sink stream:",t)}})}hr.label="slot",hr.preventInstantiation=!0;class gr{constructor(){this._connected=!1,this._components=new Map,this._stateHistory=[],this._maxHistory=200}get connected(){return this._connected&&"undefined"!=typeof window}init(){"undefined"!=typeof window&&(window.__SYGNAL_DEVTOOLS__=this,window.addEventListener("message",(t=>{t.source===window&&"__SYGNAL_DEVTOOLS_EXTENSION__"===t.data?.source&&this._handleExtensionMessage(t.data)})))}_handleExtensionMessage(t){switch(t.type){case"CONNECT":this._connected=!0,t.payload?.maxHistory&&(this._maxHistory=t.payload.maxHistory),this._sendFullTree();break;case"DISCONNECT":this._connected=!1;break;case"SET_DEBUG":this._setDebug(t.payload);break;case"TIME_TRAVEL":this._timeTravel(t.payload);break;case"SNAPSHOT":this._takeSnapshot();break;case"RESTORE_SNAPSHOT":this._restoreSnapshot(t.payload);break;case"GET_STATE":this._sendComponentState(t.payload.componentId)}}onComponentCreated(t,e,n){const o={id:t,name:e,isSubComponent:n.isSubComponent,hasModel:!!n.model,hasIntent:!!n.intent,hasContext:!!n.context,hasCalculated:!!n.calculated,components:Object.keys(n.components||{}),parentId:null,children:[],debug:n._debug,createdAt:Date.now(),mviGraph:this._extractMviGraph(n),_instanceRef:new WeakRef(n)};this._components.set(t,o),this.connected&&this._post("COMPONENT_CREATED",this._serializeMeta(o))}onStateChanged(t,e,n){if(!this.connected)return;const o={componentId:t,componentName:e,timestamp:Date.now(),state:this._safeClone(n)};this._stateHistory.push(o),this._stateHistory.length>this._maxHistory&&this._stateHistory.shift(),this._post("STATE_CHANGED",{componentId:t,componentName:e,state:o.state})}onActionDispatched(t,e,n,o){this.connected&&this._post("ACTION_DISPATCHED",{componentId:t,componentName:e,actionType:n,data:this._safeClone(o),timestamp:Date.now()})}onSubComponentRegistered(t,e){const n=this._components.get(t),o=this._components.get(e);n&&o&&(o.parentId=t,n.children.includes(e)||n.children.push(e)),this.connected&&this._post("TREE_UPDATED",{parentId:t,childId:e})}onContextChanged(t,e,n){this.connected&&this._post("CONTEXT_CHANGED",{componentId:t,componentName:e,context:this._safeClone(n),contextTrace:this._buildContextTrace(t,n)})}onPropsChanged(t,e,n){this.connected&&this._post("PROPS_CHANGED",{componentId:t,componentName:e,props:this._safeClone(n)})}onBusEvent(t){this.connected&&this._post("BUS_EVENT",{type:t.type,data:this._safeClone(t.data),componentId:t.__emitterId??null,componentName:t.__emitterName??null,timestamp:Date.now()})}onCommandSent(t,e,n,o){this.connected&&this._post("COMMAND_SENT",{type:t,data:this._safeClone(e),targetComponentName:o??null,timestamp:Date.now()})}onReadyChanged(t,e,n,o){this.connected&&this._post("READY_CHANGED",{parentId:t,parentName:e,childKey:n,ready:o,timestamp:Date.now()})}onCollectionMounted(t,e,n,o){const r=this._components.get(t);r&&(r.collection={itemComponent:n,stateField:o}),this.connected&&this._post("COLLECTION_MOUNTED",{parentId:t,parentName:e,itemComponent:n,stateField:o})}onComponentDisposed(t,e){const n=this._components.get(t);n&&(n.disposed=!0,n.disposedAt=Date.now()),this.connected&&this._post("COMPONENT_DISPOSED",{componentId:t,componentName:e,timestamp:Date.now()})}onDebugLog(t,e){this.connected&&this._post("DEBUG_LOG",{componentId:t,message:e,timestamp:Date.now()})}_setDebug({componentId:t,enabled:e}){if(null==t)return"undefined"!=typeof window&&(window.SYGNAL_DEBUG=!!e&&"true"),void this._post("DEBUG_TOGGLED",{global:!0,enabled:e});const n=this._components.get(t);if(n&&n._instanceRef){const o=n._instanceRef.deref();o&&(o._debug=e,n.debug=e,this._post("DEBUG_TOGGLED",{componentId:t,enabled:e}))}}_timeTravel({componentId:t,componentName:e,state:n}){if(null==t||!n)return void console.warn("[Sygnal DevTools] _timeTravel: missing componentId or state",{componentId:t,hasState:!!n});if("undefined"==typeof window)return;const o=this._safeClone(n),r=this._components.get(t);if(r){const n=r._instanceRef?.deref();if(n){const r=n.stateSourceName||"STATE",i=n.sinks?.[r];if(i?.shamefullySendNext)return i.shamefullySendNext((()=>({...o}))),void this._post("TIME_TRAVEL_APPLIED",{componentId:t,componentName:e,state:o});console.warn(`[Sygnal DevTools] _timeTravel: component #${t} (${e}) has no STATE sink with shamefullySendNext. sinkName=${r}, hasSinks=${!!n.sinks}, sinkKeys=${n.sinks?Object.keys(n.sinks).join(","):"none"}`)}else console.warn(`[Sygnal DevTools] _timeTravel: WeakRef for component #${t} (${e}) has been GC'd`)}else console.warn(`[Sygnal DevTools] _timeTravel: no meta for componentId ${t}`);const i=window.__SYGNAL_DEVTOOLS_APP__;i?.sinks?.STATE?.shamefullySendNext?(i.sinks.STATE.shamefullySendNext((()=>({...o}))),this._post("TIME_TRAVEL_APPLIED",{componentId:t,componentName:e,state:o})):console.warn("[Sygnal DevTools] _timeTravel: no fallback root STATE sink available")}_takeSnapshot(){const t=[];for(const[e,n]of this._components){if(n.disposed)continue;const o=n._instanceRef?.deref();null!=o?.currentState&&t.push({componentId:e,componentName:n.name,state:this._safeClone(o.currentState)})}this._post("SNAPSHOT_TAKEN",{entries:t,timestamp:Date.now()})}_restoreSnapshot(t){if(t?.entries)for(const e of t.entries)this._timeTravel(e)}_sendComponentState(t){const e=this._components.get(t);if(e&&e._instanceRef){const n=e._instanceRef.deref();n&&this._post("COMPONENT_STATE",{componentId:t,state:this._safeClone(n.currentState),context:this._safeClone(n.currentContext),contextTrace:this._buildContextTrace(t,n.currentContext),props:this._safeClone(n.currentProps)})}}_buildContextTrace(t,e){if(!e||"object"!=typeof e)return[];const n=[],o=Object.keys(e);for(const e of o){let o=t,r=!1;for(;null!=o;){const t=this._components.get(o);if(!t)break;if(t.mviGraph?.contextProvides?.includes(e)){n.push({field:e,providerId:t.id,providerName:t.name}),r=!0;break}o=t.parentId}r||n.push({field:e,providerId:-1,providerName:"unknown"})}return n}_sendFullTree(){const t=[];for(const[,e]of this._components){const n=e._instanceRef?.deref();t.push({...this._serializeMeta(e),state:n?this._safeClone(n.currentState):null,context:n?this._safeClone(n.currentContext):null})}this._post("FULL_TREE",{components:t,history:this._stateHistory})}_post(t,e){"undefined"!=typeof window&&window.postMessage({source:"__SYGNAL_DEVTOOLS_PAGE__",type:t,payload:e},"*")}_safeClone(t){if(null==t)return t;try{return JSON.parse(JSON.stringify(t))}catch(t){return"[unserializable]"}}_extractMviGraph(t){if(!t.model)return null;try{const e=t.sourceNames?[...t.sourceNames]:[],n=[],o=t.model;for(const e of Object.keys(o)){let r=e,i=o[e];if(e.includes("|")){const t=e.split("|").map((t=>t.trim()));if(2===t.length&&t[0]&&t[1]){r=t[0],n.push({name:r,sinks:[t[1]]});continue}}"function"!=typeof i?i&&"object"==typeof i&&n.push({name:r,sinks:Object.keys(i)}):n.push({name:r,sinks:[t.stateSourceName||"STATE"]})}return{sources:e,actions:n,contextProvides:t.context&&"object"==typeof t.context?Object.keys(t.context):[]}}catch(t){return null}}_serializeMeta(t){const{_instanceRef:e,...n}=t;return n}}let br=null;function wr(){return br||(br=new gr),br}function Sr(t){if(!t)return null;const e=t.default||t;return"function"!=typeof e?null:t.default?t:{default:e}}function Er(t){return/^[a-zA-Z0-9-_]+$/.test(t)}function Ar(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(!Er(e))throw new Error(`${e} is not a valid CSS class name`);return t.push(e),t}),[])}const Or=t=>(t=>"string"==typeof t)(t)||(t=>"number"==typeof t)(t),Nr={svg:1,g:1,defs:1,symbol:1,use:1,circle:1,ellipse:1,line:1,path:1,polygon:1,polyline:1,rect:1,text:1,tspan:1,textPath:1,linearGradient:1,radialGradient:1,stop:1,pattern:1,clipPath:1,mask:1,marker:1,filter:1,feBlend:1,feColorMatrix:1,feComponentTransfer:1,feComposite:1,feConvolveMatrix:1,feDiffuseLighting:1,feDisplacementMap:1,feDropShadow:1,feFlood:1,feGaussianBlur:1,feImage:1,feMerge:1,feMergeNode:1,feMorphology:1,feOffset:1,fePointLight:1,feSpecularLighting:1,feSpotLight:1,feTile:1,feTurbulence:1,feFuncR:1,feFuncG:1,feFuncB:1,feFuncA:1,desc:1,metadata:1,foreignObject:1,switch:1,animate:1,animateMotion:1,animateTransform:1,set:1,mpath:1};var Cr=Object.prototype.hasOwnProperty,Tr=Object.prototype.toString,$r=Object.defineProperty,xr=Object.getOwnPropertyDescriptor,kr=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===Tr.call(t)},Lr=function(t){if(!t||"[object Object]"!==Tr.call(t))return!1;var e,n=Cr.call(t,"constructor"),o=t.constructor&&t.constructor.prototype&&Cr.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!o)return!1;for(e in t);return void 0===e||Cr.call(t,e)},Dr=function(t,e){$r&&"__proto__"===e.name?$r(t,e.name,{enumerable:!0,configurable:!0,value:e.newValue,writable:!0}):t[e.name]=e.newValue},jr=function(t,e){if("__proto__"===e){if(!Cr.call(t,e))return;if(xr)return xr(t,e).value}return t[e]},Ir=function t(){var e,n,o,r,i,s,a=arguments[0],c=1,l=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[1]||{},c=2),(null==a||"object"!=typeof a&&"function"!=typeof a)&&(a={});c<l;++c)if(null!=(e=arguments[c]))for(n in e)o=jr(a,n),a!==(r=jr(e,n))&&(u&&r&&(Lr(r)||(i=kr(r)))?(i?(i=!1,s=o&&kr(o)?o:[]):s=o&&Lr(o)?o:{},Dr(a,{name:n,newValue:t(u,s,r)})):void 0!==r&&Dr(a,{name:n,newValue:r}));return a},Mr=o(Ir);const Pr=(...t)=>Mr(!1,...t),Rr=(t,e,n)=>{let o=n;for(let n=0;n<t.length;n++){const i=t[n];r=i,o=Array.isArray(r)?Rr(i,e,o):e(o,i)}var r;return o},Fr=(t,e)=>Object.keys(t).map((n=>e(n,t[n]))).reduce(((t,e)=>((...t)=>Mr(!0,...t))(t,e)),{}),Gr=(t,e)=>Fr(e,((e,n)=>e!==t?{[e]:n}:{})),Br=t=>Or(t)?{text:t,sel:void 0,data:void 0,children:void 0,elm:void 0,key:void 0}:void 0,Ur=t=>{if(!t||void 0===t.sel)return t;const e=t.data||{},n=e.props||{},o=Gr("className",n),r=void 0!==n.className?{class:n.className}:{},i=Pr({},o,r,e.attrs||{});return Pr(t,{data:Gr("props",Pr({},e,{ns:"http://www.w3.org/2000/svg",attrs:i}))},{children:Array.isArray(t.children)&&"foreignObject"!==t.sel?t.children.map((t=>Ur(t))):t.children})},Vr=t=>t.sel in Nr?Ur(t):t,Hr={for:"attrs",role:"attrs",tabindex:"attrs","aria-*":"attrs",key:null},Wr=(t,e)=>{const{ref:n,...o}=t,r=(t=>{if(!t.props)return t;const{autoFocus:e,autoSelect:n,...o}=t.props;if(!e&&!n)return t;t.props=o,t._autoFocus=!!e,t._autoSelect=!!n;const r=t=>{t&&"function"==typeof t.focus&&requestAnimationFrame((()=>{t.focus(),n&&"function"==typeof t.select&&t.select()}))},i=t.hook?.insert,s=t.hook?.postpatch;return t.hook={...t.hook,insert:t=>{i&&i(t),(e||n)&&r(t.elm)},postpatch:(t,e)=>{s&&s(t,e);const n=t.data?._autoFocus,o=e.data?._autoFocus;!n&&o&&r(e.elm)}},t})(((t,e)=>Fr(t,((t,n)=>{const o={[t]:n};if(Hr[t]&&void 0!==e[Hr[t]])return{[Hr[t]]:o};if(null===Hr[t])return{};const r=Object.keys(Hr);for(let n=0;n<r.length;n++){const i=r[n];if("*"===i.charAt(i.length-1)&&0===t.indexOf(i.slice(0,-1))&&void 0!==e[Hr[i]])return{[Hr[i]]:o}}return void 0!==e[t]?{[e[t]?e[t]:t]:n}:void 0!==e.props?{props:o}:o})))(((t,e)=>Fr(t,((t,n)=>{const o=t.indexOf("-");if(o>-1&&void 0!==e[t.slice(0,o)]){const e={[t.slice(o+1)]:n};return{[t.slice(0,o)]:e}}return{[t]:n}})))(o,e),e));return((t,e)=>{if(!e)return t;const n=t=>{"function"==typeof e?e(t):e&&"object"==typeof e&&"current"in e&&(e.current=t)},o=t.hook?.insert,r=t.hook?.destroy,i=t.hook?.postpatch;return t.hook={...t.hook,insert:t=>{o&&o(t),n(t.elm)},postpatch:(t,e)=>{i&&i(t,e),n(e.elm)},destroy:t=>{r&&r(t),n(null)}},t})(r,n)},Yr=t=>t.length>1||!Or(t[0])?void 0:t[0].toString(),zr=t=>Rr(t,((t,e)=>{const n=(t=>"object"==typeof t&&null!==t)(o=e)&&"sel"in o&&"data"in o&&"children"in o&&"text"in o?e:Br(e);var o;return t.push(n),t}),[]),qr=(t=>(e,n,...o)=>{if(void 0===e&&(e="UNDEFINED",console.error("JSX Error: Capitalized HTML element without corresponding factory function. Components with names where the first letter is capital MUST be defined or included at the parent component's file scope.")),"function"==typeof e){if(e.__sygnalFragment||"Fragment"===e.name)return e(n||{},o);if(n||(n={}),e.isSygnalComponent){const t=e;e=e.componentName||e.label||e.name||"sygnal-factory",n.sygnalFactory=t}else{const r=e.componentName||e.label||e.name||"FUNCTION_COMPONENT",i=e,{model:s,intent:a,hmrActions:c,context:l,peers:u,components:d,initialState:p,isolatedState:h,calculated:f,storeCalculatedInState:m,DOMSourceName:y,stateSourceName:_,onError:v,debug:g,preventInstantiation:b}=e;if(b){const e=Yr(o),i=n?Wr(n,t):{};return Vr({sel:r,data:i,children:void 0!==e?Br(e):zr(o),text:e,elm:void 0,key:n?n.key:void 0})}const w={name:r,view:i,model:s,intent:a,hmrActions:c,context:l,peers:u,components:d,initialState:p,isolatedState:h,calculated:f,storeCalculatedInState:m,DOMSourceName:y,stateSourceName:_,onError:v,debug:g};n.sygnalOptions=w,e=r}}const r=Yr(o);return Vr({sel:e,data:n?Wr(n,t):{},children:void 0!==r?Br(r):zr(o),text:r,elm:void 0,key:n?n.key:void 0})})({attrs:"",props:"",class:"",data:"dataset",style:"",hook:"",on:""});const Jr=lo;function Zr(t,e){const n=(t,n)=>e.dispatchEvent(new CustomEvent("data",{detail:{type:t,data:n}}));t.addEventListener("statechange",(()=>{"installed"===t.state&&n("installed",!0),"activated"===t.state&&n("activated",!0)})),"installed"===t.state&&n("waiting",t),"activated"===t.state&&n("activated",!0)}let Xr;const Kr=Jr.create({start(t){if("undefined"==typeof window)return void t.next(!0);t.next(navigator.onLine);const e=()=>t.next(!0),n=()=>t.next(!1);window.addEventListener("online",e),window.addEventListener("offline",n),Xr=()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n)}},stop(){Xr?.(),Xr=void 0}});const Qr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ti={"&":"&","<":"<",">":">",'"':""","'":"'"};function ei(t){return String(t).replace(/[&<>"']/g,(t=>ti[t]))}function ni(t){return t.replace(/^(Webkit|Moz|Ms|O)/,(t=>"-"+t.toLowerCase())).replace(/([A-Z])/g,"-$1").toLowerCase()}function oi(t,e,n){if(!t)return t;if("string"==typeof t||null!=t.text)return t;const o=t.sel;if(!o&&t.children&&Array.isArray(t.children))return t.children=t.children.map((t=>oi(t,e,n))).filter((t=>null!=t)),t;if("portal"===o){const o=t.children||[];return 0===o.length?null:1===o.length?oi(o[0],e,n):{sel:"div",data:{attrs:{"data-sygnal-portal":""}},children:o.map((t=>oi(t,e,n))),text:void 0,elm:void 0,key:void 0}}if("transition"===o){const o=(t.children||[])[0];return o?oi(o,e,n):null}if("suspense"===o){const o=t.children||[];return 0===o.length?null:1===o.length?oi(o[0],e,n):{sel:"div",data:{attrs:{"data-sygnal-suspense":"resolved"}},children:o.map((t=>oi(t,e,n))),text:void 0,elm:void 0,key:void 0}}if("clientonly"===o){const o=(t.data?.props||{}).fallback;return o?oi(o,e,n):{sel:"div",data:{attrs:{"data-sygnal-clientonly":""}},children:[],text:void 0,elm:void 0,key:void 0}}if("slot"===o){const o=t.children||[];return 0===o.length?null:1===o.length?oi(o[0],e,n):{sel:"div",data:{},children:o.map((t=>oi(t,e,n))),text:void 0,elm:void 0,key:void 0}}const r=t.data?.props||{};return r.sygnalOptions||"function"==typeof r.sygnalFactory?function(t,e,n){const o=t.data?.props||{},{sygnalOptions:r,sygnalFactory:i,...s}=o;let a;if(r)a=r.view,!a.initialState&&r.initialState&&(a=Object.assign(a,{initialState:r.initialState,model:r.model,intent:r.intent,context:r.context,onError:r.onError,calculated:r.calculated}));else if(i&&i.componentName)return{sel:"div",data:{attrs:{"data-sygnal-ssr":t.sel||"component"}},children:t.children||[],text:void 0,elm:void 0,key:void 0};if(!a||"function"!=typeof a)return{sel:"div",data:{attrs:{"data-sygnal-ssr":t.sel||"component"}},children:t.children||[],text:void 0,elm:void 0,key:void 0};let c=a.initialState;const l=s.state;"string"==typeof l&&null!=n&&null!=n[l]?c=n[l]:null!=l&&"string"!=typeof l&&(c=l);const u={...e},d=a.context||{};for(const t of Object.keys(d)){const e=d[t];if("function"==typeof e&&null!=c)try{u[t]=e(c)}catch(t){}}const p={},h=[],f=t.children||[];for(const t of f)if(t&&"slot"===t.sel){const e=t.data?.props?.name||"default";p[e]||(p[e]=[]);const n=t.children||[];p[e].push(...n)}else h.push(t);h.length>0&&(p.default||(p.default=[]),p.default.push(...h));let m;try{m=a({...s,state:c,children:p.default||f,slots:p,context:u,peers:{}},c,u,{})}catch(t){if("function"==typeof a.onError){const e=a.componentName||a.name||"Component";try{m=a.onError(t,{componentName:e})}catch(t){m={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}}else m={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}m||(m={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0});return oi(m,u,c)}(t,e,n):"collection"===o?function(t,e,n){const o=t.data?.props||{},{of:r,from:i,className:s}=o;if(!r||!i||!n)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};const a=n[i];if(!Array.isArray(a))return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};const c=a.map(((t,n)=>{const o={...e},i=r.context||{};for(const e of Object.keys(i)){const n=i[e];if("function"==typeof n)try{o[e]=n(t)}catch(t){}}let s;try{s=r({state:t,children:[],slots:{},context:o,peers:{}},t,o,{})}catch(t){if("function"==typeof r.onError)try{s=r.onError(t,{componentName:r.name||"CollectionItem"})}catch(t){s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}else s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}return oi(s,o,t)})).filter((t=>null!=t)),l={};s&&(l.props={className:s});return{sel:"div",data:l,children:c,text:void 0,elm:void 0,key:void 0}}(t,e,n):"switchable"===o?function(t,e,n){const o=t.data?.props||{},{components:r,active:i,initial:s}=o;if(!r)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};let a;"string"==typeof i&&(r[i]?a=i:n&&"string"==typeof n[i]&&(a=n[i]));!a&&s&&(a=s);a||(a=Object.keys(r)[0]);const c=r[a];if(!c||"function"!=typeof c)return{sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0};return function(t,e,n){const o=void 0!==e?e:t.initialState,r=t.context||{},i={...n};for(const t of Object.keys(r)){const e=r[t];if("function"==typeof e&&null!=o)try{i[t]=e(o)}catch(t){}}let s;try{s=t({state:o,children:[],slots:{},context:i,peers:{}},o,i,{})}catch(e){if("function"==typeof t.onError)try{s=t.onError(e,{componentName:t.name||"Component"})}catch(t){s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}else s={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}s||(s={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0});return oi(s,i,o)}(c,n,e)}(t,e,n):(t.children&&(Array.isArray(t.children)?t.children.length>0&&(t.children=t.children.map((t=>oi(t,e,n))).filter((t=>null!=t))):t.children&&"object"==typeof t.children&&(t.children=oi(t.children,e,n))),t)}function ri(t){if(null==t)return"";if("string"==typeof t)return ei(t);if(null!=t.text&&!t.sel)return ei(String(t.text));const e=t.sel;if(!e)return null!=t.text?ei(String(t.text)):t.children&&Array.isArray(t.children)?t.children.map((t=>ri(t))).join(""):"";const{tag:n,id:o,selectorClasses:r}=function(t){let e=t,n=null;const o=[],r=t.indexOf("#");if(-1!==r){const i=t.slice(r+1),s=i.indexOf(".");if(-1!==s){n=i.slice(0,s),e=t.slice(0,r);const a=i.slice(s+1);a&&o.push(...a.split("."))}else n=i,e=t.slice(0,r)}else{const n=t.indexOf(".");if(-1!==n){e=t.slice(0,n);const r=t.slice(n+1);r&&o.push(...r.split("."))}}e||(e="div");return{tag:e,id:n,selectorClasses:o}}(e),i=function(t,e,n){const o=[],r=[...n];if(t.props)for(const[e,n]of Object.entries(t.props))"className"===e?"string"==typeof n&&n&&r.push(n):"htmlFor"===e?o.push(["for",n]):"innerHTML"===e||"textContent"===e||"sygnalOptions"===e||"sygnalFactory"===e||("boolean"==typeof n?n&&o.push([e,!0]):null!=n&&o.push([e,n]));if(t.attrs)for(const[e,n]of Object.entries(t.attrs))"class"===e?"string"==typeof n&&n&&r.push(n):"boolean"==typeof n?n&&o.push([e,!0]):null!=n&&o.push([e,n]);if(t.class)for(const[e,n]of Object.entries(t.class))n&&r.push(e);if(t.dataset)for(const[e,n]of Object.entries(t.dataset))null!=n&&o.push([`data-${ni(e)}`,n]);e&&o.unshift(["id",e]);if(r.length>0){const t=[...new Set(r)];o.unshift(["class",t.join(" ")])}if(t.style&&"object"==typeof t.style){const e=function(t){const e=[];for(const n of Object.keys(t)){const o=t[n];if(null==o||""===o)continue;if("delayed"===n||"remove"===n||"destroy"===n)continue;const r=ni(n);e.push(`${r}: ${o}`)}return e.join("; ")}(t.style);e&&o.push(["style",e])}return o}(t.data||{},o,r);let s=`<${n}`;for(const[t,e]of i)!0===e?s+=` ${t}`:!1!==e&&null!=e&&(s+=` ${t}="${ei(String(e))}"`);if(s+=">",Qr.has(n))return s;if(null!=t.data?.props?.innerHTML)return s+=String(t.data.props.innerHTML),s+=`</${n}>`,s;if(null!=t.text)s+=ei(String(t.text));else if(t.children){const e=Array.isArray(t.children)?t.children:[t.children];for(const t of e)s+=ri(t)}return s+=`</${n}>`,s}var ii={};Object.defineProperty(ii,"__esModule",{value:!0});var si=r,ai=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 ci=ii.default=function(t){return function(e){return new si.Stream(new ai(t,e))}};t.ABORT=Fo,t.Collection=ao,t.MainDOMSource=Cn,t.MockedDOMSource=oo,t.Portal=ur,t.Slot=hr,t.Suspense=pr,t.Switchable=mo,t.Transition=dr,t.classes=function(...t){return t.reduce(((t,e)=>{var n,o;return"string"!=typeof e||t.includes(e)?Array.isArray(e)?t.push(...(o=e,o.map(Ar).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(!Er(n))throw new Error(`${n} is not a valid CSS class name`);return n})))):t.push(...Ar(e)),t}),[]).join(" ")},t.collection=so,t.component=Uo,t.createCommand=function(){const t={next:()=>{}},e={send:(n,o)=>{t.next({type:n,data:o}),"undefined"!=typeof window&&window.__SYGNAL_DEVTOOLS__?.connected&&window.__SYGNAL_DEVTOOLS__.onCommandSent(n,o,e._targetComponentId,e._targetComponentName)},_stream:lo.create({start(e){t.next=t=>e.next(t)},stop(){t.next=()=>{}}}),__sygnalCommand:!0};return e},t.createElement=qr,t.createInstallPrompt=function(){let t=null;const e=new EventTarget;return"undefined"!=typeof window&&(window.addEventListener("beforeinstallprompt",(n=>{n.preventDefault(),t=n,e.dispatchEvent(new CustomEvent("data",{detail:{type:"beforeinstallprompt",data:!0}}))})),window.addEventListener("appinstalled",(()=>{t=null,e.dispatchEvent(new CustomEvent("data",{detail:{type:"appinstalled",data:!0}}))}))),{select(t){let n;return ue(Jr.create({start:o=>{n=({detail:e})=>{e.type===t&&o.next(e.data)},e.addEventListener("data",n)},stop:()=>{n&&e.removeEventListener("data",n)}}))},prompt:()=>t?.prompt()}},t.createRef=function(){return{current:null}},t.createRef$=function(){const t={next:()=>{}},e=lo.createWithMemory({start(e){t.next=t=>e.next(t)},stop(){t.next=()=>{}}});return new Proxy({current:null,stream:e},{set:(e,n,o)=>"current"===n?(e.current=o,t.next(o),!0):(e[n]=o,!0)})},t.debounce=Oo,t.delay=bo,t.driverFromAsync=function(t,e={}){const{selector:n="category",args:o="value",return:r="value",pre:i=(t=>t),post:s=(t=>t)}=e,a=t.name||"[anonymous function]",c=typeof o;if(!("string"===c||"function"===c||Array.isArray(o)&&o.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 l=ce.create({start:t=>{c=t.next.bind(t)},stop:()=>{}});return e.addListener({next:e=>{const l=i(e);let u=[];if("object"==typeof l&&null!==l){if("function"==typeof o){const t=o(l);u=Array.isArray(t)?t:[t]}"string"==typeof o&&(u=[l[o]]),Array.isArray(o)&&(u=o.map((t=>l[t])))}const d=`Error in driver created using driverFromAsync(${a})`;t(...u).then((t=>{const o=t=>{let o;if(void 0===r)o=t,"object"==typeof o&&null!==o?o[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 r)throw new Error(`The 'return' option for driverFromAsync(${a}) must be a string. Received ${typeof r}`);o={[r]:t,[n]:e[n]}}return o};if("function"==typeof t.then)t.then((t=>{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(o(t))})).catch((t=>console.error(`${d}: ${t}`))):c(o(n))})).catch((t=>console.error(`${d}: ${t}`)));else{const n=s(t,e);"function"==typeof n.then?n.then((t=>{c(o(t))})).catch((t=>console.error(`${d}: ${t}`))):c(o(n))}})).catch((t=>console.error(`${d}: ${t}`)))},error:t=>{console.error(`Error received 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?l:"function"==typeof t?l.filter(t):l.filter((e=>e?.[n]===t))}}},t.dropRepeats=ge,t.emit=function(t,e){return{EVENTS:"function"==typeof e?(n,o,r,i)=>({type:t,data:e(n,o,r,i)}):()=>({type:t,data:e})}},t.enableHMR=function(t,e,n,o){if(!t||"function"!=typeof t.hmr)return t;if(!e||"function"!=typeof e.accept)return t;let r=!1;const i=e=>{Promise.resolve((async e=>{if(r)return;r=!0;const o=Array.isArray(e)?e.find(Boolean):e;try{let e=Sr(o);if(e||"function"!=typeof n||(e=Sr(await n())),e){const n=t?.sources?.STATE?.stream?._v;t.hmr(e,n)}}finally{r=!1}})(e)).catch((()=>{}))};return void 0!==o&&e.accept(o,i),e.accept(i),"function"==typeof e.dispose&&"function"==typeof t.dispose&&e.dispose((()=>t.dispose())),t},t.exactState=function(){return t=>t},t.getDevTools=wr,t.h=He,t.lazy=function(t){let e=null,n=null;function o(t){return n?{sel:"div",data:{attrs:{"data-sygnal-error":"lazy"}},children:[],text:void 0,elm:void 0,key:void 0}:e?e(t):{sel:"div",data:{attrs:{"data-sygnal-lazy":"loading"}},children:[],text:void 0,elm:void 0,key:void 0}}const r=t().then((t=>{e=t.default||t,o.__sygnalLazyLoadedComponent=e;const n=["model","intent","hmrActions","context","peers","components","initialState","calculated","storeCalculatedInState","DOMSourceName","stateSourceName","onError","debug","componentName"];for(const t of n)void 0!==e[t]&&void 0===o[t]&&(o[t]=e[t])})).catch((t=>{n=t,console.error("[lazy] Failed to load component:",t)}));return o.__sygnalLazy=!0,o.__sygnalLazyLoaded=()=>null!==e,o.__sygnalLazyLoadedComponent=null,o.__sygnalLazyPromise=r,o.__sygnalLazyReRenderScheduled=!1,o},t.makeDOMDriver=eo,t.makeDragDriver=function(){return function(t){const e=new Map,n=new EventTarget,o=[];let r=null;const i=t=>{if(!t?.category)return;const n=e.get(t.category)??{};e.set(t.category,{...n,...t})};t.subscribe({next(t){(t?.configs??(Array.isArray(t)?t:[t])).forEach(i)},error(){},complete(){}});const s=(t,e)=>n.dispatchEvent(new CustomEvent(t,{detail:e})),a=(t,e)=>{document.addEventListener(t,e),o.push([t,e])};a("dragstart",(t=>{const n=t;for(const[t,o]of e){if(!o.draggable)continue;const e=n.target.closest(o.draggable);if(e){if(r=t,n.dataTransfer.effectAllowed="move",o.dragImage){const t=e.closest(o.dragImage);if(t){const e=t.getBoundingClientRect();n.dataTransfer.setDragImage(t,n.clientX-e.left,n.clientY-e.top)}}return void s(`${t}:dragstart`,{element:e,dataset:{...e.dataset}})}}})),a("dragend",(()=>{r&&(s(`${r}:dragend`,null),r=null)})),a("dragover",(t=>{const n=t;for(const[,t]of e)if(t.dropZone&&(!r||!t.accepts||t.accepts===r)&&n.target.closest(t.dropZone))return void n.preventDefault()})),a("drop",(t=>{const n=t;for(const[t,o]of e){if(!o.dropZone)continue;if(r&&o.accepts&&o.accepts!==r)continue;const i=n.target.closest(o.dropZone);if(!i)continue;n.preventDefault();let a=null;const c=r?e.get(r):null;return c?.draggable&&(a=n.target.closest(c.draggable)??null),void s(`${t}:drop`,{dropZone:i,insertBefore:a})}}));const c={select:t=>({events(e){const o=`${t}:${e}`;let r;return fr(ce.create({start(t){r=({detail:e})=>t.next(e),n.addEventListener(o,r)},stop(){r&&n.removeEventListener(o,r)}}))}}),dragstart:t=>c.select(t).events("dragstart"),dragend:t=>c.select(t).events("dragend"),drop:t=>c.select(t).events("drop"),dragover:t=>c.select(t).events("dragover"),dispose(){o.forEach((([t,e])=>document.removeEventListener(t,e)))}};return c}},t.makeServiceWorkerDriver=function(t,e={}){return function(n){const o=new EventTarget;return"undefined"!=typeof navigator&&"serviceWorker"in navigator&&(navigator.serviceWorker.register(t,{scope:e.scope}).then((t=>{const e=(t,e)=>o.dispatchEvent(new CustomEvent("data",{detail:{type:t,data:e}}));t.installing&&Zr(t.installing,o),t.waiting&&e("waiting",t.waiting),t.active&&e("activated",!0),t.addEventListener("updatefound",(()=>{t.installing&&Zr(t.installing,o)})),navigator.serviceWorker.addEventListener("controllerchange",(()=>{e("controlling",!0)})),navigator.serviceWorker.addEventListener("message",(t=>{e("message",t.data)}))})).catch((t=>{o.dispatchEvent(new CustomEvent("data",{detail:{type:"error",data:t}}))})),n.addListener({next:t=>{"skipWaiting"===t.action?navigator.serviceWorker.ready.then((t=>{t.waiting&&t.waiting.postMessage({type:"SKIP_WAITING"})})):"postMessage"===t.action?navigator.serviceWorker.ready.then((e=>{e.active&&e.active.postMessage(t.data)})):"unregister"===t.action&&navigator.serviceWorker.ready.then((t=>t.unregister()))},error:t=>console.error("[SW driver] Error in sink stream:",t)})),{select(t){let e;return ue(Jr.create({start:n=>{e=({detail:e})=>{t&&e.type!==t||n.next(e.data)},o.addEventListener("data",e)},stop:()=>{e&&o.removeEventListener("data",e)}}))}}}},t.mockDOMSource=ro,t.onlineStatus$=Kr,t.portal=ur,t.processDrag=function({draggable:t,dropZone:e}={},n={}){if(t&&"function"!=typeof t.events)throw new Error("processDrag: draggable must have an .events() method (e.g. DOM.select(...))");if(e&&"function"!=typeof e.events)throw new Error("processDrag: dropZone must have an .events() method (e.g. DOM.select(...))");const{effectAllowed:o="move"}=n;return{dragStart$:t?t.events("dragstart").map((t=>(t.dataTransfer.effectAllowed=o,t))):ce.never(),dragEnd$:t?t.events("dragend").mapTo(null):ce.never(),dragOver$:e?e.events("dragover").map((t=>(t.preventDefault(),null))):ce.never(),drop$:e?e.events("drop").map((t=>(t.preventDefault(),t))):ce.never()}},t.processForm=function(t,e={}){if(!t||"function"!=typeof t.events)throw new Error("processForm: first argument must have an .events() method (e.g. DOM.select(...))");let{events:n=["input","submit"],preventDefault:o=!0}=e;"string"==typeof n&&(n=[n]);const r=n.map((e=>t.events(e)));return ce.merge(...r).map((t=>{o&&t.preventDefault();const e="submit"===t.type?t.srcElement:t.currentTarget,n=new FormData(e),r={event:t,eventType:t.type},i=e.querySelector("input[type=submit]:focus");if(i){const{name:t,value:e}=i;r[t||"submit"]=e}for(const[t,e]of n.entries())r[t]=e;return r}))},t.renderComponent=function(t,e={}){const{initialState:n,mockConfig:o={},drivers:r={}}=e,i=t.name||t.componentName||"TestComponent",s=t,{intent:a,model:c,context:l,calculated:u,storeCalculatedInState:d,onError:p}=t,h=void 0!==n?n:t.initialState,f={next:()=>{}},m=lo.create({start(t){f.next=e=>t.next(e)},stop(){f.next=()=>{}}}),y={...c||{},__TEST_ACTION__:{STATE:(t,e)=>{if(!e||!e.type)return t;const{type:n,data:o}=e;let r=c?.[n];if(!r)for(const t of Object.keys(c||{}))if(t.includes("|")){const e=t.split("|").map((t=>t.trim()));if(e[0]===n){r={[e[1]]:c[t]};break}}if(!r)return t;if("function"==typeof r){const e=r(t,o);return"symbol"==typeof e?t:void 0!==e?e:t}if("object"==typeof r){const e=r.STATE||r[_];if("function"==typeof e){const n=e(t,o);return"symbol"==typeof n?t:void 0!==n?n:t}const n=r.EFFECT;if("function"==typeof n){n(t,o,((t,e)=>{setTimeout((()=>f.next({type:t,data:e})),10)}),{})}}return t}}},_="STATE",v=Fe(Uo({name:i,view:s,intent:a?t=>({...a(t),__TEST_ACTION__:m}):t=>({__TEST_ACTION__:m}),model:y,context:l,initialState:h,calculated:u,storeCalculatedInState:d,onError:p}),_),g={DOM:()=>ro(o),EVENTS:_r,LOG:vr,...r},{sources:b,sinks:w,run:S}=yr(v,g),E=S(),A=[];let O=null;const N=b.STATE&&b.STATE.stream?b.STATE.stream:lo.never();return O={next:t=>A.push(t),error:()=>{},complete:()=>{}},N.addListener(O),{state$:N,dom$:w.DOM||lo.never(),events$:b.EVENTS||{select:()=>lo.never()},sinks:w,sources:b,simulateAction:(t,e)=>{f.next({type:t,data:e})},waitForState:(t,e=2e3)=>new Promise(((n,o)=>{for(const e of A)try{if(t(e))return n(e)}catch(t){}const r=setTimeout((()=>{try{N.removeListener(i)}catch(t){}o(new Error(`waitForState timed out after ${e}ms`))}),e),i={next:e=>{try{t(e)&&(clearTimeout(r),N.removeListener(i),n(e))}catch(t){}},error:t=>{clearTimeout(r),o(t)},complete:()=>{clearTimeout(r),o(new Error("waitForState: state stream completed without matching"))}};N.addListener(i)})),states:A,dispose:()=>{if(O){try{N.removeListener(O)}catch(t){}O=null}if("function"==typeof w.__dispose)try{w.__dispose()}catch(t){}E()}}},t.renderToString=function(t,e={}){const{state:n,props:o={},context:r={},hydrateState:i}=e,s=void 0!==n?n:t.initialState,a=t.context||{},c={...r};for(const t of Object.keys(a)){const e=a[t];if("function"==typeof e&&null!=s)try{c[t]=e(s)}catch(t){}}let l;try{l=t({...o,state:s,children:o.children||[],slots:o.slots||{},context:c,peers:{}},s,c,{})}catch(e){if("function"==typeof t.onError){const n=t.componentName||t.name||"Component";try{l=t.onError(e,{componentName:n})}catch(t){l={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}}else l={sel:"div",data:{attrs:{"data-sygnal-error":""}},children:[],text:void 0,elm:void 0,key:void 0}}l||(l={sel:"div",data:{},children:[],text:void 0,elm:void 0,key:void 0}),l=oi(l,c,s);let u=ri(l);if(i&&null!=s){const t="string"==typeof i?i:"__SYGNAL_STATE__";ei(JSON.stringify(s)),u+=`<script>window.${t}=${JSON.stringify(s)}<\/script>`}return u},t.run=function t(e,n={},o={}){if("undefined"!=typeof window){wr().init()}const{mountPoint:r="#root",fragments:i=!0,useDefaultDrivers:s=!0}=o;if(!e.isSygnalComponent){const t=e.name||e.componentName||e.label||"FUNCTIONAL_COMPONENT",n=e,{model:o,intent:r,hmrActions:i,context:s,peers:a,components:c,initialState:l,calculated:u,storeCalculatedInState:d,DOMSourceName:p,stateSourceName:h,onError:f,debug:m}=e;e=Uo({name:t,view:n,model:o,intent:r,hmrActions:i,context:s,peers:a,components:c,initialState:l,calculated:u,storeCalculatedInState:d,DOMSourceName:p,stateSourceName:h,onError:f,debug:m})}"undefined"!=typeof window&&!0===window.__SYGNAL_HMR_UPDATING&&void 0!==window.__SYGNAL_HMR_PERSISTED_STATE&&(e.initialState=window.__SYGNAL_HMR_PERSISTED_STATE);const a=Fe(e,"STATE"),c={...s?{EVENTS:_r,DOM:eo(r,{snabbdomOptions:{experimental:{fragments:i}}}),LOG:vr}:{},...n},{sources:l,sinks:u,run:d}=yr(a,c),p=d();let h=null;"undefined"!=typeof window&&l?.STATE?.stream&&"function"==typeof l.STATE.stream.addListener&&(h={next:t=>{window.__SYGNAL_HMR_PERSISTED_STATE=t},error:()=>{},complete:()=>{}},l.STATE.stream.addListener(h));const f={sources:l,sinks:u,dispose:()=>{if(h&&l?.STATE?.stream&&"function"==typeof l.STATE.stream.removeListener&&(l.STATE.stream.removeListener(h),h=null),"function"==typeof u.__dispose)try{u.__dispose()}catch(t){}p()}};"undefined"!=typeof window&&(window.__SYGNAL_DEVTOOLS_APP__=f);const m=(r,i)=>{const s="undefined"!=typeof window?window.__SYGNAL_HMR_PERSISTED_STATE:void 0,a=void 0!==s?s:e.initialState,c=void 0===i?a:i;"undefined"!=typeof window&&(window.__SYGNAL_HMR_UPDATING=!0,window.__SYGNAL_HMR_STATE=c,window.__SYGNAL_HMR_PERSISTED_STATE=c),f.dispose();const l=r.default||r;l.initialState=c;const u=t(l,n,o);if(f.sources=u.sources,f.sinks=u.sinks,f.dispose=u.dispose,void 0!==c&&u?.sinks?.STATE&&"function"==typeof u.sinks.STATE.shamefullySendNext){const t=()=>u.sinks.STATE.shamefullySendNext((()=>({...c})));setTimeout(t,0),setTimeout(t,20)}"undefined"!=typeof window&&u?.sources?.STATE?.stream&&"function"==typeof u.sources.STATE.stream.setDebugListener?u.sources.STATE.stream.setDebugListener({next:()=>{u.sources.STATE.stream.setDebugListener(null),window.__SYGNAL_HMR_STATE=void 0,setTimeout((()=>{window.__SYGNAL_HMR_UPDATING=!1}),100)}}):"undefined"!=typeof window&&(window.__SYGNAL_HMR_STATE=void 0,window.__SYGNAL_HMR_UPDATING=!1)},y=t=>t?Array.isArray(t)?y(t.find(Boolean)):t.default&&"function"==typeof t.default?t:"function"==typeof t?{default:t}:null:null;return f.hmr=(t,n)=>{const o=y(t)||{default:e};if(void 0!==n)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=n),void m(o,n);const r="undefined"!=typeof window?window.__SYGNAL_HMR_PERSISTED_STATE:void 0;if(void 0!==r)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=r),void m(o,r);const i=f?.sources?.STATE?.stream?._v;if(void 0!==i)return"undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=i),void m(o,i);f?.sinks?.STATE&&"function"==typeof f.sinks.STATE.shamefullySendNext?f.sinks.STATE.shamefullySendNext((t=>("undefined"!=typeof window&&(window.__SYGNAL_HMR_LAST_CAPTURED_STATE=t),m(o,t),Fo))):m(o)},f},t.sampleCombine=In,t.set=function(t){return"function"==typeof t?(e,n,o,r)=>({...e,...t(e,n,o,r)}):e=>({...e,...t})},t.switchable=ho,t.throttle=ci,t.thunk=function(t,e,n,o){return void 0===o&&(o=n,n=e,e=void 0),He(t,{key:e,hook:{init:hn,prepatch:fn},fn:n,args:o})},t.toggle=function(t){return e=>({...e,[t]:!e[t]})},t.xs=lo}));
|
package/package.json
CHANGED
package/src/extra/ssr.ts
CHANGED
|
@@ -155,6 +155,14 @@ function processSSRTree(vnode: any, context: Record<string, any>, parentState?:
|
|
|
155
155
|
|
|
156
156
|
const sel = vnode.sel
|
|
157
157
|
|
|
158
|
+
// Fragment: no selector, recurse into children
|
|
159
|
+
if (!sel && vnode.children && Array.isArray(vnode.children)) {
|
|
160
|
+
vnode.children = vnode.children
|
|
161
|
+
.map((c: any) => processSSRTree(c, context, parentState))
|
|
162
|
+
.filter((c: any) => c != null)
|
|
163
|
+
return vnode
|
|
164
|
+
}
|
|
165
|
+
|
|
158
166
|
// Portal: render children inline (no target container on server)
|
|
159
167
|
if (sel === 'portal') {
|
|
160
168
|
const children = vnode.children || []
|
|
@@ -543,6 +551,10 @@ function vnodeToHtml(vnode: any): string {
|
|
|
543
551
|
const sel = vnode.sel
|
|
544
552
|
if (!sel) {
|
|
545
553
|
if (vnode.text != null) return escapeHtml(String(vnode.text))
|
|
554
|
+
// Fragment: no selector, but has children — concatenate child HTML
|
|
555
|
+
if (vnode.children && Array.isArray(vnode.children)) {
|
|
556
|
+
return vnode.children.map((c: any) => vnodeToHtml(c)).join('')
|
|
557
|
+
}
|
|
546
558
|
return ''
|
|
547
559
|
}
|
|
548
560
|
|