-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathjquery.views.min.js
4 lines (4 loc) · 37.8 KB
/
jquery.views.min.js
1
2
3
4
/*! jquery.views.js v1.0.15: http://jsviews.com/ */
!function(e,t){var n=t.jQuery;"object"==typeof exports?module.exports=n?e(t,n):function(n){return e(t,n)}:"function"==typeof define&&define.amd?define(["jquery","./jsrender","./jquery.observable"],function(n,i,r){return e(t,n,i,r)}):e(t,!1)}(function(e,t,n,i){"use strict";function r(e,t,n,i,r){var a,o,l,s,d,p,f,c,v,g,u,_,m,h,b,x,k,C,y,E;if(i&&i._tgId&&(C=i,i=C._tgId,C.bindTo||(S(vt[i],C),C.bindTo=[0])),(p=vt[i])&&(u=p.to))for(u=u[t||0],a=p.linkCtx,v=a.elem,d=a.view,C=a.tag,!C&&u._cxp&&(C=u._cxp.path!==xe&&u._cxp.tag,f=e[0],e=[],e[u._cxp.ind]=f),C&&(C._.chg=1,(l=C.convertBack)&&(o=ce(l)?l:d.getRsc("converters",l))),"SELECT"===v.nodeName?(v.multiple&&null===e[0]&&(e=[[]]),v._jsvSel=e):v._jsvSel&&(y=v._jsvSel.slice(),E=wt(v.value,y),E>-1&&!v.checked?y.splice(E,1):0>E&&v.checked&&y.push(v.value),e=[y]),c=e,x=u.length,o&&(e=o.apply(C,e),void 0===e&&(u=[]),(!Z(e)||e.arg0!==!1&&(1===x||e.length!==x||e.arg0))&&(e=[e]));x--;)if((_=u[x])&&(_=typeof _===he?[a.data,_]:_,s=_[0],m=_.tag,f=(s&&s._ocp&&!s._vw?c:e)[x],!(void 0===f||C&&C.onBeforeUpdateVal&&C.onBeforeUpdateVal(r,{change:"change",data:s,path:_[1],index:x,tagElse:t,value:f})===!1)))if(m)void 0!==(k=m._.toIndex[_.ind])&&m.updateValue(f,k,_.tagElse,void 0,void 0,r),m.setValue(f,_.ind,_.tagElse);else if(void 0!==f&&s){if((m=r&&(g=r.target)._jsvInd===x&&g._jsvLkEl)&&void 0!==(k=m._.fromIndex[x])&&m.setValue(c[x],k,g._jsvElse),s._cpfn)for(b=a._ctxCb,h=s,s=a.data,h._cpCtx&&(s=h.data,b=h._cpCtx);h&&h.sb;)s=b(h),h=h.sb;Y(s,n).setProperty(_[1],f,void 0,_.isCpfn)}return C?(C._.chg=void 0,C):void 0}function a(e){var n,i,r=e.target,a=f(r),o=tt[a],l=/&(\d+)\+?/g;if(!r._jsvTr||e.delegateTarget!==je&&"number"!==r.type||"input"===e.type){for(i=ce(a)?a(r):o?t(r)[o]():t(r).attr(a),r._jsvChg=1;n=l.exec(r._jsvBnd);)$(i,r._jsvInd,r._jsvElse,void 0,n[1],e);r._jsvChg=void 0}}function o(e,t){var n,i,r,a,o,l,d,p,c,v=this,u=v.fn,_=v.tag,m=v.data,h=v.elem,b=v.convert,x=h.parentNode,k=v.view,C=k._lc,y=t&&q(k,Me,_);if(!(!x||y&&y.call(_||v,e,t)===!1||t&&"*"!==e.data.prop&&e.data.prop!==t.path)){if(k._lc=v,t||v._toLk){if(v._toLk=0,u._er)try{i=u(m,k,de)}catch(E){o=u._er,l=Ee(E,k,new Function("data,view","return "+o+";")(m,k)),i=[{props:{},args:[l],tag:_}]}else i=u(m,k,de);if(n=_&&_.attr||v.attr||(v._dfAt=f(h,!0,void 0!==b)),v._dfAt===We&&(_&&_.parentElem||v.elem).type===Re&&(n=Fe),_){if(a=o||_._er,i=i[0]?i:[i],r=!a&&(_.onUpdate===!1||t&&ce(_.onUpdate)&&_.onUpdate(e,t,i)===!1),L(_,i,a),_._.chg&&(n===be||n===We)||r||n===Qe)return A(_,e,t),_._.chg||g(v,m,h),k._lc=C,t&&(y=q(k,Oe,_))&&y.call(_||v,e,t),void(_.tagCtx.props.dataMap&&_.tagCtx.props.dataMap.map(_.tagCtx.args[0],_.tagCtx,_.tagCtx.map,isRenderCall||!_._.bnd));for(_.onUnbind&&_.onUnbind(_.tagCtx,v,_.ctx,e,t),_.linkedElems=_.linkedElem=_.mainElem=_.displayElem=void 0,c=_.tagCtxs.length;c--;)p=_.tagCtxs[c],p.linkedElems=p.mainElem=p.displayElem=void 0;i=":"===_.tagName?de._cnvt(_.convert,k,i[0]):de._tag(_,k,k.tmpl,i,!0,l)}else u._tag&&(b=""===b?Ge:b,i=b?de._cnvt(b,k,i[0]||i):de._tag(u._tag,k,k.tmpl,i,!0,l),R(_=v.tag),n=v.attr||n);(d=_&&(!_.inline||v.fn._lr)&&_.template)&&g(v,m,h),s(i,v,n,_),v._noUpd=0,_&&(_._er=o,A(_,e,t))}d||g(v,m,h),_&&_._.ths&&_.updateValue(_,_.bindTo?_.bindTo.length:1),t&&(y=q(k,Oe,_))&&y.call(_||v,e,t),k._lc=C}}function l(e,t){e._df=t,e[(t?"set":"remove")+"Attribute"](Ze,"")}function s(n,i,r,a){var o,s,d,p,f,c,v,g,_,m,h,b,x,k,C=!(r===Qe||void 0===n||i._noUpd||(r===We||r===be)&&!a&&i.elem._jsvChg),y=i.data,E=a&&a.parentElem||i.elem,w=E.parentNode,j=t(E),A=i.view,T=i._val,V=a;return a&&(a._.unlinked=!0,a.parentElem=a.parentElem||i.expr||a._elCnt?E:w,s=a._prv,d=a._nxt),C?("visible"===r&&(r="css-display"),/^css-/.test(r)?("visible"===i.attr&&(x=(E.currentStyle||Et.call(e,E,"")).display,n?(n=E._jsvd||x,n!==Qe||(n=ct[b=E.nodeName])||(h=le.createElement(b),le.body.appendChild(h),n=ct[b]=(h.currentStyle||Et.call(e,h,"")).display,le.body.removeChild(h))):(E._jsvd=x,n=Qe)),(V=V||T!==n)&&t.style(E,r.slice(4),n)):"link"!==r&&(/^data-/.test(r)?t.data(E,r.slice(5),n):/^prop-/.test(r)?(c=!0,r=r.slice(5)):r===Fe?(c=!0,E.name&&Z(n)?(E._jsvSel=n,n=wt(E.value,n)>-1):n=n&&"false"!==n):r===Ke?(c=!0,r=Fe,n=E.value===n):"selected"===r||"disabled"===r||"multiple"===r||"readonly"===r?n=n&&"false"!==n?r:null:r===We&&"SELECT"===E.nodeName&&(E._jsvSel=Z(n)?n:""+n),(o=tt[r])?r===be?a&&a.inline?(f=a.nodes(!0),a._elCnt&&(s&&s!==d?M(s,d,E,a._tgId,"^",!0):(v=s?s.getAttribute(De):E._df,g=a._tgId+"^",_=v.indexOf("#"+g)+1,m=v.indexOf("/"+g),_&&m>0&&(_+=g.length,m>_&&(O(v.slice(_,m)),v=v.slice(0,_)+v.slice(m),s?s.setAttribute(De,v):E._df&&l(E,v)))),s=s?s.previousSibling:d?d.previousSibling:E.lastChild),t(f).remove(),p=A.link(A.data,E,s,d,n,a&&{tag:a._tgId})):(C=C&&T!==n,C&&(j.empty(),p=A.link(y,E,s,d,n,a&&{tag:a._tgId}))):E._jsvSel?j[o](n):((V=V||T!==n)&&("text"===r&&E.children&&!E.children[0]?E[Ue]=null===n?"":n:j[o](n)),void 0===(k=w._jsvSel)||r!==We&&void 0!==j.attr(We)||(E.selected=wt(""+n,Z(k)?k:[k])>-1)):(V=V||T!==n)&&j[c?"prop":"attr"](r,void 0!==n||c?n:null)),i._val=n,u(p),V):void(i._val=n)}function d(e,t){var n=this,i=q(n,Me,n.tag),r=q(n,Oe,n.tag);if(!i||i.call(n,e,t)!==!1){if(t){var a=t.change,o=t.index,l=t.items;switch(n._.srt=t.refresh,a){case"insert":n.addViews(o,l,t._dly);break;case"remove":n.removeViews(o,l.length,void 0,t._dly);break;case"move":n.moveViews(t.oldIndex,o,l.length);break;case"refresh":n._.srt=void 0,n.fixIndex(0)}}r&&r.call(n,e,t)}}function p(e){var n,i,r=e.type,a=e.data,o=e._.bnd;!e._.useKey&&o&&((i=e._.bndArr)&&(t([i[1]]).off(me,i[0]),e._.bndArr=void 0),o!==!!o?r?o._.arrVws[e._.id]=e:delete o._.arrVws[e._.id]:r&&a&&(n=function(t){t.data&&t.data.off||d.apply(e,arguments)},t([a]).on(me,n),e._.bndArr=[n,a]))}function f(e,t,n){var i=e.nodeName.toLowerCase(),r=ue._fe[i]||e.contentEditable===Ge&&{to:be,from:be};return r?t?"input"===i&&e.type===Ke?Ke:r.to:r.from:t?n?"text":be:""}function c(e,n,i,r,a,o,l){var s,d,p,f,c,v=e.parentElem,g=e._prv,_=e._nxt,m=e._elCnt;if(g&&g.parentNode!==v&&ye("Missing parentNode"),l){f=e.nodes(),m&&g&&g!==_&&M(g,_,v,e._.id,"_",!0),e.removeViews(void 0,void 0,!0),d=_,m&&(g=g?g.previousSibling:_?_.previousSibling:v.lastChild),t(f).remove();for(c in e._.bnds)P(c)}else{if(n){if(p=r[n-1],!p)return!1;g=p._nxt}m?(d=g,g=d?d.previousSibling:v.lastChild):d=g.nextSibling}s=i.render(a,o,e._.useKey&&l,e,l||n,!0),u(e.link(a,v,g,d,s,p))}function v(e,t,n){var i,r;return n?(r="^`",R(n),i=n._tgId,i||(vt[i=gt++]=n,n._tgId=""+i)):(r="_`",Ne[i=t._.id]=t),"#"+i+r+(void 0!=e?e:"")+"/"+i+r}function g(e,t,n){var i,r,a,o,l,s,d,p,f,c,v,g,u=e.tag,_=!u,m=e.convertBack,h=e._hdl;if(t="object"==typeof t&&t,u&&((f=u.convert)&&(f=f===Ge?u.tagCtx.props.convert:f,f=e.view.getRsc("converters",f)||f,f=f&&f.depends,f=f&&de._dp(f,t,h)),(c=u.tagCtx.props.depends||u.depends)&&(c=de._dp(c,u,h),f=f?f.concat(c):c),g=u.linkedElems),f=f||[],!e._depends||""+e._depends!=""+f){if(l=e.fn.deps.slice(),e._depends&&(v=e._depends.bdId,Y._apply(1,[t],l,e._depends,h,e._ctxCb,!0)),u){for(r=u.boundProps.length;r--;)for(d=u.boundProps[r],a=u._.bnd.paths.length;a--;)p=u._.bnd.paths[a]["_"+d],p&&p.length&&p.skp&&(l=l.concat(p));_=void 0===u.onArrayChange||u.onArrayChange===!0}for(r=l.length;r--;)s=l[r],s._cpfn&&(l[r]=fe({},s));if(i=Y._apply(_?0:1,[t],l,f,h,e._ctxCb),v||(v=e._bndId||""+gt++,e._bndId=void 0,n._jsvBnd=(n._jsvBnd||"")+"&"+v,e.view._.bnds[v]=v),i.elem=n,i.linkCtx=e,i._tgId=v,f.bdId=v,e._depends=f,vt[v]=i,(g||void 0!==m||u&&u.bindTo)&&S(i,u,m),g)for(r=g.length;r--;)for(o=g[r],a=o&&o.length;a--;)o[a]._jsvLkEl?o[a]._jsvBnd||(o[a]._jsvBnd="&"+v+"+"):(o[a]._jsvLkEl=u,I(u,o[a]),o[a]._jsvBnd="&"+v+"+");else void 0!==m&&I(u,n);u&&!u.inline&&(u.flow||n.setAttribute(De,(n.getAttribute(De)||"")+"#"+v+"^/"+v+"^"),u._tgId=""+v)}}function u(e){var t;if(e)for(;t=e.pop();)t._hdl()}function _(e,t,n,i,r,a,o){return m(this,e,t,n,i,r,a,o)}function m(e,n,i,r,o,s,d,p){if(r===!0?(o=r,r=void 0):r="object"!=typeof r?void 0:fe({},r),e&&n){n=n.jquery?n:t(n),je||(je=le.body,Be="oninput"in je,t(je).on(qe,a).on("blur.jsv","[contenteditable]",a));for(var f,c,g,_,m,h,x,k,C,E,w=v,j=r&&"replace"===r.target,A=n.length;A--;){if(x=n[A],E=s||Te(x),typeof e===he)b(C=[],e,x,E,void 0,"expr",i,r);else{if(void 0!==e.markup)j&&(h=x.parentNode),E._.scp=!0,g=e.render(i,r,o,E,void 0,w,!0),E._.scp=void 0,h?(d=x.previousSibling,p=x.nextSibling,t.cleanData([x],!0),h.removeChild(x),x=h):(d=p=void 0,t(x).empty());else{if(e!==!0||E!==oe)break;k={lnk:"top"}}if(x._df&&!p){for(_=y(x._df,!0,mt),f=0,c=_.length;c>f;f++)m=_[f],(m=Ne[m.id])&&void 0!==m.data&&m.parent.removeViews(m._.key,void 0,!0);l(x)}C=E.link(i,x,d,p,g,k,r)}u(C)}}return n}function h(e,n,i,r,a,o,s,f){function c(e,t,n,i,r,o,l,s,d,p,f,c,v,g){var u,_,h="";return g?(m=0,e):(x=(d||p||"").toLowerCase(),i=i||f,n=n||v,Z&&!n&&(!e||i||x||o&&!m)&&(Z=void 0,Y=be.shift()),i=i||n,i&&(i=i.toLowerCase(),m=0,Z=void 0,z&&(n||v?ft[Y]||/;svg;|;math;/.test(";"+be.join(";")+";")||(u="'<"+Y+".../"):ft[i]?u="'</"+i:be.length&&i===Y||(u="Mismatch: '</"+i),u&&ke(u+">' in:\n"+a)),re=ie,Y=be.shift(),ie=dt[Y],f=f?"</"+f+">":"",re&&(_e+=oe,oe="",ie?_e+="-":(h=f+Ye+"@"+_e+Je+(c||""),_e=xe.shift()))),ie&&!m?(o?oe+=o:t=f||v||"",x&&(t+=x,oe&&(t+=" "+De+'="'+oe+'"',oe=""))):t=o?t+h+r+(m?"":Ye+o+Je)+s+x:h||e,z&&l&&(m&&ke("{^{ within elem markup ("+m+' ). Use data-link="..."'),"#"===o.charAt(0)?be.unshift(o.slice(1)):o.slice(1)!==(_=be.shift())&&ke("Closing tag for {^{...}} under different elem: <"+_+">")),x&&(m=x,be.unshift(Y),Y=x.slice(1),z&&be[0]&&be[0]===pt[Y]&&ye("Parent of <tr> must be <tbody>"),Z=ft[Y],(ie=dt[Y])&&!re&&(xe.unshift(_e),_e=""),re=ie,_e&&ie&&(_e+="+")),t)}function g(e,t){var i,r,a,o,s,f,c,g=[];if(e){for("@"===e._tkns.charAt(0)&&(t=N.previousSibling,N.parentNode.removeChild(N),N=void 0),I=e.length;I--;){if(B=e[I],a=B.ch,i=B.path)for(V=i.length-1;r=i.charAt(V--);)"+"===r?"-"===i.charAt(V)?(V--,t=t.previousElementSibling):t=t.parentNode:t=t.lastElementChild;"^"===a?(x=vt[s=B.id])&&(c=t&&(!N||N.parentNode!==t),(!N||c)&&(x.parentElem=t),B.elCnt&&c&&l(t,(B.open?"#":"/")+s+a+(t._df||"")),g.push([c?null:N,B])):(L=Ne[s=B.id])&&(L.parentElem||(L.parentElem=t||N&&N.parentNode||n,L._.onRender=v,L._.onArrayChange=d,p(L)),o=L.parentElem,B.open?(L._elCnt=B.elCnt,t&&!N?l(t,"#"+s+a+(t._df||"")):(L._prv||l(o,k(o._df,"#"+s+a)),L._prv=N)):(!t||N&&N.parentNode===t?N&&(L._nxt||l(o,k(o._df,"/"+s+a)),L._nxt=N):(l(t,"/"+s+a+(t._df||"")),L._nxt=void 0),(f=q(L,$e)||we)&&f.call(L.ctx.tag,L)))}for(I=g.length;I--;)me.push(g[I])}return!e||e.elCnt}function u(e){var t,n,i;if(e)for(I=e.length,V=0;I>V;V++)if(B=e[V],x=vt[B.id],!x._is&&x.linkCtx&&(n=x=x.linkCtx.tag,i=x.tagName===K,!x.flow||i)){if(!R){for(t=1;n=n.parent;)t++;Q=Q||t}!R&&t!==Q||K&&!i||F.push(x)}}function _(){var o,l,d="",p={},f=Ie+(ce?",["+Ze+"]":"");for(S=st?n.querySelectorAll(f):t(f,n).get(),T=S.length,i&&i.innerHTML&&(U=st?i.querySelectorAll(f):t(f,i).get(),i=U.length?U[U.length-1]:i),Q=0,j=0;T>j;j++)if(N=S[j],i&&!de)de=N===i;else{if(r&&N===r){ce&&(d+=C(N));break}if(N.parentNode)if(ce){if(d+=C(N),N._df){for(o=j+1;T>o&&N.contains(S[o]);)o++;p[o-1]=N._df}p[j]&&(d+=p[j]||"")}else fe&&(B=y(N,void 0,bt))&&(B=B[0])&&(pe=pe?B.id!==pe&&pe:B.open&&B.id),!pe&&je(y(N))&&N.getAttribute(Ve)&&me.push([N])}if(ce&&(d+=n._df||"",(l=d.indexOf("#"+ce.id)+1)&&(d=d.slice(l+ce.id.length)),l=d.indexOf("/"+ce.id),l+1&&(d=d.slice(0,l)),u(y(d,void 0,kt))),void 0===a&&n.getAttribute(Ve)&&me.push([n]),E(i,ie),E(r,ie),!ce)for(ie&&_e+oe&&(N=r,_e&&(r?g(y(_e+"+",!0),r):g(y(_e,!0),n)),g(y(oe,!0),n),r&&(d=r.getAttribute(De),(T=d.indexOf(se)+1)&&(d=d.slice(T+se.length-1)),r.setAttribute(De,oe+d))),T=me.length,j=0;T>j;j++)N=me[j],P=N[1],N=N[0],P?(x=vt[P.id])&&((h=x.linkCtx)&&(x=h.tag,x.linkCtx=h),P.open?(N&&(x.parentElem=N.parentNode,x._prv=N),x._elCnt=P.elCnt,L=x.tagCtx.view,b(Ee,void 0,x._prv,L,P.id)):(x._nxt=N,x._.unlinked&&!x._toLk&&(H=x.tagCtx,L=H.view,A(x)))):b(Ee,N.getAttribute(Ve),N,Te(N),void 0,fe,e,s)}var m,h,x,j,T,V,I,S,N,L,B,P,U,D,M,O,$,F,R,K,H,z,Q,W,X,G,J,Y,Z,ee,te,ne,ie,re,ae,oe,se,de,pe,fe,ce,ve=this,ge=ve._.id+"_",_e="",me=[],be=[],xe=[],Ee=[],we=q(ve,$e),je=g;if(o&&(o.tmpl?M="/"+o._.id+"_":(fe=o.lnk,o.tag&&(ge=o.tag+"^",o=!0),(ce=o.get)&&(je=u,F=ce.tags,R=ce.deep,K=ce.name)),o=o===!0),n=n?typeof n===he?t(n)[0]:n.jquery?n[0]:n:ve.parentElem||le.body,z=!ue.noValidate&&n.contentEditable!==Ge,Y=n.tagName.toLowerCase(),ie=!!dt[Y],i=i&&w(i,ie),r=r&&w(r,ie)||null,void 0!=a){if(te=le.createElement("div"),ee=te,se=oe="",ae="http://www.w3.org/2000/svg"===n.namespaceURI?"svg_ns":(J=Ce.exec(a))&&J[1]||"",ie){for($=r;$&&!(O=y($));)$=$.nextSibling;(ne=O?O._tkns:n._df)&&(D=M||"",(o||!M)&&(D+="#"+ge),V=ne.indexOf(D),V+1&&(V+=D.length,se=oe=ne.slice(0,V),ne=ne.slice(V),O?$.setAttribute(De,ne):l(n,ne)))}if(Z=void 0,a=(""+a).replace(_t,c),z&&be.length&&ke("Mismatched '<"+Y+"...>' in:\n"+a),f)return;for(lt.appendChild(te),ae=Se[ae]||Se.div,W=ae[0],ee.innerHTML=ae[1]+a+ae[2];W--;)ee=ee.lastChild;for(lt.removeChild(te),X=le.createDocumentFragment();G=ee.firstChild;)X.appendChild(G);n.insertBefore(X,r)}return _(),Ee}function b(e,t,n,i,r,a,o,l){var s,d,p,c,v,g,u,_,m,h,b,k=[];if(r)_=vt[r],_=_.linkCtx?_.linkCtx.tag:_,u=_.linkCtx||{type:"inline",data:i.data,elem:_._elCnt?_.parentElem:n,view:i,ctx:i.ctx,attr:be,fn:_._.bnd,tag:_,_bndId:r},_.linkCtx=u,x(u,e),_._toLk=u._bndId;else if(t&&n){for(o=a?o:i.data,s=i.tmpl,t=j(t,f(n)),b=Ae.lastIndex=0;d=Ae.exec(t);)k.push(d),b=Ae.lastIndex;for(b<t.length&&ke(t);d=k.shift();){for(m=Ae.lastIndex,p=d[1],v=d[3];k[0]&&"else"===k[0][4];)v+=re+te+k.shift()[3],h=!0;h&&(v+=re+te+ne+"/"+d[4]+ie),u={type:a||"link",data:o,elem:n,view:i,ctx:l,attr:p,_toLk:1,_noUpd:d[2]},c=void 0,d[6]&&(c=d[10]||void 0,u.convert=d[5]||"",void 0!==c&&f(n)&&(p&&ke(v+"- Remove target: "+p),u.convertBack=c=c.slice(1))),u.expr=p+v,g=ot[v],g||(ot[v]=g=de.tmplFn(v.replace(we,"\\$&"),s,!0,c,h)),u.fn=g,x(u,e),Ae.lastIndex=m}}}function x(e,n){function i(t,n){n&&n.refresh||o.call(e,t,n)}var r,a=e.type;if(("top"===a||"expr"===a)&&(e.view=new de.View(de.extendCtx(e.ctx,e.view.ctx),"link",e.view,e.data,e.expr,void 0,v)),e._ctxCb=de._gccb(r=e.view),e._hdl=i,"SELECT"===e.elem.nodeName&&(e.elem._jsvLkEl||"link"===a&&!e.attr&&void 0!==e.convert)){var l,s=e.elem,d=t(s);d.on("jsv-domchange",function(){arguments[3].refresh||(s._jsvLkEl?d.val(s._jsvLkEl.cvtArgs(s._jsvElse,1)[s._jsvInd]):e.tag?d.val(e.tag.cvtArgs(0,1)):(l=e.fn(r.data,r,de),d.val(e.convert||e.convertBack?de._cnvt(e.convert,r,l):l)))})}e.fn._lr?(e._toLk=1,n.push(e)):i(!0)}function k(e,t){var n;return e?(n=e.indexOf(t),n+1?e.slice(0,n)+e.slice(n+t.length):e):""}function C(e){return e&&(typeof e===he?e:e.tagName===Xe?e.type.slice(3):1===e.nodeType&&e.getAttribute(De)||"")}function y(e,t,n){function i(e,t,n,i,a,l){o.push({elCnt:r,id:i,ch:a,open:t,close:n,path:l,token:e})}var r,a,o=[];return(a=t?e:C(e))?(r=o.elCnt=e.tagName!==Xe,r="@"===a.charAt(0)||r,o._tkns=a,a.replace(n||Ct,i),o):void 0}function E(e,t){e&&("jsv"===e.type?e.parentNode.removeChild(e):t&&""===e.getAttribute(Ve)&&e.removeAttribute(Ve))}function w(e,t){for(var n=e;t&&n&&1!==n.nodeType;)n=n.previousSibling;return n&&(1!==n.nodeType?(n=le.createElement(Xe),n.type="jsv",e.parentNode.insertBefore(n,e)):C(n)||n.getAttribute(Ve)||n.setAttribute(Ve,"")),n}function j(e,n){return e=t.trim(e),e.slice(-1)!==ie?e=ne+":"+e+(n?":":"")+ie:e}function A(e,n,i){function r(){a=C.linkedElems||e.linkedElems||e.linkedElem&&[e.linkedElem],a&&(e.linkedElems=C.linkedElems=a,e.linkedElem=a[0]=e.linkedElem||a[0]),(l=C.mainElem||e.mainElem)&&(C.mainElem=e.mainElem=l),(l=C.displayElem||e.displayElem)&&(C.displayElem=e.displayElem=l)}var a,o,l,s,d,p,f,c,v,g,u,_,m,h,b,x,k,C=e.tagCtx,y=e.tagCtxs,E=y&&y.length,w=e.linkCtx,j=e.bindTo||{};if(e._.unlinked){if(p=t(w.elem),e.linkedElement||e.mainElement||e.displayElement){if(o=e.linkedElement)for(e.linkedElem=void 0,s=o.length;s--;)if(o[s])for(f=!e.inline&&p.filter(o[s]),d=E;d--;)g=y[d],a=g.linkedElems=g.linkedElems||new Array(s),l=f[0]?f:g.contents(!0,o[s]),l[0]&&l[0].type!==Ke&&(a[s]=l.eq(0));if(o=e.mainElement)for(f=!e.inline&&p.filter(o),d=E;d--;)g=y[d],l=f[0]?f:g.contents(!0,o).eq(0),l[0]&&(g.mainElem=l);if(o=e.displayElement)for(f=!e.inline&&p.filter(o),d=E;d--;)g=y[d],l=f[0]?f:g.contents(!0,o).eq(0),l[0]&&(g.displayElem=l);r()}e.onBind&&(e.onBind(C,w,e.ctx,n,i),r())}for(d=E;d--;){if(g=y[d],u=g.props,e._.unlinked&&g.map&&e.mapProps){for(b=e.mapProps.length,x=u.mapDepends||e.mapDepends||[],x=Z(x)?x:[x];b--;){var A=e.mapProps[b];k=e._.bnd.paths[d]["_"+A],k&&k.length&&k.skp&&(x=x.concat(k))}x.length&&g.map.observe(x,w)}(l=g.mainElem||!e.mainElement&&g.linkedElems&&g.linkedElems[0])&&(l[0]&&u.id&&!l[0].id&&(l[0].id=u.id),e.setSize&&((_=!j.height&&u.height||e.height)&&l.height(_),(_=!j.width&&u.width||e.width)&&l.width(_))),(_=(l=g.displayElem||l)&&(!j["class"]&&u["class"]||e.className))&&(m=l[0]._jsvCl,_!==m&&(l.hasClass(m)&&l.removeClass(m),l.addClass(_),l[0]._jsvCl=_))}if(e.onAfterLink&&(e.onAfterLink(C,w,e.ctx,n,i),r()),!e.flow&&!e._.chg)for(e._tgId&&e._.unlinked&&(e.linkedElems||e.bindTo)&&S(vt[e._tgId],e),d=y.length;d--;){for(u=e.cvtArgs(d,1),s=u.length;s--;)e.setValue(u[s],s,d,n,i);if(e._.unlinked)for(C=y[d],a=C.linkedElems||!d&&e.linkedElem&&[e.linkedElem],h=(e.bindTo||[0]).length;h--;)if((l=a&&a[h])&&(s=l.length))for(;s--;)c=l[s],v=c._jsvLkEl,v&&v===e||(c._jsvLkEl=e,c._jsvInd=h,c._jsvElse=d,I(e,c),e._tgId&&(c._jsvBnd="&"+e._tgId+"+"))}e._.unlinked=void 0,e._.lt&&e.refresh()}function T(e){var t=e.which;t>15&&21>t||t>32&&41>t||t>111&&131>t||27===t||144===t||setTimeout(function(){a(e)})}function V(e,t,n){t!==!0||!Be||Pe&&e[0].contentEditable===Ge?(t=typeof t===he?t:"keydown.jsv",e[n](t,t.indexOf("keydown")>=0?T:a)):e[n]("input.jsv",a)}function I(e,n){var i,r,a=n._jsvTr||!1;e&&(r=e.tagCtx.props.trigger,void 0===r&&(r=e.trigger)),void 0===r&&(r=pe.trigger),r=r&&("INPUT"===n.tagName&&n.type!==Re&&n.type!==Ke||"textarea"===n.type||n.contentEditable===Ge)&&r||!1,a!==r&&(i=t(n),V(i,a,"off"),V(i,n._jsvTr=r,"on"))}function S(e,t,n){var i,r,a,o,l,s,d,p,f,c,v,g,u,_,m,h=1,b=[],x=e.linkCtx,k=x.data,C=x.fn.paths;if(e&&!e.to){for(t&&(t.convertBack||(t.convertBack=n),s=t.bindTo,h=t.tagCtxs?t.tagCtxs.length:1);h--;){if(u=[],g=C[h])for(s=g._jsvto?["jsvto"]:s||[0],!h&&t&&t._.ths&&(s=s.concat("this")),p=s.length;p--;){if(r="",v=x._ctxCb,d=s[p],d=g[+d===d?d:"_"+d],i=d&&d.length){if(a=d[i-1],a._cpfn){for(o=a;a.sb&&a.sb._cpfn;)r=a=a.sb;r=a.sb||r&&r.path,m=a._cpfn&&!a.sb,a=r?r.slice(1):o.path}l=r?[o,a]:N(a,k,v)}else c=t.linkedCtxParam,l=[],_=t._.fromIndex,_&&c&&c[_[p]]&&(l=[t.tagCtxs[h].ctx[c[_[p]]][0],xe]);(f=l._cxp)&&f.tag&&a.indexOf(".")<0&&(l=f),l.isCpfn=m,u.unshift(l)}b.unshift(u)}e.to=b}}function N(e,t,n){for(var i,r,a,o,l,s,d,p;e&&e!==xe&&(a=n(i=e.split("^").join(".")))&&(o=a.length);){if(l=a[0]._cxp)if(d=d||l,s=a[0][0],xe in s?(p=s,s=s._vw):p=s.data,d.path=e=a[0][1],a=[d.data=p,e],n=de._gccb(s),e._cpfn){for(r=e,r.data=a[0],r._cpCtx=n;e.sb&&e.sb._cpfn;)i=e=e.sb;i=e.sb||i&&i.path,e=i?i.slice(1):r.path,a=[r,e]}else l.tag&&l.path===xe&&(a=l);else a=o>1?[a[o-2],a[o-1]]:[a[o-1]];t=a[0],e=a[1]}return a=a||[t,i],a._cxp=d,a}function L(e,t,n){var i,r,a=e.tagCtx.view,o=e.tagCtxs||[e.tagCtx],l=o.length,s=!t;if(s){if(t=e._.bnd.call(a.tmpl,(e.linkCtx||a).data,a,de),t.lt)return;e._.lt=void 0,t=Z(t)?t:[t]}if(n)o=e.tagCtxs=t,e.tagCtx=o[0],R(e);else for(;l--;)i=o[l],r=t[l],fe(i.ctx,r.ctx),i.args=r.args,s&&(i.tmpl=r.tmpl),Y(i.props).setProperty(r.props);return de._thp(e,o[0]),o}function B(e){for(var t,n,i,r=[],a=e.length,o=a;o--;)r.push(e[o]);for(o=a;o--;)if(n=r[o],n.parentNode){if(i=n._jsvBnd)for(i=i.slice(1).split("&"),n._jsvBnd="",t=i.length;t--;)P(i[t],n._jsvLkEl,n);O(C(n)+(n._df||""),n)}}function P(e,n,i){var r,a,o,l,s,d,p,f,c,v,g,u,_,m,h=vt[e];if(n)i._jsvLkEl=void 0;else if(h&&(!i||i===h.elem)){delete vt[e];for(r in h.bnd)(l=h.bnd[r])&&(s=h.cbId,Z(l)?t([l]).off(me+s).off(_e+s):t(l).off(_e+s),delete h.bnd[r]);if(a=h.linkCtx){if(o=a.tag){if(d=o.tagCtxs)for(p=d.length;p--;)u=d[p],(f=u.map)&&f.unmap(),(_=u.linkedElems)&&(m=(m||[]).concat(_));o.onUnbind&&o.onUnbind(o.tagCtx,a,o.ctx),o.onDispose&&o.onDispose(),o._elCnt||(o._prv&&o._prv.parentNode.removeChild(o._prv),o._nxt&&o._nxt.parentNode.removeChild(o._nxt))}for(_=m||[t(a.elem)],p=_.length;p--;)c=_[p],(v=c&&c[0]&&c[0]._jsvTr)&&(V(c,v,"off"),c[0]._jsvTr=void 0);g=a.view,"link"===g.type?g.parent.removeViews(g._.key,void 0,!0):delete g._.bnds[e]}delete h.s[h.cbId]}}function U(e){e?(e=e.jquery?e:t(e),e.each(function(){for(var e;(e=Te(this,!0))&&e.parent;)e.parent.removeViews(e._.key,void 0,!0);B(this.getElementsByTagName("*"))}),B(e)):(je&&(t(je).off(qe,a).off("blur.jsv","[contenteditable]",a),je=void 0),oe.removeViews(),B(le.body.getElementsByTagName("*")))}function D(e){return e.type===Re?e[Fe]:e.value}function q(e,t,n){return n&&n[t]||e.ctx[t]&&e.ctxPrm(t)||ee.helpers[t]}function M(e,t,n,i,r,a){var o,s,d,p,f,c,v,g=0,u=e===t;if(e){for(d=y(e)||[],o=0,s=d.length;s>o;o++){if(p=d[o],c=p.id,c===i&&p.ch===r){if(!a)break;s=0}u||(f="_"===p.ch?Ne[c]:vt[c].linkCtx.tag,f&&(p.open?f._prv=t:p.close&&(f._nxt=t))),g+=c.length+2}g&&e.setAttribute(De,e.getAttribute(De).slice(g)),v=t?t.getAttribute(De):n._df,(s=v.indexOf("/"+i+r)+1)&&(v=d._tkns.slice(0,g)+v.slice(s+(a?-1:i.length+1))),v&&(t?t.setAttribute(De,v):l(n,v))}else l(n,k(n._df,"#"+i+r)),a||t||l(n,k(n._df,"/"+i+r))}function O(e,t){var n,i,r,a;if(a=y(e,!0,ht))for(n=0,i=a.length;i>n;n++)r=a[n],"_"===r.ch?!(r=Ne[r.id])||!r.type||t&&r._prv!==t&&r.parentElem!==t||r.parent.removeViews(r._.key,void 0,!0):P(r.id,void 0,t)}function $(e,t,n,i,a,o){var l=this,s=[];return l&&l._tgId&&(a=l),arguments.length<4&&(+t!==t?(i=t,n=t=0):+n!==n&&(i=n,n=0)),s[t||0]=e,r(s,n,i,a,o),l}function F(){for(var e=this.tag.bindTo.length,t=arguments[e],n=arguments[e+1];e--;)this.tag.setValue(arguments[e],e,this.index,t,n)}function R(e){var n,i,a,o,d,v,u,_;if(e.contents=function(e,n,i){e!==!!e&&(n=e,e=void 0);var r,a=t(this.nodes());return a[0]&&(n=e?n||"*":n,r=n?a.filter(n):a,a=e?r.add(a.find(n)):r),i?a.filter(i):a},e.nodes=function(e,t,n){var i,r=this.contentView||this,a=r._elCnt,o=!t&&a,l=[];if(!r.args)for(t=t||r._prv,n=n||r._nxt,i=o?t===r._nxt?r.parentElem.lastSibling:t:r.inline===!1?t||r.linkCtx.elem.firstChild:t&&t.nextSibling;i&&(!n||i!==n);)(e||a||i.tagName!==Xe)&&l.push(i),i=i.nextSibling;return l},e.childTags=function(e,t){e!==!!e&&(t=e,e=void 0);var n=this.contentView||this,i=n.link?n:n.tagCtx.view,r=n._prv,a=n._elCnt,o=[];return n.args||i.link(void 0,n.parentElem,a?r&&r.previousSibling:r,n._nxt,void 0,{get:{tags:o,deep:e,name:t,id:n.link?n._.id+"_":n._tgId+"^"}}),o},"tag"===e._is){for(u=e,i=u.tagCtxs.length;i--;)a=u.tagCtxs[i],a.setValues=F,a.contents=e.contents,a.childTags=e.childTags,a.nodes=e.nodes;if(o=u.boundProps=u.boundProps||[],d=u.bindFrom)for(n=d.length;n--;)v=d[n],typeof v===he&&(d[v]=1,wt(v,o)<0&&o.push(v));u.setValue=de._gm(u.constructor.prototype.setValue||function(e){return e},function(e,i,r,a,o){i=i||0,r=r||0;var l,s,d,p,f,c,v=u.tagCtxs[r];if(!v._bdArgs||!o&&void 0===e||v._bdArgs[i]!==e||o&&"set"===o.change&&(a.target===e||o.value===e)?(v._bdArgs=v._bdArgs||[],v._bdArgs[i]=e,c=u.base.call(u,e,i,r,a,o),void 0!==c&&(v._bdVals=v._bdVals||[],v._bdVals[i]=c,e=c)):v._bdVals&&(e=v._bdVals[i]),void 0!==e&&(d=u.linkedCtxParam)&&d[i]&&v.ctxPrm(d[i],e),p=u._.toIndex[i],void 0!==p&&(f=v.linkedElems||u.linkedElem&&[u.linkedElem])&&(l=f[p])&&(n=l.length))for(;n--;)s=l[n],void 0===e||s._jsvChg||u.linkCtx._val===e||(void 0!==s.value?s.type===Re?s[Fe]=t.isArray(e)?t.inArray(s.value,e)>-1:e&&"false"!==e:s.type===Ke?s[Fe]=s.value===e:t(s).val(e):s[s.contentEditable===Ge?"innerHTML":Ue]=e),v.props.name&&(s.name=s.name||v.props.name);return u}),u.updateValue=$,u.updateValues=function(){var e,t,n=this,i=n.bindTo?n.bindTo.length:1,a=arguments.length-i;return a&&(e=arguments[i],a>1?t=a>1?arguments[i+1]:void 0:+e!==e&&(t=e,e=0)),r(arguments,e,t,this)},u.setValues=function(){return F.apply(u.tagCtx,arguments),u},u.refresh=function(){var e,t,n=u.linkCtx,i=u.tagCtx.view;if(t=L(u))return u.onUnbind&&(u.onUnbind(u.tagCtx,n,u.ctx),u._.unlinked=!0),e=u.inline?be:n.attr||f(u.parentElem,!0),t=":"===u.tagName?de._cnvt(u.convert,i,u.tagCtx):de._tag(u,i,i.tmpl,t,!0),g(n,n.data,n.elem),s(t,n,e,u),A(u),u},u.domChange=function(e,n,i,r){var o,l,s,d,p=u,f="jsv-domchange",c=/&(\d+)\+?/g,v=p.parentElem,g=t._data(v).events;for(g&&g[f]&&t(v).triggerHandler(f,arguments);v!==je;){for(;p&&(!p.parentElem||p.parentElem===v);)for(p.onDomChange&&p.onDomChange(a,n,i,r),s=p.tagCtx.view||oe,p=s.tag;!p&&s.parent&&!s.isTop;)s=s.parent,p=s.tag;for(d=v,v=p&&p.parentElem||je;d&&d!==v;){for(;o=c.exec(d._jsvBnd);)(l=vt[o[1]])&&(l=l.linkCtx.tag,l&&l.onDomChange&&l.onDomChange(a,n,i,r));d=d.parentElement}}}}else _=e,_.addViews=function(e,t,n){var i,r=this,a=t.length,o=r.views;!r._.useKey&&a&&(i=o.length+a,!n&&i!==r.data.length||c(r,e,r.tmpl,o,t,r.ctx)===!1||r._.srt||r.fixIndex(e+a))},_.removeViews=function(e,n,i,r){function a(e){var n,r,a,o,l,s,d=c[e];if(d&&d.link){n=d._.id,i||(s=d.nodes()),d.removeViews(void 0,void 0,!0),d.type=void 0,o=d._prv,l=d._nxt,a=d.parentElem,i||(d._elCnt&&M(o,l,a,n,"_"),t(s).remove()),!d._elCnt&&o&&(o.parentNode.removeChild(o),l.parentNode.removeChild(l)),p(d);for(r in d._.bnds)P(r);delete Ne[n]}}var o,l,s,d=this,f=!d._.useKey,c=d.views;if(f&&(s=c.length),void 0===e)if(f){for(o=s;o--;)a(o);d.views=[]}else{for(l in c)a(l);d.views={}}else if(void 0===n&&(f?n=1:(a(e),delete c[e])),f&&n&&(r||s-n===d.data.length)){for(o=e+n;o-->e;)a(o);c.splice(e,n),d._.srt||d.fixIndex(e)}},_.moveViews=function(e,n,i){function r(e,t){return RegExp("^(.*)("+(t?"\\/":"#")+e._.id+"_.*)$").exec(t||e._prv.getAttribute(De))}function a(e,t){var n,i=e._prv;i.setAttribute(De,t),t.replace(xt,function(e,t,r,a){n=vt[a].linkCtx.tag,n.inline&&(n[t?"_prv":"_nxt"]=i)}),t.replace(bt,function(e,t,n,r){Ne[r][t?"_prv":"_nxt"]=i})}var o,s,d,p=this,f=p._nxt,c=p.views,v=e>n,g=v?n:e,u=v?e:n,_=n,m=[],h=c.splice(e,i);for(n>c.length&&(n=c.length),c.splice.apply(c,[n,0].concat(h)),i=h.length,d=n+i,u+=i,_;d>_;_++)s=c[_],o=s.nodes(!0),m=p._elCnt?m.concat(o):m.concat(s._prv,o,s._nxt);if(m=t(m),d<c.length?m.insertBefore(c[d]._prv):f?m.insertBefore(f):m.appendTo(p.parentElem),p._elCnt){var b,x=v?g+i:u-i,k=(c[g-1],c[g]),C=c[x],y=c[u],E=r(k),w=r(C);a(k,w[1]+E[2]),y?(b=r(y),a(y,E[1]+b[2])):(c[u-1]._nxt=f,f?(b=r(p,f.getAttribute(De)),f.setAttribute(De,E[1]+b[2])):(b=r(p,p.parentElem._df),l(p.parentElem,E[1]+b[2]))),a(C,b[1]+w[2])}p.fixIndex(g)},_.refresh=function(){var e=this,t=e.parent;return t&&(c(e,e.index,e.tmpl,t.views,e.data,void 0,!0),p(e)),e},_.fixIndex=function(e){for(var t=this.views,n=t.length;e<n--;)t[n].index!==n&&Y(t[n]).setProperty("index",n)},_.link=h}function K(e,t,n){var i,r,a=e.options.props;if(z(e.propsArr,n.path,n.value,n.remove),void 0!==a.sort||void 0!==a.start||void 0!==a.end||void 0!==a.step||a.filter||a.reverse)e.update();else if("set"===n.change){for(i=e.tgt,r=i.length;r--&&i[r].key!==n.path;);-1===r?n.path&&!n.remove&&Y(i).insert({key:n.path,prop:n.value}):n.remove?Y(i).remove(r):Y(i[r]).setProperty("prop",n.value)}}function H(e,t,n){var i,r,a,o,l=e.src,s=n.change;if("set"===s)"prop"===n.path?Y(l).setProperty(t.target.key,n.value):(Y(l).removeProperty(n.oldValue),Y(l).setProperty(n.value,t.target.prop));else if("insert"===s||(o="remove"===s))for(i=n.items,r=i.length;r--;)(a=i[r].key)&&(z(e.propsArr,a,i[r].prop,o),o?(Y(l).removeProperty(a),delete l[a]):Y(l).setProperty(a,i[r].prop))}function z(e,t,n,i){for(var r=e.length;r--&&e[r].key!==t;);-1===r?t&&!i&&e.push({key:t,prop:n}):i&&e.splice(r,1)}function Q(e){return yt.test(e)}var W=t===!1;n=n||W&&e.jsrender,t=t||e.jQuery;var X="v1.0.15",G="jquery.views.js requires ";if(!t||!t.fn)throw G+"jQuery";n&&!n.fn&&n.views.sub._jq(t);var J,Y,Z=t.isArray,ee=t.views;if(!t.render)throw G+"jsrender.js";if(ee.jsviews!==X)throw G+"query.observable.js "+X;if(!ee||!ee.map||ee.jsviews!==X)throw G+"jsrender.js "+X;var te,ne,ie,re,ae,oe,le=e.document,se=ee.settings,de=ee.sub,pe=de.settings,fe=de.extend,ce=t.isFunction,ve=(t.expando,ee.converters),ge=ee.tags,ue=pe.advanced,_e=de.propChng=de.propChng||"propertyChange",me=de.arrChng=de.arrChng||"arrayChange",he="string",be="html",xe="_ocp",ke=de.syntaxErr,Ce=/<(?!script)(\w+)[>\s]/,ye=de._er,Ee=de._err,we=/['"\\]/g;if(t.link)return t;pe.trigger=!0;var je,Ae,Te,Ve,Ie,Se,Ne,Le,Be,Pe=window.navigator.userAgent,Ue=void 0!==le.textContent?"textContent":"innerText",De="data-jsv",qe="change.jsv",Me="onBeforeChange",Oe="onAfterChange",$e="onAfterCreate",Fe="checked",Re="checkbox",Ke="radio",He="input[type=",ze=He+Re+"]",Qe="none",We="value",Xe="SCRIPT",Ge="true",Je='"></script>',Ye='<script type="jsv',Ze=De+"-df",et="script,["+De+"]",tt={value:"val",input:"val",html:be,text:"text"},nt={from:We,to:We},it=0,rt=t.cleanData,at=se.delimiters,ot={},lt=le.createDocumentFragment(),st=le.querySelector,dt={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},pt={tr:"table"},ft={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},ct={},vt={},gt=1,ut=/^#(view\.?)?/,_t=/((\/>)|<\/(\w+)>|)(\s*)([#/]\d+(?:_|(\^)))`(\s*)(<\w+(?=[\s\/>]))?|\s*(?:(<\w+(?=[\s\/>]))|<\/(\w+)>(\s*)|(\/>)\s*|(>)|$)/g,mt=/(#)()(\d+)(_)/g,ht=/(#)()(\d+)([_^])/g,bt=/(?:(#)|(\/))(\d+)(_)/g,xt=/(?:(#)|(\/))(\d+)(\^)/g,kt=/(#)()(\d+)(\^)/g,Ct=/(?:(#)|(\/))(\d+)([_^])([-+@\d]+)?/g,yt=/^[^.]*$/,Et=e.getComputedStyle,wt=t.inArray;if(He+=Ke+"]",Pe=Pe.indexOf("MSIE ")>0||Pe.indexOf("Trident/")>0,Y=t.observable,!Y)throw G+"jquery.observable.js";return J=Y.observe,pe._clFns=function(){ot={}},R(de.View.prototype),de.onStore.template=function(e,n,i){null===n?(delete t.link[e],delete t.render[e]):(n.link=_,e&&!i&&"jsvTmpl"!==e&&(t.render[e]=n,t.link[e]=function(){return _.apply(n,arguments)}))},de.viewInfos=y,(se.delimiters=function(){var e=at.apply(0,arguments),t=pe.delimiters;return te=t[0].charAt(0),ne=t[0].charAt(1),ie=t[1].charAt(0),re=t[1].charAt(1),ae=t[2],Ae=new RegExp("(?:^|\\s*)([\\w-]*)(\\"+ae+")?(\\"+ne+de.rTag+"(:\\w*)?\\"+ie+")","g"),e})(),de.addSetting("trigger"),ve.merge=function(e){var t,n=this.linkCtx.elem.className,i=this.tagCtx.props.toggle;return i&&(t=i.replace(/[\\^$.|?*+()[{]/g,"\\$&"),t="(\\s(?="+t+"$)|(\\s)|^)("+t+"(\\s|$))",n=n.replace(new RegExp(t),"$2"),e=n+(e?(n&&" ")+i:"")),e},ge({on:{attr:Qe,bindTo:[],init:function(e){for(var n,i=this,r=0,a=e.args,o=a.length;o>r&&!ce(a[r]);r++);i._hi=o>r&&r+1,i.inline&&(de.rTmpl.exec(n=t.trim(e.tmpl.markup))||(i.template="<button>"+(n||e.params.args[r]||"noop")+"</button>"),i.attr=be)},onBind:function(){this.template&&(this.mainElem=this.contents("button"))},onAfterLink:function(e,n){var i,r,a,o=this,l=o._hi,s=e.args,d=s.length,p=e.props,f=p.data,c=e.view,v=p.context;l&&(i=s[l-1],r=s.slice(l),s=s.slice(0,l-1),o._sel=s[1],a=o.activeElem=o.activeElem||t(o.inline?(o._sel=s[1]||"*",o.parentElem):n.elem),v||(v=/^(.*)[.^][\w$]+$/.exec(e.params.args.slice(-r.length-1)[0]),v=v&&de.tmplFn(ne+":"+v[1]+ie,c.tmpl,!0)(n.data,c,de)),o._evs&&o.onUnbind(e,n,o.ctx),a.on(o._evs=s[0]||"click",o._sel,void 0==f?null:f,o._hlr=function(e){var t,a=!o.inline;if(!a)for(t=o.contents("*"),d=t.length;!a&&d--;)t[d].contains(e.target)&&(a=!0);return a?i.apply(v||n.data,[].concat(r,e,{change:e.type,view:c,linkCtx:n},r.slice.call(arguments,1))):void 0}))},onUpdate:!1,onArrayChange:!1,onUnbind:function(){var e=this,t=it;e.activeElem&&(it=0,e.activeElem.off(e._evs,e._sel,e._hlr),it=t)},contentCtx:!0,setSize:!0,dataBoundOnly:!0},radiogroup:{boundProps:["disabled"],init:function(e){this.name=e.props.name||(Math.random()+"jsv").slice(9)},onBind:function(e,n){var i,r,a=this,o=e.args[1],l=e.params.args[0],s=e.params.props,d=s&&s.disabled;for(a.inline?i=a.contents(!0,He,o):(i=t(He,n.elem),o&&(i=i.filter(o))),r=i.length;r--;)i[r].name=i[r].name||a.name;for(r in s)l+=" "+r+"="+s[r];i.link(l,n.data,void 0,void 0,n.view),a.linkedElem=i,a.onDomChange=function(n,r,s,p){var f,c,v=a.cvtArgs()[0];for(a.linkedElem=i=a.contents(!0,He,o),c=i.length;c--;)f=i[c],f._jsvLkEl||(f.name=f.name||a.name,
f._jsvLkEl=a,f._jsvBnd="&"+a._tgId+"+",f.checked=v===f.value,d&&(f.disabled=!!e.props.disabled),t.link(l,f,r.data))}},onAfterLink:function(e,t,n,i,r){var a=e.params.props;a&&a.disabled&&this.linkedElem.prop("disabled",!!e.props.disabled)},flow:!0,onUpdate:!1,contentCtx:!0,dataBoundOnly:!0},checkboxgroup:{boundProps:["disabled"],init:function(e){this.name=e.props.name||(Math.random()+"jsv").slice(9)},onBind:function(e,n){var i,r,a=this,o=e.args[1],l=e.params.args[0],s=e.params.props,d=s&&s.disabled;for(a.inline?i=a.contents(!0,ze,o):(a.lateRender=!0,i=t(ze,n.elem),o&&(i=i.filter(o))),r=i.length;r--;)i[r].name=i[r].name||a.name,i[r]._jsvLkEl=a;for(r in s)l+=" "+r+"="+s[r];i.link(l,n.data,void 0,void 0,n.view),a.linkedElem=i,a.onDomChange=function(n,i,r,s){for(var p,f=a.contents(!0,ze,o),c=f.length;c--;)p=f[c],d&&(p.disabled=!!e.props.disabled),p._jsvSel||(p.name=p.name||a.name,t.link(l,p,i.data))}},onAfterLink:function(e,t,n,i,r){var a=e.params.props;a&&a.disabled&&this.contents(!0,ze,e.args[1]).prop("disabled",!!e.props.disabled)},flow:!0,onUpdate:!1,contentCtx:!0,dataBoundOnly:!0}}),fe(ge["for"],{sortDataMap:ee.map({getTgt:ge["for"].sortDataMap.getTgt,obsSrc:function(e,t,n){e.update()},obsTgt:function(e,t,n){var i,r=n.items,a=e.src;if("remove"===n.change)for(i=r.length;i--;)Y(a).remove(wt(r[i],a));else"insert"===n.change&&Y(a).insert(r)}}),mapProps:["filter","sort","reverse","start","end","step"],bindTo:["paged","sorted"],bindFrom:[0],onArrayChange:function(e,t,n,i){var r,a,o=e.target.length,l=this;if(!l.rendering)if(l._.noVws||l.tagCtxs[1]&&("insert"===t.change&&o===t.items.length||"remove"===t.change&&!o))a=n.map&&n.map.propsArr,l.refresh(),a&&(n.map.propsArr=a);else for(r in l._.arrVws)r=l._.arrVws[r],r.data===e.target&&d.apply(r,arguments);l.domChange(n,i,t,e),e.done=!0},onUpdate:function(e,t,n){this.setDataMap(n)},onBind:function(e,t,n,i,r){for(var a,o=this,l=0,s=o._ars=o._ars||{},d=o.tagCtxs,p=d.length,f=o.selected||0;f>=l;l++)e=d[l],a=e.map?e.map.tgt:e.args.length?e.args[0]:e.view.data,s[l]&&(J(s[l],!0),delete s[l]),!s[l]&&Z(a)&&!function(){var n=e;J(a,s[l]=function(e,i){o.onArrayChange(e,i,n,t)})}();for(l=f+1;p>l;l++)s[l]&&(J(s[l],!0),delete s[l]);r&&o.domChange(e,t,r,i)},onAfterLink:function(){for(var e,n,i,r,a=this,o=0,l=a.tagCtxs,s=(l.length,a.selected||0);s>=o;o++)r=l[o],n=r.map,e=r.map?n.tgt:r.args.length?r.args[0]:r.view.data,Z(e)&&(i=r.params.props)&&(i.paged&&!a.paged&&(t.observable(a).setProperty("paged",e.slice()),a.updateValue(a.paged,0,o,!0)),i.sorted&&!a.sorted&&(t.observable(a).setProperty("sorted",n&&n.sorted||e.slice()),a.updateValue(a.sorted,1,o,!0)))},onDispose:function(){var e,t=this;for(e in t._ars)J(t._ars[e],!0)}}),fe(ge["if"],{onUpdate:function(e,t,n){for(var i,r,a=0;i=this.tagCtxs[a];a++)if(r=i.props.tmpl!==n[a].props.tmpl||i.args.length&&!(i=i.args[0])!=!n[a].args[0],!this.convert&&i||r)return r;return!1},onAfterLink:function(e,t,n,i,r){r&&this.domChange(e,t,r,i)}}),ge("props",{baseTag:"for",dataMap:ee.map({getTgt:ge.props.dataMap.getTgt,obsSrc:K,obsTgt:H,tgtFlt:Q}),flow:!0}),fe(t,{view:Te=function(e,n,i){function r(e,t){if(e)for(o=y(e,t,mt),s=0,d=o.length;d>s&&(!(a=Ne[o[s].id])||!(a=a&&i?a.get(!0,i):a));s++);}n!==!!n&&(i=n,n=void 0);var a,o,l,s,d,p,f,c=0,v=le.body;if(e&&e!==v&&oe._.useKey>1&&(e=typeof e===he?t(e)[0]:e.jquery?e[0]:e)){if(n){if(r(e._df,!0),!a&&e.tagName)for(f=st?e.querySelectorAll(et):t(et,e).get(),p=f.length,l=0;!a&&p>l;l++)r(f[l]);return a}for(;e;){if(o=y(e,void 0,bt))for(p=o.length;p--;)if(a=o[p],a.open){if(1>c)return a=Ne[a.id],a&&i?a.get(i):a||oe;c--}else c++;e=e.previousSibling||e.parentNode}}return oe},link:m,unlink:U,cleanData:function(e){e.length&&it&&B(e),rt.apply(t,arguments)}}),fe(t.fn,{link:function(e,t,n,i,r,a,o){return m(e,this,t,n,i,r,a,o)},unlink:function(){return U(this)},view:function(e,t){return Te(this[0],e,t)}}),t.each([be,"replaceWith","empty","remove"],function(e,n){var i=t.fn[n];t.fn[n]=function(){var e;it++;try{e=i.apply(this,arguments)}finally{it--}return e}}),fe(oe=de.topView,{tmpl:{links:{}}}),Ne={0:oe},de._glt=function(e){for(var t,n=/#(\d*)\^\/\1\^/g,i=[],r=C(e);t=n.exec(r);)(t=vt[t[1]])&&i.push(t.linkCtx.tag);return i},de._gccb=function(e){return function(t,n){var i,r,a,o,l,s,d,p,f,c,v;if(e&&t){if(t._cpfn)try{return ue.cache?e.getCache(t._cpKey):t._cpfn.call(e.tmpl,e.data,e,de)}catch(g){return}if("~"===t.charAt(0)){if("~tag"===t.slice(0,4)&&(r=e.ctx,"."===t.charAt(4)?(i=t.slice(5),r=r.tag):"~tagCtx."===t.slice(0,8)&&(i=t.slice(8),r=r.tagCtx),i))return r?[r,i]:[];if(t=t.slice(1).split("."),o=e.ctxPrm(l=t.shift(),void 0,!0))if(p=o._cxp){if(t.length&&(s="."+t.join("."),l=o[d=o.length-1],l._cpfn?(l.sb=s,l.bnd=!!n):(o[d]=(l+s).replace("#data.",""),"#view"===l.slice(0,5)&&(o[d]=o[d].slice(6),o.splice(d,0,e)))),a=[o],(r=p.tag)&&r.convert)for(v=r.bindTo||[0],d=v.length;d--;)void 0!==n&&d!==p.ind&&(c=v[d],f=[o[0],r.tagCtx.params[+c===c?"args":"props"]],f._cxp=p,a.push(f))}else(t.length||ce(o))&&(a=[o,t.join(".")]);return a||[]}if("#"===t.charAt(0))return"#data"===t?[]:[e,t.replace(ut,"")]}}},de._cp=function(e,n,i,r){if(i.linked){if(r&&(r.cvt||void 0===r.tag._.toIndex[r.ind]))e=[{_ocp:e}],r.updateValue=function(n){return t.observable(e._cxp.data).setProperty(xe,n),this};else if(n){var a=ne+":"+n+ie,o=ot[a];o||(ot[a]=o=de.tmplFn(a.replace(we,"\\$&"),i.tmpl,!0)),e=o.deps[0]?[i,o]:[{_ocp:r?e:o()}]}else e=[{_ocp:e}];e._cxp=r||{updateValue:function(t){return Y(e._cxp.data).setProperty(e._cxp.path,t),this}}}return e},de._ucp=function(e,t,n,i){var r=i.tag,a=r?wt(e,r.linkedCtxParam):0;return i.path||N("~"+e,n.data,de._gccb(n)),(i.updateValue||r.updateValue)(t,a,i.tagElse,void 0,r)},de._ceo=function jt(e){for(var t,n=[],i=e.length;i--;)t=e[i],t._cpfn&&(t=fe({},t),t.prm=jt(t.prm)),n.unshift(t);return n},Le=de.advSet,de.advSet=function(){Le.call(de),e._jsv=ue._jsv?fe(e._jsv||{},{views:Ne,bindings:vt}):void 0,Ve=ue.linkAttr,Ie=et+",["+Ve+"]",Se=ue._wm,Se.optgroup=Se.option,Se.tbody=Se.tfoot=Se.colgroup=Se.caption=Se.thead,Se.th=Se.td},se.advanced({linkAttr:"data-link",useViews:!1,noValidate:!1,_wm:{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:t.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},_fe:{input:{from:D,to:We},textarea:nt,select:nt,optgroup:{to:"label"}}}),t},window);
//# sourceMappingURL=jquery.views.min.js.map