Commit 1afd8183 authored by Pascal Hartig's avatar Pascal Hartig

CanJS: Partly moved to Bower components

Refs #475
parent 37bf12f2
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
html,
body {
margin: 0;
padding: 0;
}
button {
margin: 0;
padding: 0;
border: 0;
background: none;
font-size: 100%;
vertical-align: baseline;
font-family: inherit;
color: inherit;
-webkit-appearance: none;
/*-moz-appearance: none;*/
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
body {
font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.4em;
background: #eaeaea url('bg.png');
color: #4d4d4d;
width: 550px;
margin: 0 auto;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
}
#todoapp {
background: #fff;
background: rgba(255, 255, 255, 0.9);
margin: 130px 0 40px 0;
border: 1px solid #ccc;
position: relative;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),
0 25px 50px 0 rgba(0, 0, 0, 0.15);
}
#todoapp:before {
content: '';
border-left: 1px solid #f5d6d6;
border-right: 1px solid #f5d6d6;
width: 2px;
position: absolute;
top: 0;
left: 40px;
height: 100%;
}
#todoapp input::-webkit-input-placeholder {
font-style: italic;
}
#todoapp input:-moz-placeholder {
font-style: italic;
color: #a9a9a9;
}
#todoapp h1 {
position: absolute;
top: -120px;
width: 100%;
font-size: 70px;
font-weight: bold;
text-align: center;
color: #b3b3b3;
color: rgba(255, 255, 255, 0.3);
text-shadow: -1px -1px rgba(0, 0, 0, 0.2);
-webkit-text-rendering: optimizeLegibility;
-moz-text-rendering: optimizeLegibility;
-ms-text-rendering: optimizeLegibility;
-o-text-rendering: optimizeLegibility;
text-rendering: optimizeLegibility;
}
#header {
padding-top: 15px;
border-radius: inherit;
}
#header:before {
content: '';
position: absolute;
top: 0;
right: 0;
left: 0;
height: 15px;
z-index: 2;
border-bottom: 1px solid #6c615c;
background: #8d7d77;
background: -webkit-gradient(linear, left top, left bottom, from(rgba(132, 110, 100, 0.8)),to(rgba(101, 84, 76, 0.8)));
background: -webkit-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: -moz-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: -o-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: -ms-linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
background: linear-gradient(top, rgba(132, 110, 100, 0.8), rgba(101, 84, 76, 0.8));
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#9d8b83', EndColorStr='#847670');
border-top-left-radius: 1px;
border-top-right-radius: 1px;
}
#new-todo,
.edit {
position: relative;
margin: 0;
width: 100%;
font-size: 24px;
font-family: inherit;
line-height: 1.4em;
border: 0;
outline: none;
color: inherit;
padding: 6px;
border: 1px solid #999;
box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2);
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
}
#new-todo {
padding: 16px 16px 16px 60px;
border: none;
background: rgba(0, 0, 0, 0.02);
z-index: 2;
box-shadow: none;
}
#main {
position: relative;
z-index: 2;
border-top: 1px dotted #adadad;
}
label[for='toggle-all'] {
display: none;
}
#toggle-all {
position: absolute;
top: -42px;
left: -4px;
width: 40px;
text-align: center;
border: none; /* Mobile Safari */
}
#toggle-all:before {
content: '»';
font-size: 28px;
color: #d9d9d9;
padding: 0 25px 7px;
}
#toggle-all:checked:before {
color: #737373;
}
#todo-list {
margin: 0;
padding: 0;
list-style: none;
}
#todo-list li {
position: relative;
font-size: 24px;
border-bottom: 1px dotted #ccc;
}
#todo-list li:last-child {
border-bottom: none;
}
#todo-list li.editing {
border-bottom: none;
padding: 0;
}
#todo-list li.editing .edit {
display: block;
width: 506px;
padding: 13px 17px 12px 17px;
margin: 0 0 0 43px;
}
#todo-list li.editing .view {
display: none;
}
#todo-list li .toggle {
text-align: center;
width: 40px;
/* auto, since non-WebKit browsers doesn't support input styling */
height: auto;
position: absolute;
top: 0;
bottom: 0;
margin: auto 0;
border: none; /* Mobile Safari */
-webkit-appearance: none;
/*-moz-appearance: none;*/
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
#todo-list li .toggle:after {
content: '✔';
line-height: 43px; /* 40 + a couple of pixels visual adjustment */
font-size: 20px;
color: #d9d9d9;
text-shadow: 0 -1px 0 #bfbfbf;
}
#todo-list li .toggle:checked:after {
color: #85ada7;
text-shadow: 0 1px 0 #669991;
bottom: 1px;
position: relative;
}
#todo-list li label {
word-break: break-word;
padding: 15px;
margin-left: 45px;
display: block;
line-height: 1.2;
-webkit-transition: color 0.4s;
-moz-transition: color 0.4s;
-ms-transition: color 0.4s;
-o-transition: color 0.4s;
transition: color 0.4s;
}
#todo-list li.completed label {
color: #a9a9a9;
text-decoration: line-through;
}
#todo-list li .destroy {
display: none;
position: absolute;
top: 0;
right: 10px;
bottom: 0;
width: 40px;
height: 40px;
margin: auto 0;
font-size: 22px;
color: #a88a8a;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
#todo-list li .destroy:hover {
text-shadow: 0 0 1px #000,
0 0 10px rgba(199, 107, 107, 0.8);
-webkit-transform: scale(1.3);
-moz-transform: scale(1.3);
-ms-transform: scale(1.3);
-o-transform: scale(1.3);
transform: scale(1.3);
}
#todo-list li .destroy:after {
content: '✖';
}
#todo-list li:hover .destroy {
display: block;
}
#todo-list li .edit {
display: none;
}
#todo-list li.editing:last-child {
margin-bottom: -1px;
}
#footer {
color: #777;
padding: 0 15px;
position: absolute;
right: 0;
bottom: -31px;
left: 0;
height: 20px;
z-index: 1;
text-align: center;
}
#footer:before {
content: '';
position: absolute;
right: 0;
bottom: 31px;
left: 0;
height: 50px;
z-index: -1;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3),
0 6px 0 -3px rgba(255, 255, 255, 0.8),
0 7px 1px -3px rgba(0, 0, 0, 0.3),
0 43px 0 -6px rgba(255, 255, 255, 0.8),
0 44px 2px -6px rgba(0, 0, 0, 0.2);
}
#todo-count {
float: left;
text-align: left;
}
#filters {
margin: 0;
padding: 0;
list-style: none;
position: absolute;
right: 0;
left: 0;
}
#filters li {
display: inline;
}
#filters li a {
color: #83756f;
margin: 2px;
text-decoration: none;
}
#filters li a.selected {
font-weight: bold;
}
#clear-completed {
float: right;
position: relative;
line-height: 20px;
text-decoration: none;
background: rgba(0, 0, 0, 0.1);
font-size: 11px;
padding: 0 10px;
border-radius: 3px;
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.2);
}
#clear-completed:hover {
background: rgba(0, 0, 0, 0.15);
box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.3);
}
#info {
margin: 65px auto 0;
color: #a6a6a6;
font-size: 12px;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
text-align: center;
}
#info a {
color: inherit;
}
/*
Hack to remove background from Mobile Safari.
Can't use it globally since it destroys checkboxes in Firefox and Opera
*/
@media screen and (-webkit-min-device-pixel-ratio:0) {
#toggle-all,
#todo-list li .toggle {
background: none;
}
#todo-list li .toggle {
height: 40px;
}
#toggle-all {
top: -56px;
left: -15px;
width: 65px;
height: 41px;
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
-webkit-appearance: none;
appearance: none;
}
}
.hidden{
display:none;
}
(function () {
'use strict';
if (location.hostname === 'todomvc.com') {
var _gaq=[['_setAccount','UA-31081062-1'],['_trackPageview']];(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src='//www.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)}(document,'script'));
}
function appendSourceLink() {
var sourceLink = document.createElement('a');
var paragraph = document.createElement('p');
var footer = document.getElementById('info');
var urlBase = 'https://github.com/addyosmani/todomvc/tree/gh-pages';
if (footer) {
sourceLink.href = urlBase + location.pathname;
sourceLink.appendChild(document.createTextNode('Check out the source'));
paragraph.appendChild(sourceLink);
footer.appendChild(paragraph);
}
}
appendSourceLink();
})();
{
"name": "todomvc-common",
"version": "0.1.1",
"gitHead": "639b3e310c9fd6970e8ccda893ad564915e715f5",
"_id": "todomvc-common@0.1.1",
"readme": "ERROR: No README.md file found!",
"description": "ERROR: No README.md file found!",
"repository": {
"type": "git",
"url": "git://github.com/tastejs/todomvc-common.git"
}
}
\ No newline at end of file
......@@ -4,24 +4,21 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>CanJS • TodoMVC</title>
<link rel="stylesheet" href="../../assets/base.css">
<!--[if IE]>
<script src="../../assets/ie.js"></script>
<![endif]-->
<link rel="stylesheet" href="components/todomvc-common/base.css">
</head>
<body>
<section id="todoapp">
</section>
<div id="info">
<footer id="info">
<p>Double-click to edit a todo</p>
<p>Written by <a href="http://bitovi.com">Bitovi</a></p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</div>
</footer>
<script src="../../assets/jquery.min.js"></script>
<script src="../../assets/base.js"></script>
<script src="components/jquery/jquery.js"></script>
<script src="components/todomvc-common/base.js"></script>
<script src="js/lib/can.jquery-1.1.0.min.js"></script>
<script src="components/canjs/can.jquery.min.js"></script>
<script src="js/lib/can.mustache.min.js"></script>
<script src="js/lib/can.localstorage.min.js"></script>
<script src="js/models/todo.js"></script>
......
(function(u,n,l){var c=u.can||{};if("undefined"===typeof GLOBALCAN||!1!==GLOBALCAN)u.can=c;c.isDeferred=function(a){var b=this.isFunction;return a&&b(a.then)&&b(a.pipe)};c.each=function(a,b,d){var c=0,f;if(a)if("number"===typeof a.length&&a.pop){a.attr&&a.attr("length");for(f=a.length;c<f&&!1!==b.call(d||a[c],a[c],c,a);c++);}else if(a.hasOwnProperty)for(f in a)if(a.hasOwnProperty(f)&&!1===b.call(d||a[f],a[f],f,a))break;return a};n.extend(c,jQuery,{trigger:function(a,b,d){a.trigger?a.trigger(b,d):
n.event.trigger(b,d,a,!0)},addEvent:function(a,b){n([this]).bind(a,b);return this},removeEvent:function(a,b){n([this]).unbind(a,b);return this},buildFragment:function(a,b){var d=n.buildFragment([a],n(b));return d.cacheable?n.clone(d.fragment):d.fragment},$:jQuery,each:c.each});n.each(["bind","unbind","undelegate","delegate"],function(a,b){c[b]=function(){var a=this[b]?this:n([this]);a[b].apply(a,arguments);return this}});n.each("append filter addClass remove data get".split(" "),function(a,b){c[b]=
function(a){return a[b].apply(a,c.makeArray(arguments).slice(1))}});var Ha=n.cleanData;n.cleanData=function(a){n.each(a,function(a,d){d&&c.trigger(d,"destroyed",[],!1)});Ha(a)};var Ia=/\=\=/,Ja=/([A-Z]+)([A-Z][a-z])/g,Ka=/([a-z\d])([A-Z])/g,La=/([a-z\d])([A-Z])/g,ka=/\{([^\}]+)\}/g,x=/"/g,Ma=/'/g;c.extend(c,{esc:function(a){return(""+(null===a||a===l||isNaN(a)&&"NaN"===""+a?"":a)).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(x,"&#34;").replace(Ma,"&#39;")},getObject:function(a,
b,d){var a=a?a.split("."):[],e=a.length,f,h=0,g,i,b=c.isArray(b)?b:[b||u];if(!e)return b[0];for(;b[h];){f=b[h];for(i=0;i<e-1&&/^f|^o/.test(typeof f);i++)f=a[i]in f?f[a[i]]:d&&(f[a[i]]={});if(/^f|^o/.test(typeof f)&&(g=a[i]in f?f[a[i]]:d&&(f[a[i]]={}),g!==l))return!1===d&&delete f[a[i]],g;h++}},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)},underscore:function(a){return a.replace(Ia,"/").replace(Ja,"$1_$2").replace(Ka,"$1_$2").replace(La,"_").toLowerCase()},sub:function(a,b,d){var e=
[];e.push(a.replace(ka,function(a,h){var g=c.getObject(h,b,d===l?d:!d);return/^f|^o/.test(typeof g)?(e.push(g),""):""+g}));return 1>=e.length?e[0]:e},replacer:ka,undHash:/_|-/});var R=0;c.Construct=function(){if(arguments.length)return c.Construct.extend.apply(c.Construct,arguments)};c.extend(c.Construct,{newInstance:function(){var a=this.instance(),b;a.setup&&(b=a.setup.apply(a,arguments));a.init&&a.init.apply(a,b||arguments);return a},_inherit:function(a,b,d){c.extend(d||a,a||{})},_overwrite:function(a,
b,d,c){a[d]=c},setup:function(a){this.defaults=c.extend(!0,{},a.defaults,this.defaults)},instance:function(){R=1;var a=new this;R=0;return a},extend:function(a,b,d){function e(){if(!R)return this.constructor!==e&&arguments.length?arguments.callee.extend.apply(arguments.callee,arguments):this.constructor.newInstance.apply(this.constructor,arguments)}"string"!=typeof a&&(d=b,b=a,a=null);d||(d=b,b=null);var d=d||{},f=this.prototype,h,g,i,y;y=this.instance();c.Construct._inherit(d,f,y);for(h in this)this.hasOwnProperty(h)&&
(e[h]=this[h]);c.Construct._inherit(b,this,e);if(a){i=a.split(".");g=i.pop();i=f=c.getObject(i.join("."),u,!0);var j=c.underscore(a.replace(/\./g,"_")),s=c.underscore(g);f[g]=e}c.extend(e,{constructor:e,prototype:y,namespace:i,shortName:g,_shortName:s,fullName:a,_fullName:j});e.prototype.constructor=e;g=[this].concat(c.makeArray(arguments));y=e.setup.apply(e,g);e.init&&e.init.apply(e,y||g);return e}});var v=function(a){return a&&(c.isArray(a)||c.isPlainObject(a)||a instanceof c.Observe)},M=function(a,
b){return c.each(a,function(a){a&&a.unbind&&a.unbind("change"+b)})},S=function(a,b,d,e,f){e=e||j;f=f||j.List;a instanceof j?M([a],d._cid):a=c.isArray(a)?new f(a):new e(a);a.bind("change"+d._cid,function(){var e=c.makeArray(arguments),f=e.shift();e[0]=("*"===b?[d.indexOf(a),e[0]]:[b,e[0]]).join(".");f.triggeredNS=f.triggeredNS||{};f.triggeredNS[d._cid]||(f.triggeredNS[d._cid]=!0,c.trigger(d,f,e))});return a},N=function(a,b,d){a.each(function(a,f){d[f]=v(a)&&c.isFunction(a[b])?a[b]():a});return d},
F=function(a){return function(){return c[a].apply(this,arguments)}},G=F("addEvent"),F=F("removeEvent"),T=function(a){return c.isArray(a)?a:(""+a).split(".")},la=1,H=0,U=[],V=[],Na=0;c.cid=function(a,b){return a._cid?a._cid:a._cid=(b||"")+ ++Na};var j=c.Observe=c.Construct({bind:G,unbind:F,id:"id",canMakeObserve:v,startBatch:function(a){H++;a&&V.push(a)},stopBatch:function(a,b){a?H=0:H--;if(0==H){var d=U.slice(0),e=V.slice(0);U=[];V=[];la++;b&&this.startBatch();c.each(d,function(a){c.trigger.apply(c,
a)});c.each(e,function(a){a})}},triggerBatch:function(a,b,d){if(!a._init){if(0==H)return c.trigger(a,b,d);U.push([a,{type:b,batchNum:la},d])}},keys:function(a){var b=[];j.__reading&&j.__reading(a,"__keys");for(var d in a._data)b.push(d);return b}},{setup:function(a){this._data={};c.cid(this,".observe");this._init=1;this.attr(a);this.bind("change"+this._cid,c.proxy(this._changes,this));delete this._init},_changes:function(a,b,d,c,f){j.triggerBatch(this,{type:b,batchNum:a.batchNum},[c,f])},attr:function(a,
b){var d=typeof a;if("string"!==d&&"number"!==d)return this._attrs(a,b);if(b===l)return j.__reading&&j.__reading(this,a),this._get(a);this._set(a,b);return this},each:function(){j.__reading&&j.__reading(this,"__keys");return c.each.apply(l,[this.__get()].concat(c.makeArray(arguments)))},removeAttr:function(a){var a=T(a),b=a.shift(),d=this._data[b];if(a.length)return d.removeAttr(a);b in this._data&&(delete this._data[b],b in this.constructor.prototype||delete this[b],j.triggerBatch(this,"__keys",
l),j.triggerBatch(this,"change",[b,"remove",l,d]),j.triggerBatch(this,b,[l,d]));return d},_get:function(a){var a=T(a),b=this.__get(a.shift());return a.length?b?b._get(a):l:b},__get:function(a){return a?this._data[a]:this._data},_set:function(a,b){var d=T(a),c=d.shift(),f=this.__get(c);if(v(f)&&d.length)f._set(d,b);else{if(d.length)throw"can.Observe: Object does not exist";this.__convert&&(b=this.__convert(c,b));f||j.triggerBatch(this,"__keys",l);this.__set(c,b,f)}},__set:function(a,b,d){if(b!==d){var c=
this.__get().hasOwnProperty(a)?"set":"add";this.___set(a,v(b)?S(b,a,this):b);j.triggerBatch(this,"change",[a,c,b,d]);d&&M([d],this._cid)}},___set:function(a,b){this._data[a]=b;a in this.constructor.prototype||(this[a]=b)},bind:G,unbind:F,serialize:function(){return N(this,"serialize",{})},_attrs:function(a,b){if(a===l)return N(this,"attr",{});var a=c.extend(!0,{},a),d,e=this,f;j.startBatch();this.each(function(d,g){f=a[g];f===l?b&&e.removeAttr(g):(e.__convert&&(f=e.__convert(g,f)),d!==f&&(d instanceof
c.Observe&&f instanceof c.Observe&&M([d],e._cid),f instanceof c.Observe?e._set(g,f):v(d)&&v(f)?d.attr(f,b):d!=f&&e._set(g,f)),delete a[g])});for(d in a)f=a[d],this._set(d,f);j.stopBatch();return this}}),Oa=[].splice,O=j({setup:function(a,b){this.length=0;c.cid(this,".observe");this._init=1;this.push.apply(this,c.makeArray(a||[]));this.bind("change"+this._cid,c.proxy(this._changes,this));c.extend(this,b);delete this._init},_changes:function(a,b,d,c,f){~b.indexOf(".")||("add"===d?(j.triggerBatch(this,
d,[c,+b]),j.triggerBatch(this,"length",[this.length])):"remove"===d?(j.triggerBatch(this,d,[f,+b]),j.triggerBatch(this,"length",[this.length])):j.triggerBatch(this,d,[c,+b]));j.prototype._changes.apply(this,arguments)},__get:function(a){return a?this[a]:this},___set:function(a,b){this[a]=b;+a>=this.length&&(this.length=+a+1)},serialize:function(){return N(this,"serialize",[])},splice:function(a,b){var d=c.makeArray(arguments),e;for(e=2;e<d.length;e++){var f=d[e];v(f)&&(d[e]=S(f,"*",this))}b===l&&
(b=d[1]=this.length-a);e=Oa.apply(this,d);0<b&&(j.triggerBatch(this,"change",[""+a,"remove",l,e]),M(e,this._cid));2<d.length&&j.triggerBatch(this,"change",[""+a,"add",d.slice(2),e]);return e},_attrs:function(a,b){if(a===l)return N(this,"attr",[]);a=c.makeArray(a);j.startBatch();this._updateAttrs(a,b);j.stopBatch()},_updateAttrs:function(a,b){for(var d=Math.min(a.length,this.length),c=0;c<d;c++){var f=this[c],h=a[c];v(f)&&v(h)?f.attr(h,b):f!=h&&this._set(c,h)}a.length>this.length?this.push.apply(this,
a.slice(this.length)):a.length<this.length&&b&&this.splice(a.length)}});c.each({push:"length",unshift:0},function(a,b){O.prototype[b]=function(){for(var d=arguments[0]&&c.isArray(arguments[0])?arguments[0]:c.makeArray(arguments),e=a?this.length:0,f=0;f<d.length;f++){var h=d[f];v(h)&&(d[f]=S(h,"*",this,this.constructor.Observe,this.constructor))}f=[][b].apply(this,d);(!this.comparator||!d.length)&&j.triggerBatch(this,"change",[""+e,"add",d,l]);return f}});c.each({pop:"length",shift:0},function(a,b){O.prototype[b]=
function(){var d=arguments[0]&&c.isArray(arguments[0])?arguments[0]:c.makeArray(arguments),e=a&&this.length?this.length-1:0,d=[][b].apply(this,d);j.triggerBatch(this,"change",[""+e,"remove",l,[d]]);d&&d.unbind&&d.unbind("change"+this._cid);return d}});c.extend(O.prototype,{indexOf:function(a){this.attr("length");return c.inArray(a,this)},join:[].join,slice:function(){return new this.constructor(Array.prototype.slice.apply(this,arguments))},concat:function(){var a=[];c.each(c.makeArray(arguments),
function(b,d){a[d]=b instanceof c.Observe.List?b.serialize():b});return new this.constructor(Array.prototype.concat.apply(this.serialize(),a))},forEach:function(a,b){c.each(this,a,b||this)}});j.List=O;j.setup=function(){c.Construct.setup.apply(this,arguments);this.List=j.List({Observe:this},{})};var Pa=function(a,b,d){var e=new c.Deferred;a.then(function(){var a=c.makeArray(arguments);a[0]=b[d](a[0]);e.resolveWith(e,a)},function(){e.rejectWith(this,arguments)});"function"===typeof a.abort&&(e.abort=
function(){return a.abort()});return e},Qa=0,ma=/change.observe\d+/,I=function(a){c.Observe.__reading&&c.Observe.__reading(a,a.constructor.id);return a.__get(a.constructor.id)},na=function(a,b,d,c,f){var h;h=[a.serialize()];var g=a.constructor,i;"destroy"==b&&h.shift();"create"!==b&&h.unshift(I(a));i=g[b].apply(g,h);h=i.pipe(function(c){a[f||b+"d"](c,i);return a});i.abort&&(h.abort=function(){i.abort()});h.then(d,c);return h},Ra={create:{url:"_shortName",type:"post"},update:{data:function(a,b){var b=
b||{},d=this.id;b[d]&&b[d]!==a&&(b["new"+c.capitalize(a)]=b[d],delete b[d]);b[d]=a;return b},type:"put"},destroy:{type:"delete",data:function(a){var b={};b.id=b[this.id]=a;return b}},findAll:{url:"_shortName"},findOne:{}},oa=function(a,b){return function(d){var d=a.data?a.data.apply(this,arguments):d,e=b||this[a.url||"_url"],f=d,h=a.type||"get",g={};"string"==typeof e?(e=e.split(/\s/),g.url=e.pop(),e.length&&(g.type=e.pop())):c.extend(g,e);g.data="object"==typeof f&&!c.isArray(f)?c.extend(g.data||
{},f):f;g.url=c.sub(g.url,g.data,!0);return c.ajax(c.extend({type:h||"post",dataType:"json",success:void 0,error:void 0},g))}};c.Model=c.Observe({fullName:"can.Model",setup:function(a){this.store={};c.Observe.setup.apply(this,arguments);if(c.Model){this.List=W({Observe:this},{});var b=this,d=c.proxy(this._clean,b);c.each(Ra,function(e,f){c.isFunction(b[f])||(b[f]=oa(e,b[f]));if(b["make"+c.capitalize(f)]){var h=b["make"+c.capitalize(f)](b[f]);c.Construct._overwrite(b,a,f,function(){this._reqs++;var a=
h.apply(this,arguments),b=a.then(d,d);b.abort=a.abort;return b})}});if("can.Model"==b.fullName||!b.fullName)b.fullName="Model"+ ++Qa;this._reqs=0;this._url=this._shortName+"/{"+this.id+"}"}},_ajax:oa,_clean:function(a){this._reqs--;if(!this._reqs)for(var b in this.store)this.store[b]._bindings||delete this.store[b];return a},models:function(a){if(a){if(a instanceof this.List)return a;var b=this,d=new (b.List||W),e=c.isArray(a),f=a instanceof W,f=e?a:f?a.serialize():a.data;c.each(f,function(a){d.push(b.model(a))});
e||c.each(a,function(a,b){"data"!==b&&d.attr(b,a)});return d}},model:function(a){if(a){a instanceof this&&(a=a.serialize());var b=a[this.id],b=b&&this.store[b]?this.store[b].attr(a):new this(a);this._reqs&&(this.store[a[this.id]]=b);return b}}},{isNew:function(){var a=I(this);return!(a||0===a)},save:function(a,b){return na(this,this.isNew()?"create":"update",a,b)},destroy:function(a,b){return na(this,"destroy",a,b,"destroyed")},bind:function(a){ma.test(a)||(this._bindings||(this.constructor.store[I(this)]=
this,this._bindings=0),this._bindings++);return c.Observe.prototype.bind.apply(this,arguments)},unbind:function(a){ma.test(a)||(this._bindings--,this._bindings||delete this.constructor.store[I(this)]);return c.Observe.prototype.unbind.apply(this,arguments)},___set:function(a,b){c.Observe.prototype.___set.call(this,a,b);a===this.constructor.id&&this._bindings&&(this.constructor.store[I(this)]=this)}});c.each({makeFindAll:"models",makeFindOne:"model"},function(a,b){c.Model[b]=function(b){return function(c,
f,h){c=Pa(b.call(this,c),this,a);c.then(f,h);return c}}});c.each(["created","updated","destroyed"],function(a){c.Model.prototype[a]=function(b){var d=this.constructor;b&&"object"==typeof b&&this.attr(b.attr?b.attr():b);c.trigger(this,a);c.trigger(this,"change",a);c.trigger(d,a,this)}});var W=c.Model.List=c.Observe.List({setup:function(){c.Observe.List.prototype.setup.apply(this,arguments);var a=this;this.bind("change",function(b,c){if(/\w+\.destroyed/.test(c)){var e=a.indexOf(b.target);-1!=e&&a.splice(e,
1)}})}}),Sa=/^\d+$/,Ta=/([^\[\]]+)|(\[\])/g,Ua=/([^?#]*)(#.*)?$/,pa=function(a){return decodeURIComponent(a.replace(/\+/g," "))};c.extend(c,{deparam:function(a){var b={},d;a&&Ua.test(a)&&(a=a.split("&"),c.each(a,function(a){var a=a.split("="),c=pa(a.shift()),h=pa(a.join("="));current=b;for(var a=c.match(Ta),c=0,g=a.length-1;c<g;c++)current[a[c]]||(current[a[c]]=Sa.test(a[c+1])||"[]"==a[c+1]?[]:{}),current=current[a[c]];d=a.pop();"[]"==d?current.push(h):current[d]=h}));return b}});var qa=/\:([\w\.]+)/g,
Va=function(a){var b=[];c.each(a,function(a,e){b.push(("className"===e?"class":e)+'="'+("href"===e?a:c.esc(a))+'"')});return b.join(" ")},ra=function(a,b){var c=0,e=0,f={},h;for(h in a.defaults)a.defaults[h]===b[h]&&(f[h]=1,c++);for(;e<a.names.length;e++){if(!b.hasOwnProperty(a.names[e]))return-1;f[a.names[e]]||c++}return c},sa=!0,X=u.location,z=c.each,o=c.extend;c.route=function(a,b){var b=b||{},d=[],e=a.replace(qa,function(e,h,g){d.push(h);return"([^\\"+(a.substr(g+e.length,1)||c.route._querySeparator)+
"]"+(b[h]?"*":"+")+")"});c.route.routes[a]={test:RegExp("^"+e+"($|"+(c.route._querySeparator+"").replace(/([.?*+\^$\[\]\\(){}|\-])/g,"\\$1")+")"),route:a,names:d,defaults:b,length:a.split("/").length};return c.route};o(c.route,{_querySeparator:"&",_paramsMatcher:/^(?:&[^=]+=[^&]*)+/,param:function(a,b){var d,e=0,f,h=a.route,g=0;delete a.route;z(a,function(){g++});z(c.route.routes,function(b){f=ra(b,a);f>e&&(d=b,e=f);if(f>=g)return!1});c.route.routes[h]&&ra(c.route.routes[h],a)===e&&(d=c.route.routes[h]);
if(d){var i=o({},a),h=d.route.replace(qa,function(b,c){delete i[c];return a[c]===d.defaults[c]?"":encodeURIComponent(a[c])}),y;z(d.defaults,function(a,b){i[b]===a&&delete i[b]});y=c.param(i);b&&c.route.attr("route",d.route);return h+(y?c.route._querySeparator+y:"")}return c.isEmptyObject(a)?"":c.route._querySeparator+c.param(a)},deparam:function(a){var b={length:-1};z(c.route.routes,function(c){c.test.test(a)&&c.length>b.length&&(b=c)});if(-1<b.length){var d=a.match(b.test),e=d.shift(),f=(e=a.substr(e.length-
(d[d.length-1]===c.route._querySeparator?1:0)))&&c.route._paramsMatcher.test(e)?c.deparam(e.slice(1)):{},f=o(!0,{},b.defaults,f);z(d,function(a,d){a&&a!==c.route._querySeparator&&(f[b.names[d]]=decodeURIComponent(a))});f.route=b.route;return f}a.charAt(0)!==c.route._querySeparator&&(a=c.route._querySeparator+a);return c.route._paramsMatcher.test(a)?c.deparam(a.slice(1)):{}},data:new c.Observe({}),routes:{},ready:function(a){!1===a&&(sa=a);if(!0===a||!0===sa)c.route._setup(),ta();return c.route},url:function(a,
b){b&&(a=o({},Y,a));return"#!"+c.route.param(a)},link:function(a,b,d,e){return"<a "+Va(o({href:c.route.url(b,e)},d))+">"+a+"</a>"},current:function(a){return X.hash=="#!"+c.route.param(a)},_setup:function(){c.bind.call(u,"hashchange",ta)},_getHash:function(){return X.href.split(/#!?/)[1]||""},_setHash:function(a){a=c.route.param(a,!0);X.hash="#!"+a;return a}});z("bind unbind delegate undelegate attr removeAttr".split(" "),function(a){c.route[a]=function(){return c.route.data[a].apply(c.route.data,
arguments)}});var ua,Y,ta=c.route.setState=function(){var a=c.route._getHash();Y=c.route.deparam(a);(!Z||a!==va)&&c.route.attr(Y,!0)},va,Z;c.route.bind("change",function(){Z=1;clearTimeout(ua);ua=setTimeout(function(){Z=0;var a=c.route.data.serialize();va=c.route._setHash(a)},1)});c.bind.call(document,"ready",c.route.ready);c.route.constructor.canMakeObserve=c.Observe.canMakeObserve;var G=function(a,b,d){c.bind.call(a,b,d);return function(){c.unbind.call(a,b,d)}},D=c.isFunction,o=c.extend,z=c.each,
Wa=[].slice,wa=/\{([^\}]+)\}/g,Xa=c.getObject("$.event.special")||{},xa=function(a,b,d,e){c.delegate.call(a,b,d,e);return function(){c.undelegate.call(a,b,d,e)}},$;c.Control=c.Construct({setup:function(){c.Construct.setup.apply(this,arguments);if(c.Control){var a;this.actions={};for(a in this.prototype)this._isAction(a)&&(this.actions[a]=this._action(a))}},_shifter:function(a,b){var d="string"==typeof b?a[b]:b;D(d)||(d=a[d]);return function(){a.called=b;return d.apply(a,[this.nodeName?c.$(this):this].concat(Wa.call(arguments,
0)))}},_isAction:function(a){var b=this.prototype[a],c=typeof b;return"constructor"!==a&&("function"==c||"string"==c&&D(this.prototype[b]))&&!(!Xa[a]&&!aa[a]&&!/[^\w]/.test(a))},_action:function(a,b){wa.lastIndex=0;if(b||!wa.test(a)){var d=b?c.sub(a,[b,u]):a,e=c.isArray(d),f=e?d[1]:d,h=f.split(/\s+/g),g=h.pop();return{processor:aa[g]||$,parts:[f,h.join(" "),g],delegate:e?d[0]:l}}},processors:{},defaults:{}},{setup:function(a,b){var d=this.constructor,e=d.pluginName||d._fullName;this.element=c.$(a);
e&&"can_control"!==e&&this.element.addClass(e);(e=c.data(this.element,"controls"))||c.data(this.element,"controls",e=[]);e.push(this);this.options=o({},d.defaults,b);this.on();return[this.element,this.options]},on:function(a,b,d,e){if(!a){this.off();var a=this.constructor,b=this._bindings,d=a.actions,e=this.element,f=c.Control._shifter(this,"destroy"),h,g;for(h in d)d.hasOwnProperty(h)&&(g=d[h]||a._action(h,this.options),b.push(g.processor(g.delegate||e,g.parts[2],g.parts[1],h,this)));c.bind.call(e,
"destroyed",f);b.push(function(a){c.unbind.call(a,"destroyed",f)});return b.length}"string"==typeof a&&(e=d,d=b,b=a,a=this.element);e===l&&(e=d,d=b,b=null);"string"==typeof e&&(e=c.Control._shifter(this,e));this._bindings.push(b?xa(a,c.trim(b),d,e):G(a,d,e));return this._bindings.length},off:function(){var a=this.element[0];z(this._bindings||[],function(b){b(a)});this._bindings=[]},destroy:function(){var a=this.constructor,a=a.pluginName||a._fullName;this.off();a&&"can_control"!==a&&this.element.removeClass(a);
a=c.data(this.element,"controls");a.splice(c.inArray(this,a),1);c.trigger(this,"destroyed");this.element=null}});var aa=c.Control.processors;$=function(a,b,d,e,f){e=c.Control._shifter(f,e);return d?xa(a,c.trim(d),b,e):G(a,b,e)};z("change click contextmenu dblclick keydown keyup keypress mousedown mousemove mouseout mouseover mouseup reset resize scroll select submit focusin focusout mouseenter mouseleave touchstart touchmove touchcancel touchend touchleave".split(" "),function(a){aa[a]=$});c.Control.processors.route=
function(a,b,d,e,f){d=d||"";c.route(d);var h,g=function(a){if(c.route.attr("route")===d&&(a.batchNum===l||a.batchNum!==h))if(h=a.batchNum,a=c.route.attr(),delete a.route,c.isFunction(f[e]))f[e](a);else f[f[e]](a)};c.route.bind("change",g);return function(){c.route.unbind("change",g)}};var D=c.isFunction,Ya=c.makeArray,ya=1,k=c.view=function(a,b,d,e){a=k.render(a,b,d,e);return D(a)?a:c.isDeferred(a)?a.pipe(function(a){return k.frag(a)}):k.frag(a)};c.extend(k,{frag:function(a,b){return k.hookup(k.fragment(a),
b)},fragment:function(a){a=c.buildFragment(a,document.body);a.childNodes.length||a.appendChild(document.createTextNode(""));return a},toId:function(a){return c.map(a.toString().split(/\/|\./g),function(a){if(a)return a}).join("_")},hookup:function(a,b){var d=[],e,f;c.each(a.childNodes?c.makeArray(a.childNodes):a,function(a){1===a.nodeType&&(d.push(a),d.push.apply(d,c.makeArray(a.getElementsByTagName("*"))))});c.each(d,function(a){if(a.getAttribute&&(e=a.getAttribute("data-view-id"))&&(f=k.hookups[e]))f(a,
b,e),delete k.hookups[e],a.removeAttribute("data-view-id")});return a},hookups:{},hook:function(a){k.hookups[++ya]=a;return" data-view-id='"+ya+"'"},cached:{},cachedRenderers:{},cache:!0,register:function(a){this.types["."+a.suffix]=a},types:{},ext:".ejs",registerScript:function(){},preload:function(){},render:function(a,b,d,e){D(d)&&(e=d,d=l);var f=Za(b);if(f.length){var h=new c.Deferred;f.push(za(a,!0));c.when.apply(c,f).then(function(a){var f=Ya(arguments),g=f.pop();if(c.isDeferred(b))b=Aa(a);
else for(var j in b)c.isDeferred(b[j])&&(b[j]=Aa(f.shift()));f=g(b,d);h.resolve(f);e&&e(f)});return h}var g,f=D(e),h=za(a,f);if(f)g=h,h.then(function(a){e(b?a(b,d):a)});else{if("resolved"===h.state()&&h.__view_id)return a=k.cachedRenderers[h.__view_id],b?a(b,d):a;h.then(function(a){g=b?a(b,d):a})}return g},registerView:function(a,b,d,e){b=(d||k.types[k.ext]).renderer(a,b);e=e||new c.Deferred;k.cache&&(k.cached[a]=e,e.__view_id=a,k.cachedRenderers[a]=b);return e.resolve(b)}});var Ba=function(a,b){if(!a.length)throw"can.view: No template or empty template:"+
b;},za=function(a,b){var d=a.match(/\.[\w\d]+$/),e,f,h;a.match(/^#/)&&(a=a.substr(1));if(f=document.getElementById(a))d="."+f.type.match(/\/(x\-)?(.+)/)[2];!d&&!k.cached[a]&&(a+=d=k.ext);c.isArray(d)&&(d=d[0]);h=k.toId(a);if(a.match(/^\/\//))var g=a.substr(2),a=!u.steal?g:steal.config().root.mapJoin(g);e=k.types[d];if(k.cached[h])return k.cached[h];if(f)return k.registerView(h,f.innerHTML,e);var i=new c.Deferred;c.ajax({async:b,url:a,dataType:"text",error:function(b){Ba("",a);i.reject(b)},success:function(b){Ba(b,
a);k.registerView(h,b,e,i)}});return i},Za=function(a){var b=[];if(c.isDeferred(a))return[a];for(var d in a)c.isDeferred(a[d])&&b.push(a[d]);return b},Aa=function(a){return c.isArray(a)&&"success"===a[1]?a[0]:a};u.steal&&steal.type("view js",function(a,b){var c=k.types["."+a.type],e=k.toId(a.id);a.text="steal('"+(c.plugin||"can/view/"+a.type)+"',function(can){return can.view.preload('"+e+"',"+a.text+");\n})";b()});c.extend(k,{register:function(a){this.types["."+a.suffix]=a;u.steal&&steal.type(a.suffix+
" view js",function(a,c){var e=k.types["."+a.type],f=k.toId(a.id+"");a.text=e.script(f,a.text);c()});k[a.suffix]=function(b,c){k.preload(b,a.renderer(b,c))}},registerScript:function(a,b,c){return"can.view.preload('"+b+"',"+k.types["."+a].script(b,c)+");"},preload:function(a,b){k.cached[a]=(new c.Deferred).resolve(function(a,c){return b.call(a,a,c)});return function(){return k.frag(b.apply(this,arguments))}}});var $a=function(a,b){var d;c.Observe&&(d=c.Observe.__reading,c.Observe.__reading=function(a,
b){e.push({obj:a,attr:b})});var e=[],f=a.call(b);c.Observe&&(c.Observe.__reading=d);return{value:f,observed:e}},Ca=function(a,b,d){var e={},f=!0,h={value:l,teardown:function(){for(var a in e){var b=e[a];b.observe.obj.unbind(b.observe.attr,i);delete e[a]}}},g,i=function(a){if(a.batchNum===l||a.batchNum!==g){var b=h.value,c=j();h.value=c;c!==b&&d(c,b);g=g=a.batchNum}},j=function(){var d=$a(a,b),g=d.observed,d=d.value;f=!f;c.each(g,function(a){e[a.obj._cid+"|"+a.attr]?e[a.obj._cid+"|"+a.attr].matched=
f:(e[a.obj._cid+"|"+a.attr]={matched:f,observe:a},a.obj.bind(a.attr,i))});for(var h in e)g=e[h],g.matched!==f&&(g.observe.obj.unbind(g.observe.attr,i),delete e[h]);return d};h.value=j();h.isListening=!c.isEmptyObject(e);return h};c.compute=function(a,b){if(a&&a.isComputed)return a;var d,e=0,f,h=!0;"function"===typeof a?f=function(g){return g===l?d?(e&&c.Observe.__reading&&c.Observe.__reading(f,"change"),d.value):a.call(b||this):a.apply(b||this,arguments)}:(f=function(b){if(b===l)return c.Observe.__reading&&
c.Observe.__reading(f,"change"),a;var d=a;a=b;d!==b&&c.Observe.triggerBatch(f,"change",[b,d]);return b},h=!1);f.isComputed=!0;f.bind=function(g,i){c.addEvent.apply(f,arguments);e===0&&h&&(d=Ca(a,b||this,function(a,b){c.Observe.triggerBatch(f,"change",[a,b])}));e++};f.unbind=function(a,b){c.removeEvent.apply(f,arguments);e--;e===0&&h&&d.teardown()};return f};c.compute.binder=Ca;var ab=/(\r|\n)+/g,ba={option:"textContent",textarea:"value"},Da={tr:"tbody",option:"select",td:"tr",li:"ul"},bb=function(a,
b,c){if(a)return a;for(;c<b.length;){if("<"==b[c]&&Da[b[c+1]])return Da[b[c+1]];c++}},cb=function(a){eval(a)},db=/([^\s]+)[\s]*=[\s]*$/,B=null,ca=x=null,q=null,da=function(){return x?"'"+ca.match(db)[1]+"'":B?1:0};c.view.Scanner=Scanner=function(a){c.extend(this,{text:{},tokens:[]},a);this.tokenReg=[];this.tokenSimple={"<":"<",">":">",'"':'"',"'":"'"};this.tokenComplex=[];this.tokenMap={};for(var a=0,b;b=this.tokens[a];a++)b[2]?(this.tokenReg.push(b[2]),this.tokenComplex.push({abbr:b[1],re:RegExp(b[2]),
rescan:b[3]})):(this.tokenReg.push(b[1]),this.tokenSimple[b[1]]=b[0]),this.tokenMap[b[0]]=b[1];this.tokenReg=RegExp("("+this.tokenReg.slice(0).concat(["<",">",'"',"'"]).join("|")+")","g")};Scanner.prototype={helpers:[{name:/\s*\(([\$\w]+)\)\s*->([^\n]*)/,fn:function(a){a=a.match(/\s*\(([\$\w]+)\)\s*->([^\n]*)/);return"function(__){var "+a[1]+"=can.$(__);"+a[2]+"}"}}],scan:function(a,b){var c=[],e=0,f=this.tokenSimple,h=this.tokenComplex,a=a.replace(ab,"\n");a.replace(this.tokenReg,function(b,g){var i=
arguments[arguments.length-2];i>e&&c.push(a.substring(e,i));if(f[b])c.push(b);else for(var j=0,m;m=h[j];j++)if(m.re.test(b)){c.push(m.abbr);m.rescan&&c.push(m.rescan(g));break}e=i+g.length});e<a.length&&c.push(a.substr(e));var g="",i=["var ___v1ew = [];"+(this.text.start||"")],j=function(a,b){i.push("___v1ew.push(",'"',a.split("\\").join("\\\\").split("\n").join("\\n").split('"').join('\\"').split("\t").join("\\t"),'"'+(b||"")+");")},k=[],s,A=null,n=!1,r="",p=[],J=0,t,m=this.tokenMap;for(B=x=ca=null;(t=
c[J++])!==l;){if(null===A)switch(t){case m.left:case m.escapeLeft:case m.returnLeft:n=B&&1;case m.commentLeft:A=t;g.length&&j(g);g="";break;case m.escapeFull:n=B&&1;q=1;A=m.escapeLeft;g.length&&j(g);q=c[J++];g=q.content||q;q.before&&j(q.before);c.splice(J,0,m.right);break;case m.commentFull:break;case m.templateLeft:g+=m.left;break;case "<":0!==c[J].indexOf("!--")&&(B=1,n=0);g+=t;break;case ">":B=0;s="/"==g.substr(g.length-1);n||ba[p[p.length-1]]?(s?j(g.substr(0,g.length-1),',can.view.pending(),"/>"'):
j(g,',can.view.pending(),">"'),g=""):g+=t;s&&(p.pop(),r=p[p.length-1]);break;case "'":case '"':B&&(x&&x===t?x=null:null===x&&(x=t,ca=s));default:"<"===s&&(r=t.split(/\s/)[0],0===r.indexOf("/")&&p.pop()===r.substr(1)?r=p[p.length-1]:p.push(r)),g+=t}else switch(t){case m.right:case m.returnRight:switch(A){case m.left:s=--g.split("{").length- --g.split("}").length;1==s?(i.push("___v1ew.push(","can.view.txt(0,'"+bb(r,c,J)+"',"+da()+",this,function(){","var ___v1ew = [];",g),k.push({before:"",after:"return ___v1ew.join('')}));\n"})):
(e=k.length&&-1==s?k.pop():{after:";"},e.before&&i.push(e.before),i.push(g,";",e.after));break;case m.escapeLeft:case m.returnLeft:(s=--g.split("{").length- --g.split("}").length)&&k.push({before:"return ___v1ew.join('')",after:"}));"});for(var A=A===m.escapeLeft?1:0,eb={insert:"___v1ew.push(",tagName:r,status:da()},ea=0;ea<this.helpers.length;ea++){var o=this.helpers[ea];if(o.name.test(g)){g=o.fn(g,eb);o.name.source==/^>[\s|\w]\w*/.source&&(A=0);break}}"object"==typeof g?g.raw&&i.push(g.raw):i.push("___v1ew.push(",
"can.view.txt("+A+",'"+r+"',"+da()+",this,function(){ "+(this.text.escape||"")+"return ",g,s?"var ___v1ew = [];":"}));");q&&(q.after&&q.after.length)&&(j(q.after.length),q=null)}A=null;g="";break;case m.templateLeft:g+=m.left;break;default:g+=t}s=t}g.length&&j(g);i.push(";");g={out:"with(_VIEW) { with (_CONTEXT) {"+i.join("")+" return ___v1ew.join('')}}"};cb.call(g,"this.fn = (function(_CONTEXT,_VIEW){"+g.out+"});\r\n//@ sourceURL="+b+".js");return g}};var fa=!0;try{document.createTextNode()._=0}catch(ib){fa=
!1}var K={"class":"className",value:"value",textContent:"textContent"},fb={"":"span",table:"tr",tr:"td",ol:"li",ul:"li",tbody:"tr",thead:"tr",tfoot:"tr",select:"option",optgroup:"option"},gb=/__!!__/g,ba={option:"textContent",textarea:"value"},Ea=c.each(["checked","disabled","readonly","required"],function(a){K[a]=a}),ga=function(a,b,d){K[b]?a[K[b]]=-1<c.inArray(b,Ea)?!0:d:a.setAttribute(b,d)},L=[],ha=function(a){if("string"==typeof a)return a;if(!a&&0!==a)return"";var b=a.hookup&&function(b,c){a.hookup.call(a,
b,c)}||"function"==typeof a&&a;return b?(L.push(b),""):""+a},hb=function(a){return"string"==typeof a||"number"==typeof a?c.esc(a):ha(a)},E={},P={},Q={},ia="ejs_"+Math.random(),ja=0,C=function(a){if(fa||3!==a.nodeType)return a[ia]?a[ia]:a[ia]=(a.nodeName?"element_":"obj_")+ ++ja;for(var b in P)if(P[b]===a)return b;P["text_"+ ++ja]=a;return"text_"+ja},Fa=function(a,b){var d=E[C(a)];if(d){var e=c.inArray(b,d);0<=e&&d.splice(e,1);d.length||delete E[C(a)]}},Ga=function(a,b){var c=E[C(a)];c||(c=E[C(a)]=
[]);c.push(b)};c.extend(c.view,{pending:function(){var a=L.slice(0);lastHookups=a;L=[];return c.view.hook(function(b){c.each(a,function(a){a(b)})})},registerNode:function(a){var b=C(a);Q[b]=a;c.each(a,function(a){Ga(a,b)})},unregisterNode:function(a){var b=C(a);c.each(a,function(a){Fa(a,b)});delete Q[b]},txt:function(a,b,d,e,f){var h=c.compute.binder(f,e,function(a,b){o(a,b)});if(!h.isListening)return(a||0!==d?hb:ha)(h.value);var g,i,j=function(){h.teardown();i&&c.view.unregisterNode(i)},k=function(a){c.bind.call(a,
"destroyed",j);g=a},n=function(a){a||(j(),c.unbind.call(g,"destroyed",j))},e=fb[b]||"span",o,q=ba[b];if(0===d&&!q)return"<"+e+c.view.hook(a?function(a,b){o=function(a){d.nodeValue=""+a;n(d.parentNode)};var c=b&&11===a.parentNode.nodeType?b:a.parentNode,d=document.createTextNode(h.value);c.insertBefore(d,a);c.removeChild(a);k(c)}:function(a,b){o=function(a){d[0].parentNode&&e(a);n(d[0].parentNode)};var b=b&&11===a.parentNode.nodeType?b:a.parentNode,d,e=function(e){var e=c.view.frag(e,b),f=c.makeArray(e.childNodes),
g=d?d[d.length-1]:a;g.nextSibling?g.parentNode.insertBefore(e,g.nextSibling):g.parentNode.appendChild(e);d?(c.remove(c.$(d)),c.view.replace(d,f)):(c.remove(c.$(a)),i=d=f,c.view.registerNode(d))};e(h.value,[a]);k(b)})+">@@!!@@</"+e+">";if(1===d){var r=h.value.replace(/['"]/g,"").split("=")[0];L.push(function(a){o=function(b){var b=(b||"").replace(/['"]/g,"").split("="),d=b[0];if(d!=r&&r){var e=r;-1<c.inArray(e,Ea)?a[e]=!1:a.removeAttribute(e)}d&&(ga(a,d,b[1]),r=d)};k(a)});return h.value}var p=0===
d?q:d;(0===d?lastHookups:L).push(function(a){o=function(){ga(a,p,g.render(),q)};var b=c.$(a),d;(d=c.data(b,"hooks"))||c.data(b,"hooks",d={});var e=(K[p]?a[K[p]]:a.getAttribute(p))||"",b=e.split("__!!__"),f=[],g;f.push(b.shift(),b.join("__!!__"));d[p]?d[p].bindings.push(h):d[p]={render:function(){var a=0;return e.replace(gb,function(){return ha(g.bindings[a++].value)})},bindings:[h],batchNum:l};g=d[p];f.splice(1,0,h.value);ga(a,p,f.join(""),q);k(a)});return"__!!__"},replace:function(a,b){a=c.makeArray(a);
c.each(a,function(d){c.each(c.makeArray(E[C(d)]),function(e){var f=Q[e],h=c.inArray(d,f),g=c.inArray(a[a.length-1],f);if(0<=h&&0<=g){for(var i=h;i<=g;i++)Fa(f[i],e);f.splice.apply(f,[h,g-h+1].concat(b));c.each(b,function(a){Ga(a,e)})}else c.view.unregisterNode(f)})})},canExpando:fa,textNodeMap:P,nodeMap:E,nodeListMap:Q});var o=c.extend,w=function(a){if(this.constructor!=w){var b=new w(a);return function(a,c){return b.render(a,c)}}"function"==typeof a?this.template={fn:a}:(o(this,a),this.template=
this.scanner.scan(this.text,this.name))};c.EJS=w;w.prototype.render=function(a,b){a=a||{};return this.template.fn.call(a,a,new w.Helpers(a,b||{}))};o(w.prototype,{scanner:new c.view.Scanner({tokens:[["templateLeft","<%%"],["templateRight","%>"],["returnLeft","<%=="],["escapeLeft","<%="],["commentLeft","<%#"],["left","<%"],["right","%>"],["returnRight","%>"]]})});w.Helpers=function(a,b){this._data=a;this._extras=b;o(this,b)};w.Helpers.prototype={list:function(a,b){c.each(a,function(c,e){b(c,e,a)})}};
c.view.register({suffix:"ejs",script:function(a,b){return"can.EJS(function(_CONTEXT,_VIEW) { "+(new w({text:b,name:a})).template.out+" })"},renderer:function(a,b){return w({text:b,name:a})}})})(this,jQuery);
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment