From de75086b611832d28d278b5c3d2139ecdf0bd20b Mon Sep 17 00:00:00 2001 From: cheminfo bot Date: Thu, 14 Feb 2019 21:38:08 +0000 Subject: [PATCH] Release v0.2.0 --- dist/nmr-auto-assignment.js | 20511 +++++++++++++++--------------- dist/nmr-auto-assignment.js.map | 1 + package-lock.json | 9869 ++++++++++++++ package.json | 14 +- 4 files changed, 19988 insertions(+), 10407 deletions(-) create mode 100644 dist/nmr-auto-assignment.js.map create mode 100644 package-lock.json diff --git a/dist/nmr-auto-assignment.js b/dist/nmr-auto-assignment.js index f04fcf8..b68c5b7 100644 --- a/dist/nmr-auto-assignment.js +++ b/dist/nmr-auto-assignment.js @@ -1,3 +1,9 @@ +/** + * nmr-auto-assignment - Automatic assignment for Nuclear Magnetic Resonance spectra for small molecules + * @version v0.1.4 + * @link https://github.com/cheminfo-js/nmr-auto-assignment + * @license MIT + */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -7,10590 +13,10295 @@ exports["nmrAutoAssignment"] = factory(); else root["nmrAutoAssignment"] = factory(); -})(this, function() { +})(typeof self !== 'undefined' ? self : this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; - +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { - +/******/ /******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) +/******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; - +/******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} /******/ }; - +/******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - +/******/ /******/ // Flag the module as loaded -/******/ module.loaded = true; - +/******/ module.l = true; +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } - - +/******/ +/******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; - +/******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; - +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; - +/******/ +/******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(0); +/******/ return __webpack_require__(__webpack_require__.s = 13); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * Created by acastillo on 7/5/16. - */ - const SpinSystem = __webpack_require__(1); - const AutoAssigner = __webpack_require__(2); - const OCLE = __webpack_require__(4); - const DEBUG = false; - - function autoAssign(entry, options) { - if(entry.spectra.h1PeakList){ - return assignmentFromPeakPicking(entry, options); - } - else{ - return assignmentFromRaw(entry, options); - } - } - - function assignmentFromRaw(entry, options) { - //TODO Implement this method - /*var molfile = entry.molfile; - var spectra = entry.spectra; - - var molecule = OCLE.Molecule.fromMolfile(molfile); - - molecule.addImplicitHydrogens(); - - entry.molecule = molecule; - entry.diaIDs = molecule.getGroupedDiastereotopicAtomIDs(); - - //Simulate and process the 1H-NMR spectrum at 400MHz - var jcampFile = molFiles[i].replace("mol_","h1_").replace(".mol",".jdx"); - var spectraData1H = SD.load(spectra.h1);// - - - var signals = spectraData1H.nmrPeakDetection({nStddev:3, baselineRejoin:5, compute:false}); - spectra.solvent = spectraData1H.getParamString(".SOLVENT NAME", "unknown"); - entry.diaID = molecule.toIDCode(); - - signals = integration(signals, molecule.countAtom("H")); - - for(var j=0;j< signals.length;j++){ - signals[j]._highlight=[-(j+1)]; - } - - spectra.h1PeakList = signals; - - return assignmentFromPeakPicking(entry,options); - */ - } - - function assignmentFromPeakPicking(entry, options) { - const predictor = options.predictor; - var molecule, diaIDs, molfile; - - var spectra = entry.spectra; - if(!entry.molecule) { - molecule = OCLE.Molecule.fromMolfile(entry.molfile); - molecule.addImplicitHydrogens(); - diaIDs=molecule.getGroupedDiastereotopicAtomIDs(); - - for (var j = 0; j < diaIDs.length; j++) { - diaIDs[j].nbEquivalent=diaIDs[j].atoms.length; - } - - diaIDs.sort(function(a,b) { - if (a.atomLabel == b.atomLabel) { - return b.nbEquivalent-a.nbEquivalent; - } - return a.atomLabel 0) { + // Create an empty matrix + super(nRows); + + if (Number.isInteger(nColumns) && nColumns > 0) { + for (i = 0; i < nRows; i++) { + this[i] = new Array(nColumns); + } + } else { + throw new TypeError('nColumns must be a positive integer'); + } + } else if (Array.isArray(nRows)) { + // Copy the values from the 2D array + const matrix = nRows; + nRows = matrix.length; + nColumns = matrix[0].length; + + if (typeof nColumns !== 'number' || nColumns === 0) { + throw new TypeError('Data must be a 2D array with at least one element'); + } + + super(nRows); + + for (i = 0; i < nRows; i++) { + if (matrix[i].length !== nColumns) { + throw new RangeError('Inconsistent array dimensions'); + } + + this[i] = [].concat(matrix[i]); + } + } else { + throw new TypeError('First argument must be a positive number or an array'); + } + + this.rows = nRows; + this.columns = nColumns; + return this; + } + + set(rowIndex, columnIndex, value) { + this[rowIndex][columnIndex] = value; + return this; + } + + get(rowIndex, columnIndex) { + return this[rowIndex][columnIndex]; + } + /** + * Creates an exact and independent copy of the matrix + * @return {Matrix} + */ + + + clone() { + var newMatrix = new this.constructor[Symbol.species](this.rows, this.columns); + + for (var row = 0; row < this.rows; row++) { + for (var column = 0; column < this.columns; column++) { + newMatrix.set(row, column, this.get(row, column)); + } + } + + return newMatrix; + } + /** + * Removes a row from the given index + * @param {number} index - Row index + * @return {Matrix} this + */ + + + removeRow(index) { + util.checkRowIndex(this, index); + + if (this.rows === 1) { + throw new RangeError('A matrix cannot have less than one row'); + } + + this.splice(index, 1); + this.rows -= 1; + return this; + } + /** + * Adds a row at the given index + * @param {number} [index = this.rows] - Row index + * @param {Array|Matrix} array - Array or vector + * @return {Matrix} this + */ + + + addRow(index, array) { + if (array === undefined) { + array = index; + index = this.rows; + } + + util.checkRowIndex(this, index, true); + array = util.checkRowVector(this, array, true); + this.splice(index, 0, array); + this.rows += 1; + return this; + } + /** + * Removes a column from the given index + * @param {number} index - Column index + * @return {Matrix} this + */ + + + removeColumn(index) { + util.checkColumnIndex(this, index); + + if (this.columns === 1) { + throw new RangeError('A matrix cannot have less than one column'); + } + + for (var i = 0; i < this.rows; i++) { + this[i].splice(index, 1); + } + + this.columns -= 1; + return this; + } + /** + * Adds a column at the given index + * @param {number} [index = this.columns] - Column index + * @param {Array|Matrix} array - Array or vector + * @return {Matrix} this + */ + + + addColumn(index, array) { + if (typeof array === 'undefined') { + array = index; + index = this.columns; + } + + util.checkColumnIndex(this, index, true); + array = util.checkColumnVector(this, array); + + for (var i = 0; i < this.rows; i++) { + this[i].splice(index, 0, array[i]); + } + + this.columns += 1; + return this; + } + +} + +exports.Matrix = Matrix; +Matrix.abstractMatrix = abstractMatrix; + +/***/ }), /* 1 */ -/***/ function(module, exports) { - - /** - * Created by acastillo on 9/2/16. - */ - 'use strict' - const DEBUG = false; - class SpinSystem { - constructor(diaIDsArray, signalsArray, opt){ - var options = Object.assign({}, opt); - this.diaIDsArray = diaIDsArray; - this.signalsArray = signalsArray; - this.cosy = options.cosySignals || null; - this.connCosy = options.cosyPaths || null; - this.connHmbc = options.hmbcPaths || null; - this.hmbc = options.hmbcSignals || null; - this.init(); - } - - init(){ - const nDiaIds = this.diaIDsArray.length; - const nSignals = this.signalsArray.length; - const diaIDByAtomLabel = {}; - const indexByAtomLabel = {}; - var shiftsH = []; - var shiftsC = []; - var windowH = []; - var windowC = []; - - var signals1D = this.signalsArray; - var nH = 0, nC = 0, i = 0; - try { - this.chemicalShiftsT = new Array(nDiaIds); - this.chemicalShiftsTError = new Array(nDiaIds); - this.diaList = new Array(nDiaIds); - var dia = null; - for(i = 0; i < nDiaIds; i++) { - dia = this.diaIDsArray[i]; - if(diaIDByAtomLabel[dia.atomLabel]) { - diaIDByAtomLabel[dia.atomLabel].push(dia.diaIDs[0]); - indexByAtomLabel[dia.atomLabel].push(i); - } - else { - diaIDByAtomLabel[dia.atomLabel] = [dia.diaIDs[0]]; - indexByAtomLabel[dia.atomLabel] = [i]; - } - this.diaList[i] = dia.integral; - this.chemicalShiftsT[i] = dia.delta; - this.chemicalShiftsTError[i] = dia.error || 0; - } - // We can't have more signals than different protons in the molecule if the integral - // matches the nH - this.signals = new Array(nSignals); - this.chemicalShiftsE = new Array(nSignals); - this.signalsWidth = new Array(nSignals); - - for(i = 0; i < nSignals; i++) { - var from = signals1D[i].from; - var to = signals1D[i].to; - this.chemicalShiftsE[i] = (from+to)/2.0; - this.signals[i] = Math.round(signals1D[i].integral); - shiftsH.push((from+to)/2.0); - windowH.push(Math.abs(from-to)); - this.signalsWidth[i] = Math.abs(from-to); - } - - //System.out.println(diaIDsH.size()); - //var row,col; - - /*if(cosy.length()>0&&connCosy.length()>0){ - cosyT = new byte[nH][nH]; - //To parse the theoretical COSY - for(int i=connCosy.length()-1;i>=0;i--){ - JSONObject pair = (JSONObject) connCosy.get(i); - row=diaIDsH.indexOf(pair.getString("diaID1")); - col=diaIDsH.indexOf(pair.getString("diaID2")); - if(row>=0&&col>=0){ - cosyT[row][col]=(byte)4; - if(pair.getInt("distance")==4) - cosyT[row][col]=(byte)2; - } - } - cosyE = new byte[nSignals][nSignals]; - double resolutionX = Double.MAX_VALUE/6;//((JSONObject)hmbc.get(0)).getDouble("resolutionX"); - if(((JSONObject)cosy.get(0)).has("resolutionX")) - resolutionX = ((JSONObject)cosy.get(0)).getDouble("resolutionX"); - - for(int i=cosy.length()-1;i>=0;i--){ - double x = 0,y=0; - //JSONObject crossPeak = null; - if(cosy.get(i) instanceof JSONObject){ - x=((JSONObject)cosy.get(i)).getDouble("shiftX"); - y=((JSONObject)cosy.get(i)).getDouble("shiftY"); - } - else{ - if(cosy.get(i) instanceof NMRSignal2D){ - x =((NMRSignal2D)cosy.get(i)).toJSON().getDouble("shiftX"); - y =((NMRSignal2D)cosy.get(i)).toJSON().getDouble("shiftY"); - } - } - row = getIndex(x,shiftsH,windowH, resolutionX); - col = getIndex(y,shiftsH,windowH, resolutionX); - if(row>=0&&col>=0) - cosyE[row][col]=1; - } - //To complete the missing diagonal signals - for(int i=0;i0&&connHmbc.length()>0){ - hmbcT = new byte[nH][nC]; - //To parse the theoretical HMBC - for(int i=connHmbc.length()-1;i>=0;i--){ - JSONObject pair = (JSONObject) connHmbc.get(i); - row=diaIDsH.indexOf(pair.getString("diaID1")); - col=diaIDsC.indexOf(pair.getString("diaID2")); - if(row>=0&&col>=0) - hmbcT[row][col]=1; - } - - - for(int i=hmbc.length()-1;i>=0;i--){ - //JSONObject crossPeak = null; - double y=0;//x=0; - if(hmbc.get(i) instanceof JSONObject){ - //x=((JSONObject)hmbc.get(i)).getDouble("shiftX"); - y=((JSONObject)hmbc.get(i)).getDouble("shiftY"); - } - else{ - if(hmbc.get(i) instanceof NMRSignal2D){ - //crossPeak = (JSONObject) ((NMRSignal2D)hmbc.get(i)).toJSON().get("peaks"); - //x =((NMRSignal2D)hmbc.get(i)).toJSON().getDouble("shiftX"); - y =((NMRSignal2D)hmbc.get(i)).toJSON().getDouble("shiftY"); - } - } - if(shiftsC.size()==0) - shiftsC.add(y); - else{ - int index = shiftsC.binarySearch(y); - if(index<0) - shiftsC.beforeInsert(-(index+1), y); - } - } - if(DEBUG) System.out.println("shifts C : "+shiftsC); - if(DEBUG) System.out.println("diaIDs C : "+diaIDsC); - shiftsC=fitCount(diaIDsC,shiftsC); - if(DEBUG) System.out.println("shifts C : "+shiftsC); - hmbcE = new byte[nSignals][shiftsC.size()]; - double resolutionX = Double.MAX_VALUE/6;//((JSONObject)hmbc.get(0)).getDouble("resolutionX"); - if(((JSONObject)hmbc.get(0)).has("resolutionX")) - resolutionX = ((JSONObject)hmbc.get(0)).getDouble("resolutionX"); - double resolutionY = Double.MAX_VALUE/6;//((JSONObject)hmbc.get(0)).getDouble("resolutionY"); - if(((JSONObject)hmbc.get(0)).has("resolutionY")) - resolutionY = ((JSONObject)hmbc.get(0)).getDouble("resolutionY"); - for(int i=hmbc.length()-1;i>=0;i--){ - //JSONObject crossPeak = null; - double x=0,y=0; - if(hmbc.get(i) instanceof JSONObject){ - x=((JSONObject)hmbc.get(i)).getDouble("shiftX"); - y=((JSONObject)hmbc.get(i)).getDouble("shiftY"); - } - else{ - if(hmbc.get(i) instanceof NMRSignal2D){ - //crossPeak = (JSONObject) ((NMRSignal2D)hmbc.get(i)).toJSON().get("peaks"); - x =((NMRSignal2D)hmbc.get(i)).toJSON().getDouble("shiftX"); - y =((NMRSignal2D)hmbc.get(i)).toJSON().getDouble("shiftY"); - } - } - //System.out.println(resolutionX+" "+resolutionY+" "+windowH); - row = getIndex(x,shiftsH, windowH, resolutionX); - col = getIndex(y,shiftsC, null, resolutionY); - //System.out.println(row+" , "+col); - if(row>=0&&col>=0) - hmbcE[row][col]=1; - } - }*/ - - - } catch (e) { - // TODO Auto-generated catch block - console.log("Exception in SpinSystem " + e); - } - } - - _getIndex(value, shifts, windows, resolution) { - var minDiff = Number.MAX_VALUE; - var index = shifts.length - 1; - for(var i = shifts.length - 1; i >= 0; i--){ - if(Math.abs(value-shifts[i]) < minDiff) { - minDiff = Math.abs(value - shifts[i]); - index = i; - } - } - if(windows) { - if(minDiff <= windows[index]/2) - return index; - } - if(minDiff <= Math.abs(resolution*4)) - return index; - - return -1; - } - - } - - module.exports = SpinSystem; - - -/***/ }, +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var abstractMatrix = __webpack_require__(8); + +var Matrix = __webpack_require__(0); + +class BaseView extends abstractMatrix() { + constructor(matrix, rows, columns) { + super(); + this.matrix = matrix; + this.rows = rows; + this.columns = columns; + } + + static get [Symbol.species]() { + return Matrix.Matrix; + } + +} + +module.exports = BaseView; + +/***/ }), /* 2 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict' - /** - * Created by acastillo on 9/2/16. - */ - const TreeSet = __webpack_require__(3); - - const defaultOptions = {minScore:1, maxSolutions: 100, errorCS:-1, onlyCount: false, timeout:20000, condensed:true}; - - const DEBUG = false; - - class Assignment{ - constructor(spinSystem, opt){ - var options = Object.assign({}, defaultOptions, opt); - this.spinSystem = spinSystem; - this.minScore = options.minScore; - this.maxSolutions = options.maxSolutions; - this.errorCS = options.errorCS; - this.onlyCount = options.onlyCount; - this.timeout = options.timeout; - this.MAXERRORSHMBC = 1; - this.condensed = options.condensed; - - this.timeoutTerminated = 0; - this.score = 0; - this.nSolutions = 0; - this.nSteps = 0; - this.lowerBound = 0; - - this.solutions = null; - - this.comparator = function(a, b){ - return b.score - a.score; - } - } - - getAssignments(){ - var date = new Date(); - this.timeStart = date.getTime(); - var i, j, k, nSignals, nDiaIDs; - - if(DEBUG) console.log(this.spinSystem); - - this.lowerBound = this.minScore; - do{ - this.nSolutions = 0; - this.nSteps = 0; - this.solutions = new TreeSet(this.comparator); - - if(this.spinSystem.hmbcE != null) - this.spinSystem.hmbcLines = {}; - if(this.spinSystem.cosyE != null) - this.spinSystem.cosyLines = {}; - - nSignals = this.spinSystem.signals.length; - nDiaIDs = this.spinSystem.diaList.length; - this.scores = new Array(nSignals); - let partial = new Array(nSignals); - - for (i = 0; i < nSignals; i++) { - this.scores[i] = 1; - partial[i] = []; - } - - var diaMask = new Array(nDiaIDs); - - for(i = diaMask.length - 1; i >= 0; i--) - diaMask[i] = true; - - try { - this.exploreTreeRec(this.spinSystem.signals, - this.spinSystem.diaList,nSignals - 1, nDiaIDs - 1, diaMask, partial); - - } catch (e) { - console.log("Exception in assignment: " + e); - } - this.lowerBound -= 0.1; - if(DEBUG) console.log("Decreasing lowerBound: " + this.lowerBound); - }while(this.solutions.isEmpty() && this.lowerBound >= 0.4); - - //Format the result - this._formatAssignmentOutput(); - - return this.solutions.elements; - } - - _formatAssignmentOutput(format){ - var nSignals = this.spinSystem.signalsArray.length; - var i, j, k; - var assignment = this.solutions.elements; - var nSolutions = this.solutions.length; - for(i = 0; i < nSolutions; i++){ - var assignment = this.solutions.elements[i].assignment; - this.solutions.elements[i].index = i+""; - var assignmentNew = {}; - for(j = 0; j < nSignals; j++){ - var diaIDs = assignment[j]; - var tmp = new Array(diaIDs.length); - for(k = 0; k < diaIDs.length; k++){ - tmp[k] = this.spinSystem.diaIDsArray[diaIDs[k]].diaIDs[0]; - } - if(this.condensed) - assignmentNew[this.spinSystem.signalsArray[j].signalID] = tmp; - else{ - assignment[j] = {signalID : this.spinSystem.signalsArray[j].signalID, - delta : Math.round(this.spinSystem.signalsArray[j].signal[0].delta*100)/100, - diaID : tmp} - } - } - if(this.condensed) - this.solutions.elements[i].assignment = assignmentNew; - } - } - - exploreTreeRec(signals, diaList, indexSignal, indexDia, diaMask, partial) { - //If this happens, we can assign this atom group to this signal - while(indexDia >= 0 && signals[indexSignal] >= diaList[indexDia]) { - //Force a return if the loop time is longer than the given timeout - const d = new Date(); - if((d.getTime() - this.timeStart) > this.timeout){ - this.timeoutTerminated=true; - return; - } - //We can speed up it by checking the chemical shift first - if(diaMask[indexDia] && this._isWithinCSRange(indexSignal, indexDia)) { - this.nSteps++; - const sizePartial = partial[indexSignal].length; - //Assign the atom group to the signal - diaMask[indexDia] = false;//Mark this atom group as used - partial[indexSignal][sizePartial] = indexDia;//Add the atom group index to the assignment list - signals[indexSignal] -= diaList[indexDia];//Subtract the group from signal integral - //If this signal is completely assigned, we have to verify all the restrictions - if(signals[indexSignal] == 0){ - let keySum = this._accomplishCounts(indexSignal, partial); - if(DEBUG) console.log("Accomplish count: "+keySum); - if(keySum != 0){ - //Verify the restrictions. A good solution should give a high score - this.score = this._solutionScore(partial, indexSignal, keySum); - if(DEBUG) console.log(this.score+" "+partial); - //This is a solution - if(this.score>0){ - if(indexSignal == 0){//We found a new solution - this.nSolutions++; - var solution = {assignment: this._cloneArray(partial), score: this.score}; - if (this.solutions.length >= this.maxSolutions) { - if (this.score > this.solutions.last().score) { - this.solutions.pollLast(); - this.solutions.add(solution); - } - } else { - this.solutions.add(solution); - } - } - else{ - //Each new signal that we assign will produce a new level on the tree. - indexSignal--;//Lets go forward with the next signal - indexDia = diaList.length; - while(!diaMask[--indexDia]); - //SolutionTree newLevel = new SolutionTree(solution); - this.exploreTreeRec(signals, diaList, indexSignal, indexDia, diaMask, partial); - indexSignal++; - } - } - } - - } - else{ - //It says that the signal should be assigned by combining 2 or more signals - const previousIndexDia = indexDia; - while(indexDia > 0 && !diaMask[--indexDia]); - if(indexDia>=0) - this.exploreTreeRec(signals, diaList, indexSignal, indexDia, diaMask, partial); - indexDia = previousIndexDia; - } - //Deallocate this atom group to try the next one. - indexDia = partial[indexSignal].splice(sizePartial,1);//Add the atom group index to the assignment list - diaMask[indexDia] = true;//Mark this atom group as available - signals[indexSignal] += diaList[indexDia];//Subtract the group from signal integral - this.scores[indexSignal] = 1; - } - indexDia--; - } - } - - _cloneArray(data){ - return JSON.parse(JSON.stringify(data)); - } - - _isWithinCSRange(indexSignal, indexDia) { - if(this.spinSystem.chemicalShiftsE != null && this.spinSystem.chemicalShiftsT != null){ - if(this.errorCS == 0) - return true; - var cfAtoms = this.spinSystem.chemicalShiftsT[indexDia]; - - if(cfAtoms == -9999999) - return true; - var cfSignal = this.spinSystem.chemicalShiftsE[indexSignal]; - var error = this.spinSystem.chemicalShiftsTError[indexDia]; - if(error < Math.abs(this.errorCS)) - error = this.errorCS; - - var csError = Math.abs(this.spinSystem.signalsWidth[indexSignal]/2.0+Math.abs(error)); - if(Math.abs(cfSignal - cfAtoms) <= csError) - return true; - else - return false; - } - return true; - } - - _accomplishCounts(indexSignal, partial){ - //Check the chemical shift - var keySum = -1; - var keySumCOSY = 1; - var keySumHMBC = 1; - if(this.spinSystem.cosyE != null){ - keySumCOSY = this._accomplishCount(indexSignal, partial[indexSigna+l], - this.spinSystem.cosyT, this.spinSystem.cosyE, this.spinSystem.cosyLines, true, MAXERRORSCOSY); - keySum = keySumCOSY; - } - if(keySum!=0){ - if(this.spinSystem.hmbcE != null){ - keySumHMBC = this._accomplishCount(indexSignal, partial[indexSignal], this.spinSystem.hmbcT, - this.spinSystem.hmbcE, this.spinSystem.hmbcLines, false, MAXERRORSHMBC); - keySum = keySumHMBC; - } - } - return keySum; - } - - /** - * This function calculates the expected connectivity pattern each time that a experimental - * signal is completely assigned to a set of theoretical signals. Once the new patter is calculate, - * it verifies if this patter is potentially a candidate or not. The function stores the - * calculated pattern in a hash-map so that each of those expensive operations is performed just once. - * If the pattern accomplish with the count of expected and observed signals, it will return the key - * of the patter in the hash map, or 0 in other case. - * @param index - * @param signals - * @param theoretical - * @param experimental - * @param hashMap - * @param isSymmetryc - * @return - */ - _accomplishCount(index, signals,theoretical, experimental, hashMap, isSymmetryc, maxErrors) { - return 1; - } - - /** - * This function calculates the score of a given partial assignment. - * @param partial - * @param current - * @param keySingalAsg - * @return The score of the given function. - * @throws JSONException - */ - _solutionScore(partial, current, keySingalAsg) { - var score = 0; - var expLH=0; - if(this.spinSystem.cosyLines != null) { - expLH++; - score=this._cosyScore(partial, current, keySingalAsg); - } - if(this.spinSystem.hmbcLines != null) { - expLH++; - score+=this._hmbcScore(partial, current, keySingalAsg); - } - if(this.spinSystem.chemicalShiftsT != null && this.errorCS > 0) { - expLH++; - score+=this._chemicalShiftScore(partial, current, keySingalAsg); - } - - if(expLH==0){ - expLH=3; - score=3; - } - - this.scores[current] = score/expLH; - var sumLh=0; - var count=0; - for(var i = this.scores.length-1; i >= 0; i--) { - if(this.scores[i] != -1) { - sumLh += this.scores[i]; - count++; - } - } - - if(sumLh= 0; i--) { - csGroup = this.spinSystem.chemicalShiftsT[assignedGroups[i]]; - if(csGroup != -9999999) { - nbGroups++; - diff = Math.abs(csSignal-csGroup); - if(diff <= widthSignal) - score+=1; - else{ - diff = Math.abs(diff-widthSignal); - score += (-0.25/this.errorCS)*diff+1; - } - } - } - if(nbGroups==0) - return 1.0; - return score/nbGroups; - } catch (e) { - console.log("Exception in chemical shift score function " + e); - } - - return 1; - } - - /** - * This function calculates the assignment score for the COSY restrictions. - * @param partial - * @param current - * @param keySingalAsg - * @return - */ - _cosyScore(partial, current, keySingalAsg) { - var goodness=0; - var cosyLine = this.spinSystem.cosyLines[keySingalAsg]; - var count1 =0; - var count0 =0; - var size = cosyLine.length-1; - - for(var i = partial.length-1;i >= 0; i--) { - try { - var signal2 = partial[i]; - if(i != current && signal2.length > 0) { - var key=0; - //The unique key for the union of those signals - try { - for(var j = signal2.length-1; j >= 0; j--) { - key|=1<= 0; j--) { - if(cosyLine[j] == 6 && cosyLine2[j] != 0) - crossPeak = true; - } - if(crossPeak) - count1++; - else - count0++; - - if(this.spinSystem.cosyE[current][i] == 0 && crossPeak) - goodness-=0.5; - if(this.spinSystem.cosyE[current][i] == 1 && !crossPeak) - goodness-=0.5; - if(this.spinSystem.cosyE[current][i] == 1 && crossPeak) - goodness+=1; - if(this.spinSystem.cosyE[current][i] == 0 && !crossPeak) - goodness+=0.5; - } - } catch (e1) { - console.log("Exception in cosy score function " + e); - } - } - return Math.exp(-Math.abs((count1+count0/2.0)-goodness)/2.0); - } - - /** - * This function calculates the assignment score for the HMBC restrictions. - * @param partial - * @param current - * @param keySingalAsg - * @return - */ - _hmbcScore(partial, current, keySingalAsg) { - var hmbcLine = this.spinSystem.hmbcLines[keySingalAsg]; - var sizeT = hmbcLine.length-1; - var sizeE = this.spinSystem.hmbcE[0].length-1; - var freedom = sizeT-sizeE + this.MAXERRORSHMBC; - var crossPeaks = 0; - for(var j = sizeT; j >= 0; j--) { - if(hmbcLine[j] == 1) - crossPeaks++; - } - for(var j = sizeE; j >= 0; j--) { - if(this.spinSystem.hmbcE[current][j] == 1) - crossPeaks--; - } - - if(crossPeaks < freedom) - crossPeaks=freedom; - - return Math.exp(-Math.abs(crossPeaks-freedom)/(sizeT+1)); - } - } - module.exports = Assignment; - -/***/ }, +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) {/** + * openchemlib - Manipulate molecules + * @version v4.4.0 + * @date 2016-09-01T11:25:09.510Z + * @link https://github.com/cheminfo/openchemlib-js + * @license BSD-3-Clause +*/(function(root){'use strict';function getExports($wnd){var $doc=$wnd.document;var $gwt={};var navigator={userAgent:'webkit'};function noop(){}var __gwtModuleFunction=noop;__gwtModuleFunction.__moduleStartupDone=noop;var $sendStats=noop;var $moduleName,$moduleBase;// Start GWT code +function IG(){}function FG(){}function Fd(){}function nc(){}function oB(){}function vB(){}function tf(){}function wf(){}function yf(){}function Bf(){}function ag(){}function pg(){}function mh(){}function _m(){}function _q(){}function Xn(){}function Eo(){}function No(){}function Fz(){}function cA(){}function dA(){}function nA(){}function eB(){}function AB(){}function TB(){}function hH(){}function sH(){}function yH(){}function yO(){}function EN(){}function Tg(){this.g=1;}function QI(a){this.a=a;}function Lz(a){this.a=a;}function FH(a){this.a=a;}function aJ(a){this.a=a;}function CL(a){this.a=a;}function IL(a){this.a=a;}function ML(a){this.a=a;}function RL(a){this.a=a;}function mM(a){this.a=a;}function sM(a){this.a=a;}function hM(a){this.b=a;}function om(a){this.b=a;}function UK(a){this.c=a;}function dN(a){this.c=a;}function EP(a){this.a=a;}function wh(){th(this);}function pJ(){GA.call(this);}function pk(a,b){a.M=b;}function kk(a,b){a.G=b;}function mk(a,b){a.P=b;}function uo(a,b){a.i=b;}function Zi(a,b){a.Q&=~b;}function uj(a,b){a.A[b]=-1;}function vj(a,b){a.F[b]=128;}function hk(a,b){a.C[b]|=GR;}function qk(a,b){a.s[b]|=qR;}function wN(a,b){a.sort(b);}function hz(a){return ho(a);}function jz(a){return io(a);}function kz(a){return jo(a);}function Cz(){Bz();new $q();}function bz(){this.a=new Vn();}function gz(){this.a=new go();}function oq(){this.a=new LM();}function sA(){this.a=new LM();}function _O(){this.a=new LM();}function Uo(){this.c=new LM();}function IH(){GA.call(this);}function MI(){GA.call(this);}function OI(){GA.call(this);}function eK(){GA.call(this);}function HN(){GA.call(this);}function KH(){IH.call(this);}function MH(){MH=FG;LH=false;}function bB(){bB=FG;aB=new eB();}function yB(){yB=FG;xB=new AB();}function KA(){KA=FG;JA=new nc();}function cK(){cK=FG;bK=new yH();}function DN(){DN=FG;CN=new EN();}function kN(a){nN(a,a.length);}function mN(a){pN(a,a.length);}function jB(a){iB();hB.pb(a);}function UP(a){OP(a);return a;}function We(a,b){return a.k[b];}function af(a,b){return a.W[b];}function Pf(a,b){return a.e[b];}function ji(a,b){return a.q[b];}function ti(a,b){return a.v[b];}function vi(a,b){return a.w[b];}function Ai(a,b){return a.A[b];}function Oi(a,b){return a.D[b];}function Pi(a,b){return a.F[b];}function Qk(a,b){return a.c[b];}function Tk(a,b){return a.k[b];}function bl(a,b){return a.g[b];}function jn(a,b){return a.a[b];}function kn(a,b){return a.b[b];}function on(a,b){return a.d[b];}function rn(a,b){return a.e[b];}function kJ(a){return a<0?-a:a;}function lz(){return $n(),Yn;}function WN(a){a.b=null;a.c=0;}function Fj(a,b){a.o=b;a.Q=0;}function Gj(a,b){a.p=b;a.Q=0;}function HA(a){FA.call(this,a);}function qJ(a){IA.call(this,a);}function rJ(a){HA.call(this,a);}function oJ(a){HA.call(this,a);}function JH(a){HA.call(this,a);}function NI(a){HA.call(this,a);}function fK(a){HA.call(this,a);}function aK(a){JH.call(this,a);}function nK(a){mK.call(this,a);}function tJ(a){NI.call(this,a);}function FP(a){EP.call(this,a);}function SJ(){FH.call(this,'');}function ZJ(){FH.call(this,'');}function $J(){FH.call(this,'');}function yG(){wG==null&&(wG=[]);}function TA(){TA=FG;!!(iB(),hB);}function aQ(){aQ=FG;ZP={};_P={};}function bI(a){aI(a);return a.k;}function _N(a){return!!a&&a.b;}function Xe(a){return Ye(a,a._);}function VB(a,b){return jI(a,b);}function mz(a,b){return ko(a,b);}function nz(a,b){return lo(a,b);}function lJ(a,b){return a>b?a:b;}function mJ(a,b){return a0;}function BH(a,b){return yJ(a.a,b);}function kK(a,b){return GB(a.a,b);}function lK(a,b){return GB(a.a,b);}function bM(a,b){return!!XN(a,b);}function pf(a,b){return ab?1:0;}function aj(a,b){return(a.s[b]&4)!=0;}function hj(a,b){return(a.C[b]&4)!=0;}function dj(a,b){return(a.C[b]&qR)!=0;}function fj(a,b){return(a.C[b]&cR)!=0;}function ij(a,b){return(a.C[b]&GR)!=0;}function bj(a,b){return(a.s[b]&FR)!=0;}function lj(a,b){return(a.s[b]&cR)!=0;}function Wi(a,b){return(a.s[b]&qR)!=0;}function $i(a,b){return(a.s[b]&ER)!=0;}function Dl(a,b){return(a.s[b]&iR)!=0;}function Kl(a,b){return(a.s[b]&BR)!=0;}function Nl(a,b){return(a.s[b]&8)!=0;}function El(a,b){return(a.s[b]&xQ)!=0;}function Pl(a,b){return(a.s[b]&yQ)!=0;}function ej(a,b){return(a.D[b]&$Q)!=0;}function Ll(a,b){return(a.C[b]&64)!=0;}function Hi(a,b){return(a.C[b]&48)>>4;}function dG(a){return a.backingJsObject;}function yJ(a,b){return a.charCodeAt(b);}function nq(a,b,c){yM(a.a,new mq(b,c));}function QN(a,b,c){a.a=b^1502;a.b=c^jU;}function kh(a,b,c,d){a.a=b;a.b=c;a.c=d;}function bk(a,b,c,d){a.B[b][c]=d;a.Q=0;}function Pe(a){a.q=new ZJ();a.p=6;a.r=0;}function ai(a,b){a.F[b]=128;Uh(a);a.Q=0;}function VP(a,b){return a==b?0:a>19;}function Ji(a,b){return(a.C[b]&BR)>>10;}function Gi(a,b){return(a.D[b]&960)>>6;}function qj(a,b){return(a.s[b]&512)!=0;}function Fl(a,b){return(a.C[b]&256)!=0;}function Hl(a,b){return(a.C[b]&512)!=0;}function Ol(a,b){return(a.C[b]&128)!=0;}function Ti(a,b){return Ui(a,b)+Si(a,b);}function zo(a,b){Ic();yo.call(this,a,b);}function _J(a){FH.call(this,(OP(a),a));}function lp(a,b){Gh();zk.call(this,a,b);}function Wo(a,b){Yh(a,b);!!a.b&&(b.Q=0);}function hp(a){Xo(a,15);!!a.b&&of(a.b);}function Xm(a,b,c){a.c=b;return Zm(a,c);}function fC(a,b,c){return{l:a,m:b,h:c};}function oC(a){return a.l+a.m*XT+a.h*YT;}function YP(a){return a.$H||(a.$H=++XP);}function IJ(a,b){return a.lastIndexOf(b);}function GJ(a,b,c){return a.indexOf(b,c);}function PC(a,b){return a!=null&&NC(a,b);}function Df(a,b){a.d[a.c]=eG(a.d[a.c],b);}function Gf(a){this.d=ZB(aD,gR,6,a,14,1);}function LM(){this.a=ZB(eF,fR,1,0,5,1);}function vO(a){this.a=a;hM.call(this,a);}function qO(a){rO.call(this,a,(EO(),AO));}function BB(){BB=FG;zB((yB(),yB(),xB));}function GA(){tA(this);uA(this);this.nb();}function aI(a){if(a.k!=null){return;}nI(a);}function KP(a){if(!a){throw dG(new MI());}}function SP(a){if(!a){throw dG(new OI());}}function MP(a){if(!a){throw dG(new HN());}}function RH(a){if(!a){throw dG(new MI());}}function mB(a){iB();return parseInt(a)||-1;}function NH(a){MH();return DJ(lQ,typeof a);}function OH(a,b){MH();return a==b?0:a?1:-1;}function Kc(a,b){return a==null?b:a+','+b;}function fA(a,b){return{type:b,value:a};}function BJ(a,b){return OP(a),a+(OP(b),b);}function JM(a){return xP(a.a,a.a.length);}function XH(a){return a>=56320&&a<=57343;}function Ym(a){return a.length==0?0:xI(a);}function LJ(a,b,c){return a.substr(b,c-b);}function ii(a,b){return(a.s[b]&98304)>>15;}function _e(a,b){return a.d==null?-1:a.d[b];}function Ff(a,b){a.a=b;a.c=0;a.b=63;mN(a.d);}function dk(a,b,c){a.C[b]&=-49;a.C[b]|=c<<4;}function Kj(a,b,c){a.s[b]&=-449;a.s[b]|=c;}function WP(b,c,d){try{b[c]=d;}catch(a){}}function ar(a,b,c,d,e){return bq(a,b,c,d,e);}function JJ(a,b,c){return a.lastIndexOf(b,c);}function TC(a,b){return a&&b&&a instanceof b;}function hi(a,b){return((a.s[b]&yR)>>>28)-1;}function lh(a,b){kh(a,b.a,b.b,b.c);return a;}function VL(a,b){var c;c=a.d;a.d=b;return c;}function Xz(a){!a.a&&(a.a=new Tg());return a.a;}function Zz(a){!a.d&&(a.d=new _m());return a.d;}function $z(a){!a.e&&(a.e=new go());return a.e;}function _z(a){!a.f&&(a.f=new Eo());return a.f;}function aA(a){!a.g&&(a.g=new No());return a.g;}function bA(a){!a.i&&(a.i=new dA());return a.i;}function Vy(a,b){this.a=new Vp(new AH(a),b);}function eH(a){this.a='Helvetica';this.b=a;}function pO(a){TK(a.a);cO(a.c,a.b);a.b=null;}function zB(a){!a.a&&(a.a=new TB());return a.a;}function UA(a,b,c){return a.apply(b,c);var d;}function DM(a,b){return EM(a,b,a.a.length-1);}function mv(a,b,c,d){ou();return Ak(a,b,c,d);}function Oc(a,b,c){qo(a,b-a.O/2,c-a.O/2,a.O);}function Ed(a,b,c){this.b=a;this.c=b;this.a=c;}function RB(a,b){BB();QB.call(this,a,b,true);}function HH(){HA.call(this,'divide by zero');}function JG(){$wnd.setTimeout(eQ(LG));KG();}function kp(){Gh();this.K=this.L=256;Yi(this);}function $I(){$I=FG;ZI=ZB(ZE,eU,31,256,0,1);}function jJ(){jJ=FG;iJ=ZB(_E,eU,45,256,0,1);}function dr(){dr=FG;cr=(!Wz&&(Wz=new cA()),Wz);}function fI(a){var b;b=eI(a);rI(a,b);return b;}function Tp(a,b){a.c==null&&Pp(a,b);return a.c;}function yM(a,b){a.a[a.a.length]=b;return true;}function KJ(a,b){return a.substr(b,a.length-b);}function qi(a,b){return a.t==null?null:a.t[b];}function mi(a,b){return a.r==null?null:a.r[b];}function sj(a,b){return a.F[b]==17||a.F[b]==9;}function Rk(a,b){return a.c[b]-a.g[b]+ml(a,b);}function jl(a,b){return Ui(a,b)+Si(a,b)-ol(a,b);}function kH(a,b){return nH(a,b.c,b.d,b.b,b.a);}function zJ(a,b){return VP((OP(a),a),(OP(b),b));}function pG(a,b){return hG(xC(kG(a)?rG(a):a,b));}function qG(a,b){return hG(yC(kG(a)?rG(a):a,b));}function nJ(a){return a==0||isNaN(a)?a:a<0?-1:1;}function cp(a){Xo(a,7);return!a.b?null:Ze(a.b);}function dp(a){Xo(a,7);return!a.b?null:Xe(a.b);}function lg(a,b){return b==1?a.a+a.f++:a.i+a.g++;}function rh(a,b){b.a=b.a*a.c+a.a;b.b=b.b*a.c+a.b;}function rH(a,b,c,d,e){a.c=b;a.d=c;a.b=d;a.a=e;}function Wj(a,b,c){a.s[b]&=-49;a.s[b]|=c;a.Q&=3;}function Ij(a,b,c){a.s[b]&=-98305;a.s[b]|=c<<15;}function XG(a,b,c){TG();YG.call(this,a,b,c,255);}function xM(a,b,c){QP(b,a.a.length);zP(a.a,b,c);}function BM(a,b){NP(b,a.a.length);return a.a[b];}function AP(a,b,c){yP(c,0,a,b,c.length,false);}function vo(a,b){if(a.j!=b){a.j=b;a.e=new eH(b);}}function eP(a,b){if(a<0||a>=b){throw dG(new KH());}}function tG(a){if(kG(a)){return a|0;}return CC(a);}function xN(c){c.sort(function(a,b){return a-b;});}function Sp(a){a.c==null&&Pp(a,10240);return a.c;}function hI(a){var b;b=eI(a);b.j=a;b.e=1;return b;}function pN(a,b){var c;for(c=0;c0?1:0;}function QO(a,b){return aO(a.a,b,(MH(),LH))==null;}function _B(a){return Array.isArray(a)&&a.Lb===IG;}function OC(a){return!Array.isArray(a)&&a.Lb===IG;}function iO(a){this.b=null;this.a=(DN(),!a?CN:a);}function FA(a){tA(this);this.f=a;uA(this);this.nb();}function ru(a){ou();!a&&(a=new lp(32,32));this.a=a;}function fB(a,b){!a&&(a=[]);a[a.length]=b;return a;}function xo(a,b){RJ(a.c,'\t');RJ(a.c,b);RJ(a.c,kQ);}function Sj(a,b,c){c?a.s[b]|=cR:a.s[b]&=-262145;}function fk(a,b,c){c?a.C[b]|=cR:a.C[b]&=-262145;}function ck(a,b,c){c?a.C[b]|=qR:a.C[b]&=-131073;}function Aj(a){var b;for(b=0;b0){a>>=1;++b;}return b;}function OP(a){if(a==null){throw dG(new pJ());}return a;}function TJ(a,b){a.a+=String.fromCharCode(b);return a;}function DH(a,b,c){CH(a,b,b+1,String.fromCharCode(c));}function Yj(a,b,c){a.s[b]&=-134217729;c&&(a.s[b]|=FR);}function Of(a,b){return a.f[b]&&(a.o[b]==1||a.o[b]==2);}function rC(a,b){return fC(a.l&b.l,a.m&b.m,a.h&b.h);}function wC(a,b){return fC(a.l|b.l,a.m|b.m,a.h|b.h);}function EC(a,b){return fC(a.l^b.l,a.m^b.m,a.h^b.h);}function zH(a){return a.a==a.b.length?-1:yJ(a.b,a.a++);}function CH(a,b,c,d){a.a=LJ(a.a,0,b)+(''+d)+KJ(a.a,c);}function hm(a,b,c){a.c=6;a.d=c;a.a=b;a.e=b[a.d]-64<<11;}function Bj(a){var b;for(b=0;ba?1:a;this.L=1>b?1:b;Yi(this);}function gI(a,b){var c;c=eI(a);rI(a,c);c.e=b?8:0;return c;}function xf(a,b){if(a.c!=b.c)return a.c>b.c?1:-1;return 0;}function XJ(a,b,c){a.a=LJ(a.a,0,b)+''+KJ(a.a,c);return a;}function Uj(a,b,c,d){a.s[b]&=-8;a.s[b]|=c;d&&(a.s[b]|=4);}function qh(a,b){b.c*=a.c;b.a=b.a*a.c+a.a;b.b=b.b*a.c+a.b;}function YK(a,b){UK.call(this,a);QP(b,a.size());this.a=b;}function pp(){Uo.call(this);this.b=new LM();this.a=new LM();}function iB(){iB=FG;var a,b;b=!nB();a=new vB();hB=b?new oB():a;}function Bz(){Bz=FG;Az=(!Wz&&(Wz=new cA()),Wz);tz=(Vq(),Eq);}function dQ(){if($P==256){ZP=_P;_P={};$P=0;}++$P;}function IN(a,b){return VC(a)===VC(b)||a!=null&&pc(a,b);}function xA(a,b){a.backingJsObject=b;b!=null&&WP(b,pQ,a);}function yA(a,b){var c;c=bI(a.Jb);return b==null?c:c+': '+b;}function hN(a,b){LP(b);return jN(a,ZB(_C,DQ,6,b,15,1),b);}function CJ(a){var b;return PJ(GP(a,0,(b=a.length,DP(),b)));}function NJ(a){return String.fromCharCode.apply(null,a);}function AJ(a,b){return zJ(a.toLowerCase(),b.toLowerCase());}function gL(a,b){return b===a?'(this Map)':b==null?rQ:vc(b);}function fG(a,b){return hG(rC(kG(a)?rG(a):a,kG(b)?rG(b):b));}function oG(a,b){return hG(wC(kG(a)?rG(a):a,kG(b)?rG(b):b));}function vG(a,b){return hG(EC(kG(a)?rG(a):a,kG(b)?rG(b):b));}function vI(a){return DJ(mQ,typeof a)||a instanceof Number;}function mc(a){return bI(rc(a))+'@'+(tc(a)>>>0).toString(16);}function WC(a){return Math.max(Math.min(a,oQ),-2147483648)|0;}function ZA(a){TA();$wnd.setTimeout(function(){throw a;},0);}function Uc(a){var b,c;b=(TG(),PG);c=new WG(a);return kA(c,b);}function pu(a){var b;b=Xz(nu);b.j=new SN(0);Ig(b,a.a);$l(a.a);}function md(a){var b;b=a.a;a.a=a.b;a.b=b;b=a.c;a.c=a.d;a.d=b;}function td(a,b){var c;c=a.b;a.b=b.b;b.b=c;c=a.d;a.d=b.d;b.d=c;}function jI(a,b){var c=a.a=a.a||[];return c[b]||(c[b]=a.sb(b));}function HM(a,b,c){var d;RP(b,c,a.a.length);d=c-b;BP(a.a,b,d);}function nf(a){var b;for(b=0;b>6)+((a.D[b]&15360)>>10);}function IO(){EO();return aC(VB(UF,1),eU,42,0,[AO,BO,CO,DO]);}function SN(a){NN();QN(this,tG(fG(qG(a,24),EQ)),tG(fG(a,EQ)));}function MA(a){KA();IA.call(this,a);this.a='';this.b=a;this.a='';}function MG(a,b){tA(this);this.e=b;this.f=a;uA(this);this.nb();}function eo(a,b,c){a.b=null;a.a=b;c==null?a.c=_n(a,b):a.c=c;}function fo(a,b,c){a.e=null;a.d=b;c==null?a.f=_n(a,b):a.f=c;}function Di(a,b,c){return Ak(a.H[b].a,a.H[b].b,a.H[c].a,a.H[c].b);}function gk(a,b,c,d){a.C[b]&=-16777224;a.C[b]|=c;d&&(a.C[b]|=4);}function fO(a,b){var c;c=1-b;a.a[c]=gO(a.a[c],c);return gO(a,b);}function gA(a,b){var c;c=a-b;c>=MQ?c-=LQ:c>22&OR;d=a<0?VT:0;return fC(b,c,d);}function aM(a,b){var c,d;c=b.Fb();d=XN(a,c);return!!d&&IN(d.d,b.Gb());}function EM(a,b,c){for(;c>=0;--c){if(IN(b,a.a[c])){return c;}}return-1;}function IM(a,b,c){var d;d=(NP(b,a.a.length),a.a[b]);a.a[b]=c;return d;}function fh(a,b,c){var d;for(d=0;dMQ)c-=LQ;return c;}function FM(a,b){var c;c=(NP(b,a.a.length),a.a[b]);BP(a.a,b,1);return c;}function TN(a,b){!a.a?a.a=new _J(a.d):WJ(a.a,a.b);VJ(a.a,b);return a;}function uA(a){if(a.j){a.backingJsObject!==uQ&&a.nb();a.g=null;}return a;}function Ml(a,b){return a.A[b]==1&&a.v[b]==0&&(a.r==null||a.r[b]==null);}function ZH(a){return String.fromCharCode(a).toLowerCase().charCodeAt(0);}function PA(){if(Date.now){return Date.now();}return new Date().getTime();}function CP(){if(Date.now){return Date.now();}return new Date().getTime();}function WA(b){TA();return function(){return XA(b,this,arguments);var a;};}function Ze(a){if(a.D==null){Ue(a);ef(a);gf(a,1);gf(a,2);df(a);}return a.D;}function mp(a){Gh();zk.call(this,!a?256:a.K,!a?256:a.L);!!a&&Xh(a,this);}function xO(a,b){_L.call(this,a,b);this.a=ZB(PF,fR,60,2,0,1);this.b=true;}function Vp(a,b){Np();this.c=b;this.g=new xH(a);this.f=new $J();this.a=new $J();}function UN(a,b){this.b=', ';this.d=a;this.e=b;this.c=this.d+(''+this.e);}function cO(a,b){var c;c=new yO();c.c=true;c.d=b.Gb();return dO(a,b.Fb(),c);}function jg(a,b){var c,d;d=a.j.k[b];c=a.j.j[b];return d==0?a.b:d==1?c:a.a+c;}function mH(a,b,c){var d,e;d=a.c;e=a.d;return b>=d&&c>=e&&bMQ)c-=LQ;return c;}function ev(a){ou();var b;b=new qu();Xm(Zz(nu),b.a,new xH(new AH(a)));return b;}function bC(a,b){WB(b)!=10&&aC(rc(b),b.Kb,b.__elementTypeId$,WB(b),a);return a;}function _g(a,b){var c;for(c=0;c>16&255)+','+(b.c>>8&255)+','+(b.c&255)+')';}function QP(a,b){if(a<0||a>b){throw dG(new JH('Index: '+a+', Size: '+b));}}function NP(a,b){if(a<0||a>=b){throw dG(new JH('Index: '+a+', Size: '+b));}}function TP(a,b,c){if(a<0||b>c||ba.b+a.i&&BH(b,a.b+a.i)>=53){c=a.b+a.i-1;OB(a,b,c);}}function qe(a,b){var c;c=bl(a.L,b);while(c>19!=1&&(a.s[b]&zR)>>19!=2?-1:(a.s[b]&AR)>>21;}function Ii(a,b){return(a.C[b]&BR)>>10!=1&&(a.C[b]&BR)>>10!=2?-1:(a.C[b]&CR)>>12;}function WB(a){return a.__elementTypeCategory$==null?10:a.__elementTypeCategory$;}function EO(){EO=FG;AO=new FO('All',0);BO=new JO();CO=new LO();DO=new OO();}function DP(){DP=FG;new JP();new FP('ISO-LATIN-1');new FP('ISO-8859-1');}function Vn(){this.b=8;this.v=new LM();this.H=new SO(new nA());this.c=new SO(new nA());}function Wn(){this.b=1;this.v=new LM();this.H=new SO(new nA());this.c=new SO(new nA());}function YG(a,b,c,d){this.c=(d&255)<<24|(a&255)<<16|(b&255)<<8|c&255;aH(a,b,c,d);}function Fm(a,b){var c,d;d=kK(a.a,b);for(c=d.length;c<10;c++)TJ(a.b,32);WJ(a.b,d);}function el(a,b){var c,d;c=0;for(d=a.g[b];d=d)c-=d;while(c<0)c+=d;return c;}function Bg(a,b,c){var d,e;d=0;for(e=0;e>24;}function Pj(a,b,c){a.t==null&&(a.t=ZB(_C,mR,7,a.K,0,2));xN(c);a.t[b]=c;a.Q=0;a.I=true;}function cm(a,b,c){var d;d=wk(a,b,c);if(d&&c==26){Xo(a,3);d=d&(a.C[b]&128)==0;}return d;}function eI(a){var b;b=new cI();b.k='Class$'+(a?'S'+a:''+b.g);b.b=b.k;b.i=b.k;return b;}function cG(a){var b;if(PC(a,14)){return a;}b=a&&a[pQ];if(!b){b=new MA(a);jB(b);}return b;}function Sk(a){var b,c;Xo(a,3);b=0;for(c=0;c0)return true;return false;}function Ri(a,b){var c;c=a.A[b]>16&255)+','+(b.c>>8&255)+','+(b.c&255)+')';}function JC(){JC=FG;FC=fC(OR,OR,524287);GC=fC(0,0,tQ);HC=dC(1);dC(2);IC=dC(0);}function SC(a){return a!=null&&(typeof a===fQ||typeof a==='function')&&!(a.Lb===IG);}function AG(a,b){typeof window===fQ&&typeof window['$gwt']===fQ&&(window['$gwt'][a]=b);}function EG(a,b){for(var c in b){b[c]['configurable']=true;}Object.defineProperties(a,b);}function xq(a,b){var c;for(c=0;c=d;e&&(a-=d);f=b/32|0;c=f*a/(d-a);return e?-c:c;}function rG(a){var b,c,d,e;e=a;d=0;if(e<0){e+=YT;d=VT;}c=WC(e/XT);b=WC(e-c*XT);return fC(b,c,d);}function lB(a){var b=/function(?:\s+([\w$]+))?\s*\(/;var c=b.exec(a);return c&&c[1]||gQ;}function _h(a,b){var c;if(b.length==0)return null;for(c=0;c0)return(a[b]+a[b-1])/2;c=MQ+(a[0]+a[a.length-1])/2;return c>MQ?c-LQ:c;}function qC(a,b){var c,d,e;c=a.l+b.l;d=a.m+b.m+(c>>22);e=a.h+b.h+(d>>22);return fC(c&OR,d&OR,e&VT);}function AC(a,b){var c,d,e;c=a.l-b.l;d=a.m-b.m+(c>>22);e=a.h-b.h+(d>>22);return fC(c&OR,d&OR,e&VT);}function km(a,b,c){var d,e;return b==null?null:lm(a,IP((e=b,DP(),e)),c==null?null:IP((d=c,d)));}function rO(a,b){var c;this.c=a;c=new LM();YN(a,c,b,a.b,null,false,null,false);this.a=new YK(c,0);}function ig(a,b){var c;for(c=0;cb&&(a.a+=PJ(ZB(YC,gR,6,-b,15,1)));}function JB(a,b){var c,d,e;e=a.a.length;for(d=0;d=48&&c<=57&&DH(a,d,c-48+b&AQ);}}function oj(a,b){var c;c=a.A[b];return c==1||c>=5&&c<=9||c>=14&&c<=17||c>=33&&c<=35||c>=52&&c<=53;}function vC(a){var b,c,d;b=~a.l+1&OR;c=~a.m+(b==0?1:0)&OR;d=~a.h+(b==0&&c==0?1:0)&VT;return fC(b,c,d);}function wq(a){var b,c;c=ZB(_C,DQ,6,qq.length+2,15,1);Xo(a,3);for(b=0;b0&&++c;return c;}function aO(a,b,c){var d,e;d=new xO(b,c);e=new yO();a.b=$N(a,a.b,d,e);e.b||++a.c;a.b.b=false;return e.d;}function Yz(a,b){if(b){!a.c&&(a.c=new om(true));return a.c;}else{!a.b&&(a.b=new om(false));return a.b;}}function QH(a){if(DJ(typeof a,nQ)){return true;}return a!=null&&a.$implements__java_lang_CharSequence;}function aC(a,b,c,d,e){e.Jb=a;e.Kb=b;e.Lb=IG;e.__elementTypeId$=c;e.__elementTypeCategory$=d;return e;}function kd(a,b,c,d,e){yM(a.T,new tH(b-a.O,c-a.O,2*a.O,2*a.O));e&&yM(a.N,new Ed(b,c,$c(a,d)?-3:a.o[d]));}function jh(a,b){return $wnd.Math.sqrt((b.a-a.a)*(b.a-a.a)+(b.b-a.b)*(b.b-a.b)+(b.c-a.c)*(b.c-a.c));}function ok(a,b){a.B[0]=hN(a.B[0],b);a.B[1]=hN(a.B[1],b);a.F=hN(a.F,b);a.C=hN(a.C,b);a.D=hN(a.D,b);a.L=b;}function lC(a){var b,c,d;b=~a.l+1&OR;c=~a.m+(b==0?1:0)&OR;d=~a.h+(b==0&&c==0?1:0)&VT;a.l=b;a.m=c;a.h=d;}function mC(a){var b,c;c=VI(a.h);if(c==32){b=VI(a.m);return b==32?VI(a.l)+32:b+20-10;}else{return c-12;}}function AM(a,b){var c,d;c=b.toArray();d=c.length;if(d==0){return false;}AP(a.a,a.a.length,c);return true;}function gg(a,b){var c;for(c=0;cb){return 1;}if(a==b){return 0;}return isNaN(a)?isNaN(b)?0:1:-1;}function DA(a){var b;if(a!=null){b=a[pQ];if(b){return b;}}return TC(a,$wnd.TypeError)?new qJ(a):new IA(a);}function wA(a){var b,c,d,e;for(b=(a.g==null&&(a.g=(iB(),e=hB.qb(a),kB(e))),a.g),c=0,d=b.length;ce.c&&be.d&&c0){for(e=d;e>=1;--c;--a.p;}}function fe(a,b){if(Ah(a)==-1||Ah(b)==-1)return 3;if(((Ah(a)|Ah(b))&1)!=0)return 3;return Ah(a)==Ah(b)?1:2;}function Pm(a){if(a.indexOf('ATOMS=(')!=-1)return LR;if(a.indexOf('BONDS=(')!=-1)return'BONDS';return null;}function op(a,b){var c,d;c=So(a,b);if(c==-1)return-1;d=a.b.a.length;yM(a.b,b);xM(a.a,c,new QI(d));return d;}function Lp(a){Ip();var b,c;Xo(a,1);c=0;for(b=0;b>24;}}}function ei(a){var b,c;c=false;for(b=0;b-129&&a<128){b=a+128;c=($I(),ZI)[b];!c&&(c=ZI[b]=new QI(a));return c;}return new QI(a);}function qK(a,b){var c,d,e;OP(b);c=false;for(d=a.yb();d.Bb();){e=d.Cb();if(b.contains(e)){d.Db();c=true;}}return c;}function xp(a,b){if(a.A[b]!=6)return false;if(a.q[b]!=0)return false;if(ml(a,b)+a.g[b]!=4)return false;return true;}function TH(a){if(a>=48&&a<58){return a-48;}if(a>=97&&a<97){return a-97+10;}if(a>=65&&a<65){return a-65+10;}return-1;}function Mi(a,b){switch(a.F[b]&103){case 1:case 64:return 1;case 2:return 2;case 4:return 3;default:return 0;}}function eG(a,b){var c;if(kG(a)&&kG(b)){c=a+b;if(ZT3)return false;++a.q[b];}else{if(a.q[b]<-3)return false;--a.q[b];}a.Q=0;return true;}function up(a,b,c){var d,e;d=XB(kF,[iQ,vR],[28,2],6,[a.d,b],2);Xo(a,3);for(e=0;ea[d]&&(e=!e);b[f]>b[d]&&(e=!e);}}return e;}function Vi(a,b){var c,d,e,f;f=3;for(d=0;d<2;d++){c=a.B[d][b];e=Mi(a,b)+(Ui(a,c)+Si(a,c))-ol(a,c);f>e&&(f=e);}return f;}function sq(a,b){var c,d;c=wq(a);for(d=0;d1&&RJ(b,''+a.b[c]);}return b.a;}function _c(a){var b;a.p=ZB(aG,HQ,6,a.G.o,16,1);for(b=0;b=d||bb&&d.eb(a[f-1],a[f])>0;--f){g=a[f];a[f]=a[f-1];a[f-1]=g;}}}function qo(a,b,c,d){var e;e='';xo(a,e);}function Oo(a,b,c,d){if(a.b)return;if(a.g==4||a.g==3&&a.c!=-1){a.b=true;return;}a.i[a.g]=d;a.f[a.g]=b;a.j[a.g]=c;++a.g;}function ih(a,b){if(a.a!=b.a)return a.ac){throw dG(new JH(BQ+a+CQ+b+', size: '+c));}if(a>b){throw dG(new NI(BQ+a+' > toIndex: '+b));}}function ak(a,b,c){if(c>=0&&c<=190){if(c==151||c==152){a.A[b]=1;a.v[b]=c-149;}else{a.A[b]=c;a.v[b]=0;}a.s[b]&=268435455;a.Q=0;}}function mj(a,b){var c;c=a.A[b];return c>=3&&c<=4||c>=11&&c<=13||c>=19&&c<=31||c>=37&&c<=51||c>=55&&c<=84||c>=87&&c<=103;}function wg(a,b){var c,d;d=0;uN(a,0,a.length,null);for(c=0;c0?NQ:ZQ;return e;}function Nn(a,b){var c,d,e,f;e=0;f=0;while(e>>28)-1;c==-1&&(c=(d=a.A[b]0&&gG(a,128)<0){b=tG(a)+128;c=(jJ(),iJ)[b];!c&&(c=iJ[b]=new aJ(a));return c;}return new aJ(a);}function oK(a,b,c){var d,e;for(e=a.yb();e.Bb();){d=e.Cb();if(VC(b)===VC(d)||b!=null&&pc(b,d)){c&&e.Db();return true;}}return false;}function hf(a,b,c){var d,e;a.N=b;for(d=0;d>16-c+b;a.e<<=1;--b;--a.c;}return d;}function Sc(a,b){var c,d;for(d=0;d=f&&c>=g&&b+d<=f+a.b&&c+e<=g+a.a;}function ql(a,b,c,d){var e,f;Xo(a,1);for(e=0;e=55296&&d<=56319&&b3.4028234663852886E38){return Infinity;}else if(b<-3.4028234663852886E38){return-Infinity;}return b;}function tI(a){var b;b=typeof a;if(DJ(b,lQ)||DJ(b,mQ)||DJ(b,nQ)){return true;}return a!=null&&a.$implements__java_lang_Comparable;}function Np(){Np=FG;Mp=aC(VB(kF,1),vR,2,6,['Actelion No','ID','IDNUMBER','COMPOUND_ID','NAME','COMPND']);}function iA(){iA=FG;hA=aC(VB($C,1),gR,6,15,[0.29899999499320984,0.5870000123977661,0.11400000005960464]);}function Re(a,b){var c,d,e,f;c=b/2|0;e=a<0;a=$wnd.Math.abs(a);f=b/32|0;d=mJ(c-1,tG(jG($wnd.Math.round(a*c/(a+f)))));return e?c+d:d;}function Ak(a,b,c,d){Gh();var e,f,g;f=c-a;g=d-b;if(g!=0){e=$wnd.Math.atan(f/g);g<0&&(f<0?e-=MQ:e+=MQ);}else e=f>0?NQ:ZQ;return e;}function Li(a,b,c){var d;for(d=0;d2000){RA=a;SA=$wnd.setTimeout(_A,10);}}if(QA++==0){cB((bB(),aB));return true;}return false;}function Dk(a){Gh();switch(a){case 7:case 8:case 9:case 15:case 16:case 17:case 33:case 34:case 35:case 53:return true;}return false;}function Co(a){switch(a){case 5:case 6:case 7:case 8:case 9:case 15:case 16:case 17:case 36:case 53:return true;default:return false;}}function Zf(a,b,c,d,e,f,g,h,i,j){this.i=a;this.a=b;this.f=c;this.o=d;this.c=e;this.k=f;this.j=g;this.p=h;this.d=i;this.n=j;Mf(this);}function cn(b){var c;try{return $p((new aq(),b.a));}catch(a){a=cG(a);if(PC(a,12)){c=a;vA(c,(cK(),bK),'');return-999;}else throw dG(a);}}function DB(a,b,c){if(a.d==0){b.a=b.a.substr(0,0)+'0'+KJ(b.a,0);++a.b;++a.d;}if(a.b0){$wnd.Error.stackTraceLimit=Error.stackTraceLimit=64;return true;}return'stack'in new Error();}function qI(a,b){var c=0;while(!b[c]||b[c]==''){c++;}var d=b[c++];for(;cc)return false;}return true;}function Lf(a,b,c){var d,e,f,g,h;e=0;g=0;for(h=0;h0);if((b&-b)==b){return WC(b*PN(a)*4.6566128730773926E-10);}do{c=PN(a);d=c%b;}while(c-d+(b-1)<0);return WC(d);}function Nj(a,b,c){c!=null&&c.length==0&&(c=null);if(c==null){a.r!=null&&(a.r[b]=null);}else{a.r==null&&(a.r=ZB(XC,xR,13,a.K,0,2));a.r[b]=c;}}function fv(a,b){var e,f;ou();b=b||{};var c=!b.noCoordinates;var d=!b.noStereo;return e=new qu(),Io(aA(nu),e.a,IP((f=a,DP(),f)),d),c&&pu(e),e;}function of(a){var b,c;for(b=0;be&&(b[e]=null);return b;}function sg(a,b,c){var d,e,f;f=b.length;d=new hh(a,a.i,f);d.c[0]=0;d.d[0]=0;for(e=0;e=0&&a<=1114111);if(a>=zQ){b[c++]=55296+(a-zQ>>10&1023)&AQ;b[c]=56320+(a-zQ&1023)&AQ;return 2;}else{b[c]=a&AQ;return 1;}}function Um(a,b){var c,d,e;if(!a.c){if(DJ(b.substr(0,6),'COUNTS')){c=Nm(b,Om(b,7));d=xI(LJ(b,7,Om(b,7)));e=xI(LJ(b,c,Om(b,c)));a.c=new lp(d,e);}}}function NC(a,b){if(UC(a)){return!!MC[b];}else if(a.Kb){return!!a.Kb[b];}else if(RC(a)){return!!LC[b];}else if(QC(a)){return!!KC[b];}return false;}function Jo(a,b){var c,d,e;Pi(a.b,b)==1&&jk(a.b,b,2);for(d=0;d<2;d++){c=Ei(a.b,d,b);Sj(a.b,c,false);for(e=0;e=6)for(c=0;ce||c>d){throw dG(new IH());}c>0&&yP(a,0,b,0,c,true);}function eL(a,b){var c,d,e;for(d=new qO(new vO(a).b);RK(d.a);){c=d.b=SK(d.a);e=c.Gb();if(VC(b)===VC(e)||b!=null&&pc(b,e)){return true;}}return false;}function QB(a,b,c){if(!b){throw dG(new NI('Unknown currency code'));}this.s=a;this.a=b;LB(this,this.s);if(!c&&this.g){this.n=this.a[2]&7;this.i=this.n;}}function MJ(a){var b,c,d;c=a.length;d=0;while(dd&&a.charCodeAt(b-1)<=32){--b;}return d>0||b>24;a.j[e]=c<<24>>24;}}}function Ek(a){Gh();if(a==1||a==6)return false;if(Dk(a))return false;if(a==2||a==10||a==18||a==36||a==54)return false;if(a>103)return false;return true;}function lm(a,b,c){var d,e,f,g,h;if(b==null)return null;hm(a,b,0);d=gm(a,4);g=gm(a,4);d>8&&(d=g);e=gm(a,d);f=gm(a,g);h=new lp(e,f);nm(a,h,b,c);return h;}function kC(a,b){var c,d,e;if(b<=22){c=a.l&(1<>22);e+=d>>22;if(e<0){return false;}a.l=c&OR;a.m=d&OR;a.h=e&VT;return true;}function NN(){NN=FG;var a,b,c,d;KN=ZB(ZC,GQ,6,25,15,1);LN=ZB(ZC,GQ,6,33,15,1);d=dU;for(b=32;b>=0;b--){LN[b]=d;d*=0.5;}c=1;for(a=24;a>=0;a--){KN[a]=c;c*=0.5;}}function Up(a){var b;if(a.e)return a.e;a.e=Km(new _m(),(b=a.f.a,b));!!a.e&&(a.e.M==null||a.e.M.length==0)&&pk(a.e,a.d==-1||a.b==null?null:a.b[a.d]);return a.e;}function ZN(a,b,c,d,e,f,g){var h,i;if(b.Hb()&&(i=a.a.eb(c,d),i<0||!e&&i==0)){return false;}if(b.Ib()&&(h=a.a.eb(c,f),h>0||!g&&h==0)){return false;}return true;}function tn(a,b,c){var d,e,f;f=b.length;for(e=0;ef)&&(a.a[b[e]]=f);for(d=0;df)&&(a.b[c[d]]=f);}function nd(a,b,c){var d;d=b==0?LQ+a[0]-a[a.length-1]:a[b]-a[b-1];c>-2.0943951023931953&&c';yM(a.a,e);}function Gd(a){var b,c,d;a.e=0;d=ZB(aG,HQ,6,a.d.d,16,1);for(b=0;b>19;j=b.h>>19;if(i!=j){return j-i;}e=a.h;h=b.h;if(e!=h){return e-h;}d=a.m;g=b.m;if(d!=g){return d-g;}c=a.l;f=b.l;return c-f;}function dH(e,a){var b=cH;if(!b){b=$doc.createElement('canvas');cH=b;}var c=''+e.b+'px '+e.a;var d=b.getContext('2d');d.font=c;var a=d.measureText(a);return a.width;}function cf(a,b){var c,d,e;if(Tk(a.L,b)<2)return false;if(bl(a.L,b)==2)return true;c=0;for(e=0;e1;}function Jd(a,b){var c,d,e,f;if(Pi(a.d,b)==1){jk(a.d,b,2);a.e+=2;}for(e=0;e<2;e++){c=Ei(a.d,e,b);for(f=0;f=5&&c<=9||c>=14&&c<=17||c>=33&&c<=35||c>=52&&c<=53||a.A[b]==13;}function EB(a,b){var c,d;c=a.b+a.n;if(a.da.d&&(d=a.d);while(d>c&&yJ(b.a,d-1)==48){--d;}if(d=0){e=yJ(b.a,c);if(e==57){DH(b,c--,48);}else{DH(b,c,e+1&AQ);d=false;}}if(d){b.a=b.a.substr(0,0)+'1'+KJ(b.a,0);++a.b;++a.d;}}function zG(b,c,d,e){yG();var f=wG;$moduleName=c;$moduleBase=d;bG=e;function g(){for(var a=0;a=0;d--){if(DJ(a[d].d,b)||DJ(a[d].d,c)){a.length>=d+1&&(a.splice(0,d+1),undefined);break;}}return a;}function wI(a){uI==null&&(uI=/^\s*[+-]?(NaN|Infinity|((\d+\.?\d*)|(\.\d+))([eE][+-]?\d+)?[dDfF]?)\s*$/);if(!uI.test(a)){throw dG(new tJ(qQ+a+'"'));}return parseFloat(a);}function Lh(a,b,c,d,e,f,g){var h;h=fi(a,b,c);if(h==-1){a.o>=a.K&&nk(a,a.K*2);h=Ih(a,d);kh(a.H[h],b,c,0);a.v[h]=e;Hj(a,h,f);Wj(a,h,g);return true;}return Rh(a,h,d,e,f,g);}function Cd(a,b){var c,d;if(a.G.o==0)return null;Bd(a);c=a.K.c*Bi(a.G);d=new xh(a.t,b,c);if(d.c==1&&d.a==0&&d.b==0){d=null;}else{qh(d,a.K);sh(d,a.t);}yd(a,b,c,zQ);return d;}function Rl(a,b){var c,d,e,f,g,h,i,j;i=-1;d=0;for(g=0;g<2;g++){c=a.f[b][g];for(h=0;h=171&&a.A[b]<=190&&a.c[b]>2&&(d-=(a.c[b]-2)*Eh[1]);}return d;}function Pc(a,b,c,d){if(fj(a.G,$k(a.G,c,d))){zd(a,-3);no(a,b);zd(a,a.J);}else if(a.o[c]!==a.o[d]){Mc(a,b,c,d);}else if(a.o[c]!=0){zd(a,a.o[c]);no(a,b);zd(a,a.J);}else{no(a,b);}}function xk(a,b,c,d){var e,f,g;for(e=0;e>>1&1431655765);a=(a&858993459)+(a>>>2&858993459);a=(a&117901063)+(a>>>4&117901063);a=(a&983055)+(a>>>8&983055);return(a&31)+(a>>>16);}function sp(a){var b,c,d,e;rp(a);d=a.o;c=ZB(kF,vR,2,d,6,1);for(b=0;b>16&255)+FQ*((b.c>>16&255)-(a.c>>16&255))),WC((a.c>>8&255)+FQ*((b.c>>8&255)-(a.c>>8&255))),WC((a.c&255)+FQ*((b.c&255)-(a.c&255))));}function no(a,b){var c,d,e,f,g;d=WC(b.a);e=WC(b.b);f=WC(b.c);g=WC(b.d);c='';xo(a,c);}function $p(b){var c,d,e,f;d=0;Ql(b);Xo(b,3);for(c=0;c1&&Ge(c,d,g,j);}return false;}function Gm(a,b){var c,d,e;if(b<0||b>999){WJ(a.b,' ?');return;}c=false;for(d=0;d<3;d++){e=b/100|0;if(e==0){d==2||c?TJ(a.b,48):TJ(a.b,32);}else{TJ(a.b,48+e&AQ);c=true;}b=10*(b%100);}}function qH(a,b){var c,d,e,f,g;c=new sH();d=$wnd.Math.min(a.c,b.c);e=$wnd.Math.min(a.d,b.d);f=$wnd.Math.max(a.c+a.b,b.c+b.b);g=$wnd.Math.max(a.d+a.a,b.d+b.a);lH(c,d,e,f,g);return c;}function OJ(a){var b,c;if(a>=zQ){b=55296+(a-zQ>>10&1023)&AQ;c=56320+(a-zQ&1023)&AQ;return String.fromCharCode(b)+(''+String.fromCharCode(c));}else{return String.fromCharCode(a&AQ);}}function Sl(a,b){var c,d,e,f,g,h,i,j;i=-1;d=0;for(g=0;g<2;g++){c=a.B[g][b];for(h=0;h0&&(d[c/32|0]|=1<<31-c%32);}return d;}function ld(a,b,c,d,e,f){var g,h,i,j,k;if(f){h=(g=(i=dH(a.e,d),new tH(0,0,i,0)).b,g);j=h/2+(a.j/8|0);k=a.j/2|0;(d=='+'||d=='-')&&(k=k*2/3);yM(a.T,new tH(b-j,c-k,2*j,2*k));}e&&po(a,d,b,c);}function Jc(a){var b,c;if((a.B&32)!=0)return;c=$o(a.G);if(c!=null){if(a.u.a==0&&a.u.b==0){b=a.K.c*Bi(a.G);Bd(a);Sc(a,b);yd(a,null,b,0);}vo(a,WC(a.v));zd(a,448);po(a,c,a.u.a,a.u.b+FQ*a.v);}}function Ke(a){var b,c;c=XB(_C,[iQ,mR],[23,7],0,[2,32],2);for(b=0;b0?1:0;while(f.a[e]!=c){f=f.a[e];e=a.a.eb(c.c,f.c)>0?1:0;}f.a[e]=d;d.b=c.b;d.a[0]=c.a[0];d.a[1]=c.a[1];c.a[0]=null;c.a[1]=null;}function nn(a,b){var c,d,e,f,g;f=b.length;g=ZB(_C,DQ,6,f,15,1);for(d=0;da.length?-1:0;}function wk(a,b,c){var d,e;e=c&103;d=Vi(a,b);switch(e){case 1:case 64:return d>=1;case 2:return d>=2;case 4:return d>=3;case 32:return mj(a,a.B[0][b])^mj(a,a.B[1][b]);default:return false;}}function ri(a,b){var c,d,e;if(a.t==null||a.t[b]==null)return(a.w[b]&1)!=0?'':Ch[a.A[b]];e='';for(d=0;d0&&(e=(OP(e),e+(OP(','),',')));c=a.t[b][d];e=BJ(e,Ch[c]);}return e;}function Bn(a,b,c){var d,e,f;if(a.a){for(e=new dN(a.a);e.ad.c)return false;}}}return true;}function Un(a,b,c,d,e,f){var g,h;g=al(a.d,a.o[b],d);if(g!=a.q[b]){h=cl(a.d,a.o[b],d);if(!f[h]&&!ej(a.d,h)){a.o[++c]=g;a.q[c]=a.o[b];a.r[c]=h;f[h]=true;e[g]?a.p[c]=true:e[g]=true;}}return c;}function xC(a,b){var c,d,e;b&=63;if(b<22){c=a.l<>22-b;e=a.h<>22-b;}else if(b<44){c=0;d=a.l<>44-b;}else{c=0;d=0;e=a.l<>>b;e=a.m>>b|c<<22-b;d=a.l>>b|a.m<<22-b;}else if(b<44){f=0;e=c>>>b-22;d=a.m>>b-22|a.h<<44-b;}else{f=0;e=0;d=c>>>b-44;}return fC(d&OR,e&OR,f&VT);}function fJ(a){var b,c;if(gG(sQ,a)<=0&&gG(a,oQ)<=0){return tG(a).toString(16);}b=ZB(YC,gR,6,17,15,1);c=17;do{b[--c]=UH(tG(a)&15);a=hG(zC(kG(a)?rG(a):a,4));}while(gG(a,0)!=0);return QJ(b,c,17-c);}function dv(a,b){ou();var c;typeof b===TT&&(b=true);if(typeof b===lQ){c=new ru(jm(Yz(nu,false),a));b===true&&c.inventCoordinates();}else typeof b===nQ&&(c=new ru(km(Yz(nu,false),a,b)));return c;}function gB(b,c){var d,e,f,g;for(e=0,f=b.length;e=a.K&&nk(a,a.K*2);a.A[a.o]=0;ak(a,a.o,b);a.q[a.o]=0;a.s[a.o]=0;a.w[a.o]=0;a.u[a.o]=0;kh(a.H[a.o],0,0,0);a.t!=null&&(a.t[a.o]=null);a.r!=null&&(a.r[a.o]=null);a.Q=0;return a.o++;}function Kh(a,b){var c,d,e,f,g;a.I=a.I|b.I;d=ZB(_C,DQ,6,b.o,15,1);f=Dj(a,1);g=Dj(a,2);for(c=0;c16&&(b-=7);d[e]<<=4;d[e]+=b;}return d;}function LA(a){var b;if(a.c==null){b=VC(a.b)===VC(JA)?null:a.b;a.d=b==null?rQ:SC(b)?b==null?null:b.name:UC(b)?'String':bI(rc(b));a.a=a.a+': '+(SC(b)?b==null?null:b.message:b+'');a.c='('+a.d+') '+a.a;}}function yk(a,b,c){var d,e,f;a.R=b;a.S=c;a.N=ZB(ZC,GQ,6,a.o,15,1);a.O=ZB(ZC,GQ,6,a.o,15,1);for(d=0;de?f:e;}function UG(a){var b;b=ZB($C,gR,6,4,15,1);if(a.b==null){b[0]=(a.c>>16&255)/255;b[1]=(a.c>>8&255)/255;b[2]=(a.c&255)/255;b[3]=(a.c>>24&255)/255;}else{b[0]=a.b[0];b[1]=a.b[1];b[2]=a.b[2];b[3]=a.a;}return b;}function PN(a){var b,c,d,e,f,g;e=a.a*jU+a.b*1502;g=a.b*jU+11;b=$wnd.Math.floor(g*kU);e+=b;g-=b*GR;e%=GR;a.a=e;a.b=g;d=a.a*128;f=$wnd.Math.floor(a.b*LN[31]);c=d+f;c>=2147483648&&(c-=4294967296);return c;}function Mc(a,b,c,d){var e,f;e=new Fd();f=new Fd();e.a=b.a;e.c=b.c;e.b=(b.a+b.b)/2;e.d=(b.c+b.d)/2;f.a=e.b;f.c=e.d;f.b=b.b;f.d=b.d;if(vd(a,e)){zd(a,a.o[c]);no(a,e);}if(vd(a,f)){zd(a,a.o[d]);no(a,f);}zd(a,a.J);}function $h(a,b,c){var d,e;d=fi(a,b,c);if(d!=-1){(a.s[d]&512)!=0?ei(a):Zh(a,d);a.Q=0;return true;}e=gi(a,b,c);if(e!=-1){(a.s[a.B[0][e]]&a.s[a.B[1][e]]&512)!=0?ei(a):bi(a,e);a.Q=0;return true;}return false;}function oo(a,b,c,d){var e,f;f=new _J('');xo(a,f.a);}function Mk(a,b){var c,d,e,f,g;c=-1;if(a.k[b]==1){for(f=0;f>1);vN(b,a,i,j,-e,f);vN(b,a,j,h,-e,f);if(f.eb(a[j-1],a[j])<=0){while(c>>28)-1;(d==-1||d>=1;if(e>=f){e-=d;continue;}c=zJ(b,BM(a.c,e));if(c==0)return e;if(d==0)break;c<0?e-=d:e+=d;}return-1;}function pj(a){var b;for(b=0;b'+b+'<\/text>';xo(a,f);}function pd(a,b){var c,d,e,f,g,h,i;c=ZB(ZC,GQ,6,Qk(a.G,b),15,1);for(e=0;e';yM(a.b,h);}function Hj(a,b,c){var d;if(c>=-1&&c<=14){a.s[b]&=268435455;c!=(d=a.A[b]0&&d1;d--){c=false;for(f=1;fg)&&(e=g);h[d]=xI(a.substr(f,e-f));}return h;}function io(a){$n();var b,c,d,e,f,g;if(a==null)return null;b=ZB(XC,pR,6,a.length*8,15,1);for(d=0;d=0;e--){c=g&15;c>9&&(c+=7);b[d*8+e]=48+c<<24>>24;g>>=4;}}return PJ(GP(b,0,(f=b.length,DP(),f)));}function VI(a){var b,c,d;if(a<0){return 0;}else if(a==0){return 32;}else{d=-(a>>16);b=d>>16&16;c=16-b;a=a>>b;d=a-256;b=d>>16&8;c+=b;a<<=b;d=a-xQ;b=d>>16&4;c+=b;a<<=b;d=a-yQ;b=d>>16&2;c+=b;a<<=b;d=a>>14;b=d&~(d>>1);return c+2-b;}}function nk(a,b){var c,d;a.A=hN(a.A,b);a.q=hN(a.q,b);a.u=hN(a.u,b);d=a.H.length;a.H=iN(a.H,b);for(c=d;c0?NQ:ZQ;else{f=$wnd.Math.atan(g/c);c<0&&(f+=MQ);}e=$wnd.Math.sqrt(g*g+c*c)/b;return new pm(f,e);}function Mj(a,b,c){var d,e;if(c!=null){if(c.length==0)c=null;else{d=Ck(c);if(d!=0&&DJ(c,Ch[d])||DJ(c,'?')){ak(a,b,d);c=null;}}}if(c==null){a.r!=null&&(a.r[b]=null);}else{a.r==null&&(a.r=ZB(XC,xR,13,a.K,0,2));a.r[b]=IP((e=c,DP(),e));}}function sf(a,b){var c,d,e,f;if(a.d!=b.d)return a.d>b.d?1:-1;e=a.a.length;f=b.a.length;c=eb.a[f]?1:-1;}if(e!=f)return e>f?1:-1;if(a.b!=b.b)return a.b>b.b?1:-1;return 0;}function Mh(a,b,c,d){var e;for(e=0;e=a.L&&ok(a,a.L*2);a.B[0][a.p]=b;a.B[1][a.p]=c;a.F[a.p]=d;a.C[a.p]=0;a.D[a.p]=0;a.Q=0;return a.p++;}function ci(a){var b,c,d;d=false;for(b=0;ba.K)nk(a,a.K*2);while(a.p+d>a.L)ok(a,a.L*2);f=fi(a,b,c);if(f!=-1)return Oh(a,f,d,e);g=gi(a,b,c);if(g!=-1)return Ph(a,g,d,e);f=Hh(a,b,c,0);h=MQ*(d-2)/d;wj(a,f,d,f,e,0,MQ-h);a.Q=0;return true;}function Ro(a,b,c,d,e,f){this.k=a;if(d!=0&&d!=1){this.b=true;}else{this.a=b;this.c=c;this.d=d;this.e=f;this.g=0;this.i=ZB(aG,HQ,6,4,16,1);this.f=ZB(_C,DQ,6,4,15,1);this.j=ZB(_C,DQ,6,4,15,1);if(c!=-1&&d==1){Oo(this,oQ,e,true);this.d=0;}}}function bf(a,b){var c,d,e,f,g,h,i;i=tl(a.L);for(c=0;c0){f+=jq(dq,e);++d;}}b=d==0?-1:f/$wnd.Math.sqrt(d);return b+'\t'+d+'\t'+a.d;}function yC(a,b){var c,d,e,f,g;b&=63;c=a.h;d=(c&tQ)!=0;d&&(c|=-1048576);if(b<22){g=c>>b;f=a.m>>b|c<<22-b;e=a.l>>b|a.m<<22-b;}else if(b<44){g=d?VT:0;f=c>>b-22;e=a.m>>b-22|c<<44-b;}else{g=d?VT:0;f=d?OR:0;e=c>>b-44;}return fC(e&OR,f&OR,g&VT);}function eg(a,b,c){var d,e,f,g,h;h=false;g=1;b[c]=1;d=true;while(d){d=false;for(e=0;e=0){return vp(g,e,b,c);}return ZB(kF,vR,2,0,6,1);}function kq(a){var b,c,d,e,f;f=new xH(new AH(a));this.a=new LM();while(true){e=wH(f);if(e==null)break;d=FJ(e,OJ(9));if(d==-1)throw dG(new FA('line without TAB'));b=e.substr(0,d);c=UP(wI(e.substr(d+1,e.length-(d+1))));yM(this.a,new lq(b,c));}}function Wl(a,b,c,d){var e,f,g,h,i;g=ZB(_C,DQ,6,a.c[b],15,1);i=gl(a,b,c,d,g);if(i==3)return false;f=(a.s[b]&3)==i?17:9;for(h=0;h>=1;if(e>=f){e-=d;continue;}c=_I(b,BM(a.a,e));if(c==0)return e;if(d==0)break;c<0?e-=d:e+=d;}e0&&++e;return-(e+1);}function Pp(b,c){var d,e,f,g;g=0;e=new pp();while(g')){d=Qp(f);d!=null&&op(e,d);}}b.c=KM(e.b,ZB(kF,vR,2,0,6,1));}function IP(a){var b,c,d,e,f,g,h;g=a.length;b=0;for(f=0;f=zQ?2:1;d<128?++b:d=zQ?2:1;h+=HP(c,h,d);}return c;}function nI(a){if(a.wb()){var b=a.c;b.xb()?a.k='['+b.j:!b.wb()?a.k='[L'+b.ub()+';':a.k='['+b.ub();a.b=b.tb()+'[]';a.i=b.vb()+'[]';return;}var c=a.f;var d=a.d;d=d.split('/');a.k=qI('.',[c,qI('$',d)]);a.b=qI('.',[c,qI('.',d)]);a.i=d[d.length-1];}function Ud(a,b){var c,d,e,f,g,h;c=false;if(a.A[b]!=8)return false;if(a.g[b]!=1)return false;g=a.f[b][0];if(a.A[g]==15){h=a.g[g];for(d=0;d255){f=true;e=' Alpha';}if(a<0||a>255){f=true;e=e+' Red';}if(b<0||b>255){f=true;e=e+' Green';}if(c<0||c>255){f=true;e=e+' Blue';}if(f){throw dG(new NI('Color parameter outside of expected range:'+e));}}function sn(a,b){var c,d,e,f,g,h;for(g=0;g<2;g++){c=Ei(a.f,g,b);if(Ai(a.f,c)==7&&bl(a.f,c)==2){d=Ei(a.f,1-g,b);for(h=0;h15){Se(a,c);b-=16;}Ne(a,1,1);Ne(a,b,4);Ne(a,j,d);for(h=0;h>g,f);}}return true;}function be(a,b,c,d,e,f,g){var h,i,j,k;j=0;for(i=0;i15){Se(a,c);b-=16;}Ne(a,1,1);Ne(a,b,4);Ne(a,j,d);for(h=0;h>g,f);}}return true;}function LB(a,b){var c,d;d=0;c=new ZJ();d+=KB(a,b,0,c,false);a.t=c.a;d+=MB(a,b,d,false);d+=KB(a,b,d,c,false);a.u=c.a;if(d=a.L&&ok(a,a.L*2);a.B[0][a.p]=b;a.B[1][a.p]=c;a.F[a.p]=d;a.C[a.p]=0;a.D[a.p]=0;a.Q=0;return a.p++;}function wl(a,b){var c,d;Xo(a,1);if(a.g[b]==2&&a.j[b][0]==2&&a.j[b][1]==2){for(c=0;c<2;c++)for(d=0;d=0;f--){d=false;g=BM(a.b,f);g.a==2?d=Sf(a,g.b,g.c,g.d,b):g.a==1&&(d=Xf(a,g.b,b));if(d){GM(a.b,g);for(h=0;h=171&&a.A[b]<=190)return 0;d=0;(a.s[b]&48)==32&&(d-=1);((a.s[b]&48)==16||(a.s[b]&48)==48)&&(d-=2);c=a.q[b];if(c==0&&a.I){(a.w[b]&PQ)==RQ&&(c=-1);(a.w[b]&PQ)==QQ&&(c=1);}a.A[b]==6?d-=c<0?-c:c:Dk(a.A[b])?d+=c:d-=c;return d;}function FB(a,b){var c,d;d=0;while(d0){b.a=b.a.substr(0,0)+''+KJ(b.a,d);a.d-=d;a.e-=d;}if(a.j>a.o&&a.j>0){a.e+=a.b-1;c=a.e%a.j;c<0&&(c+=a.j);a.b=c+1;a.e-=c;}else{a.e+=a.b-a.o;a.b=a.o;}if(a.d==1&&b.a.charCodeAt(0)==48){a.e=0;a.b=a.o;}}function So(a,b){var c,d,e,f;f=a.c.a.length;if(f==0){xM(a.c,0,b);return 0;}e=1;while(2*e<=f)e<<=1;d=e;--e;while(d!=0){d>>=1;if(e>=f){e-=d;continue;}c=zJ(b,BM(a.c,e));if(c==0)return-1;if(d==0)break;c<0?e-=d:e+=d;}e0&&++e;xM(a.c,e,b);return e;}function ZG(a,b,c,d){TG();var e,f,g,h,i,j,k,l;g=a>b?a:b;c>g&&(g=c);h=a>14;if(g!=0){if(a.A.I&&g==(Oi(a.A,c)&SQ)>>14)return true;d=false;f=tl(a.A);for(e=0;e=9223372036854775807){return JC(),FC;}e=false;if(a<0){e=true;a=-a;}d=0;if(a>=YT){d=WC(a/YT);a-=d*YT;}c=0;if(a>=XT){c=WC(a/XT);a-=c*XT;}b=WC(a);f=fC(b,c,d);e&&lC(f);return f;}function bq(a,b,c,d,e){var f,g,h,i,j,k;f=1/(1+$wnd.Math.exp(a-5));k=1-1/(1+$wnd.Math.exp(b+5));j=1/(1+$wnd.Math.exp(0.012*c-6));g=1-1/(1+$wnd.Math.exp(d));h=(0.5+f/2)*(0.5+k/2)*(0.5+j/2)*(0.5+g/2);for(i=0;e!=null&&i3&&Tk(a.b,b)>0){for(e=0;e1&&jj(a.b,c)){Pi(a.b,d)==4?jk(a.b,d,2):jk(a.b,d,1);Jj(a.b,b,ji(a.b,b)+1);Jj(a.b,c,ji(a.b,c)-1);break;}}}}}function NB(a,b){var c,d,e;if(a.b>a.d){while(a.da.o){e=a.b-a.o;for(c=0;c0){b.a=b.a.substr(0,0)+''+KJ(b.a,e);a.d-=e;a.b-=e;}}}}function Wg(a){var b,c;if(a.k)return;a.n=a.c[0];a.i=a.c[0];a.o=a.d[0];a.j=a.d[0];for(b=0;ba.c[b]-c&&(a.n=a.c[b]-c);a.ia.d[b]-c&&(a.o=a.d[b]-c);a.j=b){a.d[a.c]=pG(a.d[a.c],b);a.d[a.c]=oG(a.d[a.c],c);a.b-=b;}else{a.d[a.c]=pG(a.d[a.c],a.b);a.d[a.c]=oG(a.d[a.c],qG(c,b-a.b));b-=a.b;++a.c;a.b=63-b;a.d[a.c]=oG(a.d[a.c],fG(c,(1<h;i--)e[i]=e[i-1];e[h]=k;}j=mJ(6,a.e[d]);Ff(b[d],d);Cf(b[d],16,c[d]);Cf(b[d],(6-j)*17,0);for(f=0;f>24);}}}}}}function uq(a){var b;b=new oq();yM(b.a,new mq('The polar surface area prediction is based on an atom-type based',2));yM(b.a,new mq('increment system, published by P. Ertl, B. Rohde, P. Selzer',2));yM(b.a,new mq('in J. Med. Chem. 2000, 43, 3714-3717',2));yM(b.a,new mq(MT,2));sq(a,b);return b;}function jf(a,b){var c,d,e;c=Ei(a.L,0,b);if(c>=a.L.d)return false;if(a.W[c]==1||a.W[c]==2)return true;if(a.W[c]==3)return false;d=Nk(a.L,c);if(d!=-1)return a.k[d]==1||a.k[d]==2;for(e=0;e=0){d=e+1;d=0){a.a=LJ(a.a,0,c)+''+KJ(a.a,c+1);f-=a.a.length-c;}return f;}function $N(a,b,c,d){var e,f;if(!b){return c;}else{e=a.a.eb(c.c,b.c);if(e==0){d.d=VL(b,c.d);d.b=true;return b;}f=e<0?0:1;b.a[f]=$N(a,b.a[f],c,d);if(_N(b.a[f])){if(_N(b.a[1-f])){b.b=true;b.a[0].b=false;b.a[1].b=false;}else{_N(b.a[f].a[f])?b=gO(b,1-f):_N(b.a[f].a[1-f])&&(b=fO(b,1-f));}}}return b;}function Tc(a,b){var c,d,e,f,g,h,i;e=ZB(aG,HQ,6,a.G.o,16,1);for(d=0;da.a[d]&&++b;a.e=ZB(_C,DQ,6,b,15,1);a.b=ZB(_C,DQ,6,a.r.b,15,1);b=0;for(c=0;ca.a[c]){a.e[b]=cl(a.p,a.a[c],e);++b;}}}}function il(a,b,c){var d,e,f,g,h,i,j,k;Xo(a,1);for(e=0;e=0&&e[f]){g[f]=f;--f;}for(b=0;b<=f;b++){if(e[b]){g[b]=f;g[f]=b;--f;while(f>=0&&e[f]){g[f]=f;--f;}}else{g[b]=b;}}return g;}function Jl(a,b){var c,d,e,f,g,h;if(Mi(a,b)!=1)return false;for(f=0;f<2;f++){c=a.B[f][b];h=a.B[1-f][b];while(a.k[c]==2&&a.g[c]==2&&a.A[c]<10){for(g=0;g<2;g++){d=a.f[c][g];if(d!=h){if(a.g[d]==1)return true;e=a.i[c][g];if(Mi(a,e)==1&&e=0&&d>0){b=ZB(_C,DQ,6,16,15,1);i=a.substr(c+1,d-(c+1));e=0;g=true;while(g&&e<16){c=i.indexOf(',');if(c==-1){f=i;g=false;}else{f=i.substr(0,c);i=i.substr(c+1,i.length-(c+1));}b[e++]=Ck(f);}h=ZB(_C,DQ,6,e,15,1);dK(b,h,e);}return h;}function ze(a){var b,c,d,e;a.G=true;a.R=ZB(XC,pR,6,a.L.d,15,1);a.f=ZB(XC,pR,6,a.L.e,15,1);e=oe(a,true);while(a.Nb.d+b.a-e&&(a.u.b=b.d+b.a-e);break;case tQ:if(b){a.u.a=b.c+b.b/2;a.u.b=b.d+e;break;}case cR:a.u.a=a.t.c+a.t.b/2;a.u.b=a.t.d-e;!!b&&a.u.b0)return 3;}for(d=0;d0)return 2;}return 1;}function xI(a){var b,c,d,e,f;if(a==null){throw dG(new tJ(rQ));}d=a.length;e=d>0&&(a.charCodeAt(0)==45||a.charCodeAt(0)==43)?1:0;for(b=e;boQ){throw dG(new tJ(qQ+a+'"'));}return f;}function Ge(a,b,c,d){var e,f,g,h,i,j,k,l,m;l=c[d];g=c[d+1]-l;m=ZB(hD,fR,89,g,0,1);for(i=0;i1;k--){for(j=0;j0&&eOQ&&(h=true);h&&FB(a,c);NB(a,c);PB(a,c);IB(a,c,g,e);EB(a,c);DB(a,c,f);h&&CB(a,c);i='0'.charCodeAt(0);i!=48&&JB(c,i);YJ(c,0,b?a.q:a.t);WJ(c,b?a.r:a.u);}function Bd(a){var b,c,d,e,f;e=uh(a.K,xi(a.G,0));c=uh(a.K,xi(a.G,0));f=vh(a.K,yi(a.G,0));d=vh(a.K,yi(a.G,0));for(b=0;buh(a.K,xi(a.G,b))&&(e=uh(a.K,xi(a.G,b)));cvh(a.K,yi(a.G,b))&&(f=vh(a.K,yi(a.G,b)));d>19!=0){return'-'+DC(vC(a));}c=a;d='';while(!(c.l==0&&c.m==0&&c.h==0)){e=dC(1000000000);c=gC(c,e,true);b=''+CC(cC);if(!(c.l==0&&c.m==0&&c.h==0)){f=9-b.length;for(;f>0;f--){b='0'+b;}}d=b+d;}return d;}function DI(){DI=FG;CI=aC(VB(ZC,1),GQ,6,15,[1.3407807929942597E154,1.157920892373162E77,3.4028236692093846E38,1.8446744073709552E19,4294967296,zQ,256,16,4,2]);BI=aC(VB(ZC,1),GQ,6,15,[7.458340731200207E-155,8.636168555094445E-78,2.9387358770557188E-39,5.421010862427522E-20,2.3283064365386963E-10,dU,0.00390625,0.0625,0.25,0.5]);}function Zh(a,b){var c,d,e,f;for(c=0;c0){for(c=0;cd-f&&(e=d-f);}return e;}function Zc(a){var b,c,d,e;if(a.G.I){zd(a,320);if((a.B&8)!=0)for(b=0;b=0){b=a.indexOf(' NOT[');c=a.indexOf(']',b);if(b>=0&&c>0){return-(c+1);}else{b=a.indexOf(' [');c=a.indexOf(']',b);if(b>=0&&c>0){return c+1;}}b=a.indexOf(" 'NOT[");c=a.indexOf("]'",b);if(b>=0&&c>0){return-(c+2);}else{b=a.indexOf(" '[");c=a.indexOf("]'",b);if(b>=0&&c>0){return c+2;}}cK();}return 0;}function $e(a,b,c,d){var e,f,g;e=c==-1?$wnd.Math.abs(xi(a.L,b)-xi(a.L,a.t[0]))/8:$wnd.Math.abs(xi(a.L,b)-xi(a.L,c));da.w[e]^d>e&&(g=!g);}}}else{for(f=0;fa.w[i[1]]^i[0]>i[1]&&(g=!g);}}return g;}function Jf(a,b,c){var d,e,f,g,h,i,j,k,l;if(b==null)return;h=0;for(e=0;e1)return false;a.w[b]&=-2;a.t!=null&&(a.t[b]=null);a.r!=null&&(a.r[b]=null);if(c==a.A[b]&&d==a.v[b]&&e==((a.s[b]&yR)>>>28)-1&&f==(a.s[b]&48))return false;if(c==151||c==152){d=c-149;c=1;}a.s[b]&=960;a.A[b]=c;a.v[b]=d;a.q[b]=0;a.w[b]=0;Hj(a,b,e);Wj(a,b,f);Cj(a,a.u[b]);a.Q=0;return true;}function ul(a){var b,c,d,e,f,g,h,i,j;j=0;Xo(a,3);for(d=0;d1&&(a.s[e]&xQ)==0&&Dk(a.A[e])){h=false;break;}}}}h&&!Jl(a,d)&&++j;}}return j;}function Yc(a){var b,c,d,e,f,g;if(a.G.I){g=a.P;zd(a,-7);for(b=0;bh;i--)d[i]=d[i-1];d[h]=k;}Ff(a.b[b],b);Cf(a.b[b],16,a.c[b]);for(g=j;gg.c+g.b||f.d>g.d+g.a||g.c>f.c+f.b||g.d>f.d+f.a)continue;if(sd(a,h.a,h.c,e)){if(sd(a,h.b,h.d,e))return;wd(a,h,0,e);rd(a,h,c,d);return;}if(sd(a,h.b,h.d,e)){wd(a,h,1,e);rd(a,h,c,d);return;}}Rc(a,h,c,d);}function De(b,c){var d,e,f,g,h,i;if((b.k[c]==1||b.k[c]==2)&&!Ol(b.L,c)){h=false;try{for(g=0;g<2;g++){d=Ei(b.L,g,c);if(bl(b.L,d)==3){e=ZB(_C,DQ,6,2,15,1);f=0;for(i=0;ib.c[e[1]]^Fe(b,d,e[0],e[1])&&(h=!h);}}}catch(a){a=cG(a);if(PC(a,12)){b.f[c]=3;return;}else throw dG(a);}b.k[c]==1^h?b.f[c]=1:b.f[c]=2;}}function Qp(a){var b,c,d,e;if(a.length==0||a.charCodeAt(0)!=62)return null;d=1;e=0;b=0;while(d1||!d&&ol(a,b)>2)return false;f=0;e=ZB(ZC,GQ,6,4,15,1);for(h=0;hMQ?(e[0]+e[1])/2:(e[0]+e[1])/2+MQ;g=MQ*(c-2)/c;wj(a,b,c,b,d,j-g/2,MQ-g);a.Q=0;return true;}function Kd(a){var b,c,d,e,f,g,h,i;for(c=0;cUi(a,c)+Si(a,c))throw dG(new FA('atom valence exceeded'));b+=a.q[c];}if(b!=0)throw dG(new FA('unbalanced atom charge'));}function Xf(a,b,c){var d,e,f,g,h,i,j,k;f=a.g[b];e=1;for(i=0;i=0){h=pC(a,g);if(h){j<22?(i.l|=1<>>1;g.m=k>>>1|(l&1)<<21;g.l=m>>>1|(k&1)<<21;--j;}c&&lC(i);if(f){if(d){cC=vC(a);e&&(cC=AC(cC,(JC(),HC)));}else{cC=fC(a.l,a.m,a.h);}}return i;}function Lg(a){var b,c,d,e,f,g,h;while(true){f=null;for(b=0;bf.a.length)&&(f=g);}}if(!f)break;c=new hh(a,a.i,f.a.length);for(d=0;d4)return false;h=ZB(aG,HQ,6,4,16,1);for(g=0;g0.0872664675116539)return false;e[g]=3&WC(f/NQ);if(h[e[g]])return false;h[e[g]]=true;if((e[g]&1)==0){if(a.F[a.i[b][c[g]]]!=1)return false;}else{if(!tj(a,a.i[b][c[g]],b))return false;}}return h[0]&&h[2];}function Gl(a,b){var c,d,e,f,g,h;if(a.F[b]!=1||(a.C[b]&256)!=0||(a.C[b]&64)!=0&&(!!a.n&&b2&&++h;}for(f=0;f2&&++h;}return h>2;}function Yi(a){var b;a.Q=0;a.A=ZB(_C,DQ,6,a.K,15,1);a.q=ZB(_C,DQ,6,a.K,15,1);a.u=ZB(_C,DQ,6,a.K,15,1);a.H=ZB(sD,{196:1,4:1,10:1,5:1,18:1,8:1},65,a.K,0,1);for(b=0;b0){b[m-1]=o[b[m]];--m;}return j[n];}if(j[g]==0){i[++k]=g;j[g]=j[n]+1;o[g]=n;}}}++h;}return-1;}function ml(a,b){var c,d,e,f,g,h;if(a.I&&(a.w[b]&YQ)==0)return 0;if(!am(a,b))return 0;Xo(a,1);g=0;for(e=0;e>1;}g-=Si(a,b);f=((a.s[b]&yR)>>>28)-1;if(f==-1){if(a.A[b]>=171&&a.A[b]<=190){f=2;}else{h=a.A[b]f-g?0:f-g;}function yl(a,b,c,d,e,f){var g,h,i,j,k;Xo(a,1);if(e){di(e);e.I=false;}i=ZB(_C,DQ,6,a.o,15,1);d==null?d=ZB(aG,HQ,6,a.o,16,1):qN(d,d.length);i[0]=b;i[1]=c;d[b]=true;d[c]=true;h=1;j=1;while(h<=j){for(k=0;kb[e]){j=b[e];k=e;}}p=ZB(_C,DQ,6,m,15,1);i=k>0?k-1:m-1;l=k0&&(a.e[a.i++]='.');Do(a,e,-1);++a.a;break;}}e==c&&(f=true);}a.f='';for(e=0;e1;l--){p=f[l]-f[l-1];r=ZB(fD,fR,88,p,0,1);h=f[l];for(o=0;o4){switch(d){case 5:i|=3;break;case 6:i|=9;break;case 7:i|=10;break;case 8:i|=15;}}f==1&&(i|=32);f==2&&(i|=16);i!=0&&ik(a.c,g,i,true);return g;}function jp(a){var b,c,d,e,f,g;g=false;for(c=0;c>19==1&&(f[d]=true);for(e=0;el?k.c+k.b:k.c;j=o>n?k.d+k.a:k.d;e=m-l;f=o-n;if($wnd.Math.abs(e)>$wnd.Math.abs(f)){if(n==o){g=i;h=n;}else{g=l+e*(j-n)/f;if(m>l==i>g){h=j;}else{g=i;h=n+f*(i-l)/e;}}}else{if(l==m){g=l;h=j;}else{h=n+f*(i-l)/e;if(o>n==j>h){g=i;}else{g=l+e*(j-n)/f;h=j;}}}if(c==0){b.a=g;b.c=h;}else{b.b=g;b.d=h;}}function Fg(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;h=ZB(_C,DQ,6,a.b,15,1);i=ZB(_C,DQ,6,a.b,15,1);j=ZB(_C,DQ,6,a.b,15,1);k=ZB(_C,DQ,6,a.b,15,1);h[0]=c;j[c]=1;k[0]=-1;g=0;l=0;while(g<=l){for(m=0;m1&&g==e){o=ZB(_C,DQ,6,j[i[h]],15,1);d=i[h];for(n=0;n7)return;for(m=0;m1&&g==e){o=ZB(_C,DQ,6,j[i[h]],15,1);d=i[h];for(n=0;n2){m=true;i=-1;for(k=0;ka.j.a[d]+(f==1?zQ:0)){k=a.j.a[d]+(f==1?zQ:0);i=e;l=f;j=b[h];}}}}}for(c=0;ce/2)continue;if(q==p)j=$wnd.Math.abs(p-b);else{h=(s-r)/(p-q);i=-h*p-r;j=$wnd.Math.abs((h*b+c+i)/$wnd.Math.sqrt(h*h+1));}if(j>24;a.j[g]=c<<24>>24;}else if(a.k[g]==d&&a.j[g]==c){a.k[g]=0;a.j[g]=-1;}}}}return true;}function Dg(a,b){var c,d,e,f,g,h,i,j,k,l,m,n;e=ZB(_C,DQ,6,a.b,15,1);f=ZB(_C,DQ,6,a.b,15,1);g=ZB(_C,DQ,6,a.b,15,1);h=ZB(_C,DQ,6,a.b,15,1);e[0]=b;g[b]=1;h[0]=-1;d=0;i=0;while(d<=i){if(d==0||!a.a[e[d]]){for(j=0;j=10&&b<11;}())return'ie10';if(function(){return a.indexOf('msie')!=-1&&b>=9&&b<11;}())return'ie9';if(function(){return a.indexOf('msie')!=-1&&b>=8&&b<11;}())return'ie8';if(function(){return a.indexOf('gecko')!=-1||b>=11;}())return'gecko1_8';return'unknown';}function Pk(a){var b,c,d,e,f,g,h,i;a.n=new vn(a,7);c=ZB(_C,DQ,6,a.d,15,1);for(d=0;d3&&(a.s[b]|=BR);}for(i=0;ia.w[e[1]]^e[0]>e[1]&&(h=!h);}}return h;}function vp(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p;i=new lp(a.d,a.e);k=new _O();n=0;m=0;g=ZB(aG,HQ,6,a.d,16,1);f=ZB(_C,DQ,6,a.d,15,1);for(p=0;p3.0915926535897933&&c<3.191592653589793){a.j=-1;return a.j;}a.j=cJR){e=0;f=0;for(o=0;ob.b){md(b);c=true;}for(d=0;dh.c+h.b||g.d>h.d+h.a||h.c>g.c+g.b||h.d>g.d+g.a)continue;if(sd(a,b.a,b.c,d)){if(sd(a,b.b,b.d,d)){c&&md(b);return false;}wd(a,b,0,d);f=vd(a,b);c&&md(b);return f;}if(sd(a,b.b,b.d,d)){wd(a,b,1,d);f=vd(a,b);c&&md(b);return f;}}c&&md(b);return true;}function Wh(a,b,c,d,e,f,g){var h,i,j,k,l;i=b.p;i>=b.L&&ok(b,b.L*2);k=(a.C[c]&BR)>>10;j=-1;k==1&&(d==-1?j=Dj(b,1):j=mJ(32,d+((a.C[c]&BR)>>10!=1&&(a.C[c]&BR)>>10!=2?-1:(a.C[c]&CR)>>12)));k==2&&(e==-1?j=Dj(b,2):j=mJ(32,e+((a.C[c]&BR)>>10!=1&&(a.C[c]&BR)>>10!=2?-1:(a.C[c]&CR)>>12)));for(l=0;l<2;l++)b.B[l][i]=f==null?a.B[l][c]:f[a.B[l][c]];h=g&&(a.C[c]&512)!=0?64:a.F[c];b.F[i]=h;b.C[i]=a.C[c];b.D[i]=b.I?a.D[c]:0;if(j!=-1){b.C[i]&=-126977;b.C[i]|=j<<12;}++b.p;b.Q=0;return i;}function re(a,b){var c,d,e,f,g,h,i,j,k,l,m;f=XB(_C,[mR,DQ],[7,6],15,[2,32],2);for(g=0;g<2;g++){c=ZB(_C,mR,7,32,0,2);m=0;for(e=0;e<32;e++){if(b[g][e]!=null){k=b[g][e].length;c[e]=ZB(_C,DQ,6,k,15,1);for(h=0;h0;l--){j=0;i=null;for(d=0;d<32;d++){if(c[d]!=null){if(i==null||i.length=0;h--){if(i[h]=32)return;if(d==-1){g=-1;for(f=0;f>19&&g<((a.s[f]&zR)>>19!=1&&(a.s[f]&zR)>>19!=2?-1:(a.s[f]&AR)>>21)&&(g=(a.s[f]&zR)>>19!=1&&(a.s[f]&zR)>>19!=2?-1:(a.s[f]&AR)>>21);for(e=0;e>10&&g<((a.C[e]&BR)>>10!=1&&(a.C[e]&BR)>>10!=2?-1:(a.C[e]&CR)>>12)&&(g=(a.C[e]&BR)>>10!=1&&(a.C[e]&BR)>>10!=2?-1:(a.C[e]&CR)>>12);d=g+1;if(d>=32)return;}a.s[b]&=HR;a.s[b]|=c<<19|d<<21;}a.Q&=3;}function ek(a,b,c,d){var e,f,g;if(c==0){a.C[b]&=-130049;a.C[b]|=0;}else{if(d>=32)return;if(d==-1){g=-1;for(f=0;f>19&&g<((a.s[f]&zR)>>19!=1&&(a.s[f]&zR)>>19!=2?-1:(a.s[f]&AR)>>21)&&(g=(a.s[f]&zR)>>19!=1&&(a.s[f]&zR)>>19!=2?-1:(a.s[f]&AR)>>21);for(e=0;e>10&&g<((a.C[e]&BR)>>10!=1&&(a.C[e]&BR)>>10!=2?-1:(a.C[e]&CR)>>12)&&(g=(a.C[e]&BR)>>10!=1&&(a.C[e]&BR)>>10!=2?-1:(a.C[e]&CR)>>12);d=g+1;if(d>=32)return;}a.C[b]&=-130049;a.C[b]|=c<<10|d<<12;}a.Q&=3;}function tg(a){var b,c,d,e,f,g,h,i,j;while(a.f.a.length>1){g=ZB(ZC,GQ,6,2,15,1);f=ZB(qD,fR,29,2,0,1);b=BM(a.f,0);c=BM(a.f,1);h=(Wg(b),b.i-b.n+1+(Wg(b),b.j-b.o+1));i=(Wg(c),c.i-c.n+1+(Wg(c),c.j-c.o+1));if(h>i){f[0]=b;g[0]=h;f[1]=c;g[1]=i;}else{f[0]=c;g[0]=i;f[1]=b;g[1]=h;}for(e=2;e1&&e==c){o=new sm(i[g[f]]);h[0]=cl(a.i,g[f],l);m=f;for(n=0;n\n';g='