json-object-editor
Version:
JOE the Json Object Editor | Platform Edition
8 lines • 152 kB
JavaScript
/*/---------------------------------------------------------/*/
/*/ Craydent LLC v1.9.2 /*/
/*/ Copyright 2016 (http://craydent.com/about) /*/
/*/ Dual licensed under the MIT or GPL Version 2 licenses. /*/
/*/ (http://craydent.com/license) /*/
/*/---------------------------------------------------------/*/
function __isNewer(e,r){return e[0]==r[0]?(e.splice(0,1),r.splice(0,1),r.length&&e.length?__isNewer(e,r):!1):parseInt(e[0])<parseInt(r[0])}function __cleanUp(){try{delete $w.__current,delete $w.__thisVersion,delete $w.__thisIsNewer,delete $w.__isNewer,delete $w.__version,delete $w._ie,delete $w._droid,delete $w._amay,delete $w._browser,delete $w._os,delete $w._device,delete $w._engine}catch(e){$w.__current=void 0,$w.__thisVersion=void 0,$w.__thisIsNewer=void 0,$w.__isNewer=void 0,$w.__version=void 0,$w._ie=void 0,$w._droid=void 0,$w._amay=void 0,$w._browser=void 0,$w._os=void 0,$w._device=void 0,$w._engine=void 0}}function __add_fillTemplate_ref(e){try{var r=suid();return fillTemplate.refs["ref_"+fillTemplate.refs.length]=r,fillTemplate.refs[r]=e,fillTemplate.refs.push(e),r}catch(t){error("fillTemplate.__add_fillTemplate_ref",t)}}function __and(){try{var e=0;for(len=arguments.length;len>e;e++){var r=arguments[e];if(!r)return""}return arguments[e-1]}catch(t){error("fillTemplate.__and",t)}}function __clean_micro_templates(){var e=fillTemplate._micro_templates;for(var r in e)e.hasOwnProperty(r)&&($CSS("[data-craydent-bind*='"+r+"']").length||delete e[r])}function __contextualizeMethods(e){try{return e=e||{},e.Benchmarker=Benchmarker,e.Cursor=Cursor,e.JSZip=JSZip,e.OrderedList=OrderedList,e.Queue=Queue,e.Set=Set,e.addObjectPrototype=addObjectPrototype,e.ajax=ajax,e.cout=cout,e.cuid=cuid,e.emit=emit,e.error=error,e.exclude=exclude,e.fillTemplate=fillTemplate,e.foo=foo,e.isNull=isNull,e.logit=logit,e.namespace=namespace,e.next=next,e.now=now,e.parseBoolean=parseBoolean,e.parseRaw=parseRaw,e.rand=rand,e.suid=suid,e.syncroit=syncroit,e.tryEval=tryEval,e.wait=wait,e.xmlToJson=xmlToJson,e.yieldable=yieldable,e.zipit=zipit,e}catch(r){error("__contextualizeMethods",r)}}function __convert_regex_safe(e){try{return e.replace(/\\/gi,"\\\\").replace(/\$/gi,"\\$").replace(/\//gi,"\\/").replace(/\^/gi,"\\^").replace(/\./gi,"\\.").replace(/\|/gi,"\\|").replace(/\*/gi,"\\*").replace(/\+/gi,"\\+").replace(/\?/gi,"\\?").replace(/\!/gi,"\\!").replace(/\{/gi,"\\{").replace(/\}/gi,"\\}").replace(/\[/gi,"\\[").replace(/\]/gi,"\\]").replace(/\(/gi,"\\(").replace(/\)/gi,"\\)").replace("\n","\\n")}catch(r){error("__convert_regex_safe",r)}}function __count(e){try{return e.length}catch(r){error("fillTemplate.count",r)}}function __dup(e){try{for(var r in e)e.hasOwnProperty(r)&&(this[r]=e[r])}catch(t){error("__dup",t)}}function __enum(e,r,t){try{r=r||", ",t=t||["",""];var a=[],i="";if($c.isArray(e))a=e.slice(0);else if($c.isObject(e))for(var n in e)e.hasOwnProperty(n)&&a.push(n);for(var s=0,o=a.length;o>s;s++){var n=a[s],c=$c.replace_all(t[0],["{ENUM_VAR}","{ENUM_VAL}"],[n,e[n]]),l=$c.replace_all(t[1],["{ENUM_VAR}","{ENUM_VAL}"],[n,e[n]]);i+=c+n+l+r}return i.slice(0,-1*r.length)}catch(u){error("fillTemplate.enum",u)}}function __logic_parser(e,r,t){if(!e)return"";var a=$c.TEMPLATE_TAG_CONFIG,i=[],n={};e=$c.replace_all(e,a.IGNORE_CHARS,[""]),$c.eachProperty(a,function(r){if(r.begin){var t=$c.indexOfAlt(e,r.begin);i.push(t),n[t]=r}});var s=Math.min.apply(Math,$c.condense(i,[-1]));return n[s]?e.substring(0,s)+n[s].parser(e.substring(s),r,t):e}function __observe_helper(e,r,t,a){try{if($c.isObject(e))return observe(e,r,t,a);if(!$c.isArray(e))return;for(var i,n=0;i=e[n++];)$c.isObject(i)&&observe(i,r,t,a)}catch(s){error("observe.observe_helper",s)}}function __on_observable_change(e){try{var r=e[0],t=r.object,a=r.name,i=r.oldValue,n=fillTemplate._observing,s=fillTemplate._micro_templates;if(t[a]!=i){var o=n.indexOf(t),c=n["hash_"+o],l=RegExp(c+"[a-zA-Z0-9,]*."+a+";?|$"),u=Array.prototype.slice.call($CSS("[data-craydent-bind*='"+c+"']")||[]).filter(function(e){return l.test(e.getAttribute("data-craydent-bind"))});if(!$CSS("[data-craydent-bind*='"+c+"']").length)return void delete n["hash_"+o];for(var p,h=0;p=u[h++];)if(!p.isOrphan()){var d=p.getAttribute("data-craydent-bind").split(":")[0],f=$c.getProperty(n,"parents_"+o+".0")||t;u[h-1].replace(fillTemplate(s[d].template.replace_all("${craydent_bind}",c),f).toDomElement())}}}catch(m){error("observe.on_observable_change",m)}}function __or(){try{for(var e=0,r=arguments.length;r>e;e++){var t=arguments[e];if(t)return t}return""}catch(a){error("fillTemplate.__or",a)}}function __processBlocks(e,r,t,a){a=a||{};for(var i=[],n=[],s=0,o=[],c=0;~(s=$c.indexOfAlt(t,e,s))&&~(c=$c.indexOfAlt(t,r,c));)~s&&(n.push(s),s++),~c&&(o.push(c),c++);if(n.length!=o.length)return i.push({id:"##"+suid()+"##",block:"",body:"",code:t}),i;for(var l=OrderedList([],function(e,r){return e.end<r.end?-1:e.end>r.end?1:0});n.length;){for(var u=0;o[0]>n[u];)u++;u--,l.add({begin:n[u],end:o[0]}),$c.removeAt(n,u),$c.removeAt(o,0)}for(var p,h=t.match(r)[0].length,d=0;p=l[d++];){var f="##"+suid()+"##",m=t.slice(p.begin,p.end+h),_=m.match(e)[0].length,g=t.slice(p.begin+_,p.end);t=t.replace(m,f),i.push({id:f,block:m,body:g,code:t}),a[f]=m;for(var $,v=d;$=l[v++];){var y=m.length-f.length;$.end-=y,$.begin>p.end&&($.begin-=y)}}return i.reverse()}function __parseArithmeticExpr(e,r,t){try{var a;switch(t){case"$add":a=0;for(var i,n=0;i=r.$add[n++];)a+=__processExpression(e,i);return a;case"$subtract":return __processExpression(e,r.$subtract[0])-__processExpression(e,r.$subtract[1]);case"$multiply":a=1;for(var i,n=0;i=r.$multiply[n++];)a*=__processExpression(e,i)||0;return a;case"$divide":return __processExpression(e,r.$divide[0])/__processExpression(e,r.$divide[1]);case"$mod":return __processExpression(e,r.$mod[0])%__processExpression(e,r.$mod[1])}}catch(s){error("aggregate.__parseArithmeticExpr",s)}}function __parseArrayExpr(e,r,t){try{switch(t){case"$size":return(__processExpression(e,r[t],t)||[]).length}}catch(a){error("aggregate.__parseArrayExpr",a)}}function __parseBooleanExpr(e,r,t){try{var a,i=[],n=0;switch(t){case"$and":for(i=r.$and;a=i[n++];)if(!__processExpression(e,i))return!1;return!0;case"$or":for(i=r.$or;a=i[n++];)if(__processExpression(e,i))return!0;return!1;case"$not":return i=r.$not,!__processExpression(e,i[0])}}catch(s){error("aggregate.__parseBooleanExpr",s)}}function __parseComparisonExpr(e,r,t){try{var a=[void 0,null,Number,"undefined"!=typeof Symbol?Symbol:"Symbol",String,Object,Array,"undefined"!=typeof BinData?BinData:"BinData","undefined"!=typeof ObjectId?ObjectId:"ObjectId",Boolean,Date,"undefined"!=typeof Timestamp?Timestamp:"Timestamp",RegExp],i=__processExpression(e,r[t][0]),n=__processExpression(e,r[t][1]),s=null;switch(i==n&&(s=0),n>i&&(s=-1),i>n&&(s=1),$c.isNull(s)&&(i=a.indexOf(~[null,void 0].indexOf(i)?i:i.constructor),n=a.indexOf(~[null,void 0].indexOf(n)?n:n.constructor),n>i&&(s=-1),i>n&&(s=1)),t){case"$cmp":return s;case"$eq":return 0===s;case"$gt":return 1===s;case"$gte":return 1===s||0===s;case"$lt":return-1===s;case"$lte":return-1===s||0===s;case"$ne":return 0!==s}}catch(o){error("aggregate.__parse",o)}}function __parseCond(e,r){try{if(!$c.isObject(r)||!r.$cond)return r;var t,a,i,n=r.$cond;return $c.isArray(n)?(t=n[0],a=n[1],i=n[2]):(t=n["if"],a=n.then,i=n["else"]),__processExpression(e,t)?a:i}catch(s){error("aggregate.__parseCond",s)}}function __parseConditionalExpr(e,r,t){try{switch(t){case"$cond":return __parseCond(e,r);case"$ifNull":var a=__processExpression(e,r.$ifNull[0]);return isNull(a,__processExpression(e,r.$ifNull[1]))}}catch(i){error("aggregate.__parseConditionExpr",i)}}function __parseDateExpr(e,r,t){var a=__processExpression(e,r[t]);try{switch(t){case"$dayOfYear":return a.getDayOfYear();case"$dayOfMonth":return a.getDate();case"$dayOfWeek":return a.getDay()+1;case"$year":return a.getFullYear();case"$month":return a.getMonth()+1;case"$week":return a.getWeek();case"$hour":return a.getHours();case"$minute":return a.getMinutes();case"$second":return a.getSeconds();case"$millisecond":return a.getMilliseconds();case"$dateToString":return a=__processExpression(e,r[t].date),$c.format(a,r[t].format)}}catch(i){error("aggregate.__parseDateExpr",i)}}function __parseSetExpr(e,r,t){try{var a,i,n=1,s=0;switch(t){case"$setEquals":for(;a=r[t][n++];){var o=$c.duplicate(__processExpression(e,r[t][n-2])),c=$c.duplicate(__processExpression(e,a));if(!$c.isArray(o)||!$c.isArray(c))throw"Exception: All operands of $setEquals must be arrays. One argument is of type: "+$c.captialize(typeof($c.isArray(o)?c:o));if($c.toSet(o),$c.toSet(c),o.length!=c.length)return!1;for(var l=o.length;l>s;s++)if(!~c.indexOf(o[s]))return!1}return!0;case"$setIntersection":var u=$c.duplicate(__processExpression(e,r[t][0])),p="Exception: All operands of $setIntersection must be arrays. One argument is of type: ";if(!$c.isArray(u))throw p+$c.captialize(typeof u);for($c.toSet(u);a=r[t][n++];){var o=$c.duplicate(__processExpression(e,a));if(!$c.isArray(o))throw p+$c.capitalize(typeof o);if($c.toSet(o),o.length<u.length){var h=o;o=u,u=h}for(var l=u.length;l>s;s++)~o.indexOf(u[s])||($c.removeAt(u,s--),l--);if(!u.length)return u}return u;case"$setUnion":var u=$c.duplicate(__processExpression(e,r[t][0])),p="Exception: All operands of $setUnion must be arrays. One argument is of type: ";if(!$c.isArray(u))throw p+$c.capitalize(typeof u);for(;a=r[t][n++];){var d=$c.duplicate(__processExpression(e,a));if(!$c.isArray(d))throw p+$c.capitalize(typeof d);u=u.concat(d)}return $c.toSet(u);case"$setDifference":var f=$c.duplicate(__processExpression(e,r[t][0])),m=$c.duplicate(__processExpression(e,r[t][1])),u=[];if(!$c.isArray(f)||!$c.isArray(m))throw"Exception: All operands of $setEquals must be arrays. One argument is of type: "+$c.capitalize(typeof($c.isArray(f)?m:f));for(var l=f.length;l>s;s++){var i=f[s];~m.indexOf(i)||~u.indexOf(i)||u.push(i)}return u;case"$setIsSubset":var f=$c.duplicate(__processExpression(e,r[t][0])),m=$c.duplicate(__processExpression(e,r[t][1])),u=[];if(!$c.isArray(f)||!$c.isArray(m))throw"Exception: All operands of $setEquals must be arrays. One argument is of type: "+$c.capitalize(typeof($c.isArray(f)?m:f));return $c.isSubset(f,m);case"$anyElementTrue":for(var f=$c.duplicate(__processExpression(e,r[t][0])),_=[void 0,null,0,!1];i=f[s++];)if(!~_.indexOf(i))return!0;return!1;case"$allElementsTrue":for(var f=$c.duplicate(__processExpression(e,r[t][0])),_=[void 0,null,0,!1],l=f.length;l>s;s++)if(~_.indexOf(f[s]))return!1;return!0}}catch(g){error("aggregate.__parseSetExpr",g)}}function __parseStringExpr(e,r,t){try{switch(t){case"$concat":for(var a,i="",n=0;a=r.$concat[n++];)i+=__processExpression(e,a);return i;case"$substr":var s=r.$substr[1],o=r.$substr[2]<0?void 0:r.$substr[2];return __processExpression(e,r.$substr[0]).substr(s,o);case"$toLower":return(__processExpression(e,r.$toLower)||"").toLowerCase();case"$toUpper":return(__processExpression(e,r.$toLower)||"").toUpperCase();case"$strcasecmp":var c=""+(__processExpression(e,r.$strcasecmp[0])||""),l=""+(__processExpression(e,r.$strcasecmp[1])||"");if(c==l)return 0;if(l>c)return-1;if(c>l)return 1}}catch(u){error("aggregate.__parseStringExpr",u)}}function __parseVariableExpr(e,r,t){try{switch(t){case"$map":for(var a=__processExpression(e,r[t].input),i="$"+r[t].as,n=r[t]["in"],s=0,o=a.length;o>s;s++)e[i]=a[s],a[s]=__processExpression(e,n),delete e[i];return a;case"$let":var c=r[t].vars,l=[],u=null,s=0;for(var p in c)c.hasOwnProperty(p)&&(e["$"+p]=__processExpression(e,c[p]),l.push(p));u=__processExpression(e,r[t]["in"]);for(var s=0,o=l.length;o>s;s++)delete e[l[s]];return u}}catch(h){error("aggregate.__parseVariableExpr",h)}}function __processAccumulator(e,r,t,a){try{var i=__processExpression(e,r.$sum||r.$avg||r.$first||r.$last||r.$max||r.$min||r.$push||r.$addToSet||r.$stdDevPop||r.$stdDevSamp);switch(!0){case!!r.$sum:return(i||0)+(t||0);case!!r.$avg:return t=t||[],$c.isNull(i)||t.push(i),a.length==a.index+1&&(t=$c.average(t)),t;case!!r.$first:return $c.isNull(t)&&(t=i),t;case!!r.$last:return $c.isNull(i,t);case!!r.$max:return $c.isNull(t)&&(t=-9007199254740991),$c.isNull(i)&&(i=-9007199254740991),a.length==a.index+1&&i==t==-9007199254740991?void 0:Math.max(i,t);case!!r.$min:return $c.isNull(t)&&(t=9007199254740991),$c.isNull(i)&&(i=9007199254740991),a.length==a.index+1&&i==t==9007199254740991?void 0:Math.min(i,t||9007199254740991);case!!r.$push:return t=t||[],$c.isNull(i)||t.push(i),t;case!!r.$addToSet:return t=t||[],$c.isNull(i)||~t.indexOf(i)||t.push(i),t;case!!r.$stdDevSamp:return a.sample&&~a.sample.indexOf(e)&&($c.isNull(i)||(t=t||[],t.push(i))),a.length==a.index+1&&(t=$c.stdev(t||[])),$c.isNull(t)?null:t;case!!r.$stdDevPop:return $c.isNull(i)||(t=t||[],t.push(i)),a.length==a.index+1&&(t=$c.stdev(t)),$c.isNull(t)?null:t}}catch(n){error("aggregate.__processAccumulator",n)}}function __processAttributes(e){try{var r={},t=e.indexOf(">"),a=e.substring(1,t),i=$c.indexOfAlt(a,/\s|>/),n=(~i?a.substring(0,$c.indexOfAlt(a,/\s|>/)):a,~i?a.substring($c.indexOfAlt(a,/\s|>/)):""),s=e.substring(t+1,e.indexOf("<",t));if(n){r["#text"]=s;for(var o=n.split(" "),c=0,l=o.length;l>c;c++){var u=o[c];if(u){var p=u.split("=");r["@attributes"]=r["@attributes"]||{},r["@attributes"][p[0].trim()]=$c.tryEval(p[1])||p[1].trim()}}}return r}catch(h){error("xmlToJson.__processAttributes",h)}}function __processChildren(e,r){try{for(var t,a=0,i={};t=r[a++];){var n=t.indexOf(">"),s=t.lastIndexOf("</"),o=__processAttributes(t),c=$c.strip(t.substring(n+1,s),"\n").trim();1==r.length?i[e]=$c.merge(xmlToJson(c),o):(i[e]=i[e]||[],i[e].push($c.merge(o,$c.xmlToJson(c))))}return i}catch(l){error("xmlToJson.__processChildren",l)}}function __processExpression(e,r){try{if($c.isString(r))return"$"==r[0]&&(r=r.substr(1)),$c.getProperty(e,r.replace("$CURRENT.",""));if(!$c.isObject(r))return r;for(var t in r)if(r.hasOwnProperty(t)){var a=r[t],i=["$literal"],n=["$and","$or","$not"],s=["$setEquals","$setIntersection","$setUnion","$setDifference","$setIsSubset","$anyElementTrue","$allElementsTrue"],o=["$cmp","$eq","$gt","$gte","$lt","$lte","$ne"],c=["$add","$subtract","$multiply","$divide","$mod"],l=["$concat","$substr","$toLower","$toUpper","$strcasecmp"],u=["$size"],p=["$map","$let"],h=["$dayOfYear","$dayOfMonth","$dayOfWeek","$year","$month","$week","$hour","$minute","$second","$millisecond","$dateToString"],d=["$cond","$ifNull"];switch(!0){case!!~i.indexOf(t):return r;case!!~n.indexOf(t):return __parseBooleanExpr(e,r,t);case!!~s.indexOf(t):return __parseSetExpr(e,r,t);case!!~o.indexOf(t):return __parseComparisonExpr(e,r,t);case!!~c.indexOf(t):return __parseArithmeticExpr(e,r,t);case!!~l.indexOf(t):return __parseStringExpr(e,r,t);case!!~u.indexOf(t):return __parseArrayExpr(e,r,t);case!!~p.indexOf(t):return __parseVariableExpr(e,r,t);case!!~h.indexOf(t):return __parseDateExpr(e,r,t);case!!~d.indexOf(t):return __parseConditionalExpr(e,r,t);default:__processExpression(e,a)}}}catch(f){error("aggregate.__parseExpression",f)}}function __processGroup(e,r){try{for(var t,a=r._id,i=0,n={},s=[],o={index:0,length:e.length,sample:e.sample};t=e[o.index=i++];){var c,l="null",u=null;if(a){u={};for(var p in a)a.hasOwnProperty(p)&&(u[p]=__processExpression(t,a[p]));l=JSON.stringify(u)}n[l]?c=n[l]:(c=n[l]={_id:u},s.push(c));for(var p in r)r.hasOwnProperty(p)&&"_id"!=p&&(c[p]=__processAccumulator(t,r[p],c.hasOwnProperty(p)?c[p]:void 0,o))}return s}catch(h){error("aggregate.__processGroup",h)}}function __processSiblings(e){try{var r,t=e.split("<"),a={},i="",n="";a["#text"]=a["#text"]||"";for(var s=0;s<t.length;s++){var o=t[s];if(o)if(i){if(~(r=o.indexOf("/"+i+">"))){var c=$c.strip(o.substr(r+i.length+2),["\n"," "]);c&&(a["#text"]+=c),n+="<"+o.substring(0,r+i.length+2),a=$c.merge(a,xmlToJson(n)),i="",n=""}}else{if(r=o.indexOf(">"),!~r){s?n+=o:a["#text"]+=$c.strip(o,["\n"," "]);continue}i=o.split(/\s|>/)[0],n+="<"+o}}return a["#text"]||delete a["#text"],a}catch(l){error("xmlToJson.__processSiblings",l)}}function __processStage(e,r){try{var t="",a={};for(var i in r)if(r.hasOwnProperty(i)){if(t)throw"Exception: A pipeline stage specification object must contain exactly one field.";t=i,a=r[i]}switch(i){case"$project":return $c.where(e,{},a);case"$match":return $c.where(e,a);case"$redact":return _redact(e,a);case"$limit":return e.slice(0,a);case"$skip":return e.slice(a);case"$unwind":return _unwind(e,a);case"$group":return __processGroup(e,a);case"$sort":var n=[];for(var s in a)if(a.hasOwnProperty(s)){var o="";~a[s]||(o="!"),n.push(o+s)}return $c.sortBy(e,n);case"$out":var c=$c.duplicate(e,!0);return $c.isString(a)?$g[a]=c:$c.isArray(a)&&($c.removeAll(a),c=$c.merge(a,c)),c;case"$sample":for(var l=[],u=0,p=e.length-1;u<a.size;)l.push(e[Math.round($c.rand(0,p,!0))]),u++;return e.sample=l,e;case"$lookup":for(var h,u=0,l=a.from,d=a.localField,f=a.foreignField,s=a.as;h=e[u++];){var m={};m[f]=h[d]||{$exists:!1},h[s]=$c.where(l,m)}}return e}catch(_){error("aggregate.__processStage",_)}}function __pullHelper(e,r){for(var t=0,a=r.length;a>t;t++)for(var i=r[t],n=0,s=e.length;s>n;n++)$c.equals(i,e[n])&&($c.removeAt(e,n),n--,s--)}function __queryNestedProperty(e,r){if(e[r])return[e[r]];for(var t,a=r.split("."),i=[],n=0;t=a[n++];){if(!e.hasOwnProperty(t))return[];if($c.isArray(e[t])){if($c.isNull(a[n]))return e[t];for(var s=a.slice(n).join("."),o=e[t],c=0,l=o.length;l>c;c++)i=i.concat(__queryNestedProperty(o[c],s));return i}e=e[t]}return[e]}function __relativePathFinder(e){var r="",t="/";return e.startsWith("/")||/^[a-zA-Z]:\/|^\/\/.*/.test(e)||(r=Error().stack.split("\n")[3].replace(/.*?\((.*)/,"$1"),~r.indexOf("\\")&&(r=r.replace(/\\/g,"/")),e=r.substring(0,r.lastIndexOf(t)+1)+e),e}function __rest_docs(e,r,t){var a={all:$c.where(this.server.routes.all,{path:{$ne:"/craydent/api/docs"}},{path:1,parameters:[]}),"delete":$c.where(this.server.routes.delete,{path:{$ne:"/craydent/api/docs"}},{path:1,parameters:[]}),get:$c.where(this.server.routes.get,{path:{$ne:"/craydent/api/docs"}},{path:1,parameters:[]}),post:$c.where(this.server.routes.post,{path:{$ne:"/craydent/api/docs"}},{path:1,parameters:[]}),put:$c.where(this.server.routes.put,{path:{$ne:"/craydent/api/docs"}},{path:1,parameters:[]})};return"post"==e.method.toLowerCase()||"json"==t.f?this.send(a):(this.header({"Content-Type":"text/html"},200),void this.end(fillTemplate($c.REST_API_TEMPLATE,a)))}function __run_replace(reg,template,use_run,obj){try{var pre="",post="",split_param="|",match;for(use_run&&(pre="RUN[",post="]",split_param=/;(?!\\)/);(match=reg.exec(template))&&match[1];){var funcValue=[],func="";for(funcValue=$c.replace_all(match[1],["\\[","\\]"],["[","]"]).split(split_param);$c.count(funcValue[0],"{")!=$c.count(funcValue[0],"}")&&!$c.tryEval(funcValue[0]);)funcValue[0]+=($c.isString(split_param)?split_param:";")+funcValue[1],funcValue.splice(1,1);func=$c.strip(funcValue.splice(0,1)[0],";");for(var i=0,len=funcValue.length;len>i;i++){var fv=funcValue[i];~fv.indexOf("${")&&(funcValue[i]=fillTemplate(fv,obj));try{funcValue[i]=eval("("+$c.replace_all(fv,[";\\"],[";"])+")")}catch(e){}}funcValue=funcValue.map(function(e){return $c.tryEval(e)||e}),template=~template.indexOf(match[1])?template.replace(match[1],match[1]=$c.replace_all(match[1],["\\[","\\]"],["[","]"])):template,template=$c.replace_all(template,"${"+pre+match[1]+post+"}",$c.getProperty($g,func)?$c.getProperty($g,func).apply(obj,funcValue):($c.tryEval("("+func+")")||foo).apply(obj,funcValue)||"")}return template}catch(e){error("fillTemplate.__run_replace",e)}}function __universal_trim(e){try{if($c.isString(this))return _trim(this,void 0,e);if($c.isArray(this)){var r=e,t=[],a=!1;$c.isBoolean(r)&&(a=!0);for(var i=0,n=this.length;n>i;i++){var s=this[i];$c.isString(s)&&(t[i]=(""+s).trim())||(t[i]=s),a&&(this[i]=t[i])}return t}}catch(o){return error($c.getName(this.constructor)+".trim",o),!1}}function _ajaxServerResponse(response){try{if(4==response.readyState&&200==response.status){var objResponse={};try{objResponse=eval(response.responseText.trim())}catch(e){objResponse=eval("("+response.responseText.trim()+")")}return!objResponse||objResponse.hasErrors?!1:objResponse}return!1}catch(e){return error("ajax._ajaxServerResponse",e),!1}}function _binarySearch(e,r,t,a,i,n){if(a=$c.isNull(a)?0:a,i=$c.isNull(i)?e.length-1:i,n){if(!~i)return 0;if(e[a][r]>t)return a;if(e[i][r]<t)return i}if(a==i)return e[a][r]!=t?[]:[e[a]];var s=a+parseInt((i-a)/2);if(e[s][r]>t)return _binarySearch(e,r,t,a,s,n);if(e[s][r]<t)return _binarySearch(e,r,t,s,i,n);for(;e[a][r]<t;)a++;for(;e[i][r]>t;)i--;if(n)return i;var o=i-a+1;return 0==a&&o==e.length?e:e.slice(a,i+o)}function _condense(e,r){try{var t=[],a=[],i=!1;r&&r.constructor==Array&&(i=!0);for(var n=0,s=e.length;s>n;n++){var o=e[n];if(r){var c=n;if(i&&~r.indexOf(o)){t.push(n);continue}if(~t.indexOf(n))continue;for(;~(c=e.indexOf(o,c+1));)t.push(c)}""!==o&&!$c.isNull(o)&&!~(t.indexOf&&t.indexOf(n)||_indexOf(t,n))&&!$c.isNull(o)&&a.push(o)}return a}catch(l){return error("_condence",l),!1}}function _contains_lessthan(e,r){for(var t=0,a=e.length;a>t;t++)if(e[t]<r)return!0;return!1}function _contains_greaterthan(e,r){for(var t=0,a=e.length;a>t;t++)if(e[t]>r)return!0;return!1}function _contains_lessthanequal(e,r){for(var t=0,a=e.length;a>t;t++)if(e[t]<=r)return!0;return!1}function _contains_greaterthanequal(e,r){for(var t=0,a=e.length;a>t;t++)if(e[t]>=r)return!0;return!1}function _contains_mod(e,r){for(var t=0,a=e.length;a>t;t++)if(e[t]%r[0]==r[1])return!0;return!1}function _contains_type(e,r){for(var t=0,a=e.length;a>t;t++)if(e[t].constructor==r)return!0;return!1}function _copyWithProjection(e,r,t){var a={},i=0;if(e=e||"*",$c.isString(e)&&(e=e.split(",")),$c.isArray(e)){if(!(i=e.length))return a=$c.duplicate(r);var n=e;e={};for(var s,o=0;s=n[o++];)e[s]=1}for(var c in e)if(e.hasOwnProperty(c)&&e[c]){var l=$c.getProperty(r,c)||null;if("*"==c)a=$c.duplicate(r,!0);else if($c.parseBoolean(e[c]))(t||!$c.isNull(l))&&$c.setProperty(a,c,l);else if($c.isObject(e[c])||l)if($c.isObject(e[c])||l&&!$c.isArray(l))a[c]=__processExpression(r,e[c]);else if(l){var u=!0;if(".$"==c.slice(-2))c=c.slice(0,-2),a[c]=l.slice(0,1);else if(e[c].$elemMatch)a[c]=$c.where(l,e[c].$elemMatch).slice(0,1);else if(e[c].$slice){var p=0,h=$c.isInt(e[c].$slice)?e[c].$slice:0;$c.isArray(e[c].$slice)&&(p=e[c].$slice[0],h=e[c].$slice[1]),a[c]=l.slice(p,h)}else e[c]&&(u=!1,$c.setProperty(a,c,l));u&&!a[c].length&&delete a[c]}else a[c]=e[c];else a[c]=e[c]}return a}function _craydentSelector(e,r,t,a){try{if(!t||t===!0)return void 0;var i=$d[e](t);return a?i&&(i.length&&i[0]||i)||$w[r](t)[0]:i||$w[r](t)}catch(n){error("_craydentSelector",n)}}function _dataset(){try{var e=this.attributes,r={};for(var t in e)if(e.hasOwnProperty(t)){var a=e[t];0==a.name.indexOf("data-")&&(r[a.name.substring(5)]=a.value)}return r}catch(i){error("DOM._dataset",i)}}function _defineFunction(name,func,override){try{var args=_getFuncArgs(func),fstr=(""+func).replace(/this/g,"craydent_this"),extra_code="if(arguments.length == 0 && this == $c){return;}",fnew=0===args.length||1===args.length&&!_trim(args[0])?(""+fstr).replace(/(\(\s*?\)\s*?\{)/," (craydent_this){"+extra_code):"("+(""+fstr).replace(/\((.*?)\)\s*?\{/,"(craydent_this,$1){"+extra_code)+")";return eval(override||"undefined"===eval("typeof("+name+")")?"$c."+name+" = "+fnew:"$c."+name+" = "+fnew)}catch(ex){error("_defineFunction",ex)}}function _displayHelper(e,r){try{return $d.getElementById(e)&&$(e)[r]()||e instanceof HTMLElement&&e[r]()||$w["_"+r+"overwrite"](e)}catch(t){error("_displayHelper."+r,t)}}function _duplicate(obj,original,recursive){try{if($c.isString(obj)||$c.isString(original)||$c.isInt(obj)||$c.isInt(original)||$c.isFloat(obj)||$c.isFloat(original)||$c.isNumber(obj)||$c.isNumber(original))return original;var argIndex=3,ref=arguments[argIndex]||{objects:[{obj:original,path:"obj"}]},current_path=arguments[argIndex+1]||"obj";if((arguments[argIndex+2]||(arguments[argIndex+2]={}))&&(arguments[argIndex+2].command=arguments[argIndex+2].command||""),1!=ref.objects.length)for(var prop in obj)obj.hasOwnProperty(prop)&&delete obj[prop];var loop_func=function(e,r){if(!r.hasOwnProperty(e)||!r[e]||$c.isFunction(r[e])&&recursive){if(!r.hasOwnProperty(e))return}else{var t=$c.indexOfAlt(ref.objects,r[e],function(e,r){return e.obj===r}),a=current_path+"["+parseRaw(e)+"]";if(~t)return arguments[argIndex+1].command+=a+"="+ref.objects[t].path+";";if(typeof r[e]in{object:1,"function":1}&&recursive)return obj[e]="function"==typeof r[e].constructor?new r[e].constructor:{},ref.objects.push({obj:r[e],path:a}),_duplicate(obj[e],r[e],!0,ref,a,arguments[argIndex+1])}obj[e]=r[e]};if($c.isArray(original))for(var i=0,len=original.length;i++<len;)loop_func.call(obj,i-1,original,ref,current_path,arguments[argIndex+2]);else for(var prop in original)original.hasOwnProperty(prop)&&loop_func.call(obj,prop,original,ref,current_path,arguments[argIndex+2]);return arguments[argIndex+1]||eval(arguments[argIndex+2].command),obj}catch(e){error("_duplicate",e)}}function _endsWith(){try{var e=arguments;arguments.length<3&&($c.isArray(arguments[0])||$c.isArray(arguments[1]))&&(e=arguments[1]||arguments[0]);for(var r=0,t=e.length;t>r;r++){var a=e[r];if(a!=this&&a==this.slice(-a.length))return a}return!1}catch(i){error("String.endsWith",i)}}function _ext(e,r,t,a){try{$g.__craydentNoConflict||(e.prototype[r]=e.prototype[r]||t),_df(r,t,a)}catch(i){error("_ext",i)}}function _even(e){try{return isNaN(e)?!1:!(1&e)}catch(r){error("_even",r)}}function _firstElementChild(){try{for(var e=this.childNodes,r=0,t=e.length;t>r;r++)if(1==e[r].nodeType)return e[r];return!1}catch(a){return error("DOM._firstElementChild",a),!1}}function _getBrowserVersion(e){try{var r=this.navigator.userAgent.indexOf(e);if(!~r&&this["is"+e]())return-1;var t=parseFloat(this.navigator.userAgent.substring(r+e.length+1));return 0===t||t?t:-1}catch(a){error("_getBrowserVersion",a)}}function _getDimension(e,r){try{if(!e&&"body"==this.tagName.toLowerCase()){var t,a=$d.body.style[r];$d.body.style[r]="100%",t=$d.body[r](!0),$d.body.style[r]=a}var i=this.getClientRects&&this.getClientRects()[0];return i&&i[r]||this["offset"+r.capitalize()]||this["scroll"+r.capitalize()]}catch(n){if(!this.parentNode&&this!=$d){var s,o=this.cloneNode(!0);return o.style.visible="hidden",o.style.position="absolute",o["get"+r.capitalize()]=$d.body[r],$d.body.appendChild(o),s=o["get"+r.capitalize()](),o.remove(),s}return error("_getDimension",n),!1}}function _getFuncName(e){try{return _trim((""+e).replace(/\/\/.*?[\r\n]/gi,"").replace(/[\t\r\n]*/gi,"").replace(/\/\*.*?\*\//gi,"").replace(/.*?function\s*?(.*?)\s*?\(.*/,"$1"))}catch(r){error("_getFuncName",r)}}function _getFuncArgs(e){try{return _condense(_trim(_strip(""+e,"(")).replace(/\s*/gi,"").replace(/\/\*.*?\*\//g,"").replace(/.*?\((.*?)\).*/,"$1").split(","))||[]}catch(r){error("_getFuncArgs",r)}}function _getGMTOffset(){try{return this.getHours()-24-this.getUTCHours()}catch(e){error("_getGMTOffset",e)}}function _groupFieldHelper(e,r){for(var t,a="",i=0;t=r[i++];)a+=t+":"+$c.getProperty(e,t)+",";return a}function _indexOf(e,r){try{for(var t=e.length,a=0;t>a;){if(e[a]===r)return a;++a}return-1}catch(i){error("_indexOf",i)}}function _indexOfAlt(e,r){try{if($c.isArray(this)){for(var t=r,a=this.length,i=0;a>i;){if($c.isRegExp(e)&&e.test(this[i]))return i;if($c.isFunction(t)&&(e instanceof Object?t(this[i],e):t(this[i])===e))return i;++i}return-1}if($c.isString(this)){var n=e,s=r;if(isNull(n))return-1;s=s||0;var o=this.substring(s).search(n);return 0>o?o:o+s}}catch(c){error($c.getName(this.constructor)+".indexOfAlt",c)}}function _insertAfter(e,r){try{var t=e;if($c.isDomElement(this)){var a=$c.isFunction(e.nextElementSibling)?e.nextElementSibling():e.nextElementSibling;return a?e.parentNode.insertBefore(this,a):e.parentNode.appendChild(this),!0}if($c.isArray(this))return this.splice(t+1,0,r),!0}catch(i){return error(($c.isDomElement(this)?"DOM":_getFuncName(this.constructor))+".remove",i),!1}}function _insertAt(e,r){try{if($c.isArray(this))return this.splice(e,0,r),!0;if($c.isDomElement(e)){var t=e;e=r,r=t}if($c.isDomElement(r)){var a=this.children;return e=e||0,a.length>e?(this.insertBefore(r,a[e]),!0):a.length==e?(this.appendChild(r),!0):!1}}catch(i){return error(($c.isArray(this)?"Array":"DOM")+".insertAt",i),!1}}function _invokeHashChange(){try{var e=$COMMIT.onhashchange||$c.onhashchange;e&&$c.isFunction(e)&&e()}catch(r){error("_invokeHashChange",r)}}function _isArray(e){try{return isNull(e)?!1:e.constructor==Array}catch(r){error("_isArray",r)}}function _isString(e){try{return isNull(e)?!1:e.constructor==String}catch(r){error("_isString",r)}}function _joinHelper(e,r,t,a){var i=[],n=[],s=r[0]||{};if($c.isString(t)){t=t.split("="),1==t.length&&(t=[t,t]);var o=$c.getName(arguments.callee.caller);t=$c.trim(t),"joinRight"==o&&(t=[t[1],t[0]])}for(var c in s)s.hasOwnProperty(c)&&n.push(c);for(var l=0,u=e.length;u>l;l++){var p,h=$c.duplicate(e[l],!0),d={};if(d[t[1]]=h[t[0]],p=$c.where(r,d),p.length>0)i.push($c.merge(h,p[0]));else if(!a){for(var f=0,m=n.length;m>f;f++)h[n[f]]=h[n[f]]||null;i.push(h)}}return i}function _makePrecedenceBlocks(e){try{var r=e.indexOf("("),t={before:"",after:"",block:{}};if(~r){var a=e.lastIndexOf("(");return t.before=e.substring(0,r).trim(),t.after=e.substring(a).trim(),t.block=_makePrecedenceBlocks(e.substring(r+1,a-1)),t}return t.block=e,t}catch(i){error("_makePrecedenceBlocks",i)}}function _nextElementSibling(){try{for(var e=this.nextSibling;e&&1!=e.nodeType;)e=e.nextSibling;return e}catch(r){return error("DOM._nextElementSibling",r),!1}}function _on(e,r,t){if($c.isDomElement(this))try{if(r)this.events=this.events||{},this.events[e]=this.events[e]||[],this.events[e].push(r),!this.getAttribute("on"+e)&&this.setAttribute("on"+e,"this.on('"+e+"',null,(event || $w.event));");else for(var a,i=this.events[e],n=0;a=i[n++];)a(t)}catch(s){error("HTMLElement.on",s)}else if($c.isFunction(this))try{this["_"+e]=this["_"+e]||[],this["_"+e].push(r)}catch(s){error("Function.on",s)}else;}function _orderListHelper(e,r,t){try{var a=0,i=0,n=t.length;if(!~r(e,t[0]))return 0;if(1===r(e,t[n-1]))return n;for(;n>1;){n=Math.ceil(n/2),a=i+n;var s=r(e,t[a]);if(0===s)return a;1===s&&(i=a++)}return a}catch(o){return error("OrderedList._orderListHelper",o),!1}}function _processClause(e){try{var r=$c.indexOfAlt(e,/between/i);~r&&e.replace(/between( .*? )and( .*?)( |$)/gi,"between$1&and$2$3");for(var t,a=e.split(/ or /i),i={$or:[]},n=0;t=a[n++];){for(var s,o=t.split(/ and /i),c={$and:[]},l=0;s=o[l++];){var u=s,p={};switch(!0){case!!~(r=u.indexOf("=")):p[u.substring(0,r).trim()]={$equals:$c.tryEval(u.substring(r+1).trim())},c.$and.push(p);break;case!!~(r=u.indexOf("<>")):p[u.substring(0,r).trim()]={$ne:$c.tryEval(u.substring(r+1).trim())},c.$and.push(p);break;case!!~(r=u.indexOf(">")):p[u.substring(0,r).trim()]={$gt:$c.tryEval(u.substring(r+1).trim())},c.$and.push(p);break;case!!~(r=u.indexOf(">=")):p[u.substring(0,r).trim()]={$gte:$c.tryEval(u.substring(r+1).trim())},c.$and.push({$gte:p});break;case!!~(r=u.indexOf("<")):p[u.substring(0,r).trim()]={$lt:$c.tryEval(u.substring(r+1).trim())},c.$and.push(p);break;case!!~(r=u.indexOf("<=")):p[u.substring(0,r).trim()]={$lte:$c.tryEval(u.substring(r+1).trim())},c.$and.push(p);break;case 0==$c.indexOfAlt(u,/between/i):var h=u.replace(/between (.*?) &and (.*?) ( |$)/i,"$1,$2").split(",");c.$and.push({$gte:$c.tryEval(h[0])}),c.$and.push({$lte:$c.tryEval(h[1])});break;case!!~(r=$c.indexOfAlt(u,/ in /i)):var d=$c.tryEval(u.substring(r+4).trim().replace(/\((.*)\)/,"[$1]"));if(!d)throw"Invalid syntax near 'in'";p[u.substring(0,r).trim()]=d,c.$and.push({$in:p});break;case!!~(r=$c.indexOfAlt(u,/is null/i)):p[u.substring(0,r).trim()]=null,c.$and.push({$equals:p});break;case!!~(r=$c.indexOfAlt(u,/is not null/i)):p[u.substring(0,r).trim()]=null,c.$and.push({$ne:p});break;case!!~(r=$c.indexOfAlt(u,/ like /i)):var f="^"+$c.replace_all(_trim(u.substring(r+6),null,[" ","'",'"']),"%",".*?")+"$";p[u.substring(0,r).trim()]={$regex:RegExp(f,"i")},c.$and.push(p)}}i.$or.push(c)}return i}catch(m){error("where.processClause",m)}}function _querySelectorAll(e,r){var t,a=document.createStyleSheet(),i=[],n=document.all,s=0;for(a.addRule(e,"k:v");t=n[s++]&&i.length<r;)"bar"===t.currentStyle.foo&&i.push(t);return a.removeRule(0),i}function _redact(e,r){try{e=$c.isArray(e)?e:[e];
for(var t,a=[],i=0;t=e[i++];){var n=__parseCond(t,r);if("$$KEEP"==n)a.push(t);else if("$$DESCEND"==n){a.push(t);for(var s in t)!t.hasOwnProperty(s)||$c.isArray(t[s])&&!$c.isObject(t[s][0])||!$c.isArray(t[s])&&!$c.isObject(t[s])||(t[s]=_redact(t[s],r),void 0===t[s]&&delete t[s])}else if("$$PRUNE"!=n)throw"exception: $redact's expression should not return anything aside from the variables $$KEEP, $$DESCEND, and $$PRUNE, but returned "+parseRaw(n)}return a.length?a:void 0}catch(o){error("aggregate._redact",o)}}function _remove(e,r){try{if($c.isDomElement(this))return this.parentNode.removeChild(this);if($c.isArray(this)){r=r||this.indexOf;var t=r.call(this,e);return~t?this.splice(t,1)[0]:!1}}catch(a){return error(($c.isDomElement(this)?"DOM":_getFuncName(this.constructor))+".remove",a),!1}}function _replace_all(e,r,t){try{$c.isArray(e)||(e=[e]),$c.isArray(r)||(r=[r]);for(var a=this,i=0,n=0,s=e.length;s>n;n++){var o=e[n],c=RegExp(__convert_regex_safe(o),t);$c.contains(a,c)&&(a=a.replace(c,void 0===r[n]?r[i]:r[n]),r[i+1]&&i++)}return""+a}catch(l){error("_replace_all",l)}}function _run_func_array(e,r){var t=this;!$c.isArray(e)&&(e=[e]);for(var a,i=0,n=[];a=e[i++];)try{$c.isFunction(a)?n=n.concat(a.apply(t,r)):$c.isGenerator(a)&&$c.tryEval("$c.syncroit(function *(){rtn = rtn.concat(yield func.apply(self,args));});")}catch(s){throw s}return n}function _set(e,r,t,a,i){try{r=encodeURI(r);var n=a.ignoreCase||"ignoreCase"==a?"i":"",s=RegExp("(.*)?("+e+"=)(.*?)(([&]|[@])(.*)|$)",n),o="search",c="&",l="";return o=0==e.indexOf("@")?(c="","hash"):o,$COMMIT[o]=$COMMIT[o]||"",t?($COMMIT[o]=$COMMIT[o]||$l[o],l=s.test($COMMIT[o])?$COMMIT[o].replace(s,"$1$2"+r+"$4"):$COMMIT[o]+c+e+"="+r,"&"==c&&0==l.indexOf("&")&&(l="?"+l.substring(1)),$COMMIT[o]=l,$COMMIT.update=!0):(l=s.test(i[o])?i[o].replace(s,"$1$2"+r+"$4"):i[o]+c+e+"="+r,"&"==c&&0==l.indexOf("&")&&(l="?"+l.substring(1)),i[o]=l,"hash"==o&&($COOKIE("CRAYDENTHASH","#"==i.hash[0]?i.hash.substring(1):i.hash),_invokeHashChange())),i}catch(u){error("_set",u)}}function _setDOMElementProperties(e){try{if(!e)return;for(var r in $w.HTMLElement.prototype)if($w.HTMLElement.prototype.hasOwnProperty(r))try{("dataset"==r||"firstElementChild"==r||"nextElementSibling"==r)&&(e[r]=$w["_"+r]()),e[r]=$w.HTMLElement.prototype[r]}catch(t){}}catch(t){error("_setDOMElementProperties",t)}}function _startsWith(){try{var e=arguments;arguments.length<3&&($c.isArray(arguments[0])||$c.isArray(arguments[1]))&&(e=arguments[1]||arguments[0]);for(var r=0,t=e.length;t>r;r++){var a=e[r];if(a!=this&&a==this.slice(0,a.length))return a}return!1}catch(i){error("String.startsWith",i)}}function _strip(e,r){try{return _trim(e,void 0,r)}catch(t){error("_strip",t)}}function _subFieldHelper(e,r){try{if(!$c.isObject(e))return!1;for(var t in e)if(e.hasOwnProperty(t)&&t in r)return t;return!1}catch(a){error("_subFieldHelper",a)}}function _subQuery(e,r,t){try{if(!$c.isObject(e))return~r.indexOf(".")?"$c.equals($c.getProperty(record.'"+r+"'), "+$c.parseRaw(e)+")":"$c.equals(record['"+r+"'], "+$c.parseRaw(e)+")";var a="true",i={$lt:"_clt",$lte:"_clte",$gt:"_cgt",$gte:"_cgte"};for(var n in e)if(e.hasOwnProperty(n))switch(n){case"$equals":case"$eq":case"$regex":case"$ne":var s=$c.getValue(e[n]),o="("+$c.parseRaw(s)+")";$c.isFunction(s)?o+="(record,'"+r+"',index)":o="$c.contains(values,"+o+")",a+=" && ((values = _qnp(record, '"+r+"')).length && "+("$ne"==n?"!":"")+o+")";break;case"$lt":case"$lte":case"$gt":case"$gte":a+=" && ((values = _qnp(record, '"+r+"')).length && "+i[n]+"(values,"+$c.parseRaw(e[n])+",'"+n+"'))";break;case"$exists":a+=" && ((finished = {validPath:0}),$c.getProperty(record,'"+r+"','.',finished),finished.validPath == "+e.$exists+")";break;case"$type":var c=$c.isNull(e.$type)?"!":"";a+=" && ("+c+"(values = _qnp(record, '"+r+"')).length && _ct(values,"+$c.getName(e.$type)+",'"+n+"'))";case"$text":break;case"$mod":var l=$c.isArray(e.$mod);a+=" && ((values = _qnp(record, '"+r+"')).length && "+l+" && _cm(values,"+$c.parseRaw(e[n])+",'"+n+"'))";break;case"$all":var u=$c.parseRaw(e.$all)||void 0;a+=" && (values = _qnp(record, '"+r+"')),(all = "+u+"),($c.isArray(values[0]) && $c.isArray(all)) && (function(){ for (var j = 0, jlen = all.length; j < jlen; j++){ if (!$c.contains(values[0],all[j])) { return false; }} return true;})()";break;case"$size":var p=parseInt(e.$size);a+=" && (values = _qnp(record, '"+r+"')[0]),($c.isArray(values) ? ("+p+" === values.length) : (values == undefined && 0 === "+p+"))";break;case"$where":var s="("+($c.isFunction(e.$where)?""+e.$where:"function(){return ("+e.$where+");}")+")";a+=" && "+s+".call(record)";break;case"$elemMatch":a+=" && (values = _qnp(record, '"+r+"')[0]),($c.isArray(values) && !!$c.where(values,"+$c.parseRaw(e.$elemMatch)+",1).length)";break;case"$or":case"$nor":var h,d=e[n],f=0,m="";if(!$c.isArray(d))return!1;for("$nor"==n&&(m="!"),a+=" && "+m+"(";h=d[f++];)a+="("+_subQuery(h,r,t)+") || ";a+="false)";break;case"$and":var _,g=e.$and,$=0;if(!$c.isArray(g))return!1;for(a+=" && (";_=g[$++];)a+="("+_subQuery(_,r,t)+") && ";a+="true)";break;case"$not":if(!$c.isObject(e.$not)){a+=" && $c.contains(values, "+$c.parseRaw(e.$not)+")";break}a+=" && !("+_subQuery(e[n],r)+")";break;case"$in":case"$nin":a+=" && "+("$nin"==n?"!":"")+"((values = _qnp(record, '"+r+"')[0]),$c.contains("+$c.parseRaw(e[n])+",values))";break;default:a+=" && "+_subQuery(e[n],$c.replace_all(n,"'","\\'"))}return a}catch(v){error("_subQuery",v)}}function _toCurrencyNotation(e){e=e||",";var r=""+this,t="";if("."!=e){var a=r.split(".");a.length>1&&(r=a[0],t="."+a[1])}return r.replace(/\B(?=(\d{3})+(?!\d))/g,e)+t}function _trim(str,side,characters){try{var temp=str,trimChars={" ":1," ":1,"\n":1};if(characters)if(_isArray(characters)){var ch,i=0;for(trimChars={};ch=characters[i++];)trimChars[ch]=1}else _isString(characters)&&(trimChars=eval('({"'+__convert_regex_safe(characters)+'":1})'));if(!side||"l"==side)for(;temp.charAt(0)in trimChars;)temp=temp.substring(1);if(!side||"r"==side)for(;temp.charAt(temp.length-1)in trimChars;)temp=temp.substring(0,temp.length-1);return""+temp}catch(e){error("_trim",e)}}function _unwind(e,r){try{var t,a=[],i=0,n={};for($c.isObject(r)&&(n=r,r=n.path);t=e[i++];){var s=__processExpression(t,r);if(isNull(s)||$c.isArray(s)&&$c.isEmpty(s))t=$c.duplicate(t),n.includeArrayIndex&&(t[n.includeArrayIndex]=0),n.preserveNullAndEmptyArrays&&a.push(t);else{if(!$c.isArray(s))throw"Exception: Value at end of $unwind field path '"+r+"' must be an Array, but is a "+(typeof s).capitalize()+".";"$"==r[0]&&(r=r.substr(1));for(var o=0,c=s.length;c>o;o++){var l=$c.duplicate(t);n.includeArrayIndex&&(l[n.includeArrayIndex]=o),$c.setProperty(l,r,s[o]),a.push(l)}}}return a}catch(u){error("aggregate._unwind",u)}}function addObjectPrototype(name,fn,override){try{if($c.isNull($g.__craydentNoConflict)||!$g.__craydentNoConflict){var shouldOverride=!1;"undefined"==eval("typeof("+name+")")&&(shouldOverride=!0),!override&&Object.prototype[name]||Object.defineProperty(Object.prototype,name,{writable:!0,enumerable:!1,configurable:!0,value:fn}),override=shouldOverride}}catch(e){error("addPrototype",e);try{if(Array.prototype[name]=!override&&Array.prototype[name]||fn,Function.prototype[name]=!override&&Function.prototype[name]||fn,String.prototype[name]=!override&&String.prototype[name]||fn,Number.prototype[name]=!override&&Number.prototype[name]||fn,Boolean.prototype[name]=!override&&Boolean.prototype[name]||fn,navigator.geolocation){var GeoLocation=navigator.geolocation.constructor;GeoLocation.prototype[name]=!override&&GeoLocation.prototype[name]||fn}}catch(ex){error("addPrototype:Non-ECMAScript 5",e)}}return _df(name,fn,override)}function addHTMLPrototype(name,fn,override){try{var prototypeDefined=!!HTMLElement.prototype[name];prototypeDefined&&HTMLElement.prototype[name].overwritten&&(override=!0);var original=override?"":"HTMLElement.prototype."+name+" || ";eval("HTMLElement.prototype."+name+" = "+original+"fn"),(!prototypeDefined||override)&&(HTMLElement.prototype[name].overwritten=!0),$c.isFunction($w.HTMLElement)&&$d.body&&(!$d.body[name]||override)&&($d.body[name]=fn),_df(name,fn,override)}catch(e){error("addHTMLPrototype",e)}}function Benchmarker(){try{this.executionTime=0,this.start=function(){this._start=new Date,this._end=0},this.stop=function(){return this._end=new Date,this.executionTime=(this._end-this._start)/1e3},this.start()}catch(e){error("BenchMarker",e)}}function Cursor(e){try{var r=[],t=0,a=$c.duplicate(e||[],!0);if($c.isObject(a)){for(var i in a)a.hasOwnProperty(i)&&r.push(i);r.sort()}else if($c.isArray(a))for(var n=0,s=a.length;n++<s;)r.push(n-1);return a.hasNext=function(){return t<r.length},a.next=function(){return this.current=this[r[t]],{value:this[r[t++]],done:t>=this.size()}},a.reset=function(){t=0},a.setNextIndex=function(e){e=parseInt(e)||0,0>e?e=0:e<r.length||(e=r.length-1),t=e,a.current=a[r[t]]},a.current=a[r[t]],a.size=function(){return r.length},a}catch(o){error("Cursor",o)}}function OrderedList(e,r){try{r=r||function(e,r){return r>e?-1:e>r?1:0};var t=$c.duplicate(e||[],!0).sort(r),a=0;return t.add=function(e){if(!this.length)return this.push(e);var t=_orderListHelper(e,r,this);return $c.insertBefore(this,t,e)},t.next=function(){return{value:this[a++],done:a>=this.size()}},t.hasNext=function(){return a<this.size()},t.size=function(){return this.length},t}catch(i){error("OrderedList",i)}}function Queue(e){try{var r=$c.duplicate(e||[],!0),t=0;return r.enqueue=function(e){this.push(e)},r.dequeue=function(){return this.splice(0,1)[0]},r.next=function(){return{value:this[t++],done:t>=this.size()}},r.hasNext=function(){return t<this.size()},r.size=function(){return this.length},r}catch(a){error("Queue",a)}}function Set(e){try{var r=$c.duplicate(e||[]),t=0;return r.add=function(e){for(var t=!0,a=0,i=this.length;i>a;a++)if($c.equals(e,this[a])){t=!1;break}return t?!!r.push(e):!1},r.clear=function(e,r){$c.removeAll(this,e,r)},r.clean=function(){$c.toSet(this)},r.next=function(){return{value:this[t++],done:t>=this.size()}},r.hasNext=function(){return t<this.size()},r.size=function(){return this.length},r.clean(),r}catch(a){error("Set",a)}}function ajax(params,returnData){try{$c.isString(params)&&(params={url:params});var need_to_shard=!1,browser_url_limit=1500,query,url,rtn,alwaysResolve=params.alwaysResolve===!1?!1:!0;params.dataType=params.dataType||"json",params.hitch=params.hitch||"",params.onbefore=params.onbefore||[foo],params.oncomplete=params.oncomplete||[foo],params.onerror=params.onerror||params.onresponse||[foo],params.onsuccess=params.onsuccess||params.onresponse||[foo],params.query=params.data||params.query||"",params.timeout=params.timeout||12e4,params.jsonp=(params.jsonp||"callback")+"=",$c.isArray(params.oncomplete)||(params.oncomplete=[params.oncomplete]),$c.isArray(params.onbefore)||(params.onbefore=[params.onbefore]),$c.isArray(params.onerror)||(params.onerror=[params.onerror]),$c.isArray(params.onresponse)||(params.onresponse=[params.onresponse]),$c.isArray(params.onsuccess)||(params.onsuccess=[params.onsuccess]),(params.onsuccess.length>1||params.onsuccess[0]==foo)&&(alwaysResolve=params.alwaysResolve||!1),params.thiss=this,params.url=params.url||"";var cbk=function(res,rej){if("jsonp"==params.dataType.toLowerCase()){for(var head=$d.getElementsByTagName("head")[0],func=params.jsonpCallback||"_cjson"+Math.floor(1e6*Math.random()),insert="insertBefore",tag=$d.createElement("script");!params.jsonpCallback&&$w[func];)func="_cjson"+Math.floor(1e6*Math.random());if(params.jsonpCallback&&(params.onsuccess=$w[func]),$w[func]=function(e){if(params.query){var r=params.thiss;delete params.thiss,ajax.call(r,params)}else{var t=e.code||500,a=res;if(!$c.isNull(e.hasErrors)&&e.hasErrors||!$c.isNull(e.hasErrors)&&!e.success?(_run_func_array.call(params.context||params.thiss,params.onerror,[e,params.hitch,params.thiss,params.context,e.code||500]),a=alwaysResolve?res:rej):_run_func_array.call(params.context||params.thiss,params.onsuccess,[e,params.hitch,params.thiss,params.context,t=200]),_run_func_array.call(params.context||this,params.oncomplete,[e,params.hitch,params.thiss,params.context,params.context,t]),params.jsonpCallback)$w[func]=params.onsuccess;else try{delete $w[func]}catch(i){$w[func]=void 0}var n=e;("response"==returnData||"res"==returnData||"request"==returnData||"req"==returnData)&&(n=tag),a(n)}},params.shard_data&¶ms.query&&!$c.isObject(params.query)&¶ms.query.length>browser_url_limit){need_to_shard=!0;var query_parts=params.query;params.query={},query_parts=0==query_parts.indexOf("?")?query_parts.substr(1):query_parts,query_parts=query_parts.split("&"),query_parts.map(function(e){var r=e.split("=");this[encodeURIComponent(r[0])]=encodeURIComponent(r[1])},params.query)}else params.query&&$c.isObject(params.query)&&(query=$c.toStringAlt(params.query,"=","&",!0),query.length>browser_url_limit?need_to_shard=!0:params.query=query);if(query=params.query,url=params.url,need_to_shard){params.__FIRST=isNull(params.__FIRST),params.__EOF=!0,query="&EOQ=false";for(var prop in params.query){if((query+prop+"xxx").length>browser_url_limit)break;if(query+="&"+encodeURIComponent(prop)+"="+encodeURIComponent(params.query[prop]),query.length>browser_url_limit){var left_over=query.substr(browser_url_limit);query=query.substr(0,browser_url_limit),params.query[prop]=left_over;break}delete params.query[prop]}}else params.__EOF&&(params.__EOF="true"),delete params.query;return query=(params.run?"&run="+params.run:"")+(query||"")+(params.__EOF&&"true"===params.__EOF&&"&EOQ=true"||"")+(params.__FIRST&&"&FIRST=true"||""),url+=(~params.url.indexOf("?")?"&":"?")+(params.jsonp||"callback=")+func+(query||""),tag.type="text/javascript",tag.async="async",tag.src=url,tag.onload=tag.onreadystatechange=function(){try{(!this.readyState||/complete|loaded/.test(""+this.readyState))&&(this.onload=this.onreadystatechange=null,head&&this.parentNode&&!~IEVersion()&&head.removeChild(this))}catch(e){error("ajax.tag.statechange",e)}},_run_func_array.call(params.context||this,params.onbefore,[tag,params.hitch,this]),head[insert](tag,head.firstChild),tag}var httpRequest=new Request,fileUpload=httpRequest.upload||{};params.method=params.method||"POST",params.headers=params.headers||[],params.query&&$c.isObject(params.query)&&(params.query=$c.toStringAlt(params.query,"=","&",!0)),params.query=(params.run?"run="+params.run:"")+(params.query||""),params.contentType=params.contentType||"application/x-www-form-urlencoded",params.onstatechange=params.onstatechange||foo,fileUpload.onload=params.onfileload||foo,fileUpload.onprogress=params.onprogress||foo,fileUpload.onabort=params.onabort||foo,fileUpload.onerror=params.onerror||foo,fileUpload.onloadstart=params.onloadstart||foo,"GET"==params.method&&(params.url+=params.query?"?"+params.query:"",params.query=void 0),_run_func_array.call(params.context||this,params.onbefore,[httpRequest,params.hitch,this]),httpRequest.onreadystatechange=function(xp){params.onstatechange(xp);var resrej=res,data=_ajaxServerResponse(this),done=4==this.readyState;if(data)_run_func_array.call(params.context||this,params.onsuccess,[data,params.hitch,params.thiss,params.context,this.status]);else if(done)try{var resrej=alwaysResolve?res:rej;_run_func_array.call(params.context||this,params.onerror,[eval(this.responseText),params.hitch,params.thiss,params.context,this.status])}catch(e){_run_func_array.call(params.context||this,params.onerror,[this.responseText,params.hitch,params.thiss,params.context,this.status])}done&&_run_func_array.call(params.context||this,params.oncomplete,[data,params.hitch,params.thiss,params.context,this.status]);var rtn=data;"response"==returnData||"res"==returnData?rtn=this:("request"==returnData||"req"==returnData)&&(rtn=httpRequest),resrej(rtn)},httpRequest.open(params.method,params.url,!0),httpRequest.setRequestHeader("Content-type",params.contentType);for(var i=0;i<params.headers.length;i++){var header=params.headers[i];httpRequest.setRequestHeader(header.type,header.value)}return httpRequest.send(params.query),httpRequest}.bind(this),prm={};return"undefined"!=typeof Promise&&-1!==(""+Promise).indexOf("[native code]")&&1==params.onsuccess.length&¶ms.onsuccess[0]===foo?(prm=new Promise(cbk),prm._then=prm.then||foo,prm.then=function(e,r){return alwaysResolve=params.alwaysResolve||!1,params.onsuccess.push(e),params.onerror.push(r),this}):(prm=cbk(foo,foo),prm.then=function(e){return params.onsuccess.push(e),this}),prm.otherwise=function(e){return alwaysResolve=params.alwaysResolve||!1,params.onerror.push(e),this},prm["finally"]=function(e){return alwaysResolve=params.alwaysResolve||!1,params.oncomplete.push(e),this},prm}catch(e){error("ajax",e)}}function Request(){var r;try{r=new XMLHttpRequest}catch(t){try{r=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{r=new ActiveXObject("Microsoft.XMLHTTP")}catch(t){return error("Request",e),null}}}return r}function Responsivizer(){return this.Body=$d.getElementsByTagName("body")[0],this.resp_class="responsive ",this.respond=function(){this.updateInfo();var e=this.resp_class;this.winW>1049&&(e+="large-window "),this.winW<1050&&this.winW>700&&(e+="medium-window ",e+=this.winW>800?"landscape ":"portrait "),this.winW>700||(e+="small-window ",e+=this.winW>420?"landscape ":"portrait "),this.Body.className=e},this.updateInfo=function(){this.winW=$(window).width(),this.winH=$(window).height()},this.respond(),this}function $COOKIE(e,r,t){try{t=t||{};var a=$d.cookie,i="",n="",s=[],o=[];if(t.cookie&&(a=t.cookie),$c.isObject(e)){t=r;for(var c in e)e.hasOwnProperty(c)&&(r.push(JSON.s