Bugfix: compose mail select contacts for cc/bcc failed

Cleanup: Inputosaurus and Knockout
Change: Knockout domData now uses WeakMap
Replaced: Knockout domManipulation with a documentFragment
This commit is contained in:
djmaze 2021-02-01 14:34:24 +01:00
parent fe7c7fede4
commit ebe2c0536f
23 changed files with 410 additions and 889 deletions

View file

@ -116,20 +116,20 @@ RainLoop 1.15 vs SnappyMail
|admin.js |2.158.025 | 119.197 |
|app.js |4.215.733 | 527.415 |
|boot.js | 672.433 | 4.842 |
|libs.js | 647.679 | 235.475 |
|libs.js | 647.679 | 232.283 |
|polyfills.js | 325.908 | 0 |
|serviceworker.js | 0 | 285 |
|TOTAL |8.019.778 | 887.214 |
|js/min/* |RainLoop |Snappy |Rain gzip |S gzip |R brotli |S brotli |
|--------------- |--------: |--------: |--------: |------: |-------: |-------: |
|js/min/* |RainLoop |Snappy |RL gzip |SM gzip |RL brotli |SM brotli |
|--------------- |--------: |--------: |------: |------: |--------: |--------: |
|admin.min.js | 255.514 | 61.165 | 73.899 | 17.419 | 60.674 | 15.447 |
|app.min.js | 516.000 | 256.632 |140.430 | 73.688 |110.657 | 61.812 |
|app.min.js | 516.000 | 256.629 |140.430 | 73.667 |110.657 | 61.826 |
|boot.min.js | 66.456 | 2.630 | 22.553 | 1.375 | 20.043 | 1.189 |
|libs.min.js | 574.626 | 130.930 |177.280 | 47.397 |151.855 | 42.116 |
|libs.min.js | 574.626 | 128.352 |177.280 | 46.615 |151.855 | 41.437 |
|polyfills.min.js | 32.608 | 0 | 11.315 | 0 | 10.072 | 0 |
|TOTAL |1.445.204 | 451.357 |425.477 |139.879 |353.301 |120.564 |
|TOTAL (no admin) |1.189.690 | 390.192 |351.061 |122.460 |292.627 |105.117 |
|TOTAL |1.445.204 | 448.776 |425.477 |139.076 |353.301 |119.899 |
|TOTAL (no admin) |1.189.690 | 387.611 |351.061 |121.657 |292.627 |104.452 |
For a user its around 65% smaller and faster than traditional RainLoop.
@ -155,10 +155,10 @@ For a user its around 65% smaller and faster than traditional RainLoop.
* Removed vendors/Progress.js/minified/progressjs.min.css
|css/* |RainLoop |Snappy |Rain gzip |gzip |brotli |
|-------------- |-------: |-------: |------: |------: |------: |
|app.css | 340.334 | 183.662 | 46,959 | 28.665 | 24.135 |
|app.min.css | 274.791 | 149.991 | 39.618 | 25.303 | 21.868 |
|css/* |RainLoop |Snappy |RL gzip |SM gzip |SM brotli |
|------------ |-------: |-------: |------: |------: |--------: |
|app.css | 340.334 | 183.662 | 46,959 | 28.665 | 24.135 |
|app.min.css | 274.791 | 149.991 | 39.618 | 25.303 | 21.868 |
|boot.css | | 2.534 | | 837 | 668 |
|boot.min.css | | 2.055 | | 732 | 560 |

View file

@ -68,7 +68,7 @@ ko.bindingHandlers.emailsTags = {
inputDelimiters = [',', ';', '\n'];
element.inputosaurus = new window.Inputosaurus(element, {
focusCallback: value => fValue && fValue.focused && fValue.focused(!!value),
focusCallback: value => fValue.focused && fValue.focused(!!value),
autoCompleteSource: fAllBindings.autoCompleteSource || null,
splitHook: value => {
const v = value.trim();
@ -89,7 +89,7 @@ ko.bindingHandlers.emailsTags = {
}
});
if (fValue && fValue.focused && fValue.focused.subscribe) {
if (fValue.focused && fValue.focused.subscribe) {
fValue.focused.subscribe(value =>
element.inputosaurus[value ? 'focus' : 'blur']()
);

View file

@ -142,16 +142,11 @@ class ComposePopupView extends AbstractViewPopup {
identitiesDropdownTrigger: false,
to: '',
toFocused: false,
cc: '',
ccFocused: false,
bcc: '',
bccFocused: false,
replyTo: '',
replyToFocused: false,
subject: '',
subjectFocused: false,
isHtml: false,
@ -197,20 +192,13 @@ class ComposePopupView extends AbstractViewPopup {
// this.to.subscribe((v) => console.log(v));
ko.computed(() => {
switch (true) {
case this.toFocused():
this.sLastFocusedField = 'to';
break;
case this.ccFocused():
this.sLastFocusedField = 'cc';
break;
case this.bccFocused():
this.sLastFocusedField = 'bcc';
break;
// no default
}
}).extend({ notify: 'always' });
// Used by ko.bindingHandlers.emailsTags
this.to.focused = ko.observable(false);
this.to.focused.subscribe(value => value && (this.sLastFocusedField = 'to'));
this.cc.focused = ko.observable(false);
this.cc.focused.subscribe(value => value && (this.sLastFocusedField = 'cc'));
this.bcc.focused = ko.observable(false);
this.bcc.focused.subscribe(value => value && (this.sLastFocusedField = 'bcc'));
this.attachments = ko.observableArray();
@ -688,7 +676,7 @@ class ComposePopupView extends AbstractViewPopup {
this.bSkipNextHide = false;
this.toFocused(false);
this.to.focused(false);
rl.route.on();
@ -1131,11 +1119,9 @@ class ComposePopupView extends AbstractViewPopup {
// rl.settings.app('mobile') ||
setTimeout(() => {
if (!this.to()) {
this.toFocused(true);
} else if (this.oEditor) {
if (!this.toFocused()) {
this.oEditor.focus();
}
this.to.focused(true);
} else if (this.oEditor && !this.to.focused()) {
this.oEditor.focus();
}
}, 100);
}

View file

@ -111,7 +111,7 @@
</label>
</div>
<div class="e-cell e-value">
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: to, emailsTagsFocus: toFocused, autoCompleteSource: emailsSource" />
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: to, autoCompleteSource: emailsSource" />
</div>
</div>
<div class="e-row cc-row" data-bind="visible: showCc">
@ -143,7 +143,7 @@
<span class="i18n" data-i18n="GLOBAL/SUBJECT"></span>
</div>
<div class="e-cell e-value">
<input type="text" size="70" autocomplete="off" data-bind="textInput: subject, hasFocus: subjectFocused" />
<input type="text" size="70" autocomplete="off" data-bind="textInput: subject" />
</div>
</div>
<div class="e-row">

View file

@ -178,7 +178,7 @@
<span class="contactValueStatic" data-bind="text: value"></span>
<input type="text" class="contactValueInput"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}" />
data-bind="value: value, hasfocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}" />
</div>
</div>
<div data-bind="visible: 0 < viewPropertiesOther().length, foreach: viewPropertiesOther">
@ -187,13 +187,13 @@
<span class="contactValueStatic" data-bind="text: value"></span>
<input type="text" class="contactValueInput"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}" />
data-bind="value: value, hasfocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}" />
<!-- /ko -->
<!-- ko if: largeValue -->
<span class="contactValueTextAreaStatic" data-bind="text: value"></span>
<textarea class="contactValueTextArea"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}"></textarea>
data-bind="value: value, hasfocus: focused, valueUpdate: 'keyup', attr: {'placeholder': placeholderValue}"></textarea>
<!-- /ko -->
</div>
</div>
@ -209,7 +209,7 @@
<span class="contactValueStatic" data-bind="text: value"></span>
<input type="text" class="contactValueInput"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
data-bind="value: value, hasfocus: focused, valueUpdate: 'keyup'" />
</div>
</div>
<a href="javascript:void(0);" class="g-ui-link add-link i18n" data-bind="visible: !viewReadOnly(), click: addNewEmail" data-i18n="CONTACTS/LINK_ADD_EMAIL"></a>
@ -225,7 +225,7 @@
<span class="contactValueStatic" data-bind="text: value"></span>
<input type="text" class="contactValueInput"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
data-bind="value: value, hasfocus: focused, valueUpdate: 'keyup'" />
</div>
</div>
</div>
@ -240,7 +240,7 @@
<span class="contactValueLargeStatic" data-bind="text: value"></span>
<input type="text" class="contactValueInputLarge" placeholder="https://"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: value, hasFocus: focused, valueUpdate: 'keyup'" />
data-bind="value: value, hasfocus: focused, valueUpdate: 'keyup'" />
</div>
</div>
</div>

View file

@ -14,7 +14,7 @@
<div class="control-group" data-bind="css: {'error': nameError}">
<div class="controls">
<input type="text" class="i18n span5"
data-bind="value: name, hasFocus: nameFocused"
data-bind="value: name, hasfocus: nameFocused"
autocorrect="off" autocapitalize="off" spellcheck="false"
data-i18n="[placeholder]GLOBAL/NAME"
/>

View file

@ -12,7 +12,7 @@
<div class="control-group" data-bind="css: {'error': nameError}">
<div class="controls">
<input type="text" class="i18n span5"
data-bind="value: name, hasFocus: !exists(), visible: !exists()"
data-bind="value: name, hasfocus: !exists(), visible: !exists()"
autocorrect="off" autocapitalize="off" spellcheck="false"
data-i18n="[placeholder]GLOBAL/NAME"
/>

View file

@ -76,9 +76,3 @@
background-color: Highlight;
color: HighlightText;
}
.inputosaurus-fake-span {
position: absolute;
top: 0;
left: -5000px;
}

View file

@ -35,16 +35,12 @@ this.Inputosaurus = class {
// In Chrome we have no access to dataTransfer.getData unless it's the 'drop' event
// In Chrome Mobile dataTransfer.types.includes(contentType) fails, only text/plain is set
validDropzone = () => dragData && dragData.li.parentNode !== self.ul,
fnDrag = e => validDropzone(e) && e.preventDefault();
fnDrag = e => validDropzone() && e.preventDefault();
self.element = element;
self.options = Object.assign({
// while typing, the user can separate values using these delimiters
// the value tags are created on the fly when an inputDelimiter is detected
inputDelimiters : [',', ';', '\n'],
focusCallback : null,
// simply passing an autoComplete source (array, string or function) will instantiate autocomplete functionality
@ -71,11 +67,10 @@ this.Inputosaurus = class {
self.ul.addEventListener("dragenter", fnDrag);
self.ul.addEventListener("dragover", fnDrag);
self.ul.addEventListener("drop", e => {
if (validDropzone(e) && dragData.value) {
if (validDropzone() && dragData.value) {
e.preventDefault();
dragData.source._removeDraggedTag(dragData.li);
self.input.value = dragData.value;
self.parseInput();
self._parseValue(dragData.value);
}
});
@ -83,13 +78,33 @@ this.Inputosaurus = class {
autocomplete:"off", autocorrect:"off", autocapitalize:"off", spellcheck:"false"});
self.input.addEventListener('focus', () => self._focusTrigger(true));
self.input.addEventListener('blur', () => self._focusTrigger(false));
self.input.addEventListener('keyup', e => self._inputKeypress(e));
self.input.addEventListener('keydown', e => self._inputKeypress(e));
self.input.addEventListener('change', e => self._inputKeypress(e));
self.input.addEventListener('input', e => self._inputKeypress(e));
self.input.addEventListener('blur', () => {
// prevent autoComplete menu click from causing a false 'blur'
self._parseInput();
self._focusTrigger(false);
});
self.input.addEventListener('keydown', e => {
if ('Backspace' === e.key || 'ArrowLeft' === e.key) {
// if our input contains no value and backspace has been pressed, select the last tag
var lastTag = self.inputCont.previousElementSibling,
input = self.input;
if (lastTag && (!input.value
|| (('selectionStart' in input) && input.selectionStart === 0 && input.selectionEnd === 0))
) {
e.preventDefault();
lastTag.querySelector('a').focus();
}
self._updateDatalist();
} else if (e.key == 'Enter') {
e.preventDefault();
self._parseInput();
}
});
self.input.addEventListener('input', () => {
self._parseInput();
self._updateDatalist();
});
self.input.addEventListener('focus', () => self.input.value || self._resetDatalist());
self.input.addEventListener('blur', e => self.parseInput(e));
// define starting placeholder
if (element.placeholder) {
@ -104,8 +119,7 @@ this.Inputosaurus = class {
// if instantiated input already contains a value, parse that junk
if (element.value.trim()) {
self.input.value = element.value;
self.parseInput();
self._parseValue(element.value);
}
self._updateDatalist = self.options.autoCompleteSource
@ -134,71 +148,34 @@ this.Inputosaurus = class {
datalist.textContent = '';
}
parseInput(ev) {
var self = this,
val,
hook,
delimiterFound = false,
values = [];
val = self.input.value;
if (val) {
hook = self.options.splitHook(val);
}
if (hook) {
values = hook;
} else if (delimiterFound !== false) {
values = val.split(delimiterFound);
} else if (!ev || ev.key == 'Enter') {
values.push(val);
ev && ev.preventDefault();
// prevent autoComplete menu click from causing a false 'blur'
} else if (ev.type === 'blur') {
values.push(val);
}
values = self.options.parseHook(values);
if (values.length) {
self._setChosen(values);
self.input.value = '';
self.resizeInput();
}
_parseInput() {
this._parseValue(this.input.value) && (this.input.value = '');
this._resizeInput();
}
_inputKeypress(ev) {
let self = this;
_parseValue(val) {
var self = this,
hook,
values = [];
switch (ev.key) {
case 'Backspace':
case 'ArrowLeft':
// if our input contains no value and backspace has been pressed, select the last tag
if (ev.type === 'keydown') {
var lastTag = self.inputCont.previousElementSibling,
input = self.input;
if (lastTag && (!input.value
|| (('selectionStart' in input) && input.selectionStart === 0 && input.selectionEnd === 0))
) {
ev.preventDefault();
lastTag.querySelector('a').focus();
}
if (val) {
if ((hook = self.options.splitHook(val))) {
values = hook;
} else {
values.push(val);
}
}
break;
values = self.options.parseHook(values);
default :
self.parseInput(ev);
self.resizeInput();
if (values.length) {
self._setChosen(values);
return true;
}
}
self._updateDatalist();
}
// the input dynamically resizes based on the length of its value
resizeInput() {
_resizeInput() {
let input = this.input;
if (input.clientWidth < input.scrollWidth) {
input.style.width = Math.min(500, Math.max(200, input.scrollWidth)) + 'px';
@ -220,13 +197,10 @@ this.Inputosaurus = class {
;
self._chosenValues.forEach(v => {
if (v.key === tagKey)
{
if (v.key === tagKey) {
tagName = v.value;
next = true;
}
else if (next && !oPrev)
{
} else if (next && !oPrev) {
oPrev = v;
}
});
@ -242,12 +216,7 @@ this.Inputosaurus = class {
setTimeout(() => self.input.select(), 100);
self._removeTag(ev, li);
self.resizeInput(ev);
}
// return the inputDelimiter that was detected or false if none were found
_containsDelimiter(tagStr) {
return -1 < this.options.inputDelimiters.findIndex(v => tagStr.indexOf(v) !== -1);
self._resizeInput(ev);
}
_setChosen(valArr) {
@ -258,7 +227,8 @@ this.Inputosaurus = class {
}
valArr.forEach(a => {
var v = '', exists = false,
var v = a[0].trim(),
exists = false,
lastIndex = -1,
obj = {
key : '',
@ -266,11 +236,8 @@ this.Inputosaurus = class {
value : ''
};
v = a[0].trim();
self._chosenValues.forEach((vv, kk) => {
if (vv.value === self._lastEdit)
{
if (vv.value === self._lastEdit) {
lastIndex = kk;
}
@ -283,12 +250,9 @@ this.Inputosaurus = class {
obj.value = v;
obj.obj = a[1];
if (-1 < lastIndex)
{
if (-1 < lastIndex) {
self._chosenValues.splice(lastIndex, 0, obj);
}
else
{
} else {
self._chosenValues.push(obj);
}
@ -297,8 +261,7 @@ this.Inputosaurus = class {
}
});
if (valArr.length === 1 && valArr[0] === '' && self._lastEdit !== '')
{
if (valArr.length === 1 && valArr[0] === '' && self._lastEdit !== '') {
self._lastEdit = '';
self._renderTags();
}
@ -419,8 +382,7 @@ this.Inputosaurus = class {
self = this,
indexFound = self._chosenValues.findIndex(v => key === v.key)
;
if (-1 < indexFound)
{
if (-1 < indexFound) {
self._chosenValues.splice(indexFound, 1);
self._setValue(self._buildValue());
}
@ -467,7 +429,7 @@ this.Inputosaurus = class {
self._setChosen(values);
self._renderTags();
self.input.value = '';
self.resizeInput();
self._resizeInput();
}
}
};

View file

@ -6,7 +6,7 @@ knockoutDebugCallback([
'src/utils.js',
'src/utils.domData.js',
'src/utils.domNodeDisposal.js',
'src/utils.domManipulation.js',
// 'src/utils.domManipulation.js',
// 'src/memoization.js',
'src/tasks.js',
'src/subscribables/extenders.js',

View file

@ -190,43 +190,26 @@ ko.exportSymbol('utils', ko.utils);
ko.exportSymbol('unwrap', ko.utils.unwrapObservable); // Convenient shorthand, because this is used so commonly
ko.utils.domData = new (function () {
var uniqueId = 0;
var dataStoreKeyExpandoPropertyName = "__ko__" + (Date.now());
var
// We considered using WeakMap, but it has a problem in IE 11 and Edge that prevents using
// it cross-window, so instead we just store the data directly on the node.
// See https://github.com/knockout/knockout/issues/2141
getDataForNode = (node, createIfNotFound) => {
var dataForNode = node[dataStoreKeyExpandoPropertyName];
if (!dataForNode && createIfNotFound) {
dataForNode = node[dataStoreKeyExpandoPropertyName] = {};
}
return dataForNode;
},
clear = node => {
if (node[dataStoreKeyExpandoPropertyName]) {
delete node[dataStoreKeyExpandoPropertyName];
return true; // Exposing "did clean" flag purely so specs can infer whether things have been cleaned up as intended
}
return false;
};
let uniqueId = 0,
dataStoreKeyExpandoPropertyName = "__ko__" + (Date.now()),
dataStore = new WeakMap();
return {
get: (node, key) => {
var dataForNode = getDataForNode(node, false);
return dataForNode && dataForNode[key];
},
get: (node, key) => (dataStore.get(node) || {})[key],
set: (node, key, value) => {
// Make sure we don't actually create a new domData key if we are actually deleting a value
var dataForNode = getDataForNode(node, value !== undefined /* createIfNotFound */);
dataForNode && (dataForNode[key] = value);
if (dataStore.has(node)) {
dataStore.get(node)[key] = value;
} else {
let dataForNode = {};
dataForNode[key] = value;
dataStore.set(node, dataForNode);
}
return value;
},
getOrSet: (node, key, value) => {
var dataForNode = getDataForNode(node, true /* createIfNotFound */);
return dataForNode[key] || (dataForNode[key] = value);
getOrSet: function(node, key, value) {
return this.get(node, key) || this.set(node, key, value);
},
clear: clear,
clear: node => dataStore.delete(node),
nextKey: () => (uniqueId++) + dataStoreKeyExpandoPropertyName
};
@ -323,77 +306,6 @@ ko.cleanNode = ko.utils.domNodeDisposal.cleanNode; // Shorthand name for conveni
ko.removeNode = ko.utils.domNodeDisposal.removeNode; // Shorthand name for convenience
ko.exportSymbol('utils.domNodeDisposal', ko.utils.domNodeDisposal);
ko.exportSymbol('utils.domNodeDisposal.addDisposeCallback', ko.utils.domNodeDisposal.addDisposeCallback);
(() => {
var none = [0, "", ""],
table = [1, "<table>", "</table>"],
tbody = [2, "<table><tbody>", "</tbody></table>"],
tr = [3, "<table><tbody><tr>", "</tr></tbody></table>"],
select = [1, "<select multiple='multiple'>", "</select>"],
lookup = {
'thead': table,
'tbody': table,
'tfoot': table,
'tr': tbody,
'td': tr,
'th': tr,
'option': select,
'optgroup': select
};
function getWrap(tags) {
var m = tags.match(/^(?:<!--.*?-->\s*?)*?<([a-z]+)[\s>]/);
return (m && lookup[m[1]]) || none;
}
function simpleHtmlParse(html, documentContext) {
documentContext || (documentContext = document);
var windowContext = documentContext['parentWindow'] || documentContext['defaultView'] || window;
// Based on jQuery's "clean" function, but only accounting for table-related elements.
// Trim whitespace, otherwise indexOf won't work as expected
var tags = ko.utils.stringTrim(html).toLowerCase(), div = documentContext.createElement("div"),
wrap = getWrap(tags),
depth = wrap[0];
// Go to html and back, then peel off extra wrappers
div.innerHTML = "<div>" + wrap[1] + html + wrap[2] + "</div>";
// Move to the right depth
while (depth--)
div = div.lastChild;
return [...div.lastChild.childNodes];
}
ko.utils.parseHtmlFragment = (html, documentContext) =>
simpleHtmlParse(html, documentContext); // ... otherwise, this simple logic will do in most common cases.
ko.utils.parseHtmlForTemplateNodes = (html, documentContext) => {
var nodes = ko.utils.parseHtmlFragment(html, documentContext);
return (nodes.length && nodes[0].parentElement) || ko.utils.moveCleanedNodesToContainerElement(nodes);
};
ko.utils.setHtml = (node, html) => {
ko.utils.emptyDomNode(node);
// There's no legitimate reason to display a stringified observable without unwrapping it, so we'll unwrap it
html = ko.utils.unwrapObservable(html);
if ((html !== null) && (html !== undefined)) {
if (typeof html != 'string')
html = html.toString();
// jQuery contains a lot of sophisticated code to parse arbitrary HTML fragments,
// for example <tr> elements which are not normally allowed to exist on their own.
// If you've referenced jQuery we'll use that rather than duplicating its code.
// ... otherwise, use KO's own parsing logic.
var parsedNodes = ko.utils.parseHtmlFragment(html, node.ownerDocument);
for (var i = 0; i < parsedNodes.length; i++)
node.appendChild(parsedNodes[i]);
}
};
})();
ko.tasks = (() => {
var taskQueue = [],
taskQueueLength = 0,
@ -925,7 +837,7 @@ Object.setPrototypeOf(ko.observableArray['fn'], ko.observable['fn']);
// Populate ko.observableArray.fn with native arrays functions
Object.getOwnPropertyNames(Array.prototype).forEach(methodName => {
// skip property length
// skip property length
if (typeof Array.prototype[methodName] === 'function' && 'constructor' != methodName) {
if (["copyWithin", "fill", "pop", "push", "reverse", "shift", "sort", "splice", "unshift"].includes(methodName)) {
// Mutator methods
@ -1655,25 +1567,22 @@ ko.pureComputed = (evaluatorFunctionOrOptions, evaluatorFunctionTarget) => {
}
break;
case 'SELECT':
if (value === "" || value === null) // A blank string or null value will select the caption
value = undefined;
var selection = -1;
// A blank string or null value will select the caption
var selection = -1, noValue = ("" === value || null == value);
for (var i = 0, n = element.options.length, optionValue; i < n; ++i) {
optionValue = ko.selectExtensions.readValue(element.options[i]);
// Include special check to handle selecting a caption with a blank string value
if (optionValue == value || (optionValue === "" && value === undefined)) {
if (optionValue == value || (optionValue === "" && noValue)) {
selection = i;
break;
}
}
if (allowUnset || selection >= 0 || (value === undefined && element.size > 1)) {
if (allowUnset || selection >= 0 || (noValue && element.size > 1)) {
element.selectedIndex = selection;
}
break;
default:
if ((value === null) || (value === undefined))
value = "";
element.value = value;
element.value = (value == null) ? "" : value;
break;
}
}
@ -1843,12 +1752,8 @@ ko.expressionRewriting = (() => {
preProcessBindings: preProcessBindings,
keyValueArrayContainsKey: (keyValueArray, key) => {
for (var i = 0; i < keyValueArray.length; i++)
if (keyValueArray[i]['key'] == key)
return true;
return false;
},
keyValueArrayContainsKey: (keyValueArray, key) =>
-1 < keyValueArray.findIndex(v => v['key'] == key),
// Internal, private KO utility for updating model properties from within bindings
// property: If the property being updated is (or might be) an observable, pass it here
@ -2013,37 +1918,29 @@ ko.expressionRewriting = (() => {
}
};
})();
(function() {
var defaultBindingAttributeName = "data-bind";
(() => {
const defaultBindingAttributeName = "data-bind",
ko.bindingProvider = function() {
this.bindingCache = {};
};
bindingCache = {},
ko.utils.extend(ko.bindingProvider.prototype, {
'nodeHasBindings': node => {
switch (node.nodeType) {
case 1: // Element
return node.getAttribute(defaultBindingAttributeName) != null;
case 8: // Comment node
return ko.virtualElements.hasBindingValue(node);
default: return false;
}
createBindingsStringEvaluatorViaCache = (bindingsString, cache, options) => {
var cacheKey = bindingsString + (options && options['valueAccessors'] || '');
return cache[cacheKey]
|| (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, options));
},
'getBindings': function(node, bindingContext) {
var bindingsString = this['getBindingsString'](node, bindingContext);
return bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node) : null;
},
'getBindingAccessors': function(node, bindingContext) {
var bindingsString = this['getBindingsString'](node, bindingContext);
return bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node, { 'valueAccessors': true }) : null;
createBindingsStringEvaluator = (bindingsString, options) => {
// Build the source for a function that evaluates "expression"
// For each scope variable, add an extra level of "with" nesting
// Example result: with(sc1) { with(sc0) { return (expression) } }
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options),
functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}";
return new Function("$context", "$element", functionBody);
},
// The following function is only used internally by this default provider.
// It's not part of the interface definition for a general binding provider.
'getBindingsString': (node, bindingContext) => {
getBindingsString = node => {
switch (node.nodeType) {
case 1: return node.getAttribute(defaultBindingAttributeName); // Element
case 8: return ko.virtualElements.virtualNodeBindingValue(node); // Comment node
@ -2053,33 +1950,34 @@ ko.expressionRewriting = (() => {
// The following function is only used internally by this default provider.
// It's not part of the interface definition for a general binding provider.
'parseBindingsString': function(bindingsString, bindingContext, node, options) {
parseBindingsString = (bindingsString, bindingContext, node, options) => {
try {
var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, this.bindingCache, options);
var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, bindingCache, options);
return bindingFunction(bindingContext, node);
} catch (ex) {
ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString + "\nMessage: " + ex.message;
throw ex;
}
};
ko.bindingProvider = new class
{
nodeHasBindings(node) {
switch (node.nodeType) {
case 1: // Element
return node.getAttribute(defaultBindingAttributeName) != null;
case 8: // Comment node
return ko.virtualElements.hasBindingValue(node);
default: return false;
}
}
});
ko.bindingProvider['instance'] = new ko.bindingProvider();
getBindingAccessors(node, bindingContext) {
var bindingsString = getBindingsString(node, bindingContext);
return bindingsString ? parseBindingsString(bindingsString, bindingContext, node, { 'valueAccessors': true }) : null;
}
};
function createBindingsStringEvaluatorViaCache(bindingsString, cache, options) {
var cacheKey = bindingsString + (options && options['valueAccessors'] || '');
return cache[cacheKey]
|| (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, options));
}
function createBindingsStringEvaluator(bindingsString, options) {
// Build the source for a function that evaluates "expression"
// For each scope variable, add an extra level of "with" nesting
// Example result: with(sc1) { with(sc0) { return (expression) } }
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options),
functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}";
return new Function("$context", "$element", functionBody);
}
})();
(() => {
// Hide or don't minify context properties, see https://github.com/knockout/knockout/issues/2294
@ -2343,12 +2241,6 @@ ko.expressionRewriting = (() => {
: ko.utils.objectMap(bindings, value => () => value);
}
// This function is used if the binding provider doesn't include a getBindingAccessors function.
// It must be called with 'this' set to the provider instance.
function getBindingsAndMakeAccessors(node, context) {
return makeAccessorsFromFunction(this['getBindings'].bind(this, node, context));
}
function validateThatBindingIsAllowedForVirtualElements(bindingName) {
var validator = ko.virtualElements.allowedBindings[bindingName];
if (!validator)
@ -2359,22 +2251,7 @@ ko.expressionRewriting = (() => {
var nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement);
if (nextInQueue) {
var currentChild,
provider = ko.bindingProvider['instance'],
preprocessNode = provider['preprocessNode'];
// Preprocessing allows a binding provider to mutate a node before bindings are applied to it. For example it's
// possible to insert new siblings after it, and/or replace the node with a different one. This can be used to
// implement custom binding syntaxes, such as {{ value }} for string interpolation, or custom element types that
// trigger insertion of <template> contents at that point in the document.
if (preprocessNode) {
while (currentChild = nextInQueue) {
nextInQueue = ko.virtualElements.nextSibling(currentChild);
preprocessNode.call(provider, currentChild);
}
// Reset nextInQueue for the next loop
nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement);
}
var currentChild;
while (currentChild = nextInQueue) {
// Keep a record of the next child *before* applying bindings, in case the binding removes the current child from its position
@ -2393,7 +2270,7 @@ ko.expressionRewriting = (() => {
// Perf optimisation: Apply bindings only if...
// (1) We need to store the binding info for the node (all element nodes)
// (2) It might have bindings (e.g., it has a data-bind attribute, or it's a marker for a containerless template)
var shouldApplyBindings = isElement || ko.bindingProvider['instance']['nodeHasBindings'](nodeVerified);
var shouldApplyBindings = isElement || ko.bindingProvider.nodeHasBindings(nodeVerified);
if (shouldApplyBindings)
bindingContextForDescendants = applyBindingsToNodeInternal(nodeVerified, null, bindingContext)['bindingContextForDescendants'];
@ -2462,14 +2339,11 @@ ko.expressionRewriting = (() => {
if (sourceBindings && typeof sourceBindings !== 'function') {
bindings = sourceBindings;
} else {
var provider = ko.bindingProvider['instance'],
getBindings = provider['getBindingAccessors'] || getBindingsAndMakeAccessors;
// Get the binding from the provider within a computed observable so that we can update the bindings whenever
// the binding context is updated or if the binding provider accesses observables.
var bindingsUpdater = ko.computed(
() => {
bindings = sourceBindings ? sourceBindings(bindingContext, node) : getBindings.call(provider, node, bindingContext);
bindings = sourceBindings ? sourceBindings(bindingContext, node) : ko.bindingProvider.getBindingAccessors(node, bindingContext);
// Register a dependency on the binding context to support observable view models.
if (bindings) {
if (bindingContext[contextSubscribable]) {
@ -2859,10 +2733,7 @@ ko.expressionRewriting = (() => {
}
function resolveTemplate(errorCallback, templateConfig, callback) {
if (typeof templateConfig === 'string') {
// Markup - parse it
callback(ko.utils.parseHtmlFragment(templateConfig));
} else if (templateConfig instanceof Array) {
if (templateConfig instanceof Array) {
// Assume already an array of DOM nodes - pass through unchanged
callback(templateConfig);
} else if (templateConfig instanceof DocumentFragment) {
@ -3236,17 +3107,27 @@ ko.bindingHandlers['hasfocus'] = {
}
};
ko.expressionRewriting.twoWayBindings['hasfocus'] = true;
ko.bindingHandlers['hasFocus'] = ko.bindingHandlers['hasfocus']; // Make "hasFocus" an alias
ko.expressionRewriting.twoWayBindings['hasFocus'] = 'hasfocus';
ko.bindingHandlers['html'] = {
'init': () => {
// Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)
return { 'controlsDescendantBindings': true };
},
'update': (element, valueAccessor) =>
'update': (element, valueAccessor) => {
// setHtml will unwrap the value if needed
ko.utils.setHtml(element, valueAccessor())
ko.utils.emptyDomNode(element);
// There's no legitimate reason to display a stringified observable without unwrapping it, so we'll unwrap it
let html = ko.utils.unwrapObservable(valueAccessor());
if (html != null) {
if (typeof html != 'string')
html = html.toString();
const template = document.createElement('template');
template.innerHTML = html;
element.appendChild(template.content);
}
}
};
(function () {
@ -3766,118 +3647,61 @@ makeEventHandlerShortcut('click');
// 2. ko.templateSources.anonymousElement - uses ko.utils.domData to read/write text *associated* with the DOM element, but
// without reading/writing the actual element text content, since it will be overwritten
// with the rendered template output.
// You can implement your own template source if you want to fetch/store templates somewhere other than in DOM elements.
// Template sources need to have the following functions:
// text() - returns the template text from your storage location
// text(value) - writes the supplied template text to your storage location
// data(key) - reads values stored using data(key, value) - see below
// data(key, value) - associates "value" with this template and the key "key". Is used to store information like "isRewritten".
//
// Optionally, template sources can also have the following functions:
// nodes() - returns a DOM element containing the nodes of this template, where available
// nodes(value) - writes the given DOM element to your storage location
// If a DOM element is available for a given template source, template engines are encouraged to use it in preference over text()
// for improved speed. However, all templateSources must supply text() even if they don't supply nodes().
//
// Once you've implemented a templateSource, make your template engine use it by subclassing whatever template engine you were
// using and overriding "makeTemplateSource" to return an instance of your custom template source.
ko.templateSources = {};
// ---- ko.templateSources.domElement -----
// template types
var templateTemplate = 3,
templateElement = 4;
ko.templateSources.domElement = function(element) {
this.domElement = element;
if (element) {
this.templateType =
element.matches("TEMPLATE") && element.content && element.content.nodeType === 11 ? templateTemplate :
templateElement;
}
}
ko.templateSources.domElement.prototype['text'] = function(/* valueToWrite */) {
var elemContentsProperty = "innerHTML";
if (arguments.length == 0) {
return this.domElement.innerHTML;
}
ko.utils.setHtml(this.domElement, arguments[0]);
};
var dataDomDataPrefix = ko.utils.domData.nextKey() + "_";
ko.templateSources.domElement.prototype['data'] = function(key /*, valueToWrite */) {
if (arguments.length === 1) {
return ko.utils.domData.get(this.domElement, dataDomDataPrefix + key);
}
ko.utils.domData.set(this.domElement, dataDomDataPrefix + key, arguments[1]);
};
var templatesDomDataKey = ko.utils.domData.nextKey();
function getTemplateDomData(element) {
return ko.utils.domData.get(element, templatesDomDataKey) || {};
}
function setTemplateDomData(element, data) {
ko.utils.domData.set(element, templatesDomDataKey, data);
}
ko.templateSources.domElement.prototype['nodes'] = function(/* valueToWrite */) {
var element = this.domElement;
if (arguments.length == 0) {
var templateData = getTemplateDomData(element),
nodes = templateData.containerData || (
this.templateType === templateTemplate ? element.content :
this.templateType === templateElement ? element :
undefined);
if (!nodes || templateData.alwaysCheckText) {
// If the template is associated with an element that stores the template as text,
// parse and cache the nodes whenever there's new text content available. This allows
// the user to update the template content by updating the text of template node.
var text = this['text']();
if (text && text !== templateData.textData) {
nodes = ko.utils.parseHtmlForTemplateNodes(text, element.ownerDocument);
setTemplateDomData(element, {containerData: nodes, textData: text, alwaysCheckText: true});
}
}
return nodes;
}
var valueToWrite = arguments[0];
if (this.templateType !== undefined) {
this['text'](""); // clear the text from the node
}
setTemplateDomData(element, {containerData: valueToWrite});
};
let templatesDomDataKey = ko.utils.domData.nextKey();
// ---- ko.templateSources.anonymousTemplate -----
// Anonymous templates are normally saved/retrieved as DOM nodes through "nodes".
// For compatibility, you can also read "text"; it will be serialized from the nodes on demand.
// Writing to "text" is still supported, but then the template data will not be available as DOM nodes.
ko.templateSources.anonymousTemplate = function(element) {
this.domElement = element;
};
ko.templateSources.anonymousTemplate.prototype = new ko.templateSources.domElement();
ko.templateSources.anonymousTemplate.prototype.constructor = ko.templateSources.anonymousTemplate;
ko.templateSources.anonymousTemplate.prototype['text'] = function(/* valueToWrite */) {
if (arguments.length == 0) {
var templateData = getTemplateDomData(this.domElement);
if (templateData.textData === undefined && templateData.containerData)
templateData.textData = templateData.containerData.innerHTML;
return templateData.textData;
class anonymousTemplate
{
constructor(element)
{
this.domElement = element;
}
var valueToWrite = arguments[0];
setTemplateDomData(this.domElement, {textData: valueToWrite});
nodes(...args)
{
let element = this.domElement;
if (!args.length) {
return ko.utils.domData.get(element, templatesDomDataKey) || (
this.templateType === 11 ? element.content :
this.templateType === 1 ? element :
undefined);
}
ko.utils.domData.set(element, templatesDomDataKey, args[0]);
}
}
// ---- ko.templateSources.domElement -----
class domElement extends anonymousTemplate
{
constructor(element)
{
super(element);
if (element) {
this.templateType =
element.matches("TEMPLATE") && element.content ? element.content.nodeType : 1;
}
}
}
ko.templateSources = {
domElement: domElement,
anonymousTemplate: anonymousTemplate
};
})();
(() => {
var renderTemplateSource = (templateSource, bindingContext, options, templateDocument) => {
var renderTemplateSource = templateSource => {
var templateNodes = templateSource.nodes ? templateSource.nodes() : null;
return templateNodes
? [...templateNodes.cloneNode(true).childNodes]
: ko.utils.parseHtmlFragment(templateSource['text'](), templateDocument);
: null;
},
makeTemplateSource = (template, templateDocument) => {
@ -3914,36 +3738,7 @@ makeEventHandlerShortcut('click');
if (continuousNodeArray.length) {
var firstNode = continuousNodeArray[0],
lastNode = continuousNodeArray[continuousNodeArray.length - 1],
parentNode = firstNode.parentNode,
provider = ko.bindingProvider['instance'],
preprocessNode = provider['preprocessNode'];
if (preprocessNode) {
invokeForEachNodeInContinuousRange(firstNode, lastNode, (node, nextNodeInRange) => {
var nodePreviousSibling = node.previousSibling;
var newNodes = preprocessNode.call(provider, node);
if (newNodes) {
if (node === firstNode)
firstNode = newNodes[0] || nextNodeInRange;
if (node === lastNode)
lastNode = newNodes[newNodes.length - 1] || nodePreviousSibling;
}
});
// Because preprocessNode can change the nodes, including the first and last nodes, update continuousNodeArray to match.
// We need the full set, including inner nodes, because the unmemoize step might remove the first node (and so the real
// first node needs to be in the array).
continuousNodeArray.length = 0;
if (!firstNode) { // preprocessNode might have removed all the nodes, in which case there's nothing left to do
return;
}
if (firstNode === lastNode) {
continuousNodeArray.push(firstNode);
} else {
continuousNodeArray.push(firstNode, lastNode);
ko.utils.fixUpContinuousNodeArray(continuousNodeArray, parentNode);
}
}
parentNode = firstNode.parentNode;
// Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind)
// whereas a regular applyBindings won't introduce new memoized nodes
@ -3968,10 +3763,7 @@ makeEventHandlerShortcut('click');
var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
var templateDocument = (firstTargetNode || template || {}).ownerDocument;
var renderedNodesArray = renderTemplateSource(
makeTemplateSource(template, templateDocument),
bindingContext, options, templateDocument
);
var renderedNodesArray = renderTemplateSource(makeTemplateSource(template, templateDocument));
// Loosely check result is an array of DOM nodes
if ((typeof renderedNodesArray.length != "number") || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType != "number"))
@ -4140,13 +3932,13 @@ makeEventHandlerShortcut('click');
ko.utils.domData.set(container, cleanContainerDomDataKey, true);
}
new ko.templateSources.anonymousTemplate(element)['nodes'](container);
new ko.templateSources.anonymousTemplate(element).nodes(container);
} else {
// It's an anonymous template - store the element contents, then clear the element
var templateNodes = ko.virtualElements.childNodes(element);
if (templateNodes.length > 0) {
let container = ko.utils.moveCleanedNodesToContainerElement(templateNodes); // This also removes the nodes from their current parent
new ko.templateSources.anonymousTemplate(element)['nodes'](container);
new ko.templateSources.anonymousTemplate(element).nodes(container);
} else {
throw new Error("Anonymous template defined, but no template content was provided");
}

View file

@ -4,86 +4,81 @@
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
(C=>{function G(b,c){return null===b||typeof b in ha?b===c:!1}function F(b,c){var e;return()=>{e||(e=a.a.setTimeout(()=>{e=void 0;b()},c))}}function I(b,c){var e;return()=>{clearTimeout(e);e=a.a.setTimeout(b,c)}}function T(b,c){null!==c&&c.o&&c.o()}function X(b,c){var e=this.rc,g=e[D];g.ca||(this.ab&&this.Ha[c]?(e.Fb(c,b,this.Ha[c]),this.Ha[c]=null,--this.ab):g.u[c]||e.Fb(c,b,g.v?{X:b}:e.fc(b)),b.na&&b.kc())}var U=C.document,Z={},a="undefined"!==typeof Z?Z:{};a.l=(b,c)=>{b=b.split(".");for(var e=
a,g=0;g<b.length-1;g++)e=e[b[g]];e[b[b.length-1]]=c};a.ba=(b,c,e)=>{b[c]=e};a.version="3.5.1-sm";a.l("version",a.version);a.a={Da:(b,c)=>{c=b.indexOf(c);0<c?b.splice(c,1):0===c&&b.shift()},extend:(b,c)=>{c&&Object.entries(c).forEach(e=>b[e[0]]=e[1]);return b},P:(b,c)=>b&&Object.entries(b).forEach(e=>c(e[0],e[1])),nb:(b,c,e)=>{if(!b)return b;var g={};Object.entries(b).forEach(k=>g[k[0]]=c.call(e,k[1],k[0],b));return g},eb:b=>{for(;b.firstChild;)a.removeNode(b.firstChild)},lb:b=>{var c=[...b],e=(c[0]&&
c[0].ownerDocument||U).createElement("div");b.forEach(g=>e.append(a.ia(g)));return e},Fa:(b,c)=>Array.prototype.map.call(b,c?e=>a.ia(e.cloneNode(!0)):e=>e.cloneNode(!0)),ya:(b,c)=>{a.a.eb(b);c&&b.append(...c)},va:(b,c)=>{if(b.length){for(c=8===c.nodeType&&c.parentNode||c;b.length&&b[0].parentNode!==c;)b.splice(0,1);for(;1<b.length&&b[b.length-1].parentNode!==c;)b.length--;if(1<b.length){c=b[0];var e=b[b.length-1];for(b.length=0;c!==e;)b.push(c),c=c.nextSibling;b.push(e)}}return b},tb:b=>null==b?"":
b.trim?b.trim():b.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),Mc:(b,c)=>{b=b||"";return c.length>b.length?!1:b.substring(0,c.length)===c},uc:(b,c)=>c.contains(1!==b.nodeType?b.parentNode:b),cb:b=>a.a.uc(b,b.ownerDocument.documentElement),Mb:b=>a.onError?function(){try{return b.apply(this,arguments)}catch(c){throw a.onError&&a.onError(c),c;}}:b,setTimeout:(b,c)=>setTimeout(a.a.Mb(b),c),Qb:b=>setTimeout(()=>{a.onError&&a.onError(b);throw b;},0),J:(b,c,e)=>{b.addEventListener(c,a.a.Mb(e),!1)},hc:(b,
c)=>{if(!b||!b.nodeType)throw Error("element must be a DOM node when calling triggerEvent");b.dispatchEvent(new Event(c))},g:b=>a.M(b)?b():b,rb:(b,c)=>b.textContent=a.a.g(c)||""};a.l("utils",a.a);a.l("unwrap",a.a.g);a.a.b=new function(){var b=0,c="__ko__"+Date.now(),e=(g,k)=>{var n=g[c];!n&&k&&(n=g[c]={});return n};return{get:(g,k)=>(g=e(g,!1))&&g[k],set:(g,k,n)=>{(g=e(g,void 0!==n))&&(g[k]=n)},hb:(g,k,n)=>{g=e(g,!0);return g[k]||(g[k]=n)},clear:g=>g[c]?(delete g[c],!0):!1,U:()=>b++ +c}};a.a.L=new function(){function b(d,
f){var h=a.a.b.get(d,g);void 0===h&&f&&(h=[],a.a.b.set(d,g,h));return h}function c(d){var f=b(d,!1);if(f){f=f.slice(0);for(var h=0;h<f.length;h++)f[h](d)}a.a.b.clear(d);n[d.nodeType]&&e(d.childNodes,!0)}function e(d,f){for(var h=[],m,r=0;r<d.length;r++)if(!f||8===d[r].nodeType)if(c(h[h.length]=m=d[r]),d[r]!==m)for(;r--&&!h.includes(d[r]););}var g=a.a.b.U(),k={1:!0,8:!0,9:!0},n={1:!0,9:!0};return{qa:(d,f)=>{if("function"!=typeof f)throw Error("Callback must be a function");b(d,!0).push(f)},qb:(d,f)=>
{var h=b(d,!1);h&&(a.a.Da(h,f),0==h.length&&a.a.b.set(d,g,void 0))},ia:d=>{a.m.H(()=>{k[d.nodeType]&&(c(d),n[d.nodeType]&&e(d.getElementsByTagName("*")))});return d},removeNode:d=>{a.ia(d);d.parentNode&&d.parentNode.removeChild(d)}}};a.ia=a.a.L.ia;a.removeNode=a.a.L.removeNode;a.l("utils.domNodeDisposal",a.a.L);a.l("utils.domNodeDisposal.addDisposeCallback",a.a.L.qa);(()=>{var b=[0,"",""],c=[1,"<table>","</table>"],e=[3,"<table><tbody><tr>","</tr></tbody></table>"],g=[1,"<select multiple='multiple'>",
"</select>"],k={thead:c,tbody:c,tfoot:c,tr:[2,"<table><tbody>","</tbody></table>"],td:e,th:e,option:g,optgroup:g};a.a.Pa=(n,d)=>{d||(d=U);var f=a.a.tb(n).toLowerCase();d=d.createElement("div");f=(f=f.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&k[f[1]]||b;var h=f[0];for(d.innerHTML="<div>"+f[1]+n+f[2]+"</div>";h--;)d=d.lastChild;return[...d.lastChild.childNodes]};a.a.Fc=(n,d)=>{n=a.a.Pa(n,d);return n.length&&n[0].parentElement||a.a.lb(n)};a.a.ec=(n,d)=>{a.a.eb(n);d=a.a.g(d);if(null!==d&&void 0!==
d){"string"!=typeof d&&(d=d.toString());d=a.a.Pa(d,n.ownerDocument);for(var f=0;f<d.length;f++)n.appendChild(d[f])}}})();a.vb=(()=>{function b(){if(e)for(var d=e,f=0,h;k<e;)if(h=c[k++]){if(k>d){if(5E3<=++f){k=e;a.a.Qb(Error("'Too much recursion' after processing "+f+" task groups."));break}d=e}try{h()}catch(m){a.a.Qb(m)}}k=e=c.length=0}var c=[],e=0,g=1,k=0,n=(d=>{var f=U.createElement("div");(new MutationObserver(d)).observe(f,{attributes:!0});return()=>f.classList.toggle("foo")})(b);return{cc:d=>
{e||n(b);c[e++]=d;return g++},cancel:d=>{d-=g-e;d>=k&&d<e&&(c[d]=null)}}})();a.l("tasks",a.vb);a.fb={throttle:(b,c)=>{b.throttleEvaluation=c;var e=null;return a.i({read:b,write:g=>{clearTimeout(e);e=a.a.setTimeout(()=>b(g),c)}})},rateLimit:(b,c)=>{if("number"==typeof c)var e=c;else{e=c.timeout;var g=c.method}var k="function"==typeof g?g:"notifyWhenChangesStop"==g?I:F;b.kb(n=>k(n,e,c))},notify:(b,c)=>{b.equalityComparer="always"==c?null:G}};var ha={undefined:1,"boolean":1,number:1,string:1};a.l("extenders",
a.fb);class ia{constructor(b,c,e){this.X=b;this.yb=c;this.Kb=e;this.Ua=!1;this.fa=this.Xa=null;a.ba(this,"dispose",this.o);a.ba(this,"disposeWhenNodeIsRemoved",this.j)}o(){this.Ua||(this.fa&&a.a.L.qb(this.Xa,this.fa),this.Ua=!0,this.Kb(),this.X=this.yb=this.Kb=this.Xa=this.fa=null)}j(b){this.Xa=b;a.a.L.qa(b,this.fa=this.o.bind(this))}}a.V=function(){Object.setPrototypeOf(this,P);P.Ma(this)};var P={Ma:b=>{b.W={change:[]};b.Eb=1},subscribe:function(b,c,e){var g=this;e=e||"change";var k=new ia(g,c?b.bind(c):
b,()=>{a.a.Da(g.W[e],k);g.Ca&&g.Ca(e)});g.ra&&g.ra(e);g.W[e]||(g.W[e]=[]);g.W[e].push(k);return k},notifySubscribers:function(b,c){c=c||"change";"change"===c&&this.Ra();if(this.wa(c)){c="change"===c&&this.ic||this.W[c].slice(0);try{a.m.Ib();for(var e=0,g;g=c[e++];)g.Ua||g.yb(b)}finally{a.m.end()}}},Ka:function(){return this.Eb},yc:function(b){return this.Ka()!==b},Ra:function(){++this.Eb},kb:function(b){var c=this,e=a.M(c),g,k,n,d,f;c.Ba||(c.Ba=c.notifySubscribers,c.notifySubscribers=function(m,r){r&&
"change"!==r?"beforeChange"===r?this.Bb(m):this.Ba(m,r):this.Cb(m)});var h=b(()=>{c.na=!1;e&&d===c&&(d=c.zb?c.zb():c());var m=k||f&&c.Oa(n,d);f=k=g=!1;m&&c.Ba(n=d)});c.Cb=(m,r)=>{r&&c.na||(f=!r);c.ic=c.W.change.slice(0);c.na=g=!0;d=m;h()};c.Bb=m=>{g||(n=m,c.Ba(m,"beforeChange"))};c.Db=()=>{f=!0};c.kc=()=>{c.Oa(n,c.I(!0))&&(k=!0)}},wa:function(b){return this.W[b]&&this.W[b].length},Oa:function(b,c){return!this.equalityComparer||!this.equalityComparer(b,c)},toString:()=>"[object Object]",extend:function(b){var c=
this;b&&a.a.P(b,(e,g)=>{e=a.fb[e];"function"==typeof e&&(c=e(c,g)||c)});return c}};a.ba(P,"init",P.Ma);a.ba(P,"subscribe",P.subscribe);a.ba(P,"extend",P.extend);Object.setPrototypeOf(P,Function.prototype);a.V.fn=P;a.Ac=b=>null!=b&&"function"==typeof b.subscribe&&"function"==typeof b.notifySubscribers;a.sa=a.m=(()=>{var b=[],c,e=0;return{Ib:g=>{b.push(c);c=g},end:()=>c=b.pop(),bc:g=>{if(c){if(!a.Ac(g))throw Error("Only subscribable things can act as dependencies");c.oc.call(c.pc,g,g.jc||(g.jc=++e))}},
H:(g,k,n)=>{try{return b.push(c),c=void 0,g.apply(k,n||[])}finally{c=b.pop()}},Ja:()=>c&&c.i.Ja(),gb:()=>c&&c.i.gb(),jb:()=>c&&c.jb,i:()=>c&&c.i}})();const O=Symbol("_latestValue");a.ea=b=>{function c(){if(0<arguments.length)return c.Oa(c[O],arguments[0])&&(c.Sa(),c[O]=arguments[0],c.Aa()),this;a.m.bc(c);return c[O]}c[O]=b;Object.defineProperty(c,"length",{get:()=>null==c[O]?void 0:c[O].length});a.V.fn.Ma(c);Object.setPrototypeOf(c,Q);return c};var Q={toJSON:function(){let b=this[O];return b&&b.toJSON?
b.toJSON():b},equalityComparer:G,I:function(){return this[O]},Aa:function(){this.notifySubscribers(this[O],"spectate");this.notifySubscribers(this[O])},Sa:function(){this.notifySubscribers(this[O],"beforeChange")}};Object.setPrototypeOf(Q,a.V.fn);var R=a.ea.fa="__ko_proto__";Q[R]=a.ea;a.M=b=>{if((b="function"==typeof b&&b[R])&&b!==Q[R]&&b!==a.i.fn[R])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!b};a.Cc=b=>"function"==typeof b&&(b[R]===
Q[R]||b[R]===a.i.fn[R]&&b.Vb);a.l("observable",a.ea);a.l("isObservable",a.M);a.l("observable.fn",Q);a.ba(Q,"valueHasMutated",Q.Aa);a.la=b=>{b=b||[];if("object"!=typeof b||!("length"in b))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");b=a.ea(b);Object.setPrototypeOf(b,a.la.fn);return b.extend({trackArrayChanges:!0})};a.la.fn={remove:function(b){for(var c=this.I(),e=[],g="function"!=typeof b||a.M(b)?function(d){return d===b}:b,k=c.length;k--;){var n=
c[k];if(g(n)){0===e.length&&this.Sa();if(c[k]!==n)throw Error("Array modified during remove; cannot remove item");e.push(n);c.splice(k,1)}}e.length&&this.Aa();return e},removeAll:function(b){if(void 0===b){var c=this.I(),e=c.slice(0);this.Sa();c.splice(0,c.length);this.Aa();return e}return b?this.remove(g=>b.includes(g)):[]}};Object.setPrototypeOf(a.la.fn,a.ea.fn);Object.getOwnPropertyNames(Array.prototype).forEach(b=>{"function"===typeof Array.prototype[b]&&"constructor"!=b&&("copyWithin fill pop push reverse shift sort splice unshift".split(" ").includes(b)?
a.la.fn[b]=function(...c){var e=this.I();this.Sa();this.Lb(e,b,c);c=e[b](...c);this.Aa();return c===e?this:c}:a.la.fn[b]=function(...c){return this()[b](...c)})});a.Xb=b=>a.M(b)&&"function"==typeof b.remove&&"function"==typeof b.push;a.l("observableArray",a.la);a.l("isObservableArray",a.Xb);a.fb.trackArrayChanges=(b,c)=>{function e(){function p(){if(f){var u=[].concat(b.I()||[]);if(b.wa("arrayChange")){if(!k||1<f)k=a.a.Nb(h,u,b.Za);var x=k}h=u;k=null;f=0;x&&x.length&&b.notifySubscribers(x,"arrayChange")}}
g?p():(g=!0,d=b.subscribe(()=>++f,null,"spectate"),h=[].concat(b.I()||[]),k=null,n=b.subscribe(p))}b.Za={};c&&"object"==typeof c&&a.a.extend(b.Za,c);b.Za.sparse=!0;if(!b.Lb){var g=!1,k=null,n,d,f=0,h,m=b.ra,r=b.Ca;b.ra=p=>{m&&m.call(b,p);"arrayChange"===p&&e()};b.Ca=p=>{r&&r.call(b,p);"arrayChange"!==p||b.wa("arrayChange")||(n&&n.o(),d&&d.o(),d=n=null,g=!1,h=void 0)};b.Lb=(p,u,x)=>{function v(J,z,K){return l[l.length]={status:J,value:z,index:K}}if(g&&!f){var l=[],q=p.length,t=x.length,w=0;switch(u){case "push":w=
q;case "unshift":for(u=0;u<t;u++)v("added",x[u],w+u);break;case "pop":w=q-1;case "shift":q&&v("deleted",p[w],w);break;case "splice":u=Math.min(Math.max(0,0>x[0]?q+x[0]:x[0]),q);q=1===t?q:Math.min(u+(x[1]||0),q);t=u+t-2;w=Math.max(q,t);for(var A=[],y=[],E=2;u<w;++u,++E)u<q&&y.push(v("deleted",p[u],u)),u<t&&A.push(v("added",x[E],u));a.a.Tb(y,A);break;default:return}k=l}}}};var D=Symbol("_state");a.i=function(b,c,e){function g(){if(0<arguments.length){if("function"===typeof k)k.apply(n.Ia,arguments);
else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}n.ca||a.m.bc(g);(n.Y||n.v&&g.xa())&&g.T();return n.N}"object"===typeof b?e=b:(e=e||{},b&&(e.read=b));if("function"!=typeof e.read)throw Error("Pass a function that returns the value of the ko.computed");var k=e.write,n={N:void 0,da:!0,Y:!0,Na:!1,ub:!1,ca:!1,pb:!1,v:!1,ac:e.read,Ia:c||e.owner,j:e.disposeWhenNodeIsRemoved||e.j||
null,ta:e.disposeWhen||e.ta,bb:null,u:{},K:0,Sb:null};g[D]=n;g.Vb="function"===typeof k;a.V.fn.Ma(g);Object.setPrototypeOf(g,V);e.pure?(n.pb=!0,n.v=!0,a.a.extend(g,ja)):e.deferEvaluation&&a.a.extend(g,ka);n.j&&(n.ub=!0,n.j.nodeType||(n.j=null));n.v||e.deferEvaluation||g.T();n.j&&g.ka()&&a.a.L.qa(n.j,n.bb=function(){g.o()});return g};var V={equalityComparer:G,Ja:function(){return this[D].K},gb:function(){var b=[];a.a.P(this[D].u,(c,e)=>b[e.oa]=e.X);return b},ib:function(b){if(!this[D].K)return!1;var c=
this.gb();return c.includes(b)?!0:!!c.find(e=>e.ib&&e.ib(b))},Fb:function(b,c,e){if(this[D].pb&&c===this)throw Error("A 'pure' computed must not be called recursively");this[D].u[b]=e;e.oa=this[D].K++;e.pa=c.Ka()},xa:function(){var b,c=this[D].u;for(b in c)if(Object.prototype.hasOwnProperty.call(c,b)){var e=c[b];if(this.ma&&e.X.na||e.X.yc(e.pa))return!0}},Pc:function(){this.ma&&!this[D].Na&&this.ma(!1)},ka:function(){var b=this[D];return b.Y||0<b.K},Qc:function(){this.na?this[D].Y&&(this[D].da=!0):
this.Rb()},fc:function(b){return b.subscribe(this.Rb,this)},Rb:function(){var b=this,c=b.throttleEvaluation;c&&0<=c?(clearTimeout(this[D].Sb),this[D].Sb=a.a.setTimeout(()=>b.T(!0),c)):b.ma?b.ma(!0):b.T(!0)},T:function(b){var c=this[D],e=c.ta,g=!1;if(!c.Na&&!c.ca){if(c.j&&!a.a.cb(c.j)||e&&e()){if(!c.ub){this.o();return}}else c.ub=!1;c.Na=!0;try{g=this.wc(b)}finally{c.Na=!1}return g}},wc:function(b){var c=this[D],e=c.pb?void 0:!c.K;var g={rc:this,Ha:c.u,ab:c.K};a.m.Ib({pc:g,oc:X,i:this,jb:e});c.u={};
c.K=0;var k=this.vc(c,g);c.K?g=this.Oa(c.N,k):(this.o(),g=!0);g&&(c.v?this.Ra():this.notifySubscribers(c.N,"beforeChange"),c.N=k,this.notifySubscribers(c.N,"spectate"),!c.v&&b&&this.notifySubscribers(c.N),this.Db&&this.Db());e&&this.notifySubscribers(c.N,"awake");return g},vc:(b,c)=>{try{var e=b.ac;return b.Ia?e.call(b.Ia):e()}finally{a.m.end(),c.ab&&!b.v&&a.a.P(c.Ha,T),b.da=b.Y=!1}},I:function(b){var c=this[D];(c.Y&&(b||!c.K)||c.v&&this.xa())&&this.T();return c.N},kb:function(b){a.V.fn.kb.call(this,
b);this.zb=function(){this[D].v||(this[D].da?this.T():this[D].Y=!1);return this[D].N};this.ma=function(c){this.Bb(this[D].N);this[D].Y=!0;c&&(this[D].da=!0);this.Cb(this,!c)}},o:function(){var b=this[D];!b.v&&b.u&&a.a.P(b.u,(c,e)=>e.o&&e.o());b.j&&b.bb&&a.a.L.qb(b.j,b.bb);b.u=void 0;b.K=0;b.ca=!0;b.da=!1;b.Y=!1;b.v=!1;b.j=void 0;b.ta=void 0;b.ac=void 0;this.Vb||(b.Ia=void 0)}},ja={ra:function(b){var c=this,e=c[D];if(!e.ca&&e.v&&"change"==b){e.v=!1;if(e.da||c.xa())e.u=null,e.K=0,c.T()&&c.Ra();else{var g=
[];a.a.P(e.u,(k,n)=>g[n.oa]=k);g.forEach((k,n)=>{var d=e.u[k],f=c.fc(d.X);f.oa=n;f.pa=d.pa;e.u[k]=f});c.xa()&&c.T()&&c.Ra()}e.ca||c.notifySubscribers(e.N,"awake")}},Ca:function(b){var c=this[D];c.ca||"change"!=b||this.wa("change")||(a.a.P(c.u,(e,g)=>{g.o&&(c.u[e]={X:g.X,oa:g.oa,pa:g.pa},g.o())}),c.v=!0,this.notifySubscribers(void 0,"asleep"))},Ka:function(){var b=this[D];b.v&&(b.da||this.xa())&&this.T();return a.V.fn.Ka.call(this)}},ka={ra:function(b){"change"!=b&&"beforeChange"!=b||this.I()}};Object.setPrototypeOf(V,
a.V.fn);V[a.ea.fa]=a.i;a.l("computed",a.i);a.l("computed.fn",V);a.ba(V,"dispose",V.o);a.Ic=b=>{if("function"===typeof b)return a.i(b,void 0,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.i(b,void 0)};(()=>{a.A={R:b=>{switch(b.nodeName){case "OPTION":return!0===b.__ko__hasDomDataOptionValue__?a.a.b.get(b,a.c.options.ob):b.value;case "SELECT":return 0<=b.selectedIndex?a.A.R(b.options[b.selectedIndex]):void 0;default:return b.value}},Ta:(b,c,e)=>{switch(b.nodeName){case "OPTION":"string"===typeof c?
(a.a.b.set(b,a.c.options.ob,void 0),delete b.__ko__hasDomDataOptionValue__,b.value=c):(a.a.b.set(b,a.c.options.ob,c),b.__ko__hasDomDataOptionValue__=!0,b.value="number"===typeof c?c:"");break;case "SELECT":if(""===c||null===c)c=void 0;for(var g=-1,k=0,n=b.options.length,d;k<n;++k)if(d=a.A.R(b.options[k]),d==c||""===d&&void 0===c){g=k;break}if(e||0<=g||void 0===c&&1<b.size)b.selectedIndex=g;break;default:if(null===c||void 0===c)c="";b.value=c}}}})();a.G=(()=>{function b(f){f=a.a.tb(f);123===f.charCodeAt(0)&&
(f=f.slice(1,-1));f+="\n,";var h=[],m=f.match(g),r=[],p=0;if(1<m.length){for(var u=0,x;x=m[u];++u){var v=x.charCodeAt(0);if(44===v){if(0>=p){h.push(l&&r.length?{key:l,value:r.join("")}:{unknown:l||r.join("")});var l=p=0;r=[];continue}}else if(58===v){if(!p&&!l&&1===r.length){l=r.pop();continue}}else if(47===v&&1<x.length&&(47===x.charCodeAt(1)||42===x.charCodeAt(1)))continue;else 47===v&&u&&1<x.length?(v=m[u-1].match(k))&&!n[v[0]]&&(f=f.substr(f.indexOf(x)+1),m=f.match(g),u=-1,x="/"):40===v||123===
v||91===v?++p:41===v||125===v||93===v?--p:l||r.length||34!==v&&39!==v||(x=x.slice(1,-1));r.push(x)}if(0<p)throw Error("Unbalanced parentheses, braces, or brackets");}return h}var c=["true","false","null","undefined"],e=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,g=/"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|`(?:\\.|[^`])*`|\/\*(?:[^*]|\*+[^*/])*\*+\/|\/\/.*\n|\/(?:\\.|[^/])+\/w*|[^\s:,/][^,"'`{}()/:[\]]*[^\s,"'`{}()/:[\]]|[^\s]/g,k=/[\])"'A-Za-z0-9_$]+$/,n={"in":1,"return":1,"typeof":1},d={};return{Ya:[],
Qa:d,Gc:b,Hc:function(f,h){function m(v,l){if(!x){var q=a.getBindingHandler(v);if(q&&q.preprocess&&!(l=q.preprocess(l,v,m)))return;if(q=d[v]){var t=l;c.includes(t)?t=!1:(q=t.match(e),t=null===q?!1:q[1]?"Object("+q[1]+")"+q[2]:t);q=t}q&&p.push("'"+("string"==typeof d[v]?d[v]:v)+"':function(_z){"+t+"=_z}")}u&&(l="function(){return "+l+" }");r.push("'"+v+"':"+l)}h=h||{};var r=[],p=[],u=h.valueAccessors,x=h.bindingParams;("string"===typeof f?b(f):f).forEach(v=>m(v.key||v.unknown,v.value));p.length&&m("_ko_property_writers",
"{"+p.join(",")+" }");return r.join(",")},Dc:(f,h)=>{for(var m=0;m<f.length;m++)if(f[m].key==h)return!0;return!1},xb:(f,h,m,r,p)=>{if(f&&a.M(f))!a.Cc(f)||p&&f.I()===r||f(r);else if((f=h.get("_ko_property_writers"))&&f[m])f[m](r)}}})();(()=>{function b(d){return 8==d.nodeType&&g.test(d.nodeValue)}function c(d){return 8==d.nodeType&&k.test(d.nodeValue)}function e(d,f){for(var h=d,m=1,r=[];h=h.nextSibling;){if(c(h)&&(a.a.b.set(h,n,!0),m--,0===m))return r;r.push(h);b(h)&&m++}if(!f)throw Error("Cannot find closing comment tag to match: "+
d.nodeValue);return null}var g=/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=/^\s*\/ko\s*$/,n="__ko_matchedEndComment__";a.h={ga:{},childNodes:d=>b(d)?e(d):d.childNodes,ua:d=>{if(b(d)){d=e(d);for(var f=0,h=d.length;f<h;f++)a.removeNode(d[f])}else a.a.eb(d)},ya:(d,f)=>{if(b(d)){a.h.ua(d);d=d.nextSibling;for(var h=0,m=f.length;h<m;h++)d.parentNode.insertBefore(f[h],d)}else a.a.ya(d,f)},prepend:(d,f)=>{if(b(d)){var h=d.nextSibling;d=d.parentNode}else h=d.firstChild;d.insertBefore(f,h)},Wb:(d,f,h)=>{h?(h=h.nextSibling,
b(d)&&(d=d.parentNode),d.insertBefore(f,h)):a.h.prepend(d,f)},firstChild:d=>{if(b(d))return!d.nextSibling||c(d.nextSibling)?null:d.nextSibling;if(d.firstChild&&c(d.firstChild))throw Error("Found invalid end comment, as the first child of "+d);return d.firstChild},nextSibling:d=>{if(b(d)){var f=e(d,void 0);d=f?0<f.length?f[f.length-1].nextSibling:d.nextSibling:null}if(d.nextSibling&&c(d.nextSibling)){f=d.nextSibling;if(c(f)&&!a.a.b.get(f,n))throw Error("Found end comment without a matching opening comment, as child of "+
d);return null}return d.nextSibling},xc:b,Nc:d=>(d=d.nodeValue.match(g))?d[1]:null}})();(function(){a.$=function(){this.nc={}};a.a.extend(a.$.prototype,{nodeHasBindings:b=>{switch(b.nodeType){case 1:return null!=b.getAttribute("data-bind");case 8:return a.h.xc(b);default:return!1}},getBindings:function(b,c){var e=this.getBindingsString(b,c);return e?this.parseBindingsString(e,c,b):null},getBindingAccessors:function(b,c){var e=this.getBindingsString(b,c);return e?this.parseBindingsString(e,c,b,{valueAccessors:!0}):
null},getBindingsString:b=>{switch(b.nodeType){case 1:return b.getAttribute("data-bind");case 8:return a.h.Nc(b)}return null},parseBindingsString:function(b,c,e,g){try{var k=this.nc,n=b+(g&&g.valueAccessors||""),d;if(!(d=k[n])){var f="with($context){with($data||{}){return{"+a.G.Hc(b,g)+"}}}";var h=new Function("$context","$element",f);d=k[n]=h}return d(c,e)}catch(m){throw m.message="Unable to parse bindings.\nBindings value: "+b+"\nMessage: "+m.message,m;}}});a.$.instance=new a.$})();(()=>{function b(l){var q=
(l=a.a.b.get(l,v))&&l.F;q&&(l.F=null,q.$b())}function c(l,q,t){this.node=l;this.Jb=q;this.Ea=[];this.B=!1;q.F||a.a.L.qa(l,b);t&&t.F&&(t.F.Ea.push(l),this.Va=t)}function e(l){return a.a.nb(a.m.H(l),(q,t)=>()=>l()[t])}function g(l,q,t){return"function"===typeof l?e(l.bind(null,q,t)):a.a.nb(l,w=>()=>w)}function k(l,q){return e(this.getBindings.bind(this,l,q))}function n(l,q){var t=a.h.firstChild(q);if(t){var w,A=a.$.instance,y=A.preprocessNode;if(y){for(;w=t;)t=a.h.nextSibling(w),y.call(A,w);t=a.h.firstChild(q)}for(;w=
t;)t=a.h.nextSibling(w),d(l,w)}a.f.notify(q,a.f.B)}function d(l,q){var t=l;if(1===q.nodeType||a.$.instance.nodeHasBindings(q))t=h(q,null,l).bindingContextForDescendants;t&&q.matches&&!q.matches("SCRIPT,TEXTAREA,TEMPLATE")&&n(t,q)}function f(l){var q=[],t={},w=[];a.a.P(l,function E(y){if(!t[y]){var J=a.getBindingHandler(y);J&&(J.after&&(w.push(y),J.after.forEach(z=>{if(l[z]){if(w.includes(z))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+w.join(", "));
E(z)}}),w.length--),q.push({key:y,Ub:J}));t[y]=!0}});return q}function h(l,q,t){var w=a.a.b.hb(l,v,{}),A=w.lc;if(!q){if(A)throw Error("You cannot apply bindings multiple times to the same element.");w.lc=!0}A||(w.context=t);w.mb||(w.mb={});if(q&&"function"!==typeof q)var y=q;else{var E=a.$.instance,J=E.getBindingAccessors||k,z=a.i(()=>{if(y=q?q(t,l):J.call(E,l,t)){if(t[r])t[r]();if(t[u])t[u]()}return y},null,{j:l});y&&z.ka()||(z=null)}var K=t,M;if(y){var H=z?B=>()=>z()[B]():B=>y[B];function L(){return a.a.nb(z?
z():y,B=>B())}L.get=B=>y[B]&&H(B)();L.has=B=>B in y;a.f.B in y&&a.f.subscribe(l,a.f.B,()=>{var B=y[a.f.B]();if(B){var N=a.h.childNodes(l);N.length&&B(N,a.Pb(N[0]))}});a.f.aa in y&&(K=a.f.sb(l,t),a.f.subscribe(l,a.f.aa,()=>{var B=y[a.f.aa]();B&&a.h.firstChild(l)&&B(l)}));f(y).forEach(B=>{var N=B.Ub.init,Y=B.Ub.update,S=B.key;if(8===l.nodeType&&!a.h.ga[S])throw Error("The binding '"+S+"' cannot be used with virtual elements");try{"function"==typeof N&&a.m.H(()=>{var W=N(l,H(S),L,K.$data,K);if(W&&W.controlsDescendantBindings){if(void 0!==
M)throw Error("Multiple bindings ("+M+" and "+S+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");M=S}}),"function"==typeof Y&&a.i(()=>Y(l,H(S),L,K.$data,K),null,{j:l})}catch(W){throw W.message='Unable to process binding "'+S+": "+y[S]+'"\nMessage: '+W.message,W;}})}w=void 0===M;return{shouldBindDescendants:w,bindingContextForDescendants:w&&K}}function m(l,q){return l&&l instanceof a.S?l:new a.S(l,void 0,void 0,q)}var r=
Symbol("_subscribable"),p=Symbol("_ancestorBindingInfo"),u=Symbol("_dataDependency");a.c={};a.getBindingHandler=l=>a.c[l];var x={};a.S=function(l,q,t,w,A){function y(){var L=K?z():z,B=a.a.g(L);q?(a.a.extend(E,q),p in q&&(E[p]=q[p])):(E.$parents=[],E.$root=B,E.ko=a);E[r]=H;J?B=E.$data:(E.$rawData=L,E.$data=B);t&&(E[t]=B);w&&w(E,q,B);if(q&&q[r]&&!a.sa.i().ib(q[r]))q[r]();M&&(E[u]=M);return E.$data}var E=this,J=l===x,z=J?void 0:l,K="function"==typeof z&&!a.M(z),M=A&&A.dataDependency;if(A&&A.exportDependencies)y();
else{var H=a.Ic(y);H.I();H.ka()?H.equalityComparer=null:E[r]=void 0}};a.S.prototype.createChildContext=function(l,q,t,w){!w&&q&&"object"==typeof q&&(w=q,q=w.as,t=w.extend);if(q&&w&&w.noChildContext){var A="function"==typeof l&&!a.M(l);return new a.S(x,this,null,y=>{t&&t(y);y[q]=A?l():l},w)}return new a.S(l,this,q,(y,E)=>{y.$parentContext=E;y.$parent=E.$data;y.$parents=(E.$parents||[]).slice(0);y.$parents.unshift(y.$parent);t&&t(y)},w)};a.S.prototype.extend=function(l,q){return new a.S(x,this,null,
t=>a.a.extend(t,"function"==typeof l?l(t):l),q)};var v=a.a.b.U();c.prototype.$b=function(){this.Va&&this.Va.F&&this.Va.F.tc(this.node)};c.prototype.tc=function(l){a.a.Da(this.Ea,l);!this.Ea.length&&this.B&&this.Ob()};c.prototype.Ob=function(){this.B=!0;this.Jb.F&&!this.Ea.length&&(this.Jb.F=null,a.a.L.qb(this.node,b),a.f.notify(this.node,a.f.aa),this.$b())};a.f={B:"childrenComplete",aa:"descendantsComplete",subscribe:(l,q,t,w,A)=>{var y=a.a.b.hb(l,v,{});y.ja||(y.ja=new a.V);A&&A.notifyImmediately&&
y.mb[q]&&a.m.H(t,w,[l]);return y.ja.subscribe(t,w,q)},notify:(l,q)=>{var t=a.a.b.get(l,v);if(t&&(t.mb[q]=!0,t.ja&&t.ja.notifySubscribers(l,q),q==a.f.B))if(t.F)t.F.Ob();else if(void 0===t.F&&t.ja&&t.ja.wa(a.f.aa))throw Error("descendantsComplete event not supported for bindings on this node");},sb:(l,q)=>{var t=a.a.b.hb(l,v,{});t.F||(t.F=new c(l,t,q[p]));return q[p]==t?q:q.extend(w=>{w[p]=t})}};a.Lc=l=>(l=a.a.b.get(l,v))&&l.context;a.Wa=(l,q,t)=>h(l,q,m(t));a.Oc=(l,q,t)=>{t=m(t);return a.Wa(l,g(q,
t,l),t)};a.Hb=(l,q)=>{1!==q.nodeType&&8!==q.nodeType||n(m(l),q)};a.Gb=function(l,q,t){if(2>arguments.length){if(q=U.body,!q)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");}else if(!q||1!==q.nodeType&&8!==q.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");d(m(l,t),q)};a.Pb=l=>(l=l&&[1,8].includes(l.nodeType)&&a.Lc(l))?l.$data:void 0;a.l("bindingHandlers",a.c);a.l("applyBindings",
a.Gb);a.l("applyBindingAccessorsToNode",a.Wa);a.l("dataFor",a.Pb)})();(()=>{function b(d,f){return Object.prototype.hasOwnProperty.call(d,f)?d[f]:void 0}function c(d,f){var h=b(k,d);if(h)h.subscribe(f);else{h=k[d]=new a.V;h.subscribe(f);e(d,(r,p)=>{p=!(!p||!p.synchronous);n[d]={definition:r,Bc:p};delete k[d];m||p?h.notifySubscribers(r):a.vb.cc(()=>h.notifySubscribers(r))});var m=!0}}function e(d,f){g("getConfig",[d],h=>{h?g("loadComponent",[d,h],m=>f(m,h)):f(null,null)})}function g(d,f,h,m){m||(m=
a.s.loaders.slice(0));var r=m.shift();if(r){var p=r[d];if(p){var u=!1;if(void 0!==p.apply(r,f.concat(function(x){u?h(null):null!==x?h(x):g(d,f,h,m)}))&&(u=!0,!r.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else g(d,f,h,m)}else h(null)}var k={},n={};a.s={get:(d,f)=>{var h=b(n,d);h?h.Bc?a.m.H(()=>f(h.definition)):a.vb.cc(()=>f(h.definition)):c(d,f)},qc:d=>delete n[d],Ab:g};a.s.loaders=[];a.l("components",
a.s)})();(()=>{function b(d,f,h,m){var r={},p=2;f=h.template;h=h.viewModel;f?a.s.Ab("loadTemplate",[d,f],u=>{r.template=u;0===--p&&m(r)}):0===--p&&m(r);h?a.s.Ab("loadViewModel",[d,h],u=>{r[n]=u;0===--p&&m(r)}):0===--p&&m(r)}function c(d,f,h){if("function"===typeof f)h(r=>new f(r));else if("function"===typeof f[n])h(f[n]);else if("instance"in f){var m=f.instance;h(()=>m)}else"viewModel"in f?c(d,f.viewModel,h):d("Unknown viewModel value: "+f)}function e(d){if(d.matches("TEMPLATE")&&d.content instanceof
DocumentFragment)return a.a.Fa(d.content.childNodes);throw"Template Source Element not a <template>";}function g(d){return f=>{throw Error("Component '"+d+"': "+f);}}var k={};a.s.register=(d,f)=>{if(!f)throw Error("Invalid configuration for "+d);if(a.s.Yb(d))throw Error("Component "+d+" is already registered");k[d]=f};a.s.Yb=d=>Object.prototype.hasOwnProperty.call(k,d);a.s.unregister=d=>{delete k[d];a.s.qc(d)};a.s.sc={getConfig:(d,f)=>{d=a.s.Yb(d)?k[d]:null;f(d)},loadComponent:(d,f,h)=>{var m=g(d);
b(d,m,f,h)},loadTemplate:(d,f,h)=>{d=g(d);if("string"===typeof f)h(a.a.Pa(f));else if(f instanceof Array)h(f);else if(f instanceof DocumentFragment)h([...f.childNodes]);else if(f.element)if(f=f.element,f instanceof HTMLElement)h(e(f));else if("string"===typeof f){var m=U.getElementById(f);m?h(e(m)):d("Cannot find element with ID "+f)}else d("Unknown element type: "+f);else d("Unknown template value: "+f)},loadViewModel:(d,f,h)=>c(g(d),f,h)};var n="createViewModel";a.l("components.register",a.s.register);
a.s.loaders.push(a.s.sc)})();(()=>{function b(g,k,n){k=k.template;if(!k)throw Error("Component '"+g+"' has no template");g=a.a.Fa(k);a.h.ya(n,g)}function c(g,k,n){var d=g.createViewModel;return d?d.call(g,k,n):k}var e=0;a.c.component={init:(g,k,n,d,f)=>{var h,m,r,p=()=>{var x=h&&h.dispose;"function"===typeof x&&x.call(h);r&&r.o();m=h=r=null},u=[...a.h.childNodes(g)];a.h.ua(g);a.a.L.qa(g,p);a.i(()=>{var x=a.a.g(k());if("string"===typeof x)var v=x;else{v=a.a.g(x.name);var l=a.a.g(x.params)}if(!v)throw Error("No component name specified");
var q=a.f.sb(g,f),t=m=++e;a.s.get(v,w=>{if(m===t){p();if(!w)throw Error("Unknown component '"+v+"'");b(v,w,g);var A=c(w,l,{element:g,templateNodes:u});w=q.createChildContext(A,{extend:y=>{y.$component=A;y.$componentTemplateNodes=u}});A&&A.koDescendantsComplete&&(r=a.f.subscribe(g,a.f.aa,A.koDescendantsComplete,A));h=A;a.Hb(w,g)}})},null,{j:g});return{controlsDescendantBindings:!0}}};a.h.ga.component=!0})();a.c.attr={update:(b,c)=>{c=a.a.g(c())||{};a.a.P(c,function(e,g){g=a.a.g(g);var k=e.indexOf(":");
k="lookupNamespaceURI"in b&&0<k&&b.lookupNamespaceURI(e.substr(0,k));var n=!1===g||null===g||void 0===g;n?k?b.removeAttributeNS(k,e):b.removeAttribute(e):g=g.toString();n||(k?b.setAttributeNS(k,e,g):b.setAttribute(e,g));"name"===e&&(b.name=n?"":g)})}};var aa=(b,c,e)=>{c&&c.split(/\s+/).forEach(g=>b.classList.toggle(g,e))};a.c.css={update:(b,c)=>{c=a.a.g(c());null!==c&&"object"==typeof c?a.a.P(c,(e,g)=>{g=a.a.g(g);aa(b,e,!!g)}):(c=a.a.tb(c),aa(b,b.__ko__cssValue,!1),b.__ko__cssValue=c,aa(b,c,!0))}};
a.c.enable={update:(b,c)=>{(c=a.a.g(c()))&&b.disabled?b.removeAttribute("disabled"):c||b.disabled||(b.disabled=!0)}};a.c.disable={update:(b,c)=>a.c.enable.update(b,()=>!a.a.g(c()))};a.c.event={init:(b,c,e,g,k)=>{var n=c()||{};a.a.P(n,d=>{"string"==typeof d&&a.a.J(b,d,function(f){var h=c()[d];if(h){try{g=k.$data;var m=h.apply(g,[g,...arguments])}finally{!0!==m&&f.preventDefault()}!1===e.get(d+"Bubble")&&(f.cancelBubble=!0,f.stopPropagation())}})})}};a.c.foreach={Zb:b=>()=>{var c=b(),e=a.M(c)?c.I():
c;if(!e||"number"==typeof e.length)return{foreach:c};a.a.g(c);return{foreach:e.data,as:e.as,noChildContext:e.noChildContext,includeDestroyed:e.includeDestroyed,afterAdd:e.afterAdd,beforeRemove:e.beforeRemove,afterRender:e.afterRender,beforeMove:e.beforeMove,afterMove:e.afterMove}},init:(b,c)=>a.c.template.init(b,a.c.foreach.Zb(c)),update:(b,c,e,g,k)=>a.c.template.update(b,a.c.foreach.Zb(c),e,g,k)};a.G.Ya.foreach=!1;a.h.ga.foreach=!0;a.c.hasfocus={init:(b,c,e)=>{var g=n=>{b.__ko_hasfocusUpdating=!0;
n=b.ownerDocument.activeElement===b;var d=c();a.G.xb(d,e,"hasfocus",n,!0);b.__ko_hasfocusLastValue=n;b.__ko_hasfocusUpdating=!1},k=g.bind(null,!0);g=g.bind(null,!1);a.a.J(b,"focus",k);a.a.J(b,"focusin",k);a.a.J(b,"blur",g);a.a.J(b,"focusout",g);b.__ko_hasfocusLastValue=!1},update:(b,c)=>{c=!!a.a.g(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===c||(c?b.focus():b.blur())}};a.G.Qa.hasfocus=!0;a.c.hasFocus=a.c.hasfocus;a.G.Qa.hasFocus="hasfocus";a.c.html={init:()=>({controlsDescendantBindings:!0}),
update:(b,c)=>a.a.ec(b,c())};(function(){function b(c,e,g){a.c[c]={init:(k,n,d,f,h)=>{var m,r,p={},u;if(e){f=d.get("as");var x=d.get("noChildContext");var v=!(f&&x);p={as:f,noChildContext:x,exportDependencies:v}}var l=(u="render"==d.get("completeOn"))||d.has(a.f.aa);a.i(()=>{var q=a.a.g(n()),t=!g!==!q,w=!r;if(v||t!==m){l&&(h=a.f.sb(k,h));if(t){if(!e||v)p.dataDependency=a.sa.i();var A=e?h.createChildContext("function"==typeof q?q:n,p):a.sa.Ja()?h.extend(null,p):h}w&&a.sa.Ja()&&(r=a.a.Fa(a.h.childNodes(k),
!0));t?(w||a.h.ya(k,a.a.Fa(r)),a.Hb(A,k)):(a.h.ua(k),u||a.f.notify(k,a.f.B));m=t}},null,{j:k});return{controlsDescendantBindings:!0}}};a.G.Ya[c]=!1;a.h.ga[c]=!0}b("if");b("ifnot",!1,!0);b("with",!0)})();var ba={};a.c.options={init:b=>{if(!b.matches("SELECT"))throw Error("options binding applies only to SELECT elements");for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:(b,c,e)=>{function g(){return Array.from(b.options).filter(v=>v.selected)}function k(v,l,q){var t=typeof l;
return"function"==t?l(v):"string"==t?v[l]:q}function n(v,l){u&&m?a.f.notify(b,a.f.B):r.length&&(v=r.includes(a.A.R(l[0])),l[0].selected=v,u&&!v&&a.m.H(a.a.hc,null,[b,"change"]))}var d=b.multiple,f=0!=b.length&&d?b.scrollTop:null,h=a.a.g(c()),m=e.get("valueAllowUnset")&&e.has("value");c={};var r=[];m||(d?r=g().map(a.A.R):0<=b.selectedIndex&&r.push(a.A.R(b.options[b.selectedIndex])));if(h){"undefined"==typeof h.length&&(h=[h]);var p=h.filter(v=>v||null==v);e.has("optionsCaption")&&(h=a.a.g(e.get("optionsCaption")),
null!==h&&void 0!==h&&p.unshift(ba))}var u=!1;c.beforeRemove=v=>b.removeChild(v);h=n;e.has("optionsAfterRender")&&"function"==typeof e.get("optionsAfterRender")&&(h=(v,l)=>{n(v,l);a.m.H(e.get("optionsAfterRender"),null,[l[0],v!==ba?v:void 0])});a.a.dc(b,p,function(v,l,q){q.length&&(r=!m&&q[0].selected?[a.A.R(q[0])]:[],u=!0);l=b.ownerDocument.createElement("option");v===ba?(a.a.rb(l,e.get("optionsCaption")),a.A.Ta(l,void 0)):(q=k(v,e.get("optionsValue"),v),a.A.Ta(l,a.a.g(q)),v=k(v,e.get("optionsText"),
q),a.a.rb(l,v));return[l]},c,h);if(!m){var x;d?x=r.length&&g().length<r.length:x=r.length&&0<=b.selectedIndex?a.A.R(b.options[b.selectedIndex])!==r[0]:r.length||0<=b.selectedIndex;x&&a.m.H(a.a.hc,null,[b,"change"])}(m||a.sa.jb())&&a.f.notify(b,a.f.B);f&&20<Math.abs(f-b.scrollTop)&&(b.scrollTop=f)}};a.c.options.ob=a.a.b.U();a.c.style={update:(b,c)=>{c=a.a.g(c()||{});a.a.P(c,(e,g)=>{g=a.a.g(g);if(null===g||void 0===g||!1===g)g="";if(/^--/.test(e))b.style.setProperty(e,g);else{e=e.replace(/-(\w)/g,(n,
d)=>d.toUpperCase());var k=b.style[e];b.style[e]=g;g===k||b.style[e]!=k||isNaN(g)||(b.style[e]=g+"px")}})}};a.c.submit={init:(b,c,e,g,k)=>{if("function"!=typeof c())throw Error("The value for a submit binding must be a function");a.a.J(b,"submit",n=>{var d=c();try{var f=d.call(k.$data,b)}finally{!0!==f&&(n.preventDefault?n.preventDefault():n.returnValue=!1)}})}};a.c.text={init:()=>({controlsDescendantBindings:!0}),update:(b,c)=>a.a.rb(b,c())};a.h.ga.text=!0;a.c.textInput={init:(b,c,e)=>{var g=b.value,
k,n,d=()=>{clearTimeout(k);n=k=void 0;var h=b.value;g!==h&&(g=h,a.G.xb(c(),e,"textInput",h))},f=()=>{var h=a.a.g(c());if(null===h||void 0===h)h="";void 0!==n&&h===n?a.a.setTimeout(f,4):b.value!==h&&(b.value=h,g=b.value)};a.a.J(b,"input",d);a.a.J(b,"change",d);a.a.J(b,"blur",d);a.i(f,null,{j:b})}};a.G.Qa.textInput=!0;a.c.textinput={preprocess:(b,c,e)=>e("textInput",b)};a.c.value={init:(b,c,e)=>{var g=b.matches("SELECT"),k=b.matches("INPUT");if(!k||"checkbox"!=b.type&&"radio"!=b.type){var n=[],d=e.get("valueUpdate"),
f=null;d&&("string"==typeof d?n=[d]:n=d?d.filter((p,u)=>d.indexOf(p)===u):[],a.a.Da(n,"change"));var h=()=>{f=null;var p=c(),u=a.A.R(b);a.G.xb(p,e,"value",u)};n.forEach(p=>{var u=h;a.a.Mc(p,"after")&&(u=()=>{f=a.A.R(b);a.a.setTimeout(h,0)},p=p.substring(5));a.a.J(b,p,u)});var m=k&&"file"==b.type?()=>{var p=a.a.g(c());null===p||void 0===p||""===p?b.value="":a.m.H(h)}:()=>{var p=a.a.g(c()),u=a.A.R(b);if(null!==f&&p===f)a.a.setTimeout(m,0);else if(p!==u||void 0===u)g?(u=e.get("valueAllowUnset"),a.A.Ta(b,
p,u),u||p===a.A.R(b)||a.m.H(h)):a.A.Ta(b,p)};if(g){var r;a.f.subscribe(b,a.f.B,()=>{r?e.get("valueAllowUnset")?m():h():(a.a.J(b,"change",h),r=a.i(m,null,{j:b}))},null,{notifyImmediately:!0})}else a.a.J(b,"change",h),a.i(m,null,{j:b})}else a.Wa(b,{checkedValue:c})},update:()=>{}};a.G.Qa.value=!0;a.c.visible={update:(b,c)=>{c=a.a.g(c());var e="none"!=b.style.display;c&&!e?b.style.display="":e&&!c&&(b.style.display="none")}};a.c.hidden={update:(b,c)=>b.hidden=!!a.a.g(c())};(function(b){a.c[b]={init:function(c,
e,g,k,n){return a.c.event.init.call(this,c,()=>({[b]:e()}),g,k,n)}}})("click");(()=>{a.D={};a.D.C=function(e){if(this.C=e)this.wb=e.matches("TEMPLATE")&&e.content&&11===e.content.nodeType?3:4};a.D.C.prototype.text=function(){if(0==arguments.length)return this.C.innerHTML;a.a.ec(this.C,arguments[0])};var b=a.a.b.U()+"_";a.D.C.prototype.data=function(e){if(1===arguments.length)return a.a.b.get(this.C,b+e);a.a.b.set(this.C,b+e,arguments[1])};var c=a.a.b.U();a.D.C.prototype.nodes=function(){var e=this.C;
if(0==arguments.length){var g=a.a.b.get(e,c)||{},k=g.Ga||(3===this.wb?e.content:4===this.wb?e:void 0);if(!k||g.mc){var n=this.text();n&&n!==g.za&&(k=a.a.Fc(n,e.ownerDocument),a.a.b.set(e,c,{Ga:k,za:n,mc:!0}))}return k}g=arguments[0];void 0!==this.wb&&this.text("");a.a.b.set(e,c,{Ga:g})};a.D.Z=function(e){this.C=e};a.D.Z.prototype=new a.D.C;a.D.Z.prototype.constructor=a.D.Z;a.D.Z.prototype.text=function(){if(0==arguments.length){var e=a.a.b.get(this.C,c)||{};void 0===e.za&&e.Ga&&(e.za=e.Ga.innerHTML);
return e.za}a.a.b.set(this.C,c,{za:arguments[0]})}})();(()=>{function b(d,f){if(d.length){var h=d[0],m=d[d.length-1],r=h.parentNode,p=a.$.instance,u=p.preprocessNode;if(u){g(h,m,(x,v)=>{var l=x.previousSibling,q=u.call(p,x);q&&(x===h&&(h=q[0]||v),x===m&&(m=q[q.length-1]||l))});d.length=0;if(!h)return;h===m?d.push(h):(d.push(h,m),a.a.va(d,r))}g(h,m,x=>{1!==x.nodeType&&8!==x.nodeType||a.Gb(f,x)});a.a.va(d,r)}}function c(d,f,h,m,r){r=r||{};var p=(d&&(d.nodeType?d:0<d.length?d[0]:null)||h||{}).ownerDocument;
var u=p;if("string"==typeof h){u=u||U;u=u.getElementById(h);if(!u)throw Error("Cannot find template with ID "+h);h=new a.D.C(u)}else if([1,8].includes(h.nodeType))h=new a.D.Z(h);else throw Error("Unknown template type: "+h);p=(u=h.Ec?h.Ec():null)?[...u.cloneNode(!0).childNodes]:a.a.Pa(h.text(),p);if("number"!=typeof p.length||0<p.length&&"number"!=typeof p[0].nodeType)throw Error("Template engine must return an array of DOM nodes");h=!1;switch(f){case "replaceChildren":a.h.ya(d,p);h=!0;break;case "ignoreTargetNode":break;
default:throw Error("Unknown renderMode: "+f);}h&&(b(p,m),r.afterRender&&a.m.H(r.afterRender,null,[p,m[r.as||"$data"]]),"replaceChildren"==f&&a.f.notify(d,a.f.B));return p}function e(d,f,h){return a.M(d)?d():"function"===typeof d?d(f,h):d}var g=(d,f,h)=>{var m;for(f=a.h.nextSibling(f);d&&(m=d)!==f;)d=a.h.nextSibling(m),h(m,d)};a.Jc=function(d,f,h,m){h=h||{};var r=r||"replaceChildren";if(m){var p=m.nodeType?m:0<m.length?m[0]:null;return a.i(()=>{var u=f&&f instanceof a.S?f:new a.S(f,null,null,null,
{exportDependencies:!0}),x=e(d,u.$data,u);c(m,r,x,u,h)},null,{ta:()=>!p||!a.a.cb(p),j:p})}console.log("no targetNodeOrNodeArray")};a.Kc=(d,f,h,m,r)=>{function p(w,A){a.m.H(a.a.dc,null,[m,w,v,h,l,A]);a.f.notify(m,a.f.B)}var u,x=h.as,v=(w,A)=>{u=r.createChildContext(w,{as:x,noChildContext:h.noChildContext,extend:y=>{y.$index=A;x&&(y[x+"Index"]=A)}});w=e(d,w,u);return c(m,"ignoreTargetNode",w,u,h)},l=(w,A)=>{b(A,u);h.afterRender&&h.afterRender(A,w);u=null},q=!1===h.includeDestroyed;if(q||h.beforeRemove||
!a.Xb(f))return a.i(()=>{var w=a.a.g(f)||[];"undefined"==typeof w.length&&(w=[w]);q&&(w=w.filter(A=>A||null==A));p(w)},null,{j:m});p(f.I());var t=f.subscribe(w=>{p(f(),w)},null,"arrayChange");t.j(m);return t};var k=a.a.b.U(),n=a.a.b.U();a.c.template={init:(d,f)=>{f=a.a.g(f());if("string"==typeof f||"name"in f)a.h.ua(d);else if("nodes"in f){f=f.nodes||[];if(a.M(f))throw Error('The "nodes" option must be a plain, non-observable array.');let h=f[0]&&f[0].parentNode;h&&a.a.b.get(h,n)||(h=a.a.lb(f),a.a.b.set(h,
n,!0));(new a.D.Z(d)).nodes(h)}else if(f=a.h.childNodes(d),0<f.length)f=a.a.lb(f),(new a.D.Z(d)).nodes(f);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:(d,f,h,m,r)=>{var p=f();f=a.a.g(p);h=!0;m=null;"string"==typeof f?f={}:(p="name"in f?f.name:d,"if"in f&&(h=a.a.g(f["if"])),h&&"ifnot"in f&&(h=!a.a.g(f.ifnot)),h&&!p&&(h=!1));"foreach"in f?m=a.Kc(p,h&&f.foreach||[],f,d,r):h?(h=r,"data"in f&&(h=r.createChildContext(f.data,
{as:f.as,noChildContext:f.noChildContext,exportDependencies:!0})),m=a.Jc(p,h,f,d)):a.h.ua(d);r=m;(f=a.a.b.get(d,k))&&"function"==typeof f.o&&f.o();a.a.b.set(d,k,!r||r.ka&&!r.ka()?void 0:r)}};a.G.Ya.template=d=>{d=a.G.Gc(d);return 1==d.length&&d[0].unknown||a.G.Dc(d,"name")?null:"This template engine does not support anonymous templates nested within its templates"};a.h.ga.template=!0})();a.a.Tb=(b,c,e)=>{if(b.length&&c.length){var g,k,n,d,f;for(g=k=0;(!e||g<e)&&(d=b[k]);++k){for(n=0;f=c[n];++n)if(d.value===
f.value){d.moved=f.index;f.moved=d.index;c.splice(n,1);g=n=0;break}g+=n}}};a.a.Nb=(()=>{function b(c,e,g,k,n){var d=Math.min,f=Math.max,h=[],m,r=c.length,p,u=e.length,x=u-r||1,v=r+u+1,l;for(m=0;m<=r;m++){var q=l;h.push(l=[]);var t=d(u,m+x);for(p=f(0,m-1);p<=t;p++)l[p]=p?m?c[m-1]===e[p-1]?q[p-1]:d(q[p]||v,l[p-1]||v)+1:p+1:m+1}d=[];f=[];x=[];m=r;for(p=u;m||p;)u=h[m][p]-1,p&&u===h[m][p-1]?f.push(d[d.length]={status:g,value:e[--p],index:p}):m&&u===h[m-1][p]?x.push(d[d.length]={status:k,value:c[--m],index:m}):
(--p,--m,n.sparse||d.push({status:"retained",value:e[p]}));a.a.Tb(x,f,!n.dontLimitMoves&&10*r);return d.reverse()}return function(c,e,g){g="boolean"===typeof g?{dontLimitMoves:g}:g||{};c=c||[];e=e||[];return c.length<e.length?b(c,e,"added","deleted",g):b(e,c,"deleted","added",g)}})();(()=>{function b(g,k,n,d,f){var h=[],m=a.i(()=>{var r=k(n,f,a.a.va(h,g))||[];if(0<h.length){var p=h.nodeType?[h]:h;if(0<p.length){var u=p[0],x=u.parentNode,v;var l=0;for(v=r.length;l<v;l++)x.insertBefore(r[l],u);l=0;
for(v=p.length;l<v;l++)a.removeNode(p[l])}d&&a.m.H(d,null,[n,r,f])}h.length=0;h.push(...r)},null,{j:g,ta:()=>!!h.find(a.a.cb)});return{O:h,$a:m.ka()?m:void 0}}var c=a.a.b.U(),e=a.a.b.U();a.a.dc=(g,k,n,d,f,h)=>{function m(H){z={ha:H,La:a.ea(q++)};v.push(z);x||E.push(z)}function r(H){z=u[H];q!==z.La.I()&&y.push(z);z.La(q++);a.a.va(z.O,g);v.push(z)}function p(H,L){if(H)for(var B=0,N=L.length;B<N;B++)L[B].O.forEach(Y=>H(Y,B,L[B].ha))}k=k||[];"undefined"==typeof k.length&&(k=[k]);d=d||{};var u=a.a.b.get(g,
c),x=!u,v=[],l=0,q=0,t=[],w=[],A=[],y=[],E=[],J=0;if(x)k.forEach(m);else{if(!h||u&&u._countWaitingForRemove)h=Array.prototype.map.call(u,H=>H.ha),h=a.a.Nb(h,k,{dontLimitMoves:d.dontLimitMoves,sparse:!0});for(let H=0,L,B,N;L=h[H];H++)switch(B=L.moved,N=L.index,L.status){case "deleted":for(;l<N;)r(l++);if(void 0===B){var z=u[l];z.$a&&(z.$a.o(),z.$a=void 0);a.a.va(z.O,g).length&&(d.beforeRemove&&(v.push(z),J++,z.ha===e?z=null:A.push(z)),z&&t.push.apply(t,z.O))}l++;break;case "added":for(;q<N;)r(l++);
void 0!==B?(w.push(v.length),r(B)):m(L.value)}for(;q<k.length;)r(l++);v._countWaitingForRemove=J}a.a.b.set(g,c,v);p(d.beforeMove,y);t.forEach(d.beforeRemove?a.ia:a.removeNode);var K,M;J=g.ownerDocument.activeElement;if(w.length)for(;void 0!=(k=w.shift());){z=v[k];for(K=void 0;k;)if((M=v[--k].O)&&M.length){K=M[M.length-1];break}for(l=0;t=z.O[l];K=t,l++)a.h.Wb(g,t,K)}for(k=0;z=v[k];k++){z.O||a.a.extend(z,b(g,n,z.ha,f,z.La));for(l=0;t=z.O[l];K=t,l++)a.h.Wb(g,t,K);!z.zc&&f&&(f(z.ha,z.O,z.La),z.zc=!0,
K=z.O[z.O.length-1])}J&&g.ownerDocument.activeElement!=J&&J.focus();p(d.beforeRemove,A);for(k=0;k<A.length;++k)A[k].ha=e;p(d.afterMove,y);p(d.afterAdd,E)}})();C.ko=Z})(this);
(C=>{function F(a,c){return null===a||typeof a in da?a===c:!1}function E(a,c){var e;return()=>{e||(e=b.a.setTimeout(()=>{e=void 0;a()},c))}}function J(a,c){var e;return()=>{clearTimeout(e);e=b.a.setTimeout(a,c)}}function S(a,c){null!==c&&c.o&&c.o()}function V(a,c){var e=this.lc,g=e[D];g.$||(this.Wa&&this.Aa[c]?(e.zb(c,a,this.Aa[c]),this.Aa[c]=null,--this.Wa):g.u[c]||e.zb(c,a,g.v?{V:a}:e.bc(a)),a.ja&&a.fc())}var T=C.document,W={},b="undefined"!==typeof W?W:{};b.l=(a,c)=>{a=a.split(".");for(var e=b,
g=0;g<a.length-1;g++)e=e[a[g]];e[a[a.length-1]]=c};b.Z=(a,c,e)=>{a[c]=e};b.version="3.5.1-sm";b.l("version",b.version);b.a={xa:(a,c)=>{c=a.indexOf(c);0<c?a.splice(c,1):0===c&&a.shift()},extend:(a,c)=>{c&&Object.entries(c).forEach(e=>a[e[0]]=e[1]);return a},N:(a,c)=>a&&Object.entries(a).forEach(e=>c(e[0],e[1])),ib:(a,c,e)=>{if(!a)return a;var g={};Object.entries(a).forEach(l=>g[l[0]]=c.call(e,l[1],l[0],a));return g},$a:a=>{for(;a.firstChild;)b.removeNode(a.firstChild)},Vb:a=>{var c=[...a],e=(c[0]&&
c[0].ownerDocument||T).createElement("div");a.forEach(g=>e.append(b.ea(g)));return e},za:(a,c)=>Array.prototype.map.call(a,c?e=>b.ea(e.cloneNode(!0)):e=>e.cloneNode(!0)),ta:(a,c)=>{b.a.$a(a);c&&a.append(...c)},Ca:(a,c)=>{if(a.length){for(c=8===c.nodeType&&c.parentNode||c;a.length&&a[0].parentNode!==c;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==c;)a.length--;if(1<a.length){c=a[0];var e=a[a.length-1];for(a.length=0;c!==e;)a.push(c),c=c.nextSibling;a.push(e)}}return a},ac:a=>null==a?"":
a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,""),Gc:(a,c)=>{a=a||"";return c.length>a.length?!1:a.substring(0,c.length)===c},oc:(a,c)=>c.contains(1!==a.nodeType?a.parentNode:a),Za:a=>b.a.oc(a,a.ownerDocument.documentElement),Hb:a=>b.onError?function(){try{return a.apply(this,arguments)}catch(c){throw b.onError&&b.onError(c),c;}}:a,setTimeout:(a,c)=>setTimeout(b.a.Hb(a),c),Lb:a=>setTimeout(()=>{b.onError&&b.onError(a);throw a;},0),H:(a,c,e)=>{a.addEventListener(c,b.a.Hb(e),!1)},cc:(a,
c)=>{if(!a||!a.nodeType)throw Error("element must be a DOM node when calling triggerEvent");a.dispatchEvent(new Event(c))},g:a=>b.K(a)?a():a,mb:(a,c)=>a.textContent=b.a.g(c)||""};b.l("utils",b.a);b.l("unwrap",b.a.g);b.a.f=new function(){let a=0,c="__ko__"+Date.now(),e=new WeakMap;return{get:(g,l)=>(e.get(g)||{})[l],set:(g,l,q)=>{if(e.has(g))e.get(g)[l]=q;else{let d={};d[l]=q;e.set(g,d)}return q},cb:function(g,l,q){return this.get(g,l)||this.set(g,l,q)},clear:g=>e.delete(g),X:()=>a++ +c}};b.a.J=new function(){function a(d,
f){var h=b.a.f.get(d,g);void 0===h&&f&&(h=[],b.a.f.set(d,g,h));return h}function c(d){var f=a(d,!1);if(f){f=f.slice(0);for(var h=0;h<f.length;h++)f[h](d)}b.a.f.clear(d);q[d.nodeType]&&e(d.childNodes,!0)}function e(d,f){for(var h=[],n,p=0;p<d.length;p++)if(!f||8===d[p].nodeType)if(c(h[h.length]=n=d[p]),d[p]!==n)for(;p--&&!h.includes(d[p]););}var g=b.a.f.X(),l={1:!0,8:!0,9:!0},q={1:!0,9:!0};return{ma:(d,f)=>{if("function"!=typeof f)throw Error("Callback must be a function");a(d,!0).push(f)},lb:(d,f)=>
{var h=a(d,!1);h&&(b.a.xa(h,f),0==h.length&&b.a.f.set(d,g,void 0))},ea:d=>{b.m.D(()=>{l[d.nodeType]&&(c(d),q[d.nodeType]&&e(d.getElementsByTagName("*")))});return d},removeNode:d=>{b.ea(d);d.parentNode&&d.parentNode.removeChild(d)}}};b.ea=b.a.J.ea;b.removeNode=b.a.J.removeNode;b.l("utils.domNodeDisposal",b.a.J);b.l("utils.domNodeDisposal.addDisposeCallback",b.a.J.ma);b.pb=(()=>{function a(){if(e)for(var d=e,f=0,h;l<e;)if(h=c[l++]){if(l>d){if(5E3<=++f){l=e;b.a.Lb(Error("'Too much recursion' after processing "+
f+" task groups."));break}d=e}try{h()}catch(n){b.a.Lb(n)}}l=e=c.length=0}var c=[],e=0,g=1,l=0,q=(d=>{var f=T.createElement("div");(new MutationObserver(d)).observe(f,{attributes:!0});return()=>f.classList.toggle("foo")})(a);return{Zb:d=>{e||q(a);c[e++]=d;return g++},cancel:d=>{d-=g-e;d>=l&&d<e&&(c[d]=null)}}})();b.l("tasks",b.pb);b.ab={throttle:(a,c)=>{a.throttleEvaluation=c;var e=null;return b.i({read:a,write:g=>{clearTimeout(e);e=b.a.setTimeout(()=>a(g),c)}})},rateLimit:(a,c)=>{if("number"==typeof c)var e=
c;else{e=c.timeout;var g=c.method}var l="function"==typeof g?g:"notifyWhenChangesStop"==g?J:E;a.gb(q=>l(q,e,c))},notify:(a,c)=>{a.equalityComparer="always"==c?null:F}};var da={undefined:1,"boolean":1,number:1,string:1};b.l("extenders",b.ab);class ea{constructor(a,c,e){this.V=a;this.sb=c;this.Fb=e;this.Oa=!1;this.P=this.Sa=null;b.Z(this,"dispose",this.o);b.Z(this,"disposeWhenNodeIsRemoved",this.j)}o(){this.Oa||(this.P&&b.a.J.lb(this.Sa,this.P),this.Oa=!0,this.Fb(),this.V=this.sb=this.Fb=this.Sa=this.P=
null)}j(a){this.Sa=a;b.a.J.ma(a,this.P=this.o.bind(this))}}b.T=function(){Object.setPrototypeOf(this,P);P.Ga(this)};var P={Ga:a=>{a.U={change:[]};a.yb=1},subscribe:function(a,c,e){var g=this;e=e||"change";var l=new ea(g,c?a.bind(c):a,()=>{b.a.xa(g.U[e],l);g.wa&&g.wa(e)});g.na&&g.na(e);g.U[e]||(g.U[e]=[]);g.U[e].push(l);return l},notifySubscribers:function(a,c){c=c||"change";"change"===c&&this.La();if(this.ra(c)){c="change"===c&&this.dc||this.U[c].slice(0);try{b.m.Cb();for(var e=0,g;g=c[e++];)g.Oa||
g.sb(a)}finally{b.m.end()}}},Ea:function(){return this.yb},tc:function(a){return this.Ea()!==a},La:function(){++this.yb},gb:function(a){var c=this,e=b.K(c),g,l,q,d,f;c.va||(c.va=c.notifySubscribers,c.notifySubscribers=function(n,p){p&&"change"!==p?"beforeChange"===p?this.vb(n):this.va(n,p):this.wb(n)});var h=a(()=>{c.ja=!1;e&&d===c&&(d=c.tb?c.tb():c());var n=l||f&&c.Ia(q,d);f=l=g=!1;n&&c.va(q=d)});c.wb=(n,p)=>{p&&c.ja||(f=!p);c.dc=c.U.change.slice(0);c.ja=g=!0;d=n;h()};c.vb=n=>{g||(q=n,c.va(n,"beforeChange"))};
c.xb=()=>{f=!0};c.fc=()=>{c.Ia(q,c.F(!0))&&(l=!0)}},ra:function(a){return this.U[a]&&this.U[a].length},Ia:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},toString:()=>"[object Object]",extend:function(a){var c=this;a&&b.a.N(a,(e,g)=>{e=b.ab[e];"function"==typeof e&&(c=e(c,g)||c)});return c}};b.Z(P,"init",P.Ga);b.Z(P,"subscribe",P.subscribe);b.Z(P,"extend",P.extend);Object.setPrototypeOf(P,Function.prototype);b.T.fn=P;b.vc=a=>null!=a&&"function"==typeof a.subscribe&&"function"==
typeof a.notifySubscribers;b.oa=b.m=(()=>{var a=[],c,e=0;return{Cb:g=>{a.push(c);c=g},end:()=>c=a.pop(),Yb:g=>{if(c){if(!b.vc(g))throw Error("Only subscribable things can act as dependencies");c.ic.call(c.jc,g,g.ec||(g.ec=++e))}},D:(g,l,q)=>{try{return a.push(c),c=void 0,g.apply(l,q||[])}finally{c=a.pop()}},Da:()=>c&&c.i.Da(),bb:()=>c&&c.i.bb(),fb:()=>c&&c.fb,i:()=>c&&c.i}})();const O=Symbol("_latestValue");b.ba=a=>{function c(){if(0<arguments.length)return c.Ia(c[O],arguments[0])&&(c.Ma(),c[O]=arguments[0],
c.ua()),this;b.m.Yb(c);return c[O]}c[O]=a;Object.defineProperty(c,"length",{get:()=>null==c[O]?void 0:c[O].length});b.T.fn.Ga(c);Object.setPrototypeOf(c,Q);return c};var Q={toJSON:function(){let a=this[O];return a&&a.toJSON?a.toJSON():a},equalityComparer:F,F:function(){return this[O]},ua:function(){this.notifySubscribers(this[O],"spectate");this.notifySubscribers(this[O])},Ma:function(){this.notifySubscribers(this[O],"beforeChange")}};Object.setPrototypeOf(Q,b.T.fn);var R=b.ba.P="__ko_proto__";Q[R]=
b.ba;b.K=a=>{if((a="function"==typeof a&&a[R])&&a!==Q[R]&&a!==b.i.fn[R])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!a};b.xc=a=>"function"==typeof a&&(a[R]===Q[R]||a[R]===b.i.fn[R]&&a.Qb);b.l("observable",b.ba);b.l("isObservable",b.K);b.l("observable.fn",Q);b.Z(Q,"valueHasMutated",Q.ua);b.ha=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.ba(a);Object.setPrototypeOf(a,b.ha.fn);return a.extend({trackArrayChanges:!0})};b.ha.fn={remove:function(a){for(var c=this.F(),e=[],g="function"!=typeof a||b.K(a)?function(d){return d===a}:a,l=c.length;l--;){var q=c[l];if(g(q)){0===e.length&&this.Ma();if(c[l]!==q)throw Error("Array modified during remove; cannot remove item");e.push(q);c.splice(l,1)}}e.length&&this.ua();return e},removeAll:function(a){if(void 0===a){var c=this.F(),e=c.slice(0);this.Ma();c.splice(0,c.length);this.ua();return e}return a?
this.remove(g=>a.includes(g)):[]}};Object.setPrototypeOf(b.ha.fn,b.ba.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.ha.fn[a]=function(...c){var e=this.F();this.Ma();this.Gb(e,a,c);c=e[a](...c);this.ua();return c===e?this:c}:b.ha.fn[a]=function(...c){return this()[a](...c)})});b.Sb=a=>b.K(a)&&"function"==typeof a.remove&&"function"==typeof a.push;
b.l("observableArray",b.ha);b.l("isObservableArray",b.Sb);b.ab.trackArrayChanges=(a,c)=>{function e(){function r(){if(f){var u=[].concat(a.F()||[]);if(a.ra("arrayChange")){if(!l||1<f)l=b.a.Ib(h,u,a.Ua);var x=l}h=u;l=null;f=0;x&&x.length&&a.notifySubscribers(x,"arrayChange")}}g?r():(g=!0,d=a.subscribe(()=>++f,null,"spectate"),h=[].concat(a.F()||[]),l=null,q=a.subscribe(r))}a.Ua={};c&&"object"==typeof c&&b.a.extend(a.Ua,c);a.Ua.sparse=!0;if(!a.Gb){var g=!1,l=null,q,d,f=0,h,n=a.na,p=a.wa;a.na=r=>{n&&
n.call(a,r);"arrayChange"===r&&e()};a.wa=r=>{p&&p.call(a,r);"arrayChange"!==r||a.ra("arrayChange")||(q&&q.o(),d&&d.o(),d=q=null,g=!1,h=void 0)};a.Gb=(r,u,x)=>{function k(G,z,M){return m[m.length]={status:G,value:z,index:M}}if(g&&!f){var m=[],t=r.length,v=x.length,y=0;switch(u){case "push":y=t;case "unshift":for(u=0;u<v;u++)k("added",x[u],y+u);break;case "pop":y=t-1;case "shift":t&&k("deleted",r[y],y);break;case "splice":u=Math.min(Math.max(0,0>x[0]?t+x[0]:x[0]),t);t=1===v?t:Math.min(u+(x[1]||0),t);
v=u+v-2;y=Math.max(t,v);for(var w=[],A=[],I=2;u<y;++u,++I)u<t&&A.push(k("deleted",r[u],u)),u<v&&w.push(k("added",x[I],u));b.a.Ob(A,w);break;default:return}l=m}}}};var D=Symbol("_state");b.i=function(a,c,e){function g(){if(0<arguments.length){if("function"===typeof l)l.apply(q.Ba,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}q.$||b.m.Yb(g);(q.W||q.v&&g.sa())&&g.S();
return q.L}"object"===typeof a?e=a:(e=e||{},a&&(e.read=a));if("function"!=typeof e.read)throw Error("Pass a function that returns the value of the ko.computed");var l=e.write,q={L:void 0,aa:!0,W:!0,Ha:!1,ob:!1,$:!1,kb:!1,v:!1,Xb:e.read,Ba:c||e.owner,j:e.disposeWhenNodeIsRemoved||e.j||null,pa:e.disposeWhen||e.pa,Ya:null,u:{},I:0,Nb:null};g[D]=q;g.Qb="function"===typeof l;b.T.fn.Ga(g);Object.setPrototypeOf(g,U);e.pure?(q.kb=!0,q.v=!0,b.a.extend(g,fa)):e.deferEvaluation&&b.a.extend(g,ha);q.j&&(q.ob=
!0,q.j.nodeType||(q.j=null));q.v||e.deferEvaluation||g.S();q.j&&g.ga()&&b.a.J.ma(q.j,q.Ya=function(){g.o()});return g};var U={equalityComparer:F,Da:function(){return this[D].I},bb:function(){var a=[];b.a.N(this[D].u,(c,e)=>a[e.ka]=e.V);return a},eb:function(a){if(!this[D].I)return!1;var c=this.bb();return c.includes(a)?!0:!!c.find(e=>e.eb&&e.eb(a))},zb:function(a,c,e){if(this[D].kb&&c===this)throw Error("A 'pure' computed must not be called recursively");this[D].u[a]=e;e.ka=this[D].I++;e.la=c.Ea()},
sa:function(){var a,c=this[D].u;for(a in c)if(Object.prototype.hasOwnProperty.call(c,a)){var e=c[a];if(this.ia&&e.V.ja||e.V.tc(e.la))return!0}},Jc:function(){this.ia&&!this[D].Ha&&this.ia(!1)},ga:function(){var a=this[D];return a.W||0<a.I},Kc:function(){this.ja?this[D].W&&(this[D].aa=!0):this.Mb()},bc:function(a){return a.subscribe(this.Mb,this)},Mb:function(){var a=this,c=a.throttleEvaluation;c&&0<=c?(clearTimeout(this[D].Nb),this[D].Nb=b.a.setTimeout(()=>a.S(!0),c)):a.ia?a.ia(!0):a.S(!0)},S:function(a){var c=
this[D],e=c.pa,g=!1;if(!c.Ha&&!c.$){if(c.j&&!b.a.Za(c.j)||e&&e()){if(!c.ob){this.o();return}}else c.ob=!1;c.Ha=!0;try{g=this.qc(a)}finally{c.Ha=!1}return g}},qc:function(a){var c=this[D],e=c.kb?void 0:!c.I;var g={lc:this,Aa:c.u,Wa:c.I};b.m.Cb({jc:g,ic:V,i:this,fb:e});c.u={};c.I=0;var l=this.pc(c,g);c.I?g=this.Ia(c.L,l):(this.o(),g=!0);g&&(c.v?this.La():this.notifySubscribers(c.L,"beforeChange"),c.L=l,this.notifySubscribers(c.L,"spectate"),!c.v&&a&&this.notifySubscribers(c.L),this.xb&&this.xb());e&&
this.notifySubscribers(c.L,"awake");return g},pc:(a,c)=>{try{var e=a.Xb;return a.Ba?e.call(a.Ba):e()}finally{b.m.end(),c.Wa&&!a.v&&b.a.N(c.Aa,S),a.aa=a.W=!1}},F:function(a){var c=this[D];(c.W&&(a||!c.I)||c.v&&this.sa())&&this.S();return c.L},gb:function(a){b.T.fn.gb.call(this,a);this.tb=function(){this[D].v||(this[D].aa?this.S():this[D].W=!1);return this[D].L};this.ia=function(c){this.vb(this[D].L);this[D].W=!0;c&&(this[D].aa=!0);this.wb(this,!c)}},o:function(){var a=this[D];!a.v&&a.u&&b.a.N(a.u,
(c,e)=>e.o&&e.o());a.j&&a.Ya&&b.a.J.lb(a.j,a.Ya);a.u=void 0;a.I=0;a.$=!0;a.aa=!1;a.W=!1;a.v=!1;a.j=void 0;a.pa=void 0;a.Xb=void 0;this.Qb||(a.Ba=void 0)}},fa={na:function(a){var c=this,e=c[D];if(!e.$&&e.v&&"change"==a){e.v=!1;if(e.aa||c.sa())e.u=null,e.I=0,c.S()&&c.La();else{var g=[];b.a.N(e.u,(l,q)=>g[q.ka]=l);g.forEach((l,q)=>{var d=e.u[l],f=c.bc(d.V);f.ka=q;f.la=d.la;e.u[l]=f});c.sa()&&c.S()&&c.La()}e.$||c.notifySubscribers(e.L,"awake")}},wa:function(a){var c=this[D];c.$||"change"!=a||this.ra("change")||
(b.a.N(c.u,(e,g)=>{g.o&&(c.u[e]={V:g.V,ka:g.ka,la:g.la},g.o())}),c.v=!0,this.notifySubscribers(void 0,"asleep"))},Ea:function(){var a=this[D];a.v&&(a.aa||this.sa())&&this.S();return b.T.fn.Ea.call(this)}},ha={na:function(a){"change"!=a&&"beforeChange"!=a||this.F()}};Object.setPrototypeOf(U,b.T.fn);U[b.ba.P]=b.i;b.l("computed",b.i);b.l("computed.fn",U);b.Z(U,"dispose",U.o);b.Cc=a=>{if("function"===typeof a)return b.i(a,void 0,{pure:!0});a=b.a.extend({},a);a.pure=!0;return b.i(a,void 0)};(()=>{b.A=
{O:a=>{switch(a.nodeName){case "OPTION":return!0===a.__ko__hasDomDataOptionValue__?b.a.f.get(a,b.b.options.jb):a.value;case "SELECT":return 0<=a.selectedIndex?b.A.O(a.options[a.selectedIndex]):void 0;default:return a.value}},Na:(a,c,e)=>{switch(a.nodeName){case "OPTION":"string"===typeof c?(b.a.f.set(a,b.b.options.jb,void 0),delete a.__ko__hasDomDataOptionValue__,a.value=c):(b.a.f.set(a,b.b.options.jb,c),a.__ko__hasDomDataOptionValue__=!0,a.value="number"===typeof c?c:"");break;case "SELECT":for(var g=
-1,l=""===c||null==c,q=0,d=a.options.length,f;q<d;++q)if(f=b.A.O(a.options[q]),f==c||""===f&&l){g=q;break}if(e||0<=g||l&&1<a.size)a.selectedIndex=g;break;default:a.value=null==c?"":c}}}})();b.G=(()=>{function a(f){f=b.a.ac(f);123===f.charCodeAt(0)&&(f=f.slice(1,-1));f+="\n,";var h=[],n=f.match(g),p=[],r=0;if(1<n.length){for(var u=0,x;x=n[u];++u){var k=x.charCodeAt(0);if(44===k){if(0>=r){h.push(m&&p.length?{key:m,value:p.join("")}:{unknown:m||p.join("")});var m=r=0;p=[];continue}}else if(58===k){if(!r&&
!m&&1===p.length){m=p.pop();continue}}else if(47===k&&1<x.length&&(47===x.charCodeAt(1)||42===x.charCodeAt(1)))continue;else 47===k&&u&&1<x.length?(k=n[u-1].match(l))&&!q[k[0]]&&(f=f.substr(f.indexOf(x)+1),n=f.match(g),u=-1,x="/"):40===k||123===k||91===k?++r:41===k||125===k||93===k?--r:m||p.length||34!==k&&39!==k||(x=x.slice(1,-1));p.push(x)}if(0<r)throw Error("Unbalanced parentheses, braces, or brackets");}return h}var c=["true","false","null","undefined"],e=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,
g=/"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|`(?:\\.|[^`])*`|\/\*(?:[^*]|\*+[^*/])*\*+\/|\/\/.*\n|\/(?:\\.|[^/])+\/w*|[^\s:,/][^,"'`{}()/:[\]]*[^\s,"'`{}()/:[\]]|[^\s]/g,l=/[\])"'A-Za-z0-9_$]+$/,q={"in":1,"return":1,"typeof":1},d={};return{Ta:[],qb:d,Ac:a,Bc:function(f,h){function n(k,m){if(!x){var t=b.getBindingHandler(k);if(t&&t.preprocess&&!(m=t.preprocess(m,k,n)))return;if(t=d[k]){var v=m;c.includes(v)?v=!1:(t=v.match(e),v=null===t?!1:t[1]?"Object("+t[1]+")"+t[2]:v);t=v}t&&r.push("'"+("string"==typeof d[k]?
d[k]:k)+"':function(_z){"+v+"=_z}")}u&&(m="function(){return "+m+" }");p.push("'"+k+"':"+m)}h=h||{};var p=[],r=[],u=h.valueAccessors,x=h.bindingParams;("string"===typeof f?a(f):f).forEach(k=>n(k.key||k.unknown,k.value));r.length&&n("_ko_property_writers","{"+r.join(",")+" }");return p.join(",")},yc:(f,h)=>-1<f.findIndex(n=>n.key==h),rb:(f,h,n,p,r)=>{if(f&&b.K(f))!b.xc(f)||r&&f.F()===p||f(p);else if((f=h.get("_ko_property_writers"))&&f[n])f[n](p)}}})();(()=>{function a(d){return 8==d.nodeType&&g.test(d.nodeValue)}
function c(d){return 8==d.nodeType&&l.test(d.nodeValue)}function e(d,f){for(var h=d,n=1,p=[];h=h.nextSibling;){if(c(h)&&(b.a.f.set(h,q,!0),n--,0===n))return p;p.push(h);a(h)&&n++}if(!f)throw Error("Cannot find closing comment tag to match: "+d.nodeValue);return null}var g=/^\s*ko(?:\s+([\s\S]+))?\s*$/,l=/^\s*\/ko\s*$/,q="__ko_matchedEndComment__";b.h={ca:{},childNodes:d=>a(d)?e(d):d.childNodes,qa:d=>{if(a(d)){d=e(d);for(var f=0,h=d.length;f<h;f++)b.removeNode(d[f])}else b.a.$a(d)},ta:(d,f)=>{if(a(d)){b.h.qa(d);
d=d.nextSibling;for(var h=0,n=f.length;h<n;h++)d.parentNode.insertBefore(f[h],d)}else b.a.ta(d,f)},prepend:(d,f)=>{if(a(d)){var h=d.nextSibling;d=d.parentNode}else h=d.firstChild;d.insertBefore(f,h)},Rb:(d,f,h)=>{h?(h=h.nextSibling,a(d)&&(d=d.parentNode),d.insertBefore(f,h)):b.h.prepend(d,f)},firstChild:d=>{if(a(d))return!d.nextSibling||c(d.nextSibling)?null:d.nextSibling;if(d.firstChild&&c(d.firstChild))throw Error("Found invalid end comment, as the first child of "+d);return d.firstChild},nextSibling:d=>
{if(a(d)){var f=e(d,void 0);d=f?0<f.length?f[f.length-1].nextSibling:d.nextSibling:null}if(d.nextSibling&&c(d.nextSibling)){f=d.nextSibling;if(c(f)&&!b.a.f.get(f,q))throw Error("Found end comment without a matching opening comment, as child of "+d);return null}return d.nextSibling},sc:a,Hc:d=>(d=d.nodeValue.match(g))?d[1]:null}})();(()=>{const a={};b.Eb=new class{zc(c){switch(c.nodeType){case 1:return null!=c.getAttribute("data-bind");case 8:return b.h.sc(c);default:return!1}}rc(c,e){a:{switch(c.nodeType){case 1:var g=
c.getAttribute("data-bind");break a;case 8:g=b.h.Hc(c);break a}g=null}if(g){var l={valueAccessors:!0};try{var q=g+(l&&l.valueAccessors||""),d;if(!(d=a[q])){var f="with($context){with($data||{}){return{"+b.G.Bc(g,l)+"}}}";var h=new Function("$context","$element",f);d=a[q]=h}var n=d(e,c)}catch(p){throw p.message="Unable to parse bindings.\nBindings value: "+g+"\nMessage: "+p.message,p;}}else n=null;return n}}})();(()=>{function a(k){var m=(k=b.a.f.get(k,x))&&k.C;m&&(k.C=null,m.Wb())}function c(k,m,
t){this.node=k;this.Db=m;this.ya=[];this.B=!1;m.C||b.a.J.ma(k,a);t&&t.C&&(t.C.ya.push(k),this.Pa=t)}function e(k){return b.a.ib(b.m.D(k),(m,t)=>()=>k()[t])}function g(k,m,t){return"function"===typeof k?e(k.bind(null,m,t)):b.a.ib(k,v=>()=>v)}function l(k,m){var t=b.h.firstChild(m);if(t)for(var v;v=t;)t=b.h.nextSibling(v),q(k,v);b.c.notify(m,b.c.B)}function q(k,m){var t=k;if(1===m.nodeType||b.Eb.zc(m))t=f(m,null,k).bindingContextForDescendants;t&&m.matches&&!m.matches("SCRIPT,TEXTAREA,TEMPLATE")&&l(t,
m)}function d(k){var m=[],t={},v=[];b.a.N(k,function A(w){if(!t[w]){var I=b.getBindingHandler(w);I&&(I.after&&(v.push(w),I.after.forEach(G=>{if(k[G]){if(v.includes(G))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+v.join(", "));A(G)}}),v.length--),m.push({key:w,Pb:I}));t[w]=!0}});return m}function f(k,m,t){var v=b.a.f.cb(k,x,{}),y=v.hc;if(!m){if(y)throw Error("You cannot apply bindings multiple times to the same element.");v.hc=!0}y||(v.context=t);v.hb||
(v.hb={});if(m&&"function"!==typeof m)var w=m;else{var A=b.i(()=>{if(w=m?m(t,k):b.Eb.rc(k,t)){if(t[n])t[n]();if(t[r])t[r]()}return w},null,{j:k});w&&A.ga()||(A=null)}var I=t,G;if(w){var z=A?B=>()=>A()[B]():B=>w[B];function M(){return b.a.ib(A?A():w,B=>B())}M.get=B=>w[B]&&z(B)();M.has=B=>B in w;b.c.B in w&&b.c.subscribe(k,b.c.B,()=>{var B=w[b.c.B]();if(B){var H=b.h.childNodes(k);H.length&&B(H,b.Kb(H[0]))}});b.c.Y in w&&(I=b.c.nb(k,t),b.c.subscribe(k,b.c.Y,()=>{var B=w[b.c.Y]();B&&b.h.firstChild(k)&&
B(k)}));d(w).forEach(B=>{var H=B.Pb.init,L=B.Pb.update,K=B.key;if(8===k.nodeType&&!b.h.ca[K])throw Error("The binding '"+K+"' cannot be used with virtual elements");try{"function"==typeof H&&b.m.D(()=>{var N=H(k,z(K),M,I.$data,I);if(N&&N.controlsDescendantBindings){if(void 0!==G)throw Error("Multiple bindings ("+G+" and "+K+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");G=K}}),"function"==typeof L&&b.i(()=>L(k,z(K),M,
I.$data,I),null,{j:k})}catch(N){throw N.message='Unable to process binding "'+K+": "+w[K]+'"\nMessage: '+N.message,N;}})}v=void 0===G;return{shouldBindDescendants:v,bindingContextForDescendants:v&&I}}function h(k,m){return k&&k instanceof b.R?k:new b.R(k,void 0,void 0,m)}var n=Symbol("_subscribable"),p=Symbol("_ancestorBindingInfo"),r=Symbol("_dataDependency");b.b={};b.getBindingHandler=k=>b.b[k];var u={};b.R=function(k,m,t,v,y){function w(){var H=z?G():G,L=b.a.g(H);m?(b.a.extend(A,m),p in m&&(A[p]=
m[p])):(A.$parents=[],A.$root=L,A.ko=b);A[n]=B;I?L=A.$data:(A.$rawData=H,A.$data=L);t&&(A[t]=L);v&&v(A,m,L);if(m&&m[n]&&!b.oa.i().eb(m[n]))m[n]();M&&(A[r]=M);return A.$data}var A=this,I=k===u,G=I?void 0:k,z="function"==typeof G&&!b.K(G),M=y&&y.dataDependency;if(y&&y.exportDependencies)w();else{var B=b.Cc(w);B.F();B.ga()?B.equalityComparer=null:A[n]=void 0}};b.R.prototype.createChildContext=function(k,m,t,v){!v&&m&&"object"==typeof m&&(v=m,m=v.as,t=v.extend);if(m&&v&&v.noChildContext){var y="function"==
typeof k&&!b.K(k);return new b.R(u,this,null,w=>{t&&t(w);w[m]=y?k():k},v)}return new b.R(k,this,m,(w,A)=>{w.$parentContext=A;w.$parent=A.$data;w.$parents=(A.$parents||[]).slice(0);w.$parents.unshift(w.$parent);t&&t(w)},v)};b.R.prototype.extend=function(k,m){return new b.R(u,this,null,t=>b.a.extend(t,"function"==typeof k?k(t):k),m)};var x=b.a.f.X();c.prototype.Wb=function(){this.Pa&&this.Pa.C&&this.Pa.C.nc(this.node)};c.prototype.nc=function(k){b.a.xa(this.ya,k);!this.ya.length&&this.B&&this.Jb()};
c.prototype.Jb=function(){this.B=!0;this.Db.C&&!this.ya.length&&(this.Db.C=null,b.a.J.lb(this.node,a),b.c.notify(this.node,b.c.Y),this.Wb())};b.c={B:"childrenComplete",Y:"descendantsComplete",subscribe:(k,m,t,v,y)=>{var w=b.a.f.cb(k,x,{});w.fa||(w.fa=new b.T);y&&y.notifyImmediately&&w.hb[m]&&b.m.D(t,v,[k]);return w.fa.subscribe(t,v,m)},notify:(k,m)=>{var t=b.a.f.get(k,x);if(t&&(t.hb[m]=!0,t.fa&&t.fa.notifySubscribers(k,m),m==b.c.B))if(t.C)t.C.Jb();else if(void 0===t.C&&t.fa&&t.fa.ra(b.c.Y))throw Error("descendantsComplete event not supported for bindings on this node");
},nb:(k,m)=>{var t=b.a.f.cb(k,x,{});t.C||(t.C=new c(k,t,m[p]));return m[p]==t?m:m.extend(v=>{v[p]=t})}};b.Fc=k=>(k=b.a.f.get(k,x))&&k.context;b.Ra=(k,m,t)=>f(k,m,h(t));b.Ic=(k,m,t)=>{t=h(t);return b.Ra(k,g(m,t,k),t)};b.Bb=(k,m)=>{1!==m.nodeType&&8!==m.nodeType||l(h(k),m)};b.Ab=function(k,m,t){if(2>arguments.length){if(m=T.body,!m)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");}else if(!m||1!==m.nodeType&&8!==m.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");
q(h(k,t),m)};b.Kb=k=>(k=k&&[1,8].includes(k.nodeType)&&b.Fc(k))?k.$data:void 0;b.l("bindingHandlers",b.b);b.l("applyBindings",b.Ab);b.l("applyBindingAccessorsToNode",b.Ra);b.l("dataFor",b.Kb)})();(()=>{function a(d,f){return Object.prototype.hasOwnProperty.call(d,f)?d[f]:void 0}function c(d,f){var h=a(l,d);if(h)h.subscribe(f);else{h=l[d]=new b.T;h.subscribe(f);e(d,(p,r)=>{r=!(!r||!r.synchronous);q[d]={definition:p,wc:r};delete l[d];n||r?h.notifySubscribers(p):b.pb.Zb(()=>h.notifySubscribers(p))});
var n=!0}}function e(d,f){g("getConfig",[d],h=>{h?g("loadComponent",[d,h],n=>f(n,h)):f(null,null)})}function g(d,f,h,n){n||(n=b.s.loaders.slice(0));var p=n.shift();if(p){var r=p[d];if(r){var u=!1;if(void 0!==r.apply(p,f.concat(function(x){u?h(null):null!==x?h(x):g(d,f,h,n)}))&&(u=!0,!p.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else g(d,f,h,n)}else h(null)}var l={},q={};b.s={get:(d,f)=>{var h=a(q,
d);h?h.wc?b.m.D(()=>f(h.definition)):b.pb.Zb(()=>f(h.definition)):c(d,f)},kc:d=>delete q[d],ub:g};b.s.loaders=[];b.l("components",b.s)})();(()=>{function a(d,f,h,n){var p={},r=2;f=h.template;h=h.viewModel;f?b.s.ub("loadTemplate",[d,f],u=>{p.template=u;0===--r&&n(p)}):0===--r&&n(p);h?b.s.ub("loadViewModel",[d,h],u=>{p[q]=u;0===--r&&n(p)}):0===--r&&n(p)}function c(d,f,h){if("function"===typeof f)h(p=>new f(p));else if("function"===typeof f[q])h(f[q]);else if("instance"in f){var n=f.instance;h(()=>n)}else"viewModel"in
f?c(d,f.viewModel,h):d("Unknown viewModel value: "+f)}function e(d){if(d.matches("TEMPLATE")&&d.content instanceof DocumentFragment)return b.a.za(d.content.childNodes);throw"Template Source Element not a <template>";}function g(d){return f=>{throw Error("Component '"+d+"': "+f);}}var l={};b.s.register=(d,f)=>{if(!f)throw Error("Invalid configuration for "+d);if(b.s.Tb(d))throw Error("Component "+d+" is already registered");l[d]=f};b.s.Tb=d=>Object.prototype.hasOwnProperty.call(l,d);b.s.unregister=
d=>{delete l[d];b.s.kc(d)};b.s.mc={getConfig:(d,f)=>{d=b.s.Tb(d)?l[d]:null;f(d)},loadComponent:(d,f,h)=>{var n=g(d);a(d,n,f,h)},loadTemplate:(d,f,h)=>{d=g(d);if(f instanceof Array)h(f);else if(f instanceof DocumentFragment)h([...f.childNodes]);else if(f.element)if(f=f.element,f instanceof HTMLElement)h(e(f));else if("string"===typeof f){var n=T.getElementById(f);n?h(e(n)):d("Cannot find element with ID "+f)}else d("Unknown element type: "+f);else d("Unknown template value: "+f)},loadViewModel:(d,
f,h)=>c(g(d),f,h)};var q="createViewModel";b.l("components.register",b.s.register);b.s.loaders.push(b.s.mc)})();(()=>{function a(g,l,q){l=l.template;if(!l)throw Error("Component '"+g+"' has no template");g=b.a.za(l);b.h.ta(q,g)}function c(g,l,q){var d=g.createViewModel;return d?d.call(g,l,q):l}var e=0;b.b.component={init:(g,l,q,d,f)=>{var h,n,p,r=()=>{var x=h&&h.dispose;"function"===typeof x&&x.call(h);p&&p.o();n=h=p=null},u=[...b.h.childNodes(g)];b.h.qa(g);b.a.J.ma(g,r);b.i(()=>{var x=b.a.g(l());
if("string"===typeof x)var k=x;else{k=b.a.g(x.name);var m=b.a.g(x.params)}if(!k)throw Error("No component name specified");var t=b.c.nb(g,f),v=n=++e;b.s.get(k,y=>{if(n===v){r();if(!y)throw Error("Unknown component '"+k+"'");a(k,y,g);var w=c(y,m,{element:g,templateNodes:u});y=t.createChildContext(w,{extend:A=>{A.$component=w;A.$componentTemplateNodes=u}});w&&w.koDescendantsComplete&&(p=b.c.subscribe(g,b.c.Y,w.koDescendantsComplete,w));h=w;b.Bb(y,g)}})},null,{j:g});return{controlsDescendantBindings:!0}}};
b.h.ca.component=!0})();b.b.attr={update:(a,c)=>{c=b.a.g(c())||{};b.a.N(c,function(e,g){g=b.a.g(g);var l=e.indexOf(":");l="lookupNamespaceURI"in a&&0<l&&a.lookupNamespaceURI(e.substr(0,l));var q=!1===g||null===g||void 0===g;q?l?a.removeAttributeNS(l,e):a.removeAttribute(e):g=g.toString();q||(l?a.setAttributeNS(l,e,g):a.setAttribute(e,g));"name"===e&&(a.name=q?"":g)})}};var X=(a,c,e)=>{c&&c.split(/\s+/).forEach(g=>a.classList.toggle(g,e))};b.b.css={update:(a,c)=>{c=b.a.g(c());null!==c&&"object"==typeof c?
b.a.N(c,(e,g)=>{g=b.a.g(g);X(a,e,!!g)}):(c=b.a.ac(c),X(a,a.__ko__cssValue,!1),a.__ko__cssValue=c,X(a,c,!0))}};b.b.enable={update:(a,c)=>{(c=b.a.g(c()))&&a.disabled?a.removeAttribute("disabled"):c||a.disabled||(a.disabled=!0)}};b.b.disable={update:(a,c)=>b.b.enable.update(a,()=>!b.a.g(c()))};b.b.event={init:(a,c,e,g,l)=>{var q=c()||{};b.a.N(q,d=>{"string"==typeof d&&b.a.H(a,d,function(f){var h=c()[d];if(h){try{g=l.$data;var n=h.apply(g,[g,...arguments])}finally{!0!==n&&f.preventDefault()}!1===e.get(d+
"Bubble")&&(f.cancelBubble=!0,f.stopPropagation())}})})}};b.b.foreach={Ub:a=>()=>{var c=a(),e=b.K(c)?c.F():c;if(!e||"number"==typeof e.length)return{foreach:c};b.a.g(c);return{foreach:e.data,as:e.as,noChildContext:e.noChildContext,includeDestroyed:e.includeDestroyed,afterAdd:e.afterAdd,beforeRemove:e.beforeRemove,afterRender:e.afterRender,beforeMove:e.beforeMove,afterMove:e.afterMove}},init:(a,c)=>b.b.template.init(a,b.b.foreach.Ub(c)),update:(a,c,e,g,l)=>b.b.template.update(a,b.b.foreach.Ub(c),e,
g,l)};b.G.Ta.foreach=!1;b.h.ca.foreach=!0;b.b.hasfocus={init:(a,c,e)=>{var g=q=>{a.__ko_hasfocusUpdating=!0;q=a.ownerDocument.activeElement===a;var d=c();b.G.rb(d,e,"hasfocus",q,!0);a.__ko_hasfocusLastValue=q;a.__ko_hasfocusUpdating=!1},l=g.bind(null,!0);g=g.bind(null,!1);b.a.H(a,"focus",l);b.a.H(a,"focusin",l);b.a.H(a,"blur",g);b.a.H(a,"focusout",g);a.__ko_hasfocusLastValue=!1},update:(a,c)=>{c=!!b.a.g(c());a.__ko_hasfocusUpdating||a.__ko_hasfocusLastValue===c||(c?a.focus():a.blur())}};b.G.qb.hasfocus=
!0;b.b.html={init:()=>({controlsDescendantBindings:!0}),update:(a,c)=>{b.a.$a(a);c=b.a.g(c());if(null!=c){"string"!=typeof c&&(c=c.toString());const e=T.createElement("template");e.innerHTML=c;a.appendChild(e.content)}}};(function(){function a(c,e,g){b.b[c]={init:(l,q,d,f,h)=>{var n,p,r={},u;if(e){f=d.get("as");var x=d.get("noChildContext");var k=!(f&&x);r={as:f,noChildContext:x,exportDependencies:k}}var m=(u="render"==d.get("completeOn"))||d.has(b.c.Y);b.i(()=>{var t=b.a.g(q()),v=!g!==!t,y=!p;if(k||
v!==n){m&&(h=b.c.nb(l,h));if(v){if(!e||k)r.dataDependency=b.oa.i();var w=e?h.createChildContext("function"==typeof t?t:q,r):b.oa.Da()?h.extend(null,r):h}y&&b.oa.Da()&&(p=b.a.za(b.h.childNodes(l),!0));v?(y||b.h.ta(l,b.a.za(p)),b.Bb(w,l)):(b.h.qa(l),u||b.c.notify(l,b.c.B));n=v}},null,{j:l});return{controlsDescendantBindings:!0}}};b.G.Ta[c]=!1;b.h.ca[c]=!0}a("if");a("ifnot",!1,!0);a("with",!0)})();var Y={};b.b.options={init:a=>{if(!a.matches("SELECT"))throw Error("options binding applies only to SELECT elements");
for(;0<a.length;)a.remove(0);return{controlsDescendantBindings:!0}},update:(a,c,e)=>{function g(){return Array.from(a.options).filter(k=>k.selected)}function l(k,m,t){var v=typeof m;return"function"==v?m(k):"string"==v?k[m]:t}function q(k,m){u&&n?b.c.notify(a,b.c.B):p.length&&(k=p.includes(b.A.O(m[0])),m[0].selected=k,u&&!k&&b.m.D(b.a.cc,null,[a,"change"]))}var d=a.multiple,f=0!=a.length&&d?a.scrollTop:null,h=b.a.g(c()),n=e.get("valueAllowUnset")&&e.has("value");c={};var p=[];n||(d?p=g().map(b.A.O):
0<=a.selectedIndex&&p.push(b.A.O(a.options[a.selectedIndex])));if(h){"undefined"==typeof h.length&&(h=[h]);var r=h.filter(k=>k||null==k);e.has("optionsCaption")&&(h=b.a.g(e.get("optionsCaption")),null!==h&&void 0!==h&&r.unshift(Y))}var u=!1;c.beforeRemove=k=>a.removeChild(k);h=q;e.has("optionsAfterRender")&&"function"==typeof e.get("optionsAfterRender")&&(h=(k,m)=>{q(k,m);b.m.D(e.get("optionsAfterRender"),null,[m[0],k!==Y?k:void 0])});b.a.$b(a,r,function(k,m,t){t.length&&(p=!n&&t[0].selected?[b.A.O(t[0])]:
[],u=!0);m=a.ownerDocument.createElement("option");k===Y?(b.a.mb(m,e.get("optionsCaption")),b.A.Na(m,void 0)):(t=l(k,e.get("optionsValue"),k),b.A.Na(m,b.a.g(t)),k=l(k,e.get("optionsText"),t),b.a.mb(m,k));return[m]},c,h);if(!n){var x;d?x=p.length&&g().length<p.length:x=p.length&&0<=a.selectedIndex?b.A.O(a.options[a.selectedIndex])!==p[0]:p.length||0<=a.selectedIndex;x&&b.m.D(b.a.cc,null,[a,"change"])}(n||b.oa.fb())&&b.c.notify(a,b.c.B);f&&20<Math.abs(f-a.scrollTop)&&(a.scrollTop=f)}};b.b.options.jb=
b.a.f.X();b.b.style={update:(a,c)=>{c=b.a.g(c()||{});b.a.N(c,(e,g)=>{g=b.a.g(g);if(null===g||void 0===g||!1===g)g="";if(/^--/.test(e))a.style.setProperty(e,g);else{e=e.replace(/-(\w)/g,(q,d)=>d.toUpperCase());var l=a.style[e];a.style[e]=g;g===l||a.style[e]!=l||isNaN(g)||(a.style[e]=g+"px")}})}};b.b.submit={init:(a,c,e,g,l)=>{if("function"!=typeof c())throw Error("The value for a submit binding must be a function");b.a.H(a,"submit",q=>{var d=c();try{var f=d.call(l.$data,a)}finally{!0!==f&&(q.preventDefault?
q.preventDefault():q.returnValue=!1)}})}};b.b.text={init:()=>({controlsDescendantBindings:!0}),update:(a,c)=>b.a.mb(a,c())};b.h.ca.text=!0;b.b.textInput={init:(a,c,e)=>{var g=a.value,l,q,d=()=>{clearTimeout(l);q=l=void 0;var h=a.value;g!==h&&(g=h,b.G.rb(c(),e,"textInput",h))},f=()=>{var h=b.a.g(c());if(null===h||void 0===h)h="";void 0!==q&&h===q?b.a.setTimeout(f,4):a.value!==h&&(a.value=h,g=a.value)};b.a.H(a,"input",d);b.a.H(a,"change",d);b.a.H(a,"blur",d);b.i(f,null,{j:a})}};b.G.qb.textInput=!0;
b.b.textinput={preprocess:(a,c,e)=>e("textInput",a)};b.b.value={init:(a,c,e)=>{var g=a.matches("SELECT"),l=a.matches("INPUT");if(!l||"checkbox"!=a.type&&"radio"!=a.type){var q=[],d=e.get("valueUpdate"),f=null;d&&("string"==typeof d?q=[d]:q=d?d.filter((r,u)=>d.indexOf(r)===u):[],b.a.xa(q,"change"));var h=()=>{f=null;var r=c(),u=b.A.O(a);b.G.rb(r,e,"value",u)};q.forEach(r=>{var u=h;b.a.Gc(r,"after")&&(u=()=>{f=b.A.O(a);b.a.setTimeout(h,0)},r=r.substring(5));b.a.H(a,r,u)});var n=l&&"file"==a.type?()=>
{var r=b.a.g(c());null===r||void 0===r||""===r?a.value="":b.m.D(h)}:()=>{var r=b.a.g(c()),u=b.A.O(a);if(null!==f&&r===f)b.a.setTimeout(n,0);else if(r!==u||void 0===u)g?(u=e.get("valueAllowUnset"),b.A.Na(a,r,u),u||r===b.A.O(a)||b.m.D(h)):b.A.Na(a,r)};if(g){var p;b.c.subscribe(a,b.c.B,()=>{p?e.get("valueAllowUnset")?n():h():(b.a.H(a,"change",h),p=b.i(n,null,{j:a}))},null,{notifyImmediately:!0})}else b.a.H(a,"change",h),b.i(n,null,{j:a})}else b.Ra(a,{checkedValue:c})},update:()=>{}};b.G.qb.value=!0;
b.b.visible={update:(a,c)=>{c=b.a.g(c());var e="none"!=a.style.display;c&&!e?a.style.display="":e&&!c&&(a.style.display="none")}};b.b.hidden={update:(a,c)=>a.hidden=!!b.a.g(c())};(function(a){b.b[a]={init:function(c,e,g,l,q){return b.b.event.init.call(this,c,()=>({[a]:e()}),g,l,q)}}})("click");(()=>{let a=b.a.f.X();class c{constructor(g){this.Xa=g}Ja(...g){let l=this.Xa;if(!g.length)return b.a.f.get(l,a)||(11===this.P?l.content:1===this.P?l:void 0);b.a.f.set(l,a,g[0])}}class e extends c{constructor(g){super(g);
g&&(this.P=g.matches("TEMPLATE")&&g.content?g.content.nodeType:1)}}b.Ka={Xa:e,Qa:c}})();(()=>{function a(d,f){if(d.length){var h=d[0],n=h.parentNode;g(h,d[d.length-1],p=>{1!==p.nodeType&&8!==p.nodeType||b.Ab(f,p)});b.a.Ca(d,n)}}function c(d,f,h,n,p){p=p||{};var r=(d&&(d.nodeType?d:0<d.length?d[0]:null)||h||{}).ownerDocument;if("string"==typeof h){r=r||T;r=r.getElementById(h);if(!r)throw Error("Cannot find template with ID "+h);h=new b.Ka.Xa(r)}else if([1,8].includes(h.nodeType))h=new b.Ka.Qa(h);else throw Error("Unknown template type: "+
h);h=(h=h.Ja?h.Ja():null)?[...h.cloneNode(!0).childNodes]:null;if("number"!=typeof h.length||0<h.length&&"number"!=typeof h[0].nodeType)throw Error("Template engine must return an array of DOM nodes");r=!1;switch(f){case "replaceChildren":b.h.ta(d,h);r=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+f);}r&&(a(h,n),p.afterRender&&b.m.D(p.afterRender,null,[h,n[p.as||"$data"]]),"replaceChildren"==f&&b.c.notify(d,b.c.B));return h}function e(d,f,h){return b.K(d)?d():"function"===
typeof d?d(f,h):d}var g=(d,f,h)=>{var n;for(f=b.h.nextSibling(f);d&&(n=d)!==f;)d=b.h.nextSibling(n),h(n,d)};b.Dc=function(d,f,h,n){h=h||{};var p=p||"replaceChildren";if(n){var r=n.nodeType?n:0<n.length?n[0]:null;return b.i(()=>{var u=f&&f instanceof b.R?f:new b.R(f,null,null,null,{exportDependencies:!0}),x=e(d,u.$data,u);c(n,p,x,u,h)},null,{pa:()=>!r||!b.a.Za(r),j:r})}console.log("no targetNodeOrNodeArray")};b.Ec=(d,f,h,n,p)=>{function r(y,w){b.m.D(b.a.$b,null,[n,y,k,h,m,w]);b.c.notify(n,b.c.B)}var u,
x=h.as,k=(y,w)=>{u=p.createChildContext(y,{as:x,noChildContext:h.noChildContext,extend:A=>{A.$index=w;x&&(A[x+"Index"]=w)}});y=e(d,y,u);return c(n,"ignoreTargetNode",y,u,h)},m=(y,w)=>{a(w,u);h.afterRender&&h.afterRender(w,y);u=null},t=!1===h.includeDestroyed;if(t||h.beforeRemove||!b.Sb(f))return b.i(()=>{var y=b.a.g(f)||[];"undefined"==typeof y.length&&(y=[y]);t&&(y=y.filter(w=>w||null==w));r(y)},null,{j:n});r(f.F());var v=f.subscribe(y=>{r(f(),y)},null,"arrayChange");v.j(n);return v};var l=b.a.f.X(),
q=b.a.f.X();b.b.template={init:(d,f)=>{f=b.a.g(f());if("string"==typeof f||"name"in f)b.h.qa(d);else if("nodes"in f){f=f.nodes||[];if(b.K(f))throw Error('The "nodes" option must be a plain, non-observable array.');let h=f[0]&&f[0].parentNode;h&&b.a.f.get(h,q)||(h=b.a.Vb(f),b.a.f.set(h,q,!0));(new b.Ka.Qa(d)).Ja(h)}else if(f=b.h.childNodes(d),0<f.length)f=b.a.Vb(f),(new b.Ka.Qa(d)).Ja(f);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},
update:(d,f,h,n,p)=>{var r=f();f=b.a.g(r);h=!0;n=null;"string"==typeof f?f={}:(r="name"in f?f.name:d,"if"in f&&(h=b.a.g(f["if"])),h&&"ifnot"in f&&(h=!b.a.g(f.ifnot)),h&&!r&&(h=!1));"foreach"in f?n=b.Ec(r,h&&f.foreach||[],f,d,p):h?(h=p,"data"in f&&(h=p.createChildContext(f.data,{as:f.as,noChildContext:f.noChildContext,exportDependencies:!0})),n=b.Dc(r,h,f,d)):b.h.qa(d);p=n;(f=b.a.f.get(d,l))&&"function"==typeof f.o&&f.o();b.a.f.set(d,l,!p||p.ga&&!p.ga()?void 0:p)}};b.G.Ta.template=d=>{d=b.G.Ac(d);
return 1==d.length&&d[0].unknown||b.G.yc(d,"name")?null:"This template engine does not support anonymous templates nested within its templates"};b.h.ca.template=!0})();b.a.Ob=(a,c,e)=>{if(a.length&&c.length){var g,l,q,d,f;for(g=l=0;(!e||g<e)&&(d=a[l]);++l){for(q=0;f=c[q];++q)if(d.value===f.value){d.moved=f.index;f.moved=d.index;c.splice(q,1);g=q=0;break}g+=q}}};b.a.Ib=(()=>{function a(c,e,g,l,q){var d=Math.min,f=Math.max,h=[],n,p=c.length,r,u=e.length,x=u-p||1,k=p+u+1,m;for(n=0;n<=p;n++){var t=m;
h.push(m=[]);var v=d(u,n+x);for(r=f(0,n-1);r<=v;r++)m[r]=r?n?c[n-1]===e[r-1]?t[r-1]:d(t[r]||k,m[r-1]||k)+1:r+1:n+1}d=[];f=[];x=[];n=p;for(r=u;n||r;)u=h[n][r]-1,r&&u===h[n][r-1]?f.push(d[d.length]={status:g,value:e[--r],index:r}):n&&u===h[n-1][r]?x.push(d[d.length]={status:l,value:c[--n],index:n}):(--r,--n,q.sparse||d.push({status:"retained",value:e[r]}));b.a.Ob(x,f,!q.dontLimitMoves&&10*p);return d.reverse()}return function(c,e,g){g="boolean"===typeof g?{dontLimitMoves:g}:g||{};c=c||[];e=e||[];return c.length<
e.length?a(c,e,"added","deleted",g):a(e,c,"deleted","added",g)}})();(()=>{function a(g,l,q,d,f){var h=[],n=b.i(()=>{var p=l(q,f,b.a.Ca(h,g))||[];if(0<h.length){var r=h.nodeType?[h]:h;if(0<r.length){var u=r[0],x=u.parentNode,k;var m=0;for(k=p.length;m<k;m++)x.insertBefore(p[m],u);m=0;for(k=r.length;m<k;m++)b.removeNode(r[m])}d&&b.m.D(d,null,[q,p,f])}h.length=0;h.push(...p)},null,{j:g,pa:()=>!!h.find(b.a.Za)});return{M:h,Va:n.ga()?n:void 0}}var c=b.a.f.X(),e=b.a.f.X();b.a.$b=(g,l,q,d,f,h)=>{function n(H){z=
{da:H,Fa:b.ba(t++)};k.push(z);x||I.push(z)}function p(H){z=u[H];t!==z.Fa.F()&&A.push(z);z.Fa(t++);b.a.Ca(z.M,g);k.push(z)}function r(H,L){if(H)for(var K=0,N=L.length;K<N;K++)L[K].M.forEach(ia=>H(ia,K,L[K].da))}l=l||[];"undefined"==typeof l.length&&(l=[l]);d=d||{};var u=b.a.f.get(g,c),x=!u,k=[],m=0,t=0,v=[],y=[],w=[],A=[],I=[],G=0;if(x)l.forEach(n);else{if(!h||u&&u._countWaitingForRemove)h=Array.prototype.map.call(u,H=>H.da),h=b.a.Ib(h,l,{dontLimitMoves:d.dontLimitMoves,sparse:!0});for(let H=0,L,K,
N;L=h[H];H++)switch(K=L.moved,N=L.index,L.status){case "deleted":for(;m<N;)p(m++);if(void 0===K){var z=u[m];z.Va&&(z.Va.o(),z.Va=void 0);b.a.Ca(z.M,g).length&&(d.beforeRemove&&(k.push(z),G++,z.da===e?z=null:w.push(z)),z&&v.push.apply(v,z.M))}m++;break;case "added":for(;t<N;)p(m++);void 0!==K?(y.push(k.length),p(K)):n(L.value)}for(;t<l.length;)p(m++);k._countWaitingForRemove=G}b.a.f.set(g,c,k);r(d.beforeMove,A);v.forEach(d.beforeRemove?b.ea:b.removeNode);var M,B;G=g.ownerDocument.activeElement;if(y.length)for(;void 0!=
(l=y.shift());){z=k[l];for(M=void 0;l;)if((B=k[--l].M)&&B.length){M=B[B.length-1];break}for(m=0;v=z.M[m];M=v,m++)b.h.Rb(g,v,M)}for(l=0;z=k[l];l++){z.M||b.a.extend(z,a(g,q,z.da,f,z.Fa));for(m=0;v=z.M[m];M=v,m++)b.h.Rb(g,v,M);!z.uc&&f&&(f(z.da,z.M,z.Fa),z.uc=!0,M=z.M[z.M.length-1])}G&&g.ownerDocument.activeElement!=G&&G.focus();r(d.beforeRemove,w);for(l=0;l<w.length;++l)w[l].da=e;r(d.afterMove,A);r(d.afterAdd,I)}})();C.ko=W})(this);

View file

@ -260,12 +260,6 @@
: ko.utils.objectMap(bindings, value => () => value);
}
// This function is used if the binding provider doesn't include a getBindingAccessors function.
// It must be called with 'this' set to the provider instance.
function getBindingsAndMakeAccessors(node, context) {
return makeAccessorsFromFunction(this['getBindings'].bind(this, node, context));
}
function validateThatBindingIsAllowedForVirtualElements(bindingName) {
var validator = ko.virtualElements.allowedBindings[bindingName];
if (!validator)
@ -276,22 +270,7 @@
var nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement);
if (nextInQueue) {
var currentChild,
provider = ko.bindingProvider['instance'],
preprocessNode = provider['preprocessNode'];
// Preprocessing allows a binding provider to mutate a node before bindings are applied to it. For example it's
// possible to insert new siblings after it, and/or replace the node with a different one. This can be used to
// implement custom binding syntaxes, such as {{ value }} for string interpolation, or custom element types that
// trigger insertion of <template> contents at that point in the document.
if (preprocessNode) {
while (currentChild = nextInQueue) {
nextInQueue = ko.virtualElements.nextSibling(currentChild);
preprocessNode.call(provider, currentChild);
}
// Reset nextInQueue for the next loop
nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement);
}
var currentChild;
while (currentChild = nextInQueue) {
// Keep a record of the next child *before* applying bindings, in case the binding removes the current child from its position
@ -310,7 +289,7 @@
// Perf optimisation: Apply bindings only if...
// (1) We need to store the binding info for the node (all element nodes)
// (2) It might have bindings (e.g., it has a data-bind attribute, or it's a marker for a containerless template)
var shouldApplyBindings = isElement || ko.bindingProvider['instance']['nodeHasBindings'](nodeVerified);
var shouldApplyBindings = isElement || ko.bindingProvider.nodeHasBindings(nodeVerified);
if (shouldApplyBindings)
bindingContextForDescendants = applyBindingsToNodeInternal(nodeVerified, null, bindingContext)['bindingContextForDescendants'];
@ -379,14 +358,11 @@
if (sourceBindings && typeof sourceBindings !== 'function') {
bindings = sourceBindings;
} else {
var provider = ko.bindingProvider['instance'],
getBindings = provider['getBindingAccessors'] || getBindingsAndMakeAccessors;
// Get the binding from the provider within a computed observable so that we can update the bindings whenever
// the binding context is updated or if the binding provider accesses observables.
var bindingsUpdater = ko.computed(
() => {
bindings = sourceBindings ? sourceBindings(bindingContext, node) : getBindings.call(provider, node, bindingContext);
bindings = sourceBindings ? sourceBindings(bindingContext, node) : ko.bindingProvider.getBindingAccessors(node, bindingContext);
// Register a dependency on the binding context to support observable view models.
if (bindings) {
if (bindingContext[contextSubscribable]) {

View file

@ -1,34 +1,26 @@
(function() {
var defaultBindingAttributeName = "data-bind";
(() => {
const defaultBindingAttributeName = "data-bind",
ko.bindingProvider = function() {
this.bindingCache = {};
};
bindingCache = {},
ko.utils.extend(ko.bindingProvider.prototype, {
'nodeHasBindings': node => {
switch (node.nodeType) {
case 1: // Element
return node.getAttribute(defaultBindingAttributeName) != null;
case 8: // Comment node
return ko.virtualElements.hasBindingValue(node);
default: return false;
}
createBindingsStringEvaluatorViaCache = (bindingsString, cache, options) => {
var cacheKey = bindingsString + (options && options['valueAccessors'] || '');
return cache[cacheKey]
|| (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, options));
},
'getBindings': function(node, bindingContext) {
var bindingsString = this['getBindingsString'](node, bindingContext);
return bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node) : null;
},
'getBindingAccessors': function(node, bindingContext) {
var bindingsString = this['getBindingsString'](node, bindingContext);
return bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node, { 'valueAccessors': true }) : null;
createBindingsStringEvaluator = (bindingsString, options) => {
// Build the source for a function that evaluates "expression"
// For each scope variable, add an extra level of "with" nesting
// Example result: with(sc1) { with(sc0) { return (expression) } }
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options),
functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}";
return new Function("$context", "$element", functionBody);
},
// The following function is only used internally by this default provider.
// It's not part of the interface definition for a general binding provider.
'getBindingsString': (node, bindingContext) => {
getBindingsString = node => {
switch (node.nodeType) {
case 1: return node.getAttribute(defaultBindingAttributeName); // Element
case 8: return ko.virtualElements.virtualNodeBindingValue(node); // Comment node
@ -38,31 +30,32 @@
// The following function is only used internally by this default provider.
// It's not part of the interface definition for a general binding provider.
'parseBindingsString': function(bindingsString, bindingContext, node, options) {
parseBindingsString = (bindingsString, bindingContext, node, options) => {
try {
var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, this.bindingCache, options);
var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, bindingCache, options);
return bindingFunction(bindingContext, node);
} catch (ex) {
ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString + "\nMessage: " + ex.message;
throw ex;
}
};
ko.bindingProvider = new class
{
nodeHasBindings(node) {
switch (node.nodeType) {
case 1: // Element
return node.getAttribute(defaultBindingAttributeName) != null;
case 8: // Comment node
return ko.virtualElements.hasBindingValue(node);
default: return false;
}
}
});
ko.bindingProvider['instance'] = new ko.bindingProvider();
getBindingAccessors(node, bindingContext) {
var bindingsString = getBindingsString(node, bindingContext);
return bindingsString ? parseBindingsString(bindingsString, bindingContext, node, { 'valueAccessors': true }) : null;
}
};
function createBindingsStringEvaluatorViaCache(bindingsString, cache, options) {
var cacheKey = bindingsString + (options && options['valueAccessors'] || '');
return cache[cacheKey]
|| (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, options));
}
function createBindingsStringEvaluator(bindingsString, options) {
// Build the source for a function that evaluates "expression"
// For each scope variable, add an extra level of "with" nesting
// Example result: with(sc1) { with(sc0) { return (expression) } }
var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options),
functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}";
return new Function("$context", "$element", functionBody);
}
})();

View file

@ -38,6 +38,3 @@ ko.bindingHandlers['hasfocus'] = {
}
};
ko.expressionRewriting.twoWayBindings['hasfocus'] = true;
ko.bindingHandlers['hasFocus'] = ko.bindingHandlers['hasfocus']; // Make "hasFocus" an alias
ko.expressionRewriting.twoWayBindings['hasFocus'] = 'hasfocus';

View file

@ -3,7 +3,20 @@ ko.bindingHandlers['html'] = {
// Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)
return { 'controlsDescendantBindings': true };
},
'update': (element, valueAccessor) =>
'update': (element, valueAccessor) => {
// setHtml will unwrap the value if needed
ko.utils.setHtml(element, valueAccessor())
ko.utils.emptyDomNode(element);
// There's no legitimate reason to display a stringified observable without unwrapping it, so we'll unwrap it
let html = ko.utils.unwrapObservable(valueAccessor());
if (html != null) {
if (typeof html != 'string')
html = html.toString();
const template = document.createElement('template');
template.innerHTML = html;
element.appendChild(template.content);
}
}
};

View file

@ -162,12 +162,8 @@ ko.expressionRewriting = (() => {
preProcessBindings: preProcessBindings,
keyValueArrayContainsKey: (keyValueArray, key) => {
for (var i = 0; i < keyValueArray.length; i++)
if (keyValueArray[i]['key'] == key)
return true;
return false;
},
keyValueArrayContainsKey: (keyValueArray, key) =>
-1 < keyValueArray.findIndex(v => v['key'] == key),
// Internal, private KO utility for updating model properties from within bindings
// property: If the property being updated is (or might be) an observable, pass it here

View file

@ -36,25 +36,22 @@
}
break;
case 'SELECT':
if (value === "" || value === null) // A blank string or null value will select the caption
value = undefined;
var selection = -1;
// A blank string or null value will select the caption
var selection = -1, noValue = ("" === value || null == value);
for (var i = 0, n = element.options.length, optionValue; i < n; ++i) {
optionValue = ko.selectExtensions.readValue(element.options[i]);
// Include special check to handle selecting a caption with a blank string value
if (optionValue == value || (optionValue === "" && value === undefined)) {
if (optionValue == value || (optionValue === "" && noValue)) {
selection = i;
break;
}
}
if (allowUnset || selection >= 0 || (value === undefined && element.size > 1)) {
if (allowUnset || selection >= 0 || (noValue && element.size > 1)) {
element.selectedIndex = selection;
}
break;
default:
if ((value === null) || (value === undefined))
value = "";
element.value = value;
element.value = (value == null) ? "" : value;
break;
}
}

View file

@ -92,10 +92,7 @@
}
function resolveTemplate(errorCallback, templateConfig, callback) {
if (typeof templateConfig === 'string') {
// Markup - parse it
callback(ko.utils.parseHtmlFragment(templateConfig));
} else if (templateConfig instanceof Array) {
if (templateConfig instanceof Array) {
// Assume already an array of DOM nodes - pass through unchanged
callback(templateConfig);
} else if (templateConfig instanceof DocumentFragment) {

View file

@ -7,109 +7,52 @@
// 2. ko.templateSources.anonymousElement - uses ko.utils.domData to read/write text *associated* with the DOM element, but
// without reading/writing the actual element text content, since it will be overwritten
// with the rendered template output.
// You can implement your own template source if you want to fetch/store templates somewhere other than in DOM elements.
// Template sources need to have the following functions:
// text() - returns the template text from your storage location
// text(value) - writes the supplied template text to your storage location
// data(key) - reads values stored using data(key, value) - see below
// data(key, value) - associates "value" with this template and the key "key". Is used to store information like "isRewritten".
//
// Optionally, template sources can also have the following functions:
// nodes() - returns a DOM element containing the nodes of this template, where available
// nodes(value) - writes the given DOM element to your storage location
// If a DOM element is available for a given template source, template engines are encouraged to use it in preference over text()
// for improved speed. However, all templateSources must supply text() even if they don't supply nodes().
//
// Once you've implemented a templateSource, make your template engine use it by subclassing whatever template engine you were
// using and overriding "makeTemplateSource" to return an instance of your custom template source.
ko.templateSources = {};
// ---- ko.templateSources.domElement -----
// template types
var templateTemplate = 3,
templateElement = 4;
ko.templateSources.domElement = function(element) {
this.domElement = element;
if (element) {
this.templateType =
element.matches("TEMPLATE") && element.content && element.content.nodeType === 11 ? templateTemplate :
templateElement;
}
}
ko.templateSources.domElement.prototype['text'] = function(/* valueToWrite */) {
var elemContentsProperty = "innerHTML";
if (arguments.length == 0) {
return this.domElement.innerHTML;
}
ko.utils.setHtml(this.domElement, arguments[0]);
};
var dataDomDataPrefix = ko.utils.domData.nextKey() + "_";
ko.templateSources.domElement.prototype['data'] = function(key /*, valueToWrite */) {
if (arguments.length === 1) {
return ko.utils.domData.get(this.domElement, dataDomDataPrefix + key);
}
ko.utils.domData.set(this.domElement, dataDomDataPrefix + key, arguments[1]);
};
var templatesDomDataKey = ko.utils.domData.nextKey();
function getTemplateDomData(element) {
return ko.utils.domData.get(element, templatesDomDataKey) || {};
}
function setTemplateDomData(element, data) {
ko.utils.domData.set(element, templatesDomDataKey, data);
}
ko.templateSources.domElement.prototype['nodes'] = function(/* valueToWrite */) {
var element = this.domElement;
if (arguments.length == 0) {
var templateData = getTemplateDomData(element),
nodes = templateData.containerData || (
this.templateType === templateTemplate ? element.content :
this.templateType === templateElement ? element :
undefined);
if (!nodes || templateData.alwaysCheckText) {
// If the template is associated with an element that stores the template as text,
// parse and cache the nodes whenever there's new text content available. This allows
// the user to update the template content by updating the text of template node.
var text = this['text']();
if (text && text !== templateData.textData) {
nodes = ko.utils.parseHtmlForTemplateNodes(text, element.ownerDocument);
setTemplateDomData(element, {containerData: nodes, textData: text, alwaysCheckText: true});
}
}
return nodes;
}
var valueToWrite = arguments[0];
if (this.templateType !== undefined) {
this['text'](""); // clear the text from the node
}
setTemplateDomData(element, {containerData: valueToWrite});
};
let templatesDomDataKey = ko.utils.domData.nextKey();
// ---- ko.templateSources.anonymousTemplate -----
// Anonymous templates are normally saved/retrieved as DOM nodes through "nodes".
// For compatibility, you can also read "text"; it will be serialized from the nodes on demand.
// Writing to "text" is still supported, but then the template data will not be available as DOM nodes.
ko.templateSources.anonymousTemplate = function(element) {
this.domElement = element;
};
ko.templateSources.anonymousTemplate.prototype = new ko.templateSources.domElement();
ko.templateSources.anonymousTemplate.prototype.constructor = ko.templateSources.anonymousTemplate;
ko.templateSources.anonymousTemplate.prototype['text'] = function(/* valueToWrite */) {
if (arguments.length == 0) {
var templateData = getTemplateDomData(this.domElement);
if (templateData.textData === undefined && templateData.containerData)
templateData.textData = templateData.containerData.innerHTML;
return templateData.textData;
class anonymousTemplate
{
constructor(element)
{
this.domElement = element;
}
var valueToWrite = arguments[0];
setTemplateDomData(this.domElement, {textData: valueToWrite});
nodes(...args)
{
let element = this.domElement;
if (!args.length) {
return ko.utils.domData.get(element, templatesDomDataKey) || (
this.templateType === 11 ? element.content :
this.templateType === 1 ? element :
undefined);
}
ko.utils.domData.set(element, templatesDomDataKey, args[0]);
}
}
// ---- ko.templateSources.domElement -----
class domElement extends anonymousTemplate
{
constructor(element)
{
super(element);
if (element) {
this.templateType =
element.matches("TEMPLATE") && element.content ? element.content.nodeType : 1;
}
}
}
ko.templateSources = {
domElement: domElement,
anonymousTemplate: anonymousTemplate
};
})();

View file

@ -1,9 +1,9 @@
(() => {
var renderTemplateSource = (templateSource, bindingContext, options, templateDocument) => {
var renderTemplateSource = templateSource => {
var templateNodes = templateSource.nodes ? templateSource.nodes() : null;
return templateNodes
? [...templateNodes.cloneNode(true).childNodes]
: ko.utils.parseHtmlFragment(templateSource['text'](), templateDocument);
: null;
},
makeTemplateSource = (template, templateDocument) => {
@ -40,36 +40,7 @@
if (continuousNodeArray.length) {
var firstNode = continuousNodeArray[0],
lastNode = continuousNodeArray[continuousNodeArray.length - 1],
parentNode = firstNode.parentNode,
provider = ko.bindingProvider['instance'],
preprocessNode = provider['preprocessNode'];
if (preprocessNode) {
invokeForEachNodeInContinuousRange(firstNode, lastNode, (node, nextNodeInRange) => {
var nodePreviousSibling = node.previousSibling;
var newNodes = preprocessNode.call(provider, node);
if (newNodes) {
if (node === firstNode)
firstNode = newNodes[0] || nextNodeInRange;
if (node === lastNode)
lastNode = newNodes[newNodes.length - 1] || nodePreviousSibling;
}
});
// Because preprocessNode can change the nodes, including the first and last nodes, update continuousNodeArray to match.
// We need the full set, including inner nodes, because the unmemoize step might remove the first node (and so the real
// first node needs to be in the array).
continuousNodeArray.length = 0;
if (!firstNode) { // preprocessNode might have removed all the nodes, in which case there's nothing left to do
return;
}
if (firstNode === lastNode) {
continuousNodeArray.push(firstNode);
} else {
continuousNodeArray.push(firstNode, lastNode);
ko.utils.fixUpContinuousNodeArray(continuousNodeArray, parentNode);
}
}
parentNode = firstNode.parentNode;
// Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind)
// whereas a regular applyBindings won't introduce new memoized nodes
@ -94,10 +65,7 @@
var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
var templateDocument = (firstTargetNode || template || {}).ownerDocument;
var renderedNodesArray = renderTemplateSource(
makeTemplateSource(template, templateDocument),
bindingContext, options, templateDocument
);
var renderedNodesArray = renderTemplateSource(makeTemplateSource(template, templateDocument));
// Loosely check result is an array of DOM nodes
if ((typeof renderedNodesArray.length != "number") || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType != "number"))
@ -266,13 +234,13 @@
ko.utils.domData.set(container, cleanContainerDomDataKey, true);
}
new ko.templateSources.anonymousTemplate(element)['nodes'](container);
new ko.templateSources.anonymousTemplate(element).nodes(container);
} else {
// It's an anonymous template - store the element contents, then clear the element
var templateNodes = ko.virtualElements.childNodes(element);
if (templateNodes.length > 0) {
let container = ko.utils.moveCleanedNodesToContainerElement(templateNodes); // This also removes the nodes from their current parent
new ko.templateSources.anonymousTemplate(element)['nodes'](container);
new ko.templateSources.anonymousTemplate(element).nodes(container);
} else {
throw new Error("Anonymous template defined, but no template content was provided");
}

View file

@ -1,42 +1,25 @@
ko.utils.domData = new (function () {
var uniqueId = 0;
var dataStoreKeyExpandoPropertyName = "__ko__" + (Date.now());
var
// We considered using WeakMap, but it has a problem in IE 11 and Edge that prevents using
// it cross-window, so instead we just store the data directly on the node.
// See https://github.com/knockout/knockout/issues/2141
getDataForNode = (node, createIfNotFound) => {
var dataForNode = node[dataStoreKeyExpandoPropertyName];
if (!dataForNode && createIfNotFound) {
dataForNode = node[dataStoreKeyExpandoPropertyName] = {};
}
return dataForNode;
},
clear = node => {
if (node[dataStoreKeyExpandoPropertyName]) {
delete node[dataStoreKeyExpandoPropertyName];
return true; // Exposing "did clean" flag purely so specs can infer whether things have been cleaned up as intended
}
return false;
};
let uniqueId = 0,
dataStoreKeyExpandoPropertyName = "__ko__" + (Date.now()),
dataStore = new WeakMap();
return {
get: (node, key) => {
var dataForNode = getDataForNode(node, false);
return dataForNode && dataForNode[key];
},
get: (node, key) => (dataStore.get(node) || {})[key],
set: (node, key, value) => {
// Make sure we don't actually create a new domData key if we are actually deleting a value
var dataForNode = getDataForNode(node, value !== undefined /* createIfNotFound */);
dataForNode && (dataForNode[key] = value);
if (dataStore.has(node)) {
dataStore.get(node)[key] = value;
} else {
let dataForNode = {};
dataForNode[key] = value;
dataStore.set(node, dataForNode);
}
return value;
},
getOrSet: (node, key, value) => {
var dataForNode = getDataForNode(node, true /* createIfNotFound */);
return dataForNode[key] || (dataForNode[key] = value);
getOrSet: function(node, key, value) {
return this.get(node, key) || this.set(node, key, value);
},
clear: clear,
clear: node => dataStore.delete(node),
nextKey: () => (uniqueId++) + dataStoreKeyExpandoPropertyName
};

View file

@ -1,71 +0,0 @@
(() => {
var none = [0, "", ""],
table = [1, "<table>", "</table>"],
tbody = [2, "<table><tbody>", "</tbody></table>"],
tr = [3, "<table><tbody><tr>", "</tr></tbody></table>"],
select = [1, "<select multiple='multiple'>", "</select>"],
lookup = {
'thead': table,
'tbody': table,
'tfoot': table,
'tr': tbody,
'td': tr,
'th': tr,
'option': select,
'optgroup': select
};
function getWrap(tags) {
var m = tags.match(/^(?:<!--.*?-->\s*?)*?<([a-z]+)[\s>]/);
return (m && lookup[m[1]]) || none;
}
function simpleHtmlParse(html, documentContext) {
documentContext || (documentContext = document);
var windowContext = documentContext['parentWindow'] || documentContext['defaultView'] || window;
// Based on jQuery's "clean" function, but only accounting for table-related elements.
// Trim whitespace, otherwise indexOf won't work as expected
var tags = ko.utils.stringTrim(html).toLowerCase(), div = documentContext.createElement("div"),
wrap = getWrap(tags),
depth = wrap[0];
// Go to html and back, then peel off extra wrappers
div.innerHTML = "<div>" + wrap[1] + html + wrap[2] + "</div>";
// Move to the right depth
while (depth--)
div = div.lastChild;
return [...div.lastChild.childNodes];
}
ko.utils.parseHtmlFragment = (html, documentContext) =>
simpleHtmlParse(html, documentContext); // ... otherwise, this simple logic will do in most common cases.
ko.utils.parseHtmlForTemplateNodes = (html, documentContext) => {
var nodes = ko.utils.parseHtmlFragment(html, documentContext);
return (nodes.length && nodes[0].parentElement) || ko.utils.moveCleanedNodesToContainerElement(nodes);
};
ko.utils.setHtml = (node, html) => {
ko.utils.emptyDomNode(node);
// There's no legitimate reason to display a stringified observable without unwrapping it, so we'll unwrap it
html = ko.utils.unwrapObservable(html);
if ((html !== null) && (html !== undefined)) {
if (typeof html != 'string')
html = html.toString();
// jQuery contains a lot of sophisticated code to parse arbitrary HTML fragments,
// for example <tr> elements which are not normally allowed to exist on their own.
// If you've referenced jQuery we'll use that rather than duplicating its code.
// ... otherwise, use KO's own parsing logic.
var parsedNodes = ko.utils.parseHtmlFragment(html, node.ownerDocument);
for (var i = 0; i < parsedNodes.length; i++)
node.appendChild(parsedNodes[i]);
}
};
})();