Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

j3

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

j3 - npm Package Compare versions

Comparing version 0.3.2 to 0.3.4

coffee/unique.coffee

2

lib/js/j3.core.min.js

@@ -1,1 +0,1 @@

(function(){var e,t,n,r,i,s,o,u=[].slice;r=this,n=function(){return n.$.apply(this,arguments)},typeof exports!="undefined"?typeof module!="undefined"?module.exports=n:exports.j3=n:r.j3=n,n.version="0.0.2",n.fnRetFalse=function(){return!1},n.isRunInServer=function(){return n.UA.name==="server"},n.has=function(e,t){return e.hasOwnProperty(t)},n.isUndefined=function(e){return typeof e=="undefined"},n.isBoolean=function(e){return typeof e=="boolean"},n.isFunction=function(e){return typeof e=="function"},n.isString=function(e){return typeof e=="string"},n.isObject=function(e){return typeof e=="object"},n.isNull=function(e){return e===null},n.isNullOrUndefined=function(e){return n.isNull(e)||n.isUndefined(e)},i=Object.prototype.toString,n.isDate=function(e){return"[object Date]"===i.call(e)},n.isArray=function(e){return"[object Array]"===i.call(e)},n.isDateTime=function(e){return e instanceof n.DateTime},n.bind=function(e,t,n){return n?function(){return e.apply(t,n)}:function(){return e.call(t)}},n.clone=function(e,t,r){var i,s,o,u,a,f,l;if(!n.isObject(e))return e;if(e===null)return null;if(n.isDate(e))return new Date(e.getTime());if(n.isArray(e)){o=[];for(u=0,f=e.length;u<f;u++)i=e[u],o.push(n.clone(i));return o}if(n.isFunction(e.clone))return e.clone(t);o={};if(arguments.length===1)for(s in e)o[s]=n.clone(e[s]);else for(a=0,l=t.length;a<l;a++)s=t[a],e.hasOwnProperty(s)&&(r?n.isUndefined(e[s])||(o[s]=n.clone(e[s])):o[s]=n.clone(e[s]));return o},n.equals=function(e,t){var r,i;if(typeof e!=typeof t)return!1;if(n.isNull(e))return n.isNull(t);if(!n.isObject(e))return e===t;if(n.isDate(e))return e.getTime()===t.getTime();if(n.isArray(e)){if(e.length!==t.length)return!1;r=-1;while(++r<e.length)if(!n.equals(e[r],t[r]))return!1;return!0}if(n.isFunction(e.equals))return e.equals(t);if(n.isObject(e)&&n.isObject(t)){for(i in e)if(!n.equals(e[i],t[i]))return!1;return!0}return!1},n.compare=function(e,t,r){if(n.isNullOrUndefined(e))return n.isNullOrUndefined(t)?0:r?1:-1;if(n.isNullOrUndefined(t))return r?-1:1;if(n.isDateTime(e)||n.isDate(e))e=e.getTime();if(n.isDateTime(t)||n.isDate(t))t=t.getTime();if(n.isObject(e)){if(n.isFunction(e.compare))return e.compare(t);if(!n.isObject(t))return 1}if(n.isObject(t)){if(n.isFunction(t.compare))return t.compare(e);if(!n.isObject(e))return-1}return e===t?0:e>t?1:-1},n.$=function(e){return typeof e=="string"?document.getElementById(e):e},n.guid=function(){var e,t,n,r;n="";for(e=r=1;r<33;e=++r){t=Math.floor(Math.random()*16).toString(16),n+=t;if(e===8||e===12||e===16||e===20)n+="-"}return n},n.ns=function(e){var t,n,r,i,s;r=e.split("."),t=typeof window=="undefined"?global:window;for(i=0,s=r.length;i<s;i++)n=r[i],t[n]||(t[n]={}),t=t[n];return t},t=n.ext=function(){var e,t,n,r,i,s;n=arguments[0],t=2<=arguments.length?u.call(arguments,1):[];for(i=0,s=t.length;i<s;i++){e=t[i];for(r in e)n[r]=e[r]}return n},n.cls=function(e,t){var n,r,i;return arguments.length===1&&(t=e,e=null),r=t.ctor,e?r?t.ctor=function(){return e.apply(this,arguments),r.apply(this,arguments)}:t.ctor=function(){return e.apply(this,arguments)}:r||(t.ctor=function(){}),n=t.ctor,i=n.prototype,e&&this.ext(i,e.prototype),this.ext(i,t),this.has(t,"toString")&&(i.toString=t.toString),n.base=function(){return e.prototype},n},n.UA=function(){var e,t,n,r;return t={ie:0,gecko:0,webkit:0,opera:0,name:"",N_IE:"MSIE",N_FIREFOX:"Firefox",N_OPERA:"Opera",N_CHROME:"Chrome",N_SAFARI:"Safari"},this.navigator?(n=this.navigator.userAgent,n.indexOf(t.N_IE)>-1?(t.ie=!0,t.name=t.N_IE):n.indexOf(t.N_FIREFOX)>-1?(t.gecko=!0,t.name=t.N_FIREFOX):n.indexOf(t.N_OPERA)>-1?(t.opera=!0,t.name=t.N_OPERA):n.indexOf(t.N_CHROME)>-1?(t.webkit=!0,t.name=t.N_CHROME):n.indexOf(t.N_SAFARI)>-1&&(t.webkit=!0,t.name=t.N_SAFARI),t.name===t.N_OPERA||t.name===t.N_SAFARI?e=n.indexOf("Version")+8:e=n.indexOf(t.name)+t.name.length+1,r=parseFloat(n.substring(e,e+4).match(/\d+\.\d{1}/i)[0]),t.ie?t.ie=r:t.gecko?t.gecko=r:t.opera?t.opera=r:t.webkit&&(t.webkit=r),t):(t.name="server",t)}(),n.UA.ie>=8||n.UA.opera||n.UA.webkit?n.StringBuilder=n.cls({ctor:function(){this._data=""},append:function(e){return this._data+=e,this},encodeAndAppend:function(e){return this._data+=n.htmlEncode(e),this},clear:function(){return this._data="",this},toString:function(){return this._data}}):n.StringBuilder=n.cls({ctor:function(){this._data=[]},append:function(e){return this._data[this._data.length]=e,this},encodeAndAppend:function(e){return this._data[this._data.length]=n.htmlEncode(e),this},clear:function(){return this._data=[],this},toString:function(){return this._data.join("")}}),o=n.StringBuilder.prototype,o.a=o.append,o.e=o.encodeAndAppend,n.UrlQuery=n.cls({ctor:function(){this._query={}},get:function(e){if(!this._query)return;return this._query[e]},set:function(e,t){var n;return(n=this._query)==null&&(this._query={}),this._query[e]=t},unset:function(e){if(!this._query)return;return delete this._query[e]},toString:function(){var e,t,r,i,s;r=new n.StringBuilder,e=!0,s=this._query;for(t in s)i=s[t],e?e=!1:r.a("&"),r.a(t+"="+encodeURIComponent(i));return r.toString()}}),function(e){var t,n,r,i,s,o,a,f,l,c,h,p;return f=1e3,a=6e4,o=36e5,r=864e5,l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],c=/^(\d{4})-(\d{1,2})-(\d{1,2})(?: (\d{1,2}):(\d{1,2}):(\d{1,2})(?:.(\d{1,3}))?)?$/,h=/^(\d{1,2})\/(\d{1,2})\/(\d{4})(?: (\d{1,2}):(\d{1,2}):(\d{1,2})(?:.(\d{1,3}))?)?$/,p=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:T(\d{1,2}):(\d{1,2}):(\d{1,2})(?:.(\d{1,3}))?)?Z$/,i="yyyy-MM-dd HH:mm:ss",s="yyyy-MM-ddTHH:mm:ssZ",t=e.cls({ctor:function(e,t,n,r,i,s,o){var u;u=arguments.length,u===0?this._value=new Date:u===1?this._value=new Date(e):(t=t||0,n=n||0,r=r||0,i=i||0,s=s||0,o=o||0,this._value=new Date(e,t-1,n,r,i,s,o))},getYear:function(){return this._value.getFullYear()},getMonth:function(){return this._value.getMonth()+1},getDay:function(){return this._value.getDate()},getDayOfWeek:function(){return this._value.getDay()},justDate:function(){return new t(this.getYear(),this.getMonth(),this.getDay())},justTime:function(){return new t(this._value.getTime()%r)},addYear:function(e){return new t(this._value.getFullYear+e,this._value.getMonth()+1,this._value.getDate(),this._value.getHours(),this._value.getMinutes(),this._value.getSeconds(),this._value.getMilliseconds())},addMonth:function(e){var n,r;return n=this._value.getFullYear()*12+this._value.getMonth()+1+e,r=parseInt(n/12),n%=12,new t(r,n,this._value.getDate(),this._value.getHours(),this._value.getMinutes(),this._value.getSeconds(),this._value.getMilliseconds())},addDay:function(e){return new t(this._value.getTime()+r*e)},addHour:function(e){return new t(this._value.getTime()+o*e)},addMinute:function(e){return new t(this._value.getTime()+a*e)},addSecond:function(e){return new t(this._value.getTime()+f*e)},addMillisecond:function(e){return new t(this._value.getTime()+e)},toString:function(e){return e==null&&(e=i),t.format(this._value,e)},toUTCString:function(){return t.format(this._value,s,!0)},toJson:function(t){return e.isUndefined(t)&&(t=new e.StringBuilder),t.append('"'),t.append(this.toUTCString()),t.append('"')},getValue:function(){return new Date(this._value.getTime())},getTime:function(){return this._value.getTime()},equals:function(e){return e?this._value.getTime()===e._value.getTime():!1},clone:function(){return new t(this._value.getTime())}}),e.ext(t,{UTC:function(e,n,r,i,s,o,u){var a,f;return a=arguments.length,a===0?f=(new Date).getTime():a===1?f=e:(n=n||0,r=r||0,i=i||0,s=s||0,o=o||0,u=u||0,f=Date.UTC(e,n-1,r,i,s,o,u)),new t(f)},format:function(e,n,r){var s,o,u,a,f,c,h;e instanceof t&&(e=e.getValue());if(typeof e=="number")e=new Date(e);else if(!e instanceof Date)return"";return n==null&&(n=i),r?(h=e.getUTCFullYear().toString(),f=(e.getUTCMonth()+1).toString(),o=e.getUTCDate().toString(),u=e.getUTCHours().toString(),a=e.getUTCMinutes().toString(),c=e.getUTCSeconds().toString()):(h=e.getFullYear().toString(),f=(e.getMonth()+1).toString(),o=e.getDate().toString(),u=e.getHours().toString(),a=e.getMinutes().toString(),c=e.getSeconds().toString()),s=n.replace("yyyy",h),s=s.replace("MMM",l[e.getMonth()]),s=s.replace("MM",f.length===1?"0"+f:f),s=s.replace("dd",o.length===1?"0"+o:o),s=s.replace("HH",u.length===1?"0"+u:u),s=s.replace("mm",a.length===1?"0"+a:a),s=s.replace("ss",c.length===1?"0"+c:c),s=s.replace("yy",h.substr(2)),s=s.replace("M",f),s=s.replace("d",o),s=s.replace("H",u),s=s.replace("m",a),s.replace("s",c)},formatUTC:function(e,t){return t==null&&(t=s),this.format(e,t,!0)},parse:function(e){var n;return e instanceof t?e:(n=p.exec(e),n?t.UTC(parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10),parseInt(n[4],10),parseInt(n[5],10),parseInt(n[6],10),parseInt(n[7],10)):(n=c.exec(e),n?new t(parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10),parseInt(n[4],10),parseInt(n[5],10),parseInt(n[6],10),parseInt(n[7],10)):(n=h.exec(e),n?new t(parseInt(n[3],10),parseInt(n[1],10),parseInt(n[2],10),parseInt(n[4],10),parseInt(n[5],10),parseInt(n[6],10),parseInt(n[7],10)):null)))},convertFromJson:function(){var t,n,r,i,s;r=arguments[0],n=2<=arguments.length?u.call(arguments,1):[];for(i=0,s=n.length;i<s;i++)t=n[i],r[t]=e.DateTime.parse(r[t])},now:function(){return new t},today:function(){return(new t).justDate()},fromMongoObjectId:function(e){return new t(1e3*parseInt(e.slice(0,8),16))},equals:function(e,t){return e?e.equals(t):!t},lt:function(e,t){var n,r;return n=e?e.getTime():0,r=t?t.getTime():0,n<r},gt:function(e,t){var n,r;return n=e?e.getTime():0,r=t?t.getTime():0,n>r}}),e.DateTime=t,n={format:function(t){var n,i,s,u,l;return t<a?(l=Math.floor(t/f),e.format(e.Lang.seconds,l)):t<o?(u=Math.floor(t/a),u===1?i=e.Lang.minute:i=e.Lang.minutes,e.format(i,u)):t<r?(s=Math.floor(t/o),u=Math.floor((t-s*o)/a),u===0?s===1?i=e.Lang.hour:i=e.Lang.hours:i=e.Lang.hourMinute,e.format(i,s,u)):(n=Math.floor(t/r),s=Math.floor((t-n*r)/o),s===0?n===1?i=e.Lang.day:i=e.Lang.days:i=e.Lang.dayHour,e.format(i,n,s))}},e.TimeSpan=n}(n),s=/{(\d+)?}/g,n.ext(n,{format:function(e){var t;return t=arguments,t.length===0?"":t.length===1?e:e.replace(s,function(e,n){return t[parseInt(n)+1]})},include:function(e,t,n){return n&&n.length?(n+e+n).indexOf(n+t+n)>-1:e.indexOf(t)>-1},isNullOrEmpty:function(e){return typeof e=="undefined"||e===null||e===""},hyphenlize:function(e){var t,n,r,i;n="",r=-1,i=e.length;while(++r<i)t=e.charAt(r),t===t.toUpperCase()?n+="-"+t.toLowerCase():n+=t;return n},htmlEncode:function(e){return this.isNullOrEmpty(e)?"":e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}}),String.prototype.trim?n.trim=function(e){return this.isNullOrEmpty(e)?"":e.trim()}:(n.trim=function(e){return this.isNullOrEmpty(e)?"":e.replace(_regTime,"")},String.prototype.trim=function(){var e,t,n;t=this,t=t.replace(/^\s\s*/,""),n=/\s/,e=t.length-1;while(n.test(t.charAt(e)))e--;return t.slice(0,e+1)}),n.template=function(e){var t,n,r,i,s,o,u,a;o={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},r=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:" ",u2028:"\u2028",u2029:"\u2029"};for(i in n)n[n[i]]=i;return t=/\\|'|\r|\n|\t|\u2028|\u2029/g,a=/\\(\\|'|r|n|t|u2028|u2029)/g,u=function(e){return e.replace(a,function(e,t){return n[t]})},s=function(i,s,a){var f,l,c;return a=a||{},e.ext(a,o),c=i.replace(t,function(e){return"\\"+n[e]}).replace(a.escape||r,function(e,t){return"',\nj3.htmlEncode("+u(t)+"),\n'"}).replace(a.interpolate||r,function(e,t){return"',\n"+u(t)+",\n'"}).replace(a.evaluate||r,function(e,t){return"');\n"+u(t)+"\n;__p.push('"}),l=new e.StringBuilder,l.append("var __p=[],print=function(){__p.push.apply(__p,arguments);};\n"),a.variable||l.append("with(obj||{}){\n"),l.append("__p.push('"),l.append(c),l.append("');\n"),a.variable||l.append("}\n"),l.append('return __p.join("");\n'),f=new Function(a.variable||"obj","j3",l.toString()),s?f(s,e):function(t){return f.call(this,t,e)}},s}(n),n.List=n.cls({ctor:function(){this._count=0},firstNode:function(){return this._first},first:function(){return this._first.value},lastNode:function(){return this._last},last:function(){return this._last.value},count:function(){return this._count},insertNode:function(e,t){if(e===t)return this;if(e.list){if(t)e.next?e.next.prev=e.prev:this._last=e.prev,e.prev?e.prev.next=e.next:this._first=e.next,e.prev=t.prev,e.next=t,t.prev?(t.prev.next=e,t.prev=e):this._first=e;else{if(this._last===e)return this;e.next.prev=e.prev,e.prev?e.prev.next=e.next:this._first=e.next,e.prev=this._last,e.next=null,this._last.next=e,this._last=e}return this}return e.list=this,this._first?t?(e.next=t,e.prev=t.prev,t.prev=e,e.prev?e.prev.next=e:this._first=e):(e.next=null,e.prev=this._last,this._last.next=e,this._last=e):(e.prev=e.next=null,this._first=this._last=e),this._count++,this},insert:function(e,t){return this.insertNode({value:e},t)},removeNode:function(e){return e&&(e===this._first?this._first=e.next:e.prev.next=e.next,e===this._last?this._last=e.prev:e.next.prev=e.prev,this._count--,delete e.value,delete e.prev,delete e.next,delete e.list),this},remove:function(e){return this.removeNode(this.findNode(e))},clear:function(){var e,t;t=this._first;while(t)e=t.next,delete t.value,delete t.prev,delete t.next,delete t.list,t=e;return this._first=this._last=null,this._count=0},findNode:function(e){var t;t=this._first;if(n.isFunction(e))while(t){if(e(t.value))return t;t=t.next}else if(e&&e.equals)while(t){if(e.equals(t.value))return t;t=t.next}else while(t){if(e===t.value)return t;t=t.next}return null},contains:function(e){return null!==this.findNode(e)},getNodeAt:function(e){var t;if(e<0||e>this._count)return null;t=this._first;while(e--)t=t.next;return t},getAt:function(e){var t;return t=this.getNodeAt(e),t?t.value:null},toString:function(){var e;return e=new n.StringBuilder,this.toJson(e),e.toString()},toJson:function(e){var t;e.append("["),t=this._first;if(t){n.toJson(t.value,e),t=t.next;while(t)e.append(","),n.toJson(t.value,e),t=t.next}e.append("]")},forEach:function(e,t,n){var r,i;!t&&!n?(n=e,e=null,t=null):n||(n=t,t=null),i=this._first,r=0;while(i)n.call(e,i.value,t,r),i=i.next,r++},tryUntil:function(e,t,n){var r,i;!t&&!n?(n=e,e=null,t=null):n||(n=t,t=null),i=this._first,r=0;while(i){if(n.call(e,i.value,t,r))return i.value;i=i.next,r++}},doWhile:function(e,t,n){var r,i;!t&&!n?(n=e,e=null,t=null):n||(n=t,t=null),i=this._first,r=0;while(i){if(!n.call(e,i.value,t,r))return i.value;i=i.next,r++}}}),function(e){var t,n;return e.Queue=t=e.cls({ctor:function(){return this.clear()},clear:function(){return this._size=0,this._front=this._rear=-1,this._data=[],this._data.length=5},enqueue:function(e){this._size===this._data.length&&n.call(this),this._rear=(this._rear+1)%this._data.length,this._size+=1,this._data[this._rear]=e},dequeue:function(){if(this._size===0)throw new Error("J3_Err_Queue_Empty");return this._data[this._front]=null,this._front=(this._front+1)%this._data.length,this._size-=1,this._data[this._front]},peek:function(){if(this._size===0)throw new Error("J3_Err_Queue_Empty");return this._data[(this._front+1)%this._data.length]},getSize:function(){return this._size}}),n=function(){var e,t,n,r;e=this._data,r=e.length,r<10240?r*=2:r+=10240,e.length=r;if(this._front<this._rear)return;if(this._rear+1<this._size-this._front-1){t=0,n=this._rear+1;while(t<n)e[(this._size+t)%r]=e[t],e[t]=null,t++;this._rear=(this._rear+this._size)%r}else{t=this._size-1,n=r-this._size;while(t>this._front)e[t+n]=e[t],t--;this._front+=n}},t.fromArray=function(e){var n;return n=new t,n._data=e.concat(),n._size=e.length,n}}(n),function(e){var t;return e.compileSelector=function(t){if(e.isFunction(t))return t;if(e.isString(t))return function(n){return e.getVal(n,t)};if(e.isArray(t))return function(n){var r,i,s,o;i={};for(s=0,o=t.length;s<o;s++)r=t[s],i[r]=e.getVal(n,r);return i};if(e.isObject(t))return function(n){var r,i,s;i={};for(r in t)s=t[r],i[r]=e.getVal(n,s);return i}},e.compileEquals=function(t){if(e.isFunction(t))return t;if(e.isString(t))return function(n,r){return e.equals(e.getVal(n,t),e.getVal(r,t))};if(e.isArray(t))return function(n,r){var i,s,o;for(s=0,o=t.length;s<o;s++){i=t[s];if(!e.equals(e.getVal(n,i),e.getVal(r,i)))return!1}return!0}},e.compileSortBy=function(t){var n,r,i,s,o,u,a,f,l,c;if(e.isFunction(t))return t;e.isString(t)&&(t=[t]),o=[];for(u=0,f=t.length;u<f;u++){n=t[u],i=n.split(" "),s={name:i[0]};if(i.length>1){c=i.slice(1);for(a=0,l=c.length;a<l;a++)r=c[a],r==="desc"?s.desc=!0:r==="nullGreat"&&(s.nullGreat=!0)}o.push(s)}return function(t,n){var r,i,s,u;i=0;for(s=0,u=o.length;s<u;s++){r=o[s],i=e.compare(t[r.name],n[r.name],r.nullGreat),r.desc&&(i*=-1);if(i!==0)return i}return 0}},t={},e.compileGroupBy=function(n){var r;if(e.isFunction(n))return n;if(e.isString(n))return r=t[n],r?r:(t[n]=r=function(t){return e.getVal(t,n)},r)}}(n),function(e){var t,n;return t=function(e){var t,n,r,i;i=[];for(n=0,r=this.length;n<r;n++)t=this[n],i.push(e(t));return i},e.indexOf=function(t,n,r){var i;return i=-1,r==null&&(r=e.equals),e.tryUntil(t,function(e,t,s){if(r(e,n))return i=s,!0}),i},e.count=function(t){return e.isArray(t)?t.length:t?t.count():0},e.forEach=function(t,n,r,i){var s,o,u,a;if(!t)return;!r&&!i?(i=n,n=null,r=null):i||(i=r,r=null);if(e.isArray(t))for(o=u=0,a=t.length;u<a;o=++u)s=t[o],i.call(n,s,r,o);else t.forEach&&t.forEach(n,r,i)},e.tryUntil=function(t,n,r,i){var s,o,u,a;if(!t)return;!r&&!i?(i=n,n=null,r=null):i||(i=r,r=null);if(e.isArray(t))for(o=u=0,a=t.length;u<a;o=++u){s=t[o];if(i.call(n,s,r,o))return s}else t.tryUntil&&t.tryUntil(n,r,i)},e.doWhile=function(t,n,r,i){var s,o,u,a;if(!t)return;!r&&!i?(i=n,n=null,r=null):i||(i=r,r=null);if(e.isArray(t))for(o=u=0,a=t.length;u<a;o=++u){s=t[o];if(!i.call(n,s,r,o))return s}else t.doWhile&&t.doWhile(n,r,i)},e.sortBy=function(t,n){var r;return r=e.compileSortBy(n),t.sort(r)},e.group=function(n,r,i){var s,o,u;return u={},o=e.compileGroupBy(r),s=n.forEach||t,s.call(n,function(e){var t,n;return t=o(e),n=u[t],n||(u[t]=n=[]),n.push(i?i(e):e)}),u},n=function(t,r,i){var s,o,u,a;return u=i.idName,a=i.parentName,o=i.childrenName,s=[],e.forEach(t,function(f){if(r===e.getVal(f,a))return s.push(f),e.setVal(f,o,n(t,e.getVal(f,u),i))}),s.length?s:null},e.tree=function(t,r){var i,s,o,u,a,f,l,c;return r==null&&(r={}),(f=r.idName)==null&&(r.idName="id"),(l=r.parentName)==null&&(r.parentName="parentId"),(c=r.childrenName)==null&&(r.childrenName="children"),s=r.idName,u=r.parentName,i=r.childrenName,o={},e.forEach(t,function(t){return o[e.getVal(t,s)]=t}),a=[],e.forEach(t,function(o){if(!e.getVal(o,u))return a.push(o),e.setVal(o,i,n(t,e.getVal(o,s),r))}),a},e.pickFieldVal=function(t,n){var r,i;return i=[],n.distinctField?(e.forEach(t,function(t){return i.push(e.getVal(t,n.fieldName))}),i):(r={},e.forEach(t,function(t){var s,o,u,a,f;o=e.getVal(t,n.fieldName);if(e.isArray(o)){f=[];for(u=0,a=o.length;u<a;u++)s=o[u],r[s]?f.push(void 0):(r[s]=!0,f.push(i.push(s)));return f}if(!r[o])return r[o]=!0,i.push(o)}),i)},e.toMap=function(t,n){var r;return r={},e.forEach(t,function(t){var i;return i=e.getVal(t,n),r[i]=t}),r}}(n),n.Pool=function(e){return this._maxSize=e.maxSize||-1,this._data=[],this._usedSize=0,this._poolSize=0,this.__onCreate=e.onCreate,this.__onInit=e.onInit,this.__onRelease=e.onRelease,this.__onDestroy=e.onDestroy},n.ext(n.Pool.prototype,{getMaxSize:function(){return this._maxSize},setMaxSize:function(e){if(e===-1||e>this._maxSize)return this._maxSize=e},getUsedSize:function(){return this._usedSize},canGain:function(){return this._usedSize!==this._maxSize},gain:function(e){var t;if(!this.canGain())return null;this._usedSize<this._poolSize&&(t=this._data[this._usedSize]);if(!t){t=this.__onCreate(e);if(!t)return null;this._data[this._poolSize++]=t}return this.__onInit(t,e),this._usedSize++,t},release:function(e){var t,n;if(!e)return;n=this._data[this._usedSize-1];if(e!==n){t=0;while(t<this._usedSize){if(e===this._data[t]){this._data[t]=n;break}t++}this._data[this._usedSize-1]=e}typeof this.__onRelease=="function"&&this.__onRelease(e),this._usedSize--}}),n.EventManager={on:function(e,t,r){var i,s,o;this._eventHandlers||(this._eventHandlers={});if(arguments.length===1){o=e;for(s in o)r=o[s],i=this._eventHandlers[s],n.isArray(r)?(t=r[0],r=r[1]):n.isObject(r)?(t=r.c||r.ctx||r.context,r=r.h||r.hdl||r.handler):t=null,i||(this._eventHandlers[s]=i=new n.List),i.insert({handler:r,context:t})}else arguments.length===2&&(r=t,t=null),i=this._eventHandlers[e],i||(this._eventHandlers[e]=i=new n.List),i.insert({handler:r,context:t});return this},un:function(e,t,n){var r;return this._eventHandlers?(r=this._eventHandlers[e],r?(arguments.length===2&&(n=t,t=null),r.removeNode(r.findNode({handler:n,context:t,equals:function(e){return this.handler===e.handler&&this.context===e.context}})),this):this):this},fire:function(e,t,n){var r;return this._eventHandlers?(r=this._eventHandlers[e],r?(r.forEach(function(e){return e.handler.call(e.context,t,n)}),this):this):this}},e=function(){},n.ext(e.prototype,n.EventManager),n.createEventManager=function(){return new e},function(e){var t;return t=function(e,t){this.view=e,this.handler=t},t.prototype.equals=function(e){return this.view===e.view&&this.handler===e.handler},e.Datasource={bind:function(n,r){var i;if(!n)return;this._views||(this._views=new e.List),i=new t(n,r);if(this._views.contains(i))return;return this._views.insert(i),r==null&&(r=n.updateView),r.call(n,this,"refresh")},unbind:function(e,n){var r;if(!e)return;if(!this._views)return;r=new t(e,n);if(!this._views.contains(r))return;return this._views.remove(r)},updateViews:function(e,t){var n,r,i,s;if(!this._views)return;r=this._views.firstNode();while(r)s=r.value,i=s.view,n=s.handler||i.updateView,n.call(i,this,e,t),r=r.next},refreshViews:function(){return this.updateViews("refresh")}}}(n),n.DataView={getDatasource:function(){return this._datasource},setDatasource:function(e){if(this._datasource===e)return;this._datasource&&this._datasource.unbind(this),this._datasource=e;if(e)return e.bind(this)},updateData:function(){if(!this._datasource)return;if(this._updatingData)return;return this._updatingData=!0,this.onUpdateData(this._datasource),this._updatingData=!1},isUpdatingData:function(){return this._updatingData},updateView:function(e,t,n){if(this._updatingData||this._updatingView)return;return this._updatingView=!0,this.onUpdateView(e,t,n),this._updatingView=!1},isUpdatingView:function(){return this._updatingView}},function(e){var t;return e.Model=t=function(t,n){var r;n==null&&(n={}),t&&!n.noParse&&this.parse&&(t=this.parse(t));if(r=this.get("defaults"))t=e.ext(r,t);this._data=t||{}},e.ext(t.prototype,e.EventManager,e.Datasource,{notifyChangeName:"modelDataChange",has:function(e){return this._data.hasOwnProperty(e)},getData:function(){return this._data?e.clone(this._data):{}},get:function(t,n){return e.isFunction(this[t])?this[t].call(this):this._data?this._data.hasOwnProperty(t)?this._data[t]:n:n},set:function(t,n,r){var i,s,o,u;(u=this._data)==null&&(this._data={}),e.isObject(t)&&(s=t,r=n),r==null&&(r={}),this._originalData||(this._originalData=e.clone(this._data)),o="change";if(!s){if(e.equals(this._data[t],n))return;i={},i[t]=n,this._data[t]=n}else if(r.append)for(t in s){n=s[t];if(e.equals(this._data[t],n))continue;i||(i={}),i[t]=n,this._data[t]=n}else o="refresh",this.parse&&(s=this.parse(s)),this._data=e.clone(s);return this.notifyChange({eventName:o,changedData:i,source:r.source})},notifyChange:function(e){var t,n,r;return e==null&&(e={}),r=e.eventName,t={changedData:e.changedData,source:e.source,model:this},this.fire(r,this,t),this.updateViews(r,t),n=this.collection,n&&n.notifyModelChange(this.notifyChangeName,t)},toJson:function(t){return e.toJson(this._data,t)}}),e.getVal=function(t,n,r){return e.isFunction(t.get)?t.get(n,r):e.isUndefined(t[n])?r:t[n]},e.setVal=function(t,n,r,i){return e.isFunction(t.set)?t.set(n,r,i):t[n]=r}}(n),function(e){var t;return t={},e.getCollection=function(e){return t[e]},e.Collection=e.cls({ctor:function(n){n==null&&(n={}),n.id&&(this.id=n.id,t[this.id]=this),this._idName=n.idName||"id",this._idxId={},this._model=n.model||e.Model,this._models=new e.List,this._notFoundModels={},this._lazyLoad=n.lazyLoad,this._url=n.url,this._contextData=n.contextData,n.on&&this.on(n.on)},getModel:function(){return this._model},getContextData:function(){return this._contextData},setContextData:function(e){if(this._contextData===e)return;return this._contextData=e},insert:function(t,n){var r,i,s,o;n==null&&(n={}),t instanceof this._model?s=t:s=new this._model(t),i=s.get(this._idName),i&&(this._idxId[i]=s),s.collection=this,o=null,e.isUndefined(n.targetIndex)||(o=this._models.getNodeAt(n.targetIndex)),this._models.insert(s,o);if(!n.silent)return r={model:s},this.updateViews("add",r),this.fire("addModel",this,r)},remove:function(e,t){var n,r,i;if(!e)return;t==null&&(t={}),i=this._models.findNode(e),this._activeModel===e&&(r=i.next&&i.next.value,r||(r=i.prev&&i.prev.value)),delete this._idxId[e.get(this._idName)],this._models.removeNode(i),t.silent||(n={model:e},this.updateViews("remove",n),this.fire("removeModel",this,n));if(r)return this.setActive(r,t)},removeById:function(e,t){var n;n=this.getById(e);if(n)return this.remove(n,t)},removeActive:function(e){if(this._activeModel)return this.remove(this._activeModel,e)},clear:function(e){e==null&&(e={}),this._idxId={},this._models.clear(),this._notFoundModels={};if(!e.silent)return this.updateViews("refresh"),this.fire("refresh",this)},loadData:function(t,n){var r,i,s,o;n=n||{},i=n.silent,n.silent=!0,this.clear(n);for(s=0,o=t.length;s<o;s++)r=t[s],this.insert(r,n);e.isUndefined(n.activeIndex)||this.setActive(this._models.getAt(n.activeIndex));if(!i)return this.updateViews("refresh"),this.fire("refresh",this)},getActive:function(){return this._activeModel},setActive:function(e,t){var n,r;if(this._activeModel===e)return;t=t||{},r=this._activeModel,this._activeModel=e;if(!t.silent)return n={old:r,model:e},this.updateViews("active",n),this.fire("activeModelChange",this,n)},setActiveByIndex:function(e,t){if(e>=this.count()||e<0)e=-1;return this.setActive(this.getAt(e),t)},notifyModelChange:function(e,t){return this.updateViews(e,t),this.fire(e,this,t)},getById:function(t,n){var r;return t?(r=this._idxId[t],r?(n&&n(r),r):!this._lazyLoad||this._notFoundModels[t]?(n&&n(null),null):e.get(this._url+t,null,this,function(e,r){if(e.status>=500)return n(null);if(e.status>=400)return this._notFoundModels[t]=!0,n(null);this.insert(r),n(this._idxId[t])})):(n&&n(null),null)},getAt:function(e){return this._models.getAt(e)},count:function(){return this._models.count()},forEach:function(e,t,n){return this._models.forEach(e,t,n)},tryUntil:function(e,t,n){return this._models.tryUntil(e,t,n)},doWhile:function(e,t,n){return this._models.doWhile(e,t,n)}}),e.ext(e.Collection.prototype,e.Datasource),e.ext(e.Collection.prototype,e.EventManager)}(n),function(e){var t,n,r,i;return t=function(t,n){var r,i;if(e.isFunction(n))return n(t);for(i in n){r=n[i];if(e.isFunction(r)){if(!r(t[i],t))return!1}else if(t[i]!==r)return!1}return!0},i=function(t,n){if(e.isFunction(n))return n(t)},r=function(t){var n,r,i,s,o,u;if(e.isFunction(t))return t;if(e.isString(t))return function(e){return e[t]};if(e.isObject(t))return t.text?e.isFunction(t.text)?r=t.text:(o=t.text,r=function(e){return e[o]}):r=null,t.value?e.isFunction(t.value)?i=t.value:(u=t.value,i=function(e){return e[u]}):i=null,t.id?e.isFunction(t.id)?n=t.id:(s=t.id,n=function(e){return e[s]}):n=null,function(e){var t;return t={},r&&(t.text=r(e)),i&&(t.value=i(e)),n&&(t.id=n(e)),t}},n=function(){var t,n,i,s,o,u,a,f,l,c,h,p;c=this._models,s=this._groupIdName,n=this._groupBy,a=this._groupSortBy;if(!n)return;f=r(n),u={},o=[];for(h=0,p=c.length;h<p;h++){t=c[h],i=f(t.getData()),i||(i=this._defaultGroupData);if(!i)continue;l=u[i[s]],l||(i.items=[],u[i[s]]=l=i,o.push(l)),l.items.push(t)}a||(a="id"),o.sort(e.compileSortBy(a)),this._groupList=o,this._groupMap=u},e.CollectionView=e.cls({ctor:function(e){return this._idName=e.idName||"id",this._selector=e.selector,this._filterBy=e.filterBy,this._sortBy=e.sortBy,this._groupIdName=e.groupIdName||"id",this._groupBy=e.groupBy,this._groupSortBy=e.groupSortBy,this._defaultGroupData=e.defaultGroupData,this._model=e.model,this.setDatasource(e.datasource),e.on&&this.on(e.on)},getModel:function(){return this._model||this.getDatasource().getModel()||e.Model},getSelector:function(){return this._selector},setSelector:function(e,t){t=t||{},this._selector=e;if(!t.silent)return this.refresh()},getFilterBy:function(){return this._filterBy},setFilterBy:function(e,t){t=t||{},this._filterBy=e;if(!t.silent)return this.refresh()},getSortBy:function(){return this._sortBy},setSortBy:function(e,t){t=t||{},this._sortBy=e;if(!t.silent)return this.refresh()},getGroupBy:function(){return this._groupBy},setGroupBy:function(e,t){t=t||{},this._groupBy=e;if(!t.silent)return n.call(this),this.updateViews("group")},getGroupSortBy:function(){return this._groupSortBy},setGroupSortBy:function(e,t){t=t||{},this._groupSortBy=e;if(!t.silent)return this.updateViews("groupSort")},getById:function(e){return this._idxId[e]},getAt:function(e){return e<0||e>=this._models.length?null:this._models[e]},removeById:function(e,t){return this.getDatasource().removeById(e,t)},getActive:function(){return this._activeModel},setActive:function(e,t){var n,r;if(this._activeModel===e)return;t=t||{},r=this._activeModel,this._activeModel=e;if(!t.silent)return n={old:r,model:e},this.updateViews("active",n),this.fire("activeModelChange",this,n)},count:function(){return this._models.length},onUpdateView:function(e,t,n){return this.refresh()},forEach:function(t,n,r){return e.forEach(this._models,t,n,r)},tryUntil:function(t,n,r){return e.tryUntil(this._models,t,n,r)},doWhile:function(t,n,r){return e.doWhile(this._models,t,n,r)},forEachGroup:function(e,t,n){var r,i,s,o,u,a;if(!this._groupList)return;!t&&!n?(n=e,e=null,t=null):n||(n=t,t=null),u=this._groupList,a=[];for(i=s=0,o=u.length;s<o;i=++s)r=u[i],a.push(n.call(e,r,t,i));return a},getGroupById:function(e){if(!this._groupMap)return;return this._groupMap[e]},refresh:function(){var r,s,o,u,a,f,l,c,h,p,d;f=[],s={};if(this._selector){this._datasource.forEach(this,function(e){var t,n;n=i(e,this._selector);if(n){if(!this._idName)return f.push(n);t=n[this._idName];if(!s[t])return s[t]=n,f.push(n)}});if(this._filterBy){o=[];for(c=0,p=f.length;c<p;c++)a=f[c],t(a,this._filterBy)&&o.push(a);f=o}}else this._filterBy?this._datasource.forEach(this,function(e){var n;n=e.getData();if(t(n,this._filterBy))return f.push(n)}):this._datasource.forEach(this,function(e){return f.push(e.getData())});this._sortBy&&f.sort(e.compileSortBy(this._sortBy)),this._models=[],this._idxId={},r=this.getModel();for(h=0,d=f.length;h<d;h++)a=f[h],l=new r(a),l.collection=this,this._models.push(l),this._idName&&(u=a[this._idName],this._idxId[u]=l);return n.call(this),this.updateViews("refresh")}}),e.ext(e.CollectionView.prototype,e.DataView,e.Datasource,e.EventManager)}(n),function(e){var t,n,r,i;return r=function(t,n){var r;return t.group=n,r=n.items,r||(n.items=r=new e.List),r.insert(t)},i=function(e){var t,n;t=e.group;if(!t)return;e.group=null,n=t.items;if(n)return n.remove(e)},n=function(e,t,n){var r;r=e.firstNode();while(r){if(r.value!==t&&0<n(r.value._data,t._data))return r;r=r.next}return null},e.GroupedCollection=t=e.cls({ctor:function(t){t==null&&(t={}),t.id&&(this.id=t.id,_collections[this.id]=this),this._idName=t.idName||"id",this._idxId={},this._model=t.model||e.Model,this._models=new e.List,this._groupIdName=t.groupIdName||"id",this._groupMap={},this._groupModel=t.groupModel||e.Model,this._groupList=new e.List,t.groupBy&&(this._groupBy=e.compileGroupBy(t.groupBy)),t.groupSortBy&&(this._groupSortBy=e.compileSortBy(t.groupSortBy)),t.on&&this.on(t.on)},getModel:function(){return this._model},getData:function(e){return this._data?this._data[e]:null},setData:function(e,t){return this._data||(this._data={}),this._data[e]=t},insertGroup:function(e,t){var r,i,s;t==null&&(t={}),r=new this._groupModel(e),r.notifyChangeName="groupDataChange",r.collection=this,s=r.get(this._groupIdName),s&&(this._groupMap[s]=r),this._groupSortBy&&(i=n(this._groupList,r,this._groupSortBy)),this._groupList.insert(r,i);if(!t.silent)return this.updateViews("groupAdd",{group:r})},removeGroup:function(e,t){var n,r;if(!e)return;t==null&&(t={}),r=this._groupList.findNode(e),this._activeGroup===e&&(n=r.next&&r.next.value,n||(n=r.prev&&r.prev.value)),this._groupList.removeNode(r),delete this._groupMap[e.get(this._groupIdName)],t.silent||this.updateViews("groupRemove",{group:e});if(n)return this.setActiveGroup(n,t)},removeGroupById:function(e,t){var n;n=this.getGroupById(e);if(n)return this.removeGroup(n,t)},removeActiveGroup:function(e){if(this._activeGroup)return this.removeGroup(this._activeGroup,e)},insert:function(e,t){var n,i,s,o;t==null&&(t={}),e instanceof this._model?o=e:o=new this._model(e),s=o.get(this._idName),s&&(this._idxId[s]=o);if(t.group)r(o,t.group);else{i=this._groupBy(o),n=this.getGroupById(i);if(!n)return;r(o,n)}o.collection=this,this._models.insert(o);if(!t.silent)return this.updateViews("add",{model:o})},remove:function(e,t){var n,r;if(!e)return;t==null&&(t={}),r=this._models.findNode(e),this._activeModel===e&&(n=r.next&&r.next.value,n||(n=r.prev&&r.prev.value)),i(e),delete this._idxId[e.get(this._idName)],this._models.removeNode(r),t.silent||this.updateViews("remove",{model:e});if(n)return this.setActive(n,t)},removeById:function(e,t){var n;n=this.getById(e);if(n)return this.remove(n,t)},removeActive:function(e){if(this._activeModel)return this.remove(this._activeModel,e)},clear:function(e){e==null&&(e={}),this._idxId={},this._models.clear(),this.forEachGroup(function(e){return e.items&&e.items.clear()});if(!e.silent)return this.updateViews("refresh"),this.fire("refresh",this)},clearGroup:function(e){e==null&&(e={}),this._idxId={},this._models.clear(),this._groupMap={},this._groupList.clear();if(!e.silent)return this.updateViews("refresh"),this.fire("refresh",this)},loadGroupData:function(t,n){var r,i,s,o;n==null&&(n={}),i=n.silent,n.silent=!0,this.clearGroup(n);for(s=0,o=t.length;s<o;s++)r=t[s],this.insertGroup(r,n);e.isUndefined(n.activeIndex)||this.setActiveGroup(this._groupList.getAt(n.activeIndex));if(!i)return this.updateViews("refresh"),this.fire("refresh",this)},loadData:function(t,n){var r,i,s,o;n=n||{},i=n.silent,n.silent=!0,this.clear(n);for(s=0,o=t.length;s<o;s++)r=t[s],this.insert(r,n);e.isUndefined(n.activeIndex)||this.setActive(this._models.getAt(n.activeIndex));if(!i)return this.updateViews("refresh"),this.fire("refresh",this)},getActiveGroup:function(){return this._activeGroup},setActiveGroup:function(e,t){var n,r;if(this._activeGroup===e)return;t=t||{},r=this._activeGroup,this._activeGroup=e;if(!t.silent)return n={old:r,group:e},this.updateViews("activeGroup",n),this.fire("activeGroupChange",this,n)},setActiveGroupByIndex:function(e,t){if(e>=this._groupList.count()||e<0)e=-1;return this.setActiveGroup(this.getGroupAt(e),t)},getGroupById:function(e){return e?this._groupMap[e]:null},getGroupAt:function(e){return this._groupList.getAt(e)},groupCount:function(){return this._groupList.count()},getActive:function(){return this._activeModel},setActive:function(e,t){var n,r;if(this._activeModel===e)return;t=t||{},r=this._activeModel,this._activeModel=e;if(!t.silent)return n={old:r,model:e},this.updateViews("active",n),this.fire("activeModelChange",this,n)},setActiveByIndex:function(e,t){if(e>=this.count()||e<0)e=-1;return this.setActive(this.getAt(e),t)},notifyModelChange:function(e,t){var r,i,s;return e==="groupDataChange"&&this._groupSortBy&&(r=t.model,r&&(s=n(this._groupList,r,this._groupSortBy),i=this._groupList.findNode(r),this._groupList.insertNode(i,s))),this.updateViews(e,t),this.fire(e,this,t)},getById:function(e,t){return e?this._idxId[e]:null},getAt:function(e){return this._models.getAt(e)},count:function(){return this._models.count()},forEach:function(e,t,n){return this._models.forEach(e,t,n)},tryUntil:function(e,t,n){return this._models.tryUntil(e,t,n)},doWhile:function(e,t,n){return this._models.doWhile(e,t,n)},forEachGroup:function(e,t,n){return this._groupList.forEach(e,t,n)},tryUntilGroup:function(e,t,n){return this._groupList.tryUntil(e,t,n)},doWhileGroup:function(e,t,n){return this._groupList.doWhile(e,t,n)}}),e.ext(t.prototype,e.Datasource,e.EventManager)}(n)}).call(this)
(function(){var e,t,n,r,i,s,o,u=[].slice;r=this,n=function(){return n.$.apply(this,arguments)},typeof exports!="undefined"?typeof module!="undefined"?module.exports=n:exports.j3=n:r.j3=n,n.version="0.3.4",n.fnRetFalse=function(){return!1},n.isRunInServer=function(){return n.UA.name==="server"},n.has=function(e,t){return e.hasOwnProperty(t)},n.isUndefined=function(e){return typeof e=="undefined"},n.isBoolean=function(e){return typeof e=="boolean"},n.isFunction=function(e){return typeof e=="function"},n.isString=function(e){return typeof e=="string"},n.isObject=function(e){return typeof e=="object"},n.isNull=function(e){return e===null},n.isNullOrUndefined=function(e){return n.isNull(e)||n.isUndefined(e)},i=Object.prototype.toString,n.isDate=function(e){return"[object Date]"===i.call(e)},n.isArray=function(e){return"[object Array]"===i.call(e)},n.isDateTime=function(e){return e instanceof n.DateTime},n.bind=function(e,t,n){return n?function(){return e.apply(t,n)}:function(){return e.call(t)}},n.clone=function(e,t,r){var i,s,o,u,a,f,l;if(!n.isObject(e))return e;if(e===null)return null;if(n.isDate(e))return new Date(e.getTime());if(n.isArray(e)){o=[];for(u=0,f=e.length;u<f;u++)i=e[u],o.push(n.clone(i));return o}if(n.isFunction(e.clone))return e.clone(t);o={};if(arguments.length===1)for(s in e)o[s]=n.clone(e[s]);else for(a=0,l=t.length;a<l;a++)s=t[a],e.hasOwnProperty(s)&&(r?n.isUndefined(e[s])||(o[s]=n.clone(e[s])):o[s]=n.clone(e[s]));return o},n.equals=function(e,t){var r,i;if(typeof e!=typeof t)return!1;if(n.isNull(e))return n.isNull(t);if(!n.isObject(e))return e===t;if(n.isDate(e))return e.getTime()===t.getTime();if(n.isArray(e)){if(e.length!==t.length)return!1;r=-1;while(++r<e.length)if(!n.equals(e[r],t[r]))return!1;return!0}if(n.isFunction(e.equals))return e.equals(t);if(n.isObject(e)&&n.isObject(t)){for(i in e)if(!n.equals(e[i],t[i]))return!1;return!0}return!1},n.compare=function(e,t,r){if(n.isNullOrUndefined(e))return n.isNullOrUndefined(t)?0:r?1:-1;if(n.isNullOrUndefined(t))return r?-1:1;if(n.isDateTime(e)||n.isDate(e))e=e.getTime();if(n.isDateTime(t)||n.isDate(t))t=t.getTime();if(n.isObject(e)){if(n.isFunction(e.compare))return e.compare(t);if(!n.isObject(t))return 1}if(n.isObject(t)){if(n.isFunction(t.compare))return t.compare(e);if(!n.isObject(e))return-1}return e===t?0:e>t?1:-1},n.$=function(e){return typeof e=="string"?document.getElementById(e):e},n.guid=function(){var e,t,n,r;n="";for(e=r=1;r<33;e=++r){t=Math.floor(Math.random()*16).toString(16),n+=t;if(e===8||e===12||e===16||e===20)n+="-"}return n},n.ns=function(e){var t,n,r,i,s;r=e.split("."),t=typeof window=="undefined"?global:window;for(i=0,s=r.length;i<s;i++)n=r[i],t[n]||(t[n]={}),t=t[n];return t},t=n.ext=function(){var e,t,n,r,i,s;n=arguments[0],t=2<=arguments.length?u.call(arguments,1):[];for(i=0,s=t.length;i<s;i++){e=t[i];for(r in e)n[r]=e[r]}return n},n.cls=function(e,t){var n,r,i;return arguments.length===1&&(t=e,e=null),r=t.ctor,e?r?t.ctor=function(){return e.apply(this,arguments),r.apply(this,arguments)}:t.ctor=function(){return e.apply(this,arguments)}:r||(t.ctor=function(){}),n=t.ctor,i=n.prototype,e&&this.ext(i,e.prototype),this.ext(i,t),this.has(t,"toString")&&(i.toString=t.toString),n.base=function(){return e.prototype},n},n.UA=function(){var e,t,n,r;return t={ie:0,gecko:0,webkit:0,opera:0,name:"",N_IE:"MSIE",N_FIREFOX:"Firefox",N_OPERA:"Opera",N_CHROME:"Chrome",N_SAFARI:"Safari"},this.navigator?(n=this.navigator.userAgent,n.indexOf(t.N_IE)>-1?(t.ie=!0,t.name=t.N_IE):n.indexOf(t.N_FIREFOX)>-1?(t.gecko=!0,t.name=t.N_FIREFOX):n.indexOf(t.N_OPERA)>-1?(t.opera=!0,t.name=t.N_OPERA):n.indexOf(t.N_CHROME)>-1?(t.webkit=!0,t.name=t.N_CHROME):n.indexOf(t.N_SAFARI)>-1&&(t.webkit=!0,t.name=t.N_SAFARI),t.name===t.N_OPERA||t.name===t.N_SAFARI?e=n.indexOf("Version")+8:e=n.indexOf(t.name)+t.name.length+1,r=parseFloat(n.substring(e,e+4).match(/\d+\.\d{1}/i)[0]),t.ie?t.ie=r:t.gecko?t.gecko=r:t.opera?t.opera=r:t.webkit&&(t.webkit=r),t):(t.name="server",t)}(),n.UA.ie>=8||n.UA.opera||n.UA.webkit?n.StringBuilder=n.cls({ctor:function(){this._data=""},append:function(e){return this._data+=e,this},encodeAndAppend:function(e){return this._data+=n.htmlEncode(e),this},clear:function(){return this._data="",this},toString:function(){return this._data}}):n.StringBuilder=n.cls({ctor:function(){this._data=[]},append:function(e){return this._data[this._data.length]=e,this},encodeAndAppend:function(e){return this._data[this._data.length]=n.htmlEncode(e),this},clear:function(){return this._data=[],this},toString:function(){return this._data.join("")}}),o=n.StringBuilder.prototype,o.a=o.append,o.e=o.encodeAndAppend,n.UrlQuery=n.cls({ctor:function(){this._query={}},get:function(e,t){return this._query?this._query.hasOwnProperty(e)?this._query[e]:t:t},set:function(e,t){var n;return(n=this._query)==null&&(this._query={}),this._query[e]=t},unset:function(e){if(!this._query)return;return delete this._query[e]},toString:function(){var e,t,r,i,s;r=new n.StringBuilder,e=!0,s=this._query;for(t in s)i=s[t],e?e=!1:r.a("&"),r.a(t+"="+encodeURIComponent(i));return r.toString()}}),function(e){var t,n,r,i,s,o,a,f,l,c,h,p;return f=1e3,a=6e4,o=36e5,r=864e5,l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],c=/^(\d{4})-(\d{1,2})-(\d{1,2})(?: (\d{1,2}):(\d{1,2}):(\d{1,2})(?:.(\d{1,3}))?)?$/,h=/^(\d{1,2})\/(\d{1,2})\/(\d{4})(?: (\d{1,2}):(\d{1,2}):(\d{1,2})(?:.(\d{1,3}))?)?$/,p=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:T(\d{1,2}):(\d{1,2}):(\d{1,2})(?:.(\d{1,3}))?)?Z$/,i="yyyy-MM-dd HH:mm:ss",s="yyyy-MM-ddTHH:mm:ssZ",t=e.cls({ctor:function(e,t,n,r,i,s,o){var u;u=arguments.length,u===0?this._value=new Date:u===1?this._value=new Date(e):(t=t||0,n=n||0,r=r||0,i=i||0,s=s||0,o=o||0,this._value=new Date(e,t-1,n,r,i,s,o))},getYear:function(){return this._value.getFullYear()},getMonth:function(){return this._value.getMonth()+1},getDay:function(){return this._value.getDate()},getDayOfWeek:function(){return this._value.getDay()},justDate:function(){return new t(this.getYear(),this.getMonth(),this.getDay())},justTime:function(){return new t(this._value.getTime()%r)},addYear:function(e){return new t(this._value.getFullYear+e,this._value.getMonth()+1,this._value.getDate(),this._value.getHours(),this._value.getMinutes(),this._value.getSeconds(),this._value.getMilliseconds())},addMonth:function(e){var n,r;return n=this._value.getFullYear()*12+this._value.getMonth()+1+e,r=parseInt(n/12),n%=12,new t(r,n,this._value.getDate(),this._value.getHours(),this._value.getMinutes(),this._value.getSeconds(),this._value.getMilliseconds())},addDay:function(e){return new t(this._value.getTime()+r*e)},addHour:function(e){return new t(this._value.getTime()+o*e)},addMinute:function(e){return new t(this._value.getTime()+a*e)},addSecond:function(e){return new t(this._value.getTime()+f*e)},addMillisecond:function(e){return new t(this._value.getTime()+e)},toString:function(e){return e==null&&(e=i),t.format(this._value,e)},toUTCString:function(){return t.format(this._value,s,!0)},toJson:function(t){return e.isUndefined(t)&&(t=new e.StringBuilder),t.append('"'),t.append(this.toUTCString()),t.append('"')},getValue:function(){return new Date(this._value.getTime())},getTime:function(){return this._value.getTime()},equals:function(e){return e?this._value.getTime()===e._value.getTime():!1},clone:function(){return new t(this._value.getTime())}}),e.ext(t,{UTC:function(e,n,r,i,s,o,u){var a,f;return a=arguments.length,a===0?f=(new Date).getTime():a===1?f=e:(n=n||0,r=r||0,i=i||0,s=s||0,o=o||0,u=u||0,f=Date.UTC(e,n-1,r,i,s,o,u)),new t(f)},format:function(e,n,r){var s,o,u,a,f,c,h;e instanceof t&&(e=e.getValue());if(typeof e=="number")e=new Date(e);else if(!e instanceof Date)return"";return n==null&&(n=i),r?(h=e.getUTCFullYear().toString(),f=(e.getUTCMonth()+1).toString(),o=e.getUTCDate().toString(),u=e.getUTCHours().toString(),a=e.getUTCMinutes().toString(),c=e.getUTCSeconds().toString()):(h=e.getFullYear().toString(),f=(e.getMonth()+1).toString(),o=e.getDate().toString(),u=e.getHours().toString(),a=e.getMinutes().toString(),c=e.getSeconds().toString()),s=n.replace("yyyy",h),s=s.replace("MMM",l[e.getMonth()]),s=s.replace("MM",f.length===1?"0"+f:f),s=s.replace("dd",o.length===1?"0"+o:o),s=s.replace("HH",u.length===1?"0"+u:u),s=s.replace("mm",a.length===1?"0"+a:a),s=s.replace("ss",c.length===1?"0"+c:c),s=s.replace("yy",h.substr(2)),s=s.replace("M",f),s=s.replace("d",o),s=s.replace("H",u),s=s.replace("m",a),s.replace("s",c)},formatUTC:function(e,t){return t==null&&(t=s),this.format(e,t,!0)},parse:function(e){var n;return e instanceof t?e:(n=p.exec(e),n?t.UTC(parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10),parseInt(n[4],10),parseInt(n[5],10),parseInt(n[6],10),parseInt(n[7],10)):(n=c.exec(e),n?new t(parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10),parseInt(n[4],10),parseInt(n[5],10),parseInt(n[6],10),parseInt(n[7],10)):(n=h.exec(e),n?new t(parseInt(n[3],10),parseInt(n[1],10),parseInt(n[2],10),parseInt(n[4],10),parseInt(n[5],10),parseInt(n[6],10),parseInt(n[7],10)):null)))},convertFromJson:function(){var t,n,r,i,s;r=arguments[0],n=2<=arguments.length?u.call(arguments,1):[];for(i=0,s=n.length;i<s;i++)t=n[i],r[t]=e.DateTime.parse(r[t])},now:function(){return new t},today:function(){return(new t).justDate()},fromMongoObjectId:function(e){return new t(1e3*parseInt(e.slice(0,8),16))},equals:function(e,t){return e?e.equals(t):!t},lt:function(e,t){var n,r;return n=e?e.getTime():0,r=t?t.getTime():0,n<r},gt:function(e,t){var n,r;return n=e?e.getTime():0,r=t?t.getTime():0,n>r}}),e.DateTime=t,n={format:function(t){var n,i,s,u,l;return t<a?(l=Math.floor(t/f),e.format(e.Lang.seconds,l)):t<o?(u=Math.floor(t/a),u===1?i=e.Lang.minute:i=e.Lang.minutes,e.format(i,u)):t<r?(s=Math.floor(t/o),u=Math.floor((t-s*o)/a),u===0?s===1?i=e.Lang.hour:i=e.Lang.hours:i=e.Lang.hourMinute,e.format(i,s,u)):(n=Math.floor(t/r),s=Math.floor((t-n*r)/o),s===0?n===1?i=e.Lang.day:i=e.Lang.days:i=e.Lang.dayHour,e.format(i,n,s))}},e.TimeSpan=n}(n),s=/{(\d+)?}/g,n.ext(n,{format:function(e){var t;return t=arguments,t.length===0?"":t.length===1?e:e.replace(s,function(e,n){return t[parseInt(n)+1]})},include:function(e,t,n){return n&&n.length?(n+e+n).indexOf(n+t+n)>-1:e.indexOf(t)>-1},isNullOrEmpty:function(e){return typeof e=="undefined"||e===null||e===""},hyphenlize:function(e){var t,n,r,i;n="",r=-1,i=e.length;while(++r<i)t=e.charAt(r),t===t.toUpperCase()?n+="-"+t.toLowerCase():n+=t;return n},htmlEncode:function(e){return this.isNullOrEmpty(e)?"":e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}}),String.prototype.trim?n.trim=function(e){return this.isNullOrEmpty(e)?"":e.trim()}:(n.trim=function(e){return this.isNullOrEmpty(e)?"":e.replace(_regTime,"")},String.prototype.trim=function(){var e,t,n;t=this,t=t.replace(/^\s\s*/,""),n=/\s/,e=t.length-1;while(n.test(t.charAt(e)))e--;return t.slice(0,e+1)}),n.template=function(e){var t,n,r,i,s,o,u,a;o={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},r=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:" ",u2028:"\u2028",u2029:"\u2029"};for(i in n)n[n[i]]=i;return t=/\\|'|\r|\n|\t|\u2028|\u2029/g,a=/\\(\\|'|r|n|t|u2028|u2029)/g,u=function(e){return e.replace(a,function(e,t){return n[t]})},s=function(i,s,a){var f,l,c;return a=a||{},e.ext(a,o),c=i.replace(t,function(e){return"\\"+n[e]}).replace(a.escape||r,function(e,t){return"',\nj3.htmlEncode("+u(t)+"),\n'"}).replace(a.interpolate||r,function(e,t){return"',\n"+u(t)+",\n'"}).replace(a.evaluate||r,function(e,t){return"');\n"+u(t)+"\n;__p.push('"}),l=new e.StringBuilder,l.append("var __p=[],print=function(){__p.push.apply(__p,arguments);};\n"),a.variable||l.append("with(obj||{}){\n"),l.append("__p.push('"),l.append(c),l.append("');\n"),a.variable||l.append("}\n"),l.append('return __p.join("");\n'),f=new Function(a.variable||"obj","j3",l.toString()),s?f(s,e):function(t){return f.call(this,t,e)}},s}(n),n.List=n.cls({ctor:function(){this._count=0},firstNode:function(){return this._first},first:function(){return this._first.value},lastNode:function(){return this._last},last:function(){return this._last.value},count:function(){return this._count},insertNode:function(e,t){if(e===t)return this;if(e.list){if(t)e.next?e.next.prev=e.prev:this._last=e.prev,e.prev?e.prev.next=e.next:this._first=e.next,e.prev=t.prev,e.next=t,t.prev?(t.prev.next=e,t.prev=e):this._first=e;else{if(this._last===e)return this;e.next.prev=e.prev,e.prev?e.prev.next=e.next:this._first=e.next,e.prev=this._last,e.next=null,this._last.next=e,this._last=e}return this}return e.list=this,this._first?t?(e.next=t,e.prev=t.prev,t.prev=e,e.prev?e.prev.next=e:this._first=e):(e.next=null,e.prev=this._last,this._last.next=e,this._last=e):(e.prev=e.next=null,this._first=this._last=e),this._count++,this},insert:function(e,t){return this.insertNode({value:e},t)},removeNode:function(e){return e&&(e===this._first?this._first=e.next:e.prev.next=e.next,e===this._last?this._last=e.prev:e.next.prev=e.prev,this._count--,delete e.value,delete e.prev,delete e.next,delete e.list),this},remove:function(e){return this.removeNode(this.findNode(e))},clear:function(){var e,t;t=this._first;while(t)e=t.next,delete t.value,delete t.prev,delete t.next,delete t.list,t=e;return this._first=this._last=null,this._count=0},findNode:function(e){var t;t=this._first;if(n.isFunction(e))while(t){if(e(t.value))return t;t=t.next}else if(e&&e.equals)while(t){if(e.equals(t.value))return t;t=t.next}else while(t){if(e===t.value)return t;t=t.next}return null},contains:function(e){return null!==this.findNode(e)},getNodeAt:function(e){var t;if(e<0||e>this._count)return null;t=this._first;while(e--)t=t.next;return t},getAt:function(e){var t;return t=this.getNodeAt(e),t?t.value:null},toString:function(){var e;return e=new n.StringBuilder,this.toJson(e),e.toString()},toJson:function(e){var t;e.append("["),t=this._first;if(t){n.toJson(t.value,e),t=t.next;while(t)e.append(","),n.toJson(t.value,e),t=t.next}e.append("]")},forEach:function(e,t,n){var r,i;!t&&!n?(n=e,e=null,t=null):n||(n=t,t=null),i=this._first,r=0;while(i)n.call(e,i.value,t,r),i=i.next,r++},tryUntil:function(e,t,n){var r,i;!t&&!n?(n=e,e=null,t=null):n||(n=t,t=null),i=this._first,r=0;while(i){if(n.call(e,i.value,t,r))return i.value;i=i.next,r++}},doWhile:function(e,t,n){var r,i;!t&&!n?(n=e,e=null,t=null):n||(n=t,t=null),i=this._first,r=0;while(i){if(!n.call(e,i.value,t,r))return i.value;i=i.next,r++}}}),function(e){var t,n;return e.Queue=t=e.cls({ctor:function(){return this.clear()},clear:function(){return this._size=0,this._front=this._rear=-1,this._data=[],this._data.length=5},enqueue:function(e){this._size===this._data.length&&n.call(this),this._rear=(this._rear+1)%this._data.length,this._size+=1,this._data[this._rear]=e},dequeue:function(){if(this._size===0)throw new Error("J3_Err_Queue_Empty");return this._data[this._front]=null,this._front=(this._front+1)%this._data.length,this._size-=1,this._data[this._front]},peek:function(){if(this._size===0)throw new Error("J3_Err_Queue_Empty");return this._data[(this._front+1)%this._data.length]},getSize:function(){return this._size}}),n=function(){var e,t,n,r;e=this._data,r=e.length,r<10240?r*=2:r+=10240,e.length=r;if(this._front<this._rear)return;if(this._rear+1<this._size-this._front-1){t=0,n=this._rear+1;while(t<n)e[(this._size+t)%r]=e[t],e[t]=null,t++;this._rear=(this._rear+this._size)%r}else{t=this._size-1,n=r-this._size;while(t>this._front)e[t+n]=e[t],t--;this._front+=n}},t.fromArray=function(e){var n;return n=new t,n._data=e.concat(),n._size=e.length,n}}(n),function(e){var t;return e.compileSelector=function(t){if(e.isFunction(t))return t;if(e.isString(t))return function(n){return e.getVal(n,t)};if(e.isArray(t))return function(n){var r,i,s,o;i={};for(s=0,o=t.length;s<o;s++)r=t[s],i[r]=e.getVal(n,r);return i};if(e.isObject(t))return function(n){var r,i,s;i={};for(r in t)s=t[r],i[r]=e.getVal(n,s);return i}},e.compileEquals=function(t){if(e.isFunction(t))return t;if(e.isString(t))return function(n,r){return e.equals(e.getVal(n,t),e.getVal(r,t))};if(e.isArray(t))return function(n,r){var i,s,o;for(s=0,o=t.length;s<o;s++){i=t[s];if(!e.equals(e.getVal(n,i),e.getVal(r,i)))return!1}return!0}},e.compileSortBy=function(t){var n,r,i,s,o,u,a,f,l,c;if(e.isFunction(t))return t;e.isString(t)&&(t=[t]),o=[];for(u=0,f=t.length;u<f;u++){n=t[u],i=n.split(" "),s={name:i[0]};if(i.length>1){c=i.slice(1);for(a=0,l=c.length;a<l;a++)r=c[a],r==="desc"?s.desc=!0:r==="nullGreat"&&(s.nullGreat=!0)}o.push(s)}return function(t,n){var r,i,s,u;i=0;for(s=0,u=o.length;s<u;s++){r=o[s],i=e.compare(t[r.name],n[r.name],r.nullGreat),r.desc&&(i*=-1);if(i!==0)return i}return 0}},t={},e.compileGroupBy=function(n){var r;if(e.isFunction(n))return n;if(e.isString(n))return r=t[n],r?r:(t[n]=r=function(t){return e.getVal(t,n)},r)}}(n),function(e){var t,n;return t=function(e){var t,n,r,i;i=[];for(n=0,r=this.length;n<r;n++)t=this[n],i.push(e(t));return i},e.indexOf=function(t,n,r){var i;return i=-1,r==null&&(r=e.equals),e.tryUntil(t,function(e,t,s){if(r(e,n))return i=s,!0}),i},e.count=function(t){return e.isArray(t)?t.length:t?t.count():0},e.forEach=function(t,n,r,i){var s,o,u,a;if(!t)return;!r&&!i?(i=n,n=null,r=null):i||(i=r,r=null);if(e.isArray(t))for(o=u=0,a=t.length;u<a;o=++u)s=t[o],i.call(n,s,r,o);else t.forEach&&t.forEach(n,r,i)},e.tryUntil=function(t,n,r,i){var s,o,u,a;if(!t)return;!r&&!i?(i=n,n=null,r=null):i||(i=r,r=null);if(e.isArray(t))for(o=u=0,a=t.length;u<a;o=++u){s=t[o];if(i.call(n,s,r,o))return s}else t.tryUntil&&t.tryUntil(n,r,i)},e.doWhile=function(t,n,r,i){var s,o,u,a;if(!t)return;!r&&!i?(i=n,n=null,r=null):i||(i=r,r=null);if(e.isArray(t))for(o=u=0,a=t.length;u<a;o=++u){s=t[o];if(!i.call(n,s,r,o))return s}else t.doWhile&&t.doWhile(n,r,i)},e.sortBy=function(t,n){var r;return r=e.compileSortBy(n),t.sort(r)},e.group=function(n,r,i){var s,o,u;return u={},o=e.compileGroupBy(r),s=n.forEach||t,s.call(n,function(e){var t,n;return t=o(e),n=u[t],n||(u[t]=n=[]),n.push(i?i(e):e)}),u},n=function(t,r,i){var s,o,u,a;return u=i.idName,a=i.parentName,o=i.childrenName,s=[],e.forEach(t,function(f){if(r===e.getVal(f,a))return s.push(f),e.setVal(f,o,n(t,e.getVal(f,u),i))}),s.length?s:null},e.tree=function(t,r){var i,s,o,u,a,f,l,c;return r==null&&(r={}),(f=r.idName)==null&&(r.idName="id"),(l=r.parentName)==null&&(r.parentName="parentId"),(c=r.childrenName)==null&&(r.childrenName="children"),s=r.idName,u=r.parentName,i=r.childrenName,o={},e.forEach(t,function(t){return o[e.getVal(t,s)]=t}),a=[],e.forEach(t,function(o){if(!e.getVal(o,u))return a.push(o),e.setVal(o,i,n(t,e.getVal(o,s),r))}),a},e.pickFieldVal=function(t,n){var r,i;return i=[],n.distinctField?(e.forEach(t,function(t){return i.push(e.getVal(t,n.fieldName))}),i):(r={},e.forEach(t,function(t){var s,o,u,a,f;o=e.getVal(t,n.fieldName);if(e.isArray(o)){f=[];for(u=0,a=o.length;u<a;u++)s=o[u],r[s]?f.push(void 0):(r[s]=!0,f.push(i.push(s)));return f}if(!r[o])return r[o]=!0,i.push(o)}),i)},e.toMap=function(t,n){var r;return r={},e.forEach(t,function(t){var i;return i=e.getVal(t,n),r[i]=t}),r}}(n),n.Pool=function(e){return this._maxSize=e.maxSize||-1,this._data=[],this._usedSize=0,this._poolSize=0,this.__onCreate=e.onCreate,this.__onInit=e.onInit,this.__onRelease=e.onRelease,this.__onDestroy=e.onDestroy},n.ext(n.Pool.prototype,{getMaxSize:function(){return this._maxSize},setMaxSize:function(e){if(e===-1||e>this._maxSize)return this._maxSize=e},getUsedSize:function(){return this._usedSize},canGain:function(){return this._usedSize!==this._maxSize},gain:function(e){var t;if(!this.canGain())return null;this._usedSize<this._poolSize&&(t=this._data[this._usedSize]);if(!t){t=this.__onCreate(e);if(!t)return null;this._data[this._poolSize++]=t}return this.__onInit(t,e),this._usedSize++,t},release:function(e){var t,n;if(!e)return;n=this._data[this._usedSize-1];if(e!==n){t=0;while(t<this._usedSize){if(e===this._data[t]){this._data[t]=n;break}t++}this._data[this._usedSize-1]=e}typeof this.__onRelease=="function"&&this.__onRelease(e),this._usedSize--}}),function(e){var t,n;return e.Unique=t=function(e){return this._array=[],this._ignoreEmpty=e.ignoreEmpty},t.prototype.getArray=function(){return this._array},t.prototype.add=function(t){var r,i,s,o;if(arguments.length===0)return;if(this._ignoreEmpty){if(e.isUndefined(t))return;if(e.isNull(t))return}if(e.isArray(t)){o=[];for(i=0,s=t.length;i<s;i++)r=t[i],o.push(n.call(this,r));return o}return n.call(this,t)},n=function(t){var n,r,i,s;s=this._array;for(r=0,i=s.length;r<i;r++){n=s[r];if(e.equals(n,t))return}return this._array.push(t)}}(n),n.EventManager={on:function(e,t,r){var i,s,o;this._eventHandlers||(this._eventHandlers={});if(arguments.length===1){o=e;for(s in o)r=o[s],i=this._eventHandlers[s],n.isArray(r)?(t=r[0],r=r[1]):n.isObject(r)?(t=r.c||r.ctx||r.context,r=r.h||r.hdl||r.handler):t=null,i||(this._eventHandlers[s]=i=new n.List),i.insert({handler:r,context:t})}else arguments.length===2&&(r=t,t=null),i=this._eventHandlers[e],i||(this._eventHandlers[e]=i=new n.List),i.insert({handler:r,context:t});return this},un:function(e,t,n){var r;return this._eventHandlers?(r=this._eventHandlers[e],r?(arguments.length===2&&(n=t,t=null),r.removeNode(r.findNode({handler:n,context:t,equals:function(e){return this.handler===e.handler&&this.context===e.context}})),this):this):this},fire:function(e,t,n){var r;return this._eventHandlers?(r=this._eventHandlers[e],r?(r.forEach(function(e){return e.handler.call(e.context,t,n)}),this):this):this}},e=function(){},n.ext(e.prototype,n.EventManager),n.createEventManager=function(){return new e},function(e){var t;return t=function(e,t){this.view=e,this.handler=t},t.prototype.equals=function(e){return this.view===e.view&&this.handler===e.handler},e.Datasource={bind:function(n,r){var i;if(!n)return;this._views||(this._views=new e.List),i=new t(n,r);if(this._views.contains(i))return;return this._views.insert(i),r==null&&(r=n.updateView),r.call(n,this,"refresh")},unbind:function(e,n){var r;if(!e)return;if(!this._views)return;r=new t(e,n);if(!this._views.contains(r))return;return this._views.remove(r)},updateViews:function(e,t){var n,r,i,s;if(!this._views)return;r=this._views.firstNode();while(r)s=r.value,i=s.view,n=s.handler||i.updateView,n.call(i,this,e,t),r=r.next},refreshViews:function(){return this.updateViews("refresh")}}}(n),n.DataView={getDatasource:function(){return this._datasource},setDatasource:function(e){if(this._datasource===e)return;this._datasource&&this._datasource.unbind(this),this._datasource=e;if(e)return e.bind(this)},updateData:function(){if(!this._datasource)return;if(this._updatingData)return;return this._updatingData=!0,this.onUpdateData(this._datasource),this._updatingData=!1},isUpdatingData:function(){return this._updatingData},updateView:function(e,t,n){if(this._updatingData||this._updatingView)return;return this._updatingView=!0,this.onUpdateView(e,t,n),this._updatingView=!1},isUpdatingView:function(){return this._updatingView}},function(e){var t;return e.Model=t=function(t,n){var r;n==null&&(n={}),t&&!n.noParse&&this.parse&&(t=this.parse(t));if(r=this.get("defaults"))t=e.ext(r,t);this._data=t||{}},e.ext(t.prototype,e.EventManager,e.Datasource,{notifyChangeName:"modelDataChange",has:function(e){return this._data.hasOwnProperty(e)},getData:function(){return this._data?e.clone(this._data):{}},get:function(t,n){return e.isFunction(this[t])?this[t].call(this):this._data?this._data.hasOwnProperty(t)?this._data[t]:n:n},set:function(t,n,r){var i,s,o,u;(u=this._data)==null&&(this._data={}),e.isObject(t)&&(s=t,r=n),r==null&&(r={}),this._originalData||(this._originalData=e.clone(this._data)),o="change";if(!s){if(e.equals(this._data[t],n))return;i={},i[t]=n,this._data[t]=n}else if(r.append)for(t in s){n=s[t];if(e.equals(this._data[t],n))continue;i||(i={}),i[t]=n,this._data[t]=n}else o="refresh",this.parse&&(s=this.parse(s)),this._data=e.clone(s);return this.notifyChange({eventName:o,changedData:i,source:r.source})},notifyChange:function(e){var t,n,r;return e==null&&(e={}),r=e.eventName,t={changedData:e.changedData,source:e.source,model:this},this.fire(r,this,t),this.updateViews(r,t),n=this.collection,n&&n.notifyModelChange(this.notifyChangeName,t)},toJson:function(t){return e.toJson(this._data,t)}}),e.getVal=function(t,n,r){return e.isFunction(t.get)?t.get(n,r):e.isUndefined(t[n])?r:t[n]},e.setVal=function(t,n,r,i){return e.isFunction(t.set)?t.set(n,r,i):t[n]=r}}(n),function(e){var t;return t={},e.getCollection=function(e){return t[e]},e.Collection=e.cls({ctor:function(n){n==null&&(n={}),n.id&&(this.id=n.id,t[this.id]=this),this._idName=n.idName||"id",this._idxId={},this._model=n.model||e.Model,this._models=new e.List,this._notFoundModels={},this._lazyLoad=n.lazyLoad,this._url=n.url,this._contextData=n.contextData,n.on&&this.on(n.on)},getModel:function(){return this._model},getContextData:function(){return this._contextData},setContextData:function(e){if(this._contextData===e)return;return this._contextData=e},insert:function(t,n){var r,i,s,o;n==null&&(n={}),t instanceof this._model?s=t:s=new this._model(t),i=s.get(this._idName),i&&(this._idxId[i]=s),s.collection=this,o=null,e.isUndefined(n.targetIndex)||(o=this._models.getNodeAt(n.targetIndex)),this._models.insert(s,o);if(!n.silent)return r={model:s},this.updateViews("add",r),this.fire("addModel",this,r)},remove:function(e,t){var n,r,i;if(!e)return;t==null&&(t={}),i=this._models.findNode(e),this._activeModel===e&&(r=i.next&&i.next.value,r||(r=i.prev&&i.prev.value)),delete this._idxId[e.get(this._idName)],this._models.removeNode(i),t.silent||(n={model:e},this.updateViews("remove",n),this.fire("removeModel",this,n));if(r)return this.setActive(r,t)},removeById:function(e,t){var n;n=this.getById(e);if(n)return this.remove(n,t)},removeActive:function(e){if(this._activeModel)return this.remove(this._activeModel,e)},clear:function(e){e==null&&(e={}),this._idxId={},this._models.clear(),this._notFoundModels={};if(!e.silent)return this.updateViews("refresh"),this.fire("refresh",this)},loadData:function(t,n){var r,i,s,o;n=n||{},i=n.silent,n.silent=!0,this.clear(n);for(s=0,o=t.length;s<o;s++)r=t[s],this.insert(r,n);e.isUndefined(n.activeIndex)||this.setActive(this._models.getAt(n.activeIndex));if(!i)return this.updateViews("refresh"),this.fire("refresh",this)},getActive:function(){return this._activeModel},setActive:function(e,t){var n,r;if(this._activeModel===e)return;t=t||{},r=this._activeModel,this._activeModel=e;if(!t.silent)return n={old:r,model:e},this.updateViews("active",n),this.fire("activeModelChange",this,n)},setActiveByIndex:function(e,t){if(e>=this.count()||e<0)e=-1;return this.setActive(this.getAt(e),t)},notifyModelChange:function(e,t){return this.updateViews(e,t),this.fire(e,this,t)},getById:function(t,n){var r;return t?(r=this._idxId[t],r?(n&&n(r),r):!this._lazyLoad||this._notFoundModels[t]?(n&&n(null),null):e.get(this._url+t,null,this,function(e,r){if(e.status>=500)return n(null);if(e.status>=400)return this._notFoundModels[t]=!0,n(null);this.insert(r),n(this._idxId[t])})):(n&&n(null),null)},getAt:function(e){return this._models.getAt(e)},count:function(){return this._models.count()},forEach:function(e,t,n){return this._models.forEach(e,t,n)},tryUntil:function(e,t,n){return this._models.tryUntil(e,t,n)},doWhile:function(e,t,n){return this._models.doWhile(e,t,n)}}),e.ext(e.Collection.prototype,e.Datasource),e.ext(e.Collection.prototype,e.EventManager)}(n),function(e){var t,n,r,i;return t=function(t,n){var r,i;if(e.isFunction(n))return n(t);for(i in n){r=n[i];if(e.isFunction(r)){if(!r(t[i],t))return!1}else if(t[i]!==r)return!1}return!0},i=function(t,n){if(e.isFunction(n))return n(t)},r=function(t){var n,r,i,s,o,u;if(e.isFunction(t))return t;if(e.isString(t))return function(e){return e[t]};if(e.isObject(t))return t.text?e.isFunction(t.text)?r=t.text:(o=t.text,r=function(e){return e[o]}):r=null,t.value?e.isFunction(t.value)?i=t.value:(u=t.value,i=function(e){return e[u]}):i=null,t.id?e.isFunction(t.id)?n=t.id:(s=t.id,n=function(e){return e[s]}):n=null,function(e){var t;return t={},r&&(t.text=r(e)),i&&(t.value=i(e)),n&&(t.id=n(e)),t}},n=function(){var t,n,i,s,o,u,a,f,l,c,h,p;c=this._models,s=this._groupIdName,n=this._groupBy,a=this._groupSortBy;if(!n)return;f=r(n),u={},o=[];for(h=0,p=c.length;h<p;h++){t=c[h],i=f(t.getData()),i||(i=this._defaultGroupData);if(!i)continue;l=u[i[s]],l||(i.items=[],u[i[s]]=l=i,o.push(l)),l.items.push(t)}a||(a="id"),o.sort(e.compileSortBy(a)),this._groupList=o,this._groupMap=u},e.CollectionView=e.cls({ctor:function(e){return this._idName=e.idName||"id",this._selector=e.selector,this._filterBy=e.filterBy,this._sortBy=e.sortBy,this._groupIdName=e.groupIdName||"id",this._groupBy=e.groupBy,this._groupSortBy=e.groupSortBy,this._defaultGroupData=e.defaultGroupData,this._model=e.model,this.setDatasource(e.datasource),e.on&&this.on(e.on)},getModel:function(){return this._model||this.getDatasource().getModel()||e.Model},getSelector:function(){return this._selector},setSelector:function(e,t){t=t||{},this._selector=e;if(!t.silent)return this.refresh()},getFilterBy:function(){return this._filterBy},setFilterBy:function(e,t){t=t||{},this._filterBy=e;if(!t.silent)return this.refresh()},getSortBy:function(){return this._sortBy},setSortBy:function(e,t){t=t||{},this._sortBy=e;if(!t.silent)return this.refresh()},getGroupBy:function(){return this._groupBy},setGroupBy:function(e,t){t=t||{},this._groupBy=e;if(!t.silent)return n.call(this),this.updateViews("group")},getGroupSortBy:function(){return this._groupSortBy},setGroupSortBy:function(e,t){t=t||{},this._groupSortBy=e;if(!t.silent)return this.updateViews("groupSort")},getById:function(e){return this._idxId[e]},getAt:function(e){return e<0||e>=this._models.length?null:this._models[e]},removeById:function(e,t){return this.getDatasource().removeById(e,t)},getActive:function(){return this._activeModel},setActive:function(e,t){var n,r;if(this._activeModel===e)return;t=t||{},r=this._activeModel,this._activeModel=e;if(!t.silent)return n={old:r,model:e},this.updateViews("active",n),this.fire("activeModelChange",this,n)},count:function(){return this._models.length},onUpdateView:function(e,t,n){return this.refresh()},forEach:function(t,n,r){return e.forEach(this._models,t,n,r)},tryUntil:function(t,n,r){return e.tryUntil(this._models,t,n,r)},doWhile:function(t,n,r){return e.doWhile(this._models,t,n,r)},forEachGroup:function(e,t,n){var r,i,s,o,u,a;if(!this._groupList)return;!t&&!n?(n=e,e=null,t=null):n||(n=t,t=null),u=this._groupList,a=[];for(i=s=0,o=u.length;s<o;i=++s)r=u[i],a.push(n.call(e,r,t,i));return a},getGroupById:function(e){if(!this._groupMap)return;return this._groupMap[e]},refresh:function(){var r,s,o,u,a,f,l,c,h,p,d;f=[],s={};if(this._selector){this._datasource.forEach(this,function(e){var t,n;n=i(e,this._selector);if(n){if(!this._idName)return f.push(n);t=n[this._idName];if(!s[t])return s[t]=n,f.push(n)}});if(this._filterBy){o=[];for(c=0,p=f.length;c<p;c++)a=f[c],t(a,this._filterBy)&&o.push(a);f=o}}else this._filterBy?this._datasource.forEach(this,function(e){var n;n=e.getData();if(t(n,this._filterBy))return f.push(n)}):this._datasource.forEach(this,function(e){return f.push(e.getData())});this._sortBy&&f.sort(e.compileSortBy(this._sortBy)),this._models=[],this._idxId={},r=this.getModel();for(h=0,d=f.length;h<d;h++)a=f[h],l=new r(a),l.collection=this,this._models.push(l),this._idName&&(u=a[this._idName],this._idxId[u]=l);return n.call(this),this.updateViews("refresh")}}),e.ext(e.CollectionView.prototype,e.DataView,e.Datasource,e.EventManager)}(n),function(e){var t,n,r,i;return r=function(t,n){var r;return t.group=n,r=n.items,r||(n.items=r=new e.List),r.insert(t)},i=function(e){var t,n;t=e.group;if(!t)return;e.group=null,n=t.items;if(n)return n.remove(e)},n=function(e,t,n){var r;r=e.firstNode();while(r){if(r.value!==t&&0<n(r.value._data,t._data))return r;r=r.next}return null},e.GroupedCollection=t=e.cls({ctor:function(t){t==null&&(t={}),t.id&&(this.id=t.id,_collections[this.id]=this),this._idName=t.idName||"id",this._idxId={},this._model=t.model||e.Model,this._models=new e.List,this._groupIdName=t.groupIdName||"id",this._groupMap={},this._groupModel=t.groupModel||e.Model,this._groupList=new e.List,t.groupBy&&(this._groupBy=e.compileGroupBy(t.groupBy)),t.groupSortBy&&(this._groupSortBy=e.compileSortBy(t.groupSortBy)),t.on&&this.on(t.on)},getModel:function(){return this._model},getData:function(e){return this._data?this._data[e]:null},setData:function(e,t){return this._data||(this._data={}),this._data[e]=t},insertGroup:function(e,t){var r,i,s;t==null&&(t={}),r=new this._groupModel(e),r.notifyChangeName="groupDataChange",r.collection=this,s=r.get(this._groupIdName),s&&(this._groupMap[s]=r),this._groupSortBy&&(i=n(this._groupList,r,this._groupSortBy)),this._groupList.insert(r,i);if(!t.silent)return this.updateViews("groupAdd",{group:r})},removeGroup:function(e,t){var n,r;if(!e)return;t==null&&(t={}),r=this._groupList.findNode(e),this._activeGroup===e&&(n=r.next&&r.next.value,n||(n=r.prev&&r.prev.value)),this._groupList.removeNode(r),delete this._groupMap[e.get(this._groupIdName)],t.silent||this.updateViews("groupRemove",{group:e});if(n)return this.setActiveGroup(n,t)},removeGroupById:function(e,t){var n;n=this.getGroupById(e);if(n)return this.removeGroup(n,t)},removeActiveGroup:function(e){if(this._activeGroup)return this.removeGroup(this._activeGroup,e)},insert:function(e,t){var n,i,s,o;t==null&&(t={}),e instanceof this._model?o=e:o=new this._model(e),s=o.get(this._idName),s&&(this._idxId[s]=o);if(t.group)r(o,t.group);else{i=this._groupBy(o),n=this.getGroupById(i);if(!n)return;r(o,n)}o.collection=this,this._models.insert(o);if(!t.silent)return this.updateViews("add",{model:o})},remove:function(e,t){var n,r;if(!e)return;t==null&&(t={}),r=this._models.findNode(e),this._activeModel===e&&(n=r.next&&r.next.value,n||(n=r.prev&&r.prev.value)),i(e),delete this._idxId[e.get(this._idName)],this._models.removeNode(r),t.silent||this.updateViews("remove",{model:e});if(n)return this.setActive(n,t)},removeById:function(e,t){var n;n=this.getById(e);if(n)return this.remove(n,t)},removeActive:function(e){if(this._activeModel)return this.remove(this._activeModel,e)},clear:function(e){e==null&&(e={}),this._idxId={},this._models.clear(),this.forEachGroup(function(e){return e.items&&e.items.clear()});if(!e.silent)return this.updateViews("refresh"),this.fire("refresh",this)},clearGroup:function(e){e==null&&(e={}),this._idxId={},this._models.clear(),this._groupMap={},this._groupList.clear();if(!e.silent)return this.updateViews("refresh"),this.fire("refresh",this)},loadGroupData:function(t,n){var r,i,s,o;n==null&&(n={}),i=n.silent,n.silent=!0,this.clearGroup(n);for(s=0,o=t.length;s<o;s++)r=t[s],this.insertGroup(r,n);e.isUndefined(n.activeIndex)||this.setActiveGroup(this._groupList.getAt(n.activeIndex));if(!i)return this.updateViews("refresh"),this.fire("refresh",this)},loadData:function(t,n){var r,i,s,o;n=n||{},i=n.silent,n.silent=!0,this.clear(n);for(s=0,o=t.length;s<o;s++)r=t[s],this.insert(r,n);e.isUndefined(n.activeIndex)||this.setActive(this._models.getAt(n.activeIndex));if(!i)return this.updateViews("refresh"),this.fire("refresh",this)},getActiveGroup:function(){return this._activeGroup},setActiveGroup:function(e,t){var n,r;if(this._activeGroup===e)return;t=t||{},r=this._activeGroup,this._activeGroup=e;if(!t.silent)return n={old:r,group:e},this.updateViews("activeGroup",n),this.fire("activeGroupChange",this,n)},setActiveGroupByIndex:function(e,t){if(e>=this._groupList.count()||e<0)e=-1;return this.setActiveGroup(this.getGroupAt(e),t)},getGroupById:function(e){return e?this._groupMap[e]:null},getGroupAt:function(e){return this._groupList.getAt(e)},groupCount:function(){return this._groupList.count()},getActive:function(){return this._activeModel},setActive:function(e,t){var n,r;if(this._activeModel===e)return;t=t||{},r=this._activeModel,this._activeModel=e;if(!t.silent)return n={old:r,model:e},this.updateViews("active",n),this.fire("activeModelChange",this,n)},setActiveByIndex:function(e,t){if(e>=this.count()||e<0)e=-1;return this.setActive(this.getAt(e),t)},notifyModelChange:function(e,t){var r,i,s;return e==="groupDataChange"&&this._groupSortBy&&(r=t.model,r&&(s=n(this._groupList,r,this._groupSortBy),i=this._groupList.findNode(r),this._groupList.insertNode(i,s))),this.updateViews(e,t),this.fire(e,this,t)},getById:function(e,t){return e?this._idxId[e]:null},getAt:function(e){return this._models.getAt(e)},count:function(){return this._models.count()},forEach:function(e,t,n){return this._models.forEach(e,t,n)},tryUntil:function(e,t,n){return this._models.tryUntil(e,t,n)},doWhile:function(e,t,n){return this._models.doWhile(e,t,n)},forEachGroup:function(e,t,n){return this._groupList.forEach(e,t,n)},tryUntilGroup:function(e,t,n){return this._groupList.tryUntil(e,t,n)},doWhileGroup:function(e,t,n){return this._groupList.doWhile(e,t,n)}}),e.ext(t.prototype,e.Datasource,e.EventManager)}(n)}).call(this)
{
"name": "j3",
"description": "An Useful Javascript Library for Building Website.",
"version": "0.3.2",
"version": "0.3.4",
"author": "Fossil Jue <imzshh@gmail.com>",

@@ -6,0 +6,0 @@ "repository": {"type": "git", "url": "git://github.com/imzshh/j3.git"},

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc