forked from BorisMoore/jsviews
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsviews.min.js
5 lines (5 loc) · 48.7 KB
/
jsviews.min.js
1
2
3
4
5
/*! 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: 63 (Beta Candidate) */
(function(n,t,i){"use strict";function gt(n,t){return function(){var r,i=this,u=i.base;return i.base=n,r=t.apply(i,arguments),i.base=u,r}}function ni(n,t){return y(t)&&(t=gt(n?n._d?n:gt(ii,n):ii,t),t._d=1),t}function et(n,t){for(var i in t.props)bt.test(i)&&(n[i]=ni(n[i],t.props[i]))}function ti(n){return n}function ii(){return""}function er(n){return this.base?this.baseApply(arguments):n}function ri(n){s._dbgMode=n;pt=n?"Unavailable (nested view): use #getIndex()":"";vt("dbg",pi.dbg=tt.dbg=n?er:ti)}function ot(n){this.name=(r.link?"JsViews":"JsRender")+" Error";this.message=n||this.name}function f(n,t){for(var i in t)n[i]=t[i];return n}function y(n){return typeof n=="function"}function ui(n,t,i){return(!o.rTag||n)&&(w=n?n.charAt(0):w,b=n?n.charAt(1):b,h=t?t.charAt(0):h,v=t?t.charAt(1):v,nt=i||nt,n="\\"+w+"(\\"+nt+")?\\"+b,t="\\"+h+"\\"+v,p="(?:(?:(\\w+(?=[\\/\\s\\"+h+"]))|(?:(\\w+)?(:)|(>)|!--((?:[^-]|-(?!-))*)--|(\\*)))\\s*((?:[^\\"+h+"]|\\"+h+"(?!\\"+v+"))*?)",o.rTag=p+")",p=new RegExp(n+p+"(\\/)?|(?:\\/(\\w+)))"+t,"g"),yt=new RegExp("<.*>|([^\\\\]|^)[{}]|"+n+".*"+t)),[w,b,h,v,nt]}function or(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 fi(){var n=this.get("item");return n?n.index:i}function ei(){return this.index}function sr(t){var u,e=this,o=e.linkCtx,r=(e.ctx||{})[t];return r===i&&o&&o.ctx&&(r=o.ctx[t]),r===i&&(r=pi[t]),r&&y(r)&&!r._wrp&&(u=function(){return r.apply(!this||this===n?e:this,arguments)},u._wrp=!0,f(u,r)),u||r}function hr(n,t,r,e){var s,h,l=+r===r&&t.tmpl.bnds[r-1],c=t.linkCtx;return e=e!==i&&{props:{},args:[e]},r=e||(l?l(t.data,t,u):r),h=r.args[0],(n||l)&&(s=c&&c.tag,s||(s=f(new o._tg,{_:{inline:!c,bnd:l,unlinked:!0},tagName:":",cvt:n,flow:!0,tagCtx:r}),c&&(c.tag=s,s.linkCtx=c),r.ctx=a(r.ctx,(c?c.view:t).ctx)),s._er=e&&h,et(s,r),r.view=t,s.ctx=r.ctx||{},delete r.ctx,t._.tag=s,h=st(s,s.convert||n!=="true"&&n)[0],h=l&&t._.onRender?t._.onRender(h,t,l):h,t._.tag=i),h!=i?h:""}function st(n,t){var r=n.tagCtx,u=r.view,i=r.args;return t=t&&(""+t===t?u.getRsc("converters",t)||l("Unknown converter: '"+t+"'"):t),i=!i.length&&!r.index?[u.data]:t?i.slice():i,t&&(t.depends&&(n.depends=o.getDeps(n.depends,n,t.depends,t)),i[0]=t.apply(n,i)),i}function cr(n,t){for(var f,e,r=this;f===i&&r;)e=r.tmpl[n],f=e&&e[t],r=r.parent;return f||u[n][t]}function lr(n,t,r,o,s,h){var c,ct,lt,ut,y,at,g,v,ft,nt,ot,vt,yt,b,w,ht,pt,d="",p=t.linkCtx||0,it=t.ctx,wt=r||t.tmpl,rt=+o===o&&wt.bnds[o-1];for(n._is==="tag"&&(c=n,n=c.tagName,o=c.tagCtxs),c=c||p.tag,h=h!==i&&(d+=h,[{props:{},args:[]}]),o=h||(rt?rt(t.data,t,u):o),at=o.length,y=0;y<at;y++)y||r&&c||(ot=t.getRsc("tags",n)||l("Unknown tag: {{"+n+"}}")),v=o[y],(!p.tag||y&&!p.tag._.inline||c._er)&&(nt=v.tmpl,nt=v.content=nt&&wt.tmpls[nt-1],f(v,{tmpl:(c?c:ot).template||nt,render:li,index:y,view:t,ctx:a(v.ctx,it)})),(r=v.props.tmpl)&&(r=""+r===r?t.getRsc("templates",r)||e(r):r,v.tmpl=r),c||(c=new ot._ctr,vt=!!c.init,c._={inline:!p,unlinked:!0},p&&(p.tag=c,c.linkCtx=p),(c._.bnd=rt||p.fn)?c._.arrVws={}:c.dataBoundOnly&&l("{^{"+n+"}} tag must be data-bound"),c.tagName=n,c.parent=ut=it&&it.tag,c._def=ot,c.tagCtxs=o),v.tag=c,c.dataMap&&c.tagCtxs&&(v.map=c.tagCtxs[y].map),c.flow||(ft=v.ctx=v.ctx||{},ct=c.parents=ft.parentTags=it&&a(ft.parentTags,it.parentTags)||{},ut&&(ct[ut.tagName]=ut),ct[c.tagName]=ft.tag=c);if(t._.tag=c,!(c._er=h)){for(et(c,o[0]),c.rendering={},y=0;y<at;y++)v=c.tagCtx=c.tagCtxs[y],ht=v.props,w=st(c,c.convert),(yt=ht.dataMap||c.dataMap)&&(w.length||ht.dataMap)&&(b=v.map,(!b||b.src!==w[0]||s)&&(b&&b.src&&b.unmap(),b=v.map=yt.map(w[0],ht)),w=[b.tgt]),c.ctx=v.ctx,!y&&vt&&(pt=c.template,c.init(v,p,c.ctx),vt=i,c.template!==pt&&(c._.tmpl=c.template)),p&&(p.attr=c.attr=p.attr||c.attr),g=i,c.render&&(g=c.render.apply(c,w)),w=w.length?w:[t],g=g!==i?g:v.render(w[0],!0)||(s?i:""),d=d?d+(g||""):g;delete c.rendering}return c.tagCtx=c.tagCtxs[0],c.ctx=c.tagCtx.ctx,c._.inline&&(lt=c.attr)&<!==k&&(d=lt==="text"?tt.html(d):""),rt&&t._.onRender?t._.onRender(d,t,rt):d}function g(n,t,i,r,u,f,e,o){var a,h,c,s=this,v=t==="array",l={key:0,useKey:v?0:1,id:""+fr++,onRender:o,bnds:{}};s.data=r;s.tmpl=u;s.content=e;s.views=v?[]:{};s.parent=i;s.type=t||"top";s._=l;s.linked=!!o;i?(a=i.views,h=i._,h.useKey?(a[l.key="_"+h.useKey++]=s,s.index=pt,s.getIndex=fi,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}function ar(n){var i,r,t,u,e,f,s;for(i in d)if(e=d[i],(f=e.compile)&&(r=n[i+"s"]))for(t in r)u=r[t]=f(t,r[t],n),u&&(s=o.onStore[i])&&s(t,u,f)}function vr(n,t,r){var l,h,s,c,u=new o._tg;if(y(t)&&(t={depends:t.depends,render:t}),s=t.baseTag){t.flow=!!t.flow;t.baseTag=s=""+s===s?r&&r.tags[s]||vt[s]:s;u=f(u,s);for(c in t)u[c]=ni(s[c],t[c])}else u=f(u,t);return(h=u.template)!==i&&(u.template=""+h===h?e[h]||e(h):h),u.init!==!1&&(l=u._ctr=function(){},(l.prototype=u).constructor=l),r&&(u._parentTmpl=r),u}function yr(n){return this.base.apply(this,n)}function oi(r,u,f,o){function c(u){if(""+u===u||u.nodeType>0){try{h=u.nodeType>0?u:!yt.test(u)&&t&&t(n.document).find(u)[0]}catch(s){}return h&&(u=e[r=r||h.getAttribute(ft)],u||(r=r||"_"+ur++,h.setAttribute(ft,r),u=e[r]=oi(r,h.innerHTML,f,o)),h=i),u}}var s,h;return u=u||"",s=c(u),o=o||(u.markup?u:{}),o.tmplName=r,f&&(o._parentTmpl=f),!s&&u.markup&&(s=c(u.markup))&&s.fn&&(s.debug!==u.debug||s.allowCode!==u.allowCode)&&(s=s.markup),s!==i?(r&&!f&&(dt[r]=function(){return u.render.apply(u,arguments)}),s.fn||u.fn?s.fn&&(u=r&&r!==s.tmplName?a(o,s):s):(u=hi(s,o),ct(s.replace(di,"\\$&"),u)),ar(o),u):void 0}function si(n){function t(t,i){this.tgt=n.getTgt(t,i)}return y(n)&&(n={getTgt:n}),n.baseMap&&(n=f(f({},n.baseMap),n)),n.map=function(n,i){return new t(n,i)},n}function hi(n,t){var i,e=s.wrapMap||{},u=f({markup:n,tmpls:[],links:{},tags:{},bnds:[],_is:"template",render:ci},t);return t.htmlTag||(i=tr.exec(n),u.htmlTag=i?i[1].toLowerCase():""),i=e[u.htmlTag],i&&i!==e.div&&(u.markup=r.trim(u.markup)),u}function pr(n,t){function r(e,s,h){var v,c,l,a;if(e&&typeof e===ut&&!e.nodeType&&!e.markup&&!e.getTgt){for(l in e)r(l,e[l],s);return u}return s===i&&(s=e,e=i),e&&""+e!==e&&(h=s,s=e,e=i),a=h?h[f]=h[f]||{}:r,c=t.compile,s===null?e&&delete a[e]:(s=c?s=c(e,s,h):s,e&&(a[e]=s)),c&&s&&(s._is=n),s&&(v=o.onStore[n])&&v(e,s,c),s}var f=n+"s";u[f]=r;d[n]=t}function wr(n,t,i){var r=this.jquery&&(this[0]||l('Unknown template: "'+this.selector+'"')),u=r.getAttribute(ft);return ci.call(u?e[u]:e(r),n,t,i)}function ht(n,t,i){if(s._dbgMode)try{return n.fn(t,i,u)}catch(r){return l(r,i)}return n.fn(t,i,u)}function ci(n,t,i,u,f,e){var o=this;return!u&&o.fn._nvw&&!r.isArray(n)?ht(o,n,{tmpl:o}):li.call(o,n,t,i,u,f,e)}function li(n,t,u,o,s,h){function st(n){nt=f({},t);nt[p]=n}var w,ct,y,ft,et,ot,b,d,tt,it,lt,l,at,p,nt,v=this,rt="";if(!!t===t&&(u=t,t=i),typeof t!==ut&&(t=i),s===!0&&(ot=!0,s=0),v.tag?(b=v,v=v.tag,tt=v._,lt=v.tagName,l=tt.tmpl||b.tmpl,tt.noVws=at=v.attr&&v.attr!==k,t=a(t,v.ctx),d=b.content,b.props.link===!1&&(t=t||{},t.link=!1),o=o||b.view,(p=b.props.itemVar)&&(p.charAt(0)!=="~"&&c("Use itemVar='~myItem'"),p=p.slice(1)),n=arguments.length?n:o):l=v,l&&(!o&&n&&n._is==="view"&&(o=n),o&&(d=d||o.content,h=h||o._.onRender,n===o&&(n=o.data),t=a(t,o.ctx)),o&&o.type!=="top"||((t=t||{}).root=n),l.fn||(l=e[l]||e(l)),l)){if(h=(t&&t.link)!==!1&&!at&&h,it=h,h===!0&&(it=i,h=o._.onRender),t=l.helpers?a(l.helpers,t):t,nt=t,r.isArray(n)&&!u)for(y=ot?o:s!==i&&o||new g(t,"array",o,n,l,s,d,h),p&&(y.it=p),p=y.it,w=0,ct=n.length;w<ct;w++)p&&st(n[w]),ft=new g(nt,"item",y,n[w],l,(s||0)+w,d,h),et=ht(l,n[w],ft),rt+=y._.onRender?y._.onRender(et,ft):et;else p&&st(n),y=ot?o:new g(nt,lt||"data",o,n,l,s,d,h),tt&&!v.flow&&(y.tag=v),rt+=ht(l,n,y);return it?it(rt,y):rt}return""}function l(n,t,i){var r=s.onError(n,t,i);if(""+n===n)throw new o.Err(r);return!t.linkCtx&&t.linked?tt.html(r):r}function c(n){l("Syntax error\n"+n)}function ct(n,t,i,r,u){function d(t){t-=e;t&&l.push(n.substr(e,t).replace(rt,"\\n"))}function a(t){t&&c('Unmatched or missing tag: "{{/'+t+'}}" in template:\n'+n)}function g(o,s,v,p,w,g,tt,it,ut,ft,et,ot){g&&(w=":",p=k);ft=ft||i&&!u;var st=(s||i)&&[[]],ct="",lt="",at="",vt="",yt="",pt="",kt="",dt="",ht=!ft&&!w&&!tt;v=v||(ut=ut||"#data",w);d(ot);e=ot+o.length;it?nt&&l.push(["*","\n"+ut.replace(wt,"$1")+"\n"]):v?(v==="else"&&(nr.test(ut)&&c('for "{{else if expr}}" use "{{else expr}}"'),st=f[7]&&[[]],f[8]=n.substring(f[8],ot),f=h.pop(),l=f[2],ht=!0),ut&&yi(ut.replace(rt," "),st,t).replace(gi,function(n,t,i,r,u,f,e,o){return e?(lt+=f+",",vt+="'"+o+"',"):i?(at+=r+f+",",pt+=r+"'"+o+"',"):t?kt+=f:(u==="trigger"&&(dt+=f),ct+=r+f+",",yt+=r+"'"+o+"',",b=b||bt.test(u)),""}).slice(0,-1),st&&st[0]&&st.pop(),y=[v,p||!!r||b||"",ht&&[],ai(vt,yt,pt),ai(lt,ct,at),kt,dt,st||0],l.push(y),ht&&(h.push(f),f=y,f[8]=e)):et&&(a(et!==f[0]&&f[0]!=="else"&&et),f[8]=n.substring(f[8],ot),f=h.pop());a(!f&&et);l=f[2]}var s,y,b,nt=t&&t.allowCode,o=[],e=0,h=[],l=o,f=[,,o];return i&&(n=w+n+v),a(h[0]&&h[0][2].pop()[0]),n.replace(p,g),d(n.length),(e=o[o.length-1])&&a(""+e!==e&&+e[8]===e[8]&&e[0]),i?(s=at(o,n,i),lt(s,[o[0][7]])):s=at(o,t),s._nvw&&(s._nvw=!/[~#]/.test(n)),s}function lt(n,t){var r,i,u=0,f=t.length;for(n.deps=[];u<f;u++){i=t[u];for(r in i)r!=="_jsvto"&&i[r].length&&(n.deps=n.deps.concat(i[r]))}n.paths=i}function ai(n,t,i){return[n.slice(0,-1),t.slice(0,-1),i.slice(0,-1)]}function vi(n,t){return"\n\t"+(t?t+":{":"")+"args:["+n[0]+"]"+(n[1]||!t?",\n\tprops:{"+n[1]+"}":"")+(n[2]?",\n\tctx:{"+n[2]+"}":"")}function yi(n,t,i){function d(d,g,nt,tt,it,rt,ut,ft,et,ot,st,ht,lt,at,vt,yt,pt,wt,bt,kt){function ri(n,i,o,s,h,c,l,a){var y=o===".";if(o&&(it=it.slice(i.length),y||(n=(s?'view.hlp("'+s+'")':h?"view":"data")+(a?(c?"."+c:s?"":h?"":"."+o)+(l||""):(a=s?"":h?c||"":o,"")),n=n+(a?"."+a:""),n=i+(n.slice(0,9)==="view.data"?n.slice(5):n)),u)){if(gt=e==="linkTo"?v=t._jsvto=t._jsvto||[]:f.bd,dt=y&>[gt.length-1]){if(dt._jsv){while(dt.sb)dt=dt.sb;dt.bnd&&(it="^"+it.slice(1));dt.sb=it;dt.bnd=dt.bnd||it.charAt(0)==="^"}}else gt.push(it);k[r]=bt+(y?1:0)}return n}tt=u&&tt;tt&&!ft&&(it=tt+it);rt=rt||"";nt=nt||g||ht;it=it||et;ot=ot||pt||"";var ii,ti,gt,dt,ni;if(!ut||s||o){if(u&&yt&&!s&&!o&&(!e||p||v)&&(ii=k[r-1],kt.length-1>bt-(ii||0))){if(ii=kt.slice(ii,bt+d.length),ti!==!0)if(gt=v||l[r-1].bd,dt=gt[gt.length-1],dt&&dt.prm){while(dt.sb&&dt.sb.prm)dt=dt.sb;ni=dt.sb={path:dt.sb,bnd:dt.bnd}}else gt.push(ni={path:gt.pop()});yt=b+":"+ii+" onerror=''"+h;ti=w[yt];ti||(w[yt]=!0,w[yt]=ti=ct(yt,i,!0));ti!==!0&&ni&&(ni._jsv=ti,ni.prm=f.bd,ni.bnd=ni.bnd||ni.path&&ni.path.indexOf("^")>=0)}return s?(s=!lt,s?d:'"'):o?(o=!at,o?d:'"'):(nt?(k[r]=bt++,f=l[++r]={bd:[]},nt):"")+(wt?r?"":(a=kt.slice(a,bt),e?(e=p=v=!1,"\b"):"\b,")+a+(a=bt+d.length,u&&t.push(f.bd=[]),"\b"):ft?(r&&c(n),u&&t.pop(),e=it,p=tt,a=bt+d.length,tt&&(u=f.bd=t[e]=[]),it+":"):it?it.split("^").join(".").replace(bi,ri)+(ot?(f=l[++r]={bd:[]},y[r]=!0,ot):rt):rt?rt:vt?(y[r]=!1,f=l[--r],vt)+(ot?(f=l[++r],y[r]=!0,ot):""):st?(y[r]||c(n),","):g?"":(s=lt,o=at,'"'))}c(n)}var e,v,p,o,s,u=t&&t[0],f={bd:u},l={0:f},a=0,w=i?i.links:u&&(u.links=u.links||{}),r=0,y={},k={};return(n+(i?" ":"")).replace(ki,d)}function at(n,t,r){var w,f,o,l,g,yt,pt,ti,bt,nt,ot,b,e,st,tt,it,v,ht,y,ut,p,ft,kt,d,dt,gt,ct,h,a,vt,ni,s=0,u="",et={},ii=n.length;for(""+t===t?(y=r?'data-link="'+t.replace(rt," ").slice(1,-1)+'"':t,t=0):(y=t.tmplName||"unnamed",t.allowCode&&(et.allowCode=!0),t.debug&&(et.debug=!0),b=t.bnds,ht=t.tmpls),w=0;w<ii;w++)if(f=n[w],""+f===f)u+='\n+"'+f+'"';else if(o=f[0],o==="*")u+=";\n"+f[1]+"\nret=ret";else{if(l=f[1],ft=!r&&f[2],g=vi(f[3],"params")+"},"+vi(st=f[4]),a=f[5],ni=f[6],kt=f[8]&&f[8].replace(wt,"$1"),(gt=o==="else")?e&&e.push(f[7]):(s=0,b&&(e=f[7])&&(e=[e],s=b.push(1))),(ct=o===":")?l&&(o=l===k?">":l+o):(ft&&(ut=hi(kt,et),ut.tmplName=y+"/"+o,at(ft,ut),ht.push(ut)),gt||(p=o,dt=u,u=""),d=n[w+1],d=d&&d[0]==="else"),vt=a?";\ntry{\nret+=":"\n+",tt="",it="",ct&&(e||ni||l&&l!==k)){if(h="return {"+g+"};",v='c("'+l+'",view,',h=new Function("data,view,j,u"," // "+y+" "+s+" "+o+"\n"+h),h._er=a,tt=v+s+",",it=")",h._tag=o,r)return h;lt(h,e);ot=!0}if(u+=ct?(r?(a?"\ntry{\n":"")+"return ":vt)+(ot?(ot=i,nt=bt=!0,v+(e?(b[s-1]=h,s):"{"+g+"}")+")"):o===">"?(pt=!0,"h("+st[0]+")"):(ti=!0,"((v="+(st[0]||"data")+')!=null?v:"")')):(nt=yt=!0,"\n{view:view,tmpl:"+(ft?ht.length:"0")+","+g+"},"),p&&!d){if(u="["+u.slice(0,-1)+"]",v='t("'+p+'",view,this,',r||e){if(u=new Function("data,view,j,u"," // "+y+" "+s+" "+p+"\nreturn "+u+";"),u._er=a,u._tag=p,e&<(b[s-1]=u,e),r)return u;tt=v+s+",undefined,";it=")"}u=dt+vt+v+(s||u)+")";e=0;p=0}a&&(nt=!0,u+=";\n}catch(e){ret"+(r?"urn ":"+=")+tt+"j._err(e,view,"+a+")"+it+";}"+(r?"":"ret=ret"))}u="// "+y+"\nvar v"+(yt?",t=j._tag":"")+(bt?",c=j._cnvt":"")+(pt?",h=j.converters.html":"")+(r?";\n":',ret=""\n')+(et.debug?"debugger;":"")+u+(r?"\n":";\nreturn ret;");try{u=new Function("data,view,j,u",u)}catch(ri){c("Compiled template code:\n\n"+u+'\n: "'+ri.message+'"')}return t&&(t.fn=u),nt||(u._nvw=!0),u}function a(n,t){return n&&n!==t?t?f(f({},t),n):n:t&&f({},t)}function br(n){return kt[n]||(kt[n]="&#"+n.charCodeAt(0)+";")}function kr(n){var i,t,r=[];if(typeof n===ut)for(i in n)t=n[i],t&&t.toJSON&&!t.toJSON()||y(t)||r.push({key:i,prop:t});return r}function wi(n){return n!=null?ir.test(n)&&(""+n).replace(rr,br)||n:""}if((!t||!t.render)&&!n.jsviews){var r,it,p,yt,pt,w="{",b="{",h="}",v="}",nt="^",bi=/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,ki=/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(!*?[#~]?[\w$.^]+)?\s*((\+\+|--)|\+|-|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=\s*[.^]|\s*$|[^\(\[])|[)\]])([([]?))|(\s+)/g,rt=/[ \t]*(\r\n|\n|\r)/g,wt=/\\(['"])/g,di=/['"\\]/g,gi=/(?:\x08|^)(onerror:)?(?:(~?)(([\w$]+):)?([^\x08]+))\x08(,)?([^\x08]+)/gi,nr=/^if\s/,tr=/<(\w+)[>\s]/,ir=/[\x00`><\"'&]/,bt=/^on[A-Z]|^convert(Back)?$/,rr=/[\x00`><"'&]/g,ur=0,fr=0,kt={"&":"&","<":"<",">":">","\x00":"�","'":"'",'"':""","`":"`"},k="html",ut="object",ft="data-jsv-tmpl",dt={},d={template:{compile:oi},tag:{compile:vr},helper:{},converter:{}},u={jsviews:"v1.0.0-beta",settings:function(n){f(s,n);ri(s._dbgMode);s.jsv&&s.jsv()},sub:{View:g,Err:ot,tmplFn:ct,cvt:st,parse:yi,extend:f,syntaxErr:c,onStore:{},_ths:et,_tg:function(){}},map:si,_cnvt:hr,_tag:lr,_err:l};(ot.prototype=new Error).constructor=ot;fi.depends=function(){return[this.get("item"),"index"]};ei.depends="index";g.prototype={get:or,getIndex:ei,getRsc:cr,hlp:sr,_is:"view"};for(it in d)pr(it,d[it]);var e=u.templates,tt=u.converters,pi=u.helpers,vt=u.tags,o=u.sub,s=u.settings;o._tg.prototype={baseApply:yr};t?(r=t,r.fn.render=wr,r.observable&&(f(o,r.views.sub),u.map=r.views.map)):(r=n.jsviews={},r.isArray=Array.isArray||function(n){return r.toString.call(n)==="[object Array]"});r.render=dt;r.views=u;r.templates=e=u.templates;s({debugMode:ri,delimiters:ui,onError:function(n,t,r){return t&&(n=r===i?"{Error: "+(n.message||n)+"}":y(r)?r(n,t):r),n==i?"":n},_dbgMode:!0});vt({"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(t.tagCtx.view,!0))},flow:!0},"for":{render:function(n){var f,t=this,u=t.tagCtx,e="",o=0;return t.rendering.done||((f=!arguments.length)&&(n=u.view.data),n!==i&&(e+=u.render(n,f),o+=r.isArray(n)?n.length:1),(t.rendering.done=o)&&(t.selected=u.index)),e},flow:!0},props:{baseTag:"for",dataMap:si(kr)},include:{flow:!0},"*":{render:ti,flow:!0}});tt({html:wi,attr:wi,url:function(n){return n!=i?encodeURI(""+n):n===null?n:""}});ui()}})(this,this.jQuery),function(n,t,i){"use strict";function p(n){return n._cId=n._cId||".obs"+yt++}function r(n){return u(n)?new b(n):new w(n)}function w(n){return this._data=n,this}function b(n){return this._data=n,this}function wt(n){return u(n)?[n]:n}function et(n,t){n=u(n)?n:[n];for(var i,e=t,o=e,h=n.length,r=[],s=0;s<h;s++){if(i=n[s],f(i)){r=r.concat(et(i.call(t,t),t));continue}else if(""+i!==i){t=o=i;o!==e&&r.push(e=o);continue}o!==e&&r.push(e=o);r.push(i)}return r}function ot(n,t){for(var i in n)return;delete l[t]}function k(n,t){function h(n){return typeof n===o&&(s[0]||e&&u(n))}if(!(n.data&&n.data.off)){var y,p,w,l=t.oldValue,a=t.value,r=n.data,f=r.observeAll,e=!r.cb.noArray,s=r.paths;n.type===c?(r.cb.array||r.cb).call(r,n,t):(r.prop===t.path||r.prop==="*")&&(f?(y=f._path+"."+t.path,p=f.filter,w=[n.target].concat(f.parents()),h(l)&&v(e,f.ns,[l],s,r.cb,!0,p,[w],y),h(a)&&v(e,f.ns,[a],s,r.cb,i,p,[w],y)):(h(l)&&v(e,[l],s,r.cb,!0),h(a)&&v(e,[a],s,r.cb)),r.cb(n,t))}}function a(){function e(){function ti(i,r,u,f){var o,e,a=ut(v),y=wt(v),s=si,p=bt;if(i=n?i+"."+n:i,nt||f)a&&t(y).off(i,k);else{if(b=a&&t._data(v))for(b=b&&b.events,b=b&&b[u?c:h],gt=b&&b.length;gt--;)if((st=b[gt].data)&&st.cb._cId===d._cId&&st.ns===n){if(u)return;r==="*"&&st.prop!==r&&t(v).off(i,k)}e=u?{}:{fullPath:w,paths:r?[r]:[],prop:g};e.ns=n;e.cb=d;bt&&(e.observeAll={_path:p,path:function(){return o=s.length,p.replace(/[[.]/g,function(n){return o--,n==="["?"["+t.inArray(s[o-1],s[o]):"."})},parents:function(){return s},filter:hi,ns:n});t(y).on(i,null,e,k);ui&&((l[d._cId]=ui)[t.data(v,"obId")||t.data(v,"obId",vt++)]=v)}}function pi(n){var t=kt;return n.ob=ct(n,t),n.cb=function(i,r){var s=n.ob,h=n.sb,f=ct(n,t);f!==s&&(typeof s===o&&(ii(s,!0),(h||a&&u(s))&&e([s],h,d,ct,!0)),n.ob=f,typeof f===o&&(ii(f),(h||a&&u(f))&&e([f],h,d,ct)));d(i,r)}}function ii(n,t,f,e){if(a){var o=v,s=bt;v=n;e&&(v=n[e],bt+="."+e);hi&&v&&(v=r._fltr(bt,v,e?[n].concat(si):si,hi));v&&(f||u(v))&&ti(c+".observe"+(d?dt=p(d):""),i,!0,t);v=o;bt=s}}var ri,oi,ci,ht,g,w,yi,nt,d,dt,gt,st,b,ct,li,ui,fi,ni,si,bt,hi,ai,vi,ei=at,rt=this!=1?it.apply([],arguments):tt.call(arguments),ft=rt.pop()||!1,kt=rt.shift(),v=kt,yt=rt.length;for(ft+""===ft&&(bt=ft,si=rt.pop(),hi=rt.pop(),ft=!!rt.pop(),yt-=3),ft===!!ft&&(nt=ft,ft=rt[yt-1],ft=yt&&ft+""!==ft?(yt--,rt.pop()):i),d=ft,yt&&f(rt[yt-1])&&(ct=d,d=rt.pop(),yt--),ei+=nt?d?d._cId+(d._inId||""):"":(dt=p(d))+(d._inId||""),nt||(ui=l[dt]=l[dt]||{}),ai=n&&n.match(lt)||[""],vi=ai.length;vi--;)for(n=ai[vi],u(kt)?ii(kt,nt,!0):nt&&yt===0&&kt&&ti(ei,""),fi=0,ri=0;ri<yt;ri++)if(w=rt[ri],w!==""&&w!==i){if(v=kt,""+w===w){if(ht=w.split("^"),ht[1]&&(fi=ht[0].split(".").length,w=ht.join("."),fi=w.split(".").length-fi),ct&&(li=ct(w,kt))){yt+=li.length-1;y.apply(rt,[ri--,1].concat(li));continue}ht=w.split(".")}else f(w)||(w&&w._jsv?(ni=nt?w.cb:pi(w),ni.noArray=!a,ni._cId=d._cId,ni._inId=ni._inId||".obIn"+pt++,(w.bnd||w.prm&&w.prm.length||!w.sb)&&e([v],w.path,[s],w.prm,ni,ct,nt),w.sb&&e([w.ob],w.sb,d,ct,nt),w=s,v=i):v=w),ht=[kt=w];while(v&&(g=ht.shift())!==i)if(typeof v===o){if(""+g===g){if(g==="")continue;if(ht.length<fi+1&&!v.nodeType){if(!nt&&(b=ut(v)&&t._data(v))){for(b=b.events,b=b&&b[h],gt=b&&b.length,ci=0;gt--;)st=b[gt].data,st&&st.cb===d&&st.ns===n&&(st.prop===g||st.prop==="*")&&((oi=ht.join("."))&&st.paths.push(oi),ci++);if(ci){v=v[g];continue}}if(g==="*"){!nt&&b&&b.length&&ti(ei,"",!1,!0);ti(ei,"");for(oi in v)ii(v,nt,i,oi);break}else g&&ti(ei+"."+g,ht.join("^"))}bt&&(bt+="."+g);g=v[g]}if(f(g)){(yi=g.depends)&&e([v],et(yi,v),d,ct,nt);break}v=g}ii(v,nt)}return dt&&ot(ui,dt),{cbId:dt,bnd:ui}}var n,a=this!=!1,v=tt.call(arguments),s=v[0];return s+""===s&&a&&(n=s,v.shift(),s=v[0]),e.apply(1,v)}function bt(){return[].push.call(arguments,!0),a.apply(this,arguments)}function v(){var n=it.apply([],arguments);return a.apply(n.shift(),n)}function d(n,t,i,r){n+""!==n&&(i=t,t=n,n="");ht(n,this._data,t,i,[],"root",r)}function st(n,t,i){d.call(this,n,t,i,!0)}function ht(n,t,f,e,s,h,c){function v(n,t){for(l=n.length,w=h+"[]";l--;)k(n,l,t,1)}function k(t,u,o,s){var c,h;u!==rt&&(c=r._fltr(w,t[u],b,e))&&(h=b.slice(),s&&d&&h.unshift(d),ht(n,c,f,e||(s?i:0),h,w,o))}function g(n,t){h=n.data.observeAll._path;d=n.target;switch(t.change){case"insert":v(t.items);break;case"remove":v(t.items,!0);break;case"refresh":v(t.oldItems,!0);v(n.target);break;case"set":w=h+"."+t.path;k(t,"oldValue",!0);k(t,"value")}d=i;f.apply(this,arguments)}var l,y,w,b,d;if(typeof t===o)if(b=[t].concat(s),y=u(t)?"":"*",f?(y||e!==0)&&(g._cId=p(f),a(n,t,y,g,c,e,b,h)):a(n,t,y,i,c,e,b,h),y)for(l in t)w=h+"."+l,k(t,l,c);else v(t,c)}function ct(n){return n.indexOf(".")<0&&n.indexOf("[")<0}if(!t)throw"jsViews/jsObservable require jQuery";if(!t.observable){var g=t.views=t.views||{jsviews:"v1.0.0-alpha",sub:{}},e=g.sub,nt=t.event.special,tt=[].slice,y=[].splice,it=[].concat,u=t.isArray,rt=t.expando,o="object",s=parseInt,lt=/\S+/g,h=e.propChng=e.propChng||"propertyChange",c=e.arrChng=e.arrChng||"arrayChange",l=e._cbBnds=e._cbBnds||{},at=h+".observe",f=t.isFunction,vt=1,yt=1,pt=1,ut=t.hasData,ft={};e.getDeps=function(){var n=arguments;return function(){for(var i,t,r=[],u=n.length;u--;)i=n[u--],t=n[u],t&&(r=r.concat(f(t)?t(i,i):t));return r}};t.observable=r;r._fltr=function(n,t,i,r){if(r&&f(r)?r(n,t,i):!0)return t=f(t)?t.set&&t.call(i[0]):t,typeof t===o&&t};r.Object=w;r.Array=b;t.observe=r.observe=a;t.unobserve=r.unobserve=bt;r._apply=v;w.prototype={_data:null,observeAll:d,unobserveAll:st,data:function(){return this._data},setProperty:function(n,t,r){var f,h,s,o=this,e=o._data;if(n=n||"",e)if(u(n))for(f=n.length;f--;)h=n[f],o.setProperty(h.name,h.value,r===i||r);else if(""+n!==n)for(f in n)o.setProperty(f,n[f],t);else if(n!==rt){for(s=n.split(".");e&&s.length>1;)e=e[s.shift()];e&&o._setProperty(e,s[0],t,r)}return o},removeProperty:function(n){return this.setProperty(n,ft),this},_setProperty:function(n,t,r,u){var o,s,h,e=t?n[t]:n;f(e)&&e.set&&(s=e,o=e.set===!0?e:e.set,e=e.call(n));(e!==r||u&&e!=r)&&(!(e instanceof Date)||e>r||e<r)&&(o?(o.call(n,r),r=s.call(n)):(h=r===ft)?(delete n[t],r=i):t&&(n[t]=r),this._trigger(n,{change:"set",path:t,value:r,oldValue:e,remove:h}))},_trigger:function(n,i){t(n).triggerHandler(h,i)}};b.prototype={_data:null,observeAll:d,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=s(n),n>-1&&n<=i.length&&(t=u(t)?t:[t],t.length&&this._insert(n,t)),this},_insert:function(n,t){var i=this._data,r=i.length;y.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=s(n),t=t?s(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?s(i):i===0?0:1,n=s(n),t=s(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);y.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();return this._refresh(t,n),this},_refresh:function(n,t){var i=this._data,r=i.length;y.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]);u!==i&&f.triggerHandler(h,{change:"set",path:"length",value:u,oldValue:i});f.triggerHandler(c,n)}};nt[h]=nt[c]={remove:function(n){var r,u,f,e,o,i=n.data;if(i&&(i.off=!0,i=i.cb)&&(r=l[i._cId])){for(f=t._data(this).events[n.type],e=f.length;e--&&!u;)u=(o=f[e].data)&&o.cb._cId===i._cId;u||(delete r[t.data(this,"obId")],ot(r,i._cId))}}};g.map=function(n){function u(t,u,f){var s,e=this;this.src&&this.unmap();typeof t===o&&(e.src=t,e.tgt=f||e.tgt||[],e.options=u||e.options,e.update(),n.obsSrc&&r(e.src).observeAll(e.obs=function(t,r){s||(s=!0,n.obsSrc(e,t,r),s=i)},e.srcFlt),n.obsTgt&&r(e.tgt).observeAll(e.obt=function(t,r){s||(s=!0,n.obsTgt(e,t,r),s=i)},e.tgtFlt))}return f(n)&&(n={getTgt:n}),n.baseMap&&(n=t.extend({},n.baseMap,n)),n.map=function(n,t,i){return new u(n,t,i)},(u.prototype={srcFlt:n.srcFlt||ct,tgtFlt:n.tgtFlt||ct,update:function(t){var i=this;r(i.tgt).refresh(n.getTgt(i.src,i.options=t||i.options))},unmap:function(){var n=this;n.src&&(n.obs&&r(n.src).unobserveAll(n.obs,n.srcFlt),n.obt&&r(n.tgt).unobserveAll(n.obt,n.tgtFlt),n.src=i)},map:u,_def:n}).constructor=u,n}}}(this,this.jQuery),function(n,t,i){"use strict";function nt(n,r,u){var k,it,v,o,d,y,h,g,c,p,rt,nt,tt,s,e,w,a,b=n.target,ut=b._jsvBnd,ft=/&(\d+)\+?/g;if(ut)while(p=ft.exec(ut))if((p=l[p[1]])&&(e=p.to)){if(o=p.linkCtx,c=o.view,s=o.tag,g=t(b),nt=c.hlp(ti),tt=c.hlp(ii),v=vt(b),k=fi[v],u===i&&(u=et(v)?v(b):k?g[k]():g.attr(v)),y=e[1],e=e[0],e=e+""===e?[o.data,e]:e,y&&(d=et(y)?y:c.getRsc("converters",y)),d&&(u=d.call(s,u)),rt=c.linkCtx,c.linkCtx=o,w={change:"change",oldValue:o._val,value:u},(!nt||!(it=nt.call(o,n,w)===!1))&&(!s||!s.onBeforeChange||!(it=s.onBeforeChange(n,w)===!1))&&u!==i&&(h=e[0],u!==i&&h)){if(h._jsv)for(a=h,h=o.data;a&&a.sb;)h=o._ctxCb(a,h),a=a.sb;if(s&&(s._.chging=!0),f(h).setProperty(e[2]||e[1],u),tt&&tt.call(o,n,w),s){if(s.onAfterChange)s.onAfterChange(n,w);delete s._.chging}o._val=u}c.linkCtx=rt}}function wu(n,t,u){var h,e,k,b,a,v,f=this,o=f.tag,l=f.data,p=f.elem,c=f.convert,nt=p.parentNode,s=f.view,g=s.linkCtx,w=s.hlp(ti);if(s.linkCtx=f,nt&&(!w||!(t&&w.call(f,n,t)===!1))&&!(t&&n.data.prop!=="*"&&n.data.prop!==t.path)){if(t&&(f.eventArgs=t),t||f._initVal){if(delete f._initVal,u._er)try{e=u(l,s)}catch(tt){a=u._er;v=d(tt,s,new Function("data,view","return "+a+";")(l,s));e=[{props:{},args:[v]}]}else e=u(l,s,r);if(h=bu(e,f,o=f.tag,f.attr||vt(p,!0,c!==i)),o){if(b=a||o._er,e=e[0]?e:[e],k=!b&&t&&o.onUpdate&&o.onUpdate(n,t,e)===!1,gr(o,e,b),k||h===ct){h===y&&o.onBeforeLink&&o.onBeforeLink();wt(o);ai(f,l,p);s.linkCtx=g;return}if(o._.chging)return;e=o.tagName===":"?r._cnvt(o.cvt,s,e[0]):r._tag(o,s,s.tmpl,e,!0,v)}else u._tag&&(c=c===""?at:c,e=c?r._cnvt(c,s,e[0]||e):r._tag(u._tag,s,s.tmpl,e,!0,v),o=f.tag,h=f.attr||h);ar(e,f,h,o)&&t&&(w=s.hlp(ii))&&w.call(f,n,t);o&&(o._er=a,wt(o,t))}ai(f,l,p);s.linkCtx=g}}function bu(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,et(n)&&d(r.expr+": missing parens"),c=/^css-/.test(f)&&f.slice(4))e=t.style(s,c),+n===n&&(e=parseInt(e));else if(f!=="link"){if(f==="value")s.type===ri&&(e=o.prop(f=g));else if(f===ht)if(s.value===""+n)e=o.prop(g);else return f;e===i&&(h=fi[f],e=h?o[h]():o.attr(f))}r._val=e}return f}function p(n,t){n._df=t;n[(t?"set":"remove")+"Attribute"](ur,"")}function ar(r,u,f,e){var ot,h,c,tt,st,d,a,nt,v,b,k,it,rt,ut=r!==i,lt=u.data,s=e&&e.parentElem||u.elem,ft=t(s),w=u.view,et=u._val,at=w.linkCtx,l=e||f===y;if(e&&(e.parentElem=e.parentElem||u.expr||e._elCnt?s:s.parentNode,h=e._prv,c=e._nxt),!ut){f===y&&e&&e.onBeforeLink&&e.onBeforeLink();return}if(f==="visible"&&(f="css-display"),/^css-/.test(f))u.attr==="visible"&&(rt=(s.currentStyle||lr.call(n,s,"")).display,r?(r=s._jsvd||rt,r!==ct||(r=or[it=s.nodeName])||(k=o.createElement(it),o.body.appendChild(k),r=or[it]=(k.currentStyle||lr.call(n,k,"")).display,o.body.removeChild(k))):(s._jsvd=rt,r=ct)),(l=l||et!==r)&&t.style(s,f.slice(4),r);else if(f!=="link"){if(f===g)d=!0,r=r&&r!=="false";else if(f===ht)if(s.value===""+r)r=d=!0,f=g;else{ai(u,lt,s);return}else(f==="selected"||f==="disabled"||f==="multiple"||f==="readonly")&&(r=r&&r!=="false"?f:null);(ot=fi[f])?f===y?(w.linkCtx=u,e&&e._.inline?(st=e.nodes(!0),e._elCnt&&(h&&h!==c?bi(h,c,s,e._tgId,"^",!0):(a=s._df)&&(nt=e._tgId+"^",v=a.indexOf("#"+nt)+1,b=a.indexOf("/"+nt),v&&b>0&&(v+=nt.length,b>v&&(p(s,a.slice(0,v)+a.slice(b)),tu(a.slice(v,b))))),h=h?h.previousSibling:c?c.previousSibling:s.lastChild),t(st).remove(),e&&e.onBeforeLink&&e.onBeforeLink(),tt=w.link(w.data,s,h,c,r,e&&{tag:e._tgId,lazyLink:e.tagCtx.props.lazyLink})):(ut&&ft.empty(),e&&e.onBeforeLink&&e.onBeforeLink(),ut&&(tt=w.link(lt,s,h,c,r,e&&{tag:e._tgId}))),w.linkCtx=at):(l=l||et!==r)&&(f==="text"&&s.children&&!s.children[0]?s.textContent!==i?s.textContent=r:s.innerText=r===null?"":r:ft[ot](r)):(l=l||et!==r)&&ft[d?"prop":"attr"](f,r===i&&!d?null:r);u._val=r}return tt||l}function vr(n,t){var i=this,r=i.hlp(ti),u=i.hlp(ii);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 li(n){var u,f,o=n.type,e=n.data,r=n._.bnd;if(!n._.useKey&&r)if((f=n._.bndArr)&&(t([f[1]]).off(ni,f[0]),n._.bndArr=i),r!==!!r)o?r._.arrVws[n._.id]=n:delete r._.arrVws[n._.id];else if(o&&e){u=function(t){t.data&&t.data.off||vr.apply(n,arguments)};t([e]).on(ni,u);n._.bndArr=[u,e]}}function vt(n,t,i){var u=n.nodeName.toLowerCase(),r=v.merge[u]||n.contentEditable===at&&{to:y,from:y};return r?t?u==="input"&&n.type===ht?ht:r.to:r.from:t?i?"text":y:""}function yr(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&&d("Missing parentNode"),s){w=n.nodes();y&&h&&h!==a&&bi(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)kt(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 yt(n,t,r){var u,f,e;return r?(e="^`",f=t._.tag,u=f._tgId,u||(l[u=sr++]=f,f._tgId=""+u)):(e="_`",b[u=t._.id]=t),"#"+u+e+(n!=i?n:"")+"/"+u+e}function ai(n,t,r){var c,h,o,y,p,u=n.tag,w=n.convertBack,a=[],v=n._bndId||""+sr++,b=n._hdl;if(delete n._bndId,u&&(a=u.depends||a,a=et(a)?u.depends(u):a,o=u.linkedElem),!n._depends||""+n._depends!=""+a){for(n._depends&&f._apply(!1,[t],n._depends,b,!0),y=n.fn.deps.slice(),h=y.length;h--;)p=y[h],p._jsv&&(y[h]=e({},p));if(c=f._apply(!1,[t],y,a,b,n._ctxCb),c.elem=r,c.linkCtx=n,c._tgId=v,r._jsvBnd=r._jsvBnd||"",r._jsvBnd+="&"+v,n._depends=a,n.view._.bnds[v]=v,l[v]=c,o&&(c.to=[[],w]),(o||w!==i)&&dr(c,u&&u.convertBack||w),u){if(u.onAfterBind)u.onAfterBind(c);u.flow||u._.inline||(r.setAttribute(s,(r.getAttribute(s)||"")+"#"+v+"^/"+v+"^"),u._tgId=""+v)}}if(o&&o[0])for(u._.radio&&(o=o.children("input[type=radio]")),h=o.length;h--;)o[h]._jsvBnd=o[h]._jsvBnd||r._jsvBnd+"+",o[h]._jsvLkEl=u}function pr(n,t,i,r,u,f,e){return vi(this,n,t,i,r,u,f,e)}function vi(n,r,u,f,e,s,c,l){if(typeof f!="object"&&(f=i),n&&r){if(r=r.jquery?r:t(r),!tt){tt=o.body;t(tt).on(tr,nt).on("blur","[contenteditable]",nt)}for(var w,g,rt,d,y,k,v,ut,ft=yt,ot=f&&f.target==="replace",et=r.length;et--;)if(v=r[et],""+n===n)yi(n,v,it(v),i,!0,u,f);else{if(s=s||it(v),n.markup!==i)s.link===!1&&(f=f||{},f.link=ft=!1),ot&&(k=v.parentNode),rt=n.render(u,f,e,s,i,ft),k?(c=v.previousSibling,l=v.nextSibling,t.cleanData([v],!0),k.removeChild(v),v=k):(c=l=i,t(v).empty());else if(n===!0&&s===a)ut={lnk:1};else break;if(v._df&&!l){for(d=h(v._df,!0,hr),w=0,g=d.length;w<g;w++)y=d[w],(y=b[y.id])&&y.data!==i&&y.parent.removeViews(y._.key,i,!0);p(v)}s.link(u,v,c,l,rt,ut,f)}}return r}function ku(n,r,u,f,e,a,y,k){function pu(n,t,r,u,f,o,h,c,l,a,v,y,p){var w,b="";return p?(ri=0,n):(nt=c||l||"",u=u||a,r=r||y,ei&&!r&&(u||nt||o)&&(ei=i,ut=kt.shift()),u=u||r,u&&(ri=0,ei=i,pr&&(r||y?ci[ut]||/;svg;|;math;/.test(";"+kt.join(";")+";")||(w="'<"+ut+".../"):ci[u]?w="'<\/"+u:kt.length&&u===ut||(w="Mismatch: '<\/"+u),w&&oi(w+">' in:\n"+e)),sr=ft,ut=kt.shift(),ft=hi[ut],a=a?"<\/"+a+">":"",sr&&(ht+=lt,lt="",ft?ht+="-":(b=a+rr+"@"+ht+ir+(v||""),ht=lu.shift()))),ft?(o?lt+=o:t=a||y||"",nt&&(t+=nt,lt&&(t+=" "+s+'="'+lt+'"',lt=""))):t=o?t+b+f+rr+o+ir+h+nt:b||n,ri&&o&&oi("No {^{ tags within elem markup ("+ri+' ). Use data-link="..."'),nt&&(ri=nt,kt.unshift(ut),ut=nt.slice(1),kt[0]&&kt[0]===cu[ut]&&d("Parent of <tr> must be <tbody>"),ei=ci[ut],(ft=hi[ut])&&!sr&&(lu.unshift(ht),ht=""),sr=ft,ht&&ft&&(ht+="+")),t)}function wi(n,t){var o,c,u,e,f,a,s,h=[];if(n){for(n._tkns.charAt(0)==="@"&&(t=g.previousSibling,g.parentNode.removeChild(g),g=i),vt=n.length;vt--;){if(rt=n[vt],u=rt.ch,o=rt.path)for(et=o.length-1;c=o.charAt(et--);)c==="+"?o.charAt(et)==="-"?(et--,t=t.previousSibling):t=t.parentNode:t=t.lastChild;u==="^"?(nt=l[f=rt.id])&&(s=t&&(!g||g.parentNode!==t),(!g||s)&&(nt.parentElem=t),rt.elCnt&&s&&p(t,(rt.open?"#":"/")+f+u+(t._df||"")),h.push([s?null:g,rt])):(tt=b[f=rt.id])&&(tt.parentElem||(tt.parentElem=t||g&&g.parentNode||r,tt._.onRender=yt,tt._.onArrayChange=vr,li(tt)),e=tt.parentElem,rt.open?(tt._elCnt=rt.elCnt,t&&!g?p(t,"#"+f+u+(t._df||"")):(tt._prv||p(e,pt(e._df,"#"+f+u)),tt._prv=g)):(t&&(!g||g.parentNode!==t)?(p(t,"/"+f+u+(t._df||"")),tt._nxt=i):g&&(tt._nxt||p(e,pt(e._df,"/"+f+u)),tt._nxt=g),ui=tt.linkCtx,(a=tt.ctx&&tt.ctx.onAfterCreate||wu)&&a.call(ui,tt)))}for(vt=h.length;vt--;)pi.push(h[vt])}return!n||n.elCnt}function nu(n){var t,i,r;if(n)for(vt=n.length,et=0;et<vt;et++)if(rt=n[et],i=nt=l[rt.id].linkCtx.tag,r=nt.tagName===yr,!nt.flow||r){if(!ar){for(t=1;i=i.parent;)t++;fr=fr||t}(ar||t===fr)&&(!yr||r)&&iu.push(nt)}}function tu(){var c,a,o="",p={},v=gi+(st?",["+ur+"]":"");for(bi=si?r.querySelectorAll(v):t(v,r).get(),dt=bi.length,u&&u.innerHTML&&(ki=si?u.querySelectorAll(v):t(v,u).get(),u=ki.length?ki[ki.length-1]:u),fr=0,ct=0;ct<dt;ct++)if(g=bi[ct],u&&!ou)ou=g===u;else if(f&&g===f){st&&(o+=ot(g));break}else if(g.parentNode)if(st){if(o+=ot(g),g._df){for(c=ct+1;c<dt&&g.contains(bi[c]);)c++;p[c-1]=g._df}p[ct]&&(o+=p[ct]||"")}else dr&&(rt=h(g,i,cr))&&(rt=rt[0])&&(vi=vi?rt.id!==vi&&vi:rt.open&&rt.id),!vi&&vu(h(g))&&g.getAttribute(w)&&pi.push([g]);if(st&&(o+=r._df||"",(a=o.indexOf("#"+st.id)+1)&&(o=o.slice(a+st.id.length)),a=o.indexOf("/"+st.id),a+1&&(o=o.slice(0,a)),nu(h(o,i,yu))),e===i&&r.getAttribute(w)&&pi.push([r]),br(u,ft),br(f,ft),st){bt&&bt.resolve();return}for(ft&&ht+lt&&(g=f,ht&&(f?wi(h(ht+"+",!0),f):wi(h(ht,!0),r)),wi(h(lt,!0),r),f&&(o=f.getAttribute(s),(dt=o.indexOf(hr)+1)&&(o=o.slice(dt+hr.length-1)),f.setAttribute(s,lt+o))),dt=pi.length,ct=0;ct<dt;ct++)g=pi[ct],ni=g[1],g=g[0],ni?(nt=l[ni.id])&&((ui=nt.linkCtx)&&(nt=ui.tag,nt.linkCtx=ui),ni.open?(g&&(nt.parentElem=g.parentNode,nt._prv=g),nt._elCnt=ni.elCnt,nt.onBeforeLink&&nt.onBeforeLink(),tt=nt.tagCtx.view,yi(i,nt._prv,tt,ni.id)):(nt._nxt=g,nt._.unlinked&&(ru=nt.tagCtx,tt=ru.view,wt(nt)))):yi(g.getAttribute(w),g,it(g),i,dr,n,y);bt&&bt.resolve()}var ri,ui,nt,ct,dt,et,vt,bi,g,tt,rt,ni,ki,nr,lr,tr,ti,iu,ar,yr,ru,pr,fr,uu,wr,eu,fi,ut,ei,ai,or,gt,ft,sr,ii,lt,hr,ou,vi,bt,dr,st,gr=this,hu=gr._.id+"_",ht="",pi=[],kt=[],lu=[],wu=gr.hlp(fu),vu=wi;if(a&&(bt=a.lazyLink&&t.Deferred(),a.tmpl?lr="/"+a._.id+"_":(dr=a.lnk,a.tag&&(hu=a.tag+"^",a=!0),(st=a.get)&&(vu=nu,iu=st.tags,ar=st.deep,yr=st.name)),a=a===!0),r=r?""+r===r?t(r)[0]:r.jquery?r[0]:r:gr.parentElem||o.body,pr=!v.noValidate&&r.contentEditable!==at,ut=r.tagName.toLowerCase(),ft=!!hi[ut],u=u&&kr(u,ft),f=f&&kr(f,ft)||null,e!=i){if(or=o.createElement("div"),ai=or,hr=lt="",ii=r.namespaceURI==="http://www.w3.org/2000/svg"?"svg_ns":(fi=su.exec(e))&&fi[1]||"",di&&fi&&fi[2]&&d("Unsupported: "+fi[2]),ft){for(ti=f;ti&&!(tr=h(ti));)ti=ti.nextSibling;(gt=tr?tr._tkns:r._df)&&(nr=lr||"",(a||!lr)&&(nr+="#"+hu),et=gt.indexOf(nr),et+1&&(et+=nr.length,hr=lt=gt.slice(0,et),gt=gt.slice(et),tr?ti.setAttribute(s,gt):p(r,gt)))}if(ei=i,e=(""+e).replace(au,pu),pr&&kt.length&&oi("Mismatched '<"+ut+"...>' in:\n"+e),k)return;for(er.appendChild(or),ii=c[ii]||c.div,uu=ii[0],ai.innerHTML=ii[1]+e+ii[2];uu--;)ai=ai.lastChild;for(er.removeChild(or),wr=o.createDocumentFragment();eu=ai.firstChild;)wr.appendChild(eu);r.insertBefore(wr,f)}return bt?setTimeout(tu,0):tu(),bt&&bt.promise()}function yi(n,t,r,f,e,o,s){var d,c,w,h,nt,tt,v,b,p,a,it,g,k=[];if(f)a=l[f],a=a.linkCtx?a.linkCtx.tag:a,p=a.linkCtx||{data:r.data,elem:a._elCnt?a.parentElem:t,view:r,ctx:r.ctx,attr:y,fn:a._.bnd,tag:a,_bndId:f},wr(p,p.fn);else if(n&&t){for(o=e?o:r.data,d=r.tmpl,n=du(n,vt(t)),ut.lastIndex=0;c=ut.exec(n);)k.push(c);while(c=k.shift()){for(it=ut.lastIndex,w=c[1],v=c[3];k[0]&&k[0][4]==="else";)v+="}{"+k.shift()[3],g=!0;g&&(v+="}{{/"+c[4]+"}");nt=c[10];h=i;p={data:o,elem:t,view:r,ctx:s,attr:w,isLk:e,_initVal:!c[2]};c[6]&&(!w&&(h=/:([\w$]*)$/.exec(nt))&&(h=h[1],h!==i&&(tt=-h.length-1,v=v.slice(0,tt-1)+ft)),h===null&&(h=i),p.convert=c[5]||"");p.expr=w+v;b=d.links[v];b||(d.links[v]=b=u.tmplFn(v,d,!0,h,g));p.fn=b;w||h===i||(p.convertBack=h);wr(p,b);ut.lastIndex=it}}}function wr(n,t){function r(i,r){wu.call(n,i,r,t)}r.noArray=!0;n.isLk&&(n.view=new u.View(n.ctx,"link",a,n.data,a.tmpl,i,i,yt));n._ctxCb=nf(n.view);n._hdl=r;r(!0)}function pt(n,t){var i;return n?(i=n.indexOf(t),i+1?n.slice(0,i)+n.slice(i+t.length):n):""}function ot(n){return n&&(""+n===n?n:n.tagName===lt?n.type.slice(3):n.nodeType===1&&n.getAttribute(s)||"")}function h(n,t,i){function e(n,t,i,u,e,o){f.push({elCnt:r,id:u,ch:e,open:t,close:i,path:o,token:n})}var r,u,f=[];if(u=t?n:ot(n))return r=f.elCnt=n.tagName!==lt,r=u.charAt(0)==="@"||r,f._tkns=u,u.replace(i||pu,e),f}function br(n,t){n&&(n.type==="jsv"?n.parentNode.removeChild(n):t&&n.getAttribute(w)===""&&n.removeAttribute(w))}function kr(n,t){for(var i=n;t&&i&&i.nodeType!==1;)i=i.previousSibling;return i&&(i.nodeType!==1?(i=o.createElement(lt),i.type="jsv",n.parentNode.insertBefore(i,n)):ot(i)||i.getAttribute(w)||i.setAttribute(w,"")),i}function du(n,i){return n=t.trim(n).replace(hu,"\\$&"),n.slice(-1)!==ft?n=gt+":"+n+(i?":":"")+ft:n}function wt(n,r){var e,f,c,o,s,y,p,a,w,v,b=n.tagCtx,k=b.view,h=n.linkCtx=n.linkCtx||{tag:n,data:k.data,view:k,ctx:k.ctx};if(n.onAfterLink)n.onAfterLink(b,h,r);if(delete n._.unlinked,e=n.targetTag?n.targetTag.linkedElem:n.linkedElem,(f=e&&e[0])&&((c=n._.radio)&&(e=e.children("input[type=radio]")),c||!n._.chging)){if(o=u.cvt(n,n.convert)[0],c||f!==h.elem){for(p=e.length;p--;){if(f=e[p],a=f._jsvLkEl,n._.inline&&(!a||a!==n&&a.targetTag!==n))for(f._jsvLkEl=n,s=h.elem?h.elem._jsvBnd:n._prv._jsvBnd,f._jsvBnd=s+"+",s=s.slice(1).split("&"),y=s.length;y--;)dr(l[s[y]],n.convertBack);c&&(f[g]=o===f.value)}h._val=o}o!==i&&(c||f.value===i?f.contentEditable===at&&(f.innerHTML=o):f.type===ri?f[g]=o&&o!=="false":e.val(o))}(f=f||n.tagName===":"&&h.elem)&&(w=f._jsvTr,v=b.props.trigger,w!==v&&(f._jsvTr=v,e=e||t(f),pi(e,w,"off"),pi(e,v,"on")))}function gu(n){setTimeout(function(){nt(n)},0)}function pi(n,t,i){t&&n[i](t===!0?"keydown":t,t===!0?gu:nt)}function dr(n,t){var s,e,r,i,o,f=n.linkCtx,h=f.data,u=f.fn.paths;if(n&&u)if(u=(s=u._jsvto)||u[0],e=u&&u.length,e&&(!f.tag||f.tag.tagCtx.args.length)){if(i=u[e-1],i._jsv){for(o=i;i.sb&&i.sb._jsv;)r=i=i.sb;r=i.sb||r&&r.path;i=r?r.slice(1):o.path}n.to=r?[[o,i],t]:[f._ctxCb(r=i.split("^").join("."))||[h,r],t]}else n.to=[[],t]}function gr(n,t,i){var s,h,c=n.tagCtx.view,o=n.tagCtxs||[n.tagCtx],l=o.length,a=!t;if(t=t||n._.bnd.call(c.tmpl,(n.linkCtx||c).data,c,r),i)o=n.tagCtxs=t,n.tagCtx=o[0];else while(l--)s=o[l],h=t[l],f(s.props).setProperty(h.props),e(s.ctx,h.ctx),s.args=h.args,a&&(s.tmpl=h.tmpl);return u._ths(n,o[0]),o}function bt(n){for(var u,t,i,f=[],e=n.length,r=e;r--;)f.push(n[r]);for(r=e;r--;)if(t=f[r],t.parentNode){if(i=t._jsvBnd)for(i=i.slice(1).split("&"),t._jsvBnd="",u=i.length;u--;)kt(i[u],t._jsvLkEl,t);tu(ot(t)+(t._df||""))}}function kt(n,r,f){var y,h,e,c,a,p,w,b,v,s,k,o=l[n];if(r)f===r.linkedElem[0]&&(delete f._jsvLkEl,delete r.linkedElem);else if(o){delete l[n];for(y in o.bnd)c=o.bnd[y],a=o.cbId,t.isArray(c)?t([c]).off(ni+a).off(nr+a):t(c).off(nr+a),delete o.bnd[y];if(h=o.linkCtx){if(e=h.tag){if(p=e.tagCtxs)for(w=p.length;w--;)(b=p[w].map)&&b.unmap();v=e.linkedElem;s=v&&v[0]||h.elem;(k=s&&s._jsvTr)&&(pi(v||t(s),k,"off"),s._jsvTr=i);e.onDispose&&e.onDispose();e._elCnt||(e._prv&&e._prv.parentNode.removeChild(e._prv),e._nxt&&e._nxt.parentNode.removeChild(e._nxt))}delete h.view._.bnds[n]}delete u._cbBnds[o.cbId]}}function wi(n,r){return n===i?(tt&&(t(tt).off(tr,nt).off("blur","[contenteditable]",nt),tt=i),n=!0,a.removeViews(),bt(o.body.getElementsByTagName("*"))):r&&n===!0&&(r=r.jquery?r:t(r),r.each(function(){for(var n;(n=it(this,!0))&&n.parent;)n.parent.removeViews(n._.key,i,!0);bt(this.getElementsByTagName("*"));bt([this])})),r}function nu(n,t){return wi(this,n,t)}function nf(n){return function(t,i){var f,u,e=[i];if(n&&t){if(t._jsv)return t._jsv.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(lu,""),i]}}}function tf(n){return n.type===ri?n[g]:n.value}function bi(n,t,i,r,u,f){var v,c,y,o,k,a,e,w=0,d=n===t;if(n){for(y=h(n)||[],v=0,c=y.length;v<c;v++){if(o=y[v],a=o.id,a===r&&o.ch===u)if(f)c=0;else break;d||(k=o.ch==="_"?b[a]:l[a].linkCtx.tag,o.open?k._prv=t:o.close&&(k._nxt=t));w+=a.length+2}w&&n.setAttribute(s,n.getAttribute(s).slice(w));e=t?t.getAttribute(s):i._df;(c=e.indexOf("/"+r+u)+1)&&(e=y._tkns.slice(0,w)+e.slice(c+(f?-1:r.length+1)));e&&(t?t.setAttribute(s,e):p(i,e))}else p(i,pt(i._df,"#"+r+u)),f||t||p(i,pt(i._df,"/"+r+u))}function tu(n){var r,f,t,u;if(u=h(n,!0,vu))for(r=0,f=u.length;r<f;r++)t=u[r],t.ch==="_"?(t=b[t.id])&&t.type&&t.parent.removeViews(t._.key,i,!0):kt(t.id)}function rf(n,t,i){if(i.change==="set"){for(var r=n.tgt,u=r.length;u--;)if(r[u].key===i.path)break;u===-1?i.path&&f(r).insert({key:i.path,prop:i.value}):i.remove?f(r).remove(u):f(r[u]).setProperty("prop",i.value)}}function uf(n,t,i){var r,u=n.src,e=i.change;e==="set"?i.path==="prop"?f(u).setProperty(t.target.key,i.value):(f(u).setProperty(i.oldValue,null),delete u[i.oldValue],f(u).setProperty(i.value,t.target.prop)):e==="remove"?(r=i.items[0],f(u).removeProperty(r.key),delete u[r.key]):e==="insert"&&(r=i.items[0],r.key&&f(u).setProperty(r.key,r.prop))}function ff(n){return n.indexOf(".")<0}var dt="JsViews requires ",tt,it,ut,iu,gt,ft,ru,ki,di,d,w,rt,gi,c,a,b,o=n.document,r=t.views,u=r.sub,v=r.settings,e=u.extend,et=t.isFunction,uu=r.converters,k=r.tags,f=t.observable,st=f.observe,s="data-jsv",nr=u.propChng=u.propChng||"propertyChange",ni=u.arrChng=u.arrChng||"arrayChange",tr="change.jsv",ti="onBeforeChange",ii="onAfterChange",fu="onAfterCreate",g="checked",ri="checkbox",ht="radio",ct="none",lt="SCRIPT",at="true",ir='"><\/script>',rr='<script type="jsv',ur=s+"-df",ui="script,["+s+"]",y="html",fi={value:"val",input:"val",html:y,text:"text"},fr={from:"value",to:"value"},ei=0,eu=t.cleanData,ou=v.delimiters,oi=u.syntaxErr,su=/<(?!script)(\w+)(?:[^>]*(on\w+)\s*=)?[^>]*>/,hu=/['"\\]/g,er=o.createDocumentFragment(),si=o.querySelector,hi={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},cu={tr:"table"},ci={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},or={},l={},sr=1,lu=/^#(view\.?)?/,au=/(^|(\/>)|<\/(\w+)>|)(\s*)([#\/]\d+[_^])`(\s*)(<\w+(?=[\s\/>]))?|\s*(?:(<\w+(?=[\s\/>]))|<\/(\w+)>(\s*)|(\/>)\s*|(>))/g,hr=/(#)()(\d+)(_)/g,vu=/(#)()(\d+)([_^])/g,cr=/(?:(#)|(\/))(\d+)(_)/g,yu=/(#)()(\d+)(\^)/g,pu=/(?:(#)|(\/))(\d+)([_^])([-+@\d]+)?/g,lr=n.getComputedStyle;if(!t)throw dt+"jQuery";if(!r)throw dt+"JsRender";if(!f)throw dt+"jquery.observable";t.link||(rt={contents:function(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},nodes:function(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!==lt)&&e.push(r),r=r.nextSibling;return e},childTags:function(n,t){n!==!!n&&(t=n,n=i);var r=this,e=r.link?r:r.tagCtx.view,u=r._prv,o=r._elCnt,f=[];return e.link(i,r.parentElem,o?u&&u.previousSibling:u,r._nxt,i,{get:{tags:f,deep:n,name:t,id:r.link?r._.id+"_":r._tgId+"^"}}),f},refresh:function(n){var u,f,t=this,e=t.linkCtx,o=t.tagCtx.view;return t.disposed&&d("Removed tag"),n===i&&(n=r._tag(t,o,o.tmpl,gr(t),!0)),n+""===n&&(f=t._.inline?y:e.attr||vt(t.parentElem,!0),u=ar(n,e,f,t)),wt(t),u||t},update:function(n){var t=this.linkedElem;t&&nt({target:t[0]},i,n)}},u.onStore.template=function(n,i){i.link=pr;i.unlink=nu;n&&(t.link[n]=function(){return pr.apply(i,arguments)},t.unlink[n]=function(){return nu.apply(i,arguments)})},e(e(u._tg.prototype,rt),{domChange:function(){var n=this.parentElem,i=t.hasData(n)&&t._data(n).events,r="jsv-domchange";i&&i[r]&&t(n).triggerHandler(r,arguments)}}),u.viewInfos=h,(v.delimiters=function(){var n=ou.apply(r,arguments);return iu=n[0],gt=n[1],ft=n[2],ru=n[3],ki=n[4],ut=new RegExp("(?:^|\\s*)([\\w-]*)(\\"+ki+")?(\\"+gt+u.rTag+"\\"+ft+")","g"),this})(),e(e(u.View.prototype,rt),{addViews:function(n,t,i){var u,s,r=this,e=t.length,o=r.views;if(!r._.useKey&&e&&(i=r.tmpl)&&(s=o.length+e,yr(r,n,i,o,t,r.ctx)!==!1))for(u=n+e;u<s;u++)f(o[u]).setProperty("index",u);return r},removeViews:function(n,r,u){function s(n){var s,h,c,f,o,l,r=e[n];if(r&&r.link){if(s=r._.id,u||(l=r.nodes()),r.removeViews(i,i,!0),r.type=i,f=r._prv,o=r._nxt,c=r.parentElem,u||(r._elCnt&&bi(f,o,c,s,"_"),t(l).remove()),!r._elCnt)try{f.parentNode.removeChild(f);o.parentNode.removeChild(o)}catch(a){}li(r);for(h in r._.bnds)kt(h);delete b[s]}}var o,a,h,c=this,l=!c._.useKey,e=c.views;if(l&&(h=e.length),n===i)if(l){for(o=h;o--;)s(o);c.views=[]}else{for(a in e)s(a);c.views={}}else if(r===i&&(l?r=1:(s(n),delete e[n])),l&&r){for(o=n+r;o-->n;)s(o);if(e.splice(n,r),h=e.length)while(n<h)f(e[n]).setProperty("index",n++)}return this},refresh:function(n){var t=this,i=t.parent;return i&&(yr(t,t.index,t.tmpl,i.views,t.data,n,!0),li(t)),t},link:ku}),b={0:a=new u.View},uu.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},k("on",{attr:ct,onAfterLink:function(n,r){for(var l,e,s=this,h=0,f=n.args,v=f.length,a=n.props.data,c=n.view,o=n.props.context;h<v&&!(e=et(l=f[h++])););if(e){e=f.slice(h);f=f.slice(0,h-1);o||(o=/^(.*)[\.^][\w$]+$/.exec(n.params.args.slice(-e.length-1)[0]),o=o&&u.tmplFn("{:"+o[1]+"}",c.tmpl,!0)(r.data,c));s._evs&&s.onDispose();t(r.elem).on(s._evs=f[0]||"click",s._sel=f[1],a==i?null:a,s._hlr=function(n){return l.apply(o||r.data,[].concat(e,n,{change:n.type,view:c,linkCtx:r},e.slice.call(arguments,1)))})}},onDispose:function(){t(this.parentElem).off(this._evs,this._sel,this._hlr)},flow:!0}),e(k["for"],{onArrayChange:function(n,t,i,r){var u,s=n.target,e=s.length,f=this,o=t.change;if(f._.noVws||f.tagCtxs[1]&&(o==="insert"&&e===t.items.length||o==="remove"&&!e||o==="refresh"&&!t.oldItems.length!=!e))f.refresh();else for(u in f._.arrVws)u=f._.arrVws[u],u.data===s&&u._.onArrayChange.apply(u,arguments);f.domChange(i,r,t);n.done=!0},onAfterLink:function(n,i){for(var s,u,e,o=this,f=o._ars||{},h=o.tagCtxs,l=h.length,c=o.selected||0,r=0;r<=c;r++)n=h[r],e=n.map?n.map.tgt:n.args.length?n.args[0]:n.view.data,(u=f[r])&&e!==u[0]&&(st(u[0],u[1],!0),delete f[r]),!f[r]&&t.isArray(e)&&(st(e,s=function(t,r){var u=n;o.onArrayChange(t,r,u,i)}),f[r]=[e,s]);for(r=c+1;r<l;r++)(u=f[r])&&(st(u[0],u[1],!0),delete f[r]);o._ars=f},onDispose:function(){var n,t=this;for(n in t._ars)st(t._ars[n][0],t._ars[n][1],!0)}}),e(k["for"],rt),e(k["if"],rt),e(k.include,rt),e(k["if"],{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],!this.convert&&!!r||f)return f;return!1},onAfterLink:function(n,t,i){i&&this.domChange(n,t,i)}}),k("props",{baseTag:"for",dataMap:r.map({getTgt:k.props.dataMap.getTgt,obsSrc:rf,obsTgt:uf,tgtFlt:ff})}),e(t,{view:r.view=it=function(n,r,u){function p(n,t){if(n)for(e=h(n,t,hr),l=0,w=e.length;l<w;l++)if((f=b[e[l].id])&&(f=f&&u?f.get(!0,u):f))break}r!==!!r&&(u=r,r=i);var f,e,c,l,w,s,v,y=0,k=o.body;if(n&&n!==k&&a._.useKey>1&&(n=""+n===n?t(n)[0]:n.jquery?n[0]:n,n)){if(r){if(p(n._df,!0),!f)for(v=si?n.querySelectorAll(ui):t(ui,n).get(),s=v.length,c=0;!f&&c<s;c++)p(v[c]);return f}while(n){if(e=h(n,i,cr))for(s=e.length;s--;)if(f=e[s],f.open){if(y<1)return f=b[f.id],f&&u?f.get(u):f||a;y--}else y++;n=n.previousSibling||n.parentNode}}return a},link:r.link=vi,unlink:r.unlink=wi,cleanData:function(n){n.length&&ei&&bt(n);eu.apply(t,arguments)}}),r.utility={validate:function(n){try{a.link(i,o.createElement("div"),i,i,n,i,i,1)}catch(t){return t.message}}},e(t.fn,{link:function(n,t,i,r,u,f,e){return vi(n,this,t,i,r,u,f,e)},unlink:function(n){return wi(n,this)},view:function(n,t){return it(this[0],n,t)}}),t.each([y,"replaceWith","empty","remove"],function(n,i){var r=t.fn[i];t.fn[i]=function(){var n;ei=1;try{n=r.apply(this,arguments)}finally{ei=0}return n}}),e(a,{tmpl:{links:{},tags:{}}}),a._.onRender=yt,v({wrapMap:c={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:w="data-link",merge:{input:{from:tf,to:"value"},textarea:fr,select:fr,optgroup:{to:"label"}},jsrDbgMode:v.debugMode,debugMode:function(t){v.jsrDbgMode(t);t?n._jsv={views:b,bindings:l}:delete n._jsv},jsv:function(){v.debugMode(v._dbgMode);w=v.linkAttr;d=r._err;gi=ui+",["+w+"]";di=v.noDomLevel0;c.optgroup=c.option;c.tbody=c.tfoot=c.colgroup=c.caption=c.thead;c.th=c.td}}))}(this,this.jQuery);
//# sourceMappingURL=jsviews.min.js.map