All Downloads are FREE. Search and download functionalities are using the official Maven repository.

asset.~act.js.jsrender.js Maven / Gradle / Ivy

/*! JsRender v1.0.2: http://jsviews.com/#jsrender */
/*! **VERSION FOR WEB** (For NODE.JS see http://jsviews.com/download/jsrender-node.js) */
!function(e,t){var n=t.jQuery;"object"==typeof exports?module.exports=n?e(t,n):function(n){if(n&&!n.fn)throw"Provide jQuery or null";return e(t,n)}:"function"==typeof define&&define.amd?define(function(){return e(t)}):e(t,!1)}(function(e,t){"use strict";function n(e,t){return function(){var n,r=this,i=r.base;return r.base=e,n=t.apply(r,arguments),r.base=i,n}}function r(e,t){return ae(t)&&(t=n(e?e._d?e:n(s,e):s,t),t._d=(e&&e._d||0)+1),t}function i(e,t){var n,i=t.props;for(n in i)!Me.test(n)||e[n]&&e[n].fix||(e[n]="convert"!==n?r(e.constructor.prototype[n],i[n]):i[n])}function o(e){return e}function s(){return""}function a(e){try{throw console.log("JsRender dbg breakpoint: "+e),"dbg breakpoint"}catch(t){}return this.base?this.baseApply(arguments):e}function d(e){this.name=(t.link?"JsViews":"JsRender")+" Error",this.message=e||this.name}function l(e,t){if(e){for(var n in t)e[n]=t[n];return e}}function p(e,t,n){return e?de(e)?p.apply(oe,e):(we=n?n[0]:we,/^(\W|_){5}$/.test(e+t+we)||S("Invalid delimiters"),he=e[0],_e=e[1],be=t[0],xe=t[1],ge.delimiters=[he+_e,be+xe,we],e="\\"+he+"(\\"+we+")?\\"+_e,t="\\"+be+"\\"+xe,re="(?:(\\w+(?=[\\/\\s\\"+be+"]))|(\\w+)?(:)|(>)|(\\*))\\s*((?:[^\\"+be+"]|\\"+be+"(?!\\"+xe+"))*?)",fe.rTag="(?:"+re+")",re=new RegExp("(?:"+e+re+"(\\/)?|\\"+he+"(\\"+we+")?\\"+_e+"(?:(?:\\/(\\w+))\\s*|!--[\\s\\S]*?--))"+t,"g"),fe.rTmpl=new RegExp("^\\s|\\s$|<.*>|([^\\\\]|^)[{}]|"+e+".*"+t),me):ge.delimiters}function u(e,t){t||e===!0||(t=e,e=void 0);var n,r,i,o,s=this,a="root"===t;if(e){if(o=t&&s.type===t&&s,!o)if(n=s.views,s._.useKey){for(r in n)if(o=t?n[r].get(e,t):n[r])break}else for(r=0,i=n.length;!o&&r1,v=f.ctx;if(n){if(f._||(p=f.index,f=f.tag),u=f,v&&v.hasOwnProperty(n)||(v=ue).hasOwnProperty(n)){if(a=v[n],"tag"===n||"tagCtx"===n||"root"===n||"parentTags"===n||f._.it===n)return a}else v=void 0;if((!ke&&f.tagCtx||f.linked)&&(a&&a._cxp||(f=f.tagCtx||ae(a)?f:(f=f.scope||f,!f.isTop&&f.ctx.tag||f),void 0!==a&&f.tagCtx&&(f=f.tagCtx.view.scope),v=f._ocps,a=v&&v.hasOwnProperty(n)&&v[n]||a,a&&a._cxp||!i&&!g||((v||(f._ocps=f._ocps||{}))[n]=a=[{_ocp:a,_vw:u,_key:n}],a._cxp={path:Te,ind:0,updateValue:function(e,n){return t.observable(a[0]).setProperty(Te,e),this}})),d=a&&a._cxp)){if(arguments.length>2)return s=a[1]?fe._ceo(a[1].deps):[Te],s.unshift(a[0]),s._cxp=d,s;if(p=d.tagElse,c=a[1]?d.tag&&d.tag.cvtArgs?d.tag.cvtArgs(p,1)[d.ind]:a[1](a[0].data,a[0],fe):a[0]._ocp,g)return a&&c!==r&&fe._ucp(n,r,f,d),f;a=c}return a&&ae(a)&&(o=function(){return a.apply(this&&this!==e?this:u,arguments)},l(o,a)),o||a}}function m(e){return e&&(e.fn?e:this.getRsc("templates",e)||le(e))}function h(e,t,n,r){var o,s,a,d,p,u="number"==typeof n&&t.tmpl.bnds[n-1];if(void 0===r&&u&&u._lr&&(r=""),void 0!==r?n=r={props:{},args:[r]}:u&&(n=u(t.data,t,fe)),u=u._bd&&u,e||u){if(s=t._lc,o=s&&s.tag,n.view=t,!o){if(o=l(new fe._tg,{_:{bnd:u,unlinked:!0,lt:n.lt},inline:!s,tagName:":",convert:e,flow:!0,tagCtx:n,tagCtxs:[n],_is:"tag"}),d=n.args.length,d>1)for(p=o.bindTo=[];d--;)p.unshift(d);s&&(s.tag=o,o.linkCtx=s),n.ctx=Q(n.ctx,(s?s.view:t).ctx),i(o,n)}o._er=r&&a,o.ctx=n.ctx||o.ctx||{},n.ctx=void 0,a=o.cvtArgs()[0],o._er=r&&a}else a=n.args[0];return a=u&&t._.onRender?t._.onRender(a,t,o):a,void 0!=a?a:""}function _(e,t){var n,r,i,o,s,a,d,l=this;if(l.tagName){if(a=l,l=(a.tagCtxs||[l])[e||0],!l)return}else a=l.tag;if(s=a.bindFrom,o=l.args,(d=a.convert)&&""+d===d&&(d="true"===d?void 0:l.view.getRsc("converters",d)||S("Unknown converter: '"+d+"'")),d&&!t&&(o=o.slice()),s){for(i=[],n=s.length;n--;)r=s[n],i.unshift(b(l,r));t&&(o=i)}if(d){if(d=d.apply(a,i||o),void 0===d)return o;if(s=s||[0],n=s.length,de(d)&&d.length===n||(d=[d],s=[0],n=1),t)o=d;else for(;n--;)r=s[n],+r===r&&(o[r]=d[n])}return o}function b(e,t){return e=e[+t===t?"args":"props"],e&&e[t]}function x(e){return this.cvtArgs(e,1)}function w(e,t){var n,r,i=this;if(""+t===t){for(;void 0===n&&i;)r=i.tmpl&&i.tmpl[e],n=r&&r[t],i=i.parent;return n||oe[e][t]}}function y(e,t,n,r,o,s){function a(e){var t=d[e];if(void 0!==t)for(t=de(t)?t:[t],m=t.length;m--;)J=t[m],isNaN(parseInt(J))||(t[m]=parseInt(J));return t||[0]}t=t||ie;var d,l,p,u,c,f,g,m,h,w,y,k,C,T,j,A,N,P,R,F,V,$,M,I,D,J,U,q,K,L,B=0,H="",W=t._lc||!1,Z=t.ctx,z=n||t.tmpl,G="number"==typeof r&&t.tmpl.bnds[r-1];for("tag"===e._is?(d=e,e=d.tagName,r=d.tagCtxs,p=d.template):(l=t.getRsc("tags",e)||S("Unknown tag: {{"+e+"}} "),p=l.template),void 0===s&&G&&(G._lr=l.lateRender&&G._lr!==!1||G._lr)&&(s=""),void 0!==s?(H+=s,r=s=[{props:{},args:[],params:{props:{}}}]):G&&(r=G(t.data,t,fe)),g=r.length;B0&&(s=n)){if(!s)if(/^\.\/[^\\:*?"<>]*$/.test(n))(a=le[e=e||n])?n=a:s=document.getElementById(n);else if(t.fn&&!fe.rTmpl.test(n))try{s=t(n,document)[0]}catch(d){}s&&("SCRIPT"!==s.tagName&&S(n+": Use script block, not "+s.tagName),i?n=s.innerHTML:(o=s.getAttribute(Be),o&&(o!==Qe?(n=le[o],delete le[o]):t.fn&&(n=t.data(s)[Qe])),o&&n||(e=e||(t.fn?Qe:n),n=A(e,s.innerHTML,r,i)),n.tmplName=e=e||o,e!==Qe&&(le[e]=n),s.setAttribute(Be,e),t.fn&&t.data(s,Qe,n))),s=void 0}else n.fn||(n=void 0);return n}var s,a,d=n=n||"";if(fe._html=pe.html,0===i&&(i=void 0,d=o(d)),i=i||(n.markup?n.bnds?l({},n):n:{}),i.tmplName=i.tmplName||e||"unnamed",r&&(i._parentTmpl=r),!d&&n.markup&&(d=o(n.markup))&&d.fn&&(d=d.markup),void 0!==d)return d.render||n.render?d.tmpls&&(a=d):(n=F(d,i),J(d.replace(Ne,"\\$&"),n)),a||(a=l(function(){return a.render.apply(a,arguments)},n),C(a)),a}function N(e,t){return ae(e)?e.call(t):e}function P(e){for(var t=[],n=0,r=e.length;nO-(U||0))){if(U=I.slice(U,O+i.length),q!==!0)if(K=s||f[m-1].bd,L=K[K.length-1],L&&L.prm){for(;L.sb&&L.sb.prm;)L=L.sb;B=L.sb={path:L.sb,bnd:L.bnd}}else K.push(B={path:K.pop()});$=_e+":"+U+" onerror=''"+be,q=v[$],q||(v[$]=!0,v[$]=q=J($,n,!0)),q!==!0&&B&&(B._cpfn=q,B.prm=c.bd,B.bnd=B.bnd||B.path&&B.path.indexOf("^")>=0)}return l?(l=!R,l?i:P+'"'):d?(d=!F,d?i:P+'"'):(b?(_[m]=O++,c=f[++m]={bd:[]},b):"")+(E?m?"":(g=I.slice(g,O),(o?(o=a=s=!1,"\b"):"\b,")+g+(g=O+i.length,u&&t.push(c.bd=[]),"\b")):C?(m&&D(e),u&&t.pop(),o="_"+w,a=x,g=O+i.length,u&&(u=c.bd=t[o]=[],u.skp=!x),w+":"):w?w.split("^").join(".").replace(fe.rPath,S)+(A?(c=f[++m]={bd:[]},h[m]=Q,A):y):y?y:V?(V=h[m]||V,h[m]=!1,c=f[--m],V+(A?(c=f[++m],h[m]=Q,A):"")):N?(h[m]||D(e),","):p?"":(l=R,d=F,'"'))}D(e)}var o,s,a,d,l,p,u=t&&t[0],c={bd:u},f={0:c},g=0,v=(n?n.links:u&&(u.links=u.links||{}))||ie.tmpl.links,m=0,h={},_={};return"@"===e[0]&&(e=e.replace(De,".")),p=(e+(n?" ":"")).replace(fe.rPrm,i),!m&&p||D(e)}function B(e,t,n){var r,i,o,s,a,d,l,p,u,c,f,g,v,m,h,_,b,x,w,y,k,C,T,j,A,N,P,R,V,$,M,E,O,I=0,S=ve.useViews||t.useViews||t.tags||t.templates||t.helpers||t.converters,J="",q={},L=e.length;for(""+t===t?(x=n?'data-link="'+t.replace(je," ").slice(1,-1)+'"':t,t=0):(x=t.tmplName||"unnamed",t.allowCode&&(q.allowCode=!0),t.debug&&(q.debug=!0),f=t.bnds,b=t.tmpls),r=0;r":s+o):(k&&(w=F(C,q),w.tmplName=x+"/"+o,w.useViews=w.useViews||S,B(k,w),S=w.useViews,b.push(w)),A||(y=o,S=S||o&&(!ce[o]||!ce[o].flow),j=J,J=""),T=e[r+1],T=T&&"else"===T[0]),V=R?";\ntry{\nret+=":"\n+",m="",h="",N&&(g||$||s&&s!==Ke||M)){if(P=new Function("data,view,j,u","// "+x+" "+ ++I+" "+o+E+"{"+a+"};"+O),P._er=R,P._tag=o,P._bd=!!g,P._lr=M,n)return P;U(P,g),_='c("'+s+'",view,',c=!0,m=_+I+",",h=")"}if(J+=N?(n?(R?"try{\n":"")+"return ":V)+(c?(c=void 0,S=u=!0,_+(P?(f[I-1]=P,I):"{"+a+"}")+")"):">"===o?(l=!0,"h("+v[0]+")"):(p=!0,"((v="+v[0]+")!=null?v:"+(n?"null)":'"")'))):(d=!0,"\n{view:view,content:false,tmpl:"+(k?b.length:"false")+","+a+"},"),y&&!T){if(J="["+J.slice(0,-1)+"]",_='t("'+y+'",view,this,',n||g){if(J=new Function("data,view,j,u"," // "+x+" "+I+" "+y+E+J+O),J._er=R,J._tag=y,g&&U(f[I-1]=J,g),J._lr=M,n)return J;m=_+I+",undefined,",h=")"}J=j+V+_+(g&&I||J)+")",g=0,y=0}R&&!T&&(S=!0,J+=";\n}catch(e){ret"+(n?"urn ":"+=")+m+"j._err(e,view,"+R+")"+h+";}"+(n?"":"ret=ret"))}J="// "+x+(q.debug?"\ndebugger;":"")+"\nvar v"+(d?",t=j._tag":"")+(u?",c=j._cnvt":"")+(l?",h=j._html":"")+(n?(i[8]?", ob":"")+";\n":',ret=""')+J+(n?"\n":";\nreturn ret;");try{J=new Function("data,view,j,u",J)}catch(Q){D("Compiled template code:\n\n"+J+'\n: "'+(Q.message||Q)+'"')}return t&&(t.fn=J,t.useViews=!!S),J}function Q(e,t){return e&&e!==t?t?l(l({},t),e):e:t&&l({},t)}function H(e,n){var r,i,o=n.map,s=o&&o.propsArr;if(!s){if(s=[],typeof e===Le||ae(e))for(r in e)i=e[r],r===se||!e.hasOwnProperty(r)||n.props.noFunctions&&t.isFunction(i)||s.push({key:r,prop:i});o&&(o.propsArr=o.options&&s)}return W(s,n)}function W(e,n){var r,i,o,s=n.tag,a=n.props,d=n.params.props,l=a.filter,p=a.sort,u=p===!0,c=parseInt(a.step),f=a.reverse?-1:1;if(!de(e))return e;if(u||p&&""+p===p?(r=e.map(function(e,t){return e=u?e:g(e,p),{i:t,v:""+e===e?e.toLowerCase():e}}),r.sort(function(e,t){return e.v>t.v?f:e.ve.length?e.length:+o,e=e.slice(i,o)),c>1){for(i=0,o=e.length,r=[];i\s]/,Ve=/[\x00`><"'&=]/g,$e=/[\x00`><\"'&=]/,Me=/^on[A-Z]|^convert(Back)?$/,Ee=/^\#\d+_`[\s\S]*\/\d+_`$/,Oe=Ve,Ie=/[&<>]/g,Se=/&(amp|gt|lt);/g,De=/\[['"]?|['"]?\]/g,Je=0,Ue={"&":"&","<":"<",">":">","\0":"�","'":"'",'"':""","`":"`","=":"="},qe={amp:"&",gt:">",lt:"<"},Ke="html",Le="object",Be="data-jsv-tmpl",Qe="jsvTmpl",He="For #index in nested block use #getIndex().",We={},Ze=e.jsrender,ze=Ze&&t&&!t.render,Ge={template:{compile:A},tag:{compile:T},viewModel:{compile:R},helper:{},converter:{}};if(oe={jsviews:Ce,sub:{rPath:/^(!*?)(?:null|true|false|\d[\d.]*|([\w$]+|\.|~([\w$]+)|#(view|([\w$]+))?)([\w$.^]*?)(?:[.[^]([\w$]+)\]?)?)$/g,rPrm:/(\()(?=\s*\()|(?:([([])\s*)?(?:(\^?)(~?[\w$.^]+)?\s*((\+\+|--)|\+|-|~(?![\w$])|&&|\|\||===|!==|==|!=|<=|>=|[<>%*:?\/]|(=))\s*|(!*?(@)?[#~]?[\w$.^]+)([([])?)|(,\s*)|(\(?)\\?(?:(')|("))|(?:\s*(([)\]])(?=[.^]|\s*$|[^([])|[)\]])([([]?))|(\s+)/g,View:k,Err:d,tmplFn:J,parse:L,extend:l,extendCtx:Q,syntaxErr:D,onStore:{template:function(e,t){null===t?delete We[e]:e&&(We[e]=t)}},addSetting:$,settings:{allowCode:!1},advSet:s,_thp:i,_gm:r,_tg:function(){},_cnvt:h,_tag:y,_er:S,_err:I,_cp:o,_sq:function(e){return"constructor"===e&&D(""),e}},settings:{delimiters:p,advanced:function(e){return e?(l(ve,e),fe.advSet(),me):ve}},map:M},(d.prototype=new Error).constructor=d,c.depends=function(){return[this.get("item"),"index"]},f.depends="index",k.prototype={get:u,getIndex:f,ctxPrm:v,getRsc:w,_getTmpl:m,_getOb:g,_is:"view"},fe=oe.sub,me=oe.settings,!(Ze||t&&t.render)){for(ne in Ge)V(ne,Ge[ne]);if(pe=oe.converters,ue=oe.helpers,ce=oe.tags,fe._tg.prototype={baseApply:j,cvtArgs:_,bndArgs:x,ctxPrm:v},ie=fe.topView=new k,t){if(t.fn.render=Z,se=t.expando,t.observable){if(Ce!==(Ce=t.views.jsviews))throw"JsObservable requires JsRender "+Ce;l(fe,t.views.sub),oe.map=t.views.map}}else t={},te&&(e.jsrender=t),t.renderFile=t.__express=t.compile=function(){throw"Node.js: use npm jsrender, or jsrender-node.js"},t.isFunction=function(e){return"function"==typeof e},t.isArray=Array.isArray||function(e){return"[object Array]"==={}.toString.call(e)},fe._jq=function(e){e!==t&&(l(e,t),t=e,t.fn.render=Z,delete t.jsrender,se=t.expando)},t.jsrender=Ce;ge=fe.settings,ge.allowCode=!1,ae=t.isFunction,t.render=We,t.views=oe,t.templates=le=oe.templates;for(ye in ge)$(ye);(me.debugMode=function(e){return void 0===e?ge.debugMode:(ge.debugMode=e,ge.onError=e+""===e?function(){return e}:ae(e)?e:void 0,me)})(!1),ve=ge.advanced={useViews:!1,_jsv:!1},ce({"if":{render:function(e){var t=this,n=t.tagCtx,r=t.rendering.done||!e&&(n.args.length||!n.index)?"":(t.rendering.done=!0,void(t.selected=n.index));return r},contentCtx:!0,flow:!0},"for":{sortDataMap:M(W),init:function(e,t){var n,r,i,o=this,s=o.tagCtxs;for(n=s.length;n--;)r=s[n],i=r.params.props,r.argDefault=void 0===r.props.end||r.args.length>0,r.argDefault!==!1&&de(r.args[0])&&(void 0!==i.sort||i.start||i.end||i.step||i.filter||i.reverse)&&(r.props.dataMap=o.sortDataMap)},render:function(e){var t,n,r,i,o,s=this,a=s.tagCtx,d=a.argDefault===!1,l=a.props,p=d||a.args.length,u="",c=0;if(!s.rendering.done){if(t=p?e:a.view.data,d)for(d=l.reverse?"unshift":"push",i=+l.end,o=+l.step||1,t=[],r=+l.start||0;(i-r)*o>0;r+=o)t[d](r);void 0!==t&&(n=de(t),u+=a.render(t,!p||l.noIteration),c+=n?t.length:1),(s.rendering.done=c)&&(s.selected=a.index)}return u},flow:!0},props:{baseTag:"for",dataMap:M(H),init:s,flow:!0},include:{flow:!0},"*":{render:o,flow:!0},":*":{render:o,flow:!0},dbg:ue.dbg=pe.dbg=a}),pe({html:X,attr:X,encode:Y,unencode:ee,url:function(e){return void 0!=e?encodeURI(""+e):null===e?e:""}})}return ge=fe.settings,de=(t||Ze).isArray,me.delimiters("{{","}}","^"),ze&&Ze.views.sub._jq(t),t||Ze},window);
//# sourceMappingURL=jsrender.min.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy