var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(c.get||c.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(a){return $jscomp.SYMBOL_PREFIX+(a||"")+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(a){var b=0;return $jscomp.iteratorPrototype(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})};
$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(a,b){$jscomp.initSymbolIterator();a instanceof String&&(a+="");var c=0,d={next:function(){if(c<a.length){var e=c++;return{value:b(e,a[e]),done:!1}}d.next=function(){return{done:!0,value:void 0}};return d.next()}};d[Symbol.iterator]=function(){return d};return d};
$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var f=a[e];if(b.call(c,f,e,a))return{i:e,v:f}}return{i:-1,v:void 0}};var COMPILED=!0,goog=goog||{};goog.global=this;
goog.isDef=function(a){return void 0!==a};goog.exportPath_=function(a,b,c){a=a.split(".");c=c||goog.global;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&goog.isDef(b)?c[d]=b:c=c[d]?c[d]:c[d]={}};
goog.define=function(a,b){var c=b;COMPILED||(goog.global.CLOSURE_UNCOMPILED_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_UNCOMPILED_DEFINES,a)?c=goog.global.CLOSURE_UNCOMPILED_DEFINES[a]:goog.global.CLOSURE_DEFINES&&Object.prototype.hasOwnProperty.call(goog.global.CLOSURE_DEFINES,a)&&(c=goog.global.CLOSURE_DEFINES[a]));goog.exportPath_(a,c)};goog.DEBUG=!0;goog.LOCALE="en";goog.TRUSTED_SITE=!0;goog.STRICT_MODE_COMPATIBLE=!1;goog.DISALLOW_TEST_ONLY_CODE=COMPILED&&!goog.DEBUG;
goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING=!1;goog.provide=function(a){if(goog.isInModuleLoader_())throw Error("goog.provide can not be used within a goog.module.");if(!COMPILED&&goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');goog.constructNamespace_(a)};goog.constructNamespace_=function(a,b){if(!COMPILED){delete goog.implicitNamespaces_[a];for(var c=a;(c=c.substring(0,c.lastIndexOf(".")))&&!goog.getObjectByName(c);)goog.implicitNamespaces_[c]=!0}goog.exportPath_(a,b)};
goog.VALID_MODULE_RE_=/^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
goog.module=function(a){if(!goog.isString(a)||!a||-1==a.search(goog.VALID_MODULE_RE_))throw Error("Invalid module identifier");if(!goog.isInModuleLoader_())throw Error("Module "+a+" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.");if(goog.moduleLoaderState_.moduleName)throw Error("goog.module may only be called once per module.");
goog.moduleLoaderState_.moduleName=a;if(!COMPILED){if(goog.isProvided_(a))throw Error('Namespace "'+a+'" already declared.');delete goog.implicitNamespaces_[a]}};goog.module.get=function(a){return goog.module.getInternal_(a)};goog.module.getInternal_=function(a){if(!COMPILED)return goog.isProvided_(a)?a in goog.loadedModules_?goog.loadedModules_[a]:goog.getObjectByName(a):null};goog.moduleLoaderState_=null;goog.isInModuleLoader_=function(){return null!=goog.moduleLoaderState_};
goog.module.declareLegacyNamespace=function(){if(!COMPILED&&!goog.isInModuleLoader_())throw Error("goog.module.declareLegacyNamespace must be called from within a goog.module");if(!COMPILED&&!goog.moduleLoaderState_.moduleName)throw Error("goog.module must be called prior to goog.module.declareLegacyNamespace.");goog.moduleLoaderState_.declareLegacyNamespace=!0};
goog.setTestOnly=function(a){if(goog.DISALLOW_TEST_ONLY_CODE)throw a=a||"",Error("Importing test-only code into non-debug environment"+(a?": "+a:"."));};goog.forwardDeclare=function(a){};COMPILED||(goog.isProvided_=function(a){return a in goog.loadedModules_||!goog.implicitNamespaces_[a]&&goog.isDefAndNotNull(goog.getObjectByName(a))},goog.implicitNamespaces_={"goog.module":!0});
goog.getObjectByName=function(a,b){for(var c=a.split("."),d=b||goog.global,e;e=c.shift();)if(goog.isDefAndNotNull(d[e]))d=d[e];else return null;return d};goog.globalize=function(a,b){var c=b||goog.global,d;for(d in a)c[d]=a[d]};
goog.addDependency=function(a,b,c,d){if(goog.DEPENDENCIES_ENABLED){var e;a=a.replace(/\\/g,"/");var f=goog.dependencies_;d&&"boolean"!==typeof d||(d=d?{module:"goog"}:{});for(var g=0;e=b[g];g++)f.nameToPath[e]=a,f.loadFlags[a]=d;for(d=0;b=c[d];d++)a in f.requires||(f.requires[a]={}),f.requires[a][b]=!0}};goog.ENABLE_DEBUG_LOADER=!0;goog.logToConsole_=function(a){goog.global.console&&goog.global.console.error(a)};
goog.require=function(a){if(!COMPILED){goog.ENABLE_DEBUG_LOADER&&goog.IS_OLD_IE_&&goog.maybeProcessDeferredDep_(a);if(goog.isProvided_(a)){if(goog.isInModuleLoader_())return goog.module.getInternal_(a)}else if(goog.ENABLE_DEBUG_LOADER){var b=goog.getPathFromDeps_(a);if(b)goog.writeScripts_(b);else throw a="goog.require could not find: "+a,goog.logToConsole_(a),Error(a);}return null}};goog.basePath="";goog.nullFunction=function(){};
goog.abstractMethod=function(){throw Error("unimplemented abstract method");};goog.addSingletonGetter=function(a){a.getInstance=function(){if(a.instance_)return a.instance_;goog.DEBUG&&(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length]=a);return a.instance_=new a}};goog.instantiatedSingletons_=[];goog.LOAD_MODULE_USING_EVAL=!0;goog.SEAL_MODULE_EXPORTS=goog.DEBUG;goog.loadedModules_={};goog.DEPENDENCIES_ENABLED=!COMPILED&&goog.ENABLE_DEBUG_LOADER;goog.TRANSPILE="detect";
goog.TRANSPILER="transpile.js";
goog.DEPENDENCIES_ENABLED&&(goog.dependencies_={loadFlags:{},nameToPath:{},requires:{},visited:{},written:{},deferred:{}},goog.inHtmlDocument_=function(){var a=goog.global.document;return null!=a&&"write"in a},goog.findBasePath_=function(){if(goog.isDef(goog.global.CLOSURE_BASE_PATH))goog.basePath=goog.global.CLOSURE_BASE_PATH;else if(goog.inHtmlDocument_())for(var a=goog.global.document.getElementsByTagName("SCRIPT"),b=a.length-1;0<=b;--b){var c=a[b].src,d=c.lastIndexOf("?"),d=-1==d?c.length:d;if("base.js"==
c.substr(d-7,7)){goog.basePath=c.substr(0,d-7);break}}},goog.importScript_=function(a,b){(goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_)(a,b)&&(goog.dependencies_.written[a]=!0)},goog.IS_OLD_IE_=!(goog.global.atob||!goog.global.document||!goog.global.document.all),goog.importProcessedScript_=function(a,b,c){goog.importScript_("",'goog.retrieveAndExec_("'+a+'", '+b+", "+c+");")},goog.queuedModules_=[],goog.wrapModule_=function(a,b){return goog.LOAD_MODULE_USING_EVAL&&goog.isDef(goog.global.JSON)?
"goog.loadModule("+goog.global.JSON.stringify(b+"\n//# sourceURL="+a+"\n")+");":'goog.loadModule(function(exports) {"use strict";'+b+"\n;return exports});\n//# sourceURL="+a+"\n"},goog.loadQueuedModules_=function(){var a=goog.queuedModules_.length;if(0<a){var b=goog.queuedModules_;goog.queuedModules_=[];for(var c=0;c<a;c++)goog.maybeProcessDeferredPath_(b[c])}},goog.maybeProcessDeferredDep_=function(a){goog.isDeferredModule_(a)&&goog.allDepsAreAvailable_(a)&&(a=goog.getPathFromDeps_(a),goog.maybeProcessDeferredPath_(goog.basePath+
a))},goog.isDeferredModule_=function(a){var b=(a=goog.getPathFromDeps_(a))&&goog.dependencies_.loadFlags[a]||{},c=b.lang||"es3";return a&&("goog"==b.module||goog.needsTranspile_(c))?goog.basePath+a in goog.dependencies_.deferred:!1},goog.allDepsAreAvailable_=function(a){if((a=goog.getPathFromDeps_(a))&&a in goog.dependencies_.requires)for(var b in goog.dependencies_.requires[a])if(!goog.isProvided_(b)&&!goog.isDeferredModule_(b))return!1;return!0},goog.maybeProcessDeferredPath_=function(a){if(a in
goog.dependencies_.deferred){var b=goog.dependencies_.deferred[a];delete goog.dependencies_.deferred[a];goog.globalEval(b)}},goog.loadModuleFromUrl=function(a){goog.retrieveAndExec_(a,!0,!1)},goog.writeScriptSrcNode_=function(a){goog.global.document.write('<script type="text/javascript" src="'+a+'">\x3c/script>')},goog.appendScriptSrcNode_=function(a){var b=goog.global.document,c=b.createElement("script");c.type="text/javascript";c.src=a;c.defer=!1;c.async=!1;b.head.appendChild(c)},goog.writeScriptTag_=
function(a,b){if(goog.inHtmlDocument_()){var c=goog.global.document;if(!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING&&"complete"==c.readyState){if(/\bdeps.js$/.test(a))return!1;throw Error('Cannot write "'+a+'" after document load');}if(void 0===b)if(goog.IS_OLD_IE_){var d=" onreadystatechange='goog.onScriptLoad_(this, "+ ++goog.lastNonModuleScriptIndex_+")' ";c.write('<script type="text/javascript" src="'+a+'"'+d+">\x3c/script>")}else goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING?goog.appendScriptSrcNode_(a):
goog.writeScriptSrcNode_(a);else c.write('<script type="text/javascript">'+goog.protectScriptTag_(b)+"\x3c/script>");return!0}return!1},goog.protectScriptTag_=function(a){return a.replace(/<\/(SCRIPT)/ig,"\\x3c\\$1")},goog.needsTranspile_=function(a){if("always"==goog.TRANSPILE)return!0;if("never"==goog.TRANSPILE)return!1;goog.requiresTranspilation_||(goog.requiresTranspilation_=goog.createRequiresTranspilation_());if(a in goog.requiresTranspilation_)return goog.requiresTranspilation_[a];throw Error("Unknown language mode: "+
a);},goog.requiresTranspilation_=null,goog.lastNonModuleScriptIndex_=0,goog.onScriptLoad_=function(a,b){"complete"==a.readyState&&goog.lastNonModuleScriptIndex_==b&&goog.loadQueuedModules_();return!0},goog.writeScripts_=function(a){function b(a){if(!(a in e.written||a in e.visited)){e.visited[a]=!0;if(a in e.requires)for(var f in e.requires[a])if(!goog.isProvided_(f))if(f in e.nameToPath)b(e.nameToPath[f]);else throw Error("Undefined nameToPath for "+f);a in d||(d[a]=!0,c.push(a))}}var c=[],d={},
e=goog.dependencies_;b(a);for(a=0;a<c.length;a++){var f=c[a];goog.dependencies_.written[f]=!0}var g=goog.moduleLoaderState_;goog.moduleLoaderState_=null;for(a=0;a<c.length;a++)if(f=c[a]){var h=e.loadFlags[f]||{},l=goog.needsTranspile_(h.lang||"es3");"goog"==h.module||l?goog.importProcessedScript_(goog.basePath+f,"goog"==h.module,l):goog.importScript_(goog.basePath+f)}else throw goog.moduleLoaderState_=g,Error("Undefined script input");goog.moduleLoaderState_=g},goog.getPathFromDeps_=function(a){return a in
goog.dependencies_.nameToPath?goog.dependencies_.nameToPath[a]:null},goog.findBasePath_(),goog.global.CLOSURE_NO_DEPS||goog.importScript_(goog.basePath+"deps.js"));
goog.loadModule=function(a){var b=goog.moduleLoaderState_;try{goog.moduleLoaderState_={moduleName:void 0,declareLegacyNamespace:!1};var c;if(goog.isFunction(a))c=a.call(void 0,{});else if(goog.isString(a))c=goog.loadModuleFromSource_.call(void 0,a);else throw Error("Invalid module definition");var d=goog.moduleLoaderState_.moduleName;if(!goog.isString(d)||!d)throw Error('Invalid module name "'+d+'"');goog.moduleLoaderState_.declareLegacyNamespace?goog.constructNamespace_(d,c):goog.SEAL_MODULE_EXPORTS&&
Object.seal&&goog.isObject(c)&&Object.seal(c);goog.loadedModules_[d]=c}finally{goog.moduleLoaderState_=b}};goog.loadModuleFromSource_=function(a){eval(a);return{}};goog.normalizePath_=function(a){a=a.split("/");for(var b=0;b<a.length;)"."==a[b]?a.splice(b,1):b&&".."==a[b]&&a[b-1]&&".."!=a[b-1]?a.splice(--b,2):b++;return a.join("/")};
goog.loadFileSync_=function(a){if(goog.global.CLOSURE_LOAD_FILE_SYNC)return goog.global.CLOSURE_LOAD_FILE_SYNC(a);try{var b=new goog.global.XMLHttpRequest;b.open("get",a,!1);b.send();return 0==b.status||200==b.status?b.responseText:null}catch(c){return null}};
goog.retrieveAndExec_=function(a,b,c){if(!COMPILED){var d=a;a=goog.normalizePath_(a);var e=goog.global.CLOSURE_IMPORT_SCRIPT||goog.writeScriptTag_,f=goog.loadFileSync_(a);if(null==f)throw Error('Load of "'+a+'" failed');c&&(f=goog.transpile_.call(goog.global,f,a));f=b?goog.wrapModule_(a,f):f+("\n//# sourceURL="+a);goog.IS_OLD_IE_?(goog.dependencies_.deferred[d]=f,goog.queuedModules_.push(d)):e(a,f)}};
goog.transpile_=function(a,b){var c=goog.global.$jscomp;c||(goog.global.$jscomp=c={});var d=c.transpile;if(!d){var e=goog.basePath+goog.TRANSPILER,f=goog.loadFileSync_(e);if(f){eval(f+"\n//# sourceURL="+e);if(goog.global.$gwtExport&&goog.global.$gwtExport.$jscomp&&!goog.global.$gwtExport.$jscomp.transpile)throw Error('The transpiler did not properly export the "transpile" method. $gwtExport: '+JSON.stringify(goog.global.$gwtExport));goog.global.$jscomp.transpile=goog.global.$gwtExport.$jscomp.transpile;
c=goog.global.$jscomp;d=c.transpile}}d||(d=c.transpile=function(a,b){goog.logToConsole_(b+" requires transpilation but no transpiler was found.");return a});return d(a,b)};
goog.typeOf=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b};goog.isNull=function(a){return null===a};goog.isDefAndNotNull=function(a){return null!=a};goog.isArray=function(a){return"array"==goog.typeOf(a)};goog.isArrayLike=function(a){var b=goog.typeOf(a);return"array"==b||"object"==b&&"number"==typeof a.length};goog.isDateLike=function(a){return goog.isObject(a)&&"function"==typeof a.getFullYear};goog.isString=function(a){return"string"==typeof a};
goog.isBoolean=function(a){return"boolean"==typeof a};goog.isNumber=function(a){return"number"==typeof a};goog.isFunction=function(a){return"function"==goog.typeOf(a)};goog.isObject=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b};goog.getUid=function(a){return a[goog.UID_PROPERTY_]||(a[goog.UID_PROPERTY_]=++goog.uidCounter_)};goog.hasUid=function(a){return!!a[goog.UID_PROPERTY_]};
goog.removeUid=function(a){null!==a&&"removeAttribute"in a&&a.removeAttribute(goog.UID_PROPERTY_);try{delete a[goog.UID_PROPERTY_]}catch(b){}};goog.UID_PROPERTY_="closure_uid_"+(1E9*Math.random()>>>0);goog.uidCounter_=0;goog.getHashCode=goog.getUid;goog.removeHashCode=goog.removeUid;goog.cloneObject=function(a){var b=goog.typeOf(a);if("object"==b||"array"==b){if(a.clone)return a.clone();var b="array"==b?[]:{},c;for(c in a)b[c]=goog.cloneObject(a[c]);return b}return a};
goog.bindNative_=function(a,b,c){return a.call.apply(a.bind,arguments)};goog.bindJs_=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}};
goog.bind=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?goog.bind=goog.bindNative_:goog.bind=goog.bindJs_;return goog.bind.apply(null,arguments)};goog.partial=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}};goog.mixin=function(a,b){for(var c in b)a[c]=b[c]};goog.now=goog.TRUSTED_SITE&&Date.now||function(){return+new Date};
goog.globalEval=function(a){if(goog.global.execScript)goog.global.execScript(a,"JavaScript");else if(goog.global.eval){if(null==goog.evalWorksForGlobals_)if(goog.global.eval("var _evalTest_ = 1;"),"undefined"!=typeof goog.global._evalTest_){try{delete goog.global._evalTest_}catch(d){}goog.evalWorksForGlobals_=!0}else goog.evalWorksForGlobals_=!1;if(goog.evalWorksForGlobals_)goog.global.eval(a);else{var b=goog.global.document,c=b.createElement("SCRIPT");c.type="text/javascript";c.defer=!1;c.appendChild(b.createTextNode(a));
b.body.appendChild(c);b.body.removeChild(c)}}else throw Error("goog.globalEval not available");};goog.evalWorksForGlobals_=null;
goog.getCssName=function(a,b){if("."==String(a).charAt(0))throw Error('className passed in goog.getCssName must not start with ".". You passed: '+a);var c=function(a){return goog.cssNameMapping_[a]||a},d=function(a){a=a.split("-");for(var b=[],d=0;d<a.length;d++)b.push(c(a[d]));return b.join("-")},d=goog.cssNameMapping_?"BY_WHOLE"==goog.cssNameMappingStyle_?c:d:function(a){return a},d=b?a+"-"+d(b):d(a);return goog.global.CLOSURE_CSS_NAME_MAP_FN?goog.global.CLOSURE_CSS_NAME_MAP_FN(d):d};
goog.setCssNameMapping=function(a,b){goog.cssNameMapping_=a;goog.cssNameMappingStyle_=b};!COMPILED&&goog.global.CLOSURE_CSS_NAME_MAPPING&&(goog.cssNameMapping_=goog.global.CLOSURE_CSS_NAME_MAPPING);goog.getMsg=function(a,b){b&&(a=a.replace(/\{\$([^}]+)}/g,function(a,d){return null!=b&&d in b?b[d]:a}));return a};goog.getMsgWithFallback=function(a,b){return a};goog.exportSymbol=function(a,b,c){goog.exportPath_(a,b,c)};goog.exportProperty=function(a,b,c){a[b]=c};
goog.inherits=function(a,b){function c(){}c.prototype=b.prototype;a.superClass_=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.base=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};
goog.base=function(a,b,c){var d=arguments.callee.caller;if(goog.STRICT_MODE_COMPATIBLE||goog.DEBUG&&!d)throw Error("arguments.caller not defined.  goog.base() cannot be used with strict mode code. See http://www.ecma-international.org/ecma-262/5.1/#sec-C");if(d.superClass_){for(var e=Array(arguments.length-1),f=1;f<arguments.length;f++)e[f-1]=arguments[f];return d.superClass_.constructor.apply(a,e)}e=Array(arguments.length-2);for(f=2;f<arguments.length;f++)e[f-2]=arguments[f];for(var f=!1,g=a.constructor;g;g=
g.superClass_&&g.superClass_.constructor)if(g.prototype[b]===d)f=!0;else if(f)return g.prototype[b].apply(a,e);if(a[b]===d)return a.constructor.prototype[b].apply(a,e);throw Error("goog.base called from a method of one name to a method of a different name");};goog.scope=function(a){if(goog.isInModuleLoader_())throw Error("goog.scope is not supported within a goog.module.");a.call(goog.global)};COMPILED||(goog.global.COMPILED=COMPILED);
goog.defineClass=function(a,b){var c=b.constructor,d=b.statics;c&&c!=Object.prototype.constructor||(c=function(){throw Error("cannot instantiate an interface (no constructor defined).");});c=goog.defineClass.createSealingConstructor_(c,a);a&&goog.inherits(c,a);delete b.constructor;delete b.statics;goog.defineClass.applyProperties_(c.prototype,b);null!=d&&(d instanceof Function?d(c):goog.defineClass.applyProperties_(c,d));return c};goog.defineClass.SEAL_CLASS_INSTANCES=goog.DEBUG;
goog.defineClass.createSealingConstructor_=function(a,b){if(!goog.defineClass.SEAL_CLASS_INSTANCES)return a;var c=!goog.defineClass.isUnsealable_(b),d=function(){var b=a.apply(this,arguments)||this;b[goog.UID_PROPERTY_]=b[goog.UID_PROPERTY_];this.constructor===d&&c&&Object.seal instanceof Function&&Object.seal(b);return b};return d};goog.defineClass.isUnsealable_=function(a){return a&&a.prototype&&a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]};goog.defineClass.OBJECT_PROTOTYPE_FIELDS_="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");
goog.defineClass.applyProperties_=function(a,b){for(var c in b)Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c]);for(var d=0;d<goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length;d++)c=goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[d],Object.prototype.hasOwnProperty.call(b,c)&&(a[c]=b[c])};goog.tagUnsealableClass=function(a){!COMPILED&&goog.defineClass.SEAL_CLASS_INSTANCES&&(a.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_]=!0)};goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_="goog_defineClass_legacy_unsealable";
goog.createRequiresTranspilation_=function(){function a(a,b){d?c[a]=!0:b()?c[a]=!1:d=c[a]=!0}function b(a){try{return!!eval(a)}catch(f){return!1}}var c={es3:!1},d=!1;a("es5",function(){return b("[1,].length==1")});a("es6",function(){return b('(()=>{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()')});
a("es6-impl",function(){return!0});a("es7",function(){return b("2 ** 2 == 4")});a("es8",function(){return b("async () => 1, true")});return c};var cacc={BaseUtil:{}};cacc.BaseUtil.prefix_="cacc";cacc.BaseUtil.addPrefix=function(a){return cacc.BaseUtil.prefix_+"-"+a};cacc.BaseUtil.idCounter_=0;cacc.BaseUtil.getId=function(){return cacc.BaseUtil.addPrefix("Id-"+cacc.BaseUtil.idCounter_++)};cacc.BaseUtil.toArray=function(a){for(var b=[],c=0;c<a.length;c++)b.push(a[c]);return b};cacc.BaseUtil.EXPERT_MODE=!1;cacc.BaseUtil.toggleExpertMode=function(){cacc.BaseUtil.EXPERT_MODE=!cacc.BaseUtil.EXPERT_MODE};
cacc.BaseUtil.getTextContent=function(a){a=a.textContent;" "!=a&&(a=a.replace(/^\s*/,""));return a};cacc.BaseUtil.getAttribute=function(a,b){return a.getAttribute(b)||a.getAttributeNS("http://www.chemaccess.org/sre-schema",b)};cacc.BaseUtil.classList={};cacc.BaseUtil.classList.add=function(a,b){a.classList&&a.classList.add?a.classList.add(b):a.className?cacc.BaseUtil.classList.isSVG_(a.className)?a.className.baseVal+=" "+b:a.className+=" "+b:a.className=b};
cacc.BaseUtil.classList.remove=function(a,b){a.classList&&a.classList.remove&&a.classList.remove(b);if(a.className){var c=a.className;cacc.BaseUtil.classList.isSVG_(c)?c.baseVal=c.baseVal.replace(" "+b,""):a.className=a.className.replace(" "+b,"")}};cacc.BaseUtil.classList.toggle=function(a,b){a.classList&&a.classList.toggle?a.classList.toggle(b):a.className?cacc.BaseUtil.classList.search_(a.className,b)?cacc.BaseUtil.classList.remove(a,b):cacc.BaseUtil.classList.add(a,b):a.className=b};
cacc.BaseUtil.classList.search_=function(a,b){return-1!==(cacc.BaseUtil.classList.isSVG_(a)?a.baseVal:a).search(b)};cacc.BaseUtil.classList.isSVG_=function(a){return!(!a.baseVal&&""!==a.baseVal)};cacc.BaseUtil.children=function(a){if(a.children)return Array.prototype.slice.call(a.children);var b=[];a=a.childNodes;for(var c=0,d;d=a[c];c++)1===d.nodeType&&b.push(d);return b};cacc.CssUtil={};cacc.CssUtil.documentCmlStyle=function(){document.body&&cacc.CssUtil.addStyle_(document.body,"div.cml { display:none; }",cacc.CssUtil.styleClass.CML)};cacc.CssUtil.toggleTextVisibility=function(a){cacc.BaseUtil.classList.toggle(a,cacc.CssUtil.styleClass.INVISIBLE)};cacc.CssUtil.toggleMonochrome=function(a){cacc.BaseUtil.classList.toggle(a,cacc.CssUtil.styleClass.MONOCHROME)};
cacc.CssUtil.styleClass={CML:cacc.BaseUtil.addPrefix("cml"),BASE:cacc.BaseUtil.addPrefix("base"),HIGHLIGHT:cacc.BaseUtil.addPrefix("color-highlight"),ELEMENTS:cacc.BaseUtil.addPrefix("color-elements"),BACKGROUND:cacc.BaseUtil.addPrefix("color-background"),MONOCHROME:cacc.BaseUtil.addPrefix("text-monochrome"),INVISIBLE:cacc.BaseUtil.addPrefix("text-invisible"),MESSAGE:cacc.BaseUtil.addPrefix("message"),CTRLS:cacc.BaseUtil.addPrefix("controls"),BUTTON:cacc.BaseUtil.addPrefix("button"),ACTIVE:cacc.BaseUtil.addPrefix("active"),
ALMOST:cacc.BaseUtil.addPrefix("almost"),DUMMY:cacc.BaseUtil.addPrefix("dummy"),ELEMENT:"ChemAccess-element"};cacc.CssUtil.colorSchemes_=[{frgd:"#000",bkd:"#fff",active:"#fd6",almost:"#6df"},{frgd:"#fff",bkd:"#000",active:"#fd6",almost:"#6df"},{frgd:"#3C3",bkd:"#000",active:"#fd6",almost:"#6df"},{frgd:"#ee0",bkd:"#00e",active:"#4f4",almost:"#e3e"}];cacc.CssUtil.getScheme_=function(a){return cacc.CssUtil.colorSchemes_[a%cacc.CssUtil.colorSchemes_.length]};
cacc.CssUtil.moleculeStyle=function(a){cacc.CssUtil.svgBaseStyle_(a);cacc.CssUtil.pickScheme(a,0)};cacc.CssUtil.pickScheme=function(a,b){var c=cacc.CssUtil.getScheme_(b);cacc.CssUtil.svgBackgroundStyle_(a,c.bkd);cacc.CssUtil.nodeBackgroundStyle_(a.node,c.bkd);cacc.CssUtil.svgForegroundStyle_(a,c.frgd);cacc.CssUtil.svgHighlightStyle_(a,c.active,c.almost)};cacc.CssUtil.nodeBackgroundStyle_=function(a,b){a.style.backgroundColor=b};
cacc.CssUtil.svgBaseStyle_=function(a){var b="svg."+a.id,c;c=""+(b+" { overflow: hidden; }")+(b+" text { font-size: 16px; font-family: serif; }")+(b+" text tspan[baseline-shift] { font-weight: 200; font-size: 13px; }")+(b+" line, svg rect { stroke-width: 1.0;  stroke-linecap: round; }")+(b+" line."+cacc.CssUtil.styleClass.ACTIVE+", svg g."+cacc.CssUtil.styleClass.ACTIVE+" line { stroke-width: 3.0; }");c+=b+" line."+cacc.CssUtil.styleClass.ALMOST+", svg g."+cacc.CssUtil.styleClass.ALMOST+" line { stroke-width: 2.0; }";
c+=b+" g."+cacc.CssUtil.styleClass.ACTIVE+" text { font-weight: bold; }";c+="ul."+cacc.CssUtil.styleClass.CTRLS+" { list-style-type: none; }";c+="p."+cacc.CssUtil.styleClass.MESSAGE+"."+cacc.CssUtil.styleClass.INVISIBLE+" { font-size: 1px; }";c+=b+" polyline."+cacc.CssUtil.styleClass.ACTIVE+", svg g."+cacc.CssUtil.styleClass.ACTIVE+" polyline { stroke-width: 3.0; }";c+=b+" polyline."+cacc.CssUtil.styleClass.ALMOST+", svg g."+cacc.CssUtil.styleClass.ALMOST+" polyline { stroke-width: 2.0; }";c+=b+" polygon."+
cacc.CssUtil.styleClass.ACTIVE+", svg g."+cacc.CssUtil.styleClass.ACTIVE+" polygon { stroke-width: 3.0; }";c+=b+" polygon."+cacc.CssUtil.styleClass.ALMOST+", svg g."+cacc.CssUtil.styleClass.ALMOST+" polygon { stroke-width: 2.0; }";c+=b+" path."+cacc.CssUtil.styleClass.ACTIVE+", svg g."+cacc.CssUtil.styleClass.ACTIVE+" path { stroke-width: 3.0; }";c+=b+" path."+cacc.CssUtil.styleClass.ALMOST+", svg g."+cacc.CssUtil.styleClass.ALMOST+" path { stroke-width: 2.0; }";c+=b+" rect."+cacc.CssUtil.styleClass.ACTIVE+
", svg g."+cacc.CssUtil.styleClass.ACTIVE+" rect { stroke-width: 3.0; }";c+=b+" rect."+cacc.CssUtil.styleClass.ALMOST+", svg g."+cacc.CssUtil.styleClass.ALMOST+" rect { stroke-width: 2.0; }";c+=b+" circle."+cacc.CssUtil.styleClass.ACTIVE+", svg g."+cacc.CssUtil.styleClass.ACTIVE+" circle { stroke-width: 3.0; }";c+=b+" circle."+cacc.CssUtil.styleClass.ALMOST+", svg g."+cacc.CssUtil.styleClass.ALMOST+" circle { stroke-width: 2.0; }";cacc.CssUtil.addStyle_(a.node,c,cacc.CssUtil.styleClass.BASE)};
cacc.CssUtil.svgHighlightStyle_=function(a,b,c){var d="svg."+a.id,e;e=""+(d+" line."+cacc.CssUtil.styleClass.ACTIVE+", g."+cacc.CssUtil.styleClass.ACTIVE+" line { stroke: "+b+"; }");e+=d+" line."+cacc.CssUtil.styleClass.ALMOST+", g."+cacc.CssUtil.styleClass.ALMOST+" line { stroke: "+c+"; }";e+=d+" g."+cacc.CssUtil.styleClass.ACTIVE+" text { fill: "+b+"; }";e+=d+" g."+cacc.CssUtil.styleClass.ALMOST+" text { fill: "+c+"; }";e+=d+" polyline."+cacc.CssUtil.styleClass.ACTIVE+", g."+cacc.CssUtil.styleClass.ACTIVE+
" polyline { stroke: "+b+"; }";e+=d+" polyline."+cacc.CssUtil.styleClass.ALMOST+", g."+cacc.CssUtil.styleClass.ALMOST+" polyline { stroke: "+c+"; }";e+=d+" polygon."+cacc.CssUtil.styleClass.ACTIVE+", g."+cacc.CssUtil.styleClass.ACTIVE+" polygon { stroke: "+b+"; }";e+=d+" polygon."+cacc.CssUtil.styleClass.ALMOST+", g."+cacc.CssUtil.styleClass.ALMOST+" polygon { stroke: "+c+"; }";e+=d+" path."+cacc.CssUtil.styleClass.ACTIVE+", g."+cacc.CssUtil.styleClass.ACTIVE+" path { stroke: "+b+"; }";e+=d+" path."+
cacc.CssUtil.styleClass.ALMOST+", g."+cacc.CssUtil.styleClass.ALMOST+" path { stroke: "+c+"; }";e+=d+" rect."+cacc.CssUtil.styleClass.ACTIVE+", g."+cacc.CssUtil.styleClass.ACTIVE+" rect { stroke: "+b+"; }";e+=d+" rect."+cacc.CssUtil.styleClass.ALMOST+", g."+cacc.CssUtil.styleClass.ALMOST+" rect { stroke: "+c+"; }";e+=d+" circle."+cacc.CssUtil.styleClass.ACTIVE+", g."+cacc.CssUtil.styleClass.ACTIVE+" circle { stroke: "+b+"; }";e+=d+" circle."+cacc.CssUtil.styleClass.ALMOST+", g."+cacc.CssUtil.styleClass.ALMOST+
" circle { stroke: "+c+"; }";cacc.CssUtil.replaceStyle_(a.node,e,cacc.CssUtil.styleClass.HIGHLIGHT)};
cacc.CssUtil.svgBackgroundStyle_=function(a,b){var c="svg."+a.id,c=""+(c+" { background-color: "+b+"; }")+(c+" g.atom rect { stroke: "+b+"; fill: "+b+"; }")+("div.container { background-color: "+b+"; }")+("p."+a.id+"."+cacc.CssUtil.styleClass.MESSAGE+" { background-color: "+b+"; }"),c=c+("p."+a.id+"."+cacc.CssUtil.styleClass.MESSAGE+"."+cacc.CssUtil.styleClass.INVISIBLE+" { color: "+b+"; }");cacc.CssUtil.replaceStyle_(a.node,c,cacc.CssUtil.styleClass.BACKGROUND)};
cacc.CssUtil.svgForegroundStyle_=function(a,b){var c="svg."+a.id,d;d=""+(c+" line { stroke: "+b+"; fill: "+b+"; }")+(c+"."+cacc.CssUtil.styleClass.MONOCHROME+" text { stroke: "+b+"; fill: "+b+"; }");d+="p."+a.id+"."+cacc.CssUtil.styleClass.MESSAGE+" { color: "+b+"; }";d+="ul."+a.id+"."+cacc.CssUtil.styleClass.CTRLS+" { color: "+b+"; }";cacc.CssUtil.replaceStyle_(a.node,d+(c+" polyline { stroke: "+b+"; fill: "+b+"; }")+(c+" polygon { stroke: "+b+"; fill: "+b+"; }")+(c+" path { stroke: "+b+"; fill: "+
b+"; }")+(c+" rect { stroke: "+b+"; fill: "+b+"; }")+(c+" circle { stroke: "+b+"; fill: "+b+"; }"),cacc.CssUtil.styleClass.ELEMENTS)};cacc.CssUtil.addStyle_=function(a,b,c){var d=document.createElement("style");d.setAttribute("class",c);d.innerHTML=b;a.appendChild(d)};cacc.CssUtil.removeStyle_=function(a,b){var c=a.querySelector("style."+b);return c?(a.removeChild(c),!0):!1};cacc.CssUtil.replaceStyle_=function(a,b,c){cacc.CssUtil.removeStyle_(a,c);cacc.CssUtil.addStyle_(a,b,c)};cacc.EventUtils={};cacc.EventUtils.KeyCodes={RETURN:13,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90};
cacc.EventUtils.EventType={CLICK:"click",DBLCLICK:"dblclick",MOUSEDOWN:"mousedown",MOUSEUP:"mouseup",MOUSEOVER:"mouseover",MOUSEOUT:"mouseout",MOUSEMOVE:"mousemove",SELECTSTART:"selectstart",KEYPRESS:"keypress",KEYDOWN:"keydown",KEYUP:"keyup",TOUCHSTART:"touchstart",TOUCHMOVE:"touchmove",TOUCHEND:"touchend",TOUCHCANCEL:"touchcancel"};cacc.EventUtils.Event=function(a,b,c){this.src=a;this.type=b;this.callback=c};cacc.EventUtils.Event.prototype.add=function(){this.src.addEventListener(this.type,this.callback)};
cacc.EventUtils.Event.prototype.remove=function(){this.src.removeEventListener(this.type,this.callback)};cacc.ExplorerInterface=function(){};cacc.ExplorerInterface.prototype.isActive=function(){};cacc.ExplorerInterface.prototype.activate=function(){};cacc.ExplorerInterface.prototype.deactivate=function(){};cacc.ExplorerInterface.prototype.registerEvent=function(a,b,c){};cacc.ExplorerInterface.prototype.addEvents=function(){};cacc.ExplorerInterface.prototype.removeEvents=function(){};cacc.ExplorerInterface.prototype.setupMessage=function(){};cacc.ExplorerInterface.prototype.addMessage=function(){};
cacc.ExplorerInterface.prototype.removeMessage=function(){};cacc.ExplorerInterface.prototype.updateMessage=function(a){};cacc.ExplorerInterface.prototype.setupControls=function(){};cacc.ExplorerInterface.prototype.addControls=function(){};cacc.ExplorerInterface.prototype.removeControls=function(){};cacc.ExplorerInterface.prototype.getActivationKey=function(){};cacc.AbstractExplorer=function(a){this.explorer=a;this.molecule=a.molecule;this.active_=!1;this.internalEvents_=[];this.message=this.setupMessage();this.activeElement=this.molecule.cmlStructure.getRootElement();this.addMessage();this.setupControls();this.registerMessageToggler_()};cacc.AbstractExplorer.prototype.isActive=function(){return this.active_};cacc.AbstractExplorer.prototype.toggleActive_=function(){this.active_=!this.active_};
cacc.AbstractExplorer.prototype.activate=function(){this.isActive()||(this.updateMessage(this.activeElement.getSpeech()),this.explorer.magnifier.magnifier.update(this.activeElement),this.addControls(),this.addEvents(),this.toggleActive_())};cacc.AbstractExplorer.prototype.deactivate=function(){this.isActive()&&(this.removeEvents(),this.removeControls(),this.removeMessage(),this.explorer.magnifier.viewBox.reset(),this.toggleActive_())};
cacc.AbstractExplorer.prototype.registerEvent=function(a,b,c){this.internalEvents_.push(new cacc.EventUtils.Event(a,b,c))};cacc.AbstractExplorer.prototype.addEvents=function(){for(var a=0,b;b=this.internalEvents_[a];a++)b.add()};cacc.AbstractExplorer.prototype.removeEvents=function(){for(var a=0,b;b=this.internalEvents_[a];a++)b.remove()};
cacc.AbstractExplorer.prototype.setupMessage=function(){var a=this.molecule.createElement("p");a.classList.add("explorer");a.setAttribute("aria-live","assertive");a.setAttribute("tabindex","-1");a.classList.add(cacc.CssUtil.styleClass.MESSAGE);cacc.Base.config.MSG_VISIBLE||a.classList.add(cacc.CssUtil.styleClass.INVISIBLE);return a};cacc.AbstractExplorer.prototype.addMessage=function(){this.molecule.node.parentNode.appendChild(this.message)};
cacc.AbstractExplorer.prototype.removeMessage=function(){this.message.textContent=""};cacc.AbstractExplorer.prototype.updateMessage=function(a){this.message.textContent=a};cacc.AbstractExplorer.prototype.setupControls=function(){};cacc.AbstractExplorer.prototype.addControls=function(){};cacc.AbstractExplorer.prototype.removeControls=function(){};cacc.AbstractExplorer.prototype.getActivationKey=goog.abstractMethod;cacc.AbstractExplorer.prototype.toggleMessageVisibility_=function(){cacc.CssUtil.toggleTextVisibility(this.message)};
cacc.AbstractExplorer.prototype.registerMessageToggler_=function(){this.registerEvent(this.molecule.node,cacc.EventUtils.EventType.KEYDOWN,goog.bind(function(a){a.keyCode===cacc.EventUtils.KeyCodes.S&&this.toggleMessageVisibility_();a.stopPropagation();return!1},this))};cacc.ChemObjInterface=goog.abstractMethod;cacc.ChemObjInterface.prototype.getId=goog.abstractMethod;cacc.ChemObjInterface.prototype.getKey=goog.abstractMethod;cacc.ChemObjInterface.prototype.getAnnotation=goog.abstractMethod;cacc.ChemObjInterface.prototype.getDiagram=goog.abstractMethod;cacc.ChemObjInterface.prototype.setDrawnElement=goog.abstractMethod;cacc.ChemObjInterface.prototype.getDrawnElement=goog.abstractMethod;cacc.ChemObjInterface.prototype.getDrawnElements=goog.abstractMethod;
cacc.ChemObjInterface.prototype.complete=goog.abstractMethod;cacc.ChemObjInterface.prototype.getUp=goog.abstractMethod;cacc.ChemObjInterface.prototype.getDown=goog.abstractMethod;cacc.ChemObjInterface.prototype.getRight=goog.abstractMethod;cacc.ChemObjInterface.prototype.getLeft=goog.abstractMethod;cacc.Cml={};cacc.Cml.ChemObj=function(a,b){this.annotation_=a;this.diagram_=b;this.id_=this.getId_();this.parent_=this.getParent_();this.up=this.drawnElements=this.drawn_=null;this.down=[]};cacc.Cml.ChemObj.prototype.getAnnotation=function(){return this.annotation_};cacc.Cml.ChemObj.prototype.getDiagram=function(){return this.diagram_};cacc.Cml.ChemObj.prototype.getId_=function(){var a=this.getAnnotation().firstElementChild;return a?a.textContent:""};cacc.Cml.ChemObj.prototype.getId=function(){return this.id_};
cacc.Cml.ChemObj.prototype.setDrawnElement=function(a){this.drawn_=a};cacc.Cml.ChemObj.prototype.getDrawnElement=function(){return this.drawn_};cacc.Cml.ChemObj.prototype.getDrawnElements=function(){if(this.drawnElements)return this.drawnElements;this.drawnElements=[];this.drawn_&&this.drawnElements.push(this.drawn_);return this.drawnElements};cacc.Cml.ChemObj.prototype.complete=function(){if(this.parent_){var a=this.getDiagram().get(this.parent_);this.up=a;a.down.push(this)}};
cacc.Cml.ChemObj.prototype.getParent_=function(){var a=this.getAnnotation().querySelector("parents > *");return a?cacc.BaseUtil.getTextContent(a):""};cacc.Cml.ChemObj.prototype.getKey=function(){return this.id_+this.parent_};cacc.Cml.ChemObj.prototype.getUp=function(){return this.up?[this.up]:[]};cacc.Cml.ChemObj.prototype.getDown=function(){return this.down};
cacc.Cml.ChemObj.prototype.getRight=function(){if(!this.up)return[];var a=this.up.getDown(),b=a.indexOf(this);return a.length>b+1?(a=a[b+1],a.position?[a]:[]):[]};cacc.Cml.ChemObj.prototype.getLeft=function(){if(!this.up)return[];var a=this.up.getDown(),b=a.indexOf(this);return 0<b?(a=a[b-1],a.position?[a]:[]):[]};cacc.Cml.Via=function(a,b){this.neighbour_=a;this.annotation_=b;this.type_=cacc.BaseUtil.getAttribute(this.annotation_,"type");var c=cacc.BaseUtil.children(this.annotation_);this.connectedBy_=this.getConnectedBy_(c[0]);this.position_=parseInt(cacc.BaseUtil.getTextContent(c[1]),10)};cacc.Cml.Via.prototype.getDrawnElements=function(){return this.connectedBy_.getDrawnElements()||[]};
cacc.Cml.Via.prototype.getConnectedBy_=function(a){var b=this.neighbour_.from().getDiagram();a=cacc.BaseUtil.getTextContent(a);var c=b.get(a);return c?c:b.get(a+this.neighbour_.from().getId())};cacc.Cml.Via.prototype.getType=function(){return this.type_||""};cacc.Cml.Via.prototype.getPosition=function(){return this.position_};cacc.Cml.Neighbour=function(a,b){this.from_=a;this.annotation_=b;var c=cacc.BaseUtil.children(this.annotation_);this.to_=this.from_.getDiagram().get(cacc.BaseUtil.getTextContent(c[0]));this.via_=c.slice(1).map(goog.bind(function(a){return new cacc.Cml.Via(this,a)},this));this.speech2=this.speech=null};cacc.Cml.Neighbour.prototype.from=function(){return this.from_};cacc.Cml.Neighbour.prototype.to=function(){return this.to_};cacc.Cml.Neighbour.prototype.via=function(){return this.via_};
cacc.Cml.Neighbour.prototype.getSpeech=function(){return this.from_.getDiagram().translate(this.getMessage())};cacc.Cml.Neighbour.prototype.getMessage=function(){return cacc.BaseUtil.EXPERT_MODE&&(this.speech2||(this.speech2=cacc.BaseUtil.getAttribute(this.annotation_,"speech2")))?this.speech2:this.speech?this.speech:this.speech=cacc.BaseUtil.getAttribute(this.annotation_,"speech")};cacc.Cml.NeighbourHood=function(a,b){this.neighbourhood=[];cacc.Cml.ChemObj.call(this,a,b);this.position=this.getPosition_()};goog.inherits(cacc.Cml.NeighbourHood,cacc.Cml.ChemObj);cacc.Cml.NeighbourHood.prototype.complete=function(){cacc.Cml.NeighbourHood.superClass_.complete.call(this);this.down.sort(function(a,b){return a.position-b.position});for(var a=this.getAnnotation().querySelectorAll("neighbours neighbour"),b=0,c;c=a[b];b++)this.neighbourhood.push(new cacc.Cml.Neighbour(this,c))};
cacc.Cml.NeighbourHood.prototype.getSpeech=function(){return this.getDiagram().translate(this.getMessage())};cacc.Cml.NeighbourHood.prototype.getMessage=function(){if(cacc.BaseUtil.EXPERT_MODE){var a=cacc.BaseUtil.getAttribute(this.getAnnotation(),"speech2");if(a)return a}return cacc.BaseUtil.getAttribute(this.getAnnotation(),"speech")};cacc.Cml.NeighbourHood.prototype.getNeighbours=function(){return this.neighbourhood};
cacc.Cml.NeighbourHood.prototype.getPosition_=function(){return parseInt(cacc.BaseUtil.getTextContent(this.getAnnotation().querySelector("position")),10)};cacc.Cml.Atom=function(a,b){cacc.Cml.NeighbourHood.call(this,a,b)};goog.inherits(cacc.Cml.Atom,cacc.Cml.NeighbourHood);cacc.Cml.Atom.prototype.getSpeech=function(){var a=this.neighbourhood.map(function(a){return a.getSpeech()}).join(" "),b=this.getMessage();return this.speech=this.getDiagram().translate(b)+" "+a};
cacc.Cml.Atom.prototype.getDrawnElements=function(){if(this.drawnElements)return this.drawnElements;this.drawnElements=[];var a=this.getDrawnElement();a&&this.drawnElements.push(a);for(var b=this.getAnnotation().querySelectorAll("component *"),c=0;c<b.length;c++)(a=this.getDiagram().get(cacc.BaseUtil.getTextContent(b[c])).getDrawnElement())&&-1===this.drawnElements.indexOf(a)&&this.drawnElements.push(a);return this.drawnElements};cacc.Cml.AtomSet=function(a,b){cacc.Cml.NeighbourHood.call(this,a,b)};goog.inherits(cacc.Cml.AtomSet,cacc.Cml.NeighbourHood);
cacc.Cml.AtomSet.prototype.getDrawnElements=function(){if(this.drawnElements)return this.drawnElements;this.drawnElements=[];var a={},b=function(b){a[b.id]||(a[b.id]=!0,this.drawnElements.push(b))},c=this.getDrawnElement();c&&b(c);for(var d=0;c=this.getDown()[d];d++)c.getDrawnElements().forEach(goog.bind(b,this)),(c=c.getDrawnElement())&&b(c);for(var e=this.getAnnotation().querySelectorAll("component bond,passive"),d=0;d<e.length;d++)c=cacc.BaseUtil.getTextContent(e[d]),c=this.getDiagram().get(c),
c.getDrawnElements().forEach(goog.bind(b,this)),(c=c.getDrawnElement())&&b(c);return this.drawnElements};cacc.Cml.Bond=function(a,b){cacc.Cml.ChemObj.call(this,a,b);this.ends=[]};goog.inherits(cacc.Cml.Bond,cacc.Cml.ChemObj);cacc.Cml.Bond.prototype.complete=function(){for(var a=this.getAnnotation().querySelectorAll("component > atom,active"),b=0,c;c=a[b];b++)(c=this.getDiagram().get(cacc.BaseUtil.getTextContent(c)))&&this.ends.push(c)};cacc.Language=function(a){this.cmlDocument=a;this.language=this.getLanguage();this.messages={};this.insertMessages()};cacc.Language.prototype.getLanguage=function(){var a=this.cmlDocument.querySelector("language");return a?a.textContent:""};cacc.Language.prototype.insertMessages=function(){for(var a=this.cmlDocument.querySelectorAll("message"),b=0,c;c=a[b];b++)this.messages[c.getAttribute("sre:msg")]=c.textContent};cacc.Language.prototype.translate=function(a){return this.messages[a]};cacc.Languages=function(a){this.cmlDocument=a;this.languages={};this.insertLanguages();this.active=this.defaultActive()};cacc.Languages.prototype.insertLanguages=function(){for(var a=this.cmlDocument.querySelectorAll("messages"),b=0,c;c=a[b];b++){var d=c.querySelector("language");d&&(this.languages[d.textContent]=new cacc.Language(c))}};cacc.Languages.prototype.defaultActive=function(){return this.languages.en?"en":Object.keys(this.languages)[0]};cacc.Languages.prototype.translate=function(a){return this.languages[this.active].translate(a)};
cacc.Languages.createLanguages=function(a){return 0===a.querySelectorAll("messages").length?null:new cacc.Languages(a)};cacc.Languages.prototype.nextLanguage=function(){var a=Object.keys(this.languages),b=a.indexOf(this.active)+1;this.active=a.length>b?a[b]:a[0]};cacc.Diagram=function(a){this.diagram_={};this.languages_=a};cacc.Diagram.prototype.set=function(a,b){this.diagram_[a]=b};cacc.Diagram.prototype.get=function(a){return this.diagram_[a]};cacc.Diagram.prototype.forEach=function(a){for(var b in this.diagram_)a.call(this,this.diagram_[b])};cacc.Diagram.prototype.find=function(a){for(var b in this.diagram_){var c=this.diagram_[b];if(a.call(this,c))return c}return null};
cacc.Diagram.prototype.translate=function(a){return this.languages_?this.languages_.translate(a):a};cacc.Diagram.prototype.nextLanguage=function(){if(!this.languages_)return null;this.languages_.nextLanguage();return this.languages_.active};cacc.Cml.CML=function(a){this.cmlDocument=a;this.map=new cacc.Diagram(cacc.Languages.createLanguages(a));this.root=null;this.initMap_()};
cacc.Cml.CML.prototype.initMap_=function(){for(var a=this.cmlDocument.querySelectorAll("annotations > annotation"),b=0,c;c=a[b];b++){var d=c.firstElementChild;if(d)switch(d.localName.toLowerCase()){case "atom":case "active":c=new cacc.Cml.Atom(c,this.map);this.map.set(c.getKey(),c);break;case "bond":case "passive":c=new cacc.Cml.Bond(c,this.map);this.map.set(c.getId(),c);break;case "atomset":case "grouped":c=new cacc.Cml.AtomSet(c,this.map),this.map.set(c.getId(),c)}}this.map.forEach(goog.bind(function(a){a.complete()},
c))};cacc.Cml.CML.prototype.getMap=function(){return this.map};cacc.Cml.CML.prototype.getRootElement=function(){return this.root?this.root:this.root=this.map.find(function(a){return!(a instanceof cacc.Cml.Bond)&&!a.up})};cacc.Molecule=function(a,b,c){this.id=cacc.BaseUtil.getId();this.node=a;this.svg=b;cacc.BaseUtil.classList.add(this.svg,this.id);this.cml=c;cacc.BaseUtil.classList.add(this.cml,this.id);this.cmlStructure=new cacc.Cml.CML(this.cml);this.topLevelDescription=this.cmlStructure.getRootElement().getSpeech();this.combine_()};cacc.Molecule.prototype.combine_=function(){this.cmlStructure.getMap().forEach(goog.bind(function(a){var b=this.svg.getElementById(a.getId());b&&a.setDrawnElement(b)},this))};
cacc.Molecule.prototype.createElement=function(a){a=document.createElement(a);a.classList.add(this.id);return a};cacc.MenuExplorer=function(a){this.control_=null;cacc.AbstractExplorer.call(this,a)};goog.inherits(cacc.MenuExplorer,cacc.AbstractExplorer);
cacc.MenuExplorer.prototype.setupControls=function(){var a=this.molecule.createElement("ul");a.classList.add(cacc.CssUtil.styleClass.CTRLS);a.setAttribute("role","navigation");this.control_=a;var b=goog.bind(function(a,b){var c=b();0<c.length&&(this.activeElement=c[0],this.updateMessage(this.activeElement.getSpeech()),this.explorer.magnifier.magnifier.update(this.activeElement))},this),c=goog.bind(function(a,c){this.registerEvent(a,cacc.EventUtils.EventType.KEYDOWN,function(a){if(a.keyCode===cacc.EventUtils.KeyCodes.ENTER||
a.keyCode===cacc.EventUtils.KeyCodes.SPACE)b(a,c),a.preventDefault(),a.stopPropagation();return!1});this.registerEvent(a,cacc.EventUtils.EventType.CLICK,function(a){b(a,c);a.stopPropagation();return!1})},this),d=this.makeButton_("Down",a);c(d,goog.bind(function(){return this.activeElement.getDown()},this));d=this.makeButton_("Up",a);c(d,goog.bind(function(){return this.activeElement.getUp()},this));d=this.makeButton_("Right",a);c(d,goog.bind(function(){return this.activeElement.getRight()},this));
a=this.makeButton_("Left",a);c(a,goog.bind(function(){return this.activeElement.getLeft()},this))};cacc.MenuExplorer.prototype.makeButton_=function(a,b){var c=this.molecule.createElement("li");c.setAttribute("role","button");c.setAttribute("aria-controls",this.message.getAttribute("id"));c.classList.add(cacc.CssUtil.styleClass.BUTTON);c.setAttribute("tabindex","0");c.setAttribute("title",a);c.appendChild(document.createTextNode(a));b.appendChild(c);return c};
cacc.MenuExplorer.prototype.addControls=function(){var a=this.molecule.node.querySelector("."+cacc.CssUtil.styleClass.MESSAGE);a?this.molecule.node.insertBefore(this.control_,a):this.molecule.node.appendChild(this.control_)};cacc.MenuExplorer.prototype.removeControls=function(){this.explorer.magnifier.magnifier.viewBox.clearActive();this.control_.parentNode.removeChild(this.control_)};cacc.MenuExplorer.prototype.getActivationKey=function(){return cacc.EventUtils.KeyCodes.B};cacc.KeyExplorer=function(a){cacc.AbstractExplorer.call(this,a)};goog.inherits(cacc.KeyExplorer,cacc.AbstractExplorer);
cacc.KeyExplorer.prototype.setupControls=function(){var a=goog.bind(function(a,c){var b=c();0<b.length&&(this.activeElement=b[0],this.updateMessage(this.activeElement.getSpeech()),this.explorer.magnifier.magnifier.update(this.activeElement));a.preventDefault()},this);this.registerEvent(this.molecule.node,cacc.EventUtils.EventType.KEYDOWN,goog.bind(function(b){switch(b.keyCode){case cacc.EventUtils.KeyCodes.DOWN:case cacc.EventUtils.KeyCodes.D:a(b,goog.bind(function(){return this.activeElement.getDown()},
this));break;case cacc.EventUtils.KeyCodes.UP:case cacc.EventUtils.KeyCodes.E:a(b,goog.bind(function(){return this.activeElement.getUp()},this));break;case cacc.EventUtils.KeyCodes.RIGHT:case cacc.EventUtils.KeyCodes.F:a(b,goog.bind(function(){return this.activeElement.getRight()},this));break;case cacc.EventUtils.KeyCodes.LEFT:case cacc.EventUtils.KeyCodes.S:a(b,goog.bind(function(){return this.activeElement.getLeft()},this))}b.stopPropagation();return!1},this))};
cacc.KeyExplorer.prototype.removeControls=function(){this.explorer.magnifier.magnifier.viewBox.clearActive()};cacc.KeyExplorer.prototype.getActivationKey=function(){return cacc.EventUtils.KeyCodes.A};cacc.Bbox=function(a,b,c,d){this.x=a;this.y=b;this.width=c;this.height=d};cacc.Bbox.fromSvgRect=function(a){return new cacc.Bbox(a.x,a.y,a.width,a.height)};cacc.Bbox.fromSvgViewBox=function(a){return new cacc.Bbox(a.baseVal.x,a.baseVal.y,a.baseVal.width,a.baseVal.height)};cacc.Bbox.prototype.add=function(a){return new cacc.Bbox(this.x+a.x,this.y+a.y,this.width+a.width,this.height+a.height)};
cacc.Bbox.prototype.difference=function(a,b,c){a=this.add(a.scale(-1));b&&(a.x-=b/2,a.width+=b);c&&(a.y-=c/2,a.height+=c);return a};cacc.Bbox.prototype.scale=function(a){return new cacc.Bbox(this.x*a,this.y*a,this.width*a,this.height*a)};cacc.Bbox.prototype.combine=function(a){var b=Math.min(this.x,a.x),c=Math.min(this.y,a.y);return new cacc.Bbox(b,c,Math.max(this.x+this.width,a.x+a.width)-b,Math.max(this.y+this.height,a.y+a.height)-c)};
cacc.Bbox.combineBboxes=function(a){var b=function(a){var b=a.getBBox();if(0===b.x&&0===b.y&&0===b.width&&0===b.height&&a.childNodes&&a.childNodes[0]&&a.childNodes[0].transform){var c=a.childNodes[0],d,h,l,k;c.x&&c.y&&c.width&&c.height?(d=c.x.baseVal.value,h=c.y.baseVal.value,l=c.width.baseVal.value,k=c.height.baseVal.value):(k=c.getBBox(),d=k.baseVal.x,h=k.baseVal.y,l=k.baseVal.width,k=k.baseVal.height);a=a.ownerSVGElement.createSVGPoint();c=c.transform.baseVal;a.x=d;a.y=h;for(d=c.length-1;0<=d;d--)a=
a.matrixTransform(c.getItem(d).matrix);b.x=a.x;b.y=a.y;b.width=l;b.height=k}return b},c=cacc.Bbox.fromSvgRect(b(a[0]));return 1===a.length?c:a.slice(1).reduce(function(a,c){return a.combine(b(c))},c)};cacc.Bbox.prototype.viewBoxValue=function(){return this.x+" "+this.y+" "+this.width+" "+this.height};cacc.ViewBox=function(a){this.svg=a;this.focusgroups={};this.defaultZoomOptions={xPad:this.svg.width.baseVal.value/5,yPad:this.svg.height.baseVal.value/5,duration:100,delay:10,wait:0,callback:function(){}};this.reset()};cacc.ViewBox.prototype.reset=function(){cacc.BaseUtil.toArray(this.svg.getElementsByTagName("*"));this.setViewBox_(cacc.Bbox.fromSvgRect(this.svg.getBBox()))};cacc.ViewBox.prototype.setClass=function(a,b){for(var c=0;c<a.length;c++)cacc.BaseUtil.classList.add(a[c],b)};
cacc.ViewBox.prototype.clearClass=function(a,b){for(var c=0;c<a.length;c++)cacc.BaseUtil.classList.remove(a[c],b)};cacc.ViewBox.prototype.clearActive=function(){for(var a in this.focusgroups)this.clearClass(this.focusgroups[a],a),delete this.focusgroups.key};cacc.ViewBox.prototype.select=function(a,b){var c=b||cacc.CssUtil.styleClass.ACTIVE,d=this.focusgroups[c];d&&this.clearClass(d,c);this.setClass(a,c);this.focusgroups[c]=a};
cacc.ViewBox.prototype.zoom=function(a,b){var c=this.focusgroups[a];c&&0!==c.length&&this.setViewBox_(cacc.Bbox.combineBboxes(c),b)};
cacc.ViewBox.prototype.setViewBox_=function(a,b){for(var c=this.completeZoomOptions_(b),d=this.retrieveViewBox_(),e=a.difference(d,c.xPad,c.yPad),f=Math.ceil(c.duration/c.delay),g=e.scale(1/f),e=goog.bind(function(a){return goog.bind(function(){this.svg.setAttribute("viewBox",d.add(g.scale(a)).viewBoxValue())},this)},this),h=1;h<=f;h++)setTimeout(e(h),h*c.delay);c.callback&&setTimeout(c.callback,c.wait+c.duration)};
cacc.ViewBox.prototype.completeZoomOptions_=function(a){if(!a)return this.defaultZoomOptions;for(var b in this.defaultZoomOptions)a[b]||(a[b]=this.defaultZoomOptions[b]);return a};cacc.ViewBox.prototype.retrieveViewBox_=function(){try{return cacc.Bbox.fromSvgViewBox(this.svg.viewBox)}catch(a){return new cacc.Bbox(0,0,0,0)}};cacc.MagnifierInterface=function(){};cacc.MagnifierInterface.prototype.isActive=function(){};cacc.MagnifierInterface.prototype.toggle=function(){};cacc.MagnifierInterface.prototype.registerEvent=function(a,b,c){};cacc.MagnifierInterface.prototype.addEvents=function(){};cacc.MagnifierInterface.prototype.removeEvents=function(){};cacc.MagnifierInterface.prototype.setupControls=function(){};cacc.MagnifierInterface.prototype.addControls=function(){};cacc.MagnifierInterface.prototype.removeControls=function(){};
cacc.MagnifierInterface.prototype.getActivationKey=function(){};cacc.MagnifierInterface.prototype.update=function(a){};cacc.AbstractMagnifier=function(a){this.magnifier=a;this.viewBox=this.magnifier.viewBox;this.active_=!1;this.internalEvents_=[];this.activeElement=null;this.setupControls()};cacc.AbstractMagnifier.prototype.isActive=function(){return this.active_};cacc.AbstractMagnifier.prototype.toggle=function(){this.isActive()?this.deactivate_():this.activate_();return this.isActive()};cacc.AbstractMagnifier.prototype.activate_=function(){this.active_=!0;this.addControls();this.addEvents();this.viewBox.zoom(cacc.CssUtil.styleClass.ACTIVE)};
cacc.AbstractMagnifier.prototype.deactivate_=function(){this.removeEvents();this.removeControls();this.viewBox.reset();this.active_=!1};cacc.AbstractMagnifier.prototype.registerEvent=function(a,b,c){this.internalEvents_.push(new cacc.EventUtils.Event(a,b,c))};cacc.AbstractMagnifier.prototype.addEvents=function(){for(var a=0,b;b=this.internalEvents_[a];a++)b.add()};cacc.AbstractMagnifier.prototype.removeEvents=function(){for(var a=0,b;b=this.internalEvents_[a];a++)b.remove()};
cacc.AbstractMagnifier.prototype.setupControls=function(){};cacc.AbstractMagnifier.prototype.addControls=function(){};cacc.AbstractMagnifier.prototype.removeControls=function(){};cacc.AbstractMagnifier.prototype.update=function(a){this.activeElement=a;this.viewBox.select(this.activeElement.getDrawnElements())};cacc.AbstractMagnifier.prototype.getActivationKey=goog.abstractMethod;cacc.DummyMagnifier=function(a){cacc.AbstractMagnifier.call(this,a)};goog.inherits(cacc.DummyMagnifier,cacc.AbstractMagnifier);cacc.SimpleMagnifier=function(a){cacc.AbstractMagnifier.call(this,a)};goog.inherits(cacc.SimpleMagnifier,cacc.AbstractMagnifier);cacc.SimpleMagnifier.prototype.update=function(a){this.activeElement=a;this.viewBox.select(this.activeElement.getDrawnElements());this.viewBox.zoom(cacc.CssUtil.styleClass.ACTIVE)};
cacc.SimpleMagnifier.prototype.timedUpdate=function(a){this.activeElement&&this.viewBox.select(a.getDrawnElements(),cacc.CssUtil.styleClass.ALMOST);setTimeout(goog.bind(function(){this.activeElement=a;this.viewBox.select([],cacc.CssUtil.styleClass.ALMOST);this.viewBox.select(this.activeElement.getDrawnElements(),cacc.CssUtil.styleClass.ACTIVE)},this),2E3)};cacc.SimpleMagnifier.prototype.getActivationKey=function(){return cacc.EventUtils.KeyCodes.M};cacc.StepMagnifier=function(a){cacc.AbstractMagnifier.call(this,a)};goog.inherits(cacc.StepMagnifier,cacc.AbstractMagnifier);
cacc.StepMagnifier.prototype.update=function(a){var b=this.activeElement?this.activeElement.getDrawnElements():[];this.viewBox.select(a.getDrawnElements(),cacc.CssUtil.styleClass.ALMOST);this.viewBox.select(a.getDrawnElements().concat(b),cacc.CssUtil.styleClass.DUMMY);this.activeElement=a;this.viewBox.zoom(cacc.CssUtil.styleClass.DUMMY,{duration:250,delay:25,wait:300,callback:goog.bind(function(){this.viewBox.select([],cacc.CssUtil.styleClass.ALMOST);this.viewBox.select(this.activeElement.getDrawnElements(),
cacc.CssUtil.styleClass.ACTIVE);this.viewBox.zoom(cacc.CssUtil.styleClass.ACTIVE,{duration:250,delay:25})},this)})};cacc.StepMagnifier.prototype.getActivationKey=function(){return cacc.EventUtils.KeyCodes.N};cacc.Magnifier=function(a){this.explorer=a;this.viewBox=new cacc.ViewBox(this.explorer.molecule.svg);this.magnifier=this.dummy_=new cacc.DummyMagnifier(this);this.magnifierPool_=[cacc.SimpleMagnifier,cacc.StepMagnifier].map(goog.bind(function(a){return new a(this)},this));cacc.Base.config.MAG_ACTIVE&&(this.magnifier=this.magnifierPool_[1],this.magnifier.toggle());this.addMagnifierActivation()};
cacc.Magnifier.prototype.addMagnifierActivation=function(){for(var a=this.magnifierPool_.map(goog.bind(function(a){return goog.bind(function(b){b.keyCode===a.getActivationKey()&&(this.magnifier!==a&&this.magnifier.toggle(),this.magnifier=a.toggle()?a:this.dummy_);b.stopPropagation();return!1},this)},this)),b=0,c;c=this.explorer.explorerPool[b];b++)a.forEach(goog.bind(function(a){c.registerEvent(this.explorer.molecule.node,cacc.EventUtils.EventType.KEYDOWN,a)},this))};cacc.Explorer=function(a){this.molecule=a;this.explorerPool=[cacc.KeyExplorer,cacc.MenuExplorer].map(goog.bind(function(a){return new a(this)},this));this.explorer_=null;this.magnifier=new cacc.Magnifier(this);this.scheme=0;this.addExplorerActivation();this.addColourControls()};
cacc.Explorer.prototype.addExplorerActivation=function(){(new cacc.EventUtils.Event(this.molecule.node,cacc.EventUtils.EventType.KEYDOWN,goog.bind(function(a){this.explorer_&&a.keyCode===cacc.EventUtils.KeyCodes.ESC&&(this.explorer_.deactivate(),this.explorer_=null);if(!this.explorer_)for(var b=0,c;c=this.explorerPool[b];b++)if(a.keyCode===c.getActivationKey()){c.activate();this.explorer_=c;a.preventDefault();break}a.stopPropagation();return!1},this))).add()};
cacc.Explorer.prototype.addColourControls=function(){for(var a=0,b;b=this.explorerPool[a];a++)b.registerEvent(this.molecule.node,cacc.EventUtils.EventType.KEYDOWN,goog.bind(function(a){switch(a.keyCode){case cacc.EventUtils.KeyCodes.T:cacc.CssUtil.toggleMonochrome(this.molecule.svg);break;case cacc.EventUtils.KeyCodes.C:cacc.CssUtil.pickScheme(this.molecule,++this.scheme);break;case cacc.EventUtils.KeyCodes.X:cacc.BaseUtil.toggleExpertMode();this.explorer_&&this.explorer_.updateMessage(this.explorer_.activeElement.getSpeech());
break;case cacc.EventUtils.KeyCodes.L:this.molecule.cmlStructure.getMap().nextLanguage()&&this.explorer_&&this.explorer_.updateMessage(this.explorer_.activeElement.getSpeech())}a.stopPropagation();return!1},this))};cacc.SvgUtil={};cacc.SvgUtil.rewriteTransformations=function(a){a=cacc.BaseUtil.toArray(a.querySelectorAll("text,polyline,line,rect,polygon,use"));cacc.SvgUtil.transformNodes(a);return a};cacc.SvgUtil.transformNode=function(a){var b=a,c=[];do{var d=b.getAttribute("transform");d&&c.unshift(d);b=b.parentNode}while("svg"!==b.tagName);a.setAttribute("transform",c.join(" "));return a};
cacc.SvgUtil.envelopNode=function(a){var b=document.createElementNS("http://www.w3.org/2000/svg","g"),c=a.getAttribute("id");c&&(b.setAttribute("id",c),a.removeAttribute("id"));a.parentNode.replaceChild(b,a);b.appendChild(a);return b};cacc.SvgUtil.purgeTransforms=function(a){do a=a.parentNode,a.removeAttribute("transform");while("svg"!==a.tagName)};cacc.SvgUtil.transformNodes=function(a){a.forEach(cacc.SvgUtil.transformNode);a.forEach(cacc.SvgUtil.purgeTransforms);a.filter(function(a){return a.hasAttribute("id")}).forEach(cacc.SvgUtil.envelopNode)};cacc.RetrievalUtil={};cacc.RetrievalUtil.forDocument=function(a){a=(a||document).querySelectorAll("div."+cacc.CssUtil.styleClass.ELEMENT);for(var b={},c=0,d;d=a[c];c++)cacc.RetrievalUtil.getMol_(d),d.id||(d.id=cacc.CssUtil.styleClass.ELEMENT+c),b[d.id]=d;return b};
cacc.RetrievalUtil.getMol_=function(a){a.querySelector("div.svg")?(a.setAttribute("has-svg","true"),cacc.SvgUtil.rewriteTransformations(a.querySelector("div.svg > svg"))):cacc.RetrievalUtil.getData_(a,"svg","data-src",".svg");a.querySelector("div.cml")?a.setAttribute("has-cml","true"):cacc.RetrievalUtil.getData_(a,"cml","data-cml",".xml")};
cacc.RetrievalUtil.getData_=function(a,b,c,d){(c=a.getAttribute(c)||cacc.RetrievalUtil.getParam_(a,c,d))?cacc.RetrievalUtil.fromUri_(c,function(c){if(c){a.setAttribute("has-"+b,"true");var d=document.createElement("div");d.classList.add(b);d.setAttribute("aria-hidden","true");"svg"===b&&cacc.SvgUtil.rewriteTransformations(c);d.appendChild(c.documentElement);a.appendChild(d)}else a.setAttribute("has-"+b,"false")}):a.setAttribute("has-"+b,"false")};
cacc.RetrievalUtil.getParam_=function(a,b,c){if(!a.id)return null;var d=cacc.RetrievalUtil.getUrlParameters_()[a.id];if(!d)return null;d+=c;a.setAttribute(b,d);return d};cacc.RetrievalUtil.getUrlParameters_=function(){for(var a={},b,c=window.location.href.slice(window.location.href.indexOf("?")+1).split("&"),d=0;d<c.length;d++)b=c[d].split("="),a[b[0]]=b[1];return a};cacc.RetrievalUtil.fromUri_=function(a,b){"file:"===location.protocol?b(null):$.ajax({url:a,success:b})};cacc.Base=function(){this.version="0.1";this.molMap=cacc.RetrievalUtil.forDocument();this.explorerMap={}};goog.addSingletonGetter(cacc.Base);cacc.Base.prototype.init=function(){0<Object.keys(this.molMap).length&&cacc.CssUtil.documentCmlStyle();for(var a in this.molMap)this.initElement(a,this.molMap[a])};
cacc.Base.prototype.initElement=function(a,b){b.hasAttribute("has-svg")&&b.hasAttribute("has-cml")||this.redoInitElement_(a,b);if("true"===b.getAttribute("has-svg")&&"true"===b.getAttribute("has-cml")){b.setAttribute("tabindex","0");b.setAttribute("role","application");var c=b.querySelector("div.svg").children[0],d=b.querySelector("div.cml").children[0];c&&d&&(c.setAttribute("aria-hidden","true"),d.setAttribute("aria-hidden","true"),c=new cacc.Molecule(b,c,d),this.explorerMap[a]=new cacc.Explorer(c),
cacc.CssUtil.moleculeStyle(c))}};cacc.Base.prototype.redoInitElement_=function(a,b){var c=goog.bind(function(){this.initElement(a,b)},this);setTimeout(c,500)};cacc.Base.config={MSG_VISIBLE:!0,MAG_ACTIVE:!0};
