Put knockout bind context Proxy outside bindingFunction

This commit is contained in:
the-djmaze 2024-10-29 17:16:22 +01:00
parent 3d55bdaf5a
commit c744b83480
3 changed files with 52 additions and 53 deletions

View file

@ -1636,17 +1636,17 @@ ko.bindingProvider = new class
// Build the source for a function that evaluates "expression"
// Use one "with" that has one secure scope handling Proxy
// Deprecated: with is no longer recommended
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString),
functionBody = "$context = new Proxy(\
$context,\
{\
has: () => true,\
get: (target, key) => target[key] || target['$data'][key]\
}\
);with($context){return{" + rewrittenBindings + "}}";
bindingFunction = new Function("$context", functionBody);
bindingFunction = new Function("$context",
"with($context){return{" + ko.expressionRewriting.preProcessBindings(bindingsString) + "}}");
bindingCache.set(cacheKey, bindingFunction);
}
bindingContext = new Proxy(
bindingContext,
{
has: () => true,
get: (target, key) => target[key] || target['$data'][key]
}
);
return bindingFunction(bindingContext);
} catch (ex) {
ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString

View file

@ -31,38 +31,37 @@ a.value=b):(c.g.l.set(a,c.i.options.Wa,b),a.__ko__hasDomDataOptionValue__=!0,a.v
l[k-1].match(b))&&!d[p[0]]&&(e=e.slice(e.indexOf(m)+1),l=e.match(a),k=-1,m="/"):40===p||123===p||91===p?++h:41===p||125===p||93===p?--h:n||f.length||34!==p&&39!==p||(m=m.slice(1,-1));f.push(m)}if(0<h)throw Error("Unbalanced parentheses, braces, or brackets");}g.push("'$data':()=>$data");return g.join(",")},cc:(e,g)=>-1<e.findIndex(l=>l.key==g),Ga:(e,g,l,f,h,k)=>{g&&c.W(g)?!c.vb(g)||k&&g.L()===h||g(h):(console.log(`"${f}" should contain observable in ${e.outerHTML.replace(/>.+/,">")}`),l.get("$data")[f]=
h)}}})();(()=>{function a(f){return 8==f.nodeType&&e.test(f.nodeValue)}function b(f){return 8==f.nodeType&&g.test(f.nodeValue)}function d(f,h){for(var k=f,m=1,p=[];k=k.nextSibling;){if(b(k)&&(c.g.l.set(k,l,!0),!--m))return p;p.push(k);a(k)&&++m}if(!h)throw Error("Cannot find closing comment tag to match: "+f.nodeValue);return null}var e=/^\s*ko(?:\s+([\s\S]+))?\s*$/,g=/^\s*\/ko\s*$/,l="__ko_matchedEndComment__";c.m={aa:{},childNodes:f=>a(f)?d(f):f.childNodes,ja:f=>{a(f)?(f=d(f))&&[...f].forEach(h=>
c.removeNode(h)):c.g.Qa(f)},pa:(f,h)=>{a(f)?(c.m.ja(f),f.after(...h)):c.g.pa(f,h)},prepend:(f,h)=>{a(f)?f.nextSibling.before(h):f.prepend(h)},Ub:(f,h,k)=>{k?k.after(h):c.m.prepend(f,h)},firstChild:f=>{if(a(f))return f=f.nextSibling,!f||b(f)?null:f;let h=f.firstChild;if(h&&b(h))throw Error("Found invalid end comment, as the first child of "+f);return h},nextSibling:f=>{if(a(f)){var h=d(f,void 0);f=h?(h.length?h[h.length-1]:f).nextSibling:null}if((h=f.nextSibling)&&b(h)){if(b(h)&&!c.g.l.get(h,l))throw Error("Found end comment without a matching opening comment, as child of "+
f);return null}return h},Qb:a,ac:f=>(f=f.nodeValue.match(e))?f[1]:null}})();const S=new Map;c.ob=new class{Xb(a){switch(a.nodeType){case 1:return null!=a.getAttribute("data-bind");case 8:return c.m.Qb(a)}return!1}Ob(a,b){a:{switch(a.nodeType){case 1:a=a.getAttribute("data-bind");break a;case 8:a=c.m.ac(a);break a}a=null}if(a)try{let e=S.get(a);if(!e){var d="$context = new Proxy( $context, { has: () => true, get: (target, key) => target[key] || target['$data'][key] } );with($context){return{"+
c.la.Yb(a)+"}}";e=new Function("$context",d);S.set(a,e)}return e(b)}catch(e){throw e.message="Unable to parse bindings.\nBindings value: "+a+"\nMessage: "+e.message,e;}return null}};const G=Symbol("_subscribable"),H=Symbol("_ancestorBindingInfo"),T=Symbol("_dataDependency"),U={},I=c.g.l.Z();c.i={};c.ba=class{constructor(a,b,d,e){var g=this,l=a===U,f=l?void 0:a,h="function"==typeof f&&!c.W(f),k=e?.dataDependency;a=()=>{var p=h?f():f;p=c.g.h(p);b?(c.g.extend(g,b),H in b&&(g[H]=b[H])):g.$root=p;g[G]=
m;l?p=g.$data:g.$data=p;d?.(g,b,p);if(b?.[G]&&!c.u.o().Sa(b[G]))b[G]();k&&(g[T]=k);return g.$data};if(e?.exportDependencies)a();else{var m=c.xb(a);m.L();m.isActive()?m.ka=null:g[G]=void 0}}createChildContext(a,b){return new c.ba(a,this,(d,e)=>{d.$parent=e.$data;b.extend?.(d)},b)}extend(a,b){return new c.ba(U,this,d=>c.g.extend(d,"function"==typeof a?a(d):a),b)}};const V=a=>{a=c.g.l.get(a,I);var b=a?.D;b&&(a.D=null,b.wb())};class la{constructor(a,b,d){this.H=a;this.da=b;this.ta=new Set;this.F=!1;b.D||
c.g.N.addDisposeCallback(a,V);d?.D&&(d.D.ta.add(a),this.za=d)}wb(){this.za?.D?.Mb(this.H)}Mb(a){this.ta.delete(a);this.ta.size||this.rb?.()}rb(){this.F=!0;this.da.D&&!this.ta.size&&(this.da.D=null,c.g.N.Ya(this.H,V),c.j.notify(this.H,c.j.ca),this.wb())}}c.j={F:"childrenComplete",ca:"descendantsComplete",subscribe:(a,b,d,e,g)=>{var l=c.g.l.Ra(a,I,{});l.wa||(l.wa=new c.P);g?.notifyImmediately&&l.Va[b]&&c.u.I(d,e,[a]);return l.wa.subscribe(d,e,b)},notify:(a,b)=>{var d=c.g.l.get(a,I);if(d&&(d.Va[b]=!0,
d.wa?.B(a,b),b==c.j.F))if(d.D)d.D.rb();else if(void 0===d.D&&d.wa?.na(c.j.ca))throw Error("descendantsComplete event not supported for bindings on this node");},$a:(a,b)=>{var d=c.g.l.Ra(a,I,{});d.D||(d.D=new la(a,d,b[H]));return b[H]==d?b:b.extend(e=>{e[H]=d})}};const X=(a,b)=>{for(var d,e=c.m.firstChild(b);d=e;)e=c.m.nextSibling(d),W(a,d);c.j.notify(b,c.j.F)},W=(a,b)=>{var d=a;if(1===b.nodeType||c.ob.Xb(b))d=Y(b,null,a);d&&!b.matches?.("SCRIPT,TEXTAREA,TEMPLATE")&&X(d,b)},ma=a=>{var b=[],d={},e=
[],g=l=>{if(!d[l]){var f=c.i[l];f&&(f.after&&(e.push(l),f.after.forEach(h=>{if(a[h]){if(e.includes(h))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+e.join(", "));g(h)}}),e.length--),b.push({key:l,ub:f}));d[l]=!0}};c.g.K(a,g);return b},Y=(a,b,d)=>{var e=c.g.l.Ra(a,I,{}),g=e.Hb;if(!b){if(g)throw Error("You cannot apply bindings multiple times to the same element.");e.Hb=!0}g||(e.context=d);e.Va||(e.Va={});if(b&&"function"!==typeof b)var l=b;else{var f=
c.o(()=>{if(l=b?b(d,a):c.ob.Ob(a,d))d[G]?.(),d[T]?.();return l},{s:a});l&&f.isActive()||(f=null)}var h=d,k;if(l){var m=f?n=>()=>f()[n]():n=>l[n],p={get:n=>l[n]&&m(n)(),has:n=>n in l};c.j.F in l&&c.j.subscribe(a,c.j.F,()=>{var n=l[c.j.F]();if(n){var q=c.m.childNodes(a);q.length&&n(q,c.dataFor(q[0]))}});c.j.ca in l&&(h=c.j.$a(a,d),c.j.subscribe(a,c.j.ca,()=>{var n=l[c.j.ca]();n&&c.m.firstChild(a)&&n(a)}));ma(l).forEach(n=>{var q=n.ub.init,r=n.ub.update,u=n.key;if(8===a.nodeType&&!c.m.aa[u])throw Error("The binding '"+
u+"' cannot be used with comment nodes");try{"function"==typeof q&&c.u.I(()=>{var t=q(a,m(u),p,h.$data,h);if(t&&t.controlsDescendantBindings){if(void 0!==k)throw Error("Multiple bindings ("+k+" and "+u+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");k=u}}),"function"==typeof r&&c.o(()=>r(a,m(u),p,h.$data,h),{s:a})}catch(t){throw t.message='Unable to process binding "'+u+": "+l[u]+'"\nMessage: '+t.message,t;}})}return void 0===
k&&h};c.$b=a=>c.g.l.get(a,I)?.context;const O=a=>a&&a instanceof c.ba?a:new c.ba(a);c.applyBindingAccessorsToNode=(a,b,d)=>Y(a,b,O(d));c.mb=(a,b)=>{1!==b.nodeType&&8!==b.nodeType||X(O(a),b)};c.Ib=(a,b)=>W(O(a),b);c.dataFor=a=>([1,8].includes(a?.nodeType)&&c.$b(a))?.$data;c.U("bindingHandlers",c.i);(()=>{var a=Object.create(null),b=new Map;c.components={get:(l,f)=>{if(b.has(l))f(b.get(l));else{var h=a[l];h?h.subscribe(f):(h=a[l]=new c.P,h.subscribe(f),g(l,k=>{b.set(l,k);delete a[l];h.B(k)}))}},register:(l,
f)=>{if(!f)throw Error("Invalid configuration for "+l);if(d[l])throw Error("Component "+l+" is already registered");d[l]=f}};var d=Object.create(null),e=(l,f)=>{throw Error(`Component '${l}': ${f}`);},g=(l,f)=>{var h={},k=d[l]||{},m=k.template;k=k.viewModel;if(m){m.element||e(l,"Unknown template value: "+m);m=m.element;var p=J.getElementById(m);p||e(l,"Cannot find element with ID "+m);p.matches("TEMPLATE")||e(l,"Template Source Element not a <template>");h.template=c.g.ua(p.content.childNodes)}k&&
("function"!==typeof k.createViewModel&&e(l,"Unknown viewModel value: "+k),h.createViewModel=k.createViewModel);f(h.template&&h.createViewModel?h:null)}})();(()=>{var a=0;c.i.component={init:(b,d,e,g,l)=>{var f,h,k,m=()=>{var p=f&&f.dispose;"function"===typeof p&&p.call(f);k&&k.dispose();h=f=k=null};c.m.ja(b);c.g.N.addDisposeCallback(b,m);c.o(()=>{var p=c.g.h(d());if("string"!==typeof p){var n=c.g.h(p.params);p=c.g.h(p.name)}if(!p)throw Error("No component name specified");var q=c.j.$a(b,l),r=h=++a;
c.components.get(p,u=>{if(h===r){m();if(!u)throw Error("Unknown component '"+p+"'");var t=u.template;if(!t)throw Error("Component '"+p+"' has no template");c.m.pa(b,c.g.ua(t));f=u.createViewModel(n,{element:b});c.mb(q.createChildContext(f,{}),b)}})},{s:b});return{controlsDescendantBindings:!0}}};c.m.aa.component=!0})();c.i.attr={update:(a,b)=>{b=c.g.h(b())||{};c.g.K(b,function(d,e){e=c.g.h(e);var g=d.indexOf(":");g="lookupNamespaceURI"in a&&0<g&&a.lookupNamespaceURI(d.slice(0,g));!1===e||null==e?
g?a.removeAttributeNS(g,d):a.removeAttribute(d):(e=e.toString(),g?a.setAttributeNS(g,d,e):a.setAttribute(d,e))})}};(()=>{c.i.checked={after:["value","attr"],init:function(a,b,d){var e="checkbox"==a.type,g="radio"==a.type;if(e||g){const n=c.xb(()=>{if(d.has("checkedValue"))return c.g.h(d.get("checkedValue"));if(m)return d.has("value")?c.g.h(d.get("value")):a.value});var l=()=>{if(!c.u.Ca()){var q=a.checked,r=n();if(q||!g&&!c.u.ma()){var u=c.u.I(b);if(h){var t=k?u.L():u,z=p;p=r;z!==r?q&&(t.push(r),
t.remove(z)):q?t.push(r):t.remove(r);k&&c.vb(u)&&u(t)}else e&&(void 0===r?r=q:q||(r=void 0)),c.la.Ga(a,u,d,"checked",r,!0)}}},f=b(),h=e&&c.g.h(f)instanceof Array,k=!(h&&f.push&&f.splice),m=g||h,p=h?n():void 0;c.o(l,null,{s:a});a.addEventListener("click",l);c.o(()=>{var q=c.g.h(b()),r=n();h?(a.checked=q.includes(r),p=r):a.checked=e&&void 0===r?!!q:n()===q},null,{s:a});f=void 0}}};c.i.checkedValue={update:function(a,b){a.value=c.g.h(b())}}})();var P=(a,b,d)=>b&&b.split(/\s+/).forEach(e=>a.classList.toggle(e,
d));c.i.css={update:(a,b)=>{b=c.g.h(b());"object"==typeof b?c.g.K(b,(d,e)=>{e=c.g.h(e);P(a,d,!!e)}):(b=c.g.Bb(b),P(a,a.__ko__cssValue,!1),a.__ko__cssValue=b,P(a,b,!0))}};c.i.enable={update:(a,b)=>{(b=c.g.h(b()))&&a.disabled?a.removeAttribute("disabled"):b||a.disabled||(a.disabled=!0)}};c.i.disable={update:(a,b)=>c.i.enable.update(a,()=>!c.g.h(b()))};c.i.event={init:function(a,b,d,e,g){c.g.K(b()||{},l=>{"string"==typeof l&&a.addEventListener(l,(...f)=>{var h=b()[l];if(h)try{e=g.$data;var k=h.apply(e,
[e,...f])}finally{!0!==k&&f[0].preventDefault()}})})}};const Z=a=>()=>{var b=a(),d=c.W(b)?b.L():b;if(!d||Array.isArray(d))return{foreach:b};c.g.h(b);return{foreach:d.data}};c.i.foreach={init:(a,b)=>c.i.template.init(a,Z(b)),update:(a,b,d,e,g)=>c.i.template.update(a,Z(b),d,e,g)};c.m.aa.foreach=!0;c.i.hasfocus={init:(a,b,d)=>{var e=l=>{a.__ko_hasfocusUpdating=!0;l=a.ownerDocument.activeElement===a;c.la.Ga(a,b(),d,"hasfocus",l,!0);a.__ko_hasfocusLastValue=l;a.__ko_hasfocusUpdating=!1},g=e.bind(null,
!0);e=e.bind(null,!1);a.addEventListener("focus",g);a.addEventListener("focusin",g);a.addEventListener("blur",e);a.addEventListener("focusout",e);a.__ko_hasfocusLastValue=!1},update:(a,b)=>{b=!!c.g.h(b());a.__ko_hasfocusUpdating||a.__ko_hasfocusLastValue===b||(b?a.focus():a.blur())}};c.i.html={init:()=>({controlsDescendantBindings:!0}),update:(a,b)=>{c.g.Qa(a);b=c.g.h(b());if(null!=b){const d=J.createElement("template");d.innerHTML="string"!=typeof b?b.toString():b;a.appendChild(d.content)}}};(()=>
{function a(b,d,e){c.i[b]={init:(g,l,f,h,k)=>{var m,p={};d&&(p={exportDependencies:!0});var n=f.has(c.j.ca);c.o(()=>{var q=c.g.h(l()),r=!e!==!q,u=!m;n&&(k=c.j.$a(g,k));if(r){p.dataDependency=c.u.o();var t=d?k.createChildContext("function"==typeof q?q:l,p):c.u.ma()?k.extend(null,p):k}u&&c.u.ma()&&(m=c.g.ua(c.m.childNodes(g),!0));r?(u||c.m.pa(g,c.g.ua(m)),c.mb(t,g)):(c.m.ja(g),c.j.notify(g,c.j.F))},{s:g});return{controlsDescendantBindings:!0}}};c.m.aa[b]=!0}a("if");a("ifnot",!1,!0);a("with",!0)})();
var aa={};c.i.options={init:a=>{if(!a.matches("SELECT"))throw Error("options binding applies only to SELECT elements");let b=a.length;for(;b--;)a.remove(b);return{controlsDescendantBindings:!0}},update:(a,b,d)=>{var e=a.multiple,g=0!=a.length&&e?a.scrollTop:null,l=c.g.h(b()),f=[];b=()=>Array.from(a.options).filter(n=>n.selected);var h=(n,q,r)=>{var u=typeof q;return"function"==u?q(n):"string"==u?n[q]:r},k=(n,q)=>{f.length&&(n=f.includes(c.C.M(q[0])),q[0].selected=n,p&&!n&&c.u.I(c.g.Db,null,[a,"change"]))};
e?f=b().map(c.C.M):0<=a.selectedIndex&&f.push(c.C.M(a.options[a.selectedIndex]));if(l){Array.isArray(l)||(l=[l]);var m=l.filter(n=>n??1)}var p=!1;l=k;d.has("optionsAfterRender")&&"function"==typeof d.get("optionsAfterRender")&&(l=(n,q)=>{k(n,q);c.u.I(d.get("optionsAfterRender"),null,[q[0],n!==aa?n:void 0])});c.g.Ab(a,m,(n,q,r)=>{r.length&&(f=r[0].selected?[c.C.M(r[0])]:[],p=!0);q=a.ownerDocument.createElement("option");n===aa?(c.g.Za(q),c.C.Fa(q,void 0)):(r=h(n,d.get("optionsValue"),n),c.C.Fa(q,c.g.h(r)),
n=h(n,d.get("optionsText"),r),c.g.Za(q,n));return[q]},{},l);m=f.length;(e?m&&b().length<m:m&&0<=a.selectedIndex?c.C.M(a.options[a.selectedIndex])!==f[0]:m||0<=a.selectedIndex)&&c.u.I(c.g.Db,null,[a,"change"]);c.u.Ca()&&c.j.notify(a,c.j.F);g&&20<Math.abs(g-a.scrollTop)&&(a.scrollTop=g)}};c.i.options.Wa=c.g.l.Z();c.i.style={update:(a,b)=>{c.g.K(c.g.h(b()||{}),(d,e)=>{e=c.g.h(e);if(null==e||!1===e)e="";if(/^--/.test(d))a.style.setProperty(d,e);else{d=d.replace(/-(\w)/g,(l,f)=>f.toUpperCase());var g=
a.style[d];a.style[d]=e;e===g||a.style[d]!=g||isNaN(e)||(a.style[d]=e+"px")}})}};c.i.submit={init:(a,b,d,e,g)=>{if("function"!=typeof b())throw Error("The value for a submit binding must be a function");a.addEventListener("submit",l=>{var f=b();try{var h=f.call(g.$data,a)}finally{!0!==h&&l.preventDefault()}})}};c.i.text={init:()=>({controlsDescendantBindings:!0}),update:(a,b)=>{8===a.nodeType&&(a.text||a.after(a.text=J.createTextNode("")),a=a.text);c.g.Za(a,b())}};c.m.aa.text=!0;c.i.textInput={init:(a,
b,d)=>{var e=a.value,g,l,f=()=>{clearTimeout(g);l=g=void 0;var k=a.value;a.checkValidity()&&e!==k&&(e=k,c.la.Ga(a,b(),d,"textInput",k))},h=()=>{var k=c.g.h(b())??"";void 0!==l&&k===l?setTimeout(h,4):a.value!==k&&(a.value=k,e=a.value)};a.addEventListener("input",f);a.addEventListener("change",f);c.o(h,{s:a})}};c.i.value={init:(a,b,d)=>{var e=a.matches("SELECT"),g=a.matches("INPUT");if(!g||"checkbox"!=a.type&&"radio"!=a.type){var l=new Set,f=d.get("valueUpdate"),h=null,k=()=>{h=null;var n=b(),q=c.C.M(a);
c.la.Ga(a,n,d,"value",q)};f&&("string"==typeof f?l.add(f):f.forEach(n=>l.add(n)),l.delete("change"));l.forEach(n=>{var q=k;(n||"").startsWith("after")&&(q=()=>{h=c.C.M(a);setTimeout(k,0)},n=n.slice(5));a.addEventListener(n,q)});var m=g&&"file"==a.type?()=>{var n=c.g.h(b());null==n||""===n?a.value="":c.u.I(k)}:()=>{var n=c.g.h(b()),q=c.C.M(a);if(null!==h&&n===h)setTimeout(m,0);else if(n!==q||void 0===q)e?(c.C.Fa(a,n),n!==c.C.M(a)&&c.u.I(k)):c.C.Fa(a,n)};if(e){var p;c.j.subscribe(a,c.j.F,()=>{p?d.get("valueAllowUnset")?
m():k():(a.addEventListener("change",k),p=c.o(m,{s:a}))},null,{notifyImmediately:!0})}else a.addEventListener("change",k),c.o(m,{s:a})}else c.applyBindingAccessorsToNode(a,{checkedValue:b})},update:()=>{}};c.i.visible={update:(a,b)=>{b=c.g.h(b());var d="none"!=a.style.display;b&&!d?a.style.display="":d&&!b&&(a.style.display="none")}};c.i.hidden={update:(a,b)=>a.hidden=!!c.g.h(b())};(function(a){c.i[a]={init:function(b,d,e,g,l){return c.i.event.init.call(this,b,()=>({[a]:d()}),e,g,l)}}})("click");
(()=>{let a=c.g.l.Z();class b{constructor(e){this.Na=e}Ua(...e){let g=this.Na;if(!e.length)return c.g.l.get(g,a)||(11===this.H?g.content:1===this.H?g:void 0);c.g.l.set(g,a,e[0])}}class d extends b{constructor(e){super(e);e&&(this.H=e.matches("TEMPLATE")&&e.content?e.content.nodeType:1)}}c.bb={Na:d,lb:b}})();(()=>{const a=(h,k,m)=>{var p;for(k=c.m.nextSibling(k);h&&(p=h)!==k;)h=c.m.nextSibling(p),m(p,h)},b=(h,k)=>{if(h.length){var m=h[0],p=m.parentNode;a(m,h[h.length-1],n=>(1===n.nodeType||8===n.nodeType)&&
c.Ib(k,n));c.g.xa(h,p)}},d=(h,k,m,p)=>{var n=(h&&(h.nodeType?h:0<h.length?h[0]:null)||m||{}).ownerDocument;if("string"==typeof m){n=n||J;n=n.getElementById(m);if(!n)throw Error("Cannot find template with ID "+m);m=new c.bb.Na(n)}else if([1,8].includes(m.nodeType))m=new c.bb.lb(m);else throw Error("Unknown template type: "+m);m=(m=m.Ua?m.Ua():null)?[...m.cloneNode(!0).childNodes]:null;if(!Array.isArray(m)||0<m.length&&"number"!=typeof m[0].nodeType)throw Error("Template engine must return an array of DOM nodes");
k&&(c.m.pa(h,m),b(m,p),c.j.notify(h,c.j.F));return m},e=(h,k,m)=>c.W(h)?h():"function"===typeof h?h(k,m):h,g=(h,k,m,p)=>{m=m||{};if(p){var n=p.nodeType?p:0<p.length?p[0]:null;return c.o(()=>{var q=k instanceof c.ba?k:new c.ba(k,null,null,{exportDependencies:!0}),r=e(h,q.$data,q);d(p,!0,r,q,m)},{ia:()=>!n||!c.g.Pa(n),s:n})}console.log("no targetNodeOrNodeArray")},l=(h,k,m,p,n)=>{var q,r=(w,y)=>{q=n.createChildContext(w,{extend:B=>B.$index=y});w=e(h,w,q);return d(p,!1,w,q,m)},u=(w,y)=>{b(y,q);q=null},
t=(w,y)=>{c.u.I(c.g.Ab,null,[p,w,r,m,u,y]);c.j.notify(p,c.j.F)};if(c.isObservableArray(k)){t(k.L());var z=k.subscribe(w=>{t(k(),w)},null,"arrayChange");z.s(p);return z}return c.o(()=>{var w=c.g.h(k)||[];Array.isArray(w)||(w=[w]);t(w)},{s:p})},f=c.g.l.Z();c.i.template={init:(h,k)=>{k=c.g.h(k());if("string"==typeof k||"name"in k)c.m.ja(h);else if(k=c.m.childNodes(h),k.length)k=c.g.Wb(k),(new c.bb.lb(h)).Ua(k);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},
update:(h,k,m,p,n)=>{p=k();k=c.g.h(p);m=null;"string"==typeof k?k={}:p="name"in k?k.name:h;var q=!!p;"foreach"in k?m=l(p,q&&k.foreach||[],k,h,n):q?(m=n,"data"in k&&(m=n.createChildContext(k.data,{exportDependencies:!0})),m=g(p,m,k,h)):c.m.ja(h);n=m;c.g.l.get(h,f)?.dispose?.();c.g.l.set(h,f,!n||n.isActive&&!n.isActive()?void 0:n)}};c.m.aa.template=!0})();c.g.tb=(a,b,d)=>{var e=0,g,l=b.length;l&&a.every(f=>{g=b.findIndex(h=>f.value===h.value);0<=g&&(f.moved=b[g].index,b[g].moved=f.index,b.splice(g,
1),e=g=0,--l);e+=l;return l&&(!d||e<d)})};c.g.qb=(()=>{var a=(b,d,e,g,l)=>{for(var f=Math.min,h=Math.max,k=[],m=-1,p=b.length,n,q=d.length,r=q-p||1,u=p+q+1,t,z,w;++m<=p;)for(z=t,k.push(t=[]),w=f(q,m+r),n=h(0,m-1);n<=w;n++)t[n]=n?m?b[m-1]===d[n-1]?z[n-1]:f(z[n]||u,t[n-1]||u)+1:n+1:m+1;f=[];h=[];r=[];m=p;for(n=q;m||n;)q=k[m][n]-1,n&&q===k[m][n-1]?h.push(f[f.length]={status:e,value:d[--n],index:n}):m&&q===k[m-1][n]?r.push(f[f.length]={status:g,value:b[--m],index:m}):(--n,--m,l.sparse||f.push({status:"retained",
value:d[n]}));c.g.tb(r,h,10*p);return f.reverse()};return(b,d,e)=>{b=b||[];d=d||[];return b.length<d.length?a(b,d,"added","deleted",e):a(d,b,"deleted","added",e)}})();(()=>{function a(e,g,l,f,h){var k=[],m=c.o(()=>{var p=g(l,h,c.g.xa(k,e))||[];if(0<k.length){var n=k.nodeType?[k]:k;if(0<n.length){var q=n[0],r=q.parentNode;p.forEach(u=>r.insertBefore(u,q));n.forEach(u=>c.removeNode(u))}f&&c.u.I(f,null,[l,p,h])}k.length=0;k.push(...p)},{s:e,ia:()=>!!k.find(c.g.Pa)});return{O:k,La:m.isActive()?m:void 0}}
var b=c.g.l.Z(),d=c.g.l.Z();c.g.Ab=(e,g,l,f,h,k)=>{g=g||[];Array.isArray(g)||(g=[g]);var m=c.g.l.get(e,b),p=[],n=0,q=0,r=[],u=[],t,z=v=>{t={sa:v,Ta:c.$(q++)};p.push(t)},w=v=>{t=m[v];t.Ta(q++);c.g.xa(t.O,e);p.push(t)};if(m){if(!k||m&&m._countWaitingForRemove)k=c.g.qb(Array.prototype.map.call(m,C=>C.sa),g,{sparse:!0});let v,F;for(k.forEach(C=>{v=C.moved;F=C.index;switch(C.status){case "deleted":for(;n<F;)w(n++);void 0===v&&(t=m[n],t.La&&(t.La.dispose(),t.La=void 0),c.g.xa(t.O,e).length&&t&&r.push.apply(r,
t.O));n++;break;case "added":for(;q<F;)w(n++);void 0!==v?(u.push(p.length),w(v)):z(C.value)}});q<g.length;)w(n++);p._countWaitingForRemove=0}else g.forEach(z);c.g.l.set(e,b,p);r.forEach(c.removeNode);var y=v=>{c.m.Ub(e,v,B);B=v};k=e.ownerDocument.activeElement;if(u.length)for(;null!=(g=u.shift());){for(t=p[g];g--;)if(f=p[g].O,f?.length){var B=f[f.length-1];break}t.O.forEach(y)}p.forEach(v=>{v.O||c.g.extend(v,a(e,l,v.sa,h,v.Ta));v.O.forEach(y);!v.Tb&&h&&(h(v.sa,v.O,v.Ta),v.Tb=!0,B=v.O[v.O.length-1])});
e.ownerDocument.activeElement!=k&&k?.focus();[].forEach(v=>v&&(v.sa=d))}})();Q.ko=c})(this);
f);return null}return h},Qb:a,ac:f=>(f=f.nodeValue.match(e))?f[1]:null}})();const S=new Map,la=a=>{switch(a.nodeType){case 1:return a.getAttribute("data-bind");case 8:return c.m.ac(a)}return null};c.ob=new class{Xb(a){switch(a.nodeType){case 1:return null!=a.getAttribute("data-bind");case 8:return c.m.Qb(a)}return!1}Ob(a,b){if(a=la(a))try{let d=S.get(a);d||(d=new Function("$context","with($context){return{"+c.la.Yb(a)+"}}"),S.set(a,d));b=new Proxy(b,{has:()=>!0,get:(e,g)=>e[g]||e.$data[g]});return d(b)}catch(d){throw d.message=
"Unable to parse bindings.\nBindings value: "+a+"\nMessage: "+d.message,d;}return null}};const G=Symbol("_subscribable"),H=Symbol("_ancestorBindingInfo"),T=Symbol("_dataDependency"),U={},I=c.g.l.Z();c.i={};c.ba=class{constructor(a,b,d,e){var g=this,l=a===U,f=l?void 0:a,h="function"==typeof f&&!c.W(f),k=e?.dataDependency;a=()=>{var p=h?f():f;p=c.g.h(p);b?(c.g.extend(g,b),H in b&&(g[H]=b[H])):g.$root=p;g[G]=m;l?p=g.$data:g.$data=p;d?.(g,b,p);if(b?.[G]&&!c.u.o().Sa(b[G]))b[G]();k&&(g[T]=k);return g.$data};
if(e?.exportDependencies)a();else{var m=c.xb(a);m.L();m.isActive()?m.ka=null:g[G]=void 0}}createChildContext(a,b){return new c.ba(a,this,(d,e)=>{d.$parent=e.$data;b.extend?.(d)},b)}extend(a,b){return new c.ba(U,this,d=>c.g.extend(d,"function"==typeof a?a(d):a),b)}};const V=a=>{a=c.g.l.get(a,I);var b=a?.D;b&&(a.D=null,b.wb())};class ma{constructor(a,b,d){this.H=a;this.da=b;this.ta=new Set;this.F=!1;b.D||c.g.N.addDisposeCallback(a,V);d?.D&&(d.D.ta.add(a),this.za=d)}wb(){this.za?.D?.Mb(this.H)}Mb(a){this.ta.delete(a);
this.ta.size||this.rb?.()}rb(){this.F=!0;this.da.D&&!this.ta.size&&(this.da.D=null,c.g.N.Ya(this.H,V),c.j.notify(this.H,c.j.ca),this.wb())}}c.j={F:"childrenComplete",ca:"descendantsComplete",subscribe:(a,b,d,e,g)=>{var l=c.g.l.Ra(a,I,{});l.wa||(l.wa=new c.P);g?.notifyImmediately&&l.Va[b]&&c.u.I(d,e,[a]);return l.wa.subscribe(d,e,b)},notify:(a,b)=>{var d=c.g.l.get(a,I);if(d&&(d.Va[b]=!0,d.wa?.B(a,b),b==c.j.F))if(d.D)d.D.rb();else if(void 0===d.D&&d.wa?.na(c.j.ca))throw Error("descendantsComplete event not supported for bindings on this node");
},$a:(a,b)=>{var d=c.g.l.Ra(a,I,{});d.D||(d.D=new ma(a,d,b[H]));return b[H]==d?b:b.extend(e=>{e[H]=d})}};const X=(a,b)=>{for(var d,e=c.m.firstChild(b);d=e;)e=c.m.nextSibling(d),W(a,d);c.j.notify(b,c.j.F)},W=(a,b)=>{var d=a;if(1===b.nodeType||c.ob.Xb(b))d=Y(b,null,a);d&&!b.matches?.("SCRIPT,TEXTAREA,TEMPLATE")&&X(d,b)},na=a=>{var b=[],d={},e=[],g=l=>{if(!d[l]){var f=c.i[l];f&&(f.after&&(e.push(l),f.after.forEach(h=>{if(a[h]){if(e.includes(h))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+
e.join(", "));g(h)}}),e.length--),b.push({key:l,ub:f}));d[l]=!0}};c.g.K(a,g);return b},Y=(a,b,d)=>{var e=c.g.l.Ra(a,I,{}),g=e.Hb;if(!b){if(g)throw Error("You cannot apply bindings multiple times to the same element.");e.Hb=!0}g||(e.context=d);e.Va||(e.Va={});if(b&&"function"!==typeof b)var l=b;else{var f=c.o(()=>{if(l=b?b(d,a):c.ob.Ob(a,d))d[G]?.(),d[T]?.();return l},{s:a});l&&f.isActive()||(f=null)}var h=d,k;if(l){var m=f?n=>()=>f()[n]():n=>l[n],p={get:n=>l[n]&&m(n)(),has:n=>n in l};c.j.F in l&&
c.j.subscribe(a,c.j.F,()=>{var n=l[c.j.F]();if(n){var q=c.m.childNodes(a);q.length&&n(q,c.dataFor(q[0]))}});c.j.ca in l&&(h=c.j.$a(a,d),c.j.subscribe(a,c.j.ca,()=>{var n=l[c.j.ca]();n&&c.m.firstChild(a)&&n(a)}));na(l).forEach(n=>{var q=n.ub.init,r=n.ub.update,u=n.key;if(8===a.nodeType&&!c.m.aa[u])throw Error("The binding '"+u+"' cannot be used with comment nodes");try{"function"==typeof q&&c.u.I(()=>{var t=q(a,m(u),p,h.$data,h);if(t&&t.controlsDescendantBindings){if(void 0!==k)throw Error("Multiple bindings ("+
k+" and "+u+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");k=u}}),"function"==typeof r&&c.o(()=>r(a,m(u),p,h.$data,h),{s:a})}catch(t){throw t.message='Unable to process binding "'+u+": "+l[u]+'"\nMessage: '+t.message,t;}})}return void 0===k&&h};c.$b=a=>c.g.l.get(a,I)?.context;const O=a=>a&&a instanceof c.ba?a:new c.ba(a);c.applyBindingAccessorsToNode=(a,b,d)=>Y(a,b,O(d));c.mb=(a,b)=>{1!==b.nodeType&&8!==b.nodeType||X(O(a),
b)};c.Ib=(a,b)=>W(O(a),b);c.dataFor=a=>([1,8].includes(a?.nodeType)&&c.$b(a))?.$data;c.U("bindingHandlers",c.i);(()=>{var a=Object.create(null),b=new Map;c.components={get:(l,f)=>{if(b.has(l))f(b.get(l));else{var h=a[l];h?h.subscribe(f):(h=a[l]=new c.P,h.subscribe(f),g(l,k=>{b.set(l,k);delete a[l];h.B(k)}))}},register:(l,f)=>{if(!f)throw Error("Invalid configuration for "+l);if(d[l])throw Error("Component "+l+" is already registered");d[l]=f}};var d=Object.create(null),e=(l,f)=>{throw Error(`Component '${l}': ${f}`);
},g=(l,f)=>{var h={},k=d[l]||{},m=k.template;k=k.viewModel;if(m){m.element||e(l,"Unknown template value: "+m);m=m.element;var p=J.getElementById(m);p||e(l,"Cannot find element with ID "+m);p.matches("TEMPLATE")||e(l,"Template Source Element not a <template>");h.template=c.g.ua(p.content.childNodes)}k&&("function"!==typeof k.createViewModel&&e(l,"Unknown viewModel value: "+k),h.createViewModel=k.createViewModel);f(h.template&&h.createViewModel?h:null)}})();(()=>{var a=0;c.i.component={init:(b,d,e,
g,l)=>{var f,h,k,m=()=>{var p=f&&f.dispose;"function"===typeof p&&p.call(f);k&&k.dispose();h=f=k=null};c.m.ja(b);c.g.N.addDisposeCallback(b,m);c.o(()=>{var p=c.g.h(d());if("string"!==typeof p){var n=c.g.h(p.params);p=c.g.h(p.name)}if(!p)throw Error("No component name specified");var q=c.j.$a(b,l),r=h=++a;c.components.get(p,u=>{if(h===r){m();if(!u)throw Error("Unknown component '"+p+"'");var t=u.template;if(!t)throw Error("Component '"+p+"' has no template");c.m.pa(b,c.g.ua(t));f=u.createViewModel(n,
{element:b});c.mb(q.createChildContext(f,{}),b)}})},{s:b});return{controlsDescendantBindings:!0}}};c.m.aa.component=!0})();c.i.attr={update:(a,b)=>{b=c.g.h(b())||{};c.g.K(b,function(d,e){e=c.g.h(e);var g=d.indexOf(":");g="lookupNamespaceURI"in a&&0<g&&a.lookupNamespaceURI(d.slice(0,g));!1===e||null==e?g?a.removeAttributeNS(g,d):a.removeAttribute(d):(e=e.toString(),g?a.setAttributeNS(g,d,e):a.setAttribute(d,e))})}};(()=>{c.i.checked={after:["value","attr"],init:function(a,b,d){var e="checkbox"==a.type,
g="radio"==a.type;if(e||g){const n=c.xb(()=>{if(d.has("checkedValue"))return c.g.h(d.get("checkedValue"));if(m)return d.has("value")?c.g.h(d.get("value")):a.value});var l=()=>{if(!c.u.Ca()){var q=a.checked,r=n();if(q||!g&&!c.u.ma()){var u=c.u.I(b);if(h){var t=k?u.L():u,z=p;p=r;z!==r?q&&(t.push(r),t.remove(z)):q?t.push(r):t.remove(r);k&&c.vb(u)&&u(t)}else e&&(void 0===r?r=q:q||(r=void 0)),c.la.Ga(a,u,d,"checked",r,!0)}}},f=b(),h=e&&c.g.h(f)instanceof Array,k=!(h&&f.push&&f.splice),m=g||h,p=h?n():void 0;
c.o(l,null,{s:a});a.addEventListener("click",l);c.o(()=>{var q=c.g.h(b()),r=n();h?(a.checked=q.includes(r),p=r):a.checked=e&&void 0===r?!!q:n()===q},null,{s:a});f=void 0}}};c.i.checkedValue={update:function(a,b){a.value=c.g.h(b())}}})();var P=(a,b,d)=>b&&b.split(/\s+/).forEach(e=>a.classList.toggle(e,d));c.i.css={update:(a,b)=>{b=c.g.h(b());"object"==typeof b?c.g.K(b,(d,e)=>{e=c.g.h(e);P(a,d,!!e)}):(b=c.g.Bb(b),P(a,a.__ko__cssValue,!1),a.__ko__cssValue=b,P(a,b,!0))}};c.i.enable={update:(a,b)=>{(b=
c.g.h(b()))&&a.disabled?a.removeAttribute("disabled"):b||a.disabled||(a.disabled=!0)}};c.i.disable={update:(a,b)=>c.i.enable.update(a,()=>!c.g.h(b()))};c.i.event={init:function(a,b,d,e,g){c.g.K(b()||{},l=>{"string"==typeof l&&a.addEventListener(l,(...f)=>{var h=b()[l];if(h)try{e=g.$data;var k=h.apply(e,[e,...f])}finally{!0!==k&&f[0].preventDefault()}})})}};const Z=a=>()=>{var b=a(),d=c.W(b)?b.L():b;if(!d||Array.isArray(d))return{foreach:b};c.g.h(b);return{foreach:d.data}};c.i.foreach={init:(a,b)=>
c.i.template.init(a,Z(b)),update:(a,b,d,e,g)=>c.i.template.update(a,Z(b),d,e,g)};c.m.aa.foreach=!0;c.i.hasfocus={init:(a,b,d)=>{var e=l=>{a.__ko_hasfocusUpdating=!0;l=a.ownerDocument.activeElement===a;c.la.Ga(a,b(),d,"hasfocus",l,!0);a.__ko_hasfocusLastValue=l;a.__ko_hasfocusUpdating=!1},g=e.bind(null,!0);e=e.bind(null,!1);a.addEventListener("focus",g);a.addEventListener("focusin",g);a.addEventListener("blur",e);a.addEventListener("focusout",e);a.__ko_hasfocusLastValue=!1},update:(a,b)=>{b=!!c.g.h(b());
a.__ko_hasfocusUpdating||a.__ko_hasfocusLastValue===b||(b?a.focus():a.blur())}};c.i.html={init:()=>({controlsDescendantBindings:!0}),update:(a,b)=>{c.g.Qa(a);b=c.g.h(b());if(null!=b){const d=J.createElement("template");d.innerHTML="string"!=typeof b?b.toString():b;a.appendChild(d.content)}}};(()=>{function a(b,d,e){c.i[b]={init:(g,l,f,h,k)=>{var m,p={};d&&(p={exportDependencies:!0});var n=f.has(c.j.ca);c.o(()=>{var q=c.g.h(l()),r=!e!==!q,u=!m;n&&(k=c.j.$a(g,k));if(r){p.dataDependency=c.u.o();var t=
d?k.createChildContext("function"==typeof q?q:l,p):c.u.ma()?k.extend(null,p):k}u&&c.u.ma()&&(m=c.g.ua(c.m.childNodes(g),!0));r?(u||c.m.pa(g,c.g.ua(m)),c.mb(t,g)):(c.m.ja(g),c.j.notify(g,c.j.F))},{s:g});return{controlsDescendantBindings:!0}}};c.m.aa[b]=!0}a("if");a("ifnot",!1,!0);a("with",!0)})();var aa={};c.i.options={init:a=>{if(!a.matches("SELECT"))throw Error("options binding applies only to SELECT elements");let b=a.length;for(;b--;)a.remove(b);return{controlsDescendantBindings:!0}},update:(a,
b,d)=>{var e=a.multiple,g=0!=a.length&&e?a.scrollTop:null,l=c.g.h(b()),f=[];b=()=>Array.from(a.options).filter(n=>n.selected);var h=(n,q,r)=>{var u=typeof q;return"function"==u?q(n):"string"==u?n[q]:r},k=(n,q)=>{f.length&&(n=f.includes(c.C.M(q[0])),q[0].selected=n,p&&!n&&c.u.I(c.g.Db,null,[a,"change"]))};e?f=b().map(c.C.M):0<=a.selectedIndex&&f.push(c.C.M(a.options[a.selectedIndex]));if(l){Array.isArray(l)||(l=[l]);var m=l.filter(n=>n??1)}var p=!1;l=k;d.has("optionsAfterRender")&&"function"==typeof d.get("optionsAfterRender")&&
(l=(n,q)=>{k(n,q);c.u.I(d.get("optionsAfterRender"),null,[q[0],n!==aa?n:void 0])});c.g.Ab(a,m,(n,q,r)=>{r.length&&(f=r[0].selected?[c.C.M(r[0])]:[],p=!0);q=a.ownerDocument.createElement("option");n===aa?(c.g.Za(q),c.C.Fa(q,void 0)):(r=h(n,d.get("optionsValue"),n),c.C.Fa(q,c.g.h(r)),n=h(n,d.get("optionsText"),r),c.g.Za(q,n));return[q]},{},l);m=f.length;(e?m&&b().length<m:m&&0<=a.selectedIndex?c.C.M(a.options[a.selectedIndex])!==f[0]:m||0<=a.selectedIndex)&&c.u.I(c.g.Db,null,[a,"change"]);c.u.Ca()&&
c.j.notify(a,c.j.F);g&&20<Math.abs(g-a.scrollTop)&&(a.scrollTop=g)}};c.i.options.Wa=c.g.l.Z();c.i.style={update:(a,b)=>{c.g.K(c.g.h(b()||{}),(d,e)=>{e=c.g.h(e);if(null==e||!1===e)e="";if(/^--/.test(d))a.style.setProperty(d,e);else{d=d.replace(/-(\w)/g,(l,f)=>f.toUpperCase());var g=a.style[d];a.style[d]=e;e===g||a.style[d]!=g||isNaN(e)||(a.style[d]=e+"px")}})}};c.i.submit={init:(a,b,d,e,g)=>{if("function"!=typeof b())throw Error("The value for a submit binding must be a function");a.addEventListener("submit",
l=>{var f=b();try{var h=f.call(g.$data,a)}finally{!0!==h&&l.preventDefault()}})}};c.i.text={init:()=>({controlsDescendantBindings:!0}),update:(a,b)=>{8===a.nodeType&&(a.text||a.after(a.text=J.createTextNode("")),a=a.text);c.g.Za(a,b())}};c.m.aa.text=!0;c.i.textInput={init:(a,b,d)=>{var e=a.value,g,l,f=()=>{clearTimeout(g);l=g=void 0;var k=a.value;a.checkValidity()&&e!==k&&(e=k,c.la.Ga(a,b(),d,"textInput",k))},h=()=>{var k=c.g.h(b())??"";void 0!==l&&k===l?setTimeout(h,4):a.value!==k&&(a.value=k,e=
a.value)};a.addEventListener("input",f);a.addEventListener("change",f);c.o(h,{s:a})}};c.i.value={init:(a,b,d)=>{var e=a.matches("SELECT"),g=a.matches("INPUT");if(!g||"checkbox"!=a.type&&"radio"!=a.type){var l=new Set,f=d.get("valueUpdate"),h=null,k=()=>{h=null;var n=b(),q=c.C.M(a);c.la.Ga(a,n,d,"value",q)};f&&("string"==typeof f?l.add(f):f.forEach(n=>l.add(n)),l.delete("change"));l.forEach(n=>{var q=k;(n||"").startsWith("after")&&(q=()=>{h=c.C.M(a);setTimeout(k,0)},n=n.slice(5));a.addEventListener(n,
q)});var m=g&&"file"==a.type?()=>{var n=c.g.h(b());null==n||""===n?a.value="":c.u.I(k)}:()=>{var n=c.g.h(b()),q=c.C.M(a);if(null!==h&&n===h)setTimeout(m,0);else if(n!==q||void 0===q)e?(c.C.Fa(a,n),n!==c.C.M(a)&&c.u.I(k)):c.C.Fa(a,n)};if(e){var p;c.j.subscribe(a,c.j.F,()=>{p?d.get("valueAllowUnset")?m():k():(a.addEventListener("change",k),p=c.o(m,{s:a}))},null,{notifyImmediately:!0})}else a.addEventListener("change",k),c.o(m,{s:a})}else c.applyBindingAccessorsToNode(a,{checkedValue:b})},update:()=>
{}};c.i.visible={update:(a,b)=>{b=c.g.h(b());var d="none"!=a.style.display;b&&!d?a.style.display="":d&&!b&&(a.style.display="none")}};c.i.hidden={update:(a,b)=>a.hidden=!!c.g.h(b())};(function(a){c.i[a]={init:function(b,d,e,g,l){return c.i.event.init.call(this,b,()=>({[a]:d()}),e,g,l)}}})("click");(()=>{let a=c.g.l.Z();class b{constructor(e){this.Na=e}Ua(...e){let g=this.Na;if(!e.length)return c.g.l.get(g,a)||(11===this.H?g.content:1===this.H?g:void 0);c.g.l.set(g,a,e[0])}}class d extends b{constructor(e){super(e);
e&&(this.H=e.matches("TEMPLATE")&&e.content?e.content.nodeType:1)}}c.bb={Na:d,lb:b}})();(()=>{const a=(h,k,m)=>{var p;for(k=c.m.nextSibling(k);h&&(p=h)!==k;)h=c.m.nextSibling(p),m(p,h)},b=(h,k)=>{if(h.length){var m=h[0],p=m.parentNode;a(m,h[h.length-1],n=>(1===n.nodeType||8===n.nodeType)&&c.Ib(k,n));c.g.xa(h,p)}},d=(h,k,m,p)=>{var n=(h&&(h.nodeType?h:0<h.length?h[0]:null)||m||{}).ownerDocument;if("string"==typeof m){n=n||J;n=n.getElementById(m);if(!n)throw Error("Cannot find template with ID "+m);
m=new c.bb.Na(n)}else if([1,8].includes(m.nodeType))m=new c.bb.lb(m);else throw Error("Unknown template type: "+m);m=(m=m.Ua?m.Ua():null)?[...m.cloneNode(!0).childNodes]:null;if(!Array.isArray(m)||0<m.length&&"number"!=typeof m[0].nodeType)throw Error("Template engine must return an array of DOM nodes");k&&(c.m.pa(h,m),b(m,p),c.j.notify(h,c.j.F));return m},e=(h,k,m)=>c.W(h)?h():"function"===typeof h?h(k,m):h,g=(h,k,m,p)=>{m=m||{};if(p){var n=p.nodeType?p:0<p.length?p[0]:null;return c.o(()=>{var q=
k instanceof c.ba?k:new c.ba(k,null,null,{exportDependencies:!0}),r=e(h,q.$data,q);d(p,!0,r,q,m)},{ia:()=>!n||!c.g.Pa(n),s:n})}console.log("no targetNodeOrNodeArray")},l=(h,k,m,p,n)=>{var q,r=(w,y)=>{q=n.createChildContext(w,{extend:B=>B.$index=y});w=e(h,w,q);return d(p,!1,w,q,m)},u=(w,y)=>{b(y,q);q=null},t=(w,y)=>{c.u.I(c.g.Ab,null,[p,w,r,m,u,y]);c.j.notify(p,c.j.F)};if(c.isObservableArray(k)){t(k.L());var z=k.subscribe(w=>{t(k(),w)},null,"arrayChange");z.s(p);return z}return c.o(()=>{var w=c.g.h(k)||
[];Array.isArray(w)||(w=[w]);t(w)},{s:p})},f=c.g.l.Z();c.i.template={init:(h,k)=>{k=c.g.h(k());if("string"==typeof k||"name"in k)c.m.ja(h);else if(k=c.m.childNodes(h),k.length)k=c.g.Wb(k),(new c.bb.lb(h)).Ua(k);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:(h,k,m,p,n)=>{p=k();k=c.g.h(p);m=null;"string"==typeof k?k={}:p="name"in k?k.name:h;var q=!!p;"foreach"in k?m=l(p,q&&k.foreach||[],k,h,n):q?(m=n,"data"in k&&(m=
n.createChildContext(k.data,{exportDependencies:!0})),m=g(p,m,k,h)):c.m.ja(h);n=m;c.g.l.get(h,f)?.dispose?.();c.g.l.set(h,f,!n||n.isActive&&!n.isActive()?void 0:n)}};c.m.aa.template=!0})();c.g.tb=(a,b,d)=>{var e=0,g,l=b.length;l&&a.every(f=>{g=b.findIndex(h=>f.value===h.value);0<=g&&(f.moved=b[g].index,b[g].moved=f.index,b.splice(g,1),e=g=0,--l);e+=l;return l&&(!d||e<d)})};c.g.qb=(()=>{var a=(b,d,e,g,l)=>{for(var f=Math.min,h=Math.max,k=[],m=-1,p=b.length,n,q=d.length,r=q-p||1,u=p+q+1,t,z,w;++m<=
p;)for(z=t,k.push(t=[]),w=f(q,m+r),n=h(0,m-1);n<=w;n++)t[n]=n?m?b[m-1]===d[n-1]?z[n-1]:f(z[n]||u,t[n-1]||u)+1:n+1:m+1;f=[];h=[];r=[];m=p;for(n=q;m||n;)q=k[m][n]-1,n&&q===k[m][n-1]?h.push(f[f.length]={status:e,value:d[--n],index:n}):m&&q===k[m-1][n]?r.push(f[f.length]={status:g,value:b[--m],index:m}):(--n,--m,l.sparse||f.push({status:"retained",value:d[n]}));c.g.tb(r,h,10*p);return f.reverse()};return(b,d,e)=>{b=b||[];d=d||[];return b.length<d.length?a(b,d,"added","deleted",e):a(d,b,"deleted","added",
e)}})();(()=>{function a(e,g,l,f,h){var k=[],m=c.o(()=>{var p=g(l,h,c.g.xa(k,e))||[];if(0<k.length){var n=k.nodeType?[k]:k;if(0<n.length){var q=n[0],r=q.parentNode;p.forEach(u=>r.insertBefore(u,q));n.forEach(u=>c.removeNode(u))}f&&c.u.I(f,null,[l,p,h])}k.length=0;k.push(...p)},{s:e,ia:()=>!!k.find(c.g.Pa)});return{O:k,La:m.isActive()?m:void 0}}var b=c.g.l.Z(),d=c.g.l.Z();c.g.Ab=(e,g,l,f,h,k)=>{g=g||[];Array.isArray(g)||(g=[g]);var m=c.g.l.get(e,b),p=[],n=0,q=0,r=[],u=[],t,z=v=>{t={sa:v,Ta:c.$(q++)};
p.push(t)},w=v=>{t=m[v];t.Ta(q++);c.g.xa(t.O,e);p.push(t)};if(m){if(!k||m&&m._countWaitingForRemove)k=c.g.qb(Array.prototype.map.call(m,C=>C.sa),g,{sparse:!0});let v,F;for(k.forEach(C=>{v=C.moved;F=C.index;switch(C.status){case "deleted":for(;n<F;)w(n++);void 0===v&&(t=m[n],t.La&&(t.La.dispose(),t.La=void 0),c.g.xa(t.O,e).length&&t&&r.push.apply(r,t.O));n++;break;case "added":for(;q<F;)w(n++);void 0!==v?(u.push(p.length),w(v)):z(C.value)}});q<g.length;)w(n++);p._countWaitingForRemove=0}else g.forEach(z);
c.g.l.set(e,b,p);r.forEach(c.removeNode);var y=v=>{c.m.Ub(e,v,B);B=v};k=e.ownerDocument.activeElement;if(u.length)for(;null!=(g=u.shift());){for(t=p[g];g--;)if(f=p[g].O,f?.length){var B=f[f.length-1];break}t.O.forEach(y)}p.forEach(v=>{v.O||c.g.extend(v,a(e,l,v.sa,h,v.Ta));v.O.forEach(y);!v.Tb&&h&&(h(v.sa,v.O,v.Ta),v.Tb=!0,B=v.O[v.O.length-1])});e.ownerDocument.activeElement!=k&&k?.focus();[].forEach(v=>v&&(v.sa=d))}})();Q.ko=c})(this);

View file

@ -50,17 +50,17 @@ ko.bindingProvider = new class
// Build the source for a function that evaluates "expression"
// Use one "with" that has one secure scope handling Proxy
// Deprecated: with is no longer recommended
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString),
functionBody = "$context = new Proxy(\
$context,\
{\
has: () => true,\
get: (target, key) => target[key] || target['$data'][key]\
}\
);with($context){return{" + rewrittenBindings + "}}";
bindingFunction = new Function("$context", functionBody);
bindingFunction = new Function("$context",
"with($context){return{" + ko.expressionRewriting.preProcessBindings(bindingsString) + "}}");
bindingCache.set(cacheKey, bindingFunction);
}
bindingContext = new Proxy(
bindingContext,
{
has: () => true,
get: (target, key) => target[key] || target['$data'][key]
}
);
return bindingFunction(bindingContext);
} catch (ex) {
ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString