/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/s-js@0.4.9/dist/S.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):n.S=t()}(this,(function(){"use strict";var n=function(n,t){var e=new o(n,t);return function(){return e.current()}};Object.defineProperty(n,"default",{value:n}),n.root=function(n){var t=p,e=0===n.length?g:new o(null,null),u=void 0,l=0===n.length?null:function(){null!==h?f.disposes.add(e):A(e)};return p=e,null===h?u=function(n,t,e){try{return null===t?n():n(t)}finally{p=e}}(n,l,t):(u=null===l?n():n(l),p=t),u},n.on=function(t,e,u,o){var l;return Array.isArray(t)&&(l=t,t=function(){for(var n=0;n<l.length;n++)l[n]()}),o=!!o,n(s,u);function s(n){var u=d;return t(),o?o=!1:(d=null,n=e(n),d=u),n}},n.effect=function(n,t){new o(n,t)},n.data=function(n){var t=new u(n);return function(n){return 0===arguments.length?t.current():t.next(n)}},n.value=function(t,e){var u=n.data(t),o=-1;return function(n){if(0===arguments.length)return u();if(!(e?e(t,n):t===n)){var l=f.time;if(o===l)throw new Error("conflicting values: "+n+" is not the same as "+t);o=l,t=n,u(n)}return n}},n.freeze=function(n){var t=void 0;if(null!==h)t=n();else{(h=f).changes.reset();try{t=n(),w()}finally{h=null}}return t},n.sample=function(n){var t,e=d;return null!==e?(d=null,t=n(),d=e):t=n(),t},n.cleanup=function(n){null!==p?null===p.cleanups?p.cleanups=[n]:p.cleanups.push(n):console.warn("cleanups created without a root or parent will never be run")},n.makeDataNode=function(n){return new u(n)},n.makeComputationNode=function(n,t){return new o(n,t)},n.isFrozen=function(){return null!==h},n.isListening=function(){return null!==d};var t=function(){this.time=0,this.changes=new s,this.updates=new s,this.disposes=new s},e={time:function(){return f.time}},u=function(){function n(n){this.value=n,this.pending=i,this.log=null}return n.prototype.current=function(){return null!==d&&function(n,t){null===n.log&&(n.log=new l);v(n.log,t)}(this,d),this.value},n.prototype.next=function(n){if(null!==h)if(this.pending!==i){if(n!==this.pending)throw new Error("conflicting changes: "+n+" !== "+this.pending)}else this.pending=n,f.changes.add(this);else null!==this.log?(this.pending=n,f.changes.add(this),w()):this.value=n;return n},n.prototype.clock=function(){return e},n}(),o=function(){function n(n,t){if(this.state=r,this.source1=null,this.source1slot=0,this.sources=null,this.sourceslots=null,this.log=null,this.owned=null,this.cleanups=null,this.fn=n,this.value=t,this.age=f.time,null!==n){var e=p,u=d;null===e&&console.warn("computations created without a root or parent will never be disposed"),p=d=this,null===h?function(n){h=f,f.changes.reset(),f.updates.reset();try{n.value=n.fn(n.value),(f.changes.count>0||f.updates.count>0)&&(f.time++,y(f))}finally{h=p=d=null}}(this):this.value=this.fn(this.value),e&&e!==g&&(null===e.owned?e.owned=[this]:e.owned.push(this)),p=e,d=u}}return n.prototype.current=function(){if(null!==d){if(this.age===f.time){if(this.state===a)throw new Error("circular dependency");E(this)}!function(n,t){null===n.log&&(n.log=new l);v(n.log,t)}(this,d)}return this.value},n.prototype.clock=function(){return e},n}(),l=function(){this.node1=null,this.node1slot=0,this.nodes=null,this.nodeslots=null},s=function(){function n(){this.items=[],this.count=0}return n.prototype.reset=function(){this.count=0},n.prototype.add=function(n){this.items[this.count++]=n},n.prototype.run=function(n){for(var t=this.items,e=0;e<this.count;e++)n(t[e]),t[e]=null;this.count=0},n}(),i={},r=0,c=1,a=2,f=new t,h=null,d=null,p=null,g=new o(null,null);function v(n,t){var e,u=null===t.source1?-1:null===t.sources?0:t.sources.length;null===n.node1?(n.node1=t,n.node1slot=u,e=-1):null===n.nodes?(n.nodes=[t],n.nodeslots=[u],e=0):(e=n.nodes.length,n.nodes.push(t),n.nodeslots.push(u)),null===t.source1?(t.source1=n,t.source1slot=e):null===t.sources?(t.sources=[n],t.sourceslots=[e]):(t.sources.push(n),t.sourceslots.push(e))}function w(){var n=p;f.updates.reset(),f.time++;try{y(f)}finally{h=d=null,p=n}}function y(n){var t=h,e=0;for(h=n,n.disposes.reset();0!==n.changes.count||0!==n.updates.count||0!==n.disposes.count;)if(e>0&&n.time++,n.changes.run(m),n.updates.run(E),n.disposes.run(A),e++>1e5)throw new Error("Runaway clock detected");h=t}function m(n){n.value=n.pending,n.pending=i,n.log&&k(n.log)}function k(n){var t=n.node1,e=n.nodes;if(null!==t&&b(t),null!==e)for(var u=0,o=e.length;u<o;u++)b(e[u])}function b(n){var t=f.time;n.age<t&&(n.age=t,n.state=c,f.updates.add(n),null!==n.owned&&x(n.owned),null!==n.log&&k(n.log))}function x(n){for(var t=0;t<n.length;t++){var e=n[t];e.age=f.time,e.state=r,null!==e.owned&&x(e.owned)}}function E(n){if(n.state===c){var t=p,e=d;p=d=n,n.state=a,j(n,!1),n.value=n.fn(n.value),n.state=r,p=t,d=e}}function j(n,t){var e,u,o=n.source1,l=n.sources,s=n.sourceslots,i=n.cleanups,r=n.owned;if(null!==i){for(e=0;e<i.length;e++)i[e](t);n.cleanups=null}if(null!==r){for(e=0;e<r.length;e++)A(r[e]);n.owned=null}if(null!==o&&(z(o,n.source1slot),n.source1=null),null!==l)for(e=0,u=l.length;e<u;e++)z(l.pop(),s.pop())}function z(n,t){var e,u,o=n.nodes,l=n.nodeslots;-1===t?n.node1=null:(e=o.pop(),u=l.pop(),t!==o.length&&(o[t]=e,l[t]=u,-1===u?e.source1slot=t:e.sourceslots[u]=t))}function A(n){n.fn=null,n.log=null,j(n,!0)}return n}));
//# sourceMappingURL=/sm/9aae2c66f02f5516ce79df985e3674b30caf1719eaa205def46fc6baad46e355.map