#257130: Switching to minified version of knockout.js
authorJaroslav Tulach <jtulach@netbeans.org>
Mon, 14 Dec 2015 05:52:22 +0100
changeset 103186218dd9270b
parent 1030 02568f34628a
child 1032 43cd6875cb63
#257130: Switching to minified version of knockout.js
ko4j/src/main/java/org/netbeans/html/ko4j/Knockout.java
ko4j/src/main/resources/org/netbeans/html/ko4j/knockout-3.2.0.debug.js
ko4j/src/main/resources/org/netbeans/html/ko4j/knockout-3.4.0.js
pom.xml
     1.1 --- a/ko4j/src/main/java/org/netbeans/html/ko4j/Knockout.java	Sun Dec 13 21:33:32 2015 +0100
     1.2 +++ b/ko4j/src/main/java/org/netbeans/html/ko4j/Knockout.java	Mon Dec 14 05:52:22 2015 +0100
     1.3 @@ -62,7 +62,7 @@
     1.4   *
     1.5   * @author Jaroslav Tulach
     1.6   */
     1.7 -@JavaScriptResource("knockout-3.2.0.debug.js")
     1.8 +@JavaScriptResource("knockout-3.4.0.js")
     1.9  final class Knockout extends WeakReference<Object> {
    1.10      private static final ReferenceQueue<Object> QUEUE = new ReferenceQueue();
    1.11      private static final Set<Knockout> active = Collections.synchronizedSet(new HashSet<Knockout>());
     2.1 --- a/ko4j/src/main/resources/org/netbeans/html/ko4j/knockout-3.2.0.debug.js	Sun Dec 13 21:33:32 2015 +0100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,5342 +0,0 @@
     2.4 -/*
     2.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     2.6 - *
     2.7 - * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
     2.8 - *
     2.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    2.10 - * Other names may be trademarks of their respective owners.
    2.11 - *
    2.12 - * The contents of this file are subject to the terms of either the GNU
    2.13 - * General Public License Version 2 only ("GPL") or the Common
    2.14 - * Development and Distribution License("CDDL") (collectively, the
    2.15 - * "License"). You may not use this file except in compliance with the
    2.16 - * License. You can obtain a copy of the License at
    2.17 - * http://www.netbeans.org/cddl-gplv2.html
    2.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    2.19 - * specific language governing permissions and limitations under the
    2.20 - * License.  When distributing the software, include this License Header
    2.21 - * Notice in each file and include the License file at
    2.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    2.23 - * particular file as subject to the "Classpath" exception as provided
    2.24 - * by Oracle in the GPL Version 2 section of the License file that
    2.25 - * accompanied this code. If applicable, add the following below the
    2.26 - * License Header, with the fields enclosed by brackets [] replaced by
    2.27 - * your own identifying information:
    2.28 - * "Portions Copyrighted [year] [name of copyright owner]"
    2.29 - *
    2.30 - * Contributor(s):
    2.31 - *
    2.32 - * The Original Software is NetBeans. The Initial Developer of the Original
    2.33 - * Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
    2.34 - *
    2.35 - * If you wish your version of this file to be governed by only the CDDL
    2.36 - * or only the GPL Version 2, indicate your decision by adding
    2.37 - * "[Contributor] elects to include this software in this distribution
    2.38 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    2.39 - * single choice of license, a recipient has the option to distribute
    2.40 - * your version of this file under either the CDDL, the GPL Version 2 or
    2.41 - * to extend the choice of license to its licensees as provided above.
    2.42 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    2.43 - * Version 2 license, then the option applies only if the new code is
    2.44 - * made subject to such option by the copyright holder.
    2.45 - */
    2.46 -
    2.47 -/*!
    2.48 - * Knockout JavaScript library v3.2.0
    2.49 - * (c) Steven Sanderson - http://knockoutjs.com/
    2.50 - * License: MIT (http://www.opensource.org/licenses/mit-license.php)
    2.51 - */
    2.52 -
    2.53 -(function(){
    2.54 -var DEBUG=false;
    2.55 -(function(undefined){
    2.56 -    // (0, eval)('this') is a robust way of getting a reference to the global object
    2.57 -    // For details, see http://stackoverflow.com/questions/14119988/return-this-0-evalthis/14120023#14120023
    2.58 -    var window = this || (0, eval)('this'),
    2.59 -        document = window['document'],
    2.60 -        navigator = window['navigator'],
    2.61 -        jQueryInstance = window["jQuery"],
    2.62 -        JSON = window["JSON"];
    2.63 -(function(factory) {
    2.64 -    // Support three module loading scenarios
    2.65 -    if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
    2.66 -        // [1] CommonJS/Node.js
    2.67 -        var target = module['exports'] || exports; // module.exports is for Node.js
    2.68 -        factory(target, require);
    2.69 -    } else if (typeof define === 'function' && define['amd']) {
    2.70 -        // [2] AMD anonymous module
    2.71 -        define(['exports', 'require'], factory);
    2.72 -    } else {
    2.73 -        // [3] No module loader (plain <script> tag) - put directly in global namespace
    2.74 -        factory(window['ko'] = {});
    2.75 -    }
    2.76 -}(function(koExports, require){
    2.77 -// Internally, all KO objects are attached to koExports (even the non-exported ones whose names will be minified by the closure compiler).
    2.78 -// In the future, the following "ko" variable may be made distinct from "koExports" so that private objects are not externally reachable.
    2.79 -var ko = typeof koExports !== 'undefined' ? koExports : {};
    2.80 -// Google Closure Compiler helpers (used only to make the minified file smaller)
    2.81 -ko.exportSymbol = function(koPath, object) {
    2.82 -    var tokens = koPath.split(".");
    2.83 -
    2.84 -    // In the future, "ko" may become distinct from "koExports" (so that non-exported objects are not reachable)
    2.85 -    // At that point, "target" would be set to: (typeof koExports !== "undefined" ? koExports : ko)
    2.86 -    var target = ko;
    2.87 -
    2.88 -    for (var i = 0; i < tokens.length - 1; i++)
    2.89 -        target = target[tokens[i]];
    2.90 -    target[tokens[tokens.length - 1]] = object;
    2.91 -};
    2.92 -ko.exportProperty = function(owner, publicName, object) {
    2.93 -    owner[publicName] = object;
    2.94 -};
    2.95 -ko.version = "3.2.0";
    2.96 -
    2.97 -ko.exportSymbol('version', ko.version);
    2.98 -ko.utils = (function () {
    2.99 -    function objectForEach(obj, action) {
   2.100 -        for (var prop in obj) {
   2.101 -            if (obj.hasOwnProperty(prop)) {
   2.102 -                action(prop, obj[prop]);
   2.103 -            }
   2.104 -        }
   2.105 -    }
   2.106 -
   2.107 -    function extend(target, source) {
   2.108 -        if (source) {
   2.109 -            for(var prop in source) {
   2.110 -                if(source.hasOwnProperty(prop)) {
   2.111 -                    target[prop] = source[prop];
   2.112 -                }
   2.113 -            }
   2.114 -        }
   2.115 -        return target;
   2.116 -    }
   2.117 -
   2.118 -    function setPrototypeOf(obj, proto) {
   2.119 -        obj.__proto__ = proto;
   2.120 -        return obj;
   2.121 -    }
   2.122 -
   2.123 -    var canSetPrototype = ({ __proto__: [] } instanceof Array);
   2.124 -
   2.125 -    // 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)
   2.126 -    var knownEvents = {}, knownEventTypesByEventName = {};
   2.127 -    var keyEventTypeName = (navigator && /Firefox\/2/i.test(navigator.userAgent)) ? 'KeyboardEvent' : 'UIEvents';
   2.128 -    knownEvents[keyEventTypeName] = ['keyup', 'keydown', 'keypress'];
   2.129 -    knownEvents['MouseEvents'] = ['click', 'dblclick', 'mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave'];
   2.130 -    objectForEach(knownEvents, function(eventType, knownEventsForType) {
   2.131 -        if (knownEventsForType.length) {
   2.132 -            for (var i = 0, j = knownEventsForType.length; i < j; i++)
   2.133 -                knownEventTypesByEventName[knownEventsForType[i]] = eventType;
   2.134 -        }
   2.135 -    });
   2.136 -    var eventsThatMustBeRegisteredUsingAttachEvent = { 'propertychange': true }; // Workaround for an IE9 issue - https://github.com/SteveSanderson/knockout/issues/406
   2.137 -
   2.138 -    // Detect IE versions for bug workarounds (uses IE conditionals, not UA string, for robustness)
   2.139 -    // Note that, since IE 10 does not support conditional comments, the following logic only detects IE < 10.
   2.140 -    // Currently this is by design, since IE 10+ behaves correctly when treated as a standard browser.
   2.141 -    // If there is a future need to detect specific versions of IE10+, we will amend this.
   2.142 -    var ieVersion = document && (function() {
   2.143 -        var version = 3, div = document.createElement('div'), iElems = div.getElementsByTagName('i');
   2.144 -
   2.145 -        // Keep constructing conditional HTML blocks until we hit one that resolves to an empty fragment
   2.146 -        while (
   2.147 -            div.innerHTML = '<!--[if gt IE ' + (++version) + ']><i></i><![endif]-->',
   2.148 -            iElems[0]
   2.149 -        ) {}
   2.150 -        return version > 4 ? version : undefined;
   2.151 -    }());
   2.152 -    var isIe6 = ieVersion === 6,
   2.153 -        isIe7 = ieVersion === 7;
   2.154 -
   2.155 -    function isClickOnCheckableElement(element, eventType) {
   2.156 -        if ((ko.utils.tagNameLower(element) !== "input") || !element.type) return false;
   2.157 -        if (eventType.toLowerCase() != "click") return false;
   2.158 -        var inputType = element.type;
   2.159 -        return (inputType == "checkbox") || (inputType == "radio");
   2.160 -    }
   2.161 -
   2.162 -    return {
   2.163 -        fieldsIncludedWithJsonPost: ['authenticity_token', /^__RequestVerificationToken(_.*)?$/],
   2.164 -
   2.165 -        arrayForEach: function (array, action) {
   2.166 -            for (var i = 0, j = array.length; i < j; i++)
   2.167 -                action(array[i], i);
   2.168 -        },
   2.169 -
   2.170 -        arrayIndexOf: function (array, item) {
   2.171 -            if (typeof Array.prototype.indexOf == "function")
   2.172 -                return Array.prototype.indexOf.call(array, item);
   2.173 -            for (var i = 0, j = array.length; i < j; i++)
   2.174 -                if (array[i] === item)
   2.175 -                    return i;
   2.176 -            return -1;
   2.177 -        },
   2.178 -
   2.179 -        arrayFirst: function (array, predicate, predicateOwner) {
   2.180 -            for (var i = 0, j = array.length; i < j; i++)
   2.181 -                if (predicate.call(predicateOwner, array[i], i))
   2.182 -                    return array[i];
   2.183 -            return null;
   2.184 -        },
   2.185 -
   2.186 -        arrayRemoveItem: function (array, itemToRemove) {
   2.187 -            var index = ko.utils.arrayIndexOf(array, itemToRemove);
   2.188 -            if (index > 0) {
   2.189 -                array.splice(index, 1);
   2.190 -            }
   2.191 -            else if (index === 0) {
   2.192 -                array.shift();
   2.193 -            }
   2.194 -        },
   2.195 -
   2.196 -        arrayGetDistinctValues: function (array) {
   2.197 -            array = array || [];
   2.198 -            var result = [];
   2.199 -            for (var i = 0, j = array.length; i < j; i++) {
   2.200 -                if (ko.utils.arrayIndexOf(result, array[i]) < 0)
   2.201 -                    result.push(array[i]);
   2.202 -            }
   2.203 -            return result;
   2.204 -        },
   2.205 -
   2.206 -        arrayMap: function (array, mapping) {
   2.207 -            array = array || [];
   2.208 -            var result = [];
   2.209 -            for (var i = 0, j = array.length; i < j; i++)
   2.210 -                result.push(mapping(array[i], i));
   2.211 -            return result;
   2.212 -        },
   2.213 -
   2.214 -        arrayFilter: function (array, predicate) {
   2.215 -            array = array || [];
   2.216 -            var result = [];
   2.217 -            for (var i = 0, j = array.length; i < j; i++)
   2.218 -                if (predicate(array[i], i))
   2.219 -                    result.push(array[i]);
   2.220 -            return result;
   2.221 -        },
   2.222 -
   2.223 -        arrayPushAll: function (array, valuesToPush) {
   2.224 -            if (valuesToPush instanceof Array)
   2.225 -                array.push.apply(array, valuesToPush);
   2.226 -            else
   2.227 -                for (var i = 0, j = valuesToPush.length; i < j; i++)
   2.228 -                    array.push(valuesToPush[i]);
   2.229 -            return array;
   2.230 -        },
   2.231 -
   2.232 -        addOrRemoveItem: function(array, value, included) {
   2.233 -            var existingEntryIndex = ko.utils.arrayIndexOf(ko.utils.peekObservable(array), value);
   2.234 -            if (existingEntryIndex < 0) {
   2.235 -                if (included)
   2.236 -                    array.push(value);
   2.237 -            } else {
   2.238 -                if (!included)
   2.239 -                    array.splice(existingEntryIndex, 1);
   2.240 -            }
   2.241 -        },
   2.242 -
   2.243 -        canSetPrototype: canSetPrototype,
   2.244 -
   2.245 -        extend: extend,
   2.246 -
   2.247 -        setPrototypeOf: setPrototypeOf,
   2.248 -
   2.249 -        setPrototypeOfOrExtend: canSetPrototype ? setPrototypeOf : extend,
   2.250 -
   2.251 -        objectForEach: objectForEach,
   2.252 -
   2.253 -        objectMap: function(source, mapping) {
   2.254 -            if (!source)
   2.255 -                return source;
   2.256 -            var target = {};
   2.257 -            for (var prop in source) {
   2.258 -                if (source.hasOwnProperty(prop)) {
   2.259 -                    target[prop] = mapping(source[prop], prop, source);
   2.260 -                }
   2.261 -            }
   2.262 -            return target;
   2.263 -        },
   2.264 -
   2.265 -        emptyDomNode: function (domNode) {
   2.266 -            while (domNode.firstChild) {
   2.267 -                ko.removeNode(domNode.firstChild);
   2.268 -            }
   2.269 -        },
   2.270 -
   2.271 -        moveCleanedNodesToContainerElement: function(nodes) {
   2.272 -            // Ensure it's a real array, as we're about to reparent the nodes and
   2.273 -            // we don't want the underlying collection to change while we're doing that.
   2.274 -            var nodesArray = ko.utils.makeArray(nodes);
   2.275 -
   2.276 -            var container = document.createElement('div');
   2.277 -            for (var i = 0, j = nodesArray.length; i < j; i++) {
   2.278 -                container.appendChild(ko.cleanNode(nodesArray[i]));
   2.279 -            }
   2.280 -            return container;
   2.281 -        },
   2.282 -
   2.283 -        cloneNodes: function (nodesArray, shouldCleanNodes) {
   2.284 -            for (var i = 0, j = nodesArray.length, newNodesArray = []; i < j; i++) {
   2.285 -                var clonedNode = nodesArray[i].cloneNode(true);
   2.286 -                newNodesArray.push(shouldCleanNodes ? ko.cleanNode(clonedNode) : clonedNode);
   2.287 -            }
   2.288 -            return newNodesArray;
   2.289 -        },
   2.290 -
   2.291 -        setDomNodeChildren: function (domNode, childNodes) {
   2.292 -            ko.utils.emptyDomNode(domNode);
   2.293 -            if (childNodes) {
   2.294 -                for (var i = 0, j = childNodes.length; i < j; i++)
   2.295 -                    domNode.appendChild(childNodes[i]);
   2.296 -            }
   2.297 -        },
   2.298 -
   2.299 -        replaceDomNodes: function (nodeToReplaceOrNodeArray, newNodesArray) {
   2.300 -            var nodesToReplaceArray = nodeToReplaceOrNodeArray.nodeType ? [nodeToReplaceOrNodeArray] : nodeToReplaceOrNodeArray;
   2.301 -            if (nodesToReplaceArray.length > 0) {
   2.302 -                var insertionPoint = nodesToReplaceArray[0];
   2.303 -                var parent = insertionPoint.parentNode;
   2.304 -                for (var i = 0, j = newNodesArray.length; i < j; i++)
   2.305 -                    parent.insertBefore(newNodesArray[i], insertionPoint);
   2.306 -                for (var i = 0, j = nodesToReplaceArray.length; i < j; i++) {
   2.307 -                    ko.removeNode(nodesToReplaceArray[i]);
   2.308 -                }
   2.309 -            }
   2.310 -        },
   2.311 -
   2.312 -        fixUpContinuousNodeArray: function(continuousNodeArray, parentNode) {
   2.313 -            // Before acting on a set of nodes that were previously outputted by a template function, we have to reconcile
   2.314 -            // them against what is in the DOM right now. It may be that some of the nodes have already been removed, or that
   2.315 -            // new nodes might have been inserted in the middle, for example by a binding. Also, there may previously have been
   2.316 -            // leading comment nodes (created by rewritten string-based templates) that have since been removed during binding.
   2.317 -            // So, this function translates the old "map" output array into its best guess of the set of current DOM nodes.
   2.318 -            //
   2.319 -            // Rules:
   2.320 -            //   [A] Any leading nodes that have been removed should be ignored
   2.321 -            //       These most likely correspond to memoization nodes that were already removed during binding
   2.322 -            //       See https://github.com/SteveSanderson/knockout/pull/440
   2.323 -            //   [B] We want to output a continuous series of nodes. So, ignore any nodes that have already been removed,
   2.324 -            //       and include any nodes that have been inserted among the previous collection
   2.325 -
   2.326 -            if (continuousNodeArray.length) {
   2.327 -                // The parent node can be a virtual element; so get the real parent node
   2.328 -                parentNode = (parentNode.nodeType === 8 && parentNode.parentNode) || parentNode;
   2.329 -
   2.330 -                // Rule [A]
   2.331 -                while (continuousNodeArray.length && continuousNodeArray[0].parentNode !== parentNode)
   2.332 -                    continuousNodeArray.shift();
   2.333 -
   2.334 -                // Rule [B]
   2.335 -                if (continuousNodeArray.length > 1) {
   2.336 -                    var current = continuousNodeArray[0], last = continuousNodeArray[continuousNodeArray.length - 1];
   2.337 -                    // Replace with the actual new continuous node set
   2.338 -                    continuousNodeArray.length = 0;
   2.339 -                    while (current !== last) {
   2.340 -                        continuousNodeArray.push(current);
   2.341 -                        current = current.nextSibling;
   2.342 -                        if (!current) // Won't happen, except if the developer has manually removed some DOM elements (then we're in an undefined scenario)
   2.343 -                            return;
   2.344 -                    }
   2.345 -                    continuousNodeArray.push(last);
   2.346 -                }
   2.347 -            }
   2.348 -            return continuousNodeArray;
   2.349 -        },
   2.350 -
   2.351 -        setOptionNodeSelectionState: function (optionNode, isSelected) {
   2.352 -            // IE6 sometimes throws "unknown error" if you try to write to .selected directly, whereas Firefox struggles with setAttribute. Pick one based on browser.
   2.353 -            if (ieVersion < 7)
   2.354 -                optionNode.setAttribute("selected", isSelected);
   2.355 -            else
   2.356 -                optionNode.selected = isSelected;
   2.357 -        },
   2.358 -
   2.359 -        stringTrim: function (string) {
   2.360 -            return string === null || string === undefined ? '' :
   2.361 -                string.trim ?
   2.362 -                    string.trim() :
   2.363 -                    string.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, '');
   2.364 -        },
   2.365 -
   2.366 -        stringStartsWith: function (string, startsWith) {
   2.367 -            string = string || "";
   2.368 -            if (startsWith.length > string.length)
   2.369 -                return false;
   2.370 -            return string.substring(0, startsWith.length) === startsWith;
   2.371 -        },
   2.372 -
   2.373 -        domNodeIsContainedBy: function (node, containedByNode) {
   2.374 -            if (node === containedByNode)
   2.375 -                return true;
   2.376 -            if (node.nodeType === 11)
   2.377 -                return false; // Fixes issue #1162 - can't use node.contains for document fragments on IE8
   2.378 -            if (containedByNode.contains)
   2.379 -                return containedByNode.contains(node.nodeType === 3 ? node.parentNode : node);
   2.380 -            if (containedByNode.compareDocumentPosition)
   2.381 -                return (containedByNode.compareDocumentPosition(node) & 16) == 16;
   2.382 -            while (node && node != containedByNode) {
   2.383 -                node = node.parentNode;
   2.384 -            }
   2.385 -            return !!node;
   2.386 -        },
   2.387 -
   2.388 -        domNodeIsAttachedToDocument: function (node) {
   2.389 -            return ko.utils.domNodeIsContainedBy(node, node.ownerDocument.documentElement);
   2.390 -        },
   2.391 -
   2.392 -        anyDomNodeIsAttachedToDocument: function(nodes) {
   2.393 -            return !!ko.utils.arrayFirst(nodes, ko.utils.domNodeIsAttachedToDocument);
   2.394 -        },
   2.395 -
   2.396 -        tagNameLower: function(element) {
   2.397 -            // For HTML elements, tagName will always be upper case; for XHTML elements, it'll be lower case.
   2.398 -            // Possible future optimization: If we know it's an element from an XHTML document (not HTML),
   2.399 -            // we don't need to do the .toLowerCase() as it will always be lower case anyway.
   2.400 -            return element && element.tagName && element.tagName.toLowerCase();
   2.401 -        },
   2.402 -
   2.403 -        registerEventHandler: function (element, eventType, handler) {
   2.404 -            var mustUseAttachEvent = ieVersion && eventsThatMustBeRegisteredUsingAttachEvent[eventType];
   2.405 -            if (!mustUseAttachEvent && jQueryInstance) {
   2.406 -                jQueryInstance(element)['bind'](eventType, handler);
   2.407 -            } else if (!mustUseAttachEvent && typeof element.addEventListener == "function")
   2.408 -                element.addEventListener(eventType, handler, false);
   2.409 -            else if (typeof element.attachEvent != "undefined") {
   2.410 -                var attachEventHandler = function (event) { handler.call(element, event); },
   2.411 -                    attachEventName = "on" + eventType;
   2.412 -                element.attachEvent(attachEventName, attachEventHandler);
   2.413 -
   2.414 -                // IE does not dispose attachEvent handlers automatically (unlike with addEventListener)
   2.415 -                // so to avoid leaks, we have to remove them manually. See bug #856
   2.416 -                ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
   2.417 -                    element.detachEvent(attachEventName, attachEventHandler);
   2.418 -                });
   2.419 -            } else
   2.420 -                throw new Error("Browser doesn't support addEventListener or attachEvent");
   2.421 -        },
   2.422 -
   2.423 -        triggerEvent: function (element, eventType) {
   2.424 -            if (!(element && element.nodeType))
   2.425 -                throw new Error("element must be a DOM node when calling triggerEvent");
   2.426 -
   2.427 -            // For click events on checkboxes and radio buttons, jQuery toggles the element checked state *after* the
   2.428 -            // event handler runs instead of *before*. (This was fixed in 1.9 for checkboxes but not for radio buttons.)
   2.429 -            // IE doesn't change the checked state when you trigger the click event using "fireEvent".
   2.430 -            // In both cases, we'll use the click method instead.
   2.431 -            var useClickWorkaround = isClickOnCheckableElement(element, eventType);
   2.432 -
   2.433 -            if (jQueryInstance && !useClickWorkaround) {
   2.434 -                jQueryInstance(element)['trigger'](eventType);
   2.435 -            } else if (typeof document.createEvent == "function") {
   2.436 -                if (typeof element.dispatchEvent == "function") {
   2.437 -                    var eventCategory = knownEventTypesByEventName[eventType] || "HTMLEvents";
   2.438 -                    var event = document.createEvent(eventCategory);
   2.439 -                    event.initEvent(eventType, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, element);
   2.440 -                    element.dispatchEvent(event);
   2.441 -                }
   2.442 -                else
   2.443 -                    throw new Error("The supplied element doesn't support dispatchEvent");
   2.444 -            } else if (useClickWorkaround && element.click) {
   2.445 -                element.click();
   2.446 -            } else if (typeof element.fireEvent != "undefined") {
   2.447 -                element.fireEvent("on" + eventType);
   2.448 -            } else {
   2.449 -                throw new Error("Browser doesn't support triggering events");
   2.450 -            }
   2.451 -        },
   2.452 -
   2.453 -        unwrapObservable: function (value) {
   2.454 -            return ko.isObservable(value) ? value() : value;
   2.455 -        },
   2.456 -
   2.457 -        peekObservable: function (value) {
   2.458 -            return ko.isObservable(value) ? value.peek() : value;
   2.459 -        },
   2.460 -
   2.461 -        toggleDomNodeCssClass: function (node, classNames, shouldHaveClass) {
   2.462 -            if (classNames) {
   2.463 -                var cssClassNameRegex = /\S+/g,
   2.464 -                    currentClassNames = node.className.match(cssClassNameRegex) || [];
   2.465 -                ko.utils.arrayForEach(classNames.match(cssClassNameRegex), function(className) {
   2.466 -                    ko.utils.addOrRemoveItem(currentClassNames, className, shouldHaveClass);
   2.467 -                });
   2.468 -                node.className = currentClassNames.join(" ");
   2.469 -            }
   2.470 -        },
   2.471 -
   2.472 -        setTextContent: function(element, textContent) {
   2.473 -            var value = ko.utils.unwrapObservable(textContent);
   2.474 -            if ((value === null) || (value === undefined))
   2.475 -                value = "";
   2.476 -
   2.477 -            // We need there to be exactly one child: a text node.
   2.478 -            // If there are no children, more than one, or if it's not a text node,
   2.479 -            // we'll clear everything and create a single text node.
   2.480 -            var innerTextNode = ko.virtualElements.firstChild(element);
   2.481 -            if (!innerTextNode || innerTextNode.nodeType != 3 || ko.virtualElements.nextSibling(innerTextNode)) {
   2.482 -                ko.virtualElements.setDomNodeChildren(element, [element.ownerDocument.createTextNode(value)]);
   2.483 -            } else {
   2.484 -                innerTextNode.data = value;
   2.485 -            }
   2.486 -
   2.487 -            ko.utils.forceRefresh(element);
   2.488 -        },
   2.489 -
   2.490 -        setElementName: function(element, name) {
   2.491 -            element.name = name;
   2.492 -
   2.493 -            // Workaround IE 6/7 issue
   2.494 -            // - https://github.com/SteveSanderson/knockout/issues/197
   2.495 -            // - http://www.matts411.com/post/setting_the_name_attribute_in_ie_dom/
   2.496 -            if (ieVersion <= 7) {
   2.497 -                try {
   2.498 -                    element.mergeAttributes(document.createElement("<input name='" + element.name + "'/>"), false);
   2.499 -                }
   2.500 -                catch(e) {} // For IE9 with doc mode "IE9 Standards" and browser mode "IE9 Compatibility View"
   2.501 -            }
   2.502 -        },
   2.503 -
   2.504 -        forceRefresh: function(node) {
   2.505 -            // Workaround for an IE9 rendering bug - https://github.com/SteveSanderson/knockout/issues/209
   2.506 -            if (ieVersion >= 9) {
   2.507 -                // For text nodes and comment nodes (most likely virtual elements), we will have to refresh the container
   2.508 -                var elem = node.nodeType == 1 ? node : node.parentNode;
   2.509 -                if (elem.style)
   2.510 -                    elem.style.zoom = elem.style.zoom;
   2.511 -            }
   2.512 -        },
   2.513 -
   2.514 -        ensureSelectElementIsRenderedCorrectly: function(selectElement) {
   2.515 -            // 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.
   2.516 -            // (See https://github.com/SteveSanderson/knockout/issues/312, http://stackoverflow.com/questions/5908494/select-only-shows-first-char-of-selected-option)
   2.517 -            // Also fixes IE7 and IE8 bug that causes selects to be zero width if enclosed by 'if' or 'with'. (See issue #839)
   2.518 -            if (ieVersion) {
   2.519 -                var originalWidth = selectElement.style.width;
   2.520 -                selectElement.style.width = 0;
   2.521 -                selectElement.style.width = originalWidth;
   2.522 -            }
   2.523 -        },
   2.524 -
   2.525 -        range: function (min, max) {
   2.526 -            min = ko.utils.unwrapObservable(min);
   2.527 -            max = ko.utils.unwrapObservable(max);
   2.528 -            var result = [];
   2.529 -            for (var i = min; i <= max; i++)
   2.530 -                result.push(i);
   2.531 -            return result;
   2.532 -        },
   2.533 -
   2.534 -        makeArray: function(arrayLikeObject) {
   2.535 -            var result = [];
   2.536 -            for (var i = 0, j = arrayLikeObject.length; i < j; i++) {
   2.537 -                result.push(arrayLikeObject[i]);
   2.538 -            };
   2.539 -            return result;
   2.540 -        },
   2.541 -
   2.542 -        isIe6 : isIe6,
   2.543 -        isIe7 : isIe7,
   2.544 -        ieVersion : ieVersion,
   2.545 -
   2.546 -        getFormFields: function(form, fieldName) {
   2.547 -            var fields = ko.utils.makeArray(form.getElementsByTagName("input")).concat(ko.utils.makeArray(form.getElementsByTagName("textarea")));
   2.548 -            var isMatchingField = (typeof fieldName == 'string')
   2.549 -                ? function(field) { return field.name === fieldName }
   2.550 -                : function(field) { return fieldName.test(field.name) }; // Treat fieldName as regex or object containing predicate
   2.551 -            var matches = [];
   2.552 -            for (var i = fields.length - 1; i >= 0; i--) {
   2.553 -                if (isMatchingField(fields[i]))
   2.554 -                    matches.push(fields[i]);
   2.555 -            };
   2.556 -            return matches;
   2.557 -        },
   2.558 -
   2.559 -        parseJson: function (jsonString) {
   2.560 -            if (typeof jsonString == "string") {
   2.561 -                jsonString = ko.utils.stringTrim(jsonString);
   2.562 -                if (jsonString) {
   2.563 -                    if (JSON && JSON.parse) // Use native parsing where available
   2.564 -                        return JSON.parse(jsonString);
   2.565 -                    return (new Function("return " + jsonString))(); // Fallback on less safe parsing for older browsers
   2.566 -                }
   2.567 -            }
   2.568 -            return null;
   2.569 -        },
   2.570 -
   2.571 -        stringifyJson: function (data, replacer, space) {   // replacer and space are optional
   2.572 -            if (!JSON || !JSON.stringify)
   2.573 -                throw new Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");
   2.574 -            return JSON.stringify(ko.utils.unwrapObservable(data), replacer, space);
   2.575 -        },
   2.576 -
   2.577 -        postJson: function (urlOrForm, data, options) {
   2.578 -            options = options || {};
   2.579 -            var params = options['params'] || {};
   2.580 -            var includeFields = options['includeFields'] || this.fieldsIncludedWithJsonPost;
   2.581 -            var url = urlOrForm;
   2.582 -
   2.583 -            // If we were given a form, use its 'action' URL and pick out any requested field values
   2.584 -            if((typeof urlOrForm == 'object') && (ko.utils.tagNameLower(urlOrForm) === "form")) {
   2.585 -                var originalForm = urlOrForm;
   2.586 -                url = originalForm.action;
   2.587 -                for (var i = includeFields.length - 1; i >= 0; i--) {
   2.588 -                    var fields = ko.utils.getFormFields(originalForm, includeFields[i]);
   2.589 -                    for (var j = fields.length - 1; j >= 0; j--)
   2.590 -                        params[fields[j].name] = fields[j].value;
   2.591 -                }
   2.592 -            }
   2.593 -
   2.594 -            data = ko.utils.unwrapObservable(data);
   2.595 -            var form = document.createElement("form");
   2.596 -            form.style.display = "none";
   2.597 -            form.action = url;
   2.598 -            form.method = "post";
   2.599 -            for (var key in data) {
   2.600 -                // Since 'data' this is a model object, we include all properties including those inherited from its prototype
   2.601 -                var input = document.createElement("input");
   2.602 -                input.type = "hidden";
   2.603 -                input.name = key;
   2.604 -                input.value = ko.utils.stringifyJson(ko.utils.unwrapObservable(data[key]));
   2.605 -                form.appendChild(input);
   2.606 -            }
   2.607 -            objectForEach(params, function(key, value) {
   2.608 -                var input = document.createElement("input");
   2.609 -                input.type = "hidden";
   2.610 -                input.name = key;
   2.611 -                input.value = value;
   2.612 -                form.appendChild(input);
   2.613 -            });
   2.614 -            document.body.appendChild(form);
   2.615 -            options['submitter'] ? options['submitter'](form) : form.submit();
   2.616 -            setTimeout(function () { form.parentNode.removeChild(form); }, 0);
   2.617 -        }
   2.618 -    }
   2.619 -}());
   2.620 -
   2.621 -ko.exportSymbol('utils', ko.utils);
   2.622 -ko.exportSymbol('utils.arrayForEach', ko.utils.arrayForEach);
   2.623 -ko.exportSymbol('utils.arrayFirst', ko.utils.arrayFirst);
   2.624 -ko.exportSymbol('utils.arrayFilter', ko.utils.arrayFilter);
   2.625 -ko.exportSymbol('utils.arrayGetDistinctValues', ko.utils.arrayGetDistinctValues);
   2.626 -ko.exportSymbol('utils.arrayIndexOf', ko.utils.arrayIndexOf);
   2.627 -ko.exportSymbol('utils.arrayMap', ko.utils.arrayMap);
   2.628 -ko.exportSymbol('utils.arrayPushAll', ko.utils.arrayPushAll);
   2.629 -ko.exportSymbol('utils.arrayRemoveItem', ko.utils.arrayRemoveItem);
   2.630 -ko.exportSymbol('utils.extend', ko.utils.extend);
   2.631 -ko.exportSymbol('utils.fieldsIncludedWithJsonPost', ko.utils.fieldsIncludedWithJsonPost);
   2.632 -ko.exportSymbol('utils.getFormFields', ko.utils.getFormFields);
   2.633 -ko.exportSymbol('utils.peekObservable', ko.utils.peekObservable);
   2.634 -ko.exportSymbol('utils.postJson', ko.utils.postJson);
   2.635 -ko.exportSymbol('utils.parseJson', ko.utils.parseJson);
   2.636 -ko.exportSymbol('utils.registerEventHandler', ko.utils.registerEventHandler);
   2.637 -ko.exportSymbol('utils.stringifyJson', ko.utils.stringifyJson);
   2.638 -ko.exportSymbol('utils.range', ko.utils.range);
   2.639 -ko.exportSymbol('utils.toggleDomNodeCssClass', ko.utils.toggleDomNodeCssClass);
   2.640 -ko.exportSymbol('utils.triggerEvent', ko.utils.triggerEvent);
   2.641 -ko.exportSymbol('utils.unwrapObservable', ko.utils.unwrapObservable);
   2.642 -ko.exportSymbol('utils.objectForEach', ko.utils.objectForEach);
   2.643 -ko.exportSymbol('utils.addOrRemoveItem', ko.utils.addOrRemoveItem);
   2.644 -ko.exportSymbol('unwrap', ko.utils.unwrapObservable); // Convenient shorthand, because this is used so commonly
   2.645 -
   2.646 -if (!Function.prototype['bind']) {
   2.647 -    // Function.prototype.bind is a standard part of ECMAScript 5th Edition (December 2009, http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf)
   2.648 -    // In case the browser doesn't implement it natively, provide a JavaScript implementation. This implementation is based on the one in prototype.js
   2.649 -    Function.prototype['bind'] = function (object) {
   2.650 -        var originalFunction = this, args = Array.prototype.slice.call(arguments), object = args.shift();
   2.651 -        return function () {
   2.652 -            return originalFunction.apply(object, args.concat(Array.prototype.slice.call(arguments)));
   2.653 -        };
   2.654 -    };
   2.655 -}
   2.656 -
   2.657 -ko.utils.domData = new (function () {
   2.658 -    var uniqueId = 0;
   2.659 -    var dataStoreKeyExpandoPropertyName = "__ko__" + (new Date).getTime();
   2.660 -    var dataStore = {};
   2.661 -
   2.662 -    function getAll(node, createIfNotFound) {
   2.663 -        var dataStoreKey = node[dataStoreKeyExpandoPropertyName];
   2.664 -        var hasExistingDataStore = dataStoreKey && (dataStoreKey !== "null") && dataStore[dataStoreKey];
   2.665 -        if (!hasExistingDataStore) {
   2.666 -            if (!createIfNotFound)
   2.667 -                return undefined;
   2.668 -            dataStoreKey = node[dataStoreKeyExpandoPropertyName] = "ko" + uniqueId++;
   2.669 -            dataStore[dataStoreKey] = {};
   2.670 -        }
   2.671 -        return dataStore[dataStoreKey];
   2.672 -    }
   2.673 -
   2.674 -    return {
   2.675 -        get: function (node, key) {
   2.676 -            var allDataForNode = getAll(node, false);
   2.677 -            return allDataForNode === undefined ? undefined : allDataForNode[key];
   2.678 -        },
   2.679 -        set: function (node, key, value) {
   2.680 -            if (value === undefined) {
   2.681 -                // Make sure we don't actually create a new domData key if we are actually deleting a value
   2.682 -                if (getAll(node, false) === undefined)
   2.683 -                    return;
   2.684 -            }
   2.685 -            var allDataForNode = getAll(node, true);
   2.686 -            allDataForNode[key] = value;
   2.687 -        },
   2.688 -        clear: function (node) {
   2.689 -            var dataStoreKey = node[dataStoreKeyExpandoPropertyName];
   2.690 -            if (dataStoreKey) {
   2.691 -                delete dataStore[dataStoreKey];
   2.692 -                node[dataStoreKeyExpandoPropertyName] = null;
   2.693 -                return true; // Exposing "did clean" flag purely so specs can infer whether things have been cleaned up as intended
   2.694 -            }
   2.695 -            return false;
   2.696 -        },
   2.697 -
   2.698 -        nextKey: function () {
   2.699 -            return (uniqueId++) + dataStoreKeyExpandoPropertyName;
   2.700 -        }
   2.701 -    };
   2.702 -})();
   2.703 -
   2.704 -ko.exportSymbol('utils.domData', ko.utils.domData);
   2.705 -ko.exportSymbol('utils.domData.clear', ko.utils.domData.clear); // Exporting only so specs can clear up after themselves fully
   2.706 -
   2.707 -ko.utils.domNodeDisposal = new (function () {
   2.708 -    var domDataKey = ko.utils.domData.nextKey();
   2.709 -    var cleanableNodeTypes = { 1: true, 8: true, 9: true };       // Element, Comment, Document
   2.710 -    var cleanableNodeTypesWithDescendants = { 1: true, 9: true }; // Element, Document
   2.711 -
   2.712 -    function getDisposeCallbacksCollection(node, createIfNotFound) {
   2.713 -        var allDisposeCallbacks = ko.utils.domData.get(node, domDataKey);
   2.714 -        if ((allDisposeCallbacks === undefined) && createIfNotFound) {
   2.715 -            allDisposeCallbacks = [];
   2.716 -            ko.utils.domData.set(node, domDataKey, allDisposeCallbacks);
   2.717 -        }
   2.718 -        return allDisposeCallbacks;
   2.719 -    }
   2.720 -    function destroyCallbacksCollection(node) {
   2.721 -        ko.utils.domData.set(node, domDataKey, undefined);
   2.722 -    }
   2.723 -
   2.724 -    function cleanSingleNode(node) {
   2.725 -        // Run all the dispose callbacks
   2.726 -        var callbacks = getDisposeCallbacksCollection(node, false);
   2.727 -        if (callbacks) {
   2.728 -            callbacks = callbacks.slice(0); // Clone, as the array may be modified during iteration (typically, callbacks will remove themselves)
   2.729 -            for (var i = 0; i < callbacks.length; i++)
   2.730 -                callbacks[i](node);
   2.731 -        }
   2.732 -
   2.733 -        // Erase the DOM data
   2.734 -        ko.utils.domData.clear(node);
   2.735 -
   2.736 -        // Perform cleanup needed by external libraries (currently only jQuery, but can be extended)
   2.737 -        ko.utils.domNodeDisposal["cleanExternalData"](node);
   2.738 -
   2.739 -        // Clear any immediate-child comment nodes, as these wouldn't have been found by
   2.740 -        // node.getElementsByTagName("*") in cleanNode() (comment nodes aren't elements)
   2.741 -        if (cleanableNodeTypesWithDescendants[node.nodeType])
   2.742 -            cleanImmediateCommentTypeChildren(node);
   2.743 -    }
   2.744 -
   2.745 -    function cleanImmediateCommentTypeChildren(nodeWithChildren) {
   2.746 -        var child, nextChild = nodeWithChildren.firstChild;
   2.747 -        while (child = nextChild) {
   2.748 -            nextChild = child.nextSibling;
   2.749 -            if (child.nodeType === 8)
   2.750 -                cleanSingleNode(child);
   2.751 -        }
   2.752 -    }
   2.753 -
   2.754 -    return {
   2.755 -        addDisposeCallback : function(node, callback) {
   2.756 -            if (typeof callback != "function")
   2.757 -                throw new Error("Callback must be a function");
   2.758 -            getDisposeCallbacksCollection(node, true).push(callback);
   2.759 -        },
   2.760 -
   2.761 -        removeDisposeCallback : function(node, callback) {
   2.762 -            var callbacksCollection = getDisposeCallbacksCollection(node, false);
   2.763 -            if (callbacksCollection) {
   2.764 -                ko.utils.arrayRemoveItem(callbacksCollection, callback);
   2.765 -                if (callbacksCollection.length == 0)
   2.766 -                    destroyCallbacksCollection(node);
   2.767 -            }
   2.768 -        },
   2.769 -
   2.770 -        cleanNode : function(node) {
   2.771 -            // First clean this node, where applicable
   2.772 -            if (cleanableNodeTypes[node.nodeType]) {
   2.773 -                cleanSingleNode(node);
   2.774 -
   2.775 -                // ... then its descendants, where applicable
   2.776 -                if (cleanableNodeTypesWithDescendants[node.nodeType]) {
   2.777 -                    // Clone the descendants list in case it changes during iteration
   2.778 -                    var descendants = [];
   2.779 -                    ko.utils.arrayPushAll(descendants, node.getElementsByTagName("*"));
   2.780 -                    for (var i = 0, j = descendants.length; i < j; i++)
   2.781 -                        cleanSingleNode(descendants[i]);
   2.782 -                }
   2.783 -            }
   2.784 -            return node;
   2.785 -        },
   2.786 -
   2.787 -        removeNode : function(node) {
   2.788 -            ko.cleanNode(node);
   2.789 -            if (node.parentNode)
   2.790 -                node.parentNode.removeChild(node);
   2.791 -        },
   2.792 -
   2.793 -        "cleanExternalData" : function (node) {
   2.794 -            // Special support for jQuery here because it's so commonly used.
   2.795 -            // Many jQuery plugins (including jquery.tmpl) store data using jQuery's equivalent of domData
   2.796 -            // so notify it to tear down any resources associated with the node & descendants here.
   2.797 -            if (jQueryInstance && (typeof jQueryInstance['cleanData'] == "function"))
   2.798 -                jQueryInstance['cleanData']([node]);
   2.799 -        }
   2.800 -    }
   2.801 -})();
   2.802 -ko.cleanNode = ko.utils.domNodeDisposal.cleanNode; // Shorthand name for convenience
   2.803 -ko.removeNode = ko.utils.domNodeDisposal.removeNode; // Shorthand name for convenience
   2.804 -ko.exportSymbol('cleanNode', ko.cleanNode);
   2.805 -ko.exportSymbol('removeNode', ko.removeNode);
   2.806 -ko.exportSymbol('utils.domNodeDisposal', ko.utils.domNodeDisposal);
   2.807 -ko.exportSymbol('utils.domNodeDisposal.addDisposeCallback', ko.utils.domNodeDisposal.addDisposeCallback);
   2.808 -ko.exportSymbol('utils.domNodeDisposal.removeDisposeCallback', ko.utils.domNodeDisposal.removeDisposeCallback);
   2.809 -(function () {
   2.810 -    var leadingCommentRegex = /^(\s*)<!--(.*?)-->/;
   2.811 -
   2.812 -    function simpleHtmlParse(html) {
   2.813 -        // Based on jQuery's "clean" function, but only accounting for table-related elements.
   2.814 -        // If you have referenced jQuery, this won't be used anyway - KO will use jQuery's "clean" function directly
   2.815 -
   2.816 -        // Note that there's still an issue in IE < 9 whereby it will discard comment nodes that are the first child of
   2.817 -        // a descendant node. For example: "<div><!-- mycomment -->abc</div>" will get parsed as "<div>abc</div>"
   2.818 -        // This won't affect anyone who has referenced jQuery, and there's always the workaround of inserting a dummy node
   2.819 -        // (possibly a text node) in front of the comment. So, KO does not attempt to workaround this IE issue automatically at present.
   2.820 -
   2.821 -        // Trim whitespace, otherwise indexOf won't work as expected
   2.822 -        var tags = ko.utils.stringTrim(html).toLowerCase(), div = document.createElement("div");
   2.823 -
   2.824 -        // Finds the first match from the left column, and returns the corresponding "wrap" data from the right column
   2.825 -        var wrap = tags.match(/^<(thead|tbody|tfoot)/)              && [1, "<table>", "</table>"] ||
   2.826 -                   !tags.indexOf("<tr")                             && [2, "<table><tbody>", "</tbody></table>"] ||
   2.827 -                   (!tags.indexOf("<td") || !tags.indexOf("<th"))   && [3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
   2.828 -                   /* anything else */                                 [0, "", ""];
   2.829 -
   2.830 -        // Go to html and back, then peel off extra wrappers
   2.831 -        // Note that we always prefix with some dummy text, because otherwise, IE<9 will strip out leading comment nodes in descendants. Total madness.
   2.832 -        var markup = "ignored<div>" + wrap[1] + html + wrap[2] + "</div>";
   2.833 -        if (typeof window['innerShiv'] == "function") {
   2.834 -            div.appendChild(window['innerShiv'](markup));
   2.835 -        } else {
   2.836 -            div.innerHTML = markup;
   2.837 -        }
   2.838 -
   2.839 -        // Move to the right depth
   2.840 -        while (wrap[0]--)
   2.841 -            div = div.lastChild;
   2.842 -
   2.843 -        return ko.utils.makeArray(div.lastChild.childNodes);
   2.844 -    }
   2.845 -
   2.846 -    function jQueryHtmlParse(html) {
   2.847 -        // jQuery's "parseHTML" function was introduced in jQuery 1.8.0 and is a documented public API.
   2.848 -        if (jQueryInstance['parseHTML']) {
   2.849 -            return jQueryInstance['parseHTML'](html) || []; // Ensure we always return an array and never null
   2.850 -        } else {
   2.851 -            // For jQuery < 1.8.0, we fall back on the undocumented internal "clean" function.
   2.852 -            var elems = jQueryInstance['clean']([html]);
   2.853 -
   2.854 -            // 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.
   2.855 -            // Unfortunately, it never clears the dummy parent nodes from the document fragment, so it leaks memory over time.
   2.856 -            // Fix this by finding the top-most dummy parent element, and detaching it from its owner fragment.
   2.857 -            if (elems && elems[0]) {
   2.858 -                // Find the top-most parent element that's a direct child of a document fragment
   2.859 -                var elem = elems[0];
   2.860 -                while (elem.parentNode && elem.parentNode.nodeType !== 11 /* i.e., DocumentFragment */)
   2.861 -                    elem = elem.parentNode;
   2.862 -                // ... then detach it
   2.863 -                if (elem.parentNode)
   2.864 -                    elem.parentNode.removeChild(elem);
   2.865 -            }
   2.866 -
   2.867 -            return elems;
   2.868 -        }
   2.869 -    }
   2.870 -
   2.871 -    ko.utils.parseHtmlFragment = function(html) {
   2.872 -        return jQueryInstance ? jQueryHtmlParse(html)   // As below, benefit from jQuery's optimisations where possible
   2.873 -                              : simpleHtmlParse(html);  // ... otherwise, this simple logic will do in most common cases.
   2.874 -    };
   2.875 -
   2.876 -    ko.utils.setHtml = function(node, html) {
   2.877 -        ko.utils.emptyDomNode(node);
   2.878 -
   2.879 -        // There's no legitimate reason to display a stringified observable without unwrapping it, so we'll unwrap it
   2.880 -        html = ko.utils.unwrapObservable(html);
   2.881 -
   2.882 -        if ((html !== null) && (html !== undefined)) {
   2.883 -            if (typeof html != 'string')
   2.884 -                html = html.toString();
   2.885 -
   2.886 -            // jQuery contains a lot of sophisticated code to parse arbitrary HTML fragments,
   2.887 -            // for example <tr> elements which are not normally allowed to exist on their own.
   2.888 -            // If you've referenced jQuery we'll use that rather than duplicating its code.
   2.889 -            if (jQueryInstance) {
   2.890 -                jQueryInstance(node)['html'](html);
   2.891 -            } else {
   2.892 -                // ... otherwise, use KO's own parsing logic.
   2.893 -                var parsedNodes = ko.utils.parseHtmlFragment(html);
   2.894 -                for (var i = 0; i < parsedNodes.length; i++)
   2.895 -                    node.appendChild(parsedNodes[i]);
   2.896 -            }
   2.897 -        }
   2.898 -    };
   2.899 -})();
   2.900 -
   2.901 -ko.exportSymbol('utils.parseHtmlFragment', ko.utils.parseHtmlFragment);
   2.902 -ko.exportSymbol('utils.setHtml', ko.utils.setHtml);
   2.903 -
   2.904 -ko.memoization = (function () {
   2.905 -    var memos = {};
   2.906 -
   2.907 -    function randomMax8HexChars() {
   2.908 -        return (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1);
   2.909 -    }
   2.910 -    function generateRandomId() {
   2.911 -        return randomMax8HexChars() + randomMax8HexChars();
   2.912 -    }
   2.913 -    function findMemoNodes(rootNode, appendToArray) {
   2.914 -        if (!rootNode)
   2.915 -            return;
   2.916 -        if (rootNode.nodeType == 8) {
   2.917 -            var memoId = ko.memoization.parseMemoText(rootNode.nodeValue);
   2.918 -            if (memoId != null)
   2.919 -                appendToArray.push({ domNode: rootNode, memoId: memoId });
   2.920 -        } else if (rootNode.nodeType == 1) {
   2.921 -            for (var i = 0, childNodes = rootNode.childNodes, j = childNodes.length; i < j; i++)
   2.922 -                findMemoNodes(childNodes[i], appendToArray);
   2.923 -        }
   2.924 -    }
   2.925 -
   2.926 -    return {
   2.927 -        memoize: function (callback) {
   2.928 -            if (typeof callback != "function")
   2.929 -                throw new Error("You can only pass a function to ko.memoization.memoize()");
   2.930 -            var memoId = generateRandomId();
   2.931 -            memos[memoId] = callback;
   2.932 -            return "<!--[ko_memo:" + memoId + "]-->";
   2.933 -        },
   2.934 -
   2.935 -        unmemoize: function (memoId, callbackParams) {
   2.936 -            var callback = memos[memoId];
   2.937 -            if (callback === undefined)
   2.938 -                throw new Error("Couldn't find any memo with ID " + memoId + ". Perhaps it's already been unmemoized.");
   2.939 -            try {
   2.940 -                callback.apply(null, callbackParams || []);
   2.941 -                return true;
   2.942 -            }
   2.943 -            finally { delete memos[memoId]; }
   2.944 -        },
   2.945 -
   2.946 -        unmemoizeDomNodeAndDescendants: function (domNode, extraCallbackParamsArray) {
   2.947 -            var memos = [];
   2.948 -            findMemoNodes(domNode, memos);
   2.949 -            for (var i = 0, j = memos.length; i < j; i++) {
   2.950 -                var node = memos[i].domNode;
   2.951 -                var combinedParams = [node];
   2.952 -                if (extraCallbackParamsArray)
   2.953 -                    ko.utils.arrayPushAll(combinedParams, extraCallbackParamsArray);
   2.954 -                ko.memoization.unmemoize(memos[i].memoId, combinedParams);
   2.955 -                node.nodeValue = ""; // Neuter this node so we don't try to unmemoize it again
   2.956 -                if (node.parentNode)
   2.957 -                    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)
   2.958 -            }
   2.959 -        },
   2.960 -
   2.961 -        parseMemoText: function (memoText) {
   2.962 -            var match = memoText.match(/^\[ko_memo\:(.*?)\]$/);
   2.963 -            return match ? match[1] : null;
   2.964 -        }
   2.965 -    };
   2.966 -})();
   2.967 -
   2.968 -ko.exportSymbol('memoization', ko.memoization);
   2.969 -ko.exportSymbol('memoization.memoize', ko.memoization.memoize);
   2.970 -ko.exportSymbol('memoization.unmemoize', ko.memoization.unmemoize);
   2.971 -ko.exportSymbol('memoization.parseMemoText', ko.memoization.parseMemoText);
   2.972 -ko.exportSymbol('memoization.unmemoizeDomNodeAndDescendants', ko.memoization.unmemoizeDomNodeAndDescendants);
   2.973 -ko.extenders = {
   2.974 -    'throttle': function(target, timeout) {
   2.975 -        // Throttling means two things:
   2.976 -
   2.977 -        // (1) For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies
   2.978 -        //     notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate
   2.979 -        target['throttleEvaluation'] = timeout;
   2.980 -
   2.981 -        // (2) For writable targets (observables, or writable dependent observables), we throttle *writes*
   2.982 -        //     so the target cannot change value synchronously or faster than a certain rate
   2.983 -        var writeTimeoutInstance = null;
   2.984 -        return ko.dependentObservable({
   2.985 -            'read': target,
   2.986 -            'write': function(value) {
   2.987 -                clearTimeout(writeTimeoutInstance);
   2.988 -                writeTimeoutInstance = setTimeout(function() {
   2.989 -                    target(value);
   2.990 -                }, timeout);
   2.991 -            }
   2.992 -        });
   2.993 -    },
   2.994 -
   2.995 -    'rateLimit': function(target, options) {
   2.996 -        var timeout, method, limitFunction;
   2.997 -
   2.998 -        if (typeof options == 'number') {
   2.999 -            timeout = options;
  2.1000 -        } else {
  2.1001 -            timeout = options['timeout'];
  2.1002 -            method = options['method'];
  2.1003 -        }
  2.1004 -
  2.1005 -        limitFunction = method == 'notifyWhenChangesStop' ?  debounce : throttle;
  2.1006 -        target.limit(function(callback) {
  2.1007 -            return limitFunction(callback, timeout);
  2.1008 -        });
  2.1009 -    },
  2.1010 -
  2.1011 -    'notify': function(target, notifyWhen) {
  2.1012 -        target["equalityComparer"] = notifyWhen == "always" ?
  2.1013 -            null :  // null equalityComparer means to always notify
  2.1014 -            valuesArePrimitiveAndEqual;
  2.1015 -    }
  2.1016 -};
  2.1017 -
  2.1018 -var primitiveTypes = { 'undefined':1, 'boolean':1, 'number':1, 'string':1 };
  2.1019 -function valuesArePrimitiveAndEqual(a, b) {
  2.1020 -    var oldValueIsPrimitive = (a === null) || (typeof(a) in primitiveTypes);
  2.1021 -    return oldValueIsPrimitive ? (a === b) : false;
  2.1022 -}
  2.1023 -
  2.1024 -function throttle(callback, timeout) {
  2.1025 -    var timeoutInstance;
  2.1026 -    return function () {
  2.1027 -        if (!timeoutInstance) {
  2.1028 -            timeoutInstance = setTimeout(function() {
  2.1029 -                timeoutInstance = undefined;
  2.1030 -                callback();
  2.1031 -            }, timeout);
  2.1032 -        }
  2.1033 -    };
  2.1034 -}
  2.1035 -
  2.1036 -function debounce(callback, timeout) {
  2.1037 -    var timeoutInstance;
  2.1038 -    return function () {
  2.1039 -        clearTimeout(timeoutInstance);
  2.1040 -        timeoutInstance = setTimeout(callback, timeout);
  2.1041 -    };
  2.1042 -}
  2.1043 -
  2.1044 -function applyExtenders(requestedExtenders) {
  2.1045 -    var target = this;
  2.1046 -    if (requestedExtenders) {
  2.1047 -        ko.utils.objectForEach(requestedExtenders, function(key, value) {
  2.1048 -            var extenderHandler = ko.extenders[key];
  2.1049 -            if (typeof extenderHandler == 'function') {
  2.1050 -                target = extenderHandler(target, value) || target;
  2.1051 -            }
  2.1052 -        });
  2.1053 -    }
  2.1054 -    return target;
  2.1055 -}
  2.1056 -
  2.1057 -ko.exportSymbol('extenders', ko.extenders);
  2.1058 -
  2.1059 -ko.subscription = function (target, callback, disposeCallback) {
  2.1060 -    this.target = target;
  2.1061 -    this.callback = callback;
  2.1062 -    this.disposeCallback = disposeCallback;
  2.1063 -    this.isDisposed = false;
  2.1064 -    ko.exportProperty(this, 'dispose', this.dispose);
  2.1065 -};
  2.1066 -ko.subscription.prototype.dispose = function () {
  2.1067 -    this.isDisposed = true;
  2.1068 -    this.disposeCallback();
  2.1069 -};
  2.1070 -
  2.1071 -ko.subscribable = function () {
  2.1072 -    ko.utils.setPrototypeOfOrExtend(this, ko.subscribable['fn']);
  2.1073 -    this._subscriptions = {};
  2.1074 -}
  2.1075 -
  2.1076 -var defaultEvent = "change";
  2.1077 -
  2.1078 -var ko_subscribable_fn = {
  2.1079 -    subscribe: function (callback, callbackTarget, event) {
  2.1080 -        var self = this;
  2.1081 -
  2.1082 -        event = event || defaultEvent;
  2.1083 -        var boundCallback = callbackTarget ? callback.bind(callbackTarget) : callback;
  2.1084 -
  2.1085 -        var subscription = new ko.subscription(self, boundCallback, function () {
  2.1086 -            ko.utils.arrayRemoveItem(self._subscriptions[event], subscription);
  2.1087 -            if (self.afterSubscriptionRemove)
  2.1088 -                self.afterSubscriptionRemove(event);
  2.1089 -        });
  2.1090 -
  2.1091 -        if (self.beforeSubscriptionAdd)
  2.1092 -            self.beforeSubscriptionAdd(event);
  2.1093 -
  2.1094 -        if (!self._subscriptions[event])
  2.1095 -            self._subscriptions[event] = [];
  2.1096 -        self._subscriptions[event].push(subscription);
  2.1097 -
  2.1098 -        return subscription;
  2.1099 -    },
  2.1100 -
  2.1101 -    "notifySubscribers": function (valueToNotify, event) {
  2.1102 -        event = event || defaultEvent;
  2.1103 -        if (this.hasSubscriptionsForEvent(event)) {
  2.1104 -            try {
  2.1105 -                ko.dependencyDetection.begin(); // Begin suppressing dependency detection (by setting the top frame to undefined)
  2.1106 -                for (var a = this._subscriptions[event].slice(0), i = 0, subscription; subscription = a[i]; ++i) {
  2.1107 -                    // In case a subscription was disposed during the arrayForEach cycle, check
  2.1108 -                    // for isDisposed on each subscription before invoking its callback
  2.1109 -                    if (!subscription.isDisposed)
  2.1110 -                        subscription.callback(valueToNotify);
  2.1111 -                }
  2.1112 -            } finally {
  2.1113 -                ko.dependencyDetection.end(); // End suppressing dependency detection
  2.1114 -            }
  2.1115 -        }
  2.1116 -    },
  2.1117 -
  2.1118 -    limit: function(limitFunction) {
  2.1119 -        var self = this, selfIsObservable = ko.isObservable(self),
  2.1120 -            isPending, previousValue, pendingValue, beforeChange = 'beforeChange';
  2.1121 -
  2.1122 -        if (!self._origNotifySubscribers) {
  2.1123 -            self._origNotifySubscribers = self["notifySubscribers"];
  2.1124 -            self["notifySubscribers"] = function(value, event) {
  2.1125 -                if (!event || event === defaultEvent) {
  2.1126 -                    self._rateLimitedChange(value);
  2.1127 -                } else if (event === beforeChange) {
  2.1128 -                    self._rateLimitedBeforeChange(value);
  2.1129 -                } else {
  2.1130 -                    self._origNotifySubscribers(value, event);
  2.1131 -                }
  2.1132 -            };
  2.1133 -        }
  2.1134 -
  2.1135 -        var finish = limitFunction(function() {
  2.1136 -            // If an observable provided a reference to itself, access it to get the latest value.
  2.1137 -            // This allows computed observables to delay calculating their value until needed.
  2.1138 -            if (selfIsObservable && pendingValue === self) {
  2.1139 -                pendingValue = self();
  2.1140 -            }
  2.1141 -            isPending = false;
  2.1142 -            if (self.isDifferent(previousValue, pendingValue)) {
  2.1143 -                self._origNotifySubscribers(previousValue = pendingValue);
  2.1144 -            }
  2.1145 -        });
  2.1146 -
  2.1147 -        self._rateLimitedChange = function(value) {
  2.1148 -            isPending = true;
  2.1149 -            pendingValue = value;
  2.1150 -            finish();
  2.1151 -        };
  2.1152 -        self._rateLimitedBeforeChange = function(value) {
  2.1153 -            if (!isPending) {
  2.1154 -                previousValue = value;
  2.1155 -                self._origNotifySubscribers(value, beforeChange);
  2.1156 -            }
  2.1157 -        };
  2.1158 -    },
  2.1159 -
  2.1160 -    hasSubscriptionsForEvent: function(event) {
  2.1161 -        return this._subscriptions[event] && this._subscriptions[event].length;
  2.1162 -    },
  2.1163 -
  2.1164 -    getSubscriptionsCount: function () {
  2.1165 -        var total = 0;
  2.1166 -        ko.utils.objectForEach(this._subscriptions, function(eventName, subscriptions) {
  2.1167 -            total += subscriptions.length;
  2.1168 -        });
  2.1169 -        return total;
  2.1170 -    },
  2.1171 -
  2.1172 -    isDifferent: function(oldValue, newValue) {
  2.1173 -        return !this['equalityComparer'] || !this['equalityComparer'](oldValue, newValue);
  2.1174 -    },
  2.1175 -
  2.1176 -    extend: applyExtenders
  2.1177 -};
  2.1178 -
  2.1179 -ko.exportProperty(ko_subscribable_fn, 'subscribe', ko_subscribable_fn.subscribe);
  2.1180 -ko.exportProperty(ko_subscribable_fn, 'extend', ko_subscribable_fn.extend);
  2.1181 -ko.exportProperty(ko_subscribable_fn, 'getSubscriptionsCount', ko_subscribable_fn.getSubscriptionsCount);
  2.1182 -
  2.1183 -// For browsers that support proto assignment, we overwrite the prototype of each
  2.1184 -// observable instance. Since observables are functions, we need Function.prototype
  2.1185 -// to still be in the prototype chain.
  2.1186 -if (ko.utils.canSetPrototype) {
  2.1187 -    ko.utils.setPrototypeOf(ko_subscribable_fn, Function.prototype);
  2.1188 -}
  2.1189 -
  2.1190 -ko.subscribable['fn'] = ko_subscribable_fn;
  2.1191 -
  2.1192 -
  2.1193 -ko.isSubscribable = function (instance) {
  2.1194 -    return instance != null && typeof instance.subscribe == "function" && typeof instance["notifySubscribers"] == "function";
  2.1195 -};
  2.1196 -
  2.1197 -ko.exportSymbol('subscribable', ko.subscribable);
  2.1198 -ko.exportSymbol('isSubscribable', ko.isSubscribable);
  2.1199 -
  2.1200 -ko.computedContext = ko.dependencyDetection = (function () {
  2.1201 -    var outerFrames = [],
  2.1202 -        currentFrame,
  2.1203 -        lastId = 0;
  2.1204 -
  2.1205 -    // Return a unique ID that can be assigned to an observable for dependency tracking.
  2.1206 -    // Theoretically, you could eventually overflow the number storage size, resulting
  2.1207 -    // in duplicate IDs. But in JavaScript, the largest exact integral value is 2^53
  2.1208 -    // or 9,007,199,254,740,992. If you created 1,000,000 IDs per second, it would
  2.1209 -    // take over 285 years to reach that number.
  2.1210 -    // Reference http://blog.vjeux.com/2010/javascript/javascript-max_int-number-limits.html
  2.1211 -    function getId() {
  2.1212 -        return ++lastId;
  2.1213 -    }
  2.1214 -
  2.1215 -    function begin(options) {
  2.1216 -        outerFrames.push(currentFrame);
  2.1217 -        currentFrame = options;
  2.1218 -    }
  2.1219 -
  2.1220 -    function end() {
  2.1221 -        currentFrame = outerFrames.pop();
  2.1222 -    }
  2.1223 -
  2.1224 -    return {
  2.1225 -        begin: begin,
  2.1226 -
  2.1227 -        end: end,
  2.1228 -
  2.1229 -        registerDependency: function (subscribable) {
  2.1230 -            if (currentFrame) {
  2.1231 -                if (!ko.isSubscribable(subscribable))
  2.1232 -                    throw new Error("Only subscribable things can act as dependencies");
  2.1233 -                currentFrame.callback(subscribable, subscribable._id || (subscribable._id = getId()));
  2.1234 -            }
  2.1235 -        },
  2.1236 -
  2.1237 -        ignore: function (callback, callbackTarget, callbackArgs) {
  2.1238 -            try {
  2.1239 -                begin();
  2.1240 -                return callback.apply(callbackTarget, callbackArgs || []);
  2.1241 -            } finally {
  2.1242 -                end();
  2.1243 -            }
  2.1244 -        },
  2.1245 -
  2.1246 -        getDependenciesCount: function () {
  2.1247 -            if (currentFrame)
  2.1248 -                return currentFrame.computed.getDependenciesCount();
  2.1249 -        },
  2.1250 -
  2.1251 -        isInitial: function() {
  2.1252 -            if (currentFrame)
  2.1253 -                return currentFrame.isInitial;
  2.1254 -        }
  2.1255 -    };
  2.1256 -})();
  2.1257 -
  2.1258 -ko.exportSymbol('computedContext', ko.computedContext);
  2.1259 -ko.exportSymbol('computedContext.getDependenciesCount', ko.computedContext.getDependenciesCount);
  2.1260 -ko.exportSymbol('computedContext.isInitial', ko.computedContext.isInitial);
  2.1261 -ko.exportSymbol('computedContext.isSleeping', ko.computedContext.isSleeping);
  2.1262 -ko.observable = function (initialValue) {
  2.1263 -    var _latestValue = initialValue;
  2.1264 -
  2.1265 -    function observable() {
  2.1266 -        if (arguments.length > 0) {
  2.1267 -            // Write
  2.1268 -
  2.1269 -            // Ignore writes if the value hasn't changed
  2.1270 -            if (observable.isDifferent(_latestValue, arguments[0])) {
  2.1271 -                observable.valueWillMutate();
  2.1272 -                _latestValue = arguments[0];
  2.1273 -                if (DEBUG) observable._latestValue = _latestValue;
  2.1274 -                observable.valueHasMutated();
  2.1275 -            }
  2.1276 -            return this; // Permits chained assignments
  2.1277 -        }
  2.1278 -        else {
  2.1279 -            // Read
  2.1280 -            ko.dependencyDetection.registerDependency(observable); // The caller only needs to be notified of changes if they did a "read" operation
  2.1281 -            return _latestValue;
  2.1282 -        }
  2.1283 -    }
  2.1284 -    ko.subscribable.call(observable);
  2.1285 -    ko.utils.setPrototypeOfOrExtend(observable, ko.observable['fn']);
  2.1286 -
  2.1287 -    if (DEBUG) observable._latestValue = _latestValue;
  2.1288 -    observable.peek = function() { return _latestValue };
  2.1289 -    observable.valueHasMutated = function () { observable["notifySubscribers"](_latestValue); }
  2.1290 -    observable.valueWillMutate = function () { observable["notifySubscribers"](_latestValue, "beforeChange"); }
  2.1291 -
  2.1292 -    ko.exportProperty(observable, 'peek', observable.peek);
  2.1293 -    ko.exportProperty(observable, "valueHasMutated", observable.valueHasMutated);
  2.1294 -    ko.exportProperty(observable, "valueWillMutate", observable.valueWillMutate);
  2.1295 -
  2.1296 -    return observable;
  2.1297 -}
  2.1298 -
  2.1299 -ko.observable['fn'] = {
  2.1300 -    "equalityComparer": valuesArePrimitiveAndEqual
  2.1301 -};
  2.1302 -
  2.1303 -var protoProperty = ko.observable.protoProperty = "__ko_proto__";
  2.1304 -ko.observable['fn'][protoProperty] = ko.observable;
  2.1305 -
  2.1306 -// Note that for browsers that don't support proto assignment, the
  2.1307 -// inheritance chain is created manually in the ko.observable constructor
  2.1308 -if (ko.utils.canSetPrototype) {
  2.1309 -    ko.utils.setPrototypeOf(ko.observable['fn'], ko.subscribable['fn']);
  2.1310 -}
  2.1311 -
  2.1312 -ko.hasPrototype = function(instance, prototype) {
  2.1313 -    if ((instance === null) || (instance === undefined) || (instance[protoProperty] === undefined)) return false;
  2.1314 -    if (instance[protoProperty] === prototype) return true;
  2.1315 -    return ko.hasPrototype(instance[protoProperty], prototype); // Walk the prototype chain
  2.1316 -};
  2.1317 -
  2.1318 -ko.isObservable = function (instance) {
  2.1319 -    return ko.hasPrototype(instance, ko.observable);
  2.1320 -}
  2.1321 -ko.isWriteableObservable = function (instance) {
  2.1322 -    // Observable
  2.1323 -    if ((typeof instance == "function") && instance[protoProperty] === ko.observable)
  2.1324 -        return true;
  2.1325 -    // Writeable dependent observable
  2.1326 -    if ((typeof instance == "function") && (instance[protoProperty] === ko.dependentObservable) && (instance.hasWriteFunction))
  2.1327 -        return true;
  2.1328 -    // Anything else
  2.1329 -    return false;
  2.1330 -}
  2.1331 -
  2.1332 -
  2.1333 -ko.exportSymbol('observable', ko.observable);
  2.1334 -ko.exportSymbol('isObservable', ko.isObservable);
  2.1335 -ko.exportSymbol('isWriteableObservable', ko.isWriteableObservable);
  2.1336 -ko.exportSymbol('isWritableObservable', ko.isWriteableObservable);
  2.1337 -ko.observableArray = function (initialValues) {
  2.1338 -    initialValues = initialValues || [];
  2.1339 -
  2.1340 -    if (typeof initialValues != 'object' || !('length' in initialValues))
  2.1341 -        throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
  2.1342 -
  2.1343 -    var result = ko.observable(initialValues);
  2.1344 -    ko.utils.setPrototypeOfOrExtend(result, ko.observableArray['fn']);
  2.1345 -    return result.extend({'trackArrayChanges':true});
  2.1346 -};
  2.1347 -
  2.1348 -ko.observableArray['fn'] = {
  2.1349 -    'remove': function (valueOrPredicate) {
  2.1350 -        var underlyingArray = this.peek();
  2.1351 -        var removedValues = [];
  2.1352 -        var predicate = typeof valueOrPredicate == "function" && !ko.isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate; };
  2.1353 -        for (var i = 0; i < underlyingArray.length; i++) {
  2.1354 -            var value = underlyingArray[i];
  2.1355 -            if (predicate(value)) {
  2.1356 -                if (removedValues.length === 0) {
  2.1357 -                    this.valueWillMutate();
  2.1358 -                }
  2.1359 -                removedValues.push(value);
  2.1360 -                underlyingArray.splice(i, 1);
  2.1361 -                i--;
  2.1362 -            }
  2.1363 -        }
  2.1364 -        if (removedValues.length) {
  2.1365 -            this.valueHasMutated();
  2.1366 -        }
  2.1367 -        return removedValues;
  2.1368 -    },
  2.1369 -
  2.1370 -    'removeAll': function (arrayOfValues) {
  2.1371 -        // If you passed zero args, we remove everything
  2.1372 -        if (arrayOfValues === undefined) {
  2.1373 -            var underlyingArray = this.peek();
  2.1374 -            var allValues = underlyingArray.slice(0);
  2.1375 -            this.valueWillMutate();
  2.1376 -            underlyingArray.splice(0, underlyingArray.length);
  2.1377 -            this.valueHasMutated();
  2.1378 -            return allValues;
  2.1379 -        }
  2.1380 -        // If you passed an arg, we interpret it as an array of entries to remove
  2.1381 -        if (!arrayOfValues)
  2.1382 -            return [];
  2.1383 -        return this['remove'](function (value) {
  2.1384 -            return ko.utils.arrayIndexOf(arrayOfValues, value) >= 0;
  2.1385 -        });
  2.1386 -    },
  2.1387 -
  2.1388 -    'destroy': function (valueOrPredicate) {
  2.1389 -        var underlyingArray = this.peek();
  2.1390 -        var predicate = typeof valueOrPredicate == "function" && !ko.isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate; };
  2.1391 -        this.valueWillMutate();
  2.1392 -        for (var i = underlyingArray.length - 1; i >= 0; i--) {
  2.1393 -            var value = underlyingArray[i];
  2.1394 -            if (predicate(value))
  2.1395 -                underlyingArray[i]["_destroy"] = true;
  2.1396 -        }
  2.1397 -        this.valueHasMutated();
  2.1398 -    },
  2.1399 -
  2.1400 -    'destroyAll': function (arrayOfValues) {
  2.1401 -        // If you passed zero args, we destroy everything
  2.1402 -        if (arrayOfValues === undefined)
  2.1403 -            return this['destroy'](function() { return true });
  2.1404 -
  2.1405 -        // If you passed an arg, we interpret it as an array of entries to destroy
  2.1406 -        if (!arrayOfValues)
  2.1407 -            return [];
  2.1408 -        return this['destroy'](function (value) {
  2.1409 -            return ko.utils.arrayIndexOf(arrayOfValues, value) >= 0;
  2.1410 -        });
  2.1411 -    },
  2.1412 -
  2.1413 -    'indexOf': function (item) {
  2.1414 -        var underlyingArray = this();
  2.1415 -        return ko.utils.arrayIndexOf(underlyingArray, item);
  2.1416 -    },
  2.1417 -
  2.1418 -    'replace': function(oldItem, newItem) {
  2.1419 -        var index = this['indexOf'](oldItem);
  2.1420 -        if (index >= 0) {
  2.1421 -            this.valueWillMutate();
  2.1422 -            this.peek()[index] = newItem;
  2.1423 -            this.valueHasMutated();
  2.1424 -        }
  2.1425 -    }
  2.1426 -};
  2.1427 -
  2.1428 -// Populate ko.observableArray.fn with read/write functions from native arrays
  2.1429 -// Important: Do not add any additional functions here that may reasonably be used to *read* data from the array
  2.1430 -// because we'll eval them without causing subscriptions, so ko.computed output could end up getting stale
  2.1431 -ko.utils.arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (methodName) {
  2.1432 -    ko.observableArray['fn'][methodName] = function () {
  2.1433 -        // Use "peek" to avoid creating a subscription in any computed that we're executing in the context of
  2.1434 -        // (for consistency with mutating regular observables)
  2.1435 -        var underlyingArray = this.peek();
  2.1436 -        this.valueWillMutate();
  2.1437 -        this.cacheDiffForKnownOperation(underlyingArray, methodName, arguments);
  2.1438 -        var methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments);
  2.1439 -        this.valueHasMutated();
  2.1440 -        return methodCallResult;
  2.1441 -    };
  2.1442 -});
  2.1443 -
  2.1444 -// Populate ko.observableArray.fn with read-only functions from native arrays
  2.1445 -ko.utils.arrayForEach(["slice"], function (methodName) {
  2.1446 -    ko.observableArray['fn'][methodName] = function () {
  2.1447 -        var underlyingArray = this();
  2.1448 -        return underlyingArray[methodName].apply(underlyingArray, arguments);
  2.1449 -    };
  2.1450 -});
  2.1451 -
  2.1452 -// Note that for browsers that don't support proto assignment, the
  2.1453 -// inheritance chain is created manually in the ko.observableArray constructor
  2.1454 -if (ko.utils.canSetPrototype) {
  2.1455 -    ko.utils.setPrototypeOf(ko.observableArray['fn'], ko.observable['fn']);
  2.1456 -}
  2.1457 -
  2.1458 -ko.exportSymbol('observableArray', ko.observableArray);
  2.1459 -var arrayChangeEventName = 'arrayChange';
  2.1460 -ko.extenders['trackArrayChanges'] = function(target) {
  2.1461 -    // Only modify the target observable once
  2.1462 -    if (target.cacheDiffForKnownOperation) {
  2.1463 -        return;
  2.1464 -    }
  2.1465 -    var trackingChanges = false,
  2.1466 -        cachedDiff = null,
  2.1467 -        pendingNotifications = 0,
  2.1468 -        underlyingSubscribeFunction = target.subscribe;
  2.1469 -
  2.1470 -    // Intercept "subscribe" calls, and for array change events, ensure change tracking is enabled
  2.1471 -    target.subscribe = target['subscribe'] = function(callback, callbackTarget, event) {
  2.1472 -        if (event === arrayChangeEventName) {
  2.1473 -            trackChanges();
  2.1474 -        }
  2.1475 -        return underlyingSubscribeFunction.apply(this, arguments);
  2.1476 -    };
  2.1477 -
  2.1478 -    function trackChanges() {
  2.1479 -        // Calling 'trackChanges' multiple times is the same as calling it once
  2.1480 -        if (trackingChanges) {
  2.1481 -            return;
  2.1482 -        }
  2.1483 -
  2.1484 -        trackingChanges = true;
  2.1485 -
  2.1486 -        // Intercept "notifySubscribers" to track how many times it was called.
  2.1487 -        var underlyingNotifySubscribersFunction = target['notifySubscribers'];
  2.1488 -        target['notifySubscribers'] = function(valueToNotify, event) {
  2.1489 -            if (!event || event === defaultEvent) {
  2.1490 -                ++pendingNotifications;
  2.1491 -            }
  2.1492 -            return underlyingNotifySubscribersFunction.apply(this, arguments);
  2.1493 -        };
  2.1494 -
  2.1495 -        // Each time the array changes value, capture a clone so that on the next
  2.1496 -        // change it's possible to produce a diff
  2.1497 -        var previousContents = [].concat(target.peek() || []);
  2.1498 -        cachedDiff = null;
  2.1499 -        target.subscribe(function(currentContents) {
  2.1500 -            // Make a copy of the current contents and ensure it's an array
  2.1501 -            currentContents = [].concat(currentContents || []);
  2.1502 -
  2.1503 -            // Compute the diff and issue notifications, but only if someone is listening
  2.1504 -            if (target.hasSubscriptionsForEvent(arrayChangeEventName)) {
  2.1505 -                var changes = getChanges(previousContents, currentContents);
  2.1506 -                if (changes.length) {
  2.1507 -                    target['notifySubscribers'](changes, arrayChangeEventName);
  2.1508 -                }
  2.1509 -            }
  2.1510 -
  2.1511 -            // Eliminate references to the old, removed items, so they can be GCed
  2.1512 -            previousContents = currentContents;
  2.1513 -            cachedDiff = null;
  2.1514 -            pendingNotifications = 0;
  2.1515 -        });
  2.1516 -    }
  2.1517 -
  2.1518 -    function getChanges(previousContents, currentContents) {
  2.1519 -        // We try to re-use cached diffs.
  2.1520 -        // The scenarios where pendingNotifications > 1 are when using rate-limiting or the Deferred Updates
  2.1521 -        // plugin, which without this check would not be compatible with arrayChange notifications. Normally,
  2.1522 -        // notifications are issued immediately so we wouldn't be queueing up more than one.
  2.1523 -        if (!cachedDiff || pendingNotifications > 1) {
  2.1524 -            cachedDiff = ko.utils.compareArrays(previousContents, currentContents, { 'sparse': true });
  2.1525 -        }
  2.1526 -
  2.1527 -        return cachedDiff;
  2.1528 -    }
  2.1529 -
  2.1530 -    target.cacheDiffForKnownOperation = function(rawArray, operationName, args) {
  2.1531 -        // Only run if we're currently tracking changes for this observable array
  2.1532 -        // and there aren't any pending deferred notifications.
  2.1533 -        if (!trackingChanges || pendingNotifications) {
  2.1534 -            return;
  2.1535 -        }
  2.1536 -        var diff = [],
  2.1537 -            arrayLength = rawArray.length,
  2.1538 -            argsLength = args.length,
  2.1539 -            offset = 0;
  2.1540 -
  2.1541 -        function pushDiff(status, value, index) {
  2.1542 -            return diff[diff.length] = { 'status': status, 'value': value, 'index': index };
  2.1543 -        }
  2.1544 -        switch (operationName) {
  2.1545 -            case 'push':
  2.1546 -                offset = arrayLength;
  2.1547 -            case 'unshift':
  2.1548 -                for (var index = 0; index < argsLength; index++) {
  2.1549 -                    pushDiff('added', args[index], offset + index);
  2.1550 -                }
  2.1551 -                break;
  2.1552 -
  2.1553 -            case 'pop':
  2.1554 -                offset = arrayLength - 1;
  2.1555 -            case 'shift':
  2.1556 -                if (arrayLength) {
  2.1557 -                    pushDiff('deleted', rawArray[offset], offset);
  2.1558 -                }
  2.1559 -                break;
  2.1560 -
  2.1561 -            case 'splice':
  2.1562 -                // Negative start index means 'from end of array'. After that we clamp to [0...arrayLength].
  2.1563 -                // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
  2.1564 -                var startIndex = Math.min(Math.max(0, args[0] < 0 ? arrayLength + args[0] : args[0]), arrayLength),
  2.1565 -                    endDeleteIndex = argsLength === 1 ? arrayLength : Math.min(startIndex + (args[1] || 0), arrayLength),
  2.1566 -                    endAddIndex = startIndex + argsLength - 2,
  2.1567 -                    endIndex = Math.max(endDeleteIndex, endAddIndex),
  2.1568 -                    additions = [], deletions = [];
  2.1569 -                for (var index = startIndex, argsIndex = 2; index < endIndex; ++index, ++argsIndex) {
  2.1570 -                    if (index < endDeleteIndex)
  2.1571 -                        deletions.push(pushDiff('deleted', rawArray[index], index));
  2.1572 -                    if (index < endAddIndex)
  2.1573 -                        additions.push(pushDiff('added', args[argsIndex], index));
  2.1574 -                }
  2.1575 -                ko.utils.findMovesInArrayComparison(deletions, additions);
  2.1576 -                break;
  2.1577 -
  2.1578 -            default:
  2.1579 -                return;
  2.1580 -        }
  2.1581 -        cachedDiff = diff;
  2.1582 -    };
  2.1583 -};
  2.1584 -ko.computed = ko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {
  2.1585 -    var _latestValue,
  2.1586 -        _needsEvaluation = true,
  2.1587 -        _isBeingEvaluated = false,
  2.1588 -        _suppressDisposalUntilDisposeWhenReturnsFalse = false,
  2.1589 -        _isDisposed = false,
  2.1590 -        readFunction = evaluatorFunctionOrOptions,
  2.1591 -        pure = false,
  2.1592 -        isSleeping = false;
  2.1593 -
  2.1594 -    if (readFunction && typeof readFunction == "object") {
  2.1595 -        // Single-parameter syntax - everything is on this "options" param
  2.1596 -        options = readFunction;
  2.1597 -        readFunction = options["read"];
  2.1598 -    } else {
  2.1599 -        // Multi-parameter syntax - construct the options according to the params passed
  2.1600 -        options = options || {};
  2.1601 -        if (!readFunction)
  2.1602 -            readFunction = options["read"];
  2.1603 -    }
  2.1604 -    if (typeof readFunction != "function")
  2.1605 -        throw new Error("Pass a function that returns the value of the ko.computed");
  2.1606 -
  2.1607 -    function addSubscriptionToDependency(subscribable, id) {
  2.1608 -        if (!_subscriptionsToDependencies[id]) {
  2.1609 -            _subscriptionsToDependencies[id] = subscribable.subscribe(evaluatePossiblyAsync);
  2.1610 -            ++_dependenciesCount;
  2.1611 -        }
  2.1612 -    }
  2.1613 -
  2.1614 -    function disposeAllSubscriptionsToDependencies() {
  2.1615 -        ko.utils.objectForEach(_subscriptionsToDependencies, function (id, subscription) {
  2.1616 -            subscription.dispose();
  2.1617 -        });
  2.1618 -        _subscriptionsToDependencies = {};
  2.1619 -    }
  2.1620 -
  2.1621 -    function disposeComputed() {
  2.1622 -        disposeAllSubscriptionsToDependencies();
  2.1623 -        _dependenciesCount = 0;
  2.1624 -        _isDisposed = true;
  2.1625 -        _needsEvaluation = false;
  2.1626 -    }
  2.1627 -
  2.1628 -    function evaluatePossiblyAsync() {
  2.1629 -        var throttleEvaluationTimeout = dependentObservable['throttleEvaluation'];
  2.1630 -        if (throttleEvaluationTimeout && throttleEvaluationTimeout >= 0) {
  2.1631 -            clearTimeout(evaluationTimeoutInstance);
  2.1632 -            evaluationTimeoutInstance = setTimeout(evaluateImmediate, throttleEvaluationTimeout);
  2.1633 -        } else if (dependentObservable._evalRateLimited) {
  2.1634 -            dependentObservable._evalRateLimited();
  2.1635 -        } else {
  2.1636 -            evaluateImmediate();
  2.1637 -        }
  2.1638 -    }
  2.1639 -
  2.1640 -    function evaluateImmediate(suppressChangeNotification) {
  2.1641 -        if (_isBeingEvaluated) {
  2.1642 -            if (pure) {
  2.1643 -                throw Error("A 'pure' computed must not be called recursively");
  2.1644 -            }
  2.1645 -            // If the evaluation of a ko.computed causes side effects, it's possible that it will trigger its own re-evaluation.
  2.1646 -            // This is not desirable (it's hard for a developer to realise a chain of dependencies might cause this, and they almost
  2.1647 -            // certainly didn't intend infinite re-evaluations). So, for predictability, we simply prevent ko.computeds from causing
  2.1648 -            // their own re-evaluation. Further discussion at https://github.com/SteveSanderson/knockout/pull/387
  2.1649 -            return;
  2.1650 -        }
  2.1651 -
  2.1652 -        // Do not evaluate (and possibly capture new dependencies) if disposed
  2.1653 -        if (_isDisposed) {
  2.1654 -            return;
  2.1655 -        }
  2.1656 -
  2.1657 -        if (disposeWhen && disposeWhen()) {
  2.1658 -            // See comment below about _suppressDisposalUntilDisposeWhenReturnsFalse
  2.1659 -            if (!_suppressDisposalUntilDisposeWhenReturnsFalse) {
  2.1660 -                dispose();
  2.1661 -                return;
  2.1662 -            }
  2.1663 -        } else {
  2.1664 -            // It just did return false, so we can stop suppressing now
  2.1665 -            _suppressDisposalUntilDisposeWhenReturnsFalse = false;
  2.1666 -        }
  2.1667 -
  2.1668 -        _isBeingEvaluated = true;
  2.1669 -
  2.1670 -        // When sleeping, recalculate the value and return.
  2.1671 -        if (isSleeping) {
  2.1672 -            try {
  2.1673 -                var dependencyTracking = {};
  2.1674 -                ko.dependencyDetection.begin({
  2.1675 -                    callback: function (subscribable, id) {
  2.1676 -                        if (!dependencyTracking[id]) {
  2.1677 -                            dependencyTracking[id] = 1;
  2.1678 -                            ++_dependenciesCount;
  2.1679 -                        }
  2.1680 -                    },
  2.1681 -                    computed: dependentObservable,
  2.1682 -                    isInitial: undefined
  2.1683 -                });
  2.1684 -                _dependenciesCount = 0;
  2.1685 -                _latestValue = readFunction.call(evaluatorFunctionTarget);
  2.1686 -            } finally {
  2.1687 -                ko.dependencyDetection.end();
  2.1688 -                _isBeingEvaluated = false;
  2.1689 -            }
  2.1690 -        } else {
  2.1691 -            try {
  2.1692 -                // Initially, we assume that none of the subscriptions are still being used (i.e., all are candidates for disposal).
  2.1693 -                // Then, during evaluation, we cross off any that are in fact still being used.
  2.1694 -                var disposalCandidates = _subscriptionsToDependencies, disposalCount = _dependenciesCount;
  2.1695 -                ko.dependencyDetection.begin({
  2.1696 -                    callback: function(subscribable, id) {
  2.1697 -                        if (!_isDisposed) {
  2.1698 -                            if (disposalCount && disposalCandidates[id]) {
  2.1699 -                                // Don't want to dispose this subscription, as it's still being used
  2.1700 -                                _subscriptionsToDependencies[id] = disposalCandidates[id];
  2.1701 -                                ++_dependenciesCount;
  2.1702 -                                delete disposalCandidates[id];
  2.1703 -                                --disposalCount;
  2.1704 -                            } else {
  2.1705 -                                // Brand new subscription - add it
  2.1706 -                                addSubscriptionToDependency(subscribable, id);
  2.1707 -                            }
  2.1708 -                        }
  2.1709 -                    },
  2.1710 -                    computed: dependentObservable,
  2.1711 -                    isInitial: pure ? undefined : !_dependenciesCount        // If we're evaluating when there are no previous dependencies, it must be the first time
  2.1712 -                });
  2.1713 -
  2.1714 -                _subscriptionsToDependencies = {};
  2.1715 -                _dependenciesCount = 0;
  2.1716 -
  2.1717 -                try {
  2.1718 -                    var newValue = evaluatorFunctionTarget ? readFunction.call(evaluatorFunctionTarget) : readFunction();
  2.1719 -
  2.1720 -                } finally {
  2.1721 -                    ko.dependencyDetection.end();
  2.1722 -
  2.1723 -                    // For each subscription no longer being used, remove it from the active subscriptions list and dispose it
  2.1724 -                    if (disposalCount) {
  2.1725 -                        ko.utils.objectForEach(disposalCandidates, function(id, toDispose) {
  2.1726 -                            toDispose.dispose();
  2.1727 -                        });
  2.1728 -                    }
  2.1729 -
  2.1730 -                    _needsEvaluation = false;
  2.1731 -                }
  2.1732 -
  2.1733 -                if (dependentObservable.isDifferent(_latestValue, newValue)) {
  2.1734 -                    dependentObservable["notifySubscribers"](_latestValue, "beforeChange");
  2.1735 -
  2.1736 -                    _latestValue = newValue;
  2.1737 -                    if (DEBUG) dependentObservable._latestValue = _latestValue;
  2.1738 -
  2.1739 -                    if (suppressChangeNotification !== true) {  // Check for strict true value since setTimeout in Firefox passes a numeric value to the function
  2.1740 -                        dependentObservable["notifySubscribers"](_latestValue);
  2.1741 -                    }
  2.1742 -                }
  2.1743 -            } finally {
  2.1744 -                _isBeingEvaluated = false;
  2.1745 -            }
  2.1746 -        }
  2.1747 -
  2.1748 -        if (!_dependenciesCount)
  2.1749 -            dispose();
  2.1750 -    }
  2.1751 -
  2.1752 -    function dependentObservable() {
  2.1753 -        if (arguments.length > 0) {
  2.1754 -            if (typeof writeFunction === "function") {
  2.1755 -                // Writing a value
  2.1756 -                writeFunction.apply(evaluatorFunctionTarget, arguments);
  2.1757 -            } else {
  2.1758 -                throw new Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
  2.1759 -            }
  2.1760 -            return this; // Permits chained assignments
  2.1761 -        } else {
  2.1762 -            // Reading the value
  2.1763 -            ko.dependencyDetection.registerDependency(dependentObservable);
  2.1764 -            if (_needsEvaluation)
  2.1765 -                evaluateImmediate(true /* suppressChangeNotification */);
  2.1766 -            return _latestValue;
  2.1767 -        }
  2.1768 -    }
  2.1769 -
  2.1770 -    function peek() {
  2.1771 -        // Peek won't re-evaluate, except to get the initial value when "deferEvaluation" is set, or while the computed is sleeping.
  2.1772 -        // Those are the only times that both of these conditions will be satisfied.
  2.1773 -        if (_needsEvaluation && !_dependenciesCount)
  2.1774 -            evaluateImmediate(true /* suppressChangeNotification */);
  2.1775 -        return _latestValue;
  2.1776 -    }
  2.1777 -
  2.1778 -    function isActive() {
  2.1779 -        return _needsEvaluation || _dependenciesCount > 0;
  2.1780 -    }
  2.1781 -
  2.1782 -    // By here, "options" is always non-null
  2.1783 -    var writeFunction = options["write"],
  2.1784 -        disposeWhenNodeIsRemoved = options["disposeWhenNodeIsRemoved"] || options.disposeWhenNodeIsRemoved || null,
  2.1785 -        disposeWhenOption = options["disposeWhen"] || options.disposeWhen,
  2.1786 -        disposeWhen = disposeWhenOption,
  2.1787 -        dispose = disposeComputed,
  2.1788 -        _subscriptionsToDependencies = {},
  2.1789 -        _dependenciesCount = 0,
  2.1790 -        evaluationTimeoutInstance = null;
  2.1791 -
  2.1792 -    if (!evaluatorFunctionTarget)
  2.1793 -        evaluatorFunctionTarget = options["owner"];
  2.1794 -
  2.1795 -    ko.subscribable.call(dependentObservable);
  2.1796 -    ko.utils.setPrototypeOfOrExtend(dependentObservable, ko.dependentObservable['fn']);
  2.1797 -
  2.1798 -    dependentObservable.peek = peek;
  2.1799 -    dependentObservable.getDependenciesCount = function () { return _dependenciesCount; };
  2.1800 -    dependentObservable.hasWriteFunction = typeof options["write"] === "function";
  2.1801 -    dependentObservable.dispose = function () { dispose(); };
  2.1802 -    dependentObservable.isActive = isActive;
  2.1803 -
  2.1804 -    // Replace the limit function with one that delays evaluation as well.
  2.1805 -    var originalLimit = dependentObservable.limit;
  2.1806 -    dependentObservable.limit = function(limitFunction) {
  2.1807 -        originalLimit.call(dependentObservable, limitFunction);
  2.1808 -        dependentObservable._evalRateLimited = function() {
  2.1809 -            dependentObservable._rateLimitedBeforeChange(_latestValue);
  2.1810 -
  2.1811 -            _needsEvaluation = true;    // Mark as dirty
  2.1812 -
  2.1813 -            // Pass the observable to the rate-limit code, which will access it when
  2.1814 -            // it's time to do the notification.
  2.1815 -            dependentObservable._rateLimitedChange(dependentObservable);
  2.1816 -        }
  2.1817 -    };
  2.1818 -
  2.1819 -    if (options['pure']) {
  2.1820 -        pure = true;
  2.1821 -        isSleeping = true;     // Starts off sleeping; will awake on the first subscription
  2.1822 -        dependentObservable.beforeSubscriptionAdd = function () {
  2.1823 -            // If asleep, wake up the computed and evaluate to register any dependencies.
  2.1824 -            if (isSleeping) {
  2.1825 -                isSleeping = false;
  2.1826 -                evaluateImmediate(true /* suppressChangeNotification */);
  2.1827 -            }
  2.1828 -        }
  2.1829 -        dependentObservable.afterSubscriptionRemove = function () {
  2.1830 -            if (!dependentObservable.getSubscriptionsCount()) {
  2.1831 -                disposeAllSubscriptionsToDependencies();
  2.1832 -                isSleeping = _needsEvaluation = true;
  2.1833 -            }
  2.1834 -        }
  2.1835 -    } else if (options['deferEvaluation']) {
  2.1836 -        // This will force a computed with deferEvaluation to evaluate when the first subscriptions is registered.
  2.1837 -        dependentObservable.beforeSubscriptionAdd = function () {
  2.1838 -            peek();
  2.1839 -            delete dependentObservable.beforeSubscriptionAdd;
  2.1840 -        }
  2.1841 -    }
  2.1842 -
  2.1843 -    ko.exportProperty(dependentObservable, 'peek', dependentObservable.peek);
  2.1844 -    ko.exportProperty(dependentObservable, 'dispose', dependentObservable.dispose);
  2.1845 -    ko.exportProperty(dependentObservable, 'isActive', dependentObservable.isActive);
  2.1846 -    ko.exportProperty(dependentObservable, 'getDependenciesCount', dependentObservable.getDependenciesCount);
  2.1847 -
  2.1848 -    // Add a "disposeWhen" callback that, on each evaluation, disposes if the node was removed without using ko.removeNode.
  2.1849 -    if (disposeWhenNodeIsRemoved) {
  2.1850 -        // Since this computed is associated with a DOM node, and we don't want to dispose the computed
  2.1851 -        // until the DOM node is *removed* from the document (as opposed to never having been in the document),
  2.1852 -        // we'll prevent disposal until "disposeWhen" first returns false.
  2.1853 -        _suppressDisposalUntilDisposeWhenReturnsFalse = true;
  2.1854 -
  2.1855 -        // Only watch for the node's disposal if the value really is a node. It might not be,
  2.1856 -        // e.g., { disposeWhenNodeIsRemoved: true } can be used to opt into the "only dispose
  2.1857 -        // after first false result" behaviour even if there's no specific node to watch. This
  2.1858 -        // technique is intended for KO's internal use only and shouldn't be documented or used
  2.1859 -        // by application code, as it's likely to change in a future version of KO.
  2.1860 -        if (disposeWhenNodeIsRemoved.nodeType) {
  2.1861 -            disposeWhen = function () {
  2.1862 -                return !ko.utils.domNodeIsAttachedToDocument(disposeWhenNodeIsRemoved) || (disposeWhenOption && disposeWhenOption());
  2.1863 -            };
  2.1864 -        }
  2.1865 -    }
  2.1866 -
  2.1867 -    // Evaluate, unless sleeping or deferEvaluation is true
  2.1868 -    if (!isSleeping && !options['deferEvaluation'])
  2.1869 -        evaluateImmediate();
  2.1870 -
  2.1871 -    // Attach a DOM node disposal callback so that the computed will be proactively disposed as soon as the node is
  2.1872 -    // removed using ko.removeNode. But skip if isActive is false (there will never be any dependencies to dispose).
  2.1873 -    if (disposeWhenNodeIsRemoved && isActive() && disposeWhenNodeIsRemoved.nodeType) {
  2.1874 -        dispose = function() {
  2.1875 -            ko.utils.domNodeDisposal.removeDisposeCallback(disposeWhenNodeIsRemoved, dispose);
  2.1876 -            disposeComputed();
  2.1877 -        };
  2.1878 -        ko.utils.domNodeDisposal.addDisposeCallback(disposeWhenNodeIsRemoved, dispose);
  2.1879 -    }
  2.1880 -
  2.1881 -    return dependentObservable;
  2.1882 -};
  2.1883 -
  2.1884 -ko.isComputed = function(instance) {
  2.1885 -    return ko.hasPrototype(instance, ko.dependentObservable);
  2.1886 -};
  2.1887 -
  2.1888 -var protoProp = ko.observable.protoProperty; // == "__ko_proto__"
  2.1889 -ko.dependentObservable[protoProp] = ko.observable;
  2.1890 -
  2.1891 -ko.dependentObservable['fn'] = {
  2.1892 -    "equalityComparer": valuesArePrimitiveAndEqual
  2.1893 -};
  2.1894 -ko.dependentObservable['fn'][protoProp] = ko.dependentObservable;
  2.1895 -
  2.1896 -// Note that for browsers that don't support proto assignment, the
  2.1897 -// inheritance chain is created manually in the ko.dependentObservable constructor
  2.1898 -if (ko.utils.canSetPrototype) {
  2.1899 -    ko.utils.setPrototypeOf(ko.dependentObservable['fn'], ko.subscribable['fn']);
  2.1900 -}
  2.1901 -
  2.1902 -ko.exportSymbol('dependentObservable', ko.dependentObservable);
  2.1903 -ko.exportSymbol('computed', ko.dependentObservable); // Make "ko.computed" an alias for "ko.dependentObservable"
  2.1904 -ko.exportSymbol('isComputed', ko.isComputed);
  2.1905 -
  2.1906 -ko.pureComputed = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget) {
  2.1907 -    if (typeof evaluatorFunctionOrOptions === 'function') {
  2.1908 -        return ko.computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget, {'pure':true});
  2.1909 -    } else {
  2.1910 -        evaluatorFunctionOrOptions = ko.utils.extend({}, evaluatorFunctionOrOptions);   // make a copy of the parameter object
  2.1911 -        evaluatorFunctionOrOptions['pure'] = true;
  2.1912 -        return ko.computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget);
  2.1913 -    }
  2.1914 -}
  2.1915 -ko.exportSymbol('pureComputed', ko.pureComputed);
  2.1916 -
  2.1917 -(function() {
  2.1918 -    var maxNestedObservableDepth = 10; // Escape the (unlikely) pathalogical case where an observable's current value is itself (or similar reference cycle)
  2.1919 -
  2.1920 -    ko.toJS = function(rootObject) {
  2.1921 -        if (arguments.length == 0)
  2.1922 -            throw new Error("When calling ko.toJS, pass the object you want to convert.");
  2.1923 -
  2.1924 -        // We just unwrap everything at every level in the object graph
  2.1925 -        return mapJsObjectGraph(rootObject, function(valueToMap) {
  2.1926 -            // Loop because an observable's value might in turn be another observable wrapper
  2.1927 -            for (var i = 0; ko.isObservable(valueToMap) && (i < maxNestedObservableDepth); i++)
  2.1928 -                valueToMap = valueToMap();
  2.1929 -            return valueToMap;
  2.1930 -        });
  2.1931 -    };
  2.1932 -
  2.1933 -    ko.toJSON = function(rootObject, replacer, space) {     // replacer and space are optional
  2.1934 -        var plainJavaScriptObject = ko.toJS(rootObject);
  2.1935 -        return ko.utils.stringifyJson(plainJavaScriptObject, replacer, space);
  2.1936 -    };
  2.1937 -
  2.1938 -    function mapJsObjectGraph(rootObject, mapInputCallback, visitedObjects) {
  2.1939 -        visitedObjects = visitedObjects || new objectLookup();
  2.1940 -
  2.1941 -        rootObject = mapInputCallback(rootObject);
  2.1942 -        var canHaveProperties = (typeof rootObject == "object") && (rootObject !== null) && (rootObject !== undefined) && (!(rootObject instanceof Date)) && (!(rootObject instanceof String)) && (!(rootObject instanceof Number)) && (!(rootObject instanceof Boolean));
  2.1943 -        if (!canHaveProperties)
  2.1944 -            return rootObject;
  2.1945 -
  2.1946 -        var outputProperties = rootObject instanceof Array ? [] : {};
  2.1947 -        visitedObjects.save(rootObject, outputProperties);
  2.1948 -
  2.1949 -        visitPropertiesOrArrayEntries(rootObject, function(indexer) {
  2.1950 -            var propertyValue = mapInputCallback(rootObject[indexer]);
  2.1951 -
  2.1952 -            switch (typeof propertyValue) {
  2.1953 -                case "boolean":
  2.1954 -                case "number":
  2.1955 -                case "string":
  2.1956 -                case "function":
  2.1957 -                    outputProperties[indexer] = propertyValue;
  2.1958 -                    break;
  2.1959 -                case "object":
  2.1960 -                case "undefined":
  2.1961 -                    var previouslyMappedValue = visitedObjects.get(propertyValue);
  2.1962 -                    outputProperties[indexer] = (previouslyMappedValue !== undefined)
  2.1963 -                        ? previouslyMappedValue
  2.1964 -                        : mapJsObjectGraph(propertyValue, mapInputCallback, visitedObjects);
  2.1965 -                    break;
  2.1966 -            }
  2.1967 -        });
  2.1968 -
  2.1969 -        return outputProperties;
  2.1970 -    }
  2.1971 -
  2.1972 -    function visitPropertiesOrArrayEntries(rootObject, visitorCallback) {
  2.1973 -        if (rootObject instanceof Array) {
  2.1974 -            for (var i = 0; i < rootObject.length; i++)
  2.1975 -                visitorCallback(i);
  2.1976 -
  2.1977 -            // For arrays, also respect toJSON property for custom mappings (fixes #278)
  2.1978 -            if (typeof rootObject['toJSON'] == 'function')
  2.1979 -                visitorCallback('toJSON');
  2.1980 -        } else {
  2.1981 -            for (var propertyName in rootObject) {
  2.1982 -                visitorCallback(propertyName);
  2.1983 -            }
  2.1984 -        }
  2.1985 -    };
  2.1986 -
  2.1987 -    function objectLookup() {
  2.1988 -        this.keys = [];
  2.1989 -        this.values = [];
  2.1990 -    };
  2.1991 -
  2.1992 -    objectLookup.prototype = {
  2.1993 -        constructor: objectLookup,
  2.1994 -        save: function(key, value) {
  2.1995 -            var existingIndex = ko.utils.arrayIndexOf(this.keys, key);
  2.1996 -            if (existingIndex >= 0)
  2.1997 -                this.values[existingIndex] = value;
  2.1998 -            else {
  2.1999 -                this.keys.push(key);
  2.2000 -                this.values.push(value);
  2.2001 -            }
  2.2002 -        },
  2.2003 -        get: function(key) {
  2.2004 -            var existingIndex = ko.utils.arrayIndexOf(this.keys, key);
  2.2005 -            return (existingIndex >= 0) ? this.values[existingIndex] : undefined;
  2.2006 -        }
  2.2007 -    };
  2.2008 -})();
  2.2009 -
  2.2010 -ko.exportSymbol('toJS', ko.toJS);
  2.2011 -ko.exportSymbol('toJSON', ko.toJSON);
  2.2012 -(function () {
  2.2013 -    var hasDomDataExpandoProperty = '__ko__hasDomDataOptionValue__';
  2.2014 -
  2.2015 -    // Normally, SELECT elements and their OPTIONs can only take value of type 'string' (because the values
  2.2016 -    // are stored on DOM attributes). ko.selectExtensions provides a way for SELECTs/OPTIONs to have values
  2.2017 -    // that are arbitrary objects. This is very convenient when implementing things like cascading dropdowns.
  2.2018 -    ko.selectExtensions = {
  2.2019 -        readValue : function(element) {
  2.2020 -            switch (ko.utils.tagNameLower(element)) {
  2.2021 -                case 'option':
  2.2022 -                    if (element[hasDomDataExpandoProperty] === true)
  2.2023 -                        return ko.utils.domData.get(element, ko.bindingHandlers.options.optionValueDomDataKey);
  2.2024 -                    return ko.utils.ieVersion <= 7
  2.2025 -                        ? (element.getAttributeNode('value') && element.getAttributeNode('value').specified ? element.value : element.text)
  2.2026 -                        : element.value;
  2.2027 -                case 'select':
  2.2028 -                    return element.selectedIndex >= 0 ? ko.selectExtensions.readValue(element.options[element.selectedIndex]) : undefined;
  2.2029 -                default:
  2.2030 -                    return element.value;
  2.2031 -            }
  2.2032 -        },
  2.2033 -
  2.2034 -        writeValue: function(element, value, allowUnset) {
  2.2035 -            switch (ko.utils.tagNameLower(element)) {
  2.2036 -                case 'option':
  2.2037 -                    switch(typeof value) {
  2.2038 -                        case "string":
  2.2039 -                            ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, undefined);
  2.2040 -                            if (hasDomDataExpandoProperty in element) { // IE <= 8 throws errors if you delete non-existent properties from a DOM node
  2.2041 -                                delete element[hasDomDataExpandoProperty];
  2.2042 -                            }
  2.2043 -                            element.value = value;
  2.2044 -                            break;
  2.2045 -                        default:
  2.2046 -                            // Store arbitrary object using DomData
  2.2047 -                            ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, value);
  2.2048 -                            element[hasDomDataExpandoProperty] = true;
  2.2049 -
  2.2050 -                            // Special treatment of numbers is just for backward compatibility. KO 1.2.1 wrote numerical values to element.value.
  2.2051 -                            element.value = typeof value === "number" ? value : "";
  2.2052 -                            break;
  2.2053 -                    }
  2.2054 -                    break;
  2.2055 -                case 'select':
  2.2056 -                    if (value === "" || value === null)       // A blank string or null value will select the caption
  2.2057 -                        value = undefined;
  2.2058 -                    var selection = -1;
  2.2059 -                    for (var i = 0, n = element.options.length, optionValue; i < n; ++i) {
  2.2060 -                        optionValue = ko.selectExtensions.readValue(element.options[i]);
  2.2061 -                        // Include special check to handle selecting a caption with a blank string value
  2.2062 -                        if (optionValue == value || (optionValue == "" && value === undefined)) {
  2.2063 -                            selection = i;
  2.2064 -                            break;
  2.2065 -                        }
  2.2066 -                    }
  2.2067 -                    if (allowUnset || selection >= 0 || (value === undefined && element.size > 1)) {
  2.2068 -                        element.selectedIndex = selection;
  2.2069 -                    }
  2.2070 -                    break;
  2.2071 -                default:
  2.2072 -                    if ((value === null) || (value === undefined))
  2.2073 -                        value = "";
  2.2074 -                    element.value = value;
  2.2075 -                    break;
  2.2076 -            }
  2.2077 -        }
  2.2078 -    };
  2.2079 -})();
  2.2080 -
  2.2081 -ko.exportSymbol('selectExtensions', ko.selectExtensions);
  2.2082 -ko.exportSymbol('selectExtensions.readValue', ko.selectExtensions.readValue);
  2.2083 -ko.exportSymbol('selectExtensions.writeValue', ko.selectExtensions.writeValue);
  2.2084 -ko.expressionRewriting = (function () {
  2.2085 -    var javaScriptReservedWords = ["true", "false", "null", "undefined"];
  2.2086 -
  2.2087 -    // Matches something that can be assigned to--either an isolated identifier or something ending with a property accessor
  2.2088 -    // This is designed to be simple and avoid false negatives, but could produce false positives (e.g., a+b.c).
  2.2089 -    // This also will not properly handle nested brackets (e.g., obj1[obj2['prop']]; see #911).
  2.2090 -    var javaScriptAssignmentTarget = /^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i;
  2.2091 -
  2.2092 -    function getWriteableValue(expression) {
  2.2093 -        if (ko.utils.arrayIndexOf(javaScriptReservedWords, expression) >= 0)
  2.2094 -            return false;
  2.2095 -        var match = expression.match(javaScriptAssignmentTarget);
  2.2096 -        return match === null ? false : match[1] ? ('Object(' + match[1] + ')' + match[2]) : expression;
  2.2097 -    }
  2.2098 -
  2.2099 -    // The following regular expressions will be used to split an object-literal string into tokens
  2.2100 -
  2.2101 -        // These two match strings, either with double quotes or single quotes
  2.2102 -    var stringDouble = '"(?:[^"\\\\]|\\\\.)*"',
  2.2103 -        stringSingle = "'(?:[^'\\\\]|\\\\.)*'",
  2.2104 -        // Matches a regular expression (text enclosed by slashes), but will also match sets of divisions
  2.2105 -        // as a regular expression (this is handled by the parsing loop below).
  2.2106 -        stringRegexp = '/(?:[^/\\\\]|\\\\.)*/\w*',
  2.2107 -        // These characters have special meaning to the parser and must not appear in the middle of a
  2.2108 -        // token, except as part of a string.
  2.2109 -        specials = ',"\'{}()/:[\\]',
  2.2110 -        // Match text (at least two characters) that does not contain any of the above special characters,
  2.2111 -        // although some of the special characters are allowed to start it (all but the colon and comma).
  2.2112 -        // The text can contain spaces, but leading or trailing spaces are skipped.
  2.2113 -        everyThingElse = '[^\\s:,/][^' + specials + ']*[^\\s' + specials + ']',
  2.2114 -        // Match any non-space character not matched already. This will match colons and commas, since they're
  2.2115 -        // not matched by "everyThingElse", but will also match any other single character that wasn't already
  2.2116 -        // matched (for example: in "a: 1, b: 2", each of the non-space characters will be matched by oneNotSpace).
  2.2117 -        oneNotSpace = '[^\\s]',
  2.2118 -
  2.2119 -        // Create the actual regular expression by or-ing the above strings. The order is important.
  2.2120 -        bindingToken = RegExp(stringDouble + '|' + stringSingle + '|' + stringRegexp + '|' + everyThingElse + '|' + oneNotSpace, 'g'),
  2.2121 -
  2.2122 -        // Match end of previous token to determine whether a slash is a division or regex.
  2.2123 -        divisionLookBehind = /[\])"'A-Za-z0-9_$]+$/,
  2.2124 -        keywordRegexLookBehind = {'in':1,'return':1,'typeof':1};
  2.2125 -
  2.2126 -    function parseObjectLiteral(objectLiteralString) {
  2.2127 -        // Trim leading and trailing spaces from the string
  2.2128 -        var str = ko.utils.stringTrim(objectLiteralString);
  2.2129 -
  2.2130 -        // Trim braces '{' surrounding the whole object literal
  2.2131 -        if (str.charCodeAt(0) === 123) str = str.slice(1, -1);
  2.2132 -
  2.2133 -        // Split into tokens
  2.2134 -        var result = [], toks = str.match(bindingToken), key, values, depth = 0;
  2.2135 -
  2.2136 -        if (toks) {
  2.2137 -            // Append a comma so that we don't need a separate code block to deal with the last item
  2.2138 -            toks.push(',');
  2.2139 -
  2.2140 -            for (var i = 0, tok; tok = toks[i]; ++i) {
  2.2141 -                var c = tok.charCodeAt(0);
  2.2142 -                // A comma signals the end of a key/value pair if depth is zero
  2.2143 -                if (c === 44) { // ","
  2.2144 -                    if (depth <= 0) {
  2.2145 -                        if (key)
  2.2146 -                            result.push(values ? {key: key, value: values.join('')} : {'unknown': key});
  2.2147 -                        key = values = depth = 0;
  2.2148 -                        continue;
  2.2149 -                    }
  2.2150 -                // Simply skip the colon that separates the name and value
  2.2151 -                } else if (c === 58) { // ":"
  2.2152 -                    if (!values)
  2.2153 -                        continue;
  2.2154 -                // A set of slashes is initially matched as a regular expression, but could be division
  2.2155 -                } else if (c === 47 && i && tok.length > 1) {  // "/"
  2.2156 -                    // Look at the end of the previous token to determine if the slash is actually division
  2.2157 -                    var match = toks[i-1].match(divisionLookBehind);
  2.2158 -                    if (match && !keywordRegexLookBehind[match[0]]) {
  2.2159 -                        // The slash is actually a division punctuator; re-parse the remainder of the string (not including the slash)
  2.2160 -                        str = str.substr(str.indexOf(tok) + 1);
  2.2161 -                        toks = str.match(bindingToken);
  2.2162 -                        toks.push(',');
  2.2163 -                        i = -1;
  2.2164 -                        // Continue with just the slash
  2.2165 -                        tok = '/';
  2.2166 -                    }
  2.2167 -                // Increment depth for parentheses, braces, and brackets so that interior commas are ignored
  2.2168 -                } else if (c === 40 || c === 123 || c === 91) { // '(', '{', '['
  2.2169 -                    ++depth;
  2.2170 -                } else if (c === 41 || c === 125 || c === 93) { // ')', '}', ']'
  2.2171 -                    --depth;
  2.2172 -                // The key must be a single token; if it's a string, trim the quotes
  2.2173 -                } else if (!key && !values) {
  2.2174 -                    key = (c === 34 || c === 39) /* '"', "'" */ ? tok.slice(1, -1) : tok;
  2.2175 -                    continue;
  2.2176 -                }
  2.2177 -                if (values)
  2.2178 -                    values.push(tok);
  2.2179 -                else
  2.2180 -                    values = [tok];
  2.2181 -            }
  2.2182 -        }
  2.2183 -        return result;
  2.2184 -    }
  2.2185 -
  2.2186 -    // Two-way bindings include a write function that allow the handler to update the value even if it's not an observable.
  2.2187 -    var twoWayBindings = {};
  2.2188 -
  2.2189 -    function preProcessBindings(bindingsStringOrKeyValueArray, bindingOptions) {
  2.2190 -        bindingOptions = bindingOptions || {};
  2.2191 -
  2.2192 -        function processKeyValue(key, val) {
  2.2193 -            var writableVal;
  2.2194 -            function callPreprocessHook(obj) {
  2.2195 -                return (obj && obj['preprocess']) ? (val = obj['preprocess'](val, key, processKeyValue)) : true;
  2.2196 -            }
  2.2197 -            if (!bindingParams) {
  2.2198 -                if (!callPreprocessHook(ko['getBindingHandler'](key)))
  2.2199 -                    return;
  2.2200 -
  2.2201 -                if (twoWayBindings[key] && (writableVal = getWriteableValue(val))) {
  2.2202 -                    // For two-way bindings, provide a write method in case the value
  2.2203 -                    // isn't a writable observable.
  2.2204 -                    propertyAccessorResultStrings.push("'" + key + "':function(_z){" + writableVal + "=_z}");
  2.2205 -                }
  2.2206 -            }
  2.2207 -            // Values are wrapped in a function so that each value can be accessed independently
  2.2208 -            if (makeValueAccessors) {
  2.2209 -                val = 'function(){return ' + val + ' }';
  2.2210 -            }
  2.2211 -            resultStrings.push("'" + key + "':" + val);
  2.2212 -        }
  2.2213 -
  2.2214 -        var resultStrings = [],
  2.2215 -            propertyAccessorResultStrings = [],
  2.2216 -            makeValueAccessors = bindingOptions['valueAccessors'],
  2.2217 -            bindingParams = bindingOptions['bindingParams'],
  2.2218 -            keyValueArray = typeof bindingsStringOrKeyValueArray === "string" ?
  2.2219 -                parseObjectLiteral(bindingsStringOrKeyValueArray) : bindingsStringOrKeyValueArray;
  2.2220 -
  2.2221 -        ko.utils.arrayForEach(keyValueArray, function(keyValue) {
  2.2222 -            processKeyValue(keyValue.key || keyValue['unknown'], keyValue.value);
  2.2223 -        });
  2.2224 -
  2.2225 -        if (propertyAccessorResultStrings.length)
  2.2226 -            processKeyValue('_ko_property_writers', "{" + propertyAccessorResultStrings.join(",") + " }");
  2.2227 -
  2.2228 -        return resultStrings.join(",");
  2.2229 -    }
  2.2230 -
  2.2231 -    return {
  2.2232 -        bindingRewriteValidators: [],
  2.2233 -
  2.2234 -        twoWayBindings: twoWayBindings,
  2.2235 -
  2.2236 -        parseObjectLiteral: parseObjectLiteral,
  2.2237 -
  2.2238 -        preProcessBindings: preProcessBindings,
  2.2239 -
  2.2240 -        keyValueArrayContainsKey: function(keyValueArray, key) {
  2.2241 -            for (var i = 0; i < keyValueArray.length; i++)
  2.2242 -                if (keyValueArray[i]['key'] == key)
  2.2243 -                    return true;
  2.2244 -            return false;
  2.2245 -        },
  2.2246 -
  2.2247 -        // Internal, private KO utility for updating model properties from within bindings
  2.2248 -        // property:            If the property being updated is (or might be) an observable, pass it here
  2.2249 -        //                      If it turns out to be a writable observable, it will be written to directly
  2.2250 -        // allBindings:         An object with a get method to retrieve bindings in the current execution context.
  2.2251 -        //                      This will be searched for a '_ko_property_writers' property in case you're writing to a non-observable
  2.2252 -        // key:                 The key identifying the property to be written. Example: for { hasFocus: myValue }, write to 'myValue' by specifying the key 'hasFocus'
  2.2253 -        // value:               The value to be written
  2.2254 -        // checkIfDifferent:    If true, and if the property being written is a writable observable, the value will only be written if
  2.2255 -        //                      it is !== existing value on that writable observable
  2.2256 -        writeValueToProperty: function(property, allBindings, key, value, checkIfDifferent) {
  2.2257 -            if (!property || !ko.isObservable(property)) {
  2.2258 -                var propWriters = allBindings.get('_ko_property_writers');
  2.2259 -                if (propWriters && propWriters[key])
  2.2260 -                    propWriters[key](value);
  2.2261 -            } else if (ko.isWriteableObservable(property) && (!checkIfDifferent || property.peek() !== value)) {
  2.2262 -                property(value);
  2.2263 -            }
  2.2264 -        }
  2.2265 -    };
  2.2266 -})();
  2.2267 -
  2.2268 -ko.exportSymbol('expressionRewriting', ko.expressionRewriting);
  2.2269 -ko.exportSymbol('expressionRewriting.bindingRewriteValidators', ko.expressionRewriting.bindingRewriteValidators);
  2.2270 -ko.exportSymbol('expressionRewriting.parseObjectLiteral', ko.expressionRewriting.parseObjectLiteral);
  2.2271 -ko.exportSymbol('expressionRewriting.preProcessBindings', ko.expressionRewriting.preProcessBindings);
  2.2272 -
  2.2273 -// Making bindings explicitly declare themselves as "two way" isn't ideal in the long term (it would be better if
  2.2274 -// all bindings could use an official 'property writer' API without needing to declare that they might). However,
  2.2275 -// since this is not, and has never been, a public API (_ko_property_writers was never documented), it's acceptable
  2.2276 -// as an internal implementation detail in the short term.
  2.2277 -// For those developers who rely on _ko_property_writers in their custom bindings, we expose _twoWayBindings as an
  2.2278 -// undocumented feature that makes it relatively easy to upgrade to KO 3.0. However, this is still not an official
  2.2279 -// public API, and we reserve the right to remove it at any time if we create a real public property writers API.
  2.2280 -ko.exportSymbol('expressionRewriting._twoWayBindings', ko.expressionRewriting.twoWayBindings);
  2.2281 -
  2.2282 -// For backward compatibility, define the following aliases. (Previously, these function names were misleading because
  2.2283 -// they referred to JSON specifically, even though they actually work with arbitrary JavaScript object literal expressions.)
  2.2284 -ko.exportSymbol('jsonExpressionRewriting', ko.expressionRewriting);
  2.2285 -ko.exportSymbol('jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko.expressionRewriting.preProcessBindings);
  2.2286 -(function() {
  2.2287 -    // "Virtual elements" is an abstraction on top of the usual DOM API which understands the notion that comment nodes
  2.2288 -    // may be used to represent hierarchy (in addition to the DOM's natural hierarchy).
  2.2289 -    // If you call the DOM-manipulating functions on ko.virtualElements, you will be able to read and write the state
  2.2290 -    // of that virtual hierarchy
  2.2291 -    //
  2.2292 -    // The point of all this is to support containerless templates (e.g., <!-- ko foreach:someCollection -->blah<!-- /ko -->)
  2.2293 -    // without having to scatter special cases all over the binding and templating code.
  2.2294 -
  2.2295 -    // IE 9 cannot reliably read the "nodeValue" property of a comment node (see https://github.com/SteveSanderson/knockout/issues/186)
  2.2296 -    // but it does give them a nonstandard alternative property called "text" that it can read reliably. Other browsers don't have that property.
  2.2297 -    // So, use node.text where available, and node.nodeValue elsewhere
  2.2298 -    var commentNodesHaveTextProperty = document && document.createComment("test").text === "<!--test-->";
  2.2299 -
  2.2300 -    var startCommentRegex = commentNodesHaveTextProperty ? /^<!--\s*ko(?:\s+([\s\S]+))?\s*-->$/ : /^\s*ko(?:\s+([\s\S]+))?\s*$/;
  2.2301 -    var endCommentRegex =   commentNodesHaveTextProperty ? /^<!--\s*\/ko\s*-->$/ : /^\s*\/ko\s*$/;
  2.2302 -    var htmlTagsWithOptionallyClosingChildren = { 'ul': true, 'ol': true };
  2.2303 -
  2.2304 -    function isStartComment(node) {
  2.2305 -        return (node.nodeType == 8) && startCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue);
  2.2306 -    }
  2.2307 -
  2.2308 -    function isEndComment(node) {
  2.2309 -        return (node.nodeType == 8) && endCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue);
  2.2310 -    }
  2.2311 -
  2.2312 -    function getVirtualChildren(startComment, allowUnbalanced) {
  2.2313 -        var currentNode = startComment;
  2.2314 -        var depth = 1;
  2.2315 -        var children = [];
  2.2316 -        while (currentNode = currentNode.nextSibling) {
  2.2317 -            if (isEndComment(currentNode)) {
  2.2318 -                depth--;
  2.2319 -                if (depth === 0)
  2.2320 -                    return children;
  2.2321 -            }
  2.2322 -
  2.2323 -            children.push(currentNode);
  2.2324 -
  2.2325 -            if (isStartComment(currentNode))
  2.2326 -                depth++;
  2.2327 -        }
  2.2328 -        if (!allowUnbalanced)
  2.2329 -            throw new Error("Cannot find closing comment tag to match: " + startComment.nodeValue);
  2.2330 -        return null;
  2.2331 -    }
  2.2332 -
  2.2333 -    function getMatchingEndComment(startComment, allowUnbalanced) {
  2.2334 -        var allVirtualChildren = getVirtualChildren(startComment, allowUnbalanced);
  2.2335 -        if (allVirtualChildren) {
  2.2336 -            if (allVirtualChildren.length > 0)
  2.2337 -                return allVirtualChildren[allVirtualChildren.length - 1].nextSibling;
  2.2338 -            return startComment.nextSibling;
  2.2339 -        } else
  2.2340 -            return null; // Must have no matching end comment, and allowUnbalanced is true
  2.2341 -    }
  2.2342 -
  2.2343 -    function getUnbalancedChildTags(node) {
  2.2344 -        // e.g., from <div>OK</div><!-- ko blah --><span>Another</span>, returns: <!-- ko blah --><span>Another</span>
  2.2345 -        //       from <div>OK</div><!-- /ko --><!-- /ko -->,             returns: <!-- /ko --><!-- /ko -->
  2.2346 -        var childNode = node.firstChild, captureRemaining = null;
  2.2347 -        if (childNode) {
  2.2348 -            do {
  2.2349 -                if (captureRemaining)                   // We already hit an unbalanced node and are now just scooping up all subsequent nodes
  2.2350 -                    captureRemaining.push(childNode);
  2.2351 -                else if (isStartComment(childNode)) {
  2.2352 -                    var matchingEndComment = getMatchingEndComment(childNode, /* allowUnbalanced: */ true);
  2.2353 -                    if (matchingEndComment)             // It's a balanced tag, so skip immediately to the end of this virtual set
  2.2354 -                        childNode = matchingEndComment;
  2.2355 -                    else
  2.2356 -                        captureRemaining = [childNode]; // It's unbalanced, so start capturing from this point
  2.2357 -                } else if (isEndComment(childNode)) {
  2.2358 -                    captureRemaining = [childNode];     // It's unbalanced (if it wasn't, we'd have skipped over it already), so start capturing
  2.2359 -                }
  2.2360 -            } while (childNode = childNode.nextSibling);
  2.2361 -        }
  2.2362 -        return captureRemaining;
  2.2363 -    }
  2.2364 -
  2.2365 -    ko.virtualElements = {
  2.2366 -        allowedBindings: {},
  2.2367 -
  2.2368 -        childNodes: function(node) {
  2.2369 -            return isStartComment(node) ? getVirtualChildren(node) : node.childNodes;
  2.2370 -        },
  2.2371 -
  2.2372 -        emptyNode: function(node) {
  2.2373 -            if (!isStartComment(node))
  2.2374 -                ko.utils.emptyDomNode(node);
  2.2375 -            else {
  2.2376 -                var virtualChildren = ko.virtualElements.childNodes(node);
  2.2377 -                for (var i = 0, j = virtualChildren.length; i < j; i++)
  2.2378 -                    ko.removeNode(virtualChildren[i]);
  2.2379 -            }
  2.2380 -        },
  2.2381 -
  2.2382 -        setDomNodeChildren: function(node, childNodes) {
  2.2383 -            if (!isStartComment(node))
  2.2384 -                ko.utils.setDomNodeChildren(node, childNodes);
  2.2385 -            else {
  2.2386 -                ko.virtualElements.emptyNode(node);
  2.2387 -                var endCommentNode = node.nextSibling; // Must be the next sibling, as we just emptied the children
  2.2388 -                for (var i = 0, j = childNodes.length; i < j; i++)
  2.2389 -                    endCommentNode.parentNode.insertBefore(childNodes[i], endCommentNode);
  2.2390 -            }
  2.2391 -        },
  2.2392 -
  2.2393 -        prepend: function(containerNode, nodeToPrepend) {
  2.2394 -            if (!isStartComment(containerNode)) {
  2.2395 -                if (containerNode.firstChild)
  2.2396 -                    containerNode.insertBefore(nodeToPrepend, containerNode.firstChild);
  2.2397 -                else
  2.2398 -                    containerNode.appendChild(nodeToPrepend);
  2.2399 -            } else {
  2.2400 -                // Start comments must always have a parent and at least one following sibling (the end comment)
  2.2401 -                containerNode.parentNode.insertBefore(nodeToPrepend, containerNode.nextSibling);
  2.2402 -            }
  2.2403 -        },
  2.2404 -
  2.2405 -        insertAfter: function(containerNode, nodeToInsert, insertAfterNode) {
  2.2406 -            if (!insertAfterNode) {
  2.2407 -                ko.virtualElements.prepend(containerNode, nodeToInsert);
  2.2408 -            } else if (!isStartComment(containerNode)) {
  2.2409 -                // Insert after insertion point
  2.2410 -                if (insertAfterNode.nextSibling)
  2.2411 -                    containerNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling);
  2.2412 -                else
  2.2413 -                    containerNode.appendChild(nodeToInsert);
  2.2414 -            } else {
  2.2415 -                // Children of start comments must always have a parent and at least one following sibling (the end comment)
  2.2416 -                containerNode.parentNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling);
  2.2417 -            }
  2.2418 -        },
  2.2419 -
  2.2420 -        firstChild: function(node) {
  2.2421 -            if (!isStartComment(node))
  2.2422 -                return node.firstChild;
  2.2423 -            if (!node.nextSibling || isEndComment(node.nextSibling))
  2.2424 -                return null;
  2.2425 -            return node.nextSibling;
  2.2426 -        },
  2.2427 -
  2.2428 -        nextSibling: function(node) {
  2.2429 -            if (isStartComment(node))
  2.2430 -                node = getMatchingEndComment(node);
  2.2431 -            if (node.nextSibling && isEndComment(node.nextSibling))
  2.2432 -                return null;
  2.2433 -            return node.nextSibling;
  2.2434 -        },
  2.2435 -
  2.2436 -        hasBindingValue: isStartComment,
  2.2437 -
  2.2438 -        virtualNodeBindingValue: function(node) {
  2.2439 -            var regexMatch = (commentNodesHaveTextProperty ? node.text : node.nodeValue).match(startCommentRegex);
  2.2440 -            return regexMatch ? regexMatch[1] : null;
  2.2441 -        },
  2.2442 -
  2.2443 -        normaliseVirtualElementDomStructure: function(elementVerified) {
  2.2444 -            // Workaround for https://github.com/SteveSanderson/knockout/issues/155
  2.2445 -            // (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
  2.2446 -            // that are direct descendants of <ul> into the preceding <li>)
  2.2447 -            if (!htmlTagsWithOptionallyClosingChildren[ko.utils.tagNameLower(elementVerified)])
  2.2448 -                return;
  2.2449 -
  2.2450 -            // Scan immediate children to see if they contain unbalanced comment tags. If they do, those comment tags
  2.2451 -            // must be intended to appear *after* that child, so move them there.
  2.2452 -            var childNode = elementVerified.firstChild;
  2.2453 -            if (childNode) {
  2.2454 -                do {
  2.2455 -                    if (childNode.nodeType === 1) {
  2.2456 -                        var unbalancedTags = getUnbalancedChildTags(childNode);
  2.2457 -                        if (unbalancedTags) {
  2.2458 -                            // Fix up the DOM by moving the unbalanced tags to where they most likely were intended to be placed - *after* the child
  2.2459 -                            var nodeToInsertBefore = childNode.nextSibling;
  2.2460 -                            for (var i = 0; i < unbalancedTags.length; i++) {
  2.2461 -                                if (nodeToInsertBefore)
  2.2462 -                                    elementVerified.insertBefore(unbalancedTags[i], nodeToInsertBefore);
  2.2463 -                                else
  2.2464 -                                    elementVerified.appendChild(unbalancedTags[i]);
  2.2465 -                            }
  2.2466 -                        }
  2.2467 -                    }
  2.2468 -                } while (childNode = childNode.nextSibling);
  2.2469 -            }
  2.2470 -        }
  2.2471 -    };
  2.2472 -})();
  2.2473 -ko.exportSymbol('virtualElements', ko.virtualElements);
  2.2474 -ko.exportSymbol('virtualElements.allowedBindings', ko.virtualElements.allowedBindings);
  2.2475 -ko.exportSymbol('virtualElements.emptyNode', ko.virtualElements.emptyNode);
  2.2476 -//ko.exportSymbol('virtualElements.firstChild', ko.virtualElements.firstChild);     // firstChild is not minified
  2.2477 -ko.exportSymbol('virtualElements.insertAfter', ko.virtualElements.insertAfter);
  2.2478 -//ko.exportSymbol('virtualElements.nextSibling', ko.virtualElements.nextSibling);   // nextSibling is not minified
  2.2479 -ko.exportSymbol('virtualElements.prepend', ko.virtualElements.prepend);
  2.2480 -ko.exportSymbol('virtualElements.setDomNodeChildren', ko.virtualElements.setDomNodeChildren);
  2.2481 -(function() {
  2.2482 -    var defaultBindingAttributeName = "data-bind";
  2.2483 -
  2.2484 -    ko.bindingProvider = function() {
  2.2485 -        this.bindingCache = {};
  2.2486 -    };
  2.2487 -
  2.2488 -    ko.utils.extend(ko.bindingProvider.prototype, {
  2.2489 -        'nodeHasBindings': function(node) {
  2.2490 -            switch (node.nodeType) {
  2.2491 -                case 1: // Element
  2.2492 -                    return node.getAttribute(defaultBindingAttributeName) != null
  2.2493 -                        || ko.components['getComponentNameForNode'](node);
  2.2494 -                case 8: // Comment node
  2.2495 -                    return ko.virtualElements.hasBindingValue(node);
  2.2496 -                default: return false;
  2.2497 -            }
  2.2498 -        },
  2.2499 -
  2.2500 -        'getBindings': function(node, bindingContext) {
  2.2501 -            var bindingsString = this['getBindingsString'](node, bindingContext),
  2.2502 -                parsedBindings = bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node) : null;
  2.2503 -            return ko.components.addBindingsForCustomElement(parsedBindings, node, bindingContext, /* valueAccessors */ false);
  2.2504 -        },
  2.2505 -
  2.2506 -        'getBindingAccessors': function(node, bindingContext) {
  2.2507 -            var bindingsString = this['getBindingsString'](node, bindingContext),
  2.2508 -                parsedBindings = bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node, { 'valueAccessors': true }) : null;
  2.2509 -            return ko.components.addBindingsForCustomElement(parsedBindings, node, bindingContext, /* valueAccessors */ true);
  2.2510 -        },
  2.2511 -
  2.2512 -        // The following function is only used internally by this default provider.
  2.2513 -        // It's not part of the interface definition for a general binding provider.
  2.2514 -        'getBindingsString': function(node, bindingContext) {
  2.2515 -            switch (node.nodeType) {
  2.2516 -                case 1: return node.getAttribute(defaultBindingAttributeName);   // Element
  2.2517 -                case 8: return ko.virtualElements.virtualNodeBindingValue(node); // Comment node
  2.2518 -                default: return null;
  2.2519 -            }
  2.2520 -        },
  2.2521 -
  2.2522 -        // The following function is only used internally by this default provider.
  2.2523 -        // It's not part of the interface definition for a general binding provider.
  2.2524 -        'parseBindingsString': function(bindingsString, bindingContext, node, options) {
  2.2525 -            try {
  2.2526 -                var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, this.bindingCache, options);
  2.2527 -                return bindingFunction(bindingContext, node);
  2.2528 -            } catch (ex) {
  2.2529 -                ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString + "\nMessage: " + ex.message;
  2.2530 -                throw ex;
  2.2531 -            }
  2.2532 -        }
  2.2533 -    });
  2.2534 -
  2.2535 -    ko.bindingProvider['instance'] = new ko.bindingProvider();
  2.2536 -
  2.2537 -    function createBindingsStringEvaluatorViaCache(bindingsString, cache, options) {
  2.2538 -        var cacheKey = bindingsString + (options && options['valueAccessors'] || '');
  2.2539 -        return cache[cacheKey]
  2.2540 -            || (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, options));
  2.2541 -    }
  2.2542 -
  2.2543 -    function createBindingsStringEvaluator(bindingsString, options) {
  2.2544 -        // Build the source for a function that evaluates "expression"
  2.2545 -        // For each scope variable, add an extra level of "with" nesting
  2.2546 -        // Example result: with(sc1) { with(sc0) { return (expression) } }
  2.2547 -        var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options),
  2.2548 -            functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}";
  2.2549 -        return new Function("$context", "$element", functionBody);
  2.2550 -    }
  2.2551 -})();
  2.2552 -
  2.2553 -ko.exportSymbol('bindingProvider', ko.bindingProvider);
  2.2554 -(function () {
  2.2555 -    ko.bindingHandlers = {};
  2.2556 -
  2.2557 -    // The following element types will not be recursed into during binding. In the future, we
  2.2558 -    // may consider adding <template> to this list, because such elements' contents are always
  2.2559 -    // intended to be bound in a different context from where they appear in the document.
  2.2560 -    var bindingDoesNotRecurseIntoElementTypes = {
  2.2561 -        // Don't want bindings that operate on text nodes to mutate <script> contents,
  2.2562 -        // because it's unexpected and a potential XSS issue
  2.2563 -        'script': true
  2.2564 -    };
  2.2565 -
  2.2566 -    // Use an overridable method for retrieving binding handlers so that a plugins may support dynamically created handlers
  2.2567 -    ko['getBindingHandler'] = function(bindingKey) {
  2.2568 -        return ko.bindingHandlers[bindingKey];
  2.2569 -    };
  2.2570 -
  2.2571 -    // The ko.bindingContext constructor is only called directly to create the root context. For child
  2.2572 -    // contexts, use bindingContext.createChildContext or bindingContext.extend.
  2.2573 -    ko.bindingContext = function(dataItemOrAccessor, parentContext, dataItemAlias, extendCallback) {
  2.2574 -
  2.2575 -        // The binding context object includes static properties for the current, parent, and root view models.
  2.2576 -        // If a view model is actually stored in an observable, the corresponding binding context object, and
  2.2577 -        // any child contexts, must be updated when the view model is changed.
  2.2578 -        function updateContext() {
  2.2579 -            // Most of the time, the context will directly get a view model object, but if a function is given,
  2.2580 -            // we call the function to retrieve the view model. If the function accesses any obsevables or returns
  2.2581 -            // an observable, the dependency is tracked, and those observables can later cause the binding
  2.2582 -            // context to be updated.
  2.2583 -            var dataItemOrObservable = isFunc ? dataItemOrAccessor() : dataItemOrAccessor,
  2.2584 -                dataItem = ko.utils.unwrapObservable(dataItemOrObservable);
  2.2585 -
  2.2586 -            if (parentContext) {
  2.2587 -                // When a "parent" context is given, register a dependency on the parent context. Thus whenever the
  2.2588 -                // parent context is updated, this context will also be updated.
  2.2589 -                if (parentContext._subscribable)
  2.2590 -                    parentContext._subscribable();
  2.2591 -
  2.2592 -                // Copy $root and any custom properties from the parent context
  2.2593 -                ko.utils.extend(self, parentContext);
  2.2594 -
  2.2595 -                // Because the above copy overwrites our own properties, we need to reset them.
  2.2596 -                // During the first execution, "subscribable" isn't set, so don't bother doing the update then.
  2.2597 -                if (subscribable) {
  2.2598 -                    self._subscribable = subscribable;
  2.2599 -                }
  2.2600 -            } else {
  2.2601 -                self['$parents'] = [];
  2.2602 -                self['$root'] = dataItem;
  2.2603 -
  2.2604 -                // Export 'ko' in the binding context so it will be available in bindings and templates
  2.2605 -                // even if 'ko' isn't exported as a global, such as when using an AMD loader.
  2.2606 -                // See https://github.com/SteveSanderson/knockout/issues/490
  2.2607 -                self['ko'] = ko;
  2.2608 -            }
  2.2609 -            self['$rawData'] = dataItemOrObservable;
  2.2610 -            self['$data'] = dataItem;
  2.2611 -            if (dataItemAlias)
  2.2612 -                self[dataItemAlias] = dataItem;
  2.2613 -
  2.2614 -            // The extendCallback function is provided when creating a child context or extending a context.
  2.2615 -            // It handles the specific actions needed to finish setting up the binding context. Actions in this
  2.2616 -            // function could also add dependencies to this binding context.
  2.2617 -            if (extendCallback)
  2.2618 -                extendCallback(self, parentContext, dataItem);
  2.2619 -
  2.2620 -            return self['$data'];
  2.2621 -        }
  2.2622 -        function disposeWhen() {
  2.2623 -            return nodes && !ko.utils.anyDomNodeIsAttachedToDocument(nodes);
  2.2624 -        }
  2.2625 -
  2.2626 -        var self = this,
  2.2627 -            isFunc = typeof(dataItemOrAccessor) == "function" && !ko.isObservable(dataItemOrAccessor),
  2.2628 -            nodes,
  2.2629 -            subscribable = ko.dependentObservable(updateContext, null, { disposeWhen: disposeWhen, disposeWhenNodeIsRemoved: true });
  2.2630 -
  2.2631 -        // At this point, the binding context has been initialized, and the "subscribable" computed observable is
  2.2632 -        // subscribed to any observables that were accessed in the process. If there is nothing to track, the
  2.2633 -        // computed will be inactive, and we can safely throw it away. If it's active, the computed is stored in
  2.2634 -        // the context object.
  2.2635 -        if (subscribable.isActive()) {
  2.2636 -            self._subscribable = subscribable;
  2.2637 -
  2.2638 -            // Always notify because even if the model ($data) hasn't changed, other context properties might have changed
  2.2639 -            subscribable['equalityComparer'] = null;
  2.2640 -
  2.2641 -            // We need to be able to dispose of this computed observable when it's no longer needed. This would be
  2.2642 -            // easy if we had a single node to watch, but binding contexts can be used by many different nodes, and
  2.2643 -            // we cannot assume that those nodes have any relation to each other. So instead we track any node that
  2.2644 -            // the context is attached to, and dispose the computed when all of those nodes have been cleaned.
  2.2645 -
  2.2646 -            // Add properties to *subscribable* instead of *self* because any properties added to *self* may be overwritten on updates
  2.2647 -            nodes = [];
  2.2648 -            subscribable._addNode = function(node) {
  2.2649 -                nodes.push(node);
  2.2650 -                ko.utils.domNodeDisposal.addDisposeCallback(node, function(node) {
  2.2651 -                    ko.utils.arrayRemoveItem(nodes, node);
  2.2652 -                    if (!nodes.length) {
  2.2653 -                        subscribable.dispose();
  2.2654 -                        self._subscribable = subscribable = undefined;
  2.2655 -                    }
  2.2656 -                });
  2.2657 -            };
  2.2658 -        }
  2.2659 -    }
  2.2660 -
  2.2661 -    // Extend the binding context hierarchy with a new view model object. If the parent context is watching
  2.2662 -    // any obsevables, the new child context will automatically get a dependency on the parent context.
  2.2663 -    // But this does not mean that the $data value of the child context will also get updated. If the child
  2.2664 -    // view model also depends on the parent view model, you must provide a function that returns the correct
  2.2665 -    // view model on each update.
  2.2666 -    ko.bindingContext.prototype['createChildContext'] = function (dataItemOrAccessor, dataItemAlias, extendCallback) {
  2.2667 -        return new ko.bindingContext(dataItemOrAccessor, this, dataItemAlias, function(self, parentContext) {
  2.2668 -            // Extend the context hierarchy by setting the appropriate pointers
  2.2669 -            self['$parentContext'] = parentContext;
  2.2670 -            self['$parent'] = parentContext['$data'];
  2.2671 -            self['$parents'] = (parentContext['$parents'] || []).slice(0);
  2.2672 -            self['$parents'].unshift(self['$parent']);
  2.2673 -            if (extendCallback)
  2.2674 -                extendCallback(self);
  2.2675 -        });
  2.2676 -    };
  2.2677 -
  2.2678 -    // Extend the binding context with new custom properties. This doesn't change the context hierarchy.
  2.2679 -    // Similarly to "child" contexts, provide a function here to make sure that the correct values are set
  2.2680 -    // when an observable view model is updated.
  2.2681 -    ko.bindingContext.prototype['extend'] = function(properties) {
  2.2682 -        // If the parent context references an observable view model, "_subscribable" will always be the
  2.2683 -        // latest view model object. If not, "_subscribable" isn't set, and we can use the static "$data" value.
  2.2684 -        return new ko.bindingContext(this._subscribable || this['$data'], this, null, function(self, parentContext) {
  2.2685 -            // This "child" context doesn't directly track a parent observable view model,
  2.2686 -            // so we need to manually set the $rawData value to match the parent.
  2.2687 -            self['$rawData'] = parentContext['$rawData'];
  2.2688 -            ko.utils.extend(self, typeof(properties) == "function" ? properties() : properties);
  2.2689 -        });
  2.2690 -    };
  2.2691 -
  2.2692 -    // Returns the valueAccesor function for a binding value
  2.2693 -    function makeValueAccessor(value) {
  2.2694 -        return function() {
  2.2695 -            return value;
  2.2696 -        };
  2.2697 -    }
  2.2698 -
  2.2699 -    // Returns the value of a valueAccessor function
  2.2700 -    function evaluateValueAccessor(valueAccessor) {
  2.2701 -        return valueAccessor();
  2.2702 -    }
  2.2703 -
  2.2704 -    // Given a function that returns bindings, create and return a new object that contains
  2.2705 -    // binding value-accessors functions. Each accessor function calls the original function
  2.2706 -    // so that it always gets the latest value and all dependencies are captured. This is used
  2.2707 -    // by ko.applyBindingsToNode and getBindingsAndMakeAccessors.
  2.2708 -    function makeAccessorsFromFunction(callback) {
  2.2709 -        return ko.utils.objectMap(ko.dependencyDetection.ignore(callback), function(value, key) {
  2.2710 -            return function() {
  2.2711 -                return callback()[key];
  2.2712 -            };
  2.2713 -        });
  2.2714 -    }
  2.2715 -
  2.2716 -    // Given a bindings function or object, create and return a new object that contains
  2.2717 -    // binding value-accessors functions. This is used by ko.applyBindingsToNode.
  2.2718 -    function makeBindingAccessors(bindings, context, node) {
  2.2719 -        if (typeof bindings === 'function') {
  2.2720 -            return makeAccessorsFromFunction(bindings.bind(null, context, node));
  2.2721 -        } else {
  2.2722 -            return ko.utils.objectMap(bindings, makeValueAccessor);
  2.2723 -        }
  2.2724 -    }
  2.2725 -
  2.2726 -    // This function is used if the binding provider doesn't include a getBindingAccessors function.
  2.2727 -    // It must be called with 'this' set to the provider instance.
  2.2728 -    function getBindingsAndMakeAccessors(node, context) {
  2.2729 -        return makeAccessorsFromFunction(this['getBindings'].bind(this, node, context));
  2.2730 -    }
  2.2731 -
  2.2732 -    function validateThatBindingIsAllowedForVirtualElements(bindingName) {
  2.2733 -        var validator = ko.virtualElements.allowedBindings[bindingName];
  2.2734 -        if (!validator)
  2.2735 -            throw new Error("The binding '" + bindingName + "' cannot be used with virtual elements")
  2.2736 -    }
  2.2737 -
  2.2738 -    function applyBindingsToDescendantsInternal (bindingContext, elementOrVirtualElement, bindingContextsMayDifferFromDomParentElement) {
  2.2739 -        var currentChild,
  2.2740 -            nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement),
  2.2741 -            provider = ko.bindingProvider['instance'],
  2.2742 -            preprocessNode = provider['preprocessNode'];
  2.2743 -
  2.2744 -        // Preprocessing allows a binding provider to mutate a node before bindings are applied to it. For example it's
  2.2745 -        // possible to insert new siblings after it, and/or replace the node with a different one. This can be used to
  2.2746 -        // implement custom binding syntaxes, such as {{ value }} for string interpolation, or custom element types that
  2.2747 -        // trigger insertion of <template> contents at that point in the document.
  2.2748 -        if (preprocessNode) {
  2.2749 -            while (currentChild = nextInQueue) {
  2.2750 -                nextInQueue = ko.virtualElements.nextSibling(currentChild);
  2.2751 -                preprocessNode.call(provider, currentChild);
  2.2752 -            }
  2.2753 -            // Reset nextInQueue for the next loop
  2.2754 -            nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement);
  2.2755 -        }
  2.2756 -
  2.2757 -        while (currentChild = nextInQueue) {
  2.2758 -            // Keep a record of the next child *before* applying bindings, in case the binding removes the current child from its position
  2.2759 -            nextInQueue = ko.virtualElements.nextSibling(currentChild);
  2.2760 -            applyBindingsToNodeAndDescendantsInternal(bindingContext, currentChild, bindingContextsMayDifferFromDomParentElement);
  2.2761 -        }
  2.2762 -    }
  2.2763 -
  2.2764 -    function applyBindingsToNodeAndDescendantsInternal (bindingContext, nodeVerified, bindingContextMayDifferFromDomParentElement) {
  2.2765 -        var shouldBindDescendants = true;
  2.2766 -
  2.2767 -        // Perf optimisation: Apply bindings only if...
  2.2768 -        // (1) We need to store the binding context on this node (because it may differ from the DOM parent node's binding context)
  2.2769 -        //     Note that we can't store binding contexts on non-elements (e.g., text nodes), as IE doesn't allow expando properties for those
  2.2770 -        // (2) It might have bindings (e.g., it has a data-bind attribute, or it's a marker for a containerless template)
  2.2771 -        var isElement = (nodeVerified.nodeType === 1);
  2.2772 -        if (isElement) // Workaround IE <= 8 HTML parsing weirdness
  2.2773 -            ko.virtualElements.normaliseVirtualElementDomStructure(nodeVerified);
  2.2774 -
  2.2775 -        var shouldApplyBindings = (isElement && bindingContextMayDifferFromDomParentElement)             // Case (1)
  2.2776 -                               || ko.bindingProvider['instance']['nodeHasBindings'](nodeVerified);       // Case (2)
  2.2777 -        if (shouldApplyBindings)
  2.2778 -            shouldBindDescendants = applyBindingsToNodeInternal(nodeVerified, null, bindingContext, bindingContextMayDifferFromDomParentElement)['shouldBindDescendants'];
  2.2779 -
  2.2780 -        if (shouldBindDescendants && !bindingDoesNotRecurseIntoElementTypes[ko.utils.tagNameLower(nodeVerified)]) {
  2.2781 -            // We're recursing automatically into (real or virtual) child nodes without changing binding contexts. So,
  2.2782 -            //  * For children of a *real* element, the binding context is certainly the same as on their DOM .parentNode,
  2.2783 -            //    hence bindingContextsMayDifferFromDomParentElement is false
  2.2784 -            //  * For children of a *virtual* element, we can't be sure. Evaluating .parentNode on those children may
  2.2785 -            //    skip over any number of intermediate virtual elements, any of which might define a custom binding context,
  2.2786 -            //    hence bindingContextsMayDifferFromDomParentElement is true
  2.2787 -            applyBindingsToDescendantsInternal(bindingContext, nodeVerified, /* bindingContextsMayDifferFromDomParentElement: */ !isElement);
  2.2788 -        }
  2.2789 -    }
  2.2790 -
  2.2791 -    var boundElementDomDataKey = ko.utils.domData.nextKey();
  2.2792 -
  2.2793 -
  2.2794 -    function topologicalSortBindings(bindings) {
  2.2795 -        // Depth-first sort
  2.2796 -        var result = [],                // The list of key/handler pairs that we will return
  2.2797 -            bindingsConsidered = {},    // A temporary record of which bindings are already in 'result'
  2.2798 -            cyclicDependencyStack = []; // Keeps track of a depth-search so that, if there's a cycle, we know which bindings caused it
  2.2799 -        ko.utils.objectForEach(bindings, function pushBinding(bindingKey) {
  2.2800 -            if (!bindingsConsidered[bindingKey]) {
  2.2801 -                var binding = ko['getBindingHandler'](bindingKey);
  2.2802 -                if (binding) {
  2.2803 -                    // First add dependencies (if any) of the current binding
  2.2804 -                    if (binding['after']) {
  2.2805 -                        cyclicDependencyStack.push(bindingKey);
  2.2806 -                        ko.utils.arrayForEach(binding['after'], function(bindingDependencyKey) {
  2.2807 -                            if (bindings[bindingDependencyKey]) {
  2.2808 -                                if (ko.utils.arrayIndexOf(cyclicDependencyStack, bindingDependencyKey) !== -1) {
  2.2809 -                                    throw Error("Cannot combine the following bindings, because they have a cyclic dependency: " + cyclicDependencyStack.join(", "));
  2.2810 -                                } else {
  2.2811 -                                    pushBinding(bindingDependencyKey);
  2.2812 -                                }
  2.2813 -                            }
  2.2814 -                        });
  2.2815 -                        cyclicDependencyStack.length--;
  2.2816 -                    }
  2.2817 -                    // Next add the current binding
  2.2818 -                    result.push({ key: bindingKey, handler: binding });
  2.2819 -                }
  2.2820 -                bindingsConsidered[bindingKey] = true;
  2.2821 -            }
  2.2822 -        });
  2.2823 -
  2.2824 -        return result;
  2.2825 -    }
  2.2826 -
  2.2827 -    function applyBindingsToNodeInternal(node, sourceBindings, bindingContext, bindingContextMayDifferFromDomParentElement) {
  2.2828 -        // Prevent multiple applyBindings calls for the same node, except when a binding value is specified
  2.2829 -        var alreadyBound = ko.utils.domData.get(node, boundElementDomDataKey);
  2.2830 -        if (!sourceBindings) {
  2.2831 -            if (alreadyBound) {
  2.2832 -                throw Error("You cannot apply bindings multiple times to the same element.");
  2.2833 -            }
  2.2834 -            ko.utils.domData.set(node, boundElementDomDataKey, true);
  2.2835 -        }
  2.2836 -
  2.2837 -        // Optimization: Don't store the binding context on this node if it's definitely the same as on node.parentNode, because
  2.2838 -        // we can easily recover it just by scanning up the node's ancestors in the DOM
  2.2839 -        // (note: here, parent node means "real DOM parent" not "virtual parent", as there's no O(1) way to find the virtual parent)
  2.2840 -        if (!alreadyBound && bindingContextMayDifferFromDomParentElement)
  2.2841 -            ko.storedBindingContextForNode(node, bindingContext);
  2.2842 -
  2.2843 -        // Use bindings if given, otherwise fall back on asking the bindings provider to give us some bindings
  2.2844 -        var bindings;
  2.2845 -        if (sourceBindings && typeof sourceBindings !== 'function') {
  2.2846 -            bindings = sourceBindings;
  2.2847 -        } else {
  2.2848 -            var provider = ko.bindingProvider['instance'],
  2.2849 -                getBindings = provider['getBindingAccessors'] || getBindingsAndMakeAccessors;
  2.2850 -
  2.2851 -            // Get the binding from the provider within a computed observable so that we can update the bindings whenever
  2.2852 -            // the binding context is updated or if the binding provider accesses observables.
  2.2853 -            var bindingsUpdater = ko.dependentObservable(
  2.2854 -                function() {
  2.2855 -                    bindings = sourceBindings ? sourceBindings(bindingContext, node) : getBindings.call(provider, node, bindingContext);
  2.2856 -                    // Register a dependency on the binding context to support obsevable view models.
  2.2857 -                    if (bindings && bindingContext._subscribable)
  2.2858 -                        bindingContext._subscribable();
  2.2859 -                    return bindings;
  2.2860 -                },
  2.2861 -                null, { disposeWhenNodeIsRemoved: node }
  2.2862 -            );
  2.2863 -
  2.2864 -            if (!bindings || !bindingsUpdater.isActive())
  2.2865 -                bindingsUpdater = null;
  2.2866 -        }
  2.2867 -
  2.2868 -        var bindingHandlerThatControlsDescendantBindings;
  2.2869 -        if (bindings) {
  2.2870 -            // Return the value accessor for a given binding. When bindings are static (won't be updated because of a binding
  2.2871 -            // context update), just return the value accessor from the binding. Otherwise, return a function that always gets
  2.2872 -            // the latest binding value and registers a dependency on the binding updater.
  2.2873 -            var getValueAccessor = bindingsUpdater
  2.2874 -                ? function(bindingKey) {
  2.2875 -                    return function() {
  2.2876 -                        return evaluateValueAccessor(bindingsUpdater()[bindingKey]);
  2.2877 -                    };
  2.2878 -                } : function(bindingKey) {
  2.2879 -                    return bindings[bindingKey];
  2.2880 -                };
  2.2881 -
  2.2882 -            // Use of allBindings as a function is maintained for backwards compatibility, but its use is deprecated
  2.2883 -            function allBindings() {
  2.2884 -                return ko.utils.objectMap(bindingsUpdater ? bindingsUpdater() : bindings, evaluateValueAccessor);
  2.2885 -            }
  2.2886 -            // The following is the 3.x allBindings API
  2.2887 -            allBindings['get'] = function(key) {
  2.2888 -                return bindings[key] && evaluateValueAccessor(getValueAccessor(key));
  2.2889 -            };
  2.2890 -            allBindings['has'] = function(key) {
  2.2891 -                return key in bindings;
  2.2892 -            };
  2.2893 -
  2.2894 -            // First put the bindings into the right order
  2.2895 -            var orderedBindings = topologicalSortBindings(bindings);
  2.2896 -
  2.2897 -            // Go through the sorted bindings, calling init and update for each
  2.2898 -            ko.utils.arrayForEach(orderedBindings, function(bindingKeyAndHandler) {
  2.2899 -                // Note that topologicalSortBindings has already filtered out any nonexistent binding handlers,
  2.2900 -                // so bindingKeyAndHandler.handler will always be nonnull.
  2.2901 -                var handlerInitFn = bindingKeyAndHandler.handler["init"],
  2.2902 -                    handlerUpdateFn = bindingKeyAndHandler.handler["update"],
  2.2903 -                    bindingKey = bindingKeyAndHandler.key;
  2.2904 -
  2.2905 -                if (node.nodeType === 8) {
  2.2906 -                    validateThatBindingIsAllowedForVirtualElements(bindingKey);
  2.2907 -                }
  2.2908 -
  2.2909 -                try {
  2.2910 -                    // Run init, ignoring any dependencies
  2.2911 -                    if (typeof handlerInitFn == "function") {
  2.2912 -                        ko.dependencyDetection.ignore(function() {
  2.2913 -                            var initResult = handlerInitFn(node, getValueAccessor(bindingKey), allBindings, bindingContext['$data'], bindingContext);
  2.2914 -
  2.2915 -                            // If this binding handler claims to control descendant bindings, make a note of this
  2.2916 -                            if (initResult && initResult['controlsDescendantBindings']) {
  2.2917 -                                if (bindingHandlerThatControlsDescendantBindings !== undefined)
  2.2918 -                                    throw new Error("Multiple bindings (" + bindingHandlerThatControlsDescendantBindings + " and " + bindingKey + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
  2.2919 -                                bindingHandlerThatControlsDescendantBindings = bindingKey;
  2.2920 -                            }
  2.2921 -                        });
  2.2922 -                    }
  2.2923 -
  2.2924 -                    // Run update in its own computed wrapper
  2.2925 -                    if (typeof handlerUpdateFn == "function") {
  2.2926 -                        ko.dependentObservable(
  2.2927 -                            function() {
  2.2928 -                                handlerUpdateFn(node, getValueAccessor(bindingKey), allBindings, bindingContext['$data'], bindingContext);
  2.2929 -                            },
  2.2930 -                            null,
  2.2931 -                            { disposeWhenNodeIsRemoved: node }
  2.2932 -                        );
  2.2933 -                    }
  2.2934 -                } catch (ex) {
  2.2935 -                    ex.message = "Unable to process binding \"" + bindingKey + ": " + bindings[bindingKey] + "\"\nMessage: " + ex.message;
  2.2936 -                    throw ex;
  2.2937 -                }
  2.2938 -            });
  2.2939 -        }
  2.2940 -
  2.2941 -        return {
  2.2942 -            'shouldBindDescendants': bindingHandlerThatControlsDescendantBindings === undefined
  2.2943 -        };
  2.2944 -    };
  2.2945 -
  2.2946 -    var storedBindingContextDomDataKey = ko.utils.domData.nextKey();
  2.2947 -    ko.storedBindingContextForNode = function (node, bindingContext) {
  2.2948 -        if (arguments.length == 2) {
  2.2949 -            ko.utils.domData.set(node, storedBindingContextDomDataKey, bindingContext);
  2.2950 -            if (bindingContext._subscribable)
  2.2951 -                bindingContext._subscribable._addNode(node);
  2.2952 -        } else {
  2.2953 -            return ko.utils.domData.get(node, storedBindingContextDomDataKey);
  2.2954 -        }
  2.2955 -    }
  2.2956 -
  2.2957 -    function getBindingContext(viewModelOrBindingContext) {
  2.2958 -        return viewModelOrBindingContext && (viewModelOrBindingContext instanceof ko.bindingContext)
  2.2959 -            ? viewModelOrBindingContext
  2.2960 -            : new ko.bindingContext(viewModelOrBindingContext);
  2.2961 -    }
  2.2962 -
  2.2963 -    ko.applyBindingAccessorsToNode = function (node, bindings, viewModelOrBindingContext) {
  2.2964 -        if (node.nodeType === 1) // If it's an element, workaround IE <= 8 HTML parsing weirdness
  2.2965 -            ko.virtualElements.normaliseVirtualElementDomStructure(node);
  2.2966 -        return applyBindingsToNodeInternal(node, bindings, getBindingContext(viewModelOrBindingContext), true);
  2.2967 -    };
  2.2968 -
  2.2969 -    ko.applyBindingsToNode = function (node, bindings, viewModelOrBindingContext) {
  2.2970 -        var context = getBindingContext(viewModelOrBindingContext);
  2.2971 -        return ko.applyBindingAccessorsToNode(node, makeBindingAccessors(bindings, context, node), context);
  2.2972 -    };
  2.2973 -
  2.2974 -    ko.applyBindingsToDescendants = function(viewModelOrBindingContext, rootNode) {
  2.2975 -        if (rootNode.nodeType === 1 || rootNode.nodeType === 8)
  2.2976 -            applyBindingsToDescendantsInternal(getBindingContext(viewModelOrBindingContext), rootNode, true);
  2.2977 -    };
  2.2978 -
  2.2979 -    ko.applyBindings = function (viewModelOrBindingContext, rootNode) {
  2.2980 -        // If jQuery is loaded after Knockout, we won't initially have access to it. So save it here.
  2.2981 -        if (!jQueryInstance && window['jQuery']) {
  2.2982 -            jQueryInstance = window['jQuery'];
  2.2983 -        }
  2.2984 -
  2.2985 -        if (rootNode && (rootNode.nodeType !== 1) && (rootNode.nodeType !== 8))
  2.2986 -            throw new Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");
  2.2987 -        rootNode = rootNode || window.document.body; // Make "rootNode" parameter optional
  2.2988 -
  2.2989 -        applyBindingsToNodeAndDescendantsInternal(getBindingContext(viewModelOrBindingContext), rootNode, true);
  2.2990 -    };
  2.2991 -
  2.2992 -    // Retrieving binding context from arbitrary nodes
  2.2993 -    ko.contextFor = function(node) {
  2.2994 -        // We can only do something meaningful for elements and comment nodes (in particular, not text nodes, as IE can't store domdata for them)
  2.2995 -        switch (node.nodeType) {
  2.2996 -            case 1:
  2.2997 -            case 8:
  2.2998 -                var context = ko.storedBindingContextForNode(node);
  2.2999 -                if (context) return context;
  2.3000 -                if (node.parentNode) return ko.contextFor(node.parentNode);
  2.3001 -                break;
  2.3002 -        }
  2.3003 -        return undefined;
  2.3004 -    };
  2.3005 -    ko.dataFor = function(node) {
  2.3006 -        var context = ko.contextFor(node);
  2.3007 -        return context ? context['$data'] : undefined;
  2.3008 -    };
  2.3009 -
  2.3010 -    ko.exportSymbol('bindingHandlers', ko.bindingHandlers);
  2.3011 -    ko.exportSymbol('applyBindings', ko.applyBindings);
  2.3012 -    ko.exportSymbol('applyBindingsToDescendants', ko.applyBindingsToDescendants);
  2.3013 -    ko.exportSymbol('applyBindingAccessorsToNode', ko.applyBindingAccessorsToNode);
  2.3014 -    ko.exportSymbol('applyBindingsToNode', ko.applyBindingsToNode);
  2.3015 -    ko.exportSymbol('contextFor', ko.contextFor);
  2.3016 -    ko.exportSymbol('dataFor', ko.dataFor);
  2.3017 -})();
  2.3018 -(function(undefined) {
  2.3019 -    var loadingSubscribablesCache = {}, // Tracks component loads that are currently in flight
  2.3020 -        loadedDefinitionsCache = {};    // Tracks component loads that have already completed
  2.3021 -
  2.3022 -    ko.components = {
  2.3023 -        get: function(componentName, callback) {
  2.3024 -            var cachedDefinition = getObjectOwnProperty(loadedDefinitionsCache, componentName);
  2.3025 -            if (cachedDefinition) {
  2.3026 -                // It's already loaded and cached. Reuse the same definition object.
  2.3027 -                // Note that for API consistency, even cache hits complete asynchronously.
  2.3028 -                setTimeout(function() { callback(cachedDefinition) }, 0);
  2.3029 -            } else {
  2.3030 -                // Join the loading process that is already underway, or start a new one.
  2.3031 -                loadComponentAndNotify(componentName, callback);
  2.3032 -            }
  2.3033 -        },
  2.3034 -
  2.3035 -        clearCachedDefinition: function(componentName) {
  2.3036 -            delete loadedDefinitionsCache[componentName];
  2.3037 -        },
  2.3038 -
  2.3039 -        _getFirstResultFromLoaders: getFirstResultFromLoaders
  2.3040 -    };
  2.3041 -
  2.3042 -    function getObjectOwnProperty(obj, propName) {
  2.3043 -        return obj.hasOwnProperty(propName) ? obj[propName] : undefined;
  2.3044 -    }
  2.3045 -
  2.3046 -    function loadComponentAndNotify(componentName, callback) {
  2.3047 -        var subscribable = getObjectOwnProperty(loadingSubscribablesCache, componentName),
  2.3048 -            completedAsync;
  2.3049 -        if (!subscribable) {
  2.3050 -            // It's not started loading yet. Start loading, and when it's done, move it to loadedDefinitionsCache.
  2.3051 -            subscribable = loadingSubscribablesCache[componentName] = new ko.subscribable();
  2.3052 -            beginLoadingComponent(componentName, function(definition) {
  2.3053 -                loadedDefinitionsCache[componentName] = definition;
  2.3054 -                delete loadingSubscribablesCache[componentName];
  2.3055 -
  2.3056 -                // For API consistency, all loads complete asynchronously. However we want to avoid
  2.3057 -                // adding an extra setTimeout if it's unnecessary (i.e., the completion is already
  2.3058 -                // async) since setTimeout(..., 0) still takes about 16ms or more on most browsers.
  2.3059 -                if (completedAsync) {
  2.3060 -                    subscribable['notifySubscribers'](definition);
  2.3061 -                } else {
  2.3062 -                    setTimeout(function() {
  2.3063 -                        subscribable['notifySubscribers'](definition);
  2.3064 -                    }, 0);
  2.3065 -                }
  2.3066 -            });
  2.3067 -            completedAsync = true;
  2.3068 -        }
  2.3069 -        subscribable.subscribe(callback);
  2.3070 -    }
  2.3071 -
  2.3072 -    function beginLoadingComponent(componentName, callback) {
  2.3073 -        getFirstResultFromLoaders('getConfig', [componentName], function(config) {
  2.3074 -            if (config) {
  2.3075 -                // We have a config, so now load its definition
  2.3076 -                getFirstResultFromLoaders('loadComponent', [componentName, config], function(definition) {
  2.3077 -                    callback(definition);
  2.3078 -                });
  2.3079 -            } else {
  2.3080 -                // The component has no config - it's unknown to all the loaders.
  2.3081 -                // Note that this is not an error (e.g., a module loading error) - that would abort the
  2.3082 -                // process and this callback would not run. For this callback to run, all loaders must
  2.3083 -                // have confirmed they don't know about this component.
  2.3084 -                callback(null);
  2.3085 -            }
  2.3086 -        });
  2.3087 -    }
  2.3088 -
  2.3089 -    function getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders) {
  2.3090 -        // On the first call in the stack, start with the full set of loaders
  2.3091 -        if (!candidateLoaders) {
  2.3092 -            candidateLoaders = ko.components['loaders'].slice(0); // Use a copy, because we'll be mutating this array
  2.3093 -        }
  2.3094 -
  2.3095 -        // Try the next candidate
  2.3096 -        var currentCandidateLoader = candidateLoaders.shift();
  2.3097 -        if (currentCandidateLoader) {
  2.3098 -            var methodInstance = currentCandidateLoader[methodName];
  2.3099 -            if (methodInstance) {
  2.3100 -                var wasAborted = false,
  2.3101 -                    synchronousReturnValue = methodInstance.apply(currentCandidateLoader, argsExceptCallback.concat(function(result) {
  2.3102 -                        if (wasAborted) {
  2.3103 -                            callback(null);
  2.3104 -                        } else if (result !== null) {
  2.3105 -                            // This candidate returned a value. Use it.
  2.3106 -                            callback(result);
  2.3107 -                        } else {
  2.3108 -                            // Try the next candidate
  2.3109 -                            getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders);
  2.3110 -                        }
  2.3111 -                    }));
  2.3112 -
  2.3113 -                // Currently, loaders may not return anything synchronously. This leaves open the possibility
  2.3114 -                // that we'll extend the API to support synchronous return values in the future. It won't be
  2.3115 -                // a breaking change, because currently no loader is allowed to return anything except undefined.
  2.3116 -                if (synchronousReturnValue !== undefined) {
  2.3117 -                    wasAborted = true;
  2.3118 -
  2.3119 -                    // Method to suppress exceptions will remain undocumented. This is only to keep
  2.3120 -                    // KO's specs running tidily, since we can observe the loading got aborted without
  2.3121 -                    // having exceptions cluttering up the console too.
  2.3122 -                    if (!currentCandidateLoader['suppressLoaderExceptions']) {
  2.3123 -                        throw new Error('Component loaders must supply values by invoking the callback, not by returning values synchronously.');
  2.3124 -                    }
  2.3125 -                }
  2.3126 -            } else {
  2.3127 -                // This candidate doesn't have the relevant handler. Synchronously move on to the next one.
  2.3128 -                getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders);
  2.3129 -            }
  2.3130 -        } else {
  2.3131 -            // No candidates returned a value
  2.3132 -            callback(null);
  2.3133 -        }
  2.3134 -    }
  2.3135 -
  2.3136 -    // Reference the loaders via string name so it's possible for developers
  2.3137 -    // to replace the whole array by assigning to ko.components.loaders
  2.3138 -    ko.components['loaders'] = [];
  2.3139 -
  2.3140 -    ko.exportSymbol('components', ko.components);
  2.3141 -    ko.exportSymbol('components.get', ko.components.get);
  2.3142 -    ko.exportSymbol('components.clearCachedDefinition', ko.components.clearCachedDefinition);
  2.3143 -})();
  2.3144 -(function(undefined) {
  2.3145 -
  2.3146 -    // The default loader is responsible for two things:
  2.3147 -    // 1. Maintaining the default in-memory registry of component configuration objects
  2.3148 -    //    (i.e., the thing you're writing to when you call ko.components.register(someName, ...))
  2.3149 -    // 2. Answering requests for components by fetching configuration objects
  2.3150 -    //    from that default in-memory registry and resolving them into standard
  2.3151 -    //    component definition objects (of the form { createViewModel: ..., template: ... })
  2.3152 -    // Custom loaders may override either of these facilities, i.e.,
  2.3153 -    // 1. To supply configuration objects from some other source (e.g., conventions)
  2.3154 -    // 2. Or, to resolve configuration objects by loading viewmodels/templates via arbitrary logic.
  2.3155 -
  2.3156 -    var defaultConfigRegistry = {};
  2.3157 -
  2.3158 -    ko.components.register = function(componentName, config) {
  2.3159 -        if (!config) {
  2.3160 -            throw new Error('Invalid configuration for ' + componentName);
  2.3161 -        }
  2.3162 -
  2.3163 -        if (ko.components.isRegistered(componentName)) {
  2.3164 -            throw new Error('Component ' + componentName + ' is already registered');
  2.3165 -        }
  2.3166 -
  2.3167 -        defaultConfigRegistry[componentName] = config;
  2.3168 -    }
  2.3169 -
  2.3170 -    ko.components.isRegistered = function(componentName) {
  2.3171 -        return componentName in defaultConfigRegistry;
  2.3172 -    }
  2.3173 -
  2.3174 -    ko.components.unregister = function(componentName) {
  2.3175 -        delete defaultConfigRegistry[componentName];
  2.3176 -        ko.components.clearCachedDefinition(componentName);
  2.3177 -    }
  2.3178 -
  2.3179 -    ko.components.defaultLoader = {
  2.3180 -        'getConfig': function(componentName, callback) {
  2.3181 -            var result = defaultConfigRegistry.hasOwnProperty(componentName)
  2.3182 -                ? defaultConfigRegistry[componentName]
  2.3183 -                : null;
  2.3184 -            callback(result);
  2.3185 -        },
  2.3186 -
  2.3187 -        'loadComponent': function(componentName, config, callback) {
  2.3188 -            var errorCallback = makeErrorCallback(componentName);
  2.3189 -            possiblyGetConfigFromAmd(errorCallback, config, function(loadedConfig) {
  2.3190 -                resolveConfig(componentName, errorCallback, loadedConfig, callback);
  2.3191 -            });
  2.3192 -        },
  2.3193 -
  2.3194 -        'loadTemplate': function(componentName, templateConfig, callback) {
  2.3195 -            resolveTemplate(makeErrorCallback(componentName), templateConfig, callback);
  2.3196 -        },
  2.3197 -
  2.3198 -        'loadViewModel': function(componentName, viewModelConfig, callback) {
  2.3199 -            resolveViewModel(makeErrorCallback(componentName), viewModelConfig, callback);
  2.3200 -        }
  2.3201 -    };
  2.3202 -
  2.3203 -    var createViewModelKey = 'createViewModel';
  2.3204 -
  2.3205 -    // Takes a config object of the form { template: ..., viewModel: ... }, and asynchronously convert it
  2.3206 -    // into the standard component definition format:
  2.3207 -    //    { template: <ArrayOfDomNodes>, createViewModel: function(params, componentInfo) { ... } }.
  2.3208 -    // Since both template and viewModel may need to be resolved asynchronously, both tasks are performed
  2.3209 -    // in parallel, and the results joined when both are ready. We don't depend on any promises infrastructure,
  2.3210 -    // so this is implemented manually below.
  2.3211 -    function resolveConfig(componentName, errorCallback, config, callback) {
  2.3212 -        var result = {},
  2.3213 -            makeCallBackWhenZero = 2,
  2.3214 -            tryIssueCallback = function() {
  2.3215 -                if (--makeCallBackWhenZero === 0) {
  2.3216 -                    callback(result);
  2.3217 -                }
  2.3218 -            },
  2.3219 -            templateConfig = config['template'],
  2.3220 -            viewModelConfig = config['viewModel'];
  2.3221 -
  2.3222 -        if (templateConfig) {
  2.3223 -            possiblyGetConfigFromAmd(errorCallback, templateConfig, function(loadedConfig) {
  2.3224 -                ko.components._getFirstResultFromLoaders('loadTemplate', [componentName, loadedConfig], function(resolvedTemplate) {
  2.3225 -                    result['template'] = resolvedTemplate;
  2.3226 -                    tryIssueCallback();
  2.3227 -                });
  2.3228 -            });
  2.3229 -        } else {
  2.3230 -            tryIssueCallback();
  2.3231 -        }
  2.3232 -
  2.3233 -        if (viewModelConfig) {
  2.3234 -            possiblyGetConfigFromAmd(errorCallback, viewModelConfig, function(loadedConfig) {
  2.3235 -                ko.components._getFirstResultFromLoaders('loadViewModel', [componentName, loadedConfig], function(resolvedViewModel) {
  2.3236 -                    result[createViewModelKey] = resolvedViewModel;
  2.3237 -                    tryIssueCallback();
  2.3238 -                });
  2.3239 -            });
  2.3240 -        } else {
  2.3241 -            tryIssueCallback();
  2.3242 -        }
  2.3243 -    }
  2.3244 -
  2.3245 -    function resolveTemplate(errorCallback, templateConfig, callback) {
  2.3246 -        if (typeof templateConfig === 'string') {
  2.3247 -            // Markup - parse it
  2.3248 -            callback(ko.utils.parseHtmlFragment(templateConfig));
  2.3249 -        } else if (templateConfig instanceof Array) {
  2.3250 -            // Assume already an array of DOM nodes - pass through unchanged
  2.3251 -            callback(templateConfig);
  2.3252 -        } else if (isDocumentFragment(templateConfig)) {
  2.3253 -            // Document fragment - use its child nodes
  2.3254 -            callback(ko.utils.makeArray(templateConfig.childNodes));
  2.3255 -        } else if (templateConfig['element']) {
  2.3256 -            var element = templateConfig['element'];
  2.3257 -            if (isDomElement(element)) {
  2.3258 -                // Element instance - copy its child nodes
  2.3259 -                callback(cloneNodesFromTemplateSourceElement(element));
  2.3260 -            } else if (typeof element === 'string') {
  2.3261 -                // Element ID - find it, then copy its child nodes
  2.3262 -                var elemInstance = document.getElementById(element);
  2.3263 -                if (elemInstance) {
  2.3264 -                    callback(cloneNodesFromTemplateSourceElement(elemInstance));
  2.3265 -                } else {
  2.3266 -                    errorCallback('Cannot find element with ID ' + element);
  2.3267 -                }
  2.3268 -            } else {
  2.3269 -                errorCallback('Unknown element type: ' + element);
  2.3270 -            }
  2.3271 -        } else {
  2.3272 -            errorCallback('Unknown template value: ' + templateConfig);
  2.3273 -        }
  2.3274 -    }
  2.3275 -
  2.3276 -    function resolveViewModel(errorCallback, viewModelConfig, callback) {
  2.3277 -        if (typeof viewModelConfig === 'function') {
  2.3278 -            // Constructor - convert to standard factory function format
  2.3279 -            // By design, this does *not* supply componentInfo to the constructor, as the intent is that
  2.3280 -            // componentInfo contains non-viewmodel data (e.g., the component's element) that should only
  2.3281 -            // be used in factory functions, not viewmodel constructors.
  2.3282 -            callback(function (params /*, componentInfo */) {
  2.3283 -                return new viewModelConfig(params);
  2.3284 -            });
  2.3285 -        } else if (typeof viewModelConfig[createViewModelKey] === 'function') {
  2.3286 -            // Already a factory function - use it as-is
  2.3287 -            callback(viewModelConfig[createViewModelKey]);
  2.3288 -        } else if ('instance' in viewModelConfig) {
  2.3289 -            // Fixed object instance - promote to createViewModel format for API consistency
  2.3290 -            var fixedInstance = viewModelConfig['instance'];
  2.3291 -            callback(function (params, componentInfo) {
  2.3292 -                return fixedInstance;
  2.3293 -            });
  2.3294 -        } else if ('viewModel' in viewModelConfig) {
  2.3295 -            // Resolved AMD module whose value is of the form { viewModel: ... }
  2.3296 -            resolveViewModel(errorCallback, viewModelConfig['viewModel'], callback);
  2.3297 -        } else {
  2.3298 -            errorCallback('Unknown viewModel value: ' + viewModelConfig);
  2.3299 -        }
  2.3300 -    }
  2.3301 -
  2.3302 -    function cloneNodesFromTemplateSourceElement(elemInstance) {
  2.3303 -        switch (ko.utils.tagNameLower(elemInstance)) {
  2.3304 -            case 'script':
  2.3305 -                return ko.utils.parseHtmlFragment(elemInstance.text);
  2.3306 -            case 'textarea':
  2.3307 -                return ko.utils.parseHtmlFragment(elemInstance.value);
  2.3308 -            case 'template':
  2.3309 -                // For browsers with proper <template> element support (i.e., where the .content property
  2.3310 -                // gives a document fragment), use that document fragment.
  2.3311 -                if (isDocumentFragment(elemInstance.content)) {
  2.3312 -                    return ko.utils.cloneNodes(elemInstance.content.childNodes);
  2.3313 -                }
  2.3314 -        }
  2.3315 -
  2.3316 -        // Regular elements such as <div>, and <template> elements on old browsers that don't really
  2.3317 -        // understand <template> and just treat it as a regular container
  2.3318 -        return ko.utils.cloneNodes(elemInstance.childNodes);
  2.3319 -    }
  2.3320 -
  2.3321 -    function isDomElement(obj) {
  2.3322 -        if (window['HTMLElement']) {
  2.3323 -            return obj instanceof HTMLElement;
  2.3324 -        } else {
  2.3325 -            return obj && obj.tagName && obj.nodeType === 1;
  2.3326 -        }
  2.3327 -    }
  2.3328 -
  2.3329 -    function isDocumentFragment(obj) {
  2.3330 -        if (window['DocumentFragment']) {
  2.3331 -            return obj instanceof DocumentFragment;
  2.3332 -        } else {
  2.3333 -            return obj && obj.nodeType === 11;
  2.3334 -        }
  2.3335 -    }
  2.3336 -
  2.3337 -    function possiblyGetConfigFromAmd(errorCallback, config, callback) {
  2.3338 -        if (typeof config['require'] === 'string') {
  2.3339 -            // The config is the value of an AMD module
  2.3340 -            if (require || window['require']) {
  2.3341 -                (require || window['require'])([config['require']], callback);
  2.3342 -            } else {
  2.3343 -                errorCallback('Uses require, but no AMD loader is present');
  2.3344 -            }
  2.3345 -        } else {
  2.3346 -            callback(config);
  2.3347 -        }
  2.3348 -    }
  2.3349 -
  2.3350 -    function makeErrorCallback(componentName) {
  2.3351 -        return function (message) {
  2.3352 -            throw new Error('Component \'' + componentName + '\': ' + message);
  2.3353 -        };
  2.3354 -    }
  2.3355 -
  2.3356 -    ko.exportSymbol('components.register', ko.components.register);
  2.3357 -    ko.exportSymbol('components.isRegistered', ko.components.isRegistered);
  2.3358 -    ko.exportSymbol('components.unregister', ko.components.unregister);
  2.3359 -
  2.3360 -    // Expose the default loader so that developers can directly ask it for configuration
  2.3361 -    // or to resolve configuration
  2.3362 -    ko.exportSymbol('components.defaultLoader', ko.components.defaultLoader);
  2.3363 -
  2.3364 -    // By default, the default loader is the only registered component loader
  2.3365 -    ko.components['loaders'].push(ko.components.defaultLoader);
  2.3366 -
  2.3367 -    // Privately expose the underlying config registry for use in old-IE shim
  2.3368 -    ko.components._allRegisteredComponents = defaultConfigRegistry;
  2.3369 -})();
  2.3370 -(function (undefined) {
  2.3371 -    // Overridable API for determining which component name applies to a given node. By overriding this,
  2.3372 -    // you can for example map specific tagNames to components that are not preregistered.
  2.3373 -    ko.components['getComponentNameForNode'] = function(node) {
  2.3374 -        var tagNameLower = ko.utils.tagNameLower(node);
  2.3375 -        return ko.components.isRegistered(tagNameLower) && tagNameLower;
  2.3376 -    };
  2.3377 -
  2.3378 -    ko.components.addBindingsForCustomElement = function(allBindings, node, bindingContext, valueAccessors) {
  2.3379 -        // Determine if it's really a custom element matching a component
  2.3380 -        if (node.nodeType === 1) {
  2.3381 -            var componentName = ko.components['getComponentNameForNode'](node);
  2.3382 -            if (componentName) {
  2.3383 -                // It does represent a component, so add a component binding for it
  2.3384 -                allBindings = allBindings || {};
  2.3385 -
  2.3386 -                if (allBindings['component']) {
  2.3387 -                    // Avoid silently overwriting some other 'component' binding that may already be on the element
  2.3388 -                    throw new Error('Cannot use the "component" binding on a custom element matching a component');
  2.3389 -                }
  2.3390 -
  2.3391 -                var componentBindingValue = { 'name': componentName, 'params': getComponentParamsFromCustomElement(node, bindingContext) };
  2.3392 -
  2.3393 -                allBindings['component'] = valueAccessors
  2.3394 -                    ? function() { return componentBindingValue; }
  2.3395 -                    : componentBindingValue;
  2.3396 -            }
  2.3397 -        }
  2.3398 -
  2.3399 -        return allBindings;
  2.3400 -    }
  2.3401 -
  2.3402 -    var nativeBindingProviderInstance = new ko.bindingProvider();
  2.3403 -
  2.3404 -    function getComponentParamsFromCustomElement(elem, bindingContext) {
  2.3405 -        var paramsAttribute = elem.getAttribute('params');
  2.3406 -
  2.3407 -        if (paramsAttribute) {
  2.3408 -            var params = nativeBindingProviderInstance['parseBindingsString'](paramsAttribute, bindingContext, elem, { 'valueAccessors': true, 'bindingParams': true }),
  2.3409 -                rawParamComputedValues = ko.utils.objectMap(params, function(paramValue, paramName) {
  2.3410 -                    return ko.computed(paramValue, null, { disposeWhenNodeIsRemoved: elem });
  2.3411 -                }),
  2.3412 -                result = ko.utils.objectMap(rawParamComputedValues, function(paramValueComputed, paramName) {
  2.3413 -                    // Does the evaluation of the parameter value unwrap any observables?
  2.3414 -                    if (!paramValueComputed.isActive()) {
  2.3415 -                        // No it doesn't, so there's no need for any computed wrapper. Just pass through the supplied value directly.
  2.3416 -                        // Example: "someVal: firstName, age: 123" (whether or not firstName is an observable/computed)
  2.3417 -                        return paramValueComputed.peek();
  2.3418 -                    } else {
  2.3419 -                        // Yes it does. Supply a computed property that unwraps both the outer (binding expression)
  2.3420 -                        // level of observability, and any inner (resulting model value) level of observability.
  2.3421 -                        // This means the component doesn't have to worry about multiple unwrapping.
  2.3422 -                        return ko.computed(function() {
  2.3423 -                            return ko.utils.unwrapObservable(paramValueComputed());
  2.3424 -                        }, null, { disposeWhenNodeIsRemoved: elem });
  2.3425 -                    }
  2.3426 -                });
  2.3427 -
  2.3428 -            // Give access to the raw computeds, as long as that wouldn't overwrite any custom param also called '$raw'
  2.3429 -            // This is in case the developer wants to react to outer (binding) observability separately from inner
  2.3430 -            // (model value) observability, or in case the model value observable has subobservables.
  2.3431 -            if (!result.hasOwnProperty('$raw')) {
  2.3432 -                result['$raw'] = rawParamComputedValues;
  2.3433 -            }
  2.3434 -
  2.3435 -            return result;
  2.3436 -        } else {
  2.3437 -            // For consistency, absence of a "params" attribute is treated the same as the presence of
  2.3438 -            // any empty one. Otherwise component viewmodels need special code to check whether or not
  2.3439 -            // 'params' or 'params.$raw' is null/undefined before reading subproperties, which is annoying.
  2.3440 -            return { '$raw': {} };
  2.3441 -        }
  2.3442 -    }
  2.3443 -
  2.3444 -    // --------------------------------------------------------------------------------
  2.3445 -    // Compatibility code for older (pre-HTML5) IE browsers
  2.3446 -
  2.3447 -    if (ko.utils.ieVersion < 9) {
  2.3448 -        // Whenever you preregister a component, enable it as a custom element in the current document
  2.3449 -        ko.components['register'] = (function(originalFunction) {
  2.3450 -            return function(componentName) {
  2.3451 -                document.createElement(componentName); // Allows IE<9 to parse markup containing the custom element
  2.3452 -                return originalFunction.apply(this, arguments);
  2.3453 -            }
  2.3454 -        })(ko.components['register']);
  2.3455 -
  2.3456 -        // Whenever you create a document fragment, enable all preregistered component names as custom elements
  2.3457 -        // This is needed to make innerShiv/jQuery HTML parsing correctly handle the custom elements
  2.3458 -        document.createDocumentFragment = (function(originalFunction) {
  2.3459 -            return function() {
  2.3460 -                var newDocFrag = originalFunction(),
  2.3461 -                    allComponents = ko.components._allRegisteredComponents;
  2.3462 -                for (var componentName in allComponents) {
  2.3463 -                    if (allComponents.hasOwnProperty(componentName)) {
  2.3464 -                        newDocFrag.createElement(componentName);
  2.3465 -                    }
  2.3466 -                }
  2.3467 -                return newDocFrag;
  2.3468 -            };
  2.3469 -        })(document.createDocumentFragment);
  2.3470 -    }
  2.3471 -})();(function(undefined) {
  2.3472 -
  2.3473 -    var componentLoadingOperationUniqueId = 0;
  2.3474 -
  2.3475 -    ko.bindingHandlers['component'] = {
  2.3476 -        'init': function(element, valueAccessor, ignored1, ignored2, bindingContext) {
  2.3477 -            var currentViewModel,
  2.3478 -                currentLoadingOperationId,
  2.3479 -                disposeAssociatedComponentViewModel = function () {
  2.3480 -                    var currentViewModelDispose = currentViewModel && currentViewModel['dispose'];
  2.3481 -                    if (typeof currentViewModelDispose === 'function') {
  2.3482 -                        currentViewModelDispose.call(currentViewModel);
  2.3483 -                    }
  2.3484 -
  2.3485 -                    // Any in-flight loading operation is no longer relevant, so make sure we ignore its completion
  2.3486 -                    currentLoadingOperationId = null;
  2.3487 -                };
  2.3488 -
  2.3489 -            ko.utils.domNodeDisposal.addDisposeCallback(element, disposeAssociatedComponentViewModel);
  2.3490 -
  2.3491 -            ko.computed(function () {
  2.3492 -                var value = ko.utils.unwrapObservable(valueAccessor()),
  2.3493 -                    componentName, componentParams;
  2.3494 -
  2.3495 -                if (typeof value === 'string') {
  2.3496 -                    componentName = value;
  2.3497 -                } else {
  2.3498 -                    componentName = ko.utils.unwrapObservable(value['name']);
  2.3499 -                    componentParams = ko.utils.unwrapObservable(value['params']);
  2.3500 -                }
  2.3501 -
  2.3502 -                if (!componentName) {
  2.3503 -                    throw new Error('No component name specified');
  2.3504 -                }
  2.3505 -
  2.3506 -                var loadingOperationId = currentLoadingOperationId = ++componentLoadingOperationUniqueId;
  2.3507 -                ko.components.get(componentName, function(componentDefinition) {
  2.3508 -                    // If this is not the current load operation for this element, ignore it.
  2.3509 -                    if (currentLoadingOperationId !== loadingOperationId) {
  2.3510 -                        return;
  2.3511 -                    }
  2.3512 -
  2.3513 -                    // Clean up previous state
  2.3514 -                    disposeAssociatedComponentViewModel();
  2.3515 -
  2.3516 -                    // Instantiate and bind new component. Implicitly this cleans any old DOM nodes.
  2.3517 -                    if (!componentDefinition) {
  2.3518 -                        throw new Error('Unknown component \'' + componentName + '\'');
  2.3519 -                    }
  2.3520 -                    cloneTemplateIntoElement(componentName, componentDefinition, element);
  2.3521 -                    var componentViewModel = createViewModel(componentDefinition, element, componentParams),
  2.3522 -                        childBindingContext = bindingContext['createChildContext'](componentViewModel);
  2.3523 -                    currentViewModel = componentViewModel;
  2.3524 -                    ko.applyBindingsToDescendants(childBindingContext, element);
  2.3525 -                });
  2.3526 -            }, null, { disposeWhenNodeIsRemoved: element });
  2.3527 -
  2.3528 -            return { 'controlsDescendantBindings': true };
  2.3529 -        }
  2.3530 -    };
  2.3531 -
  2.3532 -    ko.virtualElements.allowedBindings['component'] = true;
  2.3533 -
  2.3534 -    function cloneTemplateIntoElement(componentName, componentDefinition, element) {
  2.3535 -        var template = componentDefinition['template'];
  2.3536 -        if (!template) {
  2.3537 -            throw new Error('Component \'' + componentName + '\' has no template');
  2.3538 -        }
  2.3539 -
  2.3540 -        var clonedNodesArray = ko.utils.cloneNodes(template);
  2.3541 -        ko.virtualElements.setDomNodeChildren(element, clonedNodesArray);
  2.3542 -    }
  2.3543 -
  2.3544 -    function createViewModel(componentDefinition, element, componentParams) {
  2.3545 -        var componentViewModelFactory = componentDefinition['createViewModel'];
  2.3546 -        return componentViewModelFactory
  2.3547 -            ? componentViewModelFactory.call(componentDefinition, componentParams, { element: element })
  2.3548 -            : componentParams; // Template-only component
  2.3549 -    }
  2.3550 -
  2.3551 -})();
  2.3552 -var attrHtmlToJavascriptMap = { 'class': 'className', 'for': 'htmlFor' };
  2.3553 -ko.bindingHandlers['attr'] = {
  2.3554 -    'update': function(element, valueAccessor, allBindings) {
  2.3555 -        var value = ko.utils.unwrapObservable(valueAccessor()) || {};
  2.3556 -        ko.utils.objectForEach(value, function(attrName, attrValue) {
  2.3557 -            attrValue = ko.utils.unwrapObservable(attrValue);
  2.3558 -
  2.3559 -            // To cover cases like "attr: { checked:someProp }", we want to remove the attribute entirely
  2.3560 -            // when someProp is a "no value"-like value (strictly null, false, or undefined)
  2.3561 -            // (because the absence of the "checked" attr is how to mark an element as not checked, etc.)
  2.3562 -            var toRemove = (attrValue === false) || (attrValue === null) || (attrValue === undefined);
  2.3563 -            if (toRemove)
  2.3564 -                element.removeAttribute(attrName);
  2.3565 -
  2.3566 -            // In IE <= 7 and IE8 Quirks Mode, you have to use the Javascript property name instead of the
  2.3567 -            // HTML attribute name for certain attributes. IE8 Standards Mode supports the correct behavior,
  2.3568 -            // but instead of figuring out the mode, we'll just set the attribute through the Javascript
  2.3569 -            // property for IE <= 8.
  2.3570 -            if (ko.utils.ieVersion <= 8 && attrName in attrHtmlToJavascriptMap) {
  2.3571 -                attrName = attrHtmlToJavascriptMap[attrName];
  2.3572 -                if (toRemove)
  2.3573 -                    element.removeAttribute(attrName);
  2.3574 -                else
  2.3575 -                    element[attrName] = attrValue;
  2.3576 -            } else if (!toRemove) {
  2.3577 -                element.setAttribute(attrName, attrValue.toString());
  2.3578 -            }
  2.3579 -
  2.3580 -            // Treat "name" specially - although you can think of it as an attribute, it also needs
  2.3581 -            // special handling on older versions of IE (https://github.com/SteveSanderson/knockout/pull/333)
  2.3582 -            // Deliberately being case-sensitive here because XHTML would regard "Name" as a different thing
  2.3583 -            // entirely, and there's no strong reason to allow for such casing in HTML.
  2.3584 -            if (attrName === "name") {
  2.3585 -                ko.utils.setElementName(element, toRemove ? "" : attrValue.toString());
  2.3586 -            }
  2.3587 -        });
  2.3588 -    }
  2.3589 -};
  2.3590 -(function() {
  2.3591 -
  2.3592 -ko.bindingHandlers['checked'] = {
  2.3593 -    'after': ['value', 'attr'],
  2.3594 -    'init': function (element, valueAccessor, allBindings) {
  2.3595 -        var checkedValue = ko.pureComputed(function() {
  2.3596 -            // Treat "value" like "checkedValue" when it is included with "checked" binding
  2.3597 -            if (allBindings['has']('checkedValue')) {
  2.3598 -                return ko.utils.unwrapObservable(allBindings.get('checkedValue'));
  2.3599 -            } else if (allBindings['has']('value')) {
  2.3600 -                return ko.utils.unwrapObservable(allBindings.get('value'));
  2.3601 -            }
  2.3602 -
  2.3603 -            return element.value;
  2.3604 -        });
  2.3605 -
  2.3606 -        function updateModel() {
  2.3607 -            // This updates the model value from the view value.
  2.3608 -            // It runs in response to DOM events (click) and changes in checkedValue.
  2.3609 -            var isChecked = element.checked,
  2.3610 -                elemValue = useCheckedValue ? checkedValue() : isChecked;
  2.3611 -
  2.3612 -            // When we're first setting up this computed, don't change any model state.
  2.3613 -            if (ko.computedContext.isInitial()) {
  2.3614 -                return;
  2.3615 -            }
  2.3616 -
  2.3617 -            // We can ignore unchecked radio buttons, because some other radio
  2.3618 -            // button will be getting checked, and that one can take care of updating state.
  2.3619 -            if (isRadio && !isChecked) {
  2.3620 -                return;
  2.3621 -            }
  2.3622 -
  2.3623 -            var modelValue = ko.dependencyDetection.ignore(valueAccessor);
  2.3624 -            if (isValueArray) {
  2.3625 -                if (oldElemValue !== elemValue) {
  2.3626 -                    // When we're responding to the checkedValue changing, and the element is
  2.3627 -                    // currently checked, replace the old elem value with the new elem value
  2.3628 -                    // in the model array.
  2.3629 -                    if (isChecked) {
  2.3630 -                        ko.utils.addOrRemoveItem(modelValue, elemValue, true);
  2.3631 -                        ko.utils.addOrRemoveItem(modelValue, oldElemValue, false);
  2.3632 -                    }
  2.3633 -
  2.3634 -                    oldElemValue = elemValue;
  2.3635 -                } else {
  2.3636 -                    // When we're responding to the user having checked/unchecked a checkbox,
  2.3637 -                    // add/remove the element value to the model array.
  2.3638 -                    ko.utils.addOrRemoveItem(modelValue, elemValue, isChecked);
  2.3639 -                }
  2.3640 -            } else {
  2.3641 -                ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'checked', elemValue, true);
  2.3642 -            }
  2.3643 -        };
  2.3644 -
  2.3645 -        function updateView() {
  2.3646 -            // This updates the view value from the model value.
  2.3647 -            // It runs in response to changes in the bound (checked) value.
  2.3648 -            var modelValue = ko.utils.unwrapObservable(valueAccessor());
  2.3649 -
  2.3650 -            if (isValueArray) {
  2.3651 -                // When a checkbox is bound to an array, being checked represents its value being present in that array
  2.3652 -                element.checked = ko.utils.arrayIndexOf(modelValue, checkedValue()) >= 0;
  2.3653 -            } else if (isCheckbox) {
  2.3654 -                // When a checkbox is bound to any other value (not an array), being checked represents the value being trueish
  2.3655 -                element.checked = modelValue;
  2.3656 -            } else {
  2.3657 -                // For radio buttons, being checked means that the radio button's value corresponds to the model value
  2.3658 -                element.checked = (checkedValue() === modelValue);
  2.3659 -            }
  2.3660 -        };
  2.3661 -
  2.3662 -        var isCheckbox = element.type == "checkbox",
  2.3663 -            isRadio = element.type == "radio";
  2.3664 -
  2.3665 -        // Only bind to check boxes and radio buttons
  2.3666 -        if (!isCheckbox && !isRadio) {
  2.3667 -            return;
  2.3668 -        }
  2.3669 -
  2.3670 -        var isValueArray = isCheckbox && (ko.utils.unwrapObservable(valueAccessor()) instanceof Array),
  2.3671 -            oldElemValue = isValueArray ? checkedValue() : undefined,
  2.3672 -            useCheckedValue = isRadio || isValueArray;
  2.3673 -
  2.3674 -        // IE 6 won't allow radio buttons to be selected unless they have a name
  2.3675 -        if (isRadio && !element.name)
  2.3676 -            ko.bindingHandlers['uniqueName']['init'](element, function() { return true });
  2.3677 -
  2.3678 -        // Set up two computeds to update the binding:
  2.3679 -
  2.3680 -        // The first responds to changes in the checkedValue value and to element clicks
  2.3681 -        ko.computed(updateModel, null, { disposeWhenNodeIsRemoved: element });
  2.3682 -        ko.utils.registerEventHandler(element, "click", updateModel);
  2.3683 -
  2.3684 -        // The second responds to changes in the model value (the one associated with the checked binding)
  2.3685 -        ko.computed(updateView, null, { disposeWhenNodeIsRemoved: element });
  2.3686 -    }
  2.3687 -};
  2.3688 -ko.expressionRewriting.twoWayBindings['checked'] = true;
  2.3689 -
  2.3690 -ko.bindingHandlers['checkedValue'] = {
  2.3691 -    'update': function (element, valueAccessor) {
  2.3692 -        element.value = ko.utils.unwrapObservable(valueAccessor());
  2.3693 -    }
  2.3694 -};
  2.3695 -
  2.3696 -})();var classesWrittenByBindingKey = '__ko__cssValue';
  2.3697 -ko.bindingHandlers['css'] = {
  2.3698 -    'update': function (element, valueAccessor) {
  2.3699 -        var value = ko.utils.unwrapObservable(valueAccessor());
  2.3700 -        if (typeof value == "object") {
  2.3701 -            ko.utils.objectForEach(value, function(className, shouldHaveClass) {
  2.3702 -                shouldHaveClass = ko.utils.unwrapObservable(shouldHaveClass);
  2.3703 -                ko.utils.toggleDomNodeCssClass(element, className, shouldHaveClass);
  2.3704 -            });
  2.3705 -        } else {
  2.3706 -            value = String(value || ''); // Make sure we don't try to store or set a non-string value
  2.3707 -            ko.utils.toggleDomNodeCssClass(element, element[classesWrittenByBindingKey], false);
  2.3708 -            element[classesWrittenByBindingKey] = value;
  2.3709 -            ko.utils.toggleDomNodeCssClass(element, value, true);
  2.3710 -        }
  2.3711 -    }
  2.3712 -};
  2.3713 -ko.bindingHandlers['enable'] = {
  2.3714 -    'update': function (element, valueAccessor) {
  2.3715 -        var value = ko.utils.unwrapObservable(valueAccessor());
  2.3716 -        if (value && element.disabled)
  2.3717 -            element.removeAttribute("disabled");
  2.3718 -        else if ((!value) && (!element.disabled))
  2.3719 -            element.disabled = true;
  2.3720 -    }
  2.3721 -};
  2.3722 -
  2.3723 -ko.bindingHandlers['disable'] = {
  2.3724 -    'update': function (element, valueAccessor) {
  2.3725 -        ko.bindingHandlers['enable']['update'](element, function() { return !ko.utils.unwrapObservable(valueAccessor()) });
  2.3726 -    }
  2.3727 -};
  2.3728 -// For certain common events (currently just 'click'), allow a simplified data-binding syntax
  2.3729 -// e.g. click:handler instead of the usual full-length event:{click:handler}
  2.3730 -function makeEventHandlerShortcut(eventName) {
  2.3731 -    ko.bindingHandlers[eventName] = {
  2.3732 -        'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
  2.3733 -            var newValueAccessor = function () {
  2.3734 -                var result = {};
  2.3735 -                result[eventName] = valueAccessor();
  2.3736 -                return result;
  2.3737 -            };
  2.3738 -            return ko.bindingHandlers['event']['init'].call(this, element, newValueAccessor, allBindings, viewModel, bindingContext);
  2.3739 -        }
  2.3740 -    }
  2.3741 -}
  2.3742 -
  2.3743 -ko.bindingHandlers['event'] = {
  2.3744 -    'init' : function (element, valueAccessor, allBindings, viewModel, bindingContext) {
  2.3745 -        var eventsToHandle = valueAccessor() || {};
  2.3746 -        ko.utils.objectForEach(eventsToHandle, function(eventName) {
  2.3747 -            if (typeof eventName == "string") {
  2.3748 -                ko.utils.registerEventHandler(element, eventName, function (event) {
  2.3749 -                    var handlerReturnValue;
  2.3750 -                    var handlerFunction = valueAccessor()[eventName];
  2.3751 -                    if (!handlerFunction)
  2.3752 -                        return;
  2.3753 -
  2.3754 -                    try {
  2.3755 -                        // Take all the event args, and prefix with the viewmodel
  2.3756 -                        var argsForHandler = ko.utils.makeArray(arguments);
  2.3757 -                        viewModel = bindingContext['$data'];
  2.3758 -                        argsForHandler.unshift(viewModel);
  2.3759 -                        handlerReturnValue = handlerFunction.apply(viewModel, argsForHandler);
  2.3760 -                    } finally {
  2.3761 -                        if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true.
  2.3762 -                            if (event.preventDefault)
  2.3763 -                                event.preventDefault();
  2.3764 -                            else
  2.3765 -                                event.returnValue = false;
  2.3766 -                        }
  2.3767 -                    }
  2.3768 -
  2.3769 -                    var bubble = allBindings.get(eventName + 'Bubble') !== false;
  2.3770 -                    if (!bubble) {
  2.3771 -                        event.cancelBubble = true;
  2.3772 -                        if (event.stopPropagation)
  2.3773 -                            event.stopPropagation();
  2.3774 -                    }
  2.3775 -                });
  2.3776 -            }
  2.3777 -        });
  2.3778 -    }
  2.3779 -};
  2.3780 -// "foreach: someExpression" is equivalent to "template: { foreach: someExpression }"
  2.3781 -// "foreach: { data: someExpression, afterAdd: myfn }" is equivalent to "template: { foreach: someExpression, afterAdd: myfn }"
  2.3782 -ko.bindingHandlers['foreach'] = {
  2.3783 -    makeTemplateValueAccessor: function(valueAccessor) {
  2.3784 -        return function() {
  2.3785 -            var modelValue = valueAccessor(),
  2.3786 -                unwrappedValue = ko.utils.peekObservable(modelValue);    // Unwrap without setting a dependency here
  2.3787 -
  2.3788 -            // If unwrappedValue is the array, pass in the wrapped value on its own
  2.3789 -            // The value will be unwrapped and tracked within the template binding
  2.3790 -            // (See https://github.com/SteveSanderson/knockout/issues/523)
  2.3791 -            if ((!unwrappedValue) || typeof unwrappedValue.length == "number")
  2.3792 -                return { 'foreach': modelValue, 'templateEngine': ko.nativeTemplateEngine.instance };
  2.3793 -
  2.3794 -            // If unwrappedValue.data is the array, preserve all relevant options and unwrap again value so we get updates
  2.3795 -            ko.utils.unwrapObservable(modelValue);
  2.3796 -            return {
  2.3797 -                'foreach': unwrappedValue['data'],
  2.3798 -                'as': unwrappedValue['as'],
  2.3799 -                'includeDestroyed': unwrappedValue['includeDestroyed'],
  2.3800 -                'afterAdd': unwrappedValue['afterAdd'],
  2.3801 -                'beforeRemove': unwrappedValue['beforeRemove'],
  2.3802 -                'afterRender': unwrappedValue['afterRender'],
  2.3803 -                'beforeMove': unwrappedValue['beforeMove'],
  2.3804 -                'afterMove': unwrappedValue['afterMove'],
  2.3805 -                'templateEngine': ko.nativeTemplateEngine.instance
  2.3806 -            };
  2.3807 -        };
  2.3808 -    },
  2.3809 -    'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
  2.3810 -        return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor));
  2.3811 -    },
  2.3812 -    'update': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
  2.3813 -        return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor), allBindings, viewModel, bindingContext);
  2.3814 -    }
  2.3815 -};
  2.3816 -ko.expressionRewriting.bindingRewriteValidators['foreach'] = false; // Can't rewrite control flow bindings
  2.3817 -ko.virtualElements.allowedBindings['foreach'] = true;
  2.3818 -var hasfocusUpdatingProperty = '__ko_hasfocusUpdating';
  2.3819 -var hasfocusLastValue = '__ko_hasfocusLastValue';
  2.3820 -ko.bindingHandlers['hasfocus'] = {
  2.3821 -    'init': function(element, valueAccessor, allBindings) {
  2.3822 -        var handleElementFocusChange = function(isFocused) {
  2.3823 -            // Where possible, ignore which event was raised and determine focus state using activeElement,
  2.3824 -            // as this avoids phantom focus/blur events raised when changing tabs in modern browsers.
  2.3825 -            // However, not all KO-targeted browsers (Firefox 2) support activeElement. For those browsers,
  2.3826 -            // prevent a loss of focus when changing tabs/windows by setting a flag that prevents hasfocus
  2.3827 -            // from calling 'blur()' on the element when it loses focus.
  2.3828 -            // Discussion at https://github.com/SteveSanderson/knockout/pull/352
  2.3829 -            element[hasfocusUpdatingProperty] = true;
  2.3830 -            var ownerDoc = element.ownerDocument;
  2.3831 -            if ("activeElement" in ownerDoc) {
  2.3832 -                var active;
  2.3833 -                try {
  2.3834 -                    active = ownerDoc.activeElement;
  2.3835 -                } catch(e) {
  2.3836 -                    // IE9 throws if you access activeElement during page load (see issue #703)
  2.3837 -                    active = ownerDoc.body;
  2.3838 -                }
  2.3839 -                isFocused = (active === element);
  2.3840 -            }
  2.3841 -            var modelValue = valueAccessor();
  2.3842 -            ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'hasfocus', isFocused, true);
  2.3843 -
  2.3844 -            //cache the latest value, so we can avoid unnecessarily calling focus/blur in the update function
  2.3845 -            element[hasfocusLastValue] = isFocused;
  2.3846 -            element[hasfocusUpdatingProperty] = false;
  2.3847 -        };
  2.3848 -        var handleElementFocusIn = handleElementFocusChange.bind(null, true);
  2.3849 -        var handleElementFocusOut = handleElementFocusChange.bind(null, false);
  2.3850 -
  2.3851 -        ko.utils.registerEventHandler(element, "focus", handleElementFocusIn);
  2.3852 -        ko.utils.registerEventHandler(element, "focusin", handleElementFocusIn); // For IE
  2.3853 -        ko.utils.registerEventHandler(element, "blur",  handleElementFocusOut);
  2.3854 -        ko.utils.registerEventHandler(element, "focusout",  handleElementFocusOut); // For IE
  2.3855 -    },
  2.3856 -    'update': function(element, valueAccessor) {
  2.3857 -        var value = !!ko.utils.unwrapObservable(valueAccessor()); //force boolean to compare with last value
  2.3858 -        if (!element[hasfocusUpdatingProperty] && element[hasfocusLastValue] !== value) {
  2.3859 -            value ? element.focus() : element.blur();
  2.3860 -            ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, value ? "focusin" : "focusout"]); // For IE, which doesn't reliably fire "focus" or "blur" events synchronously
  2.3861 -        }
  2.3862 -    }
  2.3863 -};
  2.3864 -ko.expressionRewriting.twoWayBindings['hasfocus'] = true;
  2.3865 -
  2.3866 -ko.bindingHandlers['hasFocus'] = ko.bindingHandlers['hasfocus']; // Make "hasFocus" an alias
  2.3867 -ko.expressionRewriting.twoWayBindings['hasFocus'] = true;
  2.3868 -ko.bindingHandlers['html'] = {
  2.3869 -    'init': function() {
  2.3870 -        // Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)
  2.3871 -        return { 'controlsDescendantBindings': true };
  2.3872 -    },
  2.3873 -    'update': function (element, valueAccessor) {
  2.3874 -        // setHtml will unwrap the value if needed
  2.3875 -        ko.utils.setHtml(element, valueAccessor());
  2.3876 -    }
  2.3877 -};
  2.3878 -// Makes a binding like with or if
  2.3879 -function makeWithIfBinding(bindingKey, isWith, isNot, makeContextCallback) {
  2.3880 -    ko.bindingHandlers[bindingKey] = {
  2.3881 -        'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) {
  2.3882 -            var didDisplayOnLastUpdate,
  2.3883 -                savedNodes;
  2.3884 -            ko.computed(function() {
  2.3885 -                var dataValue = ko.utils.unwrapObservable(valueAccessor()),
  2.3886 -                    shouldDisplay = !isNot !== !dataValue, // equivalent to isNot ? !dataValue : !!dataValue
  2.3887 -                    isFirstRender = !savedNodes,
  2.3888 -                    needsRefresh = isFirstRender || isWith || (shouldDisplay !== didDisplayOnLastUpdate);
  2.3889 -
  2.3890 -                if (needsRefresh) {
  2.3891 -                    // Save a copy of the inner nodes on the initial update, but only if we have dependencies.
  2.3892 -                    if (isFirstRender && ko.computedContext.getDependenciesCount()) {
  2.3893 -                        savedNodes = ko.utils.cloneNodes(ko.virtualElements.childNodes(element), true /* shouldCleanNodes */);
  2.3894 -                    }
  2.3895 -
  2.3896 -                    if (shouldDisplay) {
  2.3897 -                        if (!isFirstRender) {
  2.3898 -                            ko.virtualElements.setDomNodeChildren(element, ko.utils.cloneNodes(savedNodes));
  2.3899 -                        }
  2.3900 -                        ko.applyBindingsToDescendants(makeContextCallback ? makeContextCallback(bindingContext, dataValue) : bindingContext, element);
  2.3901 -                    } else {
  2.3902 -                        ko.virtualElements.emptyNode(element);
  2.3903 -                    }
  2.3904 -
  2.3905 -                    didDisplayOnLastUpdate = shouldDisplay;
  2.3906 -                }
  2.3907 -            }, null, { disposeWhenNodeIsRemoved: element });
  2.3908 -            return { 'controlsDescendantBindings': true };
  2.3909 -        }
  2.3910 -    };
  2.3911 -    ko.expressionRewriting.bindingRewriteValidators[bindingKey] = false; // Can't rewrite control flow bindings
  2.3912 -    ko.virtualElements.allowedBindings[bindingKey] = true;
  2.3913 -}
  2.3914 -
  2.3915 -// Construct the actual binding handlers
  2.3916 -makeWithIfBinding('if');
  2.3917 -makeWithIfBinding('ifnot', false /* isWith */, true /* isNot */);
  2.3918 -makeWithIfBinding('with', true /* isWith */, false /* isNot */,
  2.3919 -    function(bindingContext, dataValue) {
  2.3920 -        return bindingContext['createChildContext'](dataValue);
  2.3921 -    }
  2.3922 -);
  2.3923 -var captionPlaceholder = {};
  2.3924 -ko.bindingHandlers['options'] = {
  2.3925 -    'init': function(element) {
  2.3926 -        if (ko.utils.tagNameLower(element) !== "select")
  2.3927 -            throw new Error("options binding applies only to SELECT elements");
  2.3928 -
  2.3929 -        // Remove all existing <option>s.
  2.3930 -        while (element.length > 0) {
  2.3931 -            element.remove(0);
  2.3932 -        }
  2.3933 -
  2.3934 -        // Ensures that the binding processor doesn't try to bind the options
  2.3935 -        return { 'controlsDescendantBindings': true };
  2.3936 -    },
  2.3937 -    'update': function (element, valueAccessor, allBindings) {
  2.3938 -        function selectedOptions() {
  2.3939 -            return ko.utils.arrayFilter(element.options, function (node) { return node.selected; });
  2.3940 -        }
  2.3941 -
  2.3942 -        var selectWasPreviouslyEmpty = element.length == 0;
  2.3943 -        var previousScrollTop = (!selectWasPreviouslyEmpty && element.multiple) ? element.scrollTop : null;
  2.3944 -        var unwrappedArray = ko.utils.unwrapObservable(valueAccessor());
  2.3945 -        var includeDestroyed = allBindings.get('optionsIncludeDestroyed');
  2.3946 -        var arrayToDomNodeChildrenOptions = {};
  2.3947 -        var captionValue;
  2.3948 -        var filteredArray;
  2.3949 -        var previousSelectedValues;
  2.3950 -
  2.3951 -        if (element.multiple) {
  2.3952 -            previousSelectedValues = ko.utils.arrayMap(selectedOptions(), ko.selectExtensions.readValue);
  2.3953 -        } else {
  2.3954 -            previousSelectedValues = element.selectedIndex >= 0 ? [ ko.selectExtensions.readValue(element.options[element.selectedIndex]) ] : [];
  2.3955 -        }
  2.3956 -
  2.3957 -        if (unwrappedArray) {
  2.3958 -            if (typeof unwrappedArray.length == "undefined") // Coerce single value into array
  2.3959 -                unwrappedArray = [unwrappedArray];
  2.3960 -
  2.3961 -            // Filter out any entries marked as destroyed
  2.3962 -            filteredArray = ko.utils.arrayFilter(unwrappedArray, function(item) {
  2.3963 -                return includeDestroyed || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']);
  2.3964 -            });
  2.3965 -
  2.3966 -            // If caption is included, add it to the array
  2.3967 -            if (allBindings['has']('optionsCaption')) {
  2.3968 -                captionValue = ko.utils.unwrapObservable(allBindings.get('optionsCaption'));
  2.3969 -                // If caption value is null or undefined, don't show a caption
  2.3970 -                if (captionValue !== null && captionValue !== undefined) {
  2.3971 -                    filteredArray.unshift(captionPlaceholder);
  2.3972 -                }
  2.3973 -            }
  2.3974 -        } else {
  2.3975 -            // If a falsy value is provided (e.g. null), we'll simply empty the select element
  2.3976 -        }
  2.3977 -
  2.3978 -        function applyToObject(object, predicate, defaultValue) {
  2.3979 -            var predicateType = typeof predicate;
  2.3980 -            if (predicateType == "function")    // Given a function; run it against the data value
  2.3981 -                return predicate(object);
  2.3982 -            else if (predicateType == "string") // Given a string; treat it as a property name on the data value
  2.3983 -                return object[predicate];
  2.3984 -            else                                // Given no optionsText arg; use the data value itself
  2.3985 -                return defaultValue;
  2.3986 -        }
  2.3987 -
  2.3988 -        // The following functions can run at two different times:
  2.3989 -        // The first is when the whole array is being updated directly from this binding handler.
  2.3990 -        // The second is when an observable value for a specific array entry is updated.
  2.3991 -        // oldOptions will be empty in the first case, but will be filled with the previously generated option in the second.
  2.3992 -        var itemUpdate = false;
  2.3993 -        function optionForArrayItem(arrayEntry, index, oldOptions) {
  2.3994 -            if (oldOptions.length) {
  2.3995 -                previousSelectedValues = oldOptions[0].selected ? [ ko.selectExtensions.readValue(oldOptions[0]) ] : [];
  2.3996 -                itemUpdate = true;
  2.3997 -            }
  2.3998 -            var option = element.ownerDocument.createElement("option");
  2.3999 -            if (arrayEntry === captionPlaceholder) {
  2.4000 -                ko.utils.setTextContent(option, allBindings.get('optionsCaption'));
  2.4001 -                ko.selectExtensions.writeValue(option, undefined);
  2.4002 -            } else {
  2.4003 -                // Apply a value to the option element
  2.4004 -                var optionValue = applyToObject(arrayEntry, allBindings.get('optionsValue'), arrayEntry);
  2.4005 -                ko.selectExtensions.writeValue(option, ko.utils.unwrapObservable(optionValue));
  2.4006 -
  2.4007 -                // Apply some text to the option element
  2.4008 -                var optionText = applyToObject(arrayEntry, allBindings.get('optionsText'), optionValue);
  2.4009 -                ko.utils.setTextContent(option, optionText);
  2.4010 -            }
  2.4011 -            return [option];
  2.4012 -        }
  2.4013 -
  2.4014 -        // By using a beforeRemove callback, we delay the removal until after new items are added. This fixes a selection
  2.4015 -        // problem in IE<=8 and Firefox. See https://github.com/knockout/knockout/issues/1208
  2.4016 -        arrayToDomNodeChildrenOptions['beforeRemove'] =
  2.4017 -            function (option) {
  2.4018 -                element.removeChild(option);
  2.4019 -            };
  2.4020 -
  2.4021 -        function setSelectionCallback(arrayEntry, newOptions) {
  2.4022 -            // IE6 doesn't like us to assign selection to OPTION nodes before they're added to the document.
  2.4023 -            // That's why we first added them without selection. Now it's time to set the selection.
  2.4024 -            if (previousSelectedValues.length) {
  2.4025 -                var isSelected = ko.utils.arrayIndexOf(previousSelectedValues, ko.selectExtensions.readValue(newOptions[0])) >= 0;
  2.4026 -                ko.utils.setOptionNodeSelectionState(newOptions[0], isSelected);
  2.4027 -
  2.4028 -                // If this option was changed from being selected during a single-item update, notify the change
  2.4029 -                if (itemUpdate && !isSelected)
  2.4030 -                    ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, "change"]);
  2.4031 -            }
  2.4032 -        }
  2.4033 -
  2.4034 -        var callback = setSelectionCallback;
  2.4035 -        if (allBindings['has']('optionsAfterRender')) {
  2.4036 -            callback = function(arrayEntry, newOptions) {
  2.4037 -                setSelectionCallback(arrayEntry, newOptions);
  2.4038 -                ko.dependencyDetection.ignore(allBindings.get('optionsAfterRender'), null, [newOptions[0], arrayEntry !== captionPlaceholder ? arrayEntry : undefined]);
  2.4039 -            }
  2.4040 -        }
  2.4041 -
  2.4042 -        ko.utils.setDomNodeChildrenFromArrayMapping(element, filteredArray, optionForArrayItem, arrayToDomNodeChildrenOptions, callback);
  2.4043 -
  2.4044 -        ko.dependencyDetection.ignore(function () {
  2.4045 -            if (allBindings.get('valueAllowUnset') && allBindings['has']('value')) {
  2.4046 -                // The model value is authoritative, so make sure its value is the one selected
  2.4047 -                ko.selectExtensions.writeValue(element, ko.utils.unwrapObservable(allBindings.get('value')), true /* allowUnset */);
  2.4048 -            } else {
  2.4049 -                // Determine if the selection has changed as a result of updating the options list
  2.4050 -                var selectionChanged;
  2.4051 -                if (element.multiple) {
  2.4052 -                    // For a multiple-select box, compare the new selection count to the previous one
  2.4053 -                    // But if nothing was selected before, the selection can't have changed
  2.4054 -                    selectionChanged = previousSelectedValues.length && selectedOptions().length < previousSelectedValues.length;
  2.4055 -                } else {
  2.4056 -                    // For a single-select box, compare the current value to the previous value
  2.4057 -                    // But if nothing was selected before or nothing is selected now, just look for a change in selection
  2.4058 -                    selectionChanged = (previousSelectedValues.length && element.selectedIndex >= 0)
  2.4059 -                        ? (ko.selectExtensions.readValue(element.options[element.selectedIndex]) !== previousSelectedValues[0])
  2.4060 -                        : (previousSelectedValues.length || element.selectedIndex >= 0);
  2.4061 -                }
  2.4062 -
  2.4063 -                // Ensure consistency between model value and selected option.
  2.4064 -                // If the dropdown was changed so that selection is no longer the same,
  2.4065 -                // notify the value or selectedOptions binding.
  2.4066 -                if (selectionChanged) {
  2.4067 -                    ko.utils.triggerEvent(element, "change");
  2.4068 -                }
  2.4069 -            }
  2.4070 -        });
  2.4071 -
  2.4072 -        // Workaround for IE bug
  2.4073 -        ko.utils.ensureSelectElementIsRenderedCorrectly(element);
  2.4074 -
  2.4075 -        if (previousScrollTop && Math.abs(previousScrollTop - element.scrollTop) > 20)
  2.4076 -            element.scrollTop = previousScrollTop;
  2.4077 -    }
  2.4078 -};
  2.4079 -ko.bindingHandlers['options'].optionValueDomDataKey = ko.utils.domData.nextKey();
  2.4080 -ko.bindingHandlers['selectedOptions'] = {
  2.4081 -    'after': ['options', 'foreach'],
  2.4082 -    'init': function (element, valueAccessor, allBindings) {
  2.4083 -        ko.utils.registerEventHandler(element, "change", function () {
  2.4084 -            var value = valueAccessor(), valueToWrite = [];
  2.4085 -            ko.utils.arrayForEach(element.getElementsByTagName("option"), function(node) {
  2.4086 -                if (node.selected)
  2.4087 -                    valueToWrite.push(ko.selectExtensions.readValue(node));
  2.4088 -            });
  2.4089 -            ko.expressionRewriting.writeValueToProperty(value, allBindings, 'selectedOptions', valueToWrite);
  2.4090 -        });
  2.4091 -    },
  2.4092 -    'update': function (element, valueAccessor) {
  2.4093 -        if (ko.utils.tagNameLower(element) != "select")
  2.4094 -            throw new Error("values binding applies only to SELECT elements");
  2.4095 -
  2.4096 -        var newValue = ko.utils.unwrapObservable(valueAccessor());
  2.4097 -        if (newValue && typeof newValue.length == "number") {
  2.4098 -            ko.utils.arrayForEach(element.getElementsByTagName("option"), function(node) {
  2.4099 -                var isSelected = ko.utils.arrayIndexOf(newValue, ko.selectExtensions.readValue(node)) >= 0;
  2.4100 -                ko.utils.setOptionNodeSelectionState(node, isSelected);
  2.4101 -            });
  2.4102 -        }
  2.4103 -    }
  2.4104 -};
  2.4105 -ko.expressionRewriting.twoWayBindings['selectedOptions'] = true;
  2.4106 -ko.bindingHandlers['style'] = {
  2.4107 -    'update': function (element, valueAccessor) {
  2.4108 -        var value = ko.utils.unwrapObservable(valueAccessor() || {});
  2.4109 -        ko.utils.objectForEach(value, function(styleName, styleValue) {
  2.4110 -            styleValue = ko.utils.unwrapObservable(styleValue);
  2.4111 -
  2.4112 -            if (styleValue === null || styleValue === undefined || styleValue === false) {
  2.4113 -                // Empty string removes the value, whereas null/undefined have no effect
  2.4114 -                styleValue = "";
  2.4115 -            }
  2.4116 -
  2.4117 -            element.style[styleName] = styleValue;
  2.4118 -        });
  2.4119 -    }
  2.4120 -};
  2.4121 -ko.bindingHandlers['submit'] = {
  2.4122 -    'init': function (element, valueAccessor, allBindings, viewModel, bindingContext) {
  2.4123 -        if (typeof valueAccessor() != "function")
  2.4124 -            throw new Error("The value for a submit binding must be a function");
  2.4125 -        ko.utils.registerEventHandler(element, "submit", function (event) {
  2.4126 -            var handlerReturnValue;
  2.4127 -            var value = valueAccessor();
  2.4128 -            try { handlerReturnValue = value.call(bindingContext['$data'], element); }
  2.4129 -            finally {
  2.4130 -                if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true.
  2.4131 -                    if (event.preventDefault)
  2.4132 -                        event.preventDefault();
  2.4133 -                    else
  2.4134 -                        event.returnValue = false;
  2.4135 -                }
  2.4136 -            }
  2.4137 -        });
  2.4138 -    }
  2.4139 -};
  2.4140 -ko.bindingHandlers['text'] = {
  2.4141 -    'init': function() {
  2.4142 -        // Prevent binding on the dynamically-injected text node (as developers are unlikely to expect that, and it has security implications).
  2.4143 -        // It should also make things faster, as we no longer have to consider whether the text node might be bindable.
  2.4144 -        return { 'controlsDescendantBindings': true };
  2.4145 -    },
  2.4146 -    'update': function (element, valueAccessor) {
  2.4147 -        ko.utils.setTextContent(element, valueAccessor());
  2.4148 -    }
  2.4149 -};
  2.4150 -ko.virtualElements.allowedBindings['text'] = true;
  2.4151 -(function () {
  2.4152 -
  2.4153 -if (window && window.navigator) {
  2.4154 -    var parseVersion = function (matches) {
  2.4155 -        if (matches) {
  2.4156 -            return parseFloat(matches[1]);
  2.4157 -        }
  2.4158 -    };
  2.4159 -
  2.4160 -    // Detect various browser versions because some old versions don't fully support the 'input' event
  2.4161 -    var operaVersion = window.opera && window.opera.version && parseInt(window.opera.version()),
  2.4162 -        userAgent = window.navigator.userAgent,
  2.4163 -        safariVersion = parseVersion(userAgent.match(/^(?:(?!chrome).)*version\/([^ ]*) safari/i)),
  2.4164 -        firefoxVersion = parseVersion(userAgent.match(/Firefox\/([^ ]*)/));
  2.4165 -}
  2.4166 -
  2.4167 -// IE 8 and 9 have bugs that prevent the normal events from firing when the value changes.
  2.4168 -// But it does fire the 'selectionchange' event on many of those, presumably because the
  2.4169 -// cursor is moving and that counts as the selection changing. The 'selectionchange' event is
  2.4170 -// fired at the document level only and doesn't directly indicate which element changed. We
  2.4171 -// set up just one event handler for the document and use 'activeElement' to determine which
  2.4172 -// element was changed.
  2.4173 -if (ko.utils.ieVersion < 10) {
  2.4174 -    var selectionChangeRegisteredName = ko.utils.domData.nextKey(),
  2.4175 -        selectionChangeHandlerName = ko.utils.domData.nextKey();
  2.4176 -    var selectionChangeHandler = function(event) {
  2.4177 -        var target = this.activeElement,
  2.4178 -            handler = target && ko.utils.domData.get(target, selectionChangeHandlerName);
  2.4179 -        if (handler) {
  2.4180 -            handler(event);
  2.4181 -        }
  2.4182 -    };
  2.4183 -    var registerForSelectionChangeEvent = function (element, handler) {
  2.4184 -        var ownerDoc = element.ownerDocument;
  2.4185 -        if (!ko.utils.domData.get(ownerDoc, selectionChangeRegisteredName)) {
  2.4186 -            ko.utils.domData.set(ownerDoc, selectionChangeRegisteredName, true);
  2.4187 -            ko.utils.registerEventHandler(ownerDoc, 'selectionchange', selectionChangeHandler);
  2.4188 -        }
  2.4189 -        ko.utils.domData.set(element, selectionChangeHandlerName, handler);
  2.4190 -    };
  2.4191 -}
  2.4192 -
  2.4193 -ko.bindingHandlers['textInput'] = {
  2.4194 -    'init': function (element, valueAccessor, allBindings) {
  2.4195 -
  2.4196 -        var previousElementValue = element.value,
  2.4197 -            timeoutHandle,
  2.4198 -            elementValueBeforeEvent;
  2.4199 -
  2.4200 -        var updateModel = function (event) {
  2.4201 -            clearTimeout(timeoutHandle);
  2.4202 -            elementValueBeforeEvent = timeoutHandle = undefined;
  2.4203 -
  2.4204 -            var elementValue = element.value;
  2.4205 -            if (previousElementValue !== elementValue) {
  2.4206 -                // Provide a way for tests to know exactly which event was processed
  2.4207 -                if (DEBUG && event) element['_ko_textInputProcessedEvent'] = event.type;
  2.4208 -                previousElementValue = elementValue;
  2.4209 -                ko.expressionRewriting.writeValueToProperty(valueAccessor(), allBindings, 'textInput', elementValue);
  2.4210 -            }
  2.4211 -        };
  2.4212 -
  2.4213 -        var deferUpdateModel = function (event) {
  2.4214 -            if (!timeoutHandle) {
  2.4215 -                // The elementValueBeforeEvent variable is set *only* during the brief gap between an
  2.4216 -                // event firing and the updateModel function running. This allows us to ignore model
  2.4217 -                // updates that are from the previous state of the element, usually due to techniques
  2.4218 -                // such as rateLimit. Such updates, if not ignored, can cause keystrokes to be lost.
  2.4219 -                elementValueBeforeEvent = element.value;
  2.4220 -                var handler = DEBUG ? updateModel.bind(element, {type: event.type}) : updateModel;
  2.4221 -                timeoutHandle = setTimeout(handler, 4);
  2.4222 -            }
  2.4223 -        };
  2.4224 -
  2.4225 -        var updateView = function () {
  2.4226 -            var modelValue = ko.utils.unwrapObservable(valueAccessor());
  2.4227 -
  2.4228 -            if (modelValue === null || modelValue === undefined) {
  2.4229 -                modelValue = '';
  2.4230 -            }
  2.4231 -
  2.4232 -            if (elementValueBeforeEvent !== undefined && modelValue === elementValueBeforeEvent) {
  2.4233 -                setTimeout(updateView, 4);
  2.4234 -                return;
  2.4235 -            }
  2.4236 -
  2.4237 -            // Update the element only if the element and model are different. On some browsers, updating the value
  2.4238 -            // will move the cursor to the end of the input, which would be bad while the user is typing.
  2.4239 -            if (element.value !== modelValue) {
  2.4240 -                previousElementValue = modelValue;  // Make sure we ignore events (propertychange) that result from updating the value
  2.4241 -                element.value = modelValue;
  2.4242 -            }
  2.4243 -        };
  2.4244 -
  2.4245 -        var onEvent = function (event, handler) {
  2.4246 -            ko.utils.registerEventHandler(element, event, handler);
  2.4247 -        };
  2.4248 -
  2.4249 -        if (DEBUG && ko.bindingHandlers['textInput']['_forceUpdateOn']) {
  2.4250 -            // Provide a way for tests to specify exactly which events are bound
  2.4251 -            ko.utils.arrayForEach(ko.bindingHandlers['textInput']['_forceUpdateOn'], function(eventName) {
  2.4252 -                if (eventName.slice(0,5) == 'after') {
  2.4253 -                    onEvent(eventName.slice(5), deferUpdateModel);
  2.4254 -                } else {
  2.4255 -                    onEvent(eventName, updateModel);
  2.4256 -                }
  2.4257 -            });
  2.4258 -        } else {
  2.4259 -            if (ko.utils.ieVersion < 10) {
  2.4260 -                // Internet Explorer <= 8 doesn't support the 'input' event, but does include 'propertychange' that fires whenever
  2.4261 -                // any property of an element changes. Unlike 'input', it also fires if a property is changed from JavaScript code,
  2.4262 -                // but that's an acceptable compromise for this binding. IE 9 does support 'input', but since it doesn't fire it
  2.4263 -                // when using autocomplete, we'll use 'propertychange' for it also.
  2.4264 -                onEvent('propertychange', function(event) {
  2.4265 -                    if (event.propertyName === 'value') {
  2.4266 -                        updateModel(event);
  2.4267 -                    }
  2.4268 -                });
  2.4269 -
  2.4270 -                if (ko.utils.ieVersion == 8) {
  2.4271 -                    // IE 8 has a bug where it fails to fire 'propertychange' on the first update following a value change from
  2.4272 -                    // JavaScript code. It also doesn't fire if you clear the entire value. To fix this, we bind to the following
  2.4273 -                    // events too.
  2.4274 -                    onEvent('keyup', updateModel);      // A single keystoke
  2.4275 -                    onEvent('keydown', updateModel);    // The first character when a key is held down
  2.4276 -                }
  2.4277 -                if (ko.utils.ieVersion >= 8) {
  2.4278 -                    // Internet Explorer 9 doesn't fire the 'input' event when deleting text, including using
  2.4279 -                    // the backspace, delete, or ctrl-x keys, clicking the 'x' to clear the input, dragging text
  2.4280 -                    // out of the field, and cutting or deleting text using the context menu. 'selectionchange'
  2.4281 -                    // can detect all of those except dragging text out of the field, for which we use 'dragend'.
  2.4282 -                    // These are also needed in IE8 because of the bug described above.
  2.4283 -                    registerForSelectionChangeEvent(element, updateModel);  // 'selectionchange' covers cut, paste, drop, delete, etc.
  2.4284 -                    onEvent('dragend', deferUpdateModel);
  2.4285 -                }
  2.4286 -            } else {
  2.4287 -                // All other supported browsers support the 'input' event, which fires whenever the content of the element is changed
  2.4288 -                // through the user interface.
  2.4289 -                onEvent('input', updateModel);
  2.4290 -
  2.4291 -                if (safariVersion < 5 && ko.utils.tagNameLower(element) === "textarea") {
  2.4292 -                    // Safari <5 doesn't fire the 'input' event for <textarea> elements (it does fire 'textInput'
  2.4293 -                    // but only when typing). So we'll just catch as much as we can with keydown, cut, and paste.
  2.4294 -                    onEvent('keydown', deferUpdateModel);
  2.4295 -                    onEvent('paste', deferUpdateModel);
  2.4296 -                    onEvent('cut', deferUpdateModel);
  2.4297 -                } else if (operaVersion < 11) {
  2.4298 -                    // Opera 10 doesn't always fire the 'input' event for cut, paste, undo & drop operations.
  2.4299 -                    // We can try to catch some of those using 'keydown'.
  2.4300 -                    onEvent('keydown', deferUpdateModel);
  2.4301 -                } else if (firefoxVersion < 4.0) {
  2.4302 -                    // Firefox <= 3.6 doesn't fire the 'input' event when text is filled in through autocomplete
  2.4303 -                    onEvent('DOMAutoComplete', updateModel);
  2.4304 -
  2.4305 -                    // Firefox <=3.5 doesn't fire the 'input' event when text is dropped into the input.
  2.4306 -                    onEvent('dragdrop', updateModel);       // <3.5
  2.4307 -                    onEvent('drop', updateModel);           // 3.5
  2.4308 -                }
  2.4309 -            }
  2.4310 -        }
  2.4311 -
  2.4312 -        // Bind to the change event so that we can catch programmatic updates of the value that fire this event.
  2.4313 -        onEvent('change', updateModel);
  2.4314 -
  2.4315 -        ko.computed(updateView, null, { disposeWhenNodeIsRemoved: element });
  2.4316 -    }
  2.4317 -};
  2.4318 -ko.expressionRewriting.twoWayBindings['textInput'] = true;
  2.4319 -
  2.4320 -// textinput is an alias for textInput
  2.4321 -ko.bindingHandlers['textinput'] = {
  2.4322 -    // preprocess is the only way to set up a full alias
  2.4323 -    'preprocess': function (value, name, addBinding) {
  2.4324 -        addBinding('textInput', value);
  2.4325 -    }
  2.4326 -};
  2.4327 -
  2.4328 -})();ko.bindingHandlers['uniqueName'] = {
  2.4329 -    'init': function (element, valueAccessor) {
  2.4330 -        if (valueAccessor()) {
  2.4331 -            var name = "ko_unique_" + (++ko.bindingHandlers['uniqueName'].currentIndex);
  2.4332 -            ko.utils.setElementName(element, name);
  2.4333 -        }
  2.4334 -    }
  2.4335 -};
  2.4336 -ko.bindingHandlers['uniqueName'].currentIndex = 0;
  2.4337 -ko.bindingHandlers['value'] = {
  2.4338 -    'after': ['options', 'foreach'],
  2.4339 -    'init': function (element, valueAccessor, allBindings) {
  2.4340 -        // If the value binding is placed on a radio/checkbox, then just pass through to checkedValue and quit
  2.4341 -        if (element.tagName.toLowerCase() == "input" && (element.type == "checkbox" || element.type == "radio")) {
  2.4342 -            ko.applyBindingAccessorsToNode(element, { 'checkedValue': valueAccessor });
  2.4343 -            return;
  2.4344 -        }
  2.4345 -
  2.4346 -        // Always catch "change" event; possibly other events too if asked
  2.4347 -        var eventsToCatch = ["change"];
  2.4348 -        var requestedEventsToCatch = allBindings.get("valueUpdate");
  2.4349 -        var propertyChangedFired = false;
  2.4350 -        var elementValueBeforeEvent = null;
  2.4351 -
  2.4352 -        if (requestedEventsToCatch) {
  2.4353 -            if (typeof requestedEventsToCatch == "string") // Allow both individual event names, and arrays of event names
  2.4354 -                requestedEventsToCatch = [requestedEventsToCatch];
  2.4355 -            ko.utils.arrayPushAll(eventsToCatch, requestedEventsToCatch);
  2.4356 -            eventsToCatch = ko.utils.arrayGetDistinctValues(eventsToCatch);
  2.4357 -        }
  2.4358 -
  2.4359 -        var valueUpdateHandler = function() {
  2.4360 -            elementValueBeforeEvent = null;
  2.4361 -            propertyChangedFired = false;
  2.4362 -            var modelValue = valueAccessor();
  2.4363 -            var elementValue = ko.selectExtensions.readValue(element);
  2.4364 -            ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'value', elementValue);
  2.4365 -        }
  2.4366 -
  2.4367 -        // Workaround for https://github.com/SteveSanderson/knockout/issues/122
  2.4368 -        // IE doesn't fire "change" events on textboxes if the user selects a value from its autocomplete list
  2.4369 -        var ieAutoCompleteHackNeeded = ko.utils.ieVersion && element.tagName.toLowerCase() == "input" && element.type == "text"
  2.4370 -                                       && element.autocomplete != "off" && (!element.form || element.form.autocomplete != "off");
  2.4371 -        if (ieAutoCompleteHackNeeded && ko.utils.arrayIndexOf(eventsToCatch, "propertychange") == -1) {
  2.4372 -            ko.utils.registerEventHandler(element, "propertychange", function () { propertyChangedFired = true });
  2.4373 -            ko.utils.registerEventHandler(element, "focus", function () { propertyChangedFired = false });
  2.4374 -            ko.utils.registerEventHandler(element, "blur", function() {
  2.4375 -                if (propertyChangedFired) {
  2.4376 -                    valueUpdateHandler();
  2.4377 -                }
  2.4378 -            });
  2.4379 -        }
  2.4380 -
  2.4381 -        ko.utils.arrayForEach(eventsToCatch, function(eventName) {
  2.4382 -            // The syntax "after<eventname>" means "run the handler asynchronously after the event"
  2.4383 -            // This is useful, for example, to catch "keydown" events after the browser has updated the control
  2.4384 -            // (otherwise, ko.selectExtensions.readValue(this) will receive the control's value *before* the key event)
  2.4385 -            var handler = valueUpdateHandler;
  2.4386 -            if (ko.utils.stringStartsWith(eventName, "after")) {
  2.4387 -                handler = function() {
  2.4388 -                    // The elementValueBeforeEvent variable is non-null *only* during the brief gap between
  2.4389 -                    // a keyX event firing and the valueUpdateHandler running, which is scheduled to happen
  2.4390 -                    // at the earliest asynchronous opportunity. We store this temporary information so that
  2.4391 -                    // if, between keyX and valueUpdateHandler, the underlying model value changes separately,
  2.4392 -                    // we can overwrite that model value change with the value the user just typed. Otherwise,
  2.4393 -                    // techniques like rateLimit can trigger model changes at critical moments that will
  2.4394 -                    // override the user's inputs, causing keystrokes to be lost.
  2.4395 -                    elementValueBeforeEvent = ko.selectExtensions.readValue(element);
  2.4396 -                    setTimeout(valueUpdateHandler, 0);
  2.4397 -                };
  2.4398 -                eventName = eventName.substring("after".length);
  2.4399 -            }
  2.4400 -            ko.utils.registerEventHandler(element, eventName, handler);
  2.4401 -        });
  2.4402 -
  2.4403 -        var updateFromModel = function () {
  2.4404 -            var newValue = ko.utils.unwrapObservable(valueAccessor());
  2.4405 -            var elementValue = ko.selectExtensions.readValue(element);
  2.4406 -
  2.4407 -            if (elementValueBeforeEvent !== null && newValue === elementValueBeforeEvent) {
  2.4408 -                setTimeout(updateFromModel, 0);
  2.4409 -                return;
  2.4410 -            }
  2.4411 -
  2.4412 -            var valueHasChanged = (newValue !== elementValue);
  2.4413 -
  2.4414 -            if (valueHasChanged) {
  2.4415 -                if (ko.utils.tagNameLower(element) === "select") {
  2.4416 -                    var allowUnset = allBindings.get('valueAllowUnset');
  2.4417 -                    var applyValueAction = function () {
  2.4418 -                        ko.selectExtensions.writeValue(element, newValue, allowUnset);
  2.4419 -                    };
  2.4420 -                    applyValueAction();
  2.4421 -
  2.4422 -                    if (!allowUnset && newValue !== ko.selectExtensions.readValue(element)) {
  2.4423 -                        // If you try to set a model value that can't be represented in an already-populated dropdown, reject that change,
  2.4424 -                        // because you're not allowed to have a model value that disagrees with a visible UI selection.
  2.4425 -                        ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, "change"]);
  2.4426 -                    } else {
  2.4427 -                        // Workaround for IE6 bug: It won't reliably apply values to SELECT nodes during the same execution thread
  2.4428 -                        // right after you've changed the set of OPTION nodes on it. So for that node type, we'll schedule a second thread
  2.4429 -                        // to apply the value as well.
  2.4430 -                        setTimeout(applyValueAction, 0);
  2.4431 -                    }
  2.4432 -                } else {
  2.4433 -                    ko.selectExtensions.writeValue(element, newValue);
  2.4434 -                }
  2.4435 -            }
  2.4436 -        };
  2.4437 -
  2.4438 -        ko.computed(updateFromModel, null, { disposeWhenNodeIsRemoved: element });
  2.4439 -    },
  2.4440 -    'update': function() {} // Keep for backwards compatibility with code that may have wrapped value binding
  2.4441 -};
  2.4442 -ko.expressionRewriting.twoWayBindings['value'] = true;
  2.4443 -ko.bindingHandlers['visible'] = {
  2.4444 -    'update': function (element, valueAccessor) {
  2.4445 -        var value = ko.utils.unwrapObservable(valueAccessor());
  2.4446 -        var isCurrentlyVisible = !(element.style.display == "none");
  2.4447 -        if (value && !isCurrentlyVisible)
  2.4448 -            element.style.display = "";
  2.4449 -        else if ((!value) && isCurrentlyVisible)
  2.4450 -            element.style.display = "none";
  2.4451 -    }
  2.4452 -};
  2.4453 -// 'click' is just a shorthand for the usual full-length event:{click:handler}
  2.4454 -makeEventHandlerShortcut('click');
  2.4455 -// If you want to make a custom template engine,
  2.4456 -//
  2.4457 -// [1] Inherit from this class (like ko.nativeTemplateEngine does)
  2.4458 -// [2] Override 'renderTemplateSource', supplying a function with this signature:
  2.4459 -//
  2.4460 -//        function (templateSource, bindingContext, options) {
  2.4461 -//            // - templateSource.text() is the text of the template you should render
  2.4462 -//            // - bindingContext.$data is the data you should pass into the template
  2.4463 -//            //   - you might also want to make bindingContext.$parent, bindingContext.$parents,
  2.4464 -//            //     and bindingContext.$root available in the template too
  2.4465 -//            // - options gives you access to any other properties set on "data-bind: { template: options }"
  2.4466 -//            //
  2.4467 -//            // Return value: an array of DOM nodes
  2.4468 -//        }
  2.4469 -//
  2.4470 -// [3] Override 'createJavaScriptEvaluatorBlock', supplying a function with this signature:
  2.4471 -//
  2.4472 -//        function (script) {
  2.4473 -//            // Return value: Whatever syntax means "Evaluate the JavaScript statement 'script' and output the result"
  2.4474 -//            //               For example, the jquery.tmpl template engine converts 'someScript' to '${ someScript }'
  2.4475 -//        }
  2.4476 -//
  2.4477 -//     This is only necessary if you want to allow data-bind attributes to reference arbitrary template variables.
  2.4478 -//     If you don't want to allow that, you can set the property 'allowTemplateRewriting' to false (like ko.nativeTemplateEngine does)
  2.4479 -//     and then you don't need to override 'createJavaScriptEvaluatorBlock'.
  2.4480 -
  2.4481 -ko.templateEngine = function () { };
  2.4482 -
  2.4483 -ko.templateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options) {
  2.4484 -    throw new Error("Override renderTemplateSource");
  2.4485 -};
  2.4486 -
  2.4487 -ko.templateEngine.prototype['createJavaScriptEvaluatorBlock'] = function (script) {
  2.4488 -    throw new Error("Override createJavaScriptEvaluatorBlock");
  2.4489 -};
  2.4490 -
  2.4491 -ko.templateEngine.prototype['makeTemplateSource'] = function(template, templateDocument) {
  2.4492 -    // Named template
  2.4493 -    if (typeof template == "string") {
  2.4494 -        templateDocument = templateDocument || document;
  2.4495 -        var elem = templateDocument.getElementById(template);
  2.4496 -        if (!elem)
  2.4497 -            throw new Error("Cannot find template with ID " + template);
  2.4498 -        return new ko.templateSources.domElement(elem);
  2.4499 -    } else if ((template.nodeType == 1) || (template.nodeType == 8)) {
  2.4500 -        // Anonymous template
  2.4501 -        return new ko.templateSources.anonymousTemplate(template);
  2.4502 -    } else
  2.4503 -        throw new Error("Unknown template type: " + template);
  2.4504 -};
  2.4505 -
  2.4506 -ko.templateEngine.prototype['renderTemplate'] = function (template, bindingContext, options, templateDocument) {
  2.4507 -    var templateSource = this['makeTemplateSource'](template, templateDocument);
  2.4508 -    return this['renderTemplateSource'](templateSource, bindingContext, options);
  2.4509 -};
  2.4510 -
  2.4511 -ko.templateEngine.prototype['isTemplateRewritten'] = function (template, templateDocument) {
  2.4512 -    // Skip rewriting if requested
  2.4513 -    if (this['allowTemplateRewriting'] === false)
  2.4514 -        return true;
  2.4515 -    return this['makeTemplateSource'](template, templateDocument)['data']("isRewritten");
  2.4516 -};
  2.4517 -
  2.4518 -ko.templateEngine.prototype['rewriteTemplate'] = function (template, rewriterCallback, templateDocument) {
  2.4519 -    var templateSource = this['makeTemplateSource'](template, templateDocument);
  2.4520 -    var rewritten = rewriterCallback(templateSource['text']());
  2.4521 -    templateSource['text'](rewritten);
  2.4522 -    templateSource['data']("isRewritten", true);
  2.4523 -};
  2.4524 -
  2.4525 -ko.exportSymbol('templateEngine', ko.templateEngine);
  2.4526 -
  2.4527 -ko.templateRewriting = (function () {
  2.4528 -    var memoizeDataBindingAttributeSyntaxRegex = /(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi;
  2.4529 -    var memoizeVirtualContainerBindingSyntaxRegex = /<!--\s*ko\b\s*([\s\S]*?)\s*-->/g;
  2.4530 -
  2.4531 -    function validateDataBindValuesForRewriting(keyValueArray) {
  2.4532 -        var allValidators = ko.expressionRewriting.bindingRewriteValidators;
  2.4533 -        for (var i = 0; i < keyValueArray.length; i++) {
  2.4534 -            var key = keyValueArray[i]['key'];
  2.4535 -            if (allValidators.hasOwnProperty(key)) {
  2.4536 -                var validator = allValidators[key];
  2.4537 -
  2.4538 -                if (typeof validator === "function") {
  2.4539 -                    var possibleErrorMessage = validator(keyValueArray[i]['value']);
  2.4540 -                    if (possibleErrorMessage)
  2.4541 -                        throw new Error(possibleErrorMessage);
  2.4542 -                } else if (!validator) {
  2.4543 -                    throw new Error("This template engine does not support the '" + key + "' binding within its templates");
  2.4544 -                }
  2.4545 -            }
  2.4546 -        }
  2.4547 -    }
  2.4548 -
  2.4549 -    function constructMemoizedTagReplacement(dataBindAttributeValue, tagToRetain, nodeName, templateEngine) {
  2.4550 -        var dataBindKeyValueArray = ko.expressionRewriting.parseObjectLiteral(dataBindAttributeValue);
  2.4551 -        validateDataBindValuesForRewriting(dataBindKeyValueArray);
  2.4552 -        var rewrittenDataBindAttributeValue = ko.expressionRewriting.preProcessBindings(dataBindKeyValueArray, {'valueAccessors':true});
  2.4553 -
  2.4554 -        // For no obvious reason, Opera fails to evaluate rewrittenDataBindAttributeValue unless it's wrapped in an additional
  2.4555 -        // anonymous function, even though Opera's built-in debugger can evaluate it anyway. No other browser requires this
  2.4556 -        // extra indirection.
  2.4557 -        var applyBindingsToNextSiblingScript =
  2.4558 -            "ko.__tr_ambtns(function($context,$element){return(function(){return{ " + rewrittenDataBindAttributeValue + " } })()},'" + nodeName.toLowerCase() + "')";
  2.4559 -        return templateEngine['createJavaScriptEvaluatorBlock'](applyBindingsToNextSiblingScript) + tagToRetain;
  2.4560 -    }
  2.4561 -
  2.4562 -    return {
  2.4563 -        ensureTemplateIsRewritten: function (template, templateEngine, templateDocument) {
  2.4564 -            if (!templateEngine['isTemplateRewritten'](template, templateDocument))
  2.4565 -                templateEngine['rewriteTemplate'](template, function (htmlString) {
  2.4566 -                    return ko.templateRewriting.memoizeBindingAttributeSyntax(htmlString, templateEngine);
  2.4567 -                }, templateDocument);
  2.4568 -        },
  2.4569 -
  2.4570 -        memoizeBindingAttributeSyntax: function (htmlString, templateEngine) {
  2.4571 -            return htmlString.replace(memoizeDataBindingAttributeSyntaxRegex, function () {
  2.4572 -                return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[4], /* tagToRetain: */ arguments[1], /* nodeName: */ arguments[2], templateEngine);
  2.4573 -            }).replace(memoizeVirtualContainerBindingSyntaxRegex, function() {
  2.4574 -                return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[1], /* tagToRetain: */ "<!-- ko -->", /* nodeName: */ "#comment", templateEngine);
  2.4575 -            });
  2.4576 -        },
  2.4577 -
  2.4578 -        applyMemoizedBindingsToNextSibling: function (bindings, nodeName) {
  2.4579 -            return ko.memoization.memoize(function (domNode, bindingContext) {
  2.4580 -                var nodeToBind = domNode.nextSibling;
  2.4581 -                if (nodeToBind && nodeToBind.nodeName.toLowerCase() === nodeName) {
  2.4582 -                    ko.applyBindingAccessorsToNode(nodeToBind, bindings, bindingContext);
  2.4583 -                }
  2.4584 -            });
  2.4585 -        }
  2.4586 -    }
  2.4587 -})();
  2.4588 -
  2.4589 -
  2.4590 -// Exported only because it has to be referenced by string lookup from within rewritten template
  2.4591 -ko.exportSymbol('__tr_ambtns', ko.templateRewriting.applyMemoizedBindingsToNextSibling);
  2.4592 -(function() {
  2.4593 -    // A template source represents a read/write way of accessing a template. This is to eliminate the need for template loading/saving
  2.4594 -    // logic to be duplicated in every template engine (and means they can all work with anonymous templates, etc.)
  2.4595 -    //
  2.4596 -    // Two are provided by default:
  2.4597 -    //  1. ko.templateSources.domElement       - reads/writes the text content of an arbitrary DOM element
  2.4598 -    //  2. ko.templateSources.anonymousElement - uses ko.utils.domData to read/write text *associated* with the DOM element, but
  2.4599 -    //                                           without reading/writing the actual element text content, since it will be overwritten
  2.4600 -    //                                           with the rendered template output.
  2.4601 -    // You can implement your own template source if you want to fetch/store templates somewhere other than in DOM elements.
  2.4602 -    // Template sources need to have the following functions:
  2.4603 -    //   text() 			- returns the template text from your storage location
  2.4604 -    //   text(value)		- writes the supplied template text to your storage location
  2.4605 -    //   data(key)			- reads values stored using data(key, value) - see below
  2.4606 -    //   data(key, value)	- associates "value" with this template and the key "key". Is used to store information like "isRewritten".
  2.4607 -    //
  2.4608 -    // Optionally, template sources can also have the following functions:
  2.4609 -    //   nodes()            - returns a DOM element containing the nodes of this template, where available
  2.4610 -    //   nodes(value)       - writes the given DOM element to your storage location
  2.4611 -    // If a DOM element is available for a given template source, template engines are encouraged to use it in preference over text()
  2.4612 -    // for improved speed. However, all templateSources must supply text() even if they don't supply nodes().
  2.4613 -    //
  2.4614 -    // Once you've implemented a templateSource, make your template engine use it by subclassing whatever template engine you were
  2.4615 -    // using and overriding "makeTemplateSource" to return an instance of your custom template source.
  2.4616 -
  2.4617 -    ko.templateSources = {};
  2.4618 -
  2.4619 -    // ---- ko.templateSources.domElement -----
  2.4620 -
  2.4621 -    ko.templateSources.domElement = function(element) {
  2.4622 -        this.domElement = element;
  2.4623 -    }
  2.4624 -
  2.4625 -    ko.templateSources.domElement.prototype['text'] = function(/* valueToWrite */) {
  2.4626 -        var tagNameLower = ko.utils.tagNameLower(this.domElement),
  2.4627 -            elemContentsProperty = tagNameLower === "script" ? "text"
  2.4628 -                                 : tagNameLower === "textarea" ? "value"
  2.4629 -                                 : "innerHTML";
  2.4630 -
  2.4631 -        if (arguments.length == 0) {
  2.4632 -            return this.domElement[elemContentsProperty];
  2.4633 -        } else {
  2.4634 -            var valueToWrite = arguments[0];
  2.4635 -            if (elemContentsProperty === "innerHTML")
  2.4636 -                ko.utils.setHtml(this.domElement, valueToWrite);
  2.4637 -            else
  2.4638 -                this.domElement[elemContentsProperty] = valueToWrite;
  2.4639 -        }
  2.4640 -    };
  2.4641 -
  2.4642 -    var dataDomDataPrefix = ko.utils.domData.nextKey() + "_";
  2.4643 -    ko.templateSources.domElement.prototype['data'] = function(key /*, valueToWrite */) {
  2.4644 -        if (arguments.length === 1) {
  2.4645 -            return ko.utils.domData.get(this.domElement, dataDomDataPrefix + key);
  2.4646 -        } else {
  2.4647 -            ko.utils.domData.set(this.domElement, dataDomDataPrefix + key, arguments[1]);
  2.4648 -        }
  2.4649 -    };
  2.4650 -
  2.4651 -    // ---- ko.templateSources.anonymousTemplate -----
  2.4652 -    // Anonymous templates are normally saved/retrieved as DOM nodes through "nodes".
  2.4653 -    // For compatibility, you can also read "text"; it will be serialized from the nodes on demand.
  2.4654 -    // Writing to "text" is still supported, but then the template data will not be available as DOM nodes.
  2.4655 -
  2.4656 -    var anonymousTemplatesDomDataKey = ko.utils.domData.nextKey();
  2.4657 -    ko.templateSources.anonymousTemplate = function(element) {
  2.4658 -        this.domElement = element;
  2.4659 -    }
  2.4660 -    ko.templateSources.anonymousTemplate.prototype = new ko.templateSources.domElement();
  2.4661 -    ko.templateSources.anonymousTemplate.prototype.constructor = ko.templateSources.anonymousTemplate;
  2.4662 -    ko.templateSources.anonymousTemplate.prototype['text'] = function(/* valueToWrite */) {
  2.4663 -        if (arguments.length == 0) {
  2.4664 -            var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {};
  2.4665 -            if (templateData.textData === undefined && templateData.containerData)
  2.4666 -                templateData.textData = templateData.containerData.innerHTML;
  2.4667 -            return templateData.textData;
  2.4668 -        } else {
  2.4669 -            var valueToWrite = arguments[0];
  2.4670 -            ko.utils.domData.set(this.domElement, anonymousTemplatesDomDataKey, {textData: valueToWrite});
  2.4671 -        }
  2.4672 -    };
  2.4673 -    ko.templateSources.domElement.prototype['nodes'] = function(/* valueToWrite */) {
  2.4674 -        if (arguments.length == 0) {
  2.4675 -            var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {};
  2.4676 -            return templateData.containerData;
  2.4677 -        } else {
  2.4678 -            var valueToWrite = arguments[0];
  2.4679 -            ko.utils.domData.set(this.domElement, anonymousTemplatesDomDataKey, {containerData: valueToWrite});
  2.4680 -        }
  2.4681 -    };
  2.4682 -
  2.4683 -    ko.exportSymbol('templateSources', ko.templateSources);
  2.4684 -    ko.exportSymbol('templateSources.domElement', ko.templateSources.domElement);
  2.4685 -    ko.exportSymbol('templateSources.anonymousTemplate', ko.templateSources.anonymousTemplate);
  2.4686 -})();
  2.4687 -(function () {
  2.4688 -    var _templateEngine;
  2.4689 -    ko.setTemplateEngine = function (templateEngine) {
  2.4690 -        if ((templateEngine != undefined) && !(templateEngine instanceof ko.templateEngine))
  2.4691 -            throw new Error("templateEngine must inherit from ko.templateEngine");
  2.4692 -        _templateEngine = templateEngine;
  2.4693 -    }
  2.4694 -
  2.4695 -    function invokeForEachNodeInContinuousRange(firstNode, lastNode, action) {
  2.4696 -        var node, nextInQueue = firstNode, firstOutOfRangeNode = ko.virtualElements.nextSibling(lastNode);
  2.4697 -        while (nextInQueue && ((node = nextInQueue) !== firstOutOfRangeNode)) {
  2.4698 -            nextInQueue = ko.virtualElements.nextSibling(node);
  2.4699 -            action(node, nextInQueue);
  2.4700 -        }
  2.4701 -    }
  2.4702 -
  2.4703 -    function activateBindingsOnContinuousNodeArray(continuousNodeArray, bindingContext) {
  2.4704 -        // To be used on any nodes that have been rendered by a template and have been inserted into some parent element
  2.4705 -        // Walks through continuousNodeArray (which *must* be continuous, i.e., an uninterrupted sequence of sibling nodes, because
  2.4706 -        // the algorithm for walking them relies on this), and for each top-level item in the virtual-element sense,
  2.4707 -        // (1) Does a regular "applyBindings" to associate bindingContext with this node and to activate any non-memoized bindings
  2.4708 -        // (2) Unmemoizes any memos in the DOM subtree (e.g., to activate bindings that had been memoized during template rewriting)
  2.4709 -
  2.4710 -        if (continuousNodeArray.length) {
  2.4711 -            var firstNode = continuousNodeArray[0],
  2.4712 -                lastNode = continuousNodeArray[continuousNodeArray.length - 1],
  2.4713 -                parentNode = firstNode.parentNode,
  2.4714 -                provider = ko.bindingProvider['instance'],
  2.4715 -                preprocessNode = provider['preprocessNode'];
  2.4716 -
  2.4717 -            if (preprocessNode) {
  2.4718 -                invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node, nextNodeInRange) {
  2.4719 -                    var nodePreviousSibling = node.previousSibling;
  2.4720 -                    var newNodes = preprocessNode.call(provider, node);
  2.4721 -                    if (newNodes) {
  2.4722 -                        if (node === firstNode)
  2.4723 -                            firstNode = newNodes[0] || nextNodeInRange;
  2.4724 -                        if (node === lastNode)
  2.4725 -                            lastNode = newNodes[newNodes.length - 1] || nodePreviousSibling;
  2.4726 -                    }
  2.4727 -                });
  2.4728 -
  2.4729 -                // Because preprocessNode can change the nodes, including the first and last nodes, update continuousNodeArray to match.
  2.4730 -                // We need the full set, including inner nodes, because the unmemoize step might remove the first node (and so the real
  2.4731 -                // first node needs to be in the array).
  2.4732 -                continuousNodeArray.length = 0;
  2.4733 -                if (!firstNode) { // preprocessNode might have removed all the nodes, in which case there's nothing left to do
  2.4734 -                    return;
  2.4735 -                }
  2.4736 -                if (firstNode === lastNode) {
  2.4737 -                    continuousNodeArray.push(firstNode);
  2.4738 -                } else {
  2.4739 -                    continuousNodeArray.push(firstNode, lastNode);
  2.4740 -                    ko.utils.fixUpContinuousNodeArray(continuousNodeArray, parentNode);
  2.4741 -                }
  2.4742 -            }
  2.4743 -
  2.4744 -            // Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind)
  2.4745 -            // whereas a regular applyBindings won't introduce new memoized nodes
  2.4746 -            invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node) {
  2.4747 -                if (node.nodeType === 1 || node.nodeType === 8)
  2.4748 -                    ko.applyBindings(bindingContext, node);
  2.4749 -            });
  2.4750 -            invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node) {
  2.4751 -                if (node.nodeType === 1 || node.nodeType === 8)
  2.4752 -                    ko.memoization.unmemoizeDomNodeAndDescendants(node, [bindingContext]);
  2.4753 -            });
  2.4754 -
  2.4755 -            // Make sure any changes done by applyBindings or unmemoize are reflected in the array
  2.4756 -            ko.utils.fixUpContinuousNodeArray(continuousNodeArray, parentNode);
  2.4757 -        }
  2.4758 -    }
  2.4759 -
  2.4760 -    function getFirstNodeFromPossibleArray(nodeOrNodeArray) {
  2.4761 -        return nodeOrNodeArray.nodeType ? nodeOrNodeArray
  2.4762 -                                        : nodeOrNodeArray.length > 0 ? nodeOrNodeArray[0]
  2.4763 -                                        : null;
  2.4764 -    }
  2.4765 -
  2.4766 -    function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext, options) {
  2.4767 -        options = options || {};
  2.4768 -        var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
  2.4769 -        var templateDocument = firstTargetNode && firstTargetNode.ownerDocument;
  2.4770 -        var templateEngineToUse = (options['templateEngine'] || _templateEngine);
  2.4771 -        ko.templateRewriting.ensureTemplateIsRewritten(template, templateEngineToUse, templateDocument);
  2.4772 -        var renderedNodesArray = templateEngineToUse['renderTemplate'](template, bindingContext, options, templateDocument);
  2.4773 -
  2.4774 -        // Loosely check result is an array of DOM nodes
  2.4775 -        if ((typeof renderedNodesArray.length != "number") || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType != "number"))
  2.4776 -            throw new Error("Template engine must return an array of DOM nodes");
  2.4777 -
  2.4778 -        var haveAddedNodesToParent = false;
  2.4779 -        switch (renderMode) {
  2.4780 -            case "replaceChildren":
  2.4781 -                ko.virtualElements.setDomNodeChildren(targetNodeOrNodeArray, renderedNodesArray);
  2.4782 -                haveAddedNodesToParent = true;
  2.4783 -                break;
  2.4784 -            case "replaceNode":
  2.4785 -                ko.utils.replaceDomNodes(targetNodeOrNodeArray, renderedNodesArray);
  2.4786 -                haveAddedNodesToParent = true;
  2.4787 -                break;
  2.4788 -            case "ignoreTargetNode": break;
  2.4789 -            default:
  2.4790 -                throw new Error("Unknown renderMode: " + renderMode);
  2.4791 -        }
  2.4792 -
  2.4793 -        if (haveAddedNodesToParent) {
  2.4794 -            activateBindingsOnContinuousNodeArray(renderedNodesArray, bindingContext);
  2.4795 -            if (options['afterRender'])
  2.4796 -                ko.dependencyDetection.ignore(options['afterRender'], null, [renderedNodesArray, bindingContext['$data']]);
  2.4797 -        }
  2.4798 -
  2.4799 -        return renderedNodesArray;
  2.4800 -    }
  2.4801 -
  2.4802 -    function resolveTemplateName(template, data, context) {
  2.4803 -        // The template can be specified as:
  2.4804 -        if (ko.isObservable(template)) {
  2.4805 -            // 1. An observable, with string value
  2.4806 -            return template();
  2.4807 -        } else if (typeof template === 'function') {
  2.4808 -            // 2. A function of (data, context) returning a string
  2.4809 -            return template(data, context);
  2.4810 -        } else {
  2.4811 -            // 3. A string
  2.4812 -            return template;
  2.4813 -        }
  2.4814 -    }
  2.4815 -
  2.4816 -    ko.renderTemplate = function (template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode) {
  2.4817 -        options = options || {};
  2.4818 -        if ((options['templateEngine'] || _templateEngine) == undefined)
  2.4819 -            throw new Error("Set a template engine before calling renderTemplate");
  2.4820 -        renderMode = renderMode || "replaceChildren";
  2.4821 -
  2.4822 -        if (targetNodeOrNodeArray) {
  2.4823 -            var firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
  2.4824 -
  2.4825 -            var whenToDispose = function () { return (!firstTargetNode) || !ko.utils.domNodeIsAttachedToDocument(firstTargetNode); }; // Passive disposal (on next evaluation)
  2.4826 -            var activelyDisposeWhenNodeIsRemoved = (firstTargetNode && renderMode == "replaceNode") ? firstTargetNode.parentNode : firstTargetNode;
  2.4827 -
  2.4828 -            return ko.dependentObservable( // So the DOM is automatically updated when any dependency changes
  2.4829 -                function () {
  2.4830 -                    // Ensure we've got a proper binding context to work with
  2.4831 -                    var bindingContext = (dataOrBindingContext && (dataOrBindingContext instanceof ko.bindingContext))
  2.4832 -                        ? dataOrBindingContext
  2.4833 -                        : new ko.bindingContext(ko.utils.unwrapObservable(dataOrBindingContext));
  2.4834 -
  2.4835 -                    var templateName = resolveTemplateName(template, bindingContext['$data'], bindingContext),
  2.4836 -                        renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext, options);
  2.4837 -
  2.4838 -                    if (renderMode == "replaceNode") {
  2.4839 -                        targetNodeOrNodeArray = renderedNodesArray;
  2.4840 -                        firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
  2.4841 -                    }
  2.4842 -                },
  2.4843 -                null,
  2.4844 -                { disposeWhen: whenToDispose, disposeWhenNodeIsRemoved: activelyDisposeWhenNodeIsRemoved }
  2.4845 -            );
  2.4846 -        } else {
  2.4847 -            // 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
  2.4848 -            return ko.memoization.memoize(function (domNode) {
  2.4849 -                ko.renderTemplate(template, dataOrBindingContext, options, domNode, "replaceNode");
  2.4850 -            });
  2.4851 -        }
  2.4852 -    };
  2.4853 -
  2.4854 -    ko.renderTemplateForEach = function (template, arrayOrObservableArray, options, targetNode, parentBindingContext) {
  2.4855 -        // Since setDomNodeChildrenFromArrayMapping always calls executeTemplateForArrayItem and then
  2.4856 -        // activateBindingsCallback for added items, we can store the binding context in the former to use in the latter.
  2.4857 -        var arrayItemContext;
  2.4858 -
  2.4859 -        // This will be called by setDomNodeChildrenFromArrayMapping to get the nodes to add to targetNode
  2.4860 -        var executeTemplateForArrayItem = function (arrayValue, index) {
  2.4861 -            // Support selecting template as a function of the data being rendered
  2.4862 -            arrayItemContext = parentBindingContext['createChildContext'](arrayValue, options['as'], function(context) {
  2.4863 -                context['$index'] = index;
  2.4864 -            });
  2.4865 -
  2.4866 -            var templateName = resolveTemplateName(template, arrayValue, arrayItemContext);
  2.4867 -            return executeTemplate(null, "ignoreTargetNode", templateName, arrayItemContext, options);
  2.4868 -        }
  2.4869 -
  2.4870 -        // This will be called whenever setDomNodeChildrenFromArrayMapping has added nodes to targetNode
  2.4871 -        var activateBindingsCallback = function(arrayValue, addedNodesArray, index) {
  2.4872 -            activateBindingsOnContinuousNodeArray(addedNodesArray, arrayItemContext);
  2.4873 -            if (options['afterRender'])
  2.4874 -                options['afterRender'](addedNodesArray, arrayValue);
  2.4875 -        };
  2.4876 -
  2.4877 -        return ko.dependentObservable(function () {
  2.4878 -            var unwrappedArray = ko.utils.unwrapObservable(arrayOrObservableArray) || [];
  2.4879 -            if (typeof unwrappedArray.length == "undefined") // Coerce single value into array
  2.4880 -                unwrappedArray = [unwrappedArray];
  2.4881 -
  2.4882 -            // Filter out any entries marked as destroyed
  2.4883 -            var filteredArray = ko.utils.arrayFilter(unwrappedArray, function(item) {
  2.4884 -                return options['includeDestroyed'] || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']);
  2.4885 -            });
  2.4886 -
  2.4887 -            // Call setDomNodeChildrenFromArrayMapping, ignoring any observables unwrapped within (most likely from a callback function).
  2.4888 -            // If the array items are observables, though, they will be unwrapped in executeTemplateForArrayItem and managed within setDomNodeChildrenFromArrayMapping.
  2.4889 -            ko.dependencyDetection.ignore(ko.utils.setDomNodeChildrenFromArrayMapping, null, [targetNode, filteredArray, executeTemplateForArrayItem, options, activateBindingsCallback]);
  2.4890 -
  2.4891 -        }, null, { disposeWhenNodeIsRemoved: targetNode });
  2.4892 -    };
  2.4893 -
  2.4894 -    var templateComputedDomDataKey = ko.utils.domData.nextKey();
  2.4895 -    function disposeOldComputedAndStoreNewOne(element, newComputed) {
  2.4896 -        var oldComputed = ko.utils.domData.get(element, templateComputedDomDataKey);
  2.4897 -        if (oldComputed && (typeof(oldComputed.dispose) == 'function'))
  2.4898 -            oldComputed.dispose();
  2.4899 -        ko.utils.domData.set(element, templateComputedDomDataKey, (newComputed && newComputed.isActive()) ? newComputed : undefined);
  2.4900 -    }
  2.4901 -
  2.4902 -    ko.bindingHandlers['template'] = {
  2.4903 -        'init': function(element, valueAccessor) {
  2.4904 -            // Support anonymous templates
  2.4905 -            var bindingValue = ko.utils.unwrapObservable(valueAccessor());
  2.4906 -            if (typeof bindingValue == "string" || bindingValue['name']) {
  2.4907 -                // It's a named template - clear the element
  2.4908 -                ko.virtualElements.emptyNode(element);
  2.4909 -            } else {
  2.4910 -                // It's an anonymous template - store the element contents, then clear the element
  2.4911 -                var templateNodes = ko.virtualElements.childNodes(element),
  2.4912 -                    container = ko.utils.moveCleanedNodesToContainerElement(templateNodes); // This also removes the nodes from their current parent
  2.4913 -                new ko.templateSources.anonymousTemplate(element)['nodes'](container);
  2.4914 -            }
  2.4915 -            return { 'controlsDescendantBindings': true };
  2.4916 -        },
  2.4917 -        'update': function (element, valueAccessor, allBindings, viewModel, bindingContext) {
  2.4918 -            var value = valueAccessor(),
  2.4919 -                dataValue,
  2.4920 -                options = ko.utils.unwrapObservable(value),
  2.4921 -                shouldDisplay = true,
  2.4922 -                templateComputed = null,
  2.4923 -                templateName;
  2.4924 -
  2.4925 -            if (typeof options == "string") {
  2.4926 -                templateName = value;
  2.4927 -                options = {};
  2.4928 -            } else {
  2.4929 -                templateName = options['name'];
  2.4930 -
  2.4931 -                // Support "if"/"ifnot" conditions
  2.4932 -                if ('if' in options)
  2.4933 -                    shouldDisplay = ko.utils.unwrapObservable(options['if']);
  2.4934 -                if (shouldDisplay && 'ifnot' in options)
  2.4935 -                    shouldDisplay = !ko.utils.unwrapObservable(options['ifnot']);
  2.4936 -
  2.4937 -                dataValue = ko.utils.unwrapObservable(options['data']);
  2.4938 -            }
  2.4939 -
  2.4940 -            if ('foreach' in options) {
  2.4941 -                // Render once for each data point (treating data set as empty if shouldDisplay==false)
  2.4942 -                var dataArray = (shouldDisplay && options['foreach']) || [];
  2.4943 -                templateComputed = ko.renderTemplateForEach(templateName || element, dataArray, options, element, bindingContext);
  2.4944 -            } else if (!shouldDisplay) {
  2.4945 -                ko.virtualElements.emptyNode(element);
  2.4946 -            } else {
  2.4947 -                // Render once for this single data point (or use the viewModel if no data was provided)
  2.4948 -                var innerBindingContext = ('data' in options) ?
  2.4949 -                    bindingContext['createChildContext'](dataValue, options['as']) :  // Given an explitit 'data' value, we create a child binding context for it
  2.4950 -                    bindingContext;                                                        // Given no explicit 'data' value, we retain the same binding context
  2.4951 -                templateComputed = ko.renderTemplate(templateName || element, innerBindingContext, options, element);
  2.4952 -            }
  2.4953 -
  2.4954 -            // It only makes sense to have a single template computed per element (otherwise which one should have its output displayed?)
  2.4955 -            disposeOldComputedAndStoreNewOne(element, templateComputed);
  2.4956 -        }
  2.4957 -    };
  2.4958 -
  2.4959 -    // Anonymous templates can't be rewritten. Give a nice error message if you try to do it.
  2.4960 -    ko.expressionRewriting.bindingRewriteValidators['template'] = function(bindingValue) {
  2.4961 -        var parsedBindingValue = ko.expressionRewriting.parseObjectLiteral(bindingValue);
  2.4962 -
  2.4963 -        if ((parsedBindingValue.length == 1) && parsedBindingValue[0]['unknown'])
  2.4964 -            return null; // It looks like a string literal, not an object literal, so treat it as a named template (which is allowed for rewriting)
  2.4965 -
  2.4966 -        if (ko.expressionRewriting.keyValueArrayContainsKey(parsedBindingValue, "name"))
  2.4967 -            return null; // Named templates can be rewritten, so return "no error"
  2.4968 -        return "This template engine does not support anonymous templates nested within its templates";
  2.4969 -    };
  2.4970 -
  2.4971 -    ko.virtualElements.allowedBindings['template'] = true;
  2.4972 -})();
  2.4973 -
  2.4974 -ko.exportSymbol('setTemplateEngine', ko.setTemplateEngine);
  2.4975 -ko.exportSymbol('renderTemplate', ko.renderTemplate);
  2.4976 -// Go through the items that have been added and deleted and try to find matches between them.
  2.4977 -ko.utils.findMovesInArrayComparison = function (left, right, limitFailedCompares) {
  2.4978 -    if (left.length && right.length) {
  2.4979 -        var failedCompares, l, r, leftItem, rightItem;
  2.4980 -        for (failedCompares = l = 0; (!limitFailedCompares || failedCompares < limitFailedCompares) && (leftItem = left[l]); ++l) {
  2.4981 -            for (r = 0; rightItem = right[r]; ++r) {
  2.4982 -                if (leftItem['value'] === rightItem['value']) {
  2.4983 -                    leftItem['moved'] = rightItem['index'];
  2.4984 -                    rightItem['moved'] = leftItem['index'];
  2.4985 -                    right.splice(r, 1);         // This item is marked as moved; so remove it from right list
  2.4986 -                    failedCompares = r = 0;     // Reset failed compares count because we're checking for consecutive failures
  2.4987 -                    break;
  2.4988 -                }
  2.4989 -            }
  2.4990 -            failedCompares += r;
  2.4991 -        }
  2.4992 -    }
  2.4993 -};
  2.4994 -
  2.4995 -ko.utils.compareArrays = (function () {
  2.4996 -    var statusNotInOld = 'added', statusNotInNew = 'deleted';
  2.4997 -
  2.4998 -    // Simple calculation based on Levenshtein distance.
  2.4999 -    function compareArrays(oldArray, newArray, options) {
  2.5000 -        // For backward compatibility, if the third arg is actually a bool, interpret
  2.5001 -        // it as the old parameter 'dontLimitMoves'. Newer code should use { dontLimitMoves: true }.
  2.5002 -        options = (typeof options === 'boolean') ? { 'dontLimitMoves': options } : (options || {});
  2.5003 -        oldArray = oldArray || [];
  2.5004 -        newArray = newArray || [];
  2.5005 -
  2.5006 -        if (oldArray.length <= newArray.length)
  2.5007 -            return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options);
  2.5008 -        else
  2.5009 -            return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options);
  2.5010 -    }
  2.5011 -
  2.5012 -    function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig, options) {
  2.5013 -        var myMin = Math.min,
  2.5014 -            myMax = Math.max,
  2.5015 -            editDistanceMatrix = [],
  2.5016 -            smlIndex, smlIndexMax = smlArray.length,
  2.5017 -            bigIndex, bigIndexMax = bigArray.length,
  2.5018 -            compareRange = (bigIndexMax - smlIndexMax) || 1,
  2.5019 -            maxDistance = smlIndexMax + bigIndexMax + 1,
  2.5020 -            thisRow, lastRow,
  2.5021 -            bigIndexMaxForRow, bigIndexMinForRow;
  2.5022 -
  2.5023 -        for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) {
  2.5024 -            lastRow = thisRow;
  2.5025 -            editDistanceMatrix.push(thisRow = []);
  2.5026 -            bigIndexMaxForRow = myMin(bigIndexMax, smlIndex + compareRange);
  2.5027 -            bigIndexMinForRow = myMax(0, smlIndex - 1);
  2.5028 -            for (bigIndex = bigIndexMinForRow; bigIndex <= bigIndexMaxForRow; bigIndex++) {
  2.5029 -                if (!bigIndex)
  2.5030 -                    thisRow[bigIndex] = smlIndex + 1;
  2.5031 -                else if (!smlIndex)  // Top row - transform empty array into new array via additions
  2.5032 -                    thisRow[bigIndex] = bigIndex + 1;
  2.5033 -                else if (smlArray[smlIndex - 1] === bigArray[bigIndex - 1])
  2.5034 -                    thisRow[bigIndex] = lastRow[bigIndex - 1];                  // copy value (no edit)
  2.5035 -                else {
  2.5036 -                    var northDistance = lastRow[bigIndex] || maxDistance;       // not in big (deletion)
  2.5037 -                    var westDistance = thisRow[bigIndex - 1] || maxDistance;    // not in small (addition)
  2.5038 -                    thisRow[bigIndex] = myMin(northDistance, westDistance) + 1;
  2.5039 -                }
  2.5040 -            }
  2.5041 -        }
  2.5042 -
  2.5043 -        var editScript = [], meMinusOne, notInSml = [], notInBig = [];
  2.5044 -        for (smlIndex = smlIndexMax, bigIndex = bigIndexMax; smlIndex || bigIndex;) {
  2.5045 -            meMinusOne = editDistanceMatrix[smlIndex][bigIndex] - 1;
  2.5046 -            if (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex-1]) {
  2.5047 -                notInSml.push(editScript[editScript.length] = {     // added
  2.5048 -                    'status': statusNotInSml,
  2.5049 -                    'value': bigArray[--bigIndex],
  2.5050 -                    'index': bigIndex });
  2.5051 -            } else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) {
  2.5052 -                notInBig.push(editScript[editScript.length] = {     // deleted
  2.5053 -                    'status': statusNotInBig,
  2.5054 -                    'value': smlArray[--smlIndex],
  2.5055 -                    'index': smlIndex });
  2.5056 -            } else {
  2.5057 -                --bigIndex;
  2.5058 -                --smlIndex;
  2.5059 -                if (!options['sparse']) {
  2.5060 -                    editScript.push({
  2.5061 -                        'status': "retained",
  2.5062 -                        'value': bigArray[bigIndex] });
  2.5063 -                }
  2.5064 -            }
  2.5065 -        }
  2.5066 -
  2.5067 -        // Set a limit on the number of consecutive non-matching comparisons; having it a multiple of
  2.5068 -        // smlIndexMax keeps the time complexity of this algorithm linear.
  2.5069 -        ko.utils.findMovesInArrayComparison(notInSml, notInBig, smlIndexMax * 10);
  2.5070 -
  2.5071 -        return editScript.reverse();
  2.5072 -    }
  2.5073 -
  2.5074 -    return compareArrays;
  2.5075 -})();
  2.5076 -
  2.5077 -ko.exportSymbol('utils.compareArrays', ko.utils.compareArrays);
  2.5078 -(function () {
  2.5079 -    // Objective:
  2.5080 -    // * Given an input array, a container DOM node, and a function from array elements to arrays of DOM nodes,
  2.5081 -    //   map the array elements to arrays of DOM nodes, concatenate together all these arrays, and use them to populate the container DOM node
  2.5082 -    // * Next time we're given the same combination of things (with the array possibly having mutated), update the container DOM node
  2.5083 -    //   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
  2.5084 -    //   previously mapped - retain those nodes, and just insert/delete other ones
  2.5085 -
  2.5086 -    // "callbackAfterAddingNodes" will be invoked after any "mapping"-generated nodes are inserted into the container node
  2.5087 -    // You can use this, for example, to activate bindings on those nodes.
  2.5088 -
  2.5089 -    function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) {
  2.5090 -        // Map this array value inside a dependentObservable so we re-map when any dependency changes
  2.5091 -        var mappedNodes = [];
  2.5092 -        var dependentObservable = ko.dependentObservable(function() {
  2.5093 -            var newMappedNodes = mapping(valueToMap, index, ko.utils.fixUpContinuousNodeArray(mappedNodes, containerNode)) || [];
  2.5094 -
  2.5095 -            // On subsequent evaluations, just replace the previously-inserted DOM nodes
  2.5096 -            if (mappedNodes.length > 0) {
  2.5097 -                ko.utils.replaceDomNodes(mappedNodes, newMappedNodes);
  2.5098 -                if (callbackAfterAddingNodes)
  2.5099 -                    ko.dependencyDetection.ignore(callbackAfterAddingNodes, null, [valueToMap, newMappedNodes, index]);
  2.5100 -            }
  2.5101 -
  2.5102 -            // Replace the contents of the mappedNodes array, thereby updating the record
  2.5103 -            // of which nodes would be deleted if valueToMap was itself later removed
  2.5104 -            mappedNodes.length = 0;
  2.5105 -            ko.utils.arrayPushAll(mappedNodes, newMappedNodes);
  2.5106 -        }, null, { disposeWhenNodeIsRemoved: containerNode, disposeWhen: function() { return !ko.utils.anyDomNodeIsAttachedToDocument(mappedNodes); } });
  2.5107 -        return { mappedNodes : mappedNodes, dependentObservable : (dependentObservable.isActive() ? dependentObservable : undefined) };
  2.5108 -    }
  2.5109 -
  2.5110 -    var lastMappingResultDomDataKey = ko.utils.domData.nextKey();
  2.5111 -
  2.5112 -    ko.utils.setDomNodeChildrenFromArrayMapping = function (domNode, array, mapping, options, callbackAfterAddingNodes) {
  2.5113 -        // Compare the provided array against the previous one
  2.5114 -        array = array || [];
  2.5115 -        options = options || {};
  2.5116 -        var isFirstExecution = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) === undefined;
  2.5117 -        var lastMappingResult = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) || [];
  2.5118 -        var lastArray = ko.utils.arrayMap(lastMappingResult, function (x) { return x.arrayEntry; });
  2.5119 -        var editScript = ko.utils.compareArrays(lastArray, array, options['dontLimitMoves']);
  2.5120 -
  2.5121 -        // Build the new mapping result
  2.5122 -        var newMappingResult = [];
  2.5123 -        var lastMappingResultIndex = 0;
  2.5124 -        var newMappingResultIndex = 0;
  2.5125 -
  2.5126 -        var nodesToDelete = [];
  2.5127 -        var itemsToProcess = [];
  2.5128 -        var itemsForBeforeRemoveCallbacks = [];
  2.5129 -        var itemsForMoveCallbacks = [];
  2.5130 -        var itemsForAfterAddCallbacks = [];
  2.5131 -        var mapData;
  2.5132 -
  2.5133 -        function itemMovedOrRetained(editScriptIndex, oldPosition) {
  2.5134 -            mapData = lastMappingResult[oldPosition];
  2.5135 -            if (newMappingResultIndex !== oldPosition)
  2.5136 -                itemsForMoveCallbacks[editScriptIndex] = mapData;
  2.5137 -            // Since updating the index might change the nodes, do so before calling fixUpContinuousNodeArray
  2.5138 -            mapData.indexObservable(newMappingResultIndex++);
  2.5139 -            ko.utils.fixUpContinuousNodeArray(mapData.mappedNodes, domNode);
  2.5140 -            newMappingResult.push(mapData);
  2.5141 -            itemsToProcess.push(mapData);
  2.5142 -        }
  2.5143 -
  2.5144 -        function callCallback(callback, items) {
  2.5145 -            if (callback) {
  2.5146 -                for (var i = 0, n = items.length; i < n; i++) {
  2.5147 -                    if (items[i]) {
  2.5148 -                        ko.utils.arrayForEach(items[i].mappedNodes, function(node) {
  2.5149 -                            callback(node, i, items[i].arrayEntry);
  2.5150 -                        });
  2.5151 -                    }
  2.5152 -                }
  2.5153 -            }
  2.5154 -        }
  2.5155 -
  2.5156 -        for (var i = 0, editScriptItem, movedIndex; editScriptItem = editScript[i]; i++) {
  2.5157 -            movedIndex = editScriptItem['moved'];
  2.5158 -            switch (editScriptItem['status']) {
  2.5159 -                case "deleted":
  2.5160 -                    if (movedIndex === undefined) {
  2.5161 -                        mapData = lastMappingResult[lastMappingResultIndex];
  2.5162 -
  2.5163 -                        // Stop tracking changes to the mapping for these nodes
  2.5164 -                        if (mapData.dependentObservable)
  2.5165 -                            mapData.dependentObservable.dispose();
  2.5166 -
  2.5167 -                        // Queue these nodes for later removal
  2.5168 -                        nodesToDelete.push.apply(nodesToDelete, ko.utils.fixUpContinuousNodeArray(mapData.mappedNodes, domNode));
  2.5169 -                        if (options['beforeRemove']) {
  2.5170 -                            itemsForBeforeRemoveCallbacks[i] = mapData;
  2.5171 -                            itemsToProcess.push(mapData);
  2.5172 -                        }
  2.5173 -                    }
  2.5174 -                    lastMappingResultIndex++;
  2.5175 -                    break;
  2.5176 -
  2.5177 -                case "retained":
  2.5178 -                    itemMovedOrRetained(i, lastMappingResultIndex++);
  2.5179 -                    break;
  2.5180 -
  2.5181 -                case "added":
  2.5182 -                    if (movedIndex !== undefined) {
  2.5183 -                        itemMovedOrRetained(i, movedIndex);
  2.5184 -                    } else {
  2.5185 -                        mapData = { arrayEntry: editScriptItem['value'], indexObservable: ko.observable(newMappingResultIndex++) };
  2.5186 -                        newMappingResult.push(mapData);
  2.5187 -                        itemsToProcess.push(mapData);
  2.5188 -                        if (!isFirstExecution)
  2.5189 -                            itemsForAfterAddCallbacks[i] = mapData;
  2.5190 -                    }
  2.5191 -                    break;
  2.5192 -            }
  2.5193 -        }
  2.5194 -
  2.5195 -        // Call beforeMove first before any changes have been made to the DOM
  2.5196 -        callCallback(options['beforeMove'], itemsForMoveCallbacks);
  2.5197 -
  2.5198 -        // Next remove nodes for deleted items (or just clean if there's a beforeRemove callback)
  2.5199 -        ko.utils.arrayForEach(nodesToDelete, options['beforeRemove'] ? ko.cleanNode : ko.removeNode);
  2.5200 -
  2.5201 -        // Next add/reorder the remaining items (will include deleted items if there's a beforeRemove callback)
  2.5202 -        for (var i = 0, nextNode = ko.virtualElements.firstChild(domNode), lastNode, node; mapData = itemsToProcess[i]; i++) {
  2.5203 -            // Get nodes for newly added items
  2.5204 -            if (!mapData.mappedNodes)
  2.5205 -                ko.utils.extend(mapData, mapNodeAndRefreshWhenChanged(domNode, mapping, mapData.arrayEntry, callbackAfterAddingNodes, mapData.indexObservable));
  2.5206 -
  2.5207 -            // Put nodes in the right place if they aren't there already
  2.5208 -            for (var j = 0; node = mapData.mappedNodes[j]; nextNode = node.nextSibling, lastNode = node, j++) {
  2.5209 -                if (node !== nextNode)
  2.5210 -                    ko.virtualElements.insertAfter(domNode, node, lastNode);
  2.5211 -            }
  2.5212 -
  2.5213 -            // Run the callbacks for newly added nodes (for example, to apply bindings, etc.)
  2.5214 -            if (!mapData.initialized && callbackAfterAddingNodes) {
  2.5215 -                callbackAfterAddingNodes(mapData.arrayEntry, mapData.mappedNodes, mapData.indexObservable);
  2.5216 -                mapData.initialized = true;
  2.5217 -            }
  2.5218 -        }
  2.5219 -
  2.5220 -        // If there's a beforeRemove callback, call it after reordering.
  2.5221 -        // Note that we assume that the beforeRemove callback will usually be used to remove the nodes using
  2.5222 -        // some sort of animation, which is why we first reorder the nodes that will be removed. If the
  2.5223 -        // callback instead removes the nodes right away, it would be more efficient to skip reordering them.
  2.5224 -        // Perhaps we'll make that change in the future if this scenario becomes more common.
  2.5225 -        callCallback(options['beforeRemove'], itemsForBeforeRemoveCallbacks);
  2.5226 -
  2.5227 -        // Finally call afterMove and afterAdd callbacks
  2.5228 -        callCallback(options['afterMove'], itemsForMoveCallbacks);
  2.5229 -        callCallback(options['afterAdd'], itemsForAfterAddCallbacks);
  2.5230 -
  2.5231 -        // Store a copy of the array items we just considered so we can difference it next time
  2.5232 -        ko.utils.domData.set(domNode, lastMappingResultDomDataKey, newMappingResult);
  2.5233 -    }
  2.5234 -})();
  2.5235 -
  2.5236 -ko.exportSymbol('utils.setDomNodeChildrenFromArrayMapping', ko.utils.setDomNodeChildrenFromArrayMapping);
  2.5237 -ko.nativeTemplateEngine = function () {
  2.5238 -    this['allowTemplateRewriting'] = false;
  2.5239 -}
  2.5240 -
  2.5241 -ko.nativeTemplateEngine.prototype = new ko.templateEngine();
  2.5242 -ko.nativeTemplateEngine.prototype.constructor = ko.nativeTemplateEngine;
  2.5243 -ko.nativeTemplateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options) {
  2.5244 -    var useNodesIfAvailable = !(ko.utils.ieVersion < 9), // IE<9 cloneNode doesn't work properly
  2.5245 -        templateNodesFunc = useNodesIfAvailable ? templateSource['nodes'] : null,
  2.5246 -        templateNodes = templateNodesFunc ? templateSource['nodes']() : null;
  2.5247 -
  2.5248 -    if (templateNodes) {
  2.5249 -        return ko.utils.makeArray(templateNodes.cloneNode(true).childNodes);
  2.5250 -    } else {
  2.5251 -        var templateText = templateSource['text']();
  2.5252 -        return ko.utils.parseHtmlFragment(templateText);
  2.5253 -    }
  2.5254 -};
  2.5255 -
  2.5256 -ko.nativeTemplateEngine.instance = new ko.nativeTemplateEngine();
  2.5257 -ko.setTemplateEngine(ko.nativeTemplateEngine.instance);
  2.5258 -
  2.5259 -ko.exportSymbol('nativeTemplateEngine', ko.nativeTemplateEngine);
  2.5260 -(function() {
  2.5261 -    ko.jqueryTmplTemplateEngine = function () {
  2.5262 -        // Detect which version of jquery-tmpl you're using. Unfortunately jquery-tmpl
  2.5263 -        // doesn't expose a version number, so we have to infer it.
  2.5264 -        // Note that as of Knockout 1.3, we only support jQuery.tmpl 1.0.0pre and later,
  2.5265 -        // which KO internally refers to as version "2", so older versions are no longer detected.
  2.5266 -        var jQueryTmplVersion = this.jQueryTmplVersion = (function() {
  2.5267 -            if (!jQueryInstance || !(jQueryInstance['tmpl']))
  2.5268 -                return 0;
  2.5269 -            // Since it exposes no official version number, we use our own numbering system. To be updated as jquery-tmpl evolves.
  2.5270 -            try {
  2.5271 -                if (jQueryInstance['tmpl']['tag']['tmpl']['open'].toString().indexOf('__') >= 0) {
  2.5272 -                    // Since 1.0.0pre, custom tags should append markup to an array called "__"
  2.5273 -                    return 2; // Final version of jquery.tmpl
  2.5274 -                }
  2.5275 -            } catch(ex) { /* Apparently not the version we were looking for */ }
  2.5276 -
  2.5277 -            return 1; // Any older version that we don't support
  2.5278 -        })();
  2.5279 -
  2.5280 -        function ensureHasReferencedJQueryTemplates() {
  2.5281 -            if (jQueryTmplVersion < 2)
  2.5282 -                throw new Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");
  2.5283 -        }
  2.5284 -
  2.5285 -        function executeTemplate(compiledTemplate, data, jQueryTemplateOptions) {
  2.5286 -            return jQueryInstance['tmpl'](compiledTemplate, data, jQueryTemplateOptions);
  2.5287 -        }
  2.5288 -
  2.5289 -        this['renderTemplateSource'] = function(templateSource, bindingContext, options) {
  2.5290 -            options = options || {};
  2.5291 -            ensureHasReferencedJQueryTemplates();
  2.5292 -
  2.5293 -            // Ensure we have stored a precompiled version of this template (don't want to reparse on every render)
  2.5294 -            var precompiled = templateSource['data']('precompiled');
  2.5295 -            if (!precompiled) {
  2.5296 -                var templateText = templateSource['text']() || "";
  2.5297 -                // Wrap in "with($whatever.koBindingContext) { ... }"
  2.5298 -                templateText = "{{ko_with $item.koBindingContext}}" + templateText + "{{/ko_with}}";
  2.5299 -
  2.5300 -                precompiled = jQueryInstance['template'](null, templateText);
  2.5301 -                templateSource['data']('precompiled', precompiled);
  2.5302 -            }
  2.5303 -
  2.5304 -            var data = [bindingContext['$data']]; // Prewrap the data in an array to stop jquery.tmpl from trying to unwrap any arrays
  2.5305 -            var jQueryTemplateOptions = jQueryInstance['extend']({ 'koBindingContext': bindingContext }, options['templateOptions']);
  2.5306 -
  2.5307 -            var resultNodes = executeTemplate(precompiled, data, jQueryTemplateOptions);
  2.5308 -            resultNodes['appendTo'](document.createElement("div")); // Using "appendTo" forces jQuery/jQuery.tmpl to perform necessary cleanup work
  2.5309 -
  2.5310 -            jQueryInstance['fragments'] = {}; // Clear jQuery's fragment cache to avoid a memory leak after a large number of template renders
  2.5311 -            return resultNodes;
  2.5312 -        };
  2.5313 -
  2.5314 -        this['createJavaScriptEvaluatorBlock'] = function(script) {
  2.5315 -            return "{{ko_code ((function() { return " + script + " })()) }}";
  2.5316 -        };
  2.5317 -
  2.5318 -        this['addTemplate'] = function(templateName, templateMarkup) {
  2.5319 -            document.write("<script type='text/html' id='" + templateName + "'>" + templateMarkup + "<" + "/script>");
  2.5320 -        };
  2.5321 -
  2.5322 -        if (jQueryTmplVersion > 0) {
  2.5323 -            jQueryInstance['tmpl']['tag']['ko_code'] = {
  2.5324 -                open: "__.push($1 || '');"
  2.5325 -            };
  2.5326 -            jQueryInstance['tmpl']['tag']['ko_with'] = {
  2.5327 -                open: "with($1) {",
  2.5328 -                close: "} "
  2.5329 -            };
  2.5330 -        }
  2.5331 -    };
  2.5332 -
  2.5333 -    ko.jqueryTmplTemplateEngine.prototype = new ko.templateEngine();
  2.5334 -    ko.jqueryTmplTemplateEngine.prototype.constructor = ko.jqueryTmplTemplateEngine;
  2.5335 -
  2.5336 -    // Use this one by default *only if jquery.tmpl is referenced*
  2.5337 -    var jqueryTmplTemplateEngineInstance = new ko.jqueryTmplTemplateEngine();
  2.5338 -    if (jqueryTmplTemplateEngineInstance.jQueryTmplVersion > 0)
  2.5339 -        ko.setTemplateEngine(jqueryTmplTemplateEngineInstance);
  2.5340 -
  2.5341 -    ko.exportSymbol('jqueryTmplTemplateEngine', ko.jqueryTmplTemplateEngine);
  2.5342 -})();
  2.5343 -}));
  2.5344 -}());
  2.5345 -})();
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/ko4j/src/main/resources/org/netbeans/html/ko4j/knockout-3.4.0.js	Mon Dec 14 05:52:22 2015 +0100
     3.3 @@ -0,0 +1,123 @@
     3.4 +/*!
     3.5 + * Knockout JavaScript library v3.4.0
     3.6 + * (c) Steven Sanderson - http://knockoutjs.com/
     3.7 + * License: MIT (http://www.opensource.org/licenses/mit-license.php)
     3.8 + */
     3.9 +
    3.10 +(function() {(function(n){var x=this||(0,eval)("this"),u=x.document,M=x.navigator,v=x.jQuery,F=x.JSON;(function(n){"function"===typeof define&&define.amd?define(["exports","require"],n):"object"===typeof exports&&"object"===typeof module?n(module.exports||exports):n(x.ko={})})(function(N,O){function J(a,c){return null===a||typeof a in T?a===c:!1}function U(b,c){var d;return function(){d||(d=a.a.setTimeout(function(){d=n;b()},c))}}function V(b,c){var d;return function(){clearTimeout(d);d=a.a.setTimeout(b,c)}}function W(a,
    3.11 +c){c&&c!==I?"beforeChange"===c?this.Kb(a):this.Ha(a,c):this.Lb(a)}function X(a,c){null!==c&&c.k&&c.k()}function Y(a,c){var d=this.Hc,e=d[s];e.R||(this.lb&&this.Ma[c]?(d.Pb(c,a,this.Ma[c]),this.Ma[c]=null,--this.lb):e.r[c]||d.Pb(c,a,e.s?{ia:a}:d.uc(a)))}function K(b,c,d,e){a.d[b]={init:function(b,g,k,l,m){var h,r;a.m(function(){var q=a.a.c(g()),p=!d!==!q,A=!r;if(A||c||p!==h)A&&a.va.Aa()&&(r=a.a.ua(a.f.childNodes(b),!0)),p?(A||a.f.da(b,a.a.ua(r)),a.eb(e?e(m,q):m,b)):a.f.xa(b),h=p},null,{i:b});return{controlsDescendantBindings:!0}}};
    3.12 +a.h.ta[b]=!1;a.f.Z[b]=!0}var a="undefined"!==typeof N?N:{};a.b=function(b,c){for(var d=b.split("."),e=a,f=0;f<d.length-1;f++)e=e[d[f]];e[d[d.length-1]]=c};a.G=function(a,c,d){a[c]=d};a.version="3.4.0";a.b("version",a.version);a.options={deferUpdates:!1,useOnlyNativeEvents:!1};a.a=function(){function b(a,b){for(var c in a)a.hasOwnProperty(c)&&b(c,a[c])}function c(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function d(a,b){a.__proto__=b;return a}function e(b,c,d,e){var h=b[c].match(r)||
    3.13 +[];a.a.q(d.match(r),function(b){a.a.pa(h,b,e)});b[c]=h.join(" ")}var f={__proto__:[]}instanceof Array,g="function"===typeof Symbol,k={},l={};k[M&&/Firefox\/2/i.test(M.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];k.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");b(k,function(a,b){if(b.length)for(var c=0,d=b.length;c<d;c++)l[b[c]]=a});var m={propertychange:!0},h=u&&function(){for(var a=3,b=u.createElement("div"),c=
    3.14 +b.getElementsByTagName("i");b.innerHTML="\x3c!--[if gt IE "+ ++a+"]><i></i><![endif]--\x3e",c[0];);return 4<a?a:n}(),r=/\S+/g;return{cc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],q:function(a,b){for(var c=0,d=a.length;c<d;c++)b(a[c],c)},o:function(a,b){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,b);for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},Sb:function(a,b,c){for(var d=0,e=a.length;d<e;d++)if(b.call(c,a[d],d))return a[d];
    3.15 +return null},La:function(b,c){var d=a.a.o(b,c);0<d?b.splice(d,1):0===d&&b.shift()},Tb:function(b){b=b||[];for(var c=[],d=0,e=b.length;d<e;d++)0>a.a.o(c,b[d])&&c.push(b[d]);return c},fb:function(a,b){a=a||[];for(var c=[],d=0,e=a.length;d<e;d++)c.push(b(a[d],d));return c},Ka:function(a,b){a=a||[];for(var c=[],d=0,e=a.length;d<e;d++)b(a[d],d)&&c.push(a[d]);return c},ra:function(a,b){if(b instanceof Array)a.push.apply(a,b);else for(var c=0,d=b.length;c<d;c++)a.push(b[c]);return a},pa:function(b,c,d){var e=
    3.16 +a.a.o(a.a.zb(b),c);0>e?d&&b.push(c):d||b.splice(e,1)},ka:f,extend:c,Xa:d,Ya:f?d:c,D:b,Ca:function(a,b){if(!a)return a;var c={},d;for(d in a)a.hasOwnProperty(d)&&(c[d]=b(a[d],d,a));return c},ob:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},jc:function(b){b=a.a.V(b);for(var c=(b[0]&&b[0].ownerDocument||u).createElement("div"),d=0,e=b.length;d<e;d++)c.appendChild(a.$(b[d]));return c},ua:function(b,c){for(var d=0,e=b.length,h=[];d<e;d++){var m=b[d].cloneNode(!0);h.push(c?a.$(m):m)}return h},
    3.17 +da:function(b,c){a.a.ob(b);if(c)for(var d=0,e=c.length;d<e;d++)b.appendChild(c[d])},qc:function(b,c){var d=b.nodeType?[b]:b;if(0<d.length){for(var e=d[0],h=e.parentNode,m=0,l=c.length;m<l;m++)h.insertBefore(c[m],e);m=0;for(l=d.length;m<l;m++)a.removeNode(d[m])}},za:function(a,b){if(a.length){for(b=8===b.nodeType&&b.parentNode||b;a.length&&a[0].parentNode!==b;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==b;)a.length--;if(1<a.length){var c=a[0],d=a[a.length-1];for(a.length=0;c!==d;)a.push(c),
    3.18 +c=c.nextSibling;a.push(d)}}return a},sc:function(a,b){7>h?a.setAttribute("selected",b):a.selected=b},$a:function(a){return null===a||a===n?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},nd:function(a,b){a=a||"";return b.length>a.length?!1:a.substring(0,b.length)===b},Mc:function(a,b){if(a===b)return!0;if(11===a.nodeType)return!1;if(b.contains)return b.contains(3===a.nodeType?a.parentNode:a);if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&16);for(;a&&a!=
    3.19 +b;)a=a.parentNode;return!!a},nb:function(b){return a.a.Mc(b,b.ownerDocument.documentElement)},Qb:function(b){return!!a.a.Sb(b,a.a.nb)},A:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},Wb:function(b){return a.onError?function(){try{return b.apply(this,arguments)}catch(c){throw a.onError&&a.onError(c),c;}}:b},setTimeout:function(b,c){return setTimeout(a.a.Wb(b),c)},$b:function(b){setTimeout(function(){a.onError&&a.onError(b);throw b;},0)},p:function(b,c,d){var e=a.a.Wb(d);d=h&&m[c];if(a.options.useOnlyNativeEvents||
    3.20 +d||!v)if(d||"function"!=typeof b.addEventListener)if("undefined"!=typeof b.attachEvent){var l=function(a){e.call(b,a)},f="on"+c;b.attachEvent(f,l);a.a.F.oa(b,function(){b.detachEvent(f,l)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else b.addEventListener(c,e,!1);else v(b).bind(c,e)},Da:function(b,c){if(!b||!b.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var d;"input"===a.a.A(b)&&b.type&&"click"==c.toLowerCase()?(d=b.type,d="checkbox"==
    3.21 +d||"radio"==d):d=!1;if(a.options.useOnlyNativeEvents||!v||d)if("function"==typeof u.createEvent)if("function"==typeof b.dispatchEvent)d=u.createEvent(l[c]||"HTMLEvents"),d.initEvent(c,!0,!0,x,0,0,0,0,0,!1,!1,!1,!1,0,b),b.dispatchEvent(d);else throw Error("The supplied element doesn't support dispatchEvent");else if(d&&b.click)b.click();else if("undefined"!=typeof b.fireEvent)b.fireEvent("on"+c);else throw Error("Browser doesn't support triggering events");else v(b).trigger(c)},c:function(b){return a.H(b)?
    3.22 +b():b},zb:function(b){return a.H(b)?b.t():b},bb:function(b,c,d){var h;c&&("object"===typeof b.classList?(h=b.classList[d?"add":"remove"],a.a.q(c.match(r),function(a){h.call(b.classList,a)})):"string"===typeof b.className.baseVal?e(b.className,"baseVal",c,d):e(b,"className",c,d))},Za:function(b,c){var d=a.a.c(c);if(null===d||d===n)d="";var e=a.f.firstChild(b);!e||3!=e.nodeType||a.f.nextSibling(e)?a.f.da(b,[b.ownerDocument.createTextNode(d)]):e.data=d;a.a.Rc(b)},rc:function(a,b){a.name=b;if(7>=h)try{a.mergeAttributes(u.createElement("<input name='"+
    3.23 +a.name+"'/>"),!1)}catch(c){}},Rc:function(a){9<=h&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom))},Nc:function(a){if(h){var b=a.style.width;a.style.width=0;a.style.width=b}},hd:function(b,c){b=a.a.c(b);c=a.a.c(c);for(var d=[],e=b;e<=c;e++)d.push(e);return d},V:function(a){for(var b=[],c=0,d=a.length;c<d;c++)b.push(a[c]);return b},Yb:function(a){return g?Symbol(a):a},rd:6===h,sd:7===h,C:h,ec:function(b,c){for(var d=a.a.V(b.getElementsByTagName("input")).concat(a.a.V(b.getElementsByTagName("textarea"))),
    3.24 +e="string"==typeof c?function(a){return a.name===c}:function(a){return c.test(a.name)},h=[],m=d.length-1;0<=m;m--)e(d[m])&&h.push(d[m]);return h},ed:function(b){return"string"==typeof b&&(b=a.a.$a(b))?F&&F.parse?F.parse(b):(new Function("return "+b))():null},Eb:function(b,c,d){if(!F||!F.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");
    3.25 +return F.stringify(a.a.c(b),c,d)},fd:function(c,d,e){e=e||{};var h=e.params||{},m=e.includeFields||this.cc,l=c;if("object"==typeof c&&"form"===a.a.A(c))for(var l=c.action,f=m.length-1;0<=f;f--)for(var g=a.a.ec(c,m[f]),k=g.length-1;0<=k;k--)h[g[k].name]=g[k].value;d=a.a.c(d);var r=u.createElement("form");r.style.display="none";r.action=l;r.method="post";for(var n in d)c=u.createElement("input"),c.type="hidden",c.name=n,c.value=a.a.Eb(a.a.c(d[n])),r.appendChild(c);b(h,function(a,b){var c=u.createElement("input");
    3.26 +c.type="hidden";c.name=a;c.value=b;r.appendChild(c)});u.body.appendChild(r);e.submitter?e.submitter(r):r.submit();setTimeout(function(){r.parentNode.removeChild(r)},0)}}}();a.b("utils",a.a);a.b("utils.arrayForEach",a.a.q);a.b("utils.arrayFirst",a.a.Sb);a.b("utils.arrayFilter",a.a.Ka);a.b("utils.arrayGetDistinctValues",a.a.Tb);a.b("utils.arrayIndexOf",a.a.o);a.b("utils.arrayMap",a.a.fb);a.b("utils.arrayPushAll",a.a.ra);a.b("utils.arrayRemoveItem",a.a.La);a.b("utils.extend",a.a.extend);a.b("utils.fieldsIncludedWithJsonPost",
    3.27 +a.a.cc);a.b("utils.getFormFields",a.a.ec);a.b("utils.peekObservable",a.a.zb);a.b("utils.postJson",a.a.fd);a.b("utils.parseJson",a.a.ed);a.b("utils.registerEventHandler",a.a.p);a.b("utils.stringifyJson",a.a.Eb);a.b("utils.range",a.a.hd);a.b("utils.toggleDomNodeCssClass",a.a.bb);a.b("utils.triggerEvent",a.a.Da);a.b("utils.unwrapObservable",a.a.c);a.b("utils.objectForEach",a.a.D);a.b("utils.addOrRemoveItem",a.a.pa);a.b("utils.setTextContent",a.a.Za);a.b("unwrap",a.a.c);Function.prototype.bind||(Function.prototype.bind=
    3.28 +function(a){var c=this;if(1===arguments.length)return function(){return c.apply(a,arguments)};var d=Array.prototype.slice.call(arguments,1);return function(){var e=d.slice(0);e.push.apply(e,arguments);return c.apply(a,e)}});a.a.e=new function(){function a(b,g){var k=b[d];if(!k||"null"===k||!e[k]){if(!g)return n;k=b[d]="ko"+c++;e[k]={}}return e[k]}var c=0,d="__ko__"+(new Date).getTime(),e={};return{get:function(c,d){var e=a(c,!1);return e===n?n:e[d]},set:function(c,d,e){if(e!==n||a(c,!1)!==n)a(c,!0)[d]=
    3.29 +e},clear:function(a){var b=a[d];return b?(delete e[b],a[d]=null,!0):!1},I:function(){return c++ +d}}};a.b("utils.domData",a.a.e);a.b("utils.domData.clear",a.a.e.clear);a.a.F=new function(){function b(b,c){var e=a.a.e.get(b,d);e===n&&c&&(e=[],a.a.e.set(b,d,e));return e}function c(d){var e=b(d,!1);if(e)for(var e=e.slice(0),l=0;l<e.length;l++)e[l](d);a.a.e.clear(d);a.a.F.cleanExternalData(d);if(f[d.nodeType])for(e=d.firstChild;d=e;)e=d.nextSibling,8===d.nodeType&&c(d)}var d=a.a.e.I(),e={1:!0,8:!0,9:!0},
    3.30 +f={1:!0,9:!0};return{oa:function(a,c){if("function"!=typeof c)throw Error("Callback must be a function");b(a,!0).push(c)},pc:function(c,e){var l=b(c,!1);l&&(a.a.La(l,e),0==l.length&&a.a.e.set(c,d,n))},$:function(b){if(e[b.nodeType]&&(c(b),f[b.nodeType])){var d=[];a.a.ra(d,b.getElementsByTagName("*"));for(var l=0,m=d.length;l<m;l++)c(d[l])}return b},removeNode:function(b){a.$(b);b.parentNode&&b.parentNode.removeChild(b)},cleanExternalData:function(a){v&&"function"==typeof v.cleanData&&v.cleanData([a])}}};
    3.31 +a.$=a.a.F.$;a.removeNode=a.a.F.removeNode;a.b("cleanNode",a.$);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.F);a.b("utils.domNodeDisposal.addDisposeCallback",a.a.F.oa);a.b("utils.domNodeDisposal.removeDisposeCallback",a.a.F.pc);(function(){var b=[0,"",""],c=[1,"<table>","</table>"],d=[3,"<table><tbody><tr>","</tr></tbody></table>"],e=[1,"<select multiple='multiple'>","</select>"],f={thead:c,tbody:c,tfoot:c,tr:[2,"<table><tbody>","</tbody></table>"],td:d,th:d,option:e,optgroup:e},
    3.32 +g=8>=a.a.C;a.a.ma=function(c,d){var e;if(v)if(v.parseHTML)e=v.parseHTML(c,d)||[];else{if((e=v.clean([c],d))&&e[0]){for(var h=e[0];h.parentNode&&11!==h.parentNode.nodeType;)h=h.parentNode;h.parentNode&&h.parentNode.removeChild(h)}}else{(e=d)||(e=u);var h=e.parentWindow||e.defaultView||x,r=a.a.$a(c).toLowerCase(),q=e.createElement("div"),p;p=(r=r.match(/^<([a-z]+)[ >]/))&&f[r[1]]||b;r=p[0];p="ignored<div>"+p[1]+c+p[2]+"</div>";"function"==typeof h.innerShiv?q.appendChild(h.innerShiv(p)):(g&&e.appendChild(q),
    3.33 +q.innerHTML=p,g&&q.parentNode.removeChild(q));for(;r--;)q=q.lastChild;e=a.a.V(q.lastChild.childNodes)}return e};a.a.Cb=function(b,c){a.a.ob(b);c=a.a.c(c);if(null!==c&&c!==n)if("string"!=typeof c&&(c=c.toString()),v)v(b).html(c);else for(var d=a.a.ma(c,b.ownerDocument),e=0;e<d.length;e++)b.appendChild(d[e])}})();a.b("utils.parseHtmlFragment",a.a.ma);a.b("utils.setHtml",a.a.Cb);a.M=function(){function b(c,e){if(c)if(8==c.nodeType){var f=a.M.lc(c.nodeValue);null!=f&&e.push({Lc:c,cd:f})}else if(1==c.nodeType)for(var f=
    3.34 +0,g=c.childNodes,k=g.length;f<k;f++)b(g[f],e)}var c={};return{wb:function(a){if("function"!=typeof a)throw Error("You can only pass a function to ko.memoization.memoize()");var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);c[b]=a;return"\x3c!--[ko_memo:"+b+"]--\x3e"},xc:function(a,b){var f=c[a];if(f===n)throw Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized.");try{return f.apply(null,b||[]),
    3.35 +!0}finally{delete c[a]}},yc:function(c,e){var f=[];b(c,f);for(var g=0,k=f.length;g<k;g++){var l=f[g].Lc,m=[l];e&&a.a.ra(m,e);a.M.xc(f[g].cd,m);l.nodeValue="";l.parentNode&&l.parentNode.removeChild(l)}},lc:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:null}}}();a.b("memoization",a.M);a.b("memoization.memoize",a.M.wb);a.b("memoization.unmemoize",a.M.xc);a.b("memoization.parseMemoText",a.M.lc);a.b("memoization.unmemoizeDomNodeAndDescendants",a.M.yc);a.Y=function(){function b(){if(e)for(var b=
    3.36 +e,c=0,m;g<e;)if(m=d[g++]){if(g>b){if(5E3<=++c){g=e;a.a.$b(Error("'Too much recursion' after processing "+c+" task groups."));break}b=e}try{m()}catch(h){a.a.$b(h)}}}function c(){b();g=e=d.length=0}var d=[],e=0,f=1,g=0;return{scheduler:x.MutationObserver?function(a){var b=u.createElement("div");(new MutationObserver(a)).observe(b,{attributes:!0});return function(){b.classList.toggle("foo")}}(c):u&&"onreadystatechange"in u.createElement("script")?function(a){var b=u.createElement("script");b.onreadystatechange=
    3.37 +function(){b.onreadystatechange=null;u.documentElement.removeChild(b);b=null;a()};u.documentElement.appendChild(b)}:function(a){setTimeout(a,0)},Wa:function(b){e||a.Y.scheduler(c);d[e++]=b;return f++},cancel:function(a){a-=f-e;a>=g&&a<e&&(d[a]=null)},resetForTesting:function(){var a=e-g;g=e=d.length=0;return a},md:b}}();a.b("tasks",a.Y);a.b("tasks.schedule",a.Y.Wa);a.b("tasks.runEarly",a.Y.md);a.ya={throttle:function(b,c){b.throttleEvaluation=c;var d=null;return a.B({read:b,write:function(e){clearTimeout(d);
    3.38 +d=a.a.setTimeout(function(){b(e)},c)}})},rateLimit:function(a,c){var d,e,f;"number"==typeof c?d=c:(d=c.timeout,e=c.method);a.cb=!1;f="notifyWhenChangesStop"==e?V:U;a.Ta(function(a){return f(a,d)})},deferred:function(b,c){if(!0!==c)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");b.cb||(b.cb=!0,b.Ta(function(c){var e;return function(){a.Y.cancel(e);e=a.Y.Wa(c);b.notifySubscribers(n,"dirty")}}))},notify:function(a,c){a.equalityComparer=
    3.39 +"always"==c?null:J}};var T={undefined:1,"boolean":1,number:1,string:1};a.b("extenders",a.ya);a.vc=function(b,c,d){this.ia=b;this.gb=c;this.Kc=d;this.R=!1;a.G(this,"dispose",this.k)};a.vc.prototype.k=function(){this.R=!0;this.Kc()};a.J=function(){a.a.Ya(this,D);D.rb(this)};var I="change",D={rb:function(a){a.K={};a.Nb=1},X:function(b,c,d){var e=this;d=d||I;var f=new a.vc(e,c?b.bind(c):b,function(){a.a.La(e.K[d],f);e.Ia&&e.Ia(d)});e.sa&&e.sa(d);e.K[d]||(e.K[d]=[]);e.K[d].push(f);return f},notifySubscribers:function(b,
    3.40 +c){c=c||I;c===I&&this.zc();if(this.Pa(c))try{a.l.Ub();for(var d=this.K[c].slice(0),e=0,f;f=d[e];++e)f.R||f.gb(b)}finally{a.l.end()}},Na:function(){return this.Nb},Uc:function(a){return this.Na()!==a},zc:function(){++this.Nb},Ta:function(b){var c=this,d=a.H(c),e,f,g;c.Ha||(c.Ha=c.notifySubscribers,c.notifySubscribers=W);var k=b(function(){c.Mb=!1;d&&g===c&&(g=c());e=!1;c.tb(f,g)&&c.Ha(f=g)});c.Lb=function(a){c.Mb=e=!0;g=a;k()};c.Kb=function(a){e||(f=a,c.Ha(a,"beforeChange"))}},Pa:function(a){return this.K[a]&&
    3.41 +this.K[a].length},Sc:function(b){if(b)return this.K[b]&&this.K[b].length||0;var c=0;a.a.D(this.K,function(a,b){"dirty"!==a&&(c+=b.length)});return c},tb:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},extend:function(b){var c=this;b&&a.a.D(b,function(b,e){var f=a.ya[b];"function"==typeof f&&(c=f(c,e)||c)});return c}};a.G(D,"subscribe",D.X);a.G(D,"extend",D.extend);a.G(D,"getSubscriptionsCount",D.Sc);a.a.ka&&a.a.Xa(D,Function.prototype);a.J.fn=D;a.hc=function(a){return null!=
    3.42 +a&&"function"==typeof a.X&&"function"==typeof a.notifySubscribers};a.b("subscribable",a.J);a.b("isSubscribable",a.hc);a.va=a.l=function(){function b(a){d.push(e);e=a}function c(){e=d.pop()}var d=[],e,f=0;return{Ub:b,end:c,oc:function(b){if(e){if(!a.hc(b))throw Error("Only subscribable things can act as dependencies");e.gb.call(e.Gc,b,b.Cc||(b.Cc=++f))}},w:function(a,d,e){try{return b(),a.apply(d,e||[])}finally{c()}},Aa:function(){if(e)return e.m.Aa()},Sa:function(){if(e)return e.Sa}}}();a.b("computedContext",
    3.43 +a.va);a.b("computedContext.getDependenciesCount",a.va.Aa);a.b("computedContext.isInitial",a.va.Sa);a.b("ignoreDependencies",a.qd=a.l.w);var E=a.a.Yb("_latestValue");a.N=function(b){function c(){if(0<arguments.length)return c.tb(c[E],arguments[0])&&(c.ga(),c[E]=arguments[0],c.fa()),this;a.l.oc(c);return c[E]}c[E]=b;a.a.ka||a.a.extend(c,a.J.fn);a.J.fn.rb(c);a.a.Ya(c,B);a.options.deferUpdates&&a.ya.deferred(c,!0);return c};var B={equalityComparer:J,t:function(){return this[E]},fa:function(){this.notifySubscribers(this[E])},
    3.44 +ga:function(){this.notifySubscribers(this[E],"beforeChange")}};a.a.ka&&a.a.Xa(B,a.J.fn);var H=a.N.gd="__ko_proto__";B[H]=a.N;a.Oa=function(b,c){return null===b||b===n||b[H]===n?!1:b[H]===c?!0:a.Oa(b[H],c)};a.H=function(b){return a.Oa(b,a.N)};a.Ba=function(b){return"function"==typeof b&&b[H]===a.N||"function"==typeof b&&b[H]===a.B&&b.Vc?!0:!1};a.b("observable",a.N);a.b("isObservable",a.H);a.b("isWriteableObservable",a.Ba);a.b("isWritableObservable",a.Ba);a.b("observable.fn",B);a.G(B,"peek",B.t);a.G(B,
    3.45 +"valueHasMutated",B.fa);a.G(B,"valueWillMutate",B.ga);a.la=function(b){b=b||[];if("object"!=typeof b||!("length"in b))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");b=a.N(b);a.a.Ya(b,a.la.fn);return b.extend({trackArrayChanges:!0})};a.la.fn={remove:function(b){for(var c=this.t(),d=[],e="function"!=typeof b||a.H(b)?function(a){return a===b}:b,f=0;f<c.length;f++){var g=c[f];e(g)&&(0===d.length&&this.ga(),d.push(g),c.splice(f,1),f--)}d.length&&
    3.46 +this.fa();return d},removeAll:function(b){if(b===n){var c=this.t(),d=c.slice(0);this.ga();c.splice(0,c.length);this.fa();return d}return b?this.remove(function(c){return 0<=a.a.o(b,c)}):[]},destroy:function(b){var c=this.t(),d="function"!=typeof b||a.H(b)?function(a){return a===b}:b;this.ga();for(var e=c.length-1;0<=e;e--)d(c[e])&&(c[e]._destroy=!0);this.fa()},destroyAll:function(b){return b===n?this.destroy(function(){return!0}):b?this.destroy(function(c){return 0<=a.a.o(b,c)}):[]},indexOf:function(b){var c=
    3.47 +this();return a.a.o(c,b)},replace:function(a,c){var d=this.indexOf(a);0<=d&&(this.ga(),this.t()[d]=c,this.fa())}};a.a.ka&&a.a.Xa(a.la.fn,a.N.fn);a.a.q("pop push reverse shift sort splice unshift".split(" "),function(b){a.la.fn[b]=function(){var a=this.t();this.ga();this.Vb(a,b,arguments);var d=a[b].apply(a,arguments);this.fa();return d===a?this:d}});a.a.q(["slice"],function(b){a.la.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.b("observableArray",a.la);a.ya.trackArrayChanges=function(b,
    3.48 +c){function d(){if(!e){e=!0;var c=b.notifySubscribers;b.notifySubscribers=function(a,b){b&&b!==I||++k;return c.apply(this,arguments)};var d=[].concat(b.t()||[]);f=null;g=b.X(function(c){c=[].concat(c||[]);if(b.Pa("arrayChange")){var e;if(!f||1<k)f=a.a.ib(d,c,b.hb);e=f}d=c;f=null;k=0;e&&e.length&&b.notifySubscribers(e,"arrayChange")})}}b.hb={};c&&"object"==typeof c&&a.a.extend(b.hb,c);b.hb.sparse=!0;if(!b.Vb){var e=!1,f=null,g,k=0,l=b.sa,m=b.Ia;b.sa=function(a){l&&l.call(b,a);"arrayChange"===a&&d()};
    3.49 +b.Ia=function(a){m&&m.call(b,a);"arrayChange"!==a||b.Pa("arrayChange")||(g.k(),e=!1)};b.Vb=function(b,c,d){function m(a,b,c){return l[l.length]={status:a,value:b,index:c}}if(e&&!k){var l=[],g=b.length,t=d.length,G=0;switch(c){case "push":G=g;case "unshift":for(c=0;c<t;c++)m("added",d[c],G+c);break;case "pop":G=g-1;case "shift":g&&m("deleted",b[G],G);break;case "splice":c=Math.min(Math.max(0,0>d[0]?g+d[0]:d[0]),g);for(var g=1===t?g:Math.min(c+(d[1]||0),g),t=c+t-2,G=Math.max(g,t),P=[],n=[],Q=2;c<G;++c,
    3.50 +++Q)c<g&&n.push(m("deleted",b[c],c)),c<t&&P.push(m("added",d[Q],c));a.a.dc(n,P);break;default:return}f=l}}}};var s=a.a.Yb("_state");a.m=a.B=function(b,c,d){function e(){if(0<arguments.length){if("function"===typeof f)f.apply(g.pb,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return this}a.l.oc(e);(g.S||g.s&&e.Qa())&&e.aa();return g.T}"object"===typeof b?d=b:(d=d||{},b&&(d.read=
    3.51 +b));if("function"!=typeof d.read)throw Error("Pass a function that returns the value of the ko.computed");var f=d.write,g={T:n,S:!0,Ra:!1,Fb:!1,R:!1,Va:!1,s:!1,jd:d.read,pb:c||d.owner,i:d.disposeWhenNodeIsRemoved||d.i||null,wa:d.disposeWhen||d.wa,mb:null,r:{},L:0,bc:null};e[s]=g;e.Vc="function"===typeof f;a.a.ka||a.a.extend(e,a.J.fn);a.J.fn.rb(e);a.a.Ya(e,z);d.pure?(g.Va=!0,g.s=!0,a.a.extend(e,$)):d.deferEvaluation&&a.a.extend(e,aa);a.options.deferUpdates&&a.ya.deferred(e,!0);g.i&&(g.Fb=!0,g.i.nodeType||
    3.52 +(g.i=null));g.s||d.deferEvaluation||e.aa();g.i&&e.ba()&&a.a.F.oa(g.i,g.mb=function(){e.k()});return e};var z={equalityComparer:J,Aa:function(){return this[s].L},Pb:function(a,c,d){if(this[s].Va&&c===this)throw Error("A 'pure' computed must not be called recursively");this[s].r[a]=d;d.Ga=this[s].L++;d.na=c.Na()},Qa:function(){var a,c,d=this[s].r;for(a in d)if(d.hasOwnProperty(a)&&(c=d[a],c.ia.Uc(c.na)))return!0},bd:function(){this.Fa&&!this[s].Ra&&this.Fa()},ba:function(){return this[s].S||0<this[s].L},
    3.53 +ld:function(){this.Mb||this.ac()},uc:function(a){if(a.cb&&!this[s].i){var c=a.X(this.bd,this,"dirty"),d=a.X(this.ld,this);return{ia:a,k:function(){c.k();d.k()}}}return a.X(this.ac,this)},ac:function(){var b=this,c=b.throttleEvaluation;c&&0<=c?(clearTimeout(this[s].bc),this[s].bc=a.a.setTimeout(function(){b.aa(!0)},c)):b.Fa?b.Fa():b.aa(!0)},aa:function(b){var c=this[s],d=c.wa;if(!c.Ra&&!c.R){if(c.i&&!a.a.nb(c.i)||d&&d()){if(!c.Fb){this.k();return}}else c.Fb=!1;c.Ra=!0;try{this.Qc(b)}finally{c.Ra=!1}c.L||
    3.54 +this.k()}},Qc:function(b){var c=this[s],d=c.Va?n:!c.L,e={Hc:this,Ma:c.r,lb:c.L};a.l.Ub({Gc:e,gb:Y,m:this,Sa:d});c.r={};c.L=0;e=this.Pc(c,e);this.tb(c.T,e)&&(c.s||this.notifySubscribers(c.T,"beforeChange"),c.T=e,c.s?this.zc():b&&this.notifySubscribers(c.T));d&&this.notifySubscribers(c.T,"awake")},Pc:function(b,c){try{var d=b.jd;return b.pb?d.call(b.pb):d()}finally{a.l.end(),c.lb&&!b.s&&a.a.D(c.Ma,X),b.S=!1}},t:function(){var a=this[s];(a.S&&!a.L||a.s&&this.Qa())&&this.aa();return a.T},Ta:function(b){a.J.fn.Ta.call(this,
    3.55 +b);this.Fa=function(){this.Kb(this[s].T);this[s].S=!0;this.Lb(this)}},k:function(){var b=this[s];!b.s&&b.r&&a.a.D(b.r,function(a,b){b.k&&b.k()});b.i&&b.mb&&a.a.F.pc(b.i,b.mb);b.r=null;b.L=0;b.R=!0;b.S=!1;b.s=!1;b.i=null}},$={sa:function(b){var c=this,d=c[s];if(!d.R&&d.s&&"change"==b){d.s=!1;if(d.S||c.Qa())d.r=null,d.L=0,d.S=!0,c.aa();else{var e=[];a.a.D(d.r,function(a,b){e[b.Ga]=a});a.a.q(e,function(a,b){var e=d.r[a],l=c.uc(e.ia);l.Ga=b;l.na=e.na;d.r[a]=l})}d.R||c.notifySubscribers(d.T,"awake")}},
    3.56 +Ia:function(b){var c=this[s];c.R||"change"!=b||this.Pa("change")||(a.a.D(c.r,function(a,b){b.k&&(c.r[a]={ia:b.ia,Ga:b.Ga,na:b.na},b.k())}),c.s=!0,this.notifySubscribers(n,"asleep"))},Na:function(){var b=this[s];b.s&&(b.S||this.Qa())&&this.aa();return a.J.fn.Na.call(this)}},aa={sa:function(a){"change"!=a&&"beforeChange"!=a||this.t()}};a.a.ka&&a.a.Xa(z,a.J.fn);var R=a.N.gd;a.m[R]=a.N;z[R]=a.m;a.Xc=function(b){return a.Oa(b,a.m)};a.Yc=function(b){return a.Oa(b,a.m)&&b[s]&&b[s].Va};a.b("computed",a.m);
    3.57 +a.b("dependentObservable",a.m);a.b("isComputed",a.Xc);a.b("isPureComputed",a.Yc);a.b("computed.fn",z);a.G(z,"peek",z.t);a.G(z,"dispose",z.k);a.G(z,"isActive",z.ba);a.G(z,"getDependenciesCount",z.Aa);a.nc=function(b,c){if("function"===typeof b)return a.m(b,c,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.m(b,c)};a.b("pureComputed",a.nc);(function(){function b(a,f,g){g=g||new d;a=f(a);if("object"!=typeof a||null===a||a===n||a instanceof RegExp||a instanceof Date||a instanceof String||a instanceof
    3.58 +Number||a instanceof Boolean)return a;var k=a instanceof Array?[]:{};g.save(a,k);c(a,function(c){var d=f(a[c]);switch(typeof d){case "boolean":case "number":case "string":case "function":k[c]=d;break;case "object":case "undefined":var h=g.get(d);k[c]=h!==n?h:b(d,f,g)}});return k}function c(a,b){if(a instanceof Array){for(var c=0;c<a.length;c++)b(c);"function"==typeof a.toJSON&&b("toJSON")}else for(c in a)b(c)}function d(){this.keys=[];this.Ib=[]}a.wc=function(c){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");
    3.59 +return b(c,function(b){for(var c=0;a.H(b)&&10>c;c++)b=b();return b})};a.toJSON=function(b,c,d){b=a.wc(b);return a.a.Eb(b,c,d)};d.prototype={save:function(b,c){var d=a.a.o(this.keys,b);0<=d?this.Ib[d]=c:(this.keys.push(b),this.Ib.push(c))},get:function(b){b=a.a.o(this.keys,b);return 0<=b?this.Ib[b]:n}}})();a.b("toJS",a.wc);a.b("toJSON",a.toJSON);(function(){a.j={u:function(b){switch(a.a.A(b)){case "option":return!0===b.__ko__hasDomDataOptionValue__?a.a.e.get(b,a.d.options.xb):7>=a.a.C?b.getAttributeNode("value")&&
    3.60 +b.getAttributeNode("value").specified?b.value:b.text:b.value;case "select":return 0<=b.selectedIndex?a.j.u(b.options[b.selectedIndex]):n;default:return b.value}},ha:function(b,c,d){switch(a.a.A(b)){case "option":switch(typeof c){case "string":a.a.e.set(b,a.d.options.xb,n);"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.e.set(b,a.d.options.xb,c),b.__ko__hasDomDataOptionValue__=!0,b.value="number"===typeof c?c:""}break;case "select":if(""===c||
    3.61 +null===c)c=n;for(var e=-1,f=0,g=b.options.length,k;f<g;++f)if(k=a.j.u(b.options[f]),k==c||""==k&&c===n){e=f;break}if(d||0<=e||c===n&&1<b.size)b.selectedIndex=e;break;default:if(null===c||c===n)c="";b.value=c}}}})();a.b("selectExtensions",a.j);a.b("selectExtensions.readValue",a.j.u);a.b("selectExtensions.writeValue",a.j.ha);a.h=function(){function b(b){b=a.a.$a(b);123===b.charCodeAt(0)&&(b=b.slice(1,-1));var c=[],d=b.match(e),r,k=[],p=0;if(d){d.push(",");for(var A=0,y;y=d[A];++A){var t=y.charCodeAt(0);
    3.62 +if(44===t){if(0>=p){c.push(r&&k.length?{key:r,value:k.join("")}:{unknown:r||k.join("")});r=p=0;k=[];continue}}else if(58===t){if(!p&&!r&&1===k.length){r=k.pop();continue}}else 47===t&&A&&1<y.length?(t=d[A-1].match(f))&&!g[t[0]]&&(b=b.substr(b.indexOf(y)+1),d=b.match(e),d.push(","),A=-1,y="/"):40===t||123===t||91===t?++p:41===t||125===t||93===t?--p:r||k.length||34!==t&&39!==t||(y=y.slice(1,-1));k.push(y)}}return c}var c=["true","false","null","undefined"],d=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,
    3.63 +e=RegExp("\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|/(?:[^/\\\\]|\\\\.)*/w*|[^\\s:,/][^,\"'{}()/:[\\]]*[^\\s,\"'{}()/:[\\]]|[^\\s]","g"),f=/[\])"'A-Za-z0-9_$]+$/,g={"in":1,"return":1,"typeof":1},k={};return{ta:[],ea:k,yb:b,Ua:function(e,m){function h(b,e){var m;if(!A){var l=a.getBindingHandler(b);if(l&&l.preprocess&&!(e=l.preprocess(e,b,h)))return;if(l=k[b])m=e,0<=a.a.o(c,m)?m=!1:(l=m.match(d),m=null===l?!1:l[1]?"Object("+l[1]+")"+l[2]:m),l=m;l&&g.push("'"+b+"':function(_z){"+m+"=_z}")}p&&(e=
    3.64 +"function(){return "+e+" }");f.push("'"+b+"':"+e)}m=m||{};var f=[],g=[],p=m.valueAccessors,A=m.bindingParams,y="string"===typeof e?b(e):e;a.a.q(y,function(a){h(a.key||a.unknown,a.value)});g.length&&h("_ko_property_writers","{"+g.join(",")+" }");return f.join(",")},ad:function(a,b){for(var c=0;c<a.length;c++)if(a[c].key==b)return!0;return!1},Ea:function(b,c,d,e,f){if(b&&a.H(b))!a.Ba(b)||f&&b.t()===e||b(e);else if((b=c.get("_ko_property_writers"))&&b[d])b[d](e)}}}();a.b("expressionRewriting",a.h);a.b("expressionRewriting.bindingRewriteValidators",
    3.65 +a.h.ta);a.b("expressionRewriting.parseObjectLiteral",a.h.yb);a.b("expressionRewriting.preProcessBindings",a.h.Ua);a.b("expressionRewriting._twoWayBindings",a.h.ea);a.b("jsonExpressionRewriting",a.h);a.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",a.h.Ua);(function(){function b(a){return 8==a.nodeType&&g.test(f?a.text:a.nodeValue)}function c(a){return 8==a.nodeType&&k.test(f?a.text:a.nodeValue)}function d(a,d){for(var e=a,f=1,l=[];e=e.nextSibling;){if(c(e)&&(f--,0===f))return l;l.push(e);
    3.66 +b(e)&&f++}if(!d)throw Error("Cannot find closing comment tag to match: "+a.nodeValue);return null}function e(a,b){var c=d(a,b);return c?0<c.length?c[c.length-1].nextSibling:a.nextSibling:null}var f=u&&"\x3c!--test--\x3e"===u.createComment("test").text,g=f?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,k=f?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,l={ul:!0,ol:!0};a.f={Z:{},childNodes:function(a){return b(a)?d(a):a.childNodes},xa:function(c){if(b(c)){c=a.f.childNodes(c);for(var d=
    3.67 +0,e=c.length;d<e;d++)a.removeNode(c[d])}else a.a.ob(c)},da:function(c,d){if(b(c)){a.f.xa(c);for(var e=c.nextSibling,f=0,l=d.length;f<l;f++)e.parentNode.insertBefore(d[f],e)}else a.a.da(c,d)},mc:function(a,c){b(a)?a.parentNode.insertBefore(c,a.nextSibling):a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)},gc:function(c,d,e){e?b(c)?c.parentNode.insertBefore(d,e.nextSibling):e.nextSibling?c.insertBefore(d,e.nextSibling):c.appendChild(d):a.f.mc(c,d)},firstChild:function(a){return b(a)?!a.nextSibling||
    3.68 +c(a.nextSibling)?null:a.nextSibling:a.firstChild},nextSibling:function(a){b(a)&&(a=e(a));return a.nextSibling&&c(a.nextSibling)?null:a.nextSibling},Tc:b,pd:function(a){return(a=(f?a.text:a.nodeValue).match(g))?a[1]:null},kc:function(d){if(l[a.a.A(d)]){var h=d.firstChild;if(h){do if(1===h.nodeType){var f;f=h.firstChild;var g=null;if(f){do if(g)g.push(f);else if(b(f)){var k=e(f,!0);k?f=k:g=[f]}else c(f)&&(g=[f]);while(f=f.nextSibling)}if(f=g)for(g=h.nextSibling,k=0;k<f.length;k++)g?d.insertBefore(f[k],
    3.69 +g):d.appendChild(f[k])}while(h=h.nextSibling)}}}}})();a.b("virtualElements",a.f);a.b("virtualElements.allowedBindings",a.f.Z);a.b("virtualElements.emptyNode",a.f.xa);a.b("virtualElements.insertAfter",a.f.gc);a.b("virtualElements.prepend",a.f.mc);a.b("virtualElements.setDomNodeChildren",a.f.da);(function(){a.Q=function(){this.Fc={}};a.a.extend(a.Q.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return null!=b.getAttribute("data-bind")||a.g.getComponentNameForNode(b);case 8:return a.f.Tc(b);
    3.70 +default:return!1}},getBindings:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b):null;return a.g.Ob(d,b,c,!1)},getBindingAccessors:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b,{valueAccessors:!0}):null;return a.g.Ob(d,b,c,!0)},getBindingsString:function(b){switch(b.nodeType){case 1:return b.getAttribute("data-bind");case 8:return a.f.pd(b);default:return null}},parseBindingsString:function(b,c,d,e){try{var f=this.Fc,g=b+(e&&e.valueAccessors||
    3.71 +""),k;if(!(k=f[g])){var l,m="with($context){with($data||{}){return{"+a.h.Ua(b,e)+"}}}";l=new Function("$context","$element",m);k=f[g]=l}return k(c,d)}catch(h){throw h.message="Unable to parse bindings.\nBindings value: "+b+"\nMessage: "+h.message,h;}}});a.Q.instance=new a.Q})();a.b("bindingProvider",a.Q);(function(){function b(a){return function(){return a}}function c(a){return a()}function d(b){return a.a.Ca(a.l.w(b),function(a,c){return function(){return b()[c]}})}function e(c,e,h){return"function"===
    3.72 +typeof c?d(c.bind(null,e,h)):a.a.Ca(c,b)}function f(a,b){return d(this.getBindings.bind(this,a,b))}function g(b,c,d){var e,h=a.f.firstChild(c),f=a.Q.instance,m=f.preprocessNode;if(m){for(;e=h;)h=a.f.nextSibling(e),m.call(f,e);h=a.f.firstChild(c)}for(;e=h;)h=a.f.nextSibling(e),k(b,e,d)}function k(b,c,d){var e=!0,h=1===c.nodeType;h&&a.f.kc(c);if(h&&d||a.Q.instance.nodeHasBindings(c))e=m(c,null,b,d).shouldBindDescendants;e&&!r[a.a.A(c)]&&g(b,c,!h)}function l(b){var c=[],d={},e=[];a.a.D(b,function Z(h){if(!d[h]){var f=
    3.73 +a.getBindingHandler(h);f&&(f.after&&(e.push(h),a.a.q(f.after,function(c){if(b[c]){if(-1!==a.a.o(e,c))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+e.join(", "));Z(c)}}),e.length--),c.push({key:h,fc:f}));d[h]=!0}});return c}function m(b,d,e,h){var m=a.a.e.get(b,q);if(!d){if(m)throw Error("You cannot apply bindings multiple times to the same element.");a.a.e.set(b,q,!0)}!m&&h&&a.tc(b,e);var g;if(d&&"function"!==typeof d)g=d;else{var k=a.Q.instance,r=k.getBindingAccessors||
    3.74 +f,p=a.B(function(){(g=d?d(e,b):r.call(k,b,e))&&e.P&&e.P();return g},null,{i:b});g&&p.ba()||(p=null)}var u;if(g){var v=p?function(a){return function(){return c(p()[a])}}:function(a){return g[a]},s=function(){return a.a.Ca(p?p():g,c)};s.get=function(a){return g[a]&&c(v(a))};s.has=function(a){return a in g};h=l(g);a.a.q(h,function(c){var d=c.fc.init,h=c.fc.update,f=c.key;if(8===b.nodeType&&!a.f.Z[f])throw Error("The binding '"+f+"' cannot be used with virtual elements");try{"function"==typeof d&&a.l.w(function(){var a=
    3.75 +d(b,v(f),s,e.$data,e);if(a&&a.controlsDescendantBindings){if(u!==n)throw Error("Multiple bindings ("+u+" and "+f+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");u=f}}),"function"==typeof h&&a.B(function(){h(b,v(f),s,e.$data,e)},null,{i:b})}catch(m){throw m.message='Unable to process binding "'+f+": "+g[f]+'"\nMessage: '+m.message,m;}})}return{shouldBindDescendants:u===n}}function h(b){return b&&b instanceof a.U?b:new a.U(b)}
    3.76 +a.d={};var r={script:!0,textarea:!0,template:!0};a.getBindingHandler=function(b){return a.d[b]};a.U=function(b,c,d,e){var h=this,f="function"==typeof b&&!a.H(b),m,g=a.B(function(){var m=f?b():b,l=a.a.c(m);c?(c.P&&c.P(),a.a.extend(h,c),g&&(h.P=g)):(h.$parents=[],h.$root=l,h.ko=a);h.$rawData=m;h.$data=l;d&&(h[d]=l);e&&e(h,c,l);return h.$data},null,{wa:function(){return m&&!a.a.Qb(m)},i:!0});g.ba()&&(h.P=g,g.equalityComparer=null,m=[],g.Ac=function(b){m.push(b);a.a.F.oa(b,function(b){a.a.La(m,b);m.length||
    3.77 +(g.k(),h.P=g=n)})})};a.U.prototype.createChildContext=function(b,c,d){return new a.U(b,this,c,function(a,b){a.$parentContext=b;a.$parent=b.$data;a.$parents=(b.$parents||[]).slice(0);a.$parents.unshift(a.$parent);d&&d(a)})};a.U.prototype.extend=function(b){return new a.U(this.P||this.$data,this,null,function(c,d){c.$rawData=d.$rawData;a.a.extend(c,"function"==typeof b?b():b)})};var q=a.a.e.I(),p=a.a.e.I();a.tc=function(b,c){if(2==arguments.length)a.a.e.set(b,p,c),c.P&&c.P.Ac(b);else return a.a.e.get(b,
    3.78 +p)};a.Ja=function(b,c,d){1===b.nodeType&&a.f.kc(b);return m(b,c,h(d),!0)};a.Dc=function(b,c,d){d=h(d);return a.Ja(b,e(c,d,b),d)};a.eb=function(a,b){1!==b.nodeType&&8!==b.nodeType||g(h(a),b,!0)};a.Rb=function(a,b){!v&&x.jQuery&&(v=x.jQuery);if(b&&1!==b.nodeType&&8!==b.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");b=b||x.document.body;k(h(a),b,!0)};a.kb=function(b){switch(b.nodeType){case 1:case 8:var c=a.tc(b);if(c)return c;
    3.79 +if(b.parentNode)return a.kb(b.parentNode)}return n};a.Jc=function(b){return(b=a.kb(b))?b.$data:n};a.b("bindingHandlers",a.d);a.b("applyBindings",a.Rb);a.b("applyBindingsToDescendants",a.eb);a.b("applyBindingAccessorsToNode",a.Ja);a.b("applyBindingsToNode",a.Dc);a.b("contextFor",a.kb);a.b("dataFor",a.Jc)})();(function(b){function c(c,e){var m=f.hasOwnProperty(c)?f[c]:b,h;m?m.X(e):(m=f[c]=new a.J,m.X(e),d(c,function(b,d){var e=!(!d||!d.synchronous);g[c]={definition:b,Zc:e};delete f[c];h||e?m.notifySubscribers(b):
    3.80 +a.Y.Wa(function(){m.notifySubscribers(b)})}),h=!0)}function d(a,b){e("getConfig",[a],function(c){c?e("loadComponent",[a,c],function(a){b(a,c)}):b(null,null)})}function e(c,d,f,h){h||(h=a.g.loaders.slice(0));var g=h.shift();if(g){var q=g[c];if(q){var p=!1;if(q.apply(g,d.concat(function(a){p?f(null):null!==a?f(a):e(c,d,f,h)}))!==b&&(p=!0,!g.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else e(c,d,f,h)}else f(null)}
    3.81 +var f={},g={};a.g={get:function(d,e){var f=g.hasOwnProperty(d)?g[d]:b;f?f.Zc?a.l.w(function(){e(f.definition)}):a.Y.Wa(function(){e(f.definition)}):c(d,e)},Xb:function(a){delete g[a]},Jb:e};a.g.loaders=[];a.b("components",a.g);a.b("components.get",a.g.get);a.b("components.clearCachedDefinition",a.g.Xb)})();(function(){function b(b,c,d,e){function g(){0===--y&&e(k)}var k={},y=2,t=d.template;d=d.viewModel;t?f(c,t,function(c){a.g.Jb("loadTemplate",[b,c],function(a){k.template=a;g()})}):g();d?f(c,d,function(c){a.g.Jb("loadViewModel",
    3.82 +[b,c],function(a){k[l]=a;g()})}):g()}function c(a,b,d){if("function"===typeof b)d(function(a){return new b(a)});else if("function"===typeof b[l])d(b[l]);else if("instance"in b){var e=b.instance;d(function(){return e})}else"viewModel"in b?c(a,b.viewModel,d):a("Unknown viewModel value: "+b)}function d(b){switch(a.a.A(b)){case "script":return a.a.ma(b.text);case "textarea":return a.a.ma(b.value);case "template":if(e(b.content))return a.a.ua(b.content.childNodes)}return a.a.ua(b.childNodes)}function e(a){return x.DocumentFragment?
    3.83 +a instanceof DocumentFragment:a&&11===a.nodeType}function f(a,b,c){"string"===typeof b.require?O||x.require?(O||x.require)([b.require],c):a("Uses require, but no AMD loader is present"):c(b)}function g(a){return function(b){throw Error("Component '"+a+"': "+b);}}var k={};a.g.register=function(b,c){if(!c)throw Error("Invalid configuration for "+b);if(a.g.ub(b))throw Error("Component "+b+" is already registered");k[b]=c};a.g.ub=function(a){return k.hasOwnProperty(a)};a.g.od=function(b){delete k[b];
    3.84 +a.g.Xb(b)};a.g.Zb={getConfig:function(a,b){b(k.hasOwnProperty(a)?k[a]:null)},loadComponent:function(a,c,d){var e=g(a);f(e,c,function(c){b(a,e,c,d)})},loadTemplate:function(b,c,f){b=g(b);if("string"===typeof c)f(a.a.ma(c));else if(c instanceof Array)f(c);else if(e(c))f(a.a.V(c.childNodes));else if(c.element)if(c=c.element,x.HTMLElement?c instanceof HTMLElement:c&&c.tagName&&1===c.nodeType)f(d(c));else if("string"===typeof c){var l=u.getElementById(c);l?f(d(l)):b("Cannot find element with ID "+c)}else b("Unknown element type: "+
    3.85 +c);else b("Unknown template value: "+c)},loadViewModel:function(a,b,d){c(g(a),b,d)}};var l="createViewModel";a.b("components.register",a.g.register);a.b("components.isRegistered",a.g.ub);a.b("components.unregister",a.g.od);a.b("components.defaultLoader",a.g.Zb);a.g.loaders.push(a.g.Zb);a.g.Bc=k})();(function(){function b(b,e){var f=b.getAttribute("params");if(f){var f=c.parseBindingsString(f,e,b,{valueAccessors:!0,bindingParams:!0}),f=a.a.Ca(f,function(c){return a.m(c,null,{i:b})}),g=a.a.Ca(f,function(c){var e=
    3.86 +c.t();return c.ba()?a.m({read:function(){return a.a.c(c())},write:a.Ba(e)&&function(a){c()(a)},i:b}):e});g.hasOwnProperty("$raw")||(g.$raw=f);return g}return{$raw:{}}}a.g.getComponentNameForNode=function(b){var c=a.a.A(b);if(a.g.ub(c)&&(-1!=c.indexOf("-")||"[object HTMLUnknownElement]"==""+b||8>=a.a.C&&b.tagName===c))return c};a.g.Ob=function(c,e,f,g){if(1===e.nodeType){var k=a.g.getComponentNameForNode(e);if(k){c=c||{};if(c.component)throw Error('Cannot use the "component" binding on a custom element matching a component');
    3.87 +var l={name:k,params:b(e,f)};c.component=g?function(){return l}:l}}return c};var c=new a.Q;9>a.a.C&&(a.g.register=function(a){return function(b){u.createElement(b);return a.apply(this,arguments)}}(a.g.register),u.createDocumentFragment=function(b){return function(){var c=b(),f=a.g.Bc,g;for(g in f)f.hasOwnProperty(g)&&c.createElement(g);return c}}(u.createDocumentFragment))})();(function(b){function c(b,c,d){c=c.template;if(!c)throw Error("Component '"+b+"' has no template");b=a.a.ua(c);a.f.da(d,b)}
    3.88 +function d(a,b,c,d){var e=a.createViewModel;return e?e.call(a,d,{element:b,templateNodes:c}):d}var e=0;a.d.component={init:function(f,g,k,l,m){function h(){var a=r&&r.dispose;"function"===typeof a&&a.call(r);q=r=null}var r,q,p=a.a.V(a.f.childNodes(f));a.a.F.oa(f,h);a.m(function(){var l=a.a.c(g()),k,t;"string"===typeof l?k=l:(k=a.a.c(l.name),t=a.a.c(l.params));if(!k)throw Error("No component name specified");var n=q=++e;a.g.get(k,function(e){if(q===n){h();if(!e)throw Error("Unknown component '"+k+
    3.89 +"'");c(k,e,f);var g=d(e,f,p,t);e=m.createChildContext(g,b,function(a){a.$component=g;a.$componentTemplateNodes=p});r=g;a.eb(e,f)}})},null,{i:f});return{controlsDescendantBindings:!0}}};a.f.Z.component=!0})();var S={"class":"className","for":"htmlFor"};a.d.attr={update:function(b,c){var d=a.a.c(c())||{};a.a.D(d,function(c,d){d=a.a.c(d);var g=!1===d||null===d||d===n;g&&b.removeAttribute(c);8>=a.a.C&&c in S?(c=S[c],g?b.removeAttribute(c):b[c]=d):g||b.setAttribute(c,d.toString());"name"===c&&a.a.rc(b,
    3.90 +g?"":d.toString())})}};(function(){a.d.checked={after:["value","attr"],init:function(b,c,d){function e(){var e=b.checked,f=p?g():e;if(!a.va.Sa()&&(!l||e)){var m=a.l.w(c);if(h){var k=r?m.t():m;q!==f?(e&&(a.a.pa(k,f,!0),a.a.pa(k,q,!1)),q=f):a.a.pa(k,f,e);r&&a.Ba(m)&&m(k)}else a.h.Ea(m,d,"checked",f,!0)}}function f(){var d=a.a.c(c());b.checked=h?0<=a.a.o(d,g()):k?d:g()===d}var g=a.nc(function(){return d.has("checkedValue")?a.a.c(d.get("checkedValue")):d.has("value")?a.a.c(d.get("value")):b.value}),k=
    3.91 +"checkbox"==b.type,l="radio"==b.type;if(k||l){var m=c(),h=k&&a.a.c(m)instanceof Array,r=!(h&&m.push&&m.splice),q=h?g():n,p=l||h;l&&!b.name&&a.d.uniqueName.init(b,function(){return!0});a.m(e,null,{i:b});a.a.p(b,"click",e);a.m(f,null,{i:b});m=n}}};a.h.ea.checked=!0;a.d.checkedValue={update:function(b,c){b.value=a.a.c(c())}}})();a.d.css={update:function(b,c){var d=a.a.c(c());null!==d&&"object"==typeof d?a.a.D(d,function(c,d){d=a.a.c(d);a.a.bb(b,c,d)}):(d=a.a.$a(String(d||"")),a.a.bb(b,b.__ko__cssValue,
    3.92 +!1),b.__ko__cssValue=d,a.a.bb(b,d,!0))}};a.d.enable={update:function(b,c){var d=a.a.c(c());d&&b.disabled?b.removeAttribute("disabled"):d||b.disabled||(b.disabled=!0)}};a.d.disable={update:function(b,c){a.d.enable.update(b,function(){return!a.a.c(c())})}};a.d.event={init:function(b,c,d,e,f){var g=c()||{};a.a.D(g,function(g){"string"==typeof g&&a.a.p(b,g,function(b){var m,h=c()[g];if(h){try{var r=a.a.V(arguments);e=f.$data;r.unshift(e);m=h.apply(e,r)}finally{!0!==m&&(b.preventDefault?b.preventDefault():
    3.93 +b.returnValue=!1)}!1===d.get(g+"Bubble")&&(b.cancelBubble=!0,b.stopPropagation&&b.stopPropagation())}})})}};a.d.foreach={ic:function(b){return function(){var c=b(),d=a.a.zb(c);if(!d||"number"==typeof d.length)return{foreach:c,templateEngine:a.W.sb};a.a.c(c);return{foreach:d.data,as:d.as,includeDestroyed:d.includeDestroyed,afterAdd:d.afterAdd,beforeRemove:d.beforeRemove,afterRender:d.afterRender,beforeMove:d.beforeMove,afterMove:d.afterMove,templateEngine:a.W.sb}}},init:function(b,c){return a.d.template.init(b,
    3.94 +a.d.foreach.ic(c))},update:function(b,c,d,e,f){return a.d.template.update(b,a.d.foreach.ic(c),d,e,f)}};a.h.ta.foreach=!1;a.f.Z.foreach=!0;a.d.hasfocus={init:function(b,c,d){function e(e){b.__ko_hasfocusUpdating=!0;var f=b.ownerDocument;if("activeElement"in f){var g;try{g=f.activeElement}catch(h){g=f.body}e=g===b}f=c();a.h.Ea(f,d,"hasfocus",e,!0);b.__ko_hasfocusLastValue=e;b.__ko_hasfocusUpdating=!1}var f=e.bind(null,!0),g=e.bind(null,!1);a.a.p(b,"focus",f);a.a.p(b,"focusin",f);a.a.p(b,"blur",g);a.a.p(b,
    3.95 +"focusout",g)},update:function(b,c){var d=!!a.a.c(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===d||(d?b.focus():b.blur(),!d&&b.__ko_hasfocusLastValue&&b.ownerDocument.body.focus(),a.l.w(a.a.Da,null,[b,d?"focusin":"focusout"]))}};a.h.ea.hasfocus=!0;a.d.hasFocus=a.d.hasfocus;a.h.ea.hasFocus=!0;a.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.Cb(b,c())}};K("if");K("ifnot",!1,!0);K("with",!0,!1,function(a,c){return a.createChildContext(c)});var L={};
    3.96 +a.d.options={init:function(b){if("select"!==a.a.A(b))throw Error("options binding applies only to SELECT elements");for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:function(b,c,d){function e(){return a.a.Ka(b.options,function(a){return a.selected})}function f(a,b,c){var d=typeof b;return"function"==d?b(a):"string"==d?a[b]:c}function g(c,e){if(A&&h)a.j.ha(b,a.a.c(d.get("value")),!0);else if(p.length){var f=0<=a.a.o(p,a.j.u(e[0]));a.a.sc(e[0],f);A&&!f&&a.l.w(a.a.Da,null,[b,
    3.97 +"change"])}}var k=b.multiple,l=0!=b.length&&k?b.scrollTop:null,m=a.a.c(c()),h=d.get("valueAllowUnset")&&d.has("value"),r=d.get("optionsIncludeDestroyed");c={};var q,p=[];h||(k?p=a.a.fb(e(),a.j.u):0<=b.selectedIndex&&p.push(a.j.u(b.options[b.selectedIndex])));m&&("undefined"==typeof m.length&&(m=[m]),q=a.a.Ka(m,function(b){return r||b===n||null===b||!a.a.c(b._destroy)}),d.has("optionsCaption")&&(m=a.a.c(d.get("optionsCaption")),null!==m&&m!==n&&q.unshift(L)));var A=!1;c.beforeRemove=function(a){b.removeChild(a)};
    3.98 +m=g;d.has("optionsAfterRender")&&"function"==typeof d.get("optionsAfterRender")&&(m=function(b,c){g(0,c);a.l.w(d.get("optionsAfterRender"),null,[c[0],b!==L?b:n])});a.a.Bb(b,q,function(c,e,g){g.length&&(p=!h&&g[0].selected?[a.j.u(g[0])]:[],A=!0);e=b.ownerDocument.createElement("option");c===L?(a.a.Za(e,d.get("optionsCaption")),a.j.ha(e,n)):(g=f(c,d.get("optionsValue"),c),a.j.ha(e,a.a.c(g)),c=f(c,d.get("optionsText"),g),a.a.Za(e,c));return[e]},c,m);a.l.w(function(){h?a.j.ha(b,a.a.c(d.get("value")),
    3.99 +!0):(k?p.length&&e().length<p.length:p.length&&0<=b.selectedIndex?a.j.u(b.options[b.selectedIndex])!==p[0]:p.length||0<=b.selectedIndex)&&a.a.Da(b,"change")});a.a.Nc(b);l&&20<Math.abs(l-b.scrollTop)&&(b.scrollTop=l)}};a.d.options.xb=a.a.e.I();a.d.selectedOptions={after:["options","foreach"],init:function(b,c,d){a.a.p(b,"change",function(){var e=c(),f=[];a.a.q(b.getElementsByTagName("option"),function(b){b.selected&&f.push(a.j.u(b))});a.h.Ea(e,d,"selectedOptions",f)})},update:function(b,c){if("select"!=
   3.100 +a.a.A(b))throw Error("values binding applies only to SELECT elements");var d=a.a.c(c()),e=b.scrollTop;d&&"number"==typeof d.length&&a.a.q(b.getElementsByTagName("option"),function(b){var c=0<=a.a.o(d,a.j.u(b));b.selected!=c&&a.a.sc(b,c)});b.scrollTop=e}};a.h.ea.selectedOptions=!0;a.d.style={update:function(b,c){var d=a.a.c(c()||{});a.a.D(d,function(c,d){d=a.a.c(d);if(null===d||d===n||!1===d)d="";b.style[c]=d})}};a.d.submit={init:function(b,c,d,e,f){if("function"!=typeof c())throw Error("The value for a submit binding must be a function");
   3.101 +a.a.p(b,"submit",function(a){var d,e=c();try{d=e.call(f.$data,b)}finally{!0!==d&&(a.preventDefault?a.preventDefault():a.returnValue=!1)}})}};a.d.text={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.Za(b,c())}};a.f.Z.text=!0;(function(){if(x&&x.navigator)var b=function(a){if(a)return parseFloat(a[1])},c=x.opera&&x.opera.version&&parseInt(x.opera.version()),d=x.navigator.userAgent,e=b(d.match(/^(?:(?!chrome).)*version\/([^ ]*) safari/i)),f=b(d.match(/Firefox\/([^ ]*)/));
   3.102 +if(10>a.a.C)var g=a.a.e.I(),k=a.a.e.I(),l=function(b){var c=this.activeElement;(c=c&&a.a.e.get(c,k))&&c(b)},m=function(b,c){var d=b.ownerDocument;a.a.e.get(d,g)||(a.a.e.set(d,g,!0),a.a.p(d,"selectionchange",l));a.a.e.set(b,k,c)};a.d.textInput={init:function(b,d,g){function l(c,d){a.a.p(b,c,d)}function k(){var c=a.a.c(d());if(null===c||c===n)c="";v!==n&&c===v?a.a.setTimeout(k,4):b.value!==c&&(u=c,b.value=c)}function y(){s||(v=b.value,s=a.a.setTimeout(t,4))}function t(){clearTimeout(s);v=s=n;var c=
   3.103 +b.value;u!==c&&(u=c,a.h.Ea(d(),g,"textInput",c))}var u=b.value,s,v,x=9==a.a.C?y:t;10>a.a.C?(l("propertychange",function(a){"value"===a.propertyName&&x(a)}),8==a.a.C&&(l("keyup",t),l("keydown",t)),8<=a.a.C&&(m(b,x),l("dragend",y))):(l("input",t),5>e&&"textarea"===a.a.A(b)?(l("keydown",y),l("paste",y),l("cut",y)):11>c?l("keydown",y):4>f&&(l("DOMAutoComplete",t),l("dragdrop",t),l("drop",t)));l("change",t);a.m(k,null,{i:b})}};a.h.ea.textInput=!0;a.d.textinput={preprocess:function(a,b,c){c("textInput",
   3.104 +a)}}})();a.d.uniqueName={init:function(b,c){if(c()){var d="ko_unique_"+ ++a.d.uniqueName.Ic;a.a.rc(b,d)}}};a.d.uniqueName.Ic=0;a.d.value={after:["options","foreach"],init:function(b,c,d){if("input"!=b.tagName.toLowerCase()||"checkbox"!=b.type&&"radio"!=b.type){var e=["change"],f=d.get("valueUpdate"),g=!1,k=null;f&&("string"==typeof f&&(f=[f]),a.a.ra(e,f),e=a.a.Tb(e));var l=function(){k=null;g=!1;var e=c(),f=a.j.u(b);a.h.Ea(e,d,"value",f)};!a.a.C||"input"!=b.tagName.toLowerCase()||"text"!=b.type||
   3.105 +"off"==b.autocomplete||b.form&&"off"==b.form.autocomplete||-1!=a.a.o(e,"propertychange")||(a.a.p(b,"propertychange",function(){g=!0}),a.a.p(b,"focus",function(){g=!1}),a.a.p(b,"blur",function(){g&&l()}));a.a.q(e,function(c){var d=l;a.a.nd(c,"after")&&(d=function(){k=a.j.u(b);a.a.setTimeout(l,0)},c=c.substring(5));a.a.p(b,c,d)});var m=function(){var e=a.a.c(c()),f=a.j.u(b);if(null!==k&&e===k)a.a.setTimeout(m,0);else if(e!==f)if("select"===a.a.A(b)){var g=d.get("valueAllowUnset"),f=function(){a.j.ha(b,
   3.106 +e,g)};f();g||e===a.j.u(b)?a.a.setTimeout(f,0):a.l.w(a.a.Da,null,[b,"change"])}else a.j.ha(b,e)};a.m(m,null,{i:b})}else a.Ja(b,{checkedValue:c})},update:function(){}};a.h.ea.value=!0;a.d.visible={update:function(b,c){var d=a.a.c(c()),e="none"!=b.style.display;d&&!e?b.style.display="":!d&&e&&(b.style.display="none")}};(function(b){a.d[b]={init:function(c,d,e,f,g){return a.d.event.init.call(this,c,function(){var a={};a[b]=d();return a},e,f,g)}}})("click");a.O=function(){};a.O.prototype.renderTemplateSource=
   3.107 +function(){throw Error("Override renderTemplateSource");};a.O.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock");};a.O.prototype.makeTemplateSource=function(b,c){if("string"==typeof b){c=c||u;var d=c.getElementById(b);if(!d)throw Error("Cannot find template with ID "+b);return new a.v.n(d)}if(1==b.nodeType||8==b.nodeType)return new a.v.qa(b);throw Error("Unknown template type: "+b);};a.O.prototype.renderTemplate=function(a,c,d,e){a=this.makeTemplateSource(a,
   3.108 +e);return this.renderTemplateSource(a,c,d,e)};a.O.prototype.isTemplateRewritten=function(a,c){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(a,c).data("isRewritten")};a.O.prototype.rewriteTemplate=function(a,c,d){a=this.makeTemplateSource(a,d);c=c(a.text());a.text(c);a.data("isRewritten",!0)};a.b("templateEngine",a.O);a.Gb=function(){function b(b,c,d,k){b=a.h.yb(b);for(var l=a.h.ta,m=0;m<b.length;m++){var h=b[m].key;if(l.hasOwnProperty(h)){var r=l[h];if("function"===typeof r){if(h=
   3.109 +r(b[m].value))throw Error(h);}else if(!r)throw Error("This template engine does not support the '"+h+"' binding within its templates");}}d="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+a.h.Ua(b,{valueAccessors:!0})+" } })()},'"+d.toLowerCase()+"')";return k.createJavaScriptEvaluatorBlock(d)+c}var c=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,d=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{Oc:function(b,
   3.110 +c,d){c.isTemplateRewritten(b,d)||c.rewriteTemplate(b,function(b){return a.Gb.dd(b,c)},d)},dd:function(a,f){return a.replace(c,function(a,c,d,e,h){return b(h,c,d,f)}).replace(d,function(a,c){return b(c,"\x3c!-- ko --\x3e","#comment",f)})},Ec:function(b,c){return a.M.wb(function(d,k){var l=d.nextSibling;l&&l.nodeName.toLowerCase()===c&&a.Ja(l,b,k)})}}}();a.b("__tr_ambtns",a.Gb.Ec);(function(){a.v={};a.v.n=function(b){if(this.n=b){var c=a.a.A(b);this.ab="script"===c?1:"textarea"===c?2:"template"==c&&
   3.111 +b.content&&11===b.content.nodeType?3:4}};a.v.n.prototype.text=function(){var b=1===this.ab?"text":2===this.ab?"value":"innerHTML";if(0==arguments.length)return this.n[b];var c=arguments[0];"innerHTML"===b?a.a.Cb(this.n,c):this.n[b]=c};var b=a.a.e.I()+"_";a.v.n.prototype.data=function(c){if(1===arguments.length)return a.a.e.get(this.n,b+c);a.a.e.set(this.n,b+c,arguments[1])};var c=a.a.e.I();a.v.n.prototype.nodes=function(){var b=this.n;if(0==arguments.length)return(a.a.e.get(b,c)||{}).jb||(3===this.ab?
   3.112 +b.content:4===this.ab?b:n);a.a.e.set(b,c,{jb:arguments[0]})};a.v.qa=function(a){this.n=a};a.v.qa.prototype=new a.v.n;a.v.qa.prototype.text=function(){if(0==arguments.length){var b=a.a.e.get(this.n,c)||{};b.Hb===n&&b.jb&&(b.Hb=b.jb.innerHTML);return b.Hb}a.a.e.set(this.n,c,{Hb:arguments[0]})};a.b("templateSources",a.v);a.b("templateSources.domElement",a.v.n);a.b("templateSources.anonymousTemplate",a.v.qa)})();(function(){function b(b,c,d){var e;for(c=a.f.nextSibling(c);b&&(e=b)!==c;)b=a.f.nextSibling(e),
   3.113 +d(e,b)}function c(c,d){if(c.length){var e=c[0],f=c[c.length-1],g=e.parentNode,k=a.Q.instance,n=k.preprocessNode;if(n){b(e,f,function(a,b){var c=a.previousSibling,d=n.call(k,a);d&&(a===e&&(e=d[0]||b),a===f&&(f=d[d.length-1]||c))});c.length=0;if(!e)return;e===f?c.push(e):(c.push(e,f),a.a.za(c,g))}b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.Rb(d,b)});b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.M.yc(b,[d])});a.a.za(c,g)}}function d(a){return a.nodeType?a:0<a.length?a[0]:null}function e(b,
   3.114 +e,f,k,q){q=q||{};var p=(b&&d(b)||f||{}).ownerDocument,n=q.templateEngine||g;a.Gb.Oc(f,n,p);f=n.renderTemplate(f,k,q,p);if("number"!=typeof f.length||0<f.length&&"number"!=typeof f[0].nodeType)throw Error("Template engine must return an array of DOM nodes");p=!1;switch(e){case "replaceChildren":a.f.da(b,f);p=!0;break;case "replaceNode":a.a.qc(b,f);p=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+e);}p&&(c(f,k),q.afterRender&&a.l.w(q.afterRender,null,[f,k.$data]));
   3.115 +return f}function f(b,c,d){return a.H(b)?b():"function"===typeof b?b(c,d):b}var g;a.Db=function(b){if(b!=n&&!(b instanceof a.O))throw Error("templateEngine must inherit from ko.templateEngine");g=b};a.Ab=function(b,c,h,k,q){h=h||{};if((h.templateEngine||g)==n)throw Error("Set a template engine before calling renderTemplate");q=q||"replaceChildren";if(k){var p=d(k);return a.B(function(){var g=c&&c instanceof a.U?c:new a.U(a.a.c(c)),n=f(b,g.$data,g),g=e(k,q,n,g,h);"replaceNode"==q&&(k=g,p=d(k))},null,
   3.116 +{wa:function(){return!p||!a.a.nb(p)},i:p&&"replaceNode"==q?p.parentNode:p})}return a.M.wb(function(d){a.Ab(b,c,h,d,"replaceNode")})};a.kd=function(b,d,g,k,q){function p(a,b){c(b,s);g.afterRender&&g.afterRender(b,a);s=null}function u(a,c){s=q.createChildContext(a,g.as,function(a){a.$index=c});var d=f(b,a,s);return e(null,"ignoreTargetNode",d,s,g)}var s;return a.B(function(){var b=a.a.c(d)||[];"undefined"==typeof b.length&&(b=[b]);b=a.a.Ka(b,function(b){return g.includeDestroyed||b===n||null===b||!a.a.c(b._destroy)});
   3.117 +a.l.w(a.a.Bb,null,[k,b,u,g,p])},null,{i:k})};var k=a.a.e.I();a.d.template={init:function(b,c){var d=a.a.c(c());if("string"==typeof d||d.name)a.f.xa(b);else{if("nodes"in d){if(d=d.nodes||[],a.H(d))throw Error('The "nodes" option must be a plain, non-observable array.');}else d=a.f.childNodes(b);d=a.a.jc(d);(new a.v.qa(b)).nodes(d)}return{controlsDescendantBindings:!0}},update:function(b,c,d,e,f){var g=c(),s;c=a.a.c(g);d=!0;e=null;"string"==typeof c?c={}:(g=c.name,"if"in c&&(d=a.a.c(c["if"])),d&&"ifnot"in
   3.118 +c&&(d=!a.a.c(c.ifnot)),s=a.a.c(c.data));"foreach"in c?e=a.kd(g||b,d&&c.foreach||[],c,b,f):d?(f="data"in c?f.createChildContext(s,c.as):f,e=a.Ab(g||b,f,c,b)):a.f.xa(b);f=e;(s=a.a.e.get(b,k))&&"function"==typeof s.k&&s.k();a.a.e.set(b,k,f&&f.ba()?f:n)}};a.h.ta.template=function(b){b=a.h.yb(b);return 1==b.length&&b[0].unknown||a.h.ad(b,"name")?null:"This template engine does not support anonymous templates nested within its templates"};a.f.Z.template=!0})();a.b("setTemplateEngine",a.Db);a.b("renderTemplate",
   3.119 +a.Ab);a.a.dc=function(a,c,d){if(a.length&&c.length){var e,f,g,k,l;for(e=f=0;(!d||e<d)&&(k=a[f]);++f){for(g=0;l=c[g];++g)if(k.value===l.value){k.moved=l.index;l.moved=k.index;c.splice(g,1);e=g=0;break}e+=g}}};a.a.ib=function(){function b(b,d,e,f,g){var k=Math.min,l=Math.max,m=[],h,n=b.length,q,p=d.length,s=p-n||1,u=n+p+1,t,v,x;for(h=0;h<=n;h++)for(v=t,m.push(t=[]),x=k(p,h+s),q=l(0,h-1);q<=x;q++)t[q]=q?h?b[h-1]===d[q-1]?v[q-1]:k(v[q]||u,t[q-1]||u)+1:q+1:h+1;k=[];l=[];s=[];h=n;for(q=p;h||q;)p=m[h][q]-
   3.120 +1,q&&p===m[h][q-1]?l.push(k[k.length]={status:e,value:d[--q],index:q}):h&&p===m[h-1][q]?s.push(k[k.length]={status:f,value:b[--h],index:h}):(--q,--h,g.sparse||k.push({status:"retained",value:d[q]}));a.a.dc(s,l,!g.dontLimitMoves&&10*n);return k.reverse()}return function(a,d,e){e="boolean"===typeof e?{dontLimitMoves:e}:e||{};a=a||[];d=d||[];return a.length<d.length?b(a,d,"added","deleted",e):b(d,a,"deleted","added",e)}}();a.b("utils.compareArrays",a.a.ib);(function(){function b(b,c,d,k,l){var m=[],
   3.121 +h=a.B(function(){var h=c(d,l,a.a.za(m,b))||[];0<m.length&&(a.a.qc(m,h),k&&a.l.w(k,null,[d,h,l]));m.length=0;a.a.ra(m,h)},null,{i:b,wa:function(){return!a.a.Qb(m)}});return{ca:m,B:h.ba()?h:n}}var c=a.a.e.I(),d=a.a.e.I();a.a.Bb=function(e,f,g,k,l){function m(b,c){w=q[c];v!==c&&(D[b]=w);w.qb(v++);a.a.za(w.ca,e);u.push(w);z.push(w)}function h(b,c){if(b)for(var d=0,e=c.length;d<e;d++)c[d]&&a.a.q(c[d].ca,function(a){b(a,d,c[d].ja)})}f=f||[];k=k||{};var r=a.a.e.get(e,c)===n,q=a.a.e.get(e,c)||[],p=a.a.fb(q,
   3.122 +function(a){return a.ja}),s=a.a.ib(p,f,k.dontLimitMoves),u=[],t=0,v=0,x=[],z=[];f=[];for(var D=[],p=[],w,C=0,B,E;B=s[C];C++)switch(E=B.moved,B.status){case "deleted":E===n&&(w=q[t],w.B&&(w.B.k(),w.B=n),a.a.za(w.ca,e).length&&(k.beforeRemove&&(u.push(w),z.push(w),w.ja===d?w=null:f[C]=w),w&&x.push.apply(x,w.ca)));t++;break;case "retained":m(C,t++);break;case "added":E!==n?m(C,E):(w={ja:B.value,qb:a.N(v++)},u.push(w),z.push(w),r||(p[C]=w))}a.a.e.set(e,c,u);h(k.beforeMove,D);a.a.q(x,k.beforeRemove?a.$:
   3.123 +a.removeNode);for(var C=0,r=a.f.firstChild(e),F;w=z[C];C++){w.ca||a.a.extend(w,b(e,g,w.ja,l,w.qb));for(t=0;s=w.ca[t];r=s.nextSibling,F=s,t++)s!==r&&a.f.gc(e,s,F);!w.Wc&&l&&(l(w.ja,w.ca,w.qb),w.Wc=!0)}h(k.beforeRemove,f);for(C=0;C<f.length;++C)f[C]&&(f[C].ja=d);h(k.afterMove,D);h(k.afterAdd,p)}})();a.b("utils.setDomNodeChildrenFromArrayMapping",a.a.Bb);a.W=function(){this.allowTemplateRewriting=!1};a.W.prototype=new a.O;a.W.prototype.renderTemplateSource=function(b,c,d,e){if(c=(9>a.a.C?0:b.nodes)?
   3.124 +b.nodes():null)return a.a.V(c.cloneNode(!0).childNodes);b=b.text();return a.a.ma(b,e)};a.W.sb=new a.W;a.Db(a.W.sb);a.b("nativeTemplateEngine",a.W);(function(){a.vb=function(){var a=this.$c=function(){if(!v||!v.tmpl)return 0;try{if(0<=v.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(b,e,f,g){g=g||u;f=f||{};if(2>a)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var k=b.data("precompiled");
   3.125 +k||(k=b.text()||"",k=v.template(null,"{{ko_with $item.koBindingContext}}"+k+"{{/ko_with}}"),b.data("precompiled",k));b=[e.$data];e=v.extend({koBindingContext:e},f.templateOptions);e=v.tmpl(k,b,e);e.appendTo(g.createElement("div"));v.fragments={};return e};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+a+" })()) }}"};this.addTemplate=function(a,b){u.write("<script type='text/html' id='"+a+"'>"+b+"\x3c/script>")};0<a&&(v.tmpl.tag.ko_code={open:"__.push($1 || '');"},
   3.126 +v.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};a.vb.prototype=new a.O;var b=new a.vb;0<b.$c&&a.Db(b);a.b("jqueryTmplTemplateEngine",a.vb)})()})})();})();
     4.1 --- a/pom.xml	Sun Dec 13 21:33:32 2015 +0100
     4.2 +++ b/pom.xml	Mon Dec 14 05:52:22 2015 +0100
     4.3 @@ -98,6 +98,7 @@
     4.4                         <exclude>*</exclude>
     4.5                         <exclude>.*/**</exclude>
     4.6                         <exclude>*/nb-configuration.xml</exclude>
     4.7 +                       <exclude>ko4j/src/main/resources/org/netbeans/html/ko4j/knockout-3.4.0.js</exclude>
     4.8                         <exclude>boot-script/src/test/resources/net/java/html/boot/script/ko4j/env.nashorn.1.2-debug.js</exclude>
     4.9                         <exclude>src/main/javadoc/resources/teavm.js</exclude>
    4.10                    </excludes>