diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index ed395fbd7..6383d500e 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -34,7 +34,7 @@ export const target[key] = /*isArray(value) ? ko.observableArray(value) :*/ ko.observable(value) ), addComputablesTo = (target, computables) => - forEachObjectEntry(computables, (key, fn) => target[key] = ko.computed(fn)), + forEachObjectEntry(computables, (key, fn) => target[key] = ko.computed(fn, {'pure':true})), addSubscribablesTo = (target, subscribables) => forEachObjectEntry(subscribables, (key, fn) => target[key].subscribe(fn)), diff --git a/dev/External/ko.js b/dev/External/ko.js index 22b7e501e..02b3af11b 100644 --- a/dev/External/ko.js +++ b/dev/External/ko.js @@ -8,7 +8,7 @@ import { arrayLength, isFunction } from 'Common/Utils'; * number of evaluations or other “hidden” information. Its value should be * based solely on the values of other observables in the application */ -export const koComputable = ko.pureComputed; +export const koComputable = fn => ko.computed(fn, {'pure':true}); ko.bindingHandlers.tooltipErrorTip = { init: (element, fValueAccessor) => { diff --git a/dev/Settings/User/Contacts.js b/dev/Settings/User/Contacts.js index 3ef055716..b3a7dd71f 100644 --- a/dev/Settings/User/Contacts.js +++ b/dev/Settings/User/Contacts.js @@ -1,4 +1,5 @@ import ko from 'ko'; +import { koComputable } from 'External/ko'; import { SettingsGet } from 'Common/Globals'; import { ContactUserStore } from 'Stores/User/Contact'; @@ -14,8 +15,7 @@ export class ContactsUserSettings /*extends AbstractViewSettings*/ { this.contactsSyncUser = ContactUserStore.syncUser; this.contactsSyncPass = ContactUserStore.syncPass; - this.saveTrigger = ko - .computed(() => + this.saveTrigger = koComputable(() => [ ContactUserStore.enableSync() ? '1' : '0', ContactUserStore.syncUrl(), diff --git a/dev/Stores/User/Message.js b/dev/Stores/User/Message.js index 7699958de..6c0cf90e2 100644 --- a/dev/Stores/User/Message.js +++ b/dev/Stores/User/Message.js @@ -1,4 +1,5 @@ import ko from 'ko'; +import { koComputable } from 'External/ko'; import { Scope, Notification } from 'Common/Enums'; import { MessageSetAction } from 'Common/EnumsUser'; @@ -149,16 +150,13 @@ export const MessageUserStore = new class { } }); - this.listChecked = ko - .computed(() => this.list.filter(isChecked)) + this.listChecked = koComputable(() => this.list.filter(isChecked)) .extend({ rateLimit: 0 }); - this.hasCheckedMessages = ko - .computed(() => !!this.list.find(isChecked)) + this.hasCheckedMessages = koComputable(() => !!this.list.find(isChecked)) .extend({ rateLimit: 0 }); - this.hasCheckedOrSelected = ko - .computed(() => !!(this.selectorMessageSelected() + this.hasCheckedOrSelected = koComputable(() => !!(this.selectorMessageSelected() || this.selectorMessageFocused() || this.list.find(item => item.checked()))) .extend({ rateLimit: 50 }); diff --git a/dev/View/Admin/Settings/Pane.js b/dev/View/Admin/Settings/Pane.js index c6148dd78..5233313ed 100644 --- a/dev/View/Admin/Settings/Pane.js +++ b/dev/View/Admin/Settings/Pane.js @@ -1,4 +1,5 @@ import ko from 'ko'; +import { koComputable } from 'External/ko'; import Remote from 'Remote/Admin/Fetch'; @@ -16,8 +17,7 @@ class PaneSettingsAdminView extends AbstractViewRight { this.leftPanelDisabled = leftPanelDisabled; - this.adminManLoadingVisibility = ko - .computed(() => PackageAdminStore.loading() ? 'visible' : 'hidden'); + this.adminManLoadingVisibility = koComputable(() => PackageAdminStore.loading() ? 'visible' : 'hidden'); } logoutClick() { diff --git a/vendors/knockout/build/output/knockout-latest.debug.js b/vendors/knockout/build/output/knockout-latest.debug.js index 7fd45c1d6..62c695565 100644 --- a/vendors/knockout/build/output/knockout-latest.debug.js +++ b/vendors/knockout/build/output/knockout-latest.debug.js @@ -1392,7 +1392,6 @@ ko.pureComputed = (evaluatorFunctionOrOptions) => { evaluatorFunctionOrOptions['pure'] = true; return ko.computed(evaluatorFunctionOrOptions); }; -ko.exportSymbol('pureComputed', ko.pureComputed); (() => { var hasDomDataExpandoProperty = '__ko__hasDomDataOptionValue__'; diff --git a/vendors/knockout/build/output/knockout-latest.js b/vendors/knockout/build/output/knockout-latest.js index f448e9508..7c0af97ba 100644 --- a/vendors/knockout/build/output/knockout-latest.js +++ b/vendors/knockout/build/output/knockout-latest.js @@ -4,60 +4,60 @@ * License: MIT (http://www.opensource.org/licenses/mit-license.php) */ -(T=>{function O(a,c){return null===a||U[typeof a]?a===c:!1}function V(a,c){var d;return()=>{d||(d=setTimeout(()=>{d=0;a()},c))}}function W(a,c){var d;return()=>{clearTimeout(d);d=setTimeout(a,c)}}function X(a,c){null!==c&&c.o&&c.o()}function Y(a,c){var d=this.Yb,g=d[A];g.W||(this.Ra&&this.xa[c]?(d.qb(c,a,this.xa[c]),this.xa[c]=null,--this.Ra):g.s[c]||d.qb(c,a,g.u?{S:a}:d.Pb(a)),a.ia&&a.Ub())}var L=T.document,P={},b="undefined"!==typeof P?P:{};b.m=(a,c)=>{a=a.split(".");for(var d=b,g= +(T=>{function O(a,c){return null===a||U[typeof a]?a===c:!1}function V(a,c){var d;return()=>{d||(d=setTimeout(()=>{d=0;a()},c))}}function W(a,c){var d;return()=>{clearTimeout(d);d=setTimeout(a,c)}}function X(a,c){null!==c&&c.o&&c.o()}function Y(a,c){var d=this.Xb,g=d[A];g.W||(this.Ra&&this.xa[c]?(d.qb(c,a,this.xa[c]),this.xa[c]=null,--this.Ra):g.s[c]||d.qb(c,a,g.u?{S:a}:d.Ob(a)),a.ia&&a.Tb())}var L=T.document,P={},b="undefined"!==typeof P?P:{};b.m=(a,c)=>{a=a.split(".");for(var d=b,g= 0,k=a.length-1;g{a[c]=d};b.m("version","3.5.1-sm");b.a={extend:(a,c)=>c?Object.assign(a,c):a,K:(a,c)=>a&&Object.entries(a).forEach(d=>c(d[0],d[1])),Va:a=>[...a.childNodes].forEach(c=>b.removeNode(c)),Hb:a=>{a=[...a];var c=(a[0]&&a[0].ownerDocument||L).createElement("div");a.forEach(d=>c.append(b.ba(d)));return c},wa:(a,c)=>Array.prototype.map.call(a,c?d=>b.ba(d.cloneNode(!0)):d=>d.cloneNode(!0)),sa:(a,c)=>{b.a.Va(a);c&&a.append(...c)},ya:(a,c)=>{if(a.length){for(c= -8===c.nodeType&&c.parentNode||c;a.length&&a[0].parentNode!==c;)a.splice(0,1);for(;1null==a?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),Ua:a=>a.ownerDocument.documentElement.contains(1!==a.nodeType?a.parentNode:a),Rb:(a,c)=>{if(!a||!a.nodeType)throw Error("element must be a DOM node when calling triggerEvent"); +8===c.nodeType&&c.parentNode||c;a.length&&a[0].parentNode!==c;)a.splice(0,1);for(;1null==a?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),Ua:a=>a.ownerDocument.documentElement.contains(1!==a.nodeType?a.parentNode:a),Qb:(a,c)=>{if(!a||!a.nodeType)throw Error("element must be a DOM node when calling triggerEvent"); a.dispatchEvent(new Event(c))},f:a=>b.N(a)?a():a,eb:(a,c)=>a.textContent=b.a.f(c)||""};b.m("utils",b.a);b.m("unwrap",b.a.f);(()=>{let a=0,c="__ko__"+Date.now(),d=new WeakMap;b.a.c={get:(g,k)=>(d.get(g)||{})[k],set:(g,k,t)=>{if(d.has(g))d.get(g)[k]=t;else{let e={};e[k]=t;d.set(g,e)}return t},Xa:function(g,k,t){return this.get(g,k)||this.set(g,k,t)},clear:g=>d.delete(g),U:()=>a++ +c}})();b.a.H=(()=>{var a=b.a.c.U(),c={1:1,8:1,9:1},d={1:1,9:1};const g=(e,f)=>{var h=b.a.c.get(e,a);f&&!h&&(h=new Set,b.a.c.set(e, a,h));return h},k=e=>{var f=g(e);f&&(new Set(f)).forEach(h=>h(e));b.a.c.clear(e);d[e.nodeType]&&t(e.childNodes,!0)},t=(e,f)=>{for(var h=[],r,p=0;p{if("function"!=typeof f)throw Error("Callback must be a function");g(e,1).add(f)},cb:(e,f)=>{var h=g(e);h&&(h.delete(f),h.size||b.a.c.set(e,a,null))},ba:e=>{b.l.M(()=>{c[e.nodeType]&&(k(e),d[e.nodeType]&&t(e.getElementsByTagName("*")))}); -return e},removeNode:e=>{b.ba(e);e.parentNode&&e.parentNode.removeChild(e)}}})();b.ba=b.a.H.ba;b.removeNode=b.a.H.removeNode;b.m("utils.domNodeDisposal",b.a.H);b.m("utils.domNodeDisposal.addDisposeCallback",b.a.H.la);b.Qb=(()=>{function a(){if(g)for(var f=g,h=0,r;tf){if(5E3<=++h){t=g;setTimeout(()=>{throw Error(`'Too much recursion' after processing ${h} task groups.`);},0);break}f=g}try{r()}catch(p){setTimeout(()=>{throw p;},0)}}}function c(){a();t=g=d.length=0}var d=[],g=0, -k=1,t=0,e=(f=>{var h=L.createElement("div");(new MutationObserver(f)).observe(h,{attributes:!0});return()=>h.classList.toggle("foo")})(c);return{Mb:f=>{g||e(c);d[g++]=f;return k++},cancel:f=>{f-=k-g;f>=t&&fa.Fa(d=>W(d,c)),rateLimit:(a,c)=>{if("number"==typeof c)var d=c;else{d=c.timeout;var g=c.method}var k="function"==typeof g?g:V;a.Fa(t=>k(t,d,c))},notify:(a,c)=>{a.equalityComparer="always"==c?null:O}};var U={undefined:1,"boolean":1,number:1,string:1}; +return e},removeNode:e=>{b.ba(e);e.parentNode&&e.parentNode.removeChild(e)}}})();b.ba=b.a.H.ba;b.removeNode=b.a.H.removeNode;b.m("utils.domNodeDisposal",b.a.H);b.m("utils.domNodeDisposal.addDisposeCallback",b.a.H.la);b.Pb=(()=>{function a(){if(g)for(var f=g,h=0,r;tf){if(5E3<=++h){t=g;setTimeout(()=>{throw Error(`'Too much recursion' after processing ${h} task groups.`);},0);break}f=g}try{r()}catch(p){setTimeout(()=>{throw p;},0)}}}function c(){a();t=g=d.length=0}var d=[],g=0, +k=1,t=0,e=(f=>{var h=L.createElement("div");(new MutationObserver(f)).observe(h,{attributes:!0});return()=>h.classList.toggle("foo")})(c);return{Lb:f=>{g||e(c);d[g++]=f;return k++},cancel:f=>{f-=k-g;f>=t&&fa.Fa(d=>W(d,c)),rateLimit:(a,c)=>{if("number"==typeof c)var d=c;else{d=c.timeout;var g=c.method}var k="function"==typeof g?g:V;a.Fa(t=>k(t,d,c))},notify:(a,c)=>{a.equalityComparer="always"==c?null:O}};var U={undefined:1,"boolean":1,number:1,string:1}; b.m("extenders",b.Wa);class Z{constructor(a,c,d){this.S=a;this.kb=c;this.na=d;this.La=!1;this.B=this.V=null;b.ea(this,"dispose",this.o)}o(){this.La||(this.B&&b.a.H.cb(this.V,this.B),this.La=!0,this.na(),this.S=this.kb=this.na=this.V=this.B=null)}i(a){this.V=a;b.a.H.la(a,this.B=this.o.bind(this))}}b.P=function(){Object.setPrototypeOf(this,H);H.Ca(this)};var H={Ca:a=>{a.R=new Map;a.R.set("change",new Set);a.pb=1},subscribe:function(a,c,d){var g=this;d=d||"change";var k=new Z(g,c?a.bind(c):a,()=>{g.R.get(d).delete(k); -g.ua&&g.ua(d)});g.ma&&g.ma(d);g.R.has(d)||g.R.set(d,new Set);g.R.get(d).add(k);return k},notifySubscribers:function(a,c){c=c||"change";"change"===c&&this.Ia();if(this.qa(c)){c="change"===c&&this.Sb||new Set(this.R.get(c));try{b.l.ub(),c.forEach(d=>{d.La||d.kb(a)})}finally{b.l.end()}}},Aa:function(){return this.pb},dc:function(a){return this.Aa()!==a},Ia:function(){++this.pb},Fa:function(a){var c=this,d=b.N(c),g,k,t,e,f;c.ta||(c.ta=c.notifySubscribers,c.notifySubscribers=function(r,p){p&&"change"!== -p?"beforeChange"===p?this.mb(r):this.ta(r,p):this.nb(r)});var h=a(()=>{c.ia=!1;d&&e===c&&(e=c.lb?c.lb():c());var r=k||f&&c.Ea(t,e);f=k=g=!1;r&&c.ta(t=e)});c.nb=(r,p)=>{p&&c.ia||(f=!p);c.Sb=new Set(c.R.get("change"));c.ia=g=!0;e=r;h()};c.mb=r=>{g||(t=r,c.ta(r,"beforeChange"))};c.ob=()=>{f=!0};c.Ub=()=>{c.Ea(t,c.F(!0))&&(k=!0)}},qa:function(a){return(this.R.get(a)||[]).size},Ea:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},toString:()=>"[object Object]",extend:function(a){var c= -this;a&&b.a.K(a,(d,g)=>{d=b.Wa[d];"function"==typeof d&&(c=d(c,g)||c)});return c}};b.ea(H,"init",H.Ca);b.ea(H,"subscribe",H.subscribe);b.ea(H,"extend",H.extend);Object.setPrototypeOf(H,Function.prototype);b.P.fn=H;b.hc=a=>null!=a&&"function"==typeof a.subscribe&&"function"==typeof a.notifySubscribers;(()=>{var a=[],c,d=0;b.l={ub:g=>{a.push(c);c=g},end:()=>c=a.pop(),Lb:g=>{if(c){if(!b.hc(g))throw Error("Only subscribable things can act as dependencies");c.Wb.call(c.Xb,g,g.Tb||(g.Tb=++d))}},M:(g,k, -t)=>{try{return a.push(c),c=void 0,g.apply(k,t||[])}finally{c=a.pop()}},za:()=>c&&c.j.za(),Za:()=>c&&c.Za,j:()=>c&&c.j}})();const G=Symbol("_latestValue");b.Y=a=>{function c(){if(0null==c[G]?void 0:c[G].length});b.P.fn.Ca(c);Object.setPrototypeOf(c,J);return c};var J={toJSON:function(){let a=this[G];return a&&a.toJSON?a.toJSON():a},equalityComparer:O, -F:function(){return this[G]},Ja:function(){this.notifySubscribers(this[G],"spectate");this.notifySubscribers(this[G])},ib:function(){this.notifySubscribers(this[G],"beforeChange")}};Object.setPrototypeOf(J,b.P.fn);var K=b.Y.B="__ko_proto__";J[K]=b.Y;b.N=a=>{if((a="function"==typeof a&&a[K])&&a!==J[K]&&a!==b.j.fn[K])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!a};b.ic=a=>"function"==typeof a&&(a[K]===J[K]||a[K]===b.j.fn[K]&&a.ec);b.m("observable", +g.ua&&g.ua(d)});g.ma&&g.ma(d);g.R.has(d)||g.R.set(d,new Set);g.R.get(d).add(k);return k},notifySubscribers:function(a,c){c=c||"change";"change"===c&&this.Ia();if(this.qa(c)){c="change"===c&&this.Rb||new Set(this.R.get(c));try{b.l.ub(),c.forEach(d=>{d.La||d.kb(a)})}finally{b.l.end()}}},Aa:function(){return this.pb},cc:function(a){return this.Aa()!==a},Ia:function(){++this.pb},Fa:function(a){var c=this,d=b.N(c),g,k,t,e,f;c.ta||(c.ta=c.notifySubscribers,c.notifySubscribers=function(r,p){p&&"change"!== +p?"beforeChange"===p?this.mb(r):this.ta(r,p):this.nb(r)});var h=a(()=>{c.ia=!1;d&&e===c&&(e=c.lb?c.lb():c());var r=k||f&&c.Ea(t,e);f=k=g=!1;r&&c.ta(t=e)});c.nb=(r,p)=>{p&&c.ia||(f=!p);c.Rb=new Set(c.R.get("change"));c.ia=g=!0;e=r;h()};c.mb=r=>{g||(t=r,c.ta(r,"beforeChange"))};c.ob=()=>{f=!0};c.Tb=()=>{c.Ea(t,c.F(!0))&&(k=!0)}},qa:function(a){return(this.R.get(a)||[]).size},Ea:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},toString:()=>"[object Object]",extend:function(a){var c= +this;a&&b.a.K(a,(d,g)=>{d=b.Wa[d];"function"==typeof d&&(c=d(c,g)||c)});return c}};b.ea(H,"init",H.Ca);b.ea(H,"subscribe",H.subscribe);b.ea(H,"extend",H.extend);Object.setPrototypeOf(H,Function.prototype);b.P.fn=H;b.fc=a=>null!=a&&"function"==typeof a.subscribe&&"function"==typeof a.notifySubscribers;(()=>{var a=[],c,d=0;b.l={ub:g=>{a.push(c);c=g},end:()=>c=a.pop(),Kb:g=>{if(c){if(!b.fc(g))throw Error("Only subscribable things can act as dependencies");c.Vb.call(c.Wb,g,g.Sb||(g.Sb=++d))}},M:(g,k, +t)=>{try{return a.push(c),c=void 0,g.apply(k,t||[])}finally{c=a.pop()}},za:()=>c&&c.j.za(),Za:()=>c&&c.Za,j:()=>c&&c.j}})();const G=Symbol("_latestValue");b.Y=a=>{function c(){if(0null==c[G]?void 0:c[G].length});b.P.fn.Ca(c);Object.setPrototypeOf(c,J);return c};var J={toJSON:function(){let a=this[G];return a&&a.toJSON?a.toJSON():a},equalityComparer:O, +F:function(){return this[G]},Ja:function(){this.notifySubscribers(this[G],"spectate");this.notifySubscribers(this[G])},ib:function(){this.notifySubscribers(this[G],"beforeChange")}};Object.setPrototypeOf(J,b.P.fn);var K=b.Y.B="__ko_proto__";J[K]=b.Y;b.N=a=>{if((a="function"==typeof a&&a[K])&&a!==J[K]&&a!==b.j.fn[K])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!a};b.hc=a=>"function"==typeof a&&(a[K]===J[K]||a[K]===b.j.fn[K]&&a.dc);b.m("observable", b.Y);b.m("isObservable",b.N);b.m("observable.fn",J);b.ea(J,"valueHasMutated",J.Ja);b.ga=a=>{a=a||[];if("object"!=typeof a||!("length"in a))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");a=b.Y(a);Object.setPrototypeOf(a,b.ga.fn);return a.extend({trackArrayChanges:!0})};b.ga.fn={remove:function(a){for(var c=this.F(),d=!1,g="function"!=typeof a||b.N(a)?e=>e===a:a,k=c.length;k--;){var t=c[k];if(g(t)){if(c[k]!==t)throw Error("Array modified during remove; cannot remove item"); d||this.ib();d=!0;c.splice(k,1)}}d&&this.Ja()}};Object.setPrototypeOf(b.ga.fn,b.Y.fn);Object.getOwnPropertyNames(Array.prototype).forEach(a=>{"function"===typeof Array.prototype[a]&&"constructor"!=a&&("copyWithin fill pop push reverse shift sort splice unshift".split(" ").includes(a)?b.ga.fn[a]=function(...c){var d=this.F();this.ib();this.wb(d,a,c);c=d[a](...c);this.Ja();return c===d?this:c}:b.ga.fn[a]=function(...c){return this()[a](...c)})});b.Fb=a=>b.N(a)&&"function"==typeof a.remove&&"function"== typeof a.push;b.m("observableArray",b.ga);b.m("isObservableArray",b.Fb);b.Wa.trackArrayChanges=(a,c)=>{function d(){function q(){if(f){var l=[].concat(a.F()||[]);if(a.qa("arrayChange")){if(!k||1++f,null,"spectate"),h=[].concat(a.F()||[]),k=null,t=a.subscribe(q))}a.Oa={};c&&"object"==typeof c&&b.a.extend(a.Oa,c);a.Oa.sparse=!0;if(!a.wb){var g=!1,k=null,t,e,f=0,h,r=a.ma,p=a.ua; a.ma=q=>{r&&r.call(a,q);"arrayChange"===q&&d()};a.ua=q=>{p&&p.call(a,q);"arrayChange"!==q||a.qa("arrayChange")||(t&&t.o(),e&&e.o(),e=t=null,g=!1,h=void 0)};a.wb=(q,l,n)=>{function m(E,C,z){return u[u.length]={status:E,value:C,index:z}}if(g&&!f){var u=[],w=q.length,v=n.length,y=0;switch(l){case "push":y=w;case "unshift":for(q=0;qn[0]?w+n[0]:n[0]),w);w=1===v?w:Math.min(y+ -(n[1]||0),w);v=y+v-2;l=Math.max(w,v);var x=[],B=[];for(let E=y,C=2;E{function d(){if(0{d.o()});return d};var M={equalityComparer:O,za:function(){return this[A].G},bc:function(){var a=[];b.a.K(this[A].s,(c,d)=>a[d.ja]=d.S);return a},Ya:function(a){if(!this[A].G)return!1;var c=this.bc();return c.includes(a)||!!c.find(d=>d.Ya&&d.Ya(a))},qb:function(a,c,d){if(this[A].bb&&c===this)throw Error("A 'pure' computed must not be called recursively");this[A].s[a]=d;d.ja=this[A].G++;d.ka=c.Aa()},ra:function(){var a,c= -this[A].s;for(a in c)if(Object.prototype.hasOwnProperty.call(c,a)){var d=c[a];if(this.ha&&d.S.ia||d.S.dc(d.ka))return!0}},sc:function(){this.ha&&!this[A].Da&&this.ha(!1)},fa:function(){var a=this[A];return a.T||0a.O(!0),c)):a.ha?a.ha(!0):a.O(!0)},O:function(a){var c=this[A],d=c.oa, -g=!1;if(!c.Da&&!c.W){if(c.i&&!b.a.Ua(c.i)||d&&d()){if(!c.gb){this.o();return}}else c.gb=!1;c.Da=!0;try{g=this.$b(a)}finally{c.Da=!1}return g}},$b:function(a){var c=this[A],d=c.bb?void 0:!c.G;var g={Yb:this,xa:c.s,Ra:c.G};b.l.ub({Xb:g,Wb:Y,j:this,Za:d});c.s={};c.G=0;a:{try{var k=c.Kb();break a}finally{b.l.end(),g.Ra&&!c.u&&b.a.K(g.xa,X),c.X=c.T=!1}k=void 0}c.G?g=this.Ea(c.I,k):(this.o(),g=!0);g&&(c.u?this.Ia():this.notifySubscribers(c.I,"beforeChange"),c.I=k,this.notifySubscribers(c.I,"spectate"), +(n[1]||0),w);v=y+v-2;l=Math.max(w,v);var x=[],B=[];for(let E=y,C=2;E{function d(){if(0{d.o()});return d};var M={equalityComparer:O,za:function(){return this[A].G},ac:function(){var a=[];b.a.K(this[A].s,(c,d)=>a[d.ja]=d.S);return a},Ya:function(a){if(!this[A].G)return!1;var c=this.ac();return c.includes(a)||!!c.find(d=>d.Ya&&d.Ya(a))},qb:function(a,c,d){if(this[A].bb&&c===this)throw Error("A 'pure' computed must not be called recursively");this[A].s[a]=d;d.ja=this[A].G++;d.ka=c.Aa()},ra:function(){var a,c= +this[A].s;for(a in c)if(Object.prototype.hasOwnProperty.call(c,a)){var d=c[a];if(this.ha&&d.S.ia||d.S.cc(d.ka))return!0}},sc:function(){this.ha&&!this[A].Da&&this.ha(!1)},fa:function(){var a=this[A];return a.T||0a.O(!0),c)):a.ha?a.ha(!0):a.O(!0)},O:function(a){var c=this[A],d=c.oa, +g=!1;if(!c.Da&&!c.W){if(c.i&&!b.a.Ua(c.i)||d&&d()){if(!c.gb){this.o();return}}else c.gb=!1;c.Da=!0;try{g=this.Zb(a)}finally{c.Da=!1}return g}},Zb:function(a){var c=this[A],d=c.bb?void 0:!c.G;var g={Xb:this,xa:c.s,Ra:c.G};b.l.ub({Wb:g,Vb:Y,j:this,Za:d});c.s={};c.G=0;a:{try{var k=c.Jb();break a}finally{b.l.end(),g.Ra&&!c.u&&b.a.K(g.xa,X),c.X=c.T=!1}k=void 0}c.G?g=this.Ea(c.I,k):(this.o(),g=!0);g&&(c.u?this.Ia():this.notifySubscribers(c.I,"beforeChange"),c.I=k,this.notifySubscribers(c.I,"spectate"), !c.u&&a&&this.notifySubscribers(c.I),this.ob&&this.ob());d&&this.notifySubscribers(c.I,"awake");return g},F:function(a){var c=this[A];(c.T&&(a||!c.G)||c.u&&this.ra())&&this.O();return c.I},Fa:function(a){b.P.fn.Fa.call(this,a);this.lb=function(){this[A].u||(this[A].X?this.O():this[A].T=!1);return this[A].I};this.ha=function(c){this.mb(this[A].I);this[A].T=!0;c&&(this[A].X=!0);this.nb(this,!c)}},o:function(){var a=this[A];!a.u&&a.s&&b.a.K(a.s,(c,d)=>d.o&&d.o());a.i&&a.Ta&&b.a.H.cb(a.i,a.Ta);a.s=void 0; -a.G=0;a.W=!0;a.X=!1;a.T=!1;a.u=!1;a.i=void 0;a.oa=void 0;a.Kb=void 0}},aa={ma:function(a){var c=this,d=c[A];if(!d.W&&d.u&&"change"==a){d.u=!1;if(d.X||c.ra())d.s=null,d.G=0,c.O()&&c.Ia();else{var g=[];b.a.K(d.s,(k,t)=>g[t.ja]=k);g.forEach((k,t)=>{var e=d.s[k],f=c.Pb(e.S);f.ja=t;f.ka=e.ka;d.s[k]=f});c.ra()&&c.O()&&c.Ia()}d.W||c.notifySubscribers(d.I,"awake")}},ua:function(a){var c=this[A];c.W||"change"!=a||this.qa("change")||(b.a.K(c.s,(d,g)=>{g.o&&(c.s[d]={S:g.S,ja:g.ja,ka:g.ka},g.o())}),c.u=!0,this.notifySubscribers(void 0, -"asleep"))},Aa:function(){var a=this[A];a.u&&(a.X||this.ra())&&this.O();return b.P.fn.Aa.call(this)}},ba={ma:function(a){"change"!=a&&"beforeChange"!=a||this.F()}};Object.setPrototypeOf(M,b.P.fn);var Q=b.Y.B;M[Q]=b.j;b.m("computed",b.j);b.m("isComputed",a=>"function"==typeof a&&a[Q]===M[Q]);b.m("computed.fn",M);b.ea(M,"dispose",M.o);b.Jb=a=>{if("function"===typeof a)return b.j(a,{pure:!0});a={...a,pure:!0};return b.j(a)};b.m("pureComputed",b.Jb);(()=>{b.v={L:a=>{switch(a.nodeName){case "OPTION":return!0=== -a.__ko__hasDomDataOptionValue__?b.a.c.get(a,b.b.options.ab):a.value;case "SELECT":return 0<=a.selectedIndex?b.v.L(a.options[a.selectedIndex]):void 0;default:return a.value}},Ka:(a,c,d)=>{switch(a.nodeName){case "OPTION":"string"===typeof c?(b.a.c.set(a,b.b.options.ab,void 0),delete a.__ko__hasDomDataOptionValue__,a.value=c):(b.a.c.set(a,b.b.options.ab,c),a.__ko__hasDomDataOptionValue__=!0,a.value="number"===typeof c?c:"");break;case "SELECT":for(var g=-1,k=""===c||null==c,t=0,e=a.options.length,f;t< -e;++t)if(f=b.v.L(a.options[t]),f==c||""===f&&k){g=t;break}if(d||0<=g||k&&1{function a(f){f=b.a.Ob(f);123===f.charCodeAt(0)&&(f=f.slice(1,-1));f+="\n,";var h=[],r=f.match(g),p=[],q=0;if(1=q){h.push(u&&p.length?{key:u,value:p.join("")}:{unknown:u||p.join("")});var u=q=0;p=[];continue}}else if(58===m){if(!q&&!u&&1===p.length){u=p.pop();continue}}else if(47=== -m&&1 -r(m.key||m.unknown,m.value));q.length&&r("_ko_property_writers","{"+q.join(",")+" }");return p.join(",")},jc:(f,h)=>-1r.key==h),jb:(f,h,r,p,q)=>{if(f&&b.N(f))!b.ic(f)||q&&f.F()===p||f(p);else if((f=h.get("_ko_property_writers"))&&f[r])f[r](p)}}})();(()=>{function a(e){return 8==e.nodeType&&g.test(e.nodeValue)}function c(e){return 8==e.nodeType&&k.test(e.nodeValue)}function d(e,f){for(var h=e,r=1,p=[];h=h.nextSibling;){if(c(h)&&(b.a.c.set(h,t,!0),!--r))return p;p.push(h);a(h)&&++r}if(!f)throw Error("Cannot find closing comment tag to match: "+ +a.G=0;a.W=!0;a.X=!1;a.T=!1;a.u=!1;a.i=void 0;a.oa=void 0;a.Jb=void 0}},aa={ma:function(a){var c=this,d=c[A];if(!d.W&&d.u&&"change"==a){d.u=!1;if(d.X||c.ra())d.s=null,d.G=0,c.O()&&c.Ia();else{var g=[];b.a.K(d.s,(k,t)=>g[t.ja]=k);g.forEach((k,t)=>{var e=d.s[k],f=c.Ob(e.S);f.ja=t;f.ka=e.ka;d.s[k]=f});c.ra()&&c.O()&&c.Ia()}d.W||c.notifySubscribers(d.I,"awake")}},ua:function(a){var c=this[A];c.W||"change"!=a||this.qa("change")||(b.a.K(c.s,(d,g)=>{g.o&&(c.s[d]={S:g.S,ja:g.ja,ka:g.ka},g.o())}),c.u=!0,this.notifySubscribers(void 0, +"asleep"))},Aa:function(){var a=this[A];a.u&&(a.X||this.ra())&&this.O();return b.P.fn.Aa.call(this)}},ba={ma:function(a){"change"!=a&&"beforeChange"!=a||this.F()}};Object.setPrototypeOf(M,b.P.fn);var Q=b.Y.B;M[Q]=b.j;b.m("computed",b.j);b.m("isComputed",a=>"function"==typeof a&&a[Q]===M[Q]);b.m("computed.fn",M);b.ea(M,"dispose",M.o);b.mc=a=>{if("function"===typeof a)return b.j(a,{pure:!0});a={...a,pure:!0};return b.j(a)};(()=>{b.v={L:a=>{switch(a.nodeName){case "OPTION":return!0===a.__ko__hasDomDataOptionValue__? +b.a.c.get(a,b.b.options.ab):a.value;case "SELECT":return 0<=a.selectedIndex?b.v.L(a.options[a.selectedIndex]):void 0;default:return a.value}},Ka:(a,c,d)=>{switch(a.nodeName){case "OPTION":"string"===typeof c?(b.a.c.set(a,b.b.options.ab,void 0),delete a.__ko__hasDomDataOptionValue__,a.value=c):(b.a.c.set(a,b.b.options.ab,c),a.__ko__hasDomDataOptionValue__=!0,a.value="number"===typeof c?c:"");break;case "SELECT":for(var g=-1,k=""===c||null==c,t=0,e=a.options.length,f;t{function a(f){f=b.a.Nb(f);123===f.charCodeAt(0)&&(f=f.slice(1,-1));f+="\n,";var h=[],r=f.match(g),p=[],q=0;if(1=q){h.push(u&&p.length?{key:u,value:p.join("")}:{unknown:u||p.join("")});var u=q=0;p=[];continue}}else if(58===m){if(!q&&!u&&1===p.length){u=p.pop();continue}}else if(47===m&&1 +r(m.key||m.unknown,m.value));q.length&&r("_ko_property_writers","{"+q.join(",")+" }");return p.join(",")},ic:(f,h)=>-1r.key==h),jb:(f,h,r,p,q)=>{if(f&&b.N(f))!b.hc(f)||q&&f.F()===p||f(p);else if((f=h.get("_ko_property_writers"))&&f[r])f[r](p)}}})();(()=>{function a(e){return 8==e.nodeType&&g.test(e.nodeValue)}function c(e){return 8==e.nodeType&&k.test(e.nodeValue)}function d(e,f){for(var h=e,r=1,p=[];h=h.nextSibling;){if(c(h)&&(b.a.c.set(h,t,!0),!--r))return p;p.push(h);a(h)&&++r}if(!f)throw Error("Cannot find closing comment tag to match: "+ e.nodeValue);return null}var g=/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=/^\s*\/ko\s*$/,t="__ko_matchedEndComment__";b.h={Z:{},childNodes:e=>a(e)?d(e):e.childNodes,pa:e=>{a(e)?(e=d(e))&&[...e].forEach(f=>b.removeNode(f)):b.a.Va(e)},sa:(e,f)=>{a(e)?(b.h.pa(e),e.after(...f)):b.a.sa(e,f)},prepend:(e,f)=>{a(e)?e.nextSibling.before(f):e.prepend(f)},Eb:(e,f,h)=>{h?h.after(f):b.h.prepend(e,f)},firstChild:e=>{if(a(e))return e=e.nextSibling,!e||c(e)?null:e;let f=e.firstChild;if(f&&c(f))throw Error("Found invalid end comment, as the first child of "+ -e);return f},nextSibling:e=>{if(a(e)){var f=d(e,void 0);e=f?(f.length?f[f.length-1]:e).nextSibling:null}if((f=e.nextSibling)&&c(f)){if(c(f)&&!b.a.c.get(f,t))throw Error("Found end comment without a matching opening comment, as child of "+e);return null}return f},cc:a,qc:e=>(e=e.nodeValue.match(g))?e[1]:null}})();(()=>{const a=new Map;b.vb=new class{kc(c){switch(c.nodeType){case 1:return null!=c.getAttribute("data-bind");case 8:return b.h.cc(c);default:return!1}}ac(c,d){a:{switch(c.nodeType){case 1:var g= -c.getAttribute("data-bind");break a;case 8:g=b.h.qc(c);break a}g=null}if(g)try{let t={valueAccessors:!0},e=a.get(g);if(!e){var k="with($context){with($data||{}){return{"+b.D.mc(g,t)+"}}}";e=new Function("$context","$element",k);a.set(g,e)}return e(d,c)}catch(t){throw t.message="Unable to parse bindings.\nBindings value: "+g+"\nMessage: "+t.message,t;}return null}}})();(()=>{function a(l){var n=(l=b.a.c.get(l,p))&&l.C;n&&(l.C=null,n.Ib())}function c(l,n){for(var m,u=b.h.firstChild(n);m=u;)u=b.h.nextSibling(m), -d(l,m);b.g.notify(n,b.g.A)}function d(l,n){var m=l;if(1===n.nodeType||b.vb.kc(n))m=k(n,null,l).bindingContextForDescendants;m&&n.matches&&!n.matches("SCRIPT,TEXTAREA,TEMPLATE")&&c(m,n)}function g(l){var n=[],m={},u=[];b.a.K(l,function y(v){if(!m[v]){var x=b.b[v];x&&(x.after&&(u.push(v),x.after.forEach(B=>{if(l[B]){if(u.includes(B))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+u.join(", "));y(B)}}),u.length--),n.push({key:v,Db:x}));m[v]=!0}});return n} -function k(l,n,m){var u=b.a.c.Xa(l,p,{}),w=u.Vb;if(!n){if(w)throw Error("You cannot apply bindings multiple times to the same element.");u.Vb=!0}w||(u.context=m);u.$a||(u.$a={});if(n&&"function"!==typeof n)var v=n;else{var y=b.j(()=>{if(v=n?n(m,l):b.vb.ac(l,m)){if(m[e])m[e]();if(m[h])m[h]()}return v},{i:l});v&&y.fa()||(y=null)}var x=m,B;if(v){var E=y?z=>()=>y()[z]():z=>v[z],C={get:z=>v[z]&&E(z)(),has:z=>z in v};b.g.A in v&&b.g.subscribe(l,b.g.A,()=>{var z=v[b.g.A]();if(z){var D=b.h.childNodes(l); +e);return f},nextSibling:e=>{if(a(e)){var f=d(e,void 0);e=f?(f.length?f[f.length-1]:e).nextSibling:null}if((f=e.nextSibling)&&c(f)){if(c(f)&&!b.a.c.get(f,t))throw Error("Found end comment without a matching opening comment, as child of "+e);return null}return f},bc:a,qc:e=>(e=e.nodeValue.match(g))?e[1]:null}})();(()=>{const a=new Map;b.vb=new class{jc(c){switch(c.nodeType){case 1:return null!=c.getAttribute("data-bind");case 8:return b.h.bc(c);default:return!1}}$b(c,d){a:{switch(c.nodeType){case 1:var g= +c.getAttribute("data-bind");break a;case 8:g=b.h.qc(c);break a}g=null}if(g)try{let t={valueAccessors:!0},e=a.get(g);if(!e){var k="with($context){with($data||{}){return{"+b.D.lc(g,t)+"}}}";e=new Function("$context","$element",k);a.set(g,e)}return e(d,c)}catch(t){throw t.message="Unable to parse bindings.\nBindings value: "+g+"\nMessage: "+t.message,t;}return null}}})();(()=>{function a(l){var n=(l=b.a.c.get(l,p))&&l.C;n&&(l.C=null,n.Ib())}function c(l,n){for(var m,u=b.h.firstChild(n);m=u;)u=b.h.nextSibling(m), +d(l,m);b.g.notify(n,b.g.A)}function d(l,n){var m=l;if(1===n.nodeType||b.vb.jc(n))m=k(n,null,l).bindingContextForDescendants;m&&n.matches&&!n.matches("SCRIPT,TEXTAREA,TEMPLATE")&&c(m,n)}function g(l){var n=[],m={},u=[];b.a.K(l,function y(v){if(!m[v]){var x=b.b[v];x&&(x.after&&(u.push(v),x.after.forEach(B=>{if(l[B]){if(u.includes(B))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+u.join(", "));y(B)}}),u.length--),n.push({key:v,Db:x}));m[v]=!0}});return n} +function k(l,n,m){var u=b.a.c.Xa(l,p,{}),w=u.Ub;if(!n){if(w)throw Error("You cannot apply bindings multiple times to the same element.");u.Ub=!0}w||(u.context=m);u.$a||(u.$a={});if(n&&"function"!==typeof n)var v=n;else{var y=b.j(()=>{if(v=n?n(m,l):b.vb.$b(l,m)){if(m[e])m[e]();if(m[h])m[h]()}return v},{i:l});v&&y.fa()||(y=null)}var x=m,B;if(v){var E=y?z=>()=>y()[z]():z=>v[z],C={get:z=>v[z]&&E(z)(),has:z=>z in v};b.g.A in v&&b.g.subscribe(l,b.g.A,()=>{var z=v[b.g.A]();if(z){var D=b.h.childNodes(l); D.length&&z(D,b.zb(D[0]))}});b.g.ca in v&&(x=b.g.fb(l,m),b.g.subscribe(l,b.g.ca,()=>{var z=v[b.g.ca]();z&&b.h.firstChild(l)&&z(l)}));g(v).forEach(z=>{var D=z.Db.init,F=z.Db.update,I=z.key;if(8===l.nodeType&&!b.h.Z[I])throw Error("The binding '"+I+"' cannot be used with virtual elements");try{"function"==typeof D&&b.l.M(()=>{var N=D(l,E(I),C,x.$data,x);if(N&&N.controlsDescendantBindings){if(void 0!==B)throw Error("Multiple bindings ("+B+" and "+I+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element."); B=I}}),"function"==typeof F&&b.j(()=>F(l,E(I),C,x.$data,x),{i:l})}catch(N){throw N.message='Unable to process binding "'+I+": "+v[I]+'"\nMessage: '+N.message,N;}})}u=void 0===B;return{shouldBindDescendants:u,bindingContextForDescendants:u&&x}}function t(l,n){return l&&l instanceof b.aa?l:new b.aa(l,void 0,void 0,n)}var e=Symbol("_subscribable"),f=Symbol("_ancestorBindingInfo"),h=Symbol("_dataDependency");b.b={};var r={};b.aa=class{constructor(l,n,m,u,w){function v(){var D=E?B():B,F=b.a.f(D);n?(b.a.extend(y, -n),f in n&&(y[f]=n[f])):(y.$parents=[],y.$root=F,y.ko=b);y[e]=z;x?F=y.$data:(y.$rawData=D,y.$data=F);m&&(y[m]=F);u&&u(y,n,F);if(n&&n[e]&&!b.l.j().Ya(n[e]))n[e]();C&&(y[h]=C);return y.$data}var y=this,x=l===r,B=x?void 0:l,E="function"==typeof B&&!b.N(B),C=w&&w.dataDependency;if(w&&w.exportDependencies)v();else{var z=b.Jb(v);z.F();z.fa()?z.equalityComparer=null:y[e]=void 0}}["createChildContext"](l,n,m,u){!u&&n&&"object"==typeof n&&(u=n,n=u.as,m=u.extend);return new b.aa(l,this,n,(w,v)=>{w.$parentContext= -v;w.$parent=v.$data;w.$parents=(v.$parents||[]).slice(0);w.$parents.unshift(w.$parent);m&&m(w)},u)}["extend"](l,n){return new b.aa(r,this,null,m=>b.a.extend(m,"function"==typeof l?l(m):l),n)}};var p=b.a.c.U();class q{constructor(l,n,m){this.B=l;this.na=n;this.va=new Set;this.A=!1;n.C||b.a.H.la(l,a);m&&m.C&&(m.C.va.add(l),this.V=m)}Ib(){this.V&&this.V.C&&this.V.C.Zb(this.B)}Zb(l){this.va.delete(l);!this.va.size&&this.A&&this.yb()}yb(){this.A=!0;this.na.C&&!this.va.size&&(this.na.C=null,b.a.H.cb(this.B, +n),f in n&&(y[f]=n[f])):(y.$parents=[],y.$root=F,y.ko=b);y[e]=z;x?F=y.$data:(y.$rawData=D,y.$data=F);m&&(y[m]=F);u&&u(y,n,F);if(n&&n[e]&&!b.l.j().Ya(n[e]))n[e]();C&&(y[h]=C);return y.$data}var y=this,x=l===r,B=x?void 0:l,E="function"==typeof B&&!b.N(B),C=w&&w.dataDependency;if(w&&w.exportDependencies)v();else{var z=b.mc(v);z.F();z.fa()?z.equalityComparer=null:y[e]=void 0}}["createChildContext"](l,n,m,u){!u&&n&&"object"==typeof n&&(u=n,n=u.as,m=u.extend);return new b.aa(l,this,n,(w,v)=>{w.$parentContext= +v;w.$parent=v.$data;w.$parents=(v.$parents||[]).slice(0);w.$parents.unshift(w.$parent);m&&m(w)},u)}["extend"](l,n){return new b.aa(r,this,null,m=>b.a.extend(m,"function"==typeof l?l(m):l),n)}};var p=b.a.c.U();class q{constructor(l,n,m){this.B=l;this.na=n;this.va=new Set;this.A=!1;n.C||b.a.H.la(l,a);m&&m.C&&(m.C.va.add(l),this.V=m)}Ib(){this.V&&this.V.C&&this.V.C.Yb(this.B)}Yb(l){this.va.delete(l);!this.va.size&&this.A&&this.yb()}yb(){this.A=!0;this.na.C&&!this.va.size&&(this.na.C=null,b.a.H.cb(this.B, a),b.g.notify(this.B,b.g.ca),this.Ib())}}b.g={A:"childrenComplete",ca:"descendantsComplete",subscribe:(l,n,m,u,w)=>{var v=b.a.c.Xa(l,p,{});v.da||(v.da=new b.P);w&&w.notifyImmediately&&v.$a[n]&&b.l.M(m,u,[l]);return v.da.subscribe(m,u,n)},notify:(l,n)=>{var m=b.a.c.get(l,p);if(m&&(m.$a[n]=!0,m.da&&m.da.notifySubscribers(l,n),n==b.g.A))if(m.C)m.C.yb();else if(void 0===m.C&&m.da&&m.da.qa(b.g.ca))throw Error("descendantsComplete event not supported for bindings on this node");},fb:(l,n)=>{var m=b.a.c.Xa(l, p,{});m.C||(m.C=new q(l,m,n[f]));return n[f]==m?n:n.extend(u=>{u[f]=m})}};b.pc=l=>(l=b.a.c.get(l,p))&&l.context;b.rb=(l,n,m)=>k(l,n,t(m));b.tb=(l,n)=>{1!==n.nodeType&&8!==n.nodeType||c(t(l),n)};b.sb=function(l,n,m){if(2>arguments.length){if(n=L.body,!n)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");}else if(!n||1!==n.nodeType&&8!==n.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node"); d(t(l,m),n)};b.zb=l=>(l=l&&[1,8].includes(l.nodeType)&&b.pc(l))?l.$data:void 0;b.m("bindingHandlers",b.b);b.m("applyBindings",b.sb);b.m("applyBindingAccessorsToNode",b.rb);b.m("dataFor",b.zb)})();(()=>{function a(f,h){var r={},p=t[f]||{},q=p.template;p=p.viewModel;if(q){q.element||c(f,"Unknown template value: "+q);q=q.element;var l=L.getElementById(q);l||c(f,"Cannot find element with ID "+q);l.matches("TEMPLATE")||c(f,"Template Source Element not a