UNPKG

knockout-amd-helpers

Version:

Makes Knockout and AMD modules work better together

13 lines (10 loc) 58.4 kB
// Knockout JavaScript library v3.1.0 // (c) Steven Sanderson - http://knockoutjs.com/ // License: MIT (http://www.opensource.org/licenses/mit-license.php) // knockout-amd-helpers 0.6.3 | (c) 2014 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license /** * @license RequireJS text 2.0.0 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/requirejs/text for details */ (function(){(function(p){var A=this||(0,eval)("this"),w=A.document,K=A.navigator,t=A.jQuery,C=A.JSON;(function(e){"function"==typeof require&&"object"==typeof exports&&"object"==typeof module?e(module.exports||exports):"function"==typeof define&&define.amd?define("knockout",["exports"],e):e(A.ko={})})(function(e){function n(e,t){return null===e||typeof e in u?e===t:!1}function r(e,t){var n;return function(){n||(n=setTimeout(function(){n=p,e()},t))}}function i(e,t){var n;return function(){clearTimeout(n),n=setTimeout(e,t)}}function s(e,t,n,r){o.d[e]={init:function(e,i,s,u,a){var f,l;return o.ba(function(){var s=o.a.c(i()),u=!n!=!s,c=!l;if(c||t||u!==f)c&&o.ca.fa()&&(l=o.a.lb(o.e.childNodes(e),!0)),u?(c||o.e.U(e,o.a.lb(l)),o.gb(r?r(a,s):a,e)):o.e.da(e),f=u},null,{G:e}),{controlsDescendantBindings:!0}}},o.g.aa[e]=!1,o.e.Q[e]=!0}var o="undefined"!=typeof e?e:{};o.b=function(e,t){for(var n=e.split("."),r=o,i=0;i<n.length-1;i++)r=r[n[i]];r[n[n.length-1]]=t},o.s=function(e,t,n){e[t]=n},o.version="3.1.0",o.b("version",o.version),o.a=function(){function e(e,t){for(var n in e)e.hasOwnProperty(n)&&t(n,e[n])}function n(e,t){if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function r(e,t){return e.__proto__=t,e}var i={__proto__:[]}instanceof Array,s={},u={};s[K&&/Firefox\/2/i.test(K.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],s.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),e(s,function(e,t){if(t.length)for(var n=0,r=t.length;n<r;n++)u[t[n]]=e});var a={propertychange:!0},f=w&&function(){for(var e=3,t=w.createElement("div"),n=t.getElementsByTagName("i");t.innerHTML="<!--[if gt IE "+ ++e+"]><i></i><![endif]-->",n[0];);return 4<e?e:p}();return{mb:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],r:function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)},l:function(e,t){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(e,t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},hb:function(e,t,n){for(var r=0,i=e.length;r<i;r++)if(t.call(n,e[r],r))return e[r];return null},ma:function(e,t){var n=o.a.l(e,t);0<n?e.splice(n,1):0===n&&e.shift()},ib:function(e){e=e||[];for(var t=[],n=0,r=e.length;n<r;n++)0>o.a.l(t,e[n])&&t.push(e[n]);return t},ya:function(e,t){e=e||[];for(var n=[],r=0,i=e.length;r<i;r++)n.push(t(e[r],r));return n},la:function(e,t){e=e||[];for(var n=[],r=0,i=e.length;r<i;r++)t(e[r],r)&&n.push(e[r]);return n},$:function(e,t){if(t instanceof Array)e.push.apply(e,t);else for(var n=0,r=t.length;n<r;n++)e.push(t[n]);return e},Y:function(e,t,n){var r=o.a.l(o.a.Sa(e),t);0>r?n&&e.push(t):n||e.splice(r,1)},na:i,extend:n,ra:r,sa:i?r:n,A:e,Oa:function(e,t){if(!e)return e;var n={},r;for(r in e)e.hasOwnProperty(r)&&(n[r]=t(e[r],r,e));return n},Fa:function(e){for(;e.firstChild;)o.removeNode(e.firstChild)},ec:function(e){e=o.a.R(e);for(var t=w.createElement("div"),n=0,r=e.length;n<r;n++)t.appendChild(o.M(e[n]));return t},lb:function(e,t){for(var n=0,r=e.length,i=[];n<r;n++){var s=e[n].cloneNode(!0);i.push(t?o.M(s):s)}return i},U:function(e,t){o.a.Fa(e);if(t)for(var n=0,r=t.length;n<r;n++)e.appendChild(t[n])},Bb:function(e,t){var n=e.nodeType?[e]:e;if(0<n.length){for(var r=n[0],i=r.parentNode,s=0,u=t.length;s<u;s++)i.insertBefore(t[s],r);s=0;for(u=n.length;s<u;s++)o.removeNode(n[s])}},ea:function(e,t){if(e.length){for(t=8===t.nodeType&&t.parentNode||t;e.length&&e[0].parentNode!==t;)e.shift();if(1<e.length){var n=e[0],r=e[e.length-1];for(e.length=0;n!==r;)if(e.push(n),n=n.nextSibling,!n)return;e.push(r)}}return e},Db:function(e,t){7>f?e.setAttribute("selected",t):e.selected=t},ta:function(e){return null===e||e===p?"":e.trim?e.trim():e.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},oc:function(e,t){for(var n=[],r=(e||"").split(t),i=0,s=r.length;i<s;i++){var u=o.a.ta(r[i]);""!==u&&n.push(u)}return n},kc:function(e,t){return e=e||"",t.length>e.length?!1:e.substring(0,t.length)===t},Sb:function(e,t){if(e===t)return!0;if(11===e.nodeType)return!1;if(t.contains)return t.contains(3===e.nodeType?e.parentNode:e);if(t.compareDocumentPosition)return 16==(t.compareDocumentPosition(e)&16);for(;e&&e!=t;)e=e.parentNode;return!!e},Ea:function(e){return o.a.Sb(e,e.ownerDocument.documentElement)},eb:function(e){return!!o.a.hb(e,o.a.Ea)},B:function(e){return e&&e.tagName&&e.tagName.toLowerCase()},q:function(e,n,r){var i=f&&a[n];if(!i&&t)t(e).bind(n,r);else if(i||"function"!=typeof e.addEventListener){if("undefined"==typeof e.attachEvent)throw Error("Browser doesn't support addEventListener or attachEvent");var s=function(t){r.call(e,t)},u="on"+n;e.attachEvent(u,s),o.a.u.ja(e,function(){e.detachEvent(u,s)})}else e.addEventListener(n,r,!1)},ha:function(e,n){if(!e||!e.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var r;"input"===o.a.B(e)&&e.type&&"click"==n.toLowerCase()?(r=e.type,r="checkbox"==r||"radio"==r):r=!1;if(t&&!r)t(e).trigger(n);else if("function"==typeof w.createEvent){if("function"!=typeof e.dispatchEvent)throw Error("The supplied element doesn't support dispatchEvent");r=w.createEvent(u[n]||"HTMLEvents"),r.initEvent(n,!0,!0,A,0,0,0,0,0,!1,!1,!1,!1,0,e),e.dispatchEvent(r)}else if(r&&e.click)e.click();else{if("undefined"==typeof e.fireEvent)throw Error("Browser doesn't support triggering events");e.fireEvent("on"+n)}},c:function(e){return o.v(e)?e():e},Sa:function(e){return o.v(e)?e.o():e},ua:function(e,t,n){if(t){var r=/\S+/g,i=e.className.match(r)||[];o.a.r(t.match(r),function(e){o.a.Y(i,e,n)}),e.className=i.join(" ")}},Xa:function(e,t){var n=o.a.c(t);if(null===n||n===p)n="";var r=o.e.firstChild(e);!r||3!=r.nodeType||o.e.nextSibling(r)?o.e.U(e,[e.ownerDocument.createTextNode(n)]):r.data=n,o.a.Vb(e)},Cb:function(e,t){e.name=t;if(7>=f)try{e.mergeAttributes(w.createElement("<input name='"+e.name+"'/>"),!1)}catch(n){}},Vb:function(e){9<=f&&(e=1==e.nodeType?e:e.parentNode,e.style&&(e.style.zoom=e.style.zoom))},Tb:function(e){if(f){var t=e.style.width;e.style.width=0,e.style.width=t}},ic:function(e,t){e=o.a.c(e),t=o.a.c(t);for(var n=[],r=e;r<=t;r++)n.push(r);return n},R:function(e){for(var t=[],n=0,r=e.length;n<r;n++)t.push(e[n]);return t},mc:6===f,nc:7===f,oa:f,ob:function(e,t){for(var n=o.a.R(e.getElementsByTagName("input")).concat(o.a.R(e.getElementsByTagName("textarea"))),r="string"==typeof t?function(e){return e.name===t}:function(e){return t.test(e.name)},i=[],s=n.length-1;0<=s;s--)r(n[s])&&i.push(n[s]);return i},fc:function(e){return"string"==typeof e&&(e=o.a.ta(e))?C&&C.parse?C.parse(e):(new Function("return "+e))():null},Ya:function(e,t,n){if(!C||!C.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");return C.stringify(o.a.c(e),t,n)},gc:function(t,n,r){r=r||{};var i=r.params||{},s=r.includeFields||this.mb,u=t;if("object"==typeof t&&"form"===o.a.B(t))for(var u=t.action,a=s.length-1;0<=a;a--)for(var f=o.a.ob(t,s[a]),l=f.length-1;0<=l;l--)i[f[l].name]=f[l].value;n=o.a.c(n);var c=w.createElement("form");c.style.display="none",c.action=u,c.method="post";for(var h in n)t=w.createElement("input"),t.name=h,t.value=o.a.Ya(o.a.c(n[h])),c.appendChild(t);e(i,function(e,t){var n=w.createElement("input");n.name=e,n.value=t,c.appendChild(n)}),w.body.appendChild(c),r.submitter?r.submitter(c):c.submit(),setTimeout(function(){c.parentNode.removeChild(c)},0)}}}(),o.b("utils",o.a),o.b("utils.arrayForEach",o.a.r),o.b("utils.arrayFirst",o.a.hb),o.b("utils.arrayFilter",o.a.la),o.b("utils.arrayGetDistinctValues",o.a.ib),o.b("utils.arrayIndexOf",o.a.l),o.b("utils.arrayMap",o.a.ya),o.b("utils.arrayPushAll",o.a.$),o.b("utils.arrayRemoveItem",o.a.ma),o.b("utils.extend",o.a.extend),o.b("utils.fieldsIncludedWithJsonPost",o.a.mb),o.b("utils.getFormFields",o.a.ob),o.b("utils.peekObservable",o.a.Sa),o.b("utils.postJson",o.a.gc),o.b("utils.parseJson",o.a.fc),o.b("utils.registerEventHandler",o.a.q),o.b("utils.stringifyJson",o.a.Ya),o.b("utils.range",o.a.ic),o.b("utils.toggleDomNodeCssClass",o.a.ua),o.b("utils.triggerEvent",o.a.ha),o.b("utils.unwrapObservable",o.a.c),o.b("utils.objectForEach",o.a.A),o.b("utils.addOrRemoveItem",o.a.Y),o.b("unwrap",o.a.c),Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,n=Array.prototype.slice.call(arguments);return e=n.shift(),function(){return t.apply(e,n.concat(Array.prototype.slice.call(arguments)))}}),o.a.f=new function(){function e(e,i){var s=e[n];if(!s||"null"===s||!r[s]){if(!i)return p;s=e[n]="ko"+t++,r[s]={}}return r[s]}var t=0,n="__ko__"+(new Date).getTime(),r={};return{get:function(t,n){var r=e(t,!1);return r===p?p:r[n]},set:function(t,n,r){if(r!==p||e(t,!1)!==p)e(t,!0)[n]=r},clear:function(e){var t=e[n];return t?(delete r[t],e[n]=null,!0):!1},L:function(){return t++ +n}}},o.b("utils.domData",o.a.f),o.b("utils.domData.clear",o.a.f.clear),o.a.u=new function(){function e(e,t){var n=o.a.f.get(e,r);return n===p&&t&&(n=[],o.a.f.set(e,r,n)),n}function n(t){var r=e(t,!1);if(r)for(var r=r.slice(0),i=0;i<r.length;i++)r[i](t);o.a.f.clear(t),o.a.u.cleanExternalData(t);if(s[t.nodeType])for(r=t.firstChild;t=r;)r=t.nextSibling,8===t.nodeType&&n(t)}var r=o.a.f.L(),i={1:!0,8:!0,9:!0},s={1:!0,9:!0};return{ja:function(t,n){if("function"!=typeof n)throw Error("Callback must be a function");e(t,!0).push(n)},Ab:function(t,n){var i=e(t,!1);i&&(o.a.ma(i,n),0==i.length&&o.a.f.set(t,r,p))},M:function(e){if(i[e.nodeType]&&(n(e),s[e.nodeType])){var t=[];o.a.$(t,e.getElementsByTagName("*"));for(var r=0,u=t.length;r<u;r++)n(t[r])}return e},removeNode:function(e){o.M(e),e.parentNode&&e.parentNode.removeChild(e)},cleanExternalData:function(e){t&&"function"==typeof t.cleanData&&t.cleanData([e])}}},o.M=o.a.u.M,o.removeNode=o.a.u.removeNode,o.b("cleanNode",o.M),o.b("removeNode",o.removeNode),o.b("utils.domNodeDisposal",o.a.u),o.b("utils.domNodeDisposal.addDisposeCallback",o.a.u.ja),o.b("utils.domNodeDisposal.removeDisposeCallback",o.a.u.Ab),function(){o.a.Qa=function(e){var n;if(t){if(t.parseHTML)n=t.parseHTML(e)||[];else if((n=t.clean([e]))&&n[0]){for(e=n[0];e.parentNode&&11!==e.parentNode.nodeType;)e=e.parentNode;e.parentNode&&e.parentNode.removeChild(e)}}else{var r=o.a.ta(e).toLowerCase();n=w.createElement("div"),r=r.match(/^<(thead|tbody|tfoot)/)&&[1,"<table>","</table>"]||!r.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!r.indexOf("<td")||!r.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""],e="ignored<div>"+r[1]+e+r[2]+"</div>";for("function"==typeof A.innerShiv?n.appendChild(A.innerShiv(e)):n.innerHTML=e;r[0]--;)n=n.lastChild;n=o.a.R(n.lastChild.childNodes)}return n},o.a.Va=function(e,n){o.a.Fa(e),n=o.a.c(n);if(null!==n&&n!==p)if("string"!=typeof n&&(n=n.toString()),t)t(e).html(n);else for(var r=o.a.Qa(n),i=0;i<r.length;i++)e.appendChild(r[i])}}(),o.b("utils.parseHtmlFragment",o.a.Qa),o.b("utils.setHtml",o.a.Va),o.w=function(){function e(t,n){if(t)if(8==t.nodeType){var r=o.w.xb(t.nodeValue);null!=r&&n.push({Rb:t,cc:r})}else if(1==t.nodeType)for(var r=0,i=t.childNodes,s=i.length;r<s;r++)e(i[r],n)}var t={};return{Na:function(e){if("function"!=typeof e)throw Error("You can only pass a function to ko.memoization.memoize()");var n=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return t[n]=e,"<!--[ko_memo:"+n+"]-->"},Hb:function(e,n){var r=t[e];if(r===p)throw Error("Couldn't find any memo with ID "+e+". Perhaps it's already been unmemoized.");try{return r.apply(null,n||[]),!0}finally{delete t[e]}},Ib:function(t,n){var r=[];e(t,r);for(var i=0,s=r.length;i<s;i++){var u=r[i].Rb,a=[u];n&&o.a.$(a,n),o.w.Hb(r[i].cc,a),u.nodeValue="",u.parentNode&&u.parentNode.removeChild(u)}},xb:function(e){return(e=e.match(/^\[ko_memo\:(.*?)\]$/))?e[1]:null}}}(),o.b("memoization",o.w),o.b("memoization.memoize",o.w.Na),o.b("memoization.unmemoize",o.w.Hb),o.b("memoization.parseMemoText",o.w.xb),o.b("memoization.unmemoizeDomNodeAndDescendants",o.w.Ib),o.Ga={throttle:function(e,t){e.throttleEvaluation=t;var n=null;return o.h({read:e,write:function(r){clearTimeout(n),n=setTimeout(function(){e(r)},t)}})},rateLimit:function(e,t){var n,s,o;"number"==typeof t?n=t:(n=t.timeout,s=t.method),o="notifyWhenChangesStop"==s?i:r,e.Ma(function(e){return o(e,n)})},notify:function(e,t){e.equalityComparer="always"==t?null:n}};var u={"undefined":1,"boolean":1,number:1,string:1};o.b("extenders",o.Ga),o.Fb=function(e,t,n){this.target=e,this.za=t,this.Qb=n,this.sb=!1,o.s(this,"dispose",this.F)},o.Fb.prototype.F=function(){this.sb=!0,this.Qb()},o.N=function(){o.a.sa(this,o.N.fn),this.H={}};var a="change";e={V:function(e,t,n){var r=this;n=n||a;var i=new o.Fb(r,t?e.bind(t):e,function(){o.a.ma(r.H[n],i)});return r.o&&r.o(),r.H[n]||(r.H[n]=[]),r.H[n].push(i),i},notifySubscribers:function(e,t){t=t||a;if(this.qb(t))try{o.k.jb();for(var n=this.H[t].slice(0),r=0,i;i=n[r];++r)i.sb||i.za(e)}finally{o.k.end()}},Ma:function(e){var t=this,n=o.v(t),r,i,s;t.ia||(t.ia=t.notifySubscribers,t.notifySubscribers=function(e,n){n&&n!==a?"beforeChange"===n?t.bb(e):t.ia(e,n):t.cb(e)});var u=e(function(){n&&s===t&&(s=t()),r=!1,t.Ka(i,s)&&t.ia(i=s)});t.cb=function(e){r=!0,s=e,u()},t.bb=function(e){r||(i=e,t.ia(e,"beforeChange"))}},qb:function(e){return this.H[e]&&this.H[e].length},Wb:function(){var e=0;return o.a.A(this.H,function(t,n){e+=n.length}),e},Ka:function(e,t){return!this.equalityComparer||!this.equalityComparer(e,t)},extend:function(e){var t=this;return e&&o.a.A(e,function(e,n){var r=o.Ga[e];"function"==typeof r&&(t=r(t,n)||t)}),t}},o.s(e,"subscribe",e.V),o.s(e,"extend",e.extend),o.s(e,"getSubscriptionsCount",e.Wb),o.a.na&&o.a.ra(e,Function.prototype),o.N.fn=e,o.tb=function(e){return null!=e&&"function"==typeof e.V&&"function"==typeof e.notifySubscribers},o.b("subscribable",o.N),o.b("isSubscribable",o.tb),o.ca=o.k=function(){function e(e){n.push(r),r=e}function t(){r=n.pop()}var n=[],r,i=0;return{jb:e,end:t,zb:function(e){if(r){if(!o.tb(e))throw Error("Only subscribable things can act as dependencies");r.za(e,e.Kb||(e.Kb=++i))}},t:function(n,r,i){try{return e(),n.apply(r,i||[])}finally{t()}},fa:function(){if(r)return r.ba.fa()},pa:function(){if(r)return r.pa}}}(),o.b("computedContext",o.ca),o.b("computedContext.getDependenciesCount",o.ca.fa),o.b("computedContext.isInitial",o.ca.pa),o.m=function(e){function t(){return 0<arguments.length?(t.Ka(n,arguments[0])&&(t.P(),n=arguments[0],t.O()),this):(o.k.zb(t),n)}var n=e;return o.N.call(t),o.a.sa(t,o.m.fn),t.o=function(){return n},t.O=function(){t.notifySubscribers(n)},t.P=function(){t.notifySubscribers(n,"beforeChange")},o.s(t,"peek",t.o),o.s(t,"valueHasMutated",t.O),o.s(t,"valueWillMutate",t.P),t},o.m.fn={equalityComparer:n};var f=o.m.hc="__ko_proto__";o.m.fn[f]=o.m,o.a.na&&o.a.ra(o.m.fn,o.N.fn),o.Ha=function(e,t){return null===e||e===p||e[f]===p?!1:e[f]===t?!0:o.Ha(e[f],t)},o.v=function(e){return o.Ha(e,o.m)},o.ub=function(e){return"function"==typeof e&&e[f]===o.m||"function"==typeof e&&e[f]===o.h&&e.Yb?!0:!1},o.b("observable",o.m),o.b("isObservable",o.v),o.b("isWriteableObservable",o.ub),o.T=function(e){e=e||[];if("object"==typeof e&&"length"in e)return e=o.m(e),o.a.sa(e,o.T.fn),e.extend({trackArrayChanges:!0});throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.")},o.T.fn={remove:function(e){for(var t=this.o(),n=[],r="function"!=typeof e||o.v(e)?function(t){return t===e}:e,i=0;i<t.length;i++){var s=t[i];r(s)&&(0===n.length&&this.P(),n.push(s),t.splice(i,1),i--)}return n.length&&this.O(),n},removeAll:function(e){if(e===p){var t=this.o(),n=t.slice(0);return this.P(),t.splice(0,t.length),this.O(),n}return e?this.remove(function(t){return 0<=o.a.l(e,t)}):[]},destroy:function(e){var t=this.o(),n="function"!=typeof e||o.v(e)?function(t){return t===e}:e;this.P();for(var r=t.length-1;0<=r;r--)n(t[r])&&(t[r]._destroy=!0);this.O()},destroyAll:function(e){return e===p?this.destroy(function(){return!0}):e?this.destroy(function(t){return 0<=o.a.l(e,t)}):[]},indexOf:function(e){var t=this();return o.a.l(t,e)},replace:function(e,t){var n=this.indexOf(e);0<=n&&(this.P(),this.o()[n]=t,this.O())}},o.a.r("pop push reverse shift sort splice unshift".split(" "),function(e){o.T.fn[e]=function(){var t=this.o();return this.P(),this.kb(t,e,arguments),t=t[e].apply(t,arguments),this.O(),t}}),o.a.r(["slice"],function(e){o.T.fn[e]=function(){var t=this();return t[e].apply(t,arguments)}}),o.a.na&&o.a.ra(o.T.fn,o.m.fn),o.b("observableArray",o.T);var l="arrayChange";o.Ga.trackArrayChanges=function(e){function t(){if(!n){n=!0;var t=e.notifySubscribers;e.notifySubscribers=function(e,n){return n&&n!==a||++i,t.apply(this,arguments)};var s=[].concat(e.o()||[]);r=null,e.V(function(t){t=[].concat(t||[]);if(e.qb(l)){var n;if(!r||1<i)r=o.a.Aa(s,t,{sparse:!0});n=r,n.length&&e.notifySubscribers(n,l)}s=t,r=null,i=0})}}if(!e.kb){var n=!1,r=null,i=0,s=e.V;e.V=e.subscribe=function(e,n,r){return r===l&&t(),s.apply(this,arguments)},e.kb=function(e,t,s){function u(e,t,n){return a[a.length]={status:e,value:t,index:n}}if(n&&!i){var a=[],f=e.length,l=s.length,c=0;switch(t){case"push":c=f;case"unshift":for(t=0;t<l;t++)u("added",s[t],c+t);break;case"pop":c=f-1;case"shift":f&&u("deleted",e[c],c);break;case"splice":t=Math.min(Math.max(0,0>s[0]?f+s[0]:s[0]),f);for(var f=1===l?f:Math.min(t+(s[1]||0),f),l=t+l-2,c=Math.max(f,l),h=[],p=[],v=2;t<c;++t,++v)t<f&&p.push(u("deleted",e[t],t)),t<l&&h.push(u("added",s[v],t));o.a.nb(p,h);break;default:return}r=a}}}},o.ba=o.h=function(e,t,n){function r(){p=!0,o.a.A(w,function(e,t){t.F()}),w={},E=0,l=!1}function i(){var e=u.throttleEvaluation;e&&0<=e?(clearTimeout(S),S=setTimeout(s,e)):u.wa?u.wa():s()}function s(){if(!c&&!p){if(y&&y()){if(!h){b();return}}else h=!1;c=!0;try{var e=w,n=E;o.k.jb({za:function(t,r){p||(n&&e[r]?(w[r]=e[r],++E,delete e[r],--n):w[r]||(w[r]=t.V(i),++E))},ba:u,pa:!E}),w={},E=0;try{var r=t?d.call(t):d()}finally{o.k.end(),n&&o.a.A(e,function(e,t){t.F()}),l=!1}u.Ka(f,r)&&(u.notifySubscribers(f,"beforeChange"),f=r,u.wa&&!u.throttleEvaluation||u.notifySubscribers(f))}finally{c=!1}E||b()}}function u(){if(0<arguments.length){if("function"!=typeof v)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 v.apply(t,arguments),this}return l&&s(),o.k.zb(u),f}function a(){return l||0<E}var f,l=!0,c=!1,h=!1,p=!1,d=e;d&&"object"==typeof d?(n=d,d=n.read):(n=n||{},d||(d=n.read));if("function"!=typeof d)throw Error("Pass a function that returns the value of the ko.computed");var v=n.write,m=n.disposeWhenNodeIsRemoved||n.G||null,g=n.disposeWhen||n.Da,y=g,b=r,w={},E=0,S=null;t||(t=n.owner),o.N.call(u),o.a.sa(u,o.h.fn),u.o=function(){return l&&!E&&s(),f},u.fa=function(){return E},u.Yb="function"==typeof n.write,u.F=function(){b()},u.ga=a;var x=u.Ma;return u.Ma=function(e){x.call(u,e),u.wa=function(){u.bb(f),l=!0,u.cb(u)}},o.s(u,"peek",u.o),o.s(u,"dispose",u.F),o.s(u,"isActive",u.ga),o.s(u,"getDependenciesCount",u.fa),m&&(h=!0,m.nodeType&&(y=function(){return!o.a.Ea(m)||g&&g()})),!0!==n.deferEvaluation&&s(),m&&a()&&m.nodeType&&(b=function(){o.a.u.Ab(m,b),r()},o.a.u.ja(m,b)),u},o.$b=function(e){return o.Ha(e,o.h)},e=o.m.hc,o.h[e]=o.m,o.h.fn={equalityComparer:n},o.h.fn[e]=o.h,o.a.na&&o.a.ra(o.h.fn,o.N.fn),o.b("dependentObservable",o.h),o.b("computed",o.h),o.b("isComputed",o.$b),function(){function e(r,i,s){s=s||new n,r=i(r);if("object"!=typeof r||null===r||r===p||r instanceof Date||r instanceof String||r instanceof Number||r instanceof Boolean)return r;var o=r instanceof Array?[]:{};return s.save(r,o),t(r,function(t){var n=i(r[t]);switch(typeof n){case"boolean":case"number":case"string":case"function":o[t]=n;break;case"object":case"undefined":var u=s.get(n);o[t]=u!==p?u:e(n,i,s)}}),o}function t(e,t){if(e instanceof Array){for(var n=0;n<e.length;n++)t(n);"function"==typeof e.toJSON&&t("toJSON")}else for(n in e)t(n)}function n(){this.keys=[],this.ab=[]}o.Gb=function(t){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return e(t,function(e){for(var t=0;o.v(e)&&10>t;t++)e=e();return e})},o.toJSON=function(e,t,n){return e=o.Gb(e),o.a.Ya(e,t,n)},n.prototype={save:function(e,t){var n=o.a.l(this.keys,e);0<=n?this.ab[n]=t:(this.keys.push(e),this.ab.push(t))},get:function(e){return e=o.a.l(this.keys,e),0<=e?this.ab[e]:p}}}(),o.b("toJS",o.Gb),o.b("toJSON",o.toJSON),function(){o.i={p:function(e){switch(o.a.B(e)){case"option":return!0===e.__ko__hasDomDataOptionValue__?o.a.f.get(e,o.d.options.Pa):7>=o.a.oa?e.getAttributeNode("value")&&e.getAttributeNode("value").specified?e.value:e.text:e.value;case"select":return 0<=e.selectedIndex?o.i.p(e.options[e.selectedIndex]):p;default:return e.value}},X:function(e,t,n){switch(o.a.B(e)){case"option":switch(typeof t){case"string":o.a.f.set(e,o.d.options.Pa,p),"__ko__hasDomDataOptionValue__"in e&&delete e.__ko__hasDomDataOptionValue__,e.value=t;break;default:o.a.f.set(e,o.d.options.Pa,t),e.__ko__hasDomDataOptionValue__=!0,e.value="number"==typeof t?t:""}break;case"select":if(""===t||null===t)t=p;for(var r=-1,i=0,s=e.options.length,u;i<s;++i)if(u=o.i.p(e.options[i]),u==t||""==u&&t===p){r=i;break}if(n||0<=r||t===p&&1<e.size)e.selectedIndex=r;break;default:if(null===t||t===p)t="";e.value=t}}}}(),o.b("selectExtensions",o.i),o.b("selectExtensions.readValue",o.i.p),o.b("selectExtensions.writeValue",o.i.X),o.g=function(){function e(e){e=o.a.ta(e),123===e.charCodeAt(0)&&(e=e.slice(1,-1));var t=[],n=e.match(r),u,a,f=0;if(n){n.push(",");for(var l=0,c;c=n[l];++l){var h=c.charCodeAt(0);if(44===h){if(0>=f){u&&t.push(a?{key:u,value:a.join("")}:{unknown:u}),u=a=f=0;continue}}else if(58===h){if(!a)continue}else if(47===h&&l&&1<c.length)(h=n[l-1].match(i))&&!s[h[0]]&&(e=e.substr(e.indexOf(c)+1),n=e.match(r),n.push(","),l=-1,c="/");else if(40===h||123===h||91===h)++f;else if(41===h||125===h||93===h)--f;else if(!u&&!a){u=34===h||39===h?c.slice(1,-1):c;continue}a?a.push(c):a=[c]}}return t}var t=["true","false","null","undefined"],n=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,r=RegExp("\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|/(?:[^/\\\\]|\\\\.)*/w*|[^\\s:,/][^,\"'{}()/:[\\]]*[^\\s,\"'{}()/:[\\]]|[^\\s]","g"),i=/[\])"'A-Za-z0-9_$]+$/,s={"in":1,"return":1,"typeof":1},u={};return{aa:[],W:u,Ra:e,qa:function(r,i){function s(e,r){var i,c=o.getBindingHandler(e);if(c&&c.preprocess?r=c.preprocess(r,e,s):1){if(c=u[e])i=r,0<=o.a.l(t,i)?i=!1:(c=i.match(n),i=null===c?!1:c[1]?"Object("+c[1]+")"+c[2]:i),c=i;c&&f.push("'"+e+"':function(_z){"+i+"=_z}"),l&&(r="function(){return "+r+" }"),a.push("'"+e+"':"+r)}}i=i||{};var a=[],f=[],l=i.valueAccessors,c="string"==typeof r?e(r):r;return o.a.r(c,function(e){s(e.key||e.unknown,e.value)}),f.length&&s("_ko_property_writers","{"+f.join(",")+" }"),a.join(",")},bc:function(e,t){for(var n=0;n<e.length;n++)if(e[n].key==t)return!0;return!1},va:function(e,t,n,r,i){e&&o.v(e)?!o.ub(e)||i&&e.o()===r||e(r):(e=t.get("_ko_property_writers"))&&e[n]&&e[n](r)}}}(),o.b("expressionRewriting",o.g),o.b("expressionRewriting.bindingRewriteValidators",o.g.aa),o.b("expressionRewriting.parseObjectLiteral",o.g.Ra),o.b("expressionRewriting.preProcessBindings",o.g.qa),o.b("expressionRewriting._twoWayBindings",o.g.W),o.b("jsonExpressionRewriting",o.g),o.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",o.g.qa),function(){function e(e){return 8==e.nodeType&&s.test(i?e.text:e.nodeValue)}function t(e){return 8==e.nodeType&&u.test(i?e.text:e.nodeValue)}function n(n,r){for(var i=n,s=1,o=[];i=i.nextSibling;){if(t(i)&&(s--,0===s))return o;o.push(i),e(i)&&s++}if(!r)throw Error("Cannot find closing comment tag to match: "+n.nodeValue);return null}function r(e,t){var r=n(e,t);return r?0<r.length?r[r.length-1].nextSibling:e.nextSibling:null}var i=w&&"<!--test-->"===w.createComment("test").text,s=i?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,u=i?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,a={ul:!0,ol:!0};o.e={Q:{},childNodes:function(t){return e(t)?n(t):t.childNodes},da:function(t){if(e(t)){t=o.e.childNodes(t);for(var n=0,r=t.length;n<r;n++)o.removeNode(t[n])}else o.a.Fa(t)},U:function(t,n){if(e(t)){o.e.da(t);for(var r=t.nextSibling,i=0,s=n.length;i<s;i++)r.parentNode.insertBefore(n[i],r)}else o.a.U(t,n)},yb:function(t,n){e(t)?t.parentNode.insertBefore(n,t.nextSibling):t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)},rb:function(t,n,r){r?e(t)?t.parentNode.insertBefore(n,r.nextSibling):r.nextSibling?t.insertBefore(n,r.nextSibling):t.appendChild(n):o.e.yb(t,n)},firstChild:function(n){return e(n)?!n.nextSibling||t(n.nextSibling)?null:n.nextSibling:n.firstChild},nextSibling:function(n){return e(n)&&(n=r(n)),n.nextSibling&&t(n.nextSibling)?null:n.nextSibling},Xb:e,lc:function(e){return(e=(i?e.text:e.nodeValue).match(s))?e[1]:null},wb:function(n){if(a[o.a.B(n)]){var i=n.firstChild;if(i)do if(1===i.nodeType){var s;s=i.firstChild;var u=null;if(s)do if(u)u.push(s);else if(e(s)){var f=r(s,!0);f?s=f:u=[s]}else t(s)&&(u=[s]);while(s=s.nextSibling);if(s=u)for(u=i.nextSibling,f=0;f<s.length;f++)u?n.insertBefore(s[f],u):n.appendChild(s[f])}while(i=i.nextSibling)}}}}(),o.b("virtualElements",o.e),o.b("virtualElements.allowedBindings",o.e.Q),o.b("virtualElements.emptyNode",o.e.da),o.b("virtualElements.insertAfter",o.e.rb),o.b("virtualElements.prepend",o.e.yb),o.b("virtualElements.setDomNodeChildren",o.e.U),function(){o.J=function(){this.Nb={}},o.a.extend(o.J.prototype,{nodeHasBindings:function(e){switch(e.nodeType){case 1:return null!=e.getAttribute("data-bind");case 8:return o.e.Xb(e);default:return!1}},getBindings:function(e,t){var n=this.getBindingsString(e,t);return n?this.parseBindingsString(n,t,e):null},getBindingAccessors:function(e,t){var n=this.getBindingsString(e,t);return n?this.parseBindingsString(n,t,e,{valueAccessors:!0}):null},getBindingsString:function(e){switch(e.nodeType){case 1:return e.getAttribute("data-bind");case 8:return o.e.lc(e);default:return null}},parseBindingsString:function(e,t,n,r){try{var i=this.Nb,s=e+(r&&r.valueAccessors||""),u;if(!(u=i[s])){var a,f="with($context){with($data||{}){return{"+o.g.qa(e,r)+"}}}";a=new Function("$context","$element",f),u=i[s]=a}return u(t,n)}catch(l){throw l.message="Unable to parse bindings.\nBindings value: "+e+"\nMessage: "+l.message,l}}}),o.J.instance=new o.J}(),o.b("bindingProvider",o.J),function(){function e(e){return function(){return e}}function n(e){return e()}function r(e){return o.a.Oa(o.k.t(e),function(t,n){return function(){return e()[n]}})}function i(e,t){return r(this.getBindings.bind(this,e,t))}function s(e,t,n){var r,i=o.e.firstChild(t),s=o.J.instance,a=s.preprocessNode;if(a){for(;r=i;)i=o.e.nextSibling(r),a.call(s,r);i=o.e.firstChild(t)}for(;r=i;)i=o.e.nextSibling(r),u(e,r,n)}function u(e,t,n){var r=!0,i=1===t.nodeType;i&&o.e.wb(t);if(i&&n||o.J.instance.nodeHasBindings(t))r=f(t,null,e,n).shouldBindDescendants;r&&!c[o.a.B(t)]&&s(e,t,!i)}function a(e){var t=[],n={},r=[];return o.a.A(e,function i(s){if(!n[s]){var u=o.getBindingHandler(s);u&&(u.after&&(r.push(s),o.a.r(u.after,function(t){if(e[t]){if(-1!==o.a.l(r,t))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+r.join(", "));i(t)}}),r.length--),t.push({key:s,pb:u})),n[s]=!0}}),t}function f(e,t,r,s){var u=o.a.f.get(e,h);if(!t){if(u)throw Error("You cannot apply bindings multiple times to the same element.");o.a.f.set(e,h,!0)}!u&&s&&o.Eb(e,r);var f;if(t&&"function"!=typeof t)f=t;else{var l=o.J.instance,c=l.getBindingAccessors||i,d=o.h(function(){return(f=t?t(r,e):c.call(l,e,r))&&r.D&&r.D(),f},null,{G:e});f&&d.ga()||(d=null)}var v;if(f){var m=d?function(e){return function(){return n(d()[e])}}:function(e){return f[e]},y=function(){return o.a.Oa(d?d():f,n)};y.get=function(e){return f[e]&&n(m(e))},y.has=function(e){return e in f},s=a(f),o.a.r(s,function(t){var n=t.pb.init,i=t.pb.update,s=t.key;if(8===e.nodeType&&!o.e.Q[s])throw Error("The binding '"+s+"' cannot be used with virtual elements");try{"function"==typeof n&&o.k.t(function(){var t=n(e,m(s),y,r.$data,r);if(t&&t.controlsDescendantBindings){if(v!==p)throw Error("Multiple bindings ("+v+" and "+s+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");v=s}}),"function"==typeof i&&o.h(function(){i(e,m(s),y,r.$data,r)},null,{G:e})}catch(u){throw u.message='Unable to process binding "'+s+": "+f[s]+'"\nMessage: '+u.message,u}})}return{shouldBindDescendants:v===p}}function l(e){return e&&e instanceof o.I?e:new o.I(e)}o.d={};var c={script:!0};o.getBindingHandler=function(e){return o.d[e]},o.I=function(e,t,n,r){var i=this,s="function"==typeof e&&!o.v(e),u,a=o.h(function(){var u=s?e():e,f=o.a.c(u);return t?(t.D&&t.D(),o.a.extend(i,t),a&&(i.D=a)):(i.$parents=[],i.$root=f,i.ko=o),i.$rawData=u,i.$data=f,n&&(i[n]=f),r&&r(i,t,f),i.$data},null,{Da:function(){return u&&!o.a.eb(u)},G:!0});a.ga()&&(i.D=a,a.equalityComparer=null,u=[],a.Jb=function(e){u.push(e),o.a.u.ja(e,function(e){o.a.ma(u,e),u.length||(a.F(),i.D=a=p)})})},o.I.prototype.createChildContext=function(e,t,n){return new o.I(e,this,t,function(e,t){e.$parentContext=t,e.$parent=t.$data,e.$parents=(t.$parents||[]).slice(0),e.$parents.unshift(e.$parent),n&&n(e)})},o.I.prototype.extend=function(e){return new o.I(this.D||this.$data,this,null,function(t,n){t.$rawData=n.$rawData,o.a.extend(t,"function"==typeof e?e():e)})};var h=o.a.f.L(),d=o.a.f.L();o.Eb=function(e,t){if(2!=arguments.length)return o.a.f.get(e,d);o.a.f.set(e,d,t),t.D&&t.D.Jb(e)},o.xa=function(e,t,n){return 1===e.nodeType&&o.e.wb(e),f(e,t,l(n),!0)},o.Lb=function(t,n,i){return i=l(i),o.xa(t,"function"==typeof n?r(n.bind(null,i,t)):o.a.Oa(n,e),i)},o.gb=function(e,t){1!==t.nodeType&&8!==t.nodeType||s(l(e),t,!0)},o.fb=function(e,n){!t&&A.jQuery&&(t=A.jQuery);if(n&&1!==n.nodeType&&8!==n.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");n=n||A.document.body,u(l(e),n,!0)},o.Ca=function(e){switch(e.nodeType){case 1:case 8:var t=o.Eb(e);if(t)return t;if(e.parentNode)return o.Ca(e.parentNode)}return p},o.Pb=function(e){return(e=o.Ca(e))?e.$data:p},o.b("bindingHandlers",o.d),o.b("applyBindings",o.fb),o.b("applyBindingsToDescendants",o.gb),o.b("applyBindingAccessorsToNode",o.xa),o.b("applyBindingsToNode",o.Lb),o.b("contextFor",o.Ca),o.b("dataFor",o.Pb)}();var c={"class":"className","for":"htmlFor"};o.d.attr={update:function(e,t){var n=o.a.c(t())||{};o.a.A(n,function(t,n){n=o.a.c(n);var r=!1===n||null===n||n===p;r&&e.removeAttribute(t),8>=o.a.oa&&t in c?(t=c[t],r?e.removeAttribute(t):e[t]=n):r||e.setAttribute(t,n.toString()),"name"===t&&o.a.Cb(e,r?"":n.toString())})}},function(){o.d.checked={after:["value","attr"],init:function(e,t,n){function r(){return n.has("checkedValue")?o.a.c(n.get("checkedValue")):e.value}function i(){var i=e.checked,s=c?r():i;if(!o.ca.pa()&&(!a||i)){var u=o.k.t(t);f?l!==s?(i&&(o.a.Y(u,s,!0),o.a.Y(u,l,!1)),l=s):o.a.Y(u,s,i):o.g.va(u,n,"checked",s,!0)}}function s(){var n=o.a.c(t());e.checked=f?0<=o.a.l(n,r()):u?n:r()===n}var u="checkbox"==e.type,a="radio"==e.type;if(u||a){var f=u&&o.a.c(t())instanceof Array,l=f?r():p,c=a||f;a&&!e.name&&o.d.uniqueName.init(e,function(){return!0}),o.ba(i,null,{G:e}),o.a.q(e,"click",i),o.ba(s,null,{G:e})}}},o.g.W.checked=!0,o.d.checkedValue={update:function(e,t){e.value=o.a.c(t())}}}(),o.d.css={update:function(e,t){var n=o.a.c(t());"object"==typeof n?o.a.A(n,function(t,n){n=o.a.c(n),o.a.ua(e,t,n)}):(n=String(n||""),o.a.ua(e,e.__ko__cssValue,!1),e.__ko__cssValue=n,o.a.ua(e,n,!0))}},o.d.enable={update:function(e,t){var n=o.a.c(t());n&&e.disabled?e.removeAttribute("disabled"):n||e.disabled||(e.disabled=!0)}},o.d.disable={update:function(e,t){o.d.enable.update(e,function(){return!o.a.c(t())})}},o.d.event={init:function(e,t,n,r,i){var s=t()||{};o.a.A(s,function(s){"string"==typeof s&&o.a.q(e,s,function(e){var u,a=t()[s];if(a){try{var f=o.a.R(arguments);r=i.$data,f.unshift(r),u=a.apply(r,f)}finally{!0!==u&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}!1===n.get(s+"Bubble")&&(e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation())}})})}},o.d.foreach={vb:function(e){return function(){var t=e(),n=o.a.Sa(t);return!n||"number"==typeof n.length?{foreach:t,templateEngine:o.K.Ja}:(o.a.c(t),{foreach:n.data,as:n.as,includeDestroyed:n.includeDestroyed,afterAdd:n.afterAdd,beforeRemove:n.beforeRemove,afterRender:n.afterRender,beforeMove:n.beforeMove,afterMove:n.afterMove,templateEngine:o.K.Ja})}},init:function(e,t){return o.d.template.init(e,o.d.foreach.vb(t))},update:function(e,t,n,r,i){return o.d.template.update(e,o.d.foreach.vb(t),n,r,i)}},o.g.aa.foreach=!1,o.e.Q.foreach=!0,o.d.hasfocus={init:function(e,t,n){function r(r){e.__ko_hasfocusUpdating=!0;var i=e.ownerDocument;if("activeElement"in i){var s;try{s=i.activeElement}catch(u){s=i.body}r=s===e}i=t(),o.g.va(i,n,"hasfocus",r,!0),e.__ko_hasfocusLastValue=r,e.__ko_hasfocusUpdating=!1}var i=r.bind(null,!0),s=r.bind(null,!1);o.a.q(e,"focus",i),o.a.q(e,"focusin",i),o.a.q(e,"blur",s),o.a.q(e,"focusout",s)},update:function(e,t){var n=!!o.a.c(t());e.__ko_hasfocusUpdating||e.__ko_hasfocusLastValue===n||(n?e.focus():e.blur(),o.k.t(o.a.ha,null,[e,n?"focusin":"focusout"]))}},o.g.W.hasfocus=!0,o.d.hasFocus=o.d.hasfocus,o.g.W.hasFocus=!0,o.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){o.a.Va(e,t())}},s("if"),s("ifnot",!1,!0),s("with",!0,!1,function(e,t){return e.createChildContext(t)});var h={};o.d.options={init:function(e){if("select"!==o.a.B(e))throw Error("options binding applies only to SELECT elements");for(;0<e.length;)e.remove(0);return{controlsDescendantBindings:!0}},update:function(e,t,n){function r(){return o.a.la(e.options,function(e){return e.selected})}function i(e,t,n){var r=typeof t;return"function"==r?t(e):"string"==r?e[t]:n}function s(t,n){if(c.length){var r=0<=o.a.l(c,o.i.p(n[0]));o.a.Db(n[0],r),d&&!r&&o.k.t(o.a.ha,null,[e,"change"])}}var u=0!=e.length&&e.multiple?e.scrollTop:null,a=o.a.c(t()),f=n.get("optionsIncludeDestroyed");t={};var l,c;c=e.multiple?o.a.ya(r(),o.i.p):0<=e.selectedIndex?[o.i.p(e.options[e.selectedIndex])]:[],a&&("undefined"==typeof a.length&&(a=[a]),l=o.a.la(a,function(e){return f||e===p||null===e||!o.a.c(e._destroy)}),n.has("optionsCaption")&&(a=o.a.c(n.get("optionsCaption")),null!==a&&a!==p&&l.unshift(h)));var d=!1;t.beforeRemove=function(t){e.removeChild(t)},a=s,n.has("optionsAfterRender")&&(a=function(e,t){s(0,t),o.k.t(n.get("optionsAfterRender"),null,[t[0],e!==h?e:p])}),o.a.Ua(e,l,function(t,r,s){return s.length&&(c=s[0].selected?[o.i.p(s[0])]:[],d=!0),r=e.ownerDocument.createElement("option"),t===h?(o.a.Xa(r,n.get("optionsCaption")),o.i.X(r,p)):(s=i(t,n.get("optionsValue"),t),o.i.X(r,o.a.c(s)),t=i(t,n.get("optionsText"),s),o.a.Xa(r,t)),[r]},t,a),o.k.t(function(){n.get("valueAllowUnset")&&n.has("value")?o.i.X(e,o.a.c(n.get("value")),!0):(e.multiple?c.length&&r().length<c.length:c.length&&0<=e.selectedIndex?o.i.p(e.options[e.selectedIndex])!==c[0]:c.length||0<=e.selectedIndex)&&o.a.ha(e,"change")}),o.a.Tb(e),u&&20<Math.abs(u-e.scrollTop)&&(e.scrollTop=u)}},o.d.options.Pa=o.a.f.L(),o.d.selectedOptions={after:["options","foreach"],init:function(e,t,n){o.a.q(e,"change",function(){var r=t(),i=[];o.a.r(e.getElementsByTagName("option"),function(e){e.selected&&i.push(o.i.p(e))}),o.g.va(r,n,"selectedOptions",i)})},update:function(e,t){if("select"!=o.a.B(e))throw Error("values binding applies only to SELECT elements");var n=o.a.c(t());n&&"number"==typeof n.length&&o.a.r(e.getElementsByTagName("option"),function(e){var t=0<=o.a.l(n,o.i.p(e));o.a.Db(e,t)})}},o.g.W.selectedOptions=!0,o.d.style={update:function(e,t){var n=o.a.c(t()||{});o.a.A(n,function(t,n){n=o.a.c(n),e.style[t]=n||""})}},o.d.submit={init:function(e,t,n,r,i){if("function"!=typeof t())throw Error("The value for a submit binding must be a function");o.a.q(e,"submit",function(n){var r,s=t();try{r=s.call(i.$data,e)}finally{!0!==r&&(n.preventDefault?n.preventDefault():n.returnValue=!1)}})}},o.d.text={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t){o.a.Xa(e,t())}},o.e.Q.text=!0,o.d.uniqueName={init:function(e,t){if(t()){var n="ko_unique_"+ ++o.d.uniqueName.Ob;o.a.Cb(e,n)}}},o.d.uniqueName.Ob=0,o.d.value={after:["options","foreach"],init:function(e,t,n){function r(){u=!1;var r=t(),i=o.i.p(e);o.g.va(r,n,"value",i)}var i=["change"],s=n.get("valueUpdate"),u=!1;s&&("string"==typeof s&&(s=[s]),o.a.$(i,s),i=o.a.ib(i)),!o.a.oa||"input"!=e.tagName.toLowerCase()||"text"!=e.type||"off"==e.autocomplete||e.form&&"off"==e.form.autocomplete||-1!=o.a.l(i,"propertychange")||(o.a.q(e,"propertychange",function(){u=!0}),o.a.q(e,"focus",function(){u=!1}),o.a.q(e,"blur",function(){u&&r()})),o.a.r(i,function(t){var n=r;o.a.kc(t,"after")&&(n=function(){setTimeout(r,0)},t=t.substring(5)),o.a.q(e,t,n)})},update:function(e,t,n){var r=o.a.c(t());t=o.i.p(e);if(r!==t)if("select"===o.a.B(e)){var i=n.get("valueAllowUnset");n=function(){o.i.X(e,r,i)},n(),i||r===o.i.p(e)?setTimeout(n,0):o.k.t(o.a.ha,null,[e,"change"])}else o.i.X(e,r)}},o.g.W.value=!0,o.d.visible={update:function(e,t){var n=o.a.c(t()),r="none"!=e.style.display;n&&!r?e.style.display="":!n&&r&&(e.style.display="none")}},function(e){o.d[e]={init:function(t,n,r,i,s){return o.d.event.init.call(this,t,function(){var t={};return t[e]=n(),t},r,i,s)}}}("click"),o.C=function(){},o.C.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},o.C.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},o.C.prototype.makeTemplateSource=function(e,t){if("string"==typeof e){t=t||w;var n=t.getElementById(e);if(!n)throw Error("Cannot find template with ID "+e);return new o.n.j(n)}if(1==e.nodeType||8==e.nodeType)return new o.n.Z(e);throw Error("Unknown template type: "+e)},o.C.prototype.renderTemplate=function(e,t,n,r){return e=this.makeTemplateSource(e,r),this.renderTemplateSource(e,t,n)},o.C.prototype.isTemplateRewritten=function(e,t){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(e,t).data("isRewritten")},o.C.prototype.rewriteTemplate=function(e,t,n){e=this.makeTemplateSource(e,n),t=t(e.text()),e.text(t),e.data("isRewritten",!0)},o.b("templateEngine",o.C),o.Za=function(){function e(e,t,n,r){e=o.g.Ra(e);for(var i=o.g.aa,s=0;s<e.length;s++){var u=e[s].key;if(i.hasOwnProperty(u)){var a=i[u];if("function"==typeof a){if(u=a(e[s].value))throw Error(u)}else if(!a)throw Error("This template engine does not support the '"+u+"' binding within its templates")}}return n="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+o.g.qa(e,{valueAccessors:!0})+" } })()},'"+n.toLowerCase()+"')",r.createJavaScriptEvaluatorBlock(n)+t}var t=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,n=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{Ub:function(e,t,n){t.isTemplateRewritten(e,n)||t.rewriteTemplate(e,function(e){return o.Za.dc(e,t)},n)},dc:function(r,i){return r.replace(t,function(t,n,r,s,o){return e(o,n,r,i)}).replace(n,function(t,n){return e(n,"<!-- ko -->","#comment",i)})},Mb:function(e,t){return o.w.Na(function(n,r){var i=n.nextSibling;i&&i.nodeName.toLowerCase()===t&&o.xa(i,e,r)})}}}(),o.b("__tr_ambtns",o.Za.Mb),function(){o.n={},o.n.j=function(e){this.j=e},o.n.j.prototype.text=function(){var e=o.a.B(this.j),e="script"===e?"text":"textarea"===e?"value":"innerHTML";if(0==arguments.length)return this.j[e];var t=arguments[0];"innerHTML"===e?o.a.Va(this.j,t):this.j[e]=t};var e=o.a.f.L()+"_";o.n.j.prototype.data=function(t){if(1===arguments.length)return o.a.f.get(this.j,e+t);o.a.f.set(this.j,e+t,arguments[1])};var t=o.a.f.L();o.n.Z=function(e){this.j=e},o.n.Z.prototype=new o.n.j,o.n.Z.prototype.text=function(){if(0==arguments.length){var e=o.a.f.get(this.j,t)||{};return e.$a===p&&e.Ba&&(e.$a=e.Ba.innerHTML),e.$a}o.a.f.set(this.j,t,{$a:arguments[0]})},o.n.j.prototype.nodes=function(){if(0==arguments.length)return(o.a.f.get(this.j,t)||{}).Ba;o.a.f.set(this.j,t,{Ba:arguments[0]})},o.b("templateSources",o.n),o.b("templateSources.domElement",o.n.j),o.b("templateSources.anonymousTemplate",o.n.Z)}(),function(){function e(e,t,n){var r;for(t=o.e.nextSibling(t);e&&(r=e)!==t;)e=o.e.nextSibling(r),n(r,e)}function t(t,n){if(t.length){var r=t[0],i=t[t.length-1],s=r.parentNode,u=o.J.instance,a=u.preprocessNode;if(a){e(r,i,function(e,t){var n=e.previousSibling,s=a.call(u,e);s&&(e===r&&(r=s[0]||t),e===i&&(i=s[s.length-1]||n))}),t.length=0;if(!r)return;r===i?t.push(r):(t.push(r,i),o.a.ea(t,s))}e(r,i,function(e){1!==e.nodeType&&8!==e.nodeType||o.fb(n,e)}),e(r,i,function(e){1!==e.nodeType&&8!==e.nodeType||o.w.Ib(e,[n])}),o.a.ea(t,s)}}function n(e){return e.nodeType?e:0<e.length?e[0]:null}function r(e,r,s,u,a){a=a||{};var f=e&&n(e),f=f&&f.ownerDocument,l=a.templateEngine||i;o.Za.Ub(s,l,f),s=l.renderTemplate(s,u,a,f);if("number"!=typeof s.length||0<s.length&&"number"!=typeof s[0].nodeType)throw Error("Template engine must return an array of DOM nodes");f=!1;switch(r){case"replaceChildren":o.e.U(e,s),f=!0;break;case"replaceNode":o.a.Bb(e,s),f=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+r)}return f&&(t(s,u),a.afterRender&&o.k.t(a.afterRender,null,[s,u.$data])),s}var i;o.Wa=function(e){if(!(e==p||e instanceof o.C))throw Error("templateEngine must inherit from ko.templateEngine");i=e},o.Ta=function(e,t,s,u,a){s=s||{};if((s.templateEngine||i)==p)throw Error("Set a template engine before calling renderTemplate");a=a||"replaceChildren";if(u){var f=n(u);return o.h(function(){var i=t&&t instanceof o.I?t:new o.I(o.a.c(t)),l=o.v(e)?e():"function"==typeof e?e(i.$data,i):e,i=r(u,a,l,i,s);"replaceNode"==a&&(u=i,f=n(u))},null,{Da:function(){return!f||!o.a.Ea(f)},G:f&&"replaceNode"==a?f.parentNode:f})}return o.w.Na(function(n){o.Ta(e,t,s,n,"replaceNode")})},o.jc=function(e,n,i,s,u){function a(e,n){t(n,l),i.afterRender&&i.afterRender(n,e)}function f(t,n){l=u.createChildContext(t,i.as,function(e){e.$index=n});var s="function"==typeof e?e(t,l):e;return r(null,"ignoreTargetNode",s,l,i)}var l;return o.h(function(){var e=o.a.c(n)||[];"undefined"==typeof e.length&&(e=[e]),e=o.a.la(e,function(e){return i.includeDestroyed||e===p||null===e||!o.a.c(e._destroy)}),o.k.t(o.a.Ua,null,[s,e,f,i,a])},null,{G:s})};var s=o.a.f.L();o.d.template={init:function(e,t){var n=o.a.c(t());return"string"==typeof n||n.name?o.e.da(e):(n=o.e.childNodes(e),n=o.a.ec(n),(new o.n.Z(e)).nodes(n)),{controlsDescendantBindings:!0}},update:function(e,t,n,r,i){var u=t(),a;t=o.a.c(u),n=!0,r=null,"string"==typeof t?t={}:(u=t.name,"if"in t&&(n=o.a.c(t["if"])),n&&"ifnot"in t&&(n=!o.a.c(t.ifnot)),a=o.a.c(t.data)),"foreach"in t?r=o.jc(u||e,n&&t.foreach||[],t,e,i):n?(i="data"in t?i.createChildContext(a,t.as):i,r=o.Ta(u||e,i,t,e)):o.e.da(e),i=r,(a=o.a.f.get(e,s))&&"function"==typeof a.F&&a.F(),o.a.f.set(e,s,i&&i.ga()?i:p)}},o.g.aa.template=function(e){return e=o.g.Ra(e),1==e.length&&e[0].unknown||o.g.bc(e,"name")?null:"This template engine does not support anonymous templates nested within its templates"},o.e.Q.template=!0}(),o.b("setTemplateEngine",o.Wa),o.b("renderTemplate",o.Ta),o.a.nb=function(e,t,n){if(e.length&&t.length){var r,i,s,o,u;for(r=i=0;(!n||r<n)&&(o=e[i]);++i){for(s=0;u=t[s];++s)if(o.value===u.value){o.moved=u.index,u.moved=o.index,t.splice(s,1),r=s=0;break}r+=s}}},o.a.Aa=function(){function e(e,t,n,r,i){var s=Math.min,u=Math.max,a=[],f,l=e.length,c,h=t.length,p=h-l||1,d=l+h+1,v,m,g;for(f=0;f<=l;f++)for(m=v,a.push(v=[]),g=s(h,f+p),c=u(0,f-1);c<=g;c++)v[c]=c?f?e[f-1]===t[c-1]?m[c-1]:s(m[c]||d,v[c-1]||d)+1:c+1:f+1;s=[],u=[],p=[],f=l;for(c=h;f||c;)h=a[f][c]-1,c&&h===a[f][c-1]?u.push(s[s.length]={status:n,value:t[--c],index:c}):f&&h===a[f-1][c]?p.push(s[s.length]={status:r,value:e[--f],index:f}):(--c,--f,i.sparse||s.push({status:"retained",value:t[c]}));return o.a.nb(u,p,10*l),s.reverse()}return function(t,n,r){return r="boolean"==typeof r?{dontLimitMoves:r}:r||{},t=t||[],n=n||[],t.length<=n.length?e(t,n,"added","deleted",r):e(n,t,"deleted","added",r)}}(),o.b("utils.compareArrays",o.a.Aa),function(){function e(e,t,n,r,i){var s=[],u=o.h(function(){var u=t(n,i,o.a.ea(s,e))||[];0<s.length&&(o.a.Bb(s,u),r&&o.k.t(r,null,[n,u,i])),s.length=0,o.a.$(s,u)},null,{G:e,Da:function(){return!o.a.eb(s)}});return{S:s,h:u.ga()?u:p}}var t=o.a.f.L();o.a.Ua=function(n,r,i,s,u){function a(e,t){S=c[t],g!==t&&(E[e]=S),S.Ia(g++),o.a.ea(S.S,n),v.push(S),w.push(S)}function f(e,t){if(e)for(var n=0,r=t.length;n<r;n++)t[n]&&o.a.r(t[n].S,function(r){e(r,n,t[n].ka)})}r=r||[],s=s||{};var l=o.a.f.get(n,t)===p,c=o.a.f.get(n,t)||[],h=o.a.ya(c,function(e){return e.ka}),d=o.a.Aa(h,r,s.dontLimitMoves),v=[],m=0,g=0,y=[],w=[];r=[];for(var E=[],h=[],S,x=0,T,N;T=d[x];x++)switch(N=T.moved,T.status){case"deleted":N===p&&(S=c[m],S.h&&S.h.F(),y.push.apply(y,o.a.ea(S.S,n)),s.beforeRemove&&(r[x]=S,w.push(S))),m++;break;case"retained":a(x,m++);break;case"added":N!==p?a(x,N):(S={ka:T.value,Ia:o.m(g++)},v.push(S),w.push(S),l||(h[x]=S))}f(s.beforeMove,E),o.a.r(y,s.beforeRemove?o.M:o.removeNode);for(var x=0,l=o.e.firstChild(n),C;S=w[x];x++){S.S||o.a.extend(S,e(n,i,S.ka,u,S.Ia));for(m=0;d=S.S[m];l=d.nextSibling,C=d,m++)d!==l&&o.e.rb(n,d,C);!S.Zb&&u&&(u(S.ka,S.S,S.Ia),S.Zb=!0)}f(s.beforeRemove,r),f(s.afterMove,E),f(s.afterAdd,h),o.a.f.set(n,t,v)}}(),o.b("utils.setDomNodeChildrenFromArrayMapping",o.a.Ua),o.K=function(){this.allowTemplateRewriting=!1},o.K.prototype=new o.C,o.K.prototype.renderTemplateSource=function(e){var t=(9>o.a.oa?0:e.nodes)?e.nodes():null;return t?o.a.R(t.cloneNode(!0).childNodes):(e=e.text(),o.a.Qa(e))},o.K.Ja=new o.K,o.Wa(o.K.Ja),o.b("nativeTemplateEngine",o.K),function(){o.La=function(){var e=this.ac=function(){if(!t||!t.tmpl)return 0;try{if(0<=t.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(e){}return 1}();this.renderTemplateSource=function(n,r,i){i=i||{};if(2>e)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var s=n.data("precompiled");return s||(s=n.text()||"",s=t.template(null,"{{ko_with $item.koBindingContext}}"+s+"{{/ko_with}}"),n.data("precompiled",s)),n=[r.$data],r=t.extend({koBindingContext:r},i.templateOptions),r=t.tmpl(s,n,r),r.appendTo(w.createElement("div")),t.fragments={},r},this.createJavaScriptEvaluatorBlock=function(e){return"{{ko_code ((function() { return "+e+" })()) }}"},this.addTemplate=function(e,t){w.write("<script type='text/html' id='"+e+"'>"+t+"</script>")},0<e&&(t.tmpl.tag.ko_code={open:"__.push($1 || '');"},t.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},o.La.prototype=new o.C;var e=new o.La;0<e.ac&&o.Wa(e),o.b("jqueryTmplTemplateEngine",o.La)}()})})()})(),define("modules/app",["knockout"],function(e){return function(){this.articlePath="articles",this.currentArticle=e.observable("one"),this.currentArticle.full=e.computed(function(){var e=this.currentArticle();return e&&this.articlePath+"/"+e},this)}}),define("knockout-amd-helpers",["knockout"],function(e){var t=window.require||window.curl,n=e.utils.unwrapObservable,r=function(e,t){var n,r=function(){return e.apply(this,t||[])};return r.prototype=e.prototype,n=new r,n.constructor=e,n},i=function(e){return e&&e.replace(/\/?$/,"/")},s=function(t){var n=e.virtualElements.firstChild(t);while(n){if(n.nodeType===1||n.nodeType===8)return!0;n=e.virtualElements.nextSibling(n)}return!1};e.bindingHandlers.module={init:function(o,u,a,f,l){var c,h,p=u(),d=n(p),v={},m=e.bindingHandlers.module.initializer,g=e.bindingHandlers.module.disposeMethod;return v.templateEngine=d&&d.templateEngine,v.templateProperty=e.bindingHandlers.module.templateProperty,v.afterRender=function(){var e=n(u());e&&typeof e.afterRender=="function"&&e.afterRender.apply(this,arguments)},s(o)||(v.name=function(){var e=n(p);return(e&&typeof e=="object"?n(e.template||e.name):e)||""}),v.data=e.observable(),v["if"]=v.data,e.applyBindingsToNode(o,{template:v},c=l.extend({$module:null})),h=function(){e.computed(function(){var e=v.data();e&&(typeof e[g]=="function"&&(e[g].call(e),e=null),v.data(null))}).dispose()},e.computed({read:function(){var s,o=n(p);o&&typeof o=="object"&&(m=o.initializer||m,g=o.disposeMethod||g,v.templateProperty=e.unwrap(o.templateProperty)||v.templateProperty,s=[].concat(n(o.data)),o=n(o.name)),h(),o&&t([i(e.bindingHandlers.module.baseDir)+o],function(e){typeof e=="function"?e=r(e,s):e&&e[m]&&(e=e[m].apply(e,s||[])||e),c.$module=e,v.data(e)})},disposeWhenNodeIsRemoved:o}),e.utils.domNodeDisposal.addDisposeCallback(o,h),{controlsDescendantBindings:!0}},baseDir:"",initializer:"initialize",disposeMethod:"dispose",templateProperty:""},e.virtualElements&&(e.virtualElements.allowedBindings.module=!0),function(e,t){var n=new e.nativeTemplateEngine,r={};n.defaultPath="templates",n.defaultSuffix=".tmpl.html",n.defaultRequireTextPluginName="text",e.templateSources.requireTemplate=function(t){this.key=t,this.template=e.observable(" "),this.requested=!1,this.retrieved=!1},e.templateSources.requireTemplate.prototype.text=function(e){!this.requested&&this.key&&(t([n.defaultRequireTextPluginName+"!"+i(n.defaultPath)+this.key+n.defaultSuffix],function(e){this.retrieved=!0,this.template(e)}.bind(this)),this.requested=!0),this.key||this.template("");if(arguments.length===0)return this.template()},n.makeTemplateSource=fun