kekule
Version:
Open source JavaScript toolkit for chemoinformatics
1 lines • 52.4 kB
JavaScript
"use strict";!function(e){function t(){}function r(e){if(!e)return[];if(e.toArray)return e.toArray();for(var t=e.length||0,r=new Array(t);t--;)r[t]=e[t];return r}"object"==typeof self?e=self:"object"==typeof window&&window.document?e=window:"object"==typeof global&&(e=global);var n={createCore:function(){var e=null,i=r(arguments),o=i.length>1?i[1]:i[0],a=o&&o.CLASS_NAME;if(!i[0]&&i.length>1)throw"Can not create new class"+(a?" "+a:"")+" , base class not found";function s(){this.initialize.apply(this,arguments)}if(Object.isFunction(i[0])&&(e=i.shift()),Object.extend(s,n.Methods),s.superclass=e,s.subclasses=[],e){var u=function(){};u.prototype=e.prototype,s.prototype=new u,e.subclasses.push(s)}for(var l=0;l<i.length;l++)s.addMethods(i[l]);return s.prototype.initialize||(s.prototype.initialize=t),s.prototype.constructor=s,a&&(n._named_classes[a]=s),s},create:function(){return n.createCore.apply(this,arguments)},free:function(e){e.finalize&&e.finalize(),e=null},findClass:function(e,t){var r=n._named_classes[e];if(!r){var i=Object.getCascadeFieldValue(e,t);r=i&&Object.isFunction(i)&&(i.superclass||i.subclasses)?i:null}return r},_named_classes:{}};n.Methods={addMethods:function(e){if(!e)return this;var t=this.superclass&&this.superclass.prototype,r=Object.keys(e);Object.keys({toString:!0}).length||r.push("toString","valueOf");for(var n=function(){},o=0,a=r.length;o<a;o++){var s=r[o],u=e[s],l=Object.isFunction(u);if(t&&l&&"$super"===i.argumentNames(u)[0]){var p=u;(u=function(e){return function(){return(t[e]||n).apply(this,arguments)}}(s).wrap(p)).valueOf=p.valueOf.bind(p),u.toString=p.toString.bind(p)}this.prototype[s]=u}return this}},Object.extend=function(e,t,r,n){if(r||n)for(var i in t){var o=t[i];r&&null==o||(n&&""===o||(e[i]=o))}else for(var i in t)e[i]=t[i];return e},Object.extendEx=function(e,t,r){var n=r||{};for(var i in t){var o=t[i];if((!n.ignoreUnsetValue||null!=o)&&(!n.ignoreEmptyString||""!==o)){var a=e[i];if(!r.preserveExisted||!a){var s=a&&a.constructor&&a.constructor.prototype,u=o&&o.constructor&&o.constructor.prototype;a&&"object"==typeof a&&s===u?Object.extendEx(a,o,r):e[i]=o}}}return e},Object._extendSupportMethods=function(e,t){return Object.extendEx(e,t,{ignoreUnsetValue:!0,preserveExisted:!0})},Object.getCascadeFieldValue=function(t,r){var n,i;if(i=t.length&&t.splice?t:t.split("."),!r)r=e||this;for(var o=0,a=i.length;o<a&&(n=r[i[o]]);++o)r=n;return n},Object.setCascadeFieldValue=function(e,t,r,n){for(var i,o=r,a=0,s=(i=e.length&&e.splice?e:e.split(".")).length;a<s;++a){var u=i[a];if(a===s-1)return o[u]=t,t;var l=o[u];if(!l&&n&&(l={},o[u]=l),!l)return!1;o=l}},Object._inherit=function(e){null===e&&(e={});var t=typeof e;if(!a.isFunctionType(t)&&!a.isObjectType(t))throw TypeError();function r(){}return r.prototype=e,new r},Object.create||(Object.create=Object._inherit),Object.copyValues=function(e,t,r){if(r){for(var n=0,i=r.length;n<i;++n){var o=r[n],a=t[o];void 0!==a&&(e[o]=a)}return e}return Object.extend(e,t)},Object._extendSupportMethods(Object,{keys:function(e){var t=[];for(var r in e)t.push(r);return t},isFunction:function(e){return"function"==typeof e},isUndefined:function(e){return void 0===e}}),Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(r);return t});var i={argumentNames:function(e){var t=((e.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)||[])[1]||"").replace(/\s+/g,"").split(",");return 1!=t.length||t[0]?t:[]}};Object._extendSupportMethods(Function.prototype,{argumentNames:function(){var e=this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1].replace(/\s+/g,"").split(",");return 1!=e.length||e[0]?e:[]},wrap:function(e){var t=this;return function(){return e.apply(this,[t.bind(this)].concat(r(arguments)))}},methodize:function(){if(this._methodized)return this._methodized;var e=this;return this._methodized=function(){var t=Array.prototype.slice.call(arguments);return t.unshift(this),e.apply(null,t)}},bind:function(){if(arguments.length<2&&Object.isUndefined(arguments[0]))return this;var e=this,t=r(arguments),n=t.shift();return function(){return e.apply(n,t.concat(r(arguments)))}},delay:function(){var t=this,n=r(arguments),i=n.shift();return e.setTimeout(function(){return t.apply(t,n)},i)},defer:function(){var t=this,n=r(arguments);n.shift();return e.setTimeout(function(){return t.apply(t,n)},10)}}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){t||(t=0);var r=this.length;for(t<0&&(t=r+t);t<r;t++)if(this[t]===e)return t;return-1}),Array.prototype.lastIndexOf||(Array.prototype.lastIndexOf=function(e,t){t=isNaN(t)?this.length:(t<0?this.length+t:t)+1;var r=this.slice(0,t).reverse().indexOf(e);return r<0?r:t-r-1}),Array.prototype.map&&(Array.prototype.map=function(e){var t,r,n;if(null==this)throw new TypeError("this is null or not defined");var i=Object(this),o=i.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(arguments.length>1&&(t=arguments[1]),r=new Array(o),n=0;n<o;){var a,s;n in i&&(a=i[n],s=e.call(t,a,n,i),r[n]=s),n++}return r}),Object._extendSupportMethods(String.prototype,{gsub:function(e,t){for(var r="",n=this;n.length>0;)void 0===n.match(e)?(r+=n.slice(0,(void 0).index),r+=t,n=n.slice((void 0).index+(void 0)[0].length)):(r+=n,n="");return r},sub:function(e,t,r){return r=Object.isUndefined(r)?1:r,this.gsub(e,function(e){return--r<0?e[0]:t(e)})},scan:function(e,t){return this.gsub(e,t),String(this)},truncate:function(e,t){return e=e||30,t=Object.isUndefined(t)?"...":t,this.length>e?this.slice(0,e-t.length)+t:String(this)},strip:function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")},stripTags:function(){return this.replace(/<\/?[^>]+>/gi,"")},stripScripts:function(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")},extractScripts:function(){var e=new RegExp(Prototype.ScriptFragment,"img"),t=new RegExp(Prototype.ScriptFragment,"im");return(this.match(e)||[]).map(function(e){return(e.match(t)||["",""])[1]})},escapeHTML:function(){return this.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\n/g,"<br />")},unescapeHTML:function(){return this.replace(/\<br \/\>/g,"\n").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")},toQueryParams:function(e){var t=this.strip().match(/([^?#]*)(#.*)?$/);return t?t[1].split(e||"&").inject({},function(e,t){if((t=t.split("="))[0]){var r=decodeURIComponent(t.shift()),n=t.length>1?t.join("="):t[0];null!=n&&(n=decodeURIComponent(n)),r in e?(Object.isArray(e[r])||(e[r]=[e[r]]),e[r].push(n)):e[r]=n}return e}):{}},toArray:function(){return this.split("")},succ:function(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)},times:function(e){return e<1?"":new Array(e+1).join(this)},camelize:function(){var e=this.split("-"),t=e.length;if(1==t)return e[0];for(var r="-"==this.charAt(0)?e[0].charAt(0).toUpperCase()+e[0].substring(1):e[0],n=1;n<t;n++)r+=e[n].charAt(0).toUpperCase()+e[n].substring(1);return r},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()},capitalizeFirst:function(){return this.charAt(0).toUpperCase()+this.substring(1)},underscore:function(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()},dasherize:function(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z\d])([A-Z])/g,"$1-$2").replace(/-/g,"-").toLowerCase()},inspect:function(e){var t=this.gsub(/[\x00-\x1f\\]/,function(e){var t=String.specialChar[e[0]];return t||"\\u00"+e[0].charCodeAt().toPaddedString(2,16)});return e?'"'+t.replace(/"/g,'\\"')+'"':"'"+t.replace(/'/g,"\\'")+"'"},toJSON:function(){return this.inspect(!0)},unfilterJSON:function(e){return this.sub(e||Prototype.JSONFilter,"#{1}")},isJSON:function(){var e=this;return!e.blank()&&(e=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""),/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/.test(e))},include:function(e){return this.indexOf(e)>-1},startsWith:function(e){return 0===this.indexOf(e)},endsWith:function(e){var t=this.length-e.length;return t>=0&&this.lastIndexOf(e)===t},empty:function(){return""==this},blank:function(){return/^\s*$/.test(this)},interpolate:function(e,t){return new Template(this,t).evaluate(e)}}),Object._extendSupportMethods(String.prototype,{upperFirst:function(){return this.charAt(0).toUpperCase()+this.substring(1)},format:function(){for(var e=this,t=0;t<arguments.length;t++){var r=new RegExp("\\{"+t+"\\}","gi");e=e.replace(r,arguments[t])}return e},trim:function(){return this.replace(/^\s*|\s*$/g,"")},ltrim:function(){return this.replace(/^\s+/,"")},rtrim:function(){return this.replace(/\s+$/,"")},trimLeft:function(){return this.ltrim()},trimRight:function(){return this.rtrim()},pad:function(e,t,r){for(var n=t||" ",i=[],o=0,a=e-this.length;o<a;++o)i.push(n);return r?this+i.join(""):i.join("")+this},lpad:function(e,t){return this.pad(e,t,!1)},rpad:function(e,t){return this.pad(e,t,!0)},reverse:function(){for(var e=[],t=this.length-1;t>=0;--t)e.push(this.charAt(t));return e.join("")},toCharArray:function(){for(var e=[],t=0,r=this.length;t<r;++t)e.push(this.charAt(t));return e},hyphenize:function(e){e||(e="-");for(var t=this.length,r=[],n=0;n<t;++n){var i=this.charAt(n);0!==n&&i>="A"&&i<="Z"?r.push(e+i.toLowerCase()):r.push(i)}return r.join("")}});var o={STRUE:"$TRUE",SFALSE:"$FALSE",SUNDEFINED:"$UNDEFINED",SNULL:"$NULL",SNAN:"$NAN",SPOSITIVE:"+",SNEGATIVE:"-",SDATEPREFIX:"@",isAllDigitalChar:function(e){for(var t=0,r=e.length;t<r;++t){var n=e.charAt(t);if(!(n>="0"&&n<="9")&&"."!=n)return!1}return!0},isNumbericStr:function(e){var t=Number(e);return!isNaN(t)},serializeValue:function(e,t){var r=t||[],n=a.getType(e);if(r.indexOf(n)>=0)return e.toString();if(null===e)return o.SNULL;if(void 0===e)return o.SUNDEFINED;if(e!=e)return o.SNAN;switch(n){case"boolean":return e?o.STRUE:o.SFALSE;case"number":case a.INT:case a.FLOAT:return(e>=0?o.SPOSITIVE:"")+e;case a.DATE:return o.SDATEPREFIX+e.toString();default:return e.toString()}},deserializeValue:function(e,t){if("string"!=typeof e)return e;switch(e){case o.STRUE:return!0;case o.SFALSE:return!1;case o.SNULL:return null;case o.SUNDEFINED:return;case o.SNAN:return NaN;default:if(t){if(!e&&[a.NUMBER,a.INT,a.FLOAT].indexOf(t)>=0)return;switch(t){case a.FLOAT:return parseFloat(e);case a.INT:return parseInt(e);case"number":return parseFloat(e);case"boolean":return!!e;default:return e}}else{switch(e.charAt(0)){case o.SPOSITIVE:case o.SNEGATIVE:var r=e.substring(1);return o.isNumbericStr(r)?parseFloat(e):e;case o.SDATEPREFIX:r=e.substr(1);try{var n=new Date(r);return isNaN(n.getTime())?e:n}catch(t){return e}default:return e}}}}};Object.extend(Date.prototype,{copyFrom:function(e){this.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),this.setTime(e.getTime())}}),Date.now||(Date.now=function(){return(new Date).getTime()}),Math.sqr||(Math.sqr=function(e){return e*e}),Math.sign||(Math.sign=function(e){return e>0?1:e<0?-1:0}),Math.log10||(Math.log10=function(e){return Math.log(e)*Math.LOG10E}),void 0===e.Node&&(e.Node=function(){}),e.Node.ELEMENT_NODE||Object.extend(e.Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12}),n.PropertyScope={DEFAULT:3,PUBLISHED:3,PUBLIC:2,PRIVATE:1},n.PropList=function(){this.props=[]},n.PropList.prototype={addProperty:function(e,t){var r;return t||(t={}),(r=this.getPropInfo(e))||(r={},this.props.push(r)),void 0===(r=Object.extend(r,t)).serializable&&(r.serializable=!0),r.name=e,r},removeProperty:function(e){var t=this.indexOf(e);t>=0&&this.props.splice(t,1)},removePropAt:function(e){e>=0&&(this.props[e]&&this.props.splice(e,1))},getLength:function(){return this.props.length},indexOf:function(e){for(var t=0,r=this.props.length;t<r;++t)if(this.props[t].name===e)return t;return-1},getPropInfoAt:function(e){return e>=0?this.props[e]:null},getPropInfo:function(e){var t=this.indexOf(e);return this.getPropInfoAt(t)},hasProperty:function(e){return this.indexOf(e)>=0},clear:function(){this.props.clear()},clone:function(){var e=new n.PropList;return e.props=this.props.slice(),e},appendList:function(e){for(var t=0,r=e.props.length;t<r;++t)this.props.push(e.props[t])}},n.PropList.prototype.constructor=n.PropList,n.EventHandlerList=function(){this.handlers=[],this._$flag_="KekuleEventList"},n.EventHandlerList.prototype={add:function(e,t){t||(t=null),this.handlers.push({thisArg:t,handler:e})},remove:function(e,t){var r=this.indexesOf(e,t);if(r.length>0)for(var n=r.length-1;n>=0;--n)this.removeAt(r[n])},removeAt:function(e){for(var t=e,r=this.handlers.length;t<r;++t)this.handlers[t]=this.handlers[t+1];this.handlers.length=this.handlers.length-1},clear:function(){this.handlers=[]},getHandlerInfo:function(e){return this.handlers[e]},indexOf:function(e,t){for(var r=0,n=this.handlers.length;r<n;++r)if(this.handlers[r].handler==e){if(void 0!==t&&this.handlers[r].thisArg===t)return r;if(void 0===t)return r}return-1},indexesOf:function(e,t){for(var r=[],n=0,i=this.handlers.length;n<i;++n)this.handlers[n].handler==e&&(void 0!==t&&this.handlers[n].thisArg===t?r.push(n):void 0===t&&r.push(n));return r},getLength:function(){return this.handlers.length}},n.EventHandlerList.constructor=n.EventHandlerList;var a={UNKNOWN:null,VARIANT:null,PRIMARY:"primary",UNDEFINED:"undefined",BOOL:"boolean",BOOLEAN:"boolean",NUMBER:"number",INT:"int",INTEGER:"int",FLOAT:"float",STRING:"string",ARRAY:"array",FUNCTION:"function",DATE:"date",HASH:"object",OBJECT:"object",OBJECTEX:"objectex",CLASS:"class",isSimpleType:function(e){return e==a.STRING||e==a.NUMBER||e==a.INT||e==a.FLOAT||e==a.BOOL||e==a.UNDEFINED||e==a.PRIMARY},isComplexType:function(e){return!(a.isSimpleType(e)||a.isFunctionType(e))},isFunctionType:function(e){return e==a.FUNCTION},isObjectType:function(e){return e==a.OBJECT},isDateType:function(e){return e==a.DATE},isObjectExType:function(e){var t=a.isComplexType(e)&&!a.isObjectType(e)&&!a.isDateType(e);if(t){var r=u.findClass(e);t=r&&u.isOrIsDescendantOf(r,l)}return t},getType:function(e){var t=typeof e;switch(t){case"undefined":return a.UNDEFINED;case"function":return a.FUNCTION;case"boolean":return a.BOOL;case"string":return a.STRING;case"number":return Math.floor(e)==e?a.INT:a.FLOAT;case"object":return this.isDateValue(e)?a.DATE:a.isArrayValue(e)?a.ARRAY:u.isClass(e)?a.CLASS:a.isObjectExValue(e)&&e.getClassName?e.getClassName():a.OBJECT;default:return t}},isSimpleValue:function(e){return a.isSimpleType(typeof e)},isUndefinedValue:function(e){return void 0===e},isNullValue:function(e){return null===e},isFunctionValue:function(e){return"function"==typeof e},isObjectValue:function(e){return!!e&&("object"==typeof e&&!a.isArrayValue(e)&&!a.isDateValue(e))},isDateValue:function(e){return!!e&&("object"==typeof e&&void 0!==e.getFullYear)},isArrayValue:function(e){return!!e&&("object"==typeof e&&void 0!==e.length)},isObjectExValue:function(e){return e instanceof l},createInstance:function(e){switch(e){case a.UNDEFINED:return;case a.DATE:return new Date;case a.ARRAY:return new Array;case a.OBJECT:return new Object;case a.FUNCTION:return function(){};default:return new(u.findClass(e.capitalizeFirst()))}}},s=Object.defineProperty&&function(){try{return Object.defineProperty({},"x",{}),!0}catch(e){return!1}}(),u={isClass:function(e){return!!e&&!(!e.superclass&&!e.subclasses)},findClass:function(t,r){return n.findClass(t,r||e)},getClassName:function(e){return e?e.prototype.CLASS_NAME:null},getClassLocalName:function(e){var t=u.getClassName(e),r=t.lastIndexOf(".");return r>=0?t.substring(r+1):t},getPrototype:function(e){return e.prototype},getSuperClass:function(e){return e.superclass||e.constructor.superclass},getSuperClassPrototype:function(e){return e.superclass?e.superclass.prototype:null},_getCommonSuperClass2:function(e,t){for(var r=e;r&&!u.isOrIsDescendantOf(t,r);)r=u.getSuperClass(r);return r},getCommonSuperClass:function(e){if(!e||!e.length)return null;var t=e[0].getClass?e[0].getClass():null;if(!t)return null;for(var r=1,n=e.length;r<n;++r){var i=e[r].getClass?e[r].getClass():null;if(!i)return null;t=u._getCommonSuperClass2(t,i)}return t},isDescendantOf:function(e,t){for(var r=u.getSuperClass(e);r&&r!==t;)r=u.getSuperClass(r);return!!r},isOrIsDescendantOf:function(e,t){return e===t||u.isDescendantOf(e,t)},isOrIsDescendantOfClasses:function(e,t){for(var r=0,n=t.length;r<n;++r)if(u.isOrIsDescendantOf(e,t[r]))return!0;return!1},_ensurePropertySystem:function(e){var t=u.getPrototype(e);if(t&&!t.hasOwnProperty("properties")){var r=u.getSuperClass(e);r&&u._ensurePropertySystem(r),u._createPropertyList(e),u._remapPropGetters(e),t.hasOwnProperty("initProperties")&&t.initProperties.apply(t)}},_createPropertyList:function(e){u.getPrototype(e).hasOwnProperty("properties")||(u.getPrototype(e).properties=new n.PropList)},_remapPropGetters:function(e,t){for(var r=u.getPrototype(e),n=t||Object.getOwnPropertyNames(r),i=0,o=n.length;i<o;++i){var a=n[i];if(a.length>5&&a.startsWith("doGet")){var l=r[a];if("function"==typeof l){var p=a.charAt(5).toLowerCase()+a.substr(6);if(r.hasDirectProperty(p))continue;var c=u.getPropInfo(e,p);if(c&&c.getter)if(r["get"+p.capitalizeFirst()]=l,s){var f=Object.extend({},c.descriptor);f.get=l;try{Object.defineProperty(r,p,f)}catch(e){throw e}}}}}},getOwnPropList:function(e){var t=u.getPrototype(e);return t?(t._initPropertySystem(),t.properties):null},getAllPropList:function(e){var t,r=u.getSuperClassPrototype(e);return r?(t=r.getAllPropList().clone()).appendList(u.getOwnPropList(e)):t=u.getOwnPropList(e),t},getPropListOfScopes:function(e,t){var r,i=function(e,t){var r=u.getOwnPropList(e).clone();if(r)for(var i=r.getLength()-1;i>=0;--i){var o=r.getPropInfoAt(i).scope||n.PropertyScope.DEFAULT;t.indexOf(o)<0&&r.removePropAt(i)}return r},o=u.getSuperClass(e);return o?(r=u.getPropListOfScopes(o,t).clone()).appendList(i(e,t)):r=i(e,t),r},defineProp:function(e,t,r){return u._ensurePropertySystem(e),u.getPrototype(e).defineProp(t,r)},defineProps:function(e,t){u._ensurePropertySystem(e);for(var r=u.getPrototype(e),n=0,i=t.length;n<i;++n){var o=t[n],a=o.name,s=o;r.defineProp(a,s)}},getPropInfo:function(e,t,r){return u.getPrototype(e).getPropInfo(t,r)},defineEvent:function(e,t){return u.getPrototype(e).defineEvent(t)},getUnusedMethodName:function(e,t,r){for(var n=r||0,i=u.getPrototype(e),o=t+Number(n).toString();i[o];)++n,o=t+Number(n).toString();return o},extendMethod:function(e,t,r){var n=u.getPrototype(e),i=n[t],o=u.getUnusedMethodName(e,"__$changed$_"+t+"__");n[o]=i;var a,s=(a=o,function(){return n[a].apply(this,arguments)}).wrap(r);n[t]=s,s.valueOf=r.valueOf.bind(r),s.toString=r.toString.bind(r)},extendMethods:function(e,t){for(var r=Object.keys(t),n=0,i=r.length;n<i;++n){var o=r[n],a=t[o];"function"==typeof a&&u.extendMethod(e,o,a)}},extend:function(e,t){var r=u.getPrototype(e),n=u.getSuperClassPrototype(e),o=Object.keys(t);Object.keys({toString:!0}).length||o.push("toString","valueOf");for(var a=0,s=o.length;a<s;a++){var l=o[a],p=t[l];if("function"==typeof p){var c=i.argumentNames(p),f=c[0];if("$origin"==f){var h=p,d=r[l],g=u.getUnusedMethodName(e,"__$changed$_"+l+"__");r[g]=d,(p=function(e){return function(){return r[e].apply(this,arguments)}}(g).wrap(h)).valueOf=h.valueOf.bind(h),p.toString=h.toString.bind(h),c.shift(),f=c.first()}if("$super"==f){h=p;(p=function(e){return function(){return n[e].apply(this,arguments)}}(l).wrap(h)).valueOf=h.valueOf.bind(h),p.toString=h.toString.bind(h)}}r[l]=p}return u._remapPropGetters(e,o),e}},l=n.create({CLASS_NAME:"ObjectEx",EVENT_HANDLERS_FIELD:"__$__k__eventhandlers__$__",initialize:function(){this._initPropertySystem(),this._updateStatus=0,this._childChangeEventSuppressed=!1,this._modifiedProps=[],this._finalized=!1,this.beginUpdate();try{this.initPropValues()}finally{this.endUpdate()}this.afterInitialization()},afterInitialization:function(){},finalize:function(){this._finalized||(this.doFinalize(),this.invokeEvent("finalize",{obj:this}),this[this.EVENT_HANDLERS_FIELD]=null,this._finalized=!0)},doFinalize:function(){},initProperties:function(){this.defineProp("enablePropValueGetEvent",{dataType:a.BOOL,serializable:!1,scope:n.PropertyScope.PUBLIC}),this.defineProp("enablePropValueSetEvent",{dataType:a.BOOL,serializable:!1,scope:n.PropertyScope.PUBLIC}),this.defineProp("enableObjectChangeEvent",{dataType:a.BOOL,serializable:!1,scope:n.PropertyScope.PUBLIC}),this.defineProp("bubbleEvent",{dataType:a.BOOL,serializable:!1,scope:n.PropertyScope.PUBLIC}),this.defineProp("suppressChildChangeEventInUpdating",{dataType:a.BOOL,serializable:!1,scope:n.PropertyScope.PUBLIC}),this.defineProp("eventHandlers",{dataType:a.HASH,serializable:!1,scope:n.PropertyScope.PRIVATE,setter:null,getter:function(){var e=this[this.EVENT_HANDLERS_FIELD];return e||(e={},this[this.EVENT_HANDLERS_FIELD]=e),e}})},initPropValues:function(){},getHigherLevelObj:function(){return null},saved:function(e){},allSaved:function(e){},loaded:function(e){},allLoaded:function(e){},_initPropertySystem:function(){u._ensurePropertySystem(this.getClass())},_createPropertyList:function(){u._createPropertyList(this.getClass())},_remapPropGetters:function(){u._remapPropGetters(this.getClass())},getClass:function(){return this.constructor},getSuperClass:function(){return this.getClass().superclass},getClassName:function(){return this.getPrototype().CLASS_NAME},getClassLocalName:function(){return u.getClassLocalName(this.getClass())},getSerializationName:function(){return this.getClassName()},getPrototype:function(){return this.prototype?this.prototype:this.constructor.prototype},getSuperClassPrototype:function(){return this.constructor&&this.constructor.superclass?this.constructor.superclass.prototype:null},$super:function(e,t){var r=this.getSuperClassPrototype();return e?this.tryCallSuper.apply(this,arguments):r},applySuper:function(e,t,r){var n=this.__getLastSuperMethodCallTarget__(e),i=this.__getMethodBelongedPrototype__(e,n),o=this.__getMethodBelongedPrototype__(e,n.getSuperClassPrototype());o&&o===i&&(o=this.__getMethodBelongedPrototype__(e,o.getSuperClassPrototype()));var a=o&&o[e];if(a){var s;try{this.__pushSuperMethodCallTargetStack__(e,o),s=t?a.apply(this,t):a.apply(this)}finally{this.__popSuperMethodCallTargetStack__(e)}return s}if(!r)throw"Super method not found: "+e},tryApplySuper:function(e,t){return this.applySuper(e,t,!0)},tryCallSuper:function(){var e=r(arguments),t=e.shift();return this.tryApplySuper(t,e)},__getMethodBelongedPrototype__:function(e,t){if(!t)return null;if(t.hasOwnProperty(e))return t;var r=t.getSuperClassPrototype&&t.getSuperClassPrototype();return r&&r.__getMethodBelongedPrototype__?r.__getMethodBelongedPrototype__(e,r):null},__getSuperMethodCallTargetStack__:function(e){var t=this.__$superMethodCallTargetStacks__;t||(t={},this.__$superMethodCallTargetStacks__=t);var r=t[e];return r||(r=[],t[e]=r),r},__getLastSuperMethodCallTarget__:function(e){var t=this.__getSuperMethodCallTargetStack__(e);return t.length?t[t.length-1]:this.getPrototype()},__pushSuperMethodCallTargetStack__:function(e,t){this.__getSuperMethodCallTargetStack__(e).push(t)},__popSuperMethodCallTargetStack__:function(e){var t=null,r=this.__$superMethodCallTargetStacks__,n=r&&r[e];if(n){t=n.pop();n.length||delete r[e]}return t},__changeClass__:function(e){var t=u.getPrototype(e);return this.prototype=t,this.__proto__=t,this.constructor=e,this.objectChange(["__proto__"]),this},getOwnPropList:function(){return this._initPropertySystem(),this.getPrototype().properties},getAllPropList:function(){var e,t=this.getSuperClassPrototype();return t?(e=t.getAllPropList().clone()).appendList(this.getOwnPropList()):e=this.getOwnPropList().clone(),e},getPropListOfScopes:function(e){return u.getPropListOfScopes(this.getClass(),e)},getPropInfoHashKey:function(e){return l._PROPINFO_HASHKEY_PREFIX+e},getDefPropStoreFieldName:function(e){return l._PROP_STOREFIELD_PREFIX+e},defineProp:function(e,t){var r;void 0===(r=t?Object.extend({},t):{}).serializable&&(r.serializable=!0),r.storeField=this.getDefPropStoreFieldName(e);var n,i,o=this.getOwnPropList().addProperty(e,r);if(null!==r.getter&&!1!==r.getter&&(n=this.createPropGetter(o,r.getter),o.getter=n.doGetterName),null!==r.setter&&!1!==r.setter&&(i=this.createPropSetter(o,r.setter),o.setter=i.doSetterName),this[this.getPropInfoHashKey(e)]=o,s){var a={enumerable:r.enumerable,configurable:!1};void 0===a.enumerable&&(a.enumerable=!0),n&&(a.get=this[n.getterName]),i&&(a.set=this[i.setterName]),o.descriptor=a;try{Object.defineProperty(this,e,a)}catch(e){throw e}}return o},createPropGetter:function(e,t){var r=e.name.toString().upperFirst(),n="get"+r,i="doGet"+r,o=this[i];if(!o){var a=e.storeField;o=t||function(){return this[a]},this.getPrototype()[i]=o}return this.getPrototype()[n]=o,{getterName:n,doGetterName:i}},createPropSetter:function(e,t){var r=e.name.toString(),n=r.upperFirst(),i="set"+n,o="doSet"+n,a=this[o];if(!this[o]){var s=e.storeField;a=t||function(e){this[s]=e},this.getPrototype()[o]=a}return this.getPrototype()[i]=function(){var e=arguments[0];return this[o].apply(this,arguments),this.notifyPropSet(r,e),this},{setterName:i,doSetterName:o}},hasProperty:function(e){return null!=this.getPropInfo(e)},hasDirectProperty:function(e){return null!=this.getPropInfo(e,!0)},getPropInfo:function(e,t){var r,n=e||"";t||(r=this[this.getPropInfoHashKey(n)||""]);if(!r&&!(r=this.getOwnPropList().getPropInfo(n))&&!t){var i=this.getSuperClassPrototype();r=i&&i.getPropInfo?i.getPropInfo(n):null}return r},getPropertyDataType:function(e){var t=this.getPropInfo(e);return t?t.dataType:null},isPropertySerializable:function(e){var t=this.getPropInfo(e),r=t&&t.serializable;return void 0===r||!!r},getPropStoreFieldValue:function(e){return this[l._PROP_STOREFIELD_PREFIX+e]},getPropValue:function(e){var t,r=this.getPropInfo(e);if(r){if(r.getter){var n=Array.prototype.slice.call(arguments);n.shift(),t=this[r.getter].apply(this,n)}else t=this[r.storeField];return t}return null},getCascadePropValue:function(e){for(var t,r,n=this,i=0,o=(r=e.length&&e.splice?e:e.split(".")).length;i<o&&(t=n.getPropValue(r[i]));++i)n=t;return t},getPropValues:function(e){var t={};if(a.isArrayValue(e))for(var r=0,n=e.length;r<n;++r){t[i=e[r]]=this.getPropValue(i)}else if(a.isObjectValue(e))for(var i in e)e.hasOwnProperty(i)&&"function"!=typeof e[i]&&(t[i]=this.getPropValue(i));return t},setPropStoreFieldValue:function(e,t){this[l._PROP_STOREFIELD_PREFIX+e]=t},setPropValue:function(e,t,r){var n=this.getPropInfo(e);return n&&(n.setter?this[n.setter].apply(this,[t]):r&&(this[n.storeField]=t),this.notifyPropSet(e,t)),this},setPropValueX:function(){var e=Array.prototype.slice.call(arguments),t=e.shift(),r=this.getPropInfo(t);return r&&(r.setter&&this[r.setter].apply(this,e),this.notifyPropSet(t,this.getPropValue(t))),this},setPropValues:function(e,t){for(var r in e)if(e.hasOwnProperty(r)&&this.hasProperty(r)){var n=e[r];this.setPropValue(r,n,t)}return this},setCascadePropValue:function(e){for(var t,r=Array.prototype.slice.call(arguments),n=this,i=0,o=(t=(e=r.shift()).length&&e.splice?e:e.split(".")).length-1;i<o&&(n=n.getPropValue(t[i]));++i);return n&&(r.unshift(t[o]),n.setPropValueX.apply(n,r)),this},_isPropGetOrSetEvent:function(e){return"propValueGet"==e||"propValueSet"==e},notifyPropSet:function(e,t,r){this.isUpdating()?this._modifiedProps.indexOf(e)<0&&this._modifiedProps.push(e):this._isPropGetOrSetEvent(e)||this.isEventPropName(e)||(this.doPropChanged(e,t),this.getPropStoreFieldValue("enablePropValueSetEvent")&&this.invokeEvent("propValueSet",{propName:e,propValue:t}),r||this.objectChange([e]))},objectChange:function(e){var t=[].concat(e);if(this.doObjectChange(e),this.getEnableObjectChangeEvent()){var r=t.indexOf("enableObjectChangeEvent");r>=0&&t.splice(r,1),this.invokeEvent("change",{changedPropNames:t})}},doObjectChange:function(e){},doPropChanged:function(e,t){},defineEvent:function(e){},eventNameToPropName:function(e){return"__event_"+e},isEventPropName:function(e){return"string"==typeof e&&e.indexOf("__event_")>=0},isEventHandlerList:function(e){return e&&"object"==typeof e&&e instanceof n.EventHandlerList},getEventHandlerList:function(e){var t=this.getEventHandlers(),r=t[e];return r||(r=new n.EventHandlerList,t[e]=r),r},addEventListener:function(e,t,r){var n=this.getEventHandlerList(e);return this.isEventHandlerList(n)?("change"===e&&this.setEnableObjectChangeEvent(!0),n.add(t,r)):null},addOnceEventListener:function(e,t,r){var n=this,i=function(o){n.removeEventListener(e,i,r),t(o)};return this.addEventListener(e,i,r)},removeEventListener:function(e,t,r){var n=this.getEventHandlerList(e);if(this.isEventHandlerList(n))return n.remove(t,r)},on:function(e,t,r){return this.addEventListener(e,t,r)},once:function(e,t,r){return this.addOnceEventListener(e,t,r)},off:function(e,t,r){return this.removeEventListener(e,t,r)},invokeEvent:function(e,t){t?(t.name=e,t.target=this):t={name:e,target:this},t.stopImmediatePropagation||(t.stopImmediatePropagation=this._eventStopImmediatePropagation),t.stopPropagation||(t.stopPropagation=this._eventCancelBubble),t.preventDefault||(t.preventDefault=this._eventPreventDefault),this.dispatchEvent(e,t),this.dispatchEvent("eventInvoke",{event:t,target:this,name:"eventInvoke"})},_eventStopImmediatePropagation:function(){this._stopImmediatePropagation=!0,this._cancelBubble=!0},_eventCancelBubble:function(){this._cancelBubble=!0},_eventPreventDefault:function(){this._preventDefault=!0},relayEvent:function(e,t){t.currentTarget=this,"change"===e&&this.getSuppressChildChangeEventInUpdating()&&this.isUpdating()?this._childChangeEventSuppressed=!0:this.dispatchEvent(e,t)},dispatchEvent:function(e,t){for(var r=this.getEventHandlerList(e),n=0,i=r.getLength();n<i&&!t._stopImmediatePropagation;++n){var o=r.getHandlerInfo(n);o.handler.apply(o.thisArg,[t])}if(!t._cancelBubble&&this.getBubbleEvent()){var a=this.getHigherLevelObj();a&&a.relayEvent&&a.relayEvent(e,t)}},stopEventPropagation:function(e){e.cancelBubble=!0},overwriteMethod:function(e,t){var r=this,n=this[e];return this[e]=function(){var e=Array.prototype.slice.call(arguments);return e.unshift(n&&n.bind(r)),t.apply(r,e)},this},assign:function(e){return e.assignTo(this)},assignTo:function(e){var t={};this.saveObj(t,"json"),e.loadObj(t,"json")},clone:function(){var e=new(this.getClass());return this.assignTo(e),e},beginUpdate:function(){this.doBeginUpdate()},doBeginUpdate:function(){++this._updateStatus},endUpdate:function(){if(--this._updateStatus,this.checkUpdateStatus(),!this.isUpdating()){var e=this._modifiedProps||[];this._modifiedProps=[],this._childChangeEventSuppressed&&(e.push("[children]"),this._childChangeEventSuppressed=!1),this.doEndUpdate(e)}},doEndUpdate:function(e){if(e.length){if(this.getPropStoreFieldValue("enablePropValueSetEvent"))for(var t=0,r=e.length;t<r;++t){var n=e[t],i=this.getPropValue(n);this.notifyPropSet(n,i,!0)}this.objectChange(e)}},isUpdating:function(){return this._updateStatus>0},isPropUpdated:function(e){return this._modifiedProps.indexOf(e)>=0},checkUpdateStatus:function(){this._updateStatus<=0&&(this._updateStatus=0)},copyPropsTo:function(e){for(var t=this.getAllPropList(),r=0,n=t.getLength();r<n;++r){var i=t.getPropInfoAt(r).name;if(e.hasProperty(i)){var o=this.getPropValue(i);e.setPropValue(i,o,!0)}}}});l._PROPINFO_HASHKEY_PREFIX="__$propInfo__",l._PROP_STOREFIELD_PREFIX="__$__k__p__",e.Class=n,e.ClassEx=u,e.ObjectEx=l,e.DataType=a,a.StringUtils=o}(this),function(e){var t={parse:function(e){return JSON.parse(e)},serializeToStr:function(e,t){return t&&t.prettyPrint?JSON.stringify(e,null,t.indentSpaces||2):JSON.stringify(e)}},r={DOM_PARSER:null,DOM_IMPLEMENTATION:null,XML_SERIALIZER:null,DEF_INCLUDE_TAG_NAME:"include",DEF_INCLUDE_SRC_ATTRIB:"src",DEF_LOAD_TIMEOUT:2e4,DEF_BYPASS_ROOT_ELEM:!0,DEF_SERIALIZE_TO_JSCODE_VARNAME:"__xmlStr__",FILE_EXT_XML:".xml",FILE_EXT_XML_JS_WRAPPER:".xmljs",newDocument:function(e,t){if(e||(e=""),t||(t=""),r.DOM_IMPLEMENTATION)return n=(new r.DOM_IMPLEMENTATION).createDocument(t,e,null);if("undefined"!=typeof document){if(document.implementation&&document.implementation.createDocument)return n=document.implementation.createDocument(t,e,null);if("undefined"!=typeof ActiveXObject){var n=new ActiveXObject("MSXML2.DOMDocument");if(e){var i="",o=e,a=e.indexOf(":");-1!=a&&(i=e.substring(0,a),o=e.substring(a+1));var s="<"+(i?i+":":"")+o+(t?(i?" xmlns:":" xmlns")+i+'="'+t+'"':"")+"/>";n.loadXML(s)}return n}}},parse:function(e){if(r.DOM_PARSER)return(new r.DOM_PARSER).parseFromString(e,"application/xml");if("undefined"!=typeof document){if("undefined"!=typeof DOMParser)return(new DOMParser).parseFromString(e,"application/xml");if("undefined"!=typeof ActiveXObject){var t=r.newDocument();return t.loadXML(e),t}var n="data:text/xml;charset=utf-8,"+encodeURIComponent(e),i=new XMLHttpRequest;return i.open("GET",n,!1),i.send(null),i.responseXML}},load:function(e,t,n){return r.loadHelper.loadSimple(e,t,(n||{}).timeout)},loadHelper:{loadSimple:function(e,t,n){var i=null!=t;if(null==n&&(n=r.DEF_LOAD_TIMEOUT),document.implementation&&document.implementation.createDocument){var o=new XMLHttpRequest,a=null;n&&(a=setTimeout(function(){s(null,!1)},n));var s=function(e,r){a&&clearTimeout(a),t&&t(e,r)};i&&(o.onreadystatechange=function(){if(4==o.readyState){var e=o.responseXML;e&&e.documentElement?s(e,!0):s(null,!1)}});try{o.open("get",e,i),o.send(null)}catch(e){s(null,!1)}var u=o.responseXML;return u&&u.documentElement?u:null}return r.loadHelper.loadSimpleViaDoc(e,t)},loadSimpleViaDoc:function(e,t){var n=null!=t,i=r.newDocument("dummy_dummy_dummy_dummy");return i.async=n,n&&(i.onreadystatechange=function(){4==i.readyState&&(i.documentElement&&"dummy_dummy_dummy_dummy"!=i.documentElement.tag?t(i,!0):t(i,!1))}),i.load(e),i}},serializeNode:function(e,t){if(t&&t.prettyPrint)return r.serializeNodePretty(e);if(r.XML_SERIALIZER)return(new r.XML_SERIALIZER).serializeToString(e);if("undefined"!=typeof XMLSerializer)return(new XMLSerializer).serializeToString(e);if(e.xml)return e.xml;throw"XML.serialize is not supported or can't serialize "+e},serializeNodePretty:function(e){try{return r.XML_SERIALIZER?(new r.XML_SERIALIZER).serializeToString(e).toXMLString():(new XMLSerializer).serializeToString(e).toXMLString()}catch(t){return r.serializeNode(e)}},getXmlDocUrl:function(e){return e.url||e.documentURI||e.URL||e.location}};DataType.JsonUtility=t,DataType.XmlUtility=r}(),function(){var e=Class.create(ObjectEx,{CLASS_NAME:"ObjSerializer",SERIALIZER_NAME:null,getSerializerName:function(){return this.SERIALIZER_NAME},serializeValue:function(e){return e},deserializeValue:function(e,t){return e},propNameToStorageName:function(e){return e},storageNameToPropName:function(e){return e},getObjCustomSaveMethod:function(e){return e.doSaveObj},getObjCustomLoadMethod:function(e){return e.doLoadObj},getObjCustomPropSaveMethod:function(e){return e.doSaveProp},getObjCustomPropLoadMethod:function(e){return e.doLoadProp},isUndefined:function(e){return DataType.isUndefinedValue(e)},isNull:function(e){return null===e},isNaN:function(e){return e!=e},isFunction:function(e){return DataType.isFunctionValue(e)},isArray:function(e){return DataType.isArrayValue(e)},isDate:function(e){return DataType.isDateValue(e)},isObject:function(e){return DataType.isObjectValue(e)},isObjectEx:function(e){return DataType.isObjectExValue(e)},isSimpleType:function(e){var t=typeof e;return"string"==t||"number"==t||"boolean"==t||"undefined"==t||this.isNull(e)},isComplexType:function(e){return!this.isSimpleType(e)},createChildStorageNode:function(e,t,r){},appendArrayItemStorageNode:function(e,t,r){},getNameForArrayItemStorageNode:function(e){return this.getDefaultArrayItemStorageName()},getChildStorageNode:function(e,t){},getAllArrayItemStorageNodes:function(e){},getAllStoredStorageNames:function(e){},setStorageNodeExplicitType:function(e,t){},getStorageNodeExplicitType:function(e){},getStorageNodeName:function(e){},isComplexStorageNode:function(e){},isComplexArrayItemStorageNode:function(e){},isSimpleStorageNode:function(e){},getValueExplicitType:function(e){return e instanceof ObjectEx?e.getClassName():this.isObject(e)?DataType.OBJECT:this.isArray(e)?DataType.ARRAY:this.isDate(e)?DataType.DATE:typeof e},getDefaultArrayItemStorageName:function(){return"item"},getDefaultDateStorageName:function(){return"date"},save:function(e,t,r){var n=[],i=this.saveObj(e,t,r,e,t,n);if(i)for(var o=0,a=n.length;o<a;++o)n[o]&&this.isFunction(n[o].allSaved)&&n[o].allSaved(e);return i},saveObj:function(e,t,r,n,i,o){if("object"==typeof e){var a=this.getObjCustomSaveMethod(e);if(a)return a(e,t,r||{},this,n,i,o)}var s=this.doSave(e,t,r||{},n,i,o);return s&&(o||console.log(e,e.getClassName&&e.getClassName()),o.push(e),this.isFunction(e.saved)&&e.saved(n)),s},doSave:function(e,t,r,n,i,o){return"object"==typeof e&&(e instanceof ObjectEx?this.doSaveObjectEx(e,t,r,n,i,o):this.isArray(e)?this.doSaveArray(e,t,r,n,i,o):this.isDate(e)?this.doSaveDate(e,t,r,n,i,o):this.doSaveSimpleObject(e,t,r,n,i,o)),this.setStorageNodeExplicitType(t,this.getValueExplicitType(e)),e},doSaveSimpleObject:function(e,t,r,n,i,o){for(var a in e)if(e.hasOwnProperty(a)){var s,u=e[a];this.isComplexType(u)&&(s=this.getValueExplicitType(u)),this.doSaveFieldValue(e,a,u,t,s,r,n,i,o)}},doSaveArray:function(e,t,r,n,i,o){for(var a=0,s=e.length;a<s;++a){var u=e[a],l=this.getNameForArrayItemStorageNode(u);if(this.isComplexType(u)){var p=this.appendArrayItemStorageNode(t,this.propNameToStorageName(l),this.isArray(u));this.setStorageNodeExplicitType(p,this.getValueExplicitType(u)),this.saveObj(u,p,r,n,i,o)}else this.doAppendArrayItemSimpleValue(this.serializeValue(u),typeof u,t)}},doSaveDate:function(e,t,r,n,i,o){var a=e.toUTCString();this.doSaveSimpleValue(e,this.propNameToStorageName(this.getDefaultDateStorageName()),this.serializeValue(a),DataType.DATE,t,r,n,i)},doSaveObjectEx:function(e,t,r,n,i,o){for(var a=e.getAllPropList(),s=r.propFilter,u=0,l=a.getLength();u<l;++u){var p=a.getPropInfoAt(u);if(!s||s(p,e)){var c=this.getObjCustomPropSaveMethod(e),f=!1;if(c&&(f=c(e,p,t,r,this,n,i,o)),!f)if(p.serializable)("function"==typeof p.serializable?p.serializable.apply(e):p.serializable)&&this.doSaveObjectExProp(e,p,t,r,n,i,o)}}},doSaveObjectExProp:function(e,t,r,n,i,o,a){var s=t.name,u=t.dataType,l=e.getPropValue(s);if(n.saveDefaultValues||l!==t.defaultValue){var p;l instanceof ObjectEx?l.getClassName()!=u&&(p=l.getClassName()):this.isComplexType(l)&&(p=this.getValueExplicitType(l))==u&&(p=void 0);var c=e.getPropSerializationName(s,this.getSerializerName())||s;this.doSaveFieldValue(e,c,l,r,p,n,i,o,a)}},doSaveFieldValue:function(e,t,r,n,i,o,a,s,u){if("function"!=typeof r)if(this.isComplexType(r)){var l=this.createChildStorageNode(n,this.propNameToStorageName(t),this.isArray(r));i&&this.setStorageNodeExplicitType(l,i),this.saveObj(r,l,o,a,s,u)}else this.doSaveSimpleValue(e,this.propNameToStorageName(t),this.serializeValue(r),this.getValueExplicitType(r),n,o,a,s,u)},doSaveSimpleValue:function(e,t,r,n,i,o,a,s,u){},doAppendArrayItemSimpleValue:function(e,t,r){},load:function(e,t){var r=[],n=this.loadObj(e,t,e,t,r);if(n)for(var i=0,o=r.length;i<o;++i)r[i]&&this.isFunction(r[i].allLoaded)&&r[i].allLoaded(e||n);return n},loadObj:function(e,t,r,n,i){if(!e){var o=this.getStorageNodeExplicitType(t);if(!o)return this.doLoadUntypedNode?this.doLoadUntypedNode(t,r,n):null;e=DataType.createInstance(o)}if(r||(r=e),"object"==typeof e){var a=this.getObjCustomLoadMethod(e);if(a)return a(e,t,this,r,n,i)}var s=this.doLoad(e,t,r,n,i);if(s){var u=e||s;i.push(u),this.isFunction(u.loaded)&&u.loaded(r)}return s},doLoad:function(e,t,r,n,i){this.getStorageNodeExplicitType(t);if("object"==typeof e)if(e instanceof ObjectEx){e.beginUpdate();try{e=this.doLoadObjectEx(e,t,r,n,i)}finally{e.endUpdate()}}else e=this.isArray(e)?this.doLoadArray(e,t,r,n,i):this.isDate(e)?this.doLoadDate(e,t,r,n,i):this.doLoadSimpleObject(e,t,r,n,i);return e},doLoadArray:function(e,t,r,n,i){for(var o=this.getAllArrayItemStorageNodes(t),a=0,s=o.length;a<s;++a){var u=o[a];if(this.isComplexArrayItemStorageNode(u)){var l,p=this.getStorageNodeExplicitType(u)||this.getStorageNodeName(u);p?(l=DataType.createInstance(p),this.loadObj(l,u,r,n,i)):(l={},this.loadObj(l,u,r,n,i)),e.push(l)}else{var c=this.deserializeValue(this.doGetArrayItemSimpleStorageValue(u));e.push(c)}}return e},doLoadDate:function(e,t,r,n,i){var o=this.propNameToStorageName(this.getDefaultDateStorageName()),a=this.doLoadSimpleValue(e,o,DataType.DATE,t,r,n,i);if(a){var s=new Date(a);return e.copyFrom(s),e}},doLoadSimpleObject:function(e,t,r,n,i){for(var o=this.getAllStoredStorageNames(t),a=0,s=o.length;a<s;++a){var u=o[a],l=this.storageNameToPropName(u),p=this.getChildStorageNode(t,u);if(p){var c,f=this.getStorageNodeExplicitType(p);c=f?DataType.createInstance(f):{},this.loadObj(c,p,r,n,i),e[l]=c}else{var h=this.doLoadSimpleValue(e,u,null,t,r,n,i);e[l]=h}}return e},doLoadObjectEx:function(e,t,r,n,i){for(var o=e.getAllPropList(),a=0,s=o.getLength();a<s;++a){var u=o.getPropInfoAt(a);if(u.serializable){var l=this.getObjCustomPropLoadMethod(e),p=!1;l&&(p=l(e,u,t,this,r,n,i)),p||this.doLoadObjectExProp(e,u,t,r,n,i)}}return e},doLoadObjectExProp:function(e,t,r,n,i,o){var a=t.name,s=t.dataType,u=e.getPropSerializationName(a,this.getSerializerName())||a,l=this.doLoadFieldValue(e,u,r,s,n,i,o);null!=l&&e.setPropValue(a,l,!0)},doLoadFieldValue:function(e,t,r,n,i,o,a){var s,u=!1;if(DataType.isComplexType(n)){var l=this.getChildStorageNode(r,this.propNameToStorageName(t));if(l){var p=this.getStorageNodeExplicitType(l);s=p&&p!=n?DataType.createInstance(p):DataType.createInstance(n),this.loadObj(s,l,i,o,a),u=!0}}return!DataType.isSimpleType(n)&&u||(s=this.doLoadSimpleValue(e,this.propNameToStorageName(t),n,r,i,o,a)),s},doLoadSimpleValue:function(e,t,r,n,i,o,a){var s=this.doLoadSimpleStorageValue(t,n,i,o,a);return this.deserializeValue(s,r)},doLoadSimpleStorageValue:function(e,t,r,n,i){},doGetArrayItemSimpleStorageValue:function(e){}}),t=Class.create(e,{CLASS_NAME:"JsonObjSerializer",TYPE_TAG_NAME:"__type__",createChildStorageNode:function(e,t,r){var n=r?[]:{};return e[t]=n,n},appendArrayItemStorageNode:function(e,t,r){var n=r?[]:{};return e.push(n),n},getChildStorageNode:function(e,t){var r=e[t];return this.isSimpleType(r)&&(r=null),r},getAllArrayItemStorageNodes:function(e){return Array.prototype.slice.call(e)},getAllStoredStorageNames:function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&r!=this.TYPE_TAG_NAME&&t.push(r);return t},isComplexStorageNode:function(e){return this.isComplexType(e)},isComplexArrayItemStorageNode:function(e){return this.isComplexStorageNode(e)},isSimpleStorageNode:function(e){return this.isSimpleType(e)},setStorageNodeExplicitType:function(e,t){this.isArray(e)||(e[this.TYPE_TAG_NAME]=t)},getStorageNodeExplicitType:function(e){var t=e[this.TYPE_TAG_NAME]||null;return!t&&this.isArray(e)?DataType.ARRAY:t},doSaveSimpleValue:function(e,t,r,n,i,o,a,s,u){i[t]=r},doAppendArrayItemSimpleValue:function(e,t,r){return r.push(e)},doLoadSimpleStorageValue:function(e,t,r,n,i){return t[e]},doLoadUntypedNode:function(e,t,r,n){return e},doGetArrayItemSimpleStorageValue:function(e){return e}}),r=Class.create(e,{CLASS_NAME:"XmlObjSerializer",TYPE_TAG_NAME:"dataType",UNSUIT_PROPNAME_PREFIX:"__.",getLocalName:function(e){return e.localName||e.baseName||e.nodeName},getElemTextValue:function(e){for(var t="",r=0,n=e.childNodes.length;r<n;++r)e.childNodes[r].nodeType==Node.TEXT_NODE&&(t+=e.childNodes[r].nodeValue);return t},serializeValue:function(e){return DataType.StringUtils.serializeValue(e)},deserializeValue:function(e,t){return DataType.StringUtils.deserializeValue(e,t)},propNameToStorageName:function(e){var t=e.toString().charAt(0).toLowerCase();return"_"===t||t>="a"&&t<="z"?e:this.UNSUIT_PROPNAME_PREFIX+e},storageNameToPropName:function(e){return"string"!=typeof e?e:0===e.indexOf(this.UNSUIT_PROPNAME_PREFIX)?e.substr(this.UNSUIT_PROPNAME_PREFIX.length):e},createChildStorageNode:function(e,t,r){var n=e.ownerDocument.createElement(t);return e.appendChild(n),n},appendArrayItemStorageNode:function(e,t,r){return this.createChildStorageNode(e,t,r)},getAllArrayItemStorageNodes:function(e){for(var t=[],r=0,n=e.childNodes.length;r<n;++r){var i=e.childNodes[r];i.nodeType==Node.ELEMENT_NODE&&t.push(i)}return t},getAllStoredStorageNames:function(e){for(var t=[],r=0,n=e.childNodes.length;r<n;++r){var i=e.childNodes[r];i.nodeType==Node.ELEMENT_NODE&&this.getLocalName(i)!=this.TYPE_TAG_NAME&&t.push(this.getLocalName(i))}for(r=0,n=e.attributes.length;r<n;++r){var o=e.attributes[r];this.getLocalName(o)!=this.TYPE_TAG_NAME&&t.push(this.getLocalName(o))}return t},getChildStorageNode:function(e,t){for(var r=null,n=0,i=e.childNodes.length;n<i;++n){var o=e.childNodes[n];o.nodeType==Node.ELEMENT_NODE&&this.getLocalName(o)==t&&(r=o)}return r},isComplexStorageNode:function(e){return e.nodeType==Node.ELEMENT_NODE},isComplexArrayItemStorageNode:function(e){return this.isComplexStorageNode(e)&&e.attributes.length&&!this.getElemTextValue(e).trim()},isSimpleStorageNode:function(e){return e.nodeType==Node.ATTRIBUTE_NODE},setStorageNodeExplicitType:function(e,t){e.setAttribute(this.TYPE_TAG_NAME,t)},getStorageNodeExplicitType:function(e){return e.getAttribute(this.TYPE_TAG_NAME)||null},getStorageNodeName:function(e){var t=e.tagName;return t==this.getDefaultArrayItemStorageName()?null:t},doSaveSimpleObject:function(e,t,r,n,i,o){return this.tryApplySuper("doSaveSimpleObject",[e,t,r,n,i,o])},doSaveSimpleValue:function(e,t,r,n,i,o,a,s,u){i.setAttribute(t,r)},doAppendArrayItemSimpleValue:function(e,t,r){var n=this.appendArrayItemStorageNode(r,this.propNameToStorageName(this.getDefaultArrayItemStorageName()),!1),i=n.ownerDocument.createTextNode(e);n.appendChild(i)},doLoadSimpleStorageValue:function(e,t,r,n,i){return t.getAttribute(e)||void 0},doGetArrayItemSimpleStorageValue:function(e){return this.getElemTextValue(e)}}),n={_serializerClasses:{},_defaultName:null,registerSerializer:function(e,t,r){var i="string"==typeof t?ClassEx.findClass(t):t;n._serializerClasses[e]=i,r&&(n._defaultName=e),ClassEx.getPrototype(t).SERIALIZER_NAME=e},getSerializer:function(e){var t=e||n._defaultName;if(t){var r=n._serializerClasses[t];return r?new r:null}return null}};n.registerSerializer("json",t,!0),n.registerSerializer("xml",r),Class.ObjSerializerFactory=n,ClassEx.extend(ObjectEx,{getPropSerializationName:function(e,t){return e},saveObj:function(e,t,r){return(t?"string"==typeof t?n.getSerializer(t):t:n.getSerializer()).save(this,e,r)},loadObj:function(e,t){var r,i;r=t?"string"==typeof t?n.getSerializer(t):t:n.getSerializer(),this.beginUpdate();try{i=r.load(this,e)}finally{this.endUpdate()}return i}}),Object.extend(ClassEx,{saveObj:function(e,t,r,i){return(r?"string"==typeof r?n.getSerializer(r):r:n.getSerializer()).save(e,t,i)},loadObj:function(e,t,r){return(r?"string"==typeof r?n.getSerializer(r):r:n.getSerializer()).load(e,t)}}),Object.extend(DataType,{valueToJson:function(e,t){if(DataType.isSimpleValue(e))return JSON.stringify(e);var r=DataType.isArrayValue(e)?[]:{};return ClassEx.saveObj(e,r,"json",t),JSON.stringify(r)},jsonToValue:function(e){var t=JSON.parse(e);return!t||DataType.isSimpleValue(t)?t:ClassEx.loadObj(null,t,"json")}})}();var Kekule="object"==typeof Kekule?Kekule:{};(Kekule=Object.extend(Kekule,{LIBNAME:"Kekule.js",LIBNAME_CORE:"Kekule",VERSION:"1.0.2.24121700",LOADED:!1,_afterLoadSysProcedures:[],_afterLoadUserProcedures:[],PROP_AUTO_TITLE:!0}))._loaded=function(){if(!Kekule.LOADED){Kekule.LOADED=!0;for(var e=Kekule._afterLoadSysProcedures;e.length;){(t=e.shift())&&t()}for(e=Kekule._afterLoadUserProcedures;e.length;){var t;(t=e.shift())&&t()}var r=Kekule.$jsRoot&&Kekule.$jsRoot.document;if(r&&r.createEvent&&r.body&&r.body.dispatchEvent){var n=r.createEvent("Event");n.initEvent("kekuleload",!0,!0),r.body.dispatchEvent(n)}}},Kekule._isLoaded=function(){return Kekule.LOADED},Kekule._registerAfterLoadSysProc=function(e){e&&(Kekule.LOADED?e():Kekule._afterLoadSysProcedures.push(e))},Kekule._ready=function(e){e&&(Kekule.LOADED?e():Kekule._afterLoadUserProcedures.push(e))},Kekule._registerAfterLoadProc=Kekule._ready,Kekule.$jsRoot=this,"object"==typeof window&&window&&window.document?Kekule.$jsRoot=window:"object"==typeof global?Kekule.$jsRoot=global:"object"==typeof self&&(Kekule.$jsRoot=self),Kekule.$jsRoot.Kekule=Kekule,"object"==typeof window&&window&&window.document&&(Kekule.window=window),Kekule.$document=this&&this.document||null,Kekule.scriptSrcInfo||(Kekule.scriptSrcInfo=Kekule.$jsRoot.__$kekule_load_info__),Kekule.scriptSrcInfo&&Kekule.scriptSrcInfo.language&&(Kekule.language=Kekule.scriptSrcInfo.language),!Kekule.scriptSrcInfo&&Kekule.$jsRoot.document&&(Kekule.scriptSrcInfo=function(e){var t,r=/^(.*\/?)kekule\..*\.js(\?.*)?$/;if(e&&e.currentScript&&e.currentScript.src)(t=decodeURIComponent(e.currentScript.src))&&(o=t.match(/^(.*[\/\\])[^\/\\]*\.js(\?.*)?$/));else for(var n=document.getElementsByTagName("script"),i=n.length-1;i>=0;--i){var o,a=n[i];if(t=decodeURIComponent(a.src))if(o=t.match(r))break}if(o){var s=o[2];return s&&(s=s.substr(1)),{src:t,path:o[1],paramStr:s,useMinFile:!0}}return null}(Kekule.$jsRoot.document)),Kekule.scriptSrcInfo||(Kekule.scriptSrcInfo={useMinFile:!0}),Kekule.environment={scriptInfo:Kekule.scriptSrcInfo,isNode:!("object"!=typeof process||"object"!=typeof process.versions||void 0===process.versions.node),isWeb:!("object"!=typeof window||!window.document),variables:{},getEnvVar:function(e){var t=Kekule.environment.variables[e];return void 0===t&&(t=Kekule.$jsRoot._kekule_environment_&&Kekule.$jsRoot._kekule_environment_[e]),t},setEnvVar:function(e,t){Kekule.environment.variables[e]=t}},Kekule.scriptSrcInfo&&(Kekule.environment.nodeModule=Kekule.scriptSrcInfo.nodeModule,K