file-formats-aspnet-mvc-ej1.../Scripts/jsviews.min.js

4 строки
43 KiB
JavaScript

/*! jsviews.js v1.0.0-alpha single-file version:
includes JsRender, JsObservable and JsViews http://github.com/BorisMoore/jsrender and http://jsviews.com/jsviews
informal pre V1.0 commit counter: 51 (Beta Candidate) */
(function(n,t,i){"use strict";function pt(n){return n}function pi(n){return n}function wt(n){e._dbgMode=n;lt=n?"Error: #index in nested view: use #getIndex()":"";nt("dbg",ui.dbg=ht.dbg=n?pi:pt)}function bt(n){return{getTgt:n,map:function(t){var i=this,r;i.src!==t&&(i.src&&i.unmap(),typeof t=="object"&&(r=n.apply(i,arguments),i.src=t,i.tgt=r))}}}function ut(n,t){t&&t.onError&&t.onError(n)===!1||(this.name="JsRender Error",this.message=n||"JsRender error")}function u(n,t){var i;n=n||{};for(i in t)n[i]=t[i];return n}function kt(n,t,i){return(!v.rTag||n)&&(p=n?n.charAt(0):p,w=n?n.charAt(1):w,o=t?t.charAt(0):o,l=t?t.charAt(1):l,k=i||k,n="\\"+p+"(\\"+k+")?\\"+w,t="\\"+o+"\\"+l,y="(?:(?:(\\w+(?=[\\/\\s\\"+o+"]))|(?:(\\w+)?(:)|(>)|!--((?:[^-]|-(?!-))*)--|(\\*)))\\s*((?:[^\\"+o+"]|\\"+o+"(?!\\"+l+"))*?)",v.rTag=y+")",y=new RegExp(n+y+"(\\/)?|(?:\\/(\\w+)))"+t,"g"),ct=new RegExp("<.*>|([^\\\\]|^)[{}]|"+n+".*"+t)),[p,w,o,l,k]}function wi(n,t){t||(t=n,n=i);var e,f,o,u,r=this,s=!t||t==="root";if(n){if(u=r.type===t?r:i,!u)if(e=r.views,r._.useKey){for(f in e)if(u=e[f].get(n,t))break}else for(f=0,o=e.length;!u&&f<o;f++)u=e[f].get(n,t)}else if(s)while(r.parent.parent)u=r=r.parent;else while(r&&!u)u=r.type===t?r:i,r=r.parent;return u}function dt(){var n=this.get("item");return n?n.index:i}function gt(){return this.index}function bi(t){var f,e=this,o=e.linkCtx,r=(e.ctx||{})[t];return r===i&&o&&o.ctx&&(r=o.ctx[t]),r===i&&(r=ui[t]),r&&(typeof r!="function"||r._wrp||(f=function(){return r.apply(!this||this===n?e:this,arguments)},f._wrp=1,u(f,r))),f||r}function ki(n,t,u){var h,f,e,o=+u===u&&u,s=t.linkCtx;return o&&(u=(o=t.tmpl.bnds[o-1])(t.data,t,r)),e=u.args[0],(n||o)&&(f=s&&s.tag||{_:{inline:!s,bnd:o},tagName:n+":",flow:!0,_is:"tag"},s&&(s.tag=f,f.linkCtx=f.linkCtx||s,u.ctx=c(u.ctx,s.view.ctx)),f.tagCtx=u,u.view=t,f.ctx=u.ctx||{},delete u.ctx,t._.tag=f,n=n!=="true"&&n,n&&((h=t.getRsc("converters",n))||a("Unknown converter: {{"+n+":"))&&(f.depends=h.depends,e=h.apply(f,u.args)),e=e!=i?e:"",e=o&&t._.onRender?t._.onRender(e,t,o):e,t._.tag=i),e}function di(n,t){for(var f,e,u=this;f===i&&u;)e=u.tmpl[n],f=e&&e[t],u=u.parent;return f||r[n][t]}function gi(n,t,f,e,o){var et,h,at,ot,it,v,st,w,l,rt,nt,vt,b,ct,lt,g,y,k="",ut=+e===e&&e,p=t.linkCtx||0,tt=t.ctx,yt=f||t.tmpl,pt=t._;for(n._is==="tag"&&(h=n,n=h.tagName),ut&&(e=(vt=yt.bnds[ut-1])(t.data,t,r)),st=e.length,h=h||p.tag,v=0;v<st;v++)l=e[v],nt=l.tmpl,nt=l.content=nt&&yt.tmpls[nt-1],f=l.props.tmpl,v||f&&h||(b=t.getRsc("tags",n)||a("Unknown tag: {{"+n+"}}")),f=f||(h?h:b).template||nt,f=""+f===f?t.getRsc("templates",f)||s(f):f,u(l,{tmpl:f,render:ft,index:v,view:t,ctx:c(l.ctx,tt)}),h||(b._ctr?(h=new b._ctr,ct=!!h.init,h.attr=h.attr||b.attr||i):h={render:b.render},h._={inline:!p},p&&(p.attr=h.attr=p.attr||h.attr,p.tag=h,h.linkCtx=p),(h._.bnd=vt||p.fn)?h._.arrVws={}:h.dataBoundOnly&&a("{^{"+n+"}} tag must be data-bound"),h.tagName=n,h.parent=it=tt&&tt.tag,h._is="tag",h._def=b),l.tag=h,h.map&&h.tagCtxs&&(l.map=h.tagCtxs[v].map),h.flow||(rt=l.ctx=l.ctx||{},at=h.parents=rt.parentTags=tt&&c(rt.parentTags,tt.parentTags)||{},it&&(at[it.tagName]=it),rt.tag=h);for(h.tagCtxs=e,pt.tag=h,h.rendering={},v=0;v<st;v++)l=h.tagCtx=e[v],y=l.args,(lt=l.props.map||h).map&&(y.length||!v||l.props.map)&&(y.length||(y=[t.data]),g=l.map=u(l.map||{unmap:lt.unmap},l.props),g.src!==y[0]&&(g.src&&g.unmap(),lt.map.apply(g,y)),y=[g.tgt]),h.ctx=l.ctx,!v&&ct&&(h.init(l,p,h.ctx),l=h.tagCtx,ct=i),w=i,et=h.render,(et=h.render)&&(w=et.apply(h,y)),w=w!==i?w:l.tmpl&&l.render(y[0],i,!0)||(o?i:""),k=k?k+(w||""):w;return delete h.rendering,h.tagCtx=h.tagCtxs[0],h.ctx=h.tagCtx.ctx,h._.inline&&(ot=h.attr)&&ot!==d&&(k=ot==="text"?ht.html(k):""),ut&&t._.onRender?t._.onRender(k,t,ut):k}function g(n,t,i,r,u,f,e,o){var a,h,c,v=t==="array",l={key:0,useKey:v?0:1,id:""+yi++,onRender:o,bnds:{}},s={data:r,tmpl:u,content:e,views:v?[]:{},parent:i,type:t,get:wi,getIndex:gt,getRsc:di,hlp:bi,_:l,_is:"view"};return i?(a=i.views,h=i._,h.useKey?(a[l.key="_"+h.useKey++]=s,s.index=lt,s.getIndex=dt,c=h.tag,l.bnd=v&&(!c||!!c._.bnd&&c)):a.splice(l.key=s.index=f,0,s),s.ctx=n||i.ctx):s.ctx=n,s}function nr(n){var t,i,r,u,f;for(t in b)if(u=b[t],(f=u.compile)&&(i=n[t+"s"]))for(r in i)i[r]=f(r,i[r],n,t,u)}function tr(n,t,i){var u,r;return typeof t=="function"?t={depends:t.depends,render:t}:((r=t.template)&&(t.template=""+r===r?s[r]||s(r):r),t.init!==!1&&(u=t._ctr=function(){},(u.prototype=t).constructor=u)),i&&(t._parentTmpl=i),t}function ni(r,u,f,e,o,h){function v(i){if(""+i===i||i.nodeType>0){try{a=i.nodeType>0?i:!ct.test(i)&&t&&t(n.document).find(i)[0]}catch(u){}return a&&(i=a.getAttribute(yt),r=r||i,i=s[i],i||(r=r||"_"+vi++,a.setAttribute(yt,r),i=s[r]=ni(r,a.innerHTML,f,e,o,h))),i}}var l,a;return u=u||"",l=v(u),h=h||(u.markup?u:{}),h.tmplName=r,f&&(h._parentTmpl=f),!l&&u.markup&&(l=v(u.markup))&&l.fn&&(l.debug!==u.debug||l.allowCode!==u.allowCode)&&(l=l.markup),l!==i?(r&&!f&&(rt[r]=function(){return u.render.apply(u,arguments)}),l.fn||u.fn?l.fn&&(u=r&&r!==l.tmplName?c(h,l):l):(u=ti(l,h),et(l.replace(si,"\\$&"),u)),nr(h),u):void 0}function ti(n,t){var i,o=e.wrapMap||{},r=u({markup:n,tmpls:[],links:{},tags:{},bnds:[],_is:"template",render:ft},t);return t.htmlTag||(i=li.exec(n),r.htmlTag=i?i[1].toLowerCase():""),i=o[r.htmlTag],i&&i!==o.div&&(r.markup=f.trim(r.markup)),r}function ir(n,t){function u(e,o,s){var l,h,a,c;if(e&&""+e!==e&&!e.nodeType&&!e.markup){for(a in e)u(a,e[a],o);return r}return o===i&&(o=e,e=i),e&&""+e!==e&&(s=o,o=e,e=i),c=s?s[f]=s[f]||{}:u,h=t.compile,(l=v.onBeforeStoreItem)&&(h=l(c,e,o,h)||h),e?o===null?delete c[e]:c[e]=h?o=h(e,o,s,n,t):o:o=h(i,o),h&&o&&(o._is=n),(l=v.onStoreItem)&&l(c,e,o,h),o}var f=n+"s";r[f]=u;b[n]=t}function ft(n,t,u,e,o,h){var w,ft,tt,y,it,rt,ut,b,p,et,k,ot,l,v=this,st=!v.attr||v.attr===d,nt="";if(o===!0&&(ut=!0,o=0),v.tag?(b=v,v=v.tag,et=v._,ot=v.tagName,l=b.tmpl,t=c(t,v.ctx),p=b.content,b.props.link===!1&&(t=t||{},t.link=!1),e=e||b.view,n=n===i?e:n):l=v.jquery&&(v[0]||a('Unknown template: "'+v.selector+'"'))||v,l&&(!e&&n&&n._is==="view"&&(e=n),e&&(p=p||e.content,h=h||e._.onRender,n===e&&(n=e.data,u=!0),t=c(t,e.ctx)),e&&e.data!==i||((t=t||{}).root=n),l.fn||(l=s[l]||s(l)),l)){if(h=(t&&t.link)!==!1&&st&&h,k=h,h===!0&&(k=i,h=e._.onRender),t=l.helpers?c(l.helpers,t):t,f.isArray(n)&&!u)for(y=ut?e:o!==i&&e||g(t,"array",e,n,l,o,p,h),w=0,ft=n.length;w<ft;w++)tt=n[w],it=g(t,"item",y,tt,l,(o||0)+w,p,h),rt=l.fn(tt,it,r),nt+=y._.onRender?y._.onRender(rt,it):rt;else y=ut?e:g(t,ot||"data",e,n,l,o,p,h),et&&!v.flow&&(y.tag=v),nt+=l.fn(n,y,r);return k?k(nt,y):nt}return""}function a(n){throw new v.Error(n);}function h(n){a("Syntax error\n"+n)}function et(n,t,i,r){function a(t){t-=f;t&&s.push(n.substr(f,t).replace(it,"\\n"))}function c(t){t&&h('Unmatched or missing tag: "{{/'+t+'}}" in template:\n'+n)}function v(e,v,y,w,b,k,g,nt,tt,rt,ut,ft){k&&(b=":",w=d);rt=rt||i;var vt,ht,ct=v&&[],st="",et="",lt="",at=!rt&&!b&&!g;y=y||b;a(ft);f=ft+e.length;nt?p&&s.push(["*","\n"+tt.replace(oi,"$1")+"\n"]):y?(y==="else"&&(ci.test(tt)&&h('for "{{else if expr}}" use "{{else expr}}"'),ct=u[6],u[7]=n.substring(u[7],ft),u=o.pop(),s=u[3],at=!0),tt&&(tt=tt.replace(it," "),st=ot(tt,ct,t).replace(hi,function(n,t,i){return t?lt+=i+",":et+=i+",",""})),et=et.slice(0,-1),st=st.slice(0,-1),vt=et&&et.indexOf("noerror:true")+1&&et||"",l=[y,w||!!r||"",st,at&&[],'params:"'+tt+'",props:{'+et+"}"+(lt?",ctx:{"+lt.slice(0,-1)+"}":""),vt,ct||0],s.push(l),at&&(o.push(u),u=l,u[7]=f)):ut&&(ht=u[0],c(ut!==ht&&ht!=="else"&&ut),u[7]=n.substring(u[7],ft),u=o.pop());c(!u&&ut);s=u[3]}var l,p=t&&t.allowCode,e=[],f=0,o=[],s=e,u=[,,,e];return c(o[0]&&o[0][3].pop()[0]),n.replace(y,v),a(n.length),(f=e[e.length-1])&&c(""+f!==f&&+f[7]===f[7]&&f[0]),ii(e,i?n:t,i)}function ii(n,i,r){var l,f,o,a,v,p,ht,ct,lt,at,et,w,s,ot,y,tt,b,rt,vt,k,yt,pt,st,ut,g,c=0,u="",nt="",ft={},wt=n.length;for(""+i===i?(y=r?'data-link="'+i.replace(it," ").slice(1,-1)+'"':i,i=0):(y=i.tmplName||"unnamed",i.allowCode&&(ft.allowCode=!0),i.debug&&(ft.debug=!0),w=i.bnds,ot=i.tmpls),l=0;l<wt;l++)if(f=n[l],""+f===f)u+='\nret+="'+f+'";';else if(o=f[0],o==="*")u+=""+f[1];else{if(a=f[1],v=f[2],rt=f[3],p=f[4],nt=f[5],vt=f[7],(pt=o==="else")||(c=0,w&&(s=f[6])&&(c=w.push(s))),(st=o===":")?(a&&(o=a===d?">":a+o),nt&&(ut="prm"+l,nt="try{var "+ut+"=["+v+"][0];}catch(e){"+ut+'="";}\n',v=ut)):(rt&&(tt=ti(vt,ft),tt.tmplName=y+"/"+o,ii(rt,tt),ot.push(tt)),pt||(b=o,yt=u,u=""),k=n[l+1],k=k&&k[0]==="else"),p+=",args:["+v+"]}",st&&s||a&&o!==">"){if(g=new Function("data,view,j,u"," // "+y+" "+c+" "+o+"\n"+nt+"return {"+p+";"),g.paths=s,g._ctxs=o,r)return g;et=1}if(u+=st?"\n"+(s?"":nt)+(r?"return ":"ret+=")+(et?(et=0,at=!0,'c("'+a+'",view,'+(s?(w[c-1]=g,c):"{"+p)+");"):o===">"?(ct=!0,"h("+v+");"):(lt=!0,"(v="+v+")!="+(r?"=":"")+'u?v:"";')):(ht=!0,"{view:view,tmpl:"+(rt?ot.length:"0")+","+p+","),b&&!k){if(u="["+u.slice(0,-1)+"]",(r||s)&&(u=new Function("data,view,j,u"," // "+y+" "+c+" "+b+"\nreturn "+u+";"),s&&((w[c-1]=u).paths=s),u._ctxs=o,r))return u;u=yt+'\nret+=t("'+b+'",view,this,'+(c||u)+");";s=0;b=0}}u="// "+y+"\nvar j=j||"+(t?"jQuery.":"js")+"views"+(lt?",v":"")+(ht?",t=j._tag":"")+(at?",c=j._cnvt":"")+(ct?",h=j.converters.html":"")+(r?";\n":',ret="";\n')+(e.tryCatch?"try{\n":"")+(ft.debug?"debugger;":"")+u+(r?"\n":"\nreturn ret;\n")+(e.tryCatch?"\n}catch(e){return j._err(e);}":"");try{u=new Function("data,view,j,u",u)}catch(bt){h("Compiled template code:\n\n"+u,bt)}return i&&(i.fn=u),u}function ot(n,t,i){function b(b,k,d,g,nt,tt,it,rt,ut,ft,st,ht,ct,lt,at,vt,yt,pt,wt,bt){function dt(n,i,r,f,e,o,h,l){if(r&&(t&&(u==="linkTo"&&(s=t._jsvto=t._jsvto||[],s.push(nt)),(!u||c)&&t.push(nt.slice(i.length))),r!==".")){var a=(f?'view.hlp("'+f+'")':e?"view":"data")+(l?(o?"."+o:f?"":e?"":"."+r)+(h||""):(l=f?"":e?o||"":r,""));return a=a+(l?"."+l:""),i+(a.slice(0,9)==="view.data"?a.slice(5):a)}return n}var kt;if(tt=tt||"",d=d||k||ht,nt=nt||ut,ft=ft||yt||"",!it||e||f)return t&&vt&&!e&&!f&&(!u||c||s)&&(kt=v[r],bt.length-1>wt-kt&&(kt=bt.slice(kt,wt+1),vt=w+":"+kt+o,vt=y[vt]=y[vt]||et(p+vt+l,i,!0),vt.paths||ot(kt,vt.paths=[],i),(s||t).push({_jsvOb:vt}))),e?(e=!ct,e?b:'"'):f?(f=!lt,f?b:'"'):(d?(r++,v[r]=wt++,d):"")+(pt?r?"":u?(u=c=s=!1,"\b"):",":rt?(r&&h(n),u=nt,c=g,"\b"+nt+":"):nt?nt.split("^").join(".").replace(fi,dt)+(ft?(a[++r]=!0,nt.charAt(0)!=="."&&(v[r]=wt),ft):tt):tt?tt:at?(a[r--]=!1,at)+(ft?(a[++r]=!0,ft):""):st?(a[r]||h(n),","):k?"":(e=ct,f=lt,'"'));h(n)}var u,s,c,y=i.links,a={},v={0:-1},r=0,f=!1,e=!1;return(n+" ").replace(/\)\^/g,").").replace(ei,b)}function c(n,t){return n&&n!==t?t?u(u({},t),n):n:t&&u({},t)}function ri(n){return vt[n]||(vt[n]="&#"+n.charCodeAt(0)+";")}function rr(n){var i,t,r=[];if(typeof n=="object")for(i in n)t=n[i],t&&t.toJSON&&!t.toJSON()||typeof t!="function"&&r.push({key:i,prop:n[i]});return r}if((!t||!t.views)&&!n.jsviews){var f,tt,y,ct,lt,p="{",w="{",o="}",l="}",k="^",fi=/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,ei=/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(!*?[#~]?[\w$.^]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=\s*\.|\s*\^|\s*$)|[)\]])([([]?))|(\s+)/g,it=/[ \t]*(\r\n|\n|\r)/g,oi=/\\(['"])/g,si=/['"\\]/g,hi=/\x08(~)?([^\x08]+)\x08/g,ci=/^if\s/,li=/<(\w+)[>\s]/,at=/[\x00`><"'&]/g,ai=at,vi=0,yi=0,vt={"&":"&amp;","<":"&lt;",">":"&gt;","\x00":"&#0;","'":"&#39;",'"':"&#34;","`":"&#96;"},d="html",yt="data-jsv-tmpl",rt={},b={template:{compile:ni},tag:{compile:tr},helper:{},converter:{}},r={jsviews:"v1.0.0-beta",render:rt,settings:function(n){u(e,n);wt(e._dbgMode);e.jsv&&e.jsv()},sub:{View:g,Error:ut,tmplFn:et,parse:ot,extend:u,error:a,syntaxError:h,DataMap:bt},_cnvt:ki,_tag:gi,_err:function(n){return e._dbgMode?"Error: "+(n.message||n)+". ":""}};(ut.prototype=new Error).constructor=ut;dt.depends=function(){return[this.get("item"),"index"]};gt.depends=function(){return["index"]};for(tt in b)ir(tt,b[tt]);var st,s=r.templates,ht=r.converters,ui=r.helpers,nt=r.tags,v=r.sub,e=r.settings;t?(f=t,f.fn.render=ft,(st=f.observable)&&(u(v,st.sub),delete st.sub)):(f=n.jsviews={},f.isArray=Array&&Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"});f.render=rt;f.views=r;f.templates=s=r.templates;e({debugMode:wt,delimiters:kt,_dbgMode:!0,tryCatch:!0});nt({"else":function(){},"if":{render:function(n){var t=this;return t.rendering.done||!n&&(arguments.length||!t.tagCtx.index)?"":(t.rendering.done=!0,t.selected=t.tagCtx.index,t.tagCtx.render())},onUpdate:function(n,t,i){for(var r,f,u=0;(r=this.tagCtxs[u])&&r.args.length;u++)if(r=r.args[0],f=!r!=!i[u].args[0],!!r||f)return f;return!1},flow:!0},"for":{render:function(n){var t=this,r=t.tagCtx,u="",e=0;return arguments.length||(n=r.view.data),t.rendering.done||(n!==i&&(u+=r.render(n),e+=f.isArray(n)?n.length:1),(t.rendering.done=e)&&(t.selected=r.index)),u},flow:!0},include:{flow:!0},"*":{render:pt,flow:!0}});nt({props:u(u({},nt["for"]),bt(rr))});ht({html:function(n){return n!=i?String(n).replace(ai,ri):""},attr:function(n){return n!=i?String(n).replace(at,ri):n===null?n:""},url:function(n){return n!=i?encodeURI(String(n)):n===null?n:""}});kt()}})(this,this.jQuery),function(n,t,i){"use strict";function u(n){return r(n)?new d(n):new k(n)}function k(n){return this._data=n,this}function d(n){return this._data=n,this}function lt(n){return r(n)?[n]:n}function ut(n,t){n=r(n)?n:[n];for(var i,e=t,o=e,h=n.length,u=[],s=0;s<h;s++){if(i=n[s],f(i)){u=u.concat(ut(i.call(t,t),t));continue}else if(""+i!==i){t=o=i;o!==e&&u.push(e=o);continue}o!==e&&u.push(e=o);u.push(i)}return u}function ft(n,t){var r,i;for(r in n){i=!0;break}i||delete p[t]}function g(n,t){if(!(n.data&&n.data.off)){var a,y,p,f=t.oldValue,o=t.value,u=n.data,l=u.observeAll,h=!u.cb.noArray,c=u.paths;n.type===v?(u.cb.array||u.cb).call(u,n,t):(u.prop===t.path||u.prop==="*")&&(f=typeof f===s&&(c[0]||h&&r(f))&&f,o=typeof(o=t.value)===s&&(c[0]||h&&r(o))&&o,l?(a=l._path+"."+t.path,y=l.filter,p=[l.parents().slice(0)],f&&e(h,[f],c,u.cb,!0,y,p,a),o&&e(h,[o],c,u.cb,i,y,p,a)):(f&&e(h,[f],c,u.cb,!0),o&&e(h,[o],c,u.cb)),u.cb(n,t))}}function y(){function kt(i,r,u,f){var e,s,p=rt(n),w=lt(n);if(o=0,k||f)p&&(t(w).off(i,g),o&&delete o[t.data(n,"obId")]);else{if(a=p&&t._data(n))for(a=a&&a.events,a=a&&a[u?v:l],bt=a&&a.length;bt--;)if((et=a[bt].data)&&et.cb._cId===c._cId){if(u)return;(r==="*"&&et.prop!==r||et.prop===y)&&(t(n).off(i,g),o&&delete o[t.data(n,"obId")])}s=u?{cb:c}:{fullPath:h,paths:r?[r]:[],prop:y,cb:c};ot&&(s.observeAll={_path:ot,path:function(){return e=ti.length,ot.replace(/[[.]/g,function(n){return e--,n==="["?"["+t.inArray(ti[e-1],ti[e]):"."})},parents:function(){return ti},filter:fi});t(w).on(i,null,s,g);gt&&(gt[t.data(n,"obId")||t.data(n,"obId",ct++)]=n)}}function ci(n,t){n._ob=st(n,wt);var i=wt;return function(u,f){var o=n._ob,h=t.length;typeof o===s&&(dt(o,!0),(h||at&&r(o))&&e(at,[o],t,c,st,!0));o=n._ob=st(n,i);typeof o===s&&(dt(o),(h||at&&r(o))&&e(at,[o],t,c,st,[i]));c(u,f)}}function dt(t,f,e,o){if(at){var s=n,h=ot;n=t;o&&(n=t[o],ot+="."+o,fi&&(n=u._fltr(o,t,ot,fi)));n&&(e||r(n))&&kt(v+".observe"+(c?".obs"+(pt=c._cId=c._cId||b++):""),i,!0,f);n=s;ot=h}}var yt,ri,ei,it,y,h,ui,k,c,pt,bt,et,a,st,oi,gt,ni,si,ti,ot,fi,at=this!=!1,hi=1,ii=ht,d=Array.apply(0,arguments),nt=d.pop(),wt=d.shift(),vt=wt,n=vt,tt=d.length;for(f(nt)?c=nt:(nt+""===nt&&(ot=nt,ti=d.pop(),fi=d.pop(),nt=d.pop(),tt=tt-3),nt===!0?k=nt:nt&&(wt=nt,hi=0),nt=d[tt-1],(tt&&nt===i||f(nt))&&(c=d.pop(),tt--)),tt&&f(d[tt-1])&&(st=c,c=d.pop(),tt--),ii+=k?c?".obs"+c._cId:"":".obs"+(pt=c._cId=c._cId||b++),k||(gt=p[pt]=p[pt]||{}),r(vt)?dt(vt,k,!0):k&&tt===0&&vt&&kt(ii,""),ni=0,yt=0;yt<tt;yt++)if(h=d[yt],h!==""){if(n=vt,""+h===h){if(it=h.split("^"),it[1]&&(ni=it[0].split(".").length,h=it.join("."),ni=h.split(".").length-ni),st&&(oi=st(h,vt))){tt+=oi.length-1;w.apply(d,[yt--,1].concat(oi));continue}it=h.split(".")}else hi&&!f(h)&&(h._jsvOb&&(k||(h._cb=si=ci(h,d.slice(yt+1)),si.noArray=at===!1,h._rt=wt,si._cId=c._cId),e(at,[h._rt],d.slice(0,yt),h._cb,st,k),h=h._ob),n=h),vt=h,it=[vt];while(n&&(y=it.shift())!==i)if(typeof n===s){if(""+y===y){if(y==="")continue;if(it.length<ni+1&&!n.nodeType){if(!k&&(a=rt(n)&&t._data(n))){for(a=a.events,a=a&&a[l],bt=a&&a.length,ei=0;bt--;)et=a[bt].data,et&&et.cb===c&&(et.prop===y||et.prop==="*")&&((ri=it.join("."))&&et.paths.push(ri),ei++);if(ei){n=n[y];continue}}if(y==="*"){!k&&a&&a.length&&kt(ii,"",!1,!0);f(n)?(ui=n.depends)&&e(at,[ui],c,k||wt):kt(ii,"");for(ri in n)dt(n,k,i,ri);break}else y&&kt(ii+"."+y,it.join("."))}ot&&(ot+="."+y);y=n[y]}if(f(y)){(ui=y.depends)&&e(at,[n],ut(ui,n),c,st,k||[wt]);break}n=y}dt(n,k)}return pt&&ft(gt,pt),{cbId:pt,bnd:gt,leaf:n}}function at(){return[].push.call(arguments,!0),y.apply(this,arguments)}function e(){var n=[].concat.apply([],arguments);return y.apply(n.shift(),n)}function et(n,t,i){return i.indexOf(".")<0&&i.indexOf("[")<0&&t[n]}function vt(n,r,u,f,e){return f=f||et,e=e||et,{getTgt:n,obsSrc:r,obsTgt:u,map:function(i){var o=this,h,c;return o.src!==i&&(o.src&&o.unmap(),typeof i===s&&(c=n.apply(o,arguments),t.observable&&(t.observable(i).observeAll(o.obs=function(n,t){!h&&r&&(h=!0,r.call(o,i,c,n,t),h=!1)},f),t.observable(c).observeAll(o.obt=function(n,t){!h&&u&&(h=!0,u.call(o,i,c,n,t),h=!1)},e)),o.src=i,o.tgt=c)),o},unmap:function(){if(t.observable){var n=this;n.src&&(t.observable(n.src).unobserveAll(n.obs,f),t.observable(n.tgt).unobserveAll(n.obt,e),n.src=n.tgt=i)}}}}function ot(n,t){a(this._data,n,t,[],"root")}function st(n,t){a(this._data,n,t,[],"root",!0)}function a(n,t,f,e,o,h){function v(n,i){for(l=n.length,c=o+"[]";l--;)(w=u._fltr(l,n,c,f))&&a(w,t,f||"",e.slice(0),c,i)}function k(n,i){o=n.data.observeAll._path;var r=e;e[0]!==n.target&&(e=e.slice(0),e.unshift(n.target));switch(i.change){case"insert":v(i.items);break;case"remove":v(i.items,!0);break;case"refresh":v(i.oldItems,!0);v(n.target);break;case"set":c=o+"."+i.path;a(i.oldValue,t,0,e.slice(0),c,!0);a(i.value,t,0,e.slice(0),c)}t.apply(this,arguments);e=r}var l,p,c,w;if(typeof n===s)if(p=r(n)?"":"*",e.unshift(n),t?(p||f!==0)&&(k._cId=t._cId=t._cId||b++,y(n,p,k,h,f,e.slice(),o)):y(n,p,i,h,f,e.slice(),o),p)for(l in n)l.charAt(0)!=="_"&&l!==it&&(c=o+"."+l,(w=u._fltr(l,n,c,f))&&a(w,t,f||0,e.slice(0),c,h));else v(n,h)}if(!t)throw"requires jQuery or JsRender";if(!t.observable){var o,nt,tt=t.event.special,h=t.views?t.views.sub:u.sub={},w=[].splice,r=t.isArray,it=t.expando,s="object",c=parseInt,l=h.propChng=h.propChng||"propertyChange",v=h.arrChng=h.arrChng||"arrayChange",p=h._cbBnds=h._cbBnds||{},ht=l+".observe",f=t.isFunction,ct=1,b=1,rt=t.hasData;h.DataMap=vt;t.observable=u;u._fltr=function(n,t,i,r){var u=r&&f(r)?r(n,t,i):t[n];return u&&(u=f(u)?u.set&&u.call(t):u),typeof u===s&&u};u.Object=k;u.Array=d;t.observe=u.observe=y;t.unobserve=u.unobserve=at;u._apply=e;k.prototype={_data:null,observeAll:ot,unobserveAll:st,data:function(){return this._data},setProperty:function(n,t,u){var f,h,s,e=this,o=e._data;if(n=n||"",o)if(r(n))for(f=n.length;f--;)h=n[f],e.setProperty(h.name,h.value,u===i||u);else if(""+n!==n)for(f in n)e.setProperty(f,n[f],t);else if(n!==it){for(s=n.split(".");o&&s.length>1;)o=o[s.shift()];e._setProperty(o,s.join("."),t,u)}return e},_setProperty:function(n,t,i,r){var e,o,u=t?n[t]:n;f(u)&&u.set&&(o=u,e=u.set===!0?u:u.set,u=u.call(n));(u!==i||r&&u!=i)&&(!(u instanceof Date)||u>i||u<i)&&(e?(e.call(n,i),i=o.call(n)):t&&(n[t]=i),this._trigger(n,{change:"set",path:t,value:i,oldValue:u}))},_trigger:function(n,i){t(n).triggerHandler(l,i)}};d.prototype={_data:null,observeAll:ot,unobserveAll:st,data:function(){return this._data},insert:function(n,t){var i=this._data;return arguments.length===1&&(t=n,n=i.length),n=c(n),n>-1&&n<=i.length&&(t=r(t)?t:[t],t.length&&this._insert(n,t)),this},_insert:function(n,t){var i=this._data,r=i.length;w.apply(i,[n,0].concat(t));this._trigger({change:"insert",index:n,items:t},r)},remove:function(n,t){var r,u=this._data;return n===i&&(n=u.length-1),n=c(n),t=t?c(t):t===0?0:1,t>-1&&n>-1&&(r=u.slice(n,n+t),t=r.length,t&&this._remove(n,t,r)),this},_remove:function(n,t,i){var r=this._data,u=r.length;r.splice(n,t);this._trigger({change:"remove",index:n,items:i},u)},move:function(n,t,i){if(i=i?c(i):i===0?0:1,n=c(n),t=c(t),i>0&&n>-1&&t>-1&&n!==t){var r=this._data.slice(n,n+i);i=r.length;i&&this._move(n,t,i,r)}return this},_move:function(n,t,i,r){var u=this._data,f=u.length;u.splice(n,i);u.splice.apply(u,[t,0].concat(r));this._trigger({change:"move",oldIndex:n,index:t,items:r},f)},refresh:function(n){var t=this._data.slice(0);return this._refresh(t,n),this},_refresh:function(n,t){var i=this._data,r=i.length;w.apply(i,[0,i.length].concat(t));this._trigger({change:"refresh",oldItems:n},r)},_trigger:function(n,i){var r=this._data,u=r.length,f=t([r]);f.triggerHandler(v,n);u!==i&&f.triggerHandler(l,{change:"set",path:"length",value:u,oldValue:i})}};tt[l]=tt[v]={remove:function(n){(n=n.data)&&(n.off=1,n=n.cb)&&(o=p[nt=n._cId])},teardown:function(){o&&(delete o[t.data(this,"obId")],ft(o,nt))}}}}(this,this.jQuery||this.jsviews),function(n,t,i){"use strict";function er(n){var i=this.linkedElem;i&&et({target:i[0],stopImmediatePropagation:t.noop},n)}function et(n,r){var p,w,c,f,b,l,e,k,o,a,tt,g,nt,u,s,v,y=n.target,rt=y._jsvBnd,ut=/&(\d+)\+?/g;if(rt)while(a=ut.exec(rt))if((a=h[a[1]])&&(s=a.to)){if(f=a.linkCtx,o=f.view,u=f.tag,k=t(y),g=o.hlp(wt),nt=o.hlp(bt),c=ot(y),p=gt[c],r===i&&(r=it(c)?c(y):p?k[p]():k.attr(c)),l=s[1],s=s[0],l&&(b=it(l)?l:o.getRsc("converters",l)),b&&(r=b.call(u,r)),tt=o.linkCtx,o.linkCtx=f,v={change:"change",oldValue:f._val,value:r},(!g||!(w=g.call(f,n,v)===!1))&&(!u||!u.onBeforeChange||!(w=u.onBeforeChange(n,v)===!1))&&r!==i&&(e=s[0],r!==i&&e&&(e=e._jsvOb?e._ob:e,u&&(u._.chging=!0),d(e).setProperty(s[2]||s[1],r),nt&&nt.call(f,n,v),u))){if(u.onAfterChange)u.onAfterChange(n,v);delete u._.chging}o.linkCtx=tt;w&&n.stopImmediatePropagation()}}function lu(n,t,u){var h,s,f,e=this,y=e.data,a=e.elem,l=e.convert,p=a.parentNode,b=p,o=e.view,k=o.ctx,w=o.linkCtx,v=o.hlp(wt);if(o.linkCtx=e,p&&(!v||!(t&&v.call(e,n,t)===!1))&&!(t&&n.data.prop!=="*"&&n.data.prop!==t.path)){if(t&&(e.eventArgs=t),t||e._initVal){if(delete e._initVal,s=u.call(o.tmpl,y,o,r),h=au(s,e,f,e.attr||ot(a,!0,l!==i)),f=e.tag){if(t&&f.onUpdate&&f.onUpdate(n,t,s)===!1||h==="none"){f.tagCtxs=s=s[0]?s:[s];f.tagCtx=s[0];h===c&&f.onBeforeLink&&f.onBeforeLink();ct(f,f.tagCtx);fi(e,y,a);o.linkCtx=w;return}if(f._.chging)return;s=f.tagName.slice(-1)===":"?r._cnvt(f.tagName.slice(0,-1),o,s):r._tag(f,o,o.tmpl,s,!0)}else u._ctxs&&(l=l===""?"true":l,s=l?r._cnvt(l,o,s):r._tag(u._ctxs,o,o.tmpl,s,!0),f=o._.tag,h=e.attr||h);or(s,e,h,f)&&t&&(v=o.hlp(bt))&&v.call(e,n,t)}f&&(f.contents=si,f.nodes=hi,f.childTags=ci,f.currentCtxs=yr,f.update=er,f.refresh=wr,ct(f,f.tagCtx));fi(e,y,a);o.linkCtx=w}}function au(n,r,u,f){var e,h,c,o,s=u&&u.parentElem||r.elem;if(n!==i){if(o=t(s),f=u&&u.attr||f,it(n)&&ut(r.expr+": missing parens"),f==="visible"&&(f="css-display"),c=/^css-/.test(f)&&f.slice(4))e=t.style(s,c),+n===n&&(e=parseInt(e)),e=t.style(s,c);else if(f!=="link"){if(f==="value")s.type===kt&&(e=o.prop(f=w));else if(f===rt)if(s.value===""+n)e=o.prop(w);else return f;e===i&&(h=gt[f],e=h?o[h]():o.attr(f))}r._val=e}return f}function or(n,r,u,f){var k,o,h,v,d,a,y=n!==i,g=r.data,e=f&&f.parentElem||r.elem,p=t(e),s=r.view,b=r._val,nt=s.ctx,tt=s.linkCtx,l=f||u===c;if(f&&(f.parentElem=f.parentElem||r.expr||f._elCnt?e:e.parentNode,o=f._prv,h=f._nxt),!y){u===c&&f&&f.onBeforeLink&&f.onBeforeLink();return}if(/^css-/.test(u))u==="css-display"&&(n=n?vu(e):"none"),(l=l||b!==n)&&t.style(e,u.slice(4),n);else if(u!=="link"){if(u===w)a=1,n=n&&n!=="false";else if(u===rt)if(e.value===""+n)n=!0,a=1,u=w;else{fi(r,g,e);return}else(u==="selected"||u==="disabled"||u==="multiple"||u==="readonly")&&(n=n&&n!=="false"?u:null);(k=gt[u])?u===c?(s.linkCtx=r,s.ctx=r.ctx,f&&f._.inline?(d=f.nodes(!0),f._elCnt&&(o&&o!==h&&ai(o,h,e,f._tgId,"^",!0),o=o?o.previousSibling:h?h.previousSibling:e.lastChild),t(d).remove(),f&&f.onBeforeLink&&f.onBeforeLink(),v=s.link(s.data,e,o,h,n,f&&{tag:f._tgId,lazyLink:f.tagCtx.props.lazyLink})):(y&&p.empty(),f&&f.onBeforeLink&&f.onBeforeLink(),y&&(v=s.link(g,e,o,h,n,f&&{tag:f._tgId}))),s.linkCtx=tt,s.ctx=nt):(l=l||b!==n)&&(u==="text"&&e.children&&!e.children[0]?e.textContent!==i?e.textContent=n:e.innerText=n===null?"":n:p[k](n)):(l=l||b!==n)&&p[a?"prop":"attr"](u,n===i&&!a?null:n);r._val=n}return v||l}function sr(n,t){var i=this,r=i.hlp(wt),u=i.hlp(bt);if(!r||r.call(this,n,t)!==!1){if(t){var o=t.change,f=t.index,e=t.items;switch(o){case"insert":i.addViews(f,e);break;case"remove":i.removeViews(f,e.length);break;case"move":i.refresh();break;case"refresh":i.refresh()}}u&&u.call(this,n,t)}}function vu(t){var i,u,f=n.getComputedStyle,r=(t.currentStyle||f.call(n,t,"")).display;return r!=="none"||(r=rr[u=t.nodeName])||(i=o.createElement(u),o.body.appendChild(i),r=(f?f.call(n,i,""):i.currentStyle).display,rr[u]=r,o.body.removeChild(i)),r}function ri(n){var f,e,u=n.data,r=n._.bnd;if(!n._.useKey&&r)if((e=n._.bndArr)&&(t([e[1]]).off(pt,e[0]),n._.bndArr=i),r!==!!r&&r._.inline)u?r._.arrVws[n._.id]=n:delete r._.arrVws[n._.id];else if(u){f=function(t){t.data&&t.data.off||sr.apply(n,arguments)};t([u]).on(pt,f);n._.bndArr=[f,u]}}function ot(n,t,i){var u=n.nodeName.toLowerCase(),r=f.merge[u]||n.contentEditable==="true"&&{to:c,from:c};return r?t?u==="input"&&n.type===rt?rt:r.to:r.from:t?i?"text":c:""}function hr(n,r,u,f,e,o,s){var p,c,v,w,b,l=n.parentElem,h=n._prv,a=n._nxt,y=n._elCnt;if(h&&h.parentNode!==l&&ut("Missing parentNode"),s){w=n.nodes();y&&h&&h!==a&&ai(h,a,l,n._.id,"_",!0);n.removeViews(i,i,!0);c=a;y&&(h=h?h.previousSibling:a?a.previousSibling:l.lastChild);t(w).remove();for(b in n._.bnds)at(b)}else{if(r){if(v=f[r-1],!v)return!1;h=v._nxt}y?(c=h,h=c?c.previousSibling:l.lastChild):c=h.nextSibling}p=u.render(e,o,n._.useKey&&s,n,s||r,!0);n.link(e,l,h,c,p,v)}function ui(n,t,r){var u,f,e;return r?(e="^`",f=t._.tag||{_:{inline:!0,bnd:r},tagCtx:{view:t},flow:!0},u=f._tgId,u||(h[u=ur++]=f,f._tgId=""+u)):(e="_`",v[u=t._.id]=t),"#"+u+e+(n===i?"":n)+"/"+u+e}function fi(n,t,r){var f,l,c,a=n.convertBack,u=n.tag,e=[],o=n._bndId||""+ur++,v=n._hdlr;if(delete n._bndId,u&&(c=u.linkedElem,e=u.depends||e,e=it(e)?u.depends(u):e),!n._depends||""+n._depends!=""+e){if(n._depends&&d._apply(!1,[t],n._depends,v,!0),f=d._apply(!1,[t],n.fn.paths,e,v,n._ctxCb),f.elem=r,f.linkCtx=n,f._tgId=o,r._jsvBnd=r._jsvBnd||"",r._jsvBnd+="&"+o,c)for(f.to=[[],a],l=c.length;l--;)c[l]._jsvBnd=r._jsvBnd+"+";if(n._depends=e,n.view._.bnds[o]=o,h[o]=f,u){if(u.onAfterBind)u.onAfterBind(f);u.flow||u._.inline||(r.setAttribute(s,(r.getAttribute(s)||"")+"#"+o+"^/"+o+"^"),u._tgId=""+o)}(c||a!==i)&&pr(f,a)}}function cr(n,t,i,r,u,f,e){return ei(this,n,t,i,r,u,f,e)}function ei(n,r,u,e,s,h,c,a){if(n&&r){if(r=r.jquery?r:t(r),!b){b=o.body;t(b).on(ki,et).on("blur","[contenteditable]",function(n){var t=f.noValidate;f.noValidate=!0;et(n);f.noValidate=t})}for(var k,nt,tt,g,w,d,y,it,rt=ui,ft=e&&e.target==="replace",ut=r.length;ut--;)if(y=r[ut],""+n===n)w=p(y),it=w.ctx,w.ctx=e,st(n,y,p(y),u),w.ctx=it;else{if(h=h||p(y),n.markup!==i)h.link===!1&&(e=e||{},e.link=rt=!1),ft&&(d=y.parentNode),tt=n.render(u,e,s,h,i,rt),d?(c=y.previousSibling,a=y.nextSibling,t.cleanData([y],!0),d.removeChild(y),y=d):(c=a=i,t(y).empty());else if(n!==!0)break;if(y._dfr&&!a){for(g=l(y._dfr,!0,fr),k=0,nt=g.length;k<nt;k++)w=g[k],(w=v[w.id])&&w.data!==i&&w.parent.removeViews(w._.key,i,!0);y._dfr=""}h.link(u,y,c,a,tt,i,e)}}return r}function yu(n,r,u,c,y,w,b){function au(n,t,r,u,e,o,h,c,l,a,v,p){var w,b="";return d=c||l||"",u=u||a,r=r||p,ai&&!r&&(u||d||o)&&(ai=i,it=dt.shift()),u=u||r,u&&(ai=i,f.noValidate||(r||p?ii[it]||(w="'<"+it+".../"):ii[u]?w="'<\/"+u:dt.length&&u===it||(w="Mismatch: '<\/"+u),w&&tr(w+">' in:\n"+y)),ur=rt,it=dt.shift(),rt=ti[it],a=a?"<\/"+a+">":"",ur&&(lt+=yt,yt="",rt?lt+="-":(b=a+gi+"@"+lt+di+(v||""),lt=cu.shift()))),rt?(o?yt+=o:t=a||p||"",d&&(t+=d,yt&&(t+=" "+s+'="'+yt+'"',yt=""))):t=o?t+b+e+gi+o+di+h+d:b||n,d&&(dt.unshift(it),it=d.slice(1),dt[0]&&dt[0]===uu[it]&&ut("Parent of <tr> must be <tbody>"),ai=ii[it],(rt=ti[it])&&!ur&&(cu.unshift(lt),lt=""),ur=rt,lt&&rt&&(lt+="+")),t}function yi(n,t){var o,l,u,e,f,a,s,c=[];if(n){for(n._tkns.charAt(0)==="@"&&(t=g.previousSibling,g.parentNode.removeChild(g),g=null),wt=n.length;wt--;){if(et=n[wt],u=et.ch,o=et.path)for(ft=o.length-1;l=o.charAt(ft--);)l==="+"?o.charAt(ft)==="-"?(ft--,t=t.previousSibling):t=t.parentNode:t=t.lastChild;u==="^"?(d=h[f=et.id])&&(s=t&&(!g||g.parentNode!==t),(!g||s)&&(d.parentElem=t),et.elCnt&&s&&(t._dfr=(et.open?"#":"/")+f+u+(t._dfr||"")),c.push([s?null:g,et])):(nt=v[f=et.id])&&(nt.link||(nt.parentElem=t||g&&g.parentNode||r,k(nt,vt),nt._.onRender=ui,nt._.onArrayChange=sr,ri(nt)),e=nt.parentElem,et.open?(nt._elCnt=et.elCnt,t?t._dfr="#"+f+u+(t._dfr||""):(nt._prv||(e._dfr=ht(e._dfr,"#"+f+u)),nt._prv=g)):(t&&(!g||g.parentNode!==t)?(t._dfr="/"+f+u+(t._dfr||""),nt._nxt=i):g&&(nt._nxt||(e._dfr=ht(e._dfr,"/"+f+u)),nt._nxt=g),oi=nt.linkCtx,(a=nt.ctx&&nt.ctx.onAfterCreate||yu)&&a.call(oi,nt)))}for(wt=c.length;wt--;)or.push(c[wt])}return!n||n.elCnt}function vu(n){var t,i;if(n)for(wt=n.length,ft=0;ft<wt;ft++)if(et=n[ft],at.id)at.id=at.id!==et.id&&at.id;else if(i=d=h[et.id].linkCtx.tag,!d.flow){if(!pr){for(t=1;i=i.parent;)t++;nr=nr||t}(pr||t===nr)&&(!br||d.tagName===br)&&lr.push(d)}}function tu(){for(hr=ni?r.querySelectorAll(tt):t(tt,r).get(),gt=hr.length,u&&u.innerHTML&&(pi=ni?u.querySelectorAll(tt):t(tt,u).get(),u=pi.length?pi[pi.length-1]:u),nr=0,pt=0;pt<gt;pt++)if(g=hr[pt],u&&!ou)ou=g===u;else if(c&&g===c)break;else g.parentNode&&lu(l(g,i,lr&&hu))&&!at&&g.getAttribute(a)&&or.push([g]);if(ar(u,rt),ar(c,rt),at){bt&&bt.resolve();return}for(rt&&lt+yt&&(g=c,lt&&(c?yi(l(lt+"+",!0),c):yi(l(lt,!0),r)),yi(l(yt,!0),r),c&&(ot=c.getAttribute(s),(gt=ot.indexOf(fr)+1)&&(ot=ot.slice(gt+fr.length-1)),c.setAttribute(s,yt+ot))),gt=or.length,pt=0;pt<gt;pt++)g=or[pt],kt=g[1],g=g[0],kt?(d=h[kt.id],(oi=d.linkCtx)&&(d=oi.tag,d.linkCtx=oi),kt.open?(g&&(d.parentElem=g.parentNode,d._prv=g),d._elCnt=kt.elCnt,!d||d.onBeforeLink&&d.onBeforeLink()===!1||d._.bound||(d._.bound=!0,nt=d.tagCtx.view,st(i,d._prv,nt,nt.data||n,kt.id)),d._.linking=!0):(d._nxt=g,d._.linking&&(kr=d.tagCtx,nt=kr.view,d.contents=si,d.nodes=hi,d.childTags=ci,d.currentCtxs=yr,d.update=er,d.refresh=wr,delete d._.linking,d._.bound||(d._.bound=!0,st(i,d._prv,nt,nt.data||n,kt.id)),ct(d,kr)))):(nt=p(g),st(g.getAttribute(a),g,nt,nt.data||n,i,b));bt&&bt.resolve()}var oi,d,pt,gt,ft,wt,hr,g,nt,et,kt,pi,bi,cr,ki,fi,lr,pr,br,kr,nr,at,ru,dr,fu,li,it,ai,vi,rr,ot,rt,ur,ei,yt,fr,ou,bt,nu=this,su=nu._.id+"_",lt="",or=[],dt=[],cu=[],yu=nu.hlp(gr),lu=yi;if(w&&(bt=w.lazyLink&&t.Deferred(),w.tmpl?cr="/"+w._.id+"_":(at=w.get,w.tag&&(su=w.tag+"^",w=!0)),w=w===!0),at&&(lu=vu,lr=at.tags,pr=at.deep,br=at.name),r=r?""+r===r?t(r)[0]:r.jquery?r[0]:r:nu.parentElem||o.body,it=r.tagName.toLowerCase(),rt=!!ti[it],u=u&&vr(u,rt),c=c&&vr(c,rt)||null,y!==i){if(rr=o.createElement("div"),vi=rr,fr=yt="",ei=r.namespaceURI==="http://www.w3.org/2000/svg"?"svg_ns":(li=iu.exec(y))&&li[1]||"",wi&&li&&li[2]&&ut("Unsupported: "+li[2]),rt){for(fi=c;fi&&!(ki=l(fi));)fi=fi.nextSibling;(ot=ki?ki._tkns:r._dfr)&&(bi=cr||"",(w||!cr)&&(bi+="#"+su),ft=ot.indexOf(bi),ft+1&&(ft+=bi.length,fr=yt=ot.slice(0,ft),ot=ot.slice(ft),ki?fi.setAttribute(s,ot):r._dfr=ot))}for(ai=i,y=(""+y).replace(eu,au),!f.noValidate&&dt.length&&tr("Mismatched '<"+it+"...>' in:\n"+y),ir.appendChild(rr),ei=e[ei]||e.div,ru=ei[0],vi.innerHTML=ei[1]+y+ei[2];ru--;)vi=vi.lastChild;for(ir.removeChild(rr),dr=o.createDocumentFragment();fu=vi.firstChild;)dr.appendChild(fu);r.insertBefore(dr,c)}return bt?setTimeout(tu,0):tu(),bt&&bt.promise()}function st(n,t,r,f,e,o){var w,v,b,l,k,d,y,p,a,s,tt;if(e)s=h[e],s=s.linkCtx?s.linkCtx.tag:s,a=s.linkCtx||{data:f,elem:s._elCnt?s.parentElem:t,view:r,ctx:r.ctx,attr:c,fn:s._.bnd,tag:s,_bndId:e},lr(a,a.fn);else if(n&&t)for(w=r.tmpl,n=pu(n,ot(t)),g.lastIndex=0;v=g.exec(n);)tt=g.lastIndex,b=e?c:v[1],y=v[3],k=v[10],l=i,a={data:f,elem:s&&s._elCnt?s.parentElem:t,view:r,ctx:o||r.ctx,attr:b,_initVal:!v[2]},v[6]&&(!b&&(l=/:([\w$]*)$/.exec(k))&&(l=l[1],l!==i&&(d=-l.length-1,y=y.slice(0,d-1)+nt,k=k.slice(0,d))),l===null&&(l=i),a.convert=v[5]||""),a.expr=b+y,p=w.links[y],p||(w.links[y]=p=u.tmplFn(vi+y+yi,w,!0,l),u.parse(k,p.paths=[],w)),a.fn=p,b||l===i||(a.convertBack=l),lr(a,p),g.lastIndex=tt}function lr(n,t){function i(i,r){lu.call(n,i,r,t)}i.noArray=!0;n._ctxCb=wu(n.view);n._hdlr=i;i(!0)}function ht(n,t){var i;return n?(i=n.indexOf(t),i+1?n.slice(0,i)+n.slice(i+t.length):n):""}function oi(n){return n&&(""+n===n?n:n.tagName==="SCRIPT"?n.type.slice(3):n.nodeType===1&&n.getAttribute(s)||"")}function l(n,t,i){function e(n,t,i,r,e,o){u.push({elCnt:f,id:r,ch:e,open:t,close:i,path:o,token:n})}var f,r,u=[];if(r=t?n:oi(n))return u.elCnt=!n.type,f=r.charAt(0)==="@"||!n.type,u._tkns=r,r.replace(i||cu,e),u}function ar(n,t){n&&(n.type==="jsv"?n.parentNode.removeChild(n):t&&n.getAttribute(a)===""&&n.removeAttribute(a))}function vr(n,t){for(var i=n;t&&i&&i.nodeType!==1;)i=i.previousSibling;return i&&(i.nodeType!==1?(i=o.createElement("SCRIPT"),i.type="jsv",n.parentNode.insertBefore(i,n)):oi(i)||i.getAttribute(a)||i.setAttribute(a,"")),i}function pu(n,i){return n=t.trim(n).replace(ru,"\\$&"),n.slice(-1)!==nt?n=yt+":"+n+(i?":":"")+nt:n}function si(n,r){n!==!!n&&(r=n,n=i);var f,u=t(this.nodes());return u[0]&&(f=r?u.filter(r):u,u=n&&r?f.add(u.find(r)):f),u}function hi(n,t,i){var r,u=this,f=u._elCnt,o=!t&&f,e=[];for(t=t||u._prv,i=i||u._nxt,r=o?t===u._nxt?u.parentElem.lastSibling:t:u._.inline===!1?t||u.linkCtx.elem.firstChild:t&&t.nextSibling;r&&(!i||r!==i);)(n||f||r.tagName!=="SCRIPT")&&e.push(r),r=r.nextSibling;return e}function ci(n,t){n!==!!n&&(t=n,n=i);var r=this,o=r.link?r:r.tagCtx.view,u=r._prv,f=r._elCnt,e=[];return u&&o.link(i,r.parentElem,f?u.previousSibling:u,r._nxt,i,{get:{tags:e,deep:n,name:t,id:f&&r._tgId}}),e}function yr(){var n=this.tagCtx.view;return this._.bnd.call(n.tmpl,n.data,n,r)}function ct(n,t){var o,s,u,a,f,v,y,p,c,l=t.view,e=n.linkCtx=n.linkCtx||{tag:n,data:l.data,view:l,ctx:l.ctx};if(n.onAfterLink)n.onAfterLink(t,e);if(s=n.targetTag?n.targetTag.linkedElem:n.linkedElem,!n._.chging&&s&&(u=s[0])){if(a=u.type===rt,o=e.convert,f=o?it(o)?o(t.args[0]):r._cnvt(o,l,t):t.args[0],u!==e.elem)for(p=s.length;p--;){if(u=s[p],c=u._jsvLnkdEl,n._.inline&&(!c||c!==n&&c.targetTag!==n))for(u._jsvLnkdEl=n,u._jsvBnd=e.elem?e.elem._jsvBnd:n._prv._jsvBnd,v=u._jsvBnd.slice(1).split("&"),y=v.length;y--;)pr(h[v[y]],e.convertBack);a&&(u[w]=f===u.value)}a||u.value===i||f===i||(u.type===kt?u[w]=f&&f!=="false":u.value=f)}}function pr(n,t){var e,f,r,o,u=n.linkCtx,s=u.data,i=u.fn.paths;if(n){for((e=i._jsvto)&&(i=e),f=i.length;f&&""+(r=i[--f])!==r;);r&&(!u.tag||u.tag.tagCtx.args.length)?(r=i[f]=r.split("^").join("."),n.to=r.charAt(0)==="."?[[o=i[f-1],r.slice(1)],t]:[u._ctxCb(i[0])||[s,i[0]],t],e&&o&&(n.to[0][0]=u._ctxCb(o,s))):n.to=[[],t]}}function wr(n){var u,f,t=this,e=t.linkCtx,o=t.tagCtx.view;return t.disposed&&ut("Removed tag"),n===i&&(n=r._tag(t,o,o.tmpl,t.currentCtxs?t.currentCtxs():t.tagCtxs,!0)),n+""===n&&(f=t._.inline?c:e.attr||ot(t.parentElem,!0),u=or(n,e,f,t)),ct(t,t.tagCtx),u||t}function lt(n){for(var e,o,h,r,s,t,u,c=[],a=n.length,f=a;f--;)c.push(n[f]);for(f=a;f--;)if(r=c[f],r.parentNode){if(u=r._jsvBnd)for(u=u.slice(1).split("&"),r._jsvBnd="",o=u.length;o--;)at(u[o],r._jsvLnkdEl);if(s=l(oi(r)+(r._dfr||""),!0,ou))for(e=0,h=s.length;e<h;e++)t=s[e],t.ch==="_"?(t=v[t.id])&&t.data!==i&&t.parent.removeViews(t._.key,i,!0):at(t.id)}}function at(n,i){var c,e,r,o,s,l,a,v,f=h[n];if(f)if(e=f.linkCtx,r=e.tag,i)delete r.linkedElem;else{for(c in f.bnd)o=f.bnd[c],s=".obs"+f.cbId,t.isArray(o)?t([o]).off(pt+s).off(bi+s):t(o).off(bi+s),delete f.bnd[c];if(e=f.linkCtx,r){if(l=r.tagCtxs)for(a=l.length;a--;)(v=l[a].map)&&v.unmap();r.onDispose&&r.onDispose();r._elCnt||(r._prv&&r._prv.parentNode.removeChild(r._prv),r._nxt&&r._nxt.parentNode.removeChild(r._nxt));r.disposed=!0}delete e.view._.bnds[n];delete h[n];delete u._cbBnds[f.cbId]}}function li(n,r){return n===i?(b&&(t(b).off(ki,et),b=i),n=!0,y.removeViews(),lt(o.body.getElementsByTagName("*"))):r&&(r=r.jquery?r:t(r),n===!0?r.each(function(){for(var n;(n=p(this,!0))&&n.parent;)n.parent.removeViews(n._.key,i,!0);lt(this.getElementsByTagName("*"))}):n===i&&lt(r)),r}function br(n,t){return li(this,n,t)}function wu(n){return n=n||t.view(),function(t,i){var f,u,e=[i];if(n&&t){if(t._jsvOb)return t._jsvOb.call(n.tmpl,i,n,r);if(t.charAt(0)==="~")return t.slice(0,4)==="~tag"&&(u=n.ctx,t.charAt(4)==="."&&(f=t.slice(5).split("."),u=u.tag),f)?u?[u,f.join("."),i]:[]:(t=t.slice(1).split("."),(i=n.hlp(t.shift()))&&(t.length&&e.unshift(t.join(".")),e.unshift(i)),i?e:[]);if(t.charAt(0)==="#")return t==="#data"?[]:[n,t.replace(fu,""),i]}}}function bu(n){return n.type===kt?n[w]:n.value}function ai(n,t,i,r,u,f){var y,c,p,o,b,a,e,w=0,k=n===t;if(n){for(p=l(n)||[],y=0,c=p.length;y<c;y++){if(o=p[y],a=o.id,a===r&&o.ch===u)if(f)c=0;else break;k||(b=o.ch==="_"?v[a]:h[a].linkCtx.tag,o.open?b._prv=t:o.close&&(b._nxt=t));w+=a.length+2}w&&n.setAttribute(s,n.getAttribute(s).slice(w));e=t?t.getAttribute(s):i._dfr;(c=e.indexOf("/"+r+u)+1)&&(e=p._tkns.slice(0,w)+e.slice(c+(f?-1:r.length+1)));e&&(t?t.setAttribute(s,e):i._dfr=e)}else i._dfr=ht(i._dfr,"#"+r+u),f||t||(i._dfr=ht(i._dfr,"/"+r+u))}function ku(n,i,r,u){switch(u.change){case"set":for(var f=i.length;f--;)if(i[f].key===u.path)break;f===-1?u.path&&t.observable(i).insert({key:u.path,prop:u.value}):u.value===null?(delete n[u.path],t.observable(i).remove(f)):t.observable(i[f]).setProperty("prop",u.value)}}function du(n,i,r,u){var f;switch(u.change){case"set":u.path==="prop"?t.observable(n).setProperty(r.target.key,u.value):(t.observable(n).setProperty(u.oldValue,null),delete n[u.oldValue],t.observable(n).setProperty(u.value,r.target.prop));break;case"remove":f=u.items[0];t.observable(n).setProperty(f.key,null);delete n[f.key];break;case"insert":f=u.items[0];f.key&&t.observable(n).setProperty(f.key,f.prop)}}function gu(n,t,i){return i.indexOf(".")<0&&t[n]}if(!t)throw"requires jQuery";if(!t.views)throw"requires JsRender";if(!t.observable)throw"requires jquery.observable";if(!t.link){var vt,b,p,g,vi,yt,nt,yi,pi,wi,a,tt,e,o=n.document,r=t.views,u=r.sub,f=r.settings,k=u.extend,y=u.View(i,"top"),it=t.isFunction,kr=r.templates,dr=r.converters,d=t.observable,ft=d.observe,s="data-jsv",bi=u.propChng=u.propChng||"propertyChange",pt=u.arrChng=u.arrChng||"arrayChange",nf=u._cbBnds=u._cbBnds||{},ki="change.jsv",wt="onBeforeChange",bt="onAfterChange",gr="onAfterCreate",w="checked",kt="checkbox",rt="radio",di='"><\/script>',gi='<script type="jsv',dt="script,["+s+"]",c="html",gt={value:"val",input:"val",html:c,text:"text"},nr={from:"value",to:"value"},nu=t.cleanData,tu=f.delimiters,ut=u.error,tr=u.syntaxError,iu=/<(?!script)(\w+)(?:[^>]*(on\w+)\s*=)?[^>]*>/,ru=/['"\\]/g,ir=o.createDocumentFragment(),ni=o.querySelector,ti={ol:1,ul:1,table:1,tbody:1,thead:1,tfoot:1,tr:1,colgroup:1,dl:1,select:1,optgroup:1,svg:1,svg_ns:1},uu={tr:"table"},ii={br:1,img:1,input:1,hr:1,area:1,base:1,col:1,link:1,meta:1,command:1,embed:1,keygen:1,param:1,source:1,track:1,wbr:1},rr={},v={0:y},h={},ur=1,fu=/^#(view\.?)?/,eu=/(^|(\/>)|<\/(\w+)>|>|)(\s*)([#\/]\d+[_^])`(\s*)(<\w+(?=[\s\/>]))?|\s*(?:(<\w+(?=[\s\/>]))|<\/(\w+)>(\s*)|(\/>)\s*)/g,fr=/(#)()(\d+)(_)/g,ou=/(#)()(\d+)([_^])/g,su=/(?:(#)|(\/))(\d+)(_)/g,hu=/(#)()(\d+)(\^)/g,cu=/(?:(#)|(\/))(\d+)([_^])([-+@\d]+)?/g;u.onStoreItem=function(n,i,r){r&&n===kr&&(r.link=cr,r.unlink=br,i&&(t.link[i]=function(){return cr.apply(r,arguments)},t.unlink[i]=function(){return br.apply(r,arguments)}))};(f.delimiters=function(){var n=tu.apply(r,arguments);return vi=n[0],yt=n[1],nt=n[2],yi=n[3],pi=n[4],g=new RegExp("(?:^|\\s*)([\\w-]*)(\\"+pi+")?(\\"+yt+u.rTag+"\\"+nt+")","g"),this})();u.viewInfos=l;vt={addViews:function(n,t,i){var u,o,r=this,f=t.length,e=r.views;if(!r._.useKey&&f&&(i=r.tmpl)&&(o=e.length+f,hr(r,n,i,e,t,r.ctx)!==!1))for(u=n+f;u<o;u++)d(e[u]).setProperty("index",u);return r},removeViews:function(n,r,u){function o(n){var s,h,c,e,o,l,r=f[n];if(r&&r.link){if(s=r._.id,u||(l=r.nodes()),r.removeViews(i,i,!0),r.data=i,e=r._prv,o=r._nxt,c=r.parentElem,u||(r._elCnt&&ai(e,o,c,s,"_"),t(l).remove()),!r._elCnt)try{e.parentNode.removeChild(e);o.parentNode.removeChild(o)}catch(a){}ri(r);for(h in r._.bnds)at(h);delete v[s]}}var e,l,s,h=this,c=!h._.useKey,f=h.views;if(c&&(s=f.length),n===i)if(c){for(e=s;e--;)o(e);h.views=[]}else{for(l in f)o(l);h.views={}}else if(r===i&&(c?r=1:(o(n),delete f[n])),c&&r){for(e=n+r;e-->n;)o(e);if(f.splice(n,r),s=f.length)while(n<s)d(f[n]).setProperty("index",n++)}return this},refresh:function(n){var t=this,i=t.parent;return i&&(hr(t,t.index,t.tmpl,i.views,t.data,n,!0),ri(t)),t},nodes:hi,contents:si,childTags:ci,link:yu};dr.merge=function(n){var t,i=this.linkCtx._val||"",r=this.tagCtx.props.toggle;return r&&(t=r.replace(/[\\^$.|?*+()[{]/g,"\\$&"),t="(\\s(?="+t+"$)|(\\s)|^)("+t+"(\\s|$))",i=i.replace(new RegExp(t),"$2"),n=i+(n?(i&&" ")+r:"")),n};r.tags("on",{attr:"none",onAfterLink:function(n,r){var o=this,s=t(r.elem),f=n.args,u=n.props.data,e=f.pop(),h=f[1]||null,c=n.props.context;if(u=u!==i?u:null,e&&e.call)s.on(f[0]||"click",h,u,function(n){e.call(c||o.leaf,n,{change:n.type,view:r.view,linkCtx:r})})},onAfterBind:function(n){this.leaf=n.leaf},flow:!0});k(r.tags["for"],{onArrayChange:function(n,t){var i,r=this,u=t.change;if(r.tagCtxs[1]&&(u==="insert"&&n.target.length===t.items.length||u==="remove"&&!n.target.length||u==="refresh"&&!t.oldItems.length!=!n.target.length))r.refresh();else for(i in r._.arrVws)i=r._.arrVws[i],i.data===n.target&&i._.onArrayChange.apply(i,arguments);n.done=!0},onAfterLink:function(){for(var u,o,i,f,e=this,r=e._ars||{},s=e.tagCtxs,c=s.length,h=e.selected||0,n=0;n<=h;n++)u=s[n],f=u.map?u.map.tgt:u.args.length?u.args[0]:u.view.data,(i=r[n])&&f!==i[0]&&(ft(i[0],i[1],!0),delete r[n]),!r[n]&&t.isArray(f)&&(ft(f,o=function(n,t){e.onArrayChange(n,t)}),r[n]=[f,o]);for(n=h+1;n<c;n++)(i=r[n])&&(ft(i[0],i[1],!0),delete r[n]);e._ars=r},onDispose:function(){var n,t=this;for(n in t._ars)ft(t._ars[n][0],t._ars[n][1],!0)}});r.tags({props:t.extend({},r.tags["for"],u.DataMap(r.tags.props.getTgt,ku,du,i,gu))});k(t,{view:r.view=p=function(n,r,u){r!==!!r&&(u=r,r=i);var f,e,h,c,w,s,b,a,p=0,k=o.body;if(n&&n!==k&&y._.useKey>1&&(n=""+n===n?t(n)[0]:n.jquery?n[0]:n,n))if(r){for(a=ni?n.querySelectorAll(dt):t(dt,n).get(),s=a.length,h=0;h<s;h++)for(b=a[h],e=l(b,i,fr),c=0,w=e.length;c<w;c++)if(f=e[c],(f=v[f.id])&&(f=f&&u?f.get(!0,u):f,f))return f}else while(n){if(e=l(n,i,su))for(s=e.length;s--;)if(f=e[s],f.open){if(p<1)return f=v[f.id],f&&u?f.get(u):f||y;p--}else p++;n=n.previousSibling||n.parentNode}return r?i:y},link:r.link=ei,unlink:r.unlink=li,cleanData:function(n){n.length&&(lt(n),nu.call(t,n))}});k(t.fn,{link:function(n,t,i,r,u,f,e){return ei(n,this,t,i,r,u,f,e)},unlink:function(n){return li(n,this)},view:function(n){return p(this[0],n)}});k(y,{tmpl:{links:{},tags:{}}});k(y,vt);y._.onRender=ui;f({wrapMap:e={option:[1,"<select multiple='multiple'>","<\/select>"],legend:[1,"<fieldset>","<\/fieldset>"],area:[1,"<map>","<\/map>"],param:[1,"<object>","<\/object>"],thead:[1,"<table>","<\/table>"],tr:[2,"<table><tbody>","<\/tbody><\/table>"],td:[3,"<table><tbody><tr>","<\/tr><\/tbody><\/table>"],col:[2,"<table><tbody><\/tbody><colgroup>","<\/colgroup><\/table>"],svg_ns:[1,"<svg>","<\/svg>"],div:jQuery.support.htmlSerialize?[0,"",""]:[1,"X<div>","<\/div>"]},linkAttr:a="data-link",merge:{input:{from:bu,to:"value"},textarea:nr,select:nr,optgroup:{to:"label"}},jsrDbgMode:f.debugMode,debugMode:function(t){f.jsrDbgMode(t);t?n._jsv={views:v,bindings:h}:delete n._jsv},jsv:function(){f.debugMode(f._dbgMode);a=f.linkAttr;tt=dt+",["+a+"]";wi=f.noDomLevel0;e.optgroup=e.option;e.tbody=e.tfoot=e.colgroup=e.caption=e.thead;e.th=e.td}})}}(this,this.jQuery)