diff --git a/dist/jsmart.js b/dist/jsmart.js index f68eacf..258ec3c 100644 --- a/dist/jsmart.js +++ b/dist/jsmart.js @@ -1,12 +1,12 @@ /*! - * jSmart JavaScript template engine (v3.0.2) + * jSmart JavaScript template engine (v3.0.3) * https://github.com/umakantp/jsmart * * Copyright 2011-2017, Umakant Patil * Max Miroshnikov * https://opensource.org/licenses/MIT * - * Date: 2017-11-13T06:40Z + * Date: 2017-11-15T04:27Z */ (function (factory) { 'use strict' @@ -2349,7 +2349,7 @@ } } } -var version = '3.0.2' +var version = '3.0.3' /* Define jsmart constructor. jSmart object just stores, diff --git a/dist/jsmart.min.js b/dist/jsmart.min.js index 19567a9..eab9d8d 100644 --- a/dist/jsmart.min.js +++ b/dist/jsmart.min.js @@ -1,5 +1,5 @@ /*! - * jSmart JavaScript template engine (v3.0.2) + * jSmart JavaScript template engine (v3.0.3) * https://github.com/umakantp/jsmart * https://opensource.org/licenses/MIT * @@ -7,4 +7,4 @@ * Max Miroshnikov */ -!function(e){"use strict";"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=e():("object"==typeof window&&window.document&&(window.jSmart=e()),"function"==typeof define&&define.amd&&define("jSmart",[],e))}(function(){"use strict";function objectMerge(e,t){for(var r=1;r0){for(var r=[],a=0;a2?r[2].replace(/^\s+|\s+$/g,""):"",a in this.buildInFunctions){var p=this.buildInFunctions[a],u=("parseParams"in p?p.parseParams.bind(this):this.parseParams.bind(this))(n);if("block"===p.type){e=e.replace(/^\n/,""),i=this.findCloseTag("/"+a,a+" +[^}]*",e);var c=p.parse.call(this,u,e.slice(0,i.index));c&&(o=o.concat(c)),e=e.slice(i.index+i[0].length)}else"extends"===a&&o.splice(0,o.length),o=o.concat(p.parse.call(this,u)),"extends"===a&&(l=o.length);e=e.replace(/^\n/,"")}else if(a in this.runTimePlugins)o=o.concat(this.parsePluginFunc(a,this.parseParams(n)));else if(a in this.plugins){var g=this.plugins[a];"block"===g.type?(i=this.findCloseTag("/"+a,a+" +[^}]*",e),o=o.concat(this.parsePluginBlock(a,this.parseParams(n),e.slice(0,i.index))),e=e.slice(i.index+i[0].length)):"function"===g.type&&(o=o.concat(this.parsePluginFunc(a,this.parseParams(n)))),"append"!==a&&"assign"!==a&&"capture"!==a&&"eval"!==a&&"include"!==a||(e=e.replace(/^\n/,""))}else s=this.buildInFunctions.expression.parse.call(this,t[1]),o.push(s);else"build-in"===(s=this.buildInFunctions.expression.parse.call(this,t[1])).expression.type&&"operator"===s.expression.name&&"="===s.expression.op&&(e=e.replace(/^\n/,"")),o.push(s);return e&&(o=o.concat(this.parseText(e))),o.usedExtends=l,o},findTag:function(e,t){var r,a,n,s=0,i=0,o=this.ldelim,l=this.rdelim,p=this.autoLiteral,u=/^\s*(.+)\s*$/i,c=e?new RegExp("^\\s*("+e+")\\s*$","i"):u;for(r=0;r=0&&t.substr(r-1,1).match(/\s/))continue;if(!--s&&(a=t.slice(o.length,r).replace(/[\r\n]/g," "),n=a.match(c)))return n.index=i,n[0]=t.slice(0,r+l.length),n;s<0&&(s=0)}return null},findElseTag:function(e,t,r,a){for(var n=0,s=this.findTag(r,a);s;s=this.findTag(r,a)){var i=this.findTag(e,a);if(!i||i.index>s.index)return s.index+=n,s;a=a.slice(i.index+i[0].length),n+=i.index+i[0].length;var o=this.findCloseTag(t,e,a);a=a.slice(o.index+o[0].length),n+=o.index+o[0].length}return null},findCloseTag:function(e,t,r){var a="",n=null,s=null,i=0;do{if(n&&(i+=n[0].length),!(n=this.findTag(e,r)))throw new Error("Unclosed "+this.ldelim+t+this.rdelim);a+=r.slice(0,n.index),i+=n.index,r=r.slice(n.index+n[0].length),(s=this.findTag(t,a))&&(a=a.slice(s.index+s[0].length))}while(s);return n.index=i,n},bundleOp:function(e,t,r){var a=t[e];if("operator"===a.name&&a.precedence===r&&!a.params.__parsed){if("binary"===a.optype)return a.params.__parsed=[t[e-1],t[e+1]],t.splice(e-1,3,a),[!0,t];if("post-unary"===a.optype)return a.params.__parsed=[t[e-1]],t.splice(e-1,2,a),[!0,t];a.params.__parsed=[t[e+1]],t.splice(e,2,a)}return[!1,t]},composeExpression:function(e){var t,r=0;for(r=0;r0;--r)r-=(t=this.bundleOp(r-1,e,a))[0],e=t[1];else for(r=0;r\s*|\[\s*)/,i={value:"",tree:[]},o="",l=[{type:"text",data:t.replace(/^(\w+)@(key|index|iteration|first|last|show|total)/gi,"$1__$2")}],p=r;for(r||(p=r=t),a=e.match(s);a;a=e.match(s)){if(r+=a[0],e=e.slice(a[0].length),a[0].match(/\[/)){(i=this.parseExpression(e,!0)).tree&&(r+=i.value,l.push(i.tree),e=e.slice(i.value.length));var u=e.match(/\s*\]/);u&&(r+=u[0],e=e.slice(u[0].length))}else{var c=this.parseModifiersStop;if(this.parseModifiersStop=!0,n=this.lookUp(e,""))if(i.tree=[].concat(i.tree,n.tree),i.value=n.value,r+=n.value,n.ret){var g=i.tree[i.tree.length-1];"plugin"===g.type&&"__func"===g.name&&(g.hasOwner=!0),l.push(g),e=e.slice(i.value.length)}else i=!1;this.parseModifiersStop=c}i||l.push({type:"text",data:""})}return o=r.substr(p.length),{s:e,token:r,tree:[{type:"var",parts:l}],value:o}},parseFunc:function(e,t,r){return t.__parsed.name=this.parseText(e,[])[0],r.push({type:"plugin",name:"__func",params:t}),r},parseOperator:function(e,t,r){return[{type:"build-in",name:"operator",op:e,optype:t,precedence:r,params:{}}]},parsePluginBlock:function(e,t,r){return[{type:"plugin",name:e,params:t,subTree:this.parse(r,[])}]},parsePluginFunc:function(e,t){return[{type:"plugin",name:e,params:t}]},parseModifiers:function(e,t){var r,a=e.match(/^\|(\w+)/),n="";if(!this.parseModifiersStop&&a){n+=a[0],r="default"===a[1]?"defaultValue":a[1],e=e.slice(a[0].length).replace(/^\s+/,""),this.parseModifiersStop=!0;for(var s=[],i=e.match(/^\s*:\s*/);i;i=e.match(/^\s*:\s*/)){n+=e.slice(0,i[0].length),e=e.slice(i[0].length);var o=this.lookUp(e,"");o.ret?(n+=o.value,s.push(o.tree[0]),e=e.slice(o.value.length)):s.push(this.parseText(""))}this.parseModifiersStop=!1,s.unshift(t.pop());var l=this.parseFunc(r,{__parsed:s},[]);t.push(l[0]);var p=this.parseModifiers(e,t);return p&&(t=t.concat(p.tree)),{value:n,tree:t}}},parseParams:function(e,t,r){var a=e.replace(/\n/g," ").replace(/^\s+|\s+$/g,""),n=[];if(e="",n.__parsed=[],!a)return n;for(t||(t=/^\s+/,r=/^(\w+)\s*=\s*/);a;){var s=null;if(r){var i=a.match(r);if(i){var o=i[1].charAt(0).match(/^\d+/);"true"!==i[1]&&"false"!==i[1]&&"null"!==i[1]||(o=!0),o||(s=trimAllQuotes(i[1]),e+=a.slice(0,i[0].length),a=a.slice(i[0].length))}}var l=this.parseExpression(a);if(!l)break;s?(n[s]=l.value,n.__parsed[s]=l.tree):(n.push(l.value),n.__parsed.push(l.tree)),e+=a.slice(0,l.value.length);var p=(a=a.slice(l.value.length)).match(t);if(!p)break;e+=a.slice(0,p[0].length),a=a.slice(p[0].length)}return n.toString=function(){return e},n},lookUp:function(e,t){var r,a=[];if(!e)return!1;if(e.substr(0,this.ldelim.length)===this.ldelim&&(r=this.findTag("",e),t+=r[0],r)){var n=this.parse(r[0]);a=a.concat(n);var s=this.parseModifiers(e.slice(t.length),a);return s?{ret:!0,tree:s.tree,value:s.value}:{ret:!0,tree:a,value:t}}var i=this.getMatchingToken(e);if(!1!==i){t+=RegExp.lastMatch;var o=this.tokens[i].parse.call(this,e.slice(RegExp.lastMatch.length),{tree:a,token:RegExp.lastMatch});if("string"==typeof o)if("parenStart"===o){var l=[];a.push(l),l.parent=a,a=l}else"parenEnd"===o&&a.parent&&(a=a.parent);else o&&o.constructor===Object?(t+=o.value,o=o.tree,a=a.concat(o)):a=a.concat(o);return{ret:!0,tree:a,value:t}}return{ret:!1,tree:a,value:t}},parseExpression:function(e){var t,r=[],a="";for(this.lastTreeInExpression=r;;){if(!(t=this.lookUp(e.slice(a.length),a)))break;if(r=r.concat(t.tree),a=t.value,this.lastTreeInExpression=r,!t.ret)break}return r.length&&(r=this.composeExpression(r)),{tree:r,value:a}},parseBool:function(e){return[{type:"boolean",data:e}]},parseText:function(e){var t=[];if(this.parseEmbeddedVars)for(var r=/([$][\w@]+)|`([^`]*)`/,a=r.exec(e);a;a=r.exec(e)){t.push({type:"text",data:e.slice(0,a.index)});var n=this.parseExpression(a[1]?a[1]:a[2]);t.push(n.tree),e=e.slice(a.index+a[0].length)}return t.push({type:"text",data:e}),t},loadTemplate:function(e,t){var r=[];if(!t&&e in this.files)r=this.files[e];else{var a=this.getTemplate(e);if("string"!=typeof a)throw new Error("No template for "+e);r=this.getTree(a),this.files[e]=r}return r},removeComments:function(e){for(var t=new RegExp(this.ldelim+"\\*"),r=new RegExp("\\*"+this.rdelim),a="",n=e.match(t);n;n=e.match(r)){a+=e.slice(0,n.index);var s=(e=e.slice(n.index+n[0].length)).match(r);if(!s)throw new Error("Unclosed "+t+"*");e=e.slice(s.index+s[0].length)}return a+e},applyFilters:function(e,t){for(var r=0;r=|<>|<|>)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1.replace(/<>/,"!="),"binary",5)}},{regex:/^\s+(lt|lte|le|gt|gte|ge)\s+/i,parse:function(e,t){var r=RegExp.$1.replace(/l(t)?e/,"<").replace(/lt/,"<=").replace(/g(t)?e/,">").replace(/gt/,">=");return this.parseOperator(r,"binary",5)}},{regex:/^\s+(is\s+(not\s+)?div\s+by)\s+/i,parse:function(e,t){return this.parseOperator(RegExp.$2?"div_not":"div","binary",7)}},{regex:/^\s+is\s+(not\s+)?(even|odd)(\s+by\s+)?\s*/i,parse:function(e,t){var r=RegExp.$1?"odd"===RegExp.$2?"even":"even_not":"odd"===RegExp.$2?"even_not":"even",a=this.parseOperator(r,"binary",7);return RegExp.$3?a:a.concat(this.parseText("1",a))}},{regex:/^\s*(&&)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",8)}},{regex:/^\s*(\|\|)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",9)}},{regex:/^\s+and\s+/i,parse:function(e,t){return this.parseOperator("&&","binary",11)}},{regex:/^\s+xor\s+/i,parse:function(e,t){return this.parseOperator("xor","binary",12)}},{regex:/^\s+or\s+/i,parse:function(e,t){return this.parseOperator("||","binary",13)}},{regex:/^#(\w+)#/,parse:function(e,t){var r=this.parseVar(".config."+RegExp.$1,"smarty","$smarty"),a=this.parseModifiers(r.s,r.tree);return a?(r.value+=a.value,a):r}},{regex:/^\s*\[\s*/,parse:function(e,t){var r=this.parseParams(e,/^\s*,\s*/,/^('[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|\w+)\s*=>\s*/),a=this.parsePluginFunc("__array",r),n=r.toString(),s=e.slice(r.toString().length).match(/\s*\]/);return s&&(n+=s[0]),{tree:a,value:n}}},{regex:/^[\d.]+/,parse:function(e,t){t.token.indexOf(".")>-1?t.token=parseFloat(t.token):t.token=parseInt(t.token,10);var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}},{regex:/^\w+/,parse:function(e,t){var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}}],buildInFunctions:{expression:{parse:function(e){var t=this.parseExpression(e);return{type:"build-in",name:"expression",expression:t.tree,params:this.parseParams(e.slice(t.value.length).replace(/^\s+|\s+$/g,""))}}},section:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("section [^}]+","/section","sectionelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"section",params:e,subTree:r,subTreeElse:a}}},setfilter:{type:"block",parseParams:function(e){return[this.parseExpression("__t()|"+e).tree]},parse:function(e,t){return{type:"build-in",name:"setfilter",params:e,subTree:this.parse(t)}}},config_load:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]);return{type:"build-in",name:"config_load",params:e,content:this.getConfig(t),section:trimAllQuotes(e.section?e.section:e[1]?e[1]:"")}}},append:{type:"function",parse:function(e){return{type:"build-in",name:"append",params:e}}},assign:{type:"function",parse:function(e){return{type:"build-in",name:"assign",params:e}}},break:{type:"function",parse:function(e){return{type:"build-in",name:"break",params:e}}},continue:{type:"function",parse:function(e){return{type:"build-in",name:"continue",params:e}}},call:{type:"function",parse:function(e){return{type:"build-in",name:"call",params:e}}},capture:{type:"block",parse:function(e,t){return{type:"build-in",name:"capture",params:e,subTree:this.parse(t)}}},nocache:{type:"block",parse:function(e,t){return{type:"build-in",name:"nocache",params:e,subTree:this.parse(t)}}},eval:{type:"function",parse:function(e){return this.parsePluginFunc("eval",e)}},include:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]),r=findInArray(e,"nocache")>=0;return{type:"build-in",name:"include",params:e,subTree:this.loadTemplate(t,r)}}},for:{type:"block",parseParams:function(e){var t=e.match(/^\s*\$(\w+)\s*=\s*([^\s]+)\s*to\s*([^\s]+)\s*(?:step\s*([^\s]+))?\s*(.*)$/);if(!t)throw new Error("Invalid {for} parameters: "+e);return this.parseParams("varName='"+t[1]+"' from="+t[2]+" to="+t[3]+" step="+(t[4]?t[4]:"1")+" "+t[5])},parse:function(e,t){var r=[],a=[],n=this.findElseTag("for\\s[^}]+","/for","forelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length))):r=this.parse(t),{type:"build-in",name:"for",params:e,subTree:r,subTreeElse:a}}},if:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("if\\s+[^}]+","/if","else[^}]*",t);if(n){r=this.parse(t.slice(0,n.index)),t=t.slice(n.index+n[0].length);var s=n[1].match(/^else\s*if(.*)/);a=s?this.buildInFunctions.if.parse.call(this,this.parseParams(s[1]),t.replace(/^\n/,"")):this.parse(t.replace(/^\n/,""))}else r=this.parse(t);return[{type:"build-in",name:"if",params:e,subTreeIf:r,subTreeElse:a}]}},foreach:{type:"block",parseParams:function(e){var t=e.match(/^\s*([$].+)\s*as\s*[$](\w+)\s*(=>\s*[$](\w+))?\s*$/i);return t&&(e="from="+t[1]+" item="+(t[4]||t[2]),t[4]&&(e+=" key="+t[2])),this.parseParams(e)},parse:function(e,t){var r=[],a=[],n=this.findElseTag("foreach\\s[^}]+","/foreach","foreachelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"foreach",params:e,subTree:r,subTreeElse:a}}},function:{type:"block",parse:function(e,t){this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]=!0;var r=this.parse(t);return this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]={tree:r,defaultParams:e},!1}},extends:{type:"function",parse:function(e){return this.loadTemplate(trimAllQuotes(e.file?e.file:e[0]),!0)}},block:{type:"block",parse:function(e,t){e.append=findInArray(e,"append")>=0,e.prepend=findInArray(e,"prepend")>=0,e.hide=findInArray(e,"hide")>=0;var r,a,n=this.parse(t,[]),s=trimAllQuotes(e.name?e.name:e[0]);return s in this.blocks?(this.outerBlocks[s]=[],this.outerBlocks[s]={tree:n,params:e},a="outer",r=t.match(/smarty.block.parent/),e.needParent=!1,r&&(e.needParent=!0)):(this.blocks[s]=[],this.blocks[s]={tree:n,params:e},a="inner",r=t.match(/smarty.block.child/),e.needChild=!1,r&&(e.needChild=!0)),{type:"build-in",name:"block",params:e,location:a}}},strip:{type:"block",parse:function(e,t){return this.parse(t.replace(/[ \t]*[\r\n]+[ \t]*/g,""))}},literal:{type:"block",parse:function(e,t){return this.parseText(t)}},ldelim:{type:"function",parse:function(e){return this.parseText(this.ldelim)}},rdelim:{type:"function",parse:function(e){return this.parseText(this.rdelim)}},while:{type:"block",parse:function(e,t){return{type:"build-in",name:"while",params:e,subTree:this.parse(t)}}}}},jSmartProcessor={tplModifiers:[],runTimePlugins:{},plugins:{},modifiers:{},defaultModifiers:{},escapeHtml:!1,variableFilters:[],outerBlocks:{},blocks:{},debugging:!1,clear:function(){this.runTimePlugins={},this.variableFilters=[],this.escapeHtml=!1,this.defaultModifiers={},this.modifiers={},this.plugins={},this.blocks={},this.outerBlocks={},this.debugging=!1,this.includedTemplates=[]},getProcessed:function(e,t){var r=this.process(e,t);return this.debugging&&this.plugins.debug.process([],{includedTemplates:this.includedTemplates,assignedVars:t}),this.clear(),{output:r.tpl,smarty:r.smarty}},process:function(e,t){for(var r,a,n,s,i="",o=0;o":return s>r;case"===":return s===r;case">=":return s>=r;case"!==":return s!==r}}},section:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={},n=r.__get("show",!0);if(t.smarty.section[r.__get("name",null,0)]=a,a.show=n,!n)return this.process(e.subTreeElse,t);var s=parseInt(r.__get("start",0),10),i=r.loop instanceof Object?countProperties(r.loop):isNaN(r.loop)?0:parseInt(r.loop),o=parseInt(r.__get("step",1),10),l=parseInt(r.__get("max"),10);isNaN(l)&&(l=Number.MAX_VALUE),s<0?(s+=i)<0&&(s=0):s>=i&&(s=i?i-1:0);var p=0,u=s;p=0;var c="";for(u=s;u>=0&&u=i,a.index=u,a.index_prev=u-o,a.index_next=u+o,a.iteration=a.rownum=p+1,a.total=p,a.loop=p;var g=this.process(e.subTree,t);void 0!==g&&(t=g.data,c+=g.tpl),t.smarty.continue=!1}return a.total=p,a.loop=p,t.smarty.break=!1,p?{tpl:c,data:t}:this.process(e.subTreeElse,t)}},setfilter:{process:function(e,t){this.tplModifiers.push(e.params);var r=this.process(e.subTree,t);return void 0!==r&&(t=r.data,r=r.tpl),this.tplModifiers.pop(),{tpl:r,data:t}}},for:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=parseInt(r.__get("from"),10),n=parseInt(r.__get("to"),10),s=parseInt(r.__get("step"),10);isNaN(s)&&(s=1);var i=parseInt(r.__get("max"),10);isNaN(i)&&(i=Number.MAX_VALUE);for(var o=0,l="",p=Math.min(Math.ceil((1+(s>0?n-a:a-n))/Math.abs(s)),i),u=parseInt(r.from,10);o0,r.name&&(t.smarty.foreach[r.name].show=i>0?1:""),i>0?s:this.process(e.subTreeElse,t)}},break:{process:function(e,t){return t.smarty.break=!0,{tpl:"",data:t}}},continue:{process:function(e,t){return t.smarty.continue=!0,{tpl:"",data:t}}},block:{process:function(e,t){var r,a,n,s=trimAllQuotes(e.params.name?e.params.name:e.params[0]),i=this.blocks[s],o=this.outerBlocks[s];return"inner"===e.location?(i.params.needChild?(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),t.smarty.block.child=a,void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r):o.params.needParent?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),t.smarty.block.parent=r,void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),n=a):(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),o.params.append?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=a+r):o.params.prepend?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r+a):n=a),n):""}},call:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={name:r.__get("name")?r.__get("name"):r.__get("0"),params:e.params},n=this.buildInFunctions.function.process.call(this,a,t),s=r.__get("assign",!1);return s?{tpl:"",data:this.assignVar(s,n,t)}:n}},include:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=r.__get("file",null,0);this.includedTemplates.push(a);var n=objectMerge({},t,r);n.smarty.template=a;var s=this.process(e.subTree,n);return void 0!==s&&(s=s.tpl),r.assign?{tpl:"",data:this.assignVar(r.assign,s,t)}:s}},function:{process:function(e,t){var r=this.runTimePlugins[e.name],a=this.getActualParamValues(r.defaultParams,t);delete a.name;var n=this.getActualParamValues(e.params,t);return this.process(r.tree,objectMerge({},t,a,n)).tpl}},while:{process:function(e,t){for(var r="";this.getActualParamValues(e.params,t)[0]&&!t.smarty.break;){var a=this.process(e.subTree,t);void 0!==a&&(t=a.data,r+=a.tpl),t.smarty.continue=!1}return t.smarty.break=!1,{tpl:r,data:t}}}}},version="3.0.2",jSmart=function(e,t){this.smarty={block:{},break:!1,capture:{},continue:!1,counter:{},cycle:{},foreach:{},section:{},now:Math.floor((new Date).getTime()/1e3),const:{},config:{},current_dir:"/",template:"",ldelim:"{",rdelim:"}",version:version},this.autoLiteral=!0,this.escapeHtml=!1,this.debugging=!1,this.outerBlocks={},this.blocks={},this.parse(e,t)};jSmart.prototype={constructor:jSmart,tree:[],scripts:{},modifiers:{},defaultModifiers:[],defaultModifiersGlobal:[],globalAndDefaultModifiers:[],filters:{variable:[],post:[]},filtersGlobal:{pre:[],variable:[],post:[]},globalAndDefaultFilters:[],buildInFunctions:{},plugins:{},runTimePlugins:{},parse:function(e,t){var r;t||(t={}),t.rdelim?this.smarty.rdelim=t.rdelim:jSmart.prototype.right_delimiter?this.smarty.rdelim=jSmart.prototype.right_delimiter:this.smarty.rdelim="}",t.ldelim?this.smarty.ldelim=t.ldelim:jSmart.prototype.left_delimiter?this.smarty.ldelim=jSmart.prototype.left_delimiter:this.smarty.ldelim="{",void 0!==t.autoLiteral?this.autoLiteral=t.autoLiteral:void 0!==jSmart.prototype.auto_literal&&(this.autoLiteral=jSmart.prototype.auto_literal),void 0!==t.debugging?this.debugging=t.debugging:void 0!==jSmart.prototype.debugging&&(this.debugging=jSmart.prototype.debugging),void 0!==t.escapeHtml?this.escapeHtml=t.escapeHtml:void 0!==jSmart.prototype.escape_html&&(this.escapeHtml=jSmart.prototype.escape_html),e=String(e||""),jSmartParser.clear(),jSmartParser.rdelim=this.smarty.rdelim,jSmartParser.ldelim=this.smarty.ldelim,jSmartParser.getTemplate=this.getTemplate,jSmartParser.getConfig=this.getConfig,jSmartParser.autoLiteral=this.autoLiteral,jSmartParser.plugins=this.plugins,jSmartParser.preFilters=this.filtersGlobal.pre,r=jSmartParser.getParsed(e),this.tree=r.tree,this.runTimePlugins=r.runTimePlugins,this.blocks=r.blocks,this.outerBlocks=r.outerBlocks},fetch:function(e){var t="";return"object"!=typeof e&&(e={}),e.smarty={},objectMerge(e.smarty,this.smarty),this.globalAndDefaultModifiers=jSmart.prototype.defaultModifiersGlobal.concat(this.defaultModifiers),this.globalAndDefaultFilters=jSmart.prototype.filtersGlobal.variable.concat(this.filters.variable),jSmartProcessor.clear(),jSmartProcessor.plugins=this.plugins,jSmartProcessor.modifiers=this.modifiers,jSmartProcessor.defaultModifiers=this.defaultModifiers,jSmartProcessor.escapeHtml=this.escapeHtml,jSmartProcessor.variableFilters=this.globalAndDefaultFilters,jSmartProcessor.runTimePlugins=this.runTimePlugins,jSmartProcessor.blocks=this.blocks,jSmartProcessor.outerBlocks=this.outerBlocks,jSmartProcessor.debugging=this.debugging,t=jSmartProcessor.getProcessed(this.tree,e,this.smarty),objectMerge(this.smarty,t.smarty),this.applyFilters(jSmart.prototype.filtersGlobal.post.concat(this.filters.post),t.output)},applyFilters:function(e,t){for(var r=0;r "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Array){n="Array (\n";for(a in e)e.hasOwnProperty(a)&&(n+=t+t+"["+a+"] => "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Boolean){var s="false";return!0===s&&(s="true"),s+"\n"}return e+"\n"},registerPlugin:function(e,t,r){"modifier"===e?this.modifiers[t]=r:this.plugins[t]={type:e,process:r}},registerFilter:function(e,t){(this.tree?this.filters:jSmart.prototype.filtersGlobal)["output"===e?"post":e].push(t)},addDefaultModifier:function(e){e instanceof Array||(e=[e]);for(var t=0;t=55296&&r<=56319){var a=r;return 1===t.length?r:1024*(a-55296)+(t.charCodeAt(1)-56320)+65536}return r},bin2Hex:function(e){var t,r,a,n="";for(t=0,r=(e+="").length;t1?a?s["&"]+e.substr(1):e:s[e]})},rawUrlDecode:function(e){return decodeURIComponent((e+"").replace(/%(?![\da-f]{2})/gi,function(){return"%25"}))},rawUrlEncode:function(e){return e+="",encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},sprintf:function(){var e=/%%|%(\d+\$)?([-+'#0 ]*)(\*\d+\$|\*|\d+)?(?:\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,r=0,a=function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},n=function(e,t,r,n,s,i){var o=n-e.length;return o>0&&(e=r||!s?a(e,n,i,r):[e.slice(0,t.length),a("",o,"0",!0),e.slice(t.length)].join("")),e},s=function(e,t,r,s,i,o,l){var p=e>>>0;return r=r&&p&&{2:"0b",8:"0",16:"0x"}[t]||"",e=r+a(p.toString(t),o||0,"0",!1),n(e,r,s,i,l)},i=function(e,t,r,a,s,i){return null!==a&&void 0!==a&&(e=e.slice(0,a)),n(e,"",t,r,s,i)};return t[r++].replace(e,function(e,o,l,p,u,c){var g,h,f,d,m;if("%%"===e)return"%";var y,v=!1,b="",_=!1,x=!1,w=" ",j=l.length;for(y=0;y-1?6:"d"===c?0:void 0,m=o?t[o.slice(0,-1)]:t[r++],c){case"s":return i(m+"",v,p,u,_,w);case"c":return i(String.fromCharCode(+m),v,p,u,_);case"b":return s(m,2,x,v,p,u,_);case"o":return s(m,8,x,v,p,u,_);case"x":return s(m,16,x,v,p,u,_);case"X":return s(m,16,x,v,p,u,_).toUpperCase();case"u":return s(m,10,x,v,p,u,_);case"i":case"d":return g=+m||0,g=Math.round(g-g%1),h=g<0?"-":b,m=h+a(String(Math.abs(g)),u,"0",!1),n(m,h,v,p,_);case"e":case"E":case"f":case"F":case"g":case"G":return g=+m,h=g<0?"-":b,f=["toExponential","toFixed","toPrecision"]["efg".indexOf(c.toLowerCase())],d=["toString","toUpperCase"]["eEfFgG".indexOf(c)%2],m=h+Math.abs(g)[f](u),phpJs.justify(m,h,v,p,_)[d]();default:return e}})},makeTimeStamp:function(e){if(!e)return Math.floor((new Date).getTime()/1e3);if(isNaN(e)){var t=phpJs.strtotime(e);return-1===t||!1===t?Math.floor((new Date).getTime()/1e3):t}return 14===(e+="").length&&-1!==e.search(/^[\d]+$/g)?phpJs.mktime(e.substr(8,2),e.substr(10,2),e.substr(12,2),e.substr(4,2),e.substr(6,2),e.substr(0,4)):Number(e)},mktime:function(){var e=new Date,t=arguments,r=0,a=["Hours","Minutes","Seconds","Month","Date","FullYear"];for(r=0;r=0?t[5]<=69?2e3:t[5]<=100?1900:0:0,e.setFullYear(t[5],t[3]-1,t[4]),e.setHours(t[0],t[1],t[2]);var n=e.getTime();return(n/1e3>>0)-(n<0)},_pad:function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},justify:function(e,t,r,a,n,s){var i=a-e.length;return i>0&&(e=r||!n?phpJs._pad(e,a,s,r):[e.slice(0,t.length),phpJs._pad("",i,"0",!0),e.slice(t.length)].join("")),e},strtotime:function(e,t){function r(e,t,r){var a,n=l[t];void 0!==n&&(0===(a=n-o.getDay())?a=7*r:a>0&&"last"===e?a-=7:a<0&&"next"===e&&(a+=7),o.setDate(o.getDate()+a))}var a,n,s,i,o,l,p,u,c,g,h;if(!e)return!1;e=e.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var f=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if((n=e.match(f))&&n[2]===n[4])if(n[1]>1901)switch(n[2]){case"-":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case".":return!1;case"/":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else if(n[5]>1901)switch(n[2]){case"-":case".":return!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case"/":return!(n[1]>12||n[3]>31)&&new Date(n[5],parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else switch(n[2]){case"-":return!(n[3]>12||n[5]>31||n[1]<70&&n[1]>38)&&(i=n[1]>=0&&n[1]<=38?+n[1]+2e3:n[1],new Date(i,parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case".":return n[5]>=70?!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3:n[5]<60&&!n[6]&&(!(n[1]>23||n[3]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0,n[9]||0)/1e3));case"/":return!(n[1]>12||n[3]>31||n[5]<70&&n[5]>38)&&(i=n[5]>=0&&n[5]<=38?+n[5]+2e3:n[5],new Date(i,parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case":":return!(n[1]>23||n[3]>59||n[5]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0)/1e3)}if("now"===e)return null===t||isNaN(t)?(new Date).getTime()/1e3|0:0|t;if(!isNaN(a=Date.parse(e)))return a/1e3|0;if(f=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),(n=e.match(f))&&("z"===n[4]?n[4]="Z":n[4].match(/^([+-][0-9]{2})$/)&&(n[4]=n[4]+":00"),!isNaN(a=Date.parse(n[1]+"T"+n[2]+n[4]))))return a/1e3|0;if(o=t?new Date(1e3*t):new Date,l={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},p={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},c="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)",g="([+-]?\\d+\\s"+c+"|(last|next)\\s"+c+")(\\sago)?",!(n=e.match(new RegExp(g,"gi"))))return!1;for(h=0,u=n.length;h1;r/=10)e=t.toString()+e;return e.toString()},a={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %r %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%m/%d/%Y",X:"%r",alt_digits:"",ERA:"",ERA_YEAR:"",ERA_D_T_FMT:"",ERA_D_FMT:"",ERA_T_FMT:""},n={a:function(e){return a.a[e.getDay()]},A:function(e){return a.A[e.getDay()]},b:function(e){return a.b[e.getMonth()]},B:function(e){return a.B[e.getMonth()]},C:function(e){return r(parseInt(e.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(e){return r(parseInt(this.G(e)/100,10),0)},G:function(e){var t=e.getFullYear(),r=parseInt(n.V(e),10),a=parseInt(n.W(e),10);return a>r?t++:0===a&&r>=52&&t--,t},H:["getHours","0"],I:function(e){var t=e.getHours()%12;return r(0===t?12:t,0)},j:function(e){var t=e-new Date(e.getFullYear()+"/1/1 GMT");t+=6e4*e.getTimezoneOffset();var a=parseInt(t/6e4/60/24,10)+1;return r(a,0,100)},k:["getHours","0"],l:function(e){var t=e.getHours()%12;return r(0===t?12:t," ")},m:function(e){return r(e.getMonth()+1,0)},M:["getMinutes","0"],p:function(e){return a.p[e.getHours()>=12?1:0]},P:function(e){return a.P[e.getHours()>=12?1:0]},s:function(e){return Date.parse(e)/1e3},S:["getSeconds","0"],u:function(e){var t=e.getDay();return 0===t?7:t},U:function(e){var t=parseInt(n.j(e),10),a=6-e.getDay(),s=parseInt((t+a)/7,10);return r(s,0)},V:function(e){var t=parseInt(n.W(e),10),a=new Date(e.getFullYear()+"/1/1").getDay(),s=t+(a>4||a<=1?0:1);return 53===s&&new Date(e.getFullYear()+"/12/31").getDay()<4?s=1:0===s&&(s=n.V(new Date(e.getFullYear()-1+"/12/31"))),r(s,0)},w:"getDay",W:function(e){var t=parseInt(n.j(e),10),a=7-n.u(e),s=parseInt((t+a)/7,10);return r(s,0,10)},y:function(e){return r(e.getFullYear()%100,0)},Y:"getFullYear",z:function(e){var t=e.getTimezoneOffset(),a=r(parseInt(Math.abs(t/60),10),0),n=r(t%60,0);return(t>0?"-":"+")+a+n},Z:function(e){return e.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(e){return"%"}},s=void 0===t?new Date:t instanceof Date?new Date(t):new Date(1e3*t),i={c:"locale",D:"%m/%d/%y",F:"%y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};e.match(/%[cDFhnrRtTxX]/);)e=e.replace(/%([cDFhnrRtTxX])/g,function(e,t){var r=i[t];return"locale"===r?a[t]:r});return e.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,function(e,t){var a=n[t];return"string"==typeof a?s[a]():"function"==typeof a?a(s):"object"==typeof a&&"string"==typeof a[0]?r(s[a[0]](),a[1]):t})}};return jSmart.prototype.registerPlugin("modifier","capitalize",function(e,t,r){if("string"!=typeof e)return e;var a=new RegExp(t?"[^a-zA-Z_à-ü]+":"[^a-zA-Z0-9_à-ü]"),n=null,s="";r&&(e=e.toLowerCase());var i;for(n=e.match(a);n;n=e.match(a))(i=e.slice(0,n.index)).match(/\d/)?s+=i:s+=i.charAt(0).toUpperCase()+i.slice(1),s+=e.slice(n.index,n.index+n[0].length),e=e.slice(n.index+n[0].length);return e.match(/\d/)?s+e:s+e.charAt(0).toUpperCase()+e.slice(1)}),jSmart.prototype.registerPlugin("modifier","cat",function(e,t){return t=t||"",String(e)+t}),jSmart.prototype.registerPlugin("modifier","count_characters",function(e,t){return e=String(e),t?e.length:e.replace(/\s/g,"").length}),jSmart.prototype.registerPlugin("modifier","count_paragraphs",function(e){var t=String(e).match(/\n+/g);return t?t.length+1:1}),jSmart.prototype.registerPlugin("modifier","count_sentences",function(e){if("string"==typeof e){var t=e.match(/\w[.?!](\W|$)/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","count_words",function(e){if("string"==typeof e){var t=e.match(/\w+/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","date_format",function(e,t,r){return phpJs.strftime(t||"%b %e, %Y",phpJs.makeTimeStamp(e||r))}),jSmart.prototype.registerPlugin("modifier","debug_print_var",function(e){console.log(e+"--");var t="";return"object"==typeof module&&module&&"object"==typeof module.exports?t="node":"object"==typeof window&&window.document&&(t="browser"),""===t?"":"browser"===t?jSmart.prototype.printR(e):void console.log(e)}),jSmart.prototype.registerPlugin("modifier","defaultValue",function(e,t){return t=t||"",e&&"null"!==e&&void 0!==e?e:t}),jSmart.prototype.registerPlugin("modifier","escape",function(e,t,r,a){e=String(e),t=t||"html",r=r||"UTF-8",a=void 0===a||Boolean(a);var n,s="";switch(t){case"html":return a&&(e=e.replace(/&/g,"&")),e.replace(//g,">").replace(/'/g,"'").replace(/"/g,""");case"htmlall":return phpJs.htmlEntities(e,3,r);case"url":return phpJs.rawUrlEncode(e);case"urlpathinfo":return phpJs.rawUrlEncode(e).replace(/%2F/g,"/");case"quotes":return e.replace(/(^|[^\\])'/g,"$1\\'");case"hex":for(s="",n=0;n=126?"&#"+i+";":e.substr(n,1)}return s;case"javascript":return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/<\//g,"")}),jSmart.prototype.registerPlugin("modifier","regex_replace",function(e,t,r){var a=t.match(/^ *\/(.*)\/(.*) *$/);return String(e).replace(new RegExp(a[1],"g"+(a.length>1?a[2]:"")),r)}),jSmart.prototype.registerPlugin("modifier","replace",function(e,t,r){if(!t)return e;e=String(e),t=String(t),r=String(r);var a="",n=-1;for(n=e.indexOf(t);n>=0;n=e.indexOf(t))a+=e.slice(0,n)+r,n+=t.length,e=e.slice(n);return a+e}),jSmart.prototype.registerPlugin("modifier","spacify",function(e,t){return t||(t=" "),String(e).replace(/(\n|.)(?!$)/g,"$1"+t)}),jSmart.prototype.registerPlugin("modifier","string_format",function(e,t){return phpJs.sprintf(t,e)}),jSmart.prototype.registerPlugin("modifier","strip",function(e,t){return t=t||" ",String(e).replace(/[\s]+/g,t)}),jSmart.prototype.registerPlugin("modifier","strip_tags",function(e,t,r){if(null===t&&(t=!0),r||!0!==t&&!1!==t&&(t+"").length>0&&(r=t,t=!0),r){var a=r.split(">");return a.splice(-1,1),e=String(e).replace(/<[^>]*?>/g,function(e,r,n){for(var s=e.match(/\w+/),i=0;i").match(/\w+/);if(s[0]===o[0])return e}return t?" ":""})}return String(e).replace(/<[^>]*?>/g,t?" ":"")}),jSmart.prototype.registerPlugin("modifier","to_charset",function(e){return e}),jSmart.prototype.registerPlugin("modifier","truncate",function(e,t,r,a,n){return e=String(e),t=t||80,r=null!=r?r:"...",e.length<=t?e:(t-=Math.min(t,r.length),n?e.slice(0,Math.floor(t/2))+r+e.slice(e.length-Math.floor(t/2)):(a||(e=e.slice(0,t+1).replace(/\s+?(\S+)?$/,"")),e.slice(0,t)+r))}),jSmart.prototype.registerPlugin("modifier","unescape",function(e,t,r){switch(e=String(e),t=t||"html",r=r||"UTF-8",t){case"html":return e.replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,'"');case"entity":case"htmlall":return phpJs.htmlEntityDecode(e,1);case"url":return phpJs.rawUrlDecode(e)}return e}),jSmart.prototype.registerPlugin("modifier","upper",function(e){return String(e).toUpperCase()}),jSmart.prototype.registerPlugin("modifier","wordwrap",function(e,t,r,a){t=t||80,r=r||"\n";for(var n=String(e).split("\n"),s=0;st;){for(var l=0,p=i.slice(l).match(/\s+/);p&&l+p.index<=t;p=i.slice(l).match(/\s+/))l+=p.index+p[0].length;l=a?t-1:l||(p?p.index+p[0].length:i.length),o+=i.slice(0,l).replace(/\s+$/,""),l=t.smarty.cycle[r].arr.length||a)&&(t.smarty.cycle[r].index=0),e.__get("assign",!1)?(this.assignVar(e.assign,t.smarty.cycle[r].arr[t.smarty.cycle[r].index],t),""):e.__get("print",!0)?t.smarty.cycle[r].arr[t.smarty.cycle[r].index]:""}),jSmart.prototype.registerPlugin("function","eval",function(e,t){var r=e.var;return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","debug",function(e,t){var r="";if("object"==typeof module&&module&&"object"==typeof module.exports?r="node":"object"==typeof window&&window.document&&(r="browser"),""===r)return"";if("browser"===r){window.jsmartDebug&&window.jsmartDebug.close(),window.jsmartDebug=window.open("","","width=680, height=600,resizable,scrollbars=yes");var a="",n="",s=0;for(var i in t.includedTemplates)a+=""+t.includedTemplates[i]+"";""!==a&&(a="

included templates

"+a+"

"),s=0;for(var o in t.assignedVars)n+="["+o+"]"+jSmart.prototype.printR(t.assignedVars[o])+"";""!==n&&(n="

assigned template variables

"+n+"
");var l="jSmart Debug Console

jSmart Debug Console


"+a+n+"
";window.jsmartDebug.document.write(l)}else"undefined"!=typeof console&&(console.log("included templates:- "+JSON.stringify(a)),console.log("assigned template variables:- "+JSON.stringify(n)));return""}),jSmart.prototype.registerPlugin("function","fetch",function(e,t){var r=jSmart.prototype.getFile(e.__get("file",null,0));return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","html_checkboxes",function(e,t){var r,a,n,s=e.__get("type","checkbox"),i=e.__get("name",s),o=i,l=e.__get("values",e.options),p=e.__get("options",[]),u="options"in e,c=e.__get("selected",!1),g=e.__get("separator",""),h=Boolean(e.__get("labels",!0)),f=Boolean(e.__get("label_ids",!1)),d=[],m=0,y="";if("checkbox"===s&&(i+="[]"),!u)for(r in e.output)p.push(e.output[r]);for(r in l)l.hasOwnProperty(r)&&(n=o+"_"+(a=u?r:l[r]),y=h?f?'";for(var x=0;x"+d["right"===g?x:d.length-1-x]+"";_+="\n"}return"
"+(i?"\n":"")+_+"\n\n"+y+"\n
"+i+"
\n"}),jSmart.prototype.registerPlugin("function","mailto",function(e,t){var r,a,n=e.__get("address",null),s=e.__get("encode","none"),i=e.__get("text",n),o=phpJs.rawUrlEncode(e.__get("cc","")).replace(/%40/g,"@").replace(/%2C/g,","),l=phpJs.rawUrlEncode(e.__get("bcc","")).replace(/%40/g,"@").replace(/%2C/g,","),p=phpJs.rawUrlEncode(e.__get("followupto","")).replace(/%40/g,"@").replace(/%2C/g,","),u=phpJs.rawUrlEncode(e.__get("subject","")),c=phpJs.rawUrlEncode(e.__get("newsgroups","")),g=e.__get("extra","");if(n+=o?"?cc="+o:"",n+=l?(o?"&":"?")+"bcc="+l:"",n+=u?(o||l?"&":"?")+"subject="+u:"",n+=c?(o||l||u?"&":"?")+"newsgroups="+c:"",n+=p?(o||l||u||c?"&":"?")+"followupto="+p:"",r='"+i+"","javascript"===s){r="document.write('"+r+"');";var h="";for(a=0;aeval(unescape(\''+h+"'))<\/script>"}if("javascript_charcode"===s){var f=[];for(a=0;a\n\x3c!--\n{document.write(String.fromCharCode('+f.join(",")+"))}\n//--\x3e\n<\/script>\n"}if("hex"===s){if(n.match(/^.+\?.+$/))throw new Error("mailto: hex encoding does not work with extra attributes. Try javascript.");var d="";for(a=0;a"+m+""}return r}),jSmart.prototype.registerPlugin("function","math",function(params,data){var equation=params.__get("equation",null).replace(/pi\(\s*\)/g,"PI");equation=equation.replace(/ceil/g,"Math.ceil").replace(/abs/g,"Math.abs").replace(/cos/g,"Math.cos").replace(/exp/g,"Math.exp").replace(/floor/g,"Math.floor").replace(/log/g,"Math.log").replace(/max/g,"Math.max").replace(/min/g,"Math.min").replace(/PI/g,"Math.PI").replace(/pow/g,"Math.pow").replace(/rand/g,"Math.rand").replace(/round/g,"Math.round").replace(/sin/g,"Math.sin").replace(/sqrt/g,"Math.sqrt").replace(/srans/g,"Math.srans").replace(/tan/g,"Math.tan");var words=equation.match(/\w+/g),i,j,tmp,banned=["ceil","abs","cos","exp","floor","log10","log","max","min","pi","pow","rand","round","sin","sqrt","srans","tan"];for(i=0;i(words[j+1]+"").length&&(tmp=words[j],words[j]=words[j+1],words[j+1]=tmp);for(i=0;i0&&(f=c+f),f=this.modifiers.wordwrap(f,n-l,s,i),l>0&&(f=f.replace(/^/gm,p)),g[h]=f)}var d=g.join(s+s);return"assign"in e?(this.assignVar(e.assign,d,r),""):d}),String.prototype.fetch=function(e){return new jSmart(this).fetch(e)},jSmart}); \ No newline at end of file +!function(e){"use strict";"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=e():("object"==typeof window&&window.document&&(window.jSmart=e()),"function"==typeof define&&define.amd&&define("jSmart",[],e))}(function(){"use strict";function objectMerge(e,t){for(var r=1;r0){for(var r=[],a=0;a2?r[2].replace(/^\s+|\s+$/g,""):"",a in this.buildInFunctions){var p=this.buildInFunctions[a],u=("parseParams"in p?p.parseParams.bind(this):this.parseParams.bind(this))(n);if("block"===p.type){e=e.replace(/^\n/,""),i=this.findCloseTag("/"+a,a+" +[^}]*",e);var c=p.parse.call(this,u,e.slice(0,i.index));c&&(o=o.concat(c)),e=e.slice(i.index+i[0].length)}else"extends"===a&&o.splice(0,o.length),o=o.concat(p.parse.call(this,u)),"extends"===a&&(l=o.length);e=e.replace(/^\n/,"")}else if(a in this.runTimePlugins)o=o.concat(this.parsePluginFunc(a,this.parseParams(n)));else if(a in this.plugins){var g=this.plugins[a];"block"===g.type?(i=this.findCloseTag("/"+a,a+" +[^}]*",e),o=o.concat(this.parsePluginBlock(a,this.parseParams(n),e.slice(0,i.index))),e=e.slice(i.index+i[0].length)):"function"===g.type&&(o=o.concat(this.parsePluginFunc(a,this.parseParams(n)))),"append"!==a&&"assign"!==a&&"capture"!==a&&"eval"!==a&&"include"!==a||(e=e.replace(/^\n/,""))}else s=this.buildInFunctions.expression.parse.call(this,t[1]),o.push(s);else"build-in"===(s=this.buildInFunctions.expression.parse.call(this,t[1])).expression.type&&"operator"===s.expression.name&&"="===s.expression.op&&(e=e.replace(/^\n/,"")),o.push(s);return e&&(o=o.concat(this.parseText(e))),o.usedExtends=l,o},findTag:function(e,t){var r,a,n,s=0,i=0,o=this.ldelim,l=this.rdelim,p=this.autoLiteral,u=/^\s*(.+)\s*$/i,c=e?new RegExp("^\\s*("+e+")\\s*$","i"):u;for(r=0;r=0&&t.substr(r-1,1).match(/\s/))continue;if(!--s&&(a=t.slice(o.length,r).replace(/[\r\n]/g," "),n=a.match(c)))return n.index=i,n[0]=t.slice(0,r+l.length),n;s<0&&(s=0)}return null},findElseTag:function(e,t,r,a){for(var n=0,s=this.findTag(r,a);s;s=this.findTag(r,a)){var i=this.findTag(e,a);if(!i||i.index>s.index)return s.index+=n,s;a=a.slice(i.index+i[0].length),n+=i.index+i[0].length;var o=this.findCloseTag(t,e,a);a=a.slice(o.index+o[0].length),n+=o.index+o[0].length}return null},findCloseTag:function(e,t,r){var a="",n=null,s=null,i=0;do{if(n&&(i+=n[0].length),!(n=this.findTag(e,r)))throw new Error("Unclosed "+this.ldelim+t+this.rdelim);a+=r.slice(0,n.index),i+=n.index,r=r.slice(n.index+n[0].length),(s=this.findTag(t,a))&&(a=a.slice(s.index+s[0].length))}while(s);return n.index=i,n},bundleOp:function(e,t,r){var a=t[e];if("operator"===a.name&&a.precedence===r&&!a.params.__parsed){if("binary"===a.optype)return a.params.__parsed=[t[e-1],t[e+1]],t.splice(e-1,3,a),[!0,t];if("post-unary"===a.optype)return a.params.__parsed=[t[e-1]],t.splice(e-1,2,a),[!0,t];a.params.__parsed=[t[e+1]],t.splice(e,2,a)}return[!1,t]},composeExpression:function(e){var t,r=0;for(r=0;r0;--r)r-=(t=this.bundleOp(r-1,e,a))[0],e=t[1];else for(r=0;r\s*|\[\s*)/,i={value:"",tree:[]},o="",l=[{type:"text",data:t.replace(/^(\w+)@(key|index|iteration|first|last|show|total)/gi,"$1__$2")}],p=r;for(r||(p=r=t),a=e.match(s);a;a=e.match(s)){if(r+=a[0],e=e.slice(a[0].length),a[0].match(/\[/)){(i=this.parseExpression(e,!0)).tree&&(r+=i.value,l.push(i.tree),e=e.slice(i.value.length));var u=e.match(/\s*\]/);u&&(r+=u[0],e=e.slice(u[0].length))}else{var c=this.parseModifiersStop;if(this.parseModifiersStop=!0,n=this.lookUp(e,""))if(i.tree=[].concat(i.tree,n.tree),i.value=n.value,r+=n.value,n.ret){var g=i.tree[i.tree.length-1];"plugin"===g.type&&"__func"===g.name&&(g.hasOwner=!0),l.push(g),e=e.slice(i.value.length)}else i=!1;this.parseModifiersStop=c}i||l.push({type:"text",data:""})}return o=r.substr(p.length),{s:e,token:r,tree:[{type:"var",parts:l}],value:o}},parseFunc:function(e,t,r){return t.__parsed.name=this.parseText(e,[])[0],r.push({type:"plugin",name:"__func",params:t}),r},parseOperator:function(e,t,r){return[{type:"build-in",name:"operator",op:e,optype:t,precedence:r,params:{}}]},parsePluginBlock:function(e,t,r){return[{type:"plugin",name:e,params:t,subTree:this.parse(r,[])}]},parsePluginFunc:function(e,t){return[{type:"plugin",name:e,params:t}]},parseModifiers:function(e,t){var r,a=e.match(/^\|(\w+)/),n="";if(!this.parseModifiersStop&&a){n+=a[0],r="default"===a[1]?"defaultValue":a[1],e=e.slice(a[0].length).replace(/^\s+/,""),this.parseModifiersStop=!0;for(var s=[],i=e.match(/^\s*:\s*/);i;i=e.match(/^\s*:\s*/)){n+=e.slice(0,i[0].length),e=e.slice(i[0].length);var o=this.lookUp(e,"");o.ret?(n+=o.value,s.push(o.tree[0]),e=e.slice(o.value.length)):s.push(this.parseText(""))}this.parseModifiersStop=!1,s.unshift(t.pop());var l=this.parseFunc(r,{__parsed:s},[]);t.push(l[0]);var p=this.parseModifiers(e,t);return p&&(t=t.concat(p.tree)),{value:n,tree:t}}},parseParams:function(e,t,r){var a=e.replace(/\n/g," ").replace(/^\s+|\s+$/g,""),n=[];if(e="",n.__parsed=[],!a)return n;for(t||(t=/^\s+/,r=/^(\w+)\s*=\s*/);a;){var s=null;if(r){var i=a.match(r);if(i){var o=i[1].charAt(0).match(/^\d+/);"true"!==i[1]&&"false"!==i[1]&&"null"!==i[1]||(o=!0),o||(s=trimAllQuotes(i[1]),e+=a.slice(0,i[0].length),a=a.slice(i[0].length))}}var l=this.parseExpression(a);if(!l)break;s?(n[s]=l.value,n.__parsed[s]=l.tree):(n.push(l.value),n.__parsed.push(l.tree)),e+=a.slice(0,l.value.length);var p=(a=a.slice(l.value.length)).match(t);if(!p)break;e+=a.slice(0,p[0].length),a=a.slice(p[0].length)}return n.toString=function(){return e},n},lookUp:function(e,t){var r,a=[];if(!e)return!1;if(e.substr(0,this.ldelim.length)===this.ldelim&&(r=this.findTag("",e),t+=r[0],r)){var n=this.parse(r[0]);a=a.concat(n);var s=this.parseModifiers(e.slice(t.length),a);return s?{ret:!0,tree:s.tree,value:s.value}:{ret:!0,tree:a,value:t}}var i=this.getMatchingToken(e);if(!1!==i){t+=RegExp.lastMatch;var o=this.tokens[i].parse.call(this,e.slice(RegExp.lastMatch.length),{tree:a,token:RegExp.lastMatch});if("string"==typeof o)if("parenStart"===o){var l=[];a.push(l),l.parent=a,a=l}else"parenEnd"===o&&a.parent&&(a=a.parent);else o&&o.constructor===Object?(t+=o.value,o=o.tree,a=a.concat(o)):a=a.concat(o);return{ret:!0,tree:a,value:t}}return{ret:!1,tree:a,value:t}},parseExpression:function(e){var t,r=[],a="";for(this.lastTreeInExpression=r;;){if(!(t=this.lookUp(e.slice(a.length),a)))break;if(r=r.concat(t.tree),a=t.value,this.lastTreeInExpression=r,!t.ret)break}return r.length&&(r=this.composeExpression(r)),{tree:r,value:a}},parseBool:function(e){return[{type:"boolean",data:e}]},parseText:function(e){var t=[];if(this.parseEmbeddedVars)for(var r=/([$][\w@]+)|`([^`]*)`/,a=r.exec(e);a;a=r.exec(e)){t.push({type:"text",data:e.slice(0,a.index)});var n=this.parseExpression(a[1]?a[1]:a[2]);t.push(n.tree),e=e.slice(a.index+a[0].length)}return t.push({type:"text",data:e}),t},loadTemplate:function(e,t){var r=[];if(!t&&e in this.files)r=this.files[e];else{var a=this.getTemplate(e);if("string"!=typeof a)throw new Error("No template for "+e);r=this.getTree(a),this.files[e]=r}return r},removeComments:function(e){for(var t=new RegExp(this.ldelim+"\\*"),r=new RegExp("\\*"+this.rdelim),a="",n=e.match(t);n;n=e.match(r)){a+=e.slice(0,n.index);var s=(e=e.slice(n.index+n[0].length)).match(r);if(!s)throw new Error("Unclosed "+t+"*");e=e.slice(s.index+s[0].length)}return a+e},applyFilters:function(e,t){for(var r=0;r=|<>|<|>)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1.replace(/<>/,"!="),"binary",5)}},{regex:/^\s+(lt|lte|le|gt|gte|ge)\s+/i,parse:function(e,t){var r=RegExp.$1.replace(/l(t)?e/,"<").replace(/lt/,"<=").replace(/g(t)?e/,">").replace(/gt/,">=");return this.parseOperator(r,"binary",5)}},{regex:/^\s+(is\s+(not\s+)?div\s+by)\s+/i,parse:function(e,t){return this.parseOperator(RegExp.$2?"div_not":"div","binary",7)}},{regex:/^\s+is\s+(not\s+)?(even|odd)(\s+by\s+)?\s*/i,parse:function(e,t){var r=RegExp.$1?"odd"===RegExp.$2?"even":"even_not":"odd"===RegExp.$2?"even_not":"even",a=this.parseOperator(r,"binary",7);return RegExp.$3?a:a.concat(this.parseText("1",a))}},{regex:/^\s*(&&)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",8)}},{regex:/^\s*(\|\|)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",9)}},{regex:/^\s+and\s+/i,parse:function(e,t){return this.parseOperator("&&","binary",11)}},{regex:/^\s+xor\s+/i,parse:function(e,t){return this.parseOperator("xor","binary",12)}},{regex:/^\s+or\s+/i,parse:function(e,t){return this.parseOperator("||","binary",13)}},{regex:/^#(\w+)#/,parse:function(e,t){var r=this.parseVar(".config."+RegExp.$1,"smarty","$smarty"),a=this.parseModifiers(r.s,r.tree);return a?(r.value+=a.value,a):r}},{regex:/^\s*\[\s*/,parse:function(e,t){var r=this.parseParams(e,/^\s*,\s*/,/^('[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|\w+)\s*=>\s*/),a=this.parsePluginFunc("__array",r),n=r.toString(),s=e.slice(r.toString().length).match(/\s*\]/);return s&&(n+=s[0]),{tree:a,value:n}}},{regex:/^[\d.]+/,parse:function(e,t){t.token.indexOf(".")>-1?t.token=parseFloat(t.token):t.token=parseInt(t.token,10);var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}},{regex:/^\w+/,parse:function(e,t){var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}}],buildInFunctions:{expression:{parse:function(e){var t=this.parseExpression(e);return{type:"build-in",name:"expression",expression:t.tree,params:this.parseParams(e.slice(t.value.length).replace(/^\s+|\s+$/g,""))}}},section:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("section [^}]+","/section","sectionelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"section",params:e,subTree:r,subTreeElse:a}}},setfilter:{type:"block",parseParams:function(e){return[this.parseExpression("__t()|"+e).tree]},parse:function(e,t){return{type:"build-in",name:"setfilter",params:e,subTree:this.parse(t)}}},config_load:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]);return{type:"build-in",name:"config_load",params:e,content:this.getConfig(t),section:trimAllQuotes(e.section?e.section:e[1]?e[1]:"")}}},append:{type:"function",parse:function(e){return{type:"build-in",name:"append",params:e}}},assign:{type:"function",parse:function(e){return{type:"build-in",name:"assign",params:e}}},break:{type:"function",parse:function(e){return{type:"build-in",name:"break",params:e}}},continue:{type:"function",parse:function(e){return{type:"build-in",name:"continue",params:e}}},call:{type:"function",parse:function(e){return{type:"build-in",name:"call",params:e}}},capture:{type:"block",parse:function(e,t){return{type:"build-in",name:"capture",params:e,subTree:this.parse(t)}}},nocache:{type:"block",parse:function(e,t){return{type:"build-in",name:"nocache",params:e,subTree:this.parse(t)}}},eval:{type:"function",parse:function(e){return this.parsePluginFunc("eval",e)}},include:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]),r=findInArray(e,"nocache")>=0;return{type:"build-in",name:"include",params:e,subTree:this.loadTemplate(t,r)}}},for:{type:"block",parseParams:function(e){var t=e.match(/^\s*\$(\w+)\s*=\s*([^\s]+)\s*to\s*([^\s]+)\s*(?:step\s*([^\s]+))?\s*(.*)$/);if(!t)throw new Error("Invalid {for} parameters: "+e);return this.parseParams("varName='"+t[1]+"' from="+t[2]+" to="+t[3]+" step="+(t[4]?t[4]:"1")+" "+t[5])},parse:function(e,t){var r=[],a=[],n=this.findElseTag("for\\s[^}]+","/for","forelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length))):r=this.parse(t),{type:"build-in",name:"for",params:e,subTree:r,subTreeElse:a}}},if:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("if\\s+[^}]+","/if","else[^}]*",t);if(n){r=this.parse(t.slice(0,n.index)),t=t.slice(n.index+n[0].length);var s=n[1].match(/^else\s*if(.*)/);a=s?this.buildInFunctions.if.parse.call(this,this.parseParams(s[1]),t.replace(/^\n/,"")):this.parse(t.replace(/^\n/,""))}else r=this.parse(t);return[{type:"build-in",name:"if",params:e,subTreeIf:r,subTreeElse:a}]}},foreach:{type:"block",parseParams:function(e){var t=e.match(/^\s*([$].+)\s*as\s*[$](\w+)\s*(=>\s*[$](\w+))?\s*$/i);return t&&(e="from="+t[1]+" item="+(t[4]||t[2]),t[4]&&(e+=" key="+t[2])),this.parseParams(e)},parse:function(e,t){var r=[],a=[],n=this.findElseTag("foreach\\s[^}]+","/foreach","foreachelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"foreach",params:e,subTree:r,subTreeElse:a}}},function:{type:"block",parse:function(e,t){this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]=!0;var r=this.parse(t);return this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]={tree:r,defaultParams:e},!1}},extends:{type:"function",parse:function(e){return this.loadTemplate(trimAllQuotes(e.file?e.file:e[0]),!0)}},block:{type:"block",parse:function(e,t){e.append=findInArray(e,"append")>=0,e.prepend=findInArray(e,"prepend")>=0,e.hide=findInArray(e,"hide")>=0;var r,a,n=this.parse(t,[]),s=trimAllQuotes(e.name?e.name:e[0]);return s in this.blocks?(this.outerBlocks[s]=[],this.outerBlocks[s]={tree:n,params:e},a="outer",r=t.match(/smarty.block.parent/),e.needParent=!1,r&&(e.needParent=!0)):(this.blocks[s]=[],this.blocks[s]={tree:n,params:e},a="inner",r=t.match(/smarty.block.child/),e.needChild=!1,r&&(e.needChild=!0)),{type:"build-in",name:"block",params:e,location:a}}},strip:{type:"block",parse:function(e,t){return this.parse(t.replace(/[ \t]*[\r\n]+[ \t]*/g,""))}},literal:{type:"block",parse:function(e,t){return this.parseText(t)}},ldelim:{type:"function",parse:function(e){return this.parseText(this.ldelim)}},rdelim:{type:"function",parse:function(e){return this.parseText(this.rdelim)}},while:{type:"block",parse:function(e,t){return{type:"build-in",name:"while",params:e,subTree:this.parse(t)}}}}},jSmartProcessor={tplModifiers:[],runTimePlugins:{},plugins:{},modifiers:{},defaultModifiers:{},escapeHtml:!1,variableFilters:[],outerBlocks:{},blocks:{},debugging:!1,clear:function(){this.runTimePlugins={},this.variableFilters=[],this.escapeHtml=!1,this.defaultModifiers={},this.modifiers={},this.plugins={},this.blocks={},this.outerBlocks={},this.debugging=!1,this.includedTemplates=[]},getProcessed:function(e,t){var r=this.process(e,t);return this.debugging&&this.plugins.debug.process([],{includedTemplates:this.includedTemplates,assignedVars:t}),this.clear(),{output:r.tpl,smarty:r.smarty}},process:function(e,t){for(var r,a,n,s,i="",o=0;o":return s>r;case"===":return s===r;case">=":return s>=r;case"!==":return s!==r}}},section:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={},n=r.__get("show",!0);if(t.smarty.section[r.__get("name",null,0)]=a,a.show=n,!n)return this.process(e.subTreeElse,t);var s=parseInt(r.__get("start",0),10),i=r.loop instanceof Object?countProperties(r.loop):isNaN(r.loop)?0:parseInt(r.loop),o=parseInt(r.__get("step",1),10),l=parseInt(r.__get("max"),10);isNaN(l)&&(l=Number.MAX_VALUE),s<0?(s+=i)<0&&(s=0):s>=i&&(s=i?i-1:0);var p=0,u=s;p=0;var c="";for(u=s;u>=0&&u=i,a.index=u,a.index_prev=u-o,a.index_next=u+o,a.iteration=a.rownum=p+1,a.total=p,a.loop=p;var g=this.process(e.subTree,t);void 0!==g&&(t=g.data,c+=g.tpl),t.smarty.continue=!1}return a.total=p,a.loop=p,t.smarty.break=!1,p?{tpl:c,data:t}:this.process(e.subTreeElse,t)}},setfilter:{process:function(e,t){this.tplModifiers.push(e.params);var r=this.process(e.subTree,t);return void 0!==r&&(t=r.data,r=r.tpl),this.tplModifiers.pop(),{tpl:r,data:t}}},for:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=parseInt(r.__get("from"),10),n=parseInt(r.__get("to"),10),s=parseInt(r.__get("step"),10);isNaN(s)&&(s=1);var i=parseInt(r.__get("max"),10);isNaN(i)&&(i=Number.MAX_VALUE);for(var o=0,l="",p=Math.min(Math.ceil((1+(s>0?n-a:a-n))/Math.abs(s)),i),u=parseInt(r.from,10);o0,r.name&&(t.smarty.foreach[r.name].show=i>0?1:""),i>0?s:this.process(e.subTreeElse,t)}},break:{process:function(e,t){return t.smarty.break=!0,{tpl:"",data:t}}},continue:{process:function(e,t){return t.smarty.continue=!0,{tpl:"",data:t}}},block:{process:function(e,t){var r,a,n,s=trimAllQuotes(e.params.name?e.params.name:e.params[0]),i=this.blocks[s],o=this.outerBlocks[s];return"inner"===e.location?(i.params.needChild?(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),t.smarty.block.child=a,void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r):o.params.needParent?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),t.smarty.block.parent=r,void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),n=a):(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),o.params.append?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=a+r):o.params.prepend?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r+a):n=a),n):""}},call:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={name:r.__get("name")?r.__get("name"):r.__get("0"),params:e.params},n=this.buildInFunctions.function.process.call(this,a,t),s=r.__get("assign",!1);return s?{tpl:"",data:this.assignVar(s,n,t)}:n}},include:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=r.__get("file",null,0);this.includedTemplates.push(a);var n=objectMerge({},t,r);n.smarty.template=a;var s=this.process(e.subTree,n);return void 0!==s&&(s=s.tpl),r.assign?{tpl:"",data:this.assignVar(r.assign,s,t)}:s}},function:{process:function(e,t){var r=this.runTimePlugins[e.name],a=this.getActualParamValues(r.defaultParams,t);delete a.name;var n=this.getActualParamValues(e.params,t);return this.process(r.tree,objectMerge({},t,a,n)).tpl}},while:{process:function(e,t){for(var r="";this.getActualParamValues(e.params,t)[0]&&!t.smarty.break;){var a=this.process(e.subTree,t);void 0!==a&&(t=a.data,r+=a.tpl),t.smarty.continue=!1}return t.smarty.break=!1,{tpl:r,data:t}}}}},version="3.0.3",jSmart=function(e,t){this.smarty={block:{},break:!1,capture:{},continue:!1,counter:{},cycle:{},foreach:{},section:{},now:Math.floor((new Date).getTime()/1e3),const:{},config:{},current_dir:"/",template:"",ldelim:"{",rdelim:"}",version:version},this.autoLiteral=!0,this.escapeHtml=!1,this.debugging=!1,this.outerBlocks={},this.blocks={},this.parse(e,t)};jSmart.prototype={constructor:jSmart,tree:[],scripts:{},modifiers:{},defaultModifiers:[],defaultModifiersGlobal:[],globalAndDefaultModifiers:[],filters:{variable:[],post:[]},filtersGlobal:{pre:[],variable:[],post:[]},globalAndDefaultFilters:[],buildInFunctions:{},plugins:{},runTimePlugins:{},parse:function(e,t){var r;t||(t={}),t.rdelim?this.smarty.rdelim=t.rdelim:jSmart.prototype.right_delimiter?this.smarty.rdelim=jSmart.prototype.right_delimiter:this.smarty.rdelim="}",t.ldelim?this.smarty.ldelim=t.ldelim:jSmart.prototype.left_delimiter?this.smarty.ldelim=jSmart.prototype.left_delimiter:this.smarty.ldelim="{",void 0!==t.autoLiteral?this.autoLiteral=t.autoLiteral:void 0!==jSmart.prototype.auto_literal&&(this.autoLiteral=jSmart.prototype.auto_literal),void 0!==t.debugging?this.debugging=t.debugging:void 0!==jSmart.prototype.debugging&&(this.debugging=jSmart.prototype.debugging),void 0!==t.escapeHtml?this.escapeHtml=t.escapeHtml:void 0!==jSmart.prototype.escape_html&&(this.escapeHtml=jSmart.prototype.escape_html),e=String(e||""),jSmartParser.clear(),jSmartParser.rdelim=this.smarty.rdelim,jSmartParser.ldelim=this.smarty.ldelim,jSmartParser.getTemplate=this.getTemplate,jSmartParser.getConfig=this.getConfig,jSmartParser.autoLiteral=this.autoLiteral,jSmartParser.plugins=this.plugins,jSmartParser.preFilters=this.filtersGlobal.pre,r=jSmartParser.getParsed(e),this.tree=r.tree,this.runTimePlugins=r.runTimePlugins,this.blocks=r.blocks,this.outerBlocks=r.outerBlocks},fetch:function(e){var t="";return"object"!=typeof e&&(e={}),e.smarty={},objectMerge(e.smarty,this.smarty),this.globalAndDefaultModifiers=jSmart.prototype.defaultModifiersGlobal.concat(this.defaultModifiers),this.globalAndDefaultFilters=jSmart.prototype.filtersGlobal.variable.concat(this.filters.variable),jSmartProcessor.clear(),jSmartProcessor.plugins=this.plugins,jSmartProcessor.modifiers=this.modifiers,jSmartProcessor.defaultModifiers=this.defaultModifiers,jSmartProcessor.escapeHtml=this.escapeHtml,jSmartProcessor.variableFilters=this.globalAndDefaultFilters,jSmartProcessor.runTimePlugins=this.runTimePlugins,jSmartProcessor.blocks=this.blocks,jSmartProcessor.outerBlocks=this.outerBlocks,jSmartProcessor.debugging=this.debugging,t=jSmartProcessor.getProcessed(this.tree,e,this.smarty),objectMerge(this.smarty,t.smarty),this.applyFilters(jSmart.prototype.filtersGlobal.post.concat(this.filters.post),t.output)},applyFilters:function(e,t){for(var r=0;r "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Array){n="Array (\n";for(a in e)e.hasOwnProperty(a)&&(n+=t+t+"["+a+"] => "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Boolean){var s="false";return!0===s&&(s="true"),s+"\n"}return e+"\n"},registerPlugin:function(e,t,r){"modifier"===e?this.modifiers[t]=r:this.plugins[t]={type:e,process:r}},registerFilter:function(e,t){(this.tree?this.filters:jSmart.prototype.filtersGlobal)["output"===e?"post":e].push(t)},addDefaultModifier:function(e){e instanceof Array||(e=[e]);for(var t=0;t=55296&&r<=56319){var a=r;return 1===t.length?r:1024*(a-55296)+(t.charCodeAt(1)-56320)+65536}return r},bin2Hex:function(e){var t,r,a,n="";for(t=0,r=(e+="").length;t1?a?s["&"]+e.substr(1):e:s[e]})},rawUrlDecode:function(e){return decodeURIComponent((e+"").replace(/%(?![\da-f]{2})/gi,function(){return"%25"}))},rawUrlEncode:function(e){return e+="",encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},sprintf:function(){var e=/%%|%(\d+\$)?([-+'#0 ]*)(\*\d+\$|\*|\d+)?(?:\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,r=0,a=function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},n=function(e,t,r,n,s,i){var o=n-e.length;return o>0&&(e=r||!s?a(e,n,i,r):[e.slice(0,t.length),a("",o,"0",!0),e.slice(t.length)].join("")),e},s=function(e,t,r,s,i,o,l){var p=e>>>0;return r=r&&p&&{2:"0b",8:"0",16:"0x"}[t]||"",e=r+a(p.toString(t),o||0,"0",!1),n(e,r,s,i,l)},i=function(e,t,r,a,s,i){return null!==a&&void 0!==a&&(e=e.slice(0,a)),n(e,"",t,r,s,i)};return t[r++].replace(e,function(e,o,l,p,u,c){var g,h,f,d,m;if("%%"===e)return"%";var y,v=!1,b="",_=!1,x=!1,w=" ",j=l.length;for(y=0;y-1?6:"d"===c?0:void 0,m=o?t[o.slice(0,-1)]:t[r++],c){case"s":return i(m+"",v,p,u,_,w);case"c":return i(String.fromCharCode(+m),v,p,u,_);case"b":return s(m,2,x,v,p,u,_);case"o":return s(m,8,x,v,p,u,_);case"x":return s(m,16,x,v,p,u,_);case"X":return s(m,16,x,v,p,u,_).toUpperCase();case"u":return s(m,10,x,v,p,u,_);case"i":case"d":return g=+m||0,g=Math.round(g-g%1),h=g<0?"-":b,m=h+a(String(Math.abs(g)),u,"0",!1),n(m,h,v,p,_);case"e":case"E":case"f":case"F":case"g":case"G":return g=+m,h=g<0?"-":b,f=["toExponential","toFixed","toPrecision"]["efg".indexOf(c.toLowerCase())],d=["toString","toUpperCase"]["eEfFgG".indexOf(c)%2],m=h+Math.abs(g)[f](u),phpJs.justify(m,h,v,p,_)[d]();default:return e}})},makeTimeStamp:function(e){if(!e)return Math.floor((new Date).getTime()/1e3);if(isNaN(e)){var t=phpJs.strtotime(e);return-1===t||!1===t?Math.floor((new Date).getTime()/1e3):t}return 14===(e+="").length&&-1!==e.search(/^[\d]+$/g)?phpJs.mktime(e.substr(8,2),e.substr(10,2),e.substr(12,2),e.substr(4,2),e.substr(6,2),e.substr(0,4)):Number(e)},mktime:function(){var e=new Date,t=arguments,r=0,a=["Hours","Minutes","Seconds","Month","Date","FullYear"];for(r=0;r=0?t[5]<=69?2e3:t[5]<=100?1900:0:0,e.setFullYear(t[5],t[3]-1,t[4]),e.setHours(t[0],t[1],t[2]);var n=e.getTime();return(n/1e3>>0)-(n<0)},_pad:function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},justify:function(e,t,r,a,n,s){var i=a-e.length;return i>0&&(e=r||!n?phpJs._pad(e,a,s,r):[e.slice(0,t.length),phpJs._pad("",i,"0",!0),e.slice(t.length)].join("")),e},strtotime:function(e,t){function r(e,t,r){var a,n=l[t];void 0!==n&&(0===(a=n-o.getDay())?a=7*r:a>0&&"last"===e?a-=7:a<0&&"next"===e&&(a+=7),o.setDate(o.getDate()+a))}var a,n,s,i,o,l,p,u,c,g,h;if(!e)return!1;e=e.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var f=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if((n=e.match(f))&&n[2]===n[4])if(n[1]>1901)switch(n[2]){case"-":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case".":return!1;case"/":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else if(n[5]>1901)switch(n[2]){case"-":case".":return!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case"/":return!(n[1]>12||n[3]>31)&&new Date(n[5],parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else switch(n[2]){case"-":return!(n[3]>12||n[5]>31||n[1]<70&&n[1]>38)&&(i=n[1]>=0&&n[1]<=38?+n[1]+2e3:n[1],new Date(i,parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case".":return n[5]>=70?!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3:n[5]<60&&!n[6]&&(!(n[1]>23||n[3]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0,n[9]||0)/1e3));case"/":return!(n[1]>12||n[3]>31||n[5]<70&&n[5]>38)&&(i=n[5]>=0&&n[5]<=38?+n[5]+2e3:n[5],new Date(i,parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case":":return!(n[1]>23||n[3]>59||n[5]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0)/1e3)}if("now"===e)return null===t||isNaN(t)?(new Date).getTime()/1e3|0:0|t;if(!isNaN(a=Date.parse(e)))return a/1e3|0;if(f=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),(n=e.match(f))&&("z"===n[4]?n[4]="Z":n[4].match(/^([+-][0-9]{2})$/)&&(n[4]=n[4]+":00"),!isNaN(a=Date.parse(n[1]+"T"+n[2]+n[4]))))return a/1e3|0;if(o=t?new Date(1e3*t):new Date,l={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},p={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},c="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)",g="([+-]?\\d+\\s"+c+"|(last|next)\\s"+c+")(\\sago)?",!(n=e.match(new RegExp(g,"gi"))))return!1;for(h=0,u=n.length;h1;r/=10)e=t.toString()+e;return e.toString()},a={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %r %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%m/%d/%Y",X:"%r",alt_digits:"",ERA:"",ERA_YEAR:"",ERA_D_T_FMT:"",ERA_D_FMT:"",ERA_T_FMT:""},n={a:function(e){return a.a[e.getDay()]},A:function(e){return a.A[e.getDay()]},b:function(e){return a.b[e.getMonth()]},B:function(e){return a.B[e.getMonth()]},C:function(e){return r(parseInt(e.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(e){return r(parseInt(this.G(e)/100,10),0)},G:function(e){var t=e.getFullYear(),r=parseInt(n.V(e),10),a=parseInt(n.W(e),10);return a>r?t++:0===a&&r>=52&&t--,t},H:["getHours","0"],I:function(e){var t=e.getHours()%12;return r(0===t?12:t,0)},j:function(e){var t=e-new Date(e.getFullYear()+"/1/1 GMT");t+=6e4*e.getTimezoneOffset();var a=parseInt(t/6e4/60/24,10)+1;return r(a,0,100)},k:["getHours","0"],l:function(e){var t=e.getHours()%12;return r(0===t?12:t," ")},m:function(e){return r(e.getMonth()+1,0)},M:["getMinutes","0"],p:function(e){return a.p[e.getHours()>=12?1:0]},P:function(e){return a.P[e.getHours()>=12?1:0]},s:function(e){return Date.parse(e)/1e3},S:["getSeconds","0"],u:function(e){var t=e.getDay();return 0===t?7:t},U:function(e){var t=parseInt(n.j(e),10),a=6-e.getDay(),s=parseInt((t+a)/7,10);return r(s,0)},V:function(e){var t=parseInt(n.W(e),10),a=new Date(e.getFullYear()+"/1/1").getDay(),s=t+(a>4||a<=1?0:1);return 53===s&&new Date(e.getFullYear()+"/12/31").getDay()<4?s=1:0===s&&(s=n.V(new Date(e.getFullYear()-1+"/12/31"))),r(s,0)},w:"getDay",W:function(e){var t=parseInt(n.j(e),10),a=7-n.u(e),s=parseInt((t+a)/7,10);return r(s,0,10)},y:function(e){return r(e.getFullYear()%100,0)},Y:"getFullYear",z:function(e){var t=e.getTimezoneOffset(),a=r(parseInt(Math.abs(t/60),10),0),n=r(t%60,0);return(t>0?"-":"+")+a+n},Z:function(e){return e.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(e){return"%"}},s=void 0===t?new Date:t instanceof Date?new Date(t):new Date(1e3*t),i={c:"locale",D:"%m/%d/%y",F:"%y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};e.match(/%[cDFhnrRtTxX]/);)e=e.replace(/%([cDFhnrRtTxX])/g,function(e,t){var r=i[t];return"locale"===r?a[t]:r});return e.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,function(e,t){var a=n[t];return"string"==typeof a?s[a]():"function"==typeof a?a(s):"object"==typeof a&&"string"==typeof a[0]?r(s[a[0]](),a[1]):t})}};return jSmart.prototype.registerPlugin("modifier","capitalize",function(e,t,r){if("string"!=typeof e)return e;var a=new RegExp(t?"[^a-zA-Z_à-ü]+":"[^a-zA-Z0-9_à-ü]"),n=null,s="";r&&(e=e.toLowerCase());var i;for(n=e.match(a);n;n=e.match(a))(i=e.slice(0,n.index)).match(/\d/)?s+=i:s+=i.charAt(0).toUpperCase()+i.slice(1),s+=e.slice(n.index,n.index+n[0].length),e=e.slice(n.index+n[0].length);return e.match(/\d/)?s+e:s+e.charAt(0).toUpperCase()+e.slice(1)}),jSmart.prototype.registerPlugin("modifier","cat",function(e,t){return t=t||"",String(e)+t}),jSmart.prototype.registerPlugin("modifier","count_characters",function(e,t){return e=String(e),t?e.length:e.replace(/\s/g,"").length}),jSmart.prototype.registerPlugin("modifier","count_paragraphs",function(e){var t=String(e).match(/\n+/g);return t?t.length+1:1}),jSmart.prototype.registerPlugin("modifier","count_sentences",function(e){if("string"==typeof e){var t=e.match(/\w[.?!](\W|$)/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","count_words",function(e){if("string"==typeof e){var t=e.match(/\w+/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","date_format",function(e,t,r){return phpJs.strftime(t||"%b %e, %Y",phpJs.makeTimeStamp(e||r))}),jSmart.prototype.registerPlugin("modifier","debug_print_var",function(e){console.log(e+"--");var t="";return"object"==typeof module&&module&&"object"==typeof module.exports?t="node":"object"==typeof window&&window.document&&(t="browser"),""===t?"":"browser"===t?jSmart.prototype.printR(e):void console.log(e)}),jSmart.prototype.registerPlugin("modifier","defaultValue",function(e,t){return t=t||"",e&&"null"!==e&&void 0!==e?e:t}),jSmart.prototype.registerPlugin("modifier","escape",function(e,t,r,a){e=String(e),t=t||"html",r=r||"UTF-8",a=void 0===a||Boolean(a);var n,s="";switch(t){case"html":return a&&(e=e.replace(/&/g,"&")),e.replace(//g,">").replace(/'/g,"'").replace(/"/g,""");case"htmlall":return phpJs.htmlEntities(e,3,r);case"url":return phpJs.rawUrlEncode(e);case"urlpathinfo":return phpJs.rawUrlEncode(e).replace(/%2F/g,"/");case"quotes":return e.replace(/(^|[^\\])'/g,"$1\\'");case"hex":for(s="",n=0;n=126?"&#"+i+";":e.substr(n,1)}return s;case"javascript":return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/<\//g,"")}),jSmart.prototype.registerPlugin("modifier","regex_replace",function(e,t,r){var a=t.match(/^ *\/(.*)\/(.*) *$/);return String(e).replace(new RegExp(a[1],"g"+(a.length>1?a[2]:"")),r)}),jSmart.prototype.registerPlugin("modifier","replace",function(e,t,r){if(!t)return e;e=String(e),t=String(t),r=String(r);var a="",n=-1;for(n=e.indexOf(t);n>=0;n=e.indexOf(t))a+=e.slice(0,n)+r,n+=t.length,e=e.slice(n);return a+e}),jSmart.prototype.registerPlugin("modifier","spacify",function(e,t){return t||(t=" "),String(e).replace(/(\n|.)(?!$)/g,"$1"+t)}),jSmart.prototype.registerPlugin("modifier","string_format",function(e,t){return phpJs.sprintf(t,e)}),jSmart.prototype.registerPlugin("modifier","strip",function(e,t){return t=t||" ",String(e).replace(/[\s]+/g,t)}),jSmart.prototype.registerPlugin("modifier","strip_tags",function(e,t,r){if(null===t&&(t=!0),r||!0!==t&&!1!==t&&(t+"").length>0&&(r=t,t=!0),r){var a=r.split(">");return a.splice(-1,1),e=String(e).replace(/<[^>]*?>/g,function(e,r,n){for(var s=e.match(/\w+/),i=0;i").match(/\w+/);if(s[0]===o[0])return e}return t?" ":""})}return String(e).replace(/<[^>]*?>/g,t?" ":"")}),jSmart.prototype.registerPlugin("modifier","to_charset",function(e){return e}),jSmart.prototype.registerPlugin("modifier","truncate",function(e,t,r,a,n){return e=String(e),t=t||80,r=null!=r?r:"...",e.length<=t?e:(t-=Math.min(t,r.length),n?e.slice(0,Math.floor(t/2))+r+e.slice(e.length-Math.floor(t/2)):(a||(e=e.slice(0,t+1).replace(/\s+?(\S+)?$/,"")),e.slice(0,t)+r))}),jSmart.prototype.registerPlugin("modifier","unescape",function(e,t,r){switch(e=String(e),t=t||"html",r=r||"UTF-8",t){case"html":return e.replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,'"');case"entity":case"htmlall":return phpJs.htmlEntityDecode(e,1);case"url":return phpJs.rawUrlDecode(e)}return e}),jSmart.prototype.registerPlugin("modifier","upper",function(e){return String(e).toUpperCase()}),jSmart.prototype.registerPlugin("modifier","wordwrap",function(e,t,r,a){t=t||80,r=r||"\n";for(var n=String(e).split("\n"),s=0;st;){for(var l=0,p=i.slice(l).match(/\s+/);p&&l+p.index<=t;p=i.slice(l).match(/\s+/))l+=p.index+p[0].length;l=a?t-1:l||(p?p.index+p[0].length:i.length),o+=i.slice(0,l).replace(/\s+$/,""),l=t.smarty.cycle[r].arr.length||a)&&(t.smarty.cycle[r].index=0),e.__get("assign",!1)?(this.assignVar(e.assign,t.smarty.cycle[r].arr[t.smarty.cycle[r].index],t),""):e.__get("print",!0)?t.smarty.cycle[r].arr[t.smarty.cycle[r].index]:""}),jSmart.prototype.registerPlugin("function","eval",function(e,t){var r=e.var;return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","debug",function(e,t){var r="";if("object"==typeof module&&module&&"object"==typeof module.exports?r="node":"object"==typeof window&&window.document&&(r="browser"),""===r)return"";if("browser"===r){window.jsmartDebug&&window.jsmartDebug.close(),window.jsmartDebug=window.open("","","width=680, height=600,resizable,scrollbars=yes");var a="",n="",s=0;for(var i in t.includedTemplates)a+=""+t.includedTemplates[i]+"";""!==a&&(a="

included templates

"+a+"

"),s=0;for(var o in t.assignedVars)n+="["+o+"]"+jSmart.prototype.printR(t.assignedVars[o])+"";""!==n&&(n="

assigned template variables

"+n+"
");var l="jSmart Debug Console

jSmart Debug Console


"+a+n+"
";window.jsmartDebug.document.write(l)}else"undefined"!=typeof console&&(console.log("included templates:- "+JSON.stringify(a)),console.log("assigned template variables:- "+JSON.stringify(n)));return""}),jSmart.prototype.registerPlugin("function","fetch",function(e,t){var r=jSmart.prototype.getFile(e.__get("file",null,0));return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","html_checkboxes",function(e,t){var r,a,n,s=e.__get("type","checkbox"),i=e.__get("name",s),o=i,l=e.__get("values",e.options),p=e.__get("options",[]),u="options"in e,c=e.__get("selected",!1),g=e.__get("separator",""),h=Boolean(e.__get("labels",!0)),f=Boolean(e.__get("label_ids",!1)),d=[],m=0,y="";if("checkbox"===s&&(i+="[]"),!u)for(r in e.output)p.push(e.output[r]);for(r in l)l.hasOwnProperty(r)&&(n=o+"_"+(a=u?r:l[r]),y=h?f?'";for(var x=0;x"+d["right"===g?x:d.length-1-x]+"";_+="\n"}return"
"+(i?"\n":"")+_+"\n\n"+y+"\n
"+i+"
\n"}),jSmart.prototype.registerPlugin("function","mailto",function(e,t){var r,a,n=e.__get("address",null),s=e.__get("encode","none"),i=e.__get("text",n),o=phpJs.rawUrlEncode(e.__get("cc","")).replace(/%40/g,"@").replace(/%2C/g,","),l=phpJs.rawUrlEncode(e.__get("bcc","")).replace(/%40/g,"@").replace(/%2C/g,","),p=phpJs.rawUrlEncode(e.__get("followupto","")).replace(/%40/g,"@").replace(/%2C/g,","),u=phpJs.rawUrlEncode(e.__get("subject","")),c=phpJs.rawUrlEncode(e.__get("newsgroups","")),g=e.__get("extra","");if(n+=o?"?cc="+o:"",n+=l?(o?"&":"?")+"bcc="+l:"",n+=u?(o||l?"&":"?")+"subject="+u:"",n+=c?(o||l||u?"&":"?")+"newsgroups="+c:"",n+=p?(o||l||u||c?"&":"?")+"followupto="+p:"",r='"+i+"","javascript"===s){r="document.write('"+r+"');";var h="";for(a=0;aeval(unescape(\''+h+"'))<\/script>"}if("javascript_charcode"===s){var f=[];for(a=0;a\n\x3c!--\n{document.write(String.fromCharCode('+f.join(",")+"))}\n//--\x3e\n<\/script>\n"}if("hex"===s){if(n.match(/^.+\?.+$/))throw new Error("mailto: hex encoding does not work with extra attributes. Try javascript.");var d="";for(a=0;a"+m+""}return r}),jSmart.prototype.registerPlugin("function","math",function(params,data){var equation=params.__get("equation",null).replace(/pi\(\s*\)/g,"PI");equation=equation.replace(/ceil/g,"Math.ceil").replace(/abs/g,"Math.abs").replace(/cos/g,"Math.cos").replace(/exp/g,"Math.exp").replace(/floor/g,"Math.floor").replace(/log/g,"Math.log").replace(/max/g,"Math.max").replace(/min/g,"Math.min").replace(/PI/g,"Math.PI").replace(/pow/g,"Math.pow").replace(/rand/g,"Math.rand").replace(/round/g,"Math.round").replace(/sin/g,"Math.sin").replace(/sqrt/g,"Math.sqrt").replace(/srans/g,"Math.srans").replace(/tan/g,"Math.tan");var words=equation.match(/\w+/g),i,j,tmp,banned=["ceil","abs","cos","exp","floor","log10","log","max","min","pi","pow","rand","round","sin","sqrt","srans","tan"];for(i=0;i(words[j+1]+"").length&&(tmp=words[j],words[j]=words[j+1],words[j+1]=tmp);for(i=0;i0&&(f=c+f),f=this.modifiers.wordwrap(f,n-l,s,i),l>0&&(f=f.replace(/^/gm,p)),g[h]=f)}var d=g.join(s+s);return"assign"in e?(this.assignVar(e.assign,d,r),""):d}),String.prototype.fetch=function(e){return new jSmart(this).fetch(e)},jSmart}); \ No newline at end of file diff --git a/examples/requirejs/js/jsmart.min.js b/examples/requirejs/js/jsmart.min.js index 19567a9..eab9d8d 100644 --- a/examples/requirejs/js/jsmart.min.js +++ b/examples/requirejs/js/jsmart.min.js @@ -1,5 +1,5 @@ /*! - * jSmart JavaScript template engine (v3.0.2) + * jSmart JavaScript template engine (v3.0.3) * https://github.com/umakantp/jsmart * https://opensource.org/licenses/MIT * @@ -7,4 +7,4 @@ * Max Miroshnikov */ -!function(e){"use strict";"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=e():("object"==typeof window&&window.document&&(window.jSmart=e()),"function"==typeof define&&define.amd&&define("jSmart",[],e))}(function(){"use strict";function objectMerge(e,t){for(var r=1;r0){for(var r=[],a=0;a2?r[2].replace(/^\s+|\s+$/g,""):"",a in this.buildInFunctions){var p=this.buildInFunctions[a],u=("parseParams"in p?p.parseParams.bind(this):this.parseParams.bind(this))(n);if("block"===p.type){e=e.replace(/^\n/,""),i=this.findCloseTag("/"+a,a+" +[^}]*",e);var c=p.parse.call(this,u,e.slice(0,i.index));c&&(o=o.concat(c)),e=e.slice(i.index+i[0].length)}else"extends"===a&&o.splice(0,o.length),o=o.concat(p.parse.call(this,u)),"extends"===a&&(l=o.length);e=e.replace(/^\n/,"")}else if(a in this.runTimePlugins)o=o.concat(this.parsePluginFunc(a,this.parseParams(n)));else if(a in this.plugins){var g=this.plugins[a];"block"===g.type?(i=this.findCloseTag("/"+a,a+" +[^}]*",e),o=o.concat(this.parsePluginBlock(a,this.parseParams(n),e.slice(0,i.index))),e=e.slice(i.index+i[0].length)):"function"===g.type&&(o=o.concat(this.parsePluginFunc(a,this.parseParams(n)))),"append"!==a&&"assign"!==a&&"capture"!==a&&"eval"!==a&&"include"!==a||(e=e.replace(/^\n/,""))}else s=this.buildInFunctions.expression.parse.call(this,t[1]),o.push(s);else"build-in"===(s=this.buildInFunctions.expression.parse.call(this,t[1])).expression.type&&"operator"===s.expression.name&&"="===s.expression.op&&(e=e.replace(/^\n/,"")),o.push(s);return e&&(o=o.concat(this.parseText(e))),o.usedExtends=l,o},findTag:function(e,t){var r,a,n,s=0,i=0,o=this.ldelim,l=this.rdelim,p=this.autoLiteral,u=/^\s*(.+)\s*$/i,c=e?new RegExp("^\\s*("+e+")\\s*$","i"):u;for(r=0;r=0&&t.substr(r-1,1).match(/\s/))continue;if(!--s&&(a=t.slice(o.length,r).replace(/[\r\n]/g," "),n=a.match(c)))return n.index=i,n[0]=t.slice(0,r+l.length),n;s<0&&(s=0)}return null},findElseTag:function(e,t,r,a){for(var n=0,s=this.findTag(r,a);s;s=this.findTag(r,a)){var i=this.findTag(e,a);if(!i||i.index>s.index)return s.index+=n,s;a=a.slice(i.index+i[0].length),n+=i.index+i[0].length;var o=this.findCloseTag(t,e,a);a=a.slice(o.index+o[0].length),n+=o.index+o[0].length}return null},findCloseTag:function(e,t,r){var a="",n=null,s=null,i=0;do{if(n&&(i+=n[0].length),!(n=this.findTag(e,r)))throw new Error("Unclosed "+this.ldelim+t+this.rdelim);a+=r.slice(0,n.index),i+=n.index,r=r.slice(n.index+n[0].length),(s=this.findTag(t,a))&&(a=a.slice(s.index+s[0].length))}while(s);return n.index=i,n},bundleOp:function(e,t,r){var a=t[e];if("operator"===a.name&&a.precedence===r&&!a.params.__parsed){if("binary"===a.optype)return a.params.__parsed=[t[e-1],t[e+1]],t.splice(e-1,3,a),[!0,t];if("post-unary"===a.optype)return a.params.__parsed=[t[e-1]],t.splice(e-1,2,a),[!0,t];a.params.__parsed=[t[e+1]],t.splice(e,2,a)}return[!1,t]},composeExpression:function(e){var t,r=0;for(r=0;r0;--r)r-=(t=this.bundleOp(r-1,e,a))[0],e=t[1];else for(r=0;r\s*|\[\s*)/,i={value:"",tree:[]},o="",l=[{type:"text",data:t.replace(/^(\w+)@(key|index|iteration|first|last|show|total)/gi,"$1__$2")}],p=r;for(r||(p=r=t),a=e.match(s);a;a=e.match(s)){if(r+=a[0],e=e.slice(a[0].length),a[0].match(/\[/)){(i=this.parseExpression(e,!0)).tree&&(r+=i.value,l.push(i.tree),e=e.slice(i.value.length));var u=e.match(/\s*\]/);u&&(r+=u[0],e=e.slice(u[0].length))}else{var c=this.parseModifiersStop;if(this.parseModifiersStop=!0,n=this.lookUp(e,""))if(i.tree=[].concat(i.tree,n.tree),i.value=n.value,r+=n.value,n.ret){var g=i.tree[i.tree.length-1];"plugin"===g.type&&"__func"===g.name&&(g.hasOwner=!0),l.push(g),e=e.slice(i.value.length)}else i=!1;this.parseModifiersStop=c}i||l.push({type:"text",data:""})}return o=r.substr(p.length),{s:e,token:r,tree:[{type:"var",parts:l}],value:o}},parseFunc:function(e,t,r){return t.__parsed.name=this.parseText(e,[])[0],r.push({type:"plugin",name:"__func",params:t}),r},parseOperator:function(e,t,r){return[{type:"build-in",name:"operator",op:e,optype:t,precedence:r,params:{}}]},parsePluginBlock:function(e,t,r){return[{type:"plugin",name:e,params:t,subTree:this.parse(r,[])}]},parsePluginFunc:function(e,t){return[{type:"plugin",name:e,params:t}]},parseModifiers:function(e,t){var r,a=e.match(/^\|(\w+)/),n="";if(!this.parseModifiersStop&&a){n+=a[0],r="default"===a[1]?"defaultValue":a[1],e=e.slice(a[0].length).replace(/^\s+/,""),this.parseModifiersStop=!0;for(var s=[],i=e.match(/^\s*:\s*/);i;i=e.match(/^\s*:\s*/)){n+=e.slice(0,i[0].length),e=e.slice(i[0].length);var o=this.lookUp(e,"");o.ret?(n+=o.value,s.push(o.tree[0]),e=e.slice(o.value.length)):s.push(this.parseText(""))}this.parseModifiersStop=!1,s.unshift(t.pop());var l=this.parseFunc(r,{__parsed:s},[]);t.push(l[0]);var p=this.parseModifiers(e,t);return p&&(t=t.concat(p.tree)),{value:n,tree:t}}},parseParams:function(e,t,r){var a=e.replace(/\n/g," ").replace(/^\s+|\s+$/g,""),n=[];if(e="",n.__parsed=[],!a)return n;for(t||(t=/^\s+/,r=/^(\w+)\s*=\s*/);a;){var s=null;if(r){var i=a.match(r);if(i){var o=i[1].charAt(0).match(/^\d+/);"true"!==i[1]&&"false"!==i[1]&&"null"!==i[1]||(o=!0),o||(s=trimAllQuotes(i[1]),e+=a.slice(0,i[0].length),a=a.slice(i[0].length))}}var l=this.parseExpression(a);if(!l)break;s?(n[s]=l.value,n.__parsed[s]=l.tree):(n.push(l.value),n.__parsed.push(l.tree)),e+=a.slice(0,l.value.length);var p=(a=a.slice(l.value.length)).match(t);if(!p)break;e+=a.slice(0,p[0].length),a=a.slice(p[0].length)}return n.toString=function(){return e},n},lookUp:function(e,t){var r,a=[];if(!e)return!1;if(e.substr(0,this.ldelim.length)===this.ldelim&&(r=this.findTag("",e),t+=r[0],r)){var n=this.parse(r[0]);a=a.concat(n);var s=this.parseModifiers(e.slice(t.length),a);return s?{ret:!0,tree:s.tree,value:s.value}:{ret:!0,tree:a,value:t}}var i=this.getMatchingToken(e);if(!1!==i){t+=RegExp.lastMatch;var o=this.tokens[i].parse.call(this,e.slice(RegExp.lastMatch.length),{tree:a,token:RegExp.lastMatch});if("string"==typeof o)if("parenStart"===o){var l=[];a.push(l),l.parent=a,a=l}else"parenEnd"===o&&a.parent&&(a=a.parent);else o&&o.constructor===Object?(t+=o.value,o=o.tree,a=a.concat(o)):a=a.concat(o);return{ret:!0,tree:a,value:t}}return{ret:!1,tree:a,value:t}},parseExpression:function(e){var t,r=[],a="";for(this.lastTreeInExpression=r;;){if(!(t=this.lookUp(e.slice(a.length),a)))break;if(r=r.concat(t.tree),a=t.value,this.lastTreeInExpression=r,!t.ret)break}return r.length&&(r=this.composeExpression(r)),{tree:r,value:a}},parseBool:function(e){return[{type:"boolean",data:e}]},parseText:function(e){var t=[];if(this.parseEmbeddedVars)for(var r=/([$][\w@]+)|`([^`]*)`/,a=r.exec(e);a;a=r.exec(e)){t.push({type:"text",data:e.slice(0,a.index)});var n=this.parseExpression(a[1]?a[1]:a[2]);t.push(n.tree),e=e.slice(a.index+a[0].length)}return t.push({type:"text",data:e}),t},loadTemplate:function(e,t){var r=[];if(!t&&e in this.files)r=this.files[e];else{var a=this.getTemplate(e);if("string"!=typeof a)throw new Error("No template for "+e);r=this.getTree(a),this.files[e]=r}return r},removeComments:function(e){for(var t=new RegExp(this.ldelim+"\\*"),r=new RegExp("\\*"+this.rdelim),a="",n=e.match(t);n;n=e.match(r)){a+=e.slice(0,n.index);var s=(e=e.slice(n.index+n[0].length)).match(r);if(!s)throw new Error("Unclosed "+t+"*");e=e.slice(s.index+s[0].length)}return a+e},applyFilters:function(e,t){for(var r=0;r=|<>|<|>)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1.replace(/<>/,"!="),"binary",5)}},{regex:/^\s+(lt|lte|le|gt|gte|ge)\s+/i,parse:function(e,t){var r=RegExp.$1.replace(/l(t)?e/,"<").replace(/lt/,"<=").replace(/g(t)?e/,">").replace(/gt/,">=");return this.parseOperator(r,"binary",5)}},{regex:/^\s+(is\s+(not\s+)?div\s+by)\s+/i,parse:function(e,t){return this.parseOperator(RegExp.$2?"div_not":"div","binary",7)}},{regex:/^\s+is\s+(not\s+)?(even|odd)(\s+by\s+)?\s*/i,parse:function(e,t){var r=RegExp.$1?"odd"===RegExp.$2?"even":"even_not":"odd"===RegExp.$2?"even_not":"even",a=this.parseOperator(r,"binary",7);return RegExp.$3?a:a.concat(this.parseText("1",a))}},{regex:/^\s*(&&)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",8)}},{regex:/^\s*(\|\|)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",9)}},{regex:/^\s+and\s+/i,parse:function(e,t){return this.parseOperator("&&","binary",11)}},{regex:/^\s+xor\s+/i,parse:function(e,t){return this.parseOperator("xor","binary",12)}},{regex:/^\s+or\s+/i,parse:function(e,t){return this.parseOperator("||","binary",13)}},{regex:/^#(\w+)#/,parse:function(e,t){var r=this.parseVar(".config."+RegExp.$1,"smarty","$smarty"),a=this.parseModifiers(r.s,r.tree);return a?(r.value+=a.value,a):r}},{regex:/^\s*\[\s*/,parse:function(e,t){var r=this.parseParams(e,/^\s*,\s*/,/^('[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|\w+)\s*=>\s*/),a=this.parsePluginFunc("__array",r),n=r.toString(),s=e.slice(r.toString().length).match(/\s*\]/);return s&&(n+=s[0]),{tree:a,value:n}}},{regex:/^[\d.]+/,parse:function(e,t){t.token.indexOf(".")>-1?t.token=parseFloat(t.token):t.token=parseInt(t.token,10);var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}},{regex:/^\w+/,parse:function(e,t){var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}}],buildInFunctions:{expression:{parse:function(e){var t=this.parseExpression(e);return{type:"build-in",name:"expression",expression:t.tree,params:this.parseParams(e.slice(t.value.length).replace(/^\s+|\s+$/g,""))}}},section:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("section [^}]+","/section","sectionelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"section",params:e,subTree:r,subTreeElse:a}}},setfilter:{type:"block",parseParams:function(e){return[this.parseExpression("__t()|"+e).tree]},parse:function(e,t){return{type:"build-in",name:"setfilter",params:e,subTree:this.parse(t)}}},config_load:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]);return{type:"build-in",name:"config_load",params:e,content:this.getConfig(t),section:trimAllQuotes(e.section?e.section:e[1]?e[1]:"")}}},append:{type:"function",parse:function(e){return{type:"build-in",name:"append",params:e}}},assign:{type:"function",parse:function(e){return{type:"build-in",name:"assign",params:e}}},break:{type:"function",parse:function(e){return{type:"build-in",name:"break",params:e}}},continue:{type:"function",parse:function(e){return{type:"build-in",name:"continue",params:e}}},call:{type:"function",parse:function(e){return{type:"build-in",name:"call",params:e}}},capture:{type:"block",parse:function(e,t){return{type:"build-in",name:"capture",params:e,subTree:this.parse(t)}}},nocache:{type:"block",parse:function(e,t){return{type:"build-in",name:"nocache",params:e,subTree:this.parse(t)}}},eval:{type:"function",parse:function(e){return this.parsePluginFunc("eval",e)}},include:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]),r=findInArray(e,"nocache")>=0;return{type:"build-in",name:"include",params:e,subTree:this.loadTemplate(t,r)}}},for:{type:"block",parseParams:function(e){var t=e.match(/^\s*\$(\w+)\s*=\s*([^\s]+)\s*to\s*([^\s]+)\s*(?:step\s*([^\s]+))?\s*(.*)$/);if(!t)throw new Error("Invalid {for} parameters: "+e);return this.parseParams("varName='"+t[1]+"' from="+t[2]+" to="+t[3]+" step="+(t[4]?t[4]:"1")+" "+t[5])},parse:function(e,t){var r=[],a=[],n=this.findElseTag("for\\s[^}]+","/for","forelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length))):r=this.parse(t),{type:"build-in",name:"for",params:e,subTree:r,subTreeElse:a}}},if:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("if\\s+[^}]+","/if","else[^}]*",t);if(n){r=this.parse(t.slice(0,n.index)),t=t.slice(n.index+n[0].length);var s=n[1].match(/^else\s*if(.*)/);a=s?this.buildInFunctions.if.parse.call(this,this.parseParams(s[1]),t.replace(/^\n/,"")):this.parse(t.replace(/^\n/,""))}else r=this.parse(t);return[{type:"build-in",name:"if",params:e,subTreeIf:r,subTreeElse:a}]}},foreach:{type:"block",parseParams:function(e){var t=e.match(/^\s*([$].+)\s*as\s*[$](\w+)\s*(=>\s*[$](\w+))?\s*$/i);return t&&(e="from="+t[1]+" item="+(t[4]||t[2]),t[4]&&(e+=" key="+t[2])),this.parseParams(e)},parse:function(e,t){var r=[],a=[],n=this.findElseTag("foreach\\s[^}]+","/foreach","foreachelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"foreach",params:e,subTree:r,subTreeElse:a}}},function:{type:"block",parse:function(e,t){this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]=!0;var r=this.parse(t);return this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]={tree:r,defaultParams:e},!1}},extends:{type:"function",parse:function(e){return this.loadTemplate(trimAllQuotes(e.file?e.file:e[0]),!0)}},block:{type:"block",parse:function(e,t){e.append=findInArray(e,"append")>=0,e.prepend=findInArray(e,"prepend")>=0,e.hide=findInArray(e,"hide")>=0;var r,a,n=this.parse(t,[]),s=trimAllQuotes(e.name?e.name:e[0]);return s in this.blocks?(this.outerBlocks[s]=[],this.outerBlocks[s]={tree:n,params:e},a="outer",r=t.match(/smarty.block.parent/),e.needParent=!1,r&&(e.needParent=!0)):(this.blocks[s]=[],this.blocks[s]={tree:n,params:e},a="inner",r=t.match(/smarty.block.child/),e.needChild=!1,r&&(e.needChild=!0)),{type:"build-in",name:"block",params:e,location:a}}},strip:{type:"block",parse:function(e,t){return this.parse(t.replace(/[ \t]*[\r\n]+[ \t]*/g,""))}},literal:{type:"block",parse:function(e,t){return this.parseText(t)}},ldelim:{type:"function",parse:function(e){return this.parseText(this.ldelim)}},rdelim:{type:"function",parse:function(e){return this.parseText(this.rdelim)}},while:{type:"block",parse:function(e,t){return{type:"build-in",name:"while",params:e,subTree:this.parse(t)}}}}},jSmartProcessor={tplModifiers:[],runTimePlugins:{},plugins:{},modifiers:{},defaultModifiers:{},escapeHtml:!1,variableFilters:[],outerBlocks:{},blocks:{},debugging:!1,clear:function(){this.runTimePlugins={},this.variableFilters=[],this.escapeHtml=!1,this.defaultModifiers={},this.modifiers={},this.plugins={},this.blocks={},this.outerBlocks={},this.debugging=!1,this.includedTemplates=[]},getProcessed:function(e,t){var r=this.process(e,t);return this.debugging&&this.plugins.debug.process([],{includedTemplates:this.includedTemplates,assignedVars:t}),this.clear(),{output:r.tpl,smarty:r.smarty}},process:function(e,t){for(var r,a,n,s,i="",o=0;o":return s>r;case"===":return s===r;case">=":return s>=r;case"!==":return s!==r}}},section:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={},n=r.__get("show",!0);if(t.smarty.section[r.__get("name",null,0)]=a,a.show=n,!n)return this.process(e.subTreeElse,t);var s=parseInt(r.__get("start",0),10),i=r.loop instanceof Object?countProperties(r.loop):isNaN(r.loop)?0:parseInt(r.loop),o=parseInt(r.__get("step",1),10),l=parseInt(r.__get("max"),10);isNaN(l)&&(l=Number.MAX_VALUE),s<0?(s+=i)<0&&(s=0):s>=i&&(s=i?i-1:0);var p=0,u=s;p=0;var c="";for(u=s;u>=0&&u=i,a.index=u,a.index_prev=u-o,a.index_next=u+o,a.iteration=a.rownum=p+1,a.total=p,a.loop=p;var g=this.process(e.subTree,t);void 0!==g&&(t=g.data,c+=g.tpl),t.smarty.continue=!1}return a.total=p,a.loop=p,t.smarty.break=!1,p?{tpl:c,data:t}:this.process(e.subTreeElse,t)}},setfilter:{process:function(e,t){this.tplModifiers.push(e.params);var r=this.process(e.subTree,t);return void 0!==r&&(t=r.data,r=r.tpl),this.tplModifiers.pop(),{tpl:r,data:t}}},for:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=parseInt(r.__get("from"),10),n=parseInt(r.__get("to"),10),s=parseInt(r.__get("step"),10);isNaN(s)&&(s=1);var i=parseInt(r.__get("max"),10);isNaN(i)&&(i=Number.MAX_VALUE);for(var o=0,l="",p=Math.min(Math.ceil((1+(s>0?n-a:a-n))/Math.abs(s)),i),u=parseInt(r.from,10);o0,r.name&&(t.smarty.foreach[r.name].show=i>0?1:""),i>0?s:this.process(e.subTreeElse,t)}},break:{process:function(e,t){return t.smarty.break=!0,{tpl:"",data:t}}},continue:{process:function(e,t){return t.smarty.continue=!0,{tpl:"",data:t}}},block:{process:function(e,t){var r,a,n,s=trimAllQuotes(e.params.name?e.params.name:e.params[0]),i=this.blocks[s],o=this.outerBlocks[s];return"inner"===e.location?(i.params.needChild?(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),t.smarty.block.child=a,void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r):o.params.needParent?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),t.smarty.block.parent=r,void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),n=a):(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),o.params.append?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=a+r):o.params.prepend?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r+a):n=a),n):""}},call:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={name:r.__get("name")?r.__get("name"):r.__get("0"),params:e.params},n=this.buildInFunctions.function.process.call(this,a,t),s=r.__get("assign",!1);return s?{tpl:"",data:this.assignVar(s,n,t)}:n}},include:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=r.__get("file",null,0);this.includedTemplates.push(a);var n=objectMerge({},t,r);n.smarty.template=a;var s=this.process(e.subTree,n);return void 0!==s&&(s=s.tpl),r.assign?{tpl:"",data:this.assignVar(r.assign,s,t)}:s}},function:{process:function(e,t){var r=this.runTimePlugins[e.name],a=this.getActualParamValues(r.defaultParams,t);delete a.name;var n=this.getActualParamValues(e.params,t);return this.process(r.tree,objectMerge({},t,a,n)).tpl}},while:{process:function(e,t){for(var r="";this.getActualParamValues(e.params,t)[0]&&!t.smarty.break;){var a=this.process(e.subTree,t);void 0!==a&&(t=a.data,r+=a.tpl),t.smarty.continue=!1}return t.smarty.break=!1,{tpl:r,data:t}}}}},version="3.0.2",jSmart=function(e,t){this.smarty={block:{},break:!1,capture:{},continue:!1,counter:{},cycle:{},foreach:{},section:{},now:Math.floor((new Date).getTime()/1e3),const:{},config:{},current_dir:"/",template:"",ldelim:"{",rdelim:"}",version:version},this.autoLiteral=!0,this.escapeHtml=!1,this.debugging=!1,this.outerBlocks={},this.blocks={},this.parse(e,t)};jSmart.prototype={constructor:jSmart,tree:[],scripts:{},modifiers:{},defaultModifiers:[],defaultModifiersGlobal:[],globalAndDefaultModifiers:[],filters:{variable:[],post:[]},filtersGlobal:{pre:[],variable:[],post:[]},globalAndDefaultFilters:[],buildInFunctions:{},plugins:{},runTimePlugins:{},parse:function(e,t){var r;t||(t={}),t.rdelim?this.smarty.rdelim=t.rdelim:jSmart.prototype.right_delimiter?this.smarty.rdelim=jSmart.prototype.right_delimiter:this.smarty.rdelim="}",t.ldelim?this.smarty.ldelim=t.ldelim:jSmart.prototype.left_delimiter?this.smarty.ldelim=jSmart.prototype.left_delimiter:this.smarty.ldelim="{",void 0!==t.autoLiteral?this.autoLiteral=t.autoLiteral:void 0!==jSmart.prototype.auto_literal&&(this.autoLiteral=jSmart.prototype.auto_literal),void 0!==t.debugging?this.debugging=t.debugging:void 0!==jSmart.prototype.debugging&&(this.debugging=jSmart.prototype.debugging),void 0!==t.escapeHtml?this.escapeHtml=t.escapeHtml:void 0!==jSmart.prototype.escape_html&&(this.escapeHtml=jSmart.prototype.escape_html),e=String(e||""),jSmartParser.clear(),jSmartParser.rdelim=this.smarty.rdelim,jSmartParser.ldelim=this.smarty.ldelim,jSmartParser.getTemplate=this.getTemplate,jSmartParser.getConfig=this.getConfig,jSmartParser.autoLiteral=this.autoLiteral,jSmartParser.plugins=this.plugins,jSmartParser.preFilters=this.filtersGlobal.pre,r=jSmartParser.getParsed(e),this.tree=r.tree,this.runTimePlugins=r.runTimePlugins,this.blocks=r.blocks,this.outerBlocks=r.outerBlocks},fetch:function(e){var t="";return"object"!=typeof e&&(e={}),e.smarty={},objectMerge(e.smarty,this.smarty),this.globalAndDefaultModifiers=jSmart.prototype.defaultModifiersGlobal.concat(this.defaultModifiers),this.globalAndDefaultFilters=jSmart.prototype.filtersGlobal.variable.concat(this.filters.variable),jSmartProcessor.clear(),jSmartProcessor.plugins=this.plugins,jSmartProcessor.modifiers=this.modifiers,jSmartProcessor.defaultModifiers=this.defaultModifiers,jSmartProcessor.escapeHtml=this.escapeHtml,jSmartProcessor.variableFilters=this.globalAndDefaultFilters,jSmartProcessor.runTimePlugins=this.runTimePlugins,jSmartProcessor.blocks=this.blocks,jSmartProcessor.outerBlocks=this.outerBlocks,jSmartProcessor.debugging=this.debugging,t=jSmartProcessor.getProcessed(this.tree,e,this.smarty),objectMerge(this.smarty,t.smarty),this.applyFilters(jSmart.prototype.filtersGlobal.post.concat(this.filters.post),t.output)},applyFilters:function(e,t){for(var r=0;r "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Array){n="Array (\n";for(a in e)e.hasOwnProperty(a)&&(n+=t+t+"["+a+"] => "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Boolean){var s="false";return!0===s&&(s="true"),s+"\n"}return e+"\n"},registerPlugin:function(e,t,r){"modifier"===e?this.modifiers[t]=r:this.plugins[t]={type:e,process:r}},registerFilter:function(e,t){(this.tree?this.filters:jSmart.prototype.filtersGlobal)["output"===e?"post":e].push(t)},addDefaultModifier:function(e){e instanceof Array||(e=[e]);for(var t=0;t=55296&&r<=56319){var a=r;return 1===t.length?r:1024*(a-55296)+(t.charCodeAt(1)-56320)+65536}return r},bin2Hex:function(e){var t,r,a,n="";for(t=0,r=(e+="").length;t1?a?s["&"]+e.substr(1):e:s[e]})},rawUrlDecode:function(e){return decodeURIComponent((e+"").replace(/%(?![\da-f]{2})/gi,function(){return"%25"}))},rawUrlEncode:function(e){return e+="",encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},sprintf:function(){var e=/%%|%(\d+\$)?([-+'#0 ]*)(\*\d+\$|\*|\d+)?(?:\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,r=0,a=function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},n=function(e,t,r,n,s,i){var o=n-e.length;return o>0&&(e=r||!s?a(e,n,i,r):[e.slice(0,t.length),a("",o,"0",!0),e.slice(t.length)].join("")),e},s=function(e,t,r,s,i,o,l){var p=e>>>0;return r=r&&p&&{2:"0b",8:"0",16:"0x"}[t]||"",e=r+a(p.toString(t),o||0,"0",!1),n(e,r,s,i,l)},i=function(e,t,r,a,s,i){return null!==a&&void 0!==a&&(e=e.slice(0,a)),n(e,"",t,r,s,i)};return t[r++].replace(e,function(e,o,l,p,u,c){var g,h,f,d,m;if("%%"===e)return"%";var y,v=!1,b="",_=!1,x=!1,w=" ",j=l.length;for(y=0;y-1?6:"d"===c?0:void 0,m=o?t[o.slice(0,-1)]:t[r++],c){case"s":return i(m+"",v,p,u,_,w);case"c":return i(String.fromCharCode(+m),v,p,u,_);case"b":return s(m,2,x,v,p,u,_);case"o":return s(m,8,x,v,p,u,_);case"x":return s(m,16,x,v,p,u,_);case"X":return s(m,16,x,v,p,u,_).toUpperCase();case"u":return s(m,10,x,v,p,u,_);case"i":case"d":return g=+m||0,g=Math.round(g-g%1),h=g<0?"-":b,m=h+a(String(Math.abs(g)),u,"0",!1),n(m,h,v,p,_);case"e":case"E":case"f":case"F":case"g":case"G":return g=+m,h=g<0?"-":b,f=["toExponential","toFixed","toPrecision"]["efg".indexOf(c.toLowerCase())],d=["toString","toUpperCase"]["eEfFgG".indexOf(c)%2],m=h+Math.abs(g)[f](u),phpJs.justify(m,h,v,p,_)[d]();default:return e}})},makeTimeStamp:function(e){if(!e)return Math.floor((new Date).getTime()/1e3);if(isNaN(e)){var t=phpJs.strtotime(e);return-1===t||!1===t?Math.floor((new Date).getTime()/1e3):t}return 14===(e+="").length&&-1!==e.search(/^[\d]+$/g)?phpJs.mktime(e.substr(8,2),e.substr(10,2),e.substr(12,2),e.substr(4,2),e.substr(6,2),e.substr(0,4)):Number(e)},mktime:function(){var e=new Date,t=arguments,r=0,a=["Hours","Minutes","Seconds","Month","Date","FullYear"];for(r=0;r=0?t[5]<=69?2e3:t[5]<=100?1900:0:0,e.setFullYear(t[5],t[3]-1,t[4]),e.setHours(t[0],t[1],t[2]);var n=e.getTime();return(n/1e3>>0)-(n<0)},_pad:function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},justify:function(e,t,r,a,n,s){var i=a-e.length;return i>0&&(e=r||!n?phpJs._pad(e,a,s,r):[e.slice(0,t.length),phpJs._pad("",i,"0",!0),e.slice(t.length)].join("")),e},strtotime:function(e,t){function r(e,t,r){var a,n=l[t];void 0!==n&&(0===(a=n-o.getDay())?a=7*r:a>0&&"last"===e?a-=7:a<0&&"next"===e&&(a+=7),o.setDate(o.getDate()+a))}var a,n,s,i,o,l,p,u,c,g,h;if(!e)return!1;e=e.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var f=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if((n=e.match(f))&&n[2]===n[4])if(n[1]>1901)switch(n[2]){case"-":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case".":return!1;case"/":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else if(n[5]>1901)switch(n[2]){case"-":case".":return!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case"/":return!(n[1]>12||n[3]>31)&&new Date(n[5],parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else switch(n[2]){case"-":return!(n[3]>12||n[5]>31||n[1]<70&&n[1]>38)&&(i=n[1]>=0&&n[1]<=38?+n[1]+2e3:n[1],new Date(i,parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case".":return n[5]>=70?!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3:n[5]<60&&!n[6]&&(!(n[1]>23||n[3]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0,n[9]||0)/1e3));case"/":return!(n[1]>12||n[3]>31||n[5]<70&&n[5]>38)&&(i=n[5]>=0&&n[5]<=38?+n[5]+2e3:n[5],new Date(i,parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case":":return!(n[1]>23||n[3]>59||n[5]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0)/1e3)}if("now"===e)return null===t||isNaN(t)?(new Date).getTime()/1e3|0:0|t;if(!isNaN(a=Date.parse(e)))return a/1e3|0;if(f=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),(n=e.match(f))&&("z"===n[4]?n[4]="Z":n[4].match(/^([+-][0-9]{2})$/)&&(n[4]=n[4]+":00"),!isNaN(a=Date.parse(n[1]+"T"+n[2]+n[4]))))return a/1e3|0;if(o=t?new Date(1e3*t):new Date,l={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},p={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},c="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)",g="([+-]?\\d+\\s"+c+"|(last|next)\\s"+c+")(\\sago)?",!(n=e.match(new RegExp(g,"gi"))))return!1;for(h=0,u=n.length;h1;r/=10)e=t.toString()+e;return e.toString()},a={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %r %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%m/%d/%Y",X:"%r",alt_digits:"",ERA:"",ERA_YEAR:"",ERA_D_T_FMT:"",ERA_D_FMT:"",ERA_T_FMT:""},n={a:function(e){return a.a[e.getDay()]},A:function(e){return a.A[e.getDay()]},b:function(e){return a.b[e.getMonth()]},B:function(e){return a.B[e.getMonth()]},C:function(e){return r(parseInt(e.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(e){return r(parseInt(this.G(e)/100,10),0)},G:function(e){var t=e.getFullYear(),r=parseInt(n.V(e),10),a=parseInt(n.W(e),10);return a>r?t++:0===a&&r>=52&&t--,t},H:["getHours","0"],I:function(e){var t=e.getHours()%12;return r(0===t?12:t,0)},j:function(e){var t=e-new Date(e.getFullYear()+"/1/1 GMT");t+=6e4*e.getTimezoneOffset();var a=parseInt(t/6e4/60/24,10)+1;return r(a,0,100)},k:["getHours","0"],l:function(e){var t=e.getHours()%12;return r(0===t?12:t," ")},m:function(e){return r(e.getMonth()+1,0)},M:["getMinutes","0"],p:function(e){return a.p[e.getHours()>=12?1:0]},P:function(e){return a.P[e.getHours()>=12?1:0]},s:function(e){return Date.parse(e)/1e3},S:["getSeconds","0"],u:function(e){var t=e.getDay();return 0===t?7:t},U:function(e){var t=parseInt(n.j(e),10),a=6-e.getDay(),s=parseInt((t+a)/7,10);return r(s,0)},V:function(e){var t=parseInt(n.W(e),10),a=new Date(e.getFullYear()+"/1/1").getDay(),s=t+(a>4||a<=1?0:1);return 53===s&&new Date(e.getFullYear()+"/12/31").getDay()<4?s=1:0===s&&(s=n.V(new Date(e.getFullYear()-1+"/12/31"))),r(s,0)},w:"getDay",W:function(e){var t=parseInt(n.j(e),10),a=7-n.u(e),s=parseInt((t+a)/7,10);return r(s,0,10)},y:function(e){return r(e.getFullYear()%100,0)},Y:"getFullYear",z:function(e){var t=e.getTimezoneOffset(),a=r(parseInt(Math.abs(t/60),10),0),n=r(t%60,0);return(t>0?"-":"+")+a+n},Z:function(e){return e.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(e){return"%"}},s=void 0===t?new Date:t instanceof Date?new Date(t):new Date(1e3*t),i={c:"locale",D:"%m/%d/%y",F:"%y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};e.match(/%[cDFhnrRtTxX]/);)e=e.replace(/%([cDFhnrRtTxX])/g,function(e,t){var r=i[t];return"locale"===r?a[t]:r});return e.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,function(e,t){var a=n[t];return"string"==typeof a?s[a]():"function"==typeof a?a(s):"object"==typeof a&&"string"==typeof a[0]?r(s[a[0]](),a[1]):t})}};return jSmart.prototype.registerPlugin("modifier","capitalize",function(e,t,r){if("string"!=typeof e)return e;var a=new RegExp(t?"[^a-zA-Z_à-ü]+":"[^a-zA-Z0-9_à-ü]"),n=null,s="";r&&(e=e.toLowerCase());var i;for(n=e.match(a);n;n=e.match(a))(i=e.slice(0,n.index)).match(/\d/)?s+=i:s+=i.charAt(0).toUpperCase()+i.slice(1),s+=e.slice(n.index,n.index+n[0].length),e=e.slice(n.index+n[0].length);return e.match(/\d/)?s+e:s+e.charAt(0).toUpperCase()+e.slice(1)}),jSmart.prototype.registerPlugin("modifier","cat",function(e,t){return t=t||"",String(e)+t}),jSmart.prototype.registerPlugin("modifier","count_characters",function(e,t){return e=String(e),t?e.length:e.replace(/\s/g,"").length}),jSmart.prototype.registerPlugin("modifier","count_paragraphs",function(e){var t=String(e).match(/\n+/g);return t?t.length+1:1}),jSmart.prototype.registerPlugin("modifier","count_sentences",function(e){if("string"==typeof e){var t=e.match(/\w[.?!](\W|$)/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","count_words",function(e){if("string"==typeof e){var t=e.match(/\w+/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","date_format",function(e,t,r){return phpJs.strftime(t||"%b %e, %Y",phpJs.makeTimeStamp(e||r))}),jSmart.prototype.registerPlugin("modifier","debug_print_var",function(e){console.log(e+"--");var t="";return"object"==typeof module&&module&&"object"==typeof module.exports?t="node":"object"==typeof window&&window.document&&(t="browser"),""===t?"":"browser"===t?jSmart.prototype.printR(e):void console.log(e)}),jSmart.prototype.registerPlugin("modifier","defaultValue",function(e,t){return t=t||"",e&&"null"!==e&&void 0!==e?e:t}),jSmart.prototype.registerPlugin("modifier","escape",function(e,t,r,a){e=String(e),t=t||"html",r=r||"UTF-8",a=void 0===a||Boolean(a);var n,s="";switch(t){case"html":return a&&(e=e.replace(/&/g,"&")),e.replace(//g,">").replace(/'/g,"'").replace(/"/g,""");case"htmlall":return phpJs.htmlEntities(e,3,r);case"url":return phpJs.rawUrlEncode(e);case"urlpathinfo":return phpJs.rawUrlEncode(e).replace(/%2F/g,"/");case"quotes":return e.replace(/(^|[^\\])'/g,"$1\\'");case"hex":for(s="",n=0;n=126?"&#"+i+";":e.substr(n,1)}return s;case"javascript":return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/<\//g,"")}),jSmart.prototype.registerPlugin("modifier","regex_replace",function(e,t,r){var a=t.match(/^ *\/(.*)\/(.*) *$/);return String(e).replace(new RegExp(a[1],"g"+(a.length>1?a[2]:"")),r)}),jSmart.prototype.registerPlugin("modifier","replace",function(e,t,r){if(!t)return e;e=String(e),t=String(t),r=String(r);var a="",n=-1;for(n=e.indexOf(t);n>=0;n=e.indexOf(t))a+=e.slice(0,n)+r,n+=t.length,e=e.slice(n);return a+e}),jSmart.prototype.registerPlugin("modifier","spacify",function(e,t){return t||(t=" "),String(e).replace(/(\n|.)(?!$)/g,"$1"+t)}),jSmart.prototype.registerPlugin("modifier","string_format",function(e,t){return phpJs.sprintf(t,e)}),jSmart.prototype.registerPlugin("modifier","strip",function(e,t){return t=t||" ",String(e).replace(/[\s]+/g,t)}),jSmart.prototype.registerPlugin("modifier","strip_tags",function(e,t,r){if(null===t&&(t=!0),r||!0!==t&&!1!==t&&(t+"").length>0&&(r=t,t=!0),r){var a=r.split(">");return a.splice(-1,1),e=String(e).replace(/<[^>]*?>/g,function(e,r,n){for(var s=e.match(/\w+/),i=0;i").match(/\w+/);if(s[0]===o[0])return e}return t?" ":""})}return String(e).replace(/<[^>]*?>/g,t?" ":"")}),jSmart.prototype.registerPlugin("modifier","to_charset",function(e){return e}),jSmart.prototype.registerPlugin("modifier","truncate",function(e,t,r,a,n){return e=String(e),t=t||80,r=null!=r?r:"...",e.length<=t?e:(t-=Math.min(t,r.length),n?e.slice(0,Math.floor(t/2))+r+e.slice(e.length-Math.floor(t/2)):(a||(e=e.slice(0,t+1).replace(/\s+?(\S+)?$/,"")),e.slice(0,t)+r))}),jSmart.prototype.registerPlugin("modifier","unescape",function(e,t,r){switch(e=String(e),t=t||"html",r=r||"UTF-8",t){case"html":return e.replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,'"');case"entity":case"htmlall":return phpJs.htmlEntityDecode(e,1);case"url":return phpJs.rawUrlDecode(e)}return e}),jSmart.prototype.registerPlugin("modifier","upper",function(e){return String(e).toUpperCase()}),jSmart.prototype.registerPlugin("modifier","wordwrap",function(e,t,r,a){t=t||80,r=r||"\n";for(var n=String(e).split("\n"),s=0;st;){for(var l=0,p=i.slice(l).match(/\s+/);p&&l+p.index<=t;p=i.slice(l).match(/\s+/))l+=p.index+p[0].length;l=a?t-1:l||(p?p.index+p[0].length:i.length),o+=i.slice(0,l).replace(/\s+$/,""),l=t.smarty.cycle[r].arr.length||a)&&(t.smarty.cycle[r].index=0),e.__get("assign",!1)?(this.assignVar(e.assign,t.smarty.cycle[r].arr[t.smarty.cycle[r].index],t),""):e.__get("print",!0)?t.smarty.cycle[r].arr[t.smarty.cycle[r].index]:""}),jSmart.prototype.registerPlugin("function","eval",function(e,t){var r=e.var;return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","debug",function(e,t){var r="";if("object"==typeof module&&module&&"object"==typeof module.exports?r="node":"object"==typeof window&&window.document&&(r="browser"),""===r)return"";if("browser"===r){window.jsmartDebug&&window.jsmartDebug.close(),window.jsmartDebug=window.open("","","width=680, height=600,resizable,scrollbars=yes");var a="",n="",s=0;for(var i in t.includedTemplates)a+=""+t.includedTemplates[i]+"";""!==a&&(a="

included templates

"+a+"

"),s=0;for(var o in t.assignedVars)n+="["+o+"]"+jSmart.prototype.printR(t.assignedVars[o])+"";""!==n&&(n="

assigned template variables

"+n+"
");var l="jSmart Debug Console

jSmart Debug Console


"+a+n+"
";window.jsmartDebug.document.write(l)}else"undefined"!=typeof console&&(console.log("included templates:- "+JSON.stringify(a)),console.log("assigned template variables:- "+JSON.stringify(n)));return""}),jSmart.prototype.registerPlugin("function","fetch",function(e,t){var r=jSmart.prototype.getFile(e.__get("file",null,0));return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","html_checkboxes",function(e,t){var r,a,n,s=e.__get("type","checkbox"),i=e.__get("name",s),o=i,l=e.__get("values",e.options),p=e.__get("options",[]),u="options"in e,c=e.__get("selected",!1),g=e.__get("separator",""),h=Boolean(e.__get("labels",!0)),f=Boolean(e.__get("label_ids",!1)),d=[],m=0,y="";if("checkbox"===s&&(i+="[]"),!u)for(r in e.output)p.push(e.output[r]);for(r in l)l.hasOwnProperty(r)&&(n=o+"_"+(a=u?r:l[r]),y=h?f?'";for(var x=0;x"+d["right"===g?x:d.length-1-x]+"";_+="\n"}return"
"+(i?"\n":"")+_+"\n\n"+y+"\n
"+i+"
\n"}),jSmart.prototype.registerPlugin("function","mailto",function(e,t){var r,a,n=e.__get("address",null),s=e.__get("encode","none"),i=e.__get("text",n),o=phpJs.rawUrlEncode(e.__get("cc","")).replace(/%40/g,"@").replace(/%2C/g,","),l=phpJs.rawUrlEncode(e.__get("bcc","")).replace(/%40/g,"@").replace(/%2C/g,","),p=phpJs.rawUrlEncode(e.__get("followupto","")).replace(/%40/g,"@").replace(/%2C/g,","),u=phpJs.rawUrlEncode(e.__get("subject","")),c=phpJs.rawUrlEncode(e.__get("newsgroups","")),g=e.__get("extra","");if(n+=o?"?cc="+o:"",n+=l?(o?"&":"?")+"bcc="+l:"",n+=u?(o||l?"&":"?")+"subject="+u:"",n+=c?(o||l||u?"&":"?")+"newsgroups="+c:"",n+=p?(o||l||u||c?"&":"?")+"followupto="+p:"",r='"+i+"","javascript"===s){r="document.write('"+r+"');";var h="";for(a=0;aeval(unescape(\''+h+"'))<\/script>"}if("javascript_charcode"===s){var f=[];for(a=0;a\n\x3c!--\n{document.write(String.fromCharCode('+f.join(",")+"))}\n//--\x3e\n<\/script>\n"}if("hex"===s){if(n.match(/^.+\?.+$/))throw new Error("mailto: hex encoding does not work with extra attributes. Try javascript.");var d="";for(a=0;a"+m+""}return r}),jSmart.prototype.registerPlugin("function","math",function(params,data){var equation=params.__get("equation",null).replace(/pi\(\s*\)/g,"PI");equation=equation.replace(/ceil/g,"Math.ceil").replace(/abs/g,"Math.abs").replace(/cos/g,"Math.cos").replace(/exp/g,"Math.exp").replace(/floor/g,"Math.floor").replace(/log/g,"Math.log").replace(/max/g,"Math.max").replace(/min/g,"Math.min").replace(/PI/g,"Math.PI").replace(/pow/g,"Math.pow").replace(/rand/g,"Math.rand").replace(/round/g,"Math.round").replace(/sin/g,"Math.sin").replace(/sqrt/g,"Math.sqrt").replace(/srans/g,"Math.srans").replace(/tan/g,"Math.tan");var words=equation.match(/\w+/g),i,j,tmp,banned=["ceil","abs","cos","exp","floor","log10","log","max","min","pi","pow","rand","round","sin","sqrt","srans","tan"];for(i=0;i(words[j+1]+"").length&&(tmp=words[j],words[j]=words[j+1],words[j+1]=tmp);for(i=0;i0&&(f=c+f),f=this.modifiers.wordwrap(f,n-l,s,i),l>0&&(f=f.replace(/^/gm,p)),g[h]=f)}var d=g.join(s+s);return"assign"in e?(this.assignVar(e.assign,d,r),""):d}),String.prototype.fetch=function(e){return new jSmart(this).fetch(e)},jSmart}); \ No newline at end of file +!function(e){"use strict";"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=e():("object"==typeof window&&window.document&&(window.jSmart=e()),"function"==typeof define&&define.amd&&define("jSmart",[],e))}(function(){"use strict";function objectMerge(e,t){for(var r=1;r0){for(var r=[],a=0;a2?r[2].replace(/^\s+|\s+$/g,""):"",a in this.buildInFunctions){var p=this.buildInFunctions[a],u=("parseParams"in p?p.parseParams.bind(this):this.parseParams.bind(this))(n);if("block"===p.type){e=e.replace(/^\n/,""),i=this.findCloseTag("/"+a,a+" +[^}]*",e);var c=p.parse.call(this,u,e.slice(0,i.index));c&&(o=o.concat(c)),e=e.slice(i.index+i[0].length)}else"extends"===a&&o.splice(0,o.length),o=o.concat(p.parse.call(this,u)),"extends"===a&&(l=o.length);e=e.replace(/^\n/,"")}else if(a in this.runTimePlugins)o=o.concat(this.parsePluginFunc(a,this.parseParams(n)));else if(a in this.plugins){var g=this.plugins[a];"block"===g.type?(i=this.findCloseTag("/"+a,a+" +[^}]*",e),o=o.concat(this.parsePluginBlock(a,this.parseParams(n),e.slice(0,i.index))),e=e.slice(i.index+i[0].length)):"function"===g.type&&(o=o.concat(this.parsePluginFunc(a,this.parseParams(n)))),"append"!==a&&"assign"!==a&&"capture"!==a&&"eval"!==a&&"include"!==a||(e=e.replace(/^\n/,""))}else s=this.buildInFunctions.expression.parse.call(this,t[1]),o.push(s);else"build-in"===(s=this.buildInFunctions.expression.parse.call(this,t[1])).expression.type&&"operator"===s.expression.name&&"="===s.expression.op&&(e=e.replace(/^\n/,"")),o.push(s);return e&&(o=o.concat(this.parseText(e))),o.usedExtends=l,o},findTag:function(e,t){var r,a,n,s=0,i=0,o=this.ldelim,l=this.rdelim,p=this.autoLiteral,u=/^\s*(.+)\s*$/i,c=e?new RegExp("^\\s*("+e+")\\s*$","i"):u;for(r=0;r=0&&t.substr(r-1,1).match(/\s/))continue;if(!--s&&(a=t.slice(o.length,r).replace(/[\r\n]/g," "),n=a.match(c)))return n.index=i,n[0]=t.slice(0,r+l.length),n;s<0&&(s=0)}return null},findElseTag:function(e,t,r,a){for(var n=0,s=this.findTag(r,a);s;s=this.findTag(r,a)){var i=this.findTag(e,a);if(!i||i.index>s.index)return s.index+=n,s;a=a.slice(i.index+i[0].length),n+=i.index+i[0].length;var o=this.findCloseTag(t,e,a);a=a.slice(o.index+o[0].length),n+=o.index+o[0].length}return null},findCloseTag:function(e,t,r){var a="",n=null,s=null,i=0;do{if(n&&(i+=n[0].length),!(n=this.findTag(e,r)))throw new Error("Unclosed "+this.ldelim+t+this.rdelim);a+=r.slice(0,n.index),i+=n.index,r=r.slice(n.index+n[0].length),(s=this.findTag(t,a))&&(a=a.slice(s.index+s[0].length))}while(s);return n.index=i,n},bundleOp:function(e,t,r){var a=t[e];if("operator"===a.name&&a.precedence===r&&!a.params.__parsed){if("binary"===a.optype)return a.params.__parsed=[t[e-1],t[e+1]],t.splice(e-1,3,a),[!0,t];if("post-unary"===a.optype)return a.params.__parsed=[t[e-1]],t.splice(e-1,2,a),[!0,t];a.params.__parsed=[t[e+1]],t.splice(e,2,a)}return[!1,t]},composeExpression:function(e){var t,r=0;for(r=0;r0;--r)r-=(t=this.bundleOp(r-1,e,a))[0],e=t[1];else for(r=0;r\s*|\[\s*)/,i={value:"",tree:[]},o="",l=[{type:"text",data:t.replace(/^(\w+)@(key|index|iteration|first|last|show|total)/gi,"$1__$2")}],p=r;for(r||(p=r=t),a=e.match(s);a;a=e.match(s)){if(r+=a[0],e=e.slice(a[0].length),a[0].match(/\[/)){(i=this.parseExpression(e,!0)).tree&&(r+=i.value,l.push(i.tree),e=e.slice(i.value.length));var u=e.match(/\s*\]/);u&&(r+=u[0],e=e.slice(u[0].length))}else{var c=this.parseModifiersStop;if(this.parseModifiersStop=!0,n=this.lookUp(e,""))if(i.tree=[].concat(i.tree,n.tree),i.value=n.value,r+=n.value,n.ret){var g=i.tree[i.tree.length-1];"plugin"===g.type&&"__func"===g.name&&(g.hasOwner=!0),l.push(g),e=e.slice(i.value.length)}else i=!1;this.parseModifiersStop=c}i||l.push({type:"text",data:""})}return o=r.substr(p.length),{s:e,token:r,tree:[{type:"var",parts:l}],value:o}},parseFunc:function(e,t,r){return t.__parsed.name=this.parseText(e,[])[0],r.push({type:"plugin",name:"__func",params:t}),r},parseOperator:function(e,t,r){return[{type:"build-in",name:"operator",op:e,optype:t,precedence:r,params:{}}]},parsePluginBlock:function(e,t,r){return[{type:"plugin",name:e,params:t,subTree:this.parse(r,[])}]},parsePluginFunc:function(e,t){return[{type:"plugin",name:e,params:t}]},parseModifiers:function(e,t){var r,a=e.match(/^\|(\w+)/),n="";if(!this.parseModifiersStop&&a){n+=a[0],r="default"===a[1]?"defaultValue":a[1],e=e.slice(a[0].length).replace(/^\s+/,""),this.parseModifiersStop=!0;for(var s=[],i=e.match(/^\s*:\s*/);i;i=e.match(/^\s*:\s*/)){n+=e.slice(0,i[0].length),e=e.slice(i[0].length);var o=this.lookUp(e,"");o.ret?(n+=o.value,s.push(o.tree[0]),e=e.slice(o.value.length)):s.push(this.parseText(""))}this.parseModifiersStop=!1,s.unshift(t.pop());var l=this.parseFunc(r,{__parsed:s},[]);t.push(l[0]);var p=this.parseModifiers(e,t);return p&&(t=t.concat(p.tree)),{value:n,tree:t}}},parseParams:function(e,t,r){var a=e.replace(/\n/g," ").replace(/^\s+|\s+$/g,""),n=[];if(e="",n.__parsed=[],!a)return n;for(t||(t=/^\s+/,r=/^(\w+)\s*=\s*/);a;){var s=null;if(r){var i=a.match(r);if(i){var o=i[1].charAt(0).match(/^\d+/);"true"!==i[1]&&"false"!==i[1]&&"null"!==i[1]||(o=!0),o||(s=trimAllQuotes(i[1]),e+=a.slice(0,i[0].length),a=a.slice(i[0].length))}}var l=this.parseExpression(a);if(!l)break;s?(n[s]=l.value,n.__parsed[s]=l.tree):(n.push(l.value),n.__parsed.push(l.tree)),e+=a.slice(0,l.value.length);var p=(a=a.slice(l.value.length)).match(t);if(!p)break;e+=a.slice(0,p[0].length),a=a.slice(p[0].length)}return n.toString=function(){return e},n},lookUp:function(e,t){var r,a=[];if(!e)return!1;if(e.substr(0,this.ldelim.length)===this.ldelim&&(r=this.findTag("",e),t+=r[0],r)){var n=this.parse(r[0]);a=a.concat(n);var s=this.parseModifiers(e.slice(t.length),a);return s?{ret:!0,tree:s.tree,value:s.value}:{ret:!0,tree:a,value:t}}var i=this.getMatchingToken(e);if(!1!==i){t+=RegExp.lastMatch;var o=this.tokens[i].parse.call(this,e.slice(RegExp.lastMatch.length),{tree:a,token:RegExp.lastMatch});if("string"==typeof o)if("parenStart"===o){var l=[];a.push(l),l.parent=a,a=l}else"parenEnd"===o&&a.parent&&(a=a.parent);else o&&o.constructor===Object?(t+=o.value,o=o.tree,a=a.concat(o)):a=a.concat(o);return{ret:!0,tree:a,value:t}}return{ret:!1,tree:a,value:t}},parseExpression:function(e){var t,r=[],a="";for(this.lastTreeInExpression=r;;){if(!(t=this.lookUp(e.slice(a.length),a)))break;if(r=r.concat(t.tree),a=t.value,this.lastTreeInExpression=r,!t.ret)break}return r.length&&(r=this.composeExpression(r)),{tree:r,value:a}},parseBool:function(e){return[{type:"boolean",data:e}]},parseText:function(e){var t=[];if(this.parseEmbeddedVars)for(var r=/([$][\w@]+)|`([^`]*)`/,a=r.exec(e);a;a=r.exec(e)){t.push({type:"text",data:e.slice(0,a.index)});var n=this.parseExpression(a[1]?a[1]:a[2]);t.push(n.tree),e=e.slice(a.index+a[0].length)}return t.push({type:"text",data:e}),t},loadTemplate:function(e,t){var r=[];if(!t&&e in this.files)r=this.files[e];else{var a=this.getTemplate(e);if("string"!=typeof a)throw new Error("No template for "+e);r=this.getTree(a),this.files[e]=r}return r},removeComments:function(e){for(var t=new RegExp(this.ldelim+"\\*"),r=new RegExp("\\*"+this.rdelim),a="",n=e.match(t);n;n=e.match(r)){a+=e.slice(0,n.index);var s=(e=e.slice(n.index+n[0].length)).match(r);if(!s)throw new Error("Unclosed "+t+"*");e=e.slice(s.index+s[0].length)}return a+e},applyFilters:function(e,t){for(var r=0;r=|<>|<|>)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1.replace(/<>/,"!="),"binary",5)}},{regex:/^\s+(lt|lte|le|gt|gte|ge)\s+/i,parse:function(e,t){var r=RegExp.$1.replace(/l(t)?e/,"<").replace(/lt/,"<=").replace(/g(t)?e/,">").replace(/gt/,">=");return this.parseOperator(r,"binary",5)}},{regex:/^\s+(is\s+(not\s+)?div\s+by)\s+/i,parse:function(e,t){return this.parseOperator(RegExp.$2?"div_not":"div","binary",7)}},{regex:/^\s+is\s+(not\s+)?(even|odd)(\s+by\s+)?\s*/i,parse:function(e,t){var r=RegExp.$1?"odd"===RegExp.$2?"even":"even_not":"odd"===RegExp.$2?"even_not":"even",a=this.parseOperator(r,"binary",7);return RegExp.$3?a:a.concat(this.parseText("1",a))}},{regex:/^\s*(&&)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",8)}},{regex:/^\s*(\|\|)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",9)}},{regex:/^\s+and\s+/i,parse:function(e,t){return this.parseOperator("&&","binary",11)}},{regex:/^\s+xor\s+/i,parse:function(e,t){return this.parseOperator("xor","binary",12)}},{regex:/^\s+or\s+/i,parse:function(e,t){return this.parseOperator("||","binary",13)}},{regex:/^#(\w+)#/,parse:function(e,t){var r=this.parseVar(".config."+RegExp.$1,"smarty","$smarty"),a=this.parseModifiers(r.s,r.tree);return a?(r.value+=a.value,a):r}},{regex:/^\s*\[\s*/,parse:function(e,t){var r=this.parseParams(e,/^\s*,\s*/,/^('[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|\w+)\s*=>\s*/),a=this.parsePluginFunc("__array",r),n=r.toString(),s=e.slice(r.toString().length).match(/\s*\]/);return s&&(n+=s[0]),{tree:a,value:n}}},{regex:/^[\d.]+/,parse:function(e,t){t.token.indexOf(".")>-1?t.token=parseFloat(t.token):t.token=parseInt(t.token,10);var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}},{regex:/^\w+/,parse:function(e,t){var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}}],buildInFunctions:{expression:{parse:function(e){var t=this.parseExpression(e);return{type:"build-in",name:"expression",expression:t.tree,params:this.parseParams(e.slice(t.value.length).replace(/^\s+|\s+$/g,""))}}},section:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("section [^}]+","/section","sectionelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"section",params:e,subTree:r,subTreeElse:a}}},setfilter:{type:"block",parseParams:function(e){return[this.parseExpression("__t()|"+e).tree]},parse:function(e,t){return{type:"build-in",name:"setfilter",params:e,subTree:this.parse(t)}}},config_load:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]);return{type:"build-in",name:"config_load",params:e,content:this.getConfig(t),section:trimAllQuotes(e.section?e.section:e[1]?e[1]:"")}}},append:{type:"function",parse:function(e){return{type:"build-in",name:"append",params:e}}},assign:{type:"function",parse:function(e){return{type:"build-in",name:"assign",params:e}}},break:{type:"function",parse:function(e){return{type:"build-in",name:"break",params:e}}},continue:{type:"function",parse:function(e){return{type:"build-in",name:"continue",params:e}}},call:{type:"function",parse:function(e){return{type:"build-in",name:"call",params:e}}},capture:{type:"block",parse:function(e,t){return{type:"build-in",name:"capture",params:e,subTree:this.parse(t)}}},nocache:{type:"block",parse:function(e,t){return{type:"build-in",name:"nocache",params:e,subTree:this.parse(t)}}},eval:{type:"function",parse:function(e){return this.parsePluginFunc("eval",e)}},include:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]),r=findInArray(e,"nocache")>=0;return{type:"build-in",name:"include",params:e,subTree:this.loadTemplate(t,r)}}},for:{type:"block",parseParams:function(e){var t=e.match(/^\s*\$(\w+)\s*=\s*([^\s]+)\s*to\s*([^\s]+)\s*(?:step\s*([^\s]+))?\s*(.*)$/);if(!t)throw new Error("Invalid {for} parameters: "+e);return this.parseParams("varName='"+t[1]+"' from="+t[2]+" to="+t[3]+" step="+(t[4]?t[4]:"1")+" "+t[5])},parse:function(e,t){var r=[],a=[],n=this.findElseTag("for\\s[^}]+","/for","forelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length))):r=this.parse(t),{type:"build-in",name:"for",params:e,subTree:r,subTreeElse:a}}},if:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("if\\s+[^}]+","/if","else[^}]*",t);if(n){r=this.parse(t.slice(0,n.index)),t=t.slice(n.index+n[0].length);var s=n[1].match(/^else\s*if(.*)/);a=s?this.buildInFunctions.if.parse.call(this,this.parseParams(s[1]),t.replace(/^\n/,"")):this.parse(t.replace(/^\n/,""))}else r=this.parse(t);return[{type:"build-in",name:"if",params:e,subTreeIf:r,subTreeElse:a}]}},foreach:{type:"block",parseParams:function(e){var t=e.match(/^\s*([$].+)\s*as\s*[$](\w+)\s*(=>\s*[$](\w+))?\s*$/i);return t&&(e="from="+t[1]+" item="+(t[4]||t[2]),t[4]&&(e+=" key="+t[2])),this.parseParams(e)},parse:function(e,t){var r=[],a=[],n=this.findElseTag("foreach\\s[^}]+","/foreach","foreachelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"foreach",params:e,subTree:r,subTreeElse:a}}},function:{type:"block",parse:function(e,t){this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]=!0;var r=this.parse(t);return this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]={tree:r,defaultParams:e},!1}},extends:{type:"function",parse:function(e){return this.loadTemplate(trimAllQuotes(e.file?e.file:e[0]),!0)}},block:{type:"block",parse:function(e,t){e.append=findInArray(e,"append")>=0,e.prepend=findInArray(e,"prepend")>=0,e.hide=findInArray(e,"hide")>=0;var r,a,n=this.parse(t,[]),s=trimAllQuotes(e.name?e.name:e[0]);return s in this.blocks?(this.outerBlocks[s]=[],this.outerBlocks[s]={tree:n,params:e},a="outer",r=t.match(/smarty.block.parent/),e.needParent=!1,r&&(e.needParent=!0)):(this.blocks[s]=[],this.blocks[s]={tree:n,params:e},a="inner",r=t.match(/smarty.block.child/),e.needChild=!1,r&&(e.needChild=!0)),{type:"build-in",name:"block",params:e,location:a}}},strip:{type:"block",parse:function(e,t){return this.parse(t.replace(/[ \t]*[\r\n]+[ \t]*/g,""))}},literal:{type:"block",parse:function(e,t){return this.parseText(t)}},ldelim:{type:"function",parse:function(e){return this.parseText(this.ldelim)}},rdelim:{type:"function",parse:function(e){return this.parseText(this.rdelim)}},while:{type:"block",parse:function(e,t){return{type:"build-in",name:"while",params:e,subTree:this.parse(t)}}}}},jSmartProcessor={tplModifiers:[],runTimePlugins:{},plugins:{},modifiers:{},defaultModifiers:{},escapeHtml:!1,variableFilters:[],outerBlocks:{},blocks:{},debugging:!1,clear:function(){this.runTimePlugins={},this.variableFilters=[],this.escapeHtml=!1,this.defaultModifiers={},this.modifiers={},this.plugins={},this.blocks={},this.outerBlocks={},this.debugging=!1,this.includedTemplates=[]},getProcessed:function(e,t){var r=this.process(e,t);return this.debugging&&this.plugins.debug.process([],{includedTemplates:this.includedTemplates,assignedVars:t}),this.clear(),{output:r.tpl,smarty:r.smarty}},process:function(e,t){for(var r,a,n,s,i="",o=0;o":return s>r;case"===":return s===r;case">=":return s>=r;case"!==":return s!==r}}},section:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={},n=r.__get("show",!0);if(t.smarty.section[r.__get("name",null,0)]=a,a.show=n,!n)return this.process(e.subTreeElse,t);var s=parseInt(r.__get("start",0),10),i=r.loop instanceof Object?countProperties(r.loop):isNaN(r.loop)?0:parseInt(r.loop),o=parseInt(r.__get("step",1),10),l=parseInt(r.__get("max"),10);isNaN(l)&&(l=Number.MAX_VALUE),s<0?(s+=i)<0&&(s=0):s>=i&&(s=i?i-1:0);var p=0,u=s;p=0;var c="";for(u=s;u>=0&&u=i,a.index=u,a.index_prev=u-o,a.index_next=u+o,a.iteration=a.rownum=p+1,a.total=p,a.loop=p;var g=this.process(e.subTree,t);void 0!==g&&(t=g.data,c+=g.tpl),t.smarty.continue=!1}return a.total=p,a.loop=p,t.smarty.break=!1,p?{tpl:c,data:t}:this.process(e.subTreeElse,t)}},setfilter:{process:function(e,t){this.tplModifiers.push(e.params);var r=this.process(e.subTree,t);return void 0!==r&&(t=r.data,r=r.tpl),this.tplModifiers.pop(),{tpl:r,data:t}}},for:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=parseInt(r.__get("from"),10),n=parseInt(r.__get("to"),10),s=parseInt(r.__get("step"),10);isNaN(s)&&(s=1);var i=parseInt(r.__get("max"),10);isNaN(i)&&(i=Number.MAX_VALUE);for(var o=0,l="",p=Math.min(Math.ceil((1+(s>0?n-a:a-n))/Math.abs(s)),i),u=parseInt(r.from,10);o0,r.name&&(t.smarty.foreach[r.name].show=i>0?1:""),i>0?s:this.process(e.subTreeElse,t)}},break:{process:function(e,t){return t.smarty.break=!0,{tpl:"",data:t}}},continue:{process:function(e,t){return t.smarty.continue=!0,{tpl:"",data:t}}},block:{process:function(e,t){var r,a,n,s=trimAllQuotes(e.params.name?e.params.name:e.params[0]),i=this.blocks[s],o=this.outerBlocks[s];return"inner"===e.location?(i.params.needChild?(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),t.smarty.block.child=a,void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r):o.params.needParent?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),t.smarty.block.parent=r,void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),n=a):(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),o.params.append?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=a+r):o.params.prepend?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r+a):n=a),n):""}},call:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={name:r.__get("name")?r.__get("name"):r.__get("0"),params:e.params},n=this.buildInFunctions.function.process.call(this,a,t),s=r.__get("assign",!1);return s?{tpl:"",data:this.assignVar(s,n,t)}:n}},include:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=r.__get("file",null,0);this.includedTemplates.push(a);var n=objectMerge({},t,r);n.smarty.template=a;var s=this.process(e.subTree,n);return void 0!==s&&(s=s.tpl),r.assign?{tpl:"",data:this.assignVar(r.assign,s,t)}:s}},function:{process:function(e,t){var r=this.runTimePlugins[e.name],a=this.getActualParamValues(r.defaultParams,t);delete a.name;var n=this.getActualParamValues(e.params,t);return this.process(r.tree,objectMerge({},t,a,n)).tpl}},while:{process:function(e,t){for(var r="";this.getActualParamValues(e.params,t)[0]&&!t.smarty.break;){var a=this.process(e.subTree,t);void 0!==a&&(t=a.data,r+=a.tpl),t.smarty.continue=!1}return t.smarty.break=!1,{tpl:r,data:t}}}}},version="3.0.3",jSmart=function(e,t){this.smarty={block:{},break:!1,capture:{},continue:!1,counter:{},cycle:{},foreach:{},section:{},now:Math.floor((new Date).getTime()/1e3),const:{},config:{},current_dir:"/",template:"",ldelim:"{",rdelim:"}",version:version},this.autoLiteral=!0,this.escapeHtml=!1,this.debugging=!1,this.outerBlocks={},this.blocks={},this.parse(e,t)};jSmart.prototype={constructor:jSmart,tree:[],scripts:{},modifiers:{},defaultModifiers:[],defaultModifiersGlobal:[],globalAndDefaultModifiers:[],filters:{variable:[],post:[]},filtersGlobal:{pre:[],variable:[],post:[]},globalAndDefaultFilters:[],buildInFunctions:{},plugins:{},runTimePlugins:{},parse:function(e,t){var r;t||(t={}),t.rdelim?this.smarty.rdelim=t.rdelim:jSmart.prototype.right_delimiter?this.smarty.rdelim=jSmart.prototype.right_delimiter:this.smarty.rdelim="}",t.ldelim?this.smarty.ldelim=t.ldelim:jSmart.prototype.left_delimiter?this.smarty.ldelim=jSmart.prototype.left_delimiter:this.smarty.ldelim="{",void 0!==t.autoLiteral?this.autoLiteral=t.autoLiteral:void 0!==jSmart.prototype.auto_literal&&(this.autoLiteral=jSmart.prototype.auto_literal),void 0!==t.debugging?this.debugging=t.debugging:void 0!==jSmart.prototype.debugging&&(this.debugging=jSmart.prototype.debugging),void 0!==t.escapeHtml?this.escapeHtml=t.escapeHtml:void 0!==jSmart.prototype.escape_html&&(this.escapeHtml=jSmart.prototype.escape_html),e=String(e||""),jSmartParser.clear(),jSmartParser.rdelim=this.smarty.rdelim,jSmartParser.ldelim=this.smarty.ldelim,jSmartParser.getTemplate=this.getTemplate,jSmartParser.getConfig=this.getConfig,jSmartParser.autoLiteral=this.autoLiteral,jSmartParser.plugins=this.plugins,jSmartParser.preFilters=this.filtersGlobal.pre,r=jSmartParser.getParsed(e),this.tree=r.tree,this.runTimePlugins=r.runTimePlugins,this.blocks=r.blocks,this.outerBlocks=r.outerBlocks},fetch:function(e){var t="";return"object"!=typeof e&&(e={}),e.smarty={},objectMerge(e.smarty,this.smarty),this.globalAndDefaultModifiers=jSmart.prototype.defaultModifiersGlobal.concat(this.defaultModifiers),this.globalAndDefaultFilters=jSmart.prototype.filtersGlobal.variable.concat(this.filters.variable),jSmartProcessor.clear(),jSmartProcessor.plugins=this.plugins,jSmartProcessor.modifiers=this.modifiers,jSmartProcessor.defaultModifiers=this.defaultModifiers,jSmartProcessor.escapeHtml=this.escapeHtml,jSmartProcessor.variableFilters=this.globalAndDefaultFilters,jSmartProcessor.runTimePlugins=this.runTimePlugins,jSmartProcessor.blocks=this.blocks,jSmartProcessor.outerBlocks=this.outerBlocks,jSmartProcessor.debugging=this.debugging,t=jSmartProcessor.getProcessed(this.tree,e,this.smarty),objectMerge(this.smarty,t.smarty),this.applyFilters(jSmart.prototype.filtersGlobal.post.concat(this.filters.post),t.output)},applyFilters:function(e,t){for(var r=0;r "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Array){n="Array (\n";for(a in e)e.hasOwnProperty(a)&&(n+=t+t+"["+a+"] => "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Boolean){var s="false";return!0===s&&(s="true"),s+"\n"}return e+"\n"},registerPlugin:function(e,t,r){"modifier"===e?this.modifiers[t]=r:this.plugins[t]={type:e,process:r}},registerFilter:function(e,t){(this.tree?this.filters:jSmart.prototype.filtersGlobal)["output"===e?"post":e].push(t)},addDefaultModifier:function(e){e instanceof Array||(e=[e]);for(var t=0;t=55296&&r<=56319){var a=r;return 1===t.length?r:1024*(a-55296)+(t.charCodeAt(1)-56320)+65536}return r},bin2Hex:function(e){var t,r,a,n="";for(t=0,r=(e+="").length;t1?a?s["&"]+e.substr(1):e:s[e]})},rawUrlDecode:function(e){return decodeURIComponent((e+"").replace(/%(?![\da-f]{2})/gi,function(){return"%25"}))},rawUrlEncode:function(e){return e+="",encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},sprintf:function(){var e=/%%|%(\d+\$)?([-+'#0 ]*)(\*\d+\$|\*|\d+)?(?:\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,r=0,a=function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},n=function(e,t,r,n,s,i){var o=n-e.length;return o>0&&(e=r||!s?a(e,n,i,r):[e.slice(0,t.length),a("",o,"0",!0),e.slice(t.length)].join("")),e},s=function(e,t,r,s,i,o,l){var p=e>>>0;return r=r&&p&&{2:"0b",8:"0",16:"0x"}[t]||"",e=r+a(p.toString(t),o||0,"0",!1),n(e,r,s,i,l)},i=function(e,t,r,a,s,i){return null!==a&&void 0!==a&&(e=e.slice(0,a)),n(e,"",t,r,s,i)};return t[r++].replace(e,function(e,o,l,p,u,c){var g,h,f,d,m;if("%%"===e)return"%";var y,v=!1,b="",_=!1,x=!1,w=" ",j=l.length;for(y=0;y-1?6:"d"===c?0:void 0,m=o?t[o.slice(0,-1)]:t[r++],c){case"s":return i(m+"",v,p,u,_,w);case"c":return i(String.fromCharCode(+m),v,p,u,_);case"b":return s(m,2,x,v,p,u,_);case"o":return s(m,8,x,v,p,u,_);case"x":return s(m,16,x,v,p,u,_);case"X":return s(m,16,x,v,p,u,_).toUpperCase();case"u":return s(m,10,x,v,p,u,_);case"i":case"d":return g=+m||0,g=Math.round(g-g%1),h=g<0?"-":b,m=h+a(String(Math.abs(g)),u,"0",!1),n(m,h,v,p,_);case"e":case"E":case"f":case"F":case"g":case"G":return g=+m,h=g<0?"-":b,f=["toExponential","toFixed","toPrecision"]["efg".indexOf(c.toLowerCase())],d=["toString","toUpperCase"]["eEfFgG".indexOf(c)%2],m=h+Math.abs(g)[f](u),phpJs.justify(m,h,v,p,_)[d]();default:return e}})},makeTimeStamp:function(e){if(!e)return Math.floor((new Date).getTime()/1e3);if(isNaN(e)){var t=phpJs.strtotime(e);return-1===t||!1===t?Math.floor((new Date).getTime()/1e3):t}return 14===(e+="").length&&-1!==e.search(/^[\d]+$/g)?phpJs.mktime(e.substr(8,2),e.substr(10,2),e.substr(12,2),e.substr(4,2),e.substr(6,2),e.substr(0,4)):Number(e)},mktime:function(){var e=new Date,t=arguments,r=0,a=["Hours","Minutes","Seconds","Month","Date","FullYear"];for(r=0;r=0?t[5]<=69?2e3:t[5]<=100?1900:0:0,e.setFullYear(t[5],t[3]-1,t[4]),e.setHours(t[0],t[1],t[2]);var n=e.getTime();return(n/1e3>>0)-(n<0)},_pad:function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},justify:function(e,t,r,a,n,s){var i=a-e.length;return i>0&&(e=r||!n?phpJs._pad(e,a,s,r):[e.slice(0,t.length),phpJs._pad("",i,"0",!0),e.slice(t.length)].join("")),e},strtotime:function(e,t){function r(e,t,r){var a,n=l[t];void 0!==n&&(0===(a=n-o.getDay())?a=7*r:a>0&&"last"===e?a-=7:a<0&&"next"===e&&(a+=7),o.setDate(o.getDate()+a))}var a,n,s,i,o,l,p,u,c,g,h;if(!e)return!1;e=e.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var f=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if((n=e.match(f))&&n[2]===n[4])if(n[1]>1901)switch(n[2]){case"-":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case".":return!1;case"/":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else if(n[5]>1901)switch(n[2]){case"-":case".":return!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case"/":return!(n[1]>12||n[3]>31)&&new Date(n[5],parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else switch(n[2]){case"-":return!(n[3]>12||n[5]>31||n[1]<70&&n[1]>38)&&(i=n[1]>=0&&n[1]<=38?+n[1]+2e3:n[1],new Date(i,parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case".":return n[5]>=70?!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3:n[5]<60&&!n[6]&&(!(n[1]>23||n[3]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0,n[9]||0)/1e3));case"/":return!(n[1]>12||n[3]>31||n[5]<70&&n[5]>38)&&(i=n[5]>=0&&n[5]<=38?+n[5]+2e3:n[5],new Date(i,parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case":":return!(n[1]>23||n[3]>59||n[5]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0)/1e3)}if("now"===e)return null===t||isNaN(t)?(new Date).getTime()/1e3|0:0|t;if(!isNaN(a=Date.parse(e)))return a/1e3|0;if(f=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),(n=e.match(f))&&("z"===n[4]?n[4]="Z":n[4].match(/^([+-][0-9]{2})$/)&&(n[4]=n[4]+":00"),!isNaN(a=Date.parse(n[1]+"T"+n[2]+n[4]))))return a/1e3|0;if(o=t?new Date(1e3*t):new Date,l={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},p={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},c="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)",g="([+-]?\\d+\\s"+c+"|(last|next)\\s"+c+")(\\sago)?",!(n=e.match(new RegExp(g,"gi"))))return!1;for(h=0,u=n.length;h1;r/=10)e=t.toString()+e;return e.toString()},a={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %r %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%m/%d/%Y",X:"%r",alt_digits:"",ERA:"",ERA_YEAR:"",ERA_D_T_FMT:"",ERA_D_FMT:"",ERA_T_FMT:""},n={a:function(e){return a.a[e.getDay()]},A:function(e){return a.A[e.getDay()]},b:function(e){return a.b[e.getMonth()]},B:function(e){return a.B[e.getMonth()]},C:function(e){return r(parseInt(e.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(e){return r(parseInt(this.G(e)/100,10),0)},G:function(e){var t=e.getFullYear(),r=parseInt(n.V(e),10),a=parseInt(n.W(e),10);return a>r?t++:0===a&&r>=52&&t--,t},H:["getHours","0"],I:function(e){var t=e.getHours()%12;return r(0===t?12:t,0)},j:function(e){var t=e-new Date(e.getFullYear()+"/1/1 GMT");t+=6e4*e.getTimezoneOffset();var a=parseInt(t/6e4/60/24,10)+1;return r(a,0,100)},k:["getHours","0"],l:function(e){var t=e.getHours()%12;return r(0===t?12:t," ")},m:function(e){return r(e.getMonth()+1,0)},M:["getMinutes","0"],p:function(e){return a.p[e.getHours()>=12?1:0]},P:function(e){return a.P[e.getHours()>=12?1:0]},s:function(e){return Date.parse(e)/1e3},S:["getSeconds","0"],u:function(e){var t=e.getDay();return 0===t?7:t},U:function(e){var t=parseInt(n.j(e),10),a=6-e.getDay(),s=parseInt((t+a)/7,10);return r(s,0)},V:function(e){var t=parseInt(n.W(e),10),a=new Date(e.getFullYear()+"/1/1").getDay(),s=t+(a>4||a<=1?0:1);return 53===s&&new Date(e.getFullYear()+"/12/31").getDay()<4?s=1:0===s&&(s=n.V(new Date(e.getFullYear()-1+"/12/31"))),r(s,0)},w:"getDay",W:function(e){var t=parseInt(n.j(e),10),a=7-n.u(e),s=parseInt((t+a)/7,10);return r(s,0,10)},y:function(e){return r(e.getFullYear()%100,0)},Y:"getFullYear",z:function(e){var t=e.getTimezoneOffset(),a=r(parseInt(Math.abs(t/60),10),0),n=r(t%60,0);return(t>0?"-":"+")+a+n},Z:function(e){return e.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(e){return"%"}},s=void 0===t?new Date:t instanceof Date?new Date(t):new Date(1e3*t),i={c:"locale",D:"%m/%d/%y",F:"%y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};e.match(/%[cDFhnrRtTxX]/);)e=e.replace(/%([cDFhnrRtTxX])/g,function(e,t){var r=i[t];return"locale"===r?a[t]:r});return e.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,function(e,t){var a=n[t];return"string"==typeof a?s[a]():"function"==typeof a?a(s):"object"==typeof a&&"string"==typeof a[0]?r(s[a[0]](),a[1]):t})}};return jSmart.prototype.registerPlugin("modifier","capitalize",function(e,t,r){if("string"!=typeof e)return e;var a=new RegExp(t?"[^a-zA-Z_à-ü]+":"[^a-zA-Z0-9_à-ü]"),n=null,s="";r&&(e=e.toLowerCase());var i;for(n=e.match(a);n;n=e.match(a))(i=e.slice(0,n.index)).match(/\d/)?s+=i:s+=i.charAt(0).toUpperCase()+i.slice(1),s+=e.slice(n.index,n.index+n[0].length),e=e.slice(n.index+n[0].length);return e.match(/\d/)?s+e:s+e.charAt(0).toUpperCase()+e.slice(1)}),jSmart.prototype.registerPlugin("modifier","cat",function(e,t){return t=t||"",String(e)+t}),jSmart.prototype.registerPlugin("modifier","count_characters",function(e,t){return e=String(e),t?e.length:e.replace(/\s/g,"").length}),jSmart.prototype.registerPlugin("modifier","count_paragraphs",function(e){var t=String(e).match(/\n+/g);return t?t.length+1:1}),jSmart.prototype.registerPlugin("modifier","count_sentences",function(e){if("string"==typeof e){var t=e.match(/\w[.?!](\W|$)/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","count_words",function(e){if("string"==typeof e){var t=e.match(/\w+/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","date_format",function(e,t,r){return phpJs.strftime(t||"%b %e, %Y",phpJs.makeTimeStamp(e||r))}),jSmart.prototype.registerPlugin("modifier","debug_print_var",function(e){console.log(e+"--");var t="";return"object"==typeof module&&module&&"object"==typeof module.exports?t="node":"object"==typeof window&&window.document&&(t="browser"),""===t?"":"browser"===t?jSmart.prototype.printR(e):void console.log(e)}),jSmart.prototype.registerPlugin("modifier","defaultValue",function(e,t){return t=t||"",e&&"null"!==e&&void 0!==e?e:t}),jSmart.prototype.registerPlugin("modifier","escape",function(e,t,r,a){e=String(e),t=t||"html",r=r||"UTF-8",a=void 0===a||Boolean(a);var n,s="";switch(t){case"html":return a&&(e=e.replace(/&/g,"&")),e.replace(//g,">").replace(/'/g,"'").replace(/"/g,""");case"htmlall":return phpJs.htmlEntities(e,3,r);case"url":return phpJs.rawUrlEncode(e);case"urlpathinfo":return phpJs.rawUrlEncode(e).replace(/%2F/g,"/");case"quotes":return e.replace(/(^|[^\\])'/g,"$1\\'");case"hex":for(s="",n=0;n=126?"&#"+i+";":e.substr(n,1)}return s;case"javascript":return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/<\//g,"")}),jSmart.prototype.registerPlugin("modifier","regex_replace",function(e,t,r){var a=t.match(/^ *\/(.*)\/(.*) *$/);return String(e).replace(new RegExp(a[1],"g"+(a.length>1?a[2]:"")),r)}),jSmart.prototype.registerPlugin("modifier","replace",function(e,t,r){if(!t)return e;e=String(e),t=String(t),r=String(r);var a="",n=-1;for(n=e.indexOf(t);n>=0;n=e.indexOf(t))a+=e.slice(0,n)+r,n+=t.length,e=e.slice(n);return a+e}),jSmart.prototype.registerPlugin("modifier","spacify",function(e,t){return t||(t=" "),String(e).replace(/(\n|.)(?!$)/g,"$1"+t)}),jSmart.prototype.registerPlugin("modifier","string_format",function(e,t){return phpJs.sprintf(t,e)}),jSmart.prototype.registerPlugin("modifier","strip",function(e,t){return t=t||" ",String(e).replace(/[\s]+/g,t)}),jSmart.prototype.registerPlugin("modifier","strip_tags",function(e,t,r){if(null===t&&(t=!0),r||!0!==t&&!1!==t&&(t+"").length>0&&(r=t,t=!0),r){var a=r.split(">");return a.splice(-1,1),e=String(e).replace(/<[^>]*?>/g,function(e,r,n){for(var s=e.match(/\w+/),i=0;i").match(/\w+/);if(s[0]===o[0])return e}return t?" ":""})}return String(e).replace(/<[^>]*?>/g,t?" ":"")}),jSmart.prototype.registerPlugin("modifier","to_charset",function(e){return e}),jSmart.prototype.registerPlugin("modifier","truncate",function(e,t,r,a,n){return e=String(e),t=t||80,r=null!=r?r:"...",e.length<=t?e:(t-=Math.min(t,r.length),n?e.slice(0,Math.floor(t/2))+r+e.slice(e.length-Math.floor(t/2)):(a||(e=e.slice(0,t+1).replace(/\s+?(\S+)?$/,"")),e.slice(0,t)+r))}),jSmart.prototype.registerPlugin("modifier","unescape",function(e,t,r){switch(e=String(e),t=t||"html",r=r||"UTF-8",t){case"html":return e.replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,'"');case"entity":case"htmlall":return phpJs.htmlEntityDecode(e,1);case"url":return phpJs.rawUrlDecode(e)}return e}),jSmart.prototype.registerPlugin("modifier","upper",function(e){return String(e).toUpperCase()}),jSmart.prototype.registerPlugin("modifier","wordwrap",function(e,t,r,a){t=t||80,r=r||"\n";for(var n=String(e).split("\n"),s=0;st;){for(var l=0,p=i.slice(l).match(/\s+/);p&&l+p.index<=t;p=i.slice(l).match(/\s+/))l+=p.index+p[0].length;l=a?t-1:l||(p?p.index+p[0].length:i.length),o+=i.slice(0,l).replace(/\s+$/,""),l=t.smarty.cycle[r].arr.length||a)&&(t.smarty.cycle[r].index=0),e.__get("assign",!1)?(this.assignVar(e.assign,t.smarty.cycle[r].arr[t.smarty.cycle[r].index],t),""):e.__get("print",!0)?t.smarty.cycle[r].arr[t.smarty.cycle[r].index]:""}),jSmart.prototype.registerPlugin("function","eval",function(e,t){var r=e.var;return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","debug",function(e,t){var r="";if("object"==typeof module&&module&&"object"==typeof module.exports?r="node":"object"==typeof window&&window.document&&(r="browser"),""===r)return"";if("browser"===r){window.jsmartDebug&&window.jsmartDebug.close(),window.jsmartDebug=window.open("","","width=680, height=600,resizable,scrollbars=yes");var a="",n="",s=0;for(var i in t.includedTemplates)a+=""+t.includedTemplates[i]+"";""!==a&&(a="

included templates

"+a+"

"),s=0;for(var o in t.assignedVars)n+="["+o+"]"+jSmart.prototype.printR(t.assignedVars[o])+"";""!==n&&(n="

assigned template variables

"+n+"
");var l="jSmart Debug Console

jSmart Debug Console


"+a+n+"
";window.jsmartDebug.document.write(l)}else"undefined"!=typeof console&&(console.log("included templates:- "+JSON.stringify(a)),console.log("assigned template variables:- "+JSON.stringify(n)));return""}),jSmart.prototype.registerPlugin("function","fetch",function(e,t){var r=jSmart.prototype.getFile(e.__get("file",null,0));return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","html_checkboxes",function(e,t){var r,a,n,s=e.__get("type","checkbox"),i=e.__get("name",s),o=i,l=e.__get("values",e.options),p=e.__get("options",[]),u="options"in e,c=e.__get("selected",!1),g=e.__get("separator",""),h=Boolean(e.__get("labels",!0)),f=Boolean(e.__get("label_ids",!1)),d=[],m=0,y="";if("checkbox"===s&&(i+="[]"),!u)for(r in e.output)p.push(e.output[r]);for(r in l)l.hasOwnProperty(r)&&(n=o+"_"+(a=u?r:l[r]),y=h?f?'";for(var x=0;x"+d["right"===g?x:d.length-1-x]+"";_+="\n"}return"
"+(i?"\n":"")+_+"\n\n"+y+"\n
"+i+"
\n"}),jSmart.prototype.registerPlugin("function","mailto",function(e,t){var r,a,n=e.__get("address",null),s=e.__get("encode","none"),i=e.__get("text",n),o=phpJs.rawUrlEncode(e.__get("cc","")).replace(/%40/g,"@").replace(/%2C/g,","),l=phpJs.rawUrlEncode(e.__get("bcc","")).replace(/%40/g,"@").replace(/%2C/g,","),p=phpJs.rawUrlEncode(e.__get("followupto","")).replace(/%40/g,"@").replace(/%2C/g,","),u=phpJs.rawUrlEncode(e.__get("subject","")),c=phpJs.rawUrlEncode(e.__get("newsgroups","")),g=e.__get("extra","");if(n+=o?"?cc="+o:"",n+=l?(o?"&":"?")+"bcc="+l:"",n+=u?(o||l?"&":"?")+"subject="+u:"",n+=c?(o||l||u?"&":"?")+"newsgroups="+c:"",n+=p?(o||l||u||c?"&":"?")+"followupto="+p:"",r='"+i+"","javascript"===s){r="document.write('"+r+"');";var h="";for(a=0;aeval(unescape(\''+h+"'))<\/script>"}if("javascript_charcode"===s){var f=[];for(a=0;a\n\x3c!--\n{document.write(String.fromCharCode('+f.join(",")+"))}\n//--\x3e\n<\/script>\n"}if("hex"===s){if(n.match(/^.+\?.+$/))throw new Error("mailto: hex encoding does not work with extra attributes. Try javascript.");var d="";for(a=0;a"+m+""}return r}),jSmart.prototype.registerPlugin("function","math",function(params,data){var equation=params.__get("equation",null).replace(/pi\(\s*\)/g,"PI");equation=equation.replace(/ceil/g,"Math.ceil").replace(/abs/g,"Math.abs").replace(/cos/g,"Math.cos").replace(/exp/g,"Math.exp").replace(/floor/g,"Math.floor").replace(/log/g,"Math.log").replace(/max/g,"Math.max").replace(/min/g,"Math.min").replace(/PI/g,"Math.PI").replace(/pow/g,"Math.pow").replace(/rand/g,"Math.rand").replace(/round/g,"Math.round").replace(/sin/g,"Math.sin").replace(/sqrt/g,"Math.sqrt").replace(/srans/g,"Math.srans").replace(/tan/g,"Math.tan");var words=equation.match(/\w+/g),i,j,tmp,banned=["ceil","abs","cos","exp","floor","log10","log","max","min","pi","pow","rand","round","sin","sqrt","srans","tan"];for(i=0;i(words[j+1]+"").length&&(tmp=words[j],words[j]=words[j+1],words[j+1]=tmp);for(i=0;i0&&(f=c+f),f=this.modifiers.wordwrap(f,n-l,s,i),l>0&&(f=f.replace(/^/gm,p)),g[h]=f)}var d=g.join(s+s);return"assign"in e?(this.assignVar(e.assign,d,r),""):d}),String.prototype.fetch=function(e){return new jSmart(this).fetch(e)},jSmart}); \ No newline at end of file diff --git a/examples/simple/jsmart.min.js b/examples/simple/jsmart.min.js index 19567a9..eab9d8d 100644 --- a/examples/simple/jsmart.min.js +++ b/examples/simple/jsmart.min.js @@ -1,5 +1,5 @@ /*! - * jSmart JavaScript template engine (v3.0.2) + * jSmart JavaScript template engine (v3.0.3) * https://github.com/umakantp/jsmart * https://opensource.org/licenses/MIT * @@ -7,4 +7,4 @@ * Max Miroshnikov */ -!function(e){"use strict";"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=e():("object"==typeof window&&window.document&&(window.jSmart=e()),"function"==typeof define&&define.amd&&define("jSmart",[],e))}(function(){"use strict";function objectMerge(e,t){for(var r=1;r0){for(var r=[],a=0;a2?r[2].replace(/^\s+|\s+$/g,""):"",a in this.buildInFunctions){var p=this.buildInFunctions[a],u=("parseParams"in p?p.parseParams.bind(this):this.parseParams.bind(this))(n);if("block"===p.type){e=e.replace(/^\n/,""),i=this.findCloseTag("/"+a,a+" +[^}]*",e);var c=p.parse.call(this,u,e.slice(0,i.index));c&&(o=o.concat(c)),e=e.slice(i.index+i[0].length)}else"extends"===a&&o.splice(0,o.length),o=o.concat(p.parse.call(this,u)),"extends"===a&&(l=o.length);e=e.replace(/^\n/,"")}else if(a in this.runTimePlugins)o=o.concat(this.parsePluginFunc(a,this.parseParams(n)));else if(a in this.plugins){var g=this.plugins[a];"block"===g.type?(i=this.findCloseTag("/"+a,a+" +[^}]*",e),o=o.concat(this.parsePluginBlock(a,this.parseParams(n),e.slice(0,i.index))),e=e.slice(i.index+i[0].length)):"function"===g.type&&(o=o.concat(this.parsePluginFunc(a,this.parseParams(n)))),"append"!==a&&"assign"!==a&&"capture"!==a&&"eval"!==a&&"include"!==a||(e=e.replace(/^\n/,""))}else s=this.buildInFunctions.expression.parse.call(this,t[1]),o.push(s);else"build-in"===(s=this.buildInFunctions.expression.parse.call(this,t[1])).expression.type&&"operator"===s.expression.name&&"="===s.expression.op&&(e=e.replace(/^\n/,"")),o.push(s);return e&&(o=o.concat(this.parseText(e))),o.usedExtends=l,o},findTag:function(e,t){var r,a,n,s=0,i=0,o=this.ldelim,l=this.rdelim,p=this.autoLiteral,u=/^\s*(.+)\s*$/i,c=e?new RegExp("^\\s*("+e+")\\s*$","i"):u;for(r=0;r=0&&t.substr(r-1,1).match(/\s/))continue;if(!--s&&(a=t.slice(o.length,r).replace(/[\r\n]/g," "),n=a.match(c)))return n.index=i,n[0]=t.slice(0,r+l.length),n;s<0&&(s=0)}return null},findElseTag:function(e,t,r,a){for(var n=0,s=this.findTag(r,a);s;s=this.findTag(r,a)){var i=this.findTag(e,a);if(!i||i.index>s.index)return s.index+=n,s;a=a.slice(i.index+i[0].length),n+=i.index+i[0].length;var o=this.findCloseTag(t,e,a);a=a.slice(o.index+o[0].length),n+=o.index+o[0].length}return null},findCloseTag:function(e,t,r){var a="",n=null,s=null,i=0;do{if(n&&(i+=n[0].length),!(n=this.findTag(e,r)))throw new Error("Unclosed "+this.ldelim+t+this.rdelim);a+=r.slice(0,n.index),i+=n.index,r=r.slice(n.index+n[0].length),(s=this.findTag(t,a))&&(a=a.slice(s.index+s[0].length))}while(s);return n.index=i,n},bundleOp:function(e,t,r){var a=t[e];if("operator"===a.name&&a.precedence===r&&!a.params.__parsed){if("binary"===a.optype)return a.params.__parsed=[t[e-1],t[e+1]],t.splice(e-1,3,a),[!0,t];if("post-unary"===a.optype)return a.params.__parsed=[t[e-1]],t.splice(e-1,2,a),[!0,t];a.params.__parsed=[t[e+1]],t.splice(e,2,a)}return[!1,t]},composeExpression:function(e){var t,r=0;for(r=0;r0;--r)r-=(t=this.bundleOp(r-1,e,a))[0],e=t[1];else for(r=0;r\s*|\[\s*)/,i={value:"",tree:[]},o="",l=[{type:"text",data:t.replace(/^(\w+)@(key|index|iteration|first|last|show|total)/gi,"$1__$2")}],p=r;for(r||(p=r=t),a=e.match(s);a;a=e.match(s)){if(r+=a[0],e=e.slice(a[0].length),a[0].match(/\[/)){(i=this.parseExpression(e,!0)).tree&&(r+=i.value,l.push(i.tree),e=e.slice(i.value.length));var u=e.match(/\s*\]/);u&&(r+=u[0],e=e.slice(u[0].length))}else{var c=this.parseModifiersStop;if(this.parseModifiersStop=!0,n=this.lookUp(e,""))if(i.tree=[].concat(i.tree,n.tree),i.value=n.value,r+=n.value,n.ret){var g=i.tree[i.tree.length-1];"plugin"===g.type&&"__func"===g.name&&(g.hasOwner=!0),l.push(g),e=e.slice(i.value.length)}else i=!1;this.parseModifiersStop=c}i||l.push({type:"text",data:""})}return o=r.substr(p.length),{s:e,token:r,tree:[{type:"var",parts:l}],value:o}},parseFunc:function(e,t,r){return t.__parsed.name=this.parseText(e,[])[0],r.push({type:"plugin",name:"__func",params:t}),r},parseOperator:function(e,t,r){return[{type:"build-in",name:"operator",op:e,optype:t,precedence:r,params:{}}]},parsePluginBlock:function(e,t,r){return[{type:"plugin",name:e,params:t,subTree:this.parse(r,[])}]},parsePluginFunc:function(e,t){return[{type:"plugin",name:e,params:t}]},parseModifiers:function(e,t){var r,a=e.match(/^\|(\w+)/),n="";if(!this.parseModifiersStop&&a){n+=a[0],r="default"===a[1]?"defaultValue":a[1],e=e.slice(a[0].length).replace(/^\s+/,""),this.parseModifiersStop=!0;for(var s=[],i=e.match(/^\s*:\s*/);i;i=e.match(/^\s*:\s*/)){n+=e.slice(0,i[0].length),e=e.slice(i[0].length);var o=this.lookUp(e,"");o.ret?(n+=o.value,s.push(o.tree[0]),e=e.slice(o.value.length)):s.push(this.parseText(""))}this.parseModifiersStop=!1,s.unshift(t.pop());var l=this.parseFunc(r,{__parsed:s},[]);t.push(l[0]);var p=this.parseModifiers(e,t);return p&&(t=t.concat(p.tree)),{value:n,tree:t}}},parseParams:function(e,t,r){var a=e.replace(/\n/g," ").replace(/^\s+|\s+$/g,""),n=[];if(e="",n.__parsed=[],!a)return n;for(t||(t=/^\s+/,r=/^(\w+)\s*=\s*/);a;){var s=null;if(r){var i=a.match(r);if(i){var o=i[1].charAt(0).match(/^\d+/);"true"!==i[1]&&"false"!==i[1]&&"null"!==i[1]||(o=!0),o||(s=trimAllQuotes(i[1]),e+=a.slice(0,i[0].length),a=a.slice(i[0].length))}}var l=this.parseExpression(a);if(!l)break;s?(n[s]=l.value,n.__parsed[s]=l.tree):(n.push(l.value),n.__parsed.push(l.tree)),e+=a.slice(0,l.value.length);var p=(a=a.slice(l.value.length)).match(t);if(!p)break;e+=a.slice(0,p[0].length),a=a.slice(p[0].length)}return n.toString=function(){return e},n},lookUp:function(e,t){var r,a=[];if(!e)return!1;if(e.substr(0,this.ldelim.length)===this.ldelim&&(r=this.findTag("",e),t+=r[0],r)){var n=this.parse(r[0]);a=a.concat(n);var s=this.parseModifiers(e.slice(t.length),a);return s?{ret:!0,tree:s.tree,value:s.value}:{ret:!0,tree:a,value:t}}var i=this.getMatchingToken(e);if(!1!==i){t+=RegExp.lastMatch;var o=this.tokens[i].parse.call(this,e.slice(RegExp.lastMatch.length),{tree:a,token:RegExp.lastMatch});if("string"==typeof o)if("parenStart"===o){var l=[];a.push(l),l.parent=a,a=l}else"parenEnd"===o&&a.parent&&(a=a.parent);else o&&o.constructor===Object?(t+=o.value,o=o.tree,a=a.concat(o)):a=a.concat(o);return{ret:!0,tree:a,value:t}}return{ret:!1,tree:a,value:t}},parseExpression:function(e){var t,r=[],a="";for(this.lastTreeInExpression=r;;){if(!(t=this.lookUp(e.slice(a.length),a)))break;if(r=r.concat(t.tree),a=t.value,this.lastTreeInExpression=r,!t.ret)break}return r.length&&(r=this.composeExpression(r)),{tree:r,value:a}},parseBool:function(e){return[{type:"boolean",data:e}]},parseText:function(e){var t=[];if(this.parseEmbeddedVars)for(var r=/([$][\w@]+)|`([^`]*)`/,a=r.exec(e);a;a=r.exec(e)){t.push({type:"text",data:e.slice(0,a.index)});var n=this.parseExpression(a[1]?a[1]:a[2]);t.push(n.tree),e=e.slice(a.index+a[0].length)}return t.push({type:"text",data:e}),t},loadTemplate:function(e,t){var r=[];if(!t&&e in this.files)r=this.files[e];else{var a=this.getTemplate(e);if("string"!=typeof a)throw new Error("No template for "+e);r=this.getTree(a),this.files[e]=r}return r},removeComments:function(e){for(var t=new RegExp(this.ldelim+"\\*"),r=new RegExp("\\*"+this.rdelim),a="",n=e.match(t);n;n=e.match(r)){a+=e.slice(0,n.index);var s=(e=e.slice(n.index+n[0].length)).match(r);if(!s)throw new Error("Unclosed "+t+"*");e=e.slice(s.index+s[0].length)}return a+e},applyFilters:function(e,t){for(var r=0;r=|<>|<|>)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1.replace(/<>/,"!="),"binary",5)}},{regex:/^\s+(lt|lte|le|gt|gte|ge)\s+/i,parse:function(e,t){var r=RegExp.$1.replace(/l(t)?e/,"<").replace(/lt/,"<=").replace(/g(t)?e/,">").replace(/gt/,">=");return this.parseOperator(r,"binary",5)}},{regex:/^\s+(is\s+(not\s+)?div\s+by)\s+/i,parse:function(e,t){return this.parseOperator(RegExp.$2?"div_not":"div","binary",7)}},{regex:/^\s+is\s+(not\s+)?(even|odd)(\s+by\s+)?\s*/i,parse:function(e,t){var r=RegExp.$1?"odd"===RegExp.$2?"even":"even_not":"odd"===RegExp.$2?"even_not":"even",a=this.parseOperator(r,"binary",7);return RegExp.$3?a:a.concat(this.parseText("1",a))}},{regex:/^\s*(&&)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",8)}},{regex:/^\s*(\|\|)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",9)}},{regex:/^\s+and\s+/i,parse:function(e,t){return this.parseOperator("&&","binary",11)}},{regex:/^\s+xor\s+/i,parse:function(e,t){return this.parseOperator("xor","binary",12)}},{regex:/^\s+or\s+/i,parse:function(e,t){return this.parseOperator("||","binary",13)}},{regex:/^#(\w+)#/,parse:function(e,t){var r=this.parseVar(".config."+RegExp.$1,"smarty","$smarty"),a=this.parseModifiers(r.s,r.tree);return a?(r.value+=a.value,a):r}},{regex:/^\s*\[\s*/,parse:function(e,t){var r=this.parseParams(e,/^\s*,\s*/,/^('[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|\w+)\s*=>\s*/),a=this.parsePluginFunc("__array",r),n=r.toString(),s=e.slice(r.toString().length).match(/\s*\]/);return s&&(n+=s[0]),{tree:a,value:n}}},{regex:/^[\d.]+/,parse:function(e,t){t.token.indexOf(".")>-1?t.token=parseFloat(t.token):t.token=parseInt(t.token,10);var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}},{regex:/^\w+/,parse:function(e,t){var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}}],buildInFunctions:{expression:{parse:function(e){var t=this.parseExpression(e);return{type:"build-in",name:"expression",expression:t.tree,params:this.parseParams(e.slice(t.value.length).replace(/^\s+|\s+$/g,""))}}},section:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("section [^}]+","/section","sectionelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"section",params:e,subTree:r,subTreeElse:a}}},setfilter:{type:"block",parseParams:function(e){return[this.parseExpression("__t()|"+e).tree]},parse:function(e,t){return{type:"build-in",name:"setfilter",params:e,subTree:this.parse(t)}}},config_load:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]);return{type:"build-in",name:"config_load",params:e,content:this.getConfig(t),section:trimAllQuotes(e.section?e.section:e[1]?e[1]:"")}}},append:{type:"function",parse:function(e){return{type:"build-in",name:"append",params:e}}},assign:{type:"function",parse:function(e){return{type:"build-in",name:"assign",params:e}}},break:{type:"function",parse:function(e){return{type:"build-in",name:"break",params:e}}},continue:{type:"function",parse:function(e){return{type:"build-in",name:"continue",params:e}}},call:{type:"function",parse:function(e){return{type:"build-in",name:"call",params:e}}},capture:{type:"block",parse:function(e,t){return{type:"build-in",name:"capture",params:e,subTree:this.parse(t)}}},nocache:{type:"block",parse:function(e,t){return{type:"build-in",name:"nocache",params:e,subTree:this.parse(t)}}},eval:{type:"function",parse:function(e){return this.parsePluginFunc("eval",e)}},include:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]),r=findInArray(e,"nocache")>=0;return{type:"build-in",name:"include",params:e,subTree:this.loadTemplate(t,r)}}},for:{type:"block",parseParams:function(e){var t=e.match(/^\s*\$(\w+)\s*=\s*([^\s]+)\s*to\s*([^\s]+)\s*(?:step\s*([^\s]+))?\s*(.*)$/);if(!t)throw new Error("Invalid {for} parameters: "+e);return this.parseParams("varName='"+t[1]+"' from="+t[2]+" to="+t[3]+" step="+(t[4]?t[4]:"1")+" "+t[5])},parse:function(e,t){var r=[],a=[],n=this.findElseTag("for\\s[^}]+","/for","forelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length))):r=this.parse(t),{type:"build-in",name:"for",params:e,subTree:r,subTreeElse:a}}},if:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("if\\s+[^}]+","/if","else[^}]*",t);if(n){r=this.parse(t.slice(0,n.index)),t=t.slice(n.index+n[0].length);var s=n[1].match(/^else\s*if(.*)/);a=s?this.buildInFunctions.if.parse.call(this,this.parseParams(s[1]),t.replace(/^\n/,"")):this.parse(t.replace(/^\n/,""))}else r=this.parse(t);return[{type:"build-in",name:"if",params:e,subTreeIf:r,subTreeElse:a}]}},foreach:{type:"block",parseParams:function(e){var t=e.match(/^\s*([$].+)\s*as\s*[$](\w+)\s*(=>\s*[$](\w+))?\s*$/i);return t&&(e="from="+t[1]+" item="+(t[4]||t[2]),t[4]&&(e+=" key="+t[2])),this.parseParams(e)},parse:function(e,t){var r=[],a=[],n=this.findElseTag("foreach\\s[^}]+","/foreach","foreachelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"foreach",params:e,subTree:r,subTreeElse:a}}},function:{type:"block",parse:function(e,t){this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]=!0;var r=this.parse(t);return this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]={tree:r,defaultParams:e},!1}},extends:{type:"function",parse:function(e){return this.loadTemplate(trimAllQuotes(e.file?e.file:e[0]),!0)}},block:{type:"block",parse:function(e,t){e.append=findInArray(e,"append")>=0,e.prepend=findInArray(e,"prepend")>=0,e.hide=findInArray(e,"hide")>=0;var r,a,n=this.parse(t,[]),s=trimAllQuotes(e.name?e.name:e[0]);return s in this.blocks?(this.outerBlocks[s]=[],this.outerBlocks[s]={tree:n,params:e},a="outer",r=t.match(/smarty.block.parent/),e.needParent=!1,r&&(e.needParent=!0)):(this.blocks[s]=[],this.blocks[s]={tree:n,params:e},a="inner",r=t.match(/smarty.block.child/),e.needChild=!1,r&&(e.needChild=!0)),{type:"build-in",name:"block",params:e,location:a}}},strip:{type:"block",parse:function(e,t){return this.parse(t.replace(/[ \t]*[\r\n]+[ \t]*/g,""))}},literal:{type:"block",parse:function(e,t){return this.parseText(t)}},ldelim:{type:"function",parse:function(e){return this.parseText(this.ldelim)}},rdelim:{type:"function",parse:function(e){return this.parseText(this.rdelim)}},while:{type:"block",parse:function(e,t){return{type:"build-in",name:"while",params:e,subTree:this.parse(t)}}}}},jSmartProcessor={tplModifiers:[],runTimePlugins:{},plugins:{},modifiers:{},defaultModifiers:{},escapeHtml:!1,variableFilters:[],outerBlocks:{},blocks:{},debugging:!1,clear:function(){this.runTimePlugins={},this.variableFilters=[],this.escapeHtml=!1,this.defaultModifiers={},this.modifiers={},this.plugins={},this.blocks={},this.outerBlocks={},this.debugging=!1,this.includedTemplates=[]},getProcessed:function(e,t){var r=this.process(e,t);return this.debugging&&this.plugins.debug.process([],{includedTemplates:this.includedTemplates,assignedVars:t}),this.clear(),{output:r.tpl,smarty:r.smarty}},process:function(e,t){for(var r,a,n,s,i="",o=0;o":return s>r;case"===":return s===r;case">=":return s>=r;case"!==":return s!==r}}},section:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={},n=r.__get("show",!0);if(t.smarty.section[r.__get("name",null,0)]=a,a.show=n,!n)return this.process(e.subTreeElse,t);var s=parseInt(r.__get("start",0),10),i=r.loop instanceof Object?countProperties(r.loop):isNaN(r.loop)?0:parseInt(r.loop),o=parseInt(r.__get("step",1),10),l=parseInt(r.__get("max"),10);isNaN(l)&&(l=Number.MAX_VALUE),s<0?(s+=i)<0&&(s=0):s>=i&&(s=i?i-1:0);var p=0,u=s;p=0;var c="";for(u=s;u>=0&&u=i,a.index=u,a.index_prev=u-o,a.index_next=u+o,a.iteration=a.rownum=p+1,a.total=p,a.loop=p;var g=this.process(e.subTree,t);void 0!==g&&(t=g.data,c+=g.tpl),t.smarty.continue=!1}return a.total=p,a.loop=p,t.smarty.break=!1,p?{tpl:c,data:t}:this.process(e.subTreeElse,t)}},setfilter:{process:function(e,t){this.tplModifiers.push(e.params);var r=this.process(e.subTree,t);return void 0!==r&&(t=r.data,r=r.tpl),this.tplModifiers.pop(),{tpl:r,data:t}}},for:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=parseInt(r.__get("from"),10),n=parseInt(r.__get("to"),10),s=parseInt(r.__get("step"),10);isNaN(s)&&(s=1);var i=parseInt(r.__get("max"),10);isNaN(i)&&(i=Number.MAX_VALUE);for(var o=0,l="",p=Math.min(Math.ceil((1+(s>0?n-a:a-n))/Math.abs(s)),i),u=parseInt(r.from,10);o0,r.name&&(t.smarty.foreach[r.name].show=i>0?1:""),i>0?s:this.process(e.subTreeElse,t)}},break:{process:function(e,t){return t.smarty.break=!0,{tpl:"",data:t}}},continue:{process:function(e,t){return t.smarty.continue=!0,{tpl:"",data:t}}},block:{process:function(e,t){var r,a,n,s=trimAllQuotes(e.params.name?e.params.name:e.params[0]),i=this.blocks[s],o=this.outerBlocks[s];return"inner"===e.location?(i.params.needChild?(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),t.smarty.block.child=a,void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r):o.params.needParent?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),t.smarty.block.parent=r,void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),n=a):(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),o.params.append?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=a+r):o.params.prepend?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r+a):n=a),n):""}},call:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={name:r.__get("name")?r.__get("name"):r.__get("0"),params:e.params},n=this.buildInFunctions.function.process.call(this,a,t),s=r.__get("assign",!1);return s?{tpl:"",data:this.assignVar(s,n,t)}:n}},include:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=r.__get("file",null,0);this.includedTemplates.push(a);var n=objectMerge({},t,r);n.smarty.template=a;var s=this.process(e.subTree,n);return void 0!==s&&(s=s.tpl),r.assign?{tpl:"",data:this.assignVar(r.assign,s,t)}:s}},function:{process:function(e,t){var r=this.runTimePlugins[e.name],a=this.getActualParamValues(r.defaultParams,t);delete a.name;var n=this.getActualParamValues(e.params,t);return this.process(r.tree,objectMerge({},t,a,n)).tpl}},while:{process:function(e,t){for(var r="";this.getActualParamValues(e.params,t)[0]&&!t.smarty.break;){var a=this.process(e.subTree,t);void 0!==a&&(t=a.data,r+=a.tpl),t.smarty.continue=!1}return t.smarty.break=!1,{tpl:r,data:t}}}}},version="3.0.2",jSmart=function(e,t){this.smarty={block:{},break:!1,capture:{},continue:!1,counter:{},cycle:{},foreach:{},section:{},now:Math.floor((new Date).getTime()/1e3),const:{},config:{},current_dir:"/",template:"",ldelim:"{",rdelim:"}",version:version},this.autoLiteral=!0,this.escapeHtml=!1,this.debugging=!1,this.outerBlocks={},this.blocks={},this.parse(e,t)};jSmart.prototype={constructor:jSmart,tree:[],scripts:{},modifiers:{},defaultModifiers:[],defaultModifiersGlobal:[],globalAndDefaultModifiers:[],filters:{variable:[],post:[]},filtersGlobal:{pre:[],variable:[],post:[]},globalAndDefaultFilters:[],buildInFunctions:{},plugins:{},runTimePlugins:{},parse:function(e,t){var r;t||(t={}),t.rdelim?this.smarty.rdelim=t.rdelim:jSmart.prototype.right_delimiter?this.smarty.rdelim=jSmart.prototype.right_delimiter:this.smarty.rdelim="}",t.ldelim?this.smarty.ldelim=t.ldelim:jSmart.prototype.left_delimiter?this.smarty.ldelim=jSmart.prototype.left_delimiter:this.smarty.ldelim="{",void 0!==t.autoLiteral?this.autoLiteral=t.autoLiteral:void 0!==jSmart.prototype.auto_literal&&(this.autoLiteral=jSmart.prototype.auto_literal),void 0!==t.debugging?this.debugging=t.debugging:void 0!==jSmart.prototype.debugging&&(this.debugging=jSmart.prototype.debugging),void 0!==t.escapeHtml?this.escapeHtml=t.escapeHtml:void 0!==jSmart.prototype.escape_html&&(this.escapeHtml=jSmart.prototype.escape_html),e=String(e||""),jSmartParser.clear(),jSmartParser.rdelim=this.smarty.rdelim,jSmartParser.ldelim=this.smarty.ldelim,jSmartParser.getTemplate=this.getTemplate,jSmartParser.getConfig=this.getConfig,jSmartParser.autoLiteral=this.autoLiteral,jSmartParser.plugins=this.plugins,jSmartParser.preFilters=this.filtersGlobal.pre,r=jSmartParser.getParsed(e),this.tree=r.tree,this.runTimePlugins=r.runTimePlugins,this.blocks=r.blocks,this.outerBlocks=r.outerBlocks},fetch:function(e){var t="";return"object"!=typeof e&&(e={}),e.smarty={},objectMerge(e.smarty,this.smarty),this.globalAndDefaultModifiers=jSmart.prototype.defaultModifiersGlobal.concat(this.defaultModifiers),this.globalAndDefaultFilters=jSmart.prototype.filtersGlobal.variable.concat(this.filters.variable),jSmartProcessor.clear(),jSmartProcessor.plugins=this.plugins,jSmartProcessor.modifiers=this.modifiers,jSmartProcessor.defaultModifiers=this.defaultModifiers,jSmartProcessor.escapeHtml=this.escapeHtml,jSmartProcessor.variableFilters=this.globalAndDefaultFilters,jSmartProcessor.runTimePlugins=this.runTimePlugins,jSmartProcessor.blocks=this.blocks,jSmartProcessor.outerBlocks=this.outerBlocks,jSmartProcessor.debugging=this.debugging,t=jSmartProcessor.getProcessed(this.tree,e,this.smarty),objectMerge(this.smarty,t.smarty),this.applyFilters(jSmart.prototype.filtersGlobal.post.concat(this.filters.post),t.output)},applyFilters:function(e,t){for(var r=0;r "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Array){n="Array (\n";for(a in e)e.hasOwnProperty(a)&&(n+=t+t+"["+a+"] => "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Boolean){var s="false";return!0===s&&(s="true"),s+"\n"}return e+"\n"},registerPlugin:function(e,t,r){"modifier"===e?this.modifiers[t]=r:this.plugins[t]={type:e,process:r}},registerFilter:function(e,t){(this.tree?this.filters:jSmart.prototype.filtersGlobal)["output"===e?"post":e].push(t)},addDefaultModifier:function(e){e instanceof Array||(e=[e]);for(var t=0;t=55296&&r<=56319){var a=r;return 1===t.length?r:1024*(a-55296)+(t.charCodeAt(1)-56320)+65536}return r},bin2Hex:function(e){var t,r,a,n="";for(t=0,r=(e+="").length;t1?a?s["&"]+e.substr(1):e:s[e]})},rawUrlDecode:function(e){return decodeURIComponent((e+"").replace(/%(?![\da-f]{2})/gi,function(){return"%25"}))},rawUrlEncode:function(e){return e+="",encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},sprintf:function(){var e=/%%|%(\d+\$)?([-+'#0 ]*)(\*\d+\$|\*|\d+)?(?:\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,r=0,a=function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},n=function(e,t,r,n,s,i){var o=n-e.length;return o>0&&(e=r||!s?a(e,n,i,r):[e.slice(0,t.length),a("",o,"0",!0),e.slice(t.length)].join("")),e},s=function(e,t,r,s,i,o,l){var p=e>>>0;return r=r&&p&&{2:"0b",8:"0",16:"0x"}[t]||"",e=r+a(p.toString(t),o||0,"0",!1),n(e,r,s,i,l)},i=function(e,t,r,a,s,i){return null!==a&&void 0!==a&&(e=e.slice(0,a)),n(e,"",t,r,s,i)};return t[r++].replace(e,function(e,o,l,p,u,c){var g,h,f,d,m;if("%%"===e)return"%";var y,v=!1,b="",_=!1,x=!1,w=" ",j=l.length;for(y=0;y-1?6:"d"===c?0:void 0,m=o?t[o.slice(0,-1)]:t[r++],c){case"s":return i(m+"",v,p,u,_,w);case"c":return i(String.fromCharCode(+m),v,p,u,_);case"b":return s(m,2,x,v,p,u,_);case"o":return s(m,8,x,v,p,u,_);case"x":return s(m,16,x,v,p,u,_);case"X":return s(m,16,x,v,p,u,_).toUpperCase();case"u":return s(m,10,x,v,p,u,_);case"i":case"d":return g=+m||0,g=Math.round(g-g%1),h=g<0?"-":b,m=h+a(String(Math.abs(g)),u,"0",!1),n(m,h,v,p,_);case"e":case"E":case"f":case"F":case"g":case"G":return g=+m,h=g<0?"-":b,f=["toExponential","toFixed","toPrecision"]["efg".indexOf(c.toLowerCase())],d=["toString","toUpperCase"]["eEfFgG".indexOf(c)%2],m=h+Math.abs(g)[f](u),phpJs.justify(m,h,v,p,_)[d]();default:return e}})},makeTimeStamp:function(e){if(!e)return Math.floor((new Date).getTime()/1e3);if(isNaN(e)){var t=phpJs.strtotime(e);return-1===t||!1===t?Math.floor((new Date).getTime()/1e3):t}return 14===(e+="").length&&-1!==e.search(/^[\d]+$/g)?phpJs.mktime(e.substr(8,2),e.substr(10,2),e.substr(12,2),e.substr(4,2),e.substr(6,2),e.substr(0,4)):Number(e)},mktime:function(){var e=new Date,t=arguments,r=0,a=["Hours","Minutes","Seconds","Month","Date","FullYear"];for(r=0;r=0?t[5]<=69?2e3:t[5]<=100?1900:0:0,e.setFullYear(t[5],t[3]-1,t[4]),e.setHours(t[0],t[1],t[2]);var n=e.getTime();return(n/1e3>>0)-(n<0)},_pad:function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},justify:function(e,t,r,a,n,s){var i=a-e.length;return i>0&&(e=r||!n?phpJs._pad(e,a,s,r):[e.slice(0,t.length),phpJs._pad("",i,"0",!0),e.slice(t.length)].join("")),e},strtotime:function(e,t){function r(e,t,r){var a,n=l[t];void 0!==n&&(0===(a=n-o.getDay())?a=7*r:a>0&&"last"===e?a-=7:a<0&&"next"===e&&(a+=7),o.setDate(o.getDate()+a))}var a,n,s,i,o,l,p,u,c,g,h;if(!e)return!1;e=e.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var f=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if((n=e.match(f))&&n[2]===n[4])if(n[1]>1901)switch(n[2]){case"-":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case".":return!1;case"/":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else if(n[5]>1901)switch(n[2]){case"-":case".":return!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case"/":return!(n[1]>12||n[3]>31)&&new Date(n[5],parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else switch(n[2]){case"-":return!(n[3]>12||n[5]>31||n[1]<70&&n[1]>38)&&(i=n[1]>=0&&n[1]<=38?+n[1]+2e3:n[1],new Date(i,parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case".":return n[5]>=70?!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3:n[5]<60&&!n[6]&&(!(n[1]>23||n[3]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0,n[9]||0)/1e3));case"/":return!(n[1]>12||n[3]>31||n[5]<70&&n[5]>38)&&(i=n[5]>=0&&n[5]<=38?+n[5]+2e3:n[5],new Date(i,parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case":":return!(n[1]>23||n[3]>59||n[5]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0)/1e3)}if("now"===e)return null===t||isNaN(t)?(new Date).getTime()/1e3|0:0|t;if(!isNaN(a=Date.parse(e)))return a/1e3|0;if(f=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),(n=e.match(f))&&("z"===n[4]?n[4]="Z":n[4].match(/^([+-][0-9]{2})$/)&&(n[4]=n[4]+":00"),!isNaN(a=Date.parse(n[1]+"T"+n[2]+n[4]))))return a/1e3|0;if(o=t?new Date(1e3*t):new Date,l={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},p={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},c="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)",g="([+-]?\\d+\\s"+c+"|(last|next)\\s"+c+")(\\sago)?",!(n=e.match(new RegExp(g,"gi"))))return!1;for(h=0,u=n.length;h1;r/=10)e=t.toString()+e;return e.toString()},a={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %r %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%m/%d/%Y",X:"%r",alt_digits:"",ERA:"",ERA_YEAR:"",ERA_D_T_FMT:"",ERA_D_FMT:"",ERA_T_FMT:""},n={a:function(e){return a.a[e.getDay()]},A:function(e){return a.A[e.getDay()]},b:function(e){return a.b[e.getMonth()]},B:function(e){return a.B[e.getMonth()]},C:function(e){return r(parseInt(e.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(e){return r(parseInt(this.G(e)/100,10),0)},G:function(e){var t=e.getFullYear(),r=parseInt(n.V(e),10),a=parseInt(n.W(e),10);return a>r?t++:0===a&&r>=52&&t--,t},H:["getHours","0"],I:function(e){var t=e.getHours()%12;return r(0===t?12:t,0)},j:function(e){var t=e-new Date(e.getFullYear()+"/1/1 GMT");t+=6e4*e.getTimezoneOffset();var a=parseInt(t/6e4/60/24,10)+1;return r(a,0,100)},k:["getHours","0"],l:function(e){var t=e.getHours()%12;return r(0===t?12:t," ")},m:function(e){return r(e.getMonth()+1,0)},M:["getMinutes","0"],p:function(e){return a.p[e.getHours()>=12?1:0]},P:function(e){return a.P[e.getHours()>=12?1:0]},s:function(e){return Date.parse(e)/1e3},S:["getSeconds","0"],u:function(e){var t=e.getDay();return 0===t?7:t},U:function(e){var t=parseInt(n.j(e),10),a=6-e.getDay(),s=parseInt((t+a)/7,10);return r(s,0)},V:function(e){var t=parseInt(n.W(e),10),a=new Date(e.getFullYear()+"/1/1").getDay(),s=t+(a>4||a<=1?0:1);return 53===s&&new Date(e.getFullYear()+"/12/31").getDay()<4?s=1:0===s&&(s=n.V(new Date(e.getFullYear()-1+"/12/31"))),r(s,0)},w:"getDay",W:function(e){var t=parseInt(n.j(e),10),a=7-n.u(e),s=parseInt((t+a)/7,10);return r(s,0,10)},y:function(e){return r(e.getFullYear()%100,0)},Y:"getFullYear",z:function(e){var t=e.getTimezoneOffset(),a=r(parseInt(Math.abs(t/60),10),0),n=r(t%60,0);return(t>0?"-":"+")+a+n},Z:function(e){return e.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(e){return"%"}},s=void 0===t?new Date:t instanceof Date?new Date(t):new Date(1e3*t),i={c:"locale",D:"%m/%d/%y",F:"%y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};e.match(/%[cDFhnrRtTxX]/);)e=e.replace(/%([cDFhnrRtTxX])/g,function(e,t){var r=i[t];return"locale"===r?a[t]:r});return e.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,function(e,t){var a=n[t];return"string"==typeof a?s[a]():"function"==typeof a?a(s):"object"==typeof a&&"string"==typeof a[0]?r(s[a[0]](),a[1]):t})}};return jSmart.prototype.registerPlugin("modifier","capitalize",function(e,t,r){if("string"!=typeof e)return e;var a=new RegExp(t?"[^a-zA-Z_à-ü]+":"[^a-zA-Z0-9_à-ü]"),n=null,s="";r&&(e=e.toLowerCase());var i;for(n=e.match(a);n;n=e.match(a))(i=e.slice(0,n.index)).match(/\d/)?s+=i:s+=i.charAt(0).toUpperCase()+i.slice(1),s+=e.slice(n.index,n.index+n[0].length),e=e.slice(n.index+n[0].length);return e.match(/\d/)?s+e:s+e.charAt(0).toUpperCase()+e.slice(1)}),jSmart.prototype.registerPlugin("modifier","cat",function(e,t){return t=t||"",String(e)+t}),jSmart.prototype.registerPlugin("modifier","count_characters",function(e,t){return e=String(e),t?e.length:e.replace(/\s/g,"").length}),jSmart.prototype.registerPlugin("modifier","count_paragraphs",function(e){var t=String(e).match(/\n+/g);return t?t.length+1:1}),jSmart.prototype.registerPlugin("modifier","count_sentences",function(e){if("string"==typeof e){var t=e.match(/\w[.?!](\W|$)/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","count_words",function(e){if("string"==typeof e){var t=e.match(/\w+/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","date_format",function(e,t,r){return phpJs.strftime(t||"%b %e, %Y",phpJs.makeTimeStamp(e||r))}),jSmart.prototype.registerPlugin("modifier","debug_print_var",function(e){console.log(e+"--");var t="";return"object"==typeof module&&module&&"object"==typeof module.exports?t="node":"object"==typeof window&&window.document&&(t="browser"),""===t?"":"browser"===t?jSmart.prototype.printR(e):void console.log(e)}),jSmart.prototype.registerPlugin("modifier","defaultValue",function(e,t){return t=t||"",e&&"null"!==e&&void 0!==e?e:t}),jSmart.prototype.registerPlugin("modifier","escape",function(e,t,r,a){e=String(e),t=t||"html",r=r||"UTF-8",a=void 0===a||Boolean(a);var n,s="";switch(t){case"html":return a&&(e=e.replace(/&/g,"&")),e.replace(//g,">").replace(/'/g,"'").replace(/"/g,""");case"htmlall":return phpJs.htmlEntities(e,3,r);case"url":return phpJs.rawUrlEncode(e);case"urlpathinfo":return phpJs.rawUrlEncode(e).replace(/%2F/g,"/");case"quotes":return e.replace(/(^|[^\\])'/g,"$1\\'");case"hex":for(s="",n=0;n=126?"&#"+i+";":e.substr(n,1)}return s;case"javascript":return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/<\//g,"")}),jSmart.prototype.registerPlugin("modifier","regex_replace",function(e,t,r){var a=t.match(/^ *\/(.*)\/(.*) *$/);return String(e).replace(new RegExp(a[1],"g"+(a.length>1?a[2]:"")),r)}),jSmart.prototype.registerPlugin("modifier","replace",function(e,t,r){if(!t)return e;e=String(e),t=String(t),r=String(r);var a="",n=-1;for(n=e.indexOf(t);n>=0;n=e.indexOf(t))a+=e.slice(0,n)+r,n+=t.length,e=e.slice(n);return a+e}),jSmart.prototype.registerPlugin("modifier","spacify",function(e,t){return t||(t=" "),String(e).replace(/(\n|.)(?!$)/g,"$1"+t)}),jSmart.prototype.registerPlugin("modifier","string_format",function(e,t){return phpJs.sprintf(t,e)}),jSmart.prototype.registerPlugin("modifier","strip",function(e,t){return t=t||" ",String(e).replace(/[\s]+/g,t)}),jSmart.prototype.registerPlugin("modifier","strip_tags",function(e,t,r){if(null===t&&(t=!0),r||!0!==t&&!1!==t&&(t+"").length>0&&(r=t,t=!0),r){var a=r.split(">");return a.splice(-1,1),e=String(e).replace(/<[^>]*?>/g,function(e,r,n){for(var s=e.match(/\w+/),i=0;i").match(/\w+/);if(s[0]===o[0])return e}return t?" ":""})}return String(e).replace(/<[^>]*?>/g,t?" ":"")}),jSmart.prototype.registerPlugin("modifier","to_charset",function(e){return e}),jSmart.prototype.registerPlugin("modifier","truncate",function(e,t,r,a,n){return e=String(e),t=t||80,r=null!=r?r:"...",e.length<=t?e:(t-=Math.min(t,r.length),n?e.slice(0,Math.floor(t/2))+r+e.slice(e.length-Math.floor(t/2)):(a||(e=e.slice(0,t+1).replace(/\s+?(\S+)?$/,"")),e.slice(0,t)+r))}),jSmart.prototype.registerPlugin("modifier","unescape",function(e,t,r){switch(e=String(e),t=t||"html",r=r||"UTF-8",t){case"html":return e.replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,'"');case"entity":case"htmlall":return phpJs.htmlEntityDecode(e,1);case"url":return phpJs.rawUrlDecode(e)}return e}),jSmart.prototype.registerPlugin("modifier","upper",function(e){return String(e).toUpperCase()}),jSmart.prototype.registerPlugin("modifier","wordwrap",function(e,t,r,a){t=t||80,r=r||"\n";for(var n=String(e).split("\n"),s=0;st;){for(var l=0,p=i.slice(l).match(/\s+/);p&&l+p.index<=t;p=i.slice(l).match(/\s+/))l+=p.index+p[0].length;l=a?t-1:l||(p?p.index+p[0].length:i.length),o+=i.slice(0,l).replace(/\s+$/,""),l=t.smarty.cycle[r].arr.length||a)&&(t.smarty.cycle[r].index=0),e.__get("assign",!1)?(this.assignVar(e.assign,t.smarty.cycle[r].arr[t.smarty.cycle[r].index],t),""):e.__get("print",!0)?t.smarty.cycle[r].arr[t.smarty.cycle[r].index]:""}),jSmart.prototype.registerPlugin("function","eval",function(e,t){var r=e.var;return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","debug",function(e,t){var r="";if("object"==typeof module&&module&&"object"==typeof module.exports?r="node":"object"==typeof window&&window.document&&(r="browser"),""===r)return"";if("browser"===r){window.jsmartDebug&&window.jsmartDebug.close(),window.jsmartDebug=window.open("","","width=680, height=600,resizable,scrollbars=yes");var a="",n="",s=0;for(var i in t.includedTemplates)a+=""+t.includedTemplates[i]+"";""!==a&&(a="

included templates

"+a+"

"),s=0;for(var o in t.assignedVars)n+="["+o+"]"+jSmart.prototype.printR(t.assignedVars[o])+"";""!==n&&(n="

assigned template variables

"+n+"
");var l="jSmart Debug Console

jSmart Debug Console


"+a+n+"
";window.jsmartDebug.document.write(l)}else"undefined"!=typeof console&&(console.log("included templates:- "+JSON.stringify(a)),console.log("assigned template variables:- "+JSON.stringify(n)));return""}),jSmart.prototype.registerPlugin("function","fetch",function(e,t){var r=jSmart.prototype.getFile(e.__get("file",null,0));return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","html_checkboxes",function(e,t){var r,a,n,s=e.__get("type","checkbox"),i=e.__get("name",s),o=i,l=e.__get("values",e.options),p=e.__get("options",[]),u="options"in e,c=e.__get("selected",!1),g=e.__get("separator",""),h=Boolean(e.__get("labels",!0)),f=Boolean(e.__get("label_ids",!1)),d=[],m=0,y="";if("checkbox"===s&&(i+="[]"),!u)for(r in e.output)p.push(e.output[r]);for(r in l)l.hasOwnProperty(r)&&(n=o+"_"+(a=u?r:l[r]),y=h?f?'";for(var x=0;x"+d["right"===g?x:d.length-1-x]+"";_+="\n"}return"
"+(i?"\n":"")+_+"\n\n"+y+"\n
"+i+"
\n"}),jSmart.prototype.registerPlugin("function","mailto",function(e,t){var r,a,n=e.__get("address",null),s=e.__get("encode","none"),i=e.__get("text",n),o=phpJs.rawUrlEncode(e.__get("cc","")).replace(/%40/g,"@").replace(/%2C/g,","),l=phpJs.rawUrlEncode(e.__get("bcc","")).replace(/%40/g,"@").replace(/%2C/g,","),p=phpJs.rawUrlEncode(e.__get("followupto","")).replace(/%40/g,"@").replace(/%2C/g,","),u=phpJs.rawUrlEncode(e.__get("subject","")),c=phpJs.rawUrlEncode(e.__get("newsgroups","")),g=e.__get("extra","");if(n+=o?"?cc="+o:"",n+=l?(o?"&":"?")+"bcc="+l:"",n+=u?(o||l?"&":"?")+"subject="+u:"",n+=c?(o||l||u?"&":"?")+"newsgroups="+c:"",n+=p?(o||l||u||c?"&":"?")+"followupto="+p:"",r='"+i+"","javascript"===s){r="document.write('"+r+"');";var h="";for(a=0;aeval(unescape(\''+h+"'))<\/script>"}if("javascript_charcode"===s){var f=[];for(a=0;a\n\x3c!--\n{document.write(String.fromCharCode('+f.join(",")+"))}\n//--\x3e\n<\/script>\n"}if("hex"===s){if(n.match(/^.+\?.+$/))throw new Error("mailto: hex encoding does not work with extra attributes. Try javascript.");var d="";for(a=0;a"+m+""}return r}),jSmart.prototype.registerPlugin("function","math",function(params,data){var equation=params.__get("equation",null).replace(/pi\(\s*\)/g,"PI");equation=equation.replace(/ceil/g,"Math.ceil").replace(/abs/g,"Math.abs").replace(/cos/g,"Math.cos").replace(/exp/g,"Math.exp").replace(/floor/g,"Math.floor").replace(/log/g,"Math.log").replace(/max/g,"Math.max").replace(/min/g,"Math.min").replace(/PI/g,"Math.PI").replace(/pow/g,"Math.pow").replace(/rand/g,"Math.rand").replace(/round/g,"Math.round").replace(/sin/g,"Math.sin").replace(/sqrt/g,"Math.sqrt").replace(/srans/g,"Math.srans").replace(/tan/g,"Math.tan");var words=equation.match(/\w+/g),i,j,tmp,banned=["ceil","abs","cos","exp","floor","log10","log","max","min","pi","pow","rand","round","sin","sqrt","srans","tan"];for(i=0;i(words[j+1]+"").length&&(tmp=words[j],words[j]=words[j+1],words[j+1]=tmp);for(i=0;i0&&(f=c+f),f=this.modifiers.wordwrap(f,n-l,s,i),l>0&&(f=f.replace(/^/gm,p)),g[h]=f)}var d=g.join(s+s);return"assign"in e?(this.assignVar(e.assign,d,r),""):d}),String.prototype.fetch=function(e){return new jSmart(this).fetch(e)},jSmart}); \ No newline at end of file +!function(e){"use strict";"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=e():("object"==typeof window&&window.document&&(window.jSmart=e()),"function"==typeof define&&define.amd&&define("jSmart",[],e))}(function(){"use strict";function objectMerge(e,t){for(var r=1;r0){for(var r=[],a=0;a2?r[2].replace(/^\s+|\s+$/g,""):"",a in this.buildInFunctions){var p=this.buildInFunctions[a],u=("parseParams"in p?p.parseParams.bind(this):this.parseParams.bind(this))(n);if("block"===p.type){e=e.replace(/^\n/,""),i=this.findCloseTag("/"+a,a+" +[^}]*",e);var c=p.parse.call(this,u,e.slice(0,i.index));c&&(o=o.concat(c)),e=e.slice(i.index+i[0].length)}else"extends"===a&&o.splice(0,o.length),o=o.concat(p.parse.call(this,u)),"extends"===a&&(l=o.length);e=e.replace(/^\n/,"")}else if(a in this.runTimePlugins)o=o.concat(this.parsePluginFunc(a,this.parseParams(n)));else if(a in this.plugins){var g=this.plugins[a];"block"===g.type?(i=this.findCloseTag("/"+a,a+" +[^}]*",e),o=o.concat(this.parsePluginBlock(a,this.parseParams(n),e.slice(0,i.index))),e=e.slice(i.index+i[0].length)):"function"===g.type&&(o=o.concat(this.parsePluginFunc(a,this.parseParams(n)))),"append"!==a&&"assign"!==a&&"capture"!==a&&"eval"!==a&&"include"!==a||(e=e.replace(/^\n/,""))}else s=this.buildInFunctions.expression.parse.call(this,t[1]),o.push(s);else"build-in"===(s=this.buildInFunctions.expression.parse.call(this,t[1])).expression.type&&"operator"===s.expression.name&&"="===s.expression.op&&(e=e.replace(/^\n/,"")),o.push(s);return e&&(o=o.concat(this.parseText(e))),o.usedExtends=l,o},findTag:function(e,t){var r,a,n,s=0,i=0,o=this.ldelim,l=this.rdelim,p=this.autoLiteral,u=/^\s*(.+)\s*$/i,c=e?new RegExp("^\\s*("+e+")\\s*$","i"):u;for(r=0;r=0&&t.substr(r-1,1).match(/\s/))continue;if(!--s&&(a=t.slice(o.length,r).replace(/[\r\n]/g," "),n=a.match(c)))return n.index=i,n[0]=t.slice(0,r+l.length),n;s<0&&(s=0)}return null},findElseTag:function(e,t,r,a){for(var n=0,s=this.findTag(r,a);s;s=this.findTag(r,a)){var i=this.findTag(e,a);if(!i||i.index>s.index)return s.index+=n,s;a=a.slice(i.index+i[0].length),n+=i.index+i[0].length;var o=this.findCloseTag(t,e,a);a=a.slice(o.index+o[0].length),n+=o.index+o[0].length}return null},findCloseTag:function(e,t,r){var a="",n=null,s=null,i=0;do{if(n&&(i+=n[0].length),!(n=this.findTag(e,r)))throw new Error("Unclosed "+this.ldelim+t+this.rdelim);a+=r.slice(0,n.index),i+=n.index,r=r.slice(n.index+n[0].length),(s=this.findTag(t,a))&&(a=a.slice(s.index+s[0].length))}while(s);return n.index=i,n},bundleOp:function(e,t,r){var a=t[e];if("operator"===a.name&&a.precedence===r&&!a.params.__parsed){if("binary"===a.optype)return a.params.__parsed=[t[e-1],t[e+1]],t.splice(e-1,3,a),[!0,t];if("post-unary"===a.optype)return a.params.__parsed=[t[e-1]],t.splice(e-1,2,a),[!0,t];a.params.__parsed=[t[e+1]],t.splice(e,2,a)}return[!1,t]},composeExpression:function(e){var t,r=0;for(r=0;r0;--r)r-=(t=this.bundleOp(r-1,e,a))[0],e=t[1];else for(r=0;r\s*|\[\s*)/,i={value:"",tree:[]},o="",l=[{type:"text",data:t.replace(/^(\w+)@(key|index|iteration|first|last|show|total)/gi,"$1__$2")}],p=r;for(r||(p=r=t),a=e.match(s);a;a=e.match(s)){if(r+=a[0],e=e.slice(a[0].length),a[0].match(/\[/)){(i=this.parseExpression(e,!0)).tree&&(r+=i.value,l.push(i.tree),e=e.slice(i.value.length));var u=e.match(/\s*\]/);u&&(r+=u[0],e=e.slice(u[0].length))}else{var c=this.parseModifiersStop;if(this.parseModifiersStop=!0,n=this.lookUp(e,""))if(i.tree=[].concat(i.tree,n.tree),i.value=n.value,r+=n.value,n.ret){var g=i.tree[i.tree.length-1];"plugin"===g.type&&"__func"===g.name&&(g.hasOwner=!0),l.push(g),e=e.slice(i.value.length)}else i=!1;this.parseModifiersStop=c}i||l.push({type:"text",data:""})}return o=r.substr(p.length),{s:e,token:r,tree:[{type:"var",parts:l}],value:o}},parseFunc:function(e,t,r){return t.__parsed.name=this.parseText(e,[])[0],r.push({type:"plugin",name:"__func",params:t}),r},parseOperator:function(e,t,r){return[{type:"build-in",name:"operator",op:e,optype:t,precedence:r,params:{}}]},parsePluginBlock:function(e,t,r){return[{type:"plugin",name:e,params:t,subTree:this.parse(r,[])}]},parsePluginFunc:function(e,t){return[{type:"plugin",name:e,params:t}]},parseModifiers:function(e,t){var r,a=e.match(/^\|(\w+)/),n="";if(!this.parseModifiersStop&&a){n+=a[0],r="default"===a[1]?"defaultValue":a[1],e=e.slice(a[0].length).replace(/^\s+/,""),this.parseModifiersStop=!0;for(var s=[],i=e.match(/^\s*:\s*/);i;i=e.match(/^\s*:\s*/)){n+=e.slice(0,i[0].length),e=e.slice(i[0].length);var o=this.lookUp(e,"");o.ret?(n+=o.value,s.push(o.tree[0]),e=e.slice(o.value.length)):s.push(this.parseText(""))}this.parseModifiersStop=!1,s.unshift(t.pop());var l=this.parseFunc(r,{__parsed:s},[]);t.push(l[0]);var p=this.parseModifiers(e,t);return p&&(t=t.concat(p.tree)),{value:n,tree:t}}},parseParams:function(e,t,r){var a=e.replace(/\n/g," ").replace(/^\s+|\s+$/g,""),n=[];if(e="",n.__parsed=[],!a)return n;for(t||(t=/^\s+/,r=/^(\w+)\s*=\s*/);a;){var s=null;if(r){var i=a.match(r);if(i){var o=i[1].charAt(0).match(/^\d+/);"true"!==i[1]&&"false"!==i[1]&&"null"!==i[1]||(o=!0),o||(s=trimAllQuotes(i[1]),e+=a.slice(0,i[0].length),a=a.slice(i[0].length))}}var l=this.parseExpression(a);if(!l)break;s?(n[s]=l.value,n.__parsed[s]=l.tree):(n.push(l.value),n.__parsed.push(l.tree)),e+=a.slice(0,l.value.length);var p=(a=a.slice(l.value.length)).match(t);if(!p)break;e+=a.slice(0,p[0].length),a=a.slice(p[0].length)}return n.toString=function(){return e},n},lookUp:function(e,t){var r,a=[];if(!e)return!1;if(e.substr(0,this.ldelim.length)===this.ldelim&&(r=this.findTag("",e),t+=r[0],r)){var n=this.parse(r[0]);a=a.concat(n);var s=this.parseModifiers(e.slice(t.length),a);return s?{ret:!0,tree:s.tree,value:s.value}:{ret:!0,tree:a,value:t}}var i=this.getMatchingToken(e);if(!1!==i){t+=RegExp.lastMatch;var o=this.tokens[i].parse.call(this,e.slice(RegExp.lastMatch.length),{tree:a,token:RegExp.lastMatch});if("string"==typeof o)if("parenStart"===o){var l=[];a.push(l),l.parent=a,a=l}else"parenEnd"===o&&a.parent&&(a=a.parent);else o&&o.constructor===Object?(t+=o.value,o=o.tree,a=a.concat(o)):a=a.concat(o);return{ret:!0,tree:a,value:t}}return{ret:!1,tree:a,value:t}},parseExpression:function(e){var t,r=[],a="";for(this.lastTreeInExpression=r;;){if(!(t=this.lookUp(e.slice(a.length),a)))break;if(r=r.concat(t.tree),a=t.value,this.lastTreeInExpression=r,!t.ret)break}return r.length&&(r=this.composeExpression(r)),{tree:r,value:a}},parseBool:function(e){return[{type:"boolean",data:e}]},parseText:function(e){var t=[];if(this.parseEmbeddedVars)for(var r=/([$][\w@]+)|`([^`]*)`/,a=r.exec(e);a;a=r.exec(e)){t.push({type:"text",data:e.slice(0,a.index)});var n=this.parseExpression(a[1]?a[1]:a[2]);t.push(n.tree),e=e.slice(a.index+a[0].length)}return t.push({type:"text",data:e}),t},loadTemplate:function(e,t){var r=[];if(!t&&e in this.files)r=this.files[e];else{var a=this.getTemplate(e);if("string"!=typeof a)throw new Error("No template for "+e);r=this.getTree(a),this.files[e]=r}return r},removeComments:function(e){for(var t=new RegExp(this.ldelim+"\\*"),r=new RegExp("\\*"+this.rdelim),a="",n=e.match(t);n;n=e.match(r)){a+=e.slice(0,n.index);var s=(e=e.slice(n.index+n[0].length)).match(r);if(!s)throw new Error("Unclosed "+t+"*");e=e.slice(s.index+s[0].length)}return a+e},applyFilters:function(e,t){for(var r=0;r=|<>|<|>)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1.replace(/<>/,"!="),"binary",5)}},{regex:/^\s+(lt|lte|le|gt|gte|ge)\s+/i,parse:function(e,t){var r=RegExp.$1.replace(/l(t)?e/,"<").replace(/lt/,"<=").replace(/g(t)?e/,">").replace(/gt/,">=");return this.parseOperator(r,"binary",5)}},{regex:/^\s+(is\s+(not\s+)?div\s+by)\s+/i,parse:function(e,t){return this.parseOperator(RegExp.$2?"div_not":"div","binary",7)}},{regex:/^\s+is\s+(not\s+)?(even|odd)(\s+by\s+)?\s*/i,parse:function(e,t){var r=RegExp.$1?"odd"===RegExp.$2?"even":"even_not":"odd"===RegExp.$2?"even_not":"even",a=this.parseOperator(r,"binary",7);return RegExp.$3?a:a.concat(this.parseText("1",a))}},{regex:/^\s*(&&)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",8)}},{regex:/^\s*(\|\|)\s*/,parse:function(e,t){return this.parseOperator(RegExp.$1,"binary",9)}},{regex:/^\s+and\s+/i,parse:function(e,t){return this.parseOperator("&&","binary",11)}},{regex:/^\s+xor\s+/i,parse:function(e,t){return this.parseOperator("xor","binary",12)}},{regex:/^\s+or\s+/i,parse:function(e,t){return this.parseOperator("||","binary",13)}},{regex:/^#(\w+)#/,parse:function(e,t){var r=this.parseVar(".config."+RegExp.$1,"smarty","$smarty"),a=this.parseModifiers(r.s,r.tree);return a?(r.value+=a.value,a):r}},{regex:/^\s*\[\s*/,parse:function(e,t){var r=this.parseParams(e,/^\s*,\s*/,/^('[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|\w+)\s*=>\s*/),a=this.parsePluginFunc("__array",r),n=r.toString(),s=e.slice(r.toString().length).match(/\s*\]/);return s&&(n+=s[0]),{tree:a,value:n}}},{regex:/^[\d.]+/,parse:function(e,t){t.token.indexOf(".")>-1?t.token=parseFloat(t.token):t.token=parseInt(t.token,10);var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}},{regex:/^\w+/,parse:function(e,t){var r=this.parseText(t.token),a=this.parseModifiers(e,r);return a||r}}],buildInFunctions:{expression:{parse:function(e){var t=this.parseExpression(e);return{type:"build-in",name:"expression",expression:t.tree,params:this.parseParams(e.slice(t.value.length).replace(/^\s+|\s+$/g,""))}}},section:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("section [^}]+","/section","sectionelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"section",params:e,subTree:r,subTreeElse:a}}},setfilter:{type:"block",parseParams:function(e){return[this.parseExpression("__t()|"+e).tree]},parse:function(e,t){return{type:"build-in",name:"setfilter",params:e,subTree:this.parse(t)}}},config_load:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]);return{type:"build-in",name:"config_load",params:e,content:this.getConfig(t),section:trimAllQuotes(e.section?e.section:e[1]?e[1]:"")}}},append:{type:"function",parse:function(e){return{type:"build-in",name:"append",params:e}}},assign:{type:"function",parse:function(e){return{type:"build-in",name:"assign",params:e}}},break:{type:"function",parse:function(e){return{type:"build-in",name:"break",params:e}}},continue:{type:"function",parse:function(e){return{type:"build-in",name:"continue",params:e}}},call:{type:"function",parse:function(e){return{type:"build-in",name:"call",params:e}}},capture:{type:"block",parse:function(e,t){return{type:"build-in",name:"capture",params:e,subTree:this.parse(t)}}},nocache:{type:"block",parse:function(e,t){return{type:"build-in",name:"nocache",params:e,subTree:this.parse(t)}}},eval:{type:"function",parse:function(e){return this.parsePluginFunc("eval",e)}},include:{type:"function",parse:function(e){var t=trimAllQuotes(e.file?e.file:e[0]),r=findInArray(e,"nocache")>=0;return{type:"build-in",name:"include",params:e,subTree:this.loadTemplate(t,r)}}},for:{type:"block",parseParams:function(e){var t=e.match(/^\s*\$(\w+)\s*=\s*([^\s]+)\s*to\s*([^\s]+)\s*(?:step\s*([^\s]+))?\s*(.*)$/);if(!t)throw new Error("Invalid {for} parameters: "+e);return this.parseParams("varName='"+t[1]+"' from="+t[2]+" to="+t[3]+" step="+(t[4]?t[4]:"1")+" "+t[5])},parse:function(e,t){var r=[],a=[],n=this.findElseTag("for\\s[^}]+","/for","forelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length))):r=this.parse(t),{type:"build-in",name:"for",params:e,subTree:r,subTreeElse:a}}},if:{type:"block",parse:function(e,t){var r=[],a=[],n=this.findElseTag("if\\s+[^}]+","/if","else[^}]*",t);if(n){r=this.parse(t.slice(0,n.index)),t=t.slice(n.index+n[0].length);var s=n[1].match(/^else\s*if(.*)/);a=s?this.buildInFunctions.if.parse.call(this,this.parseParams(s[1]),t.replace(/^\n/,"")):this.parse(t.replace(/^\n/,""))}else r=this.parse(t);return[{type:"build-in",name:"if",params:e,subTreeIf:r,subTreeElse:a}]}},foreach:{type:"block",parseParams:function(e){var t=e.match(/^\s*([$].+)\s*as\s*[$](\w+)\s*(=>\s*[$](\w+))?\s*$/i);return t&&(e="from="+t[1]+" item="+(t[4]||t[2]),t[4]&&(e+=" key="+t[2])),this.parseParams(e)},parse:function(e,t){var r=[],a=[],n=this.findElseTag("foreach\\s[^}]+","/foreach","foreachelse",t);return n?(r=this.parse(t.slice(0,n.index)),a=this.parse(t.slice(n.index+n[0].length).replace(/^[\r\n]/,""))):r=this.parse(t),{type:"build-in",name:"foreach",params:e,subTree:r,subTreeElse:a}}},function:{type:"block",parse:function(e,t){this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]=!0;var r=this.parse(t);return this.runTimePlugins[trimAllQuotes(e.name?e.name:e[0])]={tree:r,defaultParams:e},!1}},extends:{type:"function",parse:function(e){return this.loadTemplate(trimAllQuotes(e.file?e.file:e[0]),!0)}},block:{type:"block",parse:function(e,t){e.append=findInArray(e,"append")>=0,e.prepend=findInArray(e,"prepend")>=0,e.hide=findInArray(e,"hide")>=0;var r,a,n=this.parse(t,[]),s=trimAllQuotes(e.name?e.name:e[0]);return s in this.blocks?(this.outerBlocks[s]=[],this.outerBlocks[s]={tree:n,params:e},a="outer",r=t.match(/smarty.block.parent/),e.needParent=!1,r&&(e.needParent=!0)):(this.blocks[s]=[],this.blocks[s]={tree:n,params:e},a="inner",r=t.match(/smarty.block.child/),e.needChild=!1,r&&(e.needChild=!0)),{type:"build-in",name:"block",params:e,location:a}}},strip:{type:"block",parse:function(e,t){return this.parse(t.replace(/[ \t]*[\r\n]+[ \t]*/g,""))}},literal:{type:"block",parse:function(e,t){return this.parseText(t)}},ldelim:{type:"function",parse:function(e){return this.parseText(this.ldelim)}},rdelim:{type:"function",parse:function(e){return this.parseText(this.rdelim)}},while:{type:"block",parse:function(e,t){return{type:"build-in",name:"while",params:e,subTree:this.parse(t)}}}}},jSmartProcessor={tplModifiers:[],runTimePlugins:{},plugins:{},modifiers:{},defaultModifiers:{},escapeHtml:!1,variableFilters:[],outerBlocks:{},blocks:{},debugging:!1,clear:function(){this.runTimePlugins={},this.variableFilters=[],this.escapeHtml=!1,this.defaultModifiers={},this.modifiers={},this.plugins={},this.blocks={},this.outerBlocks={},this.debugging=!1,this.includedTemplates=[]},getProcessed:function(e,t){var r=this.process(e,t);return this.debugging&&this.plugins.debug.process([],{includedTemplates:this.includedTemplates,assignedVars:t}),this.clear(),{output:r.tpl,smarty:r.smarty}},process:function(e,t){for(var r,a,n,s,i="",o=0;o":return s>r;case"===":return s===r;case">=":return s>=r;case"!==":return s!==r}}},section:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={},n=r.__get("show",!0);if(t.smarty.section[r.__get("name",null,0)]=a,a.show=n,!n)return this.process(e.subTreeElse,t);var s=parseInt(r.__get("start",0),10),i=r.loop instanceof Object?countProperties(r.loop):isNaN(r.loop)?0:parseInt(r.loop),o=parseInt(r.__get("step",1),10),l=parseInt(r.__get("max"),10);isNaN(l)&&(l=Number.MAX_VALUE),s<0?(s+=i)<0&&(s=0):s>=i&&(s=i?i-1:0);var p=0,u=s;p=0;var c="";for(u=s;u>=0&&u=i,a.index=u,a.index_prev=u-o,a.index_next=u+o,a.iteration=a.rownum=p+1,a.total=p,a.loop=p;var g=this.process(e.subTree,t);void 0!==g&&(t=g.data,c+=g.tpl),t.smarty.continue=!1}return a.total=p,a.loop=p,t.smarty.break=!1,p?{tpl:c,data:t}:this.process(e.subTreeElse,t)}},setfilter:{process:function(e,t){this.tplModifiers.push(e.params);var r=this.process(e.subTree,t);return void 0!==r&&(t=r.data,r=r.tpl),this.tplModifiers.pop(),{tpl:r,data:t}}},for:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=parseInt(r.__get("from"),10),n=parseInt(r.__get("to"),10),s=parseInt(r.__get("step"),10);isNaN(s)&&(s=1);var i=parseInt(r.__get("max"),10);isNaN(i)&&(i=Number.MAX_VALUE);for(var o=0,l="",p=Math.min(Math.ceil((1+(s>0?n-a:a-n))/Math.abs(s)),i),u=parseInt(r.from,10);o0,r.name&&(t.smarty.foreach[r.name].show=i>0?1:""),i>0?s:this.process(e.subTreeElse,t)}},break:{process:function(e,t){return t.smarty.break=!0,{tpl:"",data:t}}},continue:{process:function(e,t){return t.smarty.continue=!0,{tpl:"",data:t}}},block:{process:function(e,t){var r,a,n,s=trimAllQuotes(e.params.name?e.params.name:e.params[0]),i=this.blocks[s],o=this.outerBlocks[s];return"inner"===e.location?(i.params.needChild?(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),t.smarty.block.child=a,void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r):o.params.needParent?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),t.smarty.block.parent=r,void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),n=a):(void 0!==(a=this.process(o.tree,t)).tpl&&(a=a.tpl),o.params.append?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=a+r):o.params.prepend?(void 0!==(r=this.process(i.tree,t)).tpl&&(r=r.tpl),n=r+a):n=a),n):""}},call:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a={name:r.__get("name")?r.__get("name"):r.__get("0"),params:e.params},n=this.buildInFunctions.function.process.call(this,a,t),s=r.__get("assign",!1);return s?{tpl:"",data:this.assignVar(s,n,t)}:n}},include:{process:function(e,t){var r=this.getActualParamValues(e.params,t),a=r.__get("file",null,0);this.includedTemplates.push(a);var n=objectMerge({},t,r);n.smarty.template=a;var s=this.process(e.subTree,n);return void 0!==s&&(s=s.tpl),r.assign?{tpl:"",data:this.assignVar(r.assign,s,t)}:s}},function:{process:function(e,t){var r=this.runTimePlugins[e.name],a=this.getActualParamValues(r.defaultParams,t);delete a.name;var n=this.getActualParamValues(e.params,t);return this.process(r.tree,objectMerge({},t,a,n)).tpl}},while:{process:function(e,t){for(var r="";this.getActualParamValues(e.params,t)[0]&&!t.smarty.break;){var a=this.process(e.subTree,t);void 0!==a&&(t=a.data,r+=a.tpl),t.smarty.continue=!1}return t.smarty.break=!1,{tpl:r,data:t}}}}},version="3.0.3",jSmart=function(e,t){this.smarty={block:{},break:!1,capture:{},continue:!1,counter:{},cycle:{},foreach:{},section:{},now:Math.floor((new Date).getTime()/1e3),const:{},config:{},current_dir:"/",template:"",ldelim:"{",rdelim:"}",version:version},this.autoLiteral=!0,this.escapeHtml=!1,this.debugging=!1,this.outerBlocks={},this.blocks={},this.parse(e,t)};jSmart.prototype={constructor:jSmart,tree:[],scripts:{},modifiers:{},defaultModifiers:[],defaultModifiersGlobal:[],globalAndDefaultModifiers:[],filters:{variable:[],post:[]},filtersGlobal:{pre:[],variable:[],post:[]},globalAndDefaultFilters:[],buildInFunctions:{},plugins:{},runTimePlugins:{},parse:function(e,t){var r;t||(t={}),t.rdelim?this.smarty.rdelim=t.rdelim:jSmart.prototype.right_delimiter?this.smarty.rdelim=jSmart.prototype.right_delimiter:this.smarty.rdelim="}",t.ldelim?this.smarty.ldelim=t.ldelim:jSmart.prototype.left_delimiter?this.smarty.ldelim=jSmart.prototype.left_delimiter:this.smarty.ldelim="{",void 0!==t.autoLiteral?this.autoLiteral=t.autoLiteral:void 0!==jSmart.prototype.auto_literal&&(this.autoLiteral=jSmart.prototype.auto_literal),void 0!==t.debugging?this.debugging=t.debugging:void 0!==jSmart.prototype.debugging&&(this.debugging=jSmart.prototype.debugging),void 0!==t.escapeHtml?this.escapeHtml=t.escapeHtml:void 0!==jSmart.prototype.escape_html&&(this.escapeHtml=jSmart.prototype.escape_html),e=String(e||""),jSmartParser.clear(),jSmartParser.rdelim=this.smarty.rdelim,jSmartParser.ldelim=this.smarty.ldelim,jSmartParser.getTemplate=this.getTemplate,jSmartParser.getConfig=this.getConfig,jSmartParser.autoLiteral=this.autoLiteral,jSmartParser.plugins=this.plugins,jSmartParser.preFilters=this.filtersGlobal.pre,r=jSmartParser.getParsed(e),this.tree=r.tree,this.runTimePlugins=r.runTimePlugins,this.blocks=r.blocks,this.outerBlocks=r.outerBlocks},fetch:function(e){var t="";return"object"!=typeof e&&(e={}),e.smarty={},objectMerge(e.smarty,this.smarty),this.globalAndDefaultModifiers=jSmart.prototype.defaultModifiersGlobal.concat(this.defaultModifiers),this.globalAndDefaultFilters=jSmart.prototype.filtersGlobal.variable.concat(this.filters.variable),jSmartProcessor.clear(),jSmartProcessor.plugins=this.plugins,jSmartProcessor.modifiers=this.modifiers,jSmartProcessor.defaultModifiers=this.defaultModifiers,jSmartProcessor.escapeHtml=this.escapeHtml,jSmartProcessor.variableFilters=this.globalAndDefaultFilters,jSmartProcessor.runTimePlugins=this.runTimePlugins,jSmartProcessor.blocks=this.blocks,jSmartProcessor.outerBlocks=this.outerBlocks,jSmartProcessor.debugging=this.debugging,t=jSmartProcessor.getProcessed(this.tree,e,this.smarty),objectMerge(this.smarty,t.smarty),this.applyFilters(jSmart.prototype.filtersGlobal.post.concat(this.filters.post),t.output)},applyFilters:function(e,t){for(var r=0;r "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Array){n="Array (\n";for(a in e)e.hasOwnProperty(a)&&(n+=t+t+"["+a+"] => "+this.printR(e[a],t+"  ",t+t));return n+=r+")\n"}if(e instanceof Boolean){var s="false";return!0===s&&(s="true"),s+"\n"}return e+"\n"},registerPlugin:function(e,t,r){"modifier"===e?this.modifiers[t]=r:this.plugins[t]={type:e,process:r}},registerFilter:function(e,t){(this.tree?this.filters:jSmart.prototype.filtersGlobal)["output"===e?"post":e].push(t)},addDefaultModifier:function(e){e instanceof Array||(e=[e]);for(var t=0;t=55296&&r<=56319){var a=r;return 1===t.length?r:1024*(a-55296)+(t.charCodeAt(1)-56320)+65536}return r},bin2Hex:function(e){var t,r,a,n="";for(t=0,r=(e+="").length;t1?a?s["&"]+e.substr(1):e:s[e]})},rawUrlDecode:function(e){return decodeURIComponent((e+"").replace(/%(?![\da-f]{2})/gi,function(){return"%25"}))},rawUrlEncode:function(e){return e+="",encodeURIComponent(e).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},sprintf:function(){var e=/%%|%(\d+\$)?([-+'#0 ]*)(\*\d+\$|\*|\d+)?(?:\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,t=arguments,r=0,a=function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},n=function(e,t,r,n,s,i){var o=n-e.length;return o>0&&(e=r||!s?a(e,n,i,r):[e.slice(0,t.length),a("",o,"0",!0),e.slice(t.length)].join("")),e},s=function(e,t,r,s,i,o,l){var p=e>>>0;return r=r&&p&&{2:"0b",8:"0",16:"0x"}[t]||"",e=r+a(p.toString(t),o||0,"0",!1),n(e,r,s,i,l)},i=function(e,t,r,a,s,i){return null!==a&&void 0!==a&&(e=e.slice(0,a)),n(e,"",t,r,s,i)};return t[r++].replace(e,function(e,o,l,p,u,c){var g,h,f,d,m;if("%%"===e)return"%";var y,v=!1,b="",_=!1,x=!1,w=" ",j=l.length;for(y=0;y-1?6:"d"===c?0:void 0,m=o?t[o.slice(0,-1)]:t[r++],c){case"s":return i(m+"",v,p,u,_,w);case"c":return i(String.fromCharCode(+m),v,p,u,_);case"b":return s(m,2,x,v,p,u,_);case"o":return s(m,8,x,v,p,u,_);case"x":return s(m,16,x,v,p,u,_);case"X":return s(m,16,x,v,p,u,_).toUpperCase();case"u":return s(m,10,x,v,p,u,_);case"i":case"d":return g=+m||0,g=Math.round(g-g%1),h=g<0?"-":b,m=h+a(String(Math.abs(g)),u,"0",!1),n(m,h,v,p,_);case"e":case"E":case"f":case"F":case"g":case"G":return g=+m,h=g<0?"-":b,f=["toExponential","toFixed","toPrecision"]["efg".indexOf(c.toLowerCase())],d=["toString","toUpperCase"]["eEfFgG".indexOf(c)%2],m=h+Math.abs(g)[f](u),phpJs.justify(m,h,v,p,_)[d]();default:return e}})},makeTimeStamp:function(e){if(!e)return Math.floor((new Date).getTime()/1e3);if(isNaN(e)){var t=phpJs.strtotime(e);return-1===t||!1===t?Math.floor((new Date).getTime()/1e3):t}return 14===(e+="").length&&-1!==e.search(/^[\d]+$/g)?phpJs.mktime(e.substr(8,2),e.substr(10,2),e.substr(12,2),e.substr(4,2),e.substr(6,2),e.substr(0,4)):Number(e)},mktime:function(){var e=new Date,t=arguments,r=0,a=["Hours","Minutes","Seconds","Month","Date","FullYear"];for(r=0;r=0?t[5]<=69?2e3:t[5]<=100?1900:0:0,e.setFullYear(t[5],t[3]-1,t[4]),e.setHours(t[0],t[1],t[2]);var n=e.getTime();return(n/1e3>>0)-(n<0)},_pad:function(e,t,r,a){r||(r=" ");var n=e.length>=t?"":new Array(1+t-e.length>>>0).join(r);return a?e+n:n+e},justify:function(e,t,r,a,n,s){var i=a-e.length;return i>0&&(e=r||!n?phpJs._pad(e,a,s,r):[e.slice(0,t.length),phpJs._pad("",i,"0",!0),e.slice(t.length)].join("")),e},strtotime:function(e,t){function r(e,t,r){var a,n=l[t];void 0!==n&&(0===(a=n-o.getDay())?a=7*r:a>0&&"last"===e?a-=7:a<0&&"next"===e&&(a+=7),o.setDate(o.getDate()+a))}var a,n,s,i,o,l,p,u,c,g,h;if(!e)return!1;e=e.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g," ").replace(/[\t\r\n]/g,"").toLowerCase();var f=new RegExp(["^(\\d{1,4})","([\\-\\.\\/:])","(\\d{1,2})","([\\-\\.\\/:])","(\\d{1,4})","(?:\\s(\\d{1,2}):(\\d{2})?:?(\\d{2})?)?","(?:\\s([A-Z]+)?)?$"].join(""));if((n=e.match(f))&&n[2]===n[4])if(n[1]>1901)switch(n[2]){case"-":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case".":return!1;case"/":return!(n[3]>12||n[5]>31)&&new Date(n[1],parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else if(n[5]>1901)switch(n[2]){case"-":case".":return!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3;case"/":return!(n[1]>12||n[3]>31)&&new Date(n[5],parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3}else switch(n[2]){case"-":return!(n[3]>12||n[5]>31||n[1]<70&&n[1]>38)&&(i=n[1]>=0&&n[1]<=38?+n[1]+2e3:n[1],new Date(i,parseInt(n[3],10)-1,n[5],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case".":return n[5]>=70?!(n[3]>12||n[1]>31)&&new Date(n[5],parseInt(n[3],10)-1,n[1],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3:n[5]<60&&!n[6]&&(!(n[1]>23||n[3]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0,n[9]||0)/1e3));case"/":return!(n[1]>12||n[3]>31||n[5]<70&&n[5]>38)&&(i=n[5]>=0&&n[5]<=38?+n[5]+2e3:n[5],new Date(i,parseInt(n[1],10)-1,n[3],n[6]||0,n[7]||0,n[8]||0,n[9]||0)/1e3);case":":return!(n[1]>23||n[3]>59||n[5]>59)&&(s=new Date,new Date(s.getFullYear(),s.getMonth(),s.getDate(),n[1]||0,n[3]||0,n[5]||0)/1e3)}if("now"===e)return null===t||isNaN(t)?(new Date).getTime()/1e3|0:0|t;if(!isNaN(a=Date.parse(e)))return a/1e3|0;if(f=new RegExp(["^([0-9]{4}-[0-9]{2}-[0-9]{2})","[ t]","([0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?)","([\\+-][0-9]{2}(:[0-9]{2})?|z)"].join("")),(n=e.match(f))&&("z"===n[4]?n[4]="Z":n[4].match(/^([+-][0-9]{2})$/)&&(n[4]=n[4]+":00"),!isNaN(a=Date.parse(n[1]+"T"+n[2]+n[4]))))return a/1e3|0;if(o=t?new Date(1e3*t):new Date,l={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},p={yea:"FullYear",mon:"Month",day:"Date",hou:"Hours",min:"Minutes",sec:"Seconds"},c="(years?|months?|weeks?|days?|hours?|minutes?|min|seconds?|sec|sunday|sun\\.?|monday|mon\\.?|tuesday|tue\\.?|wednesday|wed\\.?|thursday|thu\\.?|friday|fri\\.?|saturday|sat\\.?)",g="([+-]?\\d+\\s"+c+"|(last|next)\\s"+c+")(\\sago)?",!(n=e.match(new RegExp(g,"gi"))))return!1;for(h=0,u=n.length;h1;r/=10)e=t.toString()+e;return e.toString()},a={a:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],A:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],B:["January","February","March","April","May","June","July","August","September","October","November","December"],c:"%a %d %b %Y %r %Z",p:["AM","PM"],P:["am","pm"],r:"%I:%M:%S %p",x:"%m/%d/%Y",X:"%r",alt_digits:"",ERA:"",ERA_YEAR:"",ERA_D_T_FMT:"",ERA_D_FMT:"",ERA_T_FMT:""},n={a:function(e){return a.a[e.getDay()]},A:function(e){return a.A[e.getDay()]},b:function(e){return a.b[e.getMonth()]},B:function(e){return a.B[e.getMonth()]},C:function(e){return r(parseInt(e.getFullYear()/100,10),0)},d:["getDate","0"],e:["getDate"," "],g:function(e){return r(parseInt(this.G(e)/100,10),0)},G:function(e){var t=e.getFullYear(),r=parseInt(n.V(e),10),a=parseInt(n.W(e),10);return a>r?t++:0===a&&r>=52&&t--,t},H:["getHours","0"],I:function(e){var t=e.getHours()%12;return r(0===t?12:t,0)},j:function(e){var t=e-new Date(e.getFullYear()+"/1/1 GMT");t+=6e4*e.getTimezoneOffset();var a=parseInt(t/6e4/60/24,10)+1;return r(a,0,100)},k:["getHours","0"],l:function(e){var t=e.getHours()%12;return r(0===t?12:t," ")},m:function(e){return r(e.getMonth()+1,0)},M:["getMinutes","0"],p:function(e){return a.p[e.getHours()>=12?1:0]},P:function(e){return a.P[e.getHours()>=12?1:0]},s:function(e){return Date.parse(e)/1e3},S:["getSeconds","0"],u:function(e){var t=e.getDay();return 0===t?7:t},U:function(e){var t=parseInt(n.j(e),10),a=6-e.getDay(),s=parseInt((t+a)/7,10);return r(s,0)},V:function(e){var t=parseInt(n.W(e),10),a=new Date(e.getFullYear()+"/1/1").getDay(),s=t+(a>4||a<=1?0:1);return 53===s&&new Date(e.getFullYear()+"/12/31").getDay()<4?s=1:0===s&&(s=n.V(new Date(e.getFullYear()-1+"/12/31"))),r(s,0)},w:"getDay",W:function(e){var t=parseInt(n.j(e),10),a=7-n.u(e),s=parseInt((t+a)/7,10);return r(s,0,10)},y:function(e){return r(e.getFullYear()%100,0)},Y:"getFullYear",z:function(e){var t=e.getTimezoneOffset(),a=r(parseInt(Math.abs(t/60),10),0),n=r(t%60,0);return(t>0?"-":"+")+a+n},Z:function(e){return e.toString().replace(/^.*\(([^)]+)\)$/,"$1")},"%":function(e){return"%"}},s=void 0===t?new Date:t instanceof Date?new Date(t):new Date(1e3*t),i={c:"locale",D:"%m/%d/%y",F:"%y-%m-%d",h:"%b",n:"\n",r:"locale",R:"%H:%M",t:"\t",T:"%H:%M:%S",x:"locale",X:"locale"};e.match(/%[cDFhnrRtTxX]/);)e=e.replace(/%([cDFhnrRtTxX])/g,function(e,t){var r=i[t];return"locale"===r?a[t]:r});return e.replace(/%([aAbBCdegGHIjklmMpPsSuUVwWyYzZ%])/g,function(e,t){var a=n[t];return"string"==typeof a?s[a]():"function"==typeof a?a(s):"object"==typeof a&&"string"==typeof a[0]?r(s[a[0]](),a[1]):t})}};return jSmart.prototype.registerPlugin("modifier","capitalize",function(e,t,r){if("string"!=typeof e)return e;var a=new RegExp(t?"[^a-zA-Z_à-ü]+":"[^a-zA-Z0-9_à-ü]"),n=null,s="";r&&(e=e.toLowerCase());var i;for(n=e.match(a);n;n=e.match(a))(i=e.slice(0,n.index)).match(/\d/)?s+=i:s+=i.charAt(0).toUpperCase()+i.slice(1),s+=e.slice(n.index,n.index+n[0].length),e=e.slice(n.index+n[0].length);return e.match(/\d/)?s+e:s+e.charAt(0).toUpperCase()+e.slice(1)}),jSmart.prototype.registerPlugin("modifier","cat",function(e,t){return t=t||"",String(e)+t}),jSmart.prototype.registerPlugin("modifier","count_characters",function(e,t){return e=String(e),t?e.length:e.replace(/\s/g,"").length}),jSmart.prototype.registerPlugin("modifier","count_paragraphs",function(e){var t=String(e).match(/\n+/g);return t?t.length+1:1}),jSmart.prototype.registerPlugin("modifier","count_sentences",function(e){if("string"==typeof e){var t=e.match(/\w[.?!](\W|$)/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","count_words",function(e){if("string"==typeof e){var t=e.match(/\w+/g);if(t)return t.length}return 0}),jSmart.prototype.registerPlugin("modifier","date_format",function(e,t,r){return phpJs.strftime(t||"%b %e, %Y",phpJs.makeTimeStamp(e||r))}),jSmart.prototype.registerPlugin("modifier","debug_print_var",function(e){console.log(e+"--");var t="";return"object"==typeof module&&module&&"object"==typeof module.exports?t="node":"object"==typeof window&&window.document&&(t="browser"),""===t?"":"browser"===t?jSmart.prototype.printR(e):void console.log(e)}),jSmart.prototype.registerPlugin("modifier","defaultValue",function(e,t){return t=t||"",e&&"null"!==e&&void 0!==e?e:t}),jSmart.prototype.registerPlugin("modifier","escape",function(e,t,r,a){e=String(e),t=t||"html",r=r||"UTF-8",a=void 0===a||Boolean(a);var n,s="";switch(t){case"html":return a&&(e=e.replace(/&/g,"&")),e.replace(//g,">").replace(/'/g,"'").replace(/"/g,""");case"htmlall":return phpJs.htmlEntities(e,3,r);case"url":return phpJs.rawUrlEncode(e);case"urlpathinfo":return phpJs.rawUrlEncode(e).replace(/%2F/g,"/");case"quotes":return e.replace(/(^|[^\\])'/g,"$1\\'");case"hex":for(s="",n=0;n=126?"&#"+i+";":e.substr(n,1)}return s;case"javascript":return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/<\//g,"")}),jSmart.prototype.registerPlugin("modifier","regex_replace",function(e,t,r){var a=t.match(/^ *\/(.*)\/(.*) *$/);return String(e).replace(new RegExp(a[1],"g"+(a.length>1?a[2]:"")),r)}),jSmart.prototype.registerPlugin("modifier","replace",function(e,t,r){if(!t)return e;e=String(e),t=String(t),r=String(r);var a="",n=-1;for(n=e.indexOf(t);n>=0;n=e.indexOf(t))a+=e.slice(0,n)+r,n+=t.length,e=e.slice(n);return a+e}),jSmart.prototype.registerPlugin("modifier","spacify",function(e,t){return t||(t=" "),String(e).replace(/(\n|.)(?!$)/g,"$1"+t)}),jSmart.prototype.registerPlugin("modifier","string_format",function(e,t){return phpJs.sprintf(t,e)}),jSmart.prototype.registerPlugin("modifier","strip",function(e,t){return t=t||" ",String(e).replace(/[\s]+/g,t)}),jSmart.prototype.registerPlugin("modifier","strip_tags",function(e,t,r){if(null===t&&(t=!0),r||!0!==t&&!1!==t&&(t+"").length>0&&(r=t,t=!0),r){var a=r.split(">");return a.splice(-1,1),e=String(e).replace(/<[^>]*?>/g,function(e,r,n){for(var s=e.match(/\w+/),i=0;i").match(/\w+/);if(s[0]===o[0])return e}return t?" ":""})}return String(e).replace(/<[^>]*?>/g,t?" ":"")}),jSmart.prototype.registerPlugin("modifier","to_charset",function(e){return e}),jSmart.prototype.registerPlugin("modifier","truncate",function(e,t,r,a,n){return e=String(e),t=t||80,r=null!=r?r:"...",e.length<=t?e:(t-=Math.min(t,r.length),n?e.slice(0,Math.floor(t/2))+r+e.slice(e.length-Math.floor(t/2)):(a||(e=e.slice(0,t+1).replace(/\s+?(\S+)?$/,"")),e.slice(0,t)+r))}),jSmart.prototype.registerPlugin("modifier","unescape",function(e,t,r){switch(e=String(e),t=t||"html",r=r||"UTF-8",t){case"html":return e.replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,'"');case"entity":case"htmlall":return phpJs.htmlEntityDecode(e,1);case"url":return phpJs.rawUrlDecode(e)}return e}),jSmart.prototype.registerPlugin("modifier","upper",function(e){return String(e).toUpperCase()}),jSmart.prototype.registerPlugin("modifier","wordwrap",function(e,t,r,a){t=t||80,r=r||"\n";for(var n=String(e).split("\n"),s=0;st;){for(var l=0,p=i.slice(l).match(/\s+/);p&&l+p.index<=t;p=i.slice(l).match(/\s+/))l+=p.index+p[0].length;l=a?t-1:l||(p?p.index+p[0].length:i.length),o+=i.slice(0,l).replace(/\s+$/,""),l=t.smarty.cycle[r].arr.length||a)&&(t.smarty.cycle[r].index=0),e.__get("assign",!1)?(this.assignVar(e.assign,t.smarty.cycle[r].arr[t.smarty.cycle[r].index],t),""):e.__get("print",!0)?t.smarty.cycle[r].arr[t.smarty.cycle[r].index]:""}),jSmart.prototype.registerPlugin("function","eval",function(e,t){var r=e.var;return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","debug",function(e,t){var r="";if("object"==typeof module&&module&&"object"==typeof module.exports?r="node":"object"==typeof window&&window.document&&(r="browser"),""===r)return"";if("browser"===r){window.jsmartDebug&&window.jsmartDebug.close(),window.jsmartDebug=window.open("","","width=680, height=600,resizable,scrollbars=yes");var a="",n="",s=0;for(var i in t.includedTemplates)a+=""+t.includedTemplates[i]+"";""!==a&&(a="

included templates

"+a+"

"),s=0;for(var o in t.assignedVars)n+="["+o+"]"+jSmart.prototype.printR(t.assignedVars[o])+"";""!==n&&(n="

assigned template variables

"+n+"
");var l="jSmart Debug Console

jSmart Debug Console


"+a+n+"
";window.jsmartDebug.document.write(l)}else"undefined"!=typeof console&&(console.log("included templates:- "+JSON.stringify(a)),console.log("assigned template variables:- "+JSON.stringify(n)));return""}),jSmart.prototype.registerPlugin("function","fetch",function(e,t){var r=jSmart.prototype.getFile(e.__get("file",null,0));return"assign"in e?(this.assignVar(e.assign,r,t),""):r}),jSmart.prototype.registerPlugin("function","html_checkboxes",function(e,t){var r,a,n,s=e.__get("type","checkbox"),i=e.__get("name",s),o=i,l=e.__get("values",e.options),p=e.__get("options",[]),u="options"in e,c=e.__get("selected",!1),g=e.__get("separator",""),h=Boolean(e.__get("labels",!0)),f=Boolean(e.__get("label_ids",!1)),d=[],m=0,y="";if("checkbox"===s&&(i+="[]"),!u)for(r in e.output)p.push(e.output[r]);for(r in l)l.hasOwnProperty(r)&&(n=o+"_"+(a=u?r:l[r]),y=h?f?'";for(var x=0;x"+d["right"===g?x:d.length-1-x]+"";_+="\n"}return"
"+(i?"\n":"")+_+"\n\n"+y+"\n
"+i+"
\n"}),jSmart.prototype.registerPlugin("function","mailto",function(e,t){var r,a,n=e.__get("address",null),s=e.__get("encode","none"),i=e.__get("text",n),o=phpJs.rawUrlEncode(e.__get("cc","")).replace(/%40/g,"@").replace(/%2C/g,","),l=phpJs.rawUrlEncode(e.__get("bcc","")).replace(/%40/g,"@").replace(/%2C/g,","),p=phpJs.rawUrlEncode(e.__get("followupto","")).replace(/%40/g,"@").replace(/%2C/g,","),u=phpJs.rawUrlEncode(e.__get("subject","")),c=phpJs.rawUrlEncode(e.__get("newsgroups","")),g=e.__get("extra","");if(n+=o?"?cc="+o:"",n+=l?(o?"&":"?")+"bcc="+l:"",n+=u?(o||l?"&":"?")+"subject="+u:"",n+=c?(o||l||u?"&":"?")+"newsgroups="+c:"",n+=p?(o||l||u||c?"&":"?")+"followupto="+p:"",r='"+i+"","javascript"===s){r="document.write('"+r+"');";var h="";for(a=0;aeval(unescape(\''+h+"'))<\/script>"}if("javascript_charcode"===s){var f=[];for(a=0;a\n\x3c!--\n{document.write(String.fromCharCode('+f.join(",")+"))}\n//--\x3e\n<\/script>\n"}if("hex"===s){if(n.match(/^.+\?.+$/))throw new Error("mailto: hex encoding does not work with extra attributes. Try javascript.");var d="";for(a=0;a"+m+""}return r}),jSmart.prototype.registerPlugin("function","math",function(params,data){var equation=params.__get("equation",null).replace(/pi\(\s*\)/g,"PI");equation=equation.replace(/ceil/g,"Math.ceil").replace(/abs/g,"Math.abs").replace(/cos/g,"Math.cos").replace(/exp/g,"Math.exp").replace(/floor/g,"Math.floor").replace(/log/g,"Math.log").replace(/max/g,"Math.max").replace(/min/g,"Math.min").replace(/PI/g,"Math.PI").replace(/pow/g,"Math.pow").replace(/rand/g,"Math.rand").replace(/round/g,"Math.round").replace(/sin/g,"Math.sin").replace(/sqrt/g,"Math.sqrt").replace(/srans/g,"Math.srans").replace(/tan/g,"Math.tan");var words=equation.match(/\w+/g),i,j,tmp,banned=["ceil","abs","cos","exp","floor","log10","log","max","min","pi","pow","rand","round","sin","sqrt","srans","tan"];for(i=0;i(words[j+1]+"").length&&(tmp=words[j],words[j]=words[j+1],words[j+1]=tmp);for(i=0;i0&&(f=c+f),f=this.modifiers.wordwrap(f,n-l,s,i),l>0&&(f=f.replace(/^/gm,p)),g[h]=f)}var d=g.join(s+s);return"assign"in e?(this.assignVar(e.assign,d,r),""):d}),String.prototype.fetch=function(e){return new jSmart(this).fetch(e)},jSmart}); \ No newline at end of file