@tko/build.reference 4.0.0-alpha8.4 → 4.0.0-beta1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.min.js +16 -0
- package/dist/browser.min.js.map +7 -0
- package/dist/common.js +2 -0
- package/dist/common.js.map +7 -0
- package/dist/index.cjs +8080 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +7 -0
- package/package.json +41 -40
- package/LICENSE +0 -22
- package/dist/build.reference.es6.js +0 -10125
- package/dist/build.reference.es6.js.map +0 -1
- package/dist/build.reference.es6.min.js +0 -7
- package/dist/build.reference.es6.min.js.map +0 -1
- package/dist/build.reference.js +0 -10124
- package/dist/build.reference.js.map +0 -1
- package/dist/build.reference.min.js +0 -7
- package/dist/build.reference.min.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.reference.min.js","sources":["../../utils/src/array.js","../../utils/src/error.js","../../utils/src/async.js","../../utils/src/object.js","../../utils/src/function.js","../../utils/src/string.js","../../utils/src/symbol.js","../../utils/src/css.js","../../utils/src/dom/info.js","../../utils/src/dom/data.js","../../utils/src/dom/disposal.js","../../utils/src/dom/event.js","../../utils/src/dom/manipulation.js","../../utils/src/dom/fixes.js","../../utils/src/dom/virtualElements.js","../../utils/src/dom/html.js","../../utils/src/memoization.js","../../utils/src/tasks.js","../../observable/src/subscribableSymbol.js","../../observable/src/dependencyDetection.js","../../observable/src/defer.js","../../observable/src/extenders.js","../../observable/src/subscribable.js","../../observable/src/observable.js","../../observable/src/observableArray.changeTracking.js","../../observable/src/observableArray.js","../../observable/src/mappingHelpers.js","../../utils.parser/src/operators.js","../../utils.parser/src/preparse.js","../../computed/src/computed.js","../../computed/src/proxy.js","../../computed/src/when.js","../../bind/src/bindingContext.js","../../bind/src/applyBindings.js","../../bind/src/arrayToDomNodeChildren.js","../../binding.template/src/templateSources.js","../../binding.template/src/templateEngine.js","../../binding.template/src/templating.js","../../binding.template/src/nativeTemplateEngine.js","../../utils.component/src/registry.js","../../utils.component/src/loaders.js","../../provider.mustache/src/mustacheParser.js","../../binding.core/src/event.js","../../binding.foreach/src/foreach.js","../../utils.jsx/src/jsxClean.js","../../utils.jsx/src/JsxObserver.js","../../utils.jsx/src/jsx.js","../../utils/src/options.js","../../utils/src/ie.js","../../utils/src/jquery.js","../../utils/src/dom/selectExtensions.js","../../observable/src/Subscription.js","../../utils.parser/src/Node.js","../../utils.parser/src/Expression.js","../../utils.parser/src/Arguments.js","../../utils.parser/src/identifierExpressions.js","../../utils.parser/src/Identifier.js","../../utils.parser/src/Ternary.js","../../utils.parser/src/Parser.js","../../computed/src/throttleExtender.js","../../lifecycle/src/LifeCycle.js","../../bind/src/bindingEvent.js","../../bind/src/BindingResult.js","../../bind/src/BindingHandler.js","../../bind/src/LegacyBindingHandler.js","../../bind/src/DescendantBindingHandler.js","../../binding.template/src/foreach.js","../../builder/src/Builder.js","../../provider/src/BindingHandlerObject.js","../../provider/src/Provider.js","../../provider.bindingstring/src/BindingStringProvider.js","../../provider.virtual/src/VirtualProvider.js","../../provider.databind/src/DataBindProvider.js","../../utils.component/src/ComponentABC.js","../../utils.component/src/index.js","../../provider.component/src/ComponentProvider.js","../../provider.attr/src/AttributeProvider.js","../../provider.multi/src/MultiProvider.js","../../provider.mustache/src/AttributeMustacheProvider.js","../../provider.mustache/src/TextMustacheProvider.js","../../provider.native/src/NativeProvider.js","../../binding.core/src/click.js","../../binding.core/src/css.js","../../binding.core/src/descendantsComplete.js","../../binding.core/src/enableDisable.js","../../binding.core/src/hasfocus.js","../../binding.core/src/options.js","../../binding.core/src/style.js","../../binding.core/src/textInput.js","../../binding.core/src/uniqueName.js","../../binding.core/src/value.js","../../binding.core/src/visible.js","../../binding.if/src/ConditionalBindingHandler.js","../../binding.if/src/ifUnless.js","../../binding.if/src/with.js","../../binding.if/src/else.js","../../binding.foreach/src/index.js","../../binding.component/src/componentBinding.js","../../binding.component/src/slotBinding.js","../../filter.punches/src/index.js","../../binding.core/src/index.js","../../binding.core/src/attr.js","../../binding.core/src/checked.js","../../binding.core/src/html.js","../../binding.core/src/let.js","../../binding.core/src/selectedOptions.js","../../binding.core/src/submit.js","../../binding.core/src/text.js","../../binding.core/src/using.js","../../binding.template/src/index.js","../../binding.if/src/index.js","../../binding.component/src/index.js"],"sourcesContent":["//\n// Array utilities\n//\n// Note that the array functions may be called with\n// Array-like things, such as NodeList.\n\nconst {isArray} = Array\n\nexport function arrayForEach (array, action, thisArg) {\n if (arguments.length > 2) { action = action.bind(thisArg) }\n for (let i = 0, j = array.length; i < j; ++i) {\n action(array[i], i, array)\n }\n}\n\nexport function arrayIndexOf (array, item) {\n return (isArray(array) ? array : [...array]).indexOf(item)\n}\n\nexport function arrayFirst (array, predicate, predicateOwner) {\n return (isArray(array) ? array : [...array])\n .find(predicate, predicateOwner)\n}\n\nexport function arrayMap (array = [], mapping, thisArg) {\n if (arguments.length > 2) { mapping = mapping.bind(thisArg) }\n return array === null ? [] : Array.from(array, mapping)\n}\n\nexport function arrayRemoveItem (array, itemToRemove) {\n var index = arrayIndexOf(array, itemToRemove)\n if (index > 0) {\n array.splice(index, 1)\n } else if (index === 0) {\n array.shift()\n }\n}\n\nexport function arrayGetDistinctValues (array = []) {\n const seen = new Set()\n if (array === null) { return [] }\n return (isArray(array) ? array : [...array])\n .filter(item => seen.has(item) ? false : seen.add(item))\n}\n\nexport function arrayFilter (array, predicate, thisArg) {\n if (arguments.length > 2) { predicate = predicate.bind(thisArg) }\n return array === null ? [] : (isArray(array) ? array : [...array]).filter(predicate)\n}\n\nexport function arrayPushAll (array, valuesToPush) {\n if (isArray(valuesToPush)) {\n array.push.apply(array, valuesToPush)\n } else {\n for (var i = 0, j = valuesToPush.length; i < j; i++) { array.push(valuesToPush[i]) }\n }\n return array\n}\n\nexport function addOrRemoveItem (array, value, included) {\n var existingEntryIndex = arrayIndexOf(typeof array.peek === 'function' ? array.peek() : array, value)\n if (existingEntryIndex < 0) {\n if (included) { array.push(value) }\n } else {\n if (!included) { array.splice(existingEntryIndex, 1) }\n }\n}\n\nexport function makeArray (arrayLikeObject) {\n return Array.from(arrayLikeObject)\n}\n\nexport function range (min, max) {\n min = typeof min === 'function' ? min() : min\n max = typeof max === 'function' ? max() : max\n var result = []\n for (var i = min; i <= max; i++) { result.push(i) }\n return result\n}\n\n// Go through the items that have been added and deleted and try to find matches between them.\nexport function findMovesInArrayComparison (left, right, limitFailedCompares) {\n if (left.length && right.length) {\n var failedCompares, l, r, leftItem, rightItem\n for (failedCompares = l = 0; (!limitFailedCompares || failedCompares < limitFailedCompares) && (leftItem = left[l]); ++l) {\n for (r = 0; rightItem = right[r]; ++r) {\n if (leftItem.value === rightItem.value) {\n leftItem.moved = rightItem.index\n rightItem.moved = leftItem.index\n right.splice(r, 1) // This item is marked as moved; so remove it from right list\n failedCompares = r = 0 // Reset failed compares count because we're checking for consecutive failures\n break\n }\n }\n failedCompares += r\n }\n }\n}\n\nconst statusNotInOld = 'added'\nconst statusNotInNew = 'deleted'\n\n // Simple calculation based on Levenshtein distance.\nexport function compareArrays (oldArray, newArray, options) {\n // For backward compatibility, if the third arg is actually a bool, interpret\n // it as the old parameter 'dontLimitMoves'. Newer code should use { dontLimitMoves: true }.\n options = (typeof options === 'boolean') ? { dontLimitMoves: options } : (options || {})\n oldArray = oldArray || []\n newArray = newArray || []\n\n if (oldArray.length < newArray.length) { return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options) } else { return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options) }\n}\n\nfunction compareSmallArrayToBigArray (smlArray, bigArray, statusNotInSml, statusNotInBig, options) {\n var myMin = Math.min,\n myMax = Math.max,\n editDistanceMatrix = [],\n smlIndex, smlIndexMax = smlArray.length,\n bigIndex, bigIndexMax = bigArray.length,\n compareRange = (bigIndexMax - smlIndexMax) || 1,\n maxDistance = smlIndexMax + bigIndexMax + 1,\n thisRow, lastRow,\n bigIndexMaxForRow, bigIndexMinForRow\n\n for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) {\n lastRow = thisRow\n editDistanceMatrix.push(thisRow = [])\n bigIndexMaxForRow = myMin(bigIndexMax, smlIndex + compareRange)\n bigIndexMinForRow = myMax(0, smlIndex - 1)\n for (bigIndex = bigIndexMinForRow; bigIndex <= bigIndexMaxForRow; bigIndex++) {\n if (!bigIndex) {\n thisRow[bigIndex] = smlIndex + 1\n } else if (!smlIndex) {\n // Top row - transform empty array into new array via additions\n thisRow[bigIndex] = bigIndex + 1\n } else if (smlArray[smlIndex - 1] === bigArray[bigIndex - 1]) {\n thisRow[bigIndex] = lastRow[bigIndex - 1]\n } else { // copy value (no edit)\n var northDistance = lastRow[bigIndex] || maxDistance // not in big (deletion)\n var westDistance = thisRow[bigIndex - 1] || maxDistance // not in small (addition)\n thisRow[bigIndex] = myMin(northDistance, westDistance) + 1\n }\n }\n }\n\n var editScript = [], meMinusOne, notInSml = [], notInBig = []\n for (smlIndex = smlIndexMax, bigIndex = bigIndexMax; smlIndex || bigIndex;) {\n meMinusOne = editDistanceMatrix[smlIndex][bigIndex] - 1\n if (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex - 1]) {\n notInSml.push(editScript[editScript.length] = { // added\n 'status': statusNotInSml,\n 'value': bigArray[--bigIndex],\n 'index': bigIndex })\n } else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) {\n notInBig.push(editScript[editScript.length] = { // deleted\n 'status': statusNotInBig,\n 'value': smlArray[--smlIndex],\n 'index': smlIndex })\n } else {\n --bigIndex\n --smlIndex\n if (!options.sparse) {\n editScript.push({\n 'status': 'retained',\n 'value': bigArray[bigIndex] })\n }\n }\n }\n\n // Set a limit on the number of consecutive non-matching comparisons; having it a multiple of\n // smlIndexMax keeps the time complexity of this algorithm linear.\n findMovesInArrayComparison(notInBig, notInSml, !options.dontLimitMoves && smlIndexMax * 10)\n\n return editScript.reverse()\n}\n","//\n// Error handling\n// ---\n//\n// The default onError handler is to re-throw.\nimport options from './options.js'\n\nexport function catchFunctionErrors (delegate) {\n if (!options.onError) { return delegate }\n return (...args) => {\n try {\n return delegate(...args)\n } catch (err) {\n options.onError(err)\n }\n }\n}\n\nexport function deferError (error) {\n safeSetTimeout(function () { throw error }, 0)\n}\n\nexport function safeSetTimeout (handler, timeout) {\n return setTimeout(catchFunctionErrors(handler), timeout)\n}\n","//\n// Asynchronous functionality\n// ---\nimport { safeSetTimeout } from './error.js'\n\nexport function throttle (callback, timeout) {\n var timeoutInstance\n return function (...args) {\n if (!timeoutInstance) {\n timeoutInstance = safeSetTimeout(function () {\n timeoutInstance = undefined\n callback(...args)\n }, timeout)\n }\n }\n}\n\nexport function debounce (callback, timeout) {\n var timeoutInstance\n return function (...args) {\n clearTimeout(timeoutInstance)\n timeoutInstance = safeSetTimeout(() => callback(...args), timeout)\n }\n}\n","//\n// Object functions\n//\n\nexport function hasOwnProperty(obj, propName) {\n return Object.prototype.hasOwnProperty.call(obj, propName)\n}\n\nexport function extend (target, source) {\n if (source) {\n for (var prop in source) {\n if (hasOwnProperty(source, prop)) {\n target[prop] = source[prop]\n }\n }\n }\n return target\n}\n\nexport function objectForEach (obj, action) {\n for (var prop in obj) {\n if (hasOwnProperty(obj, prop)) {\n action(prop, obj[prop])\n }\n }\n}\n\nexport function objectMap (source, mapping, thisArg) {\n if (!source) { return source }\n if (arguments.length > 2) { mapping = mapping.bind(thisArg) }\n var target = {}\n for (var prop in source) {\n if (hasOwnProperty(source, prop)) {\n target[prop] = mapping(source[prop], prop, source)\n }\n }\n return target\n}\nexport function getObjectOwnProperty (obj, propName) {\n return hasOwnProperty(obj, propName) ? obj[propName] : undefined\n}\n\nexport function clonePlainObjectDeep (obj, seen) {\n if (!seen) { seen = [] }\n\n if (!obj || typeof obj !== 'object' ||\n obj.constructor !== Object ||\n seen.indexOf(obj) !== -1) {\n return obj\n }\n\n // Anything that makes it below is a plain object that has not yet\n // been seen/cloned.\n seen.push(obj)\n\n var result = {}\n for (var prop in obj) {\n if (hasOwnProperty(obj, prop)) {\n result[prop] = clonePlainObjectDeep(obj[prop], seen)\n }\n }\n return result\n}\n\n/**\n * JSON.stringify, but inserts `...` for objects that are referenced\n * multiple times, preventing infinite recursion.\n */\nexport function safeStringify (value) {\n const seen = new Set()\n return JSON.stringify(value, (k, v) => {\n if (seen.has(v)) { return '...' }\n if (typeof v === 'object') { seen.add(v) }\n return v\n })\n}\n\n\n/**\n * Promises/A+ compliant isThenable (per section 1.2)\n */\nexport function isThenable (object) {\n const objectType = typeof object\n const thenableType = objectType === 'object' || objectType === 'function'\n return thenableType && object !== null && typeof object.then === 'function'\n}\n","\nfunction testOverwrite () {\n try {\n Object.defineProperty(function x () {}, 'length', {})\n return true\n } catch (e) {\n return false\n }\n}\n\nexport const functionSupportsLengthOverwrite = testOverwrite()\n\nexport function overwriteLengthPropertyIfSupported (fn, descriptor) {\n if (functionSupportsLengthOverwrite) {\n Object.defineProperty(fn, 'length', descriptor)\n }\n}\n","//\n// String (and JSON)\n//\n\nexport function stringTrim (string) {\n return string === null || string === undefined ? ''\n : string.trim\n ? string.trim()\n : string.toString().replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g, '')\n}\n\nexport function stringStartsWith (string, startsWith) {\n string = string || ''\n if (startsWith.length > string.length) { return false }\n return string.substring(0, startsWith.length) === startsWith\n}\n\nexport function parseJson (jsonString) {\n if (typeof jsonString === 'string') {\n jsonString = stringTrim(jsonString)\n if (jsonString) {\n if (JSON && JSON.parse) // Use native parsing where available\n { return JSON.parse(jsonString) }\n return (new Function('return ' + jsonString))() // Fallback on less safe parsing for older browsers\n }\n }\n return null\n}\n","//\n// ES6 Symbols\n//\n\nexport var useSymbols = typeof Symbol === 'function'\n\nexport function createSymbolOrString (identifier) {\n return useSymbols ? Symbol(identifier) : identifier\n}\n","//\n// DOM - CSS\n//\n\nimport { arrayForEach, addOrRemoveItem } from './array.js'\n\n// For details on the pattern for changing node classes\n// see: https://github.com/knockout/knockout/issues/1597\nvar cssClassNameRegex = /\\S+/g\n\nfunction toggleDomNodeCssClass (node, classNames, shouldHaveClass) {\n var addOrRemoveFn\n if (!classNames) { return }\n if (typeof node.classList === 'object') {\n addOrRemoveFn = node.classList[shouldHaveClass ? 'add' : 'remove']\n arrayForEach(classNames.match(cssClassNameRegex), function (className) {\n addOrRemoveFn.call(node.classList, className)\n })\n } else if (typeof node.className['baseVal'] === 'string') {\n // SVG tag .classNames is an SVGAnimatedString instance\n toggleObjectClassPropertyString(node.className, 'baseVal', classNames, shouldHaveClass)\n } else {\n // node.className ought to be a string.\n toggleObjectClassPropertyString(node, 'className', classNames, shouldHaveClass)\n }\n}\n\nfunction toggleObjectClassPropertyString (obj, prop, classNames, shouldHaveClass) {\n // obj/prop is either a node/'className' or a SVGAnimatedString/'baseVal'.\n var currentClassNames = obj[prop].match(cssClassNameRegex) || []\n arrayForEach(classNames.match(cssClassNameRegex), function (className) {\n addOrRemoveItem(currentClassNames, className, shouldHaveClass)\n })\n obj[prop] = currentClassNames.join(' ')\n}\n\nexport { toggleDomNodeCssClass }\n","//\n// Information about the DOM\n//\nimport { arrayFirst } from '../array.js'\n\nexport function domNodeIsContainedBy (node, containedByNode) {\n if (node === containedByNode) { return true }\n if (node.nodeType === 11) { return false } // Fixes issue #1162 - can't use node.contains for document fragments on IE8\n if (containedByNode.contains) { return containedByNode.contains(node.nodeType !== 1 ? node.parentNode : node) }\n if (containedByNode.compareDocumentPosition) { return (containedByNode.compareDocumentPosition(node) & 16) == 16 }\n while (node && node != containedByNode) {\n node = node.parentNode\n }\n return !!node\n}\n\nexport function domNodeIsAttachedToDocument (node) {\n return domNodeIsContainedBy(node, node.ownerDocument.documentElement)\n}\n\nexport function anyDomNodeIsAttachedToDocument (nodes) {\n return !!arrayFirst(nodes, domNodeIsAttachedToDocument)\n}\n\nexport function tagNameLower (element) {\n // For HTML elements, tagName will always be upper case; for XHTML elements, it'll be lower case.\n // Possible future optimization: If we know it's an element from an XHTML document (not HTML),\n // we don't need to do the .toLowerCase() as it will always be lower case anyway.\n return element && element.tagName && element.tagName.toLowerCase()\n}\n\nexport function isDomElement (obj) {\n if (window.HTMLElement) {\n return obj instanceof HTMLElement\n } else {\n return obj && obj.tagName && obj.nodeType === 1\n }\n}\n\nexport function isDocumentFragment (obj) {\n if (window.DocumentFragment) {\n return obj instanceof DocumentFragment\n } else {\n return obj && obj.nodeType === 11\n }\n}\n","//\n// DOM node data\n//\nimport { ieVersion } from '../ie'\n\nconst datastoreTime = new Date().getTime()\nconst dataStoreKeyExpandoPropertyName = `__ko__${datastoreTime}`\nconst dataStoreSymbol = Symbol('Knockout data')\nvar dataStore\nlet uniqueId = 0\n\n/*\n * We considered using WeakMap, but it has a problem in IE 11 and Edge that\n * prevents using it cross-window, so instead we just store the data directly\n * on the node. See https://github.com/knockout/knockout/issues/2141\n */\nconst modern = {\n getDataForNode (node, createIfNotFound) {\n let dataForNode = node[dataStoreSymbol]\n if (!dataForNode && createIfNotFound) {\n dataForNode = node[dataStoreSymbol] = {}\n }\n return dataForNode\n },\n\n clear (node) {\n if (node[dataStoreSymbol]) {\n delete node[dataStoreSymbol]\n return true\n }\n return false\n }\n}\n\n/**\n * Old IE versions have memory issues if you store objects on the node, so we\n * use a separate data storage and link to it from the node using a string key.\n */\nconst IE = {\n getDataforNode (node, createIfNotFound) {\n let dataStoreKey = node[dataStoreKeyExpandoPropertyName]\n const hasExistingDataStore = dataStoreKey && (dataStoreKey !== 'null') && dataStore[dataStoreKey]\n if (!hasExistingDataStore) {\n if (!createIfNotFound) {\n return undefined\n }\n dataStoreKey = node[dataStoreKeyExpandoPropertyName] = 'ko' + uniqueId++\n dataStore[dataStoreKey] = {}\n }\n return dataStore[dataStoreKey]\n },\n\n clear (node) {\n const dataStoreKey = node[dataStoreKeyExpandoPropertyName]\n if (dataStoreKey) {\n delete dataStore[dataStoreKey]\n node[dataStoreKeyExpandoPropertyName] = null\n return true // Exposing 'did clean' flag purely so specs can infer whether things have been cleaned up as intended\n }\n return false\n }\n}\n\nconst {getDataForNode, clear} = ieVersion ? IE : modern\n\n/**\n * Create a unique key-string identifier.\n */\nexport function nextKey () {\n return (uniqueId++) + dataStoreKeyExpandoPropertyName\n}\n\nfunction get (node, key) {\n const dataForNode = getDataForNode(node, false)\n return dataForNode && dataForNode[key]\n}\n\nfunction set (node, key, value) {\n // Make sure we don't actually create a new domData key if we are actually deleting a value\n var dataForNode = getDataForNode(node, value !== undefined /* createIfNotFound */)\n dataForNode && (dataForNode[key] = value)\n}\n\nfunction getOrSet (node, key, value) {\n const dataForNode = getDataForNode(node, true, /* createIfNotFound */)\n return dataForNode[key] || (dataForNode[key] = value)\n}\n\nexport { get, set, getOrSet, clear }\n","//\n// DOM node disposal\n//\n/* eslint no-cond-assign: 0 */\nimport * as domData from './data.js'\nimport { default as options } from '../options.js'\nimport {arrayRemoveItem, arrayIndexOf} from '../array.js'\nimport {jQueryInstance} from '../jquery.js'\n\nvar domDataKey = domData.nextKey()\n// Node types:\n// 1: Element\n// 8: Comment\n// 9: Document\nvar cleanableNodeTypes = { 1: true, 8: true, 9: true }\nvar cleanableNodeTypesWithDescendants = { 1: true, 9: true }\n\nfunction getDisposeCallbacksCollection (node, createIfNotFound) {\n var allDisposeCallbacks = domData.get(node, domDataKey)\n if ((allDisposeCallbacks === undefined) && createIfNotFound) {\n allDisposeCallbacks = []\n domData.set(node, domDataKey, allDisposeCallbacks)\n }\n return allDisposeCallbacks\n}\nfunction destroyCallbacksCollection (node) {\n domData.set(node, domDataKey, undefined)\n}\n\nfunction cleanSingleNode (node) {\n // Run all the dispose callbacks\n var callbacks = getDisposeCallbacksCollection(node, false)\n if (callbacks) {\n callbacks = callbacks.slice(0) // Clone, as the array may be modified during iteration (typically, callbacks will remove themselves)\n for (let i = 0; i < callbacks.length; i++) { callbacks[i](node) }\n }\n\n // Erase the DOM data\n domData.clear(node)\n\n // Perform cleanup needed by external libraries (currently only jQuery, but can be extended)\n for (let i = 0, j = otherNodeCleanerFunctions.length; i < j; ++i) {\n otherNodeCleanerFunctions[i](node)\n }\n\n if (options.cleanExternalData) {\n options.cleanExternalData(node)\n }\n\n // Clear any immediate-child comment nodes, as these wouldn't have been found by\n // node.getElementsByTagName('*') in cleanNode() (comment nodes aren't elements)\n if (cleanableNodeTypesWithDescendants[node.nodeType]) {\n cleanNodesInList(node.childNodes, true /* onlyComments */)\n }\n}\n\nfunction cleanNodesInList (nodeList, onlyComments) {\n const cleanedNodes = []\n let lastCleanedNode\n for (var i = 0; i < nodeList.length; i++) {\n if (!onlyComments || nodeList[i].nodeType === 8) {\n cleanSingleNode(cleanedNodes[cleanedNodes.length] = lastCleanedNode = nodeList[i]);\n if (nodeList[i] !== lastCleanedNode) {\n while (i-- && arrayIndexOf(cleanedNodes, nodeList[i]) === -1) {}\n }\n }\n }\n}\n\n// Exports\nexport function addDisposeCallback (node, callback) {\n if (typeof callback !== 'function') { throw new Error('Callback must be a function') }\n getDisposeCallbacksCollection(node, true).push(callback)\n}\n\nexport function removeDisposeCallback (node, callback) {\n var callbacksCollection = getDisposeCallbacksCollection(node, false)\n if (callbacksCollection) {\n arrayRemoveItem(callbacksCollection, callback)\n if (callbacksCollection.length === 0) { destroyCallbacksCollection(node) }\n }\n}\n\nexport function cleanNode (node) {\n // First clean this node, where applicable\n if (cleanableNodeTypes[node.nodeType]) {\n cleanSingleNode(node)\n\n // ... then its descendants, where applicable\n if (cleanableNodeTypesWithDescendants[node.nodeType]) {\n cleanNodesInList(node.getElementsByTagName(\"*\"))\n }\n }\n return node\n}\n\nexport function removeNode (node) {\n cleanNode(node)\n if (node.parentNode) { node.parentNode.removeChild(node) }\n}\n\n// Expose supplemental node cleaning functions.\nexport const otherNodeCleanerFunctions = []\n\nexport function addCleaner (fn) {\n otherNodeCleanerFunctions.push(fn)\n}\n\nexport function removeCleaner (fn) {\n const fnIndex = otherNodeCleanerFunctions.indexOf(fn)\n if (fnIndex >= 0) { otherNodeCleanerFunctions.splice(fnIndex, 1) }\n}\n\n// Special support for jQuery here because it's so commonly used.\n// Many jQuery plugins (including jquery.tmpl) store data using jQuery's equivalent of domData\n// so notify it to tear down any resources associated with the node & descendants here.\nexport function cleanjQueryData (node) {\n var jQueryCleanNodeFn = jQueryInstance ? jQueryInstance.cleanData : null\n\n if (jQueryCleanNodeFn) {\n jQueryCleanNodeFn([node])\n }\n}\n\notherNodeCleanerFunctions.push(cleanjQueryData)\n","//\n// DOM Events\n//\n\nimport { objectForEach } from '../object.js'\nimport { jQueryInstance } from '../jquery.js'\nimport { ieVersion } from '../ie.js'\nimport { catchFunctionErrors } from '../error.js'\n\nimport { tagNameLower } from './info.js'\nimport { addDisposeCallback } from './disposal.js'\nimport options from '../options.js'\n\n// Represent the known event types in a compact way, then at runtime transform it into a hash with event name as key (for fast lookup)\nvar knownEvents = {},\n knownEventTypesByEventName = {}\n\nvar keyEventTypeName = (options.global.navigator && /Firefox\\/2/i.test(options.global.navigator.userAgent)) ? 'KeyboardEvent' : 'UIEvents'\n\nknownEvents[keyEventTypeName] = ['keyup', 'keydown', 'keypress']\n\nknownEvents['MouseEvents'] = [\n 'click', 'dblclick', 'mousedown', 'mouseup', 'mousemove', 'mouseover',\n 'mouseout', 'mouseenter', 'mouseleave']\n\nobjectForEach(knownEvents, function (eventType, knownEventsForType) {\n if (knownEventsForType.length) {\n for (var i = 0, j = knownEventsForType.length; i < j; i++) { knownEventTypesByEventName[knownEventsForType[i]] = eventType }\n }\n})\n\nfunction isClickOnCheckableElement (element, eventType) {\n if ((tagNameLower(element) !== 'input') || !element.type) return false\n if (eventType.toLowerCase() != 'click') return false\n var inputType = element.type\n return (inputType == 'checkbox') || (inputType == 'radio')\n}\n\n// Workaround for an IE9 issue - https://github.com/SteveSanderson/knockout/issues/406\nvar eventsThatMustBeRegisteredUsingAttachEvent = { 'propertychange': true }\nlet jQueryEventAttachName\n\nexport function registerEventHandler (element, eventType, handler, eventOptions = false) {\n const wrappedHandler = catchFunctionErrors(handler)\n const mustUseAttachEvent = ieVersion && eventsThatMustBeRegisteredUsingAttachEvent[eventType]\n const mustUseNative = Boolean(eventOptions)\n\n if (!options.useOnlyNativeEvents && !mustUseAttachEvent && !mustUseNative && jQueryInstance) {\n if (!jQueryEventAttachName) {\n jQueryEventAttachName = (typeof jQueryInstance(element).on === 'function') ? 'on' : 'bind'\n }\n jQueryInstance(element)[jQueryEventAttachName](eventType, wrappedHandler)\n } else if (!mustUseAttachEvent && typeof element.addEventListener === 'function') {\n element.addEventListener(eventType, wrappedHandler, eventOptions)\n } else if (typeof element.attachEvent !== 'undefined') {\n const attachEventHandler = function (event) { wrappedHandler.call(element, event) }\n const attachEventName = 'on' + eventType\n element.attachEvent(attachEventName, attachEventHandler)\n\n // IE does not dispose attachEvent handlers automatically (unlike with addEventListener)\n // so to avoid leaks, we have to remove them manually. See bug #856\n addDisposeCallback(element, function () {\n element.detachEvent(attachEventName, attachEventHandler)\n })\n } else {\n throw new Error(\"Browser doesn't support addEventListener or attachEvent\")\n }\n}\n\nexport function triggerEvent (element, eventType) {\n if (!(element && element.nodeType)) { throw new Error('element must be a DOM node when calling triggerEvent') }\n\n // For click events on checkboxes and radio buttons, jQuery toggles the element checked state *after* the\n // event handler runs instead of *before*. (This was fixed in 1.9 for checkboxes but not for radio buttons.)\n // IE doesn't change the checked state when you trigger the click event using \"fireEvent\".\n // In both cases, we'll use the click method instead.\n var useClickWorkaround = isClickOnCheckableElement(element, eventType)\n\n if (!options.useOnlyNativeEvents && jQueryInstance && !useClickWorkaround) {\n jQueryInstance(element).trigger(eventType)\n } else if (typeof document.createEvent === 'function') {\n if (typeof element.dispatchEvent === 'function') {\n var eventCategory = knownEventTypesByEventName[eventType] || 'HTMLEvents'\n var event = document.createEvent(eventCategory)\n event.initEvent(eventType, true, true, options.global, 0, 0, 0, 0, 0, false, false, false, false, 0, element)\n element.dispatchEvent(event)\n } else { throw new Error(\"The supplied element doesn't support dispatchEvent\") }\n } else if (useClickWorkaround && element.click) {\n element.click()\n } else if (typeof element.fireEvent !== 'undefined') {\n element.fireEvent('on' + eventType)\n } else {\n throw new Error(\"Browser doesn't support triggering events\")\n }\n}\n","//\n// DOM manipulation\n//\n/* eslint no-empty: 0 */\nimport { makeArray } from '../array.js'\nimport { ieVersion } from '../ie.js'\nimport { cleanNode, removeNode } from './disposal.js'\n\nexport function moveCleanedNodesToContainerElement (nodes) {\n // Ensure it's a real array, as we're about to reparent the nodes and\n // we don't want the underlying collection to change while we're doing that.\n var nodesArray = makeArray(nodes)\n var templateDocument = (nodesArray[0] && nodesArray[0].ownerDocument) || document\n\n var container = templateDocument.createElement('div')\n for (var i = 0, j = nodesArray.length; i < j; i++) {\n container.appendChild(cleanNode(nodesArray[i]))\n }\n return container\n}\n\nexport function cloneNodes (nodesArray, shouldCleanNodes) {\n for (var i = 0, j = nodesArray.length, newNodesArray = []; i < j; i++) {\n var clonedNode = nodesArray[i].cloneNode(true)\n newNodesArray.push(shouldCleanNodes ? cleanNode(clonedNode) : clonedNode)\n }\n return newNodesArray\n}\n\nexport function setDomNodeChildren (domNode, childNodes) {\n emptyDomNode(domNode)\n if (childNodes) {\n for (var i = 0, j = childNodes.length; i < j; i++) { domNode.appendChild(childNodes[i]) }\n }\n}\n\nexport function replaceDomNodes (nodeToReplaceOrNodeArray, newNodesArray) {\n var nodesToReplaceArray = nodeToReplaceOrNodeArray.nodeType ? [nodeToReplaceOrNodeArray] : nodeToReplaceOrNodeArray\n if (nodesToReplaceArray.length > 0) {\n var insertionPoint = nodesToReplaceArray[0]\n var parent = insertionPoint.parentNode\n for (var i = 0, j = newNodesArray.length; i < j; i++) { parent.insertBefore(newNodesArray[i], insertionPoint) }\n for (i = 0, j = nodesToReplaceArray.length; i < j; i++) {\n removeNode(nodesToReplaceArray[i])\n }\n }\n}\n\nexport function setElementName (element, name) {\n element.name = name\n\n // Workaround IE 6/7 issue\n // - https://github.com/SteveSanderson/knockout/issues/197\n // - http://www.matts411.com/post/setting_the_name_attribute_in_ie_dom/\n if (ieVersion <= 7) {\n try {\n element.mergeAttributes(document.createElement(\"<input name='\" + element.name + \"'/>\"), false)\n } catch (e) {} // For IE9 with doc mode \"IE9 Standards\" and browser mode \"IE9 Compatibility View\"\n }\n}\n\nexport function emptyDomNode (domNode) {\n while (domNode.firstChild) {\n removeNode(domNode.firstChild)\n }\n}\n","//\n// DOM node manipulation\n//\nimport { ieVersion } from '../ie.js'\n\nexport function fixUpContinuousNodeArray (continuousNodeArray, parentNode) {\n // Before acting on a set of nodes that were previously outputted by a template function, we have to reconcile\n // them against what is in the DOM right now. It may be that some of the nodes have already been removed, or that\n // new nodes might have been inserted in the middle, for example by a binding. Also, there may previously have been\n // leading comment nodes (created by rewritten string-based templates) that have since been removed during binding.\n // So, this function translates the old \"map\" output array into its best guess of the set of current DOM nodes.\n //\n // Rules:\n // [A] Any leading nodes that have been removed should be ignored\n // These most likely correspond to memoization nodes that were already removed during binding\n // See https://github.com/knockout/knockout/pull/440\n // [B] Any trailing nodes that have been remove should be ignored\n // This prevents the code here from adding unrelated nodes to the array while processing rule [C]\n // See https://github.com/knockout/knockout/pull/1903\n // [C] We want to output a continuous series of nodes. So, ignore any nodes that have already been removed,\n // and include any nodes that have been inserted among the previous collection\n\n if (continuousNodeArray.length) {\n // The parent node can be a virtual element; so get the real parent node\n parentNode = (parentNode.nodeType === 8 && parentNode.parentNode) || parentNode\n\n // Rule [A]\n while (continuousNodeArray.length && continuousNodeArray[0].parentNode !== parentNode) { continuousNodeArray.splice(0, 1) }\n\n // Rule [B]\n while (continuousNodeArray.length > 1 && continuousNodeArray[continuousNodeArray.length - 1].parentNode !== parentNode) { continuousNodeArray.length-- }\n\n // Rule [C]\n if (continuousNodeArray.length > 1) {\n var current = continuousNodeArray[0], last = continuousNodeArray[continuousNodeArray.length - 1]\n // Replace with the actual new continuous node set\n continuousNodeArray.length = 0\n while (current !== last) {\n continuousNodeArray.push(current)\n current = current.nextSibling\n }\n continuousNodeArray.push(last)\n }\n }\n return continuousNodeArray\n}\n\nexport function setOptionNodeSelectionState (optionNode, isSelected) {\n // IE6 sometimes throws \"unknown error\" if you try to write to .selected directly, whereas Firefox struggles with setAttribute. Pick one based on browser.\n if (ieVersion < 7) { optionNode.setAttribute('selected', isSelected) } else { optionNode.selected = isSelected }\n}\n\nexport function forceRefresh (node) {\n // Workaround for an IE9 rendering bug - https://github.com/SteveSanderson/knockout/issues/209\n if (ieVersion >= 9) {\n // For text nodes and comment nodes (most likely virtual elements), we will have to refresh the container\n var elem = node.nodeType == 1 ? node : node.parentNode\n if (elem.style) { elem.style.zoom = elem.style.zoom }\n }\n}\n\nexport function ensureSelectElementIsRenderedCorrectly (selectElement) {\n // Workaround for IE9 rendering bug - it doesn't reliably display all the text in dynamically-added select boxes unless you force it to re-render by updating the width.\n // (See https://github.com/SteveSanderson/knockout/issues/312, http://stackoverflow.com/questions/5908494/select-only-shows-first-char-of-selected-option)\n // Also fixes IE7 and IE8 bug that causes selects to be zero width if enclosed by 'if' or 'with'. (See issue #839)\n if (ieVersion) {\n var originalWidth = selectElement.style.width\n selectElement.style.width = 0\n selectElement.style.width = originalWidth\n }\n}\n","/* eslint no-cond-assign: 0 */\n//\n// Virtual Elements\n//\n//\n// \"Virtual elements\" is an abstraction on top of the usual DOM API which understands the notion that comment nodes\n// may be used to represent hierarchy (in addition to the DOM's natural hierarchy).\n// If you call the DOM-manipulating functions on ko.virtualElements, you will be able to read and write the state\n// of that virtual hierarchy\n//\n// The point of all this is to support containerless templates (e.g., <!-- ko foreach:someCollection -->blah<!-- /ko -->)\n// without having to scatter special cases all over the binding and templating code.\n\n// IE 9 cannot reliably read the \"nodeValue\" property of a comment node (see https://github.com/SteveSanderson/knockout/issues/186)\n// but it does give them a nonstandard alternative property called \"text\" that it can read reliably. Other browsers don't have that property.\n// So, use node.text where available, and node.nodeValue elsewhere\nimport { emptyDomNode, setDomNodeChildren as setRegularDomNodeChildren } from './manipulation.js'\nimport { removeNode } from './disposal.js'\nimport { tagNameLower } from './info.js'\nimport * as domData from './data'\nimport options from '../options'\n\nvar commentNodesHaveTextProperty = options.document && options.document.createComment('test').text === '<!--test-->'\n\nexport var startCommentRegex = commentNodesHaveTextProperty ? /^<!--\\s*ko(?:\\s+([\\s\\S]+))?\\s*-->$/ : /^\\s*ko(?:\\s+([\\s\\S]+))?\\s*$/\nexport var endCommentRegex = commentNodesHaveTextProperty ? /^<!--\\s*\\/ko\\s*-->$/ : /^\\s*\\/ko\\s*$/\nvar htmlTagsWithOptionallyClosingChildren = { 'ul': true, 'ol': true }\n\nexport function isStartComment (node) {\n return (node.nodeType == 8) && startCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue)\n}\n\nexport function isEndComment (node) {\n return (node.nodeType == 8) && endCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue)\n}\n\nfunction isUnmatchedEndComment (node) {\n return isEndComment(node) && !domData.get(node, matchedEndCommentDataKey)\n}\n\nconst matchedEndCommentDataKey = '__ko_matchedEndComment__'\n\nexport function getVirtualChildren (startComment, allowUnbalanced) {\n var currentNode = startComment\n var depth = 1\n var children = []\n while (currentNode = currentNode.nextSibling) {\n if (isEndComment(currentNode)) {\n domData.set(currentNode, matchedEndCommentDataKey, true)\n depth--\n if (depth === 0) { return children }\n }\n\n children.push(currentNode)\n\n if (isStartComment(currentNode)) { depth++ }\n }\n if (!allowUnbalanced) { throw new Error('Cannot find closing comment tag to match: ' + startComment.nodeValue) }\n return null\n}\n\nfunction getMatchingEndComment (startComment, allowUnbalanced) {\n var allVirtualChildren = getVirtualChildren(startComment, allowUnbalanced)\n if (allVirtualChildren) {\n if (allVirtualChildren.length > 0) { return allVirtualChildren[allVirtualChildren.length - 1].nextSibling }\n return startComment.nextSibling\n } else { return null } // Must have no matching end comment, and allowUnbalanced is true\n}\n\nfunction getUnbalancedChildTags (node) {\n // e.g., from <div>OK</div><!-- ko blah --><span>Another</span>, returns: <!-- ko blah --><span>Another</span>\n // from <div>OK</div><!-- /ko --><!-- /ko -->, returns: <!-- /ko --><!-- /ko -->\n var childNode = node.firstChild, captureRemaining = null\n if (childNode) {\n do {\n if (captureRemaining) // We already hit an unbalanced node and are now just scooping up all subsequent nodes\n { captureRemaining.push(childNode) } else if (isStartComment(childNode)) {\n var matchingEndComment = getMatchingEndComment(childNode, /* allowUnbalanced: */ true)\n if (matchingEndComment) // It's a balanced tag, so skip immediately to the end of this virtual set\n { childNode = matchingEndComment } else { captureRemaining = [childNode] } // It's unbalanced, so start capturing from this point\n } else if (isEndComment(childNode)) {\n captureRemaining = [childNode] // It's unbalanced (if it wasn't, we'd have skipped over it already), so start capturing\n }\n } while (childNode = childNode.nextSibling)\n }\n return captureRemaining\n}\n\nexport var allowedBindings = {}\nexport var hasBindingValue = isStartComment\n\nexport function childNodes (node) {\n return isStartComment(node) ? getVirtualChildren(node) : node.childNodes\n}\n\nexport function emptyNode (node) {\n if (!isStartComment(node)) { emptyDomNode(node) } else {\n var virtualChildren = childNodes(node)\n for (var i = 0, j = virtualChildren.length; i < j; i++) { removeNode(virtualChildren[i]) }\n }\n}\n\nexport function setDomNodeChildren (node, childNodes) {\n if (!isStartComment(node)) { setRegularDomNodeChildren(node, childNodes) } else {\n emptyNode(node)\n const endCommentNode = node.nextSibling // Must be the next sibling, as we just emptied the children\n const parentNode = endCommentNode.parentNode\n for (var i = 0, j = childNodes.length; i < j; ++i) {\n parentNode.insertBefore(childNodes[i], endCommentNode)\n }\n }\n}\n\nexport function prepend (containerNode, nodeToPrepend) {\n if (!isStartComment(containerNode)) {\n if (containerNode.firstChild) { containerNode.insertBefore(nodeToPrepend, containerNode.firstChild) } else { containerNode.appendChild(nodeToPrepend) }\n } else {\n // Start comments must always have a parent and at least one following sibling (the end comment)\n containerNode.parentNode.insertBefore(nodeToPrepend, containerNode.nextSibling)\n }\n}\n\nexport function insertAfter (containerNode, nodeToInsert, insertAfterNode) {\n if (!insertAfterNode) {\n prepend(containerNode, nodeToInsert)\n } else if (!isStartComment(containerNode)) {\n // Insert after insertion point\n if (insertAfterNode.nextSibling) { containerNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling) } else { containerNode.appendChild(nodeToInsert) }\n } else {\n // Children of start comments must always have a parent and at least one following sibling (the end comment)\n containerNode.parentNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling)\n }\n}\n\nexport function firstChild (node) {\n if (!isStartComment(node)) {\n if (node.firstChild && isEndComment(node.firstChild)) {\n throw new Error('Found invalid end comment, as the first child of ' + node.outerHTML)\n }\n return node.firstChild\n }\n if (!node.nextSibling || isEndComment(node.nextSibling)) {\n return null\n }\n return node.nextSibling\n}\n\nexport function lastChild (node) {\n let nextChild = firstChild(node)\n let lastChildNode\n\n do {\n lastChildNode = nextChild\n } while (nextChild = nextSibling(nextChild))\n\n return lastChildNode\n}\n\nexport function nextSibling (node) {\n if (isStartComment(node)) {\n node = getMatchingEndComment(node)\n }\n\n if (node.nextSibling && isEndComment(node.nextSibling)) {\n if (isUnmatchedEndComment(node.nextSibling)) {\n throw Error('Found end comment without a matching opening comment, as next sibling of ' + node.outerHTML)\n }\n return null\n } else {\n return node.nextSibling\n }\n}\n\nexport function previousSibling (node) {\n var depth = 0\n do {\n if (node.nodeType === 8) {\n if (isStartComment(node)) {\n if (--depth === 0) {\n return node\n }\n } else if (isEndComment(node)) {\n depth++\n }\n } else {\n if (depth === 0) { return node }\n }\n } while (node = node.previousSibling)\n}\n\nexport function virtualNodeBindingValue (node) {\n var regexMatch = (commentNodesHaveTextProperty ? node.text : node.nodeValue).match(startCommentRegex)\n return regexMatch ? regexMatch[1] : null\n}\n\nexport function normaliseVirtualElementDomStructure (elementVerified) {\n // Workaround for https://github.com/SteveSanderson/knockout/issues/155\n // (IE <= 8 or IE 9 quirks mode parses your HTML weirdly, treating closing </li> tags as if they don't exist, thereby moving comment nodes\n // that are direct descendants of <ul> into the preceding <li>)\n if (!htmlTagsWithOptionallyClosingChildren[tagNameLower(elementVerified)]) { return }\n\n // Scan immediate children to see if they contain unbalanced comment tags. If they do, those comment tags\n // must be intended to appear *after* that child, so move them there.\n var childNode = elementVerified.firstChild\n if (childNode) {\n do {\n if (childNode.nodeType === 1) {\n var unbalancedTags = getUnbalancedChildTags(childNode)\n if (unbalancedTags) {\n // Fix up the DOM by moving the unbalanced tags to where they most likely were intended to be placed - *after* the child\n var nodeToInsertBefore = childNode.nextSibling\n for (var i = 0; i < unbalancedTags.length; i++) {\n if (nodeToInsertBefore) { elementVerified.insertBefore(unbalancedTags[i], nodeToInsertBefore) } else { elementVerified.appendChild(unbalancedTags[i]) }\n }\n }\n }\n } while (childNode = childNode.nextSibling)\n }\n}\n","//\n// HTML-based manipulation\n//\nimport { stringTrim } from '../string.js'\nimport { makeArray } from '../array.js'\nimport { emptyDomNode, moveCleanedNodesToContainerElement } from './manipulation.js'\nimport { jQueryInstance } from '../jquery.js'\nimport { forceRefresh } from './fixes.js'\nimport * as virtualElements from './virtualElements'\nimport options from '../options'\n\nvar none = [0, '', ''],\n table = [1, '<table>', '</table>'],\n tbody = [2, '<table><tbody>', '</tbody></table>'],\n colgroup = [ 2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],\n tr = [3, '<table><tbody><tr>', '</tr></tbody></table>'],\n select = [1, \"<select multiple='multiple'>\", '</select>'],\n fieldset = [1, '<fieldset>', '</fieldset>'],\n map = [1, '<map>', '</map>'],\n object = [1, '<object>', '</object>'],\n lookup = {\n 'area': map,\n 'col': colgroup,\n 'colgroup': table,\n 'caption': table,\n 'legend': fieldset,\n 'thead': table,\n 'tbody': table,\n 'tfoot': table,\n 'tr': tbody,\n 'td': tr,\n 'th': tr,\n 'option': select,\n 'optgroup': select,\n 'param': object\n },\n\n // The canonical way to test that the HTML5 <template> tag is supported\n supportsTemplateTag = options.document && 'content' in options.document.createElement('template')\n\nfunction getWrap (tags) {\n const m = tags.match(/^(?:<!--.*?-->\\s*?)*?<([a-z]+)[\\s>]/)\n return (m && lookup[m[1]]) || none\n}\n\nfunction simpleHtmlParse (html, documentContext) {\n documentContext || (documentContext = document)\n var windowContext = documentContext['parentWindow'] || documentContext['defaultView'] || window\n\n // Based on jQuery's \"clean\" function, but only accounting for table-related elements.\n // If you have referenced jQuery, this won't be used anyway - KO will use jQuery's \"clean\" function directly\n\n // Note that there's still an issue in IE < 9 whereby it will discard comment nodes that are the first child of\n // a descendant node. For example: \"<div><!-- mycomment -->abc</div>\" will get parsed as \"<div>abc</div>\"\n // This won't affect anyone who has referenced jQuery, and there's always the workaround of inserting a dummy node\n // (possibly a text node) in front of the comment. So, KO does not attempt to workaround this IE issue automatically at present.\n\n // Trim whitespace, otherwise indexOf won't work as expected\n var tags = stringTrim(html).toLowerCase(), div = documentContext.createElement('div'),\n wrap = getWrap(tags),\n depth = wrap[0]\n\n // Go to html and back, then peel off extra wrappers\n // Note that we always prefix with some dummy text, because otherwise, IE<9 will strip out leading comment nodes in descendants. Total madness.\n var markup = 'ignored<div>' + wrap[1] + html + wrap[2] + '</div>'\n if (typeof windowContext['innerShiv'] === 'function') {\n // Note that innerShiv is deprecated in favour of html5shiv. We should consider adding\n // support for html5shiv (except if no explicit support is needed, e.g., if html5shiv\n // somehow shims the native APIs so it just works anyway)\n div.appendChild(windowContext['innerShiv'](markup))\n } else {\n div.innerHTML = markup\n }\n\n // Move to the right depth\n while (depth--) { div = div.lastChild }\n\n return makeArray(div.lastChild.childNodes)\n}\n\nfunction templateHtmlParse (html, documentContext) {\n if (!documentContext) { documentContext = document }\n var template = documentContext.createElement('template')\n template.innerHTML = html\n return makeArray(template.content.childNodes)\n}\n\nfunction jQueryHtmlParse (html, documentContext) {\n // jQuery's \"parseHTML\" function was introduced in jQuery 1.8.0 and is a documented public API.\n if (jQueryInstance.parseHTML) {\n return jQueryInstance.parseHTML(html, documentContext) || [] // Ensure we always return an array and never null\n } else {\n // For jQuery < 1.8.0, we fall back on the undocumented internal \"clean\" function.\n var elems = jQueryInstance.clean([html], documentContext)\n\n // As of jQuery 1.7.1, jQuery parses the HTML by appending it to some dummy parent nodes held in an in-memory document fragment.\n // Unfortunately, it never clears the dummy parent nodes from the document fragment, so it leaks memory over time.\n // Fix this by finding the top-most dummy parent element, and detaching it from its owner fragment.\n if (elems && elems[0]) {\n // Find the top-most parent element that's a direct child of a document fragment\n var elem = elems[0]\n while (elem.parentNode && elem.parentNode.nodeType !== 11 /* i.e., DocumentFragment */) { elem = elem.parentNode }\n // ... then detach it\n if (elem.parentNode) { elem.parentNode.removeChild(elem) }\n }\n\n return elems\n }\n}\n\n/**\n * parseHtmlFragment converts a string into an array of DOM Nodes.\n * If supported, it uses <template>-tag parsing, falling back on\n * jQuery parsing (if jQuery is present), and finally on a\n * straightforward parser.\n *\n * @param {string} html To be parsed.\n * @param {Object} documentContext That owns the executing code.\n * @return {[DOMNode]} Parsed DOM Nodes\n */\nexport function parseHtmlFragment (html, documentContext) {\n // Prefer <template>-tag based HTML parsing.\n return supportsTemplateTag ? templateHtmlParse(html, documentContext)\n\n // Benefit from jQuery's on old browsers, where possible\n // NOTE: jQuery's HTML parsing fails on element names like tr-*.\n // See: https://github.com/jquery/jquery/pull/1988\n : (jQueryInstance ? jQueryHtmlParse(html, documentContext)\n\n // ... otherwise, this simple logic will do in most common cases.\n : simpleHtmlParse(html, documentContext))\n}\n\nexport function parseHtmlForTemplateNodes (html, documentContext) {\n const nodes = parseHtmlFragment(html, documentContext)\n return (nodes.length && nodes[0].parentElement) || moveCleanedNodesToContainerElement(nodes)\n}\n\n/**\n * setHtml empties the node's contents, unwraps the HTML, and\n * sets the node's HTML using jQuery.html or parseHtmlFragment\n *\n * @param {DOMNode} node Node in which HTML needs to be set\n * @param {DOMNode} html HTML to be inserted in node\n * @returns undefined\n */\nexport function setHtml (node, html) {\n emptyDomNode(node)\n\n // There's few cases where we would want to display a stringified\n // function, so we unwrap it.\n if (typeof html === 'function') {\n html = html()\n }\n\n if ((html !== null) && (html !== undefined)) {\n if (typeof html !== 'string') { html = html.toString() }\n\n // If the browser supports <template> tags, prefer that, as\n // it obviates all the complex workarounds of jQuery.\n //\n // However, jQuery contains a lot of sophisticated code to parse arbitrary HTML fragments,\n // for example <tr> elements which are not normally allowed to exist on their own.\n // If you've referenced jQuery (and template tags are not supported) we'll use that rather than duplicating its code.\n if (jQueryInstance && !supportsTemplateTag) {\n jQueryInstance(node).html(html)\n } else {\n // ... otherwise, use KO's own parsing logic.\n var parsedNodes = parseHtmlFragment(html, node.ownerDocument)\n\n if (node.nodeType === 8) {\n if (html === null) {\n virtualElements.emptyNode(node)\n } else {\n virtualElements.setDomNodeChildren(node, parsedNodes)\n }\n } else {\n for (var i = 0; i < parsedNodes.length; i++) { node.appendChild(parsedNodes[i]) }\n }\n }\n }\n}\n\n\nexport function setTextContent (element, textContent) {\n var value = typeof textContent === 'function' ? textContent() : textContent\n if ((value === null) || (value === undefined)) { value = '' }\n\n // We need there to be exactly one child: a text node.\n // If there are no children, more than one, or if it's not a text node,\n // we'll clear everything and create a single text node.\n var innerTextNode = virtualElements.firstChild(element)\n if (!innerTextNode || innerTextNode.nodeType != 3 || virtualElements.nextSibling(innerTextNode)) {\n virtualElements.setDomNodeChildren(element, [element.ownerDocument.createTextNode(value)])\n } else {\n innerTextNode.data = value\n }\n\n forceRefresh(element)\n}\n","//\n// Memoization\n//\nimport { arrayPushAll } from './array.js'\n\nvar memos = {}\n\nfunction randomMax8HexChars () {\n return (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1)\n}\n\nfunction generateRandomId () {\n return randomMax8HexChars() + randomMax8HexChars()\n}\n\nfunction findMemoNodes (rootNode, appendToArray) {\n if (!rootNode) { return }\n if (rootNode.nodeType == 8) {\n var memoId = parseMemoText(rootNode.nodeValue)\n if (memoId != null) { appendToArray.push({ domNode: rootNode, memoId: memoId }) }\n } else if (rootNode.nodeType == 1) {\n for (var i = 0, childNodes = rootNode.childNodes, j = childNodes.length; i < j; i++) { findMemoNodes(childNodes[i], appendToArray) }\n }\n}\n\nexport function memoize (callback) {\n if (typeof callback !== 'function') { throw new Error('You can only pass a function to memoization.memoize()') }\n var memoId = generateRandomId()\n memos[memoId] = callback\n return '<!--[ko_memo:' + memoId + ']-->'\n}\n\nexport function unmemoize (memoId, callbackParams) {\n var callback = memos[memoId]\n if (callback === undefined) { throw new Error(\"Couldn't find any memo with ID \" + memoId + \". Perhaps it's already been unmemoized.\") }\n try {\n callback.apply(null, callbackParams || [])\n return true\n } finally { delete memos[memoId] }\n}\n\nexport function unmemoizeDomNodeAndDescendants (domNode, extraCallbackParamsArray) {\n var memos = []\n findMemoNodes(domNode, memos)\n for (var i = 0, j = memos.length; i < j; i++) {\n var node = memos[i].domNode\n var combinedParams = [node]\n if (extraCallbackParamsArray) { arrayPushAll(combinedParams, extraCallbackParamsArray) }\n unmemoize(memos[i].memoId, combinedParams)\n node.nodeValue = '' // Neuter this node so we don't try to unmemoize it again\n if (node.parentNode) { node.parentNode.removeChild(node) } // If possible, erase it totally (not always possible - someone else might just hold a reference to it then call unmemoizeDomNodeAndDescendants again)\n }\n}\n\nexport function parseMemoText (memoText) {\n var match = memoText.match(/^\\[ko_memo\\:(.*?)\\]$/)\n return match ? match[1] : null\n}\n","//\n// Tasks Micro-scheduler\n// ===\n//\n/* eslint no-cond-assign: 0 */\nimport options from './options'\nimport { deferError } from './error.js'\n\nvar taskQueue = [],\n taskQueueLength = 0,\n nextHandle = 1,\n nextIndexToProcess = 0,\n w = options.global\n\nif (w && w.MutationObserver && !(w.navigator && w.navigator.standalone)) {\n // Chrome 27+, Firefox 14+, IE 11+, Opera 15+, Safari 6.1+, node\n // From https://github.com/petkaantonov/bluebird * Copyright (c) 2014 Petka Antonov * License: MIT\n options.taskScheduler = (function (callback) {\n var div = w.document.createElement('div')\n new w.MutationObserver(callback).observe(div, {attributes: true})\n return function () { div.classList.toggle('foo') }\n })(scheduledProcess)\n} else if (w && w.document && 'onreadystatechange' in w.document.createElement('script')) {\n // IE 6-10\n // From https://github.com/YuzuJS/setImmediate * Copyright (c) 2012 Barnesandnoble.com, llc, Donavon West, and Domenic Denicola * License: MIT\n options.taskScheduler = function (callback) {\n var script = document.createElement('script')\n script.onreadystatechange = function () {\n script.onreadystatechange = null\n document.documentElement.removeChild(script)\n script = null\n callback()\n }\n document.documentElement.appendChild(script)\n }\n} else {\n options.taskScheduler = function (callback) {\n setTimeout(callback, 0)\n }\n}\n\nfunction processTasks () {\n if (taskQueueLength) {\n // Each mark represents the end of a logical group of tasks and the number of these groups is\n // limited to prevent unchecked recursion.\n var mark = taskQueueLength, countMarks = 0\n\n // nextIndexToProcess keeps track of where we are in the queue; processTasks can be called recursively without issue\n for (var task; nextIndexToProcess < taskQueueLength;) {\n if (task = taskQueue[nextIndexToProcess++]) {\n if (nextIndexToProcess > mark) {\n if (++countMarks >= 5000) {\n nextIndexToProcess = taskQueueLength // skip all tasks remaining in the queue since any of them could be causing the recursion\n deferError(Error(\"'Too much recursion' after processing \" + countMarks + ' task groups.'))\n break\n }\n mark = taskQueueLength\n }\n try {\n task()\n } catch (ex) {\n deferError(ex)\n }\n }\n }\n }\n}\n\nfunction scheduledProcess () {\n processTasks()\n\n // Reset the queue\n nextIndexToProcess = taskQueueLength = taskQueue.length = 0\n}\n\nfunction scheduleTaskProcessing () {\n options.taskScheduler(scheduledProcess)\n}\n\nexport function schedule (func) {\n if (!taskQueueLength) {\n scheduleTaskProcessing()\n }\n\n taskQueue[taskQueueLength++] = func\n return nextHandle++\n}\n\nexport function cancel (handle) {\n var index = handle - (nextHandle - taskQueueLength)\n if (index >= nextIndexToProcess && index < taskQueueLength) {\n taskQueue[index] = null\n }\n}\n\n// For testing only: reset the queue and return the previous queue length\nexport function resetForTesting () {\n var length = taskQueueLength - nextIndexToProcess\n nextIndexToProcess = taskQueueLength = taskQueue.length = 0\n return length\n}\n\nexport {processTasks as runEarly}\n","/**\n * Create a subscribable symbol that's used to identify subscribables.\n */\nexport const SUBSCRIBABLE_SYM = Symbol('Knockout Subscribable')\n\nexport function isSubscribable (instance) {\n return (instance && instance[SUBSCRIBABLE_SYM]) || false\n}\n","//\n// dependencyDetection\n// ---\n//\n// In KO 3.x, dependencyDetection was also known as computedContext.\n//\nimport { isSubscribable } from './subscribableSymbol.js'\n\nconst outerFrames = []\nlet currentFrame\nlet lastId = 0\n\n// Return a unique ID that can be assigned to an observable for dependency tracking.\n// Theoretically, you could eventually overflow the number storage size, resulting\n// in duplicate IDs. But in JavaScript, the largest exact integral value is 2^53\n// or 9,007,199,254,740,992. If you created 1,000,000 IDs per second, it would\n// take over 285 years to reach that number.\n// Reference http://blog.vjeux.com/2010/javascript/javascript-max_int-number-limits.html\nfunction getId () {\n return ++lastId\n}\n\nexport function begin (options) {\n outerFrames.push(currentFrame)\n currentFrame = options\n}\n\nexport function end () {\n currentFrame = outerFrames.pop()\n}\n\nexport function registerDependency (subscribable) {\n if (currentFrame) {\n if (!isSubscribable(subscribable)) { throw new Error('Only subscribable things can act as dependencies') }\n currentFrame.callback.call(currentFrame.callbackTarget, subscribable, subscribable._id || (subscribable._id = getId()))\n }\n}\n\nexport function ignore (callback, callbackTarget, callbackArgs) {\n try {\n begin()\n return callback.apply(callbackTarget, callbackArgs || [])\n } finally {\n end()\n }\n}\n\nexport function getDependenciesCount () {\n if (currentFrame) { return currentFrame.computed.getDependenciesCount() }\n}\n\nexport function getDependencies () {\n if (currentFrame) { return currentFrame.computed.getDependencies() }\n}\n\nexport function isInitial () {\n if (currentFrame) { return currentFrame.isInitial }\n}\n\nexport { ignore as ignoreDependencies }\n","//\n// Defer Updates\n// ===\n//\nimport { tasks } from '@tko/utils'\n\nexport function deferUpdates (target) {\n if (target._deferUpdates) { return }\n target._deferUpdates = true\n target.limit(function (callback) {\n let handle\n let ignoreUpdates = false\n return function () {\n if (!ignoreUpdates) {\n tasks.cancel(handle)\n handle = tasks.schedule(callback)\n try {\n ignoreUpdates = true\n target.notifySubscribers(undefined, 'dirty')\n } finally {\n ignoreUpdates = false\n }\n }\n }\n })\n}\n","//\n// Observable extenders\n// ---\n//\nimport {\n options, objectForEach,\n throttle as throttleFn, debounce as debounceFn\n} from '@tko/utils'\n\nimport { deferUpdates } from './defer.js'\n\nvar primitiveTypes = {\n 'undefined': 1, 'boolean': 1, 'number': 1, 'string': 1\n}\n\nexport function valuesArePrimitiveAndEqual (a, b) {\n var oldValueIsPrimitive = (a === null) || (typeof (a) in primitiveTypes)\n return oldValueIsPrimitive ? (a === b) : false\n}\n\nexport function applyExtenders (requestedExtenders) {\n var target = this\n if (requestedExtenders) {\n objectForEach(requestedExtenders, function (key, value) {\n var extenderHandler = extenders[key]\n if (typeof extenderHandler === 'function') {\n target = extenderHandler(target, value) || target\n } else {\n options.onError(new Error('Extender not found: ' + key))\n }\n })\n }\n return target\n}\n\n/*\n --- DEFAULT EXTENDERS ---\n */\n\n// Change when notifications are published.\nexport function notify (target, notifyWhen) {\n target.equalityComparer = notifyWhen == 'always'\n ? null // null equalityComparer means to always notify\n : valuesArePrimitiveAndEqual\n}\n\nexport function deferred (target, option) {\n if (option !== true) {\n throw new Error('The \\'deferred\\' extender only accepts the value \\'true\\', because it is not supported to turn deferral off once enabled.')\n }\n deferUpdates(target)\n}\n\nexport function rateLimit (target, options) {\n var timeout, method, limitFunction\n\n if (typeof options === 'number') {\n timeout = options\n } else {\n timeout = options.timeout\n method = options.method\n }\n\n // rateLimit supersedes deferred updates\n target._deferUpdates = false\n\n limitFunction = method === 'notifyWhenChangesStop' ? debounceFn : throttleFn\n\n target.limit(function (callback) {\n return limitFunction(callback, timeout)\n })\n}\n\nexport var extenders = {\n notify: notify,\n deferred: deferred,\n rateLimit: rateLimit\n}\n","/* eslint no-cond-assign: 0 */\nimport {\n arrayRemoveItem, objectForEach, options\n} from '@tko/utils'\n\nimport Subscription from './Subscription'\nimport { SUBSCRIBABLE_SYM } from './subscribableSymbol'\nimport { applyExtenders } from './extenders.js'\nimport * as dependencyDetection from './dependencyDetection.js'\nexport { isSubscribable } from './subscribableSymbol'\n\n// Descendants may have a LATEST_VALUE, which if present\n// causes TC39 subscriptions to emit the latest value when\n// subscribed.\nexport const LATEST_VALUE = Symbol('Knockout latest value')\n\nexport function subscribable () {\n Object.setPrototypeOf(this, ko_subscribable_fn)\n ko_subscribable_fn.init(this)\n}\n\nexport var defaultEvent = 'change'\n\nvar ko_subscribable_fn = {\n [SUBSCRIBABLE_SYM]: true,\n [Symbol.observable] () { return this },\n\n init (instance) {\n instance._subscriptions = { change: [] }\n instance._versionNumber = 1\n },\n\n subscribe (callback, callbackTarget, event) {\n // TC39 proposed standard Observable { next: () => ... }\n const isTC39Callback = typeof callback === 'object' && callback.next\n\n event = event || defaultEvent\n const observer = isTC39Callback ? callback : {\n next: callbackTarget ? callback.bind(callbackTarget) : callback\n }\n\n const subscriptionInstance = new Subscription(this, observer, () => {\n arrayRemoveItem(this._subscriptions[event], subscriptionInstance)\n if (this.afterSubscriptionRemove) {\n this.afterSubscriptionRemove(event)\n }\n })\n\n if (this.beforeSubscriptionAdd) {\n this.beforeSubscriptionAdd(event)\n }\n\n if (!this._subscriptions[event]) {\n this._subscriptions[event] = []\n }\n this._subscriptions[event].push(subscriptionInstance)\n\n // Have TC39 `subscribe` immediately emit.\n // https://github.com/tc39/proposal-observable/issues/190\n\n if (isTC39Callback && LATEST_VALUE in this) {\n observer.next(this[LATEST_VALUE])\n }\n\n return subscriptionInstance\n },\n\n notifySubscribers (valueToNotify, event) {\n event = event || defaultEvent\n if (event === defaultEvent) {\n this.updateVersion()\n }\n if (this.hasSubscriptionsForEvent(event)) {\n const subs = event === defaultEvent && this._changeSubscriptions\n || [...this._subscriptions[event]]\n\n try {\n dependencyDetection.begin() // Begin suppressing dependency detection (by setting the top frame to undefined)\n for (let i = 0, subscriptionInstance; subscriptionInstance = subs[i]; ++i) {\n // In case a subscription was disposed during the arrayForEach cycle, check\n // for isDisposed on each subscription before invoking its callback\n if (!subscriptionInstance._isDisposed) {\n subscriptionInstance._callback(valueToNotify)\n }\n }\n } finally {\n dependencyDetection.end() // End suppressing dependency detection\n }\n }\n },\n\n getVersion () {\n return this._versionNumber\n },\n\n hasChanged (versionToCheck) {\n return this.getVersion() !== versionToCheck\n },\n\n updateVersion () {\n ++this._versionNumber\n },\n\n hasSubscriptionsForEvent (event) {\n return this._subscriptions[event] && this._subscriptions[event].length\n },\n\n getSubscriptionsCount (event) {\n if (event) {\n return this._subscriptions[event] && this._subscriptions[event].length || 0\n } else {\n var total = 0\n objectForEach(this._subscriptions, function (eventName, subscriptions) {\n if (eventName !== 'dirty') {\n total += subscriptions.length\n }\n })\n return total\n }\n },\n\n isDifferent (oldValue, newValue) {\n return !this.equalityComparer ||\n !this.equalityComparer(oldValue, newValue)\n },\n\n once (cb) {\n const subs = this.subscribe((nv) => {\n subs.dispose()\n cb(nv)\n })\n },\n\n when (test, returnValue) {\n const current = this.peek()\n const givenRv = arguments.length > 1\n const testFn = typeof test === 'function' ? test : v => v === test\n if (testFn(current)) {\n return options.Promise.resolve(givenRv ? returnValue : current)\n }\n return new options.Promise((resolve, reject) => {\n const subs = this.subscribe(newValue => {\n if (testFn(newValue)) {\n subs.dispose()\n resolve(givenRv ? returnValue : newValue)\n }\n })\n })\n },\n\n yet (test, ...args) {\n const testFn = typeof test === 'function' ? test : v => v === test\n const negated = v => !testFn(v)\n return this.when(negated, ...args)\n },\n\n next () { return new Promise(resolve => this.once(resolve)) },\n\n toString () { return '[object Object]' },\n\n extend: applyExtenders\n}\n\n// For browsers that support proto assignment, we overwrite the prototype of each\n// observable instance. Since observables are functions, we need Function.prototype\n// to still be in the prototype chain.\nObject.setPrototypeOf(ko_subscribable_fn, Function.prototype)\n\nsubscribable.fn = ko_subscribable_fn\n","//\n// Observable values\n// ---\n//\nimport {\n options, overwriteLengthPropertyIfSupported\n} from '@tko/utils'\n\nimport * as dependencyDetection from './dependencyDetection.js'\nimport { deferUpdates } from './defer.js'\nimport { subscribable, defaultEvent, LATEST_VALUE } from './subscribable.js'\nimport { valuesArePrimitiveAndEqual } from './extenders.js'\n\nexport function observable (initialValue) {\n function Observable () {\n if (arguments.length > 0) {\n // Write\n // Ignore writes if the value hasn't changed\n if (Observable.isDifferent(Observable[LATEST_VALUE], arguments[0])) {\n Observable.valueWillMutate()\n Observable[LATEST_VALUE] = arguments[0]\n Observable.valueHasMutated()\n }\n return this // Permits chained assignments\n } else {\n // Read\n dependencyDetection.registerDependency(Observable) // The caller only needs to be notified of changes if they did a \"read\" operation\n return Observable[LATEST_VALUE]\n }\n }\n\n overwriteLengthPropertyIfSupported(Observable, { value: undefined })\n\n Observable[LATEST_VALUE] = initialValue\n\n subscribable.fn.init(Observable)\n\n // Inherit from 'observable'\n Object.setPrototypeOf(Observable, observable.fn)\n\n if (options.deferUpdates) {\n deferUpdates(Observable)\n }\n\n return Observable\n}\n\n// Define prototype for observables\nobservable.fn = {\n equalityComparer: valuesArePrimitiveAndEqual,\n peek () { return this[LATEST_VALUE] },\n valueHasMutated () {\n this.notifySubscribers(this[LATEST_VALUE], 'spectate')\n this.notifySubscribers(this[LATEST_VALUE])\n },\n valueWillMutate () {\n this.notifySubscribers(this[LATEST_VALUE], 'beforeChange')\n },\n\n modify (fn, peek = true) {\n return this(fn(peek ? this.peek() : this()))\n },\n\n // Some observables may not always be writeable, notably computeds.\n isWriteable: true\n}\n\n// Moved out of \"limit\" to avoid the extra closure\nfunction limitNotifySubscribers (value, event) {\n if (!event || event === defaultEvent) {\n this._limitChange(value)\n } else if (event === 'beforeChange') {\n this._limitBeforeChange(value)\n } else {\n this._origNotifySubscribers(value, event)\n }\n}\n\n// Add `limit` function to the subscribable prototype\nsubscribable.fn.limit = function limit (limitFunction) {\n var self = this\n var selfIsObservable = isObservable(self)\n var beforeChange = 'beforeChange'\n var ignoreBeforeChange, notifyNextChange, previousValue, pendingValue, didUpdate\n\n if (!self._origNotifySubscribers) {\n self._origNotifySubscribers = self.notifySubscribers\n self.notifySubscribers = limitNotifySubscribers\n }\n\n var finish = limitFunction(function () {\n self._notificationIsPending = false\n\n // If an observable provided a reference to itself, access it to get the latest value.\n // This allows computed observables to delay calculating their value until needed.\n if (selfIsObservable && pendingValue === self) {\n pendingValue = self._evalIfChanged ? self._evalIfChanged() : self()\n }\n const shouldNotify = notifyNextChange || (\n didUpdate && self.isDifferent(previousValue, pendingValue)\n )\n self._notifyNextChange = didUpdate = ignoreBeforeChange = false\n if (shouldNotify) {\n self._origNotifySubscribers(previousValue = pendingValue)\n }\n })\n\n Object.assign(self, {\n _limitChange (value, isDirty) {\n if (!isDirty || !self._notificationIsPending) {\n didUpdate = !isDirty\n }\n self._changeSubscriptions = [...self._subscriptions[defaultEvent]]\n self._notificationIsPending = ignoreBeforeChange = true\n pendingValue = value\n finish()\n },\n\n _limitBeforeChange (value) {\n if (!ignoreBeforeChange) {\n previousValue = value\n self._origNotifySubscribers(value, beforeChange)\n }\n },\n\n _notifyNextChangeIfValueIsDifferent () {\n if (self.isDifferent(previousValue, self.peek(true /* evaluate */))) {\n notifyNextChange = true\n }\n },\n\n _recordUpdate () {\n didUpdate = true\n }\n })\n}\n\nObject.setPrototypeOf(observable.fn, subscribable.fn)\n\nvar protoProperty = observable.protoProperty = options.protoProperty\nobservable.fn[protoProperty] = observable\n\n// Subclasses can add themselves to observableProperties so that\n// isObservable will be `true`.\nobservable.observablePrototypes = new Set([observable])\n\nexport function isObservable (instance) {\n const proto = typeof instance === 'function' && instance[protoProperty]\n if (proto && !observable.observablePrototypes.has(proto)) {\n throw Error('Invalid object that looks like an observable; possibly from another Knockout instance')\n }\n return !!proto\n}\n\nexport function unwrap (value) {\n return isObservable(value) ? value() : value\n}\n\nexport function peek (value) {\n return isObservable(value) ? value.peek() : value\n}\n\nexport function isWriteableObservable (instance) {\n return isObservable(instance) && instance.isWriteable\n}\n\nexport { isWriteableObservable as isWritableObservable }\n","//\n// Observable Array - Change Tracking Extender\n// ---\n//\n/* eslint no-fallthrough: 0 */\n\nimport {\n extend, compareArrays, findMovesInArrayComparison\n} from '@tko/utils'\n\nimport { defaultEvent } from './subscribable.js'\nimport { extenders } from './extenders.js'\n\nexport var arrayChangeEventName = 'arrayChange'\n\nexport function trackArrayChanges (target, options) {\n // Use the provided options--each call to trackArrayChanges overwrites the previously set options\n target.compareArrayOptions = {}\n if (options && typeof options === 'object') {\n extend(target.compareArrayOptions, options)\n }\n target.compareArrayOptions.sparse = true\n\n // Only modify the target observable once\n if (target.cacheDiffForKnownOperation) {\n return\n }\n let trackingChanges = false\n let cachedDiff = null\n let arrayChangeSubscription\n let pendingNotifications = 0\n let underlyingNotifySubscribersFunction\n let underlyingBeforeSubscriptionAddFunction = target.beforeSubscriptionAdd\n let underlyingAfterSubscriptionRemoveFunction = target.afterSubscriptionRemove\n\n // Watch \"subscribe\" calls, and for array change events, ensure change tracking is enabled\n target.beforeSubscriptionAdd = function (event) {\n if (underlyingBeforeSubscriptionAddFunction) {\n underlyingBeforeSubscriptionAddFunction.call(target, event)\n }\n if (event === arrayChangeEventName) {\n trackChanges()\n }\n }\n\n // Watch \"dispose\" calls, and for array change events, ensure change tracking is disabled when all are disposed\n target.afterSubscriptionRemove = function (event) {\n if (underlyingAfterSubscriptionRemoveFunction) {\n underlyingAfterSubscriptionRemoveFunction.call(target, event)\n }\n if (event === arrayChangeEventName && !target.hasSubscriptionsForEvent(arrayChangeEventName)) {\n if (underlyingNotifySubscribersFunction) {\n target.notifySubscribers = underlyingNotifySubscribersFunction\n underlyingNotifySubscribersFunction = undefined\n }\n if (arrayChangeSubscription) {\n arrayChangeSubscription.dispose()\n }\n arrayChangeSubscription = null\n trackingChanges = false\n }\n }\n\n function trackChanges () {\n // Calling 'trackChanges' multiple times is the same as calling it once\n if (trackingChanges) {\n return\n }\n\n trackingChanges = true\n\n // Intercept \"notifySubscribers\" to track how many times it was called.\n underlyingNotifySubscribersFunction = target['notifySubscribers']\n target.notifySubscribers = function (valueToNotify, event) {\n if (!event || event === defaultEvent) {\n ++pendingNotifications\n }\n return underlyingNotifySubscribersFunction.apply(this, arguments)\n }\n\n // Each time the array changes value, capture a clone so that on the next\n // change it's possible to produce a diff\n var previousContents = [].concat(target.peek() === undefined ? [] : target.peek())\n cachedDiff = null\n arrayChangeSubscription = target.subscribe(function (currentContents) {\n let changes\n // Make a copy of the current contents and ensure it's an array\n currentContents = [].concat(currentContents || [])\n\n // Compute the diff and issue notifications, but only if someone is listening\n if (target.hasSubscriptionsForEvent(arrayChangeEventName)) {\n changes = getChanges(previousContents, currentContents)\n }\n\n // Eliminate references to the old, removed items, so they can be GCed\n previousContents = currentContents\n cachedDiff = null\n pendingNotifications = 0\n\n if (changes && changes.length) {\n target.notifySubscribers(changes, arrayChangeEventName)\n }\n })\n }\n\n function getChanges (previousContents, currentContents) {\n // We try to re-use cached diffs.\n // The scenarios where pendingNotifications > 1 are when using rate-limiting or the Deferred Updates\n // plugin, which without this check would not be compatible with arrayChange notifications. Normally,\n // notifications are issued immediately so we wouldn't be queueing up more than one.\n if (!cachedDiff || pendingNotifications > 1) {\n cachedDiff = trackArrayChanges.compareArrays(previousContents, currentContents, target.compareArrayOptions)\n }\n\n return cachedDiff\n }\n\n target.cacheDiffForKnownOperation = function (rawArray, operationName, args) {\n // Only run if we're currently tracking changes for this observable array\n // and there aren't any pending deferred notifications.\n if (!trackingChanges || pendingNotifications) {\n return\n }\n var diff = [],\n arrayLength = rawArray.length,\n argsLength = args.length,\n offset = 0\n\n function pushDiff (status, value, index) {\n return diff[diff.length] = { 'status': status, 'value': value, 'index': index }\n }\n switch (operationName) {\n case 'push':\n offset = arrayLength\n case 'unshift':\n for (let index = 0; index < argsLength; index++) {\n pushDiff('added', args[index], offset + index)\n }\n break\n\n case 'pop':\n offset = arrayLength - 1\n case 'shift':\n if (arrayLength) {\n pushDiff('deleted', rawArray[offset], offset)\n }\n break\n\n case 'splice':\n // Negative start index means 'from end of array'. After that we clamp to [0...arrayLength].\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice\n var startIndex = Math.min(Math.max(0, args[0] < 0 ? arrayLength + args[0] : args[0]), arrayLength),\n endDeleteIndex = argsLength === 1 ? arrayLength : Math.min(startIndex + (args[1] || 0), arrayLength),\n endAddIndex = startIndex + argsLength - 2,\n endIndex = Math.max(endDeleteIndex, endAddIndex),\n additions = [], deletions = []\n for (let index = startIndex, argsIndex = 2; index < endIndex; ++index, ++argsIndex) {\n if (index < endDeleteIndex) { deletions.push(pushDiff('deleted', rawArray[index], index)) }\n if (index < endAddIndex) { additions.push(pushDiff('added', args[argsIndex], index)) }\n }\n findMovesInArrayComparison(deletions, additions)\n break\n\n default:\n return\n }\n cachedDiff = diff\n }\n}\n\n// Expose compareArrays for testing.\ntrackArrayChanges.compareArrays = compareArrays\n\n// Add the trackArrayChanges extender so we can use\n// obs.extend({ trackArrayChanges: true })\nextenders.trackArrayChanges = trackArrayChanges\n","//\n// Observable Arrays\n// ===\n//\nimport {\n arrayIndexOf, arrayForEach, overwriteLengthPropertyIfSupported\n} from '@tko/utils'\n\nimport { observable, isObservable } from './observable.js'\n\nimport { trackArrayChanges } from './observableArray.changeTracking.js'\n\nexport function observableArray (initialValues) {\n initialValues = initialValues || []\n\n if (typeof initialValues !== 'object' || !('length' in initialValues)) { throw new Error('The argument passed when initializing an observable array must be an array, or null, or undefined.') }\n\n var result = observable(initialValues)\n Object.setPrototypeOf(result, observableArray.fn)\n trackArrayChanges(result)\n // ^== result.extend({ trackArrayChanges: true })\n overwriteLengthPropertyIfSupported(result, { get: () => result().length })\n return result\n}\n\nexport function isObservableArray (instance) {\n return isObservable(instance) && typeof instance.remove === 'function' && typeof instance.push === 'function'\n}\n\nobservableArray.fn = {\n remove (valueOrPredicate) {\n var underlyingArray = this.peek()\n var removedValues = []\n var predicate = typeof valueOrPredicate === 'function' && !isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate }\n for (var i = 0; i < underlyingArray.length; i++) {\n var value = underlyingArray[i]\n if (predicate(value)) {\n if (removedValues.length === 0) {\n this.valueWillMutate()\n }\n if (underlyingArray[i] !== value) {\n throw Error(\"Array modified during remove; cannot remove item\")\n }\n removedValues.push(value)\n underlyingArray.splice(i, 1)\n i--\n }\n }\n if (removedValues.length) {\n this.valueHasMutated()\n }\n return removedValues\n },\n\n removeAll (arrayOfValues) {\n // If you passed zero args, we remove everything\n if (arrayOfValues === undefined) {\n var underlyingArray = this.peek()\n var allValues = underlyingArray.slice(0)\n this.valueWillMutate()\n underlyingArray.splice(0, underlyingArray.length)\n this.valueHasMutated()\n return allValues\n }\n // If you passed an arg, we interpret it as an array of entries to remove\n if (!arrayOfValues) {\n return []\n }\n return this['remove'](function (value) {\n return arrayIndexOf(arrayOfValues, value) >= 0\n })\n },\n\n destroy (valueOrPredicate) {\n var underlyingArray = this.peek()\n var predicate = typeof valueOrPredicate === 'function' && !isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate }\n this.valueWillMutate()\n for (var i = underlyingArray.length - 1; i >= 0; i--) {\n var value = underlyingArray[i]\n if (predicate(value)) {\n value['_destroy'] = true\n }\n }\n this.valueHasMutated()\n },\n\n destroyAll (arrayOfValues) {\n // If you passed zero args, we destroy everything\n if (arrayOfValues === undefined) { return this.destroy(function () { return true }) }\n\n // If you passed an arg, we interpret it as an array of entries to destroy\n if (!arrayOfValues) {\n return []\n }\n return this.destroy(function (value) {\n return arrayIndexOf(arrayOfValues, value) >= 0\n })\n },\n\n indexOf (item) {\n return arrayIndexOf(this(), item)\n },\n\n replace (oldItem, newItem) {\n var index = this.indexOf(oldItem)\n if (index >= 0) {\n this.valueWillMutate()\n this.peek()[index] = newItem\n this.valueHasMutated()\n }\n },\n\n sorted (compareFn) {\n return [...this()].sort(compareFn)\n },\n\n reversed () {\n return [...this()].reverse()\n },\n\n [Symbol.iterator]: function * () {\n yield * this()\n }\n}\n\nObject.setPrototypeOf(observableArray.fn, observable.fn)\n\n// Populate ko.observableArray.fn with read/write functions from native arrays\n// Important: Do not add any additional functions here that may reasonably be used to *read* data from the array\n// because we'll eval them without causing subscriptions, so ko.computed output could end up getting stale\narrayForEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function (methodName) {\n observableArray.fn[methodName] = function () {\n // Use \"peek\" to avoid creating a subscription in any computed that we're executing in the context of\n // (for consistency with mutating regular observables)\n var underlyingArray = this.peek()\n this.valueWillMutate()\n this.cacheDiffForKnownOperation(underlyingArray, methodName, arguments)\n var methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments)\n this.valueHasMutated()\n // The native sort and reverse methods return a reference to the array, but it makes more sense to return the observable array instead.\n return methodCallResult === underlyingArray ? this : methodCallResult\n }\n})\n\n// Populate ko.observableArray.fn with read-only functions from native arrays\narrayForEach(['slice'], function (methodName) {\n observableArray.fn[methodName] = function () {\n var underlyingArray = this()\n return underlyingArray[methodName].apply(underlyingArray, arguments)\n }\n})\n\n// Expose for testing.\nobservableArray.trackArrayChanges = trackArrayChanges\n","//\n// Helpers\n// ---\n// toJS & toJSON\n//\nimport {\n arrayIndexOf\n} from '@tko/utils'\n\nimport { isObservable } from './observable.js'\n\nvar maxNestedObservableDepth = 10 // Escape the (unlikely) pathological case where an observable's current value is itself (or similar reference cycle)\n\nexport function toJS (rootObject) {\n if (arguments.length == 0) { throw new Error('When calling ko.toJS, pass the object you want to convert.') }\n\n // We just unwrap everything at every level in the object graph\n return mapJsObjectGraph(rootObject, function (valueToMap) {\n // Loop because an observable's value might in turn be another observable wrapper\n for (var i = 0; isObservable(valueToMap) && (i < maxNestedObservableDepth); i++) { valueToMap = valueToMap() }\n return valueToMap\n })\n}\n\nexport function toJSON (rootObject, replacer, space) { // replacer and space are optional\n var plainJavaScriptObject = toJS(rootObject)\n return JSON.stringify(plainJavaScriptObject, replacer, space)\n}\n\nfunction mapJsObjectGraph (rootObject, mapInputCallback, visitedObjects) {\n visitedObjects = visitedObjects || new objectLookup()\n\n rootObject = mapInputCallback(rootObject)\n var canHaveProperties = (typeof rootObject === 'object') && (rootObject !== null) && (rootObject !== undefined) && (!(rootObject instanceof RegExp)) && (!(rootObject instanceof Date)) && (!(rootObject instanceof String)) && (!(rootObject instanceof Number)) && (!(rootObject instanceof Boolean))\n if (!canHaveProperties) { return rootObject }\n\n var outputProperties = rootObject instanceof Array ? [] : {}\n visitedObjects.save(rootObject, outputProperties)\n\n visitPropertiesOrArrayEntries(rootObject, function (indexer) {\n var propertyValue = mapInputCallback(rootObject[indexer])\n\n switch (typeof propertyValue) {\n case 'boolean':\n case 'number':\n case 'string':\n case 'function':\n outputProperties[indexer] = propertyValue\n break\n case 'object':\n case 'undefined':\n var previouslyMappedValue = visitedObjects.get(propertyValue)\n outputProperties[indexer] = (previouslyMappedValue !== undefined)\n ? previouslyMappedValue\n : mapJsObjectGraph(propertyValue, mapInputCallback, visitedObjects)\n break\n }\n })\n\n return outputProperties\n}\n\nfunction visitPropertiesOrArrayEntries (rootObject, visitorCallback) {\n if (rootObject instanceof Array) {\n for (var i = 0; i < rootObject.length; i++) { visitorCallback(i) }\n\n // For arrays, also respect toJSON property for custom mappings (fixes #278)\n if (typeof rootObject['toJSON'] === 'function') { visitorCallback('toJSON') }\n } else {\n for (var propertyName in rootObject) {\n visitorCallback(propertyName)\n }\n }\n}\n\nfunction objectLookup () {\n this.keys = []\n this.values = []\n}\n\nobjectLookup.prototype = {\n constructor: objectLookup,\n save: function (key, value) {\n var existingIndex = arrayIndexOf(this.keys, key)\n if (existingIndex >= 0) { this.values[existingIndex] = value } else {\n this.keys.push(key)\n this.values.push(value)\n }\n },\n get: function (key) {\n var existingIndex = arrayIndexOf(this.keys, key)\n return (existingIndex >= 0) ? this.values[existingIndex] : undefined\n }\n}\n","import {\n unwrap\n} from '@tko/observable'\n\nexport function LAMBDA () {}\n\n/**\n * @ operator - recursively call the identifier if it's a function\n * @param {operand} a ignored\n * @param {operand} b The variable to be called (if a function) and unwrapped\n * @return {value} The result.\n */\nfunction unwrapOrCall (a, b) {\n while (typeof b === 'function') { b = b() }\n return b\n}\n\nconst operators = {\n // unary\n '@': unwrapOrCall,\n '#': (a, b) => () => unwrap(b), // Convert to read-only.\n '=>': LAMBDA,\n '!': function not (a, b) { return !b },\n '!!': function notnot (a, b) { return !!b },\n '++': function preinc (a, b) { return ++b },\n '--': function preinc (a, b) { return --b },\n // mul/div\n '*': function mul (a, b) { return a * b },\n '/': function div (a, b) { return a / b },\n '%': function mod (a, b) { return a % b },\n // sub/add\n '+': function add (a, b) { return a + b },\n '-': function sub (a, b) { return (a || 0) - (b || 0) },\n '&-': function neg (a, b) { return -1 * b },\n // relational\n '<': function lt (a, b) { return a < b },\n '<=': function le (a, b) { return a <= b },\n '>': function gt (a, b) { return a > b },\n '>=': function ge (a, b) { return a >= b },\n // TODO: 'in': function (a, b) { return a in b; },\n // TODO: 'instanceof': function (a, b) { return a instanceof b; },\n // equality\n '==': function equal (a, b) { return a === b },\n '!=': function ne (a, b) { return a !== b },\n '===': function sequal (a, b) { return a === b },\n '!==': function sne (a, b) { return a !== b },\n // bitwise\n '&': function bitAnd (a, b) { return a & b },\n '^': function xor (a, b) { return a ^ b },\n '|': function bitOr (a, b) { return a | b },\n // logic\n '&&': function logicAnd (a, b) { return a && b },\n '||': function logicOr (a, b) { return a || b },\n // Access\n '.': function member (a, b) { return a[b] },\n '[': function member (a, b) { return a[b] },\n // conditional/ternary\n // '?': ternary See Node.js\n // Function-Call\n 'call': function callOp (a, b) { return a.apply(null, b) }\n}\n\n/* Order of precedence from:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#Table\n*/\n\n // Our operator - unwrap/call\noperators['@'].precedence = 21\noperators['#'].precedence = 21\n\n // lambda\noperators['=>'].precedence = 20\n\n // Member\noperators['.'].precedence = 19\noperators['['].precedence = 19\n\n // Logical not\noperators['!'].precedence = 16\noperators['!!'].precedence = 16 // explicit double-negative\n\n // Prefix inc/dec\noperators['++'].precedence = 16\noperators['--'].precedence = 16\noperators['&-'].precedence = 16\n\n // mul/div/remainder\noperators['%'].precedence = 14\noperators['*'].precedence = 14\noperators['/'].precedence = 14\n\n // add/sub\noperators['+'].precedence = 13\noperators['-'].precedence = 13\n\n // bitwise\noperators['|'].precedence = 12\noperators['^'].precedence = 11\noperators['&'].precedence = 10\n\n // comparison\noperators['<'].precedence = 11\noperators['<='].precedence = 11\noperators['>'].precedence = 11\noperators['>='].precedence = 11\n\n // operators['in'].precedence = 8;\n // operators['instanceof'].precedence = 8;\n // equality\noperators['=='].precedence = 10\noperators['!='].precedence = 10\noperators['==='].precedence = 10\noperators['!=='].precedence = 10\n\n // logic\noperators['&&'].precedence = 6\noperators['||'].precedence = 5\n\noperators['&&'].earlyOut = (a) => !a\noperators['||'].earlyOut = (a) => a\n\n // Call a function\noperators['call'].precedence = 1\n\nexport { operators as default }\n","import {\n stringTrim\n} from '@tko/utils'\n\n/* eslint no-cond-assign: 0 */\n\n// The following regular expressions will be used to split an object-literal string into tokens\n\n// These characters have special meaning to the parser and must not appear in the middle of a\n// token, except as part of a string.\nconst specials = ',\"\\'`{}()/:[\\\\]'\nconst bindingToken = RegExp([\n // These match strings, either with double quotes, single quotes, or backticks\n '\"(?:\\\\\\\\.|[^\"])*\"',\n \"'(?:\\\\\\\\.|[^'])*'\",\n '`(?:\\\\\\\\.|[^`])*`',\n // Match C style comments\n '/\\\\*(?:[^*]|\\\\*+[^*/])*\\\\*+/',\n // Match C++ style comments\n '//.*\\n',\n // Match a regular expression (text enclosed by slashes), but will also match sets of divisions\n // as a regular expression (this is handled by the parsing loop below).\n '/(?:\\\\\\\\.|[^/])+/\\\\w*',\n // Match text (at least two characters) that does not contain any of the above special characters,\n // although some of the special characters are allowed to start it (all but the colon and comma).\n // The text can contain spaces, but leading or trailing spaces are skipped.\n '[^\\\\s:,/][^' + specials + ']*[^\\\\s' + specials + ']',\n // Match any non-space character not matched already. This will match colons and commas, since they're\n // not matched by \"everyThingElse\", but will also match any other single character that wasn't already\n // matched (for example: in \"a: 1, b: 2\", each of the non-space characters will be matched by oneNotSpace).\n '[^\\\\s]'\n].join('|'), 'g')\n\n // Match end of previous token to determine whether a slash is a division or regex.\nconst divisionLookBehind = /[\\])\"'A-Za-z0-9_$]+$/\nconst keywordRegexLookBehind = { 'in': 1, 'return': 1, 'typeof': 1 }\n\n/**\n * Break a binding string (data-bind='x: val, y: ..') into a stable array\n * of {key: value}.\n */\nexport default function parseObjectLiteral (objectLiteralString) {\n // Trim leading and trailing spaces from the string\n var str = stringTrim(objectLiteralString)\n\n // Trim braces '{' surrounding the whole object literal\n if (str.charCodeAt(0) === 123) str = str.slice(1, -1)\n\n // Add a newline to correctly match a C++ style comment at the end of the string and\n // add a comma so that we don't need a separate code block to deal with the last item\n str += '\\n,'\n\n // Split into tokens\n var result = []\n var toks = str.match(bindingToken)\n var key\n var values = []\n var depth = 0\n\n if (toks.length <= 1) { return [] }\n\n for (var i = 0, tok; tok = toks[i]; ++i) {\n var c = tok.charCodeAt(0)\n // A comma signals the end of a key/value pair if depth is zero\n if (c === 44) { // \",\"\n if (depth <= 0) {\n result.push((key && values.length) ? {\n key: key,\n value: values.join('')\n } : {\n 'unknown': key || values.join('')\n })\n key = depth = 0\n values = []\n continue\n }\n // Simply skip the colon that separates the name and value\n } else if (c === 58) { // \":\"\n if (!depth && !key && values.length === 1) {\n key = values.pop()\n continue\n }\n // A set of slashes is initially matched as a regular expression, but could be division\n } else if (c === 47 && tok.length > 1 && (tok.charCodeAt(1) === 47 || tok.charCodeAt(1) === 42)) { // \"//\" or \"/*\"\n // skip comments\n continue\n } else if (c === 47 && i && tok.length > 1) { // \"/\"\n // Look at the end of the previous token to determine if the slash is actually division\n var match = toks[i - 1].match(divisionLookBehind)\n if (match && !keywordRegexLookBehind[match[0]]) {\n // The slash is actually a division punctuator; re-parse the remainder of the string (not including the slash)\n str = str.substr(str.indexOf(tok) + 1)\n toks = str.match(bindingToken)\n i = -1\n // Continue with just the slash\n tok = '/'\n }\n // Increment depth for parentheses, braces, and brackets so that interior commas are ignored\n } else if (c === 40 || c === 123 || c === 91) { // '(', '{', '['\n ++depth\n } else if (c === 41 || c === 125 || c === 93) { // ')', '}', ']'\n --depth\n // The key will be the first token; if it's a string, trim the quotes\n } else if (!key && !values.length && (c === 34 || c === 39)) { // '\"', \"'\"\n tok = tok.slice(1, -1)\n }\n values.push(tok)\n }\n\n return result\n}\n","//\n// Computed Observable Values\n//\n// (before tko, `computed` was also known as `dependentObservable`)\n//\nimport {\n addDisposeCallback,\n arrayForEach,\n createSymbolOrString,\n domNodeIsAttachedToDocument,\n extend,\n options,\n hasOwnProperty,\n objectForEach,\n options as koOptions,\n removeDisposeCallback,\n safeSetTimeout,\n} from '@tko/utils'\n\nimport {\n dependencyDetection,\n extenders,\n valuesArePrimitiveAndEqual,\n observable,\n subscribable,\n LATEST_VALUE\n} from '@tko/observable'\n\nconst computedState = createSymbolOrString('_state')\nconst DISPOSED_STATE = {\n dependencyTracking: null,\n dependenciesCount: 0,\n isDisposed: true,\n isStale: false,\n isDirty: false,\n isSleeping: false,\n disposeWhenNodeIsRemoved: null,\n readFunction: null,\n _options: null\n}\n\nexport function computed (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {\n if (typeof evaluatorFunctionOrOptions === 'object') {\n // Single-parameter syntax - everything is on this \"options\" param\n options = evaluatorFunctionOrOptions\n } else {\n // Multi-parameter syntax - construct the options according to the params passed\n options = options || {}\n if (evaluatorFunctionOrOptions) {\n options.read = evaluatorFunctionOrOptions\n }\n }\n if (typeof options.read !== 'function') {\n throw Error('Pass a function that returns the value of the computed')\n }\n\n var writeFunction = options.write\n var state = {\n latestValue: undefined,\n isStale: true,\n isDirty: true,\n isBeingEvaluated: false,\n suppressDisposalUntilDisposeWhenReturnsFalse: false,\n isDisposed: false,\n pure: false,\n isSleeping: false,\n readFunction: options.read,\n evaluatorFunctionTarget: evaluatorFunctionTarget || options.owner,\n disposeWhenNodeIsRemoved: options.disposeWhenNodeIsRemoved || options.disposeWhenNodeIsRemoved || null,\n disposeWhen: options.disposeWhen || options.disposeWhen,\n domNodeDisposalCallback: null,\n dependencyTracking: {},\n dependenciesCount: 0,\n evaluationTimeoutInstance: null\n }\n\n function computedObservable () {\n if (arguments.length > 0) {\n if (typeof writeFunction === 'function') {\n // Writing a value\n writeFunction.apply(state.evaluatorFunctionTarget, arguments)\n } else {\n throw new Error(\"Cannot write a value to a computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.\")\n }\n return this // Permits chained assignments\n } else {\n // Reading the value\n if (!state.isDisposed) {\n dependencyDetection.registerDependency(computedObservable)\n }\n if (state.isDirty || (state.isSleeping && computedObservable.haveDependenciesChanged())) {\n computedObservable.evaluateImmediate()\n }\n return state.latestValue\n }\n }\n\n computedObservable[computedState] = state\n computedObservable.isWriteable = typeof writeFunction === 'function'\n\n subscribable.fn.init(computedObservable)\n\n // Inherit from 'computed'\n Object.setPrototypeOf(computedObservable, computed.fn)\n\n if (options.pure) {\n state.pure = true\n state.isSleeping = true // Starts off sleeping; will awake on the first subscription\n extend(computedObservable, pureComputedOverrides)\n } else if (options.deferEvaluation) {\n extend(computedObservable, deferEvaluationOverrides)\n }\n\n if (koOptions.deferUpdates) {\n extenders.deferred(computedObservable, true)\n }\n\n if (koOptions.debug) {\n // #1731 - Aid debugging by exposing the computed's options\n computedObservable._options = options\n }\n\n if (state.disposeWhenNodeIsRemoved) {\n // Since this computed is associated with a DOM node, and we don't want to dispose the computed\n // until the DOM node is *removed* from the document (as opposed to never having been in the document),\n // we'll prevent disposal until \"disposeWhen\" first returns false.\n state.suppressDisposalUntilDisposeWhenReturnsFalse = true\n\n // disposeWhenNodeIsRemoved: true can be used to opt into the \"only dispose after first false result\"\n // behavior even if there's no specific node to watch. In that case, clear the option so we don't try\n // to watch for a non-node's disposal. This technique is intended for KO's internal use only and shouldn't\n // be documented or used by application code, as it's likely to change in a future version of KO.\n if (!state.disposeWhenNodeIsRemoved.nodeType) {\n state.disposeWhenNodeIsRemoved = null\n }\n }\n\n // Evaluate, unless sleeping or deferEvaluation is true\n if (!state.isSleeping && !options.deferEvaluation) {\n computedObservable.evaluateImmediate()\n }\n\n // Attach a DOM node disposal callback so that the computed will be proactively disposed as soon as the node is\n // removed using ko.removeNode. But skip if isActive is false (there will never be any dependencies to dispose).\n if (state.disposeWhenNodeIsRemoved && computedObservable.isActive()) {\n addDisposeCallback(state.disposeWhenNodeIsRemoved, state.domNodeDisposalCallback = function () {\n computedObservable.dispose()\n })\n }\n\n return computedObservable\n}\n\n// Utility function that disposes a given dependencyTracking entry\nfunction computedDisposeDependencyCallback (id, entryToDispose) {\n if (entryToDispose !== null && entryToDispose.dispose) {\n entryToDispose.dispose()\n }\n}\n\n// This function gets called each time a dependency is detected while evaluating a computed.\n// It's factored out as a shared function to avoid creating unnecessary function instances during evaluation.\nfunction computedBeginDependencyDetectionCallback (subscribable, id) {\n var computedObservable = this.computedObservable,\n state = computedObservable[computedState]\n if (!state.isDisposed) {\n if (this.disposalCount && this.disposalCandidates[id]) {\n // Don't want to dispose this subscription, as it's still being used\n computedObservable.addDependencyTracking(id, subscribable, this.disposalCandidates[id])\n this.disposalCandidates[id] = null // No need to actually delete the property - disposalCandidates is a transient object anyway\n --this.disposalCount\n } else if (!state.dependencyTracking[id]) {\n // Brand new subscription - add it\n computedObservable.addDependencyTracking(id, subscribable, state.isSleeping ? { _target: subscribable } : computedObservable.subscribeToDependency(subscribable))\n }\n // If the observable we've accessed has a pending notification, ensure\n // we get notified of the actual final value (bypass equality checks)\n if (subscribable._notificationIsPending) {\n subscribable._notifyNextChangeIfValueIsDifferent()\n }\n }\n}\n\ncomputed.fn = {\n equalityComparer: valuesArePrimitiveAndEqual,\n getDependenciesCount () {\n return this[computedState].dependenciesCount\n },\n\n getDependencies () {\n const dependencyTracking = this[computedState].dependencyTracking\n const dependentObservables = []\n\n objectForEach(dependencyTracking, function (id, dependency) {\n dependentObservables[dependency._order] = dependency._target\n })\n\n return dependentObservables\n },\n\n addDependencyTracking (id, target, trackingObj) {\n if (this[computedState].pure && target === this) {\n throw Error(\"A 'pure' computed must not be called recursively\")\n }\n\n this[computedState].dependencyTracking[id] = trackingObj\n trackingObj._order = this[computedState].dependenciesCount++\n trackingObj._version = target.getVersion()\n },\n haveDependenciesChanged () {\n var id, dependency, dependencyTracking = this[computedState].dependencyTracking\n for (id in dependencyTracking) {\n if (hasOwnProperty(dependencyTracking, id)) {\n dependency = dependencyTracking[id]\n if ((this._evalDelayed && dependency._target._notificationIsPending) || dependency._target.hasChanged(dependency._version)) {\n return true\n }\n }\n }\n },\n markDirty () {\n // Process \"dirty\" events if we can handle delayed notifications\n if (this._evalDelayed && !this[computedState].isBeingEvaluated) {\n this._evalDelayed(false /* notifyChange */)\n }\n },\n isActive () {\n const state = this[computedState]\n return state.isDirty || state.dependenciesCount > 0\n },\n respondToChange () {\n // Ignore \"change\" events if we've already scheduled a delayed notification\n if (!this._notificationIsPending) {\n this.evaluatePossiblyAsync()\n } else if (this[computedState].isDirty) {\n this[computedState].isStale = true\n }\n },\n subscribeToDependency (target) {\n if (target._deferUpdates) {\n var dirtySub = target.subscribe(this.markDirty, this, 'dirty'),\n changeSub = target.subscribe(this.respondToChange, this)\n return {\n _target: target,\n dispose () {\n dirtySub.dispose()\n changeSub.dispose()\n }\n }\n } else {\n return target.subscribe(this.evaluatePossiblyAsync, this)\n }\n },\n evaluatePossiblyAsync () {\n var computedObservable = this,\n throttleEvaluationTimeout = computedObservable.throttleEvaluation\n if (throttleEvaluationTimeout && throttleEvaluationTimeout >= 0) {\n clearTimeout(this[computedState].evaluationTimeoutInstance)\n this[computedState].evaluationTimeoutInstance = safeSetTimeout(function () {\n computedObservable.evaluateImmediate(true /* notifyChange */)\n }, throttleEvaluationTimeout)\n } else if (computedObservable._evalDelayed) {\n computedObservable._evalDelayed(true /* notifyChange */)\n } else {\n computedObservable.evaluateImmediate(true /* notifyChange */)\n }\n },\n evaluateImmediate (notifyChange) {\n var computedObservable = this,\n state = computedObservable[computedState],\n disposeWhen = state.disposeWhen,\n changed = false\n\n if (state.isBeingEvaluated) {\n // If the evaluation of a ko.computed causes side effects, it's possible that it will trigger its own re-evaluation.\n // This is not desirable (it's hard for a developer to realise a chain of dependencies might cause this, and they almost\n // certainly didn't intend infinite re-evaluations). So, for predictability, we simply prevent ko.computeds from causing\n // their own re-evaluation. Further discussion at https://github.com/SteveSanderson/knockout/pull/387\n return\n }\n\n // Do not evaluate (and possibly capture new dependencies) if disposed\n if (state.isDisposed) {\n return\n }\n\n if (state.disposeWhenNodeIsRemoved && !domNodeIsAttachedToDocument(state.disposeWhenNodeIsRemoved) || disposeWhen && disposeWhen()) {\n // See comment above about suppressDisposalUntilDisposeWhenReturnsFalse\n if (!state.suppressDisposalUntilDisposeWhenReturnsFalse) {\n computedObservable.dispose()\n return\n }\n } else {\n // It just did return false, so we can stop suppressing now\n state.suppressDisposalUntilDisposeWhenReturnsFalse = false\n }\n\n state.isBeingEvaluated = true\n try {\n changed = this.evaluateImmediate_CallReadWithDependencyDetection(notifyChange)\n } finally {\n state.isBeingEvaluated = false\n }\n\n return changed\n },\n evaluateImmediate_CallReadWithDependencyDetection (notifyChange) {\n // This function is really just part of the evaluateImmediate logic. You would never call it from anywhere else.\n // Factoring it out into a separate function means it can be independent of the try/catch block in evaluateImmediate,\n // which contributes to saving about 40% off the CPU overhead of computed evaluation (on V8 at least).\n\n var computedObservable = this,\n state = computedObservable[computedState],\n changed = false\n\n // Initially, we assume that none of the subscriptions are still being used (i.e., all are candidates for disposal).\n // Then, during evaluation, we cross off any that are in fact still being used.\n var isInitial = state.pure ? undefined : !state.dependenciesCount, // If we're evaluating when there are no previous dependencies, it must be the first time\n dependencyDetectionContext = {\n computedObservable: computedObservable,\n disposalCandidates: state.dependencyTracking,\n disposalCount: state.dependenciesCount\n }\n\n dependencyDetection.begin({\n callbackTarget: dependencyDetectionContext,\n callback: computedBeginDependencyDetectionCallback,\n computed: computedObservable,\n isInitial: isInitial\n })\n\n state.dependencyTracking = {}\n state.dependenciesCount = 0\n\n var newValue = this.evaluateImmediate_CallReadThenEndDependencyDetection(state, dependencyDetectionContext)\n\n if (!state.dependenciesCount) {\n computedObservable.dispose()\n changed = true // When evaluation causes a disposal, make sure all dependent computeds get notified so they'll see the new state\n } else {\n changed = computedObservable.isDifferent(state.latestValue, newValue)\n }\n\n if (changed) {\n if (!state.isSleeping) {\n computedObservable.notifySubscribers(state.latestValue, 'beforeChange')\n } else {\n computedObservable.updateVersion()\n }\n\n state.latestValue = newValue\n if (options.debug) { computedObservable._latestValue = newValue }\n\n computedObservable.notifySubscribers(state.latestValue, 'spectate')\n\n if (!state.isSleeping && notifyChange) {\n computedObservable.notifySubscribers(state.latestValue)\n }\n\n if (computedObservable._recordUpdate) {\n computedObservable._recordUpdate()\n }\n }\n\n if (isInitial) {\n computedObservable.notifySubscribers(state.latestValue, 'awake')\n }\n\n return changed\n },\n evaluateImmediate_CallReadThenEndDependencyDetection (state, dependencyDetectionContext) {\n // This function is really part of the evaluateImmediate_CallReadWithDependencyDetection logic.\n // You'd never call it from anywhere else. Factoring it out means that evaluateImmediate_CallReadWithDependencyDetection\n // can be independent of try/finally blocks, which contributes to saving about 40% off the CPU\n // overhead of computed evaluation (on V8 at least).\n\n try {\n var readFunction = state.readFunction\n return state.evaluatorFunctionTarget ? readFunction.call(state.evaluatorFunctionTarget) : readFunction()\n } finally {\n dependencyDetection.end()\n\n // For each subscription no longer being used, remove it from the active subscriptions list and dispose it\n if (dependencyDetectionContext.disposalCount && !state.isSleeping) {\n objectForEach(dependencyDetectionContext.disposalCandidates, computedDisposeDependencyCallback)\n }\n\n state.isStale = state.isDirty = false\n }\n },\n peek (forceEvaluate) {\n // Peek won't ordinarily re-evaluate, except while the computed is sleeping\n // or to get the initial value when \"deferEvaluation\" is set.\n const state = this[computedState]\n if ((state.isDirty && (forceEvaluate || !state.dependenciesCount)) || (state.isSleeping && this.haveDependenciesChanged())) {\n this.evaluateImmediate()\n }\n return state.latestValue\n },\n\n get [LATEST_VALUE] () {\n return this.peek()\n },\n\n limit (limitFunction) {\n const state = this[computedState]\n // Override the limit function with one that delays evaluation as well\n subscribable.fn.limit.call(this, limitFunction)\n Object.assign(this, {\n _evalIfChanged () {\n if (!this[computedState].isSleeping) {\n if (this[computedState].isStale) {\n this.evaluateImmediate()\n } else {\n this[computedState].isDirty = false\n }\n }\n return state.latestValue\n },\n _evalDelayed (isChange) {\n this._limitBeforeChange(state.latestValue)\n\n // Mark as dirty\n state.isDirty = true\n if (isChange) {\n state.isStale = true\n }\n\n // Pass the observable to the \"limit\" code, which will evaluate it when\n // it's time to do the notification.\n this._limitChange(this, !isChange /* isDirty */)\n }\n })\n },\n dispose () {\n var state = this[computedState]\n if (!state.isSleeping && state.dependencyTracking) {\n objectForEach(state.dependencyTracking, function (id, dependency) {\n if (dependency.dispose) {\n dependency.dispose()\n }\n })\n }\n if (state.disposeWhenNodeIsRemoved && state.domNodeDisposalCallback) {\n removeDisposeCallback(state.disposeWhenNodeIsRemoved, state.domNodeDisposalCallback)\n }\n Object.assign(state, DISPOSED_STATE)\n }\n}\n\nvar pureComputedOverrides = {\n beforeSubscriptionAdd (event) {\n // If asleep, wake up the computed by subscribing to any dependencies.\n var computedObservable = this,\n state = computedObservable[computedState]\n if (!state.isDisposed && state.isSleeping && event === 'change') {\n state.isSleeping = false\n if (state.isStale || computedObservable.haveDependenciesChanged()) {\n state.dependencyTracking = null\n state.dependenciesCount = 0\n if (computedObservable.evaluateImmediate()) {\n computedObservable.updateVersion()\n }\n } else {\n // First put the dependencies in order\n var dependenciesOrder = []\n objectForEach(state.dependencyTracking, function (id, dependency) {\n dependenciesOrder[dependency._order] = id\n })\n // Next, subscribe to each one\n arrayForEach(dependenciesOrder, function (id, order) {\n var dependency = state.dependencyTracking[id],\n subscription = computedObservable.subscribeToDependency(dependency._target)\n subscription._order = order\n subscription._version = dependency._version\n state.dependencyTracking[id] = subscription\n })\n\n // Waking dependencies may have triggered effects\n if (computedObservable.haveDependenciesChanged()) {\n if (computedObservable.evaluateImmediate()) {\n computedObservable.updateVersion()\n }\n }\n }\n\n if (!state.isDisposed) { // test since evaluating could trigger disposal\n computedObservable.notifySubscribers(state.latestValue, 'awake')\n }\n }\n },\n afterSubscriptionRemove (event) {\n var state = this[computedState]\n if (!state.isDisposed && event === 'change' && !this.hasSubscriptionsForEvent('change')) {\n objectForEach(state.dependencyTracking, function (id, dependency) {\n if (dependency.dispose) {\n state.dependencyTracking[id] = {\n _target: dependency._target,\n _order: dependency._order,\n _version: dependency._version\n }\n dependency.dispose()\n }\n })\n state.isSleeping = true\n this.notifySubscribers(undefined, 'asleep')\n }\n },\n getVersion () {\n // Because a pure computed is not automatically updated while it is sleeping, we can't\n // simply return the version number. Instead, we check if any of the dependencies have\n // changed and conditionally re-evaluate the computed observable.\n var state = this[computedState]\n if (state.isSleeping && (state.isStale || this.haveDependenciesChanged())) {\n this.evaluateImmediate()\n }\n return subscribable.fn.getVersion.call(this)\n }\n}\n\nvar deferEvaluationOverrides = {\n beforeSubscriptionAdd (event) {\n // This will force a computed with deferEvaluation to evaluate when the first subscription is registered.\n if (event === 'change' || event === 'beforeChange') {\n this.peek()\n }\n }\n}\n\nObject.setPrototypeOf(computed.fn, subscribable.fn)\n\n// Set the proto values for ko.computed\nvar protoProp = observable.protoProperty // == \"__ko_proto__\"\ncomputed.fn[protoProp] = computed\n\n/* This is used by ko.isObservable */\nobservable.observablePrototypes.add(computed)\n\nexport function isComputed (instance) {\n return (typeof instance === 'function' && instance[protoProp] === computed)\n}\n\nexport function isPureComputed (instance) {\n return isComputed(instance) && instance[computedState] && instance[computedState].pure\n}\n\nexport function pureComputed (evaluatorFunctionOrOptions, evaluatorFunctionTarget) {\n if (typeof evaluatorFunctionOrOptions === 'function') {\n return computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget, {'pure': true})\n } else {\n evaluatorFunctionOrOptions = extend({}, evaluatorFunctionOrOptions) // make a copy of the parameter object\n evaluatorFunctionOrOptions.pure = true\n return computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget)\n }\n}\n","/**\n * Create an ES\n */\n\nimport {\n observable, observableArray, unwrap\n} from '@tko/observable'\n\nimport {\n computed\n} from './computed.js'\n\nconst PROXY_SYM = Symbol('Knockout Proxied Object')\nconst MIRROR_SYM = Symbol('Knockout Proxied Observables')\n\nfunction makeComputed (proxy, fn) {\n return computed({\n owner: proxy,\n read: fn,\n write: fn,\n pure: 'pure' in fn ? fn.pure : true,\n deferEvaluation: 'deferEvaluation' in fn ? fn.deferEvaluation : true\n }).extend({ deferred: true })\n}\n\nfunction setOrCreate (mirror, prop, value, proxy) {\n if (!mirror[prop]) {\n const ctr = Array.isArray(value) ? observableArray\n : typeof value === 'function' ? makeComputed.bind(null, proxy)\n : observable\n mirror[prop] = ctr(value)\n } else {\n mirror[prop](value)\n }\n}\n\nfunction assignOrUpdate(mirror, object, proxy) {\n for (const key of Object.keys(object)) {\n setOrCreate(mirror, key, object[key], proxy)\n }\n return object\n}\n\nexport function proxy (object) {\n const mirror = { [PROXY_SYM]: object }\n mirror[MIRROR_SYM] = mirror\n const proxy = new Proxy(function () {}, {\n has (target, prop) { return prop in mirror },\n get (target, prop) { return unwrap(mirror[prop]) },\n set (target, prop, value, receiver) {\n setOrCreate(mirror, prop, value, proxy)\n object[prop] = value\n return true\n },\n deleteProperty (property) {\n delete mirror[property]\n return delete object[property]\n },\n apply (target, thisArg, [props]) {\n if (props) {\n assignOrUpdate(mirror, props, proxy)\n return Object.assign(object, props)\n }\n return object\n },\n getPrototypeOf () { return Object.getPrototypeOf(object) },\n setPrototypeOf (target, proto) { return Object.setPrototypeOf(object, proto) },\n defineProperty (target, prop, desc) { return Object.defineProperty(object, prop, desc) },\n preventExtensions () { return Object.preventExtensions(object) },\n isExtensible () { return Object.isExtensible(object) },\n ownKeys () {\n return [...Object.getOwnPropertyNames(object),\n ...Object.getOwnPropertySymbols(object)]\n }\n })\n assignOrUpdate(mirror, object, proxy)\n return proxy\n}\n\nexport function getObservable (proxied, prop) { return proxied[MIRROR_SYM][prop] }\nexport function peek (proxied, prop) { return getObservable(proxied, prop).peek() }\nexport function isProxied (proxied) { return PROXY_SYM in proxied }\n\nObject.assign(proxy, { getObservable, peek, isProxied })\n","\nimport {\n pureComputed\n} from './computed'\n\nfunction kowhen (predicate, context, resolve) {\n const observable = pureComputed(predicate, context).extend({notify: 'always'});\n const subscription = observable.subscribe(value => {\n if (value) {\n subscription.dispose()\n resolve(value)\n }\n })\n // In case the initial value is true, process it right away\n observable.notifySubscribers(observable.peek())\n return subscription\n}\n\nexport function when (predicate, callback, context) {\n const whenFn = kowhen.bind(null, predicate, context)\n return callback ? whenFn(callback.bind(context)) : new Promise(whenFn)\n}\n","import {\n extend, options, anyDomNodeIsAttachedToDocument, addDisposeCallback,\n arrayRemoveItem, domData\n} from '@tko/utils'\n\nimport {\n computed, pureComputed\n} from '@tko/computed'\n\nimport {\n unwrap, isObservable\n} from '@tko/observable'\n\nimport {\n contextAncestorBindingInfo\n} from './bindingEvent'\n\nexport const boundElementDomDataKey = domData.nextKey()\n\nexport const contextSubscribeSymbol = Symbol('Knockout Context Subscription')\n\n// Unique stub to indicate inheritance.\nconst inheritParentIndicator = Symbol('Knockout Parent Indicator')\n\n// The bindingContext constructor is only called directly to create the root context. For child\n// contexts, use bindingContext.createChildContext or bindingContext.extend.\nexport function bindingContext (dataItemOrAccessor, parentContext, dataItemAlias, extendCallback, settings) {\n const self = this\n const shouldInheritData = dataItemOrAccessor === inheritParentIndicator\n const realDataItemOrAccessor = shouldInheritData ? undefined : dataItemOrAccessor\n const isFunc = typeof realDataItemOrAccessor === 'function' && !isObservable(realDataItemOrAccessor)\n\n // Export 'ko' in the binding context so it will be available in bindings and templates\n // even if 'ko' isn't exported as a global, such as when using an AMD loader.\n // See https://github.com/SteveSanderson/knockout/issues/490\n self.ko = options.knockoutInstance\n\n let nodes\n let subscribable\n\n // The binding context object includes static properties for the current, parent, and root view models.\n // If a view model is actually stored in an observable, the corresponding binding context object, and\n // any child contexts, must be updated when the view model is changed.\n function updateContext () {\n // Most of the time, the context will directly get a view model object, but if a function is given,\n // we call the function to retrieve the view model. If the function accesses any observables or returns\n // an observable, the dependency is tracked, and those observables can later cause the binding\n // context to be updated.\n const dataItemOrObservable = isFunc ? realDataItemOrAccessor() : realDataItemOrAccessor\n let dataItem = unwrap(dataItemOrObservable)\n\n if (parentContext) {\n // When a \"parent\" context is given, register a dependency on the parent context. Thus whenever the\n // parent context is updated, this context will also be updated.\n if (parentContext[contextSubscribeSymbol]) {\n parentContext[contextSubscribeSymbol]()\n }\n\n // Copy $root and any custom properties from the parent context\n extend(self, parentContext)\n\n // Copy Symbol properties\n if (contextAncestorBindingInfo in parentContext) {\n self[contextAncestorBindingInfo] = parentContext[contextAncestorBindingInfo]\n }\n } else {\n self.$parents = []\n self.$root = dataItem\n }\n\n self[contextSubscribeSymbol] = subscribable\n\n if (shouldInheritData) {\n dataItem = self.$data\n } else {\n self.$rawData = dataItemOrObservable\n self.$data = dataItem\n }\n\n if (dataItemAlias) { self[dataItemAlias] = dataItem }\n\n // The extendCallback function is provided when creating a child context or extending a context.\n // It handles the specific actions needed to finish setting up the binding context. Actions in this\n // function could also add dependencies to this binding context.\n if (extendCallback) { extendCallback(self, parentContext, dataItem) }\n\n return self.$data\n }\n\n if (settings && settings.exportDependencies) {\n // The \"exportDependencies\" option means that the calling code will track any dependencies and re-create\n // the binding context when they change.\n updateContext()\n } else {\n subscribable = pureComputed(updateContext)\n subscribable.peek()\n\n // At this point, the binding context has been initialized, and the \"subscribable\" computed observable is\n // subscribed to any observables that were accessed in the process. If there is nothing to track, the\n // computed will be inactive, and we can safely throw it away. If it's active, the computed is stored in\n // the context object.\n if (subscribable.isActive()) {\n self[contextSubscribeSymbol] = subscribable\n\n // Always notify because even if the model ($data) hasn't changed, other context properties might have changed\n subscribable['equalityComparer'] = null\n } else {\n self[contextSubscribeSymbol] = undefined\n }\n }\n}\n\nObject.assign(bindingContext.prototype, {\n\n lookup (token, globals, node) {\n // short circuits\n switch (token) {\n case '$element': return node\n case '$context': return this\n case 'this': case '$data': return this.$data\n }\n const $data = this.$data\n // instanceof Object covers 1. {}, 2. [], 3. function() {}, 4. new *; it excludes undefined, null, primitives.\n if ($data instanceof Object && token in $data) { return $data[token] }\n if (token in this) { return this[token] }\n if (token in globals) { return globals[token] }\n\n throw new Error(`The variable \"${token}\" was not found on $data, $context, or globals.`)\n },\n\n // Extend the binding context hierarchy with a new view model object. If the parent context is watching\n // any observables, the new child context will automatically get a dependency on the parent context.\n // But this does not mean that the $data value of the child context will also get updated. If the child\n // view model also depends on the parent view model, you must provide a function that returns the correct\n // view model on each update.\n createChildContext (dataItemOrAccessor, dataItemAlias, extendCallback, settings) {\n return new bindingContext(dataItemOrAccessor, this, dataItemAlias, function (self, parentContext) {\n // Extend the context hierarchy by setting the appropriate pointers\n self.$parentContext = parentContext\n self.$parent = parentContext.$data\n self.$parents = (parentContext.$parents || []).slice(0)\n self.$parents.unshift(self.$parent)\n if (extendCallback) { extendCallback(self) }\n }, settings)\n },\n\n // Extend the binding context with new custom properties. This doesn't change the context hierarchy.\n // Similarly to \"child\" contexts, provide a function here to make sure that the correct values are set\n // when an observable view model is updated.\n extend (properties) {\n // If the parent context references an observable view model, \"_subscribable\" will always be the\n // latest view model object. If not, \"_subscribable\" isn't set, and we can use the static \"$data\" value.\n return new bindingContext(inheritParentIndicator, this, null, function (self, parentContext) {\n extend(self, typeof properties === 'function' ? properties.call(self) : properties)\n })\n },\n\n createStaticChildContext (dataItemOrAccessor, dataItemAlias) {\n return this.createChildContext(dataItemOrAccessor, dataItemAlias, null, { 'exportDependencies': true })\n }\n})\n\nexport function storedBindingContextForNode (node) {\n const bindingInfo = domData.get(node, boundElementDomDataKey)\n return bindingInfo && bindingInfo.context\n}\n\n// Retrieving binding context from arbitrary nodes\nexport function contextFor (node) {\n // We can only do something meaningful for elements and comment nodes (in particular, not text nodes, as IE can't store domdata for them)\n if (node && (node.nodeType === 1 || node.nodeType === 8)) {\n return storedBindingContextForNode(node)\n }\n}\n\nexport function dataFor (node) {\n var context = contextFor(node)\n return context ? context.$data : undefined\n}\n","\n/* eslint no-cond-assign: 0 */\n\nimport {\n extend, objectMap, virtualElements, tagNameLower, domData, objectForEach,\n arrayIndexOf, arrayForEach, options\n} from '@tko/utils'\n\nimport {\n dependencyDetection\n} from '@tko/observable'\n\nimport {\n computed\n} from '@tko/computed'\n\nimport {\n dataFor, bindingContext, boundElementDomDataKey, contextSubscribeSymbol\n} from './bindingContext'\n\nimport {\n bindingEvent\n} from './bindingEvent'\n\nimport {\n BindingResult\n} from './BindingResult'\n\nimport {\n LegacyBindingHandler\n} from './LegacyBindingHandler'\n\n// The following element types will not be recursed into during binding.\nconst bindingDoesNotRecurseIntoElementTypes = {\n // Don't want bindings that operate on text nodes to mutate <script> and <textarea> contents,\n // because it's unexpected and a potential XSS issue.\n // Also bindings should not operate on <template> elements since this breaks in Internet Explorer\n // and because such elements' contents are always intended to be bound in a different context\n // from where they appear in the document.\n 'script': true,\n 'textarea': true,\n 'template': true\n}\n\nfunction getBindingProvider () {\n return options.bindingProviderInstance.instance || options.bindingProviderInstance\n}\n\nfunction isProviderForNode (provider, node) {\n const nodeTypes = provider.FOR_NODE_TYPES || [1, 3, 8]\n return nodeTypes.includes(node.nodeType)\n}\n\nfunction asProperHandlerClass (handler, bindingKey) {\n if (!handler) { return }\n return handler.isBindingHandlerClass ? handler\n : LegacyBindingHandler.getOrCreateFor(bindingKey, handler)\n}\n\nfunction getBindingHandlerFromComponent (bindingKey, $component) {\n if (!$component || typeof $component.getBindingHandler !== 'function') { return }\n return asProperHandlerClass($component.getBindingHandler(bindingKey))\n}\n\nexport function getBindingHandler (bindingKey) {\n const bindingDefinition = options.getBindingHandler(bindingKey) || getBindingProvider().bindingHandlers.get(bindingKey)\n return asProperHandlerClass(bindingDefinition, bindingKey)\n}\n\n// Returns the value of a valueAccessor function\nfunction evaluateValueAccessor (valueAccessor) {\n return valueAccessor()\n}\n\nfunction applyBindingsToDescendantsInternal (bindingContext, elementOrVirtualElement, asyncBindingsApplied) {\n let nextInQueue = virtualElements.firstChild(elementOrVirtualElement)\n\n if (!nextInQueue) { return }\n\n let currentChild\n const provider = getBindingProvider()\n const preprocessNode = provider.preprocessNode\n\n // Preprocessing allows a binding provider to mutate a node before bindings are applied to it. For example it's\n // possible to insert new siblings after it, and/or replace the node with a different one. This can be used to\n // implement custom binding syntaxes, such as {{ value }} for string interpolation, or custom element types that\n // trigger insertion of <template> contents at that point in the document.\n if (preprocessNode) {\n while (currentChild = nextInQueue) {\n nextInQueue = virtualElements.nextSibling(currentChild)\n preprocessNode.call(provider, currentChild)\n }\n\n // Reset nextInQueue for the next loop\n nextInQueue = virtualElements.firstChild(elementOrVirtualElement)\n }\n\n while (currentChild = nextInQueue) {\n // Keep a record of the next child *before* applying bindings, in case the binding removes the current child from its position\n nextInQueue = virtualElements.nextSibling(currentChild)\n applyBindingsToNodeAndDescendantsInternal(bindingContext, currentChild, asyncBindingsApplied)\n }\n\n bindingEvent.notify(elementOrVirtualElement, bindingEvent.childrenComplete)\n}\n\nfunction hasBindings (node) {\n const provider = getBindingProvider()\n return isProviderForNode(provider, node) && provider.nodeHasBindings(node)\n}\n\nfunction nodeOrChildHasBindings (node) {\n return hasBindings(node) || [...node.childNodes].some(c => nodeOrChildHasBindings(c))\n}\n\nfunction applyBindingsToNodeAndDescendantsInternal (bindingContext, nodeVerified, asyncBindingsApplied) {\n var isElement = nodeVerified.nodeType === 1\n if (isElement) { // Workaround IE <= 8 HTML parsing weirdness\n virtualElements.normaliseVirtualElementDomStructure(nodeVerified)\n }\n\n // Perf optimisation: Apply bindings only if...\n // (1) We need to store the binding info for the node (all element nodes)\n // (2) It might have bindings (e.g., it has a data-bind attribute, or it's a marker for a containerless template)\n\n let shouldApplyBindings = isElement || // Case (1)\n hasBindings(nodeVerified) // Case (2)\n\n const { shouldBindDescendants } = shouldApplyBindings\n ? applyBindingsToNodeInternal(nodeVerified, null, bindingContext, asyncBindingsApplied)\n : { shouldBindDescendants: true }\n\n if (shouldBindDescendants && !bindingDoesNotRecurseIntoElementTypes[tagNameLower(nodeVerified)]) {\n // We're recursing automatically into (real or virtual) child nodes without changing binding contexts. So,\n // * For children of a *real* element, the binding context is certainly the same as on their DOM .parentNode,\n // hence bindingContextsMayDifferFromDomParentElement is false\n // * For children of a *virtual* element, we can't be sure. Evaluating .parentNode on those children may\n // skip over any number of intermediate virtual elements, any of which might define a custom binding context,\n // hence bindingContextsMayDifferFromDomParentElement is true\n applyBindingsToDescendantsInternal(bindingContext, nodeVerified, asyncBindingsApplied)\n }\n}\n\n\nfunction * topologicalSortBindings (bindings, $component) {\n const results = []\n // Depth-first sort\n const bindingsConsidered = {} // A temporary record of which bindings are already in 'result'\n const cyclicDependencyStack = [] // Keeps track of a depth-search so that, if there's a cycle, we know which bindings caused it\n\n objectForEach(bindings, function pushBinding (bindingKey) {\n if (!bindingsConsidered[bindingKey]) {\n const binding = getBindingHandlerFromComponent(bindingKey, $component) || getBindingHandler(bindingKey)\n if (!binding) { return }\n // First add dependencies (if any) of the current binding\n if (binding.after) {\n cyclicDependencyStack.push(bindingKey)\n arrayForEach(binding.after, function (bindingDependencyKey) {\n if (!bindings[bindingDependencyKey]) { return }\n if (arrayIndexOf(cyclicDependencyStack, bindingDependencyKey) !== -1) {\n throw Error('Cannot combine the following bindings, because they have a cyclic dependency: ' + cyclicDependencyStack.join(', '))\n } else {\n pushBinding(bindingDependencyKey)\n }\n })\n cyclicDependencyStack.length--\n }\n // Next add the current binding\n results.push([ bindingKey, binding ])\n }\n bindingsConsidered[bindingKey] = true\n })\n\n for (const result of results) { yield result }\n}\n\nfunction applyBindingsToNodeInternal (node, sourceBindings, bindingContext, asyncBindingsApplied) {\n const bindingInfo = domData.getOrSet(node, boundElementDomDataKey, {})\n // Prevent multiple applyBindings calls for the same node, except when a binding value is specified\n const alreadyBound = bindingInfo.alreadyBound\n if (!sourceBindings) {\n if (alreadyBound) {\n if (!nodeOrChildHasBindings(node)) { return false }\n onBindingError({\n during: 'apply',\n errorCaptured: new Error('You cannot apply bindings multiple times to the same element.'),\n element: node,\n bindingContext\n })\n return false\n }\n bindingInfo.alreadyBound = true\n }\n\n if (!alreadyBound) {\n bindingInfo.context = bindingContext\n }\n\n // Use bindings if given, otherwise fall back on asking the bindings provider to give us some bindings\n var bindings\n if (sourceBindings && typeof sourceBindings !== 'function') {\n bindings = sourceBindings\n } else {\n const provider = getBindingProvider()\n const getBindings = provider.getBindingAccessors\n\n if (isProviderForNode(provider, node)) {\n // Get the binding from the provider within a computed observable so that we can update the bindings whenever\n // the binding context is updated or if the binding provider accesses observables.\n var bindingsUpdater = computed(\n function () {\n bindings = sourceBindings ? sourceBindings(bindingContext, node) : getBindings.call(provider, node, bindingContext)\n // Register a dependency on the binding context to support observable view models.\n if (bindings && bindingContext[contextSubscribeSymbol]) { bindingContext[contextSubscribeSymbol]() }\n return bindings\n },\n null, { disposeWhenNodeIsRemoved: node }\n )\n\n if (!bindings || !bindingsUpdater.isActive()) { bindingsUpdater = null }\n }\n }\n\n var bindingHandlerThatControlsDescendantBindings\n if (bindings) {\n const $component = bindingContext.$component || {}\n\n const allBindingHandlers = {}\n domData.set(node, 'bindingHandlers', allBindingHandlers)\n\n // Return the value accessor for a given binding. When bindings are static (won't be updated because of a binding\n // context update), just return the value accessor from the binding. Otherwise, return a function that always gets\n // the latest binding value and registers a dependency on the binding updater.\n const getValueAccessor = bindingsUpdater\n ? (bindingKey) => function (optionalValue) {\n const valueAccessor = bindingsUpdater()[bindingKey]\n if (arguments.length === 0) {\n return evaluateValueAccessor(valueAccessor)\n } else {\n return valueAccessor(optionalValue)\n }\n } : (bindingKey) => bindings[bindingKey]\n\n // Use of allBindings as a function is maintained for backwards compatibility, but its use is deprecated\n function allBindings () {\n return objectMap(bindingsUpdater ? bindingsUpdater() : bindings, evaluateValueAccessor)\n }\n\n // The following is the 3.x allBindings API\n allBindings.has = (key) => key in bindings\n allBindings.get = (key) => bindings[key] && evaluateValueAccessor(getValueAccessor(key))\n\n if (bindingEvent.childrenComplete in bindings) {\n bindingEvent.subscribe(node, bindingEvent.childrenComplete, () => {\n const callback = evaluateValueAccessor(bindings[bindingEvent.childrenComplete])\n if (!callback) { return }\n const nodes = virtualElements.childNodes(node)\n if (nodes.length) { callback(nodes, dataFor(nodes[0])) }\n })\n }\n\n const bindingsGenerated = topologicalSortBindings(bindings, $component)\n const nodeAsyncBindingPromises = new Set()\n for (const [key, BindingHandlerClass] of bindingsGenerated) {\n // Go through the sorted bindings, calling init and update for each\n function reportBindingError (during, errorCaptured) {\n onBindingError({\n during,\n errorCaptured,\n bindings,\n allBindings,\n bindingKey: key,\n bindingContext,\n element: node,\n valueAccessor: getValueAccessor(key)\n })\n }\n\n if (node.nodeType === 8 && !BindingHandlerClass.allowVirtualElements) {\n throw new Error(`The binding '${key}' cannot be used with virtual elements`)\n }\n\n try {\n const bindingHandler = dependencyDetection.ignore(() =>\n new BindingHandlerClass({\n allBindings,\n $element: node,\n $context: bindingContext,\n onError: reportBindingError,\n valueAccessor (...v) { return getValueAccessor(key)(...v) }\n })\n )\n\n if (bindingHandler.onValueChange) {\n dependencyDetection.ignore(() =>\n bindingHandler.computed('onValueChange')\n )\n }\n\n // Expose the bindings via domData.\n allBindingHandlers[key] = bindingHandler\n\n if (bindingHandler.controlsDescendants) {\n if (bindingHandlerThatControlsDescendantBindings !== undefined) { throw new Error('Multiple bindings (' + bindingHandlerThatControlsDescendantBindings + ' and ' + key + ') are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.') }\n bindingHandlerThatControlsDescendantBindings = key\n }\n\n if (bindingHandler.bindingCompleted instanceof Promise) {\n asyncBindingsApplied.add(bindingHandler.bindingCompleted)\n nodeAsyncBindingPromises.add(bindingHandler.bindingCompleted)\n }\n } catch (err) {\n reportBindingError('creation', err)\n }\n }\n\n triggerDescendantsComplete(node, bindings, nodeAsyncBindingPromises)\n }\n\n const shouldBindDescendants = bindingHandlerThatControlsDescendantBindings === undefined\n return { shouldBindDescendants }\n}\n\n/**\n *\n * @param {HTMLElement} node\n * @param {Object} bindings\n * @param {[Promise]} nodeAsyncBindingPromises\n */\nfunction triggerDescendantsComplete (node, bindings, nodeAsyncBindingPromises) {\n /** descendantsComplete ought to be an instance of the descendantsComplete\n * binding handler. */\n const hasBindingHandler = bindingEvent.descendantsComplete in bindings\n const hasFirstChild = virtualElements.firstChild(node)\n const accessor = hasBindingHandler && evaluateValueAccessor(bindings[bindingEvent.descendantsComplete])\n const callback = () => {\n bindingEvent.notify(node, bindingEvent.descendantsComplete)\n if (accessor && hasFirstChild) { accessor(node) }\n }\n if (nodeAsyncBindingPromises.size) {\n Promise.all(nodeAsyncBindingPromises).then(callback)\n } else {\n callback()\n }\n}\n\n\nfunction getBindingContext (viewModelOrBindingContext, extendContextCallback) {\n return viewModelOrBindingContext && (viewModelOrBindingContext instanceof bindingContext)\n ? viewModelOrBindingContext\n : new bindingContext(viewModelOrBindingContext, undefined, undefined, extendContextCallback)\n}\n\nexport function applyBindingAccessorsToNode (node, bindings, viewModelOrBindingContext, asyncBindingsApplied) {\n if (node.nodeType === 1) { // If it's an element, workaround IE <= 8 HTML parsing weirdness\n virtualElements.normaliseVirtualElementDomStructure(node)\n }\n return applyBindingsToNodeInternal(node, bindings, getBindingContext(viewModelOrBindingContext), asyncBindingsApplied)\n}\n\nexport function applyBindingsToNode (node, bindings, viewModelOrBindingContext) {\n const asyncBindingsApplied = new Set()\n const bindingContext = getBindingContext(viewModelOrBindingContext)\n const bindingAccessors = getBindingProvider().makeBindingAccessors(bindings, bindingContext, node)\n applyBindingAccessorsToNode(node, bindingAccessors, bindingContext, asyncBindingsApplied)\n return new BindingResult({asyncBindingsApplied, rootNode: node, bindingContext})\n}\n\nexport function applyBindingsToDescendants (viewModelOrBindingContext, rootNode) {\n const asyncBindingsApplied = new Set()\n if (rootNode.nodeType === 1 || rootNode.nodeType === 8) {\n const bindingContext = getBindingContext(viewModelOrBindingContext)\n applyBindingsToDescendantsInternal(bindingContext, rootNode, asyncBindingsApplied)\n return new BindingResult({asyncBindingsApplied, rootNode, bindingContext})\n }\n return new BindingResult({asyncBindingsApplied, rootNode})\n}\n\nexport function applyBindings (viewModelOrBindingContext, rootNode, extendContextCallback) {\n const asyncBindingsApplied = new Set()\n // If jQuery is loaded after Knockout, we won't initially have access to it. So save it here.\n if (!options.jQuery === undefined && options.jQuery) {\n options.jQuery = options.jQuery\n }\n\n // rootNode is optional\n if (!rootNode) {\n rootNode = window.document.body\n if (!rootNode) {\n throw Error('ko.applyBindings: could not find window.document.body; has the document been loaded?')\n }\n } else if (rootNode.nodeType !== 1 && rootNode.nodeType !== 8) {\n throw Error('ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node')\n }\n const rootContext = getBindingContext(viewModelOrBindingContext, extendContextCallback)\n applyBindingsToNodeAndDescendantsInternal(rootContext, rootNode, asyncBindingsApplied)\n return Promise.all(asyncBindingsApplied)\n}\n\nfunction onBindingError (spec) {\n var error, bindingText\n if (spec.bindingKey) {\n // During: 'init' or initial 'update'\n error = spec.errorCaptured\n spec.message = 'Unable to process binding \"' + spec.bindingKey +\n '\" in binding \"' + spec.bindingKey +\n '\"\\nMessage: ' + (error.message ? error.message : error)\n } else {\n // During: 'apply'\n error = spec.errorCaptured\n }\n try {\n extend(error, spec)\n } catch (e) {\n // Read-only error e.g. a DOMEXception.\n spec.stack = error.stack\n error = new Error(error.message ? error.message : error)\n extend(error, spec)\n }\n options.onError(error)\n}\n","/* eslint no-cond-assign: 0 */\nimport {\n fixUpContinuousNodeArray, replaceDomNodes, arrayPushAll,\n anyDomNodeIsAttachedToDocument, domData, arrayMap, arrayForEach,\n virtualElements, extend, cleanNode, removeNode, compareArrays\n} from '@tko/utils'\n\nimport {\n dependencyDetection, observable\n} from '@tko/observable'\n\nimport { computed } from '@tko/computed'\n\n// Objective:\n// * Given an input array, a container DOM node, and a function from array elements to arrays of DOM nodes,\n// map the array elements to arrays of DOM nodes, concatenate together all these arrays, and use them to populate the container DOM node\n// * Next time we're given the same combination of things (with the array possibly having mutated), update the container DOM node\n// so that its children is again the concatenation of the mappings of the array elements, but don't re-map any array elements that we\n// previously mapped - retain those nodes, and just insert/delete other ones\n\n// \"callbackAfterAddingNodes\" will be invoked after any \"mapping\"-generated nodes are inserted into the container node\n// You can use this, for example, to activate bindings on those nodes.\n\nfunction mapNodeAndRefreshWhenChanged (containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) {\n // Map this array value inside a dependentObservable so we re-map when any dependency changes\n var mappedNodes = []\n var dependentObservable = computed(function () {\n var newMappedNodes = mapping(valueToMap, index, fixUpContinuousNodeArray(mappedNodes, containerNode)) || []\n\n // On subsequent evaluations, just replace the previously-inserted DOM nodes\n if (mappedNodes.length > 0) {\n replaceDomNodes(mappedNodes, newMappedNodes)\n if (callbackAfterAddingNodes) { dependencyDetection.ignore(callbackAfterAddingNodes, null, [valueToMap, newMappedNodes, index]) }\n }\n\n // Replace the contents of the mappedNodes array, thereby updating the record\n // of which nodes would be deleted if valueToMap was itself later removed\n mappedNodes.length = 0\n arrayPushAll(mappedNodes, newMappedNodes)\n }, null, { disposeWhenNodeIsRemoved: containerNode, disposeWhen: function () { return !anyDomNodeIsAttachedToDocument(mappedNodes) } })\n return { mappedNodes: mappedNodes, dependentObservable: (dependentObservable.isActive() ? dependentObservable : undefined) }\n}\n\nvar lastMappingResultDomDataKey = domData.nextKey()\nlet deletedItemDummyValue = domData.nextKey()\n\nexport function setDomNodeChildrenFromArrayMapping (domNode, array, mapping, options, callbackAfterAddingNodes, editScript) {\n // Compare the provided array against the previous one\n array = array || []\n if (typeof array.length === 'undefined') {\n array = [array]\n }\n options = options || {}\n let lastMappingResult = domData.get(domNode, lastMappingResultDomDataKey)\n let isFirstExecution = !lastMappingResult\n\n // Build the new mapping result\n var newMappingResult = []\n var lastMappingResultIndex = 0\n var newMappingResultIndex = 0\n\n var nodesToDelete = []\n var itemsToProcess = []\n var itemsForBeforeRemoveCallbacks = []\n var itemsForMoveCallbacks = []\n var itemsForAfterAddCallbacks = []\n var mapData\n let countWaitingForRemove = 0\n\n function itemAdded (value) {\n mapData = { arrayEntry: value, indexObservable: observable(newMappingResultIndex++) }\n newMappingResult.push(mapData)\n itemsToProcess.push(mapData)\n if (!isFirstExecution) {\n itemsForAfterAddCallbacks.push(mapData)\n }\n }\n\n function itemMovedOrRetained (oldPosition) {\n mapData = lastMappingResult[oldPosition]\n if (newMappingResultIndex !== oldPosition) {\n itemsForMoveCallbacks.push(mapData)\n }\n // Since updating the index might change the nodes, do so before calling fixUpContinuousNodeArray\n mapData.indexObservable(newMappingResultIndex++)\n fixUpContinuousNodeArray(mapData.mappedNodes, domNode)\n newMappingResult.push(mapData)\n itemsToProcess.push(mapData)\n }\n\n function callCallback (callback, items) {\n if (callback) {\n for (var i = 0, n = items.length; i < n; i++) {\n arrayForEach(items[i].mappedNodes, function (node) {\n callback(node, i, items[i].arrayEntry)\n })\n }\n }\n }\n\n if (isFirstExecution) {\n arrayForEach(array, itemAdded)\n } else {\n if (!editScript || (lastMappingResult && lastMappingResult['_countWaitingForRemove'])) {\n // Compare the provided array against the previous one\n var lastArray = isFirstExecution ? [] : arrayMap(lastMappingResult, function (x) { return x.arrayEntry })\n var compareOptions = {\n 'dontLimitMoves': options['dontLimitMoves'],\n 'sparse': true\n }\n editScript = compareArrays(lastArray, array, compareOptions)\n }\n\n for (var i = 0, editScriptItem, movedIndex, itemIndex; editScriptItem = editScript[i]; i++) {\n movedIndex = editScriptItem['moved']\n itemIndex = editScriptItem['index']\n switch (editScriptItem['status']) {\n case 'deleted':\n while (lastMappingResultIndex < itemIndex) {\n itemMovedOrRetained(lastMappingResultIndex++)\n }\n if (movedIndex === undefined) {\n mapData = lastMappingResult[lastMappingResultIndex]\n\n // Stop tracking changes to the mapping for these nodes\n if (mapData.dependentObservable) {\n mapData.dependentObservable.dispose()\n mapData.dependentObservable = undefined\n }\n\n // Queue these nodes for later removal\n if (fixUpContinuousNodeArray(mapData.mappedNodes, domNode).length) {\n if (options['beforeRemove']) {\n newMappingResult.push(mapData)\n itemsToProcess.push(mapData)\n countWaitingForRemove++\n if (mapData.arrayEntry === deletedItemDummyValue) {\n mapData = null\n } else {\n itemsForBeforeRemoveCallbacks.push(mapData)\n }\n }\n if (mapData) {\n nodesToDelete.push.apply(nodesToDelete, mapData.mappedNodes)\n }\n }\n }\n lastMappingResultIndex++\n break\n\n case 'added':\n while (newMappingResultIndex < itemIndex) {\n itemMovedOrRetained(lastMappingResultIndex++)\n }\n if (movedIndex !== undefined) {\n itemMovedOrRetained(movedIndex)\n } else {\n itemAdded(editScriptItem['value'])\n }\n break\n }\n }\n\n while (newMappingResultIndex < array.length) {\n itemMovedOrRetained(lastMappingResultIndex++)\n }\n\n // Record that the current view may still contain deleted items\n // because it means we won't be able to use a provided editScript.\n newMappingResult['_countWaitingForRemove'] = countWaitingForRemove\n }\n\n // Store a copy of the array items we just considered so we can difference it next time\n domData.set(domNode, lastMappingResultDomDataKey, newMappingResult)\n\n // Call beforeMove first before any changes have been made to the DOM\n callCallback(options['beforeMove'], itemsForMoveCallbacks)\n\n // Next remove nodes for deleted items (or just clean if there's a beforeRemove callback)\n arrayForEach(nodesToDelete, options['beforeRemove'] ? cleanNode : removeNode)\n\n // Next add/reorder the remaining items (will include deleted items if there's a beforeRemove callback)\n i = 0\n for (var nextNode = virtualElements.firstChild(domNode), lastNode, node; mapData = itemsToProcess[i]; i++) {\n // Get nodes for newly added items\n if (!mapData.mappedNodes) { extend(mapData, mapNodeAndRefreshWhenChanged(domNode, mapping, mapData.arrayEntry, callbackAfterAddingNodes, mapData.indexObservable)) }\n\n // Put nodes in the right place if they aren't there already\n for (var j = 0; node = mapData.mappedNodes[j]; nextNode = node.nextSibling, lastNode = node, j++) {\n if (node !== nextNode) { virtualElements.insertAfter(domNode, node, lastNode) }\n }\n\n // Run the callbacks for newly added nodes (for example, to apply bindings, etc.)\n if (!mapData.initialized && callbackAfterAddingNodes) {\n callbackAfterAddingNodes(mapData.arrayEntry, mapData.mappedNodes, mapData.indexObservable)\n mapData.initialized = true\n }\n }\n\n // If there's a beforeRemove callback, call it after reordering.\n // Note that we assume that the beforeRemove callback will usually be used to remove the nodes using\n // some sort of animation, which is why we first reorder the nodes that will be removed. If the\n // callback instead removes the nodes right away, it would be more efficient to skip reordering them.\n // Perhaps we'll make that change in the future if this scenario becomes more common.\n callCallback(options['beforeRemove'], itemsForBeforeRemoveCallbacks)\n\n // Replace the stored values of deleted items with a dummy value. This provides two benefits: it marks this item\n // as already \"removed\" so we won't call beforeRemove for it again, and it ensures that the item won't match up\n // with an actual item in the array and appear as \"retained\" or \"moved\".\n for (i = 0; i < itemsForBeforeRemoveCallbacks.length; ++i) {\n itemsForBeforeRemoveCallbacks[i].arrayEntry = deletedItemDummyValue\n }\n\n // Finally call afterMove and afterAdd callbacks\n callCallback(options['afterMove'], itemsForMoveCallbacks)\n callCallback(options['afterAdd'], itemsForAfterAddCallbacks)\n}\n","// A template source represents a read/write way of accessing a template. This is to eliminate the need for template loading/saving\n// logic to be duplicated in every template engine (and means they can all work with anonymous templates, etc.)\n//\n// Two are provided by default:\n// 1. ko.templateSources.domElement - reads/writes the text content of an arbitrary DOM element\n// 2. ko.templateSources.anonymousElement - uses ko.utils.domData to read/write text *associated* with the DOM element, but\n// without reading/writing the actual element text content, since it will be overwritten\n// with the rendered template output.\n// You can implement your own template source if you want to fetch/store templates somewhere other than in DOM elements.\n// Template sources need to have the following functions:\n// text() \t\t\t- returns the template text from your storage location\n// text(value)\t\t- writes the supplied template text to your storage location\n// data(key)\t\t\t- reads values stored using data(key, value) - see below\n// data(key, value)\t- associates \"value\" with this template and the key \"key\". Is used to store information like \"isRewritten\".\n//\n// Optionally, template sources can also have the following functions:\n// nodes() - returns a DOM element containing the nodes of this template, where available\n// nodes(value) - writes the given DOM element to your storage location\n// If a DOM element is available for a given template source, template engines are encouraged to use it in preference over text()\n// for improved speed. However, all templateSources must supply text() even if they don't supply nodes().\n//\n// Once you've implemented a templateSource, make your template engine use it by subclassing whatever template engine you were\n// using and overriding \"makeTemplateSource\" to return an instance of your custom template source.\n\nimport {\n tagNameLower as tagNameLowerFn, setHtml, domData, parseHtmlForTemplateNodes\n} from '@tko/utils'\n\n// ---- ko.templateSources.domElement -----\n\n// template types\nvar templateScript = 1,\n templateTextArea = 2,\n templateTemplate = 3,\n templateElement = 4\n\nexport function domElement (element) {\n this.domElement = element\n\n if (!element) { return }\n var tagNameLower = tagNameLowerFn(element)\n this.templateType =\n tagNameLower === 'script' ? templateScript\n : tagNameLower === 'textarea' ? templateTextArea\n // For browsers with proper <template> element support, where the .content property gives a document fragment\n : tagNameLower == 'template' && element.content && element.content.nodeType === 11 ? templateTemplate\n : templateElement\n}\n\ndomElement.prototype.text = function (/* valueToWrite */) {\n var elemContentsProperty = this.templateType === templateScript ? 'text'\n : this.templateType === templateTextArea ? 'value'\n : 'innerHTML'\n\n if (arguments.length == 0) {\n return this.domElement[elemContentsProperty]\n } else {\n var valueToWrite = arguments[0]\n if (elemContentsProperty === 'innerHTML') { setHtml(this.domElement, valueToWrite) } else { this.domElement[elemContentsProperty] = valueToWrite }\n }\n}\n\nvar dataDomDataPrefix = domData.nextKey() + '_'\ndomElement.prototype.data = function (key /*, valueToWrite */) {\n if (arguments.length === 1) {\n return domData.get(this.domElement, dataDomDataPrefix + key)\n } else {\n domData.set(this.domElement, dataDomDataPrefix + key, arguments[1])\n }\n}\n\nvar templatesDomDataKey = domData.nextKey()\nfunction getTemplateDomData (element) {\n return domData.get(element, templatesDomDataKey) || {}\n}\nfunction setTemplateDomData (element, data) {\n domData.set(element, templatesDomDataKey, data)\n}\n\ndomElement.prototype.nodes = function (/* valueToWrite */) {\n var element = this.domElement\n if (arguments.length == 0) {\n const templateData = getTemplateDomData(element)\n let nodes = templateData.containerData || (\n this.templateType === templateTemplate ? element.content :\n this.templateType === templateElement ? element :\n undefined\n )\n if (!nodes || templateData.alwaysCheckText) {\n // If the template is associated with an element that stores the template as text,\n // parse and cache the nodes whenever there's new text content available. This allows\n // the user to update the template content by updating the text of template node.\n const text = this['text']()\n if (text) {\n nodes = parseHtmlForTemplateNodes(text, element.ownerDocument)\n this['text']('') // clear the text from the node\n setTemplateDomData(element, {containerData: nodes, alwaysCheckText: true})\n }\n }\n\n return nodes\n } else {\n var valueToWrite = arguments[0]\n setTemplateDomData(element, {containerData: valueToWrite})\n }\n}\n\n// ---- ko.templateSources.anonymousTemplate -----\n// Anonymous templates are normally saved/retrieved as DOM nodes through \"nodes\".\n// For compatibility, you can also read \"text\"; it will be serialized from the nodes on demand.\n// Writing to \"text\" is still supported, but then the template data will not be available as DOM nodes.\n\nexport function anonymousTemplate (element) {\n this.domElement = element\n}\n\nanonymousTemplate.prototype = new domElement()\nanonymousTemplate.prototype.constructor = anonymousTemplate\nanonymousTemplate.prototype.text = function (/* valueToWrite */) {\n if (arguments.length == 0) {\n var templateData = getTemplateDomData(this.domElement)\n if (templateData.textData === undefined && templateData.containerData) { templateData.textData = templateData.containerData.innerHTML }\n return templateData.textData\n } else {\n var valueToWrite = arguments[0]\n setTemplateDomData(this.domElement, {textData: valueToWrite})\n }\n}\n","// If you want to make a custom template engine,\n//\n// [1] Inherit from this class (like ko.nativeTemplateEngine does)\n// [2] Override 'renderTemplateSource', supplying a function with this signature:\n//\n// function (templateSource, bindingContext, options) {\n// // - templateSource.text() is the text of the template you should render\n// // - bindingContext.$data is the data you should pass into the template\n// // - you might also want to make bindingContext.$parent, bindingContext.$parents,\n// // and bindingContext.$root available in the template too\n// // - options gives you access to any other properties set on \"data-bind: { template: options }\"\n// // - templateDocument is the document object of the template\n// //\n// // Return value: an array of DOM nodes\n// }\n//\n// [3] Override 'createJavaScriptEvaluatorBlock', supplying a function with this signature:\n//\n// function (script) {\n// // Return value: Whatever syntax means \"Evaluate the JavaScript statement 'script' and output the result\"\n// // For example, the jquery.tmpl template engine converts 'someScript' to '${ someScript }'\n// }\n//\n// This is only necessary if you want to allow data-bind attributes to reference arbitrary template variables.\n// If you don't want to allow that, you can set the property 'allowTemplateRewriting' to false (like ko.nativeTemplateEngine does)\n// and then you don't need to override 'createJavaScriptEvaluatorBlock'.\n\nimport {\n extend, options\n} from '@tko/utils'\n\nimport {\n domElement, anonymousTemplate\n} from './templateSources'\n\nexport function templateEngine () { };\n\nextend(templateEngine.prototype, {\n renderTemplateSource: function (templateSource, bindingContext, options, templateDocument) {\n options.onError('Override renderTemplateSource')\n },\n\n createJavaScriptEvaluatorBlock: function (script) {\n options.onError('Override createJavaScriptEvaluatorBlock')\n },\n\n makeTemplateSource: function (template, templateDocument) {\n // Named template\n if (typeof template === 'string') {\n templateDocument = templateDocument || document\n var elem = templateDocument.getElementById(template)\n if (!elem) { options.onError('Cannot find template with ID ' + template) }\n return new domElement(elem)\n } else if ((template.nodeType == 1) || (template.nodeType == 8)) {\n // Anonymous template\n return new anonymousTemplate(template)\n } else { options.onError('Unknown template type: ' + template) }\n },\n\n renderTemplate: function (template, bindingContext, options, templateDocument) {\n var templateSource = this['makeTemplateSource'](template, templateDocument)\n return this.renderTemplateSource(templateSource, bindingContext, options, templateDocument)\n }\n})\n","import {\n virtualElements, fixUpContinuousNodeArray, replaceDomNodes, memoization,\n domNodeIsAttachedToDocument, moveCleanedNodesToContainerElement,\n arrayFilter, domData, options as koOptions\n} from '@tko/utils'\n\nimport {\n applyBindings, setDomNodeChildrenFromArrayMapping, AsyncBindingHandler,\n bindingEvent, bindingContext as BindingContextConstructor\n} from '@tko/bind'\n\nimport {\n computed\n} from '@tko/computed'\n\nimport {\n isObservable, dependencyDetection, unwrap, observable, isObservableArray\n} from '@tko/observable'\n\nimport {\n templateEngine\n} from './templateEngine'\n\nimport {\n anonymousTemplate as AnonymousTemplate\n} from './templateSources'\n\nvar _templateEngine\nconst cleanContainerDomDataKey = domData.nextKey()\n\nexport function setTemplateEngine (tEngine) {\n if ((tEngine !== undefined) && !(tEngine instanceof templateEngine)) {\n // TODO: ko.templateEngine to appropriate name\n throw new Error('templateEngine must inherit from ko.templateEngine')\n }\n _templateEngine = tEngine\n}\n\nfunction invokeForEachNodeInContinuousRange (firstNode, lastNode, action) {\n let node\n let nextInQueue = firstNode\n let firstOutOfRangeNode = virtualElements.nextSibling(lastNode)\n while (nextInQueue && ((node = nextInQueue) !== firstOutOfRangeNode)) {\n nextInQueue = virtualElements.nextSibling(node)\n action(node, nextInQueue)\n }\n}\n\nfunction activateBindingsOnContinuousNodeArray (continuousNodeArray, bindingContext, afterBindingCallback) {\n // To be used on any nodes that have been rendered by a template and have been inserted into some parent element\n // Walks through continuousNodeArray (which *must* be continuous, i.e., an uninterrupted sequence of sibling nodes, because\n // the algorithm for walking them relies on this), and for each top-level item in the virtual-element sense,\n // (1) Does a regular \"applyBindings\" to associate bindingContext with this node and to activate any non-memoized bindings\n // (2) Unmemoizes any memos in the DOM subtree (e.g., to activate bindings that had been memoized during template rewriting)\n\n if (continuousNodeArray.length) {\n var firstNode = continuousNodeArray[0]\n var lastNode = continuousNodeArray[continuousNodeArray.length - 1]\n var parentNode = firstNode.parentNode\n var provider = koOptions.bindingProviderInstance\n var preprocessNode = provider.preprocessNode\n\n if (preprocessNode) {\n invokeForEachNodeInContinuousRange(firstNode, lastNode, function (node, nextNodeInRange) {\n var nodePreviousSibling = node.previousSibling\n var newNodes = preprocessNode.call(provider, node)\n if (newNodes) {\n if (node === firstNode) { firstNode = newNodes[0] || nextNodeInRange }\n if (node === lastNode) { lastNode = newNodes[newNodes.length - 1] || nodePreviousSibling }\n }\n })\n\n // Because preprocessNode can change the nodes, including the first and last nodes, update continuousNodeArray to match.\n // We need the full set, including inner nodes, because the unmemoize step might remove the first node (and so the real\n // first node needs to be in the array).\n continuousNodeArray.length = 0\n if (!firstNode) { // preprocessNode might have removed all the nodes, in which case there's nothing left to do\n return\n }\n if (firstNode === lastNode) {\n continuousNodeArray.push(firstNode)\n } else {\n continuousNodeArray.push(firstNode, lastNode)\n fixUpContinuousNodeArray(continuousNodeArray, parentNode)\n }\n }\n\n // Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind)\n // whereas a regular applyBindings won't introduce new memoized nodes\n invokeForEachNodeInContinuousRange(firstNode, lastNode, function (node) {\n if (node.nodeType === 1 || node.nodeType === 8) { applyBindings(bindingContext, node).then(afterBindingCallback) }\n })\n invokeForEachNodeInContinuousRange(firstNode, lastNode, function (node) {\n if (node.nodeType === 1 || node.nodeType === 8) { memoization.unmemoizeDomNodeAndDescendants(node, [bindingContext]) }\n })\n\n // Make sure any changes done by applyBindings or unmemoize are reflected in the array\n fixUpContinuousNodeArray(continuousNodeArray, parentNode)\n }\n}\n\nfunction getFirstNodeFromPossibleArray (nodeOrNodeArray) {\n return nodeOrNodeArray.nodeType ? nodeOrNodeArray\n : nodeOrNodeArray.length > 0 ? nodeOrNodeArray[0]\n : null\n}\n\nfunction executeTemplate (targetNodeOrNodeArray, renderMode, template, bindingContext, options, afterBindingCallback) {\n options = options || {}\n var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray)\n var templateDocument = (firstTargetNode || template || {}).ownerDocument\n var templateEngineToUse = (options.templateEngine || _templateEngine)\n var renderedNodesArray = templateEngineToUse.renderTemplate(template, bindingContext, options, templateDocument)\n\n // Loosely check result is an array of DOM nodes\n if ((typeof renderedNodesArray.length !== 'number') || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType !== 'number')) { throw new Error('Template engine must return an array of DOM nodes') }\n\n var haveAddedNodesToParent = false\n switch (renderMode) {\n case 'replaceChildren':\n virtualElements.setDomNodeChildren(targetNodeOrNodeArray, renderedNodesArray)\n haveAddedNodesToParent = true\n break\n case 'replaceNode':\n replaceDomNodes(targetNodeOrNodeArray, renderedNodesArray)\n haveAddedNodesToParent = true\n break\n case 'ignoreTargetNode': break\n default:\n throw new Error('Unknown renderMode: ' + renderMode)\n }\n\n if (haveAddedNodesToParent) {\n activateBindingsOnContinuousNodeArray(renderedNodesArray, bindingContext, afterBindingCallback)\n if (options.afterRender) { dependencyDetection.ignore(options.afterRender, null, [renderedNodesArray, bindingContext['$data']]) }\n if (renderMode === 'replaceChildren') {\n bindingEvent.notify(targetNodeOrNodeArray, bindingEvent.childrenComplete)\n }\n }\n\n return renderedNodesArray\n}\n\nfunction resolveTemplateName (template, data, context) {\n // The template can be specified as:\n if (isObservable(template)) {\n // 1. An observable, with string value\n return template()\n } else if (typeof template === 'function') {\n // 2. A function of (data, context) returning a string\n return template(data, context)\n } else {\n // 3. A string\n return template\n }\n}\n\nexport function renderTemplate (template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode, afterBindingCallback) {\n options = options || {}\n if ((options.templateEngine || _templateEngine) === undefined) { throw new Error('Set a template engine before calling renderTemplate') }\n renderMode = renderMode || 'replaceChildren'\n\n if (targetNodeOrNodeArray) {\n var firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray)\n\n var whenToDispose = function () { return (!firstTargetNode) || !domNodeIsAttachedToDocument(firstTargetNode) } // Passive disposal (on next evaluation)\n var activelyDisposeWhenNodeIsRemoved = (firstTargetNode && renderMode === 'replaceNode') ? firstTargetNode.parentNode : firstTargetNode\n\n return computed( // So the DOM is automatically updated when any dependency changes\n function () {\n // Ensure we've got a proper binding context to work with\n var bindingContext = (dataOrBindingContext && (dataOrBindingContext instanceof BindingContextConstructor))\n ? dataOrBindingContext\n : new BindingContextConstructor(dataOrBindingContext, null, null, null, { 'exportDependencies': true })\n\n var templateName = resolveTemplateName(template, bindingContext.$data, bindingContext)\n const renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext, options, afterBindingCallback)\n\n if (renderMode === 'replaceNode') {\n targetNodeOrNodeArray = renderedNodesArray\n firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray)\n }\n },\n null,\n { disposeWhen: whenToDispose, disposeWhenNodeIsRemoved: activelyDisposeWhenNodeIsRemoved }\n )\n } else {\n // We don't yet have a DOM node to evaluate, so use a memo and render the template later when there is a DOM node\n return memoization.memoize(function (domNode) {\n renderTemplate(template, dataOrBindingContext, options, domNode, 'replaceNode')\n })\n }\n}\n\nexport default function renderTemplateForEach (template, arrayOrObservableArray, options, targetNode, parentBindingContext, afterBindingCallback) {\n // Since setDomNodeChildrenFromArrayMapping always calls executeTemplateForArrayItem and then\n // activateBindingsCallback for added items, we can store the binding context in the former to use in the latter.\n var arrayItemContext\n\n // This will be called by setDomNodeChildrenFromArrayMapping to get the nodes to add to targetNode\n function executeTemplateForArrayItem (arrayValue, index) {\n // Support selecting template as a function of the data being rendered\n if (options.as) {\n if (koOptions.createChildContextWithAs) {\n arrayItemContext = parentBindingContext.createChildContext(\n arrayValue, options.as, context => { context.$index = index }\n )\n } else {\n arrayItemContext = parentBindingContext.extend({\n [options.as]: arrayValue,\n $index: index\n })\n }\n } else {\n arrayItemContext = parentBindingContext.createChildContext(arrayValue, options.as, context => { context.$index = index })\n }\n\n var templateName = resolveTemplateName(template, arrayValue, arrayItemContext)\n return executeTemplate(targetNode, 'ignoreTargetNode', templateName, arrayItemContext, options, afterBindingCallback)\n }\n\n // This will be called whenever setDomNodeChildrenFromArrayMapping has added nodes to targetNode\n var activateBindingsCallback = function (arrayValue, addedNodesArray /*, index */) {\n activateBindingsOnContinuousNodeArray(addedNodesArray, arrayItemContext, afterBindingCallback)\n if (options.afterRender) { options.afterRender(addedNodesArray, arrayValue) }\n\n // release the \"cache\" variable, so that it can be collected by\n // the GC when its value isn't used from within the bindings anymore.\n arrayItemContext = null\n }\n\n // Call setDomNodeChildrenFromArrayMapping, ignoring any observables unwrapped within (most likely from a callback function).\n // If the array items are observables, though, they will be unwrapped in executeTemplateForArrayItem and managed within setDomNodeChildrenFromArrayMapping.\n function localSetDomNodeChildrenFromArrayMapping (newArray, changeList) {\n dependencyDetection.ignore(setDomNodeChildrenFromArrayMapping, null, [targetNode, newArray, executeTemplateForArrayItem, options, activateBindingsCallback, changeList])\n bindingEvent.notify(targetNode, bindingEvent.childrenComplete)\n }\n\n const shouldHideDestroyed = (options.includeDestroyed === false) || (koOptions.foreachHidesDestroyed && !options.includeDestroyed);\n if (!shouldHideDestroyed && !options.beforeRemove && isObservableArray(arrayOrObservableArray)) {\n localSetDomNodeChildrenFromArrayMapping(arrayOrObservableArray.peek())\n var subscription = arrayOrObservableArray.subscribe(function (changeList) {\n localSetDomNodeChildrenFromArrayMapping(arrayOrObservableArray(), changeList)\n }, null, 'arrayChange')\n subscription.disposeWhenNodeIsRemoved(targetNode)\n return subscription\n } else {\n return computed(function () {\n var unwrappedArray = unwrap(arrayOrObservableArray) || []\n const unwrappedIsIterable = Symbol.iterator in unwrappedArray\n if (!unwrappedIsIterable) { unwrappedArray = [unwrappedArray] }\n if (shouldHideDestroyed) {\n // Filter out any entries marked as destroyed\n unwrappedArray = arrayFilter(unwrappedArray, function (item) {\n return item === undefined || item === null || !unwrap(item._destroy);\n })\n }\n localSetDomNodeChildrenFromArrayMapping(unwrappedArray)\n }, null, { disposeWhenNodeIsRemoved: targetNode })\n }\n}\n\nlet templateComputedDomDataKey = domData.nextKey()\n\nexport class TemplateBindingHandler extends AsyncBindingHandler {\n constructor (params) {\n super(params)\n const element = this.$element\n const bindingValue = unwrap(this.value)\n\n // Expose 'conditional' for `else` chaining.\n domData.set(element, 'conditional', {\n elseChainSatisfied: observable(true)\n })\n\n // Support anonymous templates\n if (typeof bindingValue === 'string' || bindingValue.name) {\n this.bindNamedTemplate()\n } else if ('nodes' in bindingValue) {\n this.bindNodeTemplate(bindingValue.nodes || [])\n } else {\n this.bindAnonymousTemplate()\n }\n }\n\n bindNamedTemplate () {\n // It's a named template - clear the element\n virtualElements.emptyNode(this.$element)\n }\n\n // We've been given an array of DOM nodes. Save them as the template source.\n // There is no known use case for the node array being an observable array (if the output\n // varies, put that behavior *into* your template - that's what templates are for), and\n // the implementation would be a mess, so assert that it's not observable.\n bindNodeTemplate (nodes) {\n if (isObservable(nodes)) {\n throw new Error('The \"nodes\" option must be a plain, non-observable array.')\n }\n\n // If the nodes are already attached to a KO-generated container, we reuse that container without moving the\n // elements to a new one (we check only the first node, as the nodes are always moved together)\n let container = nodes[0] && nodes[0].parentNode\n if (!container || !domData.get(container, cleanContainerDomDataKey)) {\n container = moveCleanedNodesToContainerElement(nodes)\n domData.set(container, cleanContainerDomDataKey, true)\n }\n\n new AnonymousTemplate(this.$element).nodes(container)\n }\n\n bindAnonymousTemplate () {\n // It's an anonymous template - store the element contents, then clear the element\n const templateNodes = virtualElements.childNodes(this.$element)\n if (templateNodes.length === 0) {\n throw new Error('Anonymous template defined, but no template content was provided.')\n }\n const container = moveCleanedNodesToContainerElement(templateNodes) // This also removes the nodes from their current parent\n new AnonymousTemplate(this.$element).nodes(container)\n }\n\n onValueChange () {\n const element = this.$element\n const bindingContext = this.$context\n var value = this.value\n var options = unwrap(value)\n var shouldDisplay = true\n var templateComputed = null\n var elseChainSatisfied = domData.get(element, 'conditional').elseChainSatisfied\n var templateName\n\n if (typeof options === 'string') {\n templateName = value\n options = {}\n } else {\n templateName = options.name\n\n // Support \"if\"/\"ifnot\" conditions\n if ('if' in options) {\n shouldDisplay = unwrap(options.if)\n }\n\n if (shouldDisplay && 'ifnot' in options) {\n shouldDisplay = !unwrap(options.ifnot)\n }\n }\n\n if ('foreach' in options) {\n // Render once for each data point (treating data set as empty if shouldDisplay==false)\n var dataArray = (shouldDisplay && options.foreach) || []\n templateComputed = renderTemplateForEach(templateName || element, dataArray, options, element, bindingContext, this.completeBinding)\n\n elseChainSatisfied((unwrap(dataArray) || []).length !== 0)\n } else if (shouldDisplay) {\n // Render once for this single data point (or use the viewModel if no data was provided)\n var innerBindingContext = ('data' in options)\n ? bindingContext.createStaticChildContext(options.data, options.as) // Given an explicit 'data' value, we create a child binding context for it\n : bindingContext // Given no explicit 'data' value, we retain the same binding context\n templateComputed = renderTemplate(templateName || element, innerBindingContext, options, element, undefined, this.completeBinding)\n elseChainSatisfied(true)\n } else {\n virtualElements.emptyNode(element)\n elseChainSatisfied(false)\n }\n\n // It only makes sense to have a single template computed per element (otherwise which one should have its output displayed?)\n this.disposeOldComputedAndStoreNewOne(element, templateComputed)\n }\n\n disposeOldComputedAndStoreNewOne (element, newComputed) {\n let oldComputed = domData.get(element, templateComputedDomDataKey)\n if (oldComputed && (typeof oldComputed.dispose === 'function')) { oldComputed.dispose() }\n domData.set(element, templateComputedDomDataKey, (newComputed && (!newComputed.isActive || newComputed.isActive())) ? newComputed : undefined)\n }\n\n get controlsDescendants () { return true }\n static get allowVirtualElements () { return true }\n}\n","\nimport {\n extend, options, ieVersion, makeArray, parseHtmlFragment\n} from '@tko/utils'\n\nimport {\n templateEngine\n} from './templateEngine'\n\nimport {\n setTemplateEngine\n} from './templating'\n\nexport function nativeTemplateEngine () {\n}\n\nnativeTemplateEngine.prototype = new templateEngine()\nnativeTemplateEngine.prototype.constructor = nativeTemplateEngine\nnativeTemplateEngine.prototype.renderTemplateSource = function (templateSource, bindingContext, options, templateDocument) {\n var useNodesIfAvailable = !(ieVersion < 9), // IE<9 cloneNode doesn't work properly\n templateNodesFunc = useNodesIfAvailable ? templateSource.nodes : null,\n templateNodes = templateNodesFunc ? templateSource.nodes() : null\n\n if (templateNodes) {\n return makeArray(templateNodes.cloneNode(true).childNodes)\n } else {\n var templateText = templateSource.text()\n return parseHtmlFragment(templateText, templateDocument)\n }\n}\n\nnativeTemplateEngine.instance = new nativeTemplateEngine()\nsetTemplateEngine(nativeTemplateEngine.instance)\n","\nimport {\n subscribable, dependencyDetection\n} from '@tko/observable'\n\nimport {\n getObjectOwnProperty, tasks\n} from '@tko/utils'\n\nvar loadingSubscribablesCache = {}, // Tracks component loads that are currently in flight\n loadedDefinitionsCache = {} // Tracks component loads that have already completed\n\nfunction loadComponentAndNotify (componentName, callback) {\n var _subscribable = getObjectOwnProperty(loadingSubscribablesCache, componentName),\n completedAsync\n if (!_subscribable) {\n // It's not started loading yet. Start loading, and when it's done, move it to loadedDefinitionsCache.\n _subscribable = loadingSubscribablesCache[componentName] = new subscribable()\n _subscribable.subscribe(callback)\n\n beginLoadingComponent(componentName, function (definition, config) {\n var isSynchronousComponent = !!(config && config.synchronous)\n loadedDefinitionsCache[componentName] = { definition: definition, isSynchronousComponent: isSynchronousComponent }\n delete loadingSubscribablesCache[componentName]\n\n // For API consistency, all loads complete asynchronously. However we want to avoid\n // adding an extra task schedule if it's unnecessary (i.e., the completion is already\n // async).\n //\n // You can bypass the 'always asynchronous' feature by putting the synchronous:true\n // flag on your component configuration when you register it.\n if (completedAsync || isSynchronousComponent) {\n // Note that notifySubscribers ignores any dependencies read within the callback.\n // See comment in loaderRegistryBehaviors.js for reasoning\n _subscribable.notifySubscribers(definition)\n } else {\n tasks.schedule(function () {\n _subscribable.notifySubscribers(definition)\n })\n }\n })\n completedAsync = true\n } else {\n _subscribable.subscribe(callback)\n }\n}\n\nfunction beginLoadingComponent (componentName, callback) {\n getFirstResultFromLoaders('getConfig', [componentName], function (config) {\n if (config) {\n // We have a config, so now load its definition\n getFirstResultFromLoaders('loadComponent', [componentName, config], function (definition) {\n callback(definition, config)\n })\n } else {\n // The component has no config - it's unknown to all the loaders.\n // Note that this is not an error (e.g., a module loading error) - that would abort the\n // process and this callback would not run. For this callback to run, all loaders must\n // have confirmed they don't know about this component.\n callback(null, null)\n }\n })\n}\n\nfunction getFirstResultFromLoaders (methodName, argsExceptCallback, callback, candidateLoaders) {\n // On the first call in the stack, start with the full set of loaders\n if (!candidateLoaders) {\n candidateLoaders = registry.loaders.slice(0) // Use a copy, because we'll be mutating this array\n }\n\n // Try the next candidate\n var currentCandidateLoader = candidateLoaders.shift()\n if (currentCandidateLoader) {\n var methodInstance = currentCandidateLoader[methodName]\n if (methodInstance) {\n var wasAborted = false,\n synchronousReturnValue = methodInstance.apply(currentCandidateLoader, argsExceptCallback.concat(function (result) {\n if (wasAborted) {\n callback(null)\n } else if (result !== null) {\n // This candidate returned a value. Use it.\n callback(result)\n } else {\n // Try the next candidate\n getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders)\n }\n }))\n\n // Currently, loaders may not return anything synchronously. This leaves open the possibility\n // that we'll extend the API to support synchronous return values in the future. It won't be\n // a breaking change, because currently no loader is allowed to return anything except undefined.\n if (synchronousReturnValue !== undefined) {\n wasAborted = true\n\n // Method to suppress exceptions will remain undocumented. This is only to keep\n // KO's specs running tidily, since we can observe the loading got aborted without\n // having exceptions cluttering up the console too.\n if (!currentCandidateLoader.suppressLoaderExceptions) {\n throw new Error('Component loaders must supply values by invoking the callback, not by returning values synchronously.')\n }\n }\n } else {\n // This candidate doesn't have the relevant handler. Synchronously move on to the next one.\n getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders)\n }\n } else {\n // No candidates returned a value\n callback(null)\n }\n}\n\nexport var registry = {\n get (componentName, callback) {\n var cachedDefinition = getObjectOwnProperty(loadedDefinitionsCache, componentName)\n if (cachedDefinition) {\n // It's already loaded and cached. Reuse the same definition object.\n // Note that for API consistency, even cache hits complete asynchronously by default.\n // You can bypass this by putting synchronous:true on your component config.\n if (cachedDefinition.isSynchronousComponent) {\n dependencyDetection.ignore(function () { // See comment in loaderRegistryBehaviors.js for reasoning\n callback(cachedDefinition.definition)\n })\n } else {\n tasks.schedule(function () { callback(cachedDefinition.definition) })\n }\n } else {\n // Join the loading process that is already underway, or start a new one.\n loadComponentAndNotify(componentName, callback)\n }\n },\n\n clearCachedDefinition (componentName) {\n delete loadedDefinitionsCache[componentName]\n },\n\n _getFirstResultFromLoaders: getFirstResultFromLoaders,\n\n loaders: []\n}\n","\nimport {\n isDomElement, isDocumentFragment, tagNameLower, parseHtmlFragment,\n makeArray, cloneNodes, hasOwnProperty\n} from '@tko/utils'\n\nimport {registry} from './registry'\n\n// The default loader is responsible for two things:\n// 1. Maintaining the default in-memory registry of component configuration objects\n// (i.e., the thing you're writing to when you call ko.components.register(someName, ...))\n// 2. Answering requests for components by fetching configuration objects\n// from that default in-memory registry and resolving them into standard\n// component definition objects (of the form { createViewModel: ..., template: ... })\n// Custom loaders may override either of these facilities, i.e.,\n// 1. To supply configuration objects from some other source (e.g., conventions)\n// 2. Or, to resolve configuration objects by loading viewmodels/templates via arbitrary logic.\n\nexport var defaultConfigRegistry = {}\nexport const VIEW_MODEL_FACTORY = Symbol('Knockout View Model ViewModel factory')\n\nexport function register (componentName, config) {\n if (!config) {\n throw new Error('Invalid configuration for ' + componentName)\n }\n\n if (isRegistered(componentName)) {\n throw new Error('Component ' + componentName + ' is already registered')\n }\n\n const ceok = componentName.includes('-') && componentName.toLowerCase() === componentName\n\n if (!config.ignoreCustomElementWarning && !ceok) {\n console.log(`\n🥊 Knockout warning: components for custom elements must be lowercase and contain a dash. To ignore this warning, add to the 'config' of .register(componentName, config):\n\n ignoreCustomElementWarning: true\n `)\n }\n\n defaultConfigRegistry[componentName] = config\n}\n\nexport function isRegistered (componentName) {\n return hasOwnProperty(defaultConfigRegistry, componentName)\n}\n\nexport function unregister (componentName) {\n delete defaultConfigRegistry[componentName]\n registry.clearCachedDefinition(componentName)\n}\n\nexport var defaultLoader = {\n getConfig: function (componentName, callback) {\n var result = hasOwnProperty(defaultConfigRegistry, componentName)\n ? defaultConfigRegistry[componentName]\n : null\n callback(result)\n },\n\n loadComponent: function (componentName, config, callback) {\n var errorCallback = makeErrorCallback(componentName)\n possiblyGetConfigFromAmd(errorCallback, config, function (loadedConfig) {\n resolveConfig(componentName, errorCallback, loadedConfig, callback)\n })\n },\n\n loadTemplate: function (componentName, templateConfig, callback) {\n resolveTemplate(makeErrorCallback(componentName), templateConfig, callback)\n },\n\n loadViewModel: function (componentName, viewModelConfig, callback) {\n resolveViewModel(makeErrorCallback(componentName), viewModelConfig, callback)\n }\n}\n\nvar createViewModelKey = 'createViewModel'\n\n// Takes a config object of the form { template: ..., viewModel: ... }, and asynchronously convert it\n// into the standard component definition format:\n// { template: <ArrayOfDomNodes>, createViewModel: function(params, componentInfo) { ... } }.\n// Since both template and viewModel may need to be resolved asynchronously, both tasks are performed\n// in parallel, and the results joined when both are ready. We don't depend on any promises infrastructure,\n// so this is implemented manually below.\nfunction resolveConfig (componentName, errorCallback, config, callback) {\n var result = {},\n makeCallBackWhenZero = 2,\n tryIssueCallback = function () {\n if (--makeCallBackWhenZero === 0) {\n callback(result)\n }\n },\n templateConfig = config['template'],\n viewModelConfig = config['viewModel']\n\n if (templateConfig) {\n possiblyGetConfigFromAmd(errorCallback, templateConfig, function (loadedConfig) {\n registry._getFirstResultFromLoaders('loadTemplate', [componentName, loadedConfig], function (resolvedTemplate) {\n result['template'] = resolvedTemplate\n tryIssueCallback()\n })\n })\n } else {\n tryIssueCallback()\n }\n\n if (viewModelConfig) {\n possiblyGetConfigFromAmd(errorCallback, viewModelConfig, function (loadedConfig) {\n registry._getFirstResultFromLoaders('loadViewModel', [componentName, loadedConfig], function (resolvedViewModel) {\n result[createViewModelKey] = resolvedViewModel\n tryIssueCallback()\n })\n })\n } else {\n tryIssueCallback()\n }\n}\n\nfunction resolveTemplate (errorCallback, templateConfig, callback) {\n if (typeof templateConfig === 'string') {\n // Markup - parse it\n callback(parseHtmlFragment(templateConfig))\n } else if (templateConfig instanceof Array) {\n // Assume already an array of DOM nodes - pass through unchanged\n callback(templateConfig)\n } else if (isDocumentFragment(templateConfig)) {\n // Document fragment - use its child nodes\n callback(makeArray(templateConfig.childNodes))\n } else if (templateConfig.element) {\n var element = templateConfig.element\n if (isDomElement(element)) {\n // Element instance - copy its child nodes\n callback(cloneNodesFromTemplateSourceElement(element))\n } else if (typeof element === 'string') {\n // Element ID - find it, then copy its child nodes\n var elemInstance = document.getElementById(element)\n if (elemInstance) {\n callback(cloneNodesFromTemplateSourceElement(elemInstance))\n } else {\n errorCallback('Cannot find element with ID ' + element)\n }\n } else {\n errorCallback('Unknown element type: ' + element)\n }\n } else if (templateConfig.elementName) {\n // JSX in the style of babel-plugin-transform-jsx\n callback(templateConfig)\n } else {\n errorCallback('Unknown template value: ' + templateConfig)\n }\n}\n\nfunction resolveViewModel (errorCallback, viewModelConfig, callback) {\n if (viewModelConfig[VIEW_MODEL_FACTORY]) {\n callback((...args) => viewModelConfig[VIEW_MODEL_FACTORY](...args))\n } else if (typeof viewModelConfig === 'function') {\n // Constructor - convert to standard factory function format\n // By design, this does *not* supply componentInfo to the constructor, as the intent is that\n // componentInfo contains non-viewmodel data (e.g., the component's element) that should only\n // be used in factory functions, not viewmodel constructors.\n callback(function (params /*, componentInfo */) {\n return new viewModelConfig(params)\n })\n } else if (typeof viewModelConfig[createViewModelKey] === 'function') {\n // Already a factory function - use it as-is\n callback(viewModelConfig[createViewModelKey])\n } else if ('instance' in viewModelConfig) {\n // Fixed object instance - promote to createViewModel format for API consistency\n var fixedInstance = viewModelConfig['instance']\n callback(function (/* params, componentInfo */) {\n return fixedInstance\n })\n } else if ('viewModel' in viewModelConfig) {\n // Resolved AMD module whose value is of the form { viewModel: ... }\n resolveViewModel(errorCallback, viewModelConfig['viewModel'], callback)\n } else {\n errorCallback('Unknown viewModel value: ' + viewModelConfig)\n }\n}\n\nfunction cloneNodesFromTemplateSourceElement (elemInstance) {\n switch (tagNameLower(elemInstance)) {\n case 'script':\n return parseHtmlFragment(elemInstance.text)\n case 'textarea':\n return parseHtmlFragment(elemInstance.value)\n case 'template':\n // For browsers with proper <template> element support (i.e., where the .content property\n // gives a document fragment), use that document fragment.\n if (isDocumentFragment(elemInstance.content)) {\n return cloneNodes(elemInstance.content.childNodes)\n }\n }\n\n // Regular elements such as <div>, and <template> elements on old browsers that don't really\n // understand <template> and just treat it as a regular container\n return cloneNodes(elemInstance.childNodes)\n}\n\nfunction possiblyGetConfigFromAmd (errorCallback, config, callback) {\n if (typeof config.require === 'string') {\n // The config is the value of an AMD module\n if (window.amdRequire || window.require) {\n (window.amdRequire || window.require)([config.require], callback)\n } else {\n errorCallback('Uses require, but no AMD loader is present')\n }\n } else {\n callback(config)\n }\n}\n\nfunction makeErrorCallback (componentName) {\n return function (message) {\n throw new Error('Component \\'' + componentName + '\\': ' + message)\n }\n}\n\n// By default, the default loader is the only registered component loader\nregistry.loaders.push(defaultLoader)\n","\nimport {\n Parser\n} from '@tko/utils.parser'\n\nconst INNER_EXPRESSION = /^([\\s\\S]*)}}([\\s\\S]*?)\\{\\{([\\s\\S]*)$/\nconst OUTER_EXPRESSION = /^([\\s\\S]*?)\\{\\{([\\s\\S]*)}}([\\s\\S]*)$/\nconst BINDING_EXPRESSION = /^([^,\"'{}()/:[\\]\\s]+)\\s+([^\\s:].*)/\n\nclass Interpolated {\n constructor (text) {\n this.text = text\n }\n\n trim (string) {\n return string === null ? '' : string.trim()\n }\n}\n\nclass Expression extends Interpolated {\n asAttr (context, globals, node) {\n return new Parser().parseExpression(this.text, context, globals, node)()\n }\n\n * textNodeReplacement (textNode) {\n const text = this.trim(this.text)\n const ownerDocument = textNode ? textNode.ownerDocument : document\n const firstChar = text[0]\n const lastChar = text[text.length - 1]\n var closeComment = true\n var binding\n\n if (firstChar === '#') {\n if (lastChar === '/') {\n binding = text.slice(1, -1)\n } else {\n binding = text.slice(1)\n closeComment = false\n }\n const matches = binding.match(BINDING_EXPRESSION)\n if (matches) {\n binding = matches[1] + ':' + matches[2]\n }\n } else if (firstChar === '/') {\n // replace only with a closing comment\n } else if (firstChar === '{' && lastChar === '}') {\n binding = 'html:' + this.trim(text.slice(1, -1))\n } else {\n binding = 'text:' + this.trim(text)\n }\n\n if (binding) {\n yield ownerDocument.createComment('ko ' + binding)\n }\n if (closeComment) {\n yield ownerDocument.createComment('/ko')\n }\n }\n}\n\nclass Text extends Interpolated {\n asAttr () { return this.text }\n\n * textNodeReplacement () {\n yield document.createTextNode(this.text.replace(/\"/g, '\\\\\"'))\n }\n}\n\n/**\n * Interpolation Parsing\n */\nexport function * innerParse (text) {\n const innerMatch = text.match(INNER_EXPRESSION)\n if (innerMatch) {\n const [pre, inner, post] = innerMatch.slice(1)\n yield * innerParse(pre)\n yield new Text(inner)\n yield new Expression(post)\n } else {\n yield new Expression(text)\n }\n}\n\nexport function * parseOuterMatch (outerMatch) {\n if (!outerMatch) { return }\n let [pre, inner, post] = outerMatch.slice(1)\n yield new Text(pre)\n yield * innerParse(inner)\n yield new Text(post)\n}\n\nexport function * parseInterpolation (text) {\n for (const textOrExpr of parseOuterMatch(text.match(OUTER_EXPRESSION))) {\n if (textOrExpr.text) { yield textOrExpr }\n }\n}\n","\nimport {\n objectForEach, registerEventHandler, makeArray,\n throttle as throttleFn, debounce as debounceFn\n} from '@tko/utils'\n\n// For certain common events (currently just 'click'), allow a simplified data-binding syntax\n// e.g. click:handler instead of the usual full-length event:{click:handler}\nexport function makeEventHandlerShortcut (eventName) {\n return {\n init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {\n var newValueAccessor = function () {\n var result = {}\n result[eventName] = valueAccessor()\n return result\n }\n eventHandler.init.call(this, element, newValueAccessor, allBindings, viewModel, bindingContext)\n }\n }\n}\n\nfunction makeDescriptor (handlerOrObject) {\n return typeof handlerOrObject === 'function' ? { handler: handlerOrObject } : handlerOrObject || {}\n}\n\nexport const eventHandler = {\n init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {\n var eventsToHandle = valueAccessor() || {}\n objectForEach(eventsToHandle, function (eventName, descriptor) {\n const {passive, capture, once, debounce, throttle} = makeDescriptor(descriptor)\n const eventOptions = (capture || passive || once) && {capture, passive, once}\n\n let eventHandlerFn = (event, ...more) => {\n var handlerReturnValue\n const {handler, passive, bubble} = makeDescriptor(valueAccessor()[eventName])\n\n try {\n // Take all the event args, and prefix with the viewmodel\n if (handler) {\n const possiblyUpdatedViewModel = bindingContext.$data\n const argsForHandler = [possiblyUpdatedViewModel, event, ...more]\n handlerReturnValue = handler.apply(possiblyUpdatedViewModel, argsForHandler)\n }\n } finally {\n if (handlerReturnValue !== true) {\n // Normally we want to prevent default action. Developer can override this be explicitly returning true.\n // preventDefault will throw an error if the event is passive.\n if (event.preventDefault) {\n if (!passive) { event.preventDefault() }\n } else {\n event.returnValue = false\n }\n }\n }\n\n const bubbleMark = allBindings.get(eventName + 'Bubble') !== false\n if (bubble === false || !bubbleMark) {\n event.cancelBubble = true\n if (event.stopPropagation) { event.stopPropagation() }\n }\n }\n\n if (debounce) { eventHandlerFn = debounceFn(eventHandlerFn, debounce) }\n if (throttle) { eventHandlerFn = throttleFn(eventHandlerFn, throttle) }\n\n registerEventHandler(element, eventName, eventHandlerFn, eventOptions || false)\n })\n }\n}\n\nexport const onHandler = {\n init: eventHandler.init,\n preprocess: function (value, key, addBinding) {\n addBinding(key.replace('on.', ''), '=>' + value)\n }\n}\n","// index.js\n// --------\n// Fast For Each\n//\n// Employing sound techniques to make a faster Knockout foreach binding.\n// --------\n\nimport {\n arrayForEach, cleanNode, options, virtualElements,\n createSymbolOrString, domData, domNodeIsContainedBy\n} from '@tko/utils'\n\nimport {\n isObservable, unwrap, observable\n} from '@tko/observable'\n\nimport {\n contextFor, applyBindingsToDescendants, AsyncBindingHandler\n} from '@tko/bind'\n\n// Utilities\nconst MAX_LIST_SIZE = 9007199254740991\n\n// from https://github.com/jonschlinkert/is-plain-object\nfunction isPlainObject (o) {\n return !!o && typeof o === 'object' && o.constructor === Object\n}\n\nconst supportsDocumentFragment = options.document && typeof options.document.createDocumentFragment === 'function'\n\n// Get a copy of the (possibly virtual) child nodes of the given element,\n// put them into a container, then empty the given node.\nfunction makeTemplateNode (sourceNode) {\n var container = document.createElement('div')\n var parentNode\n if (sourceNode.content) {\n // For e.g. <template> tags\n parentNode = sourceNode.content\n } else if (sourceNode.tagName === 'SCRIPT') {\n parentNode = document.createElement('div')\n parentNode.innerHTML = sourceNode.text\n } else {\n // Anything else e.g. <div>\n parentNode = sourceNode\n }\n arrayForEach(virtualElements.childNodes(parentNode), function (child) {\n // FIXME - This cloneNode could be expensive; we may prefer to iterate over the\n // parentNode children in reverse (so as not to foul the indexes as childNodes are\n // removed from parentNode when inserted into the container)\n if (child) {\n container.insertBefore(child.cloneNode(true), null)\n }\n })\n return container\n}\n\n// Mimic a KO change item 'add'\nfunction valueToChangeAddItem (value, index) {\n return {\n status: 'added',\n value: value,\n index: index\n }\n}\n\n// store a symbol for caching the pending delete info index in the data item objects\nconst PENDING_DELETE_INDEX_SYM = createSymbolOrString('_ko_ffe_pending_delete_index')\n\n\nexport class ForEachBinding extends AsyncBindingHandler {\n // NOTE: valid valueAccessors include:\n // []\n // observable([])\n // observableArray([])\n // computed\n // {data: array, name: string, as: string}\n\n constructor (params) {\n super(params)\n const settings = {}\n if (isPlainObject(this.value)) {\n Object.assign(settings, this.value)\n }\n\n this.as = settings.as || this.allBindings.get('as')\n\n this.data = settings.data || (unwrap(this.$context.$rawData) === this.value ? this.$context.$rawData : this.value)\n\n this.container = virtualElements.isStartComment(this.$element)\n ? this.$element.parentNode : this.$element\n this.generateContext = this.createContextGenerator(this.as)\n this.$indexHasBeenRequested = false\n\n this.templateNode = makeTemplateNode(\n settings.templateNode || (settings.name\n ? document.getElementById(settings.name).cloneNode(true)\n : this.$element)\n )\n\n ;['afterAdd', 'beforeRemove', 'afterQueueFlush', 'beforeQueueFlush']\n .forEach(p => { this[p] = settings[p] || this.allBindings.get(p) })\n\n this.changeQueue = []\n this.firstLastNodesList = []\n this.indexesToDelete = []\n this.rendering_queued = false\n this.pendingDeletes = []\n\n // Expose the conditional so that if the `foreach` data is empty, successive\n // 'else' bindings will appear.\n this.isNotEmpty = observable(Boolean(unwrap(this.data).length))\n domData.set(this.$element, 'conditional', {\n elseChainSatisfied: this.isNotEmpty\n })\n\n // Remove existing content.\n virtualElements.emptyNode(this.$element)\n\n // Prime content\n const primeData = unwrap(this.data)\n if (primeData && primeData.map) {\n this.onArrayChange(primeData.map(valueToChangeAddItem), true)\n } else {\n this.completeBinding()\n }\n\n // Watch for changes\n if (isObservable(this.data)) {\n if (!this.data.indexOf) {\n // Make sure the observable is trackable.\n this.data = this.data.extend({ trackArrayChanges: true })\n }\n this.changeSubs = this.data.subscribe(this.onArrayChange, this, 'arrayChange')\n }\n }\n\n dispose () {\n if (this.changeSubs) {\n this.changeSubs.dispose()\n }\n this.flushPendingDeletes()\n }\n\n // If the array changes we register the change.\n onArrayChange (changeSet, isInitial) {\n var changeMap = {\n added: [],\n deleted: []\n }\n\n // knockout array change notification index handling:\n // - sends the original array indexes for deletes\n // - sends the new array indexes for adds\n // - sorts them all by index in ascending order\n // because of this, when checking for possible batch additions, any delete can be between to adds with neighboring indexes, so only additions should be checked\n for (var i = 0, len = changeSet.length; i < len; i++) {\n if (changeMap.added.length && changeSet[i].status === 'added') {\n var lastAdd = changeMap.added[changeMap.added.length - 1]\n var lastIndex = lastAdd.isBatch ? lastAdd.index + lastAdd.values.length - 1 : lastAdd.index\n if (lastIndex + 1 === changeSet[i].index) {\n if (!lastAdd.isBatch) {\n // transform the last addition into a batch addition object\n lastAdd = {\n isBatch: true,\n status: 'added',\n index: lastAdd.index,\n values: [lastAdd.value]\n }\n changeMap.added.splice(changeMap.added.length - 1, 1, lastAdd)\n }\n lastAdd.values.push(changeSet[i].value)\n continue\n }\n }\n\n changeMap[changeSet[i].status].push(changeSet[i])\n }\n\n if (changeMap.deleted.length > 0) {\n this.changeQueue.push.apply(this.changeQueue, changeMap.deleted)\n this.changeQueue.push({ status: 'clearDeletedIndexes' })\n }\n\n this.changeQueue.push.apply(this.changeQueue, changeMap.added)\n // Once a change is registered, the ticking count-down starts for the processQueue.\n if (this.changeQueue.length > 0 && !this.rendering_queued) {\n this.rendering_queued = true\n if (isInitial) {\n this.processQueue()\n } else {\n ForEachBinding.animateFrame.call(window, () => this.processQueue())\n }\n }\n }\n\n startQueueFlush () {\n // Callback so folks can do things before the queue flush.\n if (typeof this.beforeQueueFlush === 'function') {\n this.beforeQueueFlush(this.changeQueue)\n }\n }\n\n endQueueFlush () {\n // Callback so folks can do things.\n if (typeof this.afterQueueFlush === 'function') {\n this.afterQueueFlush(this.changeQueue)\n }\n }\n\n // Reflect all the changes in the queue in the DOM, then wipe the queue.\n processQueue () {\n var isEmpty = !unwrap(this.data).length\n var lowestIndexChanged = MAX_LIST_SIZE\n\n this.startQueueFlush()\n\n arrayForEach(this.changeQueue, (changeItem) => {\n if (typeof changeItem.index === 'number') {\n lowestIndexChanged = Math.min(lowestIndexChanged, changeItem.index)\n }\n this[changeItem.status](changeItem)\n })\n this.flushPendingDeletes()\n this.rendering_queued = false\n\n // Update our indexes.\n if (this.$indexHasBeenRequested) {\n this.updateIndexes(lowestIndexChanged)\n }\n\n this.endQueueFlush()\n this.changeQueue = []\n\n // Update the conditional exposed on the domData\n if (isEmpty !== !this.isNotEmpty()) {\n this.isNotEmpty(!isEmpty)\n }\n }\n\n /**\n * Once the $index has been asked for once, start calculating it.\n * Note that this significantly degrades performance, from O(1) to O(n)\n * for arbitrary changes to the list.\n */\n _first$indexRequest (ctx$indexRequestedFrom) {\n this.$indexHasBeenRequested = true\n for (let i = 0, len = this.firstLastNodesList.length; i < len; ++i) {\n const ctx = this.getContextStartingFrom(this.firstLastNodesList[i].first)\n // Overwrite the defineProperty.\n if (ctx) { ctx.$index = observable(i) }\n }\n return ctx$indexRequestedFrom.$index()\n }\n\n _contextExtensions ($ctx) {\n Object.assign($ctx, { $list: this.data })\n if (this.$indexHasBeenRequested) {\n $ctx.$index = $ctx.$index || observable()\n } else {\n Object.defineProperty($ctx, '$index', {\n value: () => this._first$indexRequest($ctx),\n configurable: true,\n writable: true\n })\n }\n return $ctx\n }\n\n /**\n * Return a function that generates the context for a given node.\n *\n * We generate a single function that reduces our inner-loop calculations,\n * which has a good chance of being optimized by the browser.\n *\n * @param {string} as The name given to each item in the list\n * @param {bool} index Whether to calculate indexes\n * @return {function} A function(dataValue) that returns the context\n */\n createContextGenerator (as) {\n const $ctx = this.$context\n if (as) {\n return v => this._contextExtensions($ctx.extend({ [as]: v }))\n } else {\n return v => $ctx.createChildContext(v, null, ctx => this._contextExtensions(ctx))\n }\n }\n\n updateFirstLastNodesList (index, children) {\n const first = children[0]\n const last = children[children.length - 1]\n this.firstLastNodesList.splice(index, 0, { first, last })\n }\n\n // Process a changeItem with {status: 'added', ...}\n added (changeItem) {\n var index = changeItem.index\n var valuesToAdd = changeItem.isBatch ? changeItem.values : [changeItem.value]\n var referenceElement = this.getLastNodeBeforeIndex(index)\n // gather all childnodes for a possible batch insertion\n const allChildNodes = []\n const asyncBindingResults = []\n var children\n\n for (var i = 0, len = valuesToAdd.length; i < len; ++i) {\n // we check if we have a pending delete with reusable nodesets for this data, and if yes, we reuse one nodeset\n var pendingDelete = this.getPendingDeleteFor(valuesToAdd[i])\n if (pendingDelete && pendingDelete.nodesets.length) {\n children = pendingDelete.nodesets.pop()\n this.updateFirstLastNodesList(index + i, children)\n } else {\n var templateClone = this.templateNode.cloneNode(true)\n children = virtualElements.childNodes(templateClone)\n this.updateFirstLastNodesList(index + i, children)\n\n // Apply bindings first, and then process child nodes,\n // because bindings can add childnodes.\n const bindingResult = applyBindingsToDescendants(\n this.generateContext(valuesToAdd[i]), templateClone\n )\n asyncBindingResults.push(bindingResult)\n }\n\n allChildNodes.push(...children)\n }\n\n if (typeof this.afterAdd === 'function') {\n this.afterAdd({\n nodeOrArrayInserted: this.insertAllAfter(allChildNodes, referenceElement),\n foreachInstance: this\n })\n } else {\n this.insertAllAfter(allChildNodes, referenceElement)\n }\n\n this.completeBinding(Promise.all(asyncBindingResults))\n }\n\n getNodesForIndex (index) {\n let result = []\n let ptr = this.firstLastNodesList[index].first\n let last = this.firstLastNodesList[index].last\n result.push(ptr)\n while (ptr && ptr !== last) {\n ptr = ptr.nextSibling\n result.push(ptr)\n }\n return result\n }\n\n getLastNodeBeforeIndex (index) {\n if (index < 1 || index - 1 >= this.firstLastNodesList.length) { return null }\n return this.firstLastNodesList[index - 1].last\n }\n\n /**\n * Get the active (focused) node, if it's a child of the given node.\n */\n activeChildElement (node) {\n var active = document.activeElement\n if (domNodeIsContainedBy(active, node)) {\n return active\n }\n }\n\n insertAllAfter (nodeOrNodeArrayToInsert, insertAfterNode) {\n let frag\n let len\n let i\n let active = null\n let containerNode = this.$element\n\n // Poor man's node and array check.\n if (nodeOrNodeArrayToInsert.nodeType === undefined && nodeOrNodeArrayToInsert.length === undefined) {\n throw new Error('Expected a single node or a node array')\n }\n if (nodeOrNodeArrayToInsert.nodeType !== undefined) {\n active = this.activeChildElement(nodeOrNodeArrayToInsert)\n virtualElements.insertAfter(containerNode, nodeOrNodeArrayToInsert, insertAfterNode)\n return [nodeOrNodeArrayToInsert]\n } else if (nodeOrNodeArrayToInsert.length === 1) {\n active = this.activeChildElement(nodeOrNodeArrayToInsert[0])\n virtualElements.insertAfter(containerNode, nodeOrNodeArrayToInsert[0], insertAfterNode)\n } else if (supportsDocumentFragment) {\n frag = document.createDocumentFragment()\n for (i = 0, len = nodeOrNodeArrayToInsert.length; i !== len; ++i) {\n active = active || this.activeChildElement(nodeOrNodeArrayToInsert[i])\n frag.appendChild(nodeOrNodeArrayToInsert[i])\n }\n virtualElements.insertAfter(containerNode, frag, insertAfterNode)\n } else {\n // Nodes are inserted in reverse order - pushed down immediately after\n // the last node for the previous item or as the first node of element.\n for (i = nodeOrNodeArrayToInsert.length - 1; i >= 0; --i) {\n active = active || this.activeChildElement(nodeOrNodeArrayToInsert[i])\n var child = nodeOrNodeArrayToInsert[i]\n if (!child) { break }\n virtualElements.insertAfter(containerNode, child, insertAfterNode)\n }\n }\n\n if (active) { active.focus() }\n\n return nodeOrNodeArrayToInsert\n }\n\n // checks if the deleted data item should be handled with delay for a possible reuse at additions\n shouldDelayDeletion (data) {\n return data && (typeof data === 'object' || typeof data === 'function')\n }\n\n // gets the pending deletion info for this data item\n getPendingDeleteFor (data) {\n var index = data && data[PENDING_DELETE_INDEX_SYM]\n if (index === undefined) return null\n return this.pendingDeletes[index]\n }\n\n // tries to find the existing pending delete info for this data item, and if it can't, it registeres one\n getOrCreatePendingDeleteFor (data) {\n var pd = this.getPendingDeleteFor(data)\n if (pd) {\n return pd\n }\n pd = {\n data: data,\n nodesets: []\n }\n data[PENDING_DELETE_INDEX_SYM] = this.pendingDeletes.length\n this.pendingDeletes.push(pd)\n return pd\n }\n\n // Process a changeItem with {status: 'deleted', ...}\n deleted (changeItem) {\n // if we should delay the deletion of this data, we add the nodeset to the pending delete info object\n if (this.shouldDelayDeletion(changeItem.value)) {\n let pd = this.getOrCreatePendingDeleteFor(changeItem.value)\n pd.nodesets.push(this.getNodesForIndex(changeItem.index))\n } else { // simple data, just remove the nodes\n this.removeNodes(this.getNodesForIndex(changeItem.index))\n }\n this.indexesToDelete.push(changeItem.index)\n }\n\n // removes a set of nodes from the DOM\n removeNodes (nodes) {\n if (!nodes.length) { return }\n\n function removeFn () {\n var parent = nodes[0].parentNode\n for (var i = nodes.length - 1; i >= 0; --i) {\n cleanNode(nodes[i])\n parent.removeChild(nodes[i])\n }\n }\n\n if (this.beforeRemove) {\n var beforeRemoveReturn = this.beforeRemove({\n nodesToRemove: nodes, foreachInstance: this\n }) || {}\n // If beforeRemove returns a `then`–able e.g. a Promise, we remove\n // the nodes when that thenable completes. We pass any errors to\n // ko.onError.\n if (typeof beforeRemoveReturn.then === 'function') {\n beforeRemoveReturn.then(removeFn, options.onError)\n }\n } else {\n removeFn()\n }\n }\n\n // flushes the pending delete info store\n // this should be called after queue processing has finished, so that data items and remaining (not reused) nodesets get cleaned up\n // we also call it on dispose not to leave any mess\n flushPendingDeletes () {\n for (let i = 0, len = this.pendingDeletes.length; i !== len; ++i) {\n var pd = this.pendingDeletes[i]\n while (pd.nodesets.length) {\n this.removeNodes(pd.nodesets.pop())\n }\n if (pd.data && pd.data[PENDING_DELETE_INDEX_SYM] !== undefined) { delete pd.data[PENDING_DELETE_INDEX_SYM] }\n }\n this.pendingDeletes = []\n }\n\n // We batch our deletion of item indexes in our parallel array.\n // See brianmhunt/knockout-fast-foreach#6/#8\n clearDeletedIndexes () {\n // We iterate in reverse on the presumption (following the unit tests) that KO's diff engine\n // processes diffs (esp. deletes) monotonically ascending i.e. from index 0 -> N.\n for (let i = this.indexesToDelete.length - 1; i >= 0; --i) {\n this.firstLastNodesList.splice(this.indexesToDelete[i], 1)\n }\n this.indexesToDelete = []\n }\n\n updateIndexes (fromIndex) {\n let ctx\n for (let i = fromIndex, len = this.firstLastNodesList.length; i < len; ++i) {\n ctx = this.getContextStartingFrom(this.firstLastNodesList[i].first)\n if (ctx) { ctx.$index(i) }\n }\n }\n\n getContextStartingFrom (node) {\n let ctx\n while (node) {\n ctx = contextFor(node)\n if (ctx) { return ctx }\n node = node.nextSibling\n }\n }\n\n /**\n * Set whether the binding is always synchronous.\n * Useful during testing.\n */\n static setSync (toggle) {\n const w = options.global\n if (toggle) {\n ForEachBinding.animateFrame = function (frame) { frame() }\n } else {\n ForEachBinding.animateFrame = w.requestAnimationFrame || w.webkitRequestAnimationFrame ||\n w.mozRequestAnimationFrame || w.msRequestAnimationFrame ||\n function (cb) { return w.setTimeout(cb, 1000 / 60) }\n }\n }\n\n get controlsDescendants () { return true }\n static get allowVirtualElements () { return true }\n\n /* TODO: Remove; for legacy/testing */\n static get ForEach () { return this }\n static get PENDING_DELETE_INDEX_SYM () { return PENDING_DELETE_INDEX_SYM }\n}\n","import {\n cleanNode\n} from '@tko/utils'\n\nconst DELAY_MS = 25\nconst MAX_CLEAN_AT_ONCE = 1000\nconst cleanNodeQueue = []\nlet cleanNodeTimeoutID = null\n\nexport function queueCleanNode (node) {\n cleanNodeQueue.push(node)\n triggerCleanTimeout()\n}\n\nfunction triggerCleanTimeout () {\n if (!cleanNodeTimeoutID && cleanNodeQueue.length) {\n cleanNodeTimeoutID = setTimeout(flushCleanQueue, DELAY_MS)\n }\n}\n\nfunction flushCleanQueue () {\n cleanNodeTimeoutID = null\n const nodes = cleanNodeQueue.splice(0, MAX_CLEAN_AT_ONCE)\n for (const node of nodes) { cleanNode(node) }\n triggerCleanTimeout()\n}\n","\nimport {LifeCycle} from '@tko/lifecycle'\n\nimport {\n safeStringify, isThenable\n} from '@tko/utils'\n\nimport {\n applyBindings, contextFor\n} from '@tko/bind'\n\nimport {\n isObservable, unwrap, observable\n} from '@tko/observable'\n\nimport {\n isComputed\n} from '@tko/computed'\n\nimport {\n NativeProvider, NATIVE_BINDINGS\n} from '@tko/provider.native'\n\nimport {\n queueCleanNode\n} from './jsxClean'\n\nexport const ORIGINAL_JSX_SYM = Symbol('Knockout - Original JSX')\n\nconst NAMESPACES = {\n svg: 'http://www.w3.org/2000/svg',\n html: 'http://www.w3.org/1999/xhtml',\n xml: 'http://www.w3.org/XML/1998/namespace',\n xlink: 'http://www.w3.org/1999/xlink',\n xmlns: 'http://www.w3.org/2000/xmlns/'\n}\n\nfunction isIterable (v) {\n return v && typeof v[Symbol.iterator] === 'function'\n}\n\n/**\n * JSX object from a pre-processor.\n * @typedef {Object} JSX\n * @property {string} elementName becomes the `tagName`\n * @property {Array.<JSX>} children\n * @property {object} attributes\n */\n\n/**\n * Observe a variety of possible cases from JSX, modifying the\n * `parentNode` at `insertBefore` with the result.\n */\nexport class JsxObserver extends LifeCycle {\n /**\n * @param {any} jsxOrObservable take a long list of permutations\n */\n constructor (jsxOrObservable, parentNode, insertBefore = null, xmlns, noInitialBinding) {\n super()\n\n const parentNodeIsComment = parentNode.nodeType === 8\n\n const parentNodeTarget = this.getParentTarget(parentNode)\n\n if (isObservable(jsxOrObservable)) {\n jsxOrObservable.extend({ trackArrayChanges: true })\n this.subscribe(jsxOrObservable, this.observableArrayChange, 'arrayChange')\n\n if (!insertBefore) {\n const insertAt = parentNodeIsComment ? parentNode.nextSibling : null\n insertBefore = this.createComment('O')\n parentNodeTarget.insertBefore(insertBefore, insertAt)\n } else {\n this.adoptedInsertBefore = true\n }\n }\n\n if (parentNodeIsComment && !insertBefore) {\n // Typcially: insertBefore becomes <!-- /ko -->\n insertBefore = parentNode.nextSibling\n // Mark this so we don't remove the next node - since we didn't create it.\n this.adoptedInsertBefore = true\n }\n\n this.anchorTo(insertBefore || parentNode)\n\n Object.assign(this, {\n insertBefore,\n noInitialBinding,\n parentNode,\n parentNodeTarget,\n xmlns,\n nodeArrayOrObservableAtIndex: [],\n subscriptionsForNode: new Map(),\n })\n\n const jsx = unwrap(jsxOrObservable)\n const computed = isComputed(jsxOrObservable)\n\n if (computed || (jsx !== null && jsx !== undefined)) {\n this.observableArrayChange(this.createInitialAdditions(jsx))\n }\n this.noInitialBinding = false\n }\n\n /**\n * @param {HMTLElement|Comment|HTMLTemplateElement} parentNode\n */\n getParentTarget (parentNode) {\n if ('content' in parentNode) { return parentNode.content }\n if (parentNode.nodeType === 8) { return parentNode.parentNode }\n return parentNode\n }\n\n remove () { this.dispose() }\n dispose () {\n super.dispose()\n const ib = this.insertBefore\n const insertBeforeIsChild = ib && this.parentNodeTarget === ib.parentNode\n if (insertBeforeIsChild && !this.adoptedInsertBefore) {\n this.parentNodeTarget.removeChild(ib)\n }\n this.removeAllPriorNodes()\n Object.assign(this, {\n parentNode: null,\n parentNodeTarget: null,\n insertBefore: null,\n nodeArrayOrObservableAtIndex: []\n })\n for (const subscriptions of this.subscriptionsForNode.values()) {\n subscriptions.forEach(s => s.dispose())\n }\n this.subscriptionsForNode.clear()\n }\n\n createInitialAdditions (possibleIterable) {\n const status = 'added'\n if (typeof possibleIteratable === 'object' &&\n posibleIterable !== null &&\n Symbol.iterator in possibleIterable) {\n possibleIterable = [...possibleIterable]\n }\n\n return Array.isArray(possibleIterable)\n ? possibleIterable.map((value, index) => ({ index, status, value }))\n : [{ status, index: 0, value: possibleIterable }]\n }\n\n /**\n * Note: array change notification indexes are:\n * - to the original array indexes for deletes\n * - to the new array indexes for adds\n * - sorted by index in ascending order\n */\n observableArrayChange (changes) {\n let adds = []\n let dels = []\n for (const index in changes) {\n const change = changes[index]\n if (change.status === 'added') {\n adds.push([change.index, change.value])\n } else {\n dels.unshift([change.index, change.value])\n }\n }\n dels.forEach(change => this.delChange(...change))\n adds.forEach(change => this.addChange(...change))\n }\n\n /**\n * Add a change at the given index.\n *\n * @param {int} index\n * @param {string|object|Array|Observable.string|Observable.Array|Obseravble.object} jsx\n */\n addChange (index, jsx) {\n this.nodeArrayOrObservableAtIndex.splice(index, 0,\n this.injectNode(jsx, this.lastNodeFor(index)))\n }\n\n injectNode (jsx, nextNode) {\n let nodeArrayOrObservable\n\n if (isObservable(jsx)) {\n const {parentNode, xmlns} = this\n const observer = new JsxObserver(jsx, parentNode, nextNode, xmlns, this.noInitialBinding)\n nodeArrayOrObservable = [observer]\n } else if (typeof jsx !== 'string' && isIterable(jsx)) {\n nodeArrayOrObservable = []\n for (const child of jsx) {\n nodeArrayOrObservable.unshift(\n this.injectNode(child, nextNode))\n }\n } else {\n const $context = contextFor(this.parentNode)\n const isInsideTemplate = 'content' in this.parentNode\n const shouldApplyBindings = $context && !isInsideTemplate && !this.noInitialBinding\n\n if (Array.isArray(jsx)) {\n nodeArrayOrObservable = jsx.map(j => this.anyToNode(j))\n } else {\n nodeArrayOrObservable = [this.anyToNode(jsx)]\n }\n\n for (const node of nodeArrayOrObservable) {\n this.parentNodeTarget.insertBefore(node, nextNode)\n if (shouldApplyBindings && this.canApplyBindings(node)) {\n applyBindings($context, node)\n }\n }\n }\n\n return nodeArrayOrObservable\n }\n\n /**\n * True when Node is a type suitable for applyBindings i.e. a HTMLElement\n * or a Comment.\n * @param {Node} node\n */\n canApplyBindings (node) {\n return node.nodeType === 1 || node.nodeType === 8\n }\n\n delChange (index) {\n this.removeNodeArrayOrObservable(\n this.nodeArrayOrObservableAtIndex[index])\n this.nodeArrayOrObservableAtIndex.splice(index, 1)\n }\n\n getSubscriptionsForNode (node) {\n if (!this.subscriptionsForNode.has(node)) {\n const subscriptions = []\n this.subscriptionsForNode.set(node, subscriptions)\n return subscriptions\n }\n return this.subscriptionsForNode.get(node)\n }\n\n isJsx (jsx) {\n return typeof jsx.elementName === 'string' &&\n 'children' in jsx &&\n 'attributes' in jsx\n }\n\n /**\n * @param {any} value acceptable to turn into a Node\n *\n * The one thing `any` cannot be here is an Array or Observable; both those\n * cases are handled with new JsxObservers.\n */\n anyToNode (any) {\n if (isThenable(any)) { return this.futureJsxNode(any) }\n\n switch (typeof any) {\n case 'object':\n if (any instanceof Error) {\n return this.createComment(any.toString())\n }\n if (any === null) {\n return this.createComment(String(any))\n }\n if (any instanceof Node) {\n return this.cloneJSXorMoveNode(any)\n }\n if (Symbol.iterator in any) {\n return any\n }\n break\n case 'function': return this.anyToNode(any())\n case 'undefined':\n case 'Error':\n case 'symbol':\n return this.createComment(String(any))\n case 'string': return this.createTextNode(any)\n case 'boolean':\n case 'number':\n case 'bigint':\n default:\n return this.createTextNode(String(any))\n }\n\n return this.isJsx(any)\n ? this.jsxToNode(any)\n : this.createComment(safeStringify(any))\n }\n\n createComment (string) {\n const node = document.createComment(string)\n node[NATIVE_BINDINGS] = true\n return node\n }\n\n createTextNode (string) {\n const node = document.createTextNode(string)\n node[NATIVE_BINDINGS] = true\n return node\n }\n\n /**\n * Clone a node; if that node was originally from JSX, we clone from there\n * so we preserve binding handlers.\n *\n * @param {HTMLElement} node\n */\n cloneJSXorMoveNode (node) {\n return ORIGINAL_JSX_SYM in node\n ? this.jsxToNode(node[ORIGINAL_JSX_SYM])\n : node\n }\n\n /**\n * @param {JSX} jsx to convert to a node.\n */\n jsxToNode (jsx) {\n const xmlns = jsx.attributes.xmlns || NAMESPACES[jsx.elementName] || this.xmlns\n const node = document.createElementNS(xmlns || NAMESPACES.html, jsx.elementName)\n\n /** Slots need to be able to replicate with the attributes, which\n * are not preserved when cloning from template nodes. */\n node[ORIGINAL_JSX_SYM] = jsx\n\n if (isObservable(jsx.attributes)) {\n const subscriptions = this.getSubscriptionsForNode(node)\n subscriptions.push(\n jsx.attributes.subscribe(attrs => {\n this.updateAttributes(node, unwrap(attrs))\n }))\n }\n this.updateAttributes(node, unwrap(jsx.attributes))\n\n this.addDisposable(new JsxObserver(jsx.children, node, null, xmlns, this.noInitialBinding))\n\n return node\n }\n\n futureJsxNode (promise) {\n const obs = observable()\n promise.then(obs).catch(e => obs(e instanceof Error ? e : Error(e)))\n const jo = new JsxObserver(obs, this.parentNode, null, this.xmlns, this.noInitialBinding)\n this.addDisposable(jo)\n return jo.insertBefore\n }\n\n updateAttributes (node, attributes) {\n const subscriptions = this.getSubscriptionsForNode(node)\n const toRemove = new Set([...node.attributes].map(n => n.name))\n\n for (const [name, value] of Object.entries(attributes || {})) {\n toRemove.delete(name)\n if (isObservable(value)) {\n subscriptions.push(\n value.subscribe(attr => this.setNodeAttribute(node, name, attr)))\n }\n this.setNodeAttribute(node, name, value)\n }\n\n for (const name of toRemove) {\n this.setNodeAttribute(node, name, undefined)\n }\n }\n\n /**\n * See https://stackoverflow.com/a/52572048\n * @param {string} attr element attribute\n * @return {string} namespace argument for setAtttributeNS\n */\n getNamespaceOfAttribute (attr) {\n const [prefix, ...unqualifiedName] = attr.split(':')\n if (prefix === 'xmlns' || (unqualifiedName.length && NAMESPACES[prefix])) {\n return NAMESPACES[prefix]\n }\n return null\n }\n\n /**\n *\n * @param {HTMLElement} node\n * @param {string} name\n * @param {any} valueOrObservable\n */\n setNodeAttribute (node, name, valueOrObservable) {\n const value = unwrap(valueOrObservable)\n NativeProvider.addValueToNode(node, name, valueOrObservable)\n if (value === undefined) {\n node.removeAttributeNS(null, name)\n } else if (isThenable(valueOrObservable)) {\n Promise.resolve(valueOrObservable)\n .then(v => this.setNodeAttribute(node, name, v))\n } else {\n const ns = this.getNamespaceOfAttribute(name)\n node.setAttributeNS(ns, name, String(value))\n }\n }\n\n /**\n * @param {int} index\n * @return {Comment} that immediately precedes this.\n */\n lastNodeFor (index) {\n const nodesAtIndex = this.nodeArrayOrObservableAtIndex[index] || []\n const [lastNodeOfPrior] = nodesAtIndex.slice(-1)\n const insertBefore = lastNodeOfPrior instanceof JsxObserver\n ? lastNodeOfPrior.insertBefore : lastNodeOfPrior || this.insertBefore\n if (insertBefore) { return insertBefore.parentNode ? insertBefore : null }\n return null\n }\n\n removeAllPriorNodes () {\n const {nodeArrayOrObservableAtIndex} = this\n while (nodeArrayOrObservableAtIndex.length) {\n this.removeNodeArrayOrObservable(nodeArrayOrObservableAtIndex.pop())\n }\n }\n\n removeNodeArrayOrObservable (nodeArrayOrObservable) {\n for (const nodeOrObservable of nodeArrayOrObservable) {\n if (nodeOrObservable instanceof JsxObserver) {\n nodeOrObservable.dispose()\n continue\n }\n const node = nodeOrObservable\n delete node[ORIGINAL_JSX_SYM]\n this.detachAndDispose(node)\n const subscriptions = this.subscriptionsForNode.get(node)\n if (subscriptions) {\n subscriptions.forEach(s => s.dispose())\n this.subscriptionsForNode.delete(node)\n }\n }\n }\n\n /**\n * Detach the given node, and dispose of its children.\n *\n * The cleaning can trigger a lot of garbage collection, so we defer that.\n */\n detachAndDispose (node) {\n if (isIterable(node)) {\n for (const child of node) {\n this.detachAndDispose(child)\n }\n } else {\n node.remove()\n }\n queueCleanNode(node)\n }\n}\n\nexport default JsxObserver\n","\nimport {\n removeNode, addDisposeCallback\n} from '@tko/utils'\n\nimport {\n isObservable, unwrap\n} from '@tko/observable'\n\nimport {\n contextFor, applyBindings\n} from '@tko/bind'\n\nimport {\n NativeProvider\n} from '@tko/provider.native'\n\nimport {\n JsxObserver, ORIGINAL_JSX_SYM\n } from './JsxObserver'\n\n/**\n *\n * @param {any} possibleJsx Test whether this value is JSX.\n *\n * True for\n * { elementName }\n * [{elementName}]\n * observable({elementName} | [])\n *\n * Any observable will return truthy if its value is an array that doesn't\n * contain HTML elements. Template nodes should not be observable unless they\n * are JSX.\n *\n * There's a bit of guesswork here that we could nail down with more test cases.\n */\nexport function maybeJsx (possibleJsx) {\n if (isObservable(possibleJsx)) { return true }\n const value = unwrap(possibleJsx)\n if (!value) { return false }\n if (value.elementName) { return true }\n if (!Array.isArray(value) || !value.length) { return false }\n if (value[0] instanceof window.Node) { return false }\n return true\n}\n\nexport function getOriginalJsxForNode (node) {\n return node[ORIGINAL_JSX_SYM]\n}\n\n\n/**\n * Convert JSX into an object that can be consumed by TKO.\n * Mimics React.createElement\n * @param {string} e tagName of the element\n * @param {object|null} a attributes of the element\n * @param {...string|object} c children of the element\n */\nexport function createElement (elementName, attributes, ...children) {\n return elementName === Fragment ? children\n : {\n elementName: elementName,\n attributes: attributes || {},\n children: [...children]\n }\n}\n\nexport const Fragment = Symbol('JSX Fragment')\n \n","//\n// This becomes ko.options\n// --\n//\n// This is the root 'options', which must be extended by others.\n\nvar _global\n\ntry { _global = window } catch (e) { _global = global }\n\nvar options = {\n deferUpdates: false,\n\n useOnlyNativeEvents: false,\n\n protoProperty: '__ko_proto__',\n\n // Modify the default attribute from `data-bind`.\n defaultBindingAttribute: 'data-bind',\n\n // Enable/disable <!-- ko binding: ... -> style bindings\n allowVirtualElements: true,\n\n // Global variables that can be accessed from bindings.\n bindingGlobals: _global,\n\n // An instance of the binding provider.\n bindingProviderInstance: null,\n\n // Whether the `with` binding creates a child context when used with `as`.\n createChildContextWithAs: false,\n\n // jQuery will be automatically set to _global.jQuery in applyBindings\n // if it is (strictly equal to) undefined. Set it to false or null to\n // disable automatically setting jQuery.\n jQuery: _global && _global.jQuery,\n\n Promise: _global && _global.Promise,\n\n taskScheduler: null,\n\n debug: false,\n\n global: _global,\n document: _global.document,\n\n // Filters for bindings\n // data-bind=\"expression | filter_1 | filter_2\"\n filters: {},\n\n // Used by the template binding.\n includeDestroyed: false,\n foreachHidesDestroyed: false,\n\n onError: function (e) { throw e },\n\n set: function (name, value) {\n options[name] = value\n },\n\n // Overload getBindingHandler to have a custom lookup function.\n getBindingHandler (/* key */) {},\n cleanExternalData (/* node, callback */) {}\n}\n\nObject.defineProperty(options, '$', {\n get: function () { return options.jQuery }\n})\n\nexport default options\n","//\n// Detection and Workarounds for Internet Explorer\n//\nimport options from './options'\n\nconst ieVersion = options.document && (function () {\n var version = 3, div = options.document.createElement('div'), iElems = div.getElementsByTagName('i')\n\n // Keep constructing conditional HTML blocks until we hit one that resolves to an empty fragment\n while (\n div.innerHTML = '<!--[if gt IE ' + (++version) + ']><i></i><![endif]-->',\n iElems[0]\n ) {}\n\n if (!version) {\n const userAgent = window.navigator.userAgent\n // Detect IE 10/11\n return ua.match(/MSIE ([^ ]+)/) || ua.match(/rv:([^ )]+)/)\n }\n return version > 4 ? version : undefined\n}())\n\nconst isIe6 = ieVersion === 6\nconst isIe7 = ieVersion === 7\n\nexport { ieVersion, isIe6, isIe7 }\n","//\n// jQuery\n//\n// TODO: deprecate in favour of options.$\n\nimport options from './options'\n\nexport var jQueryInstance = options.global && options.global.jQuery\n\nexport function jQuerySetInstance (jquery) {\n options.jQuery = jQueryInstance = jquery\n}\n","\nimport { ieVersion } from '../ie'\nimport { safeSetTimeout } from '../error'\n\nimport { tagNameLower } from './info'\nimport * as domData from './data'\n\nvar hasDomDataExpandoProperty = Symbol('Knockout selectExtensions hasDomDataProperty')\n\n// Normally, SELECT elements and their OPTIONs can only take value of type 'string' (because the values\n// are stored on DOM attributes). ko.selectExtensions provides a way for SELECTs/OPTIONs to have values\n// that are arbitrary objects. This is very convenient when implementing things like cascading dropdowns.\n//\nexport var selectExtensions = {\n optionValueDomDataKey: domData.nextKey(),\n\n readValue: function (element) {\n switch (tagNameLower(element)) {\n case 'option':\n if (element[hasDomDataExpandoProperty] === true) { return domData.get(element, selectExtensions.optionValueDomDataKey) }\n return element.value\n case 'select':\n return element.selectedIndex >= 0 ? selectExtensions.readValue(element.options[element.selectedIndex]) : undefined\n default:\n return element.value\n }\n },\n\n writeValue: function (element, value, allowUnset) {\n switch (tagNameLower(element)) {\n case 'option':\n if (typeof value === 'string') {\n domData.set(element, selectExtensions.optionValueDomDataKey, undefined)\n if (hasDomDataExpandoProperty in element) { // IE <= 8 throws errors if you delete non-existent properties from a DOM node\n delete element[hasDomDataExpandoProperty]\n }\n element.value = value\n } else {\n // Store arbitrary object using DomData\n domData.set(element, selectExtensions.optionValueDomDataKey, value)\n element[hasDomDataExpandoProperty] = true\n // Special treatment of numbers is just for backward compatibility. KO 1.2.1 wrote numerical values to element.value.\n element.value = typeof value === 'number' ? value : ''\n }\n\n break\n case 'select':\n if (value === '' || value === null) {\n // A blank string or null value will select the caption\n value = undefined\n }\n var selection = -1\n for (let i = 0, n = element.options.length, optionValue; i < n; ++i) {\n optionValue = selectExtensions.readValue(element.options[i])\n // Include special check to handle selecting a caption with a blank string value\n if (optionValue === value || (optionValue === '' && value === undefined)) {\n selection = i\n break\n }\n }\n if (allowUnset || selection >= 0 || (value === undefined && element.size > 1)) {\n element.selectedIndex = selection\n if (ieVersion === 6) {\n // Workaround for IE6 bug: It won't reliably apply values to SELECT nodes during the same execution thread\n // right after you've changed the set of OPTION nodes on it. So for that node type, we'll schedule a second thread\n // to apply the value as well.\n safeSetTimeout(() => { element.selectedIndex = selection }, 0)\n }\n }\n break\n default:\n if ((value === null) || (value === undefined)) { value = '' }\n element.value = value\n break\n }\n }\n}\n","\nimport {\n removeDisposeCallback, addDisposeCallback\n} from '@tko/utils'\n\n\nexport default class Subscription {\n constructor (target, observer, disposeCallback) {\n this._target = target\n this._callback = observer.next\n this._disposeCallback = disposeCallback\n this._isDisposed = false\n this._domNodeDisposalCallback = null\n }\n\n dispose () {\n if (this._domNodeDisposalCallback) {\n removeDisposeCallback(this._node, this._domNodeDisposalCallback)\n }\n this._isDisposed = true\n this._disposeCallback()\n }\n\n disposeWhenNodeIsRemoved (node) {\n this._node = node\n addDisposeCallback(node, this._domNodeDisposalCallback = this.dispose.bind(this))\n }\n\n // TC39 Observable API\n unsubscribe () { this.dispose() }\n get closed () { return this._isDisposed }\n}\n","\nimport {\n unwrap\n} from '@tko/observable'\n\nimport {\n default as operators,\n LAMBDA\n} from './operators'\n\nconst IS_EXPR_OR_IDENT = Symbol('Node - Is Expression Or Identifier')\n\nexport default class Node {\n constructor (lhs, op, rhs) {\n this.lhs = lhs\n this.op = op\n this.rhs = rhs\n }\n\n static get operators () { return operators }\n\n get_leaf_value (leaf, context, globals, node) {\n if (typeof leaf === 'function') {\n // Expressions on observables are nonsensical, so we unwrap any\n // function values (e.g. identifiers).\n return unwrap(leaf())\n }\n\n // primitives\n if (typeof leaf !== 'object' || leaf === null) { return leaf }\n\n // Identifiers and Expressions\n if (leaf[Node.isExpressionOrIdentifierSymbol]) {\n // lhs is passed in as the parent of the leaf. It will be defined in\n // cases like a.b.c as 'a' for 'b' then as 'b' for 'c'.\n return unwrap(leaf.get_value(undefined, context, globals, node))\n }\n\n // Plain object/class.\n return leaf\n }\n\n /**\n * Return a function that calculates and returns an expression's value\n * when called.\n * @param {array} ops The operations to perform\n * @return {function} The function that calculates the expression.\n *\n * Note that for a lambda, we do not evaluate the RHS expression until\n * the lambda is called.\n */\n get_value (notused, context, globals, node) {\n var node = this\n\n if (node.op === LAMBDA) {\n return () => node.get_leaf_value(node.rhs, context, globals, node)\n }\n\n const lhv = node.get_leaf_value(node.lhs, context, globals, node)\n const earlyOut = node.op.earlyOut\n\n if (earlyOut && earlyOut(lhv)) { return lhv }\n const rhv = node.get_leaf_value(node.rhs, context, globals, node)\n\n return node.op(lhv, rhv, context, globals)\n }\n\n //\n // Class variables.\n //\n static get isExpressionOrIdentifierSymbol () { return IS_EXPR_OR_IDENT }\n get [IS_EXPR_OR_IDENT] () { return true }\n\n static value_of (item, context, globals, node) {\n if (item && item[Node.isExpressionOrIdentifierSymbol]) {\n return item.get_value(item, context, globals, node)\n }\n return item\n }\n\n /**\n * Convert an array of nodes to an executable tree.\n * @return {object} An object with a `lhs`, `rhs` and `op` key, corresponding\n * to the left hand side, right hand side, and\n * operation function.\n */\n static create_root (nodes) {\n var root, leaf, op, value\n\n // Prime the leaf = root node.\n leaf = root = new Node(nodes.shift(), nodes.shift(), nodes.shift())\n\n while (true) {\n op = nodes.shift()\n value = nodes.shift()\n if (!op) {\n break\n }\n if (op.precedence < root.op.precedence) {\n // rebase\n root = new Node(root, op, value)\n leaf = root\n } else {\n leaf.rhs = new Node(leaf.rhs, op, value)\n leaf = leaf.rhs\n }\n }\n // console.log('tree', root)\n return root\n }\n}\n\n/**\n * Because of cyclical dependencies on operators <-> Node <-> value_of,\n * we need to patch this in here.\n */\noperators['?'] = function ternary (a, b, context, globals, node) {\n return Node.value_of(a ? b.yes : b.no, context, globals, node)\n}\noperators['?'].precedence = 4\n","\nimport Node from './Node'\n\nexport default class Expression {\n constructor (nodes) {\n this.nodes = nodes\n this.root = Node.create_root(nodes)\n }\n\n /**\n * Return the value of `this` Expression instance.\n */\n get_value (parent, context, globals, node) {\n if (!this.root) {\n this.root = Node.create_root(this.nodes)\n }\n return this.root.get_value(parent, context, globals, node)\n }\n}\n\nExpression.prototype[Node.isExpressionOrIdentifierSymbol] = true\n","\nimport Node from './Node'\n\nexport default class Arguments {\n constructor (parser, args) {\n this.parser = parser\n this.args = args\n }\n\n get_value (parent, context, globals, node) {\n var deReffedArgs = []\n for (var i = 0, j = this.args.length; i < j; ++i) {\n deReffedArgs.push(Node.value_of(this.args[i], context, globals, node))\n }\n return deReffedArgs\n };\n\n get [Node.isExpressionOrIdentifierSymbol] () { return true }\n}\n","/**\n * The following regular expressions were generated by\n * https://mathiasbynens.be/demo/javascript-identifier-regex\n */\nexport var IDStart = /[\\$A-Z_a-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B4\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\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061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FD5\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AD\\uA7B0-\\uA7B7\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]/\n\nexport var IDContinue = /[\\$0-9A-Z_a-z\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B4\\u08E3-\\u0963\\u0966-\\u096F\\u0971-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\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FD5\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7AD\\uA7B0-\\uA7B7\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA8FD\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB65\\uAB70-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]/\n","\nimport Node from './Node'\nimport Arguments from './Arguments'\n\nimport { hasOwnProperty } from '@tko/utils'\n\nimport {\n isWriteableObservable, isObservable\n} from '@tko/observable'\n\nimport {\n IDStart, IDContinue\n} from './identifierExpressions'\n\nexport default class Identifier {\n constructor (parser, token, dereferences) {\n this.token = token\n this.dereferences = dereferences\n this.parser = parser\n }\n\n /**\n * Apply all () and [] functions on the identifier to the lhs value e.g.\n * a()[3] has deref functions that are essentially this:\n * [_deref_call, _deref_this where this=3]\n *\n * @param {mixed} value Should be an object.\n * @return {mixed} The dereferenced value.\n *\n * [1] We want to bind any function that is a method of an object, but not\n * corrupt any values (e.g. computed()s). e.g. Running x.bind(obj) where\n * we're given `data-bind='binding: obj.x'` and x is a computed will\n * break the computed's `this` and it will stop working as expected.\n *\n * The test `!last_value.hasOwnProperty(member)`\n * distinguishes between functions on the prototype chain (prototypal\n * members) and value-members added directly to the object. This may\n * not be the canonical test for this relationship, but it succeeds\n * in the known test cases.\n *\n * See: `this` tests of our dereference function.\n */\n dereference (value, $context, globals, node) {\n let member\n let refs = this.dereferences || []\n const $data = $context.$data || {}\n let lastValue // becomes `this` in function calls to object properties.\n let i, n\n\n for (i = 0, n = refs.length; i < n; ++i) {\n member = Node.value_of(refs[i], $context, globals, node)\n\n if (typeof value === 'function' && refs[i] instanceof Arguments) {\n // fn(args)\n value = value.apply(lastValue || $data, member)\n lastValue = value\n } else {\n // obj[x] or obj.x dereference. Note that obj may be a function.\n lastValue = value\n value = Node.value_of(value[member], $context, globals, node)\n }\n }\n\n // [1] See note above.\n if (typeof value === 'function' && n > 0 && lastValue !== value &&\n !hasOwnProperty(lastValue, member)) {\n return value.bind(lastValue)\n }\n\n return value\n };\n\n /**\n * Return the value as one would get it from the top-level i.e.\n * $data.token/$context.token/globals.token; this does not return intermediate\n * values on a chain of members i.e. $data.hello.there -- requesting the\n * Identifier('there').value will return $data/$context/globals.there.\n *\n * This will dereference using () or [arg] member.\n * @param {object | Identifier | Expression} parent\n * @return {mixed} Return the primitive or an accessor.\n */\n get_value (parent, context, globals, node) {\n const intermediate = parent && !(parent instanceof Identifier)\n ? Node.value_of(parent, context, globals, node)[this.token]\n : context.lookup(this.token, globals, node)\n return this.dereference(intermediate, context, globals, node)\n }\n\n assign (object, property, value) {\n if (isWriteableObservable(object[property])) {\n object[property](value)\n } else if (!isObservable(object[property])) {\n object[property] = value\n }\n };\n\n /**\n * Set the value of the Identifier.\n *\n * @param {Mixed} new_value The value that Identifier is to be set to.\n */\n set_value (new_value, $context, globals) {\n const $data = $context.$data || {}\n const refs = this.dereferences || []\n let leaf = this.token\n let i, n, root\n\n if (hasOwnProperty($data, leaf)) {\n root = $data\n } else if (hasOwnProperty($context, leaf)) {\n root = $context\n } else if (hasOwnProperty(globals, leaf)) {\n root = globals\n } else {\n throw new Error('Identifier::set_value -- ' +\n \"The property '\" + leaf + \"' does not exist \" +\n 'on the $data, $context, or globals.')\n }\n\n // Degenerate case. {$data|$context|global}[leaf] = something;\n n = refs.length\n if (n === 0) {\n this.assign(root, leaf, new_value)\n return\n }\n\n // First dereference is {$data|$context|global}[token].\n root = root[leaf]\n\n // We cannot use this.dereference because that gives the leaf; to evoke\n // the ES5 setter we have to call `obj[leaf] = new_value`\n for (i = 0; i < n - 1; ++i) {\n leaf = refs[i]\n if (leaf instanceof Arguments) {\n root = root()\n } else {\n root = root[Node.value_of(leaf)]\n }\n }\n\n // We indicate that a dereference is a function when it is `true`.\n if (refs[i] === true) {\n throw new Error('Cannot assign a value to a function.')\n }\n\n // Call the setter for the leaf.\n if (refs[i]) {\n this.assign(root, Node.value_of(refs[i]), new_value)\n }\n };\n\n /**\n * Determine if a character is a valid item in an identifier.\n * Note that we do not check whether the first item is a number, nor do we\n * support unicode identifiers here.\n *\n * From: http://stackoverflow.com/a/9337047\n * @param {String} ch The character\n * @return {Boolean} True if this is a valid identifier\n */\n // function is_identifier_char(ch) {\n // return (ch >= 'A' && ch <= 'Z') ||\n // (ch >= 'a' && ch <= 'z') ||\n // (ch >= '0' && ch <= 9) ||\n // ch === '_' || ch === '$';\n // }\n static is_valid_start_char (ch) {\n return IDStart.test(ch)\n }\n\n static is_valid_continue_char (ch) {\n return IDContinue.test(ch)\n }\n\n get [Node.isExpressionOrIdentifierSymbol] () { return true }\n}\n","\nimport Node from './Node'\n\nexport default class Ternary {\n constructor (yes, no) {\n Object.assign(this, {yes, no})\n }\n\n get_value () { return this }\n\n get [Node.isExpressionOrIdentifierSymbol] () { return true }\n}\n","/**\n * Originally based on (public domain):\n * https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js\n */\n\nimport {\n options, objectForEach, clonePlainObjectDeep, extend, hasOwnProperty\n} from '@tko/utils'\n\nimport {default as Expression} from './Expression'\nimport {default as Identifier} from './Identifier'\nimport {default as Arguments} from './Arguments'\nimport {default as Ternary} from './Ternary'\nimport {default as Node} from './Node'\nimport {default as operators} from './operators'\n\nconst escapee = {\n \"'\": \"'\",\n '\"': '\"',\n '`': '`',\n '\\\\': '\\\\',\n '/': '/',\n '$': '$',\n b: '\\b',\n f: '\\f',\n n: '\\n',\n r: '\\r',\n t: '\\t'\n}\n\n/**\n * Construct a new Parser instance with new Parser(node, context)\n * @param {Node} node The DOM element from which we parsed the\n * content.\n * @param {object} context The Knockout context.\n * @param {object} globals An object containing any desired globals.\n */\nexport default class Parser {\n white () {\n var ch = this.ch\n while (ch && ch <= ' ') {\n ch = this.next()\n }\n return this.comment(ch)\n }\n\n/**\n * Slurp any C or C++ style comments\n */\n comment (ch) {\n if (ch !== '/') { return ch }\n var p = this.at\n var second = this.lookahead()\n if (second === '/') {\n while (ch) {\n ch = this.next()\n if (ch === '\\n' || ch === '\\r') { break }\n }\n ch = this.next()\n } else if (second === '*') {\n while (ch) {\n ch = this.next()\n if (ch === '*' && this.lookahead() === '/') {\n this.next()\n break\n }\n }\n if (!ch) {\n this.error('Unclosed comment, starting at character ' + p)\n }\n this.next()\n return this.white()\n }\n return ch\n };\n\n next (c) {\n if (c && c !== this.ch) {\n this.error(\"Expected '\" + c + \"' but got '\" + this.ch + \"'\")\n }\n this.ch = this.text.charAt(this.at)\n this.at += 1\n return this.ch\n }\n\n lookahead () {\n return this.text[this.at]\n }\n\n error (m) {\n if (m instanceof Error) { throw m }\n let [name, msg] = m.name ? [m.name, m.message] : [m, '']\n const message = `\\n${name} ${msg} of\n ${this.text}\\n` + Array(this.at).join(' ') + '_/ 🔥 \\\\_\\n'\n throw new Error(message)\n }\n\n name () {\n // A name of a binding\n var name = ''\n var enclosedBy\n this.white()\n\n var ch = this.ch\n\n if (ch === \"'\" || ch === '\"') {\n enclosedBy = ch\n ch = this.next()\n }\n\n while (ch) {\n if (enclosedBy && ch === enclosedBy) {\n this.white()\n ch = this.next()\n if (ch !== ':' && ch !== ',') {\n this.error(\n 'Object name: ' + name + ' missing closing ' + enclosedBy\n )\n }\n return name\n } else if (ch === ':' || ch <= ' ' || ch === ',' || ch === '|') {\n return name\n }\n name += ch\n ch = this.next()\n }\n\n return name\n }\n\n number () {\n let number\n let string = ''\n let ch = this.ch\n\n if (ch === '-') {\n string = '-'\n ch = this.next('-')\n }\n while (ch >= '0' && ch <= '9') {\n string += ch\n ch = this.next()\n }\n if (ch === '.') {\n string += '.'\n ch = this.next()\n while (ch && ch >= '0' && ch <= '9') {\n string += ch\n ch = this.next()\n }\n }\n if (ch === 'e' || ch === 'E') {\n string += ch\n ch = this.next()\n if (ch === '-' || ch === '+') {\n string += ch\n ch = this.next()\n }\n while (ch >= '0' && ch <= '9') {\n string += ch\n ch = this.next()\n }\n }\n number = +string\n if (!isFinite(number)) {\n options.onError(new Error('Bad number: ' + number + ' in ' + string))\n } else {\n return number\n }\n }\n\n/**\n * Add a property to 'object' that equals the given value.\n * @param {Object} object The object to add the value to.\n * @param {String} key object[key] is set to the given value.\n * @param {mixed} value The value, may be a primitive or a function. If a\n * function it is unwrapped as a property.\n */\n objectAddValue (object, key, value) {\n if (value && value[Node.isExpressionOrIdentifierSymbol]) {\n Object.defineProperty(object, key, {\n get: () => Node.value_of(value, ...this.currentContextGlobals),\n enumerable: true\n })\n } else if (Array.isArray(value)) {\n Object.defineProperty(object, key, {\n get: () => value.map(v => Node.value_of(v, ...this.currentContextGlobals)),\n enumerable: true\n })\n } else {\n // primitives\n object[key] = value\n }\n }\n\n object () {\n let key\n let object = {}\n let ch = this.ch\n\n if (ch === '{') {\n this.next('{')\n ch = this.white()\n if (ch === '}') {\n ch = this.next('}')\n return object\n }\n while (ch) {\n if (ch === '\"' || ch === \"'\" || ch === '`') {\n key = this.string()\n } else {\n key = this.name()\n }\n if (hasOwnProperty(object, key)) {\n this.error('Duplicate key \"' + key + '\"')\n }\n if (this.white() === ':') {\n ch = this.next(':')\n this.objectAddValue(object, key, this.expression())\n } else {\n const objectKeyIsValue = new Identifier(this, key, [])\n this.objectAddValue(object, key, objectKeyIsValue)\n }\n\n ch = this.white()\n if (ch === '}') {\n ch = this.next('}')\n return object\n }\n\n this.next(',')\n ch = this.white()\n if (ch === '}') {\n ch = this.next('}')\n return object\n }\n }\n }\n this.error('Bad object')\n }\n\n/**\n * Read up to delim and return the string\n * @param {string} delim The delimiter, either ' or \"\n * @return {string} The string read.\n */\n readString (delim) {\n let string = ''\n let nodes = ['']\n let plusOp = operators['+']\n let hex\n let i\n let uffff\n let interpolate = delim === '`'\n let ch = this.next()\n\n while (ch) {\n if (ch === delim) {\n ch = this.next()\n if (interpolate) { nodes.push(plusOp) }\n nodes.push(string)\n return nodes\n }\n if (ch === '\\\\') {\n ch = this.next()\n if (ch === 'u') {\n uffff = 0\n for (i = 0; i < 4; i += 1) {\n hex = parseInt(ch = this.next(), 16)\n if (!isFinite(hex)) {\n break\n }\n uffff = uffff * 16 + hex\n }\n string += String.fromCharCode(uffff)\n } else if (typeof escapee[ch] === 'string') {\n string += escapee[ch]\n } else {\n break\n }\n } else if (interpolate && ch === '$') {\n ch = this.next()\n if (ch === '{') {\n this.next('{')\n nodes.push(plusOp)\n nodes.push(string)\n nodes.push(plusOp)\n nodes.push(this.expression())\n string = ''\n // this.next('}');\n } else {\n string += '$' + ch\n }\n } else {\n string += ch\n }\n ch = this.next()\n }\n\n this.error('Bad string')\n }\n\n string () {\n var ch = this.ch\n if (ch === '\"') {\n return this.readString('\"').join('')\n } else if (ch === \"'\") {\n return this.readString(\"'\").join('')\n } else if (ch === '`') {\n return Node.create_root(this.readString('`'))\n }\n\n this.error('Bad string')\n }\n\n array () {\n let array = []\n let ch = this.ch\n\n if (ch === '[') {\n ch = this.next('[')\n this.white()\n if (ch === ']') {\n ch = this.next(']')\n return array\n }\n while (ch) {\n array.push(this.expression())\n ch = this.white()\n if (ch === ']') {\n ch = this.next(']')\n return array\n }\n this.next(',')\n ch = this.white()\n }\n }\n this.error('Bad array')\n }\n\n value () {\n var ch\n this.white()\n ch = this.ch\n switch (ch) {\n case '{': return this.object()\n case '[': return this.array()\n case '\"': case \"'\": case '`': return this.string()\n case '-': return this.number()\n default:\n return ch >= '0' && ch <= '9' ? this.number() : this.identifier()\n }\n }\n\n/**\n * Get the function for the given operator.\n * A `.precedence` value is added to the function, with increasing\n * precedence having a higher number.\n * @return {function} The function that performs the infix operation\n */\n operator (opts) {\n let op = ''\n let opFn\n let ch = this.white()\n let isIdentifierChar = Identifier.is_valid_start_char\n\n while (ch) {\n if (isIdentifierChar(ch) || ch <= ' ' || ch === '' ||\n ch === '\"' || ch === \"'\" || ch === '{' || ch === '(' ||\n ch === '`' || ch === ')' || (ch <= '9' && ch >= '0')) {\n break\n }\n\n if (!opts.not_an_array && ch === '[') {\n break\n }\n\n op += ch\n ch = this.next()\n\n // An infix followed by the prefix e.g. a + @b\n // TODO: other prefix unary operators\n if (ch === '@') {\n break\n }\n\n isIdentifierChar = Identifier.is_valid_continue_char\n }\n\n if (op !== '') {\n if (opts.prefix && op === '-') { op = '&-' }\n opFn = operators[op]\n\n if (!opFn) {\n this.error(\"Bad operator: '\" + op + \"'.\")\n }\n }\n\n return opFn\n }\n\n/**\n * Filters\n * Returns what the Node interprets as an \"operator\".\n * e.g.\n * <span data-bind=\"text: name | fit:20 | uppercase\"></span>\n */\n filter () {\n let ch = this.next()\n let args = []\n let nextFilter = function (v) { return v }\n let name = this.name()\n\n if (!options.filters[name]) {\n options.onError('Cannot find filter by the name of: ' + name)\n }\n\n ch = this.white()\n\n while (ch) {\n if (ch === ':') {\n ch = this.next()\n args.push(this.expression('|'))\n }\n\n if (ch === '|') {\n nextFilter = this.filter()\n break\n }\n\n if (ch === ',') { break }\n\n ch = this.white()\n }\n\n var filter = function filter (value, ignored, context, globals, node) {\n var argValues = [value]\n\n for (var i = 0, j = args.length; i < j; ++i) {\n argValues.push(Node.value_of(args[i], context, globals, node))\n }\n\n return nextFilter(options.filters[name].apply(null, argValues))\n }\n\n // Lowest precedence.\n filter.precedence = 1\n return filter\n }\n\n/**\n * Parse an expression – builds an operator tree, in something like\n * Shunting-Yard.\n * See: http://en.wikipedia.org/wiki/Shunting-yard_algorithm\n *\n * @return {function} A function that computes the value of the expression\n * when called or a primitive.\n */\n expression (filterable) {\n let op\n let nodes = []\n let ch = this.white()\n\n while (ch) {\n // unary prefix operators\n op = this.operator({ prefix: true })\n if (op) {\n nodes.push(undefined) // LHS Tree node.\n nodes.push(op)\n ch = this.white()\n }\n\n if (ch === '(') {\n this.next()\n nodes.push(this.expression())\n this.next(')')\n } else {\n nodes.push(this.value())\n }\n ch = this.white()\n\n if (ch === ':' || ch === '}' || ch === ',' || ch === ']' ||\n ch === ')' || ch === '' || ch === '`' || (ch === '|' && filterable === '|')) {\n break\n }\n\n // filters\n if (ch === '|' && this.lookahead() !== '|' && filterable) {\n nodes.push(this.filter())\n nodes.push(undefined)\n break\n }\n\n // infix or postfix operators\n op = this.operator({ not_an_array: true })\n\n if (op === operators['?']) {\n this.ternary(nodes)\n break\n } else if (op === operators['.']) {\n nodes.push(op)\n nodes.push(this.member())\n op = null\n } else if (op === operators['[']) {\n nodes.push(op)\n nodes.push(this.expression())\n ch = this.next(']')\n op = null\n } else if (op) {\n nodes.push(op)\n }\n\n ch = this.white()\n\n if (ch === ']' || (!op && ch === '(')) { break }\n }\n\n if (nodes.length === 0) {\n return undefined\n }\n\n var dereferences = this.dereferences()\n\n if (nodes.length === 1 && !dereferences.length) {\n return nodes[0]\n }\n\n for (var i = 0, j = dereferences.length; i < j; ++i) {\n var deref = dereferences[i]\n if (deref.constructor === Arguments) {\n nodes.push(operators.call)\n } else {\n nodes.push(operators['.'])\n }\n nodes.push(deref)\n }\n\n return new Expression(nodes)\n }\n\n ternary (nodes) {\n var ternary = new Ternary()\n ternary.yes = this.expression()\n this.next(':')\n ternary.no = this.expression()\n nodes.push(operators['?'])\n nodes.push(ternary)\n }\n\n/**\n * Parse the arguments to a function, returning an Array.\n *\n */\n funcArguments () {\n let args = []\n let ch = this.next('(')\n\n while (ch) {\n ch = this.white()\n if (ch === ')') {\n this.next(')')\n return new Arguments(this, args)\n } else {\n args.push(this.expression())\n ch = this.white()\n }\n if (ch !== ')') { this.next(',') }\n }\n\n this.error('Bad arguments to function')\n }\n\n/**\n * The literal string reference `abc` in an `x.abc` expression.\n */\n member () {\n let member = ''\n let ch = this.white()\n let isIdentifierChar = Identifier.is_valid_start_char\n\n while (ch) {\n if (!isIdentifierChar(ch)) {\n break\n }\n member += ch\n ch = this.next()\n isIdentifierChar = Identifier.is_valid_continue_char\n }\n return member\n }\n\n/**\n * A dereference applies to an identifer, being either a function\n * call \"()\" or a membership lookup with square brackets \"[member]\".\n * @return {fn or undefined} Dereference function to be applied to the\n * Identifier\n */\n dereference () {\n let member\n let ch = this.white()\n\n while (ch) {\n if (ch === '(') {\n // a(...) function call\n return this.funcArguments()\n } else if (ch === '[') {\n // a[x] membership\n this.next('[')\n member = this.expression()\n this.white()\n this.next(']')\n\n return member\n } else if (ch === '.') {\n // a.x membership\n this.next('.')\n return this.member()\n } else {\n break\n }\n }\n }\n\n dereferences () {\n let ch = this.white()\n let dereferences = []\n let deref\n\n while (ch) {\n deref = this.dereference()\n if (deref !== undefined) {\n dereferences.push(deref)\n } else {\n break\n }\n }\n return dereferences\n }\n\n identifier () {\n let token = ''\n let isIdentifierChar = Identifier.is_valid_start_char\n let ch = this.white()\n\n while (ch) {\n if (!isIdentifierChar(ch)) {\n break\n }\n token += ch\n ch = this.next()\n isIdentifierChar = Identifier.is_valid_continue_char\n }\n switch (token) {\n case 'true': return true\n case 'false': return false\n case 'null': return null\n case 'undefined': return void 0\n case 'function':\n throw new Error('Knockout: Anonymous functions are no longer supported, but `=>` lambdas are.')\n // return this.anonymous_fn();\n }\n return new Identifier(this, token, this.dereferences())\n }\n\n readBindings () {\n let key\n let bindings = {}\n let sep\n let expr\n let ch = this.ch\n\n while (ch) {\n key = this.name()\n sep = this.white()\n\n if (!sep || sep === ',') {\n if (sep) {\n ch = this.next(',')\n } else {\n ch = ''\n }\n // A \"bare\" binding e.g. \"text\"; substitute value of 'null'\n // so it becomes \"text: null\".\n bindings[key] = null\n } else {\n if (key.indexOf('.') !== -1) {\n // Namespaced – i.e.\n // `attr.css: x` becomes `attr: { css: x }`\n // ^^^ - key\n key = key.split('.')\n bindings[key[0]] = bindings[key[0]] || {}\n\n if (key.length !== 2) {\n options.onError('Binding ' + key + ' should have two parts (a.b).')\n } else if (bindings[key[0]].constructor !== Object) {\n options.onError('Binding ' + key[0] + '.' + key[1] + ' paired with a non-object.')\n }\n\n ch = this.next(':')\n this.objectAddValue(bindings[key[0]], key[1], this.expression(true))\n } else {\n ch = this.next(':')\n if (bindings[key] && typeof bindings[key] === 'object' && bindings[key].constructor === Object) {\n // Extend a namespaced bindings e.g. we've previously seen\n // on.x, now we're seeing on: { 'abc' }.\n expr = this.expression(true)\n if (typeof expr !== 'object' || expr.constructor !== Object) {\n options.onError('Expected plain object for ' + key + ' value.')\n } else {\n extend(bindings[key], expr)\n }\n } else {\n bindings[key] = this.expression(true)\n }\n }\n\n this.white()\n if (this.ch) {\n ch = this.next(',')\n } else {\n ch = ''\n }\n }\n }\n return bindings\n }\n\n valueAsAccessor (value, context, globals, node) {\n if (!value) { return () => value }\n if (typeof value === 'function') { return value }\n\n if (value[Node.isExpressionOrIdentifierSymbol]) {\n return () => Node.value_of(value, context, globals, node)\n }\n\n if (Array.isArray(value)) {\n return () => value.map(v => Node.value_of(v, context, globals, node))\n }\n\n if (typeof (value) !== 'function') {\n return () => clonePlainObjectDeep(value)\n }\n\n throw new Error('Value has cannot be converted to accessor: ' + value)\n }\n\n /**\n * Convert result[name] from a value to a function (i.e. `valueAccessor()`)\n * @param {object} result [Map of top-level names to values]\n * @return {object} [Map of top-level names to functions]\n *\n * Accessors may be one of (below) constAccessor, identifierAccessor,\n * expressionAccessor, or nodeAccessor.\n */\n convertToAccessors (result, context, globals, node) {\n objectForEach(result, (name, value) => {\n if (value instanceof Identifier) {\n // Return a function that, with no arguments returns\n // the value of the identifier, otherwise sets the\n // value of the identifier to the first given argument.\n Object.defineProperty(result, name, {\n value: function (optionalValue, options) {\n const currentValue = value.get_value(undefined, context, globals, node)\n if (arguments.length === 0) { return currentValue }\n const unchanged = optionalValue === currentValue\n if (options && options.onlyIfChanged && unchanged) { return }\n return value.set_value(optionalValue, context, globals)\n }\n })\n } else {\n result[name] = this.valueAsAccessor(value, context, globals, node)\n }\n })\n return result\n }\n\n preparse (source = '') {\n const preparsers = options.bindingStringPreparsers || []\n return preparsers.reduce((acc, fn) => fn(acc), source.trim())\n }\n\n runParse (source, fn) {\n this.text = this.preparse(source)\n this.at = 0\n this.ch = ' '\n\n try {\n var result = fn()\n this.white()\n if (this.ch) {\n this.error('Syntax Error')\n }\n return result\n } catch (e) {\n options.onError(e)\n }\n }\n\n /**\n * Get the bindings as name: accessor()\n * @param {string} source The binding string to parse.\n * @return {object} Map of name to accessor function.\n */\n parse (source, context = {}, globals = {}, node) {\n if (!source) { return () => null }\n this.currentContextGlobals = [context, globals, node]\n const parseFn = () => this.readBindings()\n const bindingAccessors = this.runParse(source, parseFn)\n return this.convertToAccessors(bindingAccessors, context, globals, node)\n }\n\n /**\n * Return a function that evaluates and returns the result of the expression.\n */\n parseExpression (source, context = {}, globals = {}, node) {\n if (!source) { return () => '' }\n this.currentContextGlobals = [context, globals, node]\n const parseFn = () => this.expression(true)\n const bindingAccessors = this.runParse(source, parseFn)\n return this.valueAsAccessor(bindingAccessors, context, globals, node)\n }\n}\n","import {\n extenders\n} from '@tko/observable'\n\nimport {\n computed\n} from './computed.js'\n\nexport function throttleExtender (target, timeout) {\n // Throttling means two things:\n\n // (1) For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies\n // notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate\n target.throttleEvaluation = timeout\n\n // (2) For writable targets (observables, or writable dependent observables), we throttle *writes*\n // so the target cannot change value synchronously or faster than a certain rate\n var writeTimeoutInstance = null\n return computed({\n read: target,\n write: function (value) {\n clearTimeout(writeTimeoutInstance)\n writeTimeoutInstance = setTimeout(function () {\n target(value)\n }, timeout)\n }\n })\n}\n\nextenders.throttle = throttleExtender\n","'use strict'\n\nimport {\n addDisposeCallback, createSymbolOrString\n} from '@tko/utils'\n\nimport {\n computed\n} from '@tko/computed'\n\nconst SUBSCRIPTIONS = createSymbolOrString('LifeCycle Subscriptions List')\nconst ANCHOR_NODE = createSymbolOrString('LifeCycle Anchor Node')\n\nexport default class LifeCycle {\n // NOTE: For more advanced integration as an ES6 mixin, see e.g.:\n // http://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/\n\n /**\n * Copy the properties of the LifeCycle class to the target (or its prototype)\n *\n * NOTE: getOwnPropertyNames is needed to copy the non-enumerable properties.\n */\n static mixInto (Constructor) {\n const target = Constructor.prototype || Constructor\n const mixin = LifeCycle.prototype\n for (let prop of Object.getOwnPropertyNames(mixin)) {\n target[prop] = mixin[prop]\n }\n }\n\n subscribe (observable, action, subscriptionType) {\n if (typeof action === 'string') { action = this[action] }\n this.addDisposable(observable.subscribe(action, this, subscriptionType))\n }\n\n computed (params) {\n if (typeof params === 'string') {\n params = { read: this[params], write: this[params] }\n }\n\n if (typeof params === 'object') {\n params = Object.assign({ owner: this }, params)\n } else if (typeof params === 'function') {\n const proto = Object.getPrototypeOf(this)\n if (proto && proto[params.name] === params) { params = params.bind(this) }\n params = { read: params, write: params }\n } else {\n throw new Error('LifeCycle::computed not given a valid type.')\n }\n\n params.disposeWhenNodeIsRemoved = this[ANCHOR_NODE]\n return this.addDisposable(computed(params))\n }\n\n /**\n * Add an event listener for the given or anchored node.\n * @param {node} [node] (optional) The target node (otherwise the anchored node)\n * @param {string} [type] Event type\n * @param {function|string} [action] Either call the given function or `this[action]`\n * @param {object} [options] (optional) Passed as `options` to `node.addEventListener`\n */\n addEventListener (...args) {\n const node = args[0].nodeType ? args.shift() : this[ANCHOR_NODE]\n const [type, act, options] = args\n const handler = typeof act === 'string' ? this[act].bind(this) : act\n this.__addEventListener(node, type, handler, options)\n }\n\n __addEventListener (node, eventType, handler, options) {\n node.addEventListener(eventType, handler, options)\n function dispose () { node.removeEventListener(eventType, handler) }\n addDisposeCallback(node, dispose)\n this.addDisposable({ dispose })\n }\n\n anchorTo (node) {\n addDisposeCallback(node, () => this.dispose())\n this[ANCHOR_NODE] = node\n }\n\n dispose () {\n const subscriptions = this[SUBSCRIPTIONS] || []\n subscriptions.forEach(s => s.dispose())\n this[SUBSCRIPTIONS] = []\n this[ANCHOR_NODE] = null\n }\n\n addDisposable (subscription) {\n const subscriptions = this[SUBSCRIPTIONS] || []\n if (!this[SUBSCRIPTIONS]) { this[SUBSCRIPTIONS] = subscriptions }\n if (typeof subscription.dispose !== 'function') {\n throw new Error('Lifecycle::addDisposable argument missing `dispose`.')\n }\n subscriptions.push(subscription)\n return subscription\n }\n}\n","\nimport {\n domData, removeDisposeCallback, arrayRemoveItem, addDisposeCallback\n} from '@tko/utils'\n\nimport {\n subscribable\n} from '@tko/observable'\n\nexport const contextAncestorBindingInfo = Symbol('_ancestorBindingInfo')\nconst boundElementDomDataKey = domData.nextKey()\n\nexport const bindingEvent = {\n childrenComplete: 'childrenComplete',\n descendantsComplete: 'descendantsComplete',\n\n subscribe (node, event, callback, context) {\n const bindingInfo = domData.getOrSet(node, boundElementDomDataKey, {})\n if (!bindingInfo.eventSubscribable) {\n bindingInfo.eventSubscribable = new subscribable()\n }\n return bindingInfo.eventSubscribable.subscribe(callback, context, event)\n },\n\n notify (node, event) {\n const bindingInfo = domData.get(node, boundElementDomDataKey)\n if (bindingInfo) {\n if (bindingInfo.eventSubscribable) {\n bindingInfo.eventSubscribable.notifySubscribers(node, event)\n }\n }\n }\n}\n\n","\n\nexport class BindingResult {\n constructor ({asyncBindingsApplied, rootNode, bindingContext}) {\n Object.assign(this, {\n rootNode,\n bindingContext,\n isSync: asyncBindingsApplied.size === 0,\n isComplete: this.isSync\n })\n\n if (!this.isSync) {\n this.completionPromise = this.completeWhenBindingsFinish(asyncBindingsApplied)\n }\n }\n\n async completeWhenBindingsFinish (asyncBindingsApplied) {\n await Promise.all(asyncBindingsApplied)\n this.isComplete = true\n return this\n }\n}\n","\nimport {\n options\n} from '@tko/utils'\n\nimport {\n isWriteableObservable\n} from '@tko/observable'\n\nimport {\n LifeCycle\n} from '@tko/lifecycle'\n\nexport class BindingHandler extends LifeCycle {\n constructor (params) {\n super()\n const {$element, valueAccessor, allBindings, $context} = params\n Object.assign(this, {\n valueAccessor,\n allBindings,\n $element,\n $context,\n $data: $context.$data\n })\n\n this.anchorTo($element)\n }\n\n get value () { return this.valueAccessor() }\n set value (v) {\n const va = this.valueAccessor()\n if (isWriteableObservable(va)) {\n va(v)\n } else {\n this.valueAccessor(v)\n }\n }\n\n get controlsDescendants () { return false }\n\n static get allowVirtualElements () { return false }\n static get isBindingHandlerClass () { return true }\n\n /* Overload this for asynchronous bindings or bindings that recursively\n apply bindings (e.g. components, foreach, template).\n\n A binding should be complete when it has run through once, notably\n in server-side bindings for pre-rendering.\n */\n get bindingCompleted () { return true }\n\n static registerAs (name, provider = options.bindingProviderInstance) {\n provider.bindingHandlers.set(name, this)\n }\n}\n\n/**\n * An AsyncBindingHandler shall call `completeBinding` when the binding\n * is to be considered complete.\n */\nconst ResolveSymbol = Symbol('Async Binding Resolved')\n\nexport class AsyncBindingHandler extends BindingHandler {\n constructor (params) {\n super(params)\n this.bindingCompletion = new Promise((resolve) => {\n this[ResolveSymbol] = resolve\n })\n this.completeBinding = bindingResult => this[ResolveSymbol](bindingResult)\n }\n\n get bindingCompleted () { return this.bindingCompletion }\n}\n","\nimport {\n virtualElements, options\n} from '@tko/utils'\n\nimport {\n dependencyDetection\n} from '@tko/observable'\n\nimport {\n BindingHandler\n} from './BindingHandler'\n\n/**\n * We have no guarantees, for users employing legacy bindings,\n * that it has not been changed with a modification like\n *\n * ko.bindingHandlers[name] = { init: ...}\n *\n * ... so we have to keep track by way of a map.\n */\nconst PossibleWeakMap = options.global.WeakMap || Map\nconst legacyBindingMap = new PossibleWeakMap()\n\nexport class LegacyBindingHandler extends BindingHandler {\n constructor (params) {\n super(params)\n const handler = this.handler\n this.onError = params.onError\n\n if (typeof handler.dispose === 'function') {\n this.addDisposable(handler)\n }\n\n try {\n this.initReturn = handler.init && handler.init(...this.legacyArgs)\n } catch (e) {\n params.onError('init', e)\n }\n }\n\n onValueChange () {\n const handler = this.handler\n if (typeof handler.update !== 'function') { return }\n try {\n handler.update(...this.legacyArgs)\n } catch (e) {\n this.onError('update', e)\n }\n }\n\n get legacyArgs () {\n return [\n this.$element, this.valueAccessor, this.allBindings,\n this.$data, this.$context\n ]\n }\n\n get controlsDescendants () {\n const objectToTest = this.initReturn || this.handler || {}\n return objectToTest.controlsDescendantBindings\n }\n\n /**\n * Create a handler instance from the `origin`, which may be:\n *\n * 1. an object (becomes LegacyBindingHandler)\n * 2. a function (becomes LegacyBindingHandler with `init: function`)\n *\n * If given an object (the only kind supported in knockout 3.x and before), it\n * shall draw the `init`, `update`, and `allowVirtualElements` properties\n */\n static getOrCreateFor (key, handler) {\n if (legacyBindingMap.has(handler)) {\n return legacyBindingMap.get(handler)\n }\n const newLegacyHandler = this.createFor(key, handler)\n legacyBindingMap.set(handler, newLegacyHandler)\n return newLegacyHandler\n }\n\n static createFor (key, handler) {\n if (typeof handler === 'function') {\n const [initFn, disposeFn] = [handler, handler.dispose]\n return class extends LegacyBindingHandler {\n get handler () {\n const init = initFn.bind(this)\n const dispose = disposeFn ? disposeFn.bind(this) : null\n return { init, dispose }\n }\n static get after () { return handler.after }\n static get allowVirtualElements () {\n return handler.allowVirtualElements || virtualElements.allowedBindings[key]\n }\n }\n }\n\n if (typeof handler === 'object') {\n return class extends LegacyBindingHandler {\n get handler () { return handler }\n static get after () { return handler.after }\n static get allowVirtualElements () {\n return handler.allowVirtualElements || virtualElements.allowedBindings[key]\n }\n }\n }\n\n throw new Error('The given handler is not an appropriate type.')\n }\n}\n","\n\nimport {\n applyBindingsToDescendants\n} from './applyBindings'\n\nimport {\n AsyncBindingHandler\n} from './BindingHandler'\n\n/**\n * This DescendantBindingHandler is a base class for bindings that control\n * descendants, such as the `if`, `with`, `component`, `foreach` and `template`\n * bindings.\n */\nexport class DescendantBindingHandler extends AsyncBindingHandler {\n get controlsDescendants () { return true }\n\n async applyBindingsToDescendants (childContext, callback) {\n const bindingResult = applyBindingsToDescendants(childContext, this.$element)\n if (bindingResult.isSync) {\n this.bindingCompletion = bindingResult\n } else {\n await bindingResult.completionPromise\n }\n if (callback) { callback(bindingResult) }\n this.completeBinding(bindingResult)\n }\n}\n","\nimport {\n unwrap, peek\n} from '@tko/observable'\n\nimport {\n nativeTemplateEngine\n} from './nativeTemplateEngine'\n\nimport {\n TemplateBindingHandler\n} from './templating'\n\n// \"foreach: someExpression\" is equivalent to \"template: { foreach: someExpression }\"\n// \"foreach: { data: someExpression, afterAdd: myfn }\" is equivalent to \"template: { foreach: someExpression, afterAdd: myfn }\"\nexport class TemplateForEachBindingHandler extends TemplateBindingHandler {\n get value () {\n const modelValue = this.valueAccessor()\n const unwrappedValue = peek(modelValue) // Unwrap without setting a dependency here\n\n // If unwrappedValue is the array, pass in the wrapped value on its own\n // The value will be unwrapped and tracked within the template binding\n // (See https://github.com/SteveSanderson/knockout/issues/523)\n if (!unwrappedValue || typeof unwrappedValue.length === 'number') {\n return { foreach: modelValue, templateEngine: nativeTemplateEngine.instance }\n }\n\n // If unwrappedValue.data is the array, preserve all relevant options and unwrap again value so we get updates\n unwrap(modelValue)\n return {\n foreach: unwrappedValue.data,\n as: unwrappedValue.as,\n includeDestroyed: unwrappedValue.includeDestroyed,\n afterAdd: unwrappedValue.afterAdd,\n beforeRemove: unwrappedValue.beforeRemove,\n afterRender: unwrappedValue.afterRender,\n beforeMove: unwrappedValue.beforeMove,\n afterMove: unwrappedValue.afterMove,\n templateEngine: nativeTemplateEngine.instance\n }\n }\n}\n","/**\n * A class to create the global knockout instance (ko).\n */\n\nimport {\n addDisposeCallback,\n addOrRemoveItem,\n arrayFilter,\n arrayFirst,\n arrayForEach,\n arrayGetDistinctValues,\n arrayIndexOf,\n arrayMap,\n arrayPushAll,\n arrayRemoveItem,\n addCleaner,\n cleanNode,\n cloneNodes,\n compareArrays,\n createSymbolOrString,\n domData,\n extend,\n memoization,\n objectForEach,\n objectMap,\n options,\n parseHtmlFragment,\n parseJson,\n range,\n registerEventHandler,\n removeCleaner,\n removeDisposeCallback,\n removeNode,\n selectExtensions,\n setHtml,\n setTextContent,\n tasks,\n toggleDomNodeCssClass,\n triggerEvent,\n virtualElements\n} from '@tko/utils'\n\nimport {\n parseObjectLiteral\n} from '@tko/utils.parser'\n\nimport {\n LifeCycle\n} from '@tko/lifecycle'\n\nimport {\n // applyExtenders,\n // arrayChangeEventName,\n // deferUpdates,\n dependencyDetection,\n extenders as defaultExtenders,\n isObservable,\n isSubscribable,\n isWriteableObservable,\n observable,\n observableArray,\n isObservableArray,\n peek,\n subscribable,\n toJS,\n toJSON,\n unwrap\n} from '@tko/observable'\n\nimport {\n computed,\n isComputed,\n isPureComputed,\n proxy,\n pureComputed,\n when\n} from '@tko/computed'\n\nimport {\n applyBindingAccessorsToNode,\n applyBindings,\n applyBindingsToDescendants,\n applyBindingsToNode,\n contextFor,\n dataFor,\n bindingEvent,\n BindingHandler,\n AsyncBindingHandler,\n setDomNodeChildrenFromArrayMapping\n} from '@tko/bind'\n\nimport {\n anonymousTemplate,\n domElement,\n nativeTemplateEngine,\n renderTemplate,\n setTemplateEngine,\n templateEngine\n // templateSources\n} from '@tko/binding.template'\n\nconst domNodeDisposal = {\n addDisposeCallback,\n removeDisposeCallback,\n removeNode,\n addCleaner,\n removeCleaner,\n get cleanExternalData () {\n return options.cleanExternalData\n },\n set cleanExternalData (cleanerFn) {\n options.set('cleanExternalData', cleanerFn)\n }\n}\n\nconst utils = Object.assign({\n addOrRemoveItem,\n arrayFilter,\n arrayFirst,\n arrayForEach,\n arrayGetDistinctValues,\n arrayIndexOf,\n arrayMap,\n arrayPushAll,\n arrayRemoveItem,\n cloneNodes,\n compareArrays,\n createSymbolOrString,\n domData,\n domNodeDisposal,\n extend,\n filters: options.filters,\n objectForEach,\n objectMap,\n parseHtmlFragment,\n parseJson,\n parseObjectLiteral,\n peekObservable: peek,\n range,\n registerEventHandler,\n setDomNodeChildrenFromArrayMapping,\n setHtml,\n setTextContent,\n toggleDomNodeCssClass,\n triggerEvent,\n unwrapObservable: unwrap\n})\n\nconst knockout = {\n // --- Utilities ---\n cleanNode,\n dependencyDetection,\n computedContext: dependencyDetection,\n filters: options.filters,\n ignoreDependencies: dependencyDetection.ignore,\n memoization,\n options,\n removeNode,\n selectExtensions,\n tasks,\n utils,\n LifeCycle,\n\n // -- Observable ---\n isObservable,\n isSubscribable,\n isWriteableObservable,\n isWritableObservable: isWriteableObservable,\n observable,\n observableArray,\n isObservableArray,\n peek,\n subscribable,\n unwrap,\n toJS,\n toJSON,\n proxy,\n\n // ... Computed ...\n computed,\n dependentObservable: computed,\n isComputed,\n isPureComputed,\n pureComputed,\n when: when,\n\n // --- Templates ---\n nativeTemplateEngine,\n renderTemplate,\n setTemplateEngine,\n templateEngine,\n templateSources: { domElement, anonymousTemplate },\n\n // --- Binding ---\n applyBindingAccessorsToNode,\n applyBindings,\n applyBindingsToDescendants,\n applyBindingsToNode,\n contextFor,\n dataFor,\n BindingHandler,\n AsyncBindingHandler,\n virtualElements,\n domNodeDisposal,\n bindingEvent,\n}\n\nexport class Builder {\n constructor ({ provider, bindings, extenders, filters, options }) {\n Object.assign(knockout.options, options, {\n filters,\n bindingProviderInstance: provider\n })\n\n provider.setGlobals(knockout.options.bindingGlobals)\n\n if (Array.isArray(bindings)) {\n for (const bindingsObject of bindings) {\n provider.bindingHandlers.set(bindingsObject)\n }\n } else {\n provider.bindingHandlers.set(bindings)\n }\n\n this.providedProperties = {\n extenders: Object.assign(defaultExtenders, extenders),\n bindingHandlers: provider.bindingHandlers,\n bindingProvider: provider\n }\n }\n\n /**\n * @return {Object} An instance of Knockout.\n */\n create (...additionalProperties) {\n const instance = Object.assign({\n get getBindingHandler () { return options.getBindingHandler },\n set getBindingHandler (fn) { options.set('getBindingHandler', fn) }\n },\n knockout,\n this.providedProperties,\n ...additionalProperties)\n instance.options.knockoutInstance = instance\n return instance\n }\n}\n","\nimport {\n options\n} from '@tko/utils'\n\nexport default class BindingHandlerObject {\n set (nameOrObject, value) {\n if (typeof nameOrObject === 'string') {\n this[nameOrObject] = value\n } else if (typeof nameOrObject === 'object') {\n if (value !== undefined) {\n options.onError(\n new Error('Given extraneous `value` parameter (first param should be a string, but it was an object).' + nameOrObject))\n }\n Object.assign(this, nameOrObject)\n } else {\n options.onError(\n new Error('Given a bad binding handler type: ' + nameOrObject))\n }\n }\n\n /**\n * The handler may have a `.` in it, e.g. `attr.title`, in which case the\n * handler is `attr`. Otherwise it's the name given\n */\n get (nameOrDotted) {\n const [name] = nameOrDotted.split('.')\n return this[name]\n }\n}\n","\nimport {\n objectMap\n} from '@tko/utils'\n\nimport {\n dependencyDetection\n} from '@tko/observable'\n\nimport BindingHandlerObject from './BindingHandlerObject'\n\nexport default class Provider {\n constructor (params = {}) {\n if (this.constructor === Provider) {\n throw new Error('Provider is an abstract base class.')\n }\n if (!('FOR_NODE_TYPES' in this)) {\n // FOR_NODE_TYPES must return a list of integers corresponding to the\n // node.nodeType's that the provider handles.\n throw new Error('Providers must have FOR_NODE_TYPES property')\n }\n this.bindingHandlers = params.bindingHandlers || new BindingHandlerObject()\n this.globals = params.globals || {}\n }\n\n setGlobals (globals) {\n this.globals = globals\n }\n get preemptive () { return false }\n nodeHasBindings (/* node */) {}\n getBindingAccessors (/* node, context */) {}\n\n /**\n * Preprocess a given node.\n * @param {HTMLElement} node\n * @returns {[HTMLElement]|undefined}\n */\n preprocessNode (node) {}\n postProcess (/* node */) {}\n\n /** For legacy binding provider assignments to\n * ko.bindingProvider.instance = ... */\n get instance () { return this._overloadInstance || this }\n set instance (provider) {\n if (!provider || provider === this) {\n this._overloadInstance = undefined\n } else {\n this._overloadInstance = new LegacyProvider(provider, this)\n }\n }\n\n // Given a function that returns bindings, create and return a new object that contains\n // binding value-accessors functions. Each accessor function calls the original function\n // so that it always gets the latest value and all dependencies are captured. This is used\n // by ko.applyBindingsToNode and getBindingsAndMakeAccessors.\n makeAccessorsFromFunction (callback) {\n return objectMap(dependencyDetection.ignore(callback),\n (value, key) => () => callback()[key]\n )\n }\n\n // Returns the valueAccessor function for a binding value\n makeValueAccessor (value) {\n return () => value\n }\n\n // Given a bindings function or object, create and return a new object that contains\n // binding value-accessors functions. This is used by ko.applyBindingsToNode.\n makeBindingAccessors (bindings, context, node) {\n if (typeof bindings === 'function') {\n return this.makeAccessorsFromFunction(bindings.bind(null, context, node))\n } else {\n return objectMap(bindings, this.makeValueAccessor)\n }\n }\n}\n\n/**\n * LegacyProvider class is created when ko.bindingProvider.instance assigned to\n * an object that were once used for binding pre-4.0 binding providers e.g.\n * { getBindings: function () { ... },\n * nodeHasBindings: function () { ... }\n * preprocessNode: function () { ... }\n * }\n */\nclass LegacyProvider extends Provider {\n get FOR_NODE_TYPES () { return [1, 3, 8] }\n\n constructor (providerObject, parentProvider) {\n super()\n Object.assign(this, {providerObject})\n this.bindingHandlers = providerObject.bindingHandlers || parentProvider.bindingHandlers\n }\n\n // This function is used if the binding provider doesn't include a getBindingAccessors function.\n // It must be called with 'this' set to the provider instance.\n getBindingsAndMakeAccessors (node, context) {\n const bindingsFn = this.providerObject.getBindings.bind(this.providerObject, node, context)\n return this.makeAccessorsFromFunction(bindingsFn)\n }\n\n getBindingAccessors (node, context) {\n return this.providerObject.getBindingAccessors\n ? this.providerObject.getBindingAccessors(node, context)\n : this.getBindingsAndMakeAccessors(node, context)\n }\n\n nodeHasBindings (node) {\n return this.providerObject.nodeHasBindings(node)\n }\n\n preprocessNode (node) {\n if (this.providerObject.preprocessNode) {\n return this.providerObject.preprocessNode(node)\n }\n }\n}\n","import {\n Parser, parseObjectLiteral\n} from '@tko/utils.parser'\n\nimport {\n Provider\n } from '@tko/provider'\n\n/**\n * BindingStringProvider is an abstract base class parses a binding string.\n *\n * Children must implement `nodeHasBindings` and `getBindingString`.\n */\nexport default class BindingStringProvider extends Provider {\n /** Call bindingHandler.preprocess on each respective binding string.\n *\n * The `preprocess` property of bindingHandler must be a static\n * function (i.e. on the object or constructor).\n */\n * processBinding (key, value) {\n // Get the \"on\" binding from \"on.click\"\n const [handlerName, property] = key.split('.')\n const handler = this.bindingHandlers.get(handlerName)\n\n if (handler && handler.preprocess) {\n const bindingsAddedByHandler = []\n const chainFn = (...args) => bindingsAddedByHandler.push(args)\n value = handler.preprocess(value, key, chainFn)\n for (const [key, value] of bindingsAddedByHandler) {\n yield * this.processBinding(key, value)\n }\n } else if (property) {\n value = `{${property}:${value}}`\n }\n\n yield `'${handlerName}':${value}`\n }\n\n * generateBindingString (bindingStringOrObjects) {\n const bindingObjectsArray = typeof bindingStringOrObjects === 'string'\n ? parseObjectLiteral(bindingStringOrObjects) : bindingStringOrObjects\n for (const {key, unknown, value} of bindingObjectsArray) {\n yield * this.processBinding(key || unknown, value)\n }\n }\n\n preProcessBindings (bindingStringOrObjects) {\n return Array.from(this.generateBindingString(bindingStringOrObjects))\n .join(',')\n }\n\n getBindingAccessors (node, context) {\n const bindingString = node && this.getBindingString(node)\n if (!bindingString) { return }\n const processed = this.preProcessBindings(bindingString)\n return new Parser().parse(processed, context, this.globals, node)\n }\n\n getBindingString () { throw new Error('Overload getBindingString.') }\n}\n","import {\n virtualElements\n} from '@tko/utils'\n\nimport {\n BindingStringProvider\n} from '@tko/provider.bindingstring'\n\nexport default class VirtualProvider extends BindingStringProvider {\n get FOR_NODE_TYPES () { return [ 1, 8 ] }\n\n /**\n * Convert <ko binding='...'> into <!-- ko binding: ... -->\n * @param {HTMLElement} node\n */\n preprocessNode (node) {\n if (node.tagName === 'KO') {\n const parent = node.parentNode\n const childNodes = [...node.childNodes]\n const virtualBindingString = [...this.genElementBindingStrings(node)].join(',')\n const openNode = document.createComment('ko ' + virtualBindingString)\n const closeNode = document.createComment('/ko')\n parent.insertBefore(openNode, node)\n for (const child of childNodes) {\n parent.insertBefore(child, node)\n }\n parent.insertBefore(closeNode, node)\n node.remove()\n return [openNode, ...childNodes, closeNode]\n }\n }\n\n * genElementBindingStrings (node) {\n for (const {name, value} of node.attributes) {\n yield `${name.replace(/^ko-/, '')}: ${value}`\n }\n }\n\n getBindingString (node) {\n if (node.nodeType === document.COMMENT_NODE) {\n return virtualElements.virtualNodeBindingValue(node)\n }\n }\n\n nodeHasBindings (node) {\n if (node.nodeType === document.COMMENT_NODE) {\n return virtualElements.isStartComment(node)\n }\n }\n}\n","\nimport {\n BindingStringProvider\n } from '@tko/provider.bindingstring'\n\nexport default class DataBindProvider extends BindingStringProvider {\n get FOR_NODE_TYPES () { return [ 1 ] } // document.ELEMENT_NODE\n\n get BIND_ATTRIBUTE () {\n return 'data-bind'\n }\n\n getBindingString (node) {\n if (node.nodeType === document.ELEMENT_NODE) {\n return node.getAttribute(this.BIND_ATTRIBUTE)\n }\n }\n\n nodeHasBindings (node) {\n if (node.nodeType === document.ELEMENT_NODE) {\n return node.hasAttribute(this.BIND_ATTRIBUTE)\n }\n }\n}\n","/**\n * Component --- Abstract Base Class\n *\n * This simplifies and compartmentalizes Components. Use this:\n *\n * class CompX extends ComponentABC {\n * \tstatic get element () { return 'comp-x-id' }\n * \tstatic get sync () { return false }\n * \tstatic get elementName () { return 'comp-x' }\n * }\n * CompX.register()\n *\n * instead of:\n *\n * class CompX {}\n *\n * ko.components.register('comp-x', {\n * viewModel: CompX,\n * synchronous: false,\n * template: { element: 'comp-x' }\n * })\n *\n * As well, gain all the benefits of a LifeCycle, namely automated\n * event and subscription addition/removal.\n *\n * NOTE: A Component created this way can add events to the component node\n * with `this.addEventListener(type, action)`.\n */\nimport {LifeCycle} from '@tko/lifecycle'\nimport {register, VIEW_MODEL_FACTORY} from './loaders'\n\nexport class ComponentABC extends LifeCycle {\n\t/**\n * The tag name of the custom element. For example 'my-component'.\n * By default converts the class name from camel case to kebab case.\n\t * @return {string} The custom node name of this component.\n\t */\n static get customElementName () {\n return this.name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()\n }\n\n\t/**\n\t * Overload this to return:\n\t * 1. A string of markup\n\t * 2. An array of DOM nodes\n\t * 3. A document fragment\n\t * 4. An AMD module (with `{require: 'some/template'}`)\n\t * @return {mixed} One of the accepted template types for the ComponentBinding.\n\t */\n static get template () {\n if ('template' in this.prototype) { return }\n return { element: this.element }\n }\n\n\t/**\n\t * This is called by the default `template`. Overload this to return:\n\t * 1. The element ID\n\t * 2. A DOM node itself\n\t * @return {string|HTMLElement} either the element ID or actual element.\n\t */\n static get element () {\n throw new Error('[ComponentABC] `element` must be overloaded.')\n }\n\n\t/**\n\t * @return {bool} True if the component shall load synchronously\n\t */\n static get sync () { return true }\n\n /**\n * Construct a new instance of the model. When using ComponentABC as a\n * base class, we do pass in the $element and $componentTemplateNodes.\n * @param {Object} params\n * @param {{element: HTMLElement, templateNodes: [HTMLElement]}} componentInfo\n */\n static [VIEW_MODEL_FACTORY] (params, componentInfo) {\n return new this(params, componentInfo)\n }\n\n static register (name = this.customElementName) {\n const viewModel = this\n const {template} = this\n const synchronous = this.sync\n register(name, { viewModel, template, synchronous })\n }\n}\n","\nimport {registry} from './registry'\n\nimport { ComponentABC } from './ComponentABC'\n\nimport {\n register,\n isRegistered,\n unregister,\n defaultLoader,\n defaultConfigRegistry\n} from './loaders'\n\nexport { ComponentABC }\n\nexport default {\n ComponentABC,\n // -- Registry --\n get: registry.get,\n clearCachedDefinition: registry.clearCachedDefinition,\n\n // -- Loader --\n register,\n isRegistered,\n unregister,\n defaultLoader,\n // \"Privately\" expose the underlying config registry for use in old-IE shim\n _allRegisteredComponents: defaultConfigRegistry,\n\n get loaders () { return registry.loaders },\n set loaders (loaders) { registry.loaders = loaders }\n}\n","\nimport {\n tagNameLower, objectMap\n} from '@tko/utils'\n\nimport registry from '@tko/utils.component'\n\nimport {\n unwrap, isWriteableObservable\n} from '@tko/observable'\n\nimport {\n computed\n} from '@tko/computed'\n\nimport {\n Provider\n} from '@tko/provider'\n\nimport {\n Parser\n} from '@tko/utils.parser'\n\nexport default class ComponentProvider extends Provider {\n get FOR_NODE_TYPES () { return [ 1 ] } // document.ELEMENT_NODE\n\n /**\n * Convert <slot name='X'> to <!-- ko slot: 'X' --><!-- /ko -->\n * @param {HTMLElement} node\n */\n preprocessNode (node) {\n if (node.tagName === 'SLOT') {\n const parent = node.parentNode\n const slotName = node.getAttribute('name') || ''\n const openNode = document.createComment(`ko slot: \"${slotName}\"`)\n const closeNode = document.createComment('/ko')\n parent.insertBefore(openNode, node)\n parent.insertBefore(closeNode, node)\n parent.removeChild(node)\n return [openNode, closeNode]\n }\n }\n\n nodeHasBindings (node) {\n return Boolean(this.getComponentNameForNode(node))\n }\n\n getBindingAccessors (node, context) {\n const componentName = this.getComponentNameForNode(node)\n if (!componentName) { return }\n const component = () => ({\n name: componentName,\n params: this.getComponentParams(node, context)\n })\n return { component }\n }\n\n getComponentNameForNode (node) {\n if (node.nodeType !== node.ELEMENT_NODE) { return }\n const tagName = tagNameLower(node)\n if (registry.isRegistered(tagName)) {\n const hasDash = tagName.includes('-')\n const isUnknownEntity = ('' + node) === '[object HTMLUnknownElement]'\n if (hasDash || isUnknownEntity) { return tagName }\n }\n }\n\n getComponentParams (node, context) {\n const parser = new Parser(node, context, this.globals)\n const paramsString = (node.getAttribute('params') || '').trim()\n const accessors = parser.parse(paramsString, context, node)\n if (!accessors || Object.keys(accessors).length === 0) {\n return { $raw: {} }\n }\n const $raw = objectMap(accessors,\n (value) => computed(value, null, { disposeWhenNodeIsRemoved: node })\n )\n const params = objectMap($raw, (v) => this.makeParamValue(node, v))\n return Object.assign({ $raw }, params)\n }\n\n makeParamValue (node, paramValueComputed) {\n const paramValue = paramValueComputed.peek()\n // Does the evaluation of the parameter value unwrap any observables?\n if (!paramValueComputed.isActive()) {\n // No it doesn't, so there's no need for any computed wrapper. Just pass through the supplied value directly.\n // Example: \"someVal: firstName, age: 123\" (whether or not firstName is an observable/computed)\n return paramValue\n }\n // Yes it does. Supply a computed property that unwraps both the outer (binding expression)\n // level of observability, and any inner (resulting model value) level of observability.\n // This means the component doesn't have to worry about multiple unwrapping. If the value is a\n // writable observable, the computed will also be writable and pass the value on to the observable.\n const isWriteable = isWriteableObservable(paramValue)\n\n return computed({\n read: () => unwrap(paramValueComputed()),\n write: isWriteable ? (v) => paramValueComputed()(v) : null,\n disposeWhenNodeIsRemoved: node\n })\n }\n}\n","\nimport {\n Provider\n} from '@tko/provider'\n\n/**\n * Convert attributes with ko-* to bindings.\n *\n * e.g.\n * <div ko-visible='value'></div>\n */\nexport default class AttrProvider extends Provider {\n get FOR_NODE_TYPES () { return [ 1 ] } // document.ELEMENT_NODE\n\n get PREFIX () { return 'ko-' }\n\n getBindingAttributesList (node) {\n if (!node.hasAttributes()) { return [] }\n return Array.from(node.attributes)\n .filter(attr => attr.name.startsWith(this.PREFIX))\n }\n\n nodeHasBindings (node) {\n return this.getBindingAttributesList(node).length > 0\n }\n\n getBindingAccessors (node, context) {\n return Object.assign({}, ...this.handlersFromAttributes(node, context))\n }\n\n * handlersFromAttributes (node, context) {\n for (const attr of this.getBindingAttributesList(node)) {\n const name = attr.name.substr(this.PREFIX.length)\n yield {[name]: () => this.getValue(attr.value, context, node)}\n }\n }\n\n getValue (token, $context, node) {\n /* FIXME: This duplicates Identifier.prototype.lookup_value; it should\n be refactored into e.g. a BindingContext method */\n if (!token) { return }\n const $data = $context.$data\n\n switch (token) {\n case '$element': return node\n case '$context': return $context\n case 'this': case '$data': return $context.$data\n }\n\n if ($data instanceof Object && token in $data) { return $data[token] }\n if (token in $context) { return $context[token] }\n if (token in this.globals) { return this.globals[token] }\n\n throw new Error(`The variable '${token} not found.`)\n }\n}\n","\nimport {\n Provider\n} from '@tko/provider'\n\nexport default class MultiProvider extends Provider {\n get FOR_NODE_TYPES () { return this.nodeTypes }\n\n constructor (params = {}) {\n super(params)\n const providers = params.providers || []\n this.nodeTypeMap = {}\n this.nodeTypes = []\n this.providers = []\n providers.forEach(p => this.addProvider(p))\n }\n\n setGlobals (globals) {\n [this, ...this.providers].forEach(p => (p.globals = globals))\n }\n\n addProvider (provider) {\n this.providers.push(provider)\n provider.bindingHandlers = this.bindingHandlers\n provider.globals = this.globals\n const nodeTypeMap = this.nodeTypeMap\n for (const nodeType of provider.FOR_NODE_TYPES) {\n if (!nodeTypeMap[nodeType]) { nodeTypeMap[nodeType] = [] }\n nodeTypeMap[nodeType].push(provider)\n }\n this.nodeTypes = Object.keys(this.nodeTypeMap).map(k => parseInt(k, 10))\n }\n\n providersFor (node) {\n return this.nodeTypeMap[node.nodeType] || []\n }\n\n nodeHasBindings (node) {\n return this.providersFor(node).some(p => p.nodeHasBindings(node))\n }\n\n preprocessNode (node) {\n for (const provider of this.providersFor(node)) {\n const newNodes = provider.preprocessNode(node)\n if (newNodes) { return newNodes }\n }\n }\n\n * enumerateProviderBindings (node, ctx) {\n for (const provider of this.providersFor(node)) {\n const bindings = provider.getBindingAccessors(node, ctx)\n if (!bindings) { continue }\n yield * Object.entries(bindings || {})\n if (provider.preemptive) { return }\n }\n }\n\n getBindingAccessors (node, ctx) {\n const bindings = {}\n for (const [key, accessor] of this.enumerateProviderBindings(node, ctx)) {\n if (key in bindings) {\n throw new Error(`The binding \"${key}\" is duplicated by multiple providers`)\n }\n bindings[key] = accessor\n }\n return bindings\n }\n}\n","\nimport {\n unwrap\n} from '@tko/observable'\n\nimport {\n Provider\n} from '@tko/provider'\n\nimport {\n parseInterpolation\n} from './mustacheParser'\n\n/**\n * These are bindings that are mapped specific attributes, such as\n * two-way communication (value/checked) or which have anti-collision\n * properties (css).\n */\nconst DEFAULT_ATTRIBUTE_BINDING_MAP = {\n value: 'value',\n checked: 'checked',\n class: 'css'\n}\n\n/**\n * Interpret {{ }} inside DOM attributes e.g. <div class='{{ classes }}'>\n */\nexport default class AttributeMustacheProvider extends Provider {\n get FOR_NODE_TYPES () { return [ 1 ] } // document.ELEMENT_NODE\n\n constructor (params = {}) {\n super(params)\n this.ATTRIBUTES_TO_SKIP = new Set(params.attributesToSkip || ['data-bind'])\n this.ATTRIBUTES_BINDING_MAP = params.attributesBindingMap || DEFAULT_ATTRIBUTE_BINDING_MAP\n }\n\n * attributesToInterpolate (attributes) {\n for (const attr of Array.from(attributes)) {\n if (this.ATTRIBUTES_TO_SKIP.has(attr.name)) { continue }\n if (attr.specified && attr.value.includes('{{')) { yield attr }\n }\n }\n\n nodeHasBindings (node) {\n return !this.attributesToInterpolate(node.attributes).next().done\n }\n\n partsTogether (parts, context, node, ...valueToWrite) {\n if (parts.length > 1) {\n return parts\n .map(p => unwrap(p.asAttr(context, this.globals, node))).join('')\n }\n // It may be a writeable observable e.g. value=\"{{ value }}\".\n const part = parts[0].asAttr(context, this.globals)\n if (valueToWrite.length) { part(valueToWrite[0]) }\n return part\n }\n\n attributeBinding (name, parts) {\n return [name, parts]\n }\n\n * bindingParts (node, context) {\n for (const attr of this.attributesToInterpolate(node.attributes)) {\n const parts = Array.from(parseInterpolation(attr.value))\n if (parts.length) { yield this.attributeBinding(attr.name, parts) }\n }\n }\n\n getPossibleDirectBinding (attrName) {\n const bindingName = this.ATTRIBUTES_BINDING_MAP[attrName]\n return bindingName && this.bindingHandlers.get(attrName)\n }\n\n * bindingObjects (node, context) {\n for (const [attrName, parts] of this.bindingParts(node, context)) {\n const bindingForAttribute = this.getPossibleDirectBinding(attrName)\n const handler = bindingForAttribute ? attrName : `attr.${attrName}`\n const accessorFn = bindingForAttribute\n ? (...v) => this.partsTogether(parts, context, node, ...v)\n : (...v) => ({[attrName]: this.partsTogether(parts, context, node, ...v)})\n node.removeAttribute(attrName)\n yield { [handler]: accessorFn }\n }\n }\n\n getBindingAccessors (node, context) {\n return Object.assign({}, ...this.bindingObjects(node, context))\n }\n}\n","import {\n Provider\n} from '@tko/provider'\n\nimport {\n parseInterpolation\n} from './mustacheParser'\n\n/**\n * Interpret {{ }}, {{{ }}}, {{# /}}, and {{# }} ... {{/ }} inside text nodes.\n *\n * This binding must come before the VirtualProvider.\n */\nexport default class TextMustacheProvider extends Provider {\n get FOR_NODE_TYPES () { return [ 3 ] } // document.TEXT_NODE\n\n * textToNodes (textNode) {\n const parent = textNode.parentNode\n const isTextarea = parent && parent.nodeName === 'TEXTAREA'\n const hasStash = textNode.nodeValue && textNode.nodeValue.includes('{{')\n\n if (!hasStash || isTextarea) { return }\n\n for (const part of parseInterpolation(textNode.nodeValue)) {\n yield * part.textNodeReplacement(textNode)\n }\n }\n\n textInterpolation (textNode) {\n const newNodes = Array.from(this.textToNodes(textNode))\n\n if (newNodes.length === 0) { return }\n\n if (textNode.parentNode) {\n const parent = textNode.parentNode\n const n = newNodes.length\n for (let i = 0; i < n; ++i) {\n parent.insertBefore(newNodes[i], textNode)\n }\n parent.removeChild(textNode)\n }\n\n return newNodes\n }\n\n /**\n * We convert as follows:\n *\n * {{# ... }} into <!-- ko ... -->\n * {{/ ... }} into <!-- /ko -->\n * {{# ... /}} into <!-- ko ... --><!-- /ko -->\n * {{ ... }} into <!-- ko text: ... --><!-- /ko -->\n * {{{ ... }}} into <!-- ko html: ... --><!-- /ko -->\n *\n * VirtualProvider can then pick up and do the actual binding.\n */\n preprocessNode (node) {\n return this.textInterpolation(node)\n }\n}\n","\nimport {\n isObservable\n} from '@tko/observable'\n\nimport {\n Provider\n} from '@tko/provider'\n\nexport const NATIVE_BINDINGS = Symbol('Knockout native bindings')\n\n/**\n * Retrieve the binding accessors that are already attached to\n * a node under the `NATIVE_BINDINGS` symbol.\n *\n * Used by the jsxToNode function.\n */\nexport default class NativeProvider extends Provider {\n get FOR_NODE_TYPES () { return [ 1, 3 ] }\n get preemptive () { return true }\n\n nodeHasBindings (node) {\n if (!node[NATIVE_BINDINGS]) { return false }\n return Object.keys(node[NATIVE_BINDINGS] || {})\n .some(key => key.startsWith('ko-'))\n }\n\n /**\n * There can be only one preprocessor; when there are native bindings,\n * prevent re-entrance (and likely XSS) from the `{{ }}` provider.\n */\n preprocessNode (node) {\n return node[NATIVE_BINDINGS] ? node : null\n }\n\n onlyBindings ([name]) {\n return name.startsWith('ko-')\n }\n\n valueAsAccessor ([name, value]) {\n const bindingName = name.replace(/^ko-/, '')\n const valueFn = isObservable(value) ? value : () => value\n return {[bindingName]: valueFn}\n }\n\n /**\n * Return as valueAccessor function all the entries matching `ko-*`\n * @param {HTMLElement} node\n */\n getBindingAccessors (node) {\n return Object.assign({},\n ...Object.entries(node[NATIVE_BINDINGS] || {})\n .filter(this.onlyBindings)\n .map(this.valueAsAccessor)\n )\n }\n\n /**\n * Add a named-value to the given node.\n * @param {HTMLElement} node\n * @param {string} name\n * @param {any} value\n */\n static addValueToNode (node, name, value) {\n const obj = node[NATIVE_BINDINGS] || (node[NATIVE_BINDINGS] = {})\n obj[name] = value\n }\n\n /**\n *\n * @param {HTMLElement} node\n * @return {object} the stored values\n */\n static getNodeValues (node) {\n return node[NATIVE_BINDINGS]\n }\n}\n","\nimport {\n makeEventHandlerShortcut\n} from './event.js'\n\n// 'click' is just a shorthand for the usual full-length event:{click:handler}\nexport var click = makeEventHandlerShortcut('click')\n","\nimport {\n createSymbolOrString, toggleDomNodeCssClass, objectForEach, stringTrim\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nexport var css = {\n aliases: ['class'],\n update: function (element, valueAccessor) {\n var value = unwrap(valueAccessor())\n if (value !== null && typeof value === 'object') {\n objectForEach(value, function (className, shouldHaveClass) {\n shouldHaveClass = unwrap(shouldHaveClass)\n toggleDomNodeCssClass(element, className, shouldHaveClass)\n })\n } else {\n value = stringTrim(String(value || '')) // Make sure we don't try to store or set a non-string value\n toggleDomNodeCssClass(element, element[css.classesWrittenByBindingKey], false)\n element[css.classesWrittenByBindingKey] = value\n toggleDomNodeCssClass(element, value, true)\n }\n },\n classesWrittenByBindingKey: createSymbolOrString('__ko__cssValue')\n}\n","/**\n * A simple callback binding.\n */\nimport {\n BindingHandler\n} from '@tko/bind'\n\nexport default class DescendantsCompleteHandler extends BindingHandler {\n onDescendantsComplete () {\n if (typeof this.value === 'function') {\n this.value(this.$element)\n }\n }\n\n static get allowVirtualElements () { return true }\n}\n","\nimport {\n unwrap\n} from '@tko/observable'\n\nexport var enable = {\n update: function (element, valueAccessor) {\n var value = unwrap(valueAccessor())\n if (value && element.disabled) {\n element.removeAttribute('disabled')\n } else if ((!value) && (!element.disabled)) {\n element.disabled = true\n }\n }\n}\n\nexport var disable = {\n update: function (element, valueAccessor) {\n enable.update(element, function () { return !unwrap(valueAccessor()) })\n }\n}\n","\nimport {\n createSymbolOrString, triggerEvent, registerEventHandler\n} from '@tko/utils'\n\nimport {\n unwrap, dependencyDetection\n} from '@tko/observable'\n\nvar hasfocusUpdatingProperty = createSymbolOrString('__ko_hasfocusUpdating')\nvar hasfocusLastValue = createSymbolOrString('__ko_hasfocusLastValue')\n\nexport var hasfocus = {\n init: function (element, valueAccessor /*, allBindings */) {\n var handleElementFocusChange = function (isFocused) {\n // Where possible, ignore which event was raised and determine focus state using activeElement,\n // as this avoids phantom focus/blur events raised when changing tabs in modern browsers.\n // However, not all KO-targeted browsers (Firefox 2) support activeElement. For those browsers,\n // prevent a loss of focus when changing tabs/windows by setting a flag that prevents hasfocus\n // from calling 'blur()' on the element when it loses focus.\n // Discussion at https://github.com/SteveSanderson/knockout/pull/352\n element[hasfocusUpdatingProperty] = true\n var ownerDoc = element.ownerDocument\n if ('activeElement' in ownerDoc) {\n var active\n try {\n active = ownerDoc.activeElement\n } catch (e) {\n // IE9 throws if you access activeElement during page load (see issue #703)\n active = ownerDoc.body\n }\n isFocused = (active === element)\n }\n // var modelValue = valueAccessor();\n valueAccessor(isFocused, {onlyIfChanged: true})\n\n // cache the latest value, so we can avoid unnecessarily calling focus/blur in the update function\n element[hasfocusLastValue] = isFocused\n element[hasfocusUpdatingProperty] = false\n }\n var handleElementFocusIn = handleElementFocusChange.bind(null, true)\n var handleElementFocusOut = handleElementFocusChange.bind(null, false)\n\n registerEventHandler(element, 'focus', handleElementFocusIn)\n registerEventHandler(element, 'focusin', handleElementFocusIn) // For IE\n registerEventHandler(element, 'blur', handleElementFocusOut)\n registerEventHandler(element, 'focusout', handleElementFocusOut) // For IE\n },\n update: function (element, valueAccessor) {\n var value = !!unwrap(valueAccessor())\n\n if (!element[hasfocusUpdatingProperty] && element[hasfocusLastValue] !== value) {\n value ? element.focus() : element.blur()\n\n // In IE, the blur method doesn't always cause the element to lose focus (for example, if the window is not in focus).\n // Setting focus to the body element does seem to be reliable in IE, but should only be used if we know that the current\n // element was focused already.\n if (!value && element[hasfocusLastValue]) {\n element.ownerDocument.body.focus()\n }\n\n // For IE, which doesn't reliably fire \"focus\" or \"blur\" events synchronously\n dependencyDetection.ignore(triggerEvent, null, [element, value ? 'focusin' : 'focusout'])\n }\n }\n}\n","\nimport {\n tagNameLower, arrayFilter, arrayMap, setTextContent, arrayIndexOf,\n setOptionNodeSelectionState, triggerEvent, domData,\n ensureSelectElementIsRenderedCorrectly, selectExtensions\n} from '@tko/utils'\n\nimport {\n unwrap, dependencyDetection\n} from '@tko/observable'\n\nimport {\n setDomNodeChildrenFromArrayMapping\n} from '@tko/bind'\n\nvar captionPlaceholder = {}\n\nexport var options = {\n init: function (element) {\n if (tagNameLower(element) !== 'select') { throw new Error('options binding applies only to SELECT elements') }\n\n // Remove all existing <option>s.\n while (element.length > 0) {\n element.remove(0)\n }\n\n // Ensures that the binding processor doesn't try to bind the options\n return { 'controlsDescendantBindings': true }\n },\n update: function (element, valueAccessor, allBindings) {\n function selectedOptions () {\n return arrayFilter(element.options, function (node) { return node.selected })\n }\n\n var selectWasPreviouslyEmpty = element.length == 0,\n multiple = element.multiple,\n previousScrollTop = (!selectWasPreviouslyEmpty && multiple) ? element.scrollTop : null,\n unwrappedArray = unwrap(valueAccessor()),\n valueAllowUnset = allBindings.get('valueAllowUnset') && allBindings['has']('value'),\n includeDestroyed = allBindings.get('optionsIncludeDestroyed'),\n arrayToDomNodeChildrenOptions = {},\n captionValue,\n filteredArray,\n previousSelectedValues = []\n\n if (!valueAllowUnset) {\n if (multiple) {\n previousSelectedValues = arrayMap(selectedOptions(), selectExtensions.readValue)\n } else if (element.selectedIndex >= 0) {\n previousSelectedValues.push(selectExtensions.readValue(element.options[element.selectedIndex]))\n }\n }\n\n if (unwrappedArray) {\n if (typeof unwrappedArray.length === 'undefined') // Coerce single value into array\n { unwrappedArray = [unwrappedArray] }\n\n // Filter out any entries marked as destroyed\n filteredArray = arrayFilter(unwrappedArray, function (item) {\n return includeDestroyed || item === undefined || item === null || !unwrap(item['_destroy'])\n })\n\n // If caption is included, add it to the array\n if (allBindings['has']('optionsCaption')) {\n captionValue = unwrap(allBindings.get('optionsCaption'))\n // If caption value is null or undefined, don't show a caption\n if (captionValue !== null && captionValue !== undefined) {\n filteredArray.unshift(captionPlaceholder)\n }\n }\n } else {\n // If a falsy value is provided (e.g. null), we'll simply empty the select element\n }\n\n function applyToObject (object, predicate, defaultValue) {\n var predicateType = typeof predicate\n if (predicateType == 'function') // Given a function; run it against the data value\n { return predicate(object) } else if (predicateType == 'string') // Given a string; treat it as a property name on the data value\n { return object[predicate] } else // Given no optionsText arg; use the data value itself\n { return defaultValue }\n }\n\n // The following functions can run at two different times:\n // The first is when the whole array is being updated directly from this binding handler.\n // The second is when an observable value for a specific array entry is updated.\n // oldOptions will be empty in the first case, but will be filled with the previously generated option in the second.\n var itemUpdate = false\n function optionForArrayItem (arrayEntry, index, oldOptions) {\n if (oldOptions.length) {\n previousSelectedValues = !valueAllowUnset && oldOptions[0].selected ? [ selectExtensions.readValue(oldOptions[0]) ] : []\n itemUpdate = true\n }\n var option = element.ownerDocument.createElement('option')\n if (arrayEntry === captionPlaceholder) {\n setTextContent(option, allBindings.get('optionsCaption'))\n selectExtensions.writeValue(option, undefined)\n } else {\n // Apply a value to the option element\n var optionValue = applyToObject(arrayEntry, allBindings.get('optionsValue'), arrayEntry)\n selectExtensions.writeValue(option, unwrap(optionValue))\n\n // Apply some text to the option element\n var optionText = applyToObject(arrayEntry, allBindings.get('optionsText'), optionValue)\n setTextContent(option, optionText)\n }\n return [option]\n }\n\n // By using a beforeRemove callback, we delay the removal until after new items are added. This fixes a selection\n // problem in IE<=8 and Firefox. See https://github.com/knockout/knockout/issues/1208\n arrayToDomNodeChildrenOptions['beforeRemove'] =\n function (option) {\n element.removeChild(option)\n }\n\n function setSelectionCallback (arrayEntry, newOptions) {\n if (itemUpdate && valueAllowUnset) {\n // The model value is authoritative, so make sure its value is the one selected\n // There is no need to use dependencyDetection.ignore since setDomNodeChildrenFromArrayMapping does so already.\n selectExtensions.writeValue(element, unwrap(allBindings.get('value')), true /* allowUnset */)\n } else if (previousSelectedValues.length) {\n // IE6 doesn't like us to assign selection to OPTION nodes before they're added to the document.\n // That's why we first added them without selection. Now it's time to set the selection.\n var isSelected = arrayIndexOf(previousSelectedValues, selectExtensions.readValue(newOptions[0])) >= 0\n setOptionNodeSelectionState(newOptions[0], isSelected)\n\n // If this option was changed from being selected during a single-item update, notify the change\n if (itemUpdate && !isSelected) {\n dependencyDetection.ignore(triggerEvent, null, [element, 'change'])\n }\n }\n }\n\n var callback = setSelectionCallback\n if (allBindings['has']('optionsAfterRender') && typeof allBindings.get('optionsAfterRender') === 'function') {\n callback = function (arrayEntry, newOptions) {\n setSelectionCallback(arrayEntry, newOptions)\n dependencyDetection.ignore(allBindings.get('optionsAfterRender'), null, [newOptions[0], arrayEntry !== captionPlaceholder ? arrayEntry : undefined])\n }\n }\n\n setDomNodeChildrenFromArrayMapping(element, filteredArray, optionForArrayItem, arrayToDomNodeChildrenOptions, callback)\n\n dependencyDetection.ignore(function () {\n if (valueAllowUnset) {\n // The model value is authoritative, so make sure its value is the one selected\n selectExtensions.writeValue(element, unwrap(allBindings.get('value')), true /* allowUnset */)\n } else {\n // Determine if the selection has changed as a result of updating the options list\n var selectionChanged\n if (multiple) {\n // For a multiple-select box, compare the new selection count to the previous one\n // But if nothing was selected before, the selection can't have changed\n selectionChanged = previousSelectedValues.length && selectedOptions().length < previousSelectedValues.length\n } else {\n // For a single-select box, compare the current value to the previous value\n // But if nothing was selected before or nothing is selected now, just look for a change in selection\n selectionChanged = (previousSelectedValues.length && element.selectedIndex >= 0)\n ? (selectExtensions.readValue(element.options[element.selectedIndex]) !== previousSelectedValues[0])\n : (previousSelectedValues.length || element.selectedIndex >= 0)\n }\n\n // Ensure consistency between model value and selected option.\n // If the dropdown was changed so that selection is no longer the same,\n // notify the value or selectedOptions binding.\n if (selectionChanged) {\n triggerEvent(element, 'change')\n }\n }\n })\n\n // Workaround for IE bug\n ensureSelectElementIsRenderedCorrectly(element)\n\n if (previousScrollTop && Math.abs(previousScrollTop - element.scrollTop) > 20) { element.scrollTop = previousScrollTop }\n }\n}\n","\nimport {\n objectForEach, options\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nconst {jQueryInstance} = options\n\nexport var style = {\n update: function (element, valueAccessor) {\n var value = unwrap(valueAccessor() || {})\n objectForEach(value, function (styleName, styleValue) {\n styleValue = unwrap(styleValue)\n\n if (styleValue === null || styleValue === undefined || styleValue === false) {\n // Empty string removes the value, whereas null/undefined have no effect\n styleValue = ''\n }\n\n if (jQueryInstance) {\n jQueryInstance(element).css(styleName, styleValue)\n } else {\n styleName = styleName.replace(/-(\\w)/g, (all, letter) => letter.toUpperCase())\n const previousStyle = element.style[styleName]\n element.style[styleName] = styleValue\n if (styleValue !== previousStyle && element.style[styleName] === previousStyle && !isNaN(styleValue)) {\n element.style[styleName] = styleValue + 'px'\n }\n }\n })\n }\n}\n","\nimport {\n domData, registerEventHandler, ieVersion, safeSetTimeout, options,\n arrayForEach, tagNameLower\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nimport {\n computed\n} from '@tko/computed'\n\nimport {\n BindingHandler\n} from '@tko/bind'\n\nvar parseVersion, operaVersion, safariVersion, firefoxVersion\n\n\n/**\n * TextInput binding handler for modern browsers (legacy below).\n * @extends BindingHandler\n */\nclass TextInput extends BindingHandler {\n get aliases () { return 'textinput' }\n\n constructor (...args) {\n super(...args)\n this.previousElementValue = this.$element.value\n\n if (options.debug && this.constructor._forceUpdateOn) {\n // Provide a way for tests to specify exactly which events are bound\n arrayForEach(this.constructor._forceUpdateOn, (eventName) => {\n if (eventName.slice(0, 5) === 'after') {\n this.addEventListener(eventName.slice(5), 'deferUpdateModel')\n } else {\n this.addEventListener(eventName, 'updateModel')\n }\n })\n }\n\n for (const eventName of this.eventsIndicatingSyncValueChange()) {\n this.addEventListener(eventName, 'updateModel')\n }\n for (const eventName of this.eventsIndicatingDeferValueChange()) {\n this.addEventListener(eventName, 'deferUpdateModel')\n }\n this.computed('updateView')\n }\n\n eventsIndicatingSyncValueChange () {\n // input: Default, modern handler\n // change: Catch programmatic updates of the value that fire this event.\n // blur: To deal with browsers that don't notify any kind of event for some changes (IE, Safari, etc.)\n return ['input', 'change', 'blur']\n }\n\n eventsIndicatingDeferValueChange () {\n return []\n }\n\n updateModel (event) {\n const element = this.$element\n clearTimeout(this.timeoutHandle)\n this.elementValueBeforeEvent = this.timeoutHandle = undefined\n const elementValue = element.value\n if (this.previousElementValue !== elementValue) {\n // Provide a way for tests to know exactly which event was processed\n if (options.debug && event) {\n element._ko_textInputProcessedEvent = event.type\n }\n this.previousElementValue = elementValue\n this.value = elementValue\n }\n }\n\n deferUpdateModel (event) {\n const element = this.$element\n if (!this.timeoutHandle) {\n // The elementValueBeforeEvent variable is set *only* during the brief gap between an\n // event firing and the updateModel function running. This allows us to ignore model\n // updates that are from the previous state of the element, usually due to techniques\n // such as rateLimit. Such updates, if not ignored, can cause keystrokes to be lost.\n this.elementValueBeforeEvent = element.value\n const handler = options.debug ? this.updateModel.bind(this, { type: event.type }) : this.updateModel\n this.timeoutHandle = safeSetTimeout(handler, 4)\n }\n }\n\n updateView () {\n let modelValue = unwrap(this.value)\n if (modelValue === null || modelValue === undefined) {\n modelValue = ''\n }\n if (this.elementValueBeforeEvent !== undefined\n && modelValue === this.elementValueBeforeEvent) {\n setTimeout(this.updateView.bind(this), 4)\n } else if (this.$element.value !== modelValue) {\n // Update the element only if the element and model are different. On some browsers, updating the value\n // will move the cursor to the end of the input, which would be bad while the user is typing.\n this.previousElementValue = modelValue // Make sure we ignore events (propertychange) that result from updating the value\n this.$element.value = modelValue\n this.previousElementValue = this.$element.value // In case the browser changes the value (see #2281)\n }\n }\n}\n\n/**\n * Legacy Input Classes, below\n */\nclass TextInputIE extends TextInput {\n constructor (...args) {\n super(...args)\n\n if (ieVersion < 11) {\n // Internet Explorer <= 8 doesn't support the 'input' event, but does include 'propertychange' that fires whenever\n // any property of an element changes. Unlike 'input', it also fires if a property is changed from JavaScript code,\n // but that's an acceptable compromise for this binding. IE 9 and 10 support 'input', but since they don't always\n // fire it when using autocomplete, we'll use 'propertychange' for them also.\n this.addEventListener('propertychange', event =>\n event.propertyName === 'value' && this.updateModel(event)\n )\n }\n\n if (ieVersion >= 8 && ieVersion < 10) {\n this.watchForSelectionChangeEvent()\n this.addEventListener('dragend', 'deferUpdateModel')\n }\n }\n\n eventsIndicatingSyncValueChange () {\n // keypress: All versions (including 11) of Internet Explorer have a bug that they don't generate an input or propertychange event when ESC is pressed\n return [...super.eventsIndicatingValueChange(), 'keypress']\n }\n\n // IE 8 and 9 have bugs that prevent the normal events from firing when the value changes.\n // But it does fire the 'selectionchange' event on many of those, presumably because the\n // cursor is moving and that counts as the selection changing. The 'selectionchange' event is\n // fired at the document level only and doesn't directly indicate which element changed. We\n // set up just one event handler for the document and use 'activeElement' to determine which\n // element was changed.\n selectionChangeHandler (event) {\n const target = this.activeElement\n const handler = target && domData.get(target, selectionChangeHandlerName)\n if (handler) { handler(event) }\n }\n\n watchForSelectionChangeEvent (element, ieUpdateModel) {\n const ownerDoc = element.ownerDocument;\n if (!domData.get(ownerDoc, selectionChangeRegisteredName)) {\n domData.set(ownerDoc, selectionChangeRegisteredName, true)\n registerEventHandler(ownerDoc, 'selectionchange', this.selectionChangeHandler.bind(ownerDoc))\n }\n domData.set(element, selectionChangeHandlerName, handler)\n }\n}\n\n\n// IE 8 and 9 have bugs that prevent the normal events from firing when the value changes.\n// But it does fire the 'selectionchange' event on many of those, presumably because the\n// cursor is moving and that counts as the selection changing. The 'selectionchange' event is\n// fired at the document level only and doesn't directly indicate which element changed. We\n// set up just one event handler for the document and use 'activeElement' to determine which\n// element was changed.\nclass TextInputIE9 extends TextInputIE {\n updateModel (...args) {\n // IE9 will mess up the DOM if you handle events synchronously which results in DOM changes (such as other bindings);\n // so we'll make sure all updates are asynchronous\n this.deferUpdateModel(...args)\n }\n}\n\n\nclass TextInputIE8 extends TextInputIE {\n eventsIndicatingValueChange () {\n // IE 8 has a bug where it fails to fire 'propertychange' on the first update following a value change from\n // JavaScript code. It also doesn't fire if you clear the entire value. To fix this, we bind to the following\n // events too.\n // keypress: All versions (including 11) of Internet Explorer have a bug that they don't generate an input or propertychange event when ESC is pressed\n // keyup: A single keystoke\n // keydown: First character when a key is held down\n return [...super.eventsIndicatingValueChange(), 'keyup', 'keydown']\n }\n}\n\n\n// Safari <5 doesn't fire the 'input' event for <textarea> elements (it does fire 'textInput'\n// but only when typing). So we'll just catch as much as we can with keydown, cut, and paste.\nclass TextInputLegacySafari extends TextInput {\n eventsIndicatingDeferValueChange () {\n return ['keydown', 'paste', 'cut']\n }\n}\n\n\nclass TextInputLegacyOpera extends TextInput {\n eventsIndicatingDeferValueChange () {\n // Opera 10 doesn't always fire the 'input' event for cut, paste, undo & drop operations.\n // We can try to catch some of those using 'keydown'.\n return ['keydown']\n }\n}\n\n\nclass TextInputLegacyFirefox extends TextInput {\n eventsIndicatingValueChange () {\n return [\n ...super.eventsIndicatingSyncValueChange(),\n // Firefox <= 3.6 doesn't fire the 'input' event when text is filled in through autocomplete\n 'DOMAutoComplete',\n // Firefox <=3.5 doesn't fire the 'input' event when text is dropped into the input.\n 'dragdrop', // < 3.5\n 'drop' // 3.5\n ]\n }\n}\n\n\nconst w = options.global // window / global\nif (w.navigator) {\n const parseVersion = (matches) => matches && parseFloat(matches[1])\n const userAgent = w.navigator.userAgent\n const isChrome = userAgent.match(/Chrome\\/([^ ]+)/)\n // Detect various browser versions because some old versions don't fully support the 'input' event\n operaVersion = w.opera && w.opera.version && parseInt(w.opera.version())\n safariVersion = parseVersion(userAgent.match(/Version\\/([^ ]+) Safari/))\n firefoxVersion = parseVersion(userAgent.match(/Firefox\\/([^ ]*)/))\n}\n\n\nexport const textInput =\n ieVersion === 8 ? TextInputIE8\n : ieVersion === 9 ? TextInputIE9\n : ieVersion ? TextInputIE\n : safariVersion && safariVersion < 5 ? TextInputLegacySafari\n : operaVersion < 11 ? TextInputLegacyOpera\n : firefoxVersion && firefoxVersion < 4 ? TextInputLegacyFirefox\n : TextInput\n","\nimport {\n setElementName\n} from '@tko/utils'\n\nexport var uniqueName = {\n init: function (element, valueAccessor) {\n if (valueAccessor()) {\n var name = 'ko_unique_' + (++uniqueName.currentIndex)\n setElementName(element, name)\n }\n },\n currentIndex: 0\n}\n","\nimport {\n ieVersion, stringStartsWith, safeSetTimeout, tagNameLower, arrayForEach,\n selectExtensions\n} from '@tko/utils'\n\nimport {\n unwrap, dependencyDetection\n} from '@tko/observable'\n\nimport {\n applyBindingAccessorsToNode, BindingHandler\n} from '@tko/bind'\n\nexport class value extends BindingHandler {\n static get after () { return ['options', 'foreach', 'template'] }\n\n constructor (...args) {\n super(...args)\n\n // If the value binding is placed on a radio/checkbox, then just pass through to checkedValue and quit\n if (this.isCheckboxOrRadio) {\n applyBindingAccessorsToNode(this.$element,\n { checkedValue: this.valueAccessor })\n return\n }\n\n this.propertyChangedFired = false\n this.elementValueBeforeEvent = null\n\n if (this.ieAutoCompleteHackNeeded) {\n this.addEventListener('propertyChange', () => this.propertyChangedFired = true)\n this.addEventListener('focus', () => this.propertyChangedFired = false)\n this.addEventListener('blur', () => this.propertyChangeFired &&\n this.valueUpdateHandler())\n }\n\n arrayForEach(this.eventsToCatch, eventName => this.registerEvent(eventName))\n\n if (this.isInput && this.$element.type === 'file') {\n this.updateFromModel = this.updateFromModelForFile\n } else {\n this.updateFromModel = this.updateFromModelForValue\n }\n\n this.computed('updateFromModel')\n }\n\n get eventsToCatch () {\n const requestedEventsToCatch = this.allBindings.get('valueUpdate')\n const requestedEventsArray = typeof requestedEventsToCatch === 'string' ?\n [requestedEventsToCatch] : requestedEventsToCatch || []\n return [...new Set(['change', ...requestedEventsArray])]\n }\n\n get isInput () {\n return tagNameLower(this.$element) === 'input'\n }\n\n get isCheckboxOrRadio () {\n const e = this.$element\n return this.isInput && (e.type == 'checkbox' || e.type == 'radio')\n }\n\n // Workaround for https://github.com/SteveSanderson/knockout/issues/122\n // IE doesn't fire \"change\" events on textboxes if the user selects a value from its autocomplete list\n get ieAutoCompleteHackNeeded () {\n return ieVersion && isInputElement &&\n this.$element.type == 'text' && this.$element.autocomplete != 'off' &&\n (!this.$element.form || this.$element.form.autocomplete != 'off')\n }\n\n valueUpdateHandler () {\n this.elementValueBeforeEvent = null\n this.propertyChangedFired = false\n this.value = selectExtensions.readValue(this.$element)\n }\n\n registerEvent (eventName) {\n // The syntax \"after<eventname>\" means \"run the handler asynchronously after the event\"\n // This is useful, for example, to catch \"keydown\" events after the browser has updated the control\n // (otherwise, selectExtensions.readValue(this) will receive the control's value *before* the key event)\n var handler = this.valueUpdateHandler.bind(this)\n if (stringStartsWith(eventName, 'after')) {\n handler = () => {\n // The elementValueBeforeEvent variable is non-null *only* during the brief gap between\n // a keyX event firing and the valueUpdateHandler running, which is scheduled to happen\n // at the earliest asynchronous opportunity. We store this temporary information so that\n // if, between keyX and valueUpdateHandler, the underlying model value changes separately,\n // we can overwrite that model value change with the value the user just typed. Otherwise,\n // techniques like rateLimit can trigger model changes at critical moments that will\n // override the user's inputs, causing keystrokes to be lost.\n this.elementValueBeforeEvent = selectExtensions.readValue(this.$element)\n safeSetTimeout(this.valueUpdateHandler.bind(this), 0)\n }\n eventName = eventName.substring(5 /* 'after'.length */)\n }\n this.addEventListener(eventName, handler)\n }\n\n updateFromModelForFile () {\n // For file input elements, can only write the empty string\n var newValue = unwrap(this.value)\n if (newValue === null || newValue === undefined || newValue === '') {\n this.$element.value = ''\n } else {\n dependencyDetection.ignore(this.valueUpdateHandler, this) // reset the model to match the element\n }\n }\n\n updateFromModelForValue () {\n const element = this.$element\n var newValue = unwrap(this.value)\n var elementValue = selectExtensions.readValue(element)\n\n if (this.elementValueBeforeEvent !== null && newValue === this.elementValueBeforeEvent) {\n safeSetTimeout(this.updateFromModel.bind(this), 0)\n return\n }\n\n if (newValue === elementValue && elementValue !== undefined) { return }\n\n if (tagNameLower(element) === 'select') {\n const allowUnset = this.allBindings.get('valueAllowUnset')\n selectExtensions.writeValue(element, newValue, allowUnset)\n\n if (!allowUnset && newValue !== selectExtensions.readValue(element)) {\n // If you try to set a model value that can't be represented in an already-populated dropdown, reject that change,\n // because you're not allowed to have a model value that disagrees with a visible UI selection.\n dependencyDetection.ignore(this.valueUpdateHandler, this)\n }\n } else {\n selectExtensions.writeValue(element, newValue)\n }\n }\n}\n","import {\n unwrap\n} from '@tko/observable'\n\nexport var visible = {\n update: function (element, valueAccessor) {\n var value = unwrap(valueAccessor())\n var isCurrentlyVisible = !(element.style.display === 'none')\n if (value && !isCurrentlyVisible) {\n element.style.display = ''\n } else if (!value && isCurrentlyVisible) {\n element.style.display = 'none'\n }\n }\n}\n\nexport var hidden = {\n update: function (element, valueAccessor) {\n visible.update.call(this, element, () => !unwrap(valueAccessor()))\n }\n}\n","import {\n cloneNodes, virtualElements, cleanNode, domData\n} from '@tko/utils'\n\nimport {\n dependencyDetection, observable\n} from '@tko/observable'\n\nimport {\n applyBindingsToDescendants, AsyncBindingHandler\n} from '@tko/bind'\n\n/**\n * Create a DOMbinding that controls DOM nodes presence\n *\n * Covers e.g.\n *\n * 1. DOM Nodes contents\n *\n * <div data-bind='if: x'>\n * <!-- else --> ... an optional 'if'\n * </div>\n *\n * 2. Virtual elements\n *\n * <!-- ko if: x -->\n * <!-- else -->\n * <!-- /ko -->\n *\n * 3. Else binding\n * <div data-bind='if: x'></div>\n * <div data-bind='else'></div>\n *\n * Requires `renderStatus` and `get bindingContext` to be overloaded,\n * and this.computed('render') must be called in the child constructor.\n */\nexport default class ConditionalBindingHandler extends AsyncBindingHandler {\n constructor (params) {\n super(params)\n this.hasElse = this.detectElse(this.$element)\n const elseChainSatisfied = this.completesElseChain = observable()\n domData.set(this.$element, 'conditional', { elseChainSatisfied })\n }\n\n getIfElseNodes () {\n if (this.ifElseNodes) { return this.ifElseNodes }\n if (dependencyDetection.getDependenciesCount() || this.hasElse) {\n return this.cloneIfElseNodes(this.$element, this.hasElse)\n }\n }\n\n render () {\n const isFirstRender = !this.ifElseNodes\n const {shouldDisplay} = this.renderStatus()\n\n // Save the nodes before we possibly remove them from the DOM.\n this.ifElseNodes = this.getIfElseNodes() || {}\n\n if (shouldDisplay) {\n const useOriginalNodes = isFirstRender && !this.hasElse\n this.renderAndApplyBindings(this.ifElseNodes.ifNodes, useOriginalNodes)\n } else if (this.hasElse) {\n this.renderAndApplyBindings(this.ifElseNodes.elseNodes)\n } else {\n virtualElements.emptyNode(this.$element)\n }\n }\n\n async renderAndApplyBindings (nodes, useOriginalNodes) {\n if (!useOriginalNodes) {\n virtualElements.setDomNodeChildren(this.$element, cloneNodes(nodes))\n }\n const bound = await applyBindingsToDescendants(this.bindingContext, this.$element)\n this.completeBinding(bound)\n }\n\n /**\n * This may be truthy for the `else` binding.\n */\n get elseChainIsAlreadySatisfied () { return false }\n\n /**\n * Test a node for whether it represents an 'else' condition.\n * @param {HTMLElement} node to be tested\n * @return {Boolean} true when\n *\n * Matches <!-- else -->\n */\n isElseNode (node) {\n return node.nodeType === 8 &&\n node.nodeValue.trim().toLowerCase() === 'else'\n }\n\n detectElse (element) {\n var children = virtualElements.childNodes(element)\n for (var i = 0, j = children.length; i < j; ++i) {\n if (this.isElseNode(children[i])) { return true }\n }\n return false\n }\n\n /**\n * Clone the nodes, returning `ifNodes`, `elseNodes`\n * @param {HTMLElement} element The nodes to be cloned\n * @param {boolean} hasElse short-circuit to speed up the inner-loop.\n * @return {object} Containing the cloned nodes.\n */\n cloneIfElseNodes (element, hasElse) {\n const children = virtualElements.childNodes(element)\n const ifNodes = []\n const elseNodes = []\n let target = ifNodes\n\n for (var i = 0, j = children.length; i < j; ++i) {\n if (hasElse && this.isElseNode(children[i])) {\n target = elseNodes\n hasElse = false\n } else {\n target.push(cleanNode(children[i].cloneNode(true)))\n }\n }\n\n return { ifNodes, elseNodes }\n }\n\n get controlsDescendants () { return true }\n static get allowVirtualElements () { return true }\n}\n","\nimport {\n unwrap\n} from '@tko/observable'\n\nimport ConditionalBindingHandler from './ConditionalBindingHandler'\n\n/**\n * For the `if:` binding.\n */\nexport class IfBindingHandler extends ConditionalBindingHandler {\n constructor (...args) {\n super(...args)\n this.ifCondition = this.computed(() => !!unwrap(this.value))\n this.computed('render')\n }\n\n shouldDisplayIf () {\n return this.ifCondition()\n }\n\n get bindingContext () {\n return this.ifCondition.isActive()\n ? this.$context.extend(() => {\n // Ensure that this context is dependant upon the conditional, so the\n // order of binding application is: conditional before its children.\n // See https://github.com/knockout/kn\n // ockout/pull/2226\n this.ifCondition()\n return null\n })\n : this.$context\n }\n\n renderStatus () {\n let shouldDisplay = this.shouldDisplayIf()\n\n if (this.elseChainIsAlreadySatisfied) {\n shouldDisplay = false\n // needsRefresh = isFirstRender || this.didDisplayOnLastUpdate FIXME\n this.completesElseChain(true)\n } else {\n this.completesElseChain(shouldDisplay)\n }\n return {shouldDisplay}\n }\n}\n\nexport class UnlessBindingHandler extends IfBindingHandler {\n shouldDisplayIf () { return !super.shouldDisplayIf() }\n}\n","\nimport {\n options\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nimport ConditionalBindingHandler from './ConditionalBindingHandler'\n\n/**\n * The following fails somewhere in the `limit` functions of Observables i.e.\n * it's an issue related to async/deferUpdates.\n */\nexport class WithBindingHandler extends ConditionalBindingHandler {\n constructor (...args) {\n super(...args)\n this.asOption = this.allBindings.get('as')\n\n // If given `as`, reduce the condition to a boolean, so it does not\n // change & refresh when the value is updated.\n const conditionalFn = this.asOption && !options.createChildContextWithAs\n ? () => Boolean(unwrap(this.value)) : () => unwrap(this.value)\n this.conditional = this.computed(conditionalFn)\n\n this.computed('render')\n }\n\n get bindingContext () {\n if (!this.asOption) {\n return this.$context.createChildContext(this.valueAccessor)\n }\n return options.createChildContextWithAs\n ? this.$context.createChildContext(this.value, this.asOption)\n : this.$context.extend({[this.asOption]: this.value})\n }\n\n renderStatus () {\n const shouldDisplay = Boolean(this.conditional())\n return { shouldDisplay }\n }\n}\n","import {\n virtualElements, domData\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nimport {\n IfBindingHandler\n} from './ifUnless.js'\n\n/**\n * The `else` binding\n * (not to be mistaken for `<!-- else -->` inside if bindings.\n */\nexport class ElseBindingHandler extends IfBindingHandler {\n shouldDisplayIf () {\n return super.shouldDisplayIf() || this.value === undefined\n }\n\n /**\n * Return any conditional that precedes the given node.\n * @return {object} { elseChainSatisfied: observable }\n */\n get elseChainIsAlreadySatisfied () {\n if (!this._elseChain) { this._elseChain = this.readElseChain() }\n return unwrap(this._elseChain.elseChainSatisfied)\n }\n\n readElseChain () {\n let node = this.$element\n do {\n node = node.previousSibling\n } while (node && node.nodeType !== 1 && node.nodeType !== 8)\n\n if (!node) { return false }\n\n if (node.nodeType === 8) {\n node = virtualElements.previousSibling(node)\n }\n\n return domData.get(node, 'conditional') || {}\n }\n}\n","import { ForEachBinding } from './foreach.js'\n\nexport var bindings = {\n foreach: ForEachBinding\n}\n\n// By default, foreach will be async.\nForEachBinding.setSync(false)\n","//\n// Binding Handler for Components\n//\n\nimport {\n virtualElements, makeArray, cloneNodes\n} from '@tko/utils'\n\nimport {\n unwrap, isObservable\n} from '@tko/observable'\n\nimport {\n DescendantBindingHandler, applyBindingsToDescendants\n} from '@tko/bind'\n\nimport {\n JsxObserver, maybeJsx\n} from '@tko/utils.jsx'\n\nimport {\n NativeProvider\n} from '@tko/provider.native'\n\nimport {LifeCycle} from '@tko/lifecycle'\n\nimport registry from '@tko/utils.component'\n\nvar componentLoadingOperationUniqueId = 0\n\nexport default class ComponentBinding extends DescendantBindingHandler {\n constructor (params) {\n super(params)\n this.originalChildNodes = makeArray(\n virtualElements.childNodes(this.$element)\n )\n this.computed('computeApplyComponent')\n }\n\n cloneTemplateIntoElement (componentName, template, element) {\n if (!template) {\n throw new Error('Component \\'' + componentName + '\\' has no template')\n }\n\n if (maybeJsx(template)) {\n virtualElements.emptyNode(element)\n this.addDisposable(new JsxObserver(template, element, null, undefined, true))\n\n } else {\n const clonedNodesArray = cloneNodes(template)\n virtualElements.setDomNodeChildren(element, clonedNodesArray)\n }\n }\n\n createViewModel (componentDefinition, element, originalChildNodes, componentParams) {\n const componentViewModelFactory = componentDefinition.createViewModel\n return componentViewModelFactory\n ? componentViewModelFactory.call(componentDefinition, componentParams, { element, templateNodes: originalChildNodes })\n : componentParams // Template-only component\n }\n\n /**\n * Return the $componentTemplateSlotNodes for the given template\n * @param {HTMLElement|jsx} template\n */\n makeTemplateSlotNodes (originalChildNodes) {\n return Object.assign({}, ...this.genSlotsByName(originalChildNodes))\n }\n\n /**\n * Iterate over the templateNodes, yielding each '<element slot=name>'\n * as an object * of {name: element}.\n * @param {HTMLElement} templateNodes\n */\n * genSlotsByName (templateNodes) {\n for (const node of templateNodes) {\n if (node.nodeType !== 1) { continue }\n const slotName = node.getAttribute('slot')\n if (!slotName) { continue }\n yield {[slotName]: node}\n }\n }\n\n computeApplyComponent () {\n const value = unwrap(this.value)\n let componentName\n let componentParams\n\n if (typeof value === 'string') {\n componentName = value\n } else {\n componentName = unwrap(value.name)\n componentParams = NativeProvider.getNodeValues(this.$element) ||\n unwrap(value.params)\n }\n\n this.latestComponentName = componentName\n\n if (!componentName) {\n throw new Error('No component name specified')\n }\n\n this.loadingOperationId = this.currentLoadingOperationId = ++componentLoadingOperationUniqueId\n registry.get(componentName, (defn) => this.applyComponentDefinition(componentName, componentParams, defn))\n }\n\n makeChildBindingContext ($component) {\n const ctxExtender = (ctx) => Object.assign(ctx, {\n $component,\n $componentTemplateNodes: this.originalChildNodes,\n $componentTemplateSlotNodes: this.makeTemplateSlotNodes(\n this.originalChildNodes)\n })\n\n return this.$context.createChildContext($component, undefined, ctxExtender)\n }\n\n applyComponentDefinition (componentName, componentParams, componentDefinition) {\n // If this is not the current load operation for this element, ignore it.\n if (this.currentLoadingOperationId !== this.loadingOperationId ||\n this.latestComponentName !== componentName) { return }\n\n // Clean up previous state\n this.cleanUpState()\n\n const element = this.$element\n\n // Instantiate and bind new component. Implicitly this cleans any old DOM nodes.\n if (!componentDefinition) {\n throw new Error('Unknown component \\'' + componentName + '\\'')\n }\n\n if (componentDefinition.template) {\n this.cloneTemplateIntoElement(componentName, componentDefinition.template, element)\n }\n\n const componentViewModel = this.createViewModel(componentDefinition, element, this.originalChildNodes, componentParams)\n\n this.childBindingContext = this.makeChildBindingContext(componentViewModel)\n\n const viewTemplate = componentViewModel && componentViewModel.template\n\n if (!viewTemplate && !componentDefinition.template) {\n throw new Error('Component \\'' + componentName + '\\' has no template')\n }\n\n if (!componentDefinition.template) {\n this.cloneTemplateIntoElement(componentName, viewTemplate, element)\n }\n\n if (componentViewModel instanceof LifeCycle) {\n componentViewModel.anchorTo(this.$element)\n }\n\n this.currentViewModel = componentViewModel\n\n const onBinding = this.onBindingComplete.bind(this, componentViewModel)\n this.applyBindingsToDescendants(this.childBindingContext, onBinding)\n }\n\n onBindingComplete (componentViewModel, bindingResult) {\n if (componentViewModel && componentViewModel.koDescendantsComplete) {\n componentViewModel.koDescendantsComplete(this.$element)\n }\n this.completeBinding(bindingResult)\n }\n\n cleanUpState () {\n const currentView = this.currentViewModel\n const currentViewDispose = currentView && currentView.dispose\n if (typeof currentViewDispose === 'function') {\n currentViewDispose.call(currentView)\n }\n this.currentViewModel = null\n // Any in-flight loading operation is no longer relevant, so make sure we ignore its completion\n this.currentLoadingOperationId = null\n }\n\n dispose () {\n this.cleanUpState()\n super.dispose()\n }\n\n get controlsDescendants () { return true }\n static get allowVirtualElements () { return true }\n}\n","/**\n * Slots work as follows (you'll note a similarity to vue).\n *\n * Component template definitions have <slot name='abc'> tags.\n *\n * <template id='custom-component-template'>\n * <slot name='abc'>\n *\n * Component use these slots with e.g.\n *\n * <custom-component>\n * <template slot='abc'>\n *\n * When the component template is rendered, the `slot` binding will map\n * every binding to its respective slot.\n */\nimport {\n virtualElements\n} from '@tko/utils'\n\nimport {\n JsxObserver, getOriginalJsxForNode\n} from '@tko/utils.jsx'\n\nimport {\n DescendantBindingHandler, contextFor\n} from '@tko/bind'\n\n/**\n * SlotBinding replaces a slot with\n */\nexport default class SlotBinding extends DescendantBindingHandler {\n constructor (...params) {\n super(...params)\n const slotNode = this.getSlot(this.value)\n const $slotContext = contextFor(slotNode)\n\n const childContext = this.$context.extend({\n $slotContext,\n $slotData: $slotContext && $slotContext.$data\n })\n\n this.replaceSlotWithNode(this.$element, slotNode)\n\n this.applyBindingsToDescendants(childContext)\n }\n\n /**\n *\n * @param {HTMLElement} nodeToReplace\n * @param {HTMLElement}} slotValue\n */\n replaceSlotWithNode (nodeInComponentTemplate, slotNode) {\n const nodes = this.cloneNodeFromOriginal(slotNode)\n virtualElements.emptyNode(nodeInComponentTemplate)\n this.addDisposable(new JsxObserver(nodes, nodeInComponentTemplate, undefined, undefined, true))\n }\n\n cloneNodeFromOriginal (node) {\n if (!node) { return [] }\n const jsx = getOriginalJsxForNode(node)\n if (jsx) { return jsx.children }\n\n if ('content' in node) {\n const clone = document.importNode(node.content, true)\n return [...clone.childNodes]\n }\n\n const nodeArray = Array.isArray(node) ? node : [node]\n return nodeArray.map(n => n.cloneNode(true))\n }\n\n\n getSlot (slotName) {\n const {$componentTemplateSlotNodes} = this.$context\n\n if (!slotName) {\n return $componentTemplateSlotNodes[''] ||\n [...this.$context.$componentTemplateNodes]\n .filter(n => !n.getAttribute || !n.getAttribute('slot'))\n }\n\n return $componentTemplateSlotNodes[slotName]\n }\n\n static get allowVirtualElements () { return true }\n}\n","\nimport {\n unwrap, toJS\n} from '@tko/observable'\n\nvar sproto = String.prototype\n\nvar filters = {}\n\n// Convert value to uppercase\nfilters.uppercase = function (value) {\n return sproto.toUpperCase.call(unwrap(value))\n}\n\n// Convert value to lowercase\nfilters.lowercase = function (value) {\n return sproto.toLowerCase.call(unwrap(value))\n}\n\n// Return default value if the input value is empty or null\nfilters['default'] = function (value, defaultValue) {\n value = unwrap(value)\n if (typeof value === 'function') {\n return value\n }\n if (typeof value === 'string') {\n return sproto.trim.call(value) === '' ? defaultValue : value\n }\n return value == null || value.length == 0 ? defaultValue : value\n}\n\n// Return the value with the search string replaced with the replacement string\nfilters.replace = function (value, search, replace) {\n return sproto.replace.call(unwrap(value), search, replace)\n}\n\nfilters.fit = function (value, length, replacement, trimWhere) {\n value = unwrap(value)\n if (length && ('' + value).length > length) {\n replacement = '' + (replacement || '...')\n length = length - replacement.length\n value = '' + value\n switch (trimWhere) {\n case 'left':\n return replacement + value.slice(-length)\n case 'middle':\n var leftLen = Math.ceil(length / 2)\n return value.substr(0, leftLen) + replacement + value.slice(leftLen - length)\n default:\n return value.substr(0, length) + replacement\n }\n } else {\n return value\n }\n}\n\n// Convert a model object to JSON\nfilters.json = function (rootObject, space, replacer) {\n // replacer and space are optional\n return JSON.stringify(toJS(rootObject), replacer, space)\n}\n\n// Format a number using the browser's toLocaleString\nfilters.number = function (value) {\n return (+unwrap(value)).toLocaleString()\n}\n\n// Export the filters object for general access\nexport { filters }\n","\nimport {attr} from './attr.js'\nimport {checked, checkedValue} from './checked.js'\nimport {click} from './click.js'\nimport {css} from './css.js'\nimport descendantsComplete from './descendantsComplete'\nimport {enable, disable} from './enableDisable.js'\nimport {eventHandler, onHandler} from './event.js'\nimport {hasfocus} from './hasfocus.js'\nimport {html} from './html.js'\nimport $let from './let.js'\nimport {options} from './options.js'\nimport {selectedOptions} from './selectedOptions.js'\nimport {style} from './style.js'\nimport {submit} from './submit.js'\nimport {text} from './text.js'\nimport {textInput} from './textInput.js'\nimport {uniqueName} from './uniqueName.js'\nimport {value} from './value.js'\nimport {visible, hidden} from './visible.js'\nimport {using} from './using.js'\n\nexport var bindings = {\n attr,\n checked,\n checkedValue,\n click,\n css,\n 'class': css,\n descendantsComplete,\n enable,\n 'event': eventHandler,\n disable,\n hasfocus,\n hasFocus: hasfocus,\n hidden,\n html,\n 'let': $let,\n on: onHandler,\n options,\n selectedOptions,\n style,\n submit,\n text,\n textInput,\n textinput: textInput,\n uniqueName,\n using,\n value,\n visible\n}\n","\nimport {\n setElementName, objectForEach\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nexport var attr = {\n update: function (element, valueAccessor, allBindings) {\n var value = unwrap(valueAccessor()) || {}\n objectForEach(value, function (attrName, attrValue) {\n attrValue = unwrap(attrValue)\n\n // Find the namespace of this attribute, if any.\n var prefixLen = attrName.indexOf(':')\n var namespace = prefixLen > 0 && element.lookupNamespaceURI(attrName.substr(0, prefixLen))\n\n // To cover cases like \"attr: { checked:someProp }\", we want to remove the attribute entirely\n // when someProp is a \"no value\"-like value (strictly null, false, or undefined)\n // (because the absence of the \"checked\" attr is how to mark an element as not checked, etc.)\n const toRemove = attrValue === false || attrValue === null || attrValue === undefined\n\n if (toRemove) {\n if (namespace) {\n element.removeAttributeNS(namespace, attrName)\n } else {\n element.removeAttribute(attrName)\n }\n } else {\n attrValue = attrValue.toString()\n if (namespace) {\n element.setAttributeNS(namespace, attrName, attrValue)\n } else {\n element.setAttribute(attrName, attrValue)\n }\n }\n\n // Treat \"name\" specially - although you can think of it as an attribute, it also needs\n // special handling on older versions of IE (https://github.com/SteveSanderson/knockout/pull/333)\n // Deliberately being case-sensitive here because XHTML would regard \"Name\" as a different thing\n // entirely, and there's no strong reason to allow for such casing in HTML.\n if (attrName === 'name') {\n setElementName(element, toRemove ? '' : attrValue)\n }\n })\n }\n}\n","\nimport {\n registerEventHandler, arrayIndexOf, addOrRemoveItem\n} from '@tko/utils'\n\nimport {\n unwrap, dependencyDetection, isWriteableObservable\n} from '@tko/observable'\n\nimport {\n computed, pureComputed\n} from '@tko/computed'\n\nexport var checked = {\n after: ['value', 'attr'],\n init: function (element, valueAccessor, allBindings) {\n var checkedValue = pureComputed(function () {\n // Treat \"value\" like \"checkedValue\" when it is included with \"checked\" binding\n if (allBindings.has('checkedValue')) {\n return unwrap(allBindings.get('checkedValue'))\n } else if (useElementValue) {\n if (allBindings.has('value')) {\n return unwrap(allBindings.get('value'))\n } else {\n return element.value\n }\n }\n })\n\n function updateModel () {\n // This updates the model value from the view value.\n // It runs in response to DOM events (click) and changes in checkedValue.\n var isChecked = element.checked,\n elemValue = checkedValue()\n\n // When we're first setting up this computed, don't change any model state.\n if (dependencyDetection.isInitial()) {\n return\n }\n\n // We can ignore unchecked radio buttons, because some other radio\n // button will be checked, and that one can take care of updating state.\n // button will be checked, and that one can take care of updating state\n if (!isChecked && (isRadio || dependencyDetection.getDependenciesCount())) {\n return\n }\n\n var modelValue = dependencyDetection.ignore(valueAccessor)\n if (valueIsArray) {\n var writableValue = rawValueIsNonArrayObservable ? modelValue.peek() : modelValue,\n saveOldValue = oldElemValue\n oldElemValue = elemValue\n\n if (saveOldValue !== elemValue) {\n // When we're responding to the checkedValue changing, and the element is\n // currently checked, replace the old elem value with the new elem value\n // in the model array.\n if (isChecked) {\n addOrRemoveItem(writableValue, elemValue, true)\n addOrRemoveItem(writableValue, saveOldValue, false)\n }\n\n oldElemValue = elemValue\n } else {\n // When we're responding to the user having checked/unchecked a checkbox,\n // add/remove the element value to the model array.\n addOrRemoveItem(writableValue, elemValue, isChecked)\n }\n if (rawValueIsNonArrayObservable && isWriteableObservable(modelValue)) {\n modelValue(writableValue)\n }\n } else {\n if (isCheckbox) {\n if (elemValue === undefined) {\n elemValue = isChecked\n } else if (!isChecked) {\n elemValue = undefined\n }\n }\n valueAccessor(elemValue, {onlyIfChanged: true})\n }\n };\n\n function updateView () {\n // This updates the view value from the model value.\n // It runs in response to changes in the bound (checked) value.\n var modelValue = modelValue = unwrap(valueAccessor())\n var elemValue = checkedValue()\n\n if (valueIsArray) {\n // When a checkbox is bound to an array, being checked represents its value being present in that array\n element.checked = arrayIndexOf(modelValue, elemValue) >= 0\n oldElemValue = elemValue\n } else if (isCheckbox && elemValue === undefined) {\n // When a checkbox is bound to any other value (not an array) and \"checkedValue\" is not defined,\n // being checked represents the value being trueish\n element.checked = !!modelValue\n } else {\n // Otherwise, being checked means that the checkbox or radio button's value corresponds to the model value\n element.checked = (checkedValue() === modelValue)\n }\n };\n\n var isCheckbox = element.type == 'checkbox',\n isRadio = element.type == 'radio'\n\n // Only bind to check boxes and radio buttons\n if (!isCheckbox && !isRadio) {\n return\n }\n\n var rawValue = valueAccessor(),\n valueIsArray = isCheckbox && (unwrap(rawValue) instanceof Array),\n rawValueIsNonArrayObservable = !(valueIsArray && rawValue.push && rawValue.splice),\n useElementValue = isRadio || valueIsArray,\n oldElemValue = valueIsArray ? checkedValue() : undefined\n\n // Set up two computeds to update the binding:\n\n // The first responds to changes in the checkedValue value and to element clicks\n computed(updateModel, null, { disposeWhenNodeIsRemoved: element })\n registerEventHandler(element, 'click', updateModel)\n\n // The second responds to changes in the model value (the one associated with the checked binding)\n computed(updateView, null, { disposeWhenNodeIsRemoved: element })\n\n rawValue = undefined\n }\n}\n\nexport var checkedValue = {\n update: function (element, valueAccessor) {\n element.value = unwrap(valueAccessor())\n }\n}\n","import {\n setHtml, parseHtmlFragment, virtualElements\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nexport var html = {\n init: function () {\n // Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)\n return {\n 'controlsDescendantBindings': true\n }\n },\n //\n // Modify internal, per ko.punches and :\n // http://stackoverflow.com/a/15348139\n update: function (element, valueAccessor) {\n setHtml(element, valueAccessor())\n },\n allowVirtualElements: true\n}\n","\nimport {\n applyBindingsToDescendants\n} from '@tko/bind'\n\nexport default {\n init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {\n // Make a modified binding context, with extra properties, and apply it to descendant elements\n var innerContext = bindingContext['extend'](valueAccessor)\n applyBindingsToDescendants(innerContext, element)\n\n return { 'controlsDescendantBindings': true }\n },\n allowVirtualElements: true\n}\n","\nimport {\n arrayForEach, setOptionNodeSelectionState, arrayIndexOf,\n registerEventHandler, tagNameLower, selectExtensions\n} from '@tko/utils'\n\nimport {\n unwrap\n} from '@tko/observable'\n\nexport var selectedOptions = {\n after: ['options', 'foreach'],\n\n init: function (element, valueAccessor, allBindings) {\n registerEventHandler(element, 'change', function () {\n var value = valueAccessor(), valueToWrite = []\n arrayForEach(element.getElementsByTagName('option'), function (node) {\n if (node.selected) { valueToWrite.push(selectExtensions.readValue(node)) }\n })\n valueAccessor(valueToWrite)\n })\n },\n\n update: function (element, valueAccessor) {\n if (tagNameLower(element) != 'select') { throw new Error('values binding applies only to SELECT elements') }\n\n var newValue = unwrap(valueAccessor()),\n previousScrollTop = element.scrollTop\n\n if (newValue && typeof newValue.length === 'number') {\n arrayForEach(element.getElementsByTagName('option'), function (node) {\n var isSelected = arrayIndexOf(newValue, selectExtensions.readValue(node)) >= 0\n if (node.selected != isSelected) { // This check prevents flashing of the select element in IE\n setOptionNodeSelectionState(node, isSelected)\n }\n })\n }\n\n element.scrollTop = previousScrollTop\n }\n}\n","\nimport {\n registerEventHandler\n} from '@tko/utils'\n\nexport var submit = {\n init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {\n if (typeof valueAccessor() !== 'function') { throw new Error('The value for a submit binding must be a function') }\n registerEventHandler(element, 'submit', function (event) {\n var handlerReturnValue\n var value = valueAccessor()\n try { handlerReturnValue = value.call(bindingContext['$data'], element) } finally {\n if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true.\n if (event.preventDefault) { event.preventDefault() } else { event.returnValue = false }\n }\n }\n })\n }\n}\n","import {\n setTextContent\n} from '@tko/utils'\n\nexport var text = {\n init: function () {\n // Prevent binding on the dynamically-injected text node (as developers are unlikely to expect that, and it has security implications).\n // It should also make things faster, as we no longer have to consider whether the text node might be bindable.\n return { controlsDescendantBindings: true }\n },\n update: function (element, valueAccessor) {\n setTextContent(element, valueAccessor())\n },\n allowVirtualElements: true\n}\n","import {\n applyBindingsToDescendants\n} from '@tko/bind'\n\nexport var using = {\n init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {\n var innerContext = bindingContext.createChildContext(valueAccessor)\n applyBindingsToDescendants(innerContext, element)\n return { controlsDescendantBindings: true }\n },\n allowVirtualElements: true\n}\n","\nimport {\n TemplateForEachBindingHandler\n} from './foreach'\n\nimport {\n TemplateBindingHandler\n} from './templating'\n// 'let': letBinding,\n// template: template,\n\nexport const bindings = {\n foreach: TemplateForEachBindingHandler,\n template: TemplateBindingHandler\n}\n\nexport * from './nativeTemplateEngine'\nexport * from './templateEngine'\nexport * from './templating'\nexport * from './templateSources'\n","\nimport {\n IfBindingHandler,\n UnlessBindingHandler\n} from './ifUnless'\n\nimport {\n WithBindingHandler\n} from './with'\n\nimport {\n ElseBindingHandler\n} from './else'\n\nexport const bindings = {\n 'if': IfBindingHandler,\n 'with': WithBindingHandler,\n ifnot: UnlessBindingHandler,\n unless: UnlessBindingHandler,\n 'else': ElseBindingHandler,\n 'elseif': ElseBindingHandler\n}\n","\nimport component from './componentBinding'\nimport slot from './slotBinding'\nexport var bindings = { component, slot }\n"],"names":["length","bind","indexOf","find","Array","from","splice","shift","filter","push","apply","peek","value","moved","index","dontLimitMoves","sparse","reverse","onError","setTimeout","clearTimeout","Object","prototype","hasOwnProperty","call","constructor","Set","JSON","stringify","has","add","then","defineProperty","trim","toString","replace","substring","Symbol","classList","match","className","join","nodeType","contains","parentNode","compareDocumentPosition","ownerDocument","documentElement","tagName","toLowerCase","window","HTMLElement","DocumentFragment","domData.get","domData.set","slice","domData.clear","cleanExternalData","childNodes","Error","getElementsByTagName","removeChild","type","useOnlyNativeEvents","on","addEventListener","attachEvent","detachEvent","trigger","document","createEvent","dispatchEvent","initEvent","global","click","fireEvent","createElement","appendChild","cloneNode","insertBefore","name","mergeAttributes","firstChild","nextSibling","setAttribute","selected","style","zoom","width","test","text","nodeValue","setRegularDomNodeChildren","outerHTML","previousSibling","innerHTML","lastChild","content","parseHTML","clean","parentElement","html","virtualElements.emptyNode","virtualElements.setDomNodeChildren","virtualElements.firstChild","virtualElements.nextSibling","createTextNode","data","Math","random","domNode","memoId","taskScheduler","pop","callback","callbackTarget","_id","computed","getDependenciesCount","getDependencies","isInitial","_deferUpdates","limit","tasks.cancel","tasks.schedule","notifySubscribers","setPrototypeOf","init","isDifferent","arguments","valueWillMutate","valueHasMutated","dependencyDetection.registerDependency","fn","deferUpdates","_limitBeforeChange","_origNotifySubscribers","_limitChange","observablePrototypes","isWriteable","concat","subscribe","hasSubscriptionsForEvent","compareArrays","compareArrayOptions","options","cacheDiffForKnownOperation","beforeSubscriptionAdd","afterSubscriptionRemove","dispose","get","remove","RegExp","Date","String","Number","Boolean","save","keys","values","charCodeAt","key","substr","evaluatorFunctionTarget","isDisposed","isDirty","isSleeping","haveDependenciesChanged","evaluateImmediate","latestValue","read","write","isStale","isBeingEvaluated","suppressDisposalUntilDisposeWhenReturnsFalse","pure","readFunction","owner","disposeWhenNodeIsRemoved","disposeWhen","domNodeDisposalCallback","dependencyTracking","dependenciesCount","evaluationTimeoutInstance","deferEvaluation","koOptions","deferred","debug","_options","isActive","computedObservable","disposalCount","disposalCandidates","addDependencyTracking","_target","subscribeToDependency","subscribable","_notificationIsPending","_notifyNextChangeIfValueIsDifferent","extend","isArray","Proxy","set","deleteProperty","assign","getPrototypeOf","preventExtensions","isExtensible","ownKeys","getOwnPropertyNames","getOwnPropertySymbols","notify","$parents","$root","$data","$rawData","ko","knockoutInstance","exportDependencies","context","bindingProviderInstance","instance","FOR_NODE_TYPES","includes","isBindingHandlerClass","getOrCreateFor","getBindingHandler","bindingHandlers","preprocessNode","childrenComplete","nodeHasBindings","some","virtualElements.normaliseVirtualElementDomStructure","shouldBindDescendants","after","domData.getOrSet","alreadyBound","during","errorCaptured","element","getBindingAccessors","bindingContext","$component","virtualElements.childNodes","bindings","allBindings","bindingKey","valueAccessor","allowVirtualElements","dependencyDetection.ignore","$element","$context","onValueChange","controlsDescendants","bindingCompleted","Promise","descendantsComplete","size","all","asyncBindingsApplied","rootNode","jQuery","body","message","stack","mappedNodes","dependentObservable","arrayEntry","indexObservable","virtualElements.insertAfter","initialized","domElement","tagNameLower","tagNameLowerFn","templateType","memoization.unmemoizeDomNodeAndDescendants","templateEngine","renderTemplate","afterRender","memoization.memoize","as","createChildContextWithAs","createChildContext","$index","includeDestroyed","foreachHidesDestroyed","beforeRemove","iterator","_destroy","synchronous","definition","isSynchronousComponent","loaders","suppressLoaderExceptions","ignoreCustomElementWarning","console","log","_getFirstResultFromLoaders","getElementById","elementName","require","amdRequire","handler","status","Node","max","min","protoProperty","defaultBindingAttribute","bindingGlobals","filters","navigator","userAgent","ua","getTime","getDataForNode","clear","getDataforNode","domData.nextKey","cleanData","createComment","optionValueDomDataKey","readValue","selectedIndex","writeValue","MutationObserver","standalone","observe","attributes","toggle","onreadystatechange","_callback","next","_disposeCallback","_isDisposed","_domNodeDisposalCallback","_node","unsubscribe","closed","equalityComparer","rateLimit","timeout","method","observable","_subscriptions","change","_versionNumber","updateVersion","_changeSubscriptions","dependencyDetection.begin","dependencyDetection.end","getVersion","hasChanged","getSubscriptionsCount","once","when","resolve","yet","Function","modify","_evalIfChanged","_notifyNextChange","_recordUpdate","trackArrayChanges","removeAll","destroy","destroyAll","sorted","sort","reversed","precedence","earlyOut","lhs","op","rhs","operators","get_leaf_value","isExpressionOrIdentifierSymbol","get_value","value_of","create_root","yes","no","nodes","root","parser","args","token","dereferences","dereference","lookup","set_value","is_valid_start_char","is_valid_continue_char","b","f","n","r","t","white","ch","comment","at","lookahead","error","charAt","number","isFinite","objectAddValue","currentContextGlobals","enumerable","map","object","string","expression","readString","parseInt","fromCharCode","array","identifier","operator","not_an_array","prefix","ternary","member","funcArguments","readBindings","split","valueAsAccessor","convertToAccessors","onlyIfChanged","preparse","bindingStringPreparsers","reduce","runParse","parse","parseExpression","_order","_version","_evalDelayed","markDirty","respondToChange","evaluatePossiblyAsync","throttleEvaluation","evaluateImmediate_CallReadWithDependencyDetection","evaluateImmediate_CallReadThenEndDependencyDetection","_latestValue","throttle","getObservable","isProxied","mixInto","addDisposable","__addEventListener","removeEventListener","anchorTo","forEach","eventSubscribable","boundElementDomDataKey","$parentContext","$parent","unshift","createStaticChildContext","isSync","isComplete","completionPromise","completeWhenBindingsFinish","registerAs","bindingCompletion","completeBinding","WeakMap","Map","initReturn","legacyArgs","update","controlsDescendantBindings","createFor","virtualElements.allowedBindings","applyBindingsToDescendants","containerData","alwaysCheckText","textData","renderTemplateSource","createJavaScriptEvaluatorBlock","makeTemplateSource","elseChainSatisfied","bindNamedTemplate","bindNodeTemplate","bindAnonymousTemplate","if","ifnot","foreach","disposeOldComputedAndStoreNewOne","afterAdd","beforeMove","afterMove","addDisposeCallback","removeDisposeCallback","removeNode","addCleaner","removeCleaner","addOrRemoveItem","arrayFilter","arrayFirst","arrayForEach","arrayGetDistinctValues","arrayIndexOf","arrayMap","arrayPushAll","arrayRemoveItem","cloneNodes","createSymbolOrString","domData","domNodeDisposal","objectForEach","objectMap","parseHtmlFragment","parseJson","parseObjectLiteral","peekObservable","range","registerEventHandler","setDomNodeChildrenFromArrayMapping","setHtml","setTextContent","toggleDomNodeCssClass","triggerEvent","unwrapObservable","cleanNode","dependencyDetection","computedContext","ignoreDependencies","memoization","selectExtensions","tasks","utils","LifeCycle","isObservable","isSubscribable","isWriteableObservable","isWritableObservable","observableArray","isObservableArray","unwrap","toJS","toJSON","proxy","isComputed","isPureComputed","pureComputed","nativeTemplateEngine","setTemplateEngine","templateSources","anonymousTemplate","applyBindingAccessorsToNode","applyBindings","applyBindingsToNode","makeBindingAccessors","contextFor","dataFor","BindingHandler","AsyncBindingHandler","virtualElements","bindingEvent","globals","setGlobals","preemptive","postProcess","_overloadInstance","makeAccessorsFromFunction","makeValueAccessor","providerObject","getBindingsAndMakeAccessors","getBindings","processBinding","preprocess","generateBindingString","unknown","preProcessBindings","getBindingString","genElementBindingStrings","COMMENT_NODE","virtualElements.virtualNodeBindingValue","virtualElements.isStartComment","BIND_ATTRIBUTE","ELEMENT_NODE","getAttribute","hasAttribute","clearCachedDefinition","getConfig","loadComponent","loadTemplate","loadViewModel","customElementName","template","sync","register","viewModel","ComponentABC","isRegistered","unregister","defaultLoader","_allRegisteredComponents","getComponentNameForNode","component","params","getComponentParams","registry","$raw","makeParamValue","PREFIX","getBindingAttributesList","hasAttributes","startsWith","handlersFromAttributes","getValue","nodeTypes","providers","nodeTypeMap","addProvider","providersFor","enumerateProviderBindings","entries","asAttr","textNodeReplacement","checked","class","ATTRIBUTES_TO_SKIP","attributesToSkip","ATTRIBUTES_BINDING_MAP","attributesBindingMap","attributesToInterpolate","specified","done","partsTogether","attributeBinding","bindingParts","getPossibleDirectBinding","bindingObjects","removeAttribute","textToNodes","nodeName","textInterpolation","onlyBindings","addValueToNode","getNodeValues","passive","capture","bubble","preventDefault","returnValue","cancelBubble","stopPropagation","debounceFn","throttleFn","aliases","classesWrittenByBindingKey","onDescendantsComplete","disabled","activeElement","focus","blur","previousElementValue","_forceUpdateOn","eventsIndicatingSyncValueChange","eventsIndicatingDeferValueChange","updateModel","timeoutHandle","elementValueBeforeEvent","_ko_textInputProcessedEvent","deferUpdateModel","updateView","propertyName","watchForSelectionChangeEvent","eventsIndicatingValueChange","selectionChangeHandler","selectionChangeHandlerName","selectionChangeRegisteredName","w","parseFloat","opera","version","currentIndex","isCheckboxOrRadio","checkedValue","propertyChangedFired","ieAutoCompleteHackNeeded","propertyChangeFired","valueUpdateHandler","eventsToCatch","registerEvent","updateFromModel","isInput","updateFromModelForFile","updateFromModelForValue","isInputElement","autocomplete","form","display","hasElse","detectElse","completesElseChain","getIfElseNodes","ifElseNodes","dependencyDetection.getDependenciesCount","cloneIfElseNodes","render","shouldDisplay","renderStatus","renderAndApplyBindings","ifNodes","elseNodes","elseChainIsAlreadySatisfied","isElseNode","ifCondition","shouldDisplayIf","asOption","conditional","_elseChain","readElseChain","virtualElements.previousSibling","createDocumentFragment","container","generateContext","createContextGenerator","$indexHasBeenRequested","templateNode","changeQueue","firstLastNodesList","indexesToDelete","rendering_queued","pendingDeletes","isNotEmpty","onArrayChange","changeSubs","flushPendingDeletes","added","deleted","isBatch","processQueue","animateFrame","startQueueFlush","beforeQueueFlush","endQueueFlush","afterQueueFlush","updateIndexes","_first$indexRequest","getContextStartingFrom","first","_contextExtensions","$list","configurable","writable","updateFirstLastNodesList","last","getLastNodeBeforeIndex","getPendingDeleteFor","nodesets","nodeOrArrayInserted","insertAllAfter","foreachInstance","getNodesForIndex","activeChildElement","shouldDelayDeletion","getOrCreatePendingDeleteFor","removeNodes","nodesToRemove","clearDeletedIndexes","setSync","requestAnimationFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","msRequestAnimationFrame","ForEach","PENDING_DELETE_INDEX_SYM","svg","xml","xlink","xmlns","getParentTarget","observableArrayChange","adoptedInsertBefore","noInitialBinding","parentNodeTarget","nodeArrayOrObservableAtIndex","subscriptionsForNode","createInitialAdditions","removeAllPriorNodes","possibleIteratable","delChange","addChange","injectNode","lastNodeFor","anyToNode","canApplyBindings","removeNodeArrayOrObservable","getSubscriptionsForNode","isJsx","futureJsxNode","cloneJSXorMoveNode","jsxToNode","createElementNS","updateAttributes","children","catch","delete","setNodeAttribute","getNamespaceOfAttribute","removeAttributeNS","setAttributeNS","detachAndDispose","originalChildNodes","cloneTemplateIntoElement","createViewModel","templateNodes","makeTemplateSlotNodes","genSlotsByName","computeApplyComponent","latestComponentName","loadingOperationId","currentLoadingOperationId","applyComponentDefinition","makeChildBindingContext","$componentTemplateNodes","$componentTemplateSlotNodes","cleanUpState","childBindingContext","currentViewModel","onBindingComplete","koDescendantsComplete","getSlot","$slotContext","$slotData","replaceSlotWithNode","cloneNodeFromOriginal","importNode","uppercase","toUpperCase","lowercase","fit","ceil","json","toLocaleString","provider","providedProperties","extenders","bindingProvider","create","attr","lookupNamespaceURI","dependencyDetection.isInitial","css","enable","disable","hasfocus","hasFocus","hidden","multiple","scrollTop","abs","selectedOptions","jQueryInstance","isNaN","submit","textInput","textinput","uniqueName","using","visible","unless"],"mappings":"+KAQO,iBAA+C,CAC7B,CAAnB,WAAUA,MADsC,GACxB,EAAS,EAAOC,IAAP,GADe,EAEpD,IAAK,GAAI,GAAI,CAAR,CAAW,EAAI,EAAMD,MAA1B,CAAkC,GAAlC,CAAyC,GAAzC,CACE,EAAO,IAAP,KAEH,CAEM,eAAoC,CACzC,MAAO,CAAC,QAAyB,CAAC,IAAD,CAA1B,EAAsCE,OAAtC,GACR,CAEM,iBAAuD,CAC5D,MAAO,CAAC,QAAyB,CAAC,IAAD,CAA1B,EACJC,IADI,KAER,CAEM,WAAmB,EAAQ,EAA3B,KAAiD,CAEtD,MADuB,EAAnB,WAAUH,MACd,GAD4B,EAAU,EAAQC,IAAR,GACtC,EAAiB,IAAV,KAAiB,EAAjB,CAAsBG,MAAMC,IAAN,KAC9B,CAEM,eAA+C,CACpD,GAAI,GAAQ,MAAZ,CACY,CAAR,EAFgD,CAGlD,EAAMC,MAAN,GAAoB,CAApB,CAHkD,CAI/B,CAAV,IAJyC,EAKlD,EAAMC,KAAN,EAEH,CASM,iBAAiD,CAEtD,MADuB,EAAnB,WAAUP,MACd,GAD4B,EAAY,EAAUC,IAAV,GACxC,EAAiB,IAAV,KAAiB,EAAjB,CAAsB,CAAC,QAAyB,CAAC,IAAD,CAA1B,EAAsCO,MAAtC,GAC9B,CAEM,eAA4C,CACjD,GAAI,KAAJ,CACE,EAAMC,IAAN,CAAWC,KAAX,KADF,KAGE,KAAK,GAAI,GAAI,CAAR,CAAW,EAAI,EAAaV,MAAjC,CAAyC,GAAzC,CAAgD,GAAhD,CAAuD,EAAMS,IAAN,CAAW,IAAX,EAEzD,Q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