diff --git a/VERSION b/VERSION index 303519e7..664ba8d5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.5.0.1391 +7.6.0.1392 diff --git a/core/core.js b/core/core.js index bad0e90d..9c4a0051 100644 --- a/core/core.js +++ b/core/core.js @@ -1,6223 +1,3 @@ -"use strict"; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var _wrs_popupWindow; -/** - * Global variables (strict mode) - */ -var _wrs_conf_createimagePath; -var _wrs_conf_showimagePath; -var _wrs_conf_editorPath; -var _wrs_conf_CASPath; -var _wrs_conf_createcasimagePath; -var _wrs_conf_getmathmlPath; -var _wrs_conf_servicePath; -var _wrs_conf_path; -var _wrs_conf_editor; - -var _wrs_temporalRange; - -function wrs_getCorePath() { - var scriptName = "core/core.js"; - var col = document.getElementsByTagName("script"); - for (var i = 0; i < col.length; i++) { - var d; - var src; - d = col[i]; - src = d.src; - var j = src.lastIndexOf(scriptName); - if (j >= 0) { - // That's my script! - return src.substr(0, j - 1); - } - } -} - -var _wrs_corePath = wrs_getCorePath(); - -/** - * Fires an element event. - * @param {object} element element where event should be fired. - * @param {string} event event to fire. - * @ignore - */ -function wrs_fireEvent(element, event) { - if (document.createEvent) { - var eventObject = document.createEvent('HTMLEvents'); - eventObject.initEvent(event, true, true); - return !element.dispatchEvent(eventObject); - } - - var eventObject = document.createEventObject(); - return element.fireEvent('on' + event, eventObject); -} - -// Translated languages. -var _wrs_languages = 'ar,ca,cs,da,de,en,es,et,eu,fi,fr,gl,he,hr,hu,it,ja,ko,nl,no,pl,pt,pt_br,ru,sv,tr,zh,el'; - -// Load lang file at first to replace some variables -wrs_loadLangFile(); - -// Vars. -var _wrs_stringManager; -var _wrs_currentPath = window.location.toString().substr(0, window.location.toString().lastIndexOf('/') + 1); -var _wrs_editMode = typeof _wrs_editMode != 'undefined' ? _wrs_editMode : undefined; -var _wrs_isNewElement = typeof _wrs_isNewElement !== 'undefined' ? _wrs_isNewElement : true; -var _wrs_temporalImage; -var _wrs_temporalFocusElement; -var _wrs_range; -// TODO: String Manager not loaded. -function loadStringLatex() { - if (_wrs_conf_core_loaded) { - var _wrs_latex_formula_name = _wrs_stringManager.getString('latex_name_label'); - } else { - setTimeout(loadStringLatex, 100); - } -} -loadStringLatex(); - -var _wrs_latex_formula_number = 1; - -// Tags used for LaTeX formulas. -var _wrs_latexTags = { - 'open': '$$', - 'close': '$$' -}; -// LaTex client cache. -var _wrs_int_LatexCache = {}; -// Cache for all the mathmls withouts translation to LaTex. -var _wrs_int_nonLatexCache = {}; - -// Accessible client cache. -var _wrs_int_AccessibleCache = {}; - -var _wrs_xmlCharacters = { - 'tagOpener': '<', // Hex: \x3C. - 'tagCloser': '>', // Hex: \x3E. - 'doubleQuote': '"', // Hex: \x22. - 'ampersand': '&', // Hex: \x26. - 'quote': '\'' // Hex: \x27. -}; - -var _wrs_safeXmlCharacters = { - 'tagOpener': '«', // Hex: \xAB. - 'tagCloser': '»', // Hex: \xBB. - 'doubleQuote': '¨', // Hex: \xA8. - 'ampersand': '§', // Hex: \xA7. - 'quote': '`', // Hex: \x60. - 'realDoubleQuote': '¨' -}; - -var _wrs_safeXmlCharactersEntities = { - 'tagOpener': '«', - 'tagCloser': '»', - 'doubleQuote': '¨', - 'realDoubleQuote': '"' -}; - -var _wrs_safeBadBlackboardCharacters = { - 'ltElement': '«mo»<«/mo»', - 'gtElement': '«mo»>«/mo»', - 'ampElement': '«mo»&«/mo»' -}; - -var _wrs_safeGoodBlackboardCharacters = { - 'ltElement': '«mo»§lt;«/mo»', - 'gtElement': '«mo»§gt;«/mo»', - 'ampElement': '«mo»§amp;«/mo»' -}; - -var _wrs_staticNodeLengths = { - 'IMG': 1, - 'BR': 1 - - // Backwards compatibily. - -};if (!window._wrs_conf_imageClassName) { - var _wrs_conf_imageClassName = 'Wirisformula'; -} - -if (!window._wrs_conf_CASClassName) { - var _wrs_conf_CASClassName = 'Wiriscas'; -} - -// Mutation observers to avoid wiris image formulas class be removed. -if (typeof MutationObserver != 'undefined') { - var wrs_observer = new MutationObserver(function (mutations) { - mutations.forEach(function (mutation) { - if (mutation.oldValue == _wrs_conf_imageClassName && mutation.attributeName == 'class' && mutation.target.className.indexOf(_wrs_conf_imageClassName) == -1) { - mutation.target.className = _wrs_conf_imageClassName; - } - }); - }); - - var wrs_observer_config = { attributes: true, attributeOldValue: true }; -} - -// Plugin listeners for custom callbacks. This variable -// can be setted by the user using wrs_addPluginListener. -var wrs_pluginListeners = []; - -var _wrs_css_loaded = false; - -var _wrs_modalWindowProperties = typeof _wrs_modalWindowProperties != 'undefined' ? _wrs_modalWindowProperties : {}; -var _wrs_editor = typeof _wrs_editor != 'undefined' ? _wrs_editor : null; -var _wrs_modalWindow = typeof _wrs_modalWindow != 'undefined' ? _wrs_modalWindow : null; - -// If true all MathML should be parse despite of save mode. -var _wrs_parseXml = true; - -/** - * Adds element events. - * @param {object} target Target - * @param {function} doubleClickHandler Function to run when user double clicks the element - * @param {function} mousedownHandler Function to run when user mousedowns the element - * @param {function} mouseupHandler Function to run when user mouseups the element - * @ignore - */ -function wrs_addElementEvents(target, doubleClickHandler, mousedownHandler, mouseupHandler) { - if (doubleClickHandler) { - wrs_addEvent(target, 'dblclick', function (event) { - var realEvent = event ? event : window.event; - var element = realEvent.srcElement ? realEvent.srcElement : realEvent.target; - doubleClickHandler(target, element, realEvent); - }); - } - - if (mousedownHandler) { - wrs_addEvent(target, 'mousedown', function (event) { - var realEvent = event ? event : window.event; - var element = realEvent.srcElement ? realEvent.srcElement : realEvent.target; - _wrs_temporalFocusElement = element; - mousedownHandler(target, element, realEvent); - }); - } - - if (mouseupHandler) { - wrs_addEvent(target, 'mouseup', function (event) { - var realEvent = event ? event : window.event; - var element = realEvent.srcElement ? realEvent.srcElement : realEvent.target; - mouseupHandler(target, element, realEvent); - }); - } -} - -/** - * Cross-browser addEventListener/attachEvent function. - * @param {object} element Element target - * @param {event} event Event - * @param {function} func Function to run - * @ignore - */ -function wrs_addEvent(element, event, func) { - if (element.addEventListener) { - element.addEventListener(event, func, true); - } else if (element.attachEvent) { - element.attachEvent('on' + event, func); - } -} - -/** - * Adds iframe events. - * @param {object} iframe Target - * @param {function} doubleClickHandler Function to run when user double clicks the iframe - * @param {function} mousedownHandler Function to run when user mousedowns the iframe - * @param {function} mouseupHandler Function to run when user mouseups the iframe - * @ignore - */ -function wrs_addIframeEvents(iframe, doubleClickHandler, mousedownHandler, mouseupHandler) { - wrs_initSetSize(); - wrs_addElementEvents(iframe.contentWindow.document, function (target, element, event) { - doubleClickHandler(iframe, element, event); - }, function (target, element, event) { - mousedownHandler(iframe, element, event); - }, function (target, element, event) { - mouseupHandler(iframe, element, event); - }); -} - -/** - * Adds textarea events. - * @param {object} textarea Target - * @param {function} clickHandler Function to run when user clicks the textarea. - * @ignore - */ -function wrs_addTextareaEvents(textarea, clickHandler) { - if (clickHandler) { - wrs_addEvent(textarea, 'click', function (event) { - var realEvent = event ? event : window.event; - clickHandler(textarea, realEvent); - }); - } -} - -/** - * Converts applet code to img object. - * @param {object} creator Object with "createElement" method - * @param {string} appletCode Applet code - * @param {string} image Base 64 image stream - * @param {int} imageWidth Image width - * @param {int} imageHeight Image height - * @return object img object. - * @ignore - */ -function wrs_appletCodeToImgObject(creator, appletCode, image, imageWidth, imageHeight) { - var imageSrc = wrs_createImageCASSrc(image); - var imgObject = creator.createElement('img'); - - imgObject.src = imageSrc; - imgObject.align = 'middle'; - imgObject.width = imageWidth; - imgObject.height = imageHeight; - imgObject.setAttribute(_wrs_conf_CASMathmlAttribute, wrs_mathmlEncode(appletCode)); - imgObject.className = _wrs_conf_CASClassName; - - return imgObject; -} - -/** - * Checks if a determined array contains a determined element. - * @param {array} stack - * @param {object} element - * @return bool - * @ignore - */ -function wrs_arrayContains(stack, element) { - for (var i = stack.length - 1; i >= 0; --i) { - if (stack[i] === element) { - return i; - } - } - - return -1; -} - -/** - * Adds a specific className to given element - * @param {object} element - * @param {string} className - * @ignore - */ -function wrs_addClass(element, className) { - if (!wrs_containsClass(element, className)) { - element.className += " " + className; - } -} - -/** - * Checks if an element contains a class. - * @param {object} element - * @param {string} className - * @return bool - * @ignore - */ -function wrs_containsClass(element, className) { - if (element == null || !('className' in element)) { - return false; - } - - var currentClasses = element.className.split(' '); - - for (var i = currentClasses.length - 1; i >= 0; --i) { - if (currentClasses[i] == className) { - return true; - } - } - - return false; -} - -/** - * Remove a specific class - * @param {object} element - * @param {string} className - * @ignore - */ -function wrs_removeClass(element, className) { - var newClassName = ''; - var classes = element.className.split(" "); - - for (var i = 0; i < classes.length; i++) { - if (classes[i] != className) { - newClassName += classes[i] + " "; - } - } - element.className = newClassName.trim(); -} - -/** - * Converts old xmlinitialtext attribute (with «») to the correct one(with §lt;§gt;) - * @param {string} text String containtg safeXml characters - * @return {string} String with the safeXml charaters parsed. - * @ignore - */ -function wrs_convertOldXmlinitialtextAttribute(text) { - // Used to fix a bug with Cas imported from Moodle 1.9 to Moodle 2.x. - // This could be removed in future. - var val = 'value='; - - var xitpos = text.indexOf('xmlinitialtext'); - var valpos = text.indexOf(val, xitpos); - var quote = text.charAt(valpos + val.length); - var startquote = valpos + val.length + 1; - var endquote = text.indexOf(quote, startquote); - - var value = text.substring(startquote, endquote); - - var newvalue = value.split('«').join('§lt;'); - newvalue = newvalue.split('»').join('§gt;'); - newvalue = newvalue.split('&').join('§'); - newvalue = newvalue.split('¨').join('§quot;'); - - text = text.split(value).join(newvalue); - return text; -} - -/** - * Cross-browser solution for creating new elements. - * - * It fixes some browser bugs. - * - * @param {string} elementName The tag name of the wished element. - * @param {object} attributes An object where each key is a wished attribute name and each value is its value. - * @param {object} creator Optional param. If supplied, this function will use the "createElement" method from this param. Else, "document" will be used. - * @return {object} The DOM element with the specified attributes assignated. - * @ignore - */ -function wrs_createElement(elementName, attributes, creator) { - if (attributes === undefined) { - attributes = {}; - } - - if (creator === undefined) { - creator = document; - } - - var element; - - /* - * Internet Explorer fix: - * If you create a new object dynamically, you can't set a non-standard attribute. - * For example, you can't set the "src" attribute on an "applet" object. - * Other browsers will throw an exception and will run the standard code. - */ - - try { - var html = '<' + elementName; - - for (var attributeName in attributes) { - html += ' ' + attributeName + '="' + wrs_htmlentities(attributes[attributeName]) + '"'; - } - - html += '>'; - element = creator.createElement(html); - } catch (e) { - element = creator.createElement(elementName); - - for (var attributeName in attributes) { - element.setAttribute(attributeName, attributes[attributeName]); - } - } - - return element; -} - -/** - * Cross-browser httpRequest creation. - * @return {object} httpRequest request object. - * @ignore - */ -function wrs_createHttpRequest() { - if (_wrs_currentPath.substr(0, 7) == 'file://') { - throw _wrs_stringManager.getString('exception_cross_site'); - } - - if (typeof XMLHttpRequest != 'undefined') { - return new XMLHttpRequest(); - } - - try { - return new ActiveXObject('Msxml2.XMLHTTP'); - } catch (e) { - try { - return new ActiveXObject('Microsoft.XMLHTTP'); - } catch (oc) {} - } - - return false; -} - -/** - * Gets CAS image src with AJAX. - * @param {string} image Base 64 image stream - * @return {string} CAS image src. - * @ignore - */ -function wrs_createImageCASSrc(image, appletCode) { - var data = { - 'image': image, - 'mml': appletCode - }; - - return wrs_getContent(_wrs_conf_createcasimagePath, data); -} - -/** - * Gets formula image src with AJAX. - * @param {mathml} Mathml code. - * @param {object} data wiris properties object. - * @return string Image src. - * @ignore - */ -function wrs_createImageSrc(mathml, data) { - // Full base64 method (edit & save). - if (_wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'default') { - data['base64'] = true; - } - - var result = wrs_getContent(_wrs_conf_createimagePath, data); - - if (result.indexOf('@BASE@') != -1) { - // Replacing '@BASE@' with the base URL of createimage. - var baseParts = _wrs_conf_createimagePath.split('/'); - baseParts.pop(); - result = result.split('@BASE@').join(baseParts.join('/')); - } - - return result; -} - -function wrs_createShowImageSrc(mathml, data, language) { - var dataMd5 = []; - var renderParams = 'mml,color,centerbaseline,zoom,dpi,fontSize,fontFamily,defaultStretchy,backgroundColor,format'; - var renderParamsArray = renderParams.split(','); - for (var key in renderParamsArray) { - var param = renderParamsArray[key]; - if (typeof data[param] != 'undefined') { - dataMd5[param] = data[param]; - } - } - // Data variables to get. - var dataObject = {}; - for (var key in data) { - // We don't need mathml in this request we try to get cached so we only need the formula md5 calculated before. - if (key != 'mml') { - dataObject[key] = data[key]; - } - } - dataObject.formula = com.wiris.js.JsPluginTools.md5encode(wrs_propertiesToString(dataMd5)); - dataObject.lang = typeof language == 'undefined' ? 'en' : language; - dataObject.version = _wrs_conf_version; - - var result = wrs_getContent(_wrs_conf_showimagePath + '?' + wrs_httpBuildQuery(dataObject)); - return result; -} - -/** - * Creates new object using its html code. - * @param {string} objectCode html code - * @return {object} html object. - * @ignore - */ -function wrs_createObject(objectCode, creator) { - if (creator === undefined) { - creator = document; - } - - // Internet Explorer can't include "param" tag when is setting an innerHTML property. - objectCode = objectCode.split('').join('').split('').join(''); - - objectCode = objectCode.split('').join('
').split('').join('
'); - - var container = wrs_createElement('div', {}, creator); - container.innerHTML = objectCode; - - function recursiveParamsFix(object) { - if (object.getAttribute && object.getAttribute('wirisObject') == 'WirisParam') { - var attributesParsed = {}; - - for (var i = 0; i < object.attributes.length; ++i) { - if (object.attributes[i].nodeValue !== null) { - attributesParsed[object.attributes[i].nodeName] = object.attributes[i].nodeValue; - } - } - - var param = wrs_createElement('param', attributesParsed, creator); - - // IE fix. - if (param.NAME) { - param.name = param.NAME; - param.value = param.VALUE; - } - - param.removeAttribute('wirisObject'); - object.parentNode.replaceChild(param, object); - } else if (object.getAttribute && object.getAttribute('wirisObject') == 'WirisApplet') { - var attributesParsed = {}; - - for (var i = 0; i < object.attributes.length; ++i) { - if (object.attributes[i].nodeValue !== null) { - attributesParsed[object.attributes[i].nodeName] = object.attributes[i].nodeValue; - } - } - - var applet = wrs_createElement('applet', attributesParsed, creator); - applet.removeAttribute('wirisObject'); - - for (var i = 0; i < object.childNodes.length; ++i) { - recursiveParamsFix(object.childNodes[i]); - - if (object.childNodes[i].nodeName.toLowerCase() == 'param') { - applet.appendChild(object.childNodes[i]); - --i; // When we insert the object child into the applet, object loses one child. - } - } - - object.parentNode.replaceChild(applet, object); - } else { - for (var i = 0; i < object.childNodes.length; ++i) { - recursiveParamsFix(object.childNodes[i]); - } - } - } - - recursiveParamsFix(container); - return container.firstChild; -} - -/** - * Converts an object to its HTML code. - * @param {object} object DOM object.. - * @return {string} HTML code. - * @ignore - */ -function wrs_createObjectCode(object) { - - // In case that the image was not created, the object can be null or undefined. - if (typeof object == 'undefined' || object == null) { - return; - } - - if (object.nodeType == 1) { - // ELEMENT_NODE. - var output = '<' + object.tagName; - - for (var i = 0; i < object.attributes.length; ++i) { - if (object.attributes[i].specified) { - output += ' ' + object.attributes[i].name + '="' + wrs_htmlentities(object.attributes[i].value) + '"'; - } - } - - if (object.childNodes.length > 0) { - output += '>'; - - for (var i = 0; i < object.childNodes.length; ++i) { - output += wrs_createObjectCode(object.childNodes[i]); - } - - output += ''; - } else if (object.nodeName == 'DIV' || object.nodeName == 'SCRIPT') { - output += '>'; - } else { - output += '/>'; - } - - return output; - } - - if (object.nodeType == 3) { - // TEXT_NODE. - return wrs_htmlentities(object.nodeValue); - } - - return ''; -} - -/** - * Parses end HTML code. The end HTML code is HTML code with embedded images or LaTeX formulas created with MathType.
- * By default this method converts the formula images and LaTeX strings in MathML.
- * If image mode is enabled the images will not be converted into MathML. For further information see {@link http://www.wiris.com/plugins/docs/full-mathml-mode}. - * @param {string} code String to be parsed. - * @param {object} wirisProperties Extra attributes for the formula. - * @param {string} language Language for the formula. - * @return {string} - */ -function wrs_endParse(code, wirisProperties, language) { - code = wrs_endParseEditMode(code, wirisProperties, language); - return wrs_endParseSaveMode(code); -} - -function wrs_regexpIndexOf(input, regexp, start) { - var index = input.substring(start || 0).search(regexp); - return index >= 0 ? index + (start || 0) : index; -} - -/** - * Parses end HTML code depending on the edit mode. - * @param {string} code HTML code to be parsed. - * @param {object} wirisProperties Extra formula attributes. - * @param {string} language Language for the formula. - * @return {string} - * @ignore - */ -function wrs_endParseEditMode(code, wirisProperties, language) { - // Converting LaTeX to images. - - if (window._wrs_conf_parseModes !== undefined && wrs_arrayContains(_wrs_conf_parseModes, 'latex') != -1) { - var output = ''; - var endPosition = 0; - var startPosition = code.indexOf('$$'); - while (startPosition != -1) { - output += code.substring(endPosition, startPosition); - endPosition = code.indexOf('$$', startPosition + 2); - - if (endPosition != -1) { - // Before, it was a condition here to execute the next codelines 'latex.indexOf('<') == -1'. - // We don't know why it was used, but seems to have a conflict with latex formulas that contains '<'. - var latex = code.substring(startPosition + 2, endPosition); - latex = wrs_htmlentitiesDecode(latex); - var mathml = wrs_getMathMLFromLatex(latex, true); - output += mathml; - endPosition += 2; - } else { - output += '$$'; - endPosition = startPosition + 2; - } - - startPosition = code.indexOf('$$', endPosition); - } - - output += code.substring(endPosition, code.length); - code = output; - } - - if (window._wrs_conf_defaultEditMode && _wrs_conf_defaultEditMode == 'iframes') { - // Converting iframes to images. - var output = ''; - var pattern = ' class="' + _wrs_conf_imageClassName + '"'; - var formulaPosition = code.indexOf(pattern); - var endPosition = 0; - - while (formulaPosition != -1) { - // Looking for the actual startPosition. - startPosition = formulaPosition; - var i = formulaPosition; - var startTagFound = false; - - while (i >= 0 && !startTagFound) { - // Going backwards until the start tag '<' is found. - var character = code.charAt(i); - - if (character == '"' || character == '\'') { - var characterNextPosition = code.lastIndexOf(character, i); - i = characterNextPosition == -1 ? -1 : characterNextPosition; - } else if (character == '<') { - startPosition = i; - startTagFound = true; - } else if (character == '>') { - i = -1; // Break: we are inside a text node. - } - - --i; - } - - // Appending the previous code. - output += code.substring(endPosition, startPosition); - - // Looking for the endPosition. - - if (startTagFound) { - i = formulaPosition; - var counter = 1; - - while (i < code.length && counter > 0) { - var character = code.charAt(i); - - if (character == '"' || character == '\'') { - var characterNextPosition = code.indexOf(character, i); - i = characterNextPosition == -1 ? code.length : characterNextPosition; - } else if (character == '<') { - if (i + 1 < code.length && code.charAt(i + 1) == '/') { - --counter; - - if (counter == 0) { - endPosition = code.indexOf('>', i) + 1; - - if (endPosition == -1) { - // End tag stripped. - counter = -1; // to be != 0 and to break the loop. - } - } - } else { - ++counter; - } - } else if (character == '>' && code.charAt(i - 1) == '/') { - --counter; - - if (counter == 0) { - endPosition = i + 1; - } - } - - ++i; - } - - if (counter == 0) { - var formulaTagCode = code.substring(startPosition, endPosition); - var formulaTagObject = wrs_createObject(formulaTagCode); - var mathml = formulaTagObject.getAttribute(_wrs_conf_imageMathmlAttribute); - - if (mathml == null) { - mathml = formulaTagObject.getAttribute('alt'); - } - - var imgObject = wrs_mathmlToImgObject(document, mathml, wirisProperties, language); - output += wrs_createObjectCode(imgObject); - } else { - // Start tag found but no end tag found. No process is done. A character is appended to avoid infinite loop in the next search. - output += code.charAt(formulaPosition); - endPosition = formulaPosition + 1; - } - } else { - // No start tag is found. No process is done. A character is appended to avoid infinite loop in the next search. - output += code.charAt(formulaPosition); - endPosition = formulaPosition + 1; - } - - formulaPosition = code.indexOf(pattern, endPosition); - } - - output += code.substring(endPosition, code.length); - code = output; - } - - return code; -} - -/** - * Parses end HTML code depending on the save mode. - * @param {string} code HTML code - * @return {string} - * @ignore - */ -function wrs_endParseSaveMode(code) { - var output = ''; - var convertToXml = false; - var convertToSafeXml = false; - - if (window._wrs_conf_saveMode) { - if (_wrs_conf_saveMode == 'safeXml') { - convertToXml = true; - convertToSafeXml = true; - code = wrs_codeImgTransform(code, 'img2mathml'); - } else if (_wrs_conf_saveMode == 'xml') { - convertToXml = true; - code = wrs_codeImgTransform(code, 'img2mathml'); - } else if (_wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'image') { - code = wrs_codeImgTransform(code, 'img264'); - } - } - - return code; -} - -/** - * Gets the formula mathml or CAS appletCode using its image hash code. - * @param {string} variableName Variable to send on POST query to the server. - * @param {string} imageHashCode image hash code. - * @return {string} Corresponding mathml code. - * @ignore - */ -function wrs_getCode(variableName, imageHashCode) { - var data = {}; - data[variableName] = imageHashCode; - return wrs_getContent(_wrs_conf_getmathmlPath, data); -} - -/** - * Gets the content from an URL. - * @param {string} url target URL. - * @param {object} postVariables post variables. Null if a GET query should be done. - * @return {string} content of the target URL. - * @ignore - */ -function wrs_getContent(url, postVariables) { - try { - var httpRequest = wrs_createHttpRequest(); - - if (httpRequest) { - if ((typeof postVariables === "undefined" ? "undefined" : _typeof(postVariables)) === undefined || typeof postVariables == 'undefined') { - httpRequest.open('GET', url, false); - } else if (url.substr(0, 1) == '/' || url.substr(0, 7) == 'http://' || url.substr(0, 8) == 'https://') { - httpRequest.open('POST', url, false); - } else { - httpRequest.open('POST', _wrs_currentPath + url, false); - } - - if (postVariables !== undefined) { - httpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8'); - httpRequest.send(wrs_httpBuildQuery(postVariables)); - } else { - httpRequest.send(null); - } - - return httpRequest.responseText; - } - - alert(_wrs_stringManager.getString('browser_no_compatible')); - } catch (e) {} - - return ''; -} - -/** - * Generates the innerHTML of an element. - * @param {object} element target element. - * @return {string} innertHTML of the target element. - * @ignore - */ -function wrs_getInnerHTML(element) { - var innerHTML = ''; - - for (var i = 0; i < element.childNodes.length; ++i) { - innerHTML += wrs_createObjectCode(element.childNodes[i]); - } - - return innerHTML; -} - -/** - * Converts MathML to LaTeX. - * @param {string} mathml MathML String - * @return {string} MathML corresponding LaTeX. - * @ignore - */ -function wrs_getLatexFromMathML(mathml) { - var data = { - 'service': 'mathml2latex', - 'mml': mathml - }; - - var jsonResponse = JSON.parse(wrs_getContent(_wrs_conf_servicePath, data)); - - var latex; - - if (jsonResponse.status == "ok") { - latex = jsonResponse.result.text; - } - - return latex; -} - -/** - * Extracts the latex of a determined position in a text. - * @param {string} textNode test to extract LaTeX - * @param {int} caretPosition starting position to find LaTeX. - * @param {object} latexTags optional parameter representing tags between latex is inserted. It has the 'open' attribute for the open tag and the 'close' attribute for the close tag. - * @return {object} An object with 3 keys: 'latex', 'start' and 'end'. Null if latex is not found. - * @ignore - */ -function wrs_getLatexFromTextNode(textNode, caretPosition, latexTags) { - // latexTags is an optional parameter. If is not set, use default latexTags. - if (typeof latexTags == 'undefined' || latexTags == null) { - latexTags = _wrs_latexTags; - } - // Looking for the first textNode. - var startNode = textNode; - - while (startNode.previousSibling && startNode.previousSibling.nodeType == 3) { - // TEXT_NODE. - startNode = startNode.previousSibling; - } - - // Finding latex. - - /** - * It gets the next latex position and node from a specific node and position. - * @param {Object} currentNode node where searching latex. - * @param {number} currentPosition current position inside the currentNode. - * @param {Object} latexTagsToUse tags used at latex beggining and latex final. - * @param {boolean} searchEndTag If true, the first tag to search is an end tag. Otherwise, it searches the open tag first. - */ - function getNextLatexPosition(currentNode, currentPosition, latexTagsToUse, searchEndTag) { - var latexTags = latexTagsToUse; - if (searchEndTag) { - latexTags = { - 'open': latexTagsToUse.close, - 'close': latexTagsToUse.open - }; - } - - var position = currentNode.nodeValue.indexOf(latexTags.open, currentPosition); - - while (position == -1) { - currentNode = currentNode.nextSibling; - - if (!currentNode) { - // TEXT_NODE. - return null; // Not found. - } - - position = currentNode.nodeValue ? currentNode.nodeValue.indexOf(latexTags.close) : -1; - } - - return { - 'node': currentNode, - 'position': position - }; - } - - function isPrevious(node, position, endNode, endPosition) { - if (node == endNode) { - return position <= endPosition; - } - - while (node && node != endNode) { - node = node.nextSibling; - } - - return node == endNode; - } - - var start; - var end = { - 'node': startNode, - 'position': 0 - }; - var searchEndTag = false; - // Is supposed that open and close tags has the same length. - var tagLength = latexTags.open.length; - do { - var start = getNextLatexPosition(end.node, end.position, latexTags, searchEndTag); - - if (start == null || isPrevious(textNode, caretPosition, start.node, start.position)) { - return null; - } - - var end = getNextLatexPosition(start.node, start.position + tagLength, latexTags, !searchEndTag); - - if (end == null) { - return null; - } - - end.position += tagLength; - // For the next iteration, the start position to search corresponds to the opposite tag. - searchEndTag = !searchEndTag; - } while (isPrevious(end.node, end.position, textNode, caretPosition)); - - // Isolating latex. - var latex; - - if (start.node == end.node) { - latex = start.node.nodeValue.substring(start.position + tagLength, end.position - tagLength); - } else { - latex = start.node.nodeValue.substring(start.position + tagLength, start.node.nodeValue.length); - var currentNode = start.node; - - do { - currentNode = currentNode.nextSibling; - - if (currentNode == end.node) { - latex += end.node.nodeValue.substring(0, end.position - tagLength); - } else { - latex += currentNode.nodeValue ? currentNode.nodeValue : ''; - } - } while (currentNode != end.node); - } - - return { - 'latex': latex, - 'startNode': start.node, - 'startPosition': start.position, - 'endNode': end.node, - 'endPosition': end.position - }; -} - -/** - * Converts LaTeX to MathML. - * @param {string} latex String - * @param {bool} includeLatexOnSemantics If true LaTeX would me included into MathML semantics. - * @return {string} converted mathML - * @ignore - */ -function wrs_getMathMLFromLatex(latex, includeLatexOnSemantics) { - if (_wrs_int_LatexCache.hasOwnProperty(latex)) { - return _wrs_int_LatexCache[latex]; - } - var data = { - 'service': 'latex2mathml', - 'latex': latex - }; - - if (includeLatexOnSemantics) { - data['saveLatex'] = ''; - } - - var jsonResponse = JSON.parse(wrs_getContent(_wrs_conf_servicePath, data)); - - var output; - if (jsonResponse.status == "ok") { - var output = jsonResponse.result.text; - output = output.split("\r").join('').split("\n").join(' '); - // Populate LatexCache. - wrs_populateLatexCache(latex, output); - } else { - output = "$$" + latex + "$$"; - } - - return output; -} - -/** - * Gets the node length in characters. - * @param {object} node HTML node. - * @return {int} node length - * @ignore - */ -function wrs_getNodeLength(node) { - if (node.nodeType == 3) { - // TEXT_NODE. - return node.nodeValue.length; - } - - if (node.nodeType == 1) { - // ELEMENT_NODE. - var length = _wrs_staticNodeLengths[node.nodeName.toUpperCase()]; - - if (length === undefined) { - length = 0; - } - - for (var i = 0; i < node.childNodes.length; ++i) { - length += wrs_getNodeLength(node.childNodes[i]); - } - - return length; - } - - return 0; -} - -/** - * Parses the query string and returns it as a Hash table. - * @param {object} windowObject a window object with a query string. - * @return {object} a hash table containing the query string. - * @ignore - */ -function wrs_getQueryParams(windowObject) { - var data = {}; - var start = windowObject.location.search.indexOf('?'); - start = start == -1 ? 0 : start + 1; - var queryStringParts = windowObject.location.search.substr(start).split('&'); - - for (var i = 0; i < queryStringParts.length; ++i) { - var paramParts = queryStringParts[i].split('=', 2); - data[paramParts[0]] = wrs_urldecode(paramParts[1]); - } - - return data; -} - -/** - * Gets the selected node or text. - * If the caret is on a text node, concatenates it with all the previous and next text nodes. - * @param {object} target The editable element - * @param {boolean} isIframe Specifies if the target is an iframe or not - * @param {forceGetSelection} If true, ignores IE system to get the current selection and uses window.getSelection() - * @return {object} An object with the 'node' key setted if the item is an element or the keys 'node' and 'caretPosition' if the element is text - * @ignore - */ -function wrs_getSelectedItem(target, isIframe, forceGetSelection) { - var windowTarget; - - if (isIframe) { - windowTarget = target.contentWindow; - windowTarget.focus(); - } else { - windowTarget = window; - target.focus(); - } - - if (document.selection && !forceGetSelection) { - var range = windowTarget.document.selection.createRange(); - - if (range.parentElement) { - if (range.htmlText.length > 0) { - if (range.text.length == 0) { - return wrs_getSelectedItem(target, isIframe, true); - } - - return null; - } - - windowTarget.document.execCommand('InsertImage', false, '#'); - var temporalObject = range.parentElement(); - - if (temporalObject.nodeName.toUpperCase() != 'IMG') { - // IE9 fix: parentElement() does not return the IMG node, returns the parent DIV node. In IE < 9, pasteHTML does not work well. - range.pasteHTML(''); - temporalObject = windowTarget.document.getElementById('wrs_openEditorWindow_temporalObject'); - } - - var node; - var caretPosition; - - if (temporalObject.nextSibling && temporalObject.nextSibling.nodeType == 3) { - // TEXT_NODE. - node = temporalObject.nextSibling; - caretPosition = 0; - } else if (temporalObject.previousSibling && temporalObject.previousSibling.nodeType == 3) { - // TEXT_NODE. - node = temporalObject.previousSibling; - caretPosition = node.nodeValue.length; - } else { - node = windowTarget.document.createTextNode(''); - temporalObject.parentNode.insertBefore(node, temporalObject); - caretPosition = 0; - } - - temporalObject.parentNode.removeChild(temporalObject); - - return { - 'node': node, - 'caretPosition': caretPosition - }; - } - - if (range.length > 1) { - return null; - } - - return { - 'node': range.item(0) - }; - } - - if (windowTarget.getSelection) { - var selection = windowTarget.getSelection(); - - try { - var range = selection.getRangeAt(0); - } catch (e) { - var range = windowTarget.document.createRange(); - } - - var node = range.startContainer; - - if (node.nodeType == 3) { - // TEXT_NODE. - return { - 'node': node, - 'caretPosition': range.startOffset - }; - } - - if (node != range.endContainer) { - return null; - } - - if (node.nodeType == 1) { - // ELEMENT_NODE. - var position = range.startOffset; - - if (node.childNodes[position]) { - return { - 'node': node.childNodes[position] - }; - } - } - } - - return null; -} - -/** - * Returns null if there isn't any item or if it is malformed. - * Otherwise returns a div DOM node containing the mathml image and the cursor position inside the textarea. - * @param {Object} textarea DOM Element. - * @ignore - */ -function wrs_getSelectedItemOnTextarea(textarea) { - var textNode = document.createTextNode(textarea.value); - var textNodeWithLatex = wrs_getLatexFromTextNode(textNode, textarea.selectionStart); - if (textNodeWithLatex == null) { - return null; - }; - - // Try to get latex mathml from cache - var latex = textNodeWithLatex.latex; - var mathml = _wrs_int_LatexCache[latex]; - // If the formula was written and not generated by the editor, caches won't have the data. - if (typeof mathml == 'undefined') { - mathml = wrs_getMathMLFromLatex(latex); - } - - var mathmlWithoutSemantics = wrs_removeSemanticsMathml(mathml); - var img = wrs_parseMathmlToImg(mathmlWithoutSemantics, _wrs_xmlCharacters, _wrs_int_langCode); - var div = document.createElement('div'); - div.innerHTML = img; - - return { - 'node': div.firstChild, - 'startPosition': textNodeWithLatex.startPosition, - 'endPosition': textNodeWithLatex.endPosition - }; -} - -/** - * Converts the HTML of a image into the output code that WIRIS must return. - * By default returns the mathml stored on data-mahml attribute (if imgCode is a formula) - * or the Wiriscas attribute of a WIRIS applet. - * @param {string} imgCode the html code from a formula or a CAS image. - * @param {bool} convertToXml True if the image should be converted to xml. - * @param {bool} convertToSafeXml True if the image should be conerte to safeXmll - * @return {string} the Xml or safeXml of a WIRIS image. - * @ignore - */ -function wrs_getWIRISImageOutput(imgCode, convertToXml, convertToSafeXml) { - var imgObject = wrs_createObject(imgCode); - - if (imgObject) { - if (imgObject.className == _wrs_conf_imageClassName || imgObject.getAttribute(_wrs_conf_imageMathmlAttribute)) { - if (!convertToXml) { - return imgCode; - } - - var xmlCode = imgObject.getAttribute(_wrs_conf_imageMathmlAttribute); - - if (xmlCode == null) { - xmlCode = imgObject.getAttribute('alt'); - } - - if (!convertToSafeXml) { - xmlCode = wrs_mathmlDecode(xmlCode); - } - - return xmlCode; - } else if (imgObject.className == _wrs_conf_CASClassName) { - var appletCode = imgObject.getAttribute(_wrs_conf_CASMathmlAttribute); - appletCode = wrs_mathmlDecode(appletCode); - var appletObject = wrs_createObject(appletCode); - appletObject.setAttribute('src', imgObject.src); - var object = appletObject; - var appletCodeToBeInserted = wrs_createObjectCode(appletObject); - - if (convertToSafeXml) { - appletCodeToBeInserted = wrs_mathmlEncode(appletCodeToBeInserted); - } - - return appletCodeToBeInserted; - } - } - - return imgCode; -} - -/** - * Parses a text and replaces all HTML special characters by their entities. - * @param {string} input Text to be paresed. - * @return {string} the input text with all their special characters replaced by their entities. - * @ignore - */ -function wrs_htmlentities(input) { - return input.split('&').join('&').split('<').join('<').split('>').join('>').split('"').join('"'); -} - -/** - * Parses a text and replaces all the HTML entities by their characters. - * @param {string} input Text to be parsed - * @return {string} The input text with all their entities replaced by characters. - * @ignore - */ -function wrs_htmlentitiesDecode(input) { - return input.split('"').join('"').split('>').join('>').split('<').join('<').split('&').join('&'); -} - -/** - * Converts a hash to a HTTP query. - * @param {hash} properties A key-value Hash - * @return {string} A HTTP query containing all the key value pairs with all the shpecial characters replaced by their entities. - * @ignore - */ -function wrs_httpBuildQuery(properties) { - var result = ''; - - for (var i in properties) { - if (properties[i] != null) { - result += wrs_urlencode(i) + '=' + wrs_urlencode(properties[i]) + '&'; - } - } - - // Deleting last '&' empty character. - if (result.substring(result.length - 1) == '&') { - result = result.substring(0, result.length - 1); - } - - return result; -} - -/** - * Parses initial HTML code. If the HTML contains data generated by WIRIS, this data would be converted as following: - *
- * MathML code: Image containing the corresponding MathML formulas.
- * MathML code with LaTeX annotation : LaTeX.
- * 
- * @param {string} code HTML code with data generated by MathType. - * @param {string} language Language for the formula. - * @return {string} HTML code with the WIRIS data converted into LaTeX and images. - */ -function wrs_initParse(code, language) { - /* Note: The code inside this function has been inverted. - If you invert again the code then you cannot use correctly LaTeX - in Moodle. - */ - wrs_initSetSize(); - code = wrs_initParseSaveMode(code, language); - return wrs_initParseEditMode(code); -} - -/** - * Parses initial HTML code into iframes. - * @param {object} windowTarget Target object window. - * @ignore - */ -function wrs_initParseImgToIframes(windowTarget) { - if (window._wrs_conf_defaultEditMode && _wrs_conf_defaultEditMode == 'iframes') { - var imgList = windowTarget.document.getElementsByTagName('img'); - var i = 0; - - while (i < imgList.length) { - if (imgList[i].className == _wrs_conf_imageClassName) { - var mathml = imgList[i].getAttribute(_wrs_conf_imageMathmlAttribute); - - if (mathml == null) { - mathml = imgList[i].getAttribute('alt'); - } - - var iframe = wrs_mathmlToIframeObject(windowTarget, wrs_mathmlDecode(mathml)); - imgList[i].parentNode.replaceChild(iframe, imgList[i]); - } else { - ++i; - } - } - } -} - -/** - * Parses initial HTML code depending on the edit mode. - * @param {string} code HTML code. - * @return {string} parsed HTML code. - * @ignore - */ -function wrs_initParseEditMode(code) { - if (window._wrs_conf_parseModes !== undefined && wrs_arrayContains(_wrs_conf_parseModes, 'latex') != -1) { - var imgList = wrs_getElementsByNameFromString(code, 'img', true); - var token = 'encoding="LaTeX">'; - var carry = 0; // While replacing images with latex, the indexes of the found images changes respecting the original code, so this carry is needed. - - for (var i = 0; i < imgList.length; ++i) { - var imgCode = code.substring(imgList[i].start + carry, imgList[i].end + carry); - - if (imgCode.indexOf(' class="' + _wrs_conf_imageClassName + '"') != -1) { - var mathmlStartToken = ' ' + _wrs_conf_imageMathmlAttribute + '="'; - var mathmlStart = imgCode.indexOf(mathmlStartToken); - - if (mathmlStart == -1) { - mathmlStartToken = ' alt="'; - mathmlStart = imgCode.indexOf(mathmlStartToken); - } - - if (mathmlStart != -1) { - mathmlStart += mathmlStartToken.length; - var mathmlEnd = imgCode.indexOf('"', mathmlStart); - var mathml = wrs_mathmlDecode(imgCode.substring(mathmlStart, mathmlEnd)); - var latexStartPosition = mathml.indexOf(token); - - if (latexStartPosition != -1) { - latexStartPosition += token.length; - var latexEndPosition = mathml.indexOf('', latexStartPosition); - var latex = mathml.substring(latexStartPosition, latexEndPosition); - - var replaceText = '$$' + wrs_htmlentitiesDecode(latex) + '$$'; - code = code.substring(0, imgList[i].start + carry) + replaceText + code.substring(imgList[i].end + carry); - carry += replaceText.length - (imgList[i].end - imgList[i].start); - } - } - } - } - } - - return code; -} - -/** - * Parses initial HTML code depending on the save mode. - * @param {string} code HTML code to be parsed - * @param {string} language Language for the formula. - * @return {string} HTML code parsed. - * @ignore - */ -function wrs_initParseSaveMode(code, language) { - if (window._wrs_conf_saveMode) { - - if (_wrs_parseXml) { - // Converting XML to tags. - code = wrs_parseMathmlToLatex(code, _wrs_safeXmlCharacters); - code = wrs_parseMathmlToLatex(code, _wrs_xmlCharacters); - // Safe XML and XML must be parsed regardeless of save mode. - // Order is important here, safeXml must be parsed first in order to avoid conflicts with data-mathml img attribute. - code = wrs_parseSafeAppletsToObjects(code); - code = wrs_parseMathmlToImg(code, _wrs_safeXmlCharacters, language); - code = wrs_parseMathmlToImg(code, _wrs_xmlCharacters, language); - } - - if (_wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'image') { - code = wrs_codeImgTransform(code, 'base642showimage'); - } - } - - var appletList = wrs_getElementsByNameFromString(code, 'applet', false); - var carry = 0; // While replacing applets with images, the indexes of the found applets changes respecting the original code, so this carry is needed. - - for (var i = 0; i < appletList.length; ++i) { - var appletCode = code.substring(appletList[i].start + carry, appletList[i].end + carry); - - // The second control in the if is used to find WIRIS applet which don't have Wiriscas class (as it was in old CAS applets). - if (appletCode.indexOf(' class="' + _wrs_conf_CASClassName + '"') != -1 || appletCode.toUpperCase().indexOf('WIRIS') != -1) { - if (appletCode.indexOf(' src="') != -1) { - var srcStart = appletCode.indexOf(' src="') + ' src="'.length; - var srcEnd = appletCode.indexOf('"', srcStart); - var src = appletCode.substring(srcStart, srcEnd); - } else { - // This should happen only with old CAS imported from Moodle 1 to Moodle 2. - if (typeof _wrs_conf_pluginBasePath != 'undefined') { - var src = _wrs_conf_pluginBasePath + '/integration/showcasimage.php?formula=noimage'; - } else { - var src = ''; - } - if (appletCode.indexOf(' class="' + _wrs_conf_CASClassName + '"') == -1) { - var closeSymbol = appletCode.indexOf('>'); - var appletTag = appletCode.substring(0, closeSymbol); - var newAppletTag = appletTag.split(' width=').join(' class="Wiriscas" width='); - appletCode = appletCode.split(appletTag).join(newAppletTag); - appletCode = appletCode.split('\'').join('"'); - } - } - - // Double click to edit has been removed here. - var imgCode = ''; - - code = code.substring(0, appletList[i].start + carry) + imgCode + code.substring(appletList[i].end + carry); - carry += imgCode.length - (appletList[i].end - appletList[i].start); - } - } - - return code; -} - -/** - * Looks for elements that match the given name in a HTML code string. - * Important: this function is very concrete for WIRIS code. It takes as preconditions lots of behaviors that are not the general case. - * - * @param {string} code HTML code - * @param {string} name Element names - * @param {boolean} autoClosed True if the elements are autoClosed. - * @return {array} An array containing all HTML elements of code matching the name argument. - * @ignore - */ -function wrs_getElementsByNameFromString(code, name, autoClosed) { - var elements = []; - var code = code.toLowerCase(); - name = name.toLowerCase(); - var start = code.indexOf('<' + name + ' '); - - while (start != -1) { - // Look for nodes. - var endString; - - if (autoClosed) { - endString = '>'; - } else { - endString = ''; - } - - var end = code.indexOf(endString, start); - - if (end != -1) { - end += endString.length; - - elements.push({ - 'start': start, - 'end': end - }); - } else { - end = start + 1; - } - - start = code.indexOf('<' + name + ' ', end); - } - - return elements; -} - -/** - * Replaces a selection with an element. - * @param {object} element Element - * @param {object} focusElement Element to be focused - * @param {object} windowTarget Target - * @ignore - */ -function wrs_insertElementOnSelection(element, focusElement, windowTarget) { - if (typeof focusElement.frameElement !== 'undefined') { - var get_browser = function get_browser() { - var ua = navigator.userAgent; - if (ua.search("Edge/") >= 0) { - return "EDGE"; - } else if (ua.search("Chrome/") >= 0) { - return "CHROME"; - } else if (ua.search("Trident/") >= 0) { - return "IE"; - } else if (ua.search("Firefox/") >= 0) { - return "FIREFOX"; - } else if (ua.search("Safari/") >= 0) { - return "SAFARI"; - } - }; - - var browserName = get_browser(); - // Iexplorer, Edge and Safari can't focus into iframe - if (browserName == 'SAFARI' || browserName == 'IE' || browserName == 'EDGE') { - focusElement.focus(); - } else { - focusElement.frameElement.focus(); - } - } else { - focusElement.focus(); - } - - if (_wrs_isNewElement) { - if (focusElement.type == "textarea") { - wrs_updateTextarea(focusElement, element.textContent); - } else if (document.selection && document.getSelection == 0) { - var range = windowTarget.document.selection.createRange(); - windowTarget.document.execCommand('InsertImage', false, element.src); - - if (!('parentElement' in range)) { - windowTarget.document.execCommand('delete', false); - range = windowTarget.document.selection.createRange(); - windowTarget.document.execCommand('InsertImage', false, element.src); - } - - if ('parentElement' in range) { - var temporalObject = range.parentElement(); - - if (temporalObject.nodeName.toUpperCase() == 'IMG') { - temporalObject.parentNode.replaceChild(element, temporalObject); - } else { - // IE9 fix: parentNode() does not return the IMG node, returns the parent DIV node. In IE < 9, pasteHTML does not work well. - range.pasteHTML(wrs_createObjectCode(element)); - } - } - } else { - var selection = windowTarget.getSelection(); - // We have use wrs_range beacuse IExplorer delete selection when select another part of text. - if (_wrs_range) { - var range = _wrs_range; - _wrs_range = null; - } else { - - try { - var range = selection.getRangeAt(0); - } catch (e) { - var range = windowTarget.document.createRange(); - } - } - selection.removeAllRanges(); - - range.deleteContents(); - - var node = range.startContainer; - var position = range.startOffset; - - if (node.nodeType == 3) { - // TEXT_NODE. - node = node.splitText(position); - node.parentNode.insertBefore(element, node); - node = node.parentNode; - } else if (node.nodeType == 1) { - // ELEMENT_NODE. - node.insertBefore(element, node.childNodes[position]); - } - // Fix to set the caret after the inserted image. - range.selectNode(element); - // Integration function. - // If wrs_int_setCaretPosition function exists on - // integration script can call caret method from the editor instance. - // With this method we can call proper specific editor methods which in some scenarios - // help's MathType to set caret position properly on the current editor window. - if (typeof wrs_int_selectRange != 'undefined') { - wrs_int_selectRange(range); - } - // Selection collapse must have to do it after the function 'wrs_int_selectRange' because - // can be that the range was changed and the selection needs to be updated. - position = range.endOffset; - selection.collapse(node, position); - } - } else if (_wrs_temporalRange) { - if (document.selection && document.getSelection == 0) { - _wrs_isNewElement = true; - _wrs_temporalRange.select(); - wrs_insertElementOnSelection(element, focusElement, windowTarget); - } else { - var parentNode = _wrs_temporalRange.startContainer; - _wrs_temporalRange.deleteContents(); - _wrs_temporalRange.insertNode(element); - } - } else if (focusElement.type == "textarea") { - var item; - // Wrapper for some integrations that can have special behaviours to show latex. - if (typeof wrs_int_getSelectedItem != 'undefined') { - item = wrs_int_getSelectedItem(focusElement, false); - } else { - item = wrs_getSelectedItemOnTextarea(focusElement); - } - wrs_updateExistingFormulaOnTextarea(focusElement, element.textContent, item.startPosition, item.endPosition); - } else { - if (!element) { - // Editor empty, formula has been erased on edit. - _wrs_temporalImage.parentNode.removeChild(_wrs_temporalImage); - } - _wrs_temporalImage.parentNode.replaceChild(element, _wrs_temporalImage); - } - function placeCaretAfterNode(node) { - if (typeof window.getSelection != "undefined") { - var range = windowTarget.document.createRange(); - range.setStartAfter(node); - range.collapse(true); - var selection = windowTarget.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - } - }; - placeCaretAfterNode(element); -} - -/** - * Checks if the mathml at position i is inside an HTML attribute or not. - * @param {string} content A string containing MathML code. - * @param {string} i Search index. - * @return {bool} True if is inside an HTML attribute. In other case, false. - * @ignore - */ -function wrs_isMathmlInAttribute(content, i) { - // Regex = '^[\'"][\\s]*=[\\s]*[\\w-]+([\\s]*("[^"]*"|\'[^\']*\')[\\s]*=[\\s]*[\\w-]+[\\s]*)*[\\s]+gmi<'; - var math_att = '[\'"][\\s]*=[\\s]*[\\w-]+'; // "=att OR '=att - var att_content = '"[^"]*"|\'[^\']*\''; // "blabla" OR 'blabla' - var att = '[\\s]*(' + att_content + ')[\\s]*=[\\s]*[\\w-]+[\\s]*'; // "blabla"=att OR 'blabla'=att - var atts = '(' + att + ')*'; // "blabla"=att1 "blabla"=att2 - var regex = '^' + math_att + atts + '[\\s]+gmi<'; // "=att "blabla"=att1 "blabla"=att2 gmi< . - var expression = new RegExp(regex); - - var actual_content = content.substring(0, i); - var reversed = actual_content.split('').reverse().join(''); - var exists = expression.test(reversed); - - return exists; -} - -/** - * WIRIS special encoding. - * We use these entities because IE doesn't support html entities on its attributes sometimes. Yes, sometimes. - * @param {string} input String to be decoded. - * @return {string} Decoded string. - * @ignore - */ -function wrs_mathmlDecode(input) { - // Decoding entities. - input = input.split(_wrs_safeXmlCharactersEntities.tagOpener).join(_wrs_safeXmlCharacters.tagOpener); - input = input.split(_wrs_safeXmlCharactersEntities.tagCloser).join(_wrs_safeXmlCharacters.tagCloser); - input = input.split(_wrs_safeXmlCharactersEntities.doubleQuote).join(_wrs_safeXmlCharacters.doubleQuote); - // Added to fix problem due to import from 1.9.x. - input = input.split(_wrs_safeXmlCharactersEntities.realDoubleQuote).join(_wrs_safeXmlCharacters.realDoubleQuote); - - // Blackboard. - if ('_wrs_blackboard' in window && window._wrs_blackboard) { - input = input.split(_wrs_safeBadBlackboardCharacters.ltElement).join(_wrs_safeGoodBlackboardCharacters.ltElement); - input = input.split(_wrs_safeBadBlackboardCharacters.gtElement).join(_wrs_safeGoodBlackboardCharacters.gtElement); - input = input.split(_wrs_safeBadBlackboardCharacters.ampElement).join(_wrs_safeGoodBlackboardCharacters.ampElement); - - /*var regex = /«mtext».*[<>&].*«\/mtext»/; - var result = regex.exec(input); - while(result){ - var changedResult = result[0].split(_wrs_xmlCharacters.tagOpener).join('§lt;'); - changedResult = changedResult.split(_wrs_xmlCharacters.tagCloser).join('§gt;'); - changedResult = changedResult.split(_wrs_xmlCharacters.ampersand).join('§amp;'); - input = input.replace(result, changedResult); - result = regex.exec(input); - }*/ - } - - // Decoding characters. - input = input.split(_wrs_safeXmlCharacters.tagOpener).join(_wrs_xmlCharacters.tagOpener); - input = input.split(_wrs_safeXmlCharacters.tagCloser).join(_wrs_xmlCharacters.tagCloser); - input = input.split(_wrs_safeXmlCharacters.doubleQuote).join(_wrs_xmlCharacters.doubleQuote); - input = input.split(_wrs_safeXmlCharacters.ampersand).join(_wrs_xmlCharacters.ampersand); - input = input.split(_wrs_safeXmlCharacters.quote).join(_wrs_xmlCharacters.quote); - - // We are replacing $ by & when its part of an entity for retrocompatibility. Now, the standard is replace § by &. - var returnValue = ''; - var currentEntity = null; - - for (var i = 0; i < input.length; ++i) { - var character = input.charAt(i); - - if (currentEntity == null) { - if (character == '$') { - currentEntity = ''; - } else { - returnValue += character; - } - } else { - if (character == ';') { - returnValue += '&' + currentEntity + ';'; - currentEntity = null; - } else if (character.match(/([a-zA-Z0-9#._-] | '-')/)) { - // Character is part of an entity. - currentEntity += character; - } else { - returnValue += '$' + currentEntity; // Is not an entity. - currentEntity = null; - --i; // Parse again the current character. - } - } - } - - return returnValue; -} - -/** - * WIRIS special encoding. - * We use these entities because IE doesn't support html entities on its attributes sometimes. Yes, sometimes. - * @param {string} input to be encoded - * @return {string} Encoded string. - * @ignore - */ -function wrs_mathmlEncode(input) { - input = input.split(_wrs_xmlCharacters.tagOpener).join(_wrs_safeXmlCharacters.tagOpener); - input = input.split(_wrs_xmlCharacters.tagCloser).join(_wrs_safeXmlCharacters.tagCloser); - input = input.split(_wrs_xmlCharacters.doubleQuote).join(_wrs_safeXmlCharacters.doubleQuote); - input = input.split(_wrs_xmlCharacters.ampersand).join(_wrs_safeXmlCharacters.ampersand); - input = input.split(_wrs_xmlCharacters.quote).join(_wrs_safeXmlCharacters.quote); - - return input; -} - -/** - * Converts special symbols (> 128) to entities and replaces all textual entities by its number entities. - * @param {string} mathml MathML string containing - or not - special symbols - * @return {string} MathML with all textual entities replaced. - * @ignore - */ -function wrs_mathmlEntities(mathml) { - var toReturn = ''; - - for (var i = 0; i < mathml.length; ++i) { - - var character = mathml.charAt(i); - - // Parsing > 128 characters. - if (mathml.codePointAt(i) > 128) { - toReturn += '&#' + mathml.codePointAt(i) + ';'; - // For UTF-32 characters we need to move the index one position. - if (mathml.codePointAt(i) > 0xffff) { - i++; - } - } else if (character == '&') { - var end = mathml.indexOf(';', i + 1); - - if (end >= 0) { - var container = document.createElement('span'); - container.innerHTML = mathml.substring(i, end + 1); - toReturn += '&#' + wrs_fixedCharCodeAt(container.innerText || container.textContent, 0) + ';'; - i = end; - } else { - toReturn += character; - } - } else { - toReturn += character; - } - } - - return toReturn; -} - -/** - * Add wrs::type attribute to mathml if the mathml has been created with a custom editor - * for example, chemistry. - * @param {string} mathml a MathML string created with a custom editor, like chemistry. - * @return {string} The MathML string with his class containgin the editor toolbar string. - * @ignore - */ -function wrs_mathmlAddEditorAttribute(mathml) { - var toReturn = ''; - - var start = mathml.indexOf(''); - if (mathml.indexOf("class") == -1) { - // Adding custom editor type. - toReturn = mathml.substr(start, end) + ' class="wrs_' + wrs_int_getCustomEditorEnabled().toolbar + '">'; - toReturn += mathml.substr(end + 1, mathml.length); - return toReturn; - } - } - return mathml; -} - -/** - * Fix charCodeAt() javascript function to handle non-Basic-Multilingual-Plane characters. - * @param {string} str String - * @param {int} idx An integer greater than or equal to 0 and less than the length of the string - * @return {int} An integer representing the UTF-16 code of the string at the given index. - * @ignore - */ - -function wrs_fixedCharCodeAt(str, idx) { - idx = idx || 0; - var code = str.charCodeAt(idx); - var hi, low; - - /* High surrogate (could change last hex to 0xDB7F to treat high - private surrogates as single characters) */ - - if (0xD800 <= code && code <= 0xDBFF) { - hi = code; - low = str.charCodeAt(idx + 1); - if (isNaN(low)) { - throw _wrs_stringManager.getString('exception_high_surrogate'); - } - return (hi - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000; - } - - if (0xDC00 <= code && code <= 0xDFFF) { - // Low surrogate. - /* We return false to allow loops to skip this iteration since should have - already handled high surrogate above in the previous iteration. */ - return false; - } - return code; -} - -/** - * Gets the accessible text of a given MathML calling mathml2accesible service. - * @param {string} mathml MathML to get the accesibility. - * @param {string} language Language of the accesibility. - * @return {string} Accessibility from mathml string on language string. - * @ignore - */ -function wrs_mathmlToAccessible(mathml, language, data) { - var accessibleText; - - if (_wrs_int_AccessibleCache.hasOwnProperty(mathml)) { - accessibleText = _wrs_int_AccessibleCache[mathml]; - } else { - data['service'] = 'mathml2accessible'; - data['lang'] = _wrs_int_langCode; - var accesibleJsonResponse = JSON.parse(wrs_getContent(_wrs_conf_servicePath, data)); - if (accesibleJsonResponse.status != 'error') { - accessibleText = accesibleJsonResponse.result.text; - } else { - accessibleText = _wrs_stringManager.getString('error_convert_accessibility'); - } - } - - return accessibleText; -} - -/** - * Converts mathml to an iframe object. - * @param {object} windowTarget Window object. - * @param {string} mathml MathML to be converted. - * @return {object} iframe object containging parsed mathml. - * @ignore - */ -function wrs_mathmlToIframeObject(windowTarget, mathml) { - if (window.navigator.userAgent.toLowerCase().indexOf('webkit') != -1) { - var waitForViewer = function waitForViewer() { - if (windowTarget.com && windowTarget.com.wiris) { - var _prepareDiv = function _prepareDiv() { - if (windowTarget._wrs_viewer.isReady()) { - container.style.height = formulaContainer.style.height; - container.style.width = formulaContainer.style.width; - container.style.verticalAlign = formulaContainer.style.verticalAlign; - } else { - setTimeout(_prepareDiv, 100); - } - }; - - if (!('_wrs_viewer' in windowTarget)) { - windowTarget._wrs_viewer = new windowTarget.com.wiris.jsEditor.JsViewerMain(_wrs_conf_pluginBasePath + '/integration/editor'); - windowTarget._wrs_viewer.insertCSS(null, windowTarget.document); - } - - windowTarget._wrs_viewer.paintFormulaOnContainer(mathml, formulaContainer, null); - - ; - - _prepareDiv(); - } else { - setTimeout(waitForViewer, 100); - } - }; - - // In WebKit, the formula is represented by a div instead of an iframe. - var container = windowTarget.document.createElement('span'); - container.className = _wrs_conf_imageClassName; - container.setAttribute(_wrs_conf_imageMathmlAttribute, mathml); - container.setAttribute('height', '1'); - container.setAttribute('width', '1'); - container.style.display = 'inline-block'; - container.style.cursor = 'pointer'; - container.style.webkitUserModify = 'read-only'; - container.style.webkitUserSelect = 'all'; - - var formulaContainer = windowTarget.document.createElement('span'); - formulaContainer.style.display = 'inline'; - container.appendChild(formulaContainer); - - if (!('_wrs_viewerAppended' in windowTarget)) { - var viewerScript = windowTarget.document.createElement('script'); - viewerScript.src = _wrs_conf_pluginBasePath + '/integration/editor/viewer.js'; - windowTarget.document.getElementsByTagName('head')[0].appendChild(viewerScript); - windowTarget._wrs_viewerAppended = true; - } - - waitForViewer(); - - return container; - } - - windowTarget.document.wrs_assignIframeEvents = function (myIframe) { - wrs_addEvent(myIframe.contentWindow.document, 'click', function () { - wrs_fireEvent(myIframe, 'dblclick'); - }); - }; - - var iframe = windowTarget.document.createElement('iframe'); - iframe.className = _wrs_conf_imageClassName; - iframe.setAttribute(_wrs_conf_imageMathmlAttribute, mathml); - iframe.style.display = 'inline'; - iframe.style.border = 'none'; - iframe.setAttribute('height', '1'); - iframe.setAttribute('width', '1'); - iframe.setAttribute('scrolling', 'no'); - iframe.setAttribute('frameBorder', '0'); - iframe.src = _wrs_conf_pluginBasePath + '/core/iframe.html#' + _wrs_conf_imageMathmlAttribute; - return iframe; -} - -/** - * Converts mathml to img object. - * @param {object} creator Object with the "createElement" method - * @param {string} mathml MathML code - * @param {object} wirisProperties object containing WIRIS custom properties - * @param {language} language Custom language for accesibility. - * @return {object} And image containing the formula image corresponding to mathml string. - * @ignore - */ -function wrs_mathmlToImgObject(creator, mathml, wirisProperties, language) { - var width; - var height; - var baseline; - var imgObject = creator.createElement('img'); - imgObject.align = 'middle'; - imgObject.style.maxWidth = 'none'; - var data = wirisProperties ? wirisProperties : {}; - - if (window._wrs_conf_useDigestInsteadOfMathml && _wrs_conf_useDigestInsteadOfMathml) { - data['returnDigest'] = 'true'; - } - - data['mml'] = mathml; - data['lang'] = language; - - if (_wrs_conf_setSize) { - // Request metrics of the generated image. - data['metrics'] = 'true'; - data['centerbaseline'] = 'false'; - } - - // Full base64 method (edit & save). - if (_wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'default') { - data['base64'] = true; - } - - // Render js params: _wrs_int_wirisProperties contains some js render params. Since mathml can support render params, js params should be send only to editor, not to render. - - imgObject.className = _wrs_conf_imageClassName; - - // TODO Custom Editors: class="wrs_toolbar" should be given by the editor - // so the first condition shouldn't be longer necessary. - var customEditor; - if (customEditor = wrs_int_getCustomEditorEnabled()) { - imgObject.setAttribute('data-custom-editor', customEditor.toolbar); - } else if (mathml.indexOf('class="') != -1) { - // We check here if the mathmnl has been created from a customEditor (such chemistry) - // to add data-custom-editor attribute to img object (if necessary). - var mathmlSubstring = mathml.substring(mathml.indexOf('class="') + 'class="'.length, mathml.length); - mathmlSubstring = mathmlSubstring.substring(0, mathmlSubstring.indexOf('"')); - mathmlSubstring = mathmlSubstring.substring(4, mathmlSubstring.length); - imgObject.setAttribute('data-custom-editor', mathmlSubstring); - } - - // Performance enabled. - if (_wrs_conf_wirisPluginPerformance && (_wrs_conf_saveMode == 'xml' || _wrs_conf_saveMode == 'safeXml')) { - - var result = JSON.parse(wrs_createShowImageSrc(mathml, data, language)); - if (result["status"] == 'warning') { - // POST call. - // if the mathml is malformed, this function will throw an exception. - try { - result = JSON.parse(wrs_getContent(_wrs_conf_showimagePath, data)); - } catch (e) { - return; - } - } - result = result.result; - if (result['format'] == 'png') { - imgObject.src = 'data:image/png;base64,' + result['content']; - } else { - imgObject.src = 'data:image/svg+xml;charset=utf8,' + wrs_urlencode(result['content']); - } - imgObject.setAttribute(_wrs_conf_imageMathmlAttribute, wrs_mathmlEncode(mathml)); - if (_wrs_conf_setSize) { - wrs_setImgSize(imgObject, result['content'], true); - } - - if (window._wrs_conf_enableAccessibility && _wrs_conf_enableAccessibility) { - if (typeof result.alt == 'undefined') { - imgObject.alt = wrs_mathmlToAccessible(mathml, language, data); - wrs_populateAccessibleCache(mathml, imgObject.alt); - } else { - imgObject.alt = result.alt; - } - } - } else { - var result = wrs_createImageSrc(mathml, data); - if (window._wrs_conf_useDigestInsteadOfMathml && _wrs_conf_useDigestInsteadOfMathml) { - var parts = result.split(':', 2); - imgObject.setAttribute(_wrs_conf_imageMathmlAttribute, parts[0]); - imgObject.src = parts[1]; - } else { - imgObject.setAttribute(_wrs_conf_imageMathmlAttribute, wrs_mathmlEncode(mathml)); - imgObject.src = result; - if (_wrs_conf_setSize) { - wrs_setImgSize(imgObject, result, _wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'default' ? true : false); - } - } - if (window._wrs_conf_enableAccessibility && _wrs_conf_enableAccessibility) { - imgObject.alt = wrs_mathmlToAccessible(mathml, language, data); - wrs_populateAccessibleCache(mathml, imgObject.alt); - } - } - /* if (_wrs_conf_setSize) { - var ar = wrs_urlToAssArray(result); - width = ar['cw']; - height = ar['ch']; - baseline = ar['cb']; - dpi = ar['dpi']; - if (dpi) { - width = width * 96/dpi; - height = height * 96/dpi; - baseline = baseline * 96/dpi; - } - // result = wrs_assArrayToUrl(ar); - }*/ - - if (typeof wrs_observer != 'undefined') { - wrs_observer.observe(imgObject, wrs_observer_config); - } - - // Role math https://www.w3.org/TR/wai-aria/roles#math. - imgObject.setAttribute('role', 'math'); - return imgObject; -} - -/** - * Opens a new CAS window. - * @param {object} target The editable element - * @param {boolean} isIframe Specifies if target is an iframe or not - * @param {string} language CAS language. - * @return {object} The opened window - * @ignore - */ -function wrs_openCASWindow(target, isIframe, language) { - if (isIframe === undefined) { - isIframe = true; - } - - _wrs_temporalRange = null; - - if (target) { - var selectedItem = wrs_getSelectedItem(target, isIframe); - - if (selectedItem != null && selectedItem.caretPosition === undefined && selectedItem.node.nodeName.toUpperCase() == 'IMG' && selectedItem.node.className == _wrs_conf_CASClassName) { - _wrs_temporalImage = selectedItem.node; - _wrs_isNewElement = false; - } - } - - var path = _wrs_conf_CASPath; - - if (language) { - path += '?lang=' + language; - } - - return window.open(path, 'WIRISCAS', _wrs_conf_CASAttributes); -} - -/** - * Opens a new editor window. - * @param {string} language Language code for the editor - * @param {object} target The editable element - * @param {boolean} isIframe Specifies if the target is an iframe or not - * @param {boolean} isModal Specifies if the target is a modal window or not - * @return {object} The opened window - * @ignore - */ -function wrs_openEditorWindow(language, target, isIframe) { - var ua = navigator.userAgent.toLowerCase(); - var isAndroid = ua.indexOf("android") > -1; - var isIOS = ua.indexOf("ipad") > -1 || ua.indexOf("iphone") > -1; - - if (isAndroid || isIOS) { - _wrs_conf_modalWindow = true; // Conf property must be overrided on tablet/phone devices. - } - - try { - if (isIframe) { - var selection = target.contentWindow.getSelection(); - _wrs_range = selection.getRangeAt(0); - } else { - var selection = getSelection(); - _wrs_range = selection.getRangeAt(0); - } - } catch (e) { - _wrs_range = null; - } - - if (isIframe === undefined) { - isIframe = true; - } - - // Avoid double slashes. - var path = _wrs_conf_path.lastIndexOf('/') == _wrs_conf_path.length - 1 ? _wrs_conf_path + "core/editor.html" : _wrs_conf_path + "/core/editor.html"; - - // Params for editor.html - if (language) { - path = wrs_addArgument(path, "lang", language); - } - - if (location.protocol == 'https:') { - path = wrs_addArgument(path, "secure", "true"); - } - - path = wrs_addArgument(path, "v", _wrs_plugin_version); - - var availableDirs = new Array('rtl', 'ltr'); - if (typeof _wrs_int_directionality != 'undefined' && wrs_arrayContains(availableDirs, _wrs_int_directionality) != -1) { - path = wrs_addArgument(path, "dir", _wrs_int_directionality); - } - - // Cross Domain Policy. - wrs_addArgument(path, 'host', 'localhost'); - - _wrs_editMode = window._wrs_conf_defaultEditMode ? _wrs_conf_defaultEditMode : 'images'; - _wrs_temporalRange = null; - - if (target) { - var selectedItem; - if (typeof wrs_int_getSelectedItem != 'undefined') { - selectedItem = wrs_int_getSelectedItem(target, isIframe); - } else { - selectedItem = wrs_getSelectedItem(target, isIframe); - } - - if (selectedItem != null) { - if (selectedItem.caretPosition === undefined) { - if (wrs_containsClass(selectedItem.node, _wrs_conf_imageClassName)) { - if (selectedItem.node.nodeName.toUpperCase() == 'IMG') { - _wrs_editMode = 'images'; - } else if (selectedItem.node.nodeName.toUpperCase() == 'IFRAME') { - _wrs_editMode = 'iframes'; - } - - _wrs_temporalImage = selectedItem.node; - _wrs_isNewElement = false; - } - } else { - var latexResult = wrs_getLatexFromTextNode(selectedItem.node, selectedItem.caretPosition); - - if (latexResult != null) { - _wrs_editMode = 'latex'; - - var mathml = wrs_getMathMLFromLatex(latexResult.latex); - _wrs_isNewElement = false; - - _wrs_temporalImage = document.createElement('img'); - _wrs_temporalImage.setAttribute(_wrs_conf_imageMathmlAttribute, wrs_mathmlEncode(mathml)); - var windowTarget = isIframe ? target.contentWindow : window; - - if (document.selection) { - var leftOffset = 0; - var previousNode = latexResult.startNode.previousSibling; - - while (previousNode) { - leftOffset += wrs_getNodeLength(previousNode); - previousNode = previousNode.previousSibling; - } - - _wrs_temporalRange = windowTarget.document.selection.createRange(); - _wrs_temporalRange.moveToElementText(latexResult.startNode.parentNode); - _wrs_temporalRange.move('character', leftOffset + latexResult.startPosition); - _wrs_temporalRange.moveEnd('character', latexResult.latex.length + 4); // Plus 4 for the '$$' characters. - } else { - _wrs_temporalRange = windowTarget.document.createRange(); - _wrs_temporalRange.setStart(latexResult.startNode, latexResult.startPosition); - _wrs_temporalRange.setEnd(latexResult.endNode, latexResult.endPosition); - } - } - } - } - } - // Parse atributes of editor into object - var splitterEditorAtributes = _wrs_conf_editorAttributes.split(", "); - var resultEditorAtributes = {}; - for (var i = 0, len = splitterEditorAtributes.length; i < len; i++) { - var tempAtribute = splitterEditorAtributes[i].split('='); - var key = tempAtribute[0]; - var value = tempAtribute[1]; - resultEditorAtributes[key] = value; - } - resultEditorAtributes.language = _wrs_int_langCode; - - var title = wrs_int_getCustomEditorEnabled() != null ? wrs_int_getCustomEditorEnabled().title : _wrs_stringManager.getString('mathtype'); - if (_wrs_modalWindow == null) { - _wrs_modalWindow = new ModalWindow(_wrs_conf_editorAttributes); - _wrs_modalWindow.setContentManager(new contentManager(resultEditorAtributes)); - } - if (!_wrs_css_loaded) { - var fileref = document.createElement("link"); - fileref.setAttribute("rel", "stylesheet"); - fileref.setAttribute("type", "text/css"); - fileref.setAttribute("href", wrs_concatenateUrl(_wrs_conf_path, '/core/modal.css')); - document.getElementsByTagName("head")[0].appendChild(fileref); - _wrs_css_loaded = true; - } - // TODO: setMathML logic here. - _wrs_modalWindow.open(); -} - -function Core() { - this.init = true; -} - -/** - * Converts all occurrences of mathml code to LATEX. The MathML code should containg to be converted. - * @param {string} content A string containing MathML valid code. - * @param {Object} characters An object containing special characters. - * @return {string} String with all MathML annotated occurrences replaced by the corresponding LaTeX code. - * @ignore - */ -function wrs_parseMathmlToLatex(content, characters) { - var output = ''; - var mathTagBegin = characters.tagOpener + 'math'; - var mathTagEnd = characters.tagOpener + '/math' + characters.tagCloser; - var openTarget = characters.tagOpener + 'annotation encoding=' + characters.doubleQuote + 'LaTeX' + characters.doubleQuote + characters.tagCloser; - var closeTarget = characters.tagOpener + '/annotation' + characters.tagCloser; - var start = content.indexOf(mathTagBegin); - var end = 0; - var mathml, startAnnotation, closeAnnotation; - - while (start != -1) { - output += content.substring(end, start); - end = content.indexOf(mathTagEnd, start); - - if (end == -1) { - end = content.length - 1; - } else { - end += mathTagEnd.length; - } - - mathml = content.substring(start, end); - - startAnnotation = mathml.indexOf(openTarget); - if (startAnnotation != -1) { - startAnnotation += openTarget.length; - closeAnnotation = mathml.indexOf(closeTarget); - var latex = mathml.substring(startAnnotation, closeAnnotation); - if (characters == _wrs_safeXmlCharacters) { - latex = wrs_mathmlDecode(latex); - } - output += '$$' + latex + '$$'; - // Populate latex into cache. - wrs_populateLatexCache(latex, mathml); - } else { - output += mathml; - } - - start = content.indexOf(mathTagBegin, end); - } - - output += content.substring(end, content.length); - return output; -} - -/** - * Converts all occurrences of mathml code to the corresponding image. - * @param {string} content An string with valid MathML code. The matml code doesn't contain semantics. - * @param {object} characters An object containing xmlCharacters or safeXmlCharacters relation. - * @param {string} language String containging a valid language code in order to generate formula accesibilty. - * @return {string} The input string with all the MathML ocurrences replaced by the corresponding image. - * @ignore - */ -function wrs_parseMathmlToImg(content, characters, language) { - var output = ''; - var mathTagBegin = characters.tagOpener + 'math'; - var mathTagEnd = characters.tagOpener + '/math' + characters.tagCloser; - var start = content.indexOf(mathTagBegin); - var end = 0; - - while (start != -1) { - output += content.substring(end, start); - // Avoid WIRIS images to be parsed. - var imageMathmlAtrribute = content.indexOf(_wrs_conf_imageMathmlAttribute); - end = content.indexOf(mathTagEnd, start); - - if (end == -1) { - end = content.length - 1; - } else if (imageMathmlAtrribute != -1) { - // First close tag of img attribute - // If a mathmlAttribute exists should be inside a img tag. - end += content.indexOf("/>", start); - } else { - end += mathTagEnd.length; - } - - if (!wrs_isMathmlInAttribute(content, start) && imageMathmlAtrribute == -1) { - var mathml = content.substring(start, end); - mathml = characters == _wrs_safeXmlCharacters ? wrs_mathmlDecode(mathml) : wrs_mathmlEntities(mathml); - output += wrs_createObjectCode(wrs_mathmlToImgObject(document, mathml, null, language)); - } else { - output += content.substring(start, end); - } - - start = content.indexOf(mathTagBegin, end); - } - - output += content.substring(end, content.length); - return output; -} - -/** - * Converts all occurrences of safe applet code to the corresponding code. - * @param {string} content String containging valid applet code ... - * @return {string} String with all the applet code conerted to safe tags. - * @ignore - */ -function wrs_parseSafeAppletsToObjects(content) { - var output = ''; - var appletTagBegin = _wrs_safeXmlCharacters.tagOpener + 'APPLET'; - var appletTagEnd = _wrs_safeXmlCharacters.tagOpener + '/APPLET' + _wrs_safeXmlCharacters.tagCloser; - var upperCaseContent = content.toUpperCase(); - var start = upperCaseContent.indexOf(appletTagBegin); - var end = 0; - var applet; - - while (start != -1) { - output += content.substring(end, start); - end = upperCaseContent.indexOf(appletTagEnd, start); - - if (end == -1) { - end = content.length - 1; - } else { - end += appletTagEnd.length; - } - - applet = wrs_convertOldXmlinitialtextAttribute(content.substring(start, end)); - - output += wrs_mathmlDecode(applet); - start = upperCaseContent.indexOf(appletTagBegin, end); - } - - output += content.substring(end, content.length); - return output; -} - -/** - * Cross-browser removeEventListener/detachEvent function. - * @param {object} element Element target - * @param {event} event Event - * @param {function} func Function to run - * @ignore - */ -function wrs_removeEvent(element, event, func) { - if (element.removeEventListener) { - element.removeEventListener(event, func, true); - } else if (element.detachEvent) { - element.detachEvent('on' + event, func); - } -} - -/** - * Splits an HTML content in three parts: the code before , the code between and and the code after . - * @param {string} code HTML code to be splited. - * @return {objet} An object with the structure {'prefix': xxx, 'code': yyy, 'sufix': zzz} - * @ignore - */ -function wrs_splitBody(code) { - var prefix = ''; - var sufix = ''; - var bodyPosition = code.indexOf('', bodyPosition); - - if (bodyPosition != -1) { - ++bodyPosition; - var endBodyPosition = code.indexOf('', bodyPosition); - - if (endBodyPosition == -1) { - endBodyPosition = code.length; - } - - prefix = code.substring(0, bodyPosition); - sufix = code.substring(endBodyPosition, code.length); - code = code.substring(bodyPosition, endBodyPosition); - } - } - - return { - 'prefix': prefix, - 'code': code, - 'sufix': sufix - }; -} - -/** - * Inserts or modifies CAS. - * @param {object} focusElement Element to be focused - * @param {object} windowTarget Window where the editable content is - * @param {string} appletCode Applet code - * @param {string} image Base 64 image stream - * @param {int} imageWidth Image width - * @param {int} imageHeight Image height - * @ignore - */ -function wrs_updateCAS(focusElement, windowTarget, appletCode, image, imageWidth, imageHeight) { - var imgObject = wrs_appletCodeToImgObject(windowTarget.document, appletCode, image, imageWidth, imageHeight); - wrs_insertElementOnSelection(imgObject, focusElement, windowTarget); -} - -var wrs_PluginEvent = function wrs_PluginEvent() { - this.cancelled = false; - this.defaultPrevented = false; -}; - -wrs_PluginEvent.prototype.cancel = function () { - this.cancelled = true; -}; - -wrs_PluginEvent.prototype.preventDefault = function () { - this.defaultPrevented = true; -}; - -/** - * Fires MathType event listeners - * @param {String} eventName event name - * @param {Object} e event properties - * @return {bool} false if event has been prevented. - * @ignore - */ -function wrs_fireEventListeners(eventName, e) { - for (var i = 0; i < wrs_pluginListeners.length && !e.cancelled; ++i) { - if (wrs_pluginListeners[i][eventName]) { - // Calling listener. - wrs_pluginListeners[i][eventName](e); - } - } - - return e.defaultPrevented; -} - -/** - * Inserts or modifies formulas. - * @param {object} focusElement Element to be focused - * @param {object} windowTarget Window where the editable content is - * @param {string} mathml Mathml code - * @param {object} wirisProperties Extra attributes for the formula (like background color or font size). - * @param {string} editMode Current edit mode. - * @param {string} language Language for the formula. - * @ignore - */ -function wrs_updateFormula(focusElement, windowTarget, mathml, wirisProperties, editMode, language) { - // Before update listener. - - // Params on beforeUpdate listener - // - mathml - // - editMode (read only) - // - wirisProperties - // - language (read only). - - editMode = editMode !== null ? editMode : _wrs_editMode; - var e = new wrs_PluginEvent(); - - e.mathml = mathml; - - // Cloning wirisProperties object - // We don't want wirisProperties object modified. - e.wirisProperties = {}; - - for (var attr in wirisProperties) { - e.wirisProperties[attr] = wirisProperties[attr]; - } - - // Read only. - e.language = language; - e.editMode = editMode; - - if (wrs_fireEventListeners('onBeforeFormulaInsertion', e)) { - return; - } - - mathml = e.mathml; - wirisProperties = e.wirisProperties; - - // Setting empty params for after. - e = new wrs_PluginEvent(); - e.editMode = editMode; - e.windowTarget = windowTarget; - e.focusElement = focusElement; - - if (mathml.length == 0) { - wrs_insertElementOnSelection(null, focusElement, windowTarget); - } else if (editMode == 'latex') { - e.latex = wrs_getLatexFromMathML(mathml); - // wrs_int_getNonLatexNode is an integration wrapper to have special behaviours for nonLatex. - // Not all the integrations have special behaviours for nonLatex. - if (typeof wrs_int_getNonLatexNode != 'undefined' && (typeof e.latex == 'undefined' || e.latex == null)) { - wrs_int_getNonLatexNode(e, windowTarget, mathml); - } else { - e.node = windowTarget.document.createTextNode('$$' + e.latex + '$$'); - wrs_populateLatexCache(e.latex, mathml); - } - wrs_insertElementOnSelection(e.node, focusElement, windowTarget); - } else if (editMode == 'iframes') { - var iframe = wrs_mathmlToIframeObject(windowTarget, mathml); - wrs_insertElementOnSelection(iframe, focusElement, windowTarget); - } else { - e.node = wrs_mathmlToImgObject(windowTarget.document, mathml, wirisProperties, language); - wrs_insertElementOnSelection(e.node, focusElement, windowTarget); - } - - if (wrs_fireEventListeners('onAfterFormulaInsertion', e)) { - return; - } -} - -/** - * Inserts or modifies formulas or CAS on a textarea. - * @param {object} textarea Target - * @param {string} text Text to add in the textarea. For example, if you want to add the link to the image, you can call this function as wrs_updateTextarea(textarea, wrs_createImageSrc(mathml)); - * @ignore - */ -function wrs_updateTextarea(textarea, text) { - if (textarea && text) { - textarea.focus(); - - if (textarea.selectionStart != null) { - var selectionEnd = textarea.selectionEnd; - textarea.value = textarea.value.substring(0, textarea.selectionStart) + text + textarea.value.substring(textarea.selectionEnd, textarea.value.length); - textarea.selectionEnd = selectionEnd + text.length; - } else { - var selection = document.selection.createRange(); - selection.text = text; - } - } -} - -/** - * Modifies existing formula on a textarea. - * @param {object} textarea Target - * @param {string} text Text to add in the textarea. For example, if you want to add the link to the image, you can call this function as wrs_updateTextarea(textarea, wrs_createImageSrc(mathml)); - * @param {number} start Beggining index from textarea where it needs to be replaced by text. - * @param {number} end Ending index from textarea where it needs to be replaced by text - * @ignore - */ -function wrs_updateExistingFormulaOnTextarea(textarea, text, start, end) { - textarea.focus(); - textarea.value = textarea.value.substring(0, start) + text + textarea.value.substring(end, textarea.value.length); - textarea.selectionEnd = start + text.length; -} - -/** - * URL decode function. - * @param {string} input String to be decoded - * @return {string} decode string. - * @ignore - */ -function wrs_urldecode(input) { - return decodeURIComponent(input); -} - -/** - * URL encode function. - * @param {string} clearString Input string to be encoded - * @return {string} encoded string. - * @ignore - */ -function wrs_urlencode(clearString) { - var output = ''; - // Method encodeURIComponent doesn't encode !'()*~ . - output = encodeURIComponent(clearString); - return output; -} - -function wrs_addArgument(path, key, value) { - var sep; - if (path.indexOf("?") > 0) { - sep = "&"; - } else { - sep = "?"; - } - return path + sep + key + "=" + value; -} - -function wrs_urlToAssArray(url) { - var i; - i = url.indexOf("?"); - if (i > 0) { - var query = url.substring(i + 1); - var ss = query.split("&"); - var h = new Object(); - for (i = 0; i < ss.length; i++) { - var s = ss[i]; - var kv = s.split("="); - if (kv.length > 1) { - h[kv[0]] = decodeURIComponent(kv[1].replace(/\+/g, ' ')); - } - } - return h; - } else { - return new Object(); - } -} - -function wrs_setImgSize(img, url, json) { - - if (json) { - // Cleaning data:image/png;base64. - if (_wrs_conf_imageFormat == 'svg') { - // SVG format. - // If SVG is encoded in base64 we need to convert the base64 bytes into a SVG string. - if (_wrs_conf_saveMode != 'base64') { - var ar = getMetricsFromSvgString(url); - } else { - var base64String = img.src.substr(img.src.indexOf('base64,') + 7, img.src.length); - var svgString = ''; - var bytes = wrs_b64ToByteArray(base64String, base64String.length); - for (var i = 0; i < bytes.length; i++) { - svgString += String.fromCharCode(bytes[i]); - } - var ar = getMetricsFromSvgString(svgString); - } - // PNG format: we store all metrics information in the first 88 bytes. - } else { - var base64String = img.src.substr(img.src.indexOf('base64,') + 7, img.src.length); - var bytes = wrs_b64ToByteArray(base64String, 88); - var ar = wrs_getMetricsFromBytes(bytes); - } - // Backwards compatibility: we store the metrics into createimage response. - } else { - var ar = wrs_urlToAssArray(url); - } - var width = ar['cw']; - if (!width) { - return; - } - var height = ar['ch']; - var baseline = ar['cb']; - var dpi = ar['dpi']; - if (dpi) { - width = width * 96 / dpi; - height = height * 96 / dpi; - baseline = baseline * 96 / dpi; - } - img.width = width; - img.height = height; - img.style.verticalAlign = "-" + (height - baseline) + "px"; -} - -function wrs_fixAfterResize(img) { - img.removeAttribute('style'); - img.removeAttribute('width'); - img.removeAttribute('height'); - // In order to avoid resize with max-width css property. - img.style.maxWidth = 'none'; - if (_wrs_conf_setSize) { - if (img.src.indexOf("data:image") != -1) { - if (_wrs_conf_imageFormat == 'svg') { - // ...data:image/svg+xml;charset=utf8, = 32. - var svg = wrs_urldecode(img.src.substring(32, img.src.length)); - wrs_setImgSize(img, svg, true); - } else { - // ...data:image/png;base64, == 22. - var base64 = img.src.substring(22, img.src.length); - wrs_setImgSize(img, base64, true); - } - } else { - wrs_setImgSize(img, img.src); - } - } -} - -function wrs_initSetSize() { - // Override _wrs_conf_setSize to align formulas when xml or safeXml mode are enabled. - _wrs_conf_setSize = _wrs_conf_setSize || _wrs_conf_saveMode == 'xml' || _wrs_conf_saveMode == 'safeXml' || _wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'default' || _wrs_conf_saveMode == 'image' && _wrs_conf_imageFormat == 'svg'; -} - -/** - * Loads a set of global variables containing server configuration. - * This method calls to configurationjs service, converting the response - * JSON into javascript variables - * @ignore - */ -function wrs_loadConfiguration() { - if (typeof _wrs_conf_path == 'undefined') { - _wrs_conf_path = _wrs_corePath; - } - - var httpRequest = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); - var configUrl = _wrs_int_conf_file.indexOf("/") == 0 || _wrs_int_conf_file.indexOf("http") == 0 ? _wrs_int_conf_file : wrs_concatenateUrl(_wrs_conf_path, _wrs_int_conf_file); - httpRequest.open('GET', configUrl, false); - httpRequest.send(null); - - var jsonConfiguration = JSON.parse(httpRequest.responseText); - - // JSON structure: {{jsVariableName, jsVariableValue}}. - - var variables = Object.keys(jsonConfiguration); - - for (var variable in variables) { - window[variables[variable]] = jsonConfiguration[variables[variable]]; - } - - // Services path (tech dependant). - wrs_loadServicePaths(configUrl); - - // End configuration. - var _wrs_conf_configuration_loaded = true; - if (typeof _wrs_conf_core_loaded != 'undefined') { - _wrs_conf_plugin_loaded = true; - } -} - -function wrs_loadServicePaths(url) { - // Services path (tech dependant). - _wrs_conf_createimagePath = url.replace('configurationjs', 'createimage'); - _wrs_conf_showimagePath = url.replace('configurationjs', 'showimage'); - _wrs_conf_editorPath = url.replace('configurationjs', 'editor'); - _wrs_conf_CASPath = url.replace('configurationjs', 'cas'); - _wrs_conf_createcasimagePath = url.replace('configurationjs', 'createcasimage'); - _wrs_conf_getmathmlPath = url.replace('configurationjs', 'getmathml'); - _wrs_conf_servicePath = url.replace('configurationjs', 'service'); -} - -var _wrs_conf_plugin_loaded = true; - -function wrs_loadLangFile() { - if (_wrs_conf_core_loaded) { - _wrs_stringManager = new StringManager(); - // When a language is not defined, put english (en) as default. - if (typeof _wrs_int_langCode == 'undefined' || _wrs_int_langCode == null) { - _wrs_int_langCode = 'en'; - } - - var langArray = _wrs_languages.split(','); - - if (langArray.indexOf(_wrs_int_langCode) == -1) { - _wrs_int_langCode = _wrs_int_langCode.substr(0, 2); - } - - if (langArray.indexOf(_wrs_int_langCode) == -1) { - _wrs_int_langCode = 'en'; - } - - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = _wrs_corePath + "/lang/" + _wrs_int_langCode + "/strings.js"; - // When strings are loaded, it loads into stringManager - script.onload = function () { - - _wrs_stringManager.loadStrings(wrs_strings); - // Unseting global language strings array to prevent access. - wrs_strings = null; - }; - document.getElementsByTagName('head')[0].appendChild(script); - } else { - setTimeout(wrs_loadLangFile, 100); - } -} - -function wrs_concatenateUrl(path1, path2) { - var separator = ""; - if (path1.indexOf("/") != path1.length && path2.indexOf("/") != 0) { - separator = "/"; - } - return (path1 + separator + path2).replace(/([^:]\/)\/+/g, "$1"); -} - -// Loading javascript configuration. -if (typeof _wrs_conf_configuration_loaded == 'undefined') { - wrs_loadConfiguration(); -} else { - var configUrl = _wrs_int_conf_file.indexOf("/") == 0 || _wrs_int_conf_file.indexOf("http") == 0 ? _wrs_int_conf_file : wrs_concatenateUrl(_wrs_conf_path, _wrs_int_conf_file); - // If javascript configuration is loaded we need to load service paths manually. - wrs_loadServicePaths(configUrl); - _wrs_conf_plugin_loaded = true; -} - -/** - * Populates LaTeX cache into _wrs_int_LatexCache global variable. - * - * @param {string}latex LaTeX code (with $$ separators) - * @param {string} mathml matml LaTeX translation. - * @ignore - */ -function wrs_populateLatexCache(latex, mathml) { - if (mathml.indexOf('semantics') == -1 && mathml.indexOf('annotation') == -1) { - mathml = wrs_insertSemanticsMathml(mathml, latex); - } - if (!_wrs_int_LatexCache.hasOwnProperty(latex)) { - _wrs_int_LatexCache[latex] = mathml; - } -} - -/** - * Populates Non-LaTeX cache into _wrs_int_nonLatexCache global variable. - * Non-LaTeX is called to all the mathmls without LaTeX translation. - * - * @param {string}latex Non-LaTeX code. - * @param {string} mathml matml associated. - * @ignore - */ -function wrs_populateNonLatexCache(latex, mathml) { - if (!_wrs_int_LatexCache.hasOwnProperty(latex)) { - _wrs_int_nonLatexCache[latex] = mathml; - } -} - -/** - * Puts into _wrs_int_AccessibleCache global variable dictionary the pair mathml=>accessibleText. - * - * @param {string} mathml MatML text. - * @param {string} accessibleText Image accessible text - * @ignore - */ -function wrs_populateAccessibleCache(mathml, accessibleText) { - if (!_wrs_int_AccessibleCache.hasOwnProperty(mathml)) { - _wrs_int_AccessibleCache[mathml] = accessibleText; - } -} - -/** - * Add annotation tag to mathml without it (mathml comes from LaTeX string) - * @param {string} mathml MathML code generated by a LaTeX string. - * @param {string} latex Original LaTeX string - * @param {string} withoutLatexTranslate True if not exists latex translation from mathml. - * @return {string} new mathml containing LaTeX code on annotation tag. - * @ignore - */ -function wrs_insertSemanticsMathml(mathml, latex) { - - // If latex is empty, insert semantics doesn't provide information. We can avoid semantics insertion and return the mathml. - if (latex == "") { - return mathml; - } - - var firstEndTag = '>'; - var mathTagEnd = '<' + '/math' + '>'; - var openSemantics = '<' + 'semantics' + '>'; - var closeSemantics = '<' + '/semantics' + '>'; - var openTarget = ''; - var closeTarget = '<' + '/annotation' + '>'; - var mrowOpen = ''; - var mrowClose = ''; - - var indexMathBegin = mathml.indexOf(firstEndTag); - var indexMathEnd = mathml.indexOf(mathTagEnd); - var mathBeginExists = mathml.substring(mathml.indexOf('<'), mathml.indexOf('>')).indexOf('math'); - - if (indexMathBegin != -1 && indexMathEnd != -1 && mathBeginExists) { - var mathmlContent = mathml.substring(indexMathBegin + 1, indexMathEnd); - if (mathmlContent.indexOf(mrowOpen) != 0) { - var mathmlContentSemantics = openSemantics + mrowOpen + mathmlContent + mrowClose + openTarget + latex + closeTarget + closeSemantics; - } else { - var mathmlContentSemantics = openSemantics + mathmlContent + openTarget + latex + closeTarget + closeSemantics; - } - return mathml.replace(mathmlContent, mathmlContentSemantics); - } else { - return mathml; - } -} - -/** - * Removes annotation tag to mathml. - * @param {*} mathml Valid MathML. - */ -function wrs_removeSemanticsMathml(mathml) { - var mathTagEnd = '<' + '/math' + '>'; - var openSemantics = '<' + 'semantics' + '>'; - var openAnnotation = ''; - - var mathmlWithoutSemantics = mathml; - var startSemantics = mathml.indexOf(openSemantics); - if (startSemantics != -1) { - var startAnnotation = mathml.indexOf(openAnnotation, startSemantics + openSemantics.length); - if (startAnnotation != -1) { - mathmlWithoutSemantics = mathml.substring(0, startSemantics) + mathml.substring(startSemantics + openSemantics.length, startAnnotation) + mathTagEnd; - } - } - - return mathmlWithoutSemantics; -} - -/** - * Transform html img tags inside a html code to mathml, base64 img tags (i.e with base64 on src) or showimage img tags (i.e with showimage.php on src) - * - * @param {String} code html code - * @param {String} mode base642showimage or img2mathml or img264 transform. - * @return {String} html code transformed. - * @ignore - */ -function wrs_codeImgTransform(code, mode) { - var output = ''; - - var endPosition = 0; - var pattern = /') { - endPosition = i + 1; - } - - ++i; - } - - if (endPosition < startPosition) { - // The img tag is stripped. - output += code.substring(startPosition, code.length); - return output; - } - var imgCode = code.substring(startPosition, endPosition); - var imgObject = wrs_createObject(imgCode); - var xmlCode = imgObject.getAttribute(_wrs_conf_imageMathmlAttribute); - var convertToXml; - var convertToSafeXml; - - if (mode == 'base642showimage') { - if (xmlCode == null) { - xmlCode = imgObject.getAttribute('alt'); - } - xmlCode = wrs_mathmlDecode(xmlCode); - imgCode = wrs_mathmlToImgObject(document, xmlCode, null, null); - output += wrs_createObjectCode(imgCode); - } else if (mode == 'img2mathml') { - if (window._wrs_conf_saveMode) { - if (_wrs_conf_saveMode == 'safeXml') { - convertToXml = true; - convertToSafeXml = true; - } else if (_wrs_conf_saveMode == 'xml') { - convertToXml = true; - convertToSafeXml = false; - } - } - output += wrs_getWIRISImageOutput(imgCode, convertToXml, convertToSafeXml); - } else if (mode == 'img264') { - - if (xmlCode == null) { - xmlCode = imgObject.getAttribute('alt'); - } - xmlCode = wrs_mathmlDecode(xmlCode); - - var properties = {}; - properties['base64'] = 'true'; - imgCode = wrs_mathmlToImgObject(document, xmlCode, properties, null); - // Metrics. - wrs_setImgSize(imgCode, imgCode.src, true); - - output += wrs_createObjectCode(imgCode); - } - } - output += code.substring(endPosition, code.length); - return output; -} - -/** - * Decode a base64 to its numeric value - * - * @param {String} el base64 character. - * @return {int} base64 char numeric value. - * @ignore - */ -function wrs_decode64(el) { - - var PLUS = '+'.charCodeAt(0); - var SLASH = '/'.charCodeAt(0); - var NUMBER = '0'.charCodeAt(0); - var LOWER = 'a'.charCodeAt(0); - var UPPER = 'A'.charCodeAt(0); - var PLUS_URL_SAFE = '-'.charCodeAt(0); - var SLASH_URL_SAFE = '_'.charCodeAt(0); - var code = el.charCodeAt(0); - - if (code === PLUS || code === PLUS_URL_SAFE) { - return 62; // Char '+'. - } - if (code === SLASH || code === SLASH_URL_SAFE) { - return 63; // Char '/'. - } - if (code < NUMBER) { - return -1; // No match. - } - if (code < NUMBER + 10) { - return code - NUMBER + 26 + 26; - } - if (code < UPPER + 26) { - return code - UPPER; - } - if (code < LOWER + 26) { - return code - LOWER + 26; - } -} - -/** - * Converts a base64 string to a array of bytes. - * @param {String} b64String base64 string. - * @param {int} len dimension of byte array (by default whole string). - * @return {Array} Byte array. - * @ignore - */ -function wrs_b64ToByteArray(b64String, len) { - - var tmp; - - if (b64String.length % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4'); // Tipped base64. Length is fixed. - } - - var arr = new Array(); - - if (!len) { - // All b64String string. - var placeHolders = b64String.charAt(b64String.length - 2) === '=' ? 2 : b64String.charAt(b64String.length - 1) === '=' ? 1 : 0; - var l = placeHolders > 0 ? b64String.length - 4 : b64String.length; - } else { - var l = len; - } - - for (var i = 0; i < l; i += 4) { - // Ignoring code checker standards (bitewise operators). - // See https://tracker.moodle.org/browse/CONTRIB-5862 for further information. - // @codingStandardsIgnoreStart - tmp = wrs_decode64(b64String.charAt(i)) << 18 | wrs_decode64(b64String.charAt(i + 1)) << 12 | wrs_decode64(b64String.charAt(i + 2)) << 6 | wrs_decode64(b64String.charAt(i + 3)); - - arr.push(tmp >> 16 & 0xFF); - arr.push(tmp >> 8 & 0xFF); - arr.push(tmp & 0xFF); - // @codingStandardsIgnoreEnd - } - - if (placeHolders) { - if (placeHolders === 2) { - // Ignoring code checker standards (bitewise operators). - // @codingStandardsIgnoreStart - tmp = wrs_decode64(b64String.charAt(i)) << 2 | wrs_decode64(b64String.charAt(i + 1)) >> 4; - arr.push(tmp & 0xFF); - } else if (placeHolders === 1) { - tmp = wrs_decode64(b64String.charAt(i)) << 10 | wrs_decode64(b64String.charAt(i + 1)) << 4 | wrs_decode64(b64String.charAt(i + 2)) >> 2; - arr.push(tmp >> 8 & 0xFF); - arr.push(tmp & 0xFF); - // @codingStandardsIgnoreEnd - } - } - - return arr; -} - -/** - * Returns the first 32-bit signed integer from a byte array. - * @param {Array} bytes array of bytes. - * @return {int} 32-bit signed integer. - * @ignore - */ -function wrs_readInt32(bytes) { - if (bytes.length < 4) { - return false; - } - var int32 = bytes.splice(0, 4); - // @codingStandardsIgnoreStart - return int32[0] << 24 | int32[1] << 16 | int32[2] << 8 | int32[3] << 0; - // @codingStandardsIgnoreEnd -} - -/** - * Read the first byte from a byte array. - * @param {array} bytes byte array. - * @return {int} first byte of the byte array. - * @ignore - */ -function wrs_readByte(bytes) { - // @codingStandardsIgnoreStart - return bytes.shift() << 0; - // @codingStandardsIgnoreEnd -} - -/** - * Read an arbitrary number of bytes, from a fixed position on a byte array. - * @param {array} bytes byte array. - * @param {int} post start position. - * @param {int} len number of bytes to read. - * @return {array} byte array. - * @ignore - */ -function wrs_readBytes(bytes, pos, len) { - return bytes.splice(pos, len); -} - -/** - * Get metrics (width, height, baseline and dpi) from a png's byte array. - * @param {array} bytes png byte array. - * @return {array} An array containging the png's metrics. - * @ignore - */ -function wrs_getMetricsFromBytes(bytes) { - wrs_readBytes(bytes, 0, 8); - var alloc = 10; - var i = 0; - while (bytes.length >= 4) { - var len = wrs_readInt32(bytes); - var typ = wrs_readInt32(bytes); - if (typ == 0x49484452) { - var width = wrs_readInt32(bytes); - var height = wrs_readInt32(bytes); - // Read 5 bytes. - wrs_readInt32(bytes); - wrs_readByte(bytes); - } else if (typ == 0x62615345) { - // Baseline: 'baSE'. - var baseline = wrs_readInt32(bytes); - } else if (typ == 0x70485973) { - // Dpis: 'pHYs'. - var dpi = wrs_readInt32(bytes); - dpi = Math.round(dpi / 39.37); - wrs_readInt32(bytes); - wrs_readByte(bytes); - } - wrs_readInt32(bytes); - } - - if (typeof width != 'undefined') { - var arr = new Array(); - arr['cw'] = width; - arr['ch'] = height; - arr['dpi'] = dpi; - if (baseline) { - arr['cb'] = baseline; - } - - return arr; - } -} - -function getMetricsFromSvgString(svgString) { - var first = svgString.indexOf('height="'); - var last = svgString.indexOf('"', first + 8, svgString.length); - var height = svgString.substring(first + 8, last); - - first = svgString.indexOf('width="'); - last = svgString.indexOf('"', first + 7, svgString.length); - var width = svgString.substring(first + 7, last); - - first = svgString.indexOf('wrs:baseline="'); - last = svgString.indexOf('"', first + 14, svgString.length); - var baseline = svgString.substring(first + 14, last); - - if (_typeof(width != 'undefined')) { - var arr = new Array(); - arr['cw'] = width; - arr['ch'] = height; - if (typeof baseline != 'undefined') { - arr['cb'] = baseline; - } - - return arr; - } -} - -/** - * Get custom active editor - * @ignore - */ -function wrs_int_getCustomEditorEnabled() { - var customEditorEnabled = null; - for (var key in _wrs_int_customEditors) { - if (_wrs_int_customEditors[key].enabled) { - customEditorEnabled = _wrs_int_customEditors[key]; - break; - } - } - - return customEditorEnabled; -} - -/** - * Disable all custom editors - * @ignore - */ -function wrs_int_disableCustomEditors() { - Object.keys(_wrs_int_customEditors).forEach(function (key) { - _wrs_int_customEditors[key].enabled = false; - }); -} - -/** - * Enable a custom editor - * @param {string} editor a custom editor to be enabled - * @ignore - */ -function wrs_int_enableCustomEditor(editor) { - // Only one custom editor enabled at the same time. - wrs_int_disableCustomEditors(); - if (_wrs_int_customEditors[editor]) { - _wrs_int_customEditors[editor].enabled = true; - } -} - -/** - * Convert a hash to string sorting keys to get a deterministic output - * @param {hash} h a key-value hash - * @return{string} A string with the form key1=value1...keyn=valuen - * @ignore - */ -function wrs_propertiesToString(h) { - // 1. Sort keys. We sort the keys because we want a deterministic output. - var keys = []; - for (var key in h) { - if (h.hasOwnProperty(key)) { - keys.push(key); - } - } - - var n = keys.length; - for (var i = 0; i < n; i++) { - for (var j = i + 1; j < n; j++) { - var s1 = keys[i]; - var s2 = keys[j]; - if (wrs_compareStrings(s1, s2) > 0) { - // Swap. - keys[i] = s2; - keys[j] = s1; - } - } - } - - // 2. Generate output. - var output = ''; - for (var i = 0; i < n; i++) { - var key = keys[i]; - output += key; - output += "="; - var value = h[key]; - value = value.replace("\\", "\\\\"); - value = value.replace("\n", "\\n"); - value = value.replace("\r", "\\r"); - value = value.replace("\t", "\\t"); - - output += value; - output += "\n"; - } - return output; -} - -/** - * Compare two strings using charCodeAt method - * @param {string} a first string to compare. - * @param {string} b second string to compare - * @return {int} the int difference between a and b - * @ignore - */ -function wrs_compareStrings(a, b) { - var i; - var an = a.length; - var bn = b.length; - var n = an > bn ? bn : an; - for (i = 0; i < n; i++) { - var c = wrs_fixedCharCodeAt(a, i) - wrs_fixedCharCodeAt(b, i); - if (c != 0) { - return c; - } - } - return a.length - b.length; -} - -// Polyfills. - -if (!Object.keys) { - Object.keys = function () { - 'use strict'; - - var hasOwnProperty = Object.prototype.hasOwnProperty, - hasDontEnumBug = !{ toString: null }.propertyIsEnumerable('toString'), - dontEnums = ['toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor'], - dontEnumsLength = dontEnums.length; - - return function (obj) { - if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) !== 'object' && (typeof obj !== 'function' || obj === null)) { - throw new TypeError('Object.keys called on non-object'); - } - - var result = [], - prop, - i; - - for (prop in obj) { - if (hasOwnProperty.call(obj, prop)) { - result.push(prop); - } - } - - if (hasDontEnumBug) { - for (i = 0; i < dontEnumsLength; i++) { - if (hasOwnProperty.call(obj, dontEnums[i])) { - result.push(dontEnums[i]); - } - } - } - return result; - }; - }(); -} - +!function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=6)}([function(module,__webpack_exports__,__webpack_require__){"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var md5,_unused_webpack_default_export=md5;!function(){var HxOverrides=function(){};HxOverrides.__name__=!0,HxOverrides.dateStr=function(e){var t=e.getMonth()+1,i=e.getDate(),n=e.getHours(),r=e.getMinutes(),s=e.getSeconds();return e.getFullYear()+"-"+(t<10?"0"+t:""+t)+"-"+(i<10?"0"+i:""+i)+" "+(n<10?"0"+n:""+n)+":"+(r<10?"0"+r:""+r)+":"+(s<10?"0"+s:""+s)},HxOverrides.strDate=function(e){switch(e.length){case 8:var t=e.split(":"),i=new Date;return i.setTime(0),i.setUTCHours(t[0]),i.setUTCMinutes(t[1]),i.setUTCSeconds(t[2]),i;case 10:t=e.split("-");return new Date(t[0],t[1]-1,t[2],0,0,0);case 19:var n=(t=e.split(" "))[0].split("-"),r=t[1].split(":");return new Date(n[0],n[1]-1,n[2],r[0],r[1],r[2]);default:throw"Invalid date format : "+e}},HxOverrides.cca=function(e,t){var i=e.charCodeAt(t);if(i==i)return i},HxOverrides.substr=function(e,t,i){return null!=t&&0!=t&&null!=i&&i<0?"":(null==i&&(i=e.length),t<0?(t=e.length+t)<0&&(t=0):i<0&&(i=e.length+i-t),e.substr(t,i))},HxOverrides.remove=function(e,t){for(var i=0,n=e.length;i>>32-t},str2blks:function(e){for(var t=1+(e.length+8>>6),i=new Array,n=0,r=16*t;n>2]|=HxOverrides.cca(e,s)<<(8*e.length+s)%4*8,s++;i[s>>2]|=128<<(8*e.length+s)%4*8;var o=8*e.length,a=16*t-2;return i[a]=255&o,i[a]|=(o>>>8&255)<<8,i[a]|=(o>>>16&255)<<16,i[a]|=(o>>>24&255)<<24,i},rhex:function(e){for(var t="",i=0;i<4;){var n=i++;t+="0123456789abcdef".charAt(e>>8*n+4&15)+"0123456789abcdef".charAt(e>>8*n&15)}return t},addme:function(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i},bitAND:function(e,t){return(e>>>1&t>>>1)<<1|1&e&t},bitXOR:function(e,t){return(e>>>1^t>>>1)<<1|1&e^1&t},bitOR:function(e,t){return(e>>>1|t>>>1)<<1|(1&e|1&t)},__class__:haxe.Md5},haxe.Timer=function(e){var t=this;this.id=window.setInterval(function(){t.run()},e)},haxe.Timer.__name__=!0,haxe.Timer.delay=function(e,t){var i=new haxe.Timer(t);return i.run=function(){i.stop(),e()},i},haxe.Timer.measure=function(e,t){var i=haxe.Timer.stamp(),n=e();return haxe.Log.trace(haxe.Timer.stamp()-i+"s",t),n},haxe.Timer.stamp=function(){return(new Date).getTime()/1e3},haxe.Timer.prototype={run:function(){},stop:function(){null!=this.id&&(window.clearInterval(this.id),this.id=null)},__class__:haxe.Timer};var js=js||{},$_;function $bind(e,t){var i=function e(){return e.method.apply(e.scope,arguments)};return i.scope=e,i.method=t,i}js.Boot=function(){},js.Boot.__name__=!0,js.Boot.__unhtml=function(e){return e.split("&").join("&").split("<").join("<").split(">").join(">")},js.Boot.__trace=function(e,t){var i,n=null!=t?t.fileName+":"+t.lineNumber+": ":"";n+=js.Boot.__string_rec(e,""),"undefined"!=typeof document&&null!=(i=document.getElementById("haxe:trace"))?i.innerHTML+=js.Boot.__unhtml(n)+"
":"undefined"!=typeof console&&null!=console.log&&console.log(n)},js.Boot.__clear_trace=function(){var e=document.getElementById("haxe:trace");null!=e&&(e.innerHTML="")},js.Boot.isClass=function(e){return e.__name__},js.Boot.isEnum=function(e){return e.__ename__},js.Boot.getClass=function(e){return e.__class__},js.Boot.__string_rec=function(e,t){if(null==e)return"null";if(t.length>=5)return"<...>";var i=_typeof(e);switch("function"==i&&(e.__name__||e.__ename__)&&(i="object"),i){case"object":if(e instanceof Array){if(e.__enum__){if(2==e.length)return e[0];var n=e[0]+"(";t+="\t";for(var r=2,s=e.length;r0?",":"")+js.Boot.__string_rec(e[l],t)}return n+="]"}var c;try{c=e.toString}catch(e){return"???"}if(null!=c&&c!=Object.toString){var u=e.toString();if("[object Object]"!=u)return u}var h=null;n="{\n";t+="\t";var d=null!=e.hasOwnProperty;for(var h in e)d&&!e.hasOwnProperty(h)||"prototype"!=h&&"__class__"!=h&&"__super__"!=h&&"__interfaces__"!=h&&"__properties__"!=h&&(2!=n.length&&(n+=", \n"),n+=t+h+" : "+js.Boot.__string_rec(e[h],t));return n+="\n"+(t=t.substring(1))+"}";case"function":return"";case"string":return e;default:return String(e)}},js.Boot.__interfLoop=function(e,t){if(null==e)return!1;if(e==t)return!0;var i=e.__interfaces__;if(null!=i)for(var n=0,r=i.length;n>>32-t},str2blks:function(e){for(var t=1+(e.length+8>>6),i=new Array,n=0,r=16*t;n>2]|=HxOverrides.cca(e,s)<<(8*e.length+s)%4*8,s++;i[s>>2]|=128<<(8*e.length+s)%4*8;var o=8*e.length,a=16*t-2;return i[a]=255&o,i[a]|=(o>>>8&255)<<8,i[a]|=(o>>>16&255)<<16,i[a]|=(o>>>24&255)<<24,i},rhex:function(e){for(var t="",i=0;i<4;){var n=i++;t+="0123456789abcdef".charAt(e>>8*n+4&15)+"0123456789abcdef".charAt(e>>8*n&15)}return t},addme:function(e,t){var i=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(i>>16)<<16|65535&i},bitAND:function(e,t){return(e>>>1&t>>>1)<<1|1&e&t},bitXOR:function(e,t){return(e>>>1^t>>>1)<<1|1&e^1&t},bitOR:function(e,t){return(e>>>1|t>>>1)<<1|(1&e|1&t)},__class__:haxe.Md5},haxe.Timer=function(e){var t=this;this.id=window.setInterval(function(){t.run()},e)},haxe.Timer.__name__=!0,haxe.Timer.delay=function(e,t){var i=new haxe.Timer(t);return i.run=function(){i.stop(),e()},i},haxe.Timer.measure=function(e,t){var i=haxe.Timer.stamp(),n=e();return haxe.Log.trace(haxe.Timer.stamp()-i+"s",t),n},haxe.Timer.stamp=function(){return(new Date).getTime()/1e3},haxe.Timer.prototype={run:function(){},stop:function(){null!=this.id&&(window.clearInterval(this.id),this.id=null)},__class__:haxe.Timer};var js=js||{},$_;function $bind(e,t){var i=function e(){return e.method.apply(e.scope,arguments)};return i.scope=e,i.method=t,i}js.Boot=function(){},js.Boot.__name__=!0,js.Boot.__unhtml=function(e){return e.split("&").join("&").split("<").join("<").split(">").join(">")},js.Boot.__trace=function(e,t){var i,n=null!=t?t.fileName+":"+t.lineNumber+": ":"";n+=js.Boot.__string_rec(e,""),"undefined"!=typeof document&&null!=(i=document.getElementById("haxe:trace"))?i.innerHTML+=js.Boot.__unhtml(n)+"
":"undefined"!=typeof console&&null!=console.log&&console.log(n)},js.Boot.__clear_trace=function(){var e=document.getElementById("haxe:trace");null!=e&&(e.innerHTML="")},js.Boot.isClass=function(e){return e.__name__},js.Boot.isEnum=function(e){return e.__ename__},js.Boot.getClass=function(e){return e.__class__},js.Boot.__string_rec=function(e,t){if(null==e)return"null";if(t.length>=5)return"<...>";var i=_typeof(e);switch("function"==i&&(e.__name__||e.__ename__)&&(i="object"),i){case"object":if(e instanceof Array){if(e.__enum__){if(2==e.length)return e[0];var n=e[0]+"(";t+="\t";for(var r=2,s=e.length;r0?",":"")+js.Boot.__string_rec(e[l],t)}return n+="]"}var c;try{c=e.toString}catch(e){return"???"}if(null!=c&&c!=Object.toString){var u=e.toString();if("[object Object]"!=u)return u}var h=null;n="{\n";t+="\t";var d=null!=e.hasOwnProperty;for(var h in e)d&&!e.hasOwnProperty(h)||"prototype"!=h&&"__class__"!=h&&"__super__"!=h&&"__interfaces__"!=h&&"__properties__"!=h&&(2!=n.length&&(n+=", \n"),n+=t+h+" : "+js.Boot.__string_rec(e[h],t));return n+="\n"+(t=t.substring(1))+"}";case"function":return"";case"string":return e;default:return String(e)}},js.Boot.__interfLoop=function(e,t){if(null==e)return!1;if(e==t)return!0;var i=e.__interfaces__;if(null!=i)for(var n=0,r=i.length;n=0&&l.splice(t,1)}function m(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var n=function(){0;return i.nc}();n&&(e.attrs.nonce=n)}return g(t,e.attrs),d(e,t),t}function g(e,t){Object.keys(t).forEach(function(i){e.setAttribute(i,t[i])})}function p(e,t){var i,n,r,s;if(t.transform&&e.css){if(!(s=t.transform(e.css)))return function(){};e.css=s}if(t.singleton){var l=a++;i=o||(o=m(t)),n=b.bind(null,i,l,!1),r=b.bind(null,i,l,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(i=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",g(t,e.attrs),d(e,t),t}(t),n=function(e,t,i){var n=i.css,r=i.sourceMap,s=void 0===t.convertToAbsoluteUrls&&r;(t.convertToAbsoluteUrls||s)&&(n=c(n));r&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");var o=new Blob([n],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(o),a&&URL.revokeObjectURL(a)}.bind(null,i,t),r=function(){f(i),i.href&&URL.revokeObjectURL(i.href)}):(i=m(t),n=function(e,t){var i=t.css,n=t.media;n&&e.setAttribute("media",n);if(e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}.bind(null,i),r=function(){f(i)});return n(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;n(e=t)}else r()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=r()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var i=h(e,t);return u(i,t),function(e){for(var r=[],s=0;s«/mo»",ampElement:"«mo»&«/mo»"}}},{key:"safeGoodBlackboardCharacters",get:function(){return{ltElement:"«mo»§lt;«/mo»",gtElement:"«mo»§gt;«/mo»",ampElement:"«mo»§amp;«/mo»"}}}]),e}();function s(e,t){for(var i=0;i",doubleQuote:'"',ampersand:"&",quote:"'"},r.safeXmlCharacters={tagOpener:"«",tagCloser:"»",doubleQuote:"¨",ampersand:"§",quote:"`",realDoubleQuote:"¨"};var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,i){t&&s(e.prototype,t),i&&s(e,i)}(e,null,[{key:"isMathmlInAttribute",value:function(e,t){var i=new RegExp("^['\"][\\s]*=[\\s]*[\\w-]+([\\s]*(\"[^\"]*\"|'[^']*')[\\s]*=[\\s]*[\\w-]+[\\s]*)*[\\s]+gmi<"),n=e.substring(0,t).split("").reverse().join("");return i.test(n)}},{key:"safeXmlDecode",value:function(e){e=(e=(e=(e=e.split(r.safeXmlCharactersEntities.tagOpener).join(r.safeXmlCharacters.tagOpener)).split(r.safeXmlCharactersEntities.tagCloser).join(r.safeXmlCharacters.tagCloser)).split(r.safeXmlCharactersEntities.doubleQuote).join(r.safeXmlCharacters.doubleQuote)).split(r.safeXmlCharactersEntities.realDoubleQuote).join(r.safeXmlCharacters.realDoubleQuote),"_wrs_blackboard"in window&&window._wrs_blackboard&&(e=(e=(e=e.split(r.safeBadBlackboardCharacters.ltElement).join(r.safeGoodBlackboardCharacters.ltElement)).split(r.safeBadBlackboardCharacters.gtElement).join(r.safeGoodBlackboardCharacters.gtElement)).split(r.safeBadBlackboardCharacters.ampElement).join(r.safeGoodBlackboardCharacters.ampElement)),e=(e=(e=(e=(e=e.split(r.safeXmlCharacters.tagOpener).join(r.xmlCharacters.tagOpener)).split(r.safeXmlCharacters.tagCloser).join(r.xmlCharacters.tagCloser)).split(r.safeXmlCharacters.doubleQuote).join(r.xmlCharacters.doubleQuote)).split(r.safeXmlCharacters.ampersand).join(r.xmlCharacters.ampersand)).split(r.safeXmlCharacters.quote).join(r.xmlCharacters.quote);for(var t="",i=null,n=0;n128)t+="&#"+e.codePointAt(i)+";",e.codePointAt(i)>65535&&i++;else if("&"==n){var r=e.indexOf(";",i+1);if(r>=0){var s=document.createElement("span");s.innerHTML=e.substring(i,r+1),t+="&#"+v.fixedCharCodeAt(s.innerText||s.textContent,0)+";",i=r}else t+=n}else t+=n}return t}},{key:"addEditorAttribute",value:function(e,t){var i="",n=e.indexOf("");if(-1==e.indexOf("class"))return i=e.substr(n,r)+' class="wrs_'+t+'">',i+=e.substr(r+1,e.length)}return e}},{key:"insertSemanticsMathml",value:function(e,t,i){if(""==t)return e;var n='',r=e.indexOf(">"),s=e.indexOf(""),o=e.substring(e.indexOf("<"),e.indexOf(">")).indexOf("math");if(-1!=r&&-1!=s&&o){var a=e.substring(r+1,s);if(0!=a.indexOf(""))var l=""+a+""+n+t+"";else l=""+a+n+t+"
";return e.replace(a,l)}return e}},{key:"removeSemanticsMathml",value:function(e,t){var i='',n=e,r=e.indexOf("");if(-1!=r){var s=e.indexOf(i,r+"".length);-1!=s&&(n=e.substring(0,r)+e.substring(r+"".length,s)+"")}return n}},{key:"containClass",value:function(e,t){var i=e.indexOf("class");if(-1==i)return!1;var n=e.indexOf(">",i);return-1!=e.substring(i,n).indexOf(t)}}]),e}();function a(e,t){for(var i=0;i=0;--n)if(i[n]==t)return!0;return!1}},{key:"removeClass",value:function(e,t){for(var i="",n=e.className.split(" "),r=0;r").join("").split("").join("")).split("").join("
").split("").join("
");var n=e.createElement("div",{},i);return n.innerHTML=t,function t(n){if(n.getAttribute&&"WirisParam"==n.getAttribute("wirisObject")){for(var r={},s=0;s0){i+=">";for(n=0;n"}else"DIV"==t.nodeName||"SCRIPT"==t.nodeName?i+=">":i+="/>";return i}return 3==t.nodeType?e.htmlEntities(t.nodeValue):""}}},{key:"concatenateUrl",value:function(e,t){var i="";return e.indexOf("/")!=e.length&&0!=t.indexOf("/")&&(i="/"),(e+i+t).replace(/([^:]\/)\/+/g,"$1")}},{key:"htmlEntities",value:function(e){return e.split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""")}},{key:"htmlEntitiesDecode",value:function(e){return e.split(""").join('"').split(">").join(">").split("<").join("<").split("&").join("&")}},{key:"createHttpRequest",value:function(){if("file://"==window.location.toString().substr(0,window.location.toString().lastIndexOf("/")+1).substr(0,7))throw Core.getStringManager().getString("exception_cross_site");if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}return!1}},{key:"httpBuildQuery",value:function(t){var i="";for(var n in t)null!=t[n]&&(i+=e.urlEncode(n)+"="+e.urlEncode(t[n])+"&");return"&"==i.substring(i.length-1)&&(i=i.substring(0,i.length-1)),i}},{key:"propertiesToString",value:function(t){var i=[];for(var n in t)t.hasOwnProperty(n)&&i.push(n);for(var r=i.length,s=0;s0&&(i[s]=l,i[o]=a)}var c="";for(s=0;ss?s:r;for(n=0;n0){var i=e.substring(t+1).split("&"),n=new Object;for(t=0;t1&&(n[r[0]]=decodeURIComponent(r[1].replace(/\+/g," ")))}return n}return new Object}},{key:"urlEncode",value:function(e){return encodeURIComponent(e)}},{key:"getWIRISImageOutput",value:function(t,i,n){var r=e.createObject(t);if(r){if(r.className==l.get("imageClassName")||r.getAttribute(l.get("imageMathmlAttribute"))){if(!i)return t;var s=r.getAttribute(l.get("imageMathmlAttribute"));return null==s&&(s=r.getAttribute("alt")),n||(s=o.safeXmlDecode(s)),s}if(r.className==l.get("CASClassName")){var a=r.getAttribute(l.get("CASMathmlAttribute"));a=o.safeXmlDecode(a);var c=e.createObject(a);c.setAttribute("src",r.src);var u=e.createObjectCode(c);return n&&(u=o.safeXmlEncode(u)),u}}return t}},{key:"getNodeLength",value:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){if(3==e.nodeType)return e.nodeValue.length;if(1==e.nodeType){var t={IMG:1,BR:1}[e.nodeName.toUpperCase()];void 0===t&&(t=0);for(var i=0;i0)return 0==c.text.length?e.getSelectedItem(t,i,!0):null;r.document.execCommand("InsertImage",!1,"#");var s,o=c.parentElement();return"IMG"!=o.nodeName.toUpperCase()&&(c.pasteHTML(''),o=r.document.getElementById("wrs_openEditorWindow_temporalObject")),o.nextSibling&&3==o.nextSibling.nodeType?(a=o.nextSibling,s=0):o.previousSibling&&3==o.previousSibling.nodeType?s=(a=o.previousSibling).nodeValue.length:(a=r.document.createTextNode(""),o.parentNode.insertBefore(a,o),s=0),o.parentNode.removeChild(o),{node:a,caretPosition:s}}return c.length>1?null:{node:c.item(0)}}if(r.getSelection){var a,l=r.getSelection();try{var c=l.getRangeAt(0)}catch(e){c=r.document.createRange()}if(3==(a=c.startContainer).nodeType)return{node:a,caretPosition:c.startOffset};if(a!=c.endContainer)return null;if(1==a.nodeType){var u=c.startOffset;if(a.childNodes[u])return{node:a.childNodes[u]}}}return null}},{key:"getSelectedItemOnTextarea",value:function(e){var t=document.createTextNode(e.value),i=g.getLatexFromTextNode(t,e.selectionStart);return null===i?null:{node:t,caretPosition:e.selectionStart,startPosition:i.startPosition,endPosition:i.endPosition}}},{key:"getElementsByNameFromString",value:function(e,t,i){var n=[];e=e.toLowerCase();t=t.toLowerCase();for(var r=e.indexOf("<"+t+" ");-1!=r;){var s;s=i?">":"";var o=e.indexOf(s,r);-1!=o?(o+=s.length,n.push({start:r,end:o})):o=r+1,r=e.indexOf("<"+t+" ",o)}return n}},{key:"decode64",value:function(e){var t="+".charCodeAt(0),i="/".charCodeAt(0),n="0".charCodeAt(0),r="a".charCodeAt(0),s="A".charCodeAt(0),o="-".charCodeAt(0),a="_".charCodeAt(0),l=e.charCodeAt(0);return l===t||l===o?62:l===i||l===a?63:l0)throw new Error("Invalid string. Length must be a multiple of 4");var r=new Array;if(i)o=i;else var s="="===t.charAt(t.length-2)?2:"="===t.charAt(t.length-1)?1:0,o=s>0?t.length-4:t.length;for(var a=0;a>16&255),r.push(n>>8&255),r.push(255&n);return s&&(2===s?(n=e.decode64(t.charAt(a))<<2|e.decode64(t.charAt(a+1))>>4,r.push(255&n)):1===s&&(n=e.decode64(t.charAt(a))<<10|e.decode64(t.charAt(a+1))<<4|e.decode64(t.charAt(a+2))>>2,r.push(n>>8&255),r.push(255&n))),r}},{key:"readInt32",value:function(e){if(e.length<4)return!1;var t=e.splice(0,4);return t[0]<<24|t[1]<<16|t[2]<<8|t[3]<<0}},{key:"readByte",value:function(e){return e.shift()<<0}},{key:"readBytes",value:function(e,t,i){return e.splice(t,i)}},{key:"updateTextArea",value:function(e,t){if(e&&t)if(e.focus(),null!=e.selectionStart){var i=e.selectionEnd;e.value=e.value.substring(0,e.selectionStart)+t+e.value.substring(e.selectionEnd,e.value.length),e.selectionEnd=i+t.length}else{document.selection.createRange().text=t}}},{key:"updateExistingTextOnTextarea",value:function(e,t,i,n){e.focus(),e.value=e.value.substring(0,i)+t+e.value.substring(n,e.value.length),e.selectionEnd=i+t.length}},{key:"addArgument",value:function(e,t,i){return e+(e.indexOf("?")>0?"&":"?")+t+"="+i}}]),e}();function b(e,t){for(var i=0;i-1,this.deviceProperties.isIOS=this.ua.indexOf("ipad")>-1||this.ua.indexOf("iphone")>-1,this.toolbar=null,this.modalDialogInstance=null,this.listeners=new y,this.mathML=null,this.isNewElement=!0,this.integrationModel=null,this.isEditorLoaded=!1}return function(e,t,i){t&&E(e.prototype,t),i&&E(e,i)}(e,[{key:"addListener",value:function(e){this.listeners.add(e)}},{key:"setIntegrationModel",value:function(e){this.integrationModel=e}},{key:"setModalDialogInstance",value:function(e){this.modalDialogInstance=e}},{key:"insert",value:function(){this.updateTitle(this.modalDialogInstance),this.insertEditor(this.modalDialogInstance)}},{key:"insertEditor",value:function(){if("com"in window&&"wiris"in window.com&&"jsEditor"in window.com.wiris){if(this.editor=com.wiris.jsEditor.JsEditor.newInstance(this.editorAttributes),this.editor.insertInto(this.modalDialogInstance.contentContainer),this.editor.focus(),this.modalDialogInstance.rtl&&this.editor.action("rtl"),this.editor.getEditorModel().isRTL()&&(this.editor.element.style.direction="rtl"),this.editor.getEditorModel().addEditorListener(this.editorListener),this.modalDialogInstance.deviceProperties.isIOS){setTimeout(function(){this.modalDialogInstance.hideKeyboard()},400);var t=document.getElementsByClassName("wrs_formulaDisplay")[0];v.addEvent(t,"focus",this.modalDialogInstance.openedIosSoftkeyboard.bind()),v.addEvent(t,"blur",this.modalDialogInstance.closedIosSoftkeyboard.bind())}this.listeners.fire("onLoad",{}),this.isEditorLoaded=!0}else setTimeout(e.prototype.insertEditor.bind(this,this.modalDialogInstance),100)}},{key:"init",value:function(){for(var e=window.location.search.substring(1).split("&"),t=0;t=0&&(version=e[t].substring(2))}var i=document.createElement("script");i.type="text/javascript";var n=l.get("editorUrl"),r=document.createElement("a");r.href=n,0==window.location.href.indexOf("https://")&&"http:"==r.protocol&&(r.protocol="https:"),n="80"==r.port||"443"==r.port?r.protocol+"//"+r.hostname+"/"+r.pathname:r.protocol+"//"+r.hostname+":"+r.port+"/"+r.pathname;var s={};"editor"in this.environment?s.editor=this.environment.editor:s.editor="unknown","mode"in this.environment?s.mode=this.environment.mode:s.mode=l.get("saveMode"),"version"in this.environment?s.version=this.environment.version:s.version=l.get("version"),i.src=n+"?lang="+this.language+"&stats-editor="+s.editor+"&stats-mode="+s.mode+"&stats-version="+s.version,document.getElementsByTagName("head")[0].appendChild(i)}},{key:"setInitialContent",value:function(){this.isNewElement||this.setMathML(this.mathML)}},{key:"setMathML",value:function(e,t){void 0===t&&(t=!1),this.editor.setMathMLWithCallback(e,function(){this.editorListener.setWaitingForChanges(!0)}.bind(this)),setTimeout(function(){this.editorListener.setIsContentChanged(!1)}.bind(this),500),t||this.onFocus()}},{key:"onFocus",value:function(){void 0!==this.editor&&null!=this.editor&&this.editor.focus()}},{key:"submitAction",value:function(){var e=this.editor.getMathML();null!=this.customEditors.getActiveEditor()&&(e=o.addEditorAttribute(e,this.customEditors.getActiveEditor().toolbar));var t=o.mathMLEntities(e);this.integrationModel.updateFormula(t),this.customEditors.disable(),this.integrationModel.notifyWindowClosed(),this.setEmptyMathML(),this.customEditors.disable(),setTimeout(function(){"undefined"!=typeof _wrs_currentEditor&&_wrs_currentEditor&&_wrs_currentEditor.focus()},100)}},{key:"setEmptyMathML",value:function(){this.deviceProperties.isAndroid||this.deviceProperties.isIOS?this.editor.getEditorModel().isRTL()?this.setMathML('[]"',!0):this.setMathML('[]"',!0):this.editor.getEditorModel().isRTL()?this.setMathML('',!0):this.setMathML("",!0)}},{key:"onOpen",value:function(){this.isNewElement?this.setEmptyMathML():this.setMathML(this.mathML),this.updateToolbar(),this.onFocus()}},{key:"updateToolbar",value:function(){var e;if(this.updateTitle(this.modalDialogInstance),e=this.customEditors.getActiveEditor()){var t=e.toolbar?e.toolbar:_wrs_int_wirisProperties.toolbar;null!=this.toolbar&&this.toolbar==t||this.setToolbar(t)}else{t=this.getToolbar();null!=this.toolbar&&this.toolbar==t||(this.setToolbar(t),this.customEditors.disable())}}},{key:"updateTitle",value:function(){var e;(e=this.customEditors.getActiveEditor())?this.modalDialogInstance.setTitle(e.title):this.modalDialogInstance.setTitle("MathType")}},{key:"getToolbar",value:function(){var e;return"general"==(e="toolbar"in this.editorAttributes?this.editorAttributes.toolbar:"general")&&(e="undefined"==typeof _wrs_int_wirisProperties||void 0===_wrs_int_wirisProperties.toolbar?"general":_wrs_int_wirisProperties.toolbar),e}},{key:"setToolbar",value:function(e){this.toolbar=e,this.editor.setParams({toolbar:this.toolbar})}},{key:"hasChanges",value:function(){return!this.editor.isFormulaEmpty()&&this.editorListener.getIsContentChanged()}}]),e}();function k(e,t){for(var i=0;i-1,r=i.indexOf("ipad")>-1||i.indexOf("iphone")>-1;this.iosSoftkeyboardOpened=!1,this.iosMeasureUnit=-1==i.indexOf("crios")?"%":"vh",this.iosDivHeight="100"+this.iosMeasureUnit;var s=window.outerWidth,o=window.outerHeight,a=s>o,l=so||l&&this.attributes.width>s);this.instanceId=document.getElementsByClassName("wrs_modal_dialogContainer").length,this.deviceProperties={orientation:a?"landscape":"portait",isAndroid:!!n,isIOS:!!r,isMobile:c,isDesktop:!c&&!r&&!n},this.properties={created:!1,state:"",previousState:"",position:{bottom:0,right:10},size:{height:338,width:580}};var u={class:"wrs_modal_overlay"};u.id=this.getElementId(u.class),this.overlay=v.createElement("div",u),(u={}).class="wrs_modal_title_bar",u.id=this.getElementId(u.class),this.titleBar=v.createElement("div",u),(u={}).class="wrs_modal_title",u.id=this.getElementId(u.class),this.title=v.createElement("div",u),this.title.innerHTML="",(u={}).class="wrs_modal_close_button",u.id=this.getElementId(u.class),u.title=$.getStringManager().getString("close"),this.closeDiv=v.createElement("a",u),this.closeDiv.setAttribute("role","button"),(u={}).class="wrs_modal_stack_button",u.id=this.getElementId(u.class),u.title="Exit full-screen",this.stackDiv=v.createElement("a",u),this.stackDiv.setAttribute("role","button"),(u={}).class="wrs_modal_maximize_button",u.id=this.getElementId(u.class),u.title=$.getStringManager().getString("fullscreen"),this.maximizeDiv=v.createElement("a",u),this.maximizeDiv.setAttribute("role","button"),(u={}).class="wrs_modal_minimize_button",u.id=this.getElementId(u.class),u.title=$.getStringManager().getString("minimise"),this.minimizeDiv=v.createElement("a",u),this.minimizeDiv.setAttribute("role","button"),(u={}).class="wrs_modal_dialogContainer",u.id=this.getElementId(u.class),this.container=v.createElement("div",u),(u={}).class="wrs_modal_wrapper",u.id=this.getElementId(u.class),this.wrapper=v.createElement("div",u),(u={}).class="wrs_content_container",u.id=this.getElementId(u.class),this.contentContainer=v.createElement("div",u),(u={}).class="wrs_modal_controls",u.id=this.getElementId(u.class),this.controls=v.createElement("div",u),(u={}).class="wrs_modal_buttons_container",u.id=this.getElementId(u.class),this.buttonContainer=v.createElement("div",u),this.submitButton=this.createSubmitButton({id:this.getElementId("wrs_modal_button_accept"),class:"wrs_modal_button_accept",innerHTML:$.getStringManager().getString("accept")},this.submitAction.bind(this)),this.cancelButton=this.createSubmitButton({id:this.getElementId("wrs_modal_button_cancel"),class:"wrs_modal_button_cancel",innerHTML:$.getStringManager().getString("cancel")},this.cancelAction.bind(this)),this.contentManager=null;var h={cancelString:$.getStringManager().getString("cancel"),submitString:$.getStringManager().getString("close"),message:$.getStringManager().getString("close_modal_warning")},d={closeCallback:function(){this.close()}.bind(this),cancelCallback:function(){this.focus()}.bind(this)},f={overlayElement:this.container,callbacks:d,strings:h};this.popup=new S(f),this.rtl=!1,"rtl"in this.attributes&&(this.rtl=this.attributes.rtl)}return function(e,t,i){t&&O(e.prototype,t),i&&O(e,i)}(e,[{key:"setContentManager",value:function(e){this.contentManager=e}},{key:"getContentManager",value:function(){return this.contentManager}},{key:"submitAction",value:function(){void 0!==this.contentManager.submitAction&&this.contentManager.submitAction(),this.close()}},{key:"cancelAction",value:function(){void 0===this.contentManager.hasChanges?this.close():this.contentManager.hasChanges()?this.showPopUpMessage():this.close()}},{key:"createSubmitButton",value:function(e,t){function i(e,t){this.element=document.createElement("button"),this.element.id=e.id,this.element.className=e.class,this.element.innerHTML=e.innerHTML,v.addEvent(this.element,"click",t)}return i.prototype.getElement=function(){return this.element},new i(e,t).getElement()}},{key:"create",value:function(){this.titleBar.appendChild(this.closeDiv),this.titleBar.appendChild(this.stackDiv),this.titleBar.appendChild(this.maximizeDiv),this.titleBar.appendChild(this.minimizeDiv),this.titleBar.appendChild(this.title),this.deviceProperties.isDesktop&&this.container.appendChild(this.titleBar),this.wrapper.appendChild(this.contentContainer),this.wrapper.appendChild(this.controls),this.controls.appendChild(this.buttonContainer),this.buttonContainer.appendChild(this.submitButton),this.buttonContainer.appendChild(this.cancelButton),this.container.appendChild(this.wrapper),this.recalculateScrollBar(),document.body.appendChild(this.container),document.body.appendChild(this.overlay),this.deviceProperties.isDesktop?(this.createModalWindowDesktop(),this.createResizeButtons(),this.addListeners(),l.get("modalWindowFullScreen")&&this.maximize()):this.deviceProperties.isAndroid?this.createModalWindowAndroid():this.deviceProperties.isIOS&&!this.deviceProperties.isMobile&&this.createModalWindowIos(),null!=this.contentManager&&this.contentManager.insert(this),this.properties.open=!0,this.properties.created=!0,this.isRTL()&&(this.container.style.right=window.innerWidth-this.scrollbarWidth-this.container.offsetWidth+"px",this.container.className+=" wrs_modal_rtl")}},{key:"createResizeButtons",value:function(){this.resizerBR=document.createElement("div"),this.resizerBR.className="wrs_bottom_right_resizer",this.resizerBR.innerHTML="◢",this.resizerTL=document.createElement("div"),this.resizerTL.className="wrs_bottom_left_resizer",this.container.appendChild(this.resizerBR),this.titleBar.appendChild(this.resizerTL),v.addEvent(this.resizerBR,"mousedown",this.activateResizeStateBR.bind(this)),v.addEvent(this.resizerTL,"mousedown",this.activateResizeStateTL.bind(this))}},{key:"activateResizeStateBR",value:function(e){this.initializeResizeProperties(e,!1)}},{key:"activateResizeStateTL",value:function(e){this.initializeResizeProperties(e,!0)}},{key:"initializeResizeProperties",value:function(e,t){v.addClass(document.body,"wrs_noselect"),v.addClass(this.overlay,"wrs_overlay_active"),this.resizeDataObject={x:this.eventClient(e).X,y:this.eventClient(e).Y},this.initialWidth=parseInt(this.container.style.width),this.initialHeight=parseInt(this.container.style.height),t?this.leftScale=!0:(this.initialRight=parseInt(this.container.style.right),this.initialBottom=parseInt(this.container.style.bottom)),this.initialRight||(this.initialRight=0),this.initialBottom||(this.initialBottom=0),document.body.style["user-select"]="none"}},{key:"open",value:function(){if(this.removeClass("wrs_closed"),(this.deviceProperties.isIOS||this.deviceProperties.isAndroid||this.deviceProperties.isMobile)&&(this.restoreWebsiteScale(),this.blockWebsiteScroll(),setTimeout(function(){this.hideKeyboard()}.bind(this),400)),this.properties.created?(this.properties.open||(this.properties.open=!0,this.deviceProperties.isAndroid||this.deviceProperties.isIOS||this.restoreState()),this.deviceProperties.isDesktop&&l.get("modalWindowFullScreen")&&this.maximize(),this.deviceProperties.isIOS&&(this.iosSoftkeyboardOpened=!1,this.setContainerHeight("100"+this.iosMeasureUnit))):this.create(),!1===this.contentManager.isEditorLoaded){var e=y.newListener("onLoad",function(){this.contentManager.onOpen(this)}.bind(this));this.contentManager.addListener(e)}else this.contentManager.onOpen(this)}},{key:"close",value:function(){this.removeClass("wrs_maximized"),this.removeClass("wrs_minimized"),this.removeClass("wrs_stack"),this.addClass("wrs_closed"),this.saveModalProperties(),this.unblockWebsiteScroll(),this.properties.open=!1}},{key:"restoreWebsiteScale",value:function(){var e=document.querySelector("meta[name=viewport]"),t=["initial-scale=","minimum-scale=","maximum-scale="],i=["1.0","1.0","1.0"],n=function(e,t){var n=e.getAttribute("content");if(n){for(var r=n.split(","),s="",o=[],a=0;a=0||navigator.userAgent.search("Trident/")>=0||navigator.userAgent.search("Edge/")>=0}},{key:"isRTL",value:function(){return"ar"==this.attributes.language||"he"==this.attributes.language||this.rtl}},{key:"addClass",value:function(e){v.addClass(this.overlay,e),v.addClass(this.titleBar,e),v.addClass(this.overlay,e),v.addClass(this.container,e),v.addClass(this.contentContainer,e),v.addClass(this.stackDiv,e),v.addClass(this.minimizeDiv,e),v.addClass(this.maximizeDiv,e),v.addClass(this.wrapper,e)}},{key:"removeClass",value:function(e){v.removeClass(this.overlay,e),v.removeClass(this.titleBar,e),v.removeClass(this.overlay,e),v.removeClass(this.container,e),v.removeClass(this.contentContainer,e),v.removeClass(this.stackDiv,e),v.removeClass(this.minimizeDiv,e),v.removeClass(this.maximizeDiv,e),v.removeClass(this.wrapper,e)}},{key:"createModalWindowDesktop",value:function(){this.addClass("wrs_modal_desktop"),this.stack()}},{key:"createModalWindowAndroid",value:function(){this.addClass("wrs_modal_android"),window.addEventListener("resize",this.orientationChangeAndroidSoftkeyboard.bind(this))}},{key:"createModalWindowIos",value:function(){this.addClass("wrs_modal_ios"),window.addEventListener("resize",this.orientationChangeIosSoftkeyboard.bind(this))}},{key:"restoreState",value:function(){"maximized"==this.properties.state?this.maximize():"minimized"==this.properties.state?(this.properties.state=this.properties.previousState,this.properties.previousState="",this.minimize()):this.stack()}},{key:"stack",value:function(){this.properties.previousState=this.properties.state,this.properties.state="stack",this.removeClass("wrs_maximized"),this.minimizeDiv.title="Minimise",this.removeClass("wrs_minimized"),this.addClass("wrs_stack"),this.restoreModalProperties(),void 0!==this.resizerBR&&void 0!==this.resizerTL&&this.setResizeButtonsVisibility(),this.recalculateScrollBar(),this.recalculatePosition(),this.recalculateScale(),this.focus()}},{key:"minimize",value:function(){this.saveModalProperties(),"minimized"==this.properties.state&&"stack"==this.properties.previousState?this.stack():"minimized"==this.properties.state&&"maximized"==this.properties.previousState?this.maximize():(this.container.style.height="30px",this.container.style.width="250px",this.container.style.bottom="0px",this.container.style.right="10px",this.removeListeners(),this.properties.previousState=this.properties.state,this.properties.state="minimized",this.setResizeButtonsVisibility(),this.minimizeDiv.title="Maximise",v.containsClass(this.overlay,"wrs_stack")?this.removeClass("wrs_stack"):this.removeClass("wrs_maximized"),this.addClass("wrs_minimized"))}},{key:"maximize",value:function(){this.saveModalProperties(),"maximized"!=this.properties.state&&(this.properties.previousState=this.properties.state,this.properties.state="maximized"),this.setResizeButtonsVisibility(),v.containsClass(this.overlay,"wrs_minimized")?(this.minimizeDiv.title="Minimise",this.removeClass("wrs_minimized")):v.containsClass(this.overlay,"wrs_stack")&&(this.container.style.left=null,this.container.style.top=null,this.removeClass("wrs_stack")),this.addClass("wrs_maximized"),this.setSize(parseInt(.8*window.innerHeight),parseInt(.8*window.innerWidth));this.container.clientHeight>700&&(this.container.style.height="700px"),this.container.clientWidth>1200&&(this.container.style.width="1200px"),this.setPosition(window.innerHeight/2-this.container.offsetHeight/2,window.innerWidth/2-this.container.offsetWidth/2),this.recalculateScale(),this.recalculatePosition(),this.recalculateSize(),this.focus()}},{key:"setSize",value:function(e,t){this.container.style.height=e+"px",this.container.style.width=t+"px",this.recalculateSize()}},{key:"setPosition",value:function(e,t){this.container.style.bottom=e+"px",this.container.style.right=t+"px"}},{key:"saveModalProperties",value:function(){"stack"==this.properties.state&&(this.properties.position.bottom=parseInt(this.container.style.bottom),this.properties.position.right=parseInt(this.container.style.right),this.properties.size.width=parseInt(this.container.style.width),this.properties.size.height=parseInt(this.container.style.height))}},{key:"restoreModalProperties",value:function(){"stack"==this.properties.state&&(this.setPosition(this.properties.position.bottom,this.properties.position.right),this.setSize(this.properties.size.height,this.properties.size.width))}},{key:"recalculateSize",value:function(){this.wrapper.style.width=this.container.clientWidth-12+"px",this.wrapper.style.height=this.container.clientHeight-38+"px",this.contentContainer.style.height=parseInt(this.wrapper.offsetHeight-50)+"px"}},{key:"setResizeButtonsVisibility",value:function(){"stack"==this.properties.state?(this.resizerTL.style.visibility="visible",this.resizerBR.style.visibility="visible"):(this.resizerTL.style.visibility="hidden",this.resizerBR.style.visibility="hidden")}},{key:"addListeners",value:function(){this.maximizeDiv.addEventListener("click",this.maximize.bind(this),!0),this.stackDiv.addEventListener("click",this.stack.bind(this),!0),this.minimizeDiv.addEventListener("click",this.minimize.bind(this),!0),this.closeDiv.addEventListener("click",this.cancelAction.bind(this)),v.addEvent(window,"mousedown",this.startDrag.bind(this)),v.addEvent(window,"mouseup",this.stopDrag.bind(this)),v.addEvent(window,"mousemove",this.drag.bind(this)),v.addEvent(window,"resize",this.onWindowResize.bind(this)),v.addEvent(window,"keydown",this.onKeyDown.bind(this))}},{key:"removeListeners",value:function(){v.removeEvent(window,"mousedown",this.startDrag),v.removeEvent(window,"mouseup",this.stopDrag),v.removeEvent(window,"mousemove",this.drag),v.removeEvent(window,"resize",this.onWindowResize),v.removeEvent(window,"keydown",this.onKeyDown)}},{key:"eventClient",value:function(e){if(void 0===e.clientX&&e.changedTouches){var t={X:e.changedTouches[0].clientX,Y:e.changedTouches[0].clientY};return t}return t={X:e.clientX,Y:e.clientY}}},{key:"startDrag",value:function(e){"minimized"!=this.properties.state&&e.target===this.title&&(void 0!==this.dragDataObject&&null!==this.dragDataObject||(e=e||event,this.dragDataObject={x:this.eventClient(e).X,y:this.eventClient(e).Y},this.lastDrag={x:"0px",y:"0px"},""==this.container.style.right&&(this.container.style.right="0px"),""==this.container.style.bottom&&(this.container.style.bottom="0px"),this.isIE11(),v.addClass(document.body,"wrs_noselect"),v.addClass(this.overlay,"wrs_overlay_active"),this.limitWindow=this.getLimitWindow()))}},{key:"drag",value:function(e){if(this.dragDataObject){e.preventDefault(),e=e||event;var t=Math.min(this.eventClient(e).Y,this.limitWindow.minPointer.y);t=Math.max(this.limitWindow.maxPointer.y,t);var i=Math.min(this.eventClient(e).X,this.limitWindow.minPointer.x),n=(i=Math.max(this.limitWindow.maxPointer.x,i))-this.dragDataObject.x+"px",r=t-this.dragDataObject.y+"px";this.lastDrag={x:n,y:r},this.container.style.transform="translate3d("+n+","+r+",0)"}if(this.resizeDataObject){var s;i=Math.min(this.eventClient(e).X,window.innerWidth-this.scrollbarWidth-7),t=Math.min(this.eventClient(e).Y,window.innerHeight-7);i<0&&(i=0),t<0&&(t=0),s=this.leftScale?-1:1,this.container.style.width=this.initialWidth+s*(i-this.resizeDataObject.x)+"px",this.container.style.height=this.initialHeight+s*(t-this.resizeDataObject.y)+"px",this.leftScale||(this.resizeDataObject.x-i-this.initialWidth<-580?this.container.style.right=this.initialRight-(i-this.resizeDataObject.x)+"px":(this.container.style.right=this.initialRight+this.initialWidth-580+"px",this.container.style.width="580px"),this.resizeDataObject.y-t580?(this.container.style.width=Math.min(parseInt(this.container.style.width),window.innerWidth-this.scrollbarWidth)+"px",e=!0):(this.container.style.width="580px",e=!0),parseInt(this.container.style.height)>338?(this.container.style.height=Math.min(parseInt(this.container.style.height),window.innerHeight)+"px",e=!0):(this.container.style.height="338px",e=!0),e&&this.recalculateSize()}},{key:"recalculateScrollBar",value:function(){this.hasScrollBar=window.innerWidth>document.documentElement.clientWidth,this.hasScrollBar?this.scrollbarWidth=this.getScrollBarWidth():this.scrollbarWidth=0}},{key:"hideKeyboard",value:function(){document.activeElement.blur()}},{key:"focus",value:function(){null!=this.contentManager&&void 0!==this.contentManager.onFocus&&this.contentManager.onFocus()}},{key:"portraitMode",value:function(){return window.innerHeight>window.innerWidth}},{key:"openedIosSoftkeyboard",value:function(){this.iosSoftkeyboardOpened||null==this.iosDivHeight||this.iosDivHeight!="100"+this.iosMeasureUnit||(this.portraitMode()?this.setContainerHeight("63"+this.iosMeasureUnit):this.setContainerHeight("40"+this.iosMeasureUnit)),this.iosSoftkeyboardOpened=!0}},{key:"closedIosSoftkeyboard",value:function(){this.iosSoftkeyboardOpened=!1,this.setContainerHeight("100"+this.iosMeasureUnit)}},{key:"orientationChangeIosSoftkeyboard",value:function(){this.iosSoftkeyboardOpened?this.portraitMode()?this.setContainerHeight("63"+this.iosMeasureUnit):this.setContainerHeight("40"+this.iosMeasureUnit):this.setContainerHeight("100"+this.iosMeasureUnit)}},{key:"orientationChangeAndroidSoftkeyboard",value:function(){this.setContainerHeight("100%")}},{key:"setContainerHeight",value:function(e){this.iosDivHeight=e,this.wrapper.style.height=e}},{key:"showPopUpMessage",value:function(){"minimized"==this.properties.state&&this.stack(),this.popup.show()}},{key:"setTitle",value:function(e){this.title.innerHTML=e}},{key:"getElementId",value:function(e){return e+"["+this.instanceId+"]"}}]),e}();function I(e){return(I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function T(e,t){for(var i=0;i=4;){v.readInt32(e);var t=v.readInt32(e);if(1229472850==t){var i=v.readInt32(e),n=v.readInt32(e);v.readInt32(e),v.readByte(e)}else if(1650545477==t)var r=v.readInt32(e);else if(1883789683==t){var s=v.readInt32(e);s=Math.round(s/39.37),v.readInt32(e),v.readByte(e)}v.readInt32(e)}if(void 0!==i){var o=new Array;return o.cw=i,o.ch=n,o.dpi=s,r&&(o.cb=r),o}}}]),e}();function A(e,t){for(var i=0;i"),m=c.substring(0,f),p=m.split(" width=").join(' class="Wiriscas" width=');c=(c=c.split(m).join(p)).split("'").join('"')}}var b='';t=t.substring(0,n[a].start+s)+b+t.substring(n[a].end+s),s+=b.length-(n[a].end-n[a].start)}}return t}},{key:"initParseEditMode",value:function(e){if(-1!=l.get("parseModes").indexOf("latex"))for(var t=v.getElementsByNameFromString(e,"img",!0),i='encoding="LaTeX">',n=0,r=0;r",d),m=h.substring(d,f),g="$$"+v.htmlEntitiesDecode(m)+"$$";e=e.substring(0,t[r].start+n)+g+e.substring(t[r].end+n),n+=g.length-(t[r].end-t[r].start)}}}}return e}},{key:"endParse",value:function(t){return t=e.endParseEditMode(t),e.endParseSaveMode(t)}},{key:"endParseEditMode",value:function(e){if(-1!=l.get("parseModes").indexOf("latex")){for(var t="",i=0,n=e.indexOf("$$");-1!=n;){if(t+=e.substring(i,n),-1!=(i=e.indexOf("$$",n+2))){var r=e.substring(n+2,i);r=v.htmlEntitiesDecode(r),t+=g.getMathMLFromLatex(r,!0),i+=2}else t+="$$",i=n+2;n=e.indexOf("$$",i)}e=t+=e.substring(i,e.length)}return e}},{key:"endParseSaveMode",value:function(t){return l.get("saveMode")&&("safeXml"==l.get("saveMode")?t=e.codeImgTransform(t,"img2mathml"):"xml"==l.get("saveMode")?t=e.codeImgTransform(t,"img2mathml"):"base64"==l.get("saveMode")&&"image"==l.get("editMode")&&(t=e.codeImgTransform(t,"img264"))),t}},{key:"createShowImageSrc",value:function(e,t){var i=[],n="mml,color,centerbaseline,zoom,dpi,fontSize,fontFamily,defaultStretchy,backgroundColor,format".split(",");for(var r in n){var s=n[r];void 0!==e[s]&&(i[s]=e[s])}var o={};for(var r in e)"mml"!=r&&(o[r]=e[r]);return o.formula=com.wiris.js.JsPluginTools.md5encode(v.propertiesToString(i)),o.lang=void 0===t?"en":t,o.version=l.get("version"),f.getService("showimage",v.httpBuildQuery(o),!0)}},{key:"codeImgTransform",value:function(t,i){for(var n="",r=0,s=/"==h&&(r=u+1);++u}if(r",u):c.length,o.isMathmlInAttribute(t,u)||-1!=d)s+=t.substring(u,h);else{var f=t.substring(u,h);f=i==r.safeXmlCharacters?o.safeXmlDecode(f):o.mathMLEntities(f),s+=v.createObjectCode(e.mathmlToImgObject(document,f,null,n))}u=t.indexOf(a,h)}return s+=t.substring(h,t.length)}}]),e}();if("undefined"!=typeof MutationObserver){var D=new MutationObserver(function(e){e.forEach(function(e){e.oldValue===l.get("imageClassName")&&"class"===e.attributeName&&-1==e.target.className.indexOf(l.get("imageClassName"))&&(e.target.className=l.get("imageClassName"))})});B.observer=Object.create(D),B.observer.Config={attributes:!0,attributeOldValue:!0},B.observer.observe=function(e){this.__proto__.observe(e,this.Config)}}function R(e,t){for(var i=0;i=0&&(t=e[i].src.substr(0,n-1))}return t}},{key:"setLanguage",value:function(e){this.language=e}},{key:"setCore",value:function(e){this.core=e,e.setIntegrationModel(this)}},{key:"getCore",value:function(){return this.core}},{key:"setTarget",value:function(e){this.target=e,this.isIframe="IFRAME"===this.target.tagName.toUpperCase()}},{key:"setEditorObject",value:function(e){this.editorObject=e}},{key:"openNewFormulaEditor",value:function(){this.core.editionProperties.isNewElement=!0,this.core.openModalDialog(this.target,this.isIframe)}},{key:"openExistingFormulaEditor",value:function(){this.core.editionProperties.isNewElement=!1,this.core.openModalDialog(this.target,this.isIframe)}},{key:"updateFormula",value:function(e){this.isIframe?this.core.updateFormula(this.target.contentWindow,this.target.contentWindow,e,null):this.core.updateFormula(this.target,window,e,null)}},{key:"getSelection",value:function(){return this.isIframe?(this.target.contentWindow.focus(),this.target.contentWindow.getSelection()):(this.target.focus(),window.getSelection())}},{key:"addEvents",value:function(){var e=this.isIframe?this.target.contentWindow.document:this.target;v.addElementEvents(e,function(e,t){this.doubleClickHandler(e,t)}.bind(this),function(e,t){this.mousedownHandler(e,t)}.bind(this),function(e,t){this.mouseupHandler(e,t)}.bind(this))}},{key:"doubleClickHandler",value:function(e){if("img"==e.nodeName.toLowerCase()){if(this.core.getCustomEditors().disable(),e.hasAttribute("data-custom-editor")){var t=e.getAttribute("data-custom-editor");this.core.getCustomEditors().enable(t)}v.containsClass(e,l.get("imageClassName"))&&(this.core.editionProperties.temporalImage=e,this.core.editionProperties.isNewElement=!0,this.openExistingFormulaEditor())}}},{key:"mouseupHandler",value:function(){this.temporalImageResizing&&setTimeout(function(){P.fixAfterResize(this.temporalImageResizing)}.bind(this),10)}},{key:"mousedownHandler",value:function(e){"img"==e.nodeName.toLowerCase()&&v.containsClass(e,l.get("imageClassName"))&&(this.temporalImageResizing=e)}},{key:"getLanguage",value:function(){return this.getBrowserLanguage()}},{key:"getBrowserLanguage",value:function(){return navigator.userLanguage?navigator.userLanguage.substring(0,2):navigator.language?navigator.language.substring(0,2):"en"}},{key:"callbackFunction",value:function(){var e=y.newListener("onTargetReady",function(){this.addEvents(this.target)}.bind(this));this.listeners.add(e)}},{key:"notifyWindowClosed",value:function(){}},{key:"getMathmlFromTextNode",value:function(e,t){}},{key:"fillNonLatexNode",value:function(e,t,i){}},{key:"getSelectedItem",value:function(e,t){}}]),e}();function J(e,t){for(var i=0;i=0?"EDGE":e.search("Chrome/")>=0?"CHROME":e.search("Trident/")>=0?"IE":e.search("Firefox/")>=0?"FIREFOX":e.search("Safari/")>=0?"SAFARI":void 0}(),this.listeners=new y}return function(e,t,i){t&&J(e.prototype,t),i&&J(e,i)}(e,[{key:"init",value:function(e){this.load(e)}},{key:"setIntegrationModel",value:function(e){this.integrationModel=e}},{key:"setEnvironment",value:function(e){"editor"in e&&(this.environment.editor=e.editor),"mode"in e&&(this.environment.mode=e.mode),"version"in e&&(this.environment.version=e.version)}},{key:"getModalDialog",value:function(){return this.modalDialog}},{key:"load",value:function(t){var i="undefined"!=typeof XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");this.integrationPath=0==t.indexOf("/")||0==t.indexOf("http")?t:v.concatenateUrl(this.integrationModel.getPath(),t),i.open("GET",this.integrationPath,!1),i.onload=function(t){var n=this;if(4===i.readyState){var r=JSON.parse(i.responseText);Object.keys(r);if(l.addConfiguration(r),l.addConfiguration(H),this.loadServicePaths(),this.loadLangFile(),this.loadCSS(),null===e.stringManager){var s=y.newListener("onLoad",function(){n.listeners.fire("onLoad",{})});e.stringManager.addListener(s)}else this.listeners.fire("onLoad",{})}}.bind(this),i.send(null)}},{key:"loadServicePaths",value:function(){var e=this.integrationPath.replace("configurationjs","createimage"),t=this.integrationPath.replace("configurationjs","showimage"),i=(e=this.integrationPath.replace("configurationjs","createimage"),this.integrationPath.replace("configurationjs","getmathml")),n=this.integrationPath.replace("configurationjs","service");if(0==this.integrationPath.indexOf("/")){var r=this.getServerPath();t=r+t,e=r+e,i=r+i,n=r+n}f.setServicePath("showimage",t),f.setServicePath("createimage",e),f.setServicePath("service",n),f.setServicePath("getmathml",i)}},{key:"getServerPath",value:function(){var e=this.integrationModel.getPath(),t=e.indexOf("/",e.indexOf("/")+2);return e.substr(0,t)}},{key:"loadLangFile",value:function(){var t="ar,ca,cs,da,de,en,es,et,eu,fi,fr,gl,he,hr,hu,it,ja,ko,nl,no,pl,pt,pt_br,ru,sv,tr,zh,el".split(","),i=this.language;-1==t.indexOf(i)&&(i=i.substr(0,2)),-1==t.indexOf(i)&&(i="en");var n=document.createElement("script");n.type="text/javascript",n.src=this.integrationModel.getPath()+"/"+this.integrationModel.langFolderName+"/"+i+"/strings.js",n.onload=function(){e.getStringManager().loadStrings(wrs_strings)},document.getElementsByTagName("head")[0].appendChild(n)}},{key:"loadCSS",value:function(){var e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href",v.concatenateUrl(this.integrationModel.getPath(),"/core/styles.css")),document.getElementsByTagName("head")[0].appendChild(e)}},{key:"addListener",value:function(e){this.listeners.add(e)}},{key:"updateFormula",value:function(t,i,n,r){var s=new F;for(var o in s.mathml=n,s.wirisProperties={},r)s.wirisProperties[o]=r[o];if(s.language=this.language,s.editMode=this.editMode,!this.listeners.fire("onBeforeFormulaInsertion",s)&&!e.globalListeners.fire("onBeforeFormulaInsertion",s)){n=s.mathml,r=s.wirisProperties;var a=new F;if(a.editMode=this.editMode,a.windowTarget=i,a.focusElement=t,0==n.length)this.insertElementOnSelection(null,t,i);else if("latex"==this.editMode)a.latex=g.getLatexFromMathML(n),this.integrationModel.fillNonLatexNode&&void 0===a.latex?this.integrationModel.fillNonLatexNode(a,i,n):(a.node=i.document.createTextNode("$$"+a.latex+"$$"),g.cache.populate(a.latex,n)),this.insertElementOnSelection(a.node,t,i);else if("iframes"==this.editMode){var l=wrs_mathmlToIframeObject(i,n);this.insertElementOnSelection(l,t,i)}else a.node=B.mathmlToImgObject(i.document,n,r,this.language),this.insertElementOnSelection(a.node,t,i);this.listeners.fire("onAfterFormulaInsertion",a)||e.globalListeners.fire("onAfterFormulaInsertion",a)}}},{key:"placeCaretAfterNode",value:function(e){this.integrationModel.getSelection();var t=e.ownerDocument;if(void 0!==t.getSelection){var i=t.createRange();i.setStartAfter(e),i.collapse(!0);var n=t.getSelection();n.removeAllRanges(),n.addRange(i),t.body.focus()}}},{key:"insertElementOnSelection",value:function(e,t,i){if(this.editionProperties.isNewElement)if("textarea"==t.type)v.updateTextArea(t,e.textContent);else if(document.selection&&0==document.getSelection){var n=i.document.selection.createRange();if(i.document.execCommand("InsertImage",!1,e.src),"parentElement"in n||(i.document.execCommand("delete",!1),n=i.document.selection.createRange(),i.document.execCommand("InsertImage",!1,e.src)),"parentElement"in n){var r=n.parentElement();"IMG"==r.nodeName.toUpperCase()?r.parentNode.replaceChild(e,r):n.pasteHTML(v.createObjectCode(e))}}else{var s,o=this.integrationModel.getSelection();this.editionProperties.range?(s=this.editionProperties.range,this.editionProperties.range=null):s=o.getRangeAt(0),s.deleteContents();var a=s.startContainer,l=s.startOffset;3==a.nodeType?(a=a.splitText(l)).parentNode.insertBefore(e,a):1==a.nodeType&&a.insertBefore(e,a.childNodes[l]),this.placeCaretAfterNode(e)}else if(this.editionProperties.latexRange)if(document.selection&&0==document.getSelection)this.editionProperties.isNewElement=!0,this.editionProperties.latexRange.select(),this.insertElementOnSelection(e,t,i);else{this.editionProperties.latexRange.startContainer;this.editionProperties.latexRange.deleteContents(),this.editionProperties.latexRange.insertNode(e),this.placeCaretAfterNode(e)}else if("textarea"==t.type){var c;c=void 0!==this.integrationModel.getSelectedItem?this.integrationModel.getSelectedItem(t,!1):v.getSelectedItemOnTextarea(t),v.updateExistingTextOnTextarea(t,e.textContent,c.startPosition,c.endPosition)}else e||this.editionProperties.temporalImage.parentNode.removeChild(this.editionProperties.temporalImage),this.editionProperties.temporalImage.parentNode.replaceChild(e,this.editionProperties.temporalImage),this.placeCaretAfterNode(e)}},{key:"openModalDialog",value:function(e,t){this.editMode="images";try{if(t){e.contentWindow.focus();var i=e.contentWindow.getSelection();this.editionProperties.range=i.getRangeAt(0)}else{e.focus();var n=getSelection();this.editionProperties.range=n.getRangeAt(0)}}catch(e){this.editionProperties.range=null}var r;if(void 0===t&&(t=!0),this.editionProperties.latexRange=null,e)if(r=void 0!==this.integrationModel.getSelectedItem?this.integrationModel.getSelectedItem(e,t):v.getSelectedItem(e,t)){if(!r.caretPosition&&v.containsClass(r.node,l.get("imageClassName")))this.editionProperties.temporalImage=r.node,this.editionProperties.isNewElement=!1;else if(3===r.node.nodeType)if(this.integrationModel.getMathmlFromTextNode){var s=this.integrationModel.getMathmlFromTextNode(r.node,r.caretPosition);s&&(this.editMode="latex",this.editionProperties.isNewElement=!1,this.editionProperties.temporalImage=document.createElement("img"),this.editionProperties.temporalImage.setAttribute(l.get("imageMathmlAttribute"),o.safeXmlEncode(s)))}else{var a=g.getLatexFromTextNode(r.node,r.caretPosition);if(a){var c=g.getMathMLFromLatex(a.latex);this.editMode="latex",this.editionProperties.isNewElement=!1,this.editionProperties.temporalImage=document.createElement("img"),this.editionProperties.temporalImage.setAttribute(l.get("imageMathmlAttribute"),o.safeXmlEncode(c));var u=t?e.contentWindow:window;if("textarea"!==e.tagName.toLowerCase())if(document.selection){for(var h=0,d=a.startNode.previousSibling;d;)h+=v.getNodeLength(d),d=d.previousSibling;this.editionProperties.latexRange=u.document.selection.createRange(),this.editionProperties.latexRange.moveToElementText(a.startNode.parentNode),this.editionProperties.latexRange.move("character",h+a.startPosition),this.editionProperties.latexRange.moveEnd("character",a.latex.length+4)}else this.editionProperties.latexRange=u.document.createRange(),this.editionProperties.latexRange.setStart(a.startNode,a.startPosition),this.editionProperties.latexRange.setEnd(a.endNode,a.endPosition)}}}else"textarea"===e.tagName.toLowerCase()&&(this.editMode="latex");for(var f=l.get("editorAttributes").split(", "),m={},p=0,b=f.length;p= size) { - return undefined; - } - // Get the first code unit - var first = string.charCodeAt(index); - var second; - if ( // check if it’s the start of a surrogate pair - first >= 0xD800 && first <= 0xDBFF && // high surrogate - size > index + 1 // there is a next code unit - ) { - second = string.charCodeAt(index + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { - // low surrogate - // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - } - } - return first; - }; - if (Object.defineProperty) { - Object.defineProperty(String.prototype, 'codePointAt', { - 'value': codePointAt, - 'configurable': true, - 'writable': true - }); - } else { - String.prototype.codePointAt = codePointAt; - } - })(); -} - -/** - * Add a new callback to a MathType listener. - * @param {object} listener an Object containing listener name and a callback. - * @tutorial tutorial - */ -function wrs_addPluginListener(listener) { - wrs_pluginListeners.push(listener); -} - -/** - * Get the base URL (i.e the URL on core.js lives). - * @ignore - */ -function wrs_getServerPath() { - var url = _wrs_corePath; - var hostNameIndex = url.indexOf("/", url.indexOf("/") + 2); - return url.substr(0, hostNameIndex); -} - -/** - * This method updates all services paths if there are relative with the absolute - * URL path. - * @ignore - */ -function wrs_updateContextPath() { - if (typeof _wrs_conf_plugin_loaded == 'undefined') { - setTimeout(wrs_updateContextPath, 100); - } else { - if (_wrs_conf_showimagePath.indexOf("/") == 0) { - var serverPath = wrs_getServerPath(); - _wrs_conf_showimagePath = serverPath + _wrs_conf_showimagePath; - _wrs_conf_editorPath = serverPath + _wrs_conf_editorPath; - _wrs_conf_CASPath = serverPath + _wrs_conf_CASPath; - _wrs_conf_createimagePath = serverPath + _wrs_conf_createimagePath; - _wrs_conf_createcasimagePath = serverPath + _wrs_conf_createcasimagePath; - _wrs_conf_getmathmlPath = serverPath + _wrs_conf_getmathmlPath; - _wrs_conf_servicePath = serverPath + _wrs_conf_servicePath; - } - } -} - -wrs_updateContextPath(); - -// Production steps of ECMA-262, Edition 5, 15.4.4.18 -// Reference: http://es5.github.io/#x15.4.4.18. -if (!Array.prototype.forEach) { - - Array.prototype.forEach = function (callback, thisArg) { - - var T, k; - - if (this == null) { - throw new TypeError(' this is null or not defined'); - } - - // 1. Let O be the result of calling ToObject passing the |this| value as the argument. - var O = Object(this); - - // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". - // 3. Let len be ToUint32(lenValue). - - // @codingStandardsIgnoreStart - var len = O.length >>> 0; - // @codingStandardsIgnoreEnd - - // 4. If IsCallable(callback) is false, throw a TypeError exception. - // See: http://es5.github.com/#x9.11 . - if (typeof callback !== "function") { - throw new TypeError(callback + ' is not a function'); - } - - // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. - if (arguments.length > 1) { - T = thisArg; - } - - // 6. Let k be 0. - k = 0; - - // 7. Repeat, while k < len. - while (k < len) { - - var kValue; - - // A. Let Pk be ToString(k). - // This is implicit for LHS operands of the in operator - // B. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk - // This step can be combined with c - // C. If kPresent is true. - if (k in O) { - - // I. Let kValue be the result of calling the Get internal method of O with argument Pk. - kValue = O[k]; - - // II. Call the Call internal method of callback with T as the this value and - // argument list containing kValue, k, and O. - callback.call(T, kValue, k, O); - } - // D. Increase k by 1. - k++; - } - // 8. return undefined. - }; -} -// @codingStandardsIgnoreStart -(function () { - var HxOverrides = function HxOverrides() {}; - HxOverrides.__name__ = true; - HxOverrides.dateStr = function (date) { - var m = date.getMonth() + 1; - var d = date.getDate(); - var h = date.getHours(); - var mi = date.getMinutes(); - var s = date.getSeconds(); - return date.getFullYear() + "-" + (m < 10 ? "0" + m : "" + m) + "-" + (d < 10 ? "0" + d : "" + d) + " " + (h < 10 ? "0" + h : "" + h) + ":" + (mi < 10 ? "0" + mi : "" + mi) + ":" + (s < 10 ? "0" + s : "" + s); - }; - HxOverrides.strDate = function (s) { - switch (s.length) { - case 8: - var k = s.split(":"); - var d = new Date(); - d.setTime(0); - d.setUTCHours(k[0]); - d.setUTCMinutes(k[1]); - d.setUTCSeconds(k[2]); - return d; - case 10: - var k = s.split("-"); - return new Date(k[0], k[1] - 1, k[2], 0, 0, 0); - case 19: - var k = s.split(" "); - var y = k[0].split("-"); - var t = k[1].split(":"); - return new Date(y[0], y[1] - 1, y[2], t[0], t[1], t[2]); - default: - throw "Invalid date format : " + s; - } - }; - HxOverrides.cca = function (s, index) { - var x = s.charCodeAt(index); - if (x != x) return undefined; - return x; - }; - HxOverrides.substr = function (s, pos, len) { - if (pos != null && pos != 0 && len != null && len < 0) return ""; - if (len == null) len = s.length; - if (pos < 0) { - pos = s.length + pos; - if (pos < 0) pos = 0; - } else if (len < 0) len = s.length + len - pos; - return s.substr(pos, len); - }; - HxOverrides.remove = function (a, obj) { - var i = 0; - var l = a.length; - while (i < l) { - if (a[i] == obj) { - a.splice(i, 1); - return true; - } - i++; - } - return false; - }; - HxOverrides.iter = function (a) { - return { cur: 0, arr: a, hasNext: function hasNext() { - return this.cur < this.arr.length; - }, next: function next() { - return this.arr[this.cur++]; - } }; - }; - var IntIter = function IntIter(min, max) { - this.min = min; - this.max = max; - }; - IntIter.__name__ = true; - IntIter.prototype = { - next: function next() { - return this.min++; - }, - hasNext: function hasNext() { - return this.min < this.max; - }, - __class__: IntIter - }; - var Std = function Std() {}; - Std.__name__ = true; - Std["is"] = function (v, t) { - return js.Boot.__instanceof(v, t); - }; - Std.string = function (s) { - return js.Boot.__string_rec(s, ""); - }; - Std["int"] = function (x) { - return x | 0; - }; - Std.parseInt = function (x) { - var v = parseInt(x, 10); - if (v == 0 && (HxOverrides.cca(x, 1) == 120 || HxOverrides.cca(x, 1) == 88)) v = parseInt(x); - if (isNaN(v)) return null; - return v; - }; - Std.parseFloat = function (x) { - return parseFloat(x); - }; - Std.random = function (x) { - return Math.floor(Math.random() * x); - }; - var com = com || {}; - if (!com.wiris) com.wiris = {}; - if (!com.wiris.js) com.wiris.js = {}; - com.wiris.js.JsPluginTools = function () { - this.tryReady(); - }; - com.wiris.js.JsPluginTools.__name__ = true; - com.wiris.js.JsPluginTools.main = function () { - var ev; - ev = com.wiris.js.JsPluginTools.getInstance(); - haxe.Timer.delay($bind(ev, ev.tryReady), 100); - }; - com.wiris.js.JsPluginTools.getInstance = function () { - if (com.wiris.js.JsPluginTools.instance == null) com.wiris.js.JsPluginTools.instance = new com.wiris.js.JsPluginTools(); - return com.wiris.js.JsPluginTools.instance; - }; - com.wiris.js.JsPluginTools.bypassEncapsulation = function () { - if (window.com == null) window.com = {}; - if (window.com.wiris == null) window.com.wiris = {}; - if (window.com.wiris.js == null) window.com.wiris.js = {}; - if (window.com.wiris.js.JsPluginTools == null) window.com.wiris.js.JsPluginTools = com.wiris.js.JsPluginTools.getInstance(); - }; - com.wiris.js.JsPluginTools.prototype = { - md5encode: function md5encode(content) { - return haxe.Md5.encode(content); - }, - doLoad: function doLoad() { - this.ready = true; - com.wiris.js.JsPluginTools.instance = this; - com.wiris.js.JsPluginTools.bypassEncapsulation(); - }, - tryReady: function tryReady() { - this.ready = false; - if (js.Lib.document.readyState) { - this.doLoad(); - this.ready = true; - } - if (!this.ready) haxe.Timer.delay($bind(this, this.tryReady), 100); - }, - __class__: com.wiris.js.JsPluginTools - }; - var haxe = haxe || {}; - haxe.Log = function () {}; - haxe.Log.__name__ = true; - haxe.Log.trace = function (v, infos) { - js.Boot.__trace(v, infos); - }; - haxe.Log.clear = function () { - js.Boot.__clear_trace(); - }; - haxe.Md5 = function () {}; - haxe.Md5.__name__ = true; - haxe.Md5.encode = function (s) { - return new haxe.Md5().doEncode(s); - }; - haxe.Md5.prototype = { - doEncode: function doEncode(str) { - var x = this.str2blks(str); - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; - var step; - var i = 0; - while (i < x.length) { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; - step = 0; - a = this.ff(a, b, c, d, x[i], 7, -680876936); - d = this.ff(d, a, b, c, x[i + 1], 12, -389564586); - c = this.ff(c, d, a, b, x[i + 2], 17, 606105819); - b = this.ff(b, c, d, a, x[i + 3], 22, -1044525330); - a = this.ff(a, b, c, d, x[i + 4], 7, -176418897); - d = this.ff(d, a, b, c, x[i + 5], 12, 1200080426); - c = this.ff(c, d, a, b, x[i + 6], 17, -1473231341); - b = this.ff(b, c, d, a, x[i + 7], 22, -45705983); - a = this.ff(a, b, c, d, x[i + 8], 7, 1770035416); - d = this.ff(d, a, b, c, x[i + 9], 12, -1958414417); - c = this.ff(c, d, a, b, x[i + 10], 17, -42063); - b = this.ff(b, c, d, a, x[i + 11], 22, -1990404162); - a = this.ff(a, b, c, d, x[i + 12], 7, 1804603682); - d = this.ff(d, a, b, c, x[i + 13], 12, -40341101); - c = this.ff(c, d, a, b, x[i + 14], 17, -1502002290); - b = this.ff(b, c, d, a, x[i + 15], 22, 1236535329); - a = this.gg(a, b, c, d, x[i + 1], 5, -165796510); - d = this.gg(d, a, b, c, x[i + 6], 9, -1069501632); - c = this.gg(c, d, a, b, x[i + 11], 14, 643717713); - b = this.gg(b, c, d, a, x[i], 20, -373897302); - a = this.gg(a, b, c, d, x[i + 5], 5, -701558691); - d = this.gg(d, a, b, c, x[i + 10], 9, 38016083); - c = this.gg(c, d, a, b, x[i + 15], 14, -660478335); - b = this.gg(b, c, d, a, x[i + 4], 20, -405537848); - a = this.gg(a, b, c, d, x[i + 9], 5, 568446438); - d = this.gg(d, a, b, c, x[i + 14], 9, -1019803690); - c = this.gg(c, d, a, b, x[i + 3], 14, -187363961); - b = this.gg(b, c, d, a, x[i + 8], 20, 1163531501); - a = this.gg(a, b, c, d, x[i + 13], 5, -1444681467); - d = this.gg(d, a, b, c, x[i + 2], 9, -51403784); - c = this.gg(c, d, a, b, x[i + 7], 14, 1735328473); - b = this.gg(b, c, d, a, x[i + 12], 20, -1926607734); - a = this.hh(a, b, c, d, x[i + 5], 4, -378558); - d = this.hh(d, a, b, c, x[i + 8], 11, -2022574463); - c = this.hh(c, d, a, b, x[i + 11], 16, 1839030562); - b = this.hh(b, c, d, a, x[i + 14], 23, -35309556); - a = this.hh(a, b, c, d, x[i + 1], 4, -1530992060); - d = this.hh(d, a, b, c, x[i + 4], 11, 1272893353); - c = this.hh(c, d, a, b, x[i + 7], 16, -155497632); - b = this.hh(b, c, d, a, x[i + 10], 23, -1094730640); - a = this.hh(a, b, c, d, x[i + 13], 4, 681279174); - d = this.hh(d, a, b, c, x[i], 11, -358537222); - c = this.hh(c, d, a, b, x[i + 3], 16, -722521979); - b = this.hh(b, c, d, a, x[i + 6], 23, 76029189); - a = this.hh(a, b, c, d, x[i + 9], 4, -640364487); - d = this.hh(d, a, b, c, x[i + 12], 11, -421815835); - c = this.hh(c, d, a, b, x[i + 15], 16, 530742520); - b = this.hh(b, c, d, a, x[i + 2], 23, -995338651); - a = this.ii(a, b, c, d, x[i], 6, -198630844); - d = this.ii(d, a, b, c, x[i + 7], 10, 1126891415); - c = this.ii(c, d, a, b, x[i + 14], 15, -1416354905); - b = this.ii(b, c, d, a, x[i + 5], 21, -57434055); - a = this.ii(a, b, c, d, x[i + 12], 6, 1700485571); - d = this.ii(d, a, b, c, x[i + 3], 10, -1894986606); - c = this.ii(c, d, a, b, x[i + 10], 15, -1051523); - b = this.ii(b, c, d, a, x[i + 1], 21, -2054922799); - a = this.ii(a, b, c, d, x[i + 8], 6, 1873313359); - d = this.ii(d, a, b, c, x[i + 15], 10, -30611744); - c = this.ii(c, d, a, b, x[i + 6], 15, -1560198380); - b = this.ii(b, c, d, a, x[i + 13], 21, 1309151649); - a = this.ii(a, b, c, d, x[i + 4], 6, -145523070); - d = this.ii(d, a, b, c, x[i + 11], 10, -1120210379); - c = this.ii(c, d, a, b, x[i + 2], 15, 718787259); - b = this.ii(b, c, d, a, x[i + 9], 21, -343485551); - a = this.addme(a, olda); - b = this.addme(b, oldb); - c = this.addme(c, oldc); - d = this.addme(d, oldd); - i += 16; - } - return this.rhex(a) + this.rhex(b) + this.rhex(c) + this.rhex(d); - }, - ii: function ii(a, b, c, d, x, s, t) { - return this.cmn(this.bitXOR(c, this.bitOR(b, ~d)), a, b, x, s, t); - }, - hh: function hh(a, b, c, d, x, s, t) { - return this.cmn(this.bitXOR(this.bitXOR(b, c), d), a, b, x, s, t); - }, - gg: function gg(a, b, c, d, x, s, t) { - return this.cmn(this.bitOR(this.bitAND(b, d), this.bitAND(c, ~d)), a, b, x, s, t); - }, - ff: function ff(a, b, c, d, x, s, t) { - return this.cmn(this.bitOR(this.bitAND(b, c), this.bitAND(~b, d)), a, b, x, s, t); - }, - cmn: function cmn(q, a, b, x, s, t) { - return this.addme(this.rol(this.addme(this.addme(a, q), this.addme(x, t)), s), b); - }, - rol: function rol(num, cnt) { - return num << cnt | num >>> 32 - cnt; - }, - str2blks: function str2blks(str) { - var nblk = (str.length + 8 >> 6) + 1; - var blks = new Array(); - var _g1 = 0, - _g = nblk * 16; - while (_g1 < _g) { - var i = _g1++; - blks[i] = 0; - } - var i = 0; - while (i < str.length) { - blks[i >> 2] |= HxOverrides.cca(str, i) << (str.length * 8 + i) % 4 * 8; - i++; - } - blks[i >> 2] |= 128 << (str.length * 8 + i) % 4 * 8; - var l = str.length * 8; - var k = nblk * 16 - 2; - blks[k] = l & 255; - blks[k] |= (l >>> 8 & 255) << 8; - blks[k] |= (l >>> 16 & 255) << 16; - blks[k] |= (l >>> 24 & 255) << 24; - return blks; - }, - rhex: function rhex(num) { - var str = ""; - var hex_chr = "0123456789abcdef"; - var _g = 0; - while (_g < 4) { - var j = _g++; - str += hex_chr.charAt(num >> j * 8 + 4 & 15) + hex_chr.charAt(num >> j * 8 & 15); - } - return str; - }, - addme: function addme(x, y) { - var lsw = (x & 65535) + (y & 65535); - var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return msw << 16 | lsw & 65535; - }, - bitAND: function bitAND(a, b) { - var lsb = a & 1 & (b & 1); - var msb31 = a >>> 1 & b >>> 1; - return msb31 << 1 | lsb; - }, - bitXOR: function bitXOR(a, b) { - var lsb = a & 1 ^ b & 1; - var msb31 = a >>> 1 ^ b >>> 1; - return msb31 << 1 | lsb; - }, - bitOR: function bitOR(a, b) { - var lsb = a & 1 | b & 1; - var msb31 = a >>> 1 | b >>> 1; - return msb31 << 1 | lsb; - }, - __class__: haxe.Md5 - }; - haxe.Timer = function (time_ms) { - var me = this; - this.id = window.setInterval(function () { - me.run(); - }, time_ms); - }; - haxe.Timer.__name__ = true; - haxe.Timer.delay = function (f, time_ms) { - var t = new haxe.Timer(time_ms); - t.run = function () { - t.stop(); - f(); - }; - return t; - }; - haxe.Timer.measure = function (f, pos) { - var t0 = haxe.Timer.stamp(); - var r = f(); - haxe.Log.trace(haxe.Timer.stamp() - t0 + "s", pos); - return r; - }; - haxe.Timer.stamp = function () { - return new Date().getTime() / 1000; - }; - haxe.Timer.prototype = { - run: function run() {}, - stop: function stop() { - if (this.id == null) return; - window.clearInterval(this.id); - this.id = null; - }, - __class__: haxe.Timer - }; - var js = js || {}; - js.Boot = function () {}; - js.Boot.__name__ = true; - js.Boot.__unhtml = function (s) { - return s.split("&").join("&").split("<").join("<").split(">").join(">"); - }; - js.Boot.__trace = function (v, i) { - var msg = i != null ? i.fileName + ":" + i.lineNumber + ": " : ""; - msg += js.Boot.__string_rec(v, ""); - var d; - if (typeof document != "undefined" && (d = document.getElementById("haxe:trace")) != null) d.innerHTML += js.Boot.__unhtml(msg) + "
";else if (typeof console != "undefined" && console.log != null) console.log(msg); - }; - js.Boot.__clear_trace = function () { - var d = document.getElementById("haxe:trace"); - if (d != null) d.innerHTML = ""; - }; - js.Boot.isClass = function (o) { - return o.__name__; - }; - js.Boot.isEnum = function (e) { - return e.__ename__; - }; - js.Boot.getClass = function (o) { - return o.__class__; - }; - js.Boot.__string_rec = function (o, s) { - if (o == null) return "null"; - if (s.length >= 5) return "<...>"; - var t = typeof o === "undefined" ? "undefined" : _typeof(o); - if (t == "function" && (o.__name__ || o.__ename__)) t = "object"; - switch (t) { - case "object": - if (o instanceof Array) { - if (o.__enum__) { - if (o.length == 2) return o[0]; - var str = o[0] + "("; - s += "\t"; - var _g1 = 2, - _g = o.length; - while (_g1 < _g) { - var i = _g1++; - if (i != 2) str += "," + js.Boot.__string_rec(o[i], s);else str += js.Boot.__string_rec(o[i], s); - } - return str + ")"; - } - var l = o.length; - var i; - var str = "["; - s += "\t"; - var _g = 0; - while (_g < l) { - var i1 = _g++; - str += (i1 > 0 ? "," : "") + js.Boot.__string_rec(o[i1], s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch (e) { - return "???"; - } - if (tostr != null && tostr != Object.toString) { - var s2 = o.toString(); - if (s2 != "[object Object]") return s2; - } - var k = null; - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - for (var k in o) { - ; - if (hasp && !o.hasOwnProperty(k)) { - continue; - } - if (k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if (str.length != 2) str += ", \n"; - str += s + k + " : " + js.Boot.__string_rec(o[k], s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "function": - return ""; - case "string": - return o; - default: - return String(o); - } - }; - js.Boot.__interfLoop = function (cc, cl) { - if (cc == null) return false; - if (cc == cl) return true; - var intf = cc.__interfaces__; - if (intf != null) { - var _g1 = 0, - _g = intf.length; - while (_g1 < _g) { - var i = _g1++; - var i1 = intf[i]; - if (i1 == cl || js.Boot.__interfLoop(i1, cl)) return true; - } - } - return js.Boot.__interfLoop(cc.__super__, cl); - }; - js.Boot.__instanceof = function (o, cl) { - try { - if (o instanceof cl) { - if (cl == Array) return o.__enum__ == null; - return true; - } - if (js.Boot.__interfLoop(o.__class__, cl)) return true; - } catch (e) { - if (cl == null) return false; - } - switch (cl) { - case Int: - return Math.ceil(o % 2147483648.0) === o; - case Float: - return typeof o == "number"; - case Bool: - return o === true || o === false; - case String: - return typeof o == "string"; - case Dynamic: - return true; - default: - if (o == null) return false; - if (cl == Class && o.__name__ != null) return true;else null; - if (cl == Enum && o.__ename__ != null) return true;else null; - return o.__enum__ == cl; - } - }; - js.Boot.__cast = function (o, t) { - if (js.Boot.__instanceof(o, t)) return o;else throw "Cannot cast " + Std.string(o) + " to " + Std.string(t); - }; - js.Lib = function () {}; - js.Lib.__name__ = true; - js.Lib.debug = function () { - debugger; - }; - js.Lib.alert = function (v) { - alert(js.Boot.__string_rec(v, "")); - }; - js.Lib.eval = function (code) { - return eval(code); - }; - js.Lib.setErrorHandler = function (f) { - js.Lib.onerror = f; - }; - var $_; - function $bind(o, m) { - var f = function f() { - return f.method.apply(f.scope, arguments); - };f.scope = o;f.method = m;return f; - }; - if (Array.prototype.indexOf) HxOverrides.remove = function (a, o) { - var i = a.indexOf(o); - if (i == -1) return false; - a.splice(i, 1); - return true; - };else null; - Math.__name__ = ["Math"]; - Math.NaN = Number.NaN; - Math.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY; - Math.POSITIVE_INFINITY = Number.POSITIVE_INFINITY; - Math.isFinite = function (i) { - return isFinite(i); - }; - Math.isNaN = function (i) { - return isNaN(i); - }; - String.prototype.__class__ = String; - String.__name__ = true; - Array.prototype.__class__ = Array; - Array.__name__ = true; - Date.prototype.__class__ = Date; - Date.__name__ = ["Date"]; - var Int = { __name__: ["Int"] }; - var Dynamic = { __name__: ["Dynamic"] }; - var Float = Number; - Float.__name__ = ["Float"]; - var Bool = Boolean; - Bool.__ename__ = ["Bool"]; - var Class = { __name__: ["Class"] }; - var Enum = {}; - var Void = { __ename__: ["Void"] }; - if (typeof document != "undefined") js.Lib.document = document; - if (typeof window != "undefined") { - js.Lib.window = window; - js.Lib.window.onerror = function (msg, url, line) { - var f = js.Lib.onerror; - if (f == null) return false; - return f(msg, [url + ":" + line]); - }; - } - com.wiris.js.JsPluginTools.main(); - delete Array.prototype.__class__; -})(); -// @codingStandardsIgnoreEnd -/** - * Modal window constructor - * @param {Object} editorAttributes Editor attributes (width, height)... - * @ignore - */ - -var ModalWindow = function () { - function ModalWindow(editorAttributes) { - _classCallCheck(this, ModalWindow); - - // EditorAtributes - // TODO: Remove the argument: we need to find a way to detect mobile devices - // without known anything about editor. - this.editorAttributes = editorAttributes; - - // Metrics - var ua = navigator.userAgent.toLowerCase(); - var isAndroid = ua.indexOf("android") > -1; - var isIOS = ua.indexOf("ipad") > -1 || ua.indexOf("iphone") > -1; - this.iosSoftkeyboardOpened = false; - this.iosMeasureUnit = ua.indexOf("crios") == -1 ? "%" : "vh"; - this.iosDivHeight = "100" + this.iosMeasureUnit; - - var deviceWidth = window.outerWidth; - var deviceHeight = window.outerHeight; - - var landscape = deviceWidth > deviceHeight; - var portrait = deviceWidth < deviceHeight; - - var editorWidth = editorAttributes.split(' ').join('').split(',')[0].split("=")[1]; - var editorHeight = editorAttributes.split(' ').join('').split(',')[1].split("=")[1]; - - // TODO: Detect isMobile without using editor metrics. - var isMobile = landscape && editorHeight > deviceHeight || portrait && editorWidth > deviceWidth ? true : false; - - // Device object properties. - - this.deviceProperties = { - orientation: landscape ? 'landscape' : 'portait', - isAndroid: isAndroid ? true : false, - isIOS: isIOS ? true : false, - isMobile: isMobile, - isDesktop: !isMobile && !isIOS && !isAndroid - }; - - this.properties = { - created: false, - state: '', - previousState: '', - position: { bottom: 0, right: 10 }, - size: { height: 338, width: 580 } - }; - - var attributes = {}; - attributes.class = 'wrs_modal_overlay'; - attributes.id = attributes.class + '_id'; - this.overlay = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_modal_title_bar'; - attributes.id = attributes.class + '_id'; - this.titleBar = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_modal_title'; - attributes.id = attributes.class + '_id'; - this.title = wrs_createElement('div', attributes); - this.title.innerHTML = ''; - - attributes = {}; - attributes.class = 'wrs_modal_close_button'; - attributes.id = attributes.class + '_id'; - attributes.title = _wrs_stringManager.getString('close'); - this.closeDiv = wrs_createElement('a', attributes);; - this.closeDiv.setAttribute('role', 'button'); - - attributes = {}; - attributes.class = 'wrs_modal_stack_button'; - attributes.id = attributes.class + '_id'; - attributes.title = "Exit full-screen"; - this.stackDiv = wrs_createElement('a', attributes); - this.stackDiv.setAttribute('role', 'button'); - - attributes = {}; - attributes.class = 'wrs_modal_maximize_button'; - attributes.id = attributes.class + '_id'; - attributes.title = _wrs_stringManager.getString('fullscreen'); - this.maximizeDiv = wrs_createElement('a', attributes); - this.maximizeDiv.setAttribute('role', 'button'); - - attributes = {}; - attributes.class = 'wrs_modal_minimize_button'; - attributes.id = attributes.class + '_id'; - attributes.title = _wrs_stringManager.getString('minimise'); - this.minimizeDiv = wrs_createElement('a', attributes); - this.minimizeDiv.setAttribute('role', 'button'); - - attributes = {}; - attributes.class = 'wrs_modal_dialogContainer'; - attributes.id = attributes.class + '_id'; - this.container = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_modal_wrapper'; - attributes.id = attributes.class + '_id'; - this.wrapper = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_content_container'; - attributes.id = attributes.class + '_id'; - this.contentContainer = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_modal_controls'; - attributes.id = attributes.class + '_id'; - this.controls = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_modal_buttons_container'; - attributes.id = attributes.class + '_id'; - this.buttonContainer = wrs_createElement('div', attributes); - - // Buttons: all button must be created using createSubmitButton method. - this.submitButton = this.createSubmitButton({ - class: 'wrs_modal_button_accept', - innerHTML: _wrs_stringManager.getString('accept') - }, this.submitAction.bind(this)); - - this.cancelButton = this.createSubmitButton({ - class: 'wrs_modal_button_cancel', - innerHTML: _wrs_stringManager.getString('cancel') - }, this.cancelAction.bind(this)); - - this.lastImageWasNew = true; - - this.contentManager = null; - - // Overlay popup. - var popupStrings = { - 'cancelString': _wrs_stringManager.getString('cancel'), - 'submitString': _wrs_stringManager.getString('close'), - 'message': _wrs_stringManager.getString('close_modal_warning') - }; - - var callbacks = { - 'closeCallback': function () { - this.close(); - }.bind(this), - 'cancelCallback': function () { - this.focus(); - }.bind(this) - }; - - var popupupProperties = { - 'overlayElement': this.container, - 'callbacks': callbacks, - 'strings': popupStrings - }; - - this.popup = new PopUpMessage(popupupProperties); - } - /** - * This method sets the contentElement object. A contentElement object - * manages the logic of modal object content: submit, update, close and changes. - * @param {object} contentManager - * @ignore - */ - - - _createClass(ModalWindow, [{ - key: "setContentManager", - value: function setContentManager(contentManager) { - this.contentManager = contentManager; - } - - /** - * Returns the modal contentElement object. - *@returns {object} - *@ignore - */ - - }, { - key: "getContentManager", - value: function getContentManager() { - return this.contentManager; - } - - /** - * This method is called when the modal object has been submited. Calls - * contentElement submitAction method - if exists - and closes the modal - * object. No logic about the content should be placed here, - * contentElement.submitAction is the responsible of the content logic. - * @ignore - */ - - }, { - key: "submitAction", - value: function submitAction() { - if (typeof this.contentManager.submitAction !== 'undefined') { - this.contentManager.submitAction(); - } - this.close(); - } - - /** - * This method is called when the modal object has been cancelled. If - * contentElement has implemented hasChanges method, a confirm popup - * will be shown if hasChanges returns true. - * @ignore - */ - - }, { - key: "cancelAction", - value: function cancelAction() { - if (typeof this.contentManager.hasChanges === 'undefined') { - this.close(); - } else if (!this.contentManager.hasChanges()) { - this.close(); - } else { - this.showPopUpMessage(); - } - } - - /** - * Returns a submit button. The properties argument admits the following: - * properties { - * 'class' : '', // button class. - * 'innerHTML : '' // button innerHTML. - * } - * @param {Object} properties input button properties. - * @param {Function} callback callback function associated to click event. - * @ignore - */ - - }, { - key: "createSubmitButton", - value: function createSubmitButton(properties, callback) { - function SubmitButton(properties, callback) { - this.element = document.createElement('button'); - this.element.id = properties.class + '_id'; - this.element.className = properties.class; - this.element.innerHTML = properties.innerHTML; - wrs_addEvent(this.element, 'click', callback); - } - - SubmitButton.prototype.getElement = function () { - return this.element; - }; - - return new SubmitButton(properties, callback).getElement(); - } - - /** - * Creates the modal window object inserting a contentElement object. - * @ignore - */ - - }, { - key: "create", - value: function create() { - - /*Modal Window Structure - _____________________________________________________________________________________ - |wrs_modal_dialog_Container | - | _________________________________________________________________________________ | - | |title_bar minimize_button stack_button close_button | | - | |_______________________________________________________________________________| | - | |wrapper | | - | | _____________________________________________________________________________ | | - | | |content | | | - | | | | | | - | | | | | | - | | |___________________________________________________________________________| | | - | | _____________________________________________________________________________ | | - | | |controls | | | - | | | ___________________________________ | | | - | | | |buttonContainer | | | | - | | | | _______________________________ | | | | - | | | | |button_accept | button_cancel| | | | | - | | | |_|_____________ |______________|_| | | | - | | |___________________________________________________________________________| | | - | |_______________________________________________________________________________| | - |___________________________________________________________________________________|*/ - - this.titleBar.appendChild(this.closeDiv); - this.titleBar.appendChild(this.stackDiv); - this.titleBar.appendChild(this.maximizeDiv); - this.titleBar.appendChild(this.minimizeDiv); - this.titleBar.appendChild(this.title); - - if (this.deviceProperties['isDesktop']) { - this.container.appendChild(this.titleBar); - } - - this.wrapper.appendChild(this.contentContainer); - this.wrapper.appendChild(this.controls); - - this.controls.appendChild(this.buttonContainer); - - this.buttonContainer.appendChild(this.submitButton); - this.buttonContainer.appendChild(this.cancelButton); - - this.container.appendChild(this.wrapper); - - // Check if browser has scrollBar before modal has modified. - this.recalculateScrollBar(); - - document.body.appendChild(this.container); - document.body.appendChild(this.overlay); - - if (this.deviceProperties['isDesktop']) { - // Desktop. - this.createModalWindowDesktop(); - this.createResizeButtons(); - - this.addListeners(); - // Maximize window only when the configuration is set and the device is not iOS or Android. - if (_wrs_conf_modalWindowFullScreen) { - this.maximize(); - } - } else if (this.deviceProperties['isAndroid']) { - this.createModalWindowAndroid(); - } else if (this.deviceProperties['isIOS'] && !this.deviceProperties['isMobile']) { - this.createModalWindowIos(); - } - - if (this.contentManager != null) { - this.contentManager.insert(this); - } - - this.properties.open = true; - this.properties.created = true; - - // If actual language is arabic modal starts at left of window browser - if (this.isRTL(_wrs_int_langCode)) { - this.container.style.right = window.innerWidth - this.scrollbarWidth - this.container.offsetWidth + 'px'; - } - } - - /** - * Creates a button in the modal object to resize it. - * @ignore - */ - - }, { - key: "createResizeButtons", - value: function createResizeButtons() { - // This is a definition of Resize Button Bottom-Right - this.resizerBR = document.createElement('div'); - this.resizerBR.className = 'wrs_bottom_right_resizer'; - this.resizerBR.innerHTML = '◢'; - // This is a definition of Resize Button Top-Left - this.resizerTL = document.createElement('div'); - this.resizerTL.className = 'wrs_bottom_left_resizer'; - // Append resize buttons to modal - this.container.appendChild(this.resizerBR); - this.titleBar.appendChild(this.resizerTL); - // Add events to resize on click and drag - wrs_addEvent(this.resizerBR, 'mousedown', this.activateResizeStateBR.bind(this)); - wrs_addEvent(this.resizerTL, 'mousedown', this.activateResizeStateTL.bind(this)); - } - /** - * Method to initialize variables for Bottom-Right resize button - * @param {event} ev mouse - * @ignore - */ - - }, { - key: "activateResizeStateBR", - value: function activateResizeStateBR(ev) { - this.initializeResizeProperties(ev, false); - } - - /** - * Method to initialize variables for Top-Left resize button - * @param {event} ev mouse - * @ignore - */ - - }, { - key: "activateResizeStateTL", - value: function activateResizeStateTL(ev) { - this.initializeResizeProperties(ev, true); - } - - /** - * Common method to initialize variables at resize - * @param {event} ev mouse - * @ignore - */ - - }, { - key: "initializeResizeProperties", - value: function initializeResizeProperties(ev, leftOption) { - // Apply class for disable involuntary select text when drag. - wrs_addClass(document.body, 'wrs_noselect'); - wrs_addClass(this.overlay, 'wrs_overlay_active'); - this.resizeDataObject = { - x: this.eventClient(ev).X, - y: this.eventClient(ev).Y - }; - // Save Initial state of modal to compare on drag and obtain the difference. - this.initialWidth = parseInt(this.container.style.width); - this.initialHeight = parseInt(this.container.style.height); - if (!leftOption) { - this.initialRight = parseInt(this.container.style.right); - this.initialBottom = parseInt(this.container.style.bottom); - } else { - this.leftScale = true; - } - if (!this.initialRight) { - this.initialRight = 0; - } - if (!this.initialBottom) { - this.initialBottom = 0; - } - // Disable mouse events on editor when we start to drag modal. - document.body.style['user-select'] = 'none'; - } - - /** - * This method opens the modal window, restoring the previous state, position and metrics, - * if exists. - * By default the modal object opens in stack mode. - * @ignore - */ - - }, { - key: "open", - value: function open() { - //Removing close class. - this.removeClass('wrs_closed'); - // Hiding keyboard for mobile devices. - if (this.deviceProperties['isIOS'] || this.deviceProperties['isAndroid'] || this.deviceProperties['isMobile']) { - // Restore scale to 1 - this.restoreWebsiteScale(); - this.blockWebsiteScroll(); - // Due to editor wait we need to wait until editor focus. - setTimeout(function () { - this.hideKeyboard(); - }.bind(this), 400); - } - - // New modal window. He need to create the whole object. - if (!this.properties.created) { - this.create(); - } else { - // Previous state closed. Open method can be called even the previous state is open, - // for exmample updating the content of the modal object. - if (!this.properties.open) { - this.properties.open = true; - - // Restoring the previous open state: if the modal object has been closed - // re-open it should preserve the state and the metrics. - if (!this.deviceProperties.isAndroid && !this.deviceProperties.isIOS) { - this.restoreState(); - } - } - - // Maximize window only when the configuration is set and the device is not iOs or Android. - if (this.deviceProperties['isDesktop'] && _wrs_conf_modalWindowFullScreen) { - this.maximize(); - } - - // In iOS we need to recalculate the size of the modal object because - // iOS keyboard is a float div which can overlay the modal object. - if (this.deviceProperties['isIOS']) { - this.iosSoftkeyboardOpened = false; - this.setContainerHeight("100" + this.iosMeasureUnit); - } - - // Updating content element. - if (typeof this.contentManager != 'undefined') { - this.contentManager.onOpen(this); - } - } - } - - /** - * Closes modal window and restores viewport header. - * @ignore - */ - - }, { - key: "close", - value: function close() { - this.removeClass('wrs_maximized'); - this.removeClass('wrs_minimized'); - this.removeClass('wrs_stack'); - this.addClass('wrs_closed'); - this.saveModalProperties(); - this.unblockWebsiteScroll(); - this.properties.open = false; - } - - /** - * It sets the website scale to one. - * @ignore - */ - - }, { - key: "restoreWebsiteScale", - value: function restoreWebsiteScale() { - var viewportmeta = document.querySelector('meta[name=viewport]'); - // Let the equal symbols in order to search and make meta's final content. - var contentAttrsToUpdate = ['initial-scale=', 'minimum-scale=', 'maximum-scale=']; - var contentAttrsValuesToUpdate = ['1.0', '1.0', '1.0']; - var setMetaAttrFunc = function setMetaAttrFunc(viewportelement, contentAttrsToUpdate) { - var contentAttr = viewportelement.getAttribute('content'); - // If it exists, we need to maintain old values and put our values. - if (contentAttr) { - var attrArray = contentAttr.split(','); - var finalContentMeta = ""; - var oldAttrs = []; - for (var i = 0; i < attrArray.length; i++) { - var isAttrToUpdate = false; - var j = 0; - while (!isAttrToUpdate && j < contentAttrsToUpdate.length) { - if (attrArray[i].indexOf(contentAttrsToUpdate[j])) { - isAttrToUpdate = true; - } - - j++; - } - - if (!isAttrToUpdate) { - oldAttrs.push(attrArray[i]); - } - } - - for (var _i = 0; _i < contentAttrsToUpdate.length; _i++) { - var attr = contentAttrsToUpdate[_i] + contentAttrsValuesToUpdate[_i]; - finalContentMeta += _i == 0 ? attr : ',' + attr; - } - - for (var _i2 = 0; _i2 < oldAttrs.length; _i2++) { - finalContentMeta += ',' + oldAttrs[_i2]; - } - - viewportelement.setAttribute('content', finalContentMeta); - viewportelement.setAttribute('content', contentAttr); - } else { - viewportelement.setAttribute('content', 'initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0'); - viewportelement.removeAttribute('content'); - } - }; - - if (!viewportmeta) { - viewportmeta = document.createElement('meta'); - document.getElementsByTagName('head')[0].appendChild(viewportmeta); - setMetaAttrFunc(viewportmeta, contentAttrsToUpdate, contentAttrsValuesToUpdate); - viewportmeta.remove(); - } else { - setMetaAttrFunc(viewportmeta, contentAttrsToUpdate, contentAttrsValuesToUpdate); - } - } - - /** - * Adds an event to avoid touchscrolling. - * @ignore - */ - - }, { - key: "blockWebsiteScroll", - value: function blockWebsiteScroll() { - document.body.addEventListener('touchmove', this.disableTouchMove, { passive: false }); - } - - /** - * Removes the event to avoid touchscrolling. - * @ignore - */ - - }, { - key: "unblockWebsiteScroll", - value: function unblockWebsiteScroll() { - document.body.removeEventListener('touchmove', this.disableTouchMove, { passive: false }); - } - - /** - * Prevents the default event behaviour. - * @param {Object} ev javascript event. - * @ignore. - */ - - }, { - key: "disableTouchMove", - value: function disableTouchMove(ev) { - ev.preventDefault(); - } - - /** - * Util function to kwnow if browser is internet explorer 11. - * @return {boolean} return true if browser is iexplorer v11 or false in others. - * @ignore - */ - - }, { - key: "isIE11", - value: function isIE11() { - if (navigator.userAgent.search("Msie/") >= 0 || navigator.userAgent.search("Trident/") >= 0 || navigator.userAgent.search("Edge/") >= 0) { - return true; - } - return false; - } - - /** - * @param {string} actual language to check if it's rtl - * @return {boolean} return true if current language is type RTL - * @ignore - */ - - }, { - key: "isRTL", - value: function isRTL(language) { - if (_wrs_int_langCode == 'ar' || _wrs_int_langCode == 'he') { - return true; - } - return false; - } - /** - * Adds a class to all modal DOM elements. - * @param {string} cls - * @ignore - */ - - }, { - key: "addClass", - value: function addClass(cls) { - wrs_addClass(this.overlay, cls); - wrs_addClass(this.titleBar, cls); - wrs_addClass(this.overlay, cls); - wrs_addClass(this.container, cls); - wrs_addClass(this.contentContainer, cls); - wrs_addClass(this.stackDiv, cls); - wrs_addClass(this.minimizeDiv, cls); - wrs_addClass(this.maximizeDiv, cls); - wrs_addClass(this.wrapper, cls); - } - - /** - * Remove a calss from all modal DOM elements. - * @param {string} cls - * @ignore - */ - - }, { - key: "removeClass", - value: function removeClass(cls) { - wrs_removeClass(this.overlay, cls); - wrs_removeClass(this.titleBar, cls); - wrs_removeClass(this.overlay, cls); - wrs_removeClass(this.container, cls); - wrs_removeClass(this.contentContainer, cls); - wrs_removeClass(this.stackDiv, cls); - wrs_removeClass(this.minimizeDiv, cls); - wrs_removeClass(this.maximizeDiv, cls); - wrs_removeClass(this.wrapper, cls); - } - - /** - * Create modal dialog for desktop. - * @ignore - */ - - }, { - key: "createModalWindowDesktop", - value: function createModalWindowDesktop() { - this.addClass('wrs_modal_desktop'); - this.stack(); - } - - /** - * Create modal dialog for non mobile android devices. - * @ignore - */ - - }, { - key: "createModalWindowAndroid", - value: function createModalWindowAndroid() { - this.addClass('wrs_modal_android'); - window.addEventListener('resize', this.orientationChangeAndroidSoftkeyboard.bind(this)); - } - - /** - * Create modal dialog for iOS devices. - * @ignore - */ - - }, { - key: "createModalWindowIos", - value: function createModalWindowIos() { - this.addClass('wrs_modal_ios'); - // Refresh the size when the orientation is changed - window.addEventListener('resize', this.orientationChangeIosSoftkeyboard.bind(this)); - } - - /** - * Restore previous state, position and size of previous stacked modal window - * @ignore - */ - - }, { - key: "restoreState", - value: function restoreState() { - if (this.properties.state == 'maximized') { - // Reseting states for prevent return to stack state. - this.maximize(); - } else if (this.properties.state == 'minimized') { - // Reseting states for prevent return to stack state. - this.properties.state = this.properties.previousState; - this.properties.previousState = ''; - this.minimize(); - } else { - this.stack(); - } - } - - /** - * Stacks the modal object. - * @ignore - */ - - }, { - key: "stack", - value: function stack() { - this.properties.previousState = this.properties.state; - this.properties.state = 'stack'; - this.removeClass('wrs_maximized'); - this.minimizeDiv.title = "Minimise"; - this.removeClass('wrs_minimized'); - this.addClass('wrs_stack'); - - this.restoreModalProperties(); - - if (typeof this.resizerBR !== 'undefined' && typeof this.resizerTL !== 'undefined') { - this.setResizeButtonsVisibility(); - } - - // Need recalculate position of actual modal because window can was changed in fullscreenmode - this.recalculateScrollBar(); - this.recalculatePosition(); - this.recalculateScale(); - this.focus(); - } - - /** - * Minimizes the modal object - * @ignore - */ - - }, { - key: "minimize", - value: function minimize() { - // Saving width, height, top and bottom parameters to restore when open - this.saveModalProperties(); - if (this.properties.state == 'minimized' && this.properties.previousState == 'stack') { - this.stack(); - } else if (this.properties.state == 'minimized' && this.properties.previousState == 'maximized') { - this.maximize(); - } else { - // Setting css to prevent important tag into css style - this.container.style.height = "30px"; - this.container.style.width = "250px"; - this.container.style.bottom = "0px"; - this.container.style.right = "10px"; - - this.removeListeners(); - this.properties.previousState = this.properties.state; - this.properties.state = "minimized"; - this.setResizeButtonsVisibility(); - this.minimizeDiv.title = "Maximise"; - - if (wrs_containsClass(this.overlay, 'wrs_stack')) { - this.removeClass('wrs_stack'); - } else { - this.removeClass('wrs_maximized'); - } - this.addClass('wrs_minimized'); - } - } - - /** - * Maximizes the modal object. - * @ignore - */ - - }, { - key: "maximize", - value: function maximize() { - // Saving width, height, top and bottom parameters to restore when open - this.saveModalProperties(); - if (this.properties.state != 'maximized') { - this.properties.previousState = this.properties.state; - this.properties.state = 'maximized'; - } - // Don't permit resize on maximize mode. - this.setResizeButtonsVisibility(); - - if (wrs_containsClass(this.overlay, 'wrs_minimized')) { - this.minimizeDiv.title = "Minimise"; - this.removeClass('wrs_minimized'); - } else if (wrs_containsClass(this.overlay, 'wrs_stack')) { - this.container.style.left = null; - this.container.style.top = null; - this.removeClass('wrs_stack'); - } - - this.addClass('wrs_maximized'); - - // Set size to 80% screen with a max size. - this.setSize(parseInt(window.innerHeight * 0.8), parseInt(window.innerWidth * 0.8)); - var sizeModificated = false; - if (this.container.clientHeight > 700) { - this.container.style.height = '700px'; - sizeModificated = true; - } - if (this.container.clientWidth > 1200) { - this.container.style.width = '1200px'; - sizeModificated = true; - } - - // Setting modal position in center on screen. - this.setPosition(window.innerHeight / 2 - this.container.offsetHeight / 2, window.innerWidth / 2 - this.container.offsetWidth / 2); - this.recalculateScale(); - this.recalculatePosition(); - this.recalculateSize(); - this.focus(); - } - - /** - * Sets modal size. - * @param {integer} height set a height of modal with an integer - * @param {integer} width set a width of modal with an integer - * @ignore - */ - - }, { - key: "setSize", - value: function setSize(height, width) { - this.container.style.height = height + 'px'; - this.container.style.width = width + 'px'; - this.recalculateSize(); - } - - /** - * Sets modal position. - * @param {integer} bottom set a bottom of div modal with an integer - * @param {integer} right set a right of div modal with an integer - * @ignore - */ - - }, { - key: "setPosition", - value: function setPosition(bottom, right) { - this.container.style.bottom = bottom + 'px'; - this.container.style.right = right + 'px'; - } - - /** - * Saves actual parameters of open modal object (like size and position...) to restore it - * once the modal object is re-opened. - * @ignore - */ - - }, { - key: "saveModalProperties", - value: function saveModalProperties() { - // Saving values of modal only when modal is in stack state. - if (this.properties.state == 'stack') { - this.properties.position.bottom = parseInt(this.container.style.bottom); - this.properties.position.right = parseInt(this.container.style.right); - this.properties.size.width = parseInt(this.container.style.width); - this.properties.size.height = parseInt(this.container.style.height); - } - } - - /** - * Restore previous parameters values of closed modal (like size and position) and apply this parameters in actual modal. - * @ignore - */ - - }, { - key: "restoreModalProperties", - value: function restoreModalProperties() { - if (this.properties.state == 'stack') { - // Restoring Bottom and Right values from last modal - this.setPosition(this.properties.position.bottom, this.properties.position.right); - // Restoring Height and Left values from last modal - this.setSize(this.properties.size.height, this.properties.size.width); - } - } - - /** - * Set modal size. - * @ignore - */ - - }, { - key: "recalculateSize", - value: function recalculateSize() { - this.wrapper.style.width = this.container.clientWidth - 12 + 'px'; - this.wrapper.style.height = this.container.clientHeight - 38 + 'px'; - this.contentContainer.style.height = parseInt(this.wrapper.offsetHeight - 50) + 'px'; - } - - /** - * Active and disable visibility of resize buttons in modal window depend on state. - * @ignore - */ - - }, { - key: "setResizeButtonsVisibility", - value: function setResizeButtonsVisibility() { - if (this.properties.state == 'stack') { - this.resizerTL.style.visibility = 'visible'; - this.resizerBR.style.visibility = 'visible'; - } else { - this.resizerTL.style.visibility = 'hidden'; - this.resizerBR.style.visibility = 'hidden'; - } - } - - /** - * Makes an object draggable adding mouse and touch events. - * @ignore - */ - - }, { - key: "addListeners", - value: function addListeners() { - // Button events (maximize, minimize, stack and close). - this.maximizeDiv.addEventListener('click', this.maximize.bind(this), true); - this.stackDiv.addEventListener('click', this.stack.bind(this), true); - this.minimizeDiv.addEventListener('click', this.minimize.bind(this), true); - this.closeDiv.addEventListener('click', this.cancelAction.bind(this)); - - // Mouse events. - wrs_addEvent(window, 'mousedown', this.startDrag.bind(this)); - wrs_addEvent(window, 'mouseup', this.stopDrag.bind(this)); - wrs_addEvent(window, 'mousemove', this.drag.bind(this)); - wrs_addEvent(window, 'resize', this.onWindowResize.bind(this)); - // Key events. - wrs_addEvent(window, 'keydown', this.onKeyDown.bind(this)); - } - - /** - * Removes draggable events from an object. - * @ignore - */ - - }, { - key: "removeListeners", - value: function removeListeners() { - // Mouse events. - wrs_removeEvent(window, 'mousedown', this.startDrag); - wrs_removeEvent(window, 'mouseup', this.stopDrag); - wrs_removeEvent(window, 'mousemove', this.drag); - wrs_removeEvent(window, 'resize', this.onWindowResize); - // Key events - wrs_removeEvent(window, 'keydown', this.onKeyDown); - } - - /** - * Returns mouse or touch coordinates (on touch events ev.ClientX doesn't exists) - * @param {event} ev mouse or touch event - * @return {object} with the X and Y coordinates. - * @ignore - */ - - }, { - key: "eventClient", - value: function eventClient(ev) { - if (typeof ev.clientX == 'undefined' && ev.changedTouches) { - var client = { - X: ev.changedTouches[0].clientX, - Y: ev.changedTouches[0].clientY - }; - return client; - } else { - client = { - X: ev.clientX, - Y: ev.clientY - }; - return client; - } - } - - /** - * Start drag function: set the object dragDataObject with the draggable object offsets coordinates. - * when drag starts (on touchstart or mousedown events). - * - * @param {event} ev touchstart or mousedown event. - * @ignore - */ - - }, { - key: "startDrag", - value: function startDrag(ev) { - if (this.properties.state == 'minimized') { - return; - } - if (ev.target.className == 'wrs_modal_title') { - if (typeof this.dragDataObject === 'undefined' || this.dragDataObject === null) { - ev = ev || event; - // Save first click mouse point on screen - this.dragDataObject = { - x: this.eventClient(ev).X, - y: this.eventClient(ev).Y - }; - // Reset last drag position when start drag - this.lastDrag = { - x: "0px", - y: "0px" - }; - // Init right and bottom values for window modal if it isn't exist. - if (this.container.style.right == '') { - this.container.style.right = "0px"; - } - if (this.container.style.bottom == '') { - this.container.style.bottom = "0px"; - } - - // Needed for IE11 for apply disabled mouse events on editor because iexplorer need a dinamic object to apply this property. - if (this.isIE11()) {} - // this.iframe.style['position'] = 'relative'; - - // Apply class for disable involuntary select text when drag. - wrs_addClass(document.body, 'wrs_noselect'); - wrs_addClass(this.overlay, 'wrs_overlay_active'); - // Obtain screen limits for prevent overflow. - this.limitWindow = this.getLimitWindow(); - } - } - } - - /** - * UpdatesdragDataObject with the draggable object coordinates when the draggable object is being moved. - * - * @param {event} ev touchmouve or mousemove events. - * @ignore - */ - - }, { - key: "drag", - value: function drag(ev) { - if (this.dragDataObject) { - ev.preventDefault(); - ev = ev || event; - // Calculate max and min between actual mouse position and limit of screeen. It restric the movement of modal into window. - var limitY = Math.min(this.eventClient(ev).Y + window.pageYOffset, this.limitWindow.minPointer.y + window.pageYOffset); - limitY = Math.max(this.limitWindow.maxPointer.y + window.pageYOffset, limitY); - var limitX = Math.min(this.eventClient(ev).X + window.pageXOffset, this.limitWindow.minPointer.x + window.pageXOffset); - limitX = Math.max(this.limitWindow.maxPointer.x + window.pageXOffset, limitX); - // Substract limit with first position to obtain relative pixels increment to the anchor point. - var dragX = limitX - this.dragDataObject.x + "px"; - var dragY = limitY - this.dragDataObject.y + "px"; - // Save last valid position of modal before window overflow. - this.lastDrag = { - x: dragX, - y: dragY - }; - // This move modal with hadware acceleration. - this.container.style.transform = "translate3d(" + dragX + "," + dragY + ",0)"; - } - if (this.resizeDataObject) { - var limitX = Math.min(this.eventClient(ev).X, window.innerWidth - this.scrollbarWidth - 7); - var limitY = Math.min(this.eventClient(ev).Y, window.innerHeight - 7); - if (limitX < 0) { - limitX = 0; - } - - if (limitY < 0) { - limitY = 0; - } - - var scaleMultiplier; - if (this.leftScale) { - scaleMultiplier = -1; - } else { - scaleMultiplier = 1; - } - this.container.style.width = this.initialWidth + scaleMultiplier * (limitX - this.resizeDataObject.x) + 'px'; - this.container.style.height = this.initialHeight + scaleMultiplier * (limitY - this.resizeDataObject.y) + 'px'; - if (!this.leftScale) { - if (this.resizeDataObject.x - limitX - this.initialWidth < -580) { - this.container.style.right = this.initialRight - (limitX - this.resizeDataObject.x) + 'px'; - } else { - this.container.style.right = this.initialRight + this.initialWidth - 580 + "px"; - this.container.style.width = "580px"; - } - if (this.resizeDataObject.y - limitY < this.initialHeight - 338) { - this.container.style.bottom = this.initialBottom - (limitY - this.resizeDataObject.y) + 'px'; - } else { - this.container.style.bottom = this.initialBottom + this.initialHeight - 338 + "px"; - this.container.style.height = "338px"; - } - } - this.recalculateScale(); - this.recalculatePosition(); - } - } - /** - * Get limits of actual window to limit modal movement - * @return {Object} Object containing mouseX and mouseY are coordinates of actual mouse on screen. - * @ignore - */ - - }, { - key: "getLimitWindow", - value: function getLimitWindow() { - // Obtain dimentions of window page. - var maxWidth = window.innerWidth; - var maxHeight = window.innerHeight; - - // Calculate relative position of mouse point into window. - var offSetToolbarY = this.container.offsetHeight + parseInt(this.container.style.bottom) - (maxHeight - (this.dragDataObject.y - window.pageXOffset)); - var offSetToolbarX = maxWidth - this.scrollbarWidth - (this.dragDataObject.x - window.pageXOffset) - parseInt(this.container.style.right); - - // Calculate limits with sizes of window, modal and mouse position. - var minPointerY = maxHeight - this.container.offsetHeight + offSetToolbarY; - var maxPointerY = this.title.offsetHeight - (this.title.offsetHeight - offSetToolbarY); - var minPointerX = maxWidth - offSetToolbarX - this.scrollbarWidth; - var maxPointerX = this.container.offsetWidth - offSetToolbarX; - var minPointer = { x: minPointerX, y: minPointerY }; - var maxPointer = { x: maxPointerX, y: maxPointerY }; - return { minPointer: minPointer, maxPointer: maxPointer }; - } - /** - * Get Scrollbar width size of browser - * @ignore - */ - - }, { - key: "getScrollBarWidth", - value: function getScrollBarWidth() { - // Create a paragraph with full width of page. - var inner = document.createElement('p'); - inner.style.width = "100%"; - inner.style.height = "200px"; - - // Create a hidden div to compare sizes. - var outer = document.createElement('div'); - outer.style.position = "absolute"; - outer.style.top = "0px"; - outer.style.left = "0px"; - outer.style.visibility = "hidden"; - outer.style.width = "200px"; - outer.style.height = "150px"; - outer.style.overflow = "hidden"; - outer.appendChild(inner); - - document.body.appendChild(outer); - var widthOuter = inner.offsetWidth; - - // Change type overflow of paragraph for measure scrollbar. - outer.style.overflow = 'scroll'; - var widthInner = inner.offsetWidth; - - // If measure is the same, we compare with internal div. - if (widthOuter == widthInner) { - widthInner = outer.clientWidth; - } - document.body.removeChild(outer); - - return widthOuter - widthInner; - } - - /** - * Set the dragDataObject to null when the drag finish (touchend or mouseup events). - * - * @param {event} ev touchend or mouseup event. - * @ignore - */ - - }, { - key: "stopDrag", - value: function stopDrag(ev) { - // Due to we have multiple events that call this function, we need only to execute the next modifiers one time, - // when the user stops to drag and dragDataObject is not null (the object to drag is attached). - if (this.dragDataObject || this.resizeDataObject) { - // If modal doesn't change, it's not necessary to set position with interpolation - this.container.style.transform = ''; - if (this.dragDataObject) { - this.container.style.right = parseInt(this.container.style.right) - parseInt(this.lastDrag.x) + pageXOffset + "px"; - this.container.style.bottom = parseInt(this.container.style.bottom) - parseInt(this.lastDrag.y) + pageYOffset + "px"; - } - // We make focus on editor after drag modal windows to prevent lose focus. - this.focus(); - // Restore mouse events on iframe - // this.iframe.style['pointer-events'] = 'auto'; - document.body.style['user-select'] = ''; - // Restore static state of iframe if we use iexplorer - if (this.isIE11()) {} - // this.iframe.style['position'] = null; - - // Active text select event - wrs_removeClass(document.body, 'wrs_noselect'); - wrs_removeClass(this.overlay, 'wrs_overlay_active'); - } - this.dragDataObject = null; - this.resizeDataObject = null; - this.initialWidth = null; - this.leftScale = null; - } - - /** - * Recalculating scale for modal when resize browser window * - * @ignore - */ - - }, { - key: "onWindowResize", - value: function onWindowResize() { - this.recalculateScrollBar(); - this.recalculatePosition(); - this.recalculateScale(); - } - - /** - * Keydown events: - * Esc key close modal window. - * Tab key tab to submit button. - * @param {event} ev - */ - - }, { - key: "onKeyDown", - value: function onKeyDown(ev) { - if (ev.key !== undefined && ev.repeat === false) { - // Code for detect Esc event - if (ev.key === "Escape" || ev.key === 'Esc') { - if (this.properties.open) { - this.cancelAction(); - } - } - // Code for detect Tab event - if (ev.key === "Tab") { - this.submitButton.focus(); - ev.preventDefault(); - } - } - } - /** - * Recalculating position for modal when resize browser window - * @ignore - */ - - }, { - key: "recalculatePosition", - value: function recalculatePosition() { - this.container.style.right = Math.min(parseInt(this.container.style.right), window.innerWidth - this.scrollbarWidth - this.container.offsetWidth) + "px"; - if (parseInt(this.container.style.right) < 0) { - this.container.style.right = "0px"; - } - this.container.style.bottom = Math.min(parseInt(this.container.style.bottom), window.innerHeight - this.container.offsetHeight) + "px"; - if (parseInt(this.container.style.bottom) < 0) { - this.container.style.bottom = "0px"; - } - } - - /** - * Recalculating scale for modal when resize browser window - * @ignore - */ - - }, { - key: "recalculateScale", - value: function recalculateScale() { - var sizeModificated = false; - if (parseInt(this.container.style.width) > 580) { - this.container.style.width = Math.min(parseInt(this.container.style.width), window.innerWidth - this.scrollbarWidth) + "px"; - sizeModificated = true; - } else { - this.container.style.width = "580px"; - sizeModificated = true; - } - if (parseInt(this.container.style.height) > 338) { - this.container.style.height = Math.min(parseInt(this.container.style.height), window.innerHeight) + "px"; - sizeModificated = true; - } else { - this.container.style.height = "338px"; - sizeModificated = true; - } - if (sizeModificated) { - this.recalculateSize(); - } - } - - /** - * Recalculating width of scrollBar browser - * @ignore - */ - - }, { - key: "recalculateScrollBar", - value: function recalculateScrollBar() { - this.hasScrollBar = window.innerWidth > document.documentElement.clientWidth; - if (this.hasScrollBar) { - this.scrollbarWidth = this.getScrollBarWidth(); - } else { - this.scrollbarWidth = 0; - } - } - - /** - * Hide soft keyboards on IOS systems. - * @ignore - */ - - }, { - key: "hideKeyboard", - value: function hideKeyboard() { - document.activeElement.blur(); - } - - /** - * Focus to content object - * @ignore - */ - - }, { - key: "focus", - value: function focus() { - if (this.contentManager != null && typeof this.contentManager.onFocus !== 'undefined') { - this.contentManager.onFocus(); - } - } - - /** - * Returns true when the device is on portrait mode. - * @ignore - */ - - }, { - key: "portraitMode", - value: function portraitMode() { - return window.innerHeight > window.innerWidth; - } - - /** - * Change container sizes when the keyboard is opened on iOS. - * @ignore - */ - - }, { - key: "openedIosSoftkeyboard", - value: function openedIosSoftkeyboard() { - if (!this.iosSoftkeyboardOpened && this.iosDivHeight != null && this.iosDivHeight == "100" + this.iosMeasureUnit) { - if (this.portraitMode()) { - this.setContainerHeight("63" + this.iosMeasureUnit); - } else { - this.setContainerHeight("40" + this.iosMeasureUnit); - } - } - this.iosSoftkeyboardOpened = true; - } - - /** - * Change container sizes when the keyboard is closed on iOS. - * @ignore - */ - - }, { - key: "closedIosSoftkeyboard", - value: function closedIosSoftkeyboard() { - this.iosSoftkeyboardOpened = false; - this.setContainerHeight("100" + this.iosMeasureUnit); - } - - /** - * Change container sizes when orientation is changed on iOS. - * @ignore - */ - - }, { - key: "orientationChangeIosSoftkeyboard", - value: function orientationChangeIosSoftkeyboard() { - if (this.iosSoftkeyboardOpened) { - if (this.portraitMode()) { - this.setContainerHeight("63" + this.iosMeasureUnit); - } else { - this.setContainerHeight("40" + this.iosMeasureUnit); - } - } else { - this.setContainerHeight("100" + this.iosMeasureUnit); - } - } - - /** - * Change container sizes when orientation is changed on Android. - * @ignore - */ - - }, { - key: "orientationChangeAndroidSoftkeyboard", - value: function orientationChangeAndroidSoftkeyboard() { - this.setContainerHeight("100%"); - } - - /** - * Set iframe container height. - * @ignore - */ - - }, { - key: "setContainerHeight", - value: function setContainerHeight(height) { - this.iosDivHeight = height; - this.wrapper.style.height = height; - // this.editor.getElement().style.height = (this.container.offsetHeight -10) - this.controlsDiv.offsetHeight + 'px'; - } - - /** - * Check content of editor before close action - * @ignore - */ - - }, { - key: "showPopUpMessage", - value: function showPopUpMessage() { - if (this.properties.state == 'minimized') { - this.stack(); - } - this.popup.show(); - } - }, { - key: "setTitle", - value: function setTitle(title) { - this.title.innerHTML = title; - } - }]); - - return ModalWindow; -}(); -/** - * This class shows a dialog message overlaying a dom element in order to - * accept / cancel discart changes. The dialog can be closed i.e the overlay dissapears - * o canceled. In this last case a callback function should be called. - * - * The constructor accepts the following attributes object: - * { - * overlayElement: '', Element to be overlayed. - * callbacks: { - * 'closeCallback' : function(), // Callback function to be called if the dialog is closed. - * 'cancelCallback' : function() // Callback function to be called if the dialog is cancelled - * strings: { - * 'submitString' : '', // Submit button string - * 'cancelString : ''. // Cancel button string - * 'message': '' // Message string - * } - * } - * @param {object} popupProperties - */ - - -var PopUpMessage = function () { - function PopUpMessage(popupProperties) { - _classCallCheck(this, PopUpMessage); - - this.overlay = popupProperties.overlayElement; - this.callbacks = popupProperties.callbacks; - this.overlayEnvolture = this.overlay.appendChild(document.createElement("div")); - this.overlayEnvolture.setAttribute("class", "wrs_popupmessage_overlay_envolture"); - - this.message = this.overlayEnvolture.appendChild(document.createElement("div")); - this.message.id = "wrs_popupmessage"; - this.message.setAttribute("class", "wrs_popupmessage_panel"); - this.message.innerHTML = popupProperties.strings.message; - - var overlay = this.overlayEnvolture.appendChild(document.createElement("div")); - overlay.setAttribute("class", "wrs_popupmessage_overlay"); - // We create a overlay that close popup message on click in there - overlay.addEventListener("click", this.cancelAction.bind(this)); - - this.buttonArea = this.message.appendChild(document.createElement('div')); - this.buttonArea.setAttribute("class", "wrs_popupmessage_button_area"); - this.buttonArea.id = 'wrs_popup_button_area'; - - // Buttons creation - var buttonSubmitArguments = { - class: "wrs_button_accept", - innerHTML: popupProperties.strings.submitString, - id: 'wrs_popup_accept_button' - }; - this.acceptButton = this.createButton(buttonSubmitArguments, this.closeAction.bind(this)); - this.buttonArea.appendChild(this.acceptButton); - - var buttonCancelArguments = { - class: "wrs_button_cancel", - innerHTML: popupProperties.strings.cancelString, - id: 'wrs_popup_cancel_button' - }; - this.cancelButton = this.createButton(buttonCancelArguments, this.cancelAction.bind(this)); - this.buttonArea.appendChild(this.cancelButton); - } - - /** - * This method create a button with arguments and return button dom object - * @param {object} parameters An object containg id, class and innerHTML button text. - * @param {object} callback Callback method to call on click event. - */ - - - _createClass(PopUpMessage, [{ - key: "createButton", - value: function createButton(parameters, callback) { - function popUpButton(parameters) { - this.element = document.createElement("button"); - this.element.setAttribute("id", parameters.id); - this.element.setAttribute("class", parameters.class); - this.element.innerHTML = parameters.innerHTML; - this.element.addEventListener("click", callback); - } - - popUpButton.prototype.getElement = function () { - return this.element; - }; - - return new popUpButton(parameters).getElement(); - } - - /** - * This method show the popupmessage containing a message, and two buttons - * to cancel the action or close the modal dialog. - */ - - }, { - key: "show", - value: function show() { - if (this.overlayEnvolture.style.display != 'block') { - // Clear focus with blur for prevent press anykey - document.activeElement.blur(); - - // For works with Safari - window.focus(); - this.overlayEnvolture.style.display = 'block'; - } else { - this.overlayEnvolture.style.display = 'none'; - _wrs_modalWindow.focus(); - } - } - - /** - * This method cancel the popupMessage: the dialog dissapears revealing the overlaid element. - * A callback method is called (if defined). For example a method to focus the overlaid element. - */ - - }, { - key: "cancelAction", - value: function cancelAction() { - this.overlayEnvolture.style.display = 'none'; - if (typeof this.callbacks.cancelCallback !== 'undefined') { - this.callbacks.cancelCallback(); - } - } - - /** - * This method closes the popupMessage: the dialog dissapears and the close callback is called. - * For example to close the overlaid element. - */ - - }, { - key: "closeAction", - value: function closeAction() { - this.cancelAction(); - if (typeof this.callbacks.closeCallback !== 'undefined') { - this.callbacks.closeCallback(); - } - } - }]); - - return PopUpMessage; -}(); /** - * This class implements ModalContent interface. Manage the following: - * - insertion in modal object (insert(modalObject) method) - * - actions to be done once the modal object has been submited (submitAction() method) - * - updates itself when modalObject is updated with a re-open action for example (update(modalObject) method) - * - comunicates to modalObject if some changes have be done (hasChanges() method) - * - * @param {object} editorAttributes editor attributes. See http://docs.wiris.com/en/mathtype/mathtype_web/sdk-api/parameters - * for further information. - * @ignore - */ - - -var contentManager = function () { - // Editor listener. - function contentManager(editorAttributes) { - _classCallCheck(this, contentManager); - - this.editorListener = new EditorListener(); - this.editor = null; - this.editorAttributes = editorAttributes; - this.lastImageWasNew = false; - // Device properties - var ua = navigator.userAgent.toLowerCase(); - this.deviceProperties = {}; - this.deviceProperties.isAndroid = ua.indexOf("android") > -1; - this.deviceProperties.isIOS = ua.indexOf("ipad") > -1 || ua.indexOf("iphone") > -1; - // Toolbar - this.toolbar = null; - this.loadEditor(); - } - - /** - * Mandatory method: inserts editor into modal object content container. - * @param {object} modalObject - * @ignore - */ - - - _createClass(contentManager, [{ - key: "insert", - value: function insert(modalObject) { - // Before insert the editor we update the modal object title to avoid weird render display. - this.updateTitle(modalObject); - this.insertEditor(modalObject); - } - - /** - * Method to insert MathType into modal object. This method - * watis until editor JavaScript is loaded to insert the editor into - * contentContainer modal object element. - * @ignore - */ - - }, { - key: "insertEditor", - value: function insertEditor(modalObject) { - // To know if editor JavaScript is loaded we need to wait until com.wiris.jsEditor namespace is ready. - if ('com' in window && 'wiris' in window.com && 'jsEditor' in window.com.wiris) { - this.editor = com.wiris.jsEditor.JsEditor.newInstance(this.editorAttributes); - this.editor.insertInto(modalObject.contentContainer); - this.editor.focus(); - // Setting div in rtl in case of it's activated. - if (this.editor.getEditorModel().isRTL()) { - this.editor.element.style.direction = 'rtl'; - } - - // Editor listener: this object manages the changes logic of editor. - this.editor.getEditorModel().addEditorListener(this.editorListener); - - // iOS events. - if (modalObject.deviceProperties['isIOS']) { - setTimeout(function () { - _wrs_modalWindow.hideKeyboard(); - }, 400); - var formulaDisplayDiv = document.getElementsByClassName('wrs_formulaDisplay')[0]; - wrs_addEvent(formulaDisplayDiv, 'focus', modalObject.openedIosSoftkeyboard.bind(modalObject)); - wrs_addEvent(formulaDisplayDiv, 'blur', modalObject.closedIosSoftkeyboard.bind(modalObject)); - } - - this.onOpen(modalObject); - } else { - setTimeout(contentManager.prototype.insertEditor.bind(this, modalObject), 100); - } - } - - /** - * Loads MathType ediitor JavaScript. - * @ignore - */ - - }, { - key: "loadEditor", - value: function loadEditor() { - var queryParams = window.location.search.substring(1).split("&"); - var version = ""; - for (var i = 0; i < queryParams.length; i++) { - var pos = queryParams[i].indexOf("v="); - if (pos >= 0) { - version = queryParams[i].substring(2); - } - } - - var script = document.createElement('script'); - script.type = 'text/javascript'; - var editorUrl = _wrs_conf_editorUrl; - // Change to https if necessary. - // We create an object url for parse url string and work more efficiently. - var urlObject = document.createElement('a'); - urlObject.href = editorUrl; - - if (window.location.href.indexOf("https://") == 0) { - // It check if browser is https and configuration is http. If this is so, we will replace protocol. - if (urlObject.protocol == 'http:') { - urlObject.protocol = 'https:'; - } - } - - // Check protocol and remove port if it's standard. - if (urlObject.port == '80' || urlObject.port == '443') { - editorUrl = urlObject.protocol + '//' + urlObject.hostname + '/' + urlObject.pathname; - } else { - editorUrl = urlObject.protocol + '//' + urlObject.hostname + ':' + urlObject.port + '/' + urlObject.pathname; - } - - // Editor stats. - var statEditor = _wrs_conf_editor; - var statSaveMode = _wrs_conf_saveMode; - var statVersion = _wrs_conf_version; - - script.src = editorUrl + "?lang=" + _wrs_int_langCode + '&stats-editor=' + statEditor + '&stats-mode=' + statSaveMode + '&stats-version=' + statVersion; - document.getElementsByTagName('head')[0].appendChild(script); - } - - /** - * Set the editor initial content: an existing formula or a blank MathML - */ - - }, { - key: "setInitialContent", - value: function setInitialContent() { - if (!_wrs_isNewElement) { - var mathml = wrs_mathmlDecode(_wrs_temporalImage.getAttribute(_wrs_conf_imageMathmlAttribute)); - this.setMathML(mathml); - } - } - - /** - * Set a MathML into editor. - * @param {string} mathml MathML string. - * @param {bool} focusDisabled if true editor don't get focus after the MathML is set. false by default. - * @ignore - */ - - }, { - key: "setMathML", - value: function setMathML(mathml, focusDisabled) { - // By default focus is enabled - if (typeof focusDisabled === 'undefined') { - focusDisabled = false; - } - // Using setMathML method is not a change produced by the user but for the API - // so we set to false the contentChange property of editorListener. - this.editor.setMathMLWithCallback(mathml, function () { - this.editorListener.setWaitingForChanges(true); - }.bind(this)); - // We need to wait a little until the callback finish. - setTimeout(function () { - this.editorListener.setIsContentChanged(false); - }.bind(this), 500); - - // In some scenarios - like closing modal object - editor mustn't be focused. - if (!focusDisabled) { - this.onFocus(); - } - } - - /** - * Set focus on editor. - * @ignore - */ - - }, { - key: "onFocus", - value: function onFocus() { - // TODO: Check editor avaliable. - if (typeof this.editor !== 'undefined' && this.editor != null) { - this.editor.focus(); - } - } - - /** - * Mandatory method: modal object calls this method to execute a callback action - * on submit. - * This method updates the edition area (inserting a new formula or update an older one), - * and focus the edition area too. - * @ignore - */ - - }, { - key: "submitAction", - value: function submitAction() { - var mathML = this.editor.getMathML(); - // Add class for custom editors. - if (wrs_int_getCustomEditorEnabled() != null) { - mathML = wrs_mathmlAddEditorAttribute(mathML); - } - var mathmlEntitiesEncoded = wrs_mathmlEntities(mathML); - wrs_int_updateFormula(mathmlEntitiesEncoded, null, _wrs_int_langCode); - wrs_int_disableCustomEditors(); - wrs_int_notifyWindowClosed(); - _wrs_editMode = window._wrs_conf_defaultEditMode ? _wrs_conf_defaultEditMode : 'images'; - - // Set disabled focus to prevent lost focus. - this.setEmptyMathML(); - wrs_int_disableCustomEditors(); - // Reconvering editing area focus. - setTimeout(function () { - if (typeof _wrs_currentEditor !== 'undefined' && _wrs_currentEditor) { - _wrs_currentEditor.focus(); - } - }, 100); - } - - /** - * Set an empty MathML into the editor in order to clean the edit area. - * @ignore - */ - - }, { - key: "setEmptyMathML", - value: function setEmptyMathML() { - // As second argument we pass - if (this.deviceProperties.isAndroid || this.deviceProperties.isIOS) { - // We need to set a empty annotation in order to maintain editor in Hand mode. - // Adding dir rtl in case of it's activated. - if (this.editor.getEditorModel().isRTL()) { - this.setMathML('[]"', true); - } else { - this.setMathML('[]"', true); - } - } else { - if (this.editor.getEditorModel().isRTL()) { - this.setMathML('', true); - } else { - this.setMathML('', true); - } - } - } - - /** - * Mandatory method: modal object calls this method when is updated, for example re-editing a formula when the - * editor is open with another formula. This method updates the editor content (with an empty MathML or an exising formula), - * updates - if needed - the editor toolbar (math --> chem or chem --> math) and recover the focus. - * @param {object} modalObject - * @ignore - */ - - }, { - key: "onOpen", - value: function onOpen(modalObject) { - if (_wrs_isNewElement) { - this.setEmptyMathML(); - this.lastImageWasNew = true; - } else { - this.setMathML(wrs_mathmlDecode(_wrs_temporalImage.getAttribute(_wrs_conf_imageMathmlAttribute))); - this.lastImageWasNew = false; - } - this.updateToolbar(modalObject); - this.onFocus(); - } - - /** - * Sets the correct toolbar depending if exist other custom toolbars at the same time (e.g: Chemistry) - * @ignore - */ - - }, { - key: "updateToolbar", - value: function updateToolbar(modalObject) { - this.updateTitle(modalObject); - var customEditor; - if (customEditor = wrs_int_getCustomEditorEnabled()) { - var toolbar = customEditor.toolbar ? customEditor.toolbar : _wrs_int_wirisProperties['toolbar']; - if (this.toolbar == null || this.toolbar != toolbar) { - this.setToolbar(toolbar); - } - } else { - var toolbar = this.getToolbar(); - if (this.toolbar == null || this.toolbar != toolbar) { - this.setToolbar(toolbar); - wrs_int_disableCustomEditors(); - } - } - } - /** - * Updates the modalObject title: if a custom editor (with a custom toolbar) is enabled - * picks the custom editor title. Otherwise default title. - * @param {object} modalObject - * @ignore - */ - - }, { - key: "updateTitle", - value: function updateTitle(modalObject) { - var customEditor; - if (customEditor = wrs_int_getCustomEditorEnabled()) { - modalObject.setTitle(customEditor.title); - } else { - modalObject.setTitle('MathType'); - } - } - /** - * Returns toolbar depending on the configuration local or serverside. - * @ignore - */ - - }, { - key: "getToolbar", - value: function getToolbar() { - var toolbar = typeof _wrs_conf_editorParameters == 'undefined' || typeof _wrs_conf_editorParameters['toolbar'] == 'undefined' ? 'general' : _wrs_conf_editorParameters['toolbar']; - if (toolbar == 'general') { - toolbar = typeof _wrs_int_wirisProperties == 'undefined' || typeof _wrs_int_wirisProperties['toolbar'] == 'undefined' ? 'general' : _wrs_int_wirisProperties['toolbar']; - } - return toolbar; - } - - /** - * Set a toolbar into editor. - * @param {string} toolbar toolbar name. - * @ignore - */ - - }, { - key: "setToolbar", - value: function setToolbar(toolbar) { - this.toolbar = toolbar; - this.editor.setParams({ 'toolbar': this.toolbar }); - } - - /** - * Returns true if the content of the editor has been changed. The logic of the changes - * is delegated to editorListener object. - * @ignore - */ - - }, { - key: "hasChanges", - value: function hasChanges() { - return !this.editor.isFormulaEmpty() && this.editorListener.getIsContentChanged(); - } - }]); - - return contentManager; -}(); -/** - * EditorListener class. This class implement EditorListener interface - * and contains the logic to determine if editor has been changed or not. - * @ignore - */ - - -var EditorListener = function () { - function EditorListener() { - _classCallCheck(this, EditorListener); - - this.isContentChanged = false; - this.waitingForChanges = false; - } - - /** - * EditorListener method set if content is changed - * @ignore - */ - - - _createClass(EditorListener, [{ - key: "setIsContentChanged", - value: function setIsContentChanged(value) { - this.isContentChanged = value; - } - }, { - key: "getIsContentChanged", - - /** - * EditorListener method to get if content is changed - * @ignore - */ - value: function getIsContentChanged(value) { - return this.isContentChanged; - } - }, { - key: "setWaitingForChanges", - - /** - * EditorListener method to wait changes - * @ignore - */ - value: function setWaitingForChanges(value) { - this.waitingForChanges = value; - } - }, { - key: "caretPositionChanged", - - /** - * EditorListener method to overwrite - * @ignore - */ - value: function caretPositionChanged(editor) {} - }, { - key: "clipboardChanged", - - /** - * EditorListener method to overwrite - * @ignore - */ - value: function clipboardChanged(editor) {} - }, { - key: "contentChanged", - - /** - * EditorListener method to set if content is changed - * @ignore - */ - value: function contentChanged(editor) { - if (this.waitingForChanges === true && this.isContentChanged === false) { - this.isContentChanged = true; - } - } - /** - * EditorListener method to overwrite - * @ignore - */ - - }, { - key: "styleChanged", - value: function styleChanged(editor) {} - }, { - key: "transformationReceived", - - /** - * EditorListener method to overwrite - * @ignore - */ - value: function transformationReceived(editor) {} - }]); - - return EditorListener; -}(); // TODO: Methods to static? -/** - * StringManager class to use strings in code correctly with control. - * @ignore - */ - - -var StringManager = function () { - function StringManager() { - _classCallCheck(this, StringManager); - - // Strings are empty when it creates, it set when calls load method. - this.strings = null; - this.stringsLoaded = false; - } - - /** - * This method return a string passing a key. - * @param {string} key of array strings that you want. - * @return string A text that you want or key if it doesn't exist. - * @ignore - */ - - - _createClass(StringManager, [{ - key: "getString", - value: function getString(key) { - // Wait 200ms and recall this method if strings aren't load. - if (!this.stringsLoaded) { - setTimeout(this.getString.bind(this, key), 100); - return; - } - if (key in this.strings) { - return this.strings[key]; - } - return key; - } - /** - * This method load all strings to the manager and unset it for prevent bad usage. - * @param {array} String array of language - * @ignore - */ - - }, { - key: "loadStrings", - value: function loadStrings(langStrings) { - if (!this.stringsLoaded) { - this.strings = langStrings; - // Activate variable to unlock getStrings - this.stringsLoaded = true; - } - } - }]); - - return StringManager; -}(); - -var _wrs_conf_core_loaded = true; +String.prototype.codePointAt||function(){var e=function(e){if(null==this)throw TypeError();var t=String(this),i=t.length,n=e?Number(e):0;if(n!=n&&(n=0),!(n<0||n>=i)){var r,s=t.charCodeAt(n);return s>=55296&&s<=56319&&i>n+1&&(r=t.charCodeAt(n+1))>=56320&&r<=57343?1024*(s-55296)+r-56320+65536:s}};Object.defineProperty?Object.defineProperty(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}(),"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(e),n=1;n= 0) { - // That's my script! - return src.substr(0, j - 1); - } - } -} - -var _wrs_corePath = wrs_getCorePath(); - -/** - * Fires an element event. - * @param {object} element element where event should be fired. - * @param {string} event event to fire. - * @ignore - */ -function wrs_fireEvent(element, event) { - if (document.createEvent){ - var eventObject = document.createEvent('HTMLEvents'); - eventObject.initEvent(event, true, true); - return !element.dispatchEvent(eventObject); - } - - var eventObject = document.createEventObject(); - return element.fireEvent('on' + event, eventObject) -} - - -// Translated languages. -var _wrs_languages = 'ar,ca,cs,da,de,en,es,et,eu,fi,fr,gl,he,hr,hu,it,ja,ko,nl,no,pl,pt,pt_br,ru,sv,tr,zh,el'; - -// Load lang file at first to replace some variables -wrs_loadLangFile() - -// Vars. -var _wrs_stringManager; -var _wrs_currentPath = window.location.toString().substr(0, window.location.toString().lastIndexOf('/') + 1); -var _wrs_editMode = typeof _wrs_editMode != 'undefined' ? _wrs_editMode : undefined; -var _wrs_isNewElement = typeof _wrs_isNewElement !== 'undefined' ? _wrs_isNewElement : true; -var _wrs_temporalImage; -var _wrs_temporalFocusElement; -var _wrs_range; -// TODO: String Manager not loaded. -function loadStringLatex() { - if(_wrs_conf_core_loaded) { - var _wrs_latex_formula_name = _wrs_stringManager.getString('latex_name_label'); - } else { - setTimeout(loadStringLatex,100); - } -} -loadStringLatex(); - -var _wrs_latex_formula_number = 1; - -// Tags used for LaTeX formulas. -var _wrs_latexTags = { - 'open': '$$', - 'close': '$$' -}; -// LaTex client cache. -var _wrs_int_LatexCache = {}; -// Cache for all the mathmls withouts translation to LaTex. -var _wrs_int_nonLatexCache = {}; - -// Accessible client cache. -var _wrs_int_AccessibleCache = {}; - -var _wrs_xmlCharacters = { - 'tagOpener': '<', // Hex: \x3C. - 'tagCloser': '>', // Hex: \x3E. - 'doubleQuote': '"', // Hex: \x22. - 'ampersand': '&', // Hex: \x26. - 'quote': '\'' // Hex: \x27. -}; - -var _wrs_safeXmlCharacters = { - 'tagOpener': '«', // Hex: \xAB. - 'tagCloser': '»', // Hex: \xBB. - 'doubleQuote': '¨', // Hex: \xA8. - 'ampersand': '§', // Hex: \xA7. - 'quote': '`', // Hex: \x60. - 'realDoubleQuote': '¨' -}; - -var _wrs_safeXmlCharactersEntities = { - 'tagOpener': '«', - 'tagCloser': '»', - 'doubleQuote': '¨', - 'realDoubleQuote': '"' -} - -var _wrs_safeBadBlackboardCharacters = { - 'ltElement': '«mo»<«/mo»', - 'gtElement': '«mo»>«/mo»', - 'ampElement': '«mo»&«/mo»' -} - -var _wrs_safeGoodBlackboardCharacters = { - 'ltElement': '«mo»§lt;«/mo»', - 'gtElement': '«mo»§gt;«/mo»', - 'ampElement': '«mo»§amp;«/mo»' -} - -var _wrs_staticNodeLengths = { - 'IMG': 1, - 'BR': 1 -} - -// Backwards compatibily. - -if (!(window._wrs_conf_imageClassName)) { - var _wrs_conf_imageClassName = 'Wirisformula'; -} - -if (!(window._wrs_conf_CASClassName)) { - var _wrs_conf_CASClassName = 'Wiriscas'; -} - -// Mutation observers to avoid wiris image formulas class be removed. -if (typeof MutationObserver != 'undefined') { - var wrs_observer = new MutationObserver(function(mutations) { - mutations.forEach(function(mutation) { - if (mutation.oldValue == _wrs_conf_imageClassName && mutation.attributeName == 'class' && mutation.target.className.indexOf(_wrs_conf_imageClassName) == -1 ) { - mutation.target.className = _wrs_conf_imageClassName; - } - }); - }); - - var wrs_observer_config = { attributes: true, attributeOldValue:true }; -} - -// Plugin listeners for custom callbacks. This variable -// can be setted by the user using wrs_addPluginListener. -var wrs_pluginListeners = []; - -var _wrs_css_loaded = false; - -var _wrs_modalWindowProperties = typeof _wrs_modalWindowProperties != 'undefined' ? _wrs_modalWindowProperties : {}; -var _wrs_editor = typeof _wrs_editor != 'undefined' ? _wrs_editor : null; -var _wrs_modalWindow = typeof _wrs_modalWindow != 'undefined' ? _wrs_modalWindow : null; - -// If true all MathML should be parse despite of save mode. -var _wrs_parseXml = true; - -/** - * Adds element events. - * @param {object} target Target - * @param {function} doubleClickHandler Function to run when user double clicks the element - * @param {function} mousedownHandler Function to run when user mousedowns the element - * @param {function} mouseupHandler Function to run when user mouseups the element - * @ignore - */ -function wrs_addElementEvents(target, doubleClickHandler, mousedownHandler, mouseupHandler) { - if (doubleClickHandler) { - wrs_addEvent(target, 'dblclick', function (event) { - var realEvent = (event) ? event : window.event; - var element = realEvent.srcElement ? realEvent.srcElement : realEvent.target; - doubleClickHandler(target, element, realEvent); - }); - } - - if (mousedownHandler) { - wrs_addEvent(target, 'mousedown', function (event) { - var realEvent = (event) ? event : window.event; - var element = realEvent.srcElement ? realEvent.srcElement : realEvent.target; - _wrs_temporalFocusElement = element; - mousedownHandler(target, element, realEvent); - }); - } - - if (mouseupHandler) { - wrs_addEvent(target, 'mouseup', function (event) { - var realEvent = (event) ? event : window.event; - var element = realEvent.srcElement ? realEvent.srcElement : realEvent.target; - mouseupHandler(target, element, realEvent); - }); - } -} - -/** - * Cross-browser addEventListener/attachEvent function. - * @param {object} element Element target - * @param {event} event Event - * @param {function} func Function to run - * @ignore - */ -function wrs_addEvent(element, event, func) { - if (element.addEventListener) { - element.addEventListener(event, func, true); - } - else if (element.attachEvent) { - element.attachEvent('on' + event, func); - } -} - -/** - * Adds iframe events. - * @param {object} iframe Target - * @param {function} doubleClickHandler Function to run when user double clicks the iframe - * @param {function} mousedownHandler Function to run when user mousedowns the iframe - * @param {function} mouseupHandler Function to run when user mouseups the iframe - * @ignore - */ -function wrs_addIframeEvents(iframe, doubleClickHandler, mousedownHandler, mouseupHandler) { - wrs_initSetSize(); - wrs_addElementEvents(iframe.contentWindow.document, - function (target, element, event) { - doubleClickHandler(iframe, element, event); - }, - function (target, element, event) { - mousedownHandler(iframe, element, event); - }, - function (target, element, event) { - mouseupHandler(iframe, element, event); - } - ); -} - -/** - * Adds textarea events. - * @param {object} textarea Target - * @param {function} clickHandler Function to run when user clicks the textarea. - * @ignore - */ -function wrs_addTextareaEvents(textarea, clickHandler) { - if (clickHandler) { - wrs_addEvent(textarea, 'click', function (event) { - var realEvent = (event) ? event : window.event; - clickHandler(textarea, realEvent); - }); - } -} - -/** - * Converts applet code to img object. - * @param {object} creator Object with "createElement" method - * @param {string} appletCode Applet code - * @param {string} image Base 64 image stream - * @param {int} imageWidth Image width - * @param {int} imageHeight Image height - * @return object img object. - * @ignore - */ -function wrs_appletCodeToImgObject(creator, appletCode, image, imageWidth, imageHeight) { - var imageSrc = wrs_createImageCASSrc(image); - var imgObject = creator.createElement('img'); - - imgObject.src = imageSrc; - imgObject.align = 'middle'; - imgObject.width = imageWidth; - imgObject.height = imageHeight; - imgObject.setAttribute(_wrs_conf_CASMathmlAttribute, wrs_mathmlEncode(appletCode)); - imgObject.className = _wrs_conf_CASClassName; - - return imgObject; -} - -/** - * Checks if a determined array contains a determined element. - * @param {array} stack - * @param {object} element - * @return bool - * @ignore - */ -function wrs_arrayContains(stack, element) { - for (var i = stack.length - 1; i >= 0; --i) { - if (stack[i] === element) { - return i; - } - } - - return -1; -} - -/** - * Adds a specific className to given element - * @param {object} element - * @param {string} className - * @ignore - */ -function wrs_addClass(element, className) { - if (!wrs_containsClass(element, className)) { - element.className += " " + className; - } -} - -/** - * Checks if an element contains a class. - * @param {object} element - * @param {string} className - * @return bool - * @ignore - */ -function wrs_containsClass(element, className) { - if (element == null || !('className' in element)) { - return false; - } - - var currentClasses = element.className.split(' '); - - for (var i = currentClasses.length - 1; i >= 0; --i) { - if (currentClasses[i] == className) { - return true; - } - } - - return false; -} - -/** - * Remove a specific class - * @param {object} element - * @param {string} className - * @ignore - */ -function wrs_removeClass(element, className) { - var newClassName = ''; - var classes = element.className.split(" "); - - for (var i = 0; i < classes.length; i++) { - if(classes[i] != className) { - newClassName += classes[i] + " "; - } - } - element.className = newClassName.trim(); -} - -/** - * Converts old xmlinitialtext attribute (with «») to the correct one(with §lt;§gt;) - * @param {string} text String containtg safeXml characters - * @return {string} String with the safeXml charaters parsed. - * @ignore - */ -function wrs_convertOldXmlinitialtextAttribute(text){ - // Used to fix a bug with Cas imported from Moodle 1.9 to Moodle 2.x. - // This could be removed in future. - var val = 'value='; - - var xitpos = text.indexOf('xmlinitialtext'); - var valpos = text.indexOf(val, xitpos); - var quote = text.charAt(valpos + val.length); - var startquote = valpos + val.length + 1; - var endquote = text.indexOf(quote, startquote); - - var value = text.substring(startquote, endquote); - - var newvalue = value.split('«').join('§lt;'); - newvalue = newvalue.split('»').join('§gt;'); - newvalue = newvalue.split('&').join('§'); - newvalue = newvalue.split('¨').join('§quot;'); - - text = text.split(value).join(newvalue); - return text; -} - -/** - * Cross-browser solution for creating new elements. - * - * It fixes some browser bugs. - * - * @param {string} elementName The tag name of the wished element. - * @param {object} attributes An object where each key is a wished attribute name and each value is its value. - * @param {object} creator Optional param. If supplied, this function will use the "createElement" method from this param. Else, "document" will be used. - * @return {object} The DOM element with the specified attributes assignated. - * @ignore - */ -function wrs_createElement(elementName, attributes, creator) { - if (attributes === undefined) { - attributes = {}; - } - - if (creator === undefined) { - creator = document; - } - - var element; - - /* - * Internet Explorer fix: - * If you create a new object dynamically, you can't set a non-standard attribute. - * For example, you can't set the "src" attribute on an "applet" object. - * Other browsers will throw an exception and will run the standard code. - */ - - try { - var html = '<' + elementName; - - for (var attributeName in attributes) { - html += ' ' + attributeName + '="' + wrs_htmlentities(attributes[attributeName]) + '"'; - } - - html += '>'; - element = creator.createElement(html); - } - catch (e) { - element = creator.createElement(elementName); - - for (var attributeName in attributes) { - element.setAttribute(attributeName, attributes[attributeName]); - } - } - - return element; -} - -/** - * Cross-browser httpRequest creation. - * @return {object} httpRequest request object. - * @ignore - */ -function wrs_createHttpRequest() { - if (_wrs_currentPath.substr(0, 7) == 'file://') { - throw _wrs_stringManager.getString('exception_cross_site'); - } - - if (typeof XMLHttpRequest != 'undefined') { - return new XMLHttpRequest(); - } - - try { - return new ActiveXObject('Msxml2.XMLHTTP'); - } - catch (e) { - try { - return new ActiveXObject('Microsoft.XMLHTTP'); - } - catch (oc) { - } - } - - return false; -} - -/** - * Gets CAS image src with AJAX. - * @param {string} image Base 64 image stream - * @return {string} CAS image src. - * @ignore - */ -function wrs_createImageCASSrc(image, appletCode) { - var data = { - 'image': image, - 'mml': appletCode - }; - - return wrs_getContent(_wrs_conf_createcasimagePath, data); -} - -/** - * Gets formula image src with AJAX. - * @param {mathml} Mathml code. - * @param {object} data wiris properties object. - * @return string Image src. - * @ignore - */ -function wrs_createImageSrc(mathml, data) { - // Full base64 method (edit & save). - if (_wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'default') { - data['base64'] = true; - } - - var result = wrs_getContent(_wrs_conf_createimagePath, data); - - if (result.indexOf('@BASE@') != -1) { - // Replacing '@BASE@' with the base URL of createimage. - var baseParts = _wrs_conf_createimagePath.split('/'); - baseParts.pop(); - result = result.split('@BASE@').join(baseParts.join('/')); - } - - return result; -} - -function wrs_createShowImageSrc(mathml, data, language) { - var dataMd5 = [] - var renderParams = 'mml,color,centerbaseline,zoom,dpi,fontSize,fontFamily,defaultStretchy,backgroundColor,format'; - var renderParamsArray = renderParams.split(','); - for (var key in renderParamsArray) { - var param = renderParamsArray[key]; - if (typeof data[param] != 'undefined') { - dataMd5[param] = data[param]; - } - } - // Data variables to get. - var dataObject = {}; - for (var key in data) { - // We don't need mathml in this request we try to get cached so we only need the formula md5 calculated before. - if (key != 'mml') { - dataObject[key] = data[key]; - } - } - dataObject.formula = com.wiris.js.JsPluginTools.md5encode(wrs_propertiesToString(dataMd5)); - dataObject.lang = (typeof language == 'undefined') ? 'en' : language; - dataObject.version = _wrs_conf_version; - - var result = wrs_getContent(_wrs_conf_showimagePath + '?' + wrs_httpBuildQuery(dataObject)); - return result; -} - -/** - * Creates new object using its html code. - * @param {string} objectCode html code - * @return {object} html object. - * @ignore - */ -function wrs_createObject(objectCode, creator) { - if (creator === undefined) { - creator = document; - } - - // Internet Explorer can't include "param" tag when is setting an innerHTML property. - objectCode = objectCode.split('').join('').split('').join(''); - - objectCode = objectCode.split('').join('
').split('').join('
'); - - var container = wrs_createElement('div', {}, creator); - container.innerHTML = objectCode; - - function recursiveParamsFix(object) { - if (object.getAttribute && object.getAttribute('wirisObject') == 'WirisParam') { - var attributesParsed = {}; - - for (var i = 0; i < object.attributes.length; ++i) { - if (object.attributes[i].nodeValue !== null) { - attributesParsed[object.attributes[i].nodeName] = object.attributes[i].nodeValue; - } - } - - var param = wrs_createElement('param', attributesParsed, creator); - - // IE fix. - if (param.NAME) { - param.name = param.NAME; - param.value = param.VALUE; - } - - param.removeAttribute('wirisObject'); - object.parentNode.replaceChild(param, object); - } - else if (object.getAttribute && object.getAttribute('wirisObject') == 'WirisApplet') { - var attributesParsed = {}; - - for (var i = 0; i < object.attributes.length; ++i) { - if (object.attributes[i].nodeValue !== null) { - attributesParsed[object.attributes[i].nodeName] = object.attributes[i].nodeValue; - } - } - - var applet = wrs_createElement('applet', attributesParsed, creator); - applet.removeAttribute('wirisObject'); - - for (var i = 0; i < object.childNodes.length; ++i) { - recursiveParamsFix(object.childNodes[i]); - - if (object.childNodes[i].nodeName.toLowerCase() == 'param') { - applet.appendChild(object.childNodes[i]); - --i; // When we insert the object child into the applet, object loses one child. - } - } - - object.parentNode.replaceChild(applet, object); - } - else { - for (var i = 0; i < object.childNodes.length; ++i) { - recursiveParamsFix(object.childNodes[i]); - } - } - } - - recursiveParamsFix(container); - return container.firstChild; -} - -/** - * Converts an object to its HTML code. - * @param {object} object DOM object.. - * @return {string} HTML code. - * @ignore - */ -function wrs_createObjectCode(object) { - - // In case that the image was not created, the object can be null or undefined. - if (typeof object == 'undefined' || object == null) { - return; - } - - if (object.nodeType == 1) { // ELEMENT_NODE. - var output = '<' + object.tagName; - - for (var i = 0; i < object.attributes.length; ++i) { - if (object.attributes[i].specified) { - output += ' ' + object.attributes[i].name + '="' + wrs_htmlentities(object.attributes[i].value) + '"'; - } - } - - if (object.childNodes.length > 0) { - output += '>'; - - for (var i = 0; i < object.childNodes.length; ++i) { - output += wrs_createObjectCode(object.childNodes[i]); - } - - output += ''; - } - else if (object.nodeName == 'DIV' || object.nodeName == 'SCRIPT') { - output += '>'; - } - else { - output += '/>'; - } - - return output; - } - - if (object.nodeType == 3) { // TEXT_NODE. - return wrs_htmlentities(object.nodeValue); - } - - return ''; -} - -/** - * Parses end HTML code. The end HTML code is HTML code with embedded images or LaTeX formulas created with MathType.
- * By default this method converts the formula images and LaTeX strings in MathML.
- * If image mode is enabled the images will not be converted into MathML. For further information see {@link http://www.wiris.com/plugins/docs/full-mathml-mode}. - * @param {string} code String to be parsed. - * @param {object} wirisProperties Extra attributes for the formula. - * @param {string} language Language for the formula. - * @return {string} - */ -function wrs_endParse(code, wirisProperties, language) { - code = wrs_endParseEditMode(code, wirisProperties, language); - return wrs_endParseSaveMode(code); -} - -function wrs_regexpIndexOf(input, regexp, start) { - var index = input.substring(start || 0).search(regexp); - return (index >= 0) ? (index + (start || 0)) : index; -} - -/** - * Parses end HTML code depending on the edit mode. - * @param {string} code HTML code to be parsed. - * @param {object} wirisProperties Extra formula attributes. - * @param {string} language Language for the formula. - * @return {string} - * @ignore - */ -function wrs_endParseEditMode(code, wirisProperties, language) { - // Converting LaTeX to images. - - if (window._wrs_conf_parseModes !== undefined && wrs_arrayContains(_wrs_conf_parseModes, 'latex') != -1) { - var output = ''; - var endPosition = 0; - var startPosition = code.indexOf('$$'); - while (startPosition != -1) { - output += code.substring(endPosition, startPosition); - endPosition = code.indexOf('$$', startPosition + 2); - - if (endPosition != -1) { - // Before, it was a condition here to execute the next codelines 'latex.indexOf('<') == -1'. - // We don't know why it was used, but seems to have a conflict with latex formulas that contains '<'. - var latex = code.substring(startPosition + 2, endPosition); - latex = wrs_htmlentitiesDecode(latex); - var mathml = wrs_getMathMLFromLatex(latex, true); - output += mathml; - endPosition += 2; - } - else { - output += '$$'; - endPosition = startPosition + 2; - } - - startPosition = code.indexOf('$$', endPosition); - } - - output += code.substring(endPosition, code.length); - code = output; - } - - if (window._wrs_conf_defaultEditMode && _wrs_conf_defaultEditMode == 'iframes') { - // Converting iframes to images. - var output = ''; - var pattern = ' class="' + _wrs_conf_imageClassName + '"'; - var formulaPosition = code.indexOf(pattern); - var endPosition = 0; - - while (formulaPosition != -1) { - // Looking for the actual startPosition. - startPosition = formulaPosition; - var i = formulaPosition; - var startTagFound = false; - - while (i >= 0 && !startTagFound) { // Going backwards until the start tag '<' is found. - var character = code.charAt(i); - - if (character == '"' || character == '\'') { - var characterNextPosition = code.lastIndexOf(character, i); - i = (characterNextPosition == -1) ? -1 : characterNextPosition; - } - else if (character == '<') { - startPosition = i; - startTagFound = true; - } - else if (character == '>') { - i = -1; // Break: we are inside a text node. - } - - --i; - } - - // Appending the previous code. - output += code.substring(endPosition, startPosition); - - // Looking for the endPosition. - - if (startTagFound) { - i = formulaPosition; - var counter = 1; - - while (i < code.length && counter > 0) { - var character = code.charAt(i); - - if (character == '"' || character == '\'') { - var characterNextPosition = code.indexOf(character, i); - i = (characterNextPosition == -1) ? code.length : characterNextPosition; - } - else if (character == '<') { - if (i + 1 < code.length && code.charAt(i + 1) == '/') { - --counter; - - if (counter == 0) { - endPosition = code.indexOf('>', i) + 1; - - if (endPosition == -1) { - // End tag stripped. - counter = -1; // to be != 0 and to break the loop. - } - } - } - else { - ++counter; - } - } - else if (character == '>' && code.charAt(i - 1) == '/') { - --counter; - - if (counter == 0) { - endPosition = i + 1; - } - } - - ++i; - } - - if (counter == 0) { - var formulaTagCode = code.substring(startPosition, endPosition); - var formulaTagObject = wrs_createObject(formulaTagCode); - var mathml = formulaTagObject.getAttribute(_wrs_conf_imageMathmlAttribute); - - if (mathml == null) { - mathml = formulaTagObject.getAttribute('alt'); - } - - var imgObject = wrs_mathmlToImgObject(document, mathml, wirisProperties, language); - output += wrs_createObjectCode(imgObject); - } - else { - // Start tag found but no end tag found. No process is done. A character is appended to avoid infinite loop in the next search. - output += code.charAt(formulaPosition); - endPosition = formulaPosition + 1; - } - } - else { - // No start tag is found. No process is done. A character is appended to avoid infinite loop in the next search. - output += code.charAt(formulaPosition); - endPosition = formulaPosition + 1; - } - - formulaPosition = code.indexOf(pattern, endPosition); - } - - output += code.substring(endPosition, code.length); - code = output; - } - - return code; -} - -/** - * Parses end HTML code depending on the save mode. - * @param {string} code HTML code - * @return {string} - * @ignore - */ -function wrs_endParseSaveMode(code) { - var output = ''; - var convertToXml = false; - var convertToSafeXml = false; - - if (window._wrs_conf_saveMode) { - if (_wrs_conf_saveMode == 'safeXml') { - convertToXml = true; - convertToSafeXml = true; - code = wrs_codeImgTransform(code, 'img2mathml'); - } - else if (_wrs_conf_saveMode == 'xml') { - convertToXml = true; - code = wrs_codeImgTransform(code, 'img2mathml'); - } - else if (_wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'image') { - code = wrs_codeImgTransform(code, 'img264'); - } - } - - return code; -} - -/** - * Gets the formula mathml or CAS appletCode using its image hash code. - * @param {string} variableName Variable to send on POST query to the server. - * @param {string} imageHashCode image hash code. - * @return {string} Corresponding mathml code. - * @ignore - */ -function wrs_getCode(variableName, imageHashCode) { - var data = {}; - data[variableName] = imageHashCode; - return wrs_getContent(_wrs_conf_getmathmlPath, data); -} - -/** - * Gets the content from an URL. - * @param {string} url target URL. - * @param {object} postVariables post variables. Null if a GET query should be done. - * @return {string} content of the target URL. - * @ignore - */ -function wrs_getContent(url, postVariables) { - try { - var httpRequest = wrs_createHttpRequest(); - - if (httpRequest) { - if (typeof postVariables === undefined || typeof postVariables == 'undefined') { - httpRequest.open('GET', url, false); - } - else if (url.substr(0, 1) == '/' || url.substr(0, 7) == 'http://' || url.substr(0, 8) == 'https://') { - httpRequest.open('POST', url, false); - } - else { - httpRequest.open('POST', _wrs_currentPath + url, false); - } - - if (postVariables !== undefined) { - httpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8'); - httpRequest.send(wrs_httpBuildQuery(postVariables)); - } - else { - httpRequest.send(null); - } - - return httpRequest.responseText; - } - - alert(_wrs_stringManager.getString('browser_no_compatible')); - } - catch (e) { - } - - return ''; -} - -/** - * Generates the innerHTML of an element. - * @param {object} element target element. - * @return {string} innertHTML of the target element. - * @ignore - */ -function wrs_getInnerHTML(element) { - var innerHTML = ''; - - for (var i = 0; i < element.childNodes.length; ++i) { - innerHTML += wrs_createObjectCode(element.childNodes[i]); - } - - return innerHTML; -} - -/** - * Converts MathML to LaTeX. - * @param {string} mathml MathML String - * @return {string} MathML corresponding LaTeX. - * @ignore - */ -function wrs_getLatexFromMathML(mathml) { - var data = { - 'service': 'mathml2latex', - 'mml': mathml - }; - - var jsonResponse = JSON.parse(wrs_getContent(_wrs_conf_servicePath, data)); - - var latex; - - if (jsonResponse.status == "ok") { - latex = jsonResponse.result.text; - } - - return latex; -} - -/** - * Extracts the latex of a determined position in a text. - * @param {string} textNode test to extract LaTeX - * @param {int} caretPosition starting position to find LaTeX. - * @param {object} latexTags optional parameter representing tags between latex is inserted. It has the 'open' attribute for the open tag and the 'close' attribute for the close tag. - * @return {object} An object with 3 keys: 'latex', 'start' and 'end'. Null if latex is not found. - * @ignore - */ -function wrs_getLatexFromTextNode(textNode, caretPosition, latexTags) { - // latexTags is an optional parameter. If is not set, use default latexTags. - if (typeof latexTags == 'undefined' || latexTags == null) { - latexTags = _wrs_latexTags; - } - // Looking for the first textNode. - var startNode = textNode; - - while (startNode.previousSibling && startNode.previousSibling.nodeType == 3) { // TEXT_NODE. - startNode = startNode.previousSibling; - } - - // Finding latex. - - /** - * It gets the next latex position and node from a specific node and position. - * @param {Object} currentNode node where searching latex. - * @param {number} currentPosition current position inside the currentNode. - * @param {Object} latexTagsToUse tags used at latex beggining and latex final. - * @param {boolean} searchEndTag If true, the first tag to search is an end tag. Otherwise, it searches the open tag first. - */ - function getNextLatexPosition(currentNode, currentPosition, latexTagsToUse, searchEndTag) { - var latexTags = latexTagsToUse; - if (searchEndTag) { - latexTags = { - 'open': latexTagsToUse.close, - 'close': latexTagsToUse.open - }; - } - - var position = currentNode.nodeValue.indexOf(latexTags.open, currentPosition); - - while (position == -1) { - currentNode = currentNode.nextSibling; - - if (!currentNode) { // TEXT_NODE. - return null; // Not found. - } - - position = currentNode.nodeValue ? currentNode.nodeValue.indexOf(latexTags.close) : -1; - } - - return { - 'node': currentNode, - 'position': position - }; - } - - function isPrevious(node, position, endNode, endPosition) { - if (node == endNode) { - return (position <= endPosition); - } - - while (node && node != endNode) { - node = node.nextSibling; - } - - return (node == endNode); - } - - var start; - var end = { - 'node': startNode, - 'position': 0 - }; - var searchEndTag = false; - // Is supposed that open and close tags has the same length. - var tagLength = latexTags.open.length; - do { - var start = getNextLatexPosition(end.node, end.position, latexTags, searchEndTag); - - if (start == null || isPrevious(textNode, caretPosition, start.node, start.position)) { - return null; - } - - var end = getNextLatexPosition(start.node, start.position + tagLength, latexTags, !searchEndTag); - - if (end == null) { - return null; - } - - end.position += tagLength; - // For the next iteration, the start position to search corresponds to the opposite tag. - searchEndTag = !searchEndTag; - } while (isPrevious(end.node, end.position, textNode, caretPosition)); - - // Isolating latex. - var latex; - - if (start.node == end.node) { - latex = start.node.nodeValue.substring(start.position + tagLength, end.position - tagLength); - } - else { - latex = start.node.nodeValue.substring(start.position + tagLength, start.node.nodeValue.length); - var currentNode = start.node; - - do { - currentNode = currentNode.nextSibling; - - if (currentNode == end.node) { - latex += end.node.nodeValue.substring(0, end.position - tagLength); - } - else { - latex += currentNode.nodeValue ? currentNode.nodeValue : ''; - } - } while (currentNode != end.node); - } - - return { - 'latex': latex, - 'startNode': start.node, - 'startPosition': start.position, - 'endNode': end.node, - 'endPosition': end.position - }; -} - -/** - * Converts LaTeX to MathML. - * @param {string} latex String - * @param {bool} includeLatexOnSemantics If true LaTeX would me included into MathML semantics. - * @return {string} converted mathML - * @ignore - */ -function wrs_getMathMLFromLatex(latex, includeLatexOnSemantics) { - if (_wrs_int_LatexCache.hasOwnProperty(latex)) { - return _wrs_int_LatexCache[latex]; - } - var data = { - 'service': 'latex2mathml', - 'latex': latex - }; - - if (includeLatexOnSemantics) { - data['saveLatex'] = ''; - } - - var jsonResponse = JSON.parse(wrs_getContent(_wrs_conf_servicePath, data)); - - var output; - if (jsonResponse.status == "ok") { - var output = jsonResponse.result.text; - output = output.split("\r").join('').split("\n").join(' '); - // Populate LatexCache. - wrs_populateLatexCache(latex, output); - } else { - output = "$$" + latex + "$$"; - } - - return output; -} - -/** - * Gets the node length in characters. - * @param {object} node HTML node. - * @return {int} node length - * @ignore - */ -function wrs_getNodeLength(node) { - if (node.nodeType == 3) { // TEXT_NODE. - return node.nodeValue.length; - } - - if (node.nodeType == 1) { // ELEMENT_NODE. - var length = _wrs_staticNodeLengths[node.nodeName.toUpperCase()]; - - if (length === undefined) { - length = 0; - } - - for (var i = 0; i < node.childNodes.length; ++i) { - length += wrs_getNodeLength(node.childNodes[i]); - } - - return length; - } - - return 0; -} - -/** - * Parses the query string and returns it as a Hash table. - * @param {object} windowObject a window object with a query string. - * @return {object} a hash table containing the query string. - * @ignore - */ -function wrs_getQueryParams(windowObject) { - var data = {}; - var start = windowObject.location.search.indexOf('?'); - start = (start == -1) ? 0 : start + 1; - var queryStringParts = windowObject.location.search.substr(start).split('&'); - - for (var i = 0; i < queryStringParts.length; ++i) { - var paramParts = queryStringParts[i].split('=', 2); - data[paramParts[0]] = wrs_urldecode(paramParts[1]); - } - - return data; -} - -/** - * Gets the selected node or text. - * If the caret is on a text node, concatenates it with all the previous and next text nodes. - * @param {object} target The editable element - * @param {boolean} isIframe Specifies if the target is an iframe or not - * @param {forceGetSelection} If true, ignores IE system to get the current selection and uses window.getSelection() - * @return {object} An object with the 'node' key setted if the item is an element or the keys 'node' and 'caretPosition' if the element is text - * @ignore - */ -function wrs_getSelectedItem(target, isIframe, forceGetSelection) { - var windowTarget; - - if (isIframe) { - windowTarget = target.contentWindow; - windowTarget.focus(); - } - else { - windowTarget = window; - target.focus(); - } - - if (document.selection && !forceGetSelection) { - var range = windowTarget.document.selection.createRange(); - - if (range.parentElement) { - if (range.htmlText.length > 0) { - if (range.text.length == 0) { - return wrs_getSelectedItem(target, isIframe, true); - } - - return null; - } - - windowTarget.document.execCommand('InsertImage', false, '#'); - var temporalObject = range.parentElement(); - - if (temporalObject.nodeName.toUpperCase() != 'IMG') { - // IE9 fix: parentElement() does not return the IMG node, returns the parent DIV node. In IE < 9, pasteHTML does not work well. - range.pasteHTML(''); - temporalObject = windowTarget.document.getElementById('wrs_openEditorWindow_temporalObject'); - } - - var node; - var caretPosition; - - if (temporalObject.nextSibling && temporalObject.nextSibling.nodeType == 3) { // TEXT_NODE. - node = temporalObject.nextSibling; - caretPosition = 0; - } - else if (temporalObject.previousSibling && temporalObject.previousSibling.nodeType == 3) { // TEXT_NODE. - node = temporalObject.previousSibling; - caretPosition = node.nodeValue.length; - } - else { - node = windowTarget.document.createTextNode(''); - temporalObject.parentNode.insertBefore(node, temporalObject); - caretPosition = 0; - } - - temporalObject.parentNode.removeChild(temporalObject); - - return { - 'node': node, - 'caretPosition': caretPosition - }; - } - - if (range.length > 1) { - return null; - } - - return { - 'node': range.item(0) - }; - } - - if (windowTarget.getSelection) { - var selection = windowTarget.getSelection(); - - try { - var range = selection.getRangeAt(0); - } - catch (e) { - var range = windowTarget.document.createRange(); - } - - var node = range.startContainer; - - if (node.nodeType == 3) { // TEXT_NODE. - return { - 'node': node, - 'caretPosition': range.startOffset - }; - } - - if (node != range.endContainer) { - return null; - } - - if (node.nodeType == 1) { // ELEMENT_NODE. - var position = range.startOffset; - - if (node.childNodes[position]) { - return { - 'node': node.childNodes[position] - }; - } - } - } - - return null; -} - -/** - * Returns null if there isn't any item or if it is malformed. - * Otherwise returns a div DOM node containing the mathml image and the cursor position inside the textarea. - * @param {Object} textarea DOM Element. - * @ignore - */ -function wrs_getSelectedItemOnTextarea(textarea) { - var textNode = document.createTextNode(textarea.value); - var textNodeWithLatex = wrs_getLatexFromTextNode(textNode, textarea.selectionStart); - if (textNodeWithLatex == null) { - return null - }; - - // Try to get latex mathml from cache - var latex = textNodeWithLatex.latex; - var mathml = _wrs_int_LatexCache[latex]; - // If the formula was written and not generated by the editor, caches won't have the data. - if (typeof mathml == 'undefined') { - mathml = wrs_getMathMLFromLatex(latex); - } - - var mathmlWithoutSemantics = wrs_removeSemanticsMathml(mathml); - var img = wrs_parseMathmlToImg(mathmlWithoutSemantics, _wrs_xmlCharacters, _wrs_int_langCode); - var div = document.createElement('div'); - div.innerHTML = img; - - return { - 'node': div.firstChild, - 'startPosition': textNodeWithLatex.startPosition, - 'endPosition': textNodeWithLatex.endPosition - }; -} - -/** - * Converts the HTML of a image into the output code that WIRIS must return. - * By default returns the mathml stored on data-mahml attribute (if imgCode is a formula) - * or the Wiriscas attribute of a WIRIS applet. - * @param {string} imgCode the html code from a formula or a CAS image. - * @param {bool} convertToXml True if the image should be converted to xml. - * @param {bool} convertToSafeXml True if the image should be conerte to safeXmll - * @return {string} the Xml or safeXml of a WIRIS image. - * @ignore - */ -function wrs_getWIRISImageOutput(imgCode, convertToXml, convertToSafeXml) { - var imgObject = wrs_createObject(imgCode); - - if (imgObject) { - if (imgObject.className == _wrs_conf_imageClassName || imgObject.getAttribute(_wrs_conf_imageMathmlAttribute)) { - if (!convertToXml) { - return imgCode; - } - - var xmlCode = imgObject.getAttribute(_wrs_conf_imageMathmlAttribute); - - if (xmlCode == null) { - xmlCode = imgObject.getAttribute('alt'); - } - - if (!convertToSafeXml) { - xmlCode = wrs_mathmlDecode(xmlCode); - } - - return xmlCode; - } - else if (imgObject.className == _wrs_conf_CASClassName) { - var appletCode = imgObject.getAttribute(_wrs_conf_CASMathmlAttribute); - appletCode = wrs_mathmlDecode(appletCode); - var appletObject = wrs_createObject(appletCode); - appletObject.setAttribute('src', imgObject.src); - var object = appletObject; - var appletCodeToBeInserted = wrs_createObjectCode(appletObject); - - if (convertToSafeXml) { - appletCodeToBeInserted = wrs_mathmlEncode(appletCodeToBeInserted); - } - - return appletCodeToBeInserted; - } - } - - return imgCode; -} - -/** - * Parses a text and replaces all HTML special characters by their entities. - * @param {string} input Text to be paresed. - * @return {string} the input text with all their special characters replaced by their entities. - * @ignore - */ -function wrs_htmlentities(input) { - return input.split('&').join('&').split('<').join('<').split('>').join('>').split('"').join('"'); -} - -/** - * Parses a text and replaces all the HTML entities by their characters. - * @param {string} input Text to be parsed - * @return {string} The input text with all their entities replaced by characters. - * @ignore - */ -function wrs_htmlentitiesDecode(input) { - return input.split('"').join('"').split('>').join('>').split('<').join('<').split('&').join('&'); -} - -/** - * Converts a hash to a HTTP query. - * @param {hash} properties A key-value Hash - * @return {string} A HTTP query containing all the key value pairs with all the shpecial characters replaced by their entities. - * @ignore - */ -function wrs_httpBuildQuery(properties) { - var result = ''; - - for (var i in properties) { - if (properties[i] != null) { - result += wrs_urlencode(i) + '=' + wrs_urlencode(properties[i]) + '&'; - } - } - - // Deleting last '&' empty character. - if (result.substring(result.length - 1) == '&') { - result = result.substring(0, result.length - 1); - } - - return result; -} - -/** - * Parses initial HTML code. If the HTML contains data generated by WIRIS, this data would be converted as following: - *
- * MathML code: Image containing the corresponding MathML formulas.
- * MathML code with LaTeX annotation : LaTeX.
- * 
- * @param {string} code HTML code with data generated by MathType. - * @param {string} language Language for the formula. - * @return {string} HTML code with the WIRIS data converted into LaTeX and images. - */ -function wrs_initParse(code, language) { - /* Note: The code inside this function has been inverted. - If you invert again the code then you cannot use correctly LaTeX - in Moodle. - */ - wrs_initSetSize(); - code = wrs_initParseSaveMode(code, language); - return wrs_initParseEditMode(code); -} - -/** - * Parses initial HTML code into iframes. - * @param {object} windowTarget Target object window. - * @ignore - */ -function wrs_initParseImgToIframes(windowTarget) { - if (window._wrs_conf_defaultEditMode && _wrs_conf_defaultEditMode == 'iframes') { - var imgList = windowTarget.document.getElementsByTagName('img'); - var i = 0; - - while (i < imgList.length) { - if (imgList[i].className == _wrs_conf_imageClassName) { - var mathml = imgList[i].getAttribute(_wrs_conf_imageMathmlAttribute); - - if (mathml == null) { - mathml = imgList[i].getAttribute('alt'); - } - - var iframe = wrs_mathmlToIframeObject(windowTarget, wrs_mathmlDecode(mathml)); - imgList[i].parentNode.replaceChild(iframe, imgList[i]); - } - else { - ++i; - } - } - } -} - -/** - * Parses initial HTML code depending on the edit mode. - * @param {string} code HTML code. - * @return {string} parsed HTML code. - * @ignore - */ -function wrs_initParseEditMode(code) { - if (window._wrs_conf_parseModes !== undefined && wrs_arrayContains(_wrs_conf_parseModes, 'latex') != -1) { - var imgList = wrs_getElementsByNameFromString(code, 'img', true); - var token = 'encoding="LaTeX">'; - var carry = 0; // While replacing images with latex, the indexes of the found images changes respecting the original code, so this carry is needed. - - for (var i = 0; i < imgList.length; ++i) { - var imgCode = code.substring(imgList[i].start + carry, imgList[i].end + carry); - - if (imgCode.indexOf(' class="' + _wrs_conf_imageClassName + '"') != -1) { - var mathmlStartToken = ' ' + _wrs_conf_imageMathmlAttribute + '="'; - var mathmlStart = imgCode.indexOf(mathmlStartToken); - - if (mathmlStart == -1) { - mathmlStartToken = ' alt="'; - mathmlStart = imgCode.indexOf(mathmlStartToken); - } - - if (mathmlStart != -1) { - mathmlStart += mathmlStartToken.length; - var mathmlEnd = imgCode.indexOf('"', mathmlStart); - var mathml = wrs_mathmlDecode(imgCode.substring(mathmlStart, mathmlEnd)); - var latexStartPosition = mathml.indexOf(token); - - if (latexStartPosition != -1) { - latexStartPosition += token.length; - var latexEndPosition = mathml.indexOf('
', latexStartPosition); - var latex = mathml.substring(latexStartPosition, latexEndPosition); - - var replaceText = '$$' + wrs_htmlentitiesDecode(latex) + '$$'; - code = code.substring(0, imgList[i].start + carry) + replaceText + code.substring(imgList[i].end + carry); - carry += replaceText.length - (imgList[i].end - imgList[i].start); - } - } - } - } - } - - return code; -} - -/** - * Parses initial HTML code depending on the save mode. - * @param {string} code HTML code to be parsed - * @param {string} language Language for the formula. - * @return {string} HTML code parsed. - * @ignore - */ -function wrs_initParseSaveMode(code, language) { - if (window._wrs_conf_saveMode) { - - if (_wrs_parseXml) { - // Converting XML to tags. - code = wrs_parseMathmlToLatex(code, _wrs_safeXmlCharacters); - code = wrs_parseMathmlToLatex(code, _wrs_xmlCharacters); - // Safe XML and XML must be parsed regardeless of save mode. - // Order is important here, safeXml must be parsed first in order to avoid conflicts with data-mathml img attribute. - code = wrs_parseSafeAppletsToObjects(code); - code = wrs_parseMathmlToImg(code, _wrs_safeXmlCharacters, language); - code = wrs_parseMathmlToImg(code, _wrs_xmlCharacters, language); - } - - if (_wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'image') { - code = wrs_codeImgTransform(code, 'base642showimage'); - } - } - - var appletList = wrs_getElementsByNameFromString(code, 'applet', false); - var carry = 0; // While replacing applets with images, the indexes of the found applets changes respecting the original code, so this carry is needed. - - for (var i = 0; i < appletList.length; ++i) { - var appletCode = code.substring(appletList[i].start + carry, appletList[i].end + carry); - - // The second control in the if is used to find WIRIS applet which don't have Wiriscas class (as it was in old CAS applets). - if (appletCode.indexOf(' class="' + _wrs_conf_CASClassName + '"') != -1 || appletCode.toUpperCase().indexOf('WIRIS') != -1) { - if (appletCode.indexOf(' src="') != -1){ - var srcStart = appletCode.indexOf(' src="') + ' src="'.length; - var srcEnd = appletCode.indexOf('"', srcStart); - var src = appletCode.substring(srcStart, srcEnd); - } else{ - // This should happen only with old CAS imported from Moodle 1 to Moodle 2. - if (typeof(_wrs_conf_pluginBasePath) != 'undefined'){ - var src = _wrs_conf_pluginBasePath + '/integration/showcasimage.php?formula=noimage'; - } else { - var src = ''; - } - if (appletCode.indexOf(' class="' + _wrs_conf_CASClassName + '"') == -1){ - var closeSymbol = appletCode.indexOf('>'); - var appletTag = appletCode.substring(0, closeSymbol); - var newAppletTag = appletTag.split(' width=').join(' class="Wiriscas" width='); - appletCode = appletCode.split(appletTag).join(newAppletTag); - appletCode = appletCode.split('\'').join('"'); - } - } - - // Double click to edit has been removed here. - var imgCode = ''; - - code = code.substring(0, appletList[i].start + carry) + imgCode + code.substring(appletList[i].end + carry); - carry += imgCode.length - (appletList[i].end - appletList[i].start); - } - } - - return code; -} - -/** - * Looks for elements that match the given name in a HTML code string. - * Important: this function is very concrete for WIRIS code. It takes as preconditions lots of behaviors that are not the general case. - * - * @param {string} code HTML code - * @param {string} name Element names - * @param {boolean} autoClosed True if the elements are autoClosed. - * @return {array} An array containing all HTML elements of code matching the name argument. - * @ignore - */ -function wrs_getElementsByNameFromString(code, name, autoClosed) { - var elements = []; - var code = code.toLowerCase(); - name = name.toLowerCase(); - var start = code.indexOf('<' + name + ' '); - - while (start != -1) { // Look for nodes. - var endString; - - if (autoClosed) { - endString = '>'; - } - else { - endString = ''; - } - - var end = code.indexOf(endString, start); - - if (end != -1) { - end += endString.length; - - elements.push({ - 'start': start, - 'end': end - }); - } - else { - end = start + 1; - } - - start = code.indexOf('<' + name + ' ', end); - } - - return elements; -} - -/** - * Replaces a selection with an element. - * @param {object} element Element - * @param {object} focusElement Element to be focused - * @param {object} windowTarget Target - * @ignore - */ -function wrs_insertElementOnSelection(element, focusElement, windowTarget) { - if(typeof focusElement.frameElement !== 'undefined'){ - function get_browser(){ - var ua = navigator.userAgent; - if(ua.search("Edge/") >= 0){ - return "EDGE"; - }else if(ua.search("Chrome/") >= 0){ - return "CHROME"; - }else if(ua.search("Trident/") >= 0){ - return "IE"; - }else if(ua.search("Firefox/") >= 0){ - return "FIREFOX"; - }else if(ua.search("Safari/") >= 0){ - return "SAFARI"; - } - } - var browserName = get_browser(); - // Iexplorer, Edge and Safari can't focus into iframe - if (browserName == 'SAFARI' || browserName == 'IE' || browserName == 'EDGE') { - focusElement.focus(); - }else{ - focusElement.frameElement.focus(); - } - }else{ - focusElement.focus(); - } - - if (_wrs_isNewElement) { - if (focusElement.type == "textarea") { - wrs_updateTextarea(focusElement, element.textContent); - } - else if (document.selection && document.getSelection == 0) { - var range = windowTarget.document.selection.createRange(); - windowTarget.document.execCommand('InsertImage', false, element.src); - - if (!('parentElement' in range)) { - windowTarget.document.execCommand('delete', false); - range = windowTarget.document.selection.createRange(); - windowTarget.document.execCommand('InsertImage', false, element.src); - } - - if ('parentElement' in range) { - var temporalObject = range.parentElement(); - - if (temporalObject.nodeName.toUpperCase() == 'IMG') { - temporalObject.parentNode.replaceChild(element, temporalObject); - } - else { - // IE9 fix: parentNode() does not return the IMG node, returns the parent DIV node. In IE < 9, pasteHTML does not work well. - range.pasteHTML(wrs_createObjectCode(element)); - } - } - } - else { - var selection = windowTarget.getSelection(); - // We have use wrs_range beacuse IExplorer delete selection when select another part of text. - if (_wrs_range) { - var range = _wrs_range; - _wrs_range = null; - } - else { - - try { - var range = selection.getRangeAt(0); - } - catch (e) { - var range = windowTarget.document.createRange(); - } - } - selection.removeAllRanges(); - - range.deleteContents(); - - var node = range.startContainer; - var position = range.startOffset; - - if (node.nodeType == 3) { // TEXT_NODE. - node = node.splitText(position); - node.parentNode.insertBefore(element, node); - node = node.parentNode; - } - else if (node.nodeType == 1) { // ELEMENT_NODE. - node.insertBefore(element, node.childNodes[position]); - } - // Fix to set the caret after the inserted image. - range.selectNode(element); - // Integration function. - // If wrs_int_setCaretPosition function exists on - // integration script can call caret method from the editor instance. - // With this method we can call proper specific editor methods which in some scenarios - // help's MathType to set caret position properly on the current editor window. - if (typeof wrs_int_selectRange != 'undefined') { - wrs_int_selectRange(range); - } - // Selection collapse must have to do it after the function 'wrs_int_selectRange' because - // can be that the range was changed and the selection needs to be updated. - position = range.endOffset; - selection.collapse(node, position); - } - } - else if (_wrs_temporalRange) { - if (document.selection && document.getSelection == 0) { - _wrs_isNewElement = true; - _wrs_temporalRange.select(); - wrs_insertElementOnSelection(element, focusElement, windowTarget); - } - else { - var parentNode = _wrs_temporalRange.startContainer; - _wrs_temporalRange.deleteContents(); - _wrs_temporalRange.insertNode(element); - } - } - else if (focusElement.type == "textarea") { - var item; - // Wrapper for some integrations that can have special behaviours to show latex. - if (typeof wrs_int_getSelectedItem != 'undefined') { - item = wrs_int_getSelectedItem(focusElement, false); - } - else { - item = wrs_getSelectedItemOnTextarea(focusElement); - } - wrs_updateExistingFormulaOnTextarea(focusElement, element.textContent, item.startPosition, item.endPosition); - } - else { - if (!element) { // Editor empty, formula has been erased on edit. - _wrs_temporalImage.parentNode.removeChild(_wrs_temporalImage); - } - _wrs_temporalImage.parentNode.replaceChild(element, _wrs_temporalImage); - } - function placeCaretAfterNode(node) { - if (typeof window.getSelection != "undefined") { - var range = windowTarget.document.createRange(); - range.setStartAfter(node); - range.collapse(true); - var selection = windowTarget.getSelection(); - selection.removeAllRanges(); - selection.addRange(range); - } - }; - placeCaretAfterNode(element); -} - -/** - * Checks if the mathml at position i is inside an HTML attribute or not. - * @param {string} content A string containing MathML code. - * @param {string} i Search index. - * @return {bool} True if is inside an HTML attribute. In other case, false. - * @ignore - */ -function wrs_isMathmlInAttribute(content, i) { - // Regex = '^[\'"][\\s]*=[\\s]*[\\w-]+([\\s]*("[^"]*"|\'[^\']*\')[\\s]*=[\\s]*[\\w-]+[\\s]*)*[\\s]+gmi<'; - var math_att = '[\'"][\\s]*=[\\s]*[\\w-]+'; // "=att OR '=att - var att_content = '"[^"]*"|\'[^\']*\''; // "blabla" OR 'blabla' - var att = '[\\s]*(' + att_content + ')[\\s]*=[\\s]*[\\w-]+[\\s]*'; // "blabla"=att OR 'blabla'=att - var atts = '(' + att + ')*'; // "blabla"=att1 "blabla"=att2 - var regex = '^' + math_att + atts + '[\\s]+gmi<'; // "=att "blabla"=att1 "blabla"=att2 gmi< . - var expression = new RegExp(regex); - - var actual_content = content.substring(0, i); - var reversed = actual_content.split('').reverse().join(''); - var exists = expression.test(reversed); - - return exists; -} - -/** - * WIRIS special encoding. - * We use these entities because IE doesn't support html entities on its attributes sometimes. Yes, sometimes. - * @param {string} input String to be decoded. - * @return {string} Decoded string. - * @ignore - */ -function wrs_mathmlDecode(input) { - // Decoding entities. - input = input.split(_wrs_safeXmlCharactersEntities.tagOpener).join(_wrs_safeXmlCharacters.tagOpener); - input = input.split(_wrs_safeXmlCharactersEntities.tagCloser).join(_wrs_safeXmlCharacters.tagCloser); - input = input.split(_wrs_safeXmlCharactersEntities.doubleQuote).join(_wrs_safeXmlCharacters.doubleQuote); - // Added to fix problem due to import from 1.9.x. - input = input.split(_wrs_safeXmlCharactersEntities.realDoubleQuote).join(_wrs_safeXmlCharacters.realDoubleQuote); - - // Blackboard. - if ('_wrs_blackboard' in window && window._wrs_blackboard){ - input = input.split(_wrs_safeBadBlackboardCharacters.ltElement).join(_wrs_safeGoodBlackboardCharacters.ltElement); - input = input.split(_wrs_safeBadBlackboardCharacters.gtElement).join(_wrs_safeGoodBlackboardCharacters.gtElement); - input = input.split(_wrs_safeBadBlackboardCharacters.ampElement).join(_wrs_safeGoodBlackboardCharacters.ampElement); - - /*var regex = /«mtext».*[<>&].*«\/mtext»/; - - var result = regex.exec(input); - while(result){ - var changedResult = result[0].split(_wrs_xmlCharacters.tagOpener).join('§lt;'); - changedResult = changedResult.split(_wrs_xmlCharacters.tagCloser).join('§gt;'); - changedResult = changedResult.split(_wrs_xmlCharacters.ampersand).join('§amp;'); - input = input.replace(result, changedResult); - result = regex.exec(input); - }*/ - } - - // Decoding characters. - input = input.split(_wrs_safeXmlCharacters.tagOpener).join(_wrs_xmlCharacters.tagOpener); - input = input.split(_wrs_safeXmlCharacters.tagCloser).join(_wrs_xmlCharacters.tagCloser); - input = input.split(_wrs_safeXmlCharacters.doubleQuote).join(_wrs_xmlCharacters.doubleQuote); - input = input.split(_wrs_safeXmlCharacters.ampersand).join(_wrs_xmlCharacters.ampersand); - input = input.split(_wrs_safeXmlCharacters.quote).join(_wrs_xmlCharacters.quote); - - // We are replacing $ by & when its part of an entity for retrocompatibility. Now, the standard is replace § by &. - var returnValue = ''; - var currentEntity = null; - - for (var i = 0; i < input.length; ++i) { - var character = input.charAt(i); - - if (currentEntity == null) { - if (character == '$') { - currentEntity = ''; - } - else { - returnValue += character; - } - } - else { - if (character == ';') { - returnValue += '&' + currentEntity + ';'; - currentEntity = null; - } - else if (character.match(/([a-zA-Z0-9#._-] | '-')/)) { // Character is part of an entity. - currentEntity += character; - } - else { - returnValue += '$' + currentEntity; // Is not an entity. - currentEntity = null; - --i; // Parse again the current character. - } - } - } - - return returnValue; -} - -/** - * WIRIS special encoding. - * We use these entities because IE doesn't support html entities on its attributes sometimes. Yes, sometimes. - * @param {string} input to be encoded - * @return {string} Encoded string. - * @ignore - */ -function wrs_mathmlEncode(input) { - input = input.split(_wrs_xmlCharacters.tagOpener).join(_wrs_safeXmlCharacters.tagOpener); - input = input.split(_wrs_xmlCharacters.tagCloser).join(_wrs_safeXmlCharacters.tagCloser); - input = input.split(_wrs_xmlCharacters.doubleQuote).join(_wrs_safeXmlCharacters.doubleQuote); - input = input.split(_wrs_xmlCharacters.ampersand).join(_wrs_safeXmlCharacters.ampersand); - input = input.split(_wrs_xmlCharacters.quote).join(_wrs_safeXmlCharacters.quote); - - return input; -} - -/** - * Converts special symbols (> 128) to entities and replaces all textual entities by its number entities. - * @param {string} mathml MathML string containing - or not - special symbols - * @return {string} MathML with all textual entities replaced. - * @ignore - */ -function wrs_mathmlEntities(mathml) { - var toReturn = ''; - - for (var i = 0; i < mathml.length; ++i) { - - var character = mathml.charAt(i); - - // Parsing > 128 characters. - if (mathml.codePointAt(i) > 128) { - toReturn += '&#' + mathml.codePointAt(i) + ';' - // For UTF-32 characters we need to move the index one position. - if (mathml.codePointAt(i) > 0xffff) { - i++; - } - } - else if (character == '&') { - var end = mathml.indexOf(';', i + 1); - - if (end >= 0) { - var container = document.createElement('span'); - container.innerHTML = mathml.substring(i, end + 1); - toReturn += '&#' + wrs_fixedCharCodeAt((container.innerText || container.textContent),0) + ';'; - i = end; - } - else { - toReturn += character; - } - } - else { - toReturn += character; - } - } - - return toReturn; -} - -/** - * Add wrs::type attribute to mathml if the mathml has been created with a custom editor - * for example, chemistry. - * @param {string} mathml a MathML string created with a custom editor, like chemistry. - * @return {string} The MathML string with his class containgin the editor toolbar string. - * @ignore - */ -function wrs_mathmlAddEditorAttribute(mathml) { - var toReturn = ''; - - var start = mathml.indexOf(''); - if (mathml.indexOf("class") == -1 ) { - // Adding custom editor type. - toReturn = mathml.substr(start, end) + ' class="wrs_' + wrs_int_getCustomEditorEnabled().toolbar + '">'; - toReturn += mathml.substr(end + 1, mathml.length); - return toReturn; - } - } - return mathml; - -} - -/** - * Fix charCodeAt() javascript function to handle non-Basic-Multilingual-Plane characters. - * @param {string} str String - * @param {int} idx An integer greater than or equal to 0 and less than the length of the string - * @return {int} An integer representing the UTF-16 code of the string at the given index. - * @ignore - */ - -function wrs_fixedCharCodeAt(str, idx) { - idx = idx || 0; - var code = str.charCodeAt(idx); - var hi, low; - - /* High surrogate (could change last hex to 0xDB7F to treat high - private surrogates as single characters) */ - - if (0xD800 <= code && code <= 0xDBFF) { - hi = code; - low = str.charCodeAt(idx + 1); - if (isNaN(low)) { - throw _wrs_stringManager.getString('exception_high_surrogate'); - } - return ((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000; - } - - if (0xDC00 <= code && code <= 0xDFFF) { // Low surrogate. - /* We return false to allow loops to skip this iteration since should have - already handled high surrogate above in the previous iteration. */ - return false; - } - return code; -} - -/** - * Gets the accessible text of a given MathML calling mathml2accesible service. - * @param {string} mathml MathML to get the accesibility. - * @param {string} language Language of the accesibility. - * @return {string} Accessibility from mathml string on language string. - * @ignore - */ -function wrs_mathmlToAccessible(mathml, language, data) { - var accessibleText; - - if (_wrs_int_AccessibleCache.hasOwnProperty(mathml)) { - accessibleText = _wrs_int_AccessibleCache[mathml]; - } - else { - data['service'] = 'mathml2accessible'; - data['lang'] = _wrs_int_langCode; - var accesibleJsonResponse = JSON.parse(wrs_getContent(_wrs_conf_servicePath, data)); - if (accesibleJsonResponse.status != 'error') { - accessibleText = accesibleJsonResponse.result.text; - } - else { - accessibleText = _wrs_stringManager.getString('error_convert_accessibility'); - } - } - - return accessibleText; - -} - -/** - * Converts mathml to an iframe object. - * @param {object} windowTarget Window object. - * @param {string} mathml MathML to be converted. - * @return {object} iframe object containging parsed mathml. - * @ignore - */ -function wrs_mathmlToIframeObject(windowTarget, mathml) { - if (window.navigator.userAgent.toLowerCase().indexOf('webkit') != -1) { - // In WebKit, the formula is represented by a div instead of an iframe. - var container = windowTarget.document.createElement('span'); - container.className = _wrs_conf_imageClassName; - container.setAttribute(_wrs_conf_imageMathmlAttribute, mathml); - container.setAttribute('height', '1'); - container.setAttribute('width', '1'); - container.style.display = 'inline-block'; - container.style.cursor = 'pointer'; - container.style.webkitUserModify = 'read-only'; - container.style.webkitUserSelect = 'all'; - - var formulaContainer = windowTarget.document.createElement('span'); - formulaContainer.style.display = 'inline'; - container.appendChild(formulaContainer); - - function waitForViewer() { - if (windowTarget.com && windowTarget.com.wiris) { - if (!('_wrs_viewer' in windowTarget)) { - windowTarget._wrs_viewer = new windowTarget.com.wiris.jsEditor.JsViewerMain(_wrs_conf_pluginBasePath + '/integration/editor'); - windowTarget._wrs_viewer.insertCSS(null, windowTarget.document); - } - - windowTarget._wrs_viewer.paintFormulaOnContainer(mathml, formulaContainer, null); - - function prepareDiv() { - if (windowTarget._wrs_viewer.isReady()) { - container.style.height = formulaContainer.style.height; - container.style.width = formulaContainer.style.width; - container.style.verticalAlign = formulaContainer.style.verticalAlign; - } - else { - setTimeout(prepareDiv, 100); - } - }; - - prepareDiv(); - } - else { - setTimeout(waitForViewer, 100); - } - } - - if (!('_wrs_viewerAppended' in windowTarget)) { - var viewerScript = windowTarget.document.createElement('script'); - viewerScript.src = _wrs_conf_pluginBasePath + '/integration/editor/viewer.js'; - windowTarget.document.getElementsByTagName('head')[0].appendChild(viewerScript); - windowTarget._wrs_viewerAppended = true; - } - - waitForViewer(); - - return container; - } - - windowTarget.document.wrs_assignIframeEvents = function (myIframe) { - wrs_addEvent(myIframe.contentWindow.document, 'click', function () { - wrs_fireEvent(myIframe, 'dblclick'); - }); - }; - - var iframe = windowTarget.document.createElement('iframe'); - iframe.className = _wrs_conf_imageClassName; - iframe.setAttribute(_wrs_conf_imageMathmlAttribute, mathml); - iframe.style.display = 'inline'; - iframe.style.border = 'none'; - iframe.setAttribute('height', '1'); - iframe.setAttribute('width', '1'); - iframe.setAttribute('scrolling', 'no'); - iframe.setAttribute('frameBorder', '0'); - iframe.src = _wrs_conf_pluginBasePath + '/core/iframe.html#' + _wrs_conf_imageMathmlAttribute; - return iframe; -} - -/** - * Converts mathml to img object. - * @param {object} creator Object with the "createElement" method - * @param {string} mathml MathML code - * @param {object} wirisProperties object containing WIRIS custom properties - * @param {language} language Custom language for accesibility. - * @return {object} And image containing the formula image corresponding to mathml string. - * @ignore - */ -function wrs_mathmlToImgObject(creator, mathml, wirisProperties, language) { - var width; - var height; - var baseline; - var imgObject = creator.createElement('img'); - imgObject.align = 'middle'; - imgObject.style.maxWidth = 'none'; - var data = (wirisProperties) ? wirisProperties : {}; - - if (window._wrs_conf_useDigestInsteadOfMathml && _wrs_conf_useDigestInsteadOfMathml) { - data['returnDigest'] = 'true'; - } - - data['mml'] = mathml; - data['lang'] = language; - - if (_wrs_conf_setSize) { - // Request metrics of the generated image. - data['metrics'] = 'true'; - data['centerbaseline'] = 'false'; - } - - // Full base64 method (edit & save). - if (_wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'default') { - data['base64'] = true; - } - - // Render js params: _wrs_int_wirisProperties contains some js render params. Since mathml can support render params, js params should be send only to editor, not to render. - - imgObject.className = _wrs_conf_imageClassName; - - // TODO Custom Editors: class="wrs_toolbar" should be given by the editor - // so the first condition shouldn't be longer necessary. - var customEditor; - if (customEditor = wrs_int_getCustomEditorEnabled()) { - imgObject.setAttribute('data-custom-editor', customEditor.toolbar); - } else if (mathml.indexOf('class="') != -1) { // We check here if the mathmnl has been created from a customEditor (such chemistry) - // to add data-custom-editor attribute to img object (if necessary). - var mathmlSubstring = mathml.substring(mathml.indexOf('class="') + 'class="'.length, mathml.length); - mathmlSubstring = mathmlSubstring.substring(0, mathmlSubstring.indexOf('"')); - mathmlSubstring = mathmlSubstring.substring(4,mathmlSubstring.length); - imgObject.setAttribute('data-custom-editor', mathmlSubstring); - } - - // Performance enabled. - if (_wrs_conf_wirisPluginPerformance && (_wrs_conf_saveMode == 'xml' || _wrs_conf_saveMode == 'safeXml')) { - - var result = JSON.parse(wrs_createShowImageSrc(mathml, data, language)); - if (result["status"] == 'warning') { - // POST call. - // if the mathml is malformed, this function will throw an exception. - try { - result = JSON.parse(wrs_getContent(_wrs_conf_showimagePath, data)); - } - catch (e) { - return; - } - } - result = result.result; - if (result['format'] == 'png') { - imgObject.src = 'data:image/png;base64,' + result['content']; - } else { - imgObject.src = 'data:image/svg+xml;charset=utf8,' + wrs_urlencode(result['content']); - } - imgObject.setAttribute(_wrs_conf_imageMathmlAttribute, wrs_mathmlEncode(mathml)); - if (_wrs_conf_setSize) { - wrs_setImgSize(imgObject, result['content'], true); - } - - if (window._wrs_conf_enableAccessibility && _wrs_conf_enableAccessibility) { - if (typeof result.alt == 'undefined') { - imgObject.alt = wrs_mathmlToAccessible(mathml, language, data); - wrs_populateAccessibleCache(mathml, imgObject.alt); - } - else { - imgObject.alt = result.alt; - } - } - } - else { - var result = wrs_createImageSrc(mathml, data); - if (window._wrs_conf_useDigestInsteadOfMathml && _wrs_conf_useDigestInsteadOfMathml) { - var parts = result.split(':', 2); - imgObject.setAttribute(_wrs_conf_imageMathmlAttribute, parts[0]); - imgObject.src = parts[1]; - } - else { - imgObject.setAttribute(_wrs_conf_imageMathmlAttribute, wrs_mathmlEncode(mathml)); - imgObject.src = result; - if (_wrs_conf_setSize) { - wrs_setImgSize(imgObject,result, (_wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'default') ? true : false); - } - } - if (window._wrs_conf_enableAccessibility && _wrs_conf_enableAccessibility) { - imgObject.alt = wrs_mathmlToAccessible(mathml, language, data); - wrs_populateAccessibleCache(mathml, imgObject.alt); - } - } - /* if (_wrs_conf_setSize) { - var ar = wrs_urlToAssArray(result); - width = ar['cw']; - height = ar['ch']; - baseline = ar['cb']; - dpi = ar['dpi']; - if (dpi) { - width = width * 96/dpi; - height = height * 96/dpi; - baseline = baseline * 96/dpi; - } - // result = wrs_assArrayToUrl(ar); - }*/ - - if (typeof wrs_observer != 'undefined') { - wrs_observer.observe(imgObject, wrs_observer_config); - } - - // Role math https://www.w3.org/TR/wai-aria/roles#math. - imgObject.setAttribute('role', 'math'); - return imgObject; -} - -/** - * Opens a new CAS window. - * @param {object} target The editable element - * @param {boolean} isIframe Specifies if target is an iframe or not - * @param {string} language CAS language. - * @return {object} The opened window - * @ignore - */ -function wrs_openCASWindow(target, isIframe, language) { - if (isIframe === undefined) { - isIframe = true; - } - - _wrs_temporalRange = null; - - if (target) { - var selectedItem = wrs_getSelectedItem(target, isIframe); - - if (selectedItem != null && selectedItem.caretPosition === undefined && selectedItem.node.nodeName.toUpperCase() == 'IMG' && selectedItem.node.className == _wrs_conf_CASClassName) { - _wrs_temporalImage = selectedItem.node; - _wrs_isNewElement = false; - } - } - - var path = _wrs_conf_CASPath; - - if (language) { - path += '?lang=' + language; - } - - return window.open(path, 'WIRISCAS', _wrs_conf_CASAttributes); -} - -/** - * Opens a new editor window. - * @param {string} language Language code for the editor - * @param {object} target The editable element - * @param {boolean} isIframe Specifies if the target is an iframe or not - * @param {boolean} isModal Specifies if the target is a modal window or not - * @return {object} The opened window - * @ignore - */ -function wrs_openEditorWindow(language, target, isIframe) { - var ua = navigator.userAgent.toLowerCase(); - var isAndroid = ua.indexOf("android") > -1; - var isIOS = ((ua.indexOf("ipad") > -1) || (ua.indexOf("iphone") > -1)); - - if(isAndroid || isIOS) { - _wrs_conf_modalWindow = true; // Conf property must be overrided on tablet/phone devices. - } - - try { - if (isIframe) { - var selection = target.contentWindow.getSelection(); - _wrs_range = selection.getRangeAt(0); - } - else { - var selection = getSelection(); - _wrs_range = selection.getRangeAt(0); - } - } - catch (e) { - _wrs_range = null; - } - - if (isIframe === undefined) { - isIframe = true; - } - - // Avoid double slashes. - var path = _wrs_conf_path.lastIndexOf('/') == _wrs_conf_path.length - 1 ? _wrs_conf_path + "core/editor.html" : _wrs_conf_path + "/core/editor.html"; - - // Params for editor.html - if (language) { - path = wrs_addArgument(path, "lang", language); - } - - if (location.protocol == 'https:') { - path = wrs_addArgument(path, "secure", "true"); - } - - path = wrs_addArgument(path, "v", _wrs_plugin_version); - - var availableDirs = new Array('rtl', 'ltr'); - if (typeof _wrs_int_directionality != 'undefined' && wrs_arrayContains(availableDirs, _wrs_int_directionality) != -1){ - path = wrs_addArgument(path,"dir",_wrs_int_directionality); - } - - // Cross Domain Policy. - wrs_addArgument(path, 'host', 'localhost'); - - _wrs_editMode = (window._wrs_conf_defaultEditMode) ? _wrs_conf_defaultEditMode : 'images'; - _wrs_temporalRange = null; - - if (target) { - var selectedItem; - if (typeof wrs_int_getSelectedItem != 'undefined') { - selectedItem = wrs_int_getSelectedItem(target, isIframe); - } else { - selectedItem = wrs_getSelectedItem(target, isIframe); - } - - if (selectedItem != null) { - if (selectedItem.caretPosition === undefined) { - if (wrs_containsClass(selectedItem.node, _wrs_conf_imageClassName)) { - if (selectedItem.node.nodeName.toUpperCase() == 'IMG') { - _wrs_editMode = 'images'; - } - else if (selectedItem.node.nodeName.toUpperCase() == 'IFRAME') { - _wrs_editMode = 'iframes'; - } - - _wrs_temporalImage = selectedItem.node; - _wrs_isNewElement = false; - } - } - else { - var latexResult = wrs_getLatexFromTextNode(selectedItem.node, selectedItem.caretPosition); - - if (latexResult != null) { - _wrs_editMode = 'latex'; - - var mathml = wrs_getMathMLFromLatex(latexResult.latex); - _wrs_isNewElement = false; - - _wrs_temporalImage = document.createElement('img'); - _wrs_temporalImage.setAttribute(_wrs_conf_imageMathmlAttribute, wrs_mathmlEncode(mathml)); - var windowTarget = (isIframe) ? target.contentWindow : window; - - if (document.selection) { - var leftOffset = 0; - var previousNode = latexResult.startNode.previousSibling; - - while (previousNode) { - leftOffset += wrs_getNodeLength(previousNode); - previousNode = previousNode.previousSibling; - } - - _wrs_temporalRange = windowTarget.document.selection.createRange(); - _wrs_temporalRange.moveToElementText(latexResult.startNode.parentNode); - _wrs_temporalRange.move('character', leftOffset + latexResult.startPosition); - _wrs_temporalRange.moveEnd('character', latexResult.latex.length + 4); // Plus 4 for the '$$' characters. - } - else { - _wrs_temporalRange = windowTarget.document.createRange(); - _wrs_temporalRange.setStart(latexResult.startNode, latexResult.startPosition); - _wrs_temporalRange.setEnd(latexResult.endNode, latexResult.endPosition); - } - } - } - } - } - // Parse atributes of editor into object - var splitterEditorAtributes = _wrs_conf_editorAttributes.split(", "); - var resultEditorAtributes = {}; - for (var i = 0, len = splitterEditorAtributes.length; i < len; i++) { - var tempAtribute = splitterEditorAtributes[i].split('='); - var key = tempAtribute[0]; - var value = tempAtribute[1]; - resultEditorAtributes[key] = value; - } - resultEditorAtributes.language = _wrs_int_langCode; - - var title = wrs_int_getCustomEditorEnabled() != null ? wrs_int_getCustomEditorEnabled().title : _wrs_stringManager.getString('mathtype'); - if (_wrs_modalWindow == null) { - _wrs_modalWindow = new ModalWindow(_wrs_conf_editorAttributes); - _wrs_modalWindow.setContentManager(new contentManager(resultEditorAtributes)); - } - if (!_wrs_css_loaded) { - var fileref = document.createElement("link"); - fileref.setAttribute("rel", "stylesheet"); - fileref.setAttribute("type", "text/css"); - fileref.setAttribute("href", wrs_concatenateUrl(_wrs_conf_path, '/core/modal.css')); - document.getElementsByTagName("head")[0].appendChild(fileref); - _wrs_css_loaded = true; - } - // TODO: setMathML logic here. - _wrs_modalWindow.open(); -} - -function Core() { - this.init = true; -} - - -/** - * Converts all occurrences of mathml code to LATEX. The MathML code should containg to be converted. - * @param {string} content A string containing MathML valid code. - * @param {Object} characters An object containing special characters. - * @return {string} String with all MathML annotated occurrences replaced by the corresponding LaTeX code. - * @ignore - */ -function wrs_parseMathmlToLatex(content, characters){ - var output = ''; - var mathTagBegin = characters.tagOpener + 'math'; - var mathTagEnd = characters.tagOpener + '/math' + characters.tagCloser; - var openTarget = characters.tagOpener + 'annotation encoding=' + characters.doubleQuote + 'LaTeX' + characters.doubleQuote + characters.tagCloser; - var closeTarget = characters.tagOpener + '/annotation' + characters.tagCloser; - var start = content.indexOf(mathTagBegin); - var end = 0; - var mathml, startAnnotation, closeAnnotation; - - while (start != -1) { - output += content.substring(end, start); - end = content.indexOf(mathTagEnd, start); - - if (end == -1) { - end = content.length - 1; - } - else { - end += mathTagEnd.length; - } - - mathml = content.substring(start, end); - - startAnnotation = mathml.indexOf(openTarget); - if (startAnnotation != -1){ - startAnnotation += openTarget.length; - closeAnnotation = mathml.indexOf(closeTarget); - var latex = mathml.substring(startAnnotation, closeAnnotation); - if (characters == _wrs_safeXmlCharacters) { - latex = wrs_mathmlDecode(latex); - } - output += '$$' + latex + '$$'; - // Populate latex into cache. - wrs_populateLatexCache(latex, mathml); - }else{ - output += mathml; - } - - start = content.indexOf(mathTagBegin, end); - } - - output += content.substring(end, content.length); - return output; -} - -/** - * Converts all occurrences of mathml code to the corresponding image. - * @param {string} content An string with valid MathML code. The matml code doesn't contain semantics. - * @param {object} characters An object containing xmlCharacters or safeXmlCharacters relation. - * @param {string} language String containging a valid language code in order to generate formula accesibilty. - * @return {string} The input string with all the MathML ocurrences replaced by the corresponding image. - * @ignore - */ -function wrs_parseMathmlToImg(content, characters, language) { - var output = ''; - var mathTagBegin = characters.tagOpener + 'math'; - var mathTagEnd = characters.tagOpener + '/math' + characters.tagCloser; - var start = content.indexOf(mathTagBegin); - var end = 0; - - while (start != -1) { - output += content.substring(end, start); - // Avoid WIRIS images to be parsed. - var imageMathmlAtrribute = content.indexOf(_wrs_conf_imageMathmlAttribute); - end = content.indexOf(mathTagEnd, start); - - if (end == -1) { - end = content.length - 1; - } else if (imageMathmlAtrribute != -1) { - // First close tag of img attribute - // If a mathmlAttribute exists should be inside a img tag. - end += content.indexOf("/>", start); - } - else { - end += mathTagEnd.length; - } - - if (!wrs_isMathmlInAttribute(content, start) && imageMathmlAtrribute == -1){ - var mathml = content.substring(start, end); - mathml = (characters == _wrs_safeXmlCharacters) ? wrs_mathmlDecode(mathml) : wrs_mathmlEntities(mathml); - output += wrs_createObjectCode(wrs_mathmlToImgObject(document, mathml, null, language)); - } - else { - output += content.substring(start, end); - } - - start = content.indexOf(mathTagBegin, end); - } - - output += content.substring(end, content.length); - return output; -} - -/** - * Converts all occurrences of safe applet code to the corresponding code. - * @param {string} content String containging valid applet code ... - * @return {string} String with all the applet code conerted to safe tags. - * @ignore - */ -function wrs_parseSafeAppletsToObjects(content) { - var output = ''; - var appletTagBegin = _wrs_safeXmlCharacters.tagOpener + 'APPLET'; - var appletTagEnd = _wrs_safeXmlCharacters.tagOpener + '/APPLET' + _wrs_safeXmlCharacters.tagCloser; - var upperCaseContent = content.toUpperCase(); - var start = upperCaseContent.indexOf(appletTagBegin); - var end = 0; - var applet; - - while (start != -1) { - output += content.substring(end, start); - end = upperCaseContent.indexOf(appletTagEnd, start); - - if (end == -1) { - end = content.length - 1; - } - else { - end += appletTagEnd.length; - } - - applet = wrs_convertOldXmlinitialtextAttribute(content.substring(start, end)); - - output += wrs_mathmlDecode(applet); - start = upperCaseContent.indexOf(appletTagBegin, end); - } - - output += content.substring(end, content.length); - return output; -} - -/** - * Cross-browser removeEventListener/detachEvent function. - * @param {object} element Element target - * @param {event} event Event - * @param {function} func Function to run - * @ignore - */ -function wrs_removeEvent(element, event, func) { - if (element.removeEventListener) { - element.removeEventListener(event, func, true); - } - else if (element.detachEvent) { - element.detachEvent('on' + event, func); - } -} - -/** - * Splits an HTML content in three parts: the code before , the code between and and the code after . - * @param {string} code HTML code to be splited. - * @return {objet} An object with the structure {'prefix': xxx, 'code': yyy, 'sufix': zzz} - * @ignore - */ -function wrs_splitBody(code) { - var prefix = ''; - var sufix = ''; - var bodyPosition = code.indexOf('', bodyPosition); - - if (bodyPosition != -1) { - ++bodyPosition; - var endBodyPosition = code.indexOf('', bodyPosition); - - if (endBodyPosition == -1) { - endBodyPosition = code.length; - } - - prefix = code.substring(0, bodyPosition); - sufix = code.substring(endBodyPosition, code.length); - code = code.substring(bodyPosition, endBodyPosition); - } - } - - return { - 'prefix': prefix, - 'code': code, - 'sufix': sufix - }; -} - -/** - * Inserts or modifies CAS. - * @param {object} focusElement Element to be focused - * @param {object} windowTarget Window where the editable content is - * @param {string} appletCode Applet code - * @param {string} image Base 64 image stream - * @param {int} imageWidth Image width - * @param {int} imageHeight Image height - * @ignore - */ -function wrs_updateCAS(focusElement, windowTarget, appletCode, image, imageWidth, imageHeight) { - var imgObject = wrs_appletCodeToImgObject(windowTarget.document, appletCode, image, imageWidth, imageHeight); - wrs_insertElementOnSelection(imgObject, focusElement, windowTarget); -} - -var wrs_PluginEvent = function () { - this.cancelled = false; - this.defaultPrevented = false; -} - -wrs_PluginEvent.prototype.cancel = function () { - this.cancelled = true; -} - -wrs_PluginEvent.prototype.preventDefault = function () { - this.defaultPrevented = true; -} - -/** - * Fires MathType event listeners - * @param {String} eventName event name - * @param {Object} e event properties - * @return {bool} false if event has been prevented. - * @ignore - */ -function wrs_fireEventListeners(eventName, e) { - for (var i = 0; i < wrs_pluginListeners.length && !e.cancelled; ++i) { - if (wrs_pluginListeners[i][eventName]) { - // Calling listener. - wrs_pluginListeners[i][eventName](e); - } - } - - return e.defaultPrevented; -} - -/** - * Inserts or modifies formulas. - * @param {object} focusElement Element to be focused - * @param {object} windowTarget Window where the editable content is - * @param {string} mathml Mathml code - * @param {object} wirisProperties Extra attributes for the formula (like background color or font size). - * @param {string} editMode Current edit mode. - * @param {string} language Language for the formula. - * @ignore - */ -function wrs_updateFormula(focusElement, windowTarget, mathml, wirisProperties, editMode, language) { - // Before update listener. - - // Params on beforeUpdate listener - // - mathml - // - editMode (read only) - // - wirisProperties - // - language (read only). - - editMode = editMode !== null ? editMode : _wrs_editMode; - var e = new wrs_PluginEvent(); - - e.mathml = mathml; - - // Cloning wirisProperties object - // We don't want wirisProperties object modified. - e.wirisProperties = {}; - - for (var attr in wirisProperties) { - e.wirisProperties[attr] = wirisProperties[attr]; - } - - // Read only. - e.language = language; - e.editMode = editMode; - - if (wrs_fireEventListeners('onBeforeFormulaInsertion', e)) { - return; - } - - mathml = e.mathml; - wirisProperties = e.wirisProperties; - - // Setting empty params for after. - e = new wrs_PluginEvent(); - e.editMode = editMode; - e.windowTarget = windowTarget; - e.focusElement = focusElement; - - if (mathml.length == 0) { - wrs_insertElementOnSelection(null, focusElement, windowTarget); - } - else if (editMode == 'latex') { - e.latex = wrs_getLatexFromMathML(mathml); - // wrs_int_getNonLatexNode is an integration wrapper to have special behaviours for nonLatex. - // Not all the integrations have special behaviours for nonLatex. - if (typeof wrs_int_getNonLatexNode != 'undefined' && (typeof e.latex == 'undefined' || e.latex == null)) { - wrs_int_getNonLatexNode(e, windowTarget, mathml); - } - else { - e.node = windowTarget.document.createTextNode('$$' + e.latex + '$$'); - wrs_populateLatexCache(e.latex, mathml); - } - wrs_insertElementOnSelection(e.node, focusElement, windowTarget); - } - else if (editMode == 'iframes') { - var iframe = wrs_mathmlToIframeObject(windowTarget, mathml); - wrs_insertElementOnSelection(iframe, focusElement, windowTarget); - } - else { - e.node = wrs_mathmlToImgObject(windowTarget.document, mathml, wirisProperties, language); - wrs_insertElementOnSelection(e.node, focusElement, windowTarget); - } - - if (wrs_fireEventListeners('onAfterFormulaInsertion', e)) { - return; - } -} - -/** - * Inserts or modifies formulas or CAS on a textarea. - * @param {object} textarea Target - * @param {string} text Text to add in the textarea. For example, if you want to add the link to the image, you can call this function as wrs_updateTextarea(textarea, wrs_createImageSrc(mathml)); - * @ignore - */ -function wrs_updateTextarea(textarea, text) { - if (textarea && text) { - textarea.focus(); - - if (textarea.selectionStart != null) { - var selectionEnd = textarea.selectionEnd; - textarea.value = textarea.value.substring(0, textarea.selectionStart) + text + textarea.value.substring(textarea.selectionEnd, textarea.value.length); - textarea.selectionEnd = selectionEnd + text.length; - } - else { - var selection = document.selection.createRange(); - selection.text = text; - } - } -} - -/** - * Modifies existing formula on a textarea. - * @param {object} textarea Target - * @param {string} text Text to add in the textarea. For example, if you want to add the link to the image, you can call this function as wrs_updateTextarea(textarea, wrs_createImageSrc(mathml)); - * @param {number} start Beggining index from textarea where it needs to be replaced by text. - * @param {number} end Ending index from textarea where it needs to be replaced by text - * @ignore - */ -function wrs_updateExistingFormulaOnTextarea(textarea, text, start, end) { - textarea.focus(); - textarea.value = textarea.value.substring(0, start) + text + textarea.value.substring(end, textarea.value.length); - textarea.selectionEnd = start + text.length; -} - -/** - * URL decode function. - * @param {string} input String to be decoded - * @return {string} decode string. - * @ignore - */ -function wrs_urldecode(input) { - return decodeURIComponent(input); -} - -/** - * URL encode function. - * @param {string} clearString Input string to be encoded - * @return {string} encoded string. - * @ignore - */ -function wrs_urlencode(clearString) { - var output = ''; - // Method encodeURIComponent doesn't encode !'()*~ . - output = encodeURIComponent(clearString); - return output; -} - -function wrs_addArgument(path,key,value) { - var sep; - if (path.indexOf("?") > 0) { - sep = "&"; - } else { - sep = "?"; - } - return path + sep + key + "=" + value; -} - -function wrs_urlToAssArray(url) { - var i; - i = url.indexOf("?"); - if (i > 0) { - var query = url.substring(i + 1); - var ss = query.split("&"); - var h = new Object(); - for (i = 0; i < ss.length; i++) { - var s = ss[i]; - var kv = s.split("="); - if (kv.length > 1) { - h[kv[0]] = decodeURIComponent(kv[1].replace(/\+/g, ' ')); - } - } - return h; - } else { - return new Object(); - } -} - -function wrs_setImgSize(img, url, json) { - - if (json) { - // Cleaning data:image/png;base64. - if (_wrs_conf_imageFormat == 'svg') { - // SVG format. - // If SVG is encoded in base64 we need to convert the base64 bytes into a SVG string. - if (_wrs_conf_saveMode != 'base64') { - var ar = getMetricsFromSvgString(url); - } else { - var base64String = img.src.substr( img.src.indexOf('base64,') + 7, img.src.length); - var svgString = ''; - var bytes = wrs_b64ToByteArray(base64String, base64String.length); - for (var i = 0; i < bytes.length; i++) { - svgString += String.fromCharCode(bytes[i]); - } - var ar = getMetricsFromSvgString(svgString); - } - // PNG format: we store all metrics information in the first 88 bytes. - } else { - var base64String = img.src.substr( img.src.indexOf('base64,') + 7, img.src.length); - var bytes = wrs_b64ToByteArray(base64String, 88); - var ar = wrs_getMetricsFromBytes(bytes); - } - // Backwards compatibility: we store the metrics into createimage response. - } else { - var ar = wrs_urlToAssArray(url); - } - var width = ar['cw']; - if (!width) { - return; - } - var height = ar['ch']; - var baseline = ar['cb']; - var dpi = ar['dpi']; - if (dpi) { - width = width * 96 / dpi; - height = height * 96 / dpi; - baseline = baseline * 96 / dpi; - } - img.width = width; - img.height = height; - img.style.verticalAlign = "-" + (height - baseline) + "px"; -} - -function wrs_fixAfterResize(img) { - img.removeAttribute('style'); - img.removeAttribute('width'); - img.removeAttribute('height'); - // In order to avoid resize with max-width css property. - img.style.maxWidth = 'none'; - if (_wrs_conf_setSize) { - if (img.src.indexOf("data:image") != -1) { - if (_wrs_conf_imageFormat == 'svg') { - // ...data:image/svg+xml;charset=utf8, = 32. - var svg = wrs_urldecode(img.src.substring(32, img.src.length)) - wrs_setImgSize(img, svg, true); - } else { - // ...data:image/png;base64, == 22. - var base64 = img.src.substring(22,img.src.length); - wrs_setImgSize(img, base64, true); - } - } else { - wrs_setImgSize(img,img.src); - } - } -} - -function wrs_initSetSize() { - // Override _wrs_conf_setSize to align formulas when xml or safeXml mode are enabled. - _wrs_conf_setSize = _wrs_conf_setSize || _wrs_conf_saveMode == 'xml' || _wrs_conf_saveMode == 'safeXml' || (_wrs_conf_saveMode == 'base64' && _wrs_conf_editMode == 'default') - || (_wrs_conf_saveMode == 'image' && _wrs_conf_imageFormat == 'svg'); -} - -/** - * Loads a set of global variables containing server configuration. - * This method calls to configurationjs service, converting the response - * JSON into javascript variables - * @ignore - */ -function wrs_loadConfiguration() { - if (typeof _wrs_conf_path == 'undefined') { - _wrs_conf_path = _wrs_corePath; - } - - var httpRequest = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); - var configUrl = _wrs_int_conf_file.indexOf("/") == 0 || _wrs_int_conf_file.indexOf("http") == 0 ? _wrs_int_conf_file : wrs_concatenateUrl(_wrs_conf_path, _wrs_int_conf_file); - httpRequest.open('GET', configUrl, false); - httpRequest.send(null); - - var jsonConfiguration = JSON.parse(httpRequest.responseText); - - // JSON structure: {{jsVariableName, jsVariableValue}}. - - var variables = Object.keys(jsonConfiguration); - - for (var variable in variables) { - window[variables[variable]] = jsonConfiguration[variables[variable]]; - } - - // Services path (tech dependant). - wrs_loadServicePaths(configUrl); - - // End configuration. - var _wrs_conf_configuration_loaded = true; - if (typeof _wrs_conf_core_loaded != 'undefined') { - _wrs_conf_plugin_loaded = true; - } -} - -function wrs_loadServicePaths(url) { - // Services path (tech dependant). - _wrs_conf_createimagePath = url.replace('configurationjs', 'createimage'); - _wrs_conf_showimagePath = url.replace('configurationjs', 'showimage'); - _wrs_conf_editorPath = url.replace('configurationjs', 'editor'); - _wrs_conf_CASPath = url.replace('configurationjs', 'cas'); - _wrs_conf_createcasimagePath = url.replace('configurationjs', 'createcasimage'); - _wrs_conf_getmathmlPath = url.replace('configurationjs', 'getmathml'); - _wrs_conf_servicePath = url.replace('configurationjs', 'service'); -} - -var _wrs_conf_plugin_loaded = true; - -function wrs_loadLangFile() { - if (_wrs_conf_core_loaded) { - _wrs_stringManager = new StringManager(); - // When a language is not defined, put english (en) as default. - if (typeof _wrs_int_langCode == 'undefined' || _wrs_int_langCode == null) { - _wrs_int_langCode = 'en'; - } - - var langArray = _wrs_languages.split(','); - - if (langArray.indexOf(_wrs_int_langCode) == -1) { - _wrs_int_langCode = _wrs_int_langCode.substr(0,2); - } - - if (langArray.indexOf(_wrs_int_langCode) == -1) { - _wrs_int_langCode = 'en'; - } - - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.src = _wrs_corePath + "/lang/" + _wrs_int_langCode + "/strings.js"; - // When strings are loaded, it loads into stringManager - script.onload = function() { - - _wrs_stringManager.loadStrings(wrs_strings); - // Unseting global language strings array to prevent access. - wrs_strings = null; - }; - document.getElementsByTagName('head')[0].appendChild(script); - } else { - setTimeout(wrs_loadLangFile, 100); - } -} - -function wrs_concatenateUrl(path1, path2) { - var separator = ""; - if ((path1.indexOf("/") != path1.length) && (path2.indexOf("/") != 0)) { - separator = "/"; - } - return (path1 + separator + path2).replace(/([^:]\/)\/+/g, "$1"); -} - -// Loading javascript configuration. -if (typeof _wrs_conf_configuration_loaded == 'undefined') { - wrs_loadConfiguration(); -} else { - var configUrl = _wrs_int_conf_file.indexOf("/") == 0 || _wrs_int_conf_file.indexOf("http") == 0 ? _wrs_int_conf_file : wrs_concatenateUrl(_wrs_conf_path, _wrs_int_conf_file); - // If javascript configuration is loaded we need to load service paths manually. - wrs_loadServicePaths(configUrl); - _wrs_conf_plugin_loaded = true; -} - -/** - * Populates LaTeX cache into _wrs_int_LatexCache global variable. - * - * @param {string}latex LaTeX code (with $$ separators) - * @param {string} mathml matml LaTeX translation. - * @ignore - */ -function wrs_populateLatexCache(latex, mathml) { - if (mathml.indexOf('semantics') == -1 && mathml.indexOf('annotation') == -1 ) { - mathml = wrs_insertSemanticsMathml(mathml, latex); - } - if (!_wrs_int_LatexCache.hasOwnProperty(latex)) { - _wrs_int_LatexCache[latex] = mathml; - } -} - -/** - * Populates Non-LaTeX cache into _wrs_int_nonLatexCache global variable. - * Non-LaTeX is called to all the mathmls without LaTeX translation. - * - * @param {string}latex Non-LaTeX code. - * @param {string} mathml matml associated. - * @ignore - */ -function wrs_populateNonLatexCache(latex, mathml) { - if (!_wrs_int_LatexCache.hasOwnProperty(latex)) { - _wrs_int_nonLatexCache[latex] = mathml; - } -} - -/** - * Puts into _wrs_int_AccessibleCache global variable dictionary the pair mathml=>accessibleText. - * - * @param {string} mathml MatML text. - * @param {string} accessibleText Image accessible text - * @ignore - */ -function wrs_populateAccessibleCache(mathml, accessibleText) { - if (!_wrs_int_AccessibleCache.hasOwnProperty(mathml)) { - _wrs_int_AccessibleCache[mathml] = accessibleText; - } -} - -/** - * Add annotation tag to mathml without it (mathml comes from LaTeX string) - * @param {string} mathml MathML code generated by a LaTeX string. - * @param {string} latex Original LaTeX string - * @param {string} withoutLatexTranslate True if not exists latex translation from mathml. - * @return {string} new mathml containing LaTeX code on annotation tag. - * @ignore - */ -function wrs_insertSemanticsMathml(mathml, latex) { - - // If latex is empty, insert semantics doesn't provide information. We can avoid semantics insertion and return the mathml. - if (latex == "") { - return mathml; - } - - var firstEndTag = '>'; - var mathTagEnd = '<' + '/math' + '>'; - var openSemantics = '<' + 'semantics' + '>'; - var closeSemantics = '<' + '/semantics' + '>'; - var openTarget = ''; - var closeTarget = '<' + '/annotation' + '>'; - var mrowOpen = ''; - var mrowClose = ''; - - var indexMathBegin = mathml.indexOf(firstEndTag); - var indexMathEnd = mathml.indexOf(mathTagEnd); - var mathBeginExists = mathml.substring(mathml.indexOf('<'), mathml.indexOf('>')).indexOf('math'); - - if (indexMathBegin != -1 && indexMathEnd != -1 && mathBeginExists) { - var mathmlContent = mathml.substring(indexMathBegin + 1, indexMathEnd); - if (mathmlContent.indexOf(mrowOpen) != 0) { - var mathmlContentSemantics = openSemantics + mrowOpen + mathmlContent + mrowClose + openTarget + latex + closeTarget + closeSemantics; - } else { - var mathmlContentSemantics = openSemantics + mathmlContent + openTarget + latex + closeTarget + closeSemantics; - } - return mathml.replace(mathmlContent, mathmlContentSemantics); - } else { - return mathml; - } - -} - -/** - * Removes annotation tag to mathml. - * @param {*} mathml Valid MathML. - */ -function wrs_removeSemanticsMathml(mathml) { - var mathTagEnd = '<' + '/math' + '>'; - var openSemantics = '<' + 'semantics' + '>'; - var openAnnotation = ''; - - var mathmlWithoutSemantics = mathml; - var startSemantics = mathml.indexOf(openSemantics); - if (startSemantics != -1) { - var startAnnotation = mathml.indexOf(openAnnotation, startSemantics + openSemantics.length); - if (startAnnotation != -1) { - mathmlWithoutSemantics = mathml.substring(0, startSemantics) + mathml.substring(startSemantics + openSemantics.length, startAnnotation) + mathTagEnd; - } - } - - return mathmlWithoutSemantics; -} - -/** - * Transform html img tags inside a html code to mathml, base64 img tags (i.e with base64 on src) or showimage img tags (i.e with showimage.php on src) - * - * @param {String} code html code - * @param {String} mode base642showimage or img2mathml or img264 transform. - * @return {String} html code transformed. - * @ignore - */ -function wrs_codeImgTransform(code, mode) { - var output = ''; - - var endPosition = 0; - var pattern = /') { - endPosition = i + 1; - } - - ++i; - } - - if (endPosition < startPosition) { // The img tag is stripped. - output += code.substring(startPosition, code.length); - return output; - } - var imgCode = code.substring(startPosition, endPosition); - var imgObject = wrs_createObject(imgCode); - var xmlCode = imgObject.getAttribute(_wrs_conf_imageMathmlAttribute); - var convertToXml; - var convertToSafeXml; - - if (mode == 'base642showimage') { - if (xmlCode == null) { - xmlCode = imgObject.getAttribute('alt'); - } - xmlCode = wrs_mathmlDecode(xmlCode); - imgCode = wrs_mathmlToImgObject(document, xmlCode, null, null); - output += wrs_createObjectCode(imgCode); - } else if (mode == 'img2mathml') { - if (window._wrs_conf_saveMode) { - if (_wrs_conf_saveMode == 'safeXml') { - convertToXml = true; - convertToSafeXml = true; - } - else if (_wrs_conf_saveMode == 'xml') { - convertToXml = true; - convertToSafeXml = false; - } - } - output += wrs_getWIRISImageOutput(imgCode, convertToXml, convertToSafeXml); - } else if (mode == 'img264') { - - if (xmlCode == null) { - xmlCode = imgObject.getAttribute('alt'); - } - xmlCode = wrs_mathmlDecode(xmlCode); - - var properties = {}; - properties['base64'] = 'true'; - imgCode = wrs_mathmlToImgObject(document, xmlCode, properties, null) - // Metrics. - wrs_setImgSize(imgCode, imgCode.src, true); - - output += wrs_createObjectCode(imgCode); - } - } - output += code.substring(endPosition, code.length); - return output; -} - -/** - * Decode a base64 to its numeric value - * - * @param {String} el base64 character. - * @return {int} base64 char numeric value. - * @ignore - */ -function wrs_decode64(el) { - - var PLUS = '+'.charCodeAt(0); - var SLASH = '/'.charCodeAt(0); - var NUMBER = '0'.charCodeAt(0); - var LOWER = 'a'.charCodeAt(0); - var UPPER = 'A'.charCodeAt(0); - var PLUS_URL_SAFE = '-'.charCodeAt(0); - var SLASH_URL_SAFE = '_'.charCodeAt(0); - var code = el.charCodeAt(0); - - if (code === PLUS || code === PLUS_URL_SAFE) { - return 62; // Char '+'. - } - if (code === SLASH || code === SLASH_URL_SAFE){ - return 63 // Char '/'. - } - if (code < NUMBER){ - return -1 // No match. - } - if (code < NUMBER + 10){ - return code - NUMBER + 26 + 26 - } - if (code < UPPER + 26){ - return code - UPPER - } - if (code < LOWER + 26){ - return code - LOWER + 26 - } -} - -/** - * Converts a base64 string to a array of bytes. - * @param {String} b64String base64 string. - * @param {int} len dimension of byte array (by default whole string). - * @return {Array} Byte array. - * @ignore - */ -function wrs_b64ToByteArray(b64String, len) { - - var tmp; - - if (b64String.length % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4'); // Tipped base64. Length is fixed. - } - - var arr = new Array() - - if (!len) { // All b64String string. - var placeHolders = b64String.charAt(b64String.length - 2) === '=' ? 2 : b64String.charAt(b64String.length - 1) === '=' ? 1 : 0 - var l = placeHolders > 0 ? b64String.length - 4 : b64String.length; - } else { - var l = len; - } - - for (var i = 0; i < l; i += 4) { - // Ignoring code checker standards (bitewise operators). - // See https://tracker.moodle.org/browse/CONTRIB-5862 for further information. - // @codingStandardsIgnoreStart - tmp = (wrs_decode64(b64String.charAt(i)) << 18) | (wrs_decode64(b64String.charAt(i + 1)) << 12) | (wrs_decode64(b64String.charAt(i + 2)) << 6) | wrs_decode64(b64String.charAt(i + 3)); - - arr.push((tmp >> 16) & 0xFF); - arr.push((tmp >> 8) & 0xFF); - arr.push(tmp & 0xFF); - // @codingStandardsIgnoreEnd - } - - if (placeHolders) { - if (placeHolders === 2) { - // Ignoring code checker standards (bitewise operators). - // @codingStandardsIgnoreStart - tmp = (wrs_decode64(b64String.charAt(i)) << 2) | (wrs_decode64(b64String.charAt(i + 1)) >> 4); - arr.push(tmp & 0xFF) - } else if (placeHolders === 1) { - tmp = (wrs_decode64(b64String.charAt(i)) << 10) | (wrs_decode64(b64String.charAt(i + 1)) << 4) | (wrs_decode64(b64String.charAt(i + 2)) >> 2) - arr.push((tmp >> 8) & 0xFF); - arr.push(tmp & 0xFF); - // @codingStandardsIgnoreEnd - } - } - - return arr -} - -/** - * Returns the first 32-bit signed integer from a byte array. - * @param {Array} bytes array of bytes. - * @return {int} 32-bit signed integer. - * @ignore - */ -function wrs_readInt32(bytes) { - if (bytes.length < 4) { - return false; - } - var int32 = bytes.splice(0,4); - // @codingStandardsIgnoreStart - return (int32[0] << 24 | int32[1] << 16 | int32[2] << 8 | int32[3] << 0); - // @codingStandardsIgnoreEnd -} - -/** - * Read the first byte from a byte array. - * @param {array} bytes byte array. - * @return {int} first byte of the byte array. - * @ignore - */ -function wrs_readByte(bytes) { - // @codingStandardsIgnoreStart - return bytes.shift() << 0; - // @codingStandardsIgnoreEnd - -} - -/** - * Read an arbitrary number of bytes, from a fixed position on a byte array. - * @param {array} bytes byte array. - * @param {int} post start position. - * @param {int} len number of bytes to read. - * @return {array} byte array. - * @ignore - */ -function wrs_readBytes(bytes, pos, len) { - return bytes.splice(pos, len); -} - -/** - * Get metrics (width, height, baseline and dpi) from a png's byte array. - * @param {array} bytes png byte array. - * @return {array} An array containging the png's metrics. - * @ignore - */ -function wrs_getMetricsFromBytes(bytes) { - wrs_readBytes(bytes, 0, 8); - var alloc = 10; - var i = 0; - while (bytes.length >= 4) { - var len = wrs_readInt32(bytes); - var typ = wrs_readInt32(bytes); - if (typ == 0x49484452) { - var width = wrs_readInt32(bytes); - var height = wrs_readInt32(bytes); - // Read 5 bytes. - wrs_readInt32(bytes); - wrs_readByte(bytes); - } else if (typ == 0x62615345) { // Baseline: 'baSE'. - var baseline = wrs_readInt32(bytes); - } else if (typ == 0x70485973) { // Dpis: 'pHYs'. - var dpi = wrs_readInt32(bytes); - dpi = (Math.round(dpi / 39.37)); - wrs_readInt32(bytes); - wrs_readByte(bytes); - } - wrs_readInt32(bytes); - } - - if (typeof width != 'undefined') { - var arr = new Array(); - arr['cw'] = width; - arr['ch'] = height; - arr['dpi'] = dpi; - if (baseline) { - arr['cb'] = baseline; - } - - return arr; - } -} - -function getMetricsFromSvgString(svgString) { - var first = svgString.indexOf('height="'); - var last = svgString.indexOf('"',first + 8, svgString.length); - var height = svgString.substring(first + 8, last); - - first = svgString.indexOf('width="'); - last = svgString.indexOf('"',first + 7, svgString.length); - var width = svgString.substring(first + 7, last); - - first = svgString.indexOf('wrs:baseline="'); - last = svgString.indexOf('"',first + 14, svgString.length); - var baseline = svgString.substring(first + 14, last); - - if (typeof(width != 'undefined')) { - var arr = new Array(); - arr['cw'] = width; - arr['ch'] = height; - if (typeof baseline != 'undefined') { - arr['cb'] = baseline - } - - return arr; - } - -} - -/** - * Get custom active editor - * @ignore - */ -function wrs_int_getCustomEditorEnabled() { - var customEditorEnabled = null; - for (var key in _wrs_int_customEditors) { - if (_wrs_int_customEditors[key].enabled) { - customEditorEnabled = _wrs_int_customEditors[key]; - break; - } - } - - return customEditorEnabled; -} - - -/** - * Disable all custom editors - * @ignore - */ -function wrs_int_disableCustomEditors(){ - Object.keys(_wrs_int_customEditors).forEach(function(key) { - _wrs_int_customEditors[key].enabled = false; - }); -} - -/** - * Enable a custom editor - * @param {string} editor a custom editor to be enabled - * @ignore - */ -function wrs_int_enableCustomEditor(editor) { - // Only one custom editor enabled at the same time. - wrs_int_disableCustomEditors(); - if (_wrs_int_customEditors[editor]) { - _wrs_int_customEditors[editor].enabled = true; - } -} - -/** - * Convert a hash to string sorting keys to get a deterministic output - * @param {hash} h a key-value hash - * @return{string} A string with the form key1=value1...keyn=valuen - * @ignore - */ -function wrs_propertiesToString(h) { - // 1. Sort keys. We sort the keys because we want a deterministic output. - var keys = [] - for (var key in h) { - if (h.hasOwnProperty(key)) { - keys.push(key); - } - } - - var n = keys.length; - for (var i = 0; i < n; i++) { - for (var j = i + 1; j < n; j++) { - var s1 = keys[i]; - var s2 = keys[j]; - if (wrs_compareStrings(s1,s2) > 0) { - // Swap. - keys[i] = s2; - keys[j] = s1; - } - } - } - - // 2. Generate output. - var output = ''; - for (var i = 0; i < n; i++) { - var key = keys[i]; - output += key; - output += "="; - var value = h[key]; - value = value.replace("\\", "\\\\"); - value = value.replace("\n", "\\n"); - value = value.replace("\r", "\\r"); - value = value.replace("\t", "\\t"); - - output += value; - output += "\n"; - } - return output; -} - -/** - * Compare two strings using charCodeAt method - * @param {string} a first string to compare. - * @param {string} b second string to compare - * @return {int} the int difference between a and b - * @ignore - */ -function wrs_compareStrings(a, b){ - var i; - var an = a.length; - var bn = b.length; - var n = (an > bn) ? bn : an; - for(i = 0; i < n; i++){ - var c = wrs_fixedCharCodeAt(a,i) - wrs_fixedCharCodeAt(b,i); - if(c != 0) { - return c; - } - } - return a.length - b.length; -} - -// Polyfills. - -if (!Object.keys) { - Object.keys = (function () { - 'use strict'; - var hasOwnProperty = Object.prototype.hasOwnProperty, - hasDontEnumBug = !({toString: null}).propertyIsEnumerable('toString'), - dontEnums = [ - 'toString', - 'toLocaleString', - 'valueOf', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' - ], - dontEnumsLength = dontEnums.length; - - return function (obj) { - if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { - throw new TypeError('Object.keys called on non-object'); - } - - var result = [], prop, i; - - for (prop in obj) { - if (hasOwnProperty.call(obj, prop)) { - result.push(prop); - } - } - - if (hasDontEnumBug) { - for (i = 0; i < dontEnumsLength; i++) { - if (hasOwnProperty.call(obj, dontEnums[i])) { - result.push(dontEnums[i]); - } - } - } - return result; - }; - }()); -} - -/*! http://mths.be/codepointat v0.1.0 by @mathias */ -if (!String.prototype.codePointAt) { - (function() { - 'use strict'; // needed to support `apply`/`call` with `undefined`/`null` - var codePointAt = function(position) { - if (this == null) { - throw TypeError(); - } - var string = String(this); - var size = string.length; - // `ToInteger` - var index = position ? Number(position) : 0; - if (index != index) { // better `isNaN` - index = 0; - } - // Account for out-of-bounds indices: - if (index < 0 || index >= size) { - return undefined; - } - // Get the first code unit - var first = string.charCodeAt(index); - var second; - if ( // check if it’s the start of a surrogate pair - first >= 0xD800 && first <= 0xDBFF && // high surrogate - size > index + 1 // there is a next code unit - ) { - second = string.charCodeAt(index + 1); - if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate - // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae - return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000; - } - } - return first; - }; - if (Object.defineProperty) { - Object.defineProperty(String.prototype, 'codePointAt', { - 'value': codePointAt, - 'configurable': true, - 'writable': true - }); - } else { - String.prototype.codePointAt = codePointAt; - } - }()); -} - -/** - * Add a new callback to a MathType listener. - * @param {object} listener an Object containing listener name and a callback. - * @tutorial tutorial - */ -function wrs_addPluginListener(listener) { - wrs_pluginListeners.push(listener); -} - -/** - * Get the base URL (i.e the URL on core.js lives). - * @ignore - */ -function wrs_getServerPath() { - var url = _wrs_corePath; - var hostNameIndex = url.indexOf("/", url.indexOf("/") + 2); - return url.substr(0, hostNameIndex); -} - -/** - * This method updates all services paths if there are relative with the absolute - * URL path. - * @ignore - */ -function wrs_updateContextPath() { - if (typeof _wrs_conf_plugin_loaded == 'undefined') { - setTimeout(wrs_updateContextPath, 100); - } else { - if (_wrs_conf_showimagePath.indexOf("/") == 0) { - var serverPath = wrs_getServerPath() - _wrs_conf_showimagePath = serverPath + _wrs_conf_showimagePath; - _wrs_conf_editorPath = serverPath + _wrs_conf_editorPath; - _wrs_conf_CASPath = serverPath + _wrs_conf_CASPath; - _wrs_conf_createimagePath = serverPath + _wrs_conf_createimagePath; - _wrs_conf_createcasimagePath = serverPath + _wrs_conf_createcasimagePath; - _wrs_conf_getmathmlPath = serverPath + _wrs_conf_getmathmlPath; - _wrs_conf_servicePath = serverPath + _wrs_conf_servicePath; - } - } -} - -wrs_updateContextPath(); - -// Production steps of ECMA-262, Edition 5, 15.4.4.18 -// Reference: http://es5.github.io/#x15.4.4.18. -if (!Array.prototype.forEach) { - - Array.prototype.forEach = function(callback, thisArg) { - - var T, k; - - if (this == null) { - throw new TypeError(' this is null or not defined'); - } - - // 1. Let O be the result of calling ToObject passing the |this| value as the argument. - var O = Object(this); - - // 2. Let lenValue be the result of calling the Get internal method of O with the argument "length". - // 3. Let len be ToUint32(lenValue). - - // @codingStandardsIgnoreStart - var len = O.length >>> 0; - // @codingStandardsIgnoreEnd - - // 4. If IsCallable(callback) is false, throw a TypeError exception. - // See: http://es5.github.com/#x9.11 . - if (typeof callback !== "function") { - throw new TypeError(callback + ' is not a function'); - } - - // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. - if (arguments.length > 1) { - T = thisArg; - } - - // 6. Let k be 0. - k = 0; - - // 7. Repeat, while k < len. - while (k < len) { - - var kValue; - - // A. Let Pk be ToString(k). - // This is implicit for LHS operands of the in operator - // B. Let kPresent be the result of calling the HasProperty internal method of O with argument Pk - // This step can be combined with c - // C. If kPresent is true. - if (k in O) { - - // I. Let kValue be the result of calling the Get internal method of O with argument Pk. - kValue = O[k]; - - // II. Call the Call internal method of callback with T as the this value and - // argument list containing kValue, k, and O. - callback.call(T, kValue, k, O); - } - // D. Increase k by 1. - k++; - } - // 8. return undefined. - }; -} -// @codingStandardsIgnoreStart -(function(){ -var HxOverrides = function() { } -HxOverrides.__name__ = true; -HxOverrides.dateStr = function(date) { - var m = date.getMonth() + 1; - var d = date.getDate(); - var h = date.getHours(); - var mi = date.getMinutes(); - var s = date.getSeconds(); - return date.getFullYear() + "-" + (m < 10?"0" + m:"" + m) + "-" + (d < 10?"0" + d:"" + d) + " " + (h < 10?"0" + h:"" + h) + ":" + (mi < 10?"0" + mi:"" + mi) + ":" + (s < 10?"0" + s:"" + s); -} -HxOverrides.strDate = function(s) { - switch(s.length) { - case 8: - var k = s.split(":"); - var d = new Date(); - d.setTime(0); - d.setUTCHours(k[0]); - d.setUTCMinutes(k[1]); - d.setUTCSeconds(k[2]); - return d; - case 10: - var k = s.split("-"); - return new Date(k[0],k[1] - 1,k[2],0,0,0); - case 19: - var k = s.split(" "); - var y = k[0].split("-"); - var t = k[1].split(":"); - return new Date(y[0],y[1] - 1,y[2],t[0],t[1],t[2]); - default: - throw "Invalid date format : " + s; - } -} -HxOverrides.cca = function(s,index) { - var x = s.charCodeAt(index); - if(x != x) return undefined; - return x; -} -HxOverrides.substr = function(s,pos,len) { - if(pos != null && pos != 0 && len != null && len < 0) return ""; - if(len == null) len = s.length; - if(pos < 0) { - pos = s.length + pos; - if(pos < 0) pos = 0; - } else if(len < 0) len = s.length + len - pos; - return s.substr(pos,len); -} -HxOverrides.remove = function(a,obj) { - var i = 0; - var l = a.length; - while(i < l) { - if(a[i] == obj) { - a.splice(i,1); - return true; - } - i++; - } - return false; -} -HxOverrides.iter = function(a) { - return { cur : 0, arr : a, hasNext : function() { - return this.cur < this.arr.length; - }, next : function() { - return this.arr[this.cur++]; - }}; -} -var IntIter = function(min,max) { - this.min = min; - this.max = max; -}; -IntIter.__name__ = true; -IntIter.prototype = { - next: function() { - return this.min++; - } - ,hasNext: function() { - return this.min < this.max; - } - ,__class__: IntIter -} -var Std = function() { } -Std.__name__ = true; -Std["is"] = function(v,t) { - return js.Boot.__instanceof(v,t); -} -Std.string = function(s) { - return js.Boot.__string_rec(s,""); -} -Std["int"] = function(x) { - return x | 0; -} -Std.parseInt = function(x) { - var v = parseInt(x,10); - if(v == 0 && (HxOverrides.cca(x,1) == 120 || HxOverrides.cca(x,1) == 88)) v = parseInt(x); - if(isNaN(v)) return null; - return v; -} -Std.parseFloat = function(x) { - return parseFloat(x); -} -Std.random = function(x) { - return Math.floor(Math.random() * x); -} -var com = com || {} -if(!com.wiris) com.wiris = {} -if(!com.wiris.js) com.wiris.js = {} -com.wiris.js.JsPluginTools = function() { - this.tryReady(); -}; -com.wiris.js.JsPluginTools.__name__ = true; -com.wiris.js.JsPluginTools.main = function() { - var ev; - ev = com.wiris.js.JsPluginTools.getInstance(); - haxe.Timer.delay($bind(ev,ev.tryReady),100); -} -com.wiris.js.JsPluginTools.getInstance = function() { - if(com.wiris.js.JsPluginTools.instance == null) com.wiris.js.JsPluginTools.instance = new com.wiris.js.JsPluginTools(); - return com.wiris.js.JsPluginTools.instance; -} -com.wiris.js.JsPluginTools.bypassEncapsulation = function() { - if(window.com == null) window.com = { }; - if(window.com.wiris == null) window.com.wiris = { }; - if(window.com.wiris.js == null) window.com.wiris.js = { }; - if(window.com.wiris.js.JsPluginTools == null) window.com.wiris.js.JsPluginTools = com.wiris.js.JsPluginTools.getInstance(); -} -com.wiris.js.JsPluginTools.prototype = { - md5encode: function(content) { - return haxe.Md5.encode(content); - } - ,doLoad: function() { - this.ready = true; - com.wiris.js.JsPluginTools.instance = this; - com.wiris.js.JsPluginTools.bypassEncapsulation(); - } - ,tryReady: function() { - this.ready = false; - if(js.Lib.document.readyState) { - this.doLoad(); - this.ready = true; - } - if(!this.ready) haxe.Timer.delay($bind(this,this.tryReady),100); - } - ,__class__: com.wiris.js.JsPluginTools -} -var haxe = haxe || {} -haxe.Log = function() { } -haxe.Log.__name__ = true; -haxe.Log.trace = function(v,infos) { - js.Boot.__trace(v,infos); -} -haxe.Log.clear = function() { - js.Boot.__clear_trace(); -} -haxe.Md5 = function() { -}; -haxe.Md5.__name__ = true; -haxe.Md5.encode = function(s) { - return new haxe.Md5().doEncode(s); -} -haxe.Md5.prototype = { - doEncode: function(str) { - var x = this.str2blks(str); - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; - var step; - var i = 0; - while(i < x.length) { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; - step = 0; - a = this.ff(a,b,c,d,x[i],7,-680876936); - d = this.ff(d,a,b,c,x[i + 1],12,-389564586); - c = this.ff(c,d,a,b,x[i + 2],17,606105819); - b = this.ff(b,c,d,a,x[i + 3],22,-1044525330); - a = this.ff(a,b,c,d,x[i + 4],7,-176418897); - d = this.ff(d,a,b,c,x[i + 5],12,1200080426); - c = this.ff(c,d,a,b,x[i + 6],17,-1473231341); - b = this.ff(b,c,d,a,x[i + 7],22,-45705983); - a = this.ff(a,b,c,d,x[i + 8],7,1770035416); - d = this.ff(d,a,b,c,x[i + 9],12,-1958414417); - c = this.ff(c,d,a,b,x[i + 10],17,-42063); - b = this.ff(b,c,d,a,x[i + 11],22,-1990404162); - a = this.ff(a,b,c,d,x[i + 12],7,1804603682); - d = this.ff(d,a,b,c,x[i + 13],12,-40341101); - c = this.ff(c,d,a,b,x[i + 14],17,-1502002290); - b = this.ff(b,c,d,a,x[i + 15],22,1236535329); - a = this.gg(a,b,c,d,x[i + 1],5,-165796510); - d = this.gg(d,a,b,c,x[i + 6],9,-1069501632); - c = this.gg(c,d,a,b,x[i + 11],14,643717713); - b = this.gg(b,c,d,a,x[i],20,-373897302); - a = this.gg(a,b,c,d,x[i + 5],5,-701558691); - d = this.gg(d,a,b,c,x[i + 10],9,38016083); - c = this.gg(c,d,a,b,x[i + 15],14,-660478335); - b = this.gg(b,c,d,a,x[i + 4],20,-405537848); - a = this.gg(a,b,c,d,x[i + 9],5,568446438); - d = this.gg(d,a,b,c,x[i + 14],9,-1019803690); - c = this.gg(c,d,a,b,x[i + 3],14,-187363961); - b = this.gg(b,c,d,a,x[i + 8],20,1163531501); - a = this.gg(a,b,c,d,x[i + 13],5,-1444681467); - d = this.gg(d,a,b,c,x[i + 2],9,-51403784); - c = this.gg(c,d,a,b,x[i + 7],14,1735328473); - b = this.gg(b,c,d,a,x[i + 12],20,-1926607734); - a = this.hh(a,b,c,d,x[i + 5],4,-378558); - d = this.hh(d,a,b,c,x[i + 8],11,-2022574463); - c = this.hh(c,d,a,b,x[i + 11],16,1839030562); - b = this.hh(b,c,d,a,x[i + 14],23,-35309556); - a = this.hh(a,b,c,d,x[i + 1],4,-1530992060); - d = this.hh(d,a,b,c,x[i + 4],11,1272893353); - c = this.hh(c,d,a,b,x[i + 7],16,-155497632); - b = this.hh(b,c,d,a,x[i + 10],23,-1094730640); - a = this.hh(a,b,c,d,x[i + 13],4,681279174); - d = this.hh(d,a,b,c,x[i],11,-358537222); - c = this.hh(c,d,a,b,x[i + 3],16,-722521979); - b = this.hh(b,c,d,a,x[i + 6],23,76029189); - a = this.hh(a,b,c,d,x[i + 9],4,-640364487); - d = this.hh(d,a,b,c,x[i + 12],11,-421815835); - c = this.hh(c,d,a,b,x[i + 15],16,530742520); - b = this.hh(b,c,d,a,x[i + 2],23,-995338651); - a = this.ii(a,b,c,d,x[i],6,-198630844); - d = this.ii(d,a,b,c,x[i + 7],10,1126891415); - c = this.ii(c,d,a,b,x[i + 14],15,-1416354905); - b = this.ii(b,c,d,a,x[i + 5],21,-57434055); - a = this.ii(a,b,c,d,x[i + 12],6,1700485571); - d = this.ii(d,a,b,c,x[i + 3],10,-1894986606); - c = this.ii(c,d,a,b,x[i + 10],15,-1051523); - b = this.ii(b,c,d,a,x[i + 1],21,-2054922799); - a = this.ii(a,b,c,d,x[i + 8],6,1873313359); - d = this.ii(d,a,b,c,x[i + 15],10,-30611744); - c = this.ii(c,d,a,b,x[i + 6],15,-1560198380); - b = this.ii(b,c,d,a,x[i + 13],21,1309151649); - a = this.ii(a,b,c,d,x[i + 4],6,-145523070); - d = this.ii(d,a,b,c,x[i + 11],10,-1120210379); - c = this.ii(c,d,a,b,x[i + 2],15,718787259); - b = this.ii(b,c,d,a,x[i + 9],21,-343485551); - a = this.addme(a,olda); - b = this.addme(b,oldb); - c = this.addme(c,oldc); - d = this.addme(d,oldd); - i += 16; - } - return this.rhex(a) + this.rhex(b) + this.rhex(c) + this.rhex(d); - } - ,ii: function(a,b,c,d,x,s,t) { - return this.cmn(this.bitXOR(c,this.bitOR(b,~d)),a,b,x,s,t); - } - ,hh: function(a,b,c,d,x,s,t) { - return this.cmn(this.bitXOR(this.bitXOR(b,c),d),a,b,x,s,t); - } - ,gg: function(a,b,c,d,x,s,t) { - return this.cmn(this.bitOR(this.bitAND(b,d),this.bitAND(c,~d)),a,b,x,s,t); - } - ,ff: function(a,b,c,d,x,s,t) { - return this.cmn(this.bitOR(this.bitAND(b,c),this.bitAND(~b,d)),a,b,x,s,t); - } - ,cmn: function(q,a,b,x,s,t) { - return this.addme(this.rol(this.addme(this.addme(a,q),this.addme(x,t)),s),b); - } - ,rol: function(num,cnt) { - return num << cnt | num >>> 32 - cnt; - } - ,str2blks: function(str) { - var nblk = (str.length + 8 >> 6) + 1; - var blks = new Array(); - var _g1 = 0, _g = nblk * 16; - while(_g1 < _g) { - var i = _g1++; - blks[i] = 0; - } - var i = 0; - while(i < str.length) { - blks[i >> 2] |= HxOverrides.cca(str,i) << (str.length * 8 + i) % 4 * 8; - i++; - } - blks[i >> 2] |= 128 << (str.length * 8 + i) % 4 * 8; - var l = str.length * 8; - var k = nblk * 16 - 2; - blks[k] = l & 255; - blks[k] |= (l >>> 8 & 255) << 8; - blks[k] |= (l >>> 16 & 255) << 16; - blks[k] |= (l >>> 24 & 255) << 24; - return blks; - } - ,rhex: function(num) { - var str = ""; - var hex_chr = "0123456789abcdef"; - var _g = 0; - while(_g < 4) { - var j = _g++; - str += hex_chr.charAt(num >> j * 8 + 4 & 15) + hex_chr.charAt(num >> j * 8 & 15); - } - return str; - } - ,addme: function(x,y) { - var lsw = (x & 65535) + (y & 65535); - var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return msw << 16 | lsw & 65535; - } - ,bitAND: function(a,b) { - var lsb = a & 1 & (b & 1); - var msb31 = a >>> 1 & b >>> 1; - return msb31 << 1 | lsb; - } - ,bitXOR: function(a,b) { - var lsb = a & 1 ^ b & 1; - var msb31 = a >>> 1 ^ b >>> 1; - return msb31 << 1 | lsb; - } - ,bitOR: function(a,b) { - var lsb = a & 1 | b & 1; - var msb31 = a >>> 1 | b >>> 1; - return msb31 << 1 | lsb; - } - ,__class__: haxe.Md5 -} -haxe.Timer = function(time_ms) { - var me = this; - this.id = window.setInterval(function() { - me.run(); - },time_ms); -}; -haxe.Timer.__name__ = true; -haxe.Timer.delay = function(f,time_ms) { - var t = new haxe.Timer(time_ms); - t.run = function() { - t.stop(); - f(); - }; - return t; -} -haxe.Timer.measure = function(f,pos) { - var t0 = haxe.Timer.stamp(); - var r = f(); - haxe.Log.trace(haxe.Timer.stamp() - t0 + "s",pos); - return r; -} -haxe.Timer.stamp = function() { - return new Date().getTime() / 1000; -} -haxe.Timer.prototype = { - run: function() { - } - ,stop: function() { - if(this.id == null) return; - window.clearInterval(this.id); - this.id = null; - } - ,__class__: haxe.Timer -} -var js = js || {} -js.Boot = function() { } -js.Boot.__name__ = true; -js.Boot.__unhtml = function(s) { - return s.split("&").join("&").split("<").join("<").split(">").join(">"); -} -js.Boot.__trace = function(v,i) { - var msg = i != null?i.fileName + ":" + i.lineNumber + ": ":""; - msg += js.Boot.__string_rec(v,""); - var d; - if(typeof(document) != "undefined" && (d = document.getElementById("haxe:trace")) != null) d.innerHTML += js.Boot.__unhtml(msg) + "
"; else if(typeof(console) != "undefined" && console.log != null) console.log(msg); -} -js.Boot.__clear_trace = function() { - var d = document.getElementById("haxe:trace"); - if(d != null) d.innerHTML = ""; -} -js.Boot.isClass = function(o) { - return o.__name__; -} -js.Boot.isEnum = function(e) { - return e.__ename__; -} -js.Boot.getClass = function(o) { - return o.__class__; -} -js.Boot.__string_rec = function(o,s) { - if(o == null) return "null"; - if(s.length >= 5) return "<...>"; - var t = typeof(o); - if(t == "function" && (o.__name__ || o.__ename__)) t = "object"; - switch(t) { - case "object": - if(o instanceof Array) { - if(o.__enum__) { - if(o.length == 2) return o[0]; - var str = o[0] + "("; - s += "\t"; - var _g1 = 2, _g = o.length; - while(_g1 < _g) { - var i = _g1++; - if(i != 2) str += "," + js.Boot.__string_rec(o[i],s); else str += js.Boot.__string_rec(o[i],s); - } - return str + ")"; - } - var l = o.length; - var i; - var str = "["; - s += "\t"; - var _g = 0; - while(_g < l) { - var i1 = _g++; - str += (i1 > 0?",":"") + js.Boot.__string_rec(o[i1],s); - } - str += "]"; - return str; - } - var tostr; - try { - tostr = o.toString; - } catch( e ) { - return "???"; - } - if(tostr != null && tostr != Object.toString) { - var s2 = o.toString(); - if(s2 != "[object Object]") return s2; - } - var k = null; - var str = "{\n"; - s += "\t"; - var hasp = o.hasOwnProperty != null; - for( var k in o ) { ; - if(hasp && !o.hasOwnProperty(k)) { - continue; - } - if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { - continue; - } - if(str.length != 2) str += ", \n"; - str += s + k + " : " + js.Boot.__string_rec(o[k],s); - } - s = s.substring(1); - str += "\n" + s + "}"; - return str; - case "function": - return ""; - case "string": - return o; - default: - return String(o); - } -} -js.Boot.__interfLoop = function(cc,cl) { - if(cc == null) return false; - if(cc == cl) return true; - var intf = cc.__interfaces__; - if(intf != null) { - var _g1 = 0, _g = intf.length; - while(_g1 < _g) { - var i = _g1++; - var i1 = intf[i]; - if(i1 == cl || js.Boot.__interfLoop(i1,cl)) return true; - } - } - return js.Boot.__interfLoop(cc.__super__,cl); -} -js.Boot.__instanceof = function(o,cl) { - try { - if(o instanceof cl) { - if(cl == Array) return o.__enum__ == null; - return true; - } - if(js.Boot.__interfLoop(o.__class__,cl)) return true; - } catch( e ) { - if(cl == null) return false; - } - switch(cl) { - case Int: - return Math.ceil(o%2147483648.0) === o; - case Float: - return typeof(o) == "number"; - case Bool: - return o === true || o === false; - case String: - return typeof(o) == "string"; - case Dynamic: - return true; - default: - if(o == null) return false; - if(cl == Class && o.__name__ != null) return true; else null; - if(cl == Enum && o.__ename__ != null) return true; else null; - return o.__enum__ == cl; - } -} -js.Boot.__cast = function(o,t) { - if(js.Boot.__instanceof(o,t)) return o; else throw "Cannot cast " + Std.string(o) + " to " + Std.string(t); -} -js.Lib = function() { } -js.Lib.__name__ = true; -js.Lib.debug = function() { - debugger; -} -js.Lib.alert = function(v) { - alert(js.Boot.__string_rec(v,"")); -} -js.Lib.eval = function(code) { - return eval(code); -} -js.Lib.setErrorHandler = function(f) { - js.Lib.onerror = f; -} -var $_; -function $bind(o,m) { var f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; return f; }; -if(Array.prototype.indexOf) HxOverrides.remove = function(a,o) { - var i = a.indexOf(o); - if(i == -1) return false; - a.splice(i,1); - return true; -}; else null; -Math.__name__ = ["Math"]; -Math.NaN = Number.NaN; -Math.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY; -Math.POSITIVE_INFINITY = Number.POSITIVE_INFINITY; -Math.isFinite = function(i) { - return isFinite(i); -}; -Math.isNaN = function(i) { - return isNaN(i); -}; -String.prototype.__class__ = String; -String.__name__ = true; -Array.prototype.__class__ = Array; -Array.__name__ = true; -Date.prototype.__class__ = Date; -Date.__name__ = ["Date"]; -var Int = { __name__ : ["Int"]}; -var Dynamic = { __name__ : ["Dynamic"]}; -var Float = Number; -Float.__name__ = ["Float"]; -var Bool = Boolean; -Bool.__ename__ = ["Bool"]; -var Class = { __name__ : ["Class"]}; -var Enum = { }; -var Void = { __ename__ : ["Void"]}; -if(typeof document != "undefined") js.Lib.document = document; -if(typeof window != "undefined") { - js.Lib.window = window; - js.Lib.window.onerror = function(msg,url,line) { - var f = js.Lib.onerror; - if(f == null) return false; - return f(msg,[url + ":" + line]); - }; -} -com.wiris.js.JsPluginTools.main(); -delete Array.prototype.__class__; }()); -// @codingStandardsIgnoreEnd -/** - * Modal window constructor - * @param {Object} editorAttributes Editor attributes (width, height)... - * @ignore - */ -class ModalWindow { - - constructor(editorAttributes) { - // EditorAtributes - // TODO: Remove the argument: we need to find a way to detect mobile devices - // without known anything about editor. - this.editorAttributes = editorAttributes - - // Metrics - var ua = navigator.userAgent.toLowerCase(); - var isAndroid = ua.indexOf("android") > -1; - var isIOS = ((ua.indexOf("ipad") > -1) || (ua.indexOf("iphone") > -1)); - this.iosSoftkeyboardOpened = false; - this.iosMeasureUnit = ua.indexOf("crios") == -1 ? "%" : "vh"; - this.iosDivHeight = "100" + this.iosMeasureUnit; - - var deviceWidth = window.outerWidth; - var deviceHeight = window.outerHeight; - - var landscape = deviceWidth > deviceHeight; - var portrait = deviceWidth < deviceHeight; - - var editorWidth = editorAttributes.split(' ').join('').split(',')[0].split("=")[1]; - var editorHeight = editorAttributes.split(' ').join('').split(',')[1].split("=")[1]; - - // TODO: Detect isMobile without using editor metrics. - var isMobile = (landscape && editorHeight > deviceHeight) || (portrait && editorWidth > deviceWidth) ? true : false; - - // Device object properties. - - this.deviceProperties = { - orientation : landscape ? 'landscape' : 'portait', - isAndroid : isAndroid ? true : false, - isIOS : isIOS ? true : false, - isMobile : isMobile, - isDesktop : !isMobile && !isIOS && !isAndroid - }; - - this.properties = { - created : false, - state : '', - previousState : '', - position : {bottom: 0, right: 10}, - size : {height: 338, width: 580} - }; - - var attributes = {}; - attributes.class = 'wrs_modal_overlay'; - attributes.id = attributes.class + '_id'; - this.overlay = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_modal_title_bar'; - attributes.id = attributes.class + '_id'; - this.titleBar = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_modal_title'; - attributes.id = attributes.class + '_id'; - this.title = wrs_createElement('div', attributes); - this.title.innerHTML = ''; - - attributes = {}; - attributes.class = 'wrs_modal_close_button'; - attributes.id = attributes.class + '_id'; - attributes.title = _wrs_stringManager.getString('close'); - this.closeDiv = wrs_createElement('a', attributes);; - this.closeDiv.setAttribute('role','button'); - - attributes = {}; - attributes.class = 'wrs_modal_stack_button'; - attributes.id = attributes.class + '_id'; - attributes.title = "Exit full-screen"; - this.stackDiv = wrs_createElement('a', attributes); - this.stackDiv.setAttribute('role','button'); - - attributes = {}; - attributes.class = 'wrs_modal_maximize_button'; - attributes.id = attributes.class + '_id'; - attributes.title = _wrs_stringManager.getString('fullscreen'); - this.maximizeDiv = wrs_createElement('a', attributes); - this.maximizeDiv.setAttribute('role','button'); - - attributes = {}; - attributes.class = 'wrs_modal_minimize_button'; - attributes.id = attributes.class + '_id'; - attributes.title = _wrs_stringManager.getString('minimise'); - this.minimizeDiv = wrs_createElement('a', attributes); - this.minimizeDiv.setAttribute('role','button'); - - attributes = {}; - attributes.class = 'wrs_modal_dialogContainer'; - attributes.id = attributes.class + '_id'; - this.container = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_modal_wrapper'; - attributes.id = attributes.class + '_id'; - this.wrapper = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_content_container'; - attributes.id = attributes.class + '_id'; - this.contentContainer = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_modal_controls'; - attributes.id = attributes.class + '_id'; - this.controls = wrs_createElement('div', attributes); - - attributes = {}; - attributes.class = 'wrs_modal_buttons_container'; - attributes.id = attributes.class + '_id'; - this.buttonContainer = wrs_createElement('div', attributes); - - // Buttons: all button must be created using createSubmitButton method. - this.submitButton = this.createSubmitButton( - { - class: 'wrs_modal_button_accept', - innerHTML: _wrs_stringManager.getString('accept') - }, - this.submitAction.bind(this) - ); - - this.cancelButton = this.createSubmitButton( - { - class: 'wrs_modal_button_cancel', - innerHTML: _wrs_stringManager.getString('cancel') - }, - this.cancelAction.bind(this) - ); - - this.lastImageWasNew = true; - - this.contentManager = null; - - // Overlay popup. - var popupStrings = { - 'cancelString' : _wrs_stringManager.getString('cancel'), - 'submitString' : _wrs_stringManager.getString('close'), - 'message' : _wrs_stringManager.getString('close_modal_warning') - }; - - var callbacks = { - 'closeCallback' : function(){this.close()}.bind(this), - 'cancelCallback' : function(){this.focus()}.bind(this) - } - - var popupupProperties = { - 'overlayElement' : this.container, - 'callbacks' :callbacks, - 'strings': popupStrings - } - - this.popup = new PopUpMessage(popupupProperties); - } - /** - * This method sets the contentElement object. A contentElement object - * manages the logic of modal object content: submit, update, close and changes. - * @param {object} contentManager - * @ignore - */ - setContentManager(contentManager) { - this.contentManager = contentManager; - } - - /** - * Returns the modal contentElement object. - *@returns {object} - *@ignore - */ - getContentManager() { - return this.contentManager; - } - - /** - * This method is called when the modal object has been submited. Calls - * contentElement submitAction method - if exists - and closes the modal - * object. No logic about the content should be placed here, - * contentElement.submitAction is the responsible of the content logic. - * @ignore - */ - submitAction() { - if (typeof this.contentManager.submitAction !== 'undefined') { - this.contentManager.submitAction(); - } - this.close(); - } - - /** - * This method is called when the modal object has been cancelled. If - * contentElement has implemented hasChanges method, a confirm popup - * will be shown if hasChanges returns true. - * @ignore - */ - cancelAction() { - if (typeof this.contentManager.hasChanges === 'undefined') { - this.close(); - } else if (!this.contentManager.hasChanges()){ - this.close(); - } else { - this.showPopUpMessage(); - } - } - - /** - * Returns a submit button. The properties argument admits the following: - * properties { - * 'class' : '', // button class. - * 'innerHTML : '' // button innerHTML. - * } - * @param {Object} properties input button properties. - * @param {Function} callback callback function associated to click event. - * @ignore - */ - createSubmitButton(properties, callback) { - function SubmitButton(properties, callback) { - this.element = document.createElement('button'); - this.element.id = properties.class + '_id'; - this.element.className = properties.class; - this.element.innerHTML = properties.innerHTML; - wrs_addEvent(this.element, 'click', callback); - } - - SubmitButton.prototype.getElement = function() { - return this.element; - } - - return new SubmitButton(properties, callback).getElement(); - } - - /** - * Creates the modal window object inserting a contentElement object. - * @ignore - */ - create() { - - /*Modal Window Structure - _____________________________________________________________________________________ - |wrs_modal_dialog_Container | - | _________________________________________________________________________________ | - | |title_bar minimize_button stack_button close_button | | - | |_______________________________________________________________________________| | - | |wrapper | | - | | _____________________________________________________________________________ | | - | | |content | | | - | | | | | | - | | | | | | - | | |___________________________________________________________________________| | | - | | _____________________________________________________________________________ | | - | | |controls | | | - | | | ___________________________________ | | | - | | | |buttonContainer | | | | - | | | | _______________________________ | | | | - | | | | |button_accept | button_cancel| | | | | - | | | |_|_____________ |______________|_| | | | - | | |___________________________________________________________________________| | | - | |_______________________________________________________________________________| | - |___________________________________________________________________________________|*/ - - this.titleBar.appendChild(this.closeDiv); - this.titleBar.appendChild(this.stackDiv); - this.titleBar.appendChild(this.maximizeDiv); - this.titleBar.appendChild(this.minimizeDiv); - this.titleBar.appendChild(this.title); - - if (this.deviceProperties['isDesktop']) { - this.container.appendChild(this.titleBar); - } - - this.wrapper.appendChild(this.contentContainer); - this.wrapper.appendChild(this.controls); - - this.controls.appendChild(this.buttonContainer); - - this.buttonContainer.appendChild(this.submitButton); - this.buttonContainer.appendChild(this.cancelButton); - - this.container.appendChild(this.wrapper); - - // Check if browser has scrollBar before modal has modified. - this.recalculateScrollBar(); - - document.body.appendChild(this.container); - document.body.appendChild(this.overlay); - - if (this.deviceProperties['isDesktop']) { // Desktop. - this.createModalWindowDesktop(); - this.createResizeButtons(); - - this.addListeners(); - // Maximize window only when the configuration is set and the device is not iOS or Android. - if (_wrs_conf_modalWindowFullScreen) { - this.maximize(); - } - } - else if (this.deviceProperties['isAndroid']) { - this.createModalWindowAndroid(); - } - else if (this.deviceProperties['isIOS'] && !this.deviceProperties['isMobile']) { - this.createModalWindowIos(); - } - - if (this.contentManager != null) { - this.contentManager.insert(this); - } - - this.properties.open = true; - this.properties.created = true; - - // If actual language is arabic modal starts at left of window browser - if (this.isRTL(_wrs_int_langCode)) { - this.container.style.right = window.innerWidth - this.scrollbarWidth - this.container.offsetWidth + 'px'; - } - } - - /** - * Creates a button in the modal object to resize it. - * @ignore - */ - createResizeButtons() { - // This is a definition of Resize Button Bottom-Right - this.resizerBR = document.createElement('div'); - this.resizerBR.className = 'wrs_bottom_right_resizer'; - this.resizerBR.innerHTML = '◢'; - // This is a definition of Resize Button Top-Left - this.resizerTL = document.createElement('div'); - this.resizerTL.className = 'wrs_bottom_left_resizer'; - // Append resize buttons to modal - this.container.appendChild(this.resizerBR); - this.titleBar.appendChild(this.resizerTL); - // Add events to resize on click and drag - wrs_addEvent(this.resizerBR, 'mousedown', this.activateResizeStateBR.bind(this)); - wrs_addEvent(this.resizerTL, 'mousedown', this.activateResizeStateTL.bind(this)); - } - /** - * Method to initialize variables for Bottom-Right resize button - * @param {event} ev mouse - * @ignore - */ - activateResizeStateBR(ev) { - this.initializeResizeProperties(ev, false); - } - - /** - * Method to initialize variables for Top-Left resize button - * @param {event} ev mouse - * @ignore - */ - activateResizeStateTL(ev) { - this.initializeResizeProperties(ev, true); - } - - /** - * Common method to initialize variables at resize - * @param {event} ev mouse - * @ignore - */ - initializeResizeProperties(ev, leftOption) { - // Apply class for disable involuntary select text when drag. - wrs_addClass(document.body, 'wrs_noselect'); - wrs_addClass(this.overlay, 'wrs_overlay_active'); - this.resizeDataObject = { - x: this.eventClient(ev).X, - y: this.eventClient(ev).Y - }; - // Save Initial state of modal to compare on drag and obtain the difference. - this.initialWidth = parseInt(this.container.style.width); - this.initialHeight = parseInt(this.container.style.height); - if (!leftOption) { - this.initialRight = parseInt(this.container.style.right); - this.initialBottom = parseInt(this.container.style.bottom); - } else { - this.leftScale = true; - } - if (!this.initialRight){ - this.initialRight = 0; - } - if (!this.initialBottom){ - this.initialBottom = 0; - } - // Disable mouse events on editor when we start to drag modal. - document.body.style['user-select'] = 'none'; - } - - /** - * This method opens the modal window, restoring the previous state, position and metrics, - * if exists. - * By default the modal object opens in stack mode. - * @ignore - */ - open() { - //Removing close class. - this.removeClass('wrs_closed'); - // Hiding keyboard for mobile devices. - if (this.deviceProperties['isIOS'] || this.deviceProperties['isAndroid'] || this.deviceProperties['isMobile']) { - // Restore scale to 1 - this.restoreWebsiteScale(); - this.blockWebsiteScroll(); - // Due to editor wait we need to wait until editor focus. - setTimeout(function() { this.hideKeyboard() }.bind(this), 400); - } - - // New modal window. He need to create the whole object. - if (!this.properties.created) { - this.create(); - } - else { - // Previous state closed. Open method can be called even the previous state is open, - // for exmample updating the content of the modal object. - if (!this.properties.open) { - this.properties.open = true; - - // Restoring the previous open state: if the modal object has been closed - // re-open it should preserve the state and the metrics. - if (!this.deviceProperties.isAndroid && !this.deviceProperties.isIOS) { - this.restoreState(); - } - } - - // Maximize window only when the configuration is set and the device is not iOs or Android. - if (this.deviceProperties['isDesktop'] && _wrs_conf_modalWindowFullScreen) { - this.maximize(); - } - - // In iOS we need to recalculate the size of the modal object because - // iOS keyboard is a float div which can overlay the modal object. - if (this.deviceProperties['isIOS']) { - this.iosSoftkeyboardOpened = false; - this.setContainerHeight("100" + this.iosMeasureUnit); - } - - // Updating content element. - if (typeof this.contentManager != 'undefined') { - this.contentManager.onOpen(this); - } - } - } - - /** - * Closes modal window and restores viewport header. - * @ignore - */ - close() { - this.removeClass('wrs_maximized'); - this.removeClass('wrs_minimized'); - this.removeClass('wrs_stack'); - this.addClass('wrs_closed'); - this.saveModalProperties(); - this.unblockWebsiteScroll(); - this.properties.open = false; - } - - /** - * It sets the website scale to one. - * @ignore - */ - restoreWebsiteScale() { - let viewportmeta = document.querySelector('meta[name=viewport]'); - // Let the equal symbols in order to search and make meta's final content. - let contentAttrsToUpdate = ['initial-scale=', 'minimum-scale=', 'maximum-scale=']; - let contentAttrsValuesToUpdate = ['1.0', '1.0', '1.0']; - let setMetaAttrFunc = (viewportelement, contentAttrsToUpdate) => { - let contentAttr = viewportelement.getAttribute('content'); - // If it exists, we need to maintain old values and put our values. - if (contentAttr) { - let attrArray = contentAttr.split(','); - let finalContentMeta = ""; - let oldAttrs = []; - for (let i = 0; i < attrArray.length; i++) { - let isAttrToUpdate = false; - let j = 0; - while (!isAttrToUpdate && j < contentAttrsToUpdate.length) { - if (attrArray[i].indexOf(contentAttrsToUpdate[j])) { - isAttrToUpdate = true; - } - - j++; - } - - if (!isAttrToUpdate) { - oldAttrs.push(attrArray[i]); - } - } - - for (let i = 0; i < contentAttrsToUpdate.length; i++) { - let attr = contentAttrsToUpdate[i] + contentAttrsValuesToUpdate[i]; - finalContentMeta += i == 0 ? attr : ',' + attr; - } - - for (let i = 0; i < oldAttrs.length; i++) { - finalContentMeta += ',' + oldAttrs[i]; - } - - viewportelement.setAttribute('content', finalContentMeta); - viewportelement.setAttribute('content', contentAttr); - } - else { - viewportelement.setAttribute('content', 'initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0'); - viewportelement.removeAttribute('content'); - } - }; - - if (!viewportmeta) { - viewportmeta = document.createElement('meta'); - document.getElementsByTagName('head')[0].appendChild(viewportmeta); - setMetaAttrFunc(viewportmeta, contentAttrsToUpdate, contentAttrsValuesToUpdate); - viewportmeta.remove(); - } - else { - setMetaAttrFunc(viewportmeta, contentAttrsToUpdate, contentAttrsValuesToUpdate); - } - - } - - /** - * Adds an event to avoid touchscrolling. - * @ignore - */ - blockWebsiteScroll() { - document.body.addEventListener('touchmove', this.disableTouchMove, {passive: false}); - } - - /** - * Removes the event to avoid touchscrolling. - * @ignore - */ - unblockWebsiteScroll() { - document.body.removeEventListener('touchmove', this.disableTouchMove, {passive: false}); - } - - /** - * Prevents the default event behaviour. - * @param {Object} ev javascript event. - * @ignore. - */ - disableTouchMove(ev) { - ev.preventDefault(); - } - - /** - * Util function to kwnow if browser is internet explorer 11. - * @return {boolean} return true if browser is iexplorer v11 or false in others. - * @ignore - */ - isIE11() { - if (navigator.userAgent.search("Msie/") >= 0 || navigator.userAgent.search("Trident/") >= 0 || navigator.userAgent.search("Edge/") >= 0 ) { - return true; - } - return false; - } - - /** - * @param {string} actual language to check if it's rtl - * @return {boolean} return true if current language is type RTL - * @ignore - */ - isRTL(language) { - if (_wrs_int_langCode == 'ar' || _wrs_int_langCode == 'he') { - return true; - } - return false; - } - /** - * Adds a class to all modal DOM elements. - * @param {string} cls - * @ignore - */ - addClass(cls) { - wrs_addClass(this.overlay, cls); - wrs_addClass(this.titleBar, cls); - wrs_addClass(this.overlay, cls); - wrs_addClass(this.container, cls); - wrs_addClass(this.contentContainer, cls); - wrs_addClass(this.stackDiv, cls); - wrs_addClass(this.minimizeDiv, cls); - wrs_addClass(this.maximizeDiv, cls); - wrs_addClass(this.wrapper, cls); - } - - /** - * Remove a calss from all modal DOM elements. - * @param {string} cls - * @ignore - */ - removeClass(cls) { - wrs_removeClass(this.overlay, cls); - wrs_removeClass(this.titleBar, cls); - wrs_removeClass(this.overlay, cls); - wrs_removeClass(this.container, cls); - wrs_removeClass(this.contentContainer, cls); - wrs_removeClass(this.stackDiv, cls); - wrs_removeClass(this.minimizeDiv, cls); - wrs_removeClass(this.maximizeDiv, cls); - wrs_removeClass(this.wrapper, cls); - } - - /** - * Create modal dialog for desktop. - * @ignore - */ - createModalWindowDesktop() { - this.addClass('wrs_modal_desktop'); - this.stack(); - } - - /** - * Create modal dialog for non mobile android devices. - * @ignore - */ - createModalWindowAndroid() { - this.addClass('wrs_modal_android'); - window.addEventListener('resize', this.orientationChangeAndroidSoftkeyboard.bind(this)); - } - - /** - * Create modal dialog for iOS devices. - * @ignore - */ - createModalWindowIos() { - this.addClass('wrs_modal_ios'); - // Refresh the size when the orientation is changed - window.addEventListener('resize', this.orientationChangeIosSoftkeyboard.bind(this)); - } - - /** - * Restore previous state, position and size of previous stacked modal window - * @ignore - */ - restoreState() { - if (this.properties.state == 'maximized') { - // Reseting states for prevent return to stack state. - this.maximize(); - } else if (this.properties.state == 'minimized') { - // Reseting states for prevent return to stack state. - this.properties.state = this.properties.previousState; - this.properties.previousState = ''; - this.minimize(); - } else { - this.stack(); - } - } - - /** - * Stacks the modal object. - * @ignore - */ - stack() { - this.properties.previousState = this.properties.state; - this.properties.state = 'stack'; - this.removeClass('wrs_maximized'); - this.minimizeDiv.title = "Minimise"; - this.removeClass('wrs_minimized'); - this.addClass('wrs_stack'); - - this.restoreModalProperties(); - - if (typeof this.resizerBR !== 'undefined' && typeof this.resizerTL !== 'undefined') { - this.setResizeButtonsVisibility(); - } - - // Need recalculate position of actual modal because window can was changed in fullscreenmode - this.recalculateScrollBar(); - this.recalculatePosition(); - this.recalculateScale(); - this.focus(); - } - - /** - * Minimizes the modal object - * @ignore - */ - minimize() { - // Saving width, height, top and bottom parameters to restore when open - this.saveModalProperties(); - if (this.properties.state == 'minimized' && this.properties.previousState == 'stack') { - this.stack(); - } - else if (this.properties.state == 'minimized' && this.properties.previousState == 'maximized') { - this.maximize(); - } - else { - // Setting css to prevent important tag into css style - this.container.style.height = "30px"; - this.container.style.width = "250px"; - this.container.style.bottom = "0px"; - this.container.style.right = "10px"; - - this.removeListeners(); - this.properties.previousState = this.properties.state; - this.properties.state = "minimized"; - this.setResizeButtonsVisibility(); - this.minimizeDiv.title = "Maximise"; - - if (wrs_containsClass(this.overlay, 'wrs_stack')) { - this.removeClass('wrs_stack'); - } - else { - this.removeClass('wrs_maximized'); - } - this.addClass('wrs_minimized'); - } - } - - /** - * Maximizes the modal object. - * @ignore - */ - maximize() { - // Saving width, height, top and bottom parameters to restore when open - this.saveModalProperties(); - if (this.properties.state != 'maximized') { - this.properties.previousState = this.properties.state; - this.properties.state = 'maximized'; - } - // Don't permit resize on maximize mode. - this.setResizeButtonsVisibility(); - - if (wrs_containsClass(this.overlay, 'wrs_minimized')) { - this.minimizeDiv.title = "Minimise"; - this.removeClass('wrs_minimized'); - } - else if (wrs_containsClass(this.overlay, 'wrs_stack')) { - this.container.style.left = null; - this.container.style.top = null; - this.removeClass('wrs_stack'); - } - - this.addClass('wrs_maximized'); - - // Set size to 80% screen with a max size. - this.setSize(parseInt(window.innerHeight * 0.8) , parseInt(window.innerWidth * 0.8)); - var sizeModificated = false; - if (this.container.clientHeight > 700) { - this.container.style.height = '700px'; - sizeModificated = true; - } - if (this.container.clientWidth > 1200) { - this.container.style.width = '1200px'; - sizeModificated = true; - } - - // Setting modal position in center on screen. - this.setPosition(window.innerHeight / 2 - this.container.offsetHeight / 2, window.innerWidth / 2 - this.container.offsetWidth / 2); - this.recalculateScale(); - this.recalculatePosition(); - this.recalculateSize(); - this.focus(); - } - - /** - * Sets modal size. - * @param {integer} height set a height of modal with an integer - * @param {integer} width set a width of modal with an integer - * @ignore - */ - setSize(height, width) { - this.container.style.height = height + 'px'; - this.container.style.width = width + 'px'; - this.recalculateSize(); - } - - /** - * Sets modal position. - * @param {integer} bottom set a bottom of div modal with an integer - * @param {integer} right set a right of div modal with an integer - * @ignore - */ - setPosition(bottom, right) { - this.container.style.bottom = bottom + 'px'; - this.container.style.right = right + 'px'; - } - - /** - * Saves actual parameters of open modal object (like size and position...) to restore it - * once the modal object is re-opened. - * @ignore - */ - saveModalProperties() { - // Saving values of modal only when modal is in stack state. - if (this.properties.state == 'stack') { - this.properties.position.bottom = parseInt(this.container.style.bottom); - this.properties.position.right = parseInt(this.container.style.right); - this.properties.size.width = parseInt(this.container.style.width); - this.properties.size.height = parseInt(this.container.style.height); - } - } - - /** - * Restore previous parameters values of closed modal (like size and position) and apply this parameters in actual modal. - * @ignore - */ - restoreModalProperties() { - if (this.properties.state == 'stack') { - // Restoring Bottom and Right values from last modal - this.setPosition(this.properties.position.bottom, this.properties.position.right); - // Restoring Height and Left values from last modal - this.setSize(this.properties.size.height, this.properties.size.width); - } - } - - /** - * Set modal size. - * @ignore - */ - recalculateSize() { - this.wrapper.style.width = this.container.clientWidth - 12 + 'px'; - this.wrapper.style.height = this.container.clientHeight - 38 + 'px'; - this.contentContainer.style.height = parseInt(this.wrapper.offsetHeight - 50) + 'px'; - } - - /** - * Active and disable visibility of resize buttons in modal window depend on state. - * @ignore - */ - setResizeButtonsVisibility() { - if (this.properties.state == 'stack') { - this.resizerTL.style.visibility = 'visible'; - this.resizerBR.style.visibility = 'visible'; - } - else { - this.resizerTL.style.visibility = 'hidden'; - this.resizerBR.style.visibility = 'hidden'; - } - } - - /** - * Makes an object draggable adding mouse and touch events. - * @ignore - */ - addListeners() { - // Button events (maximize, minimize, stack and close). - this.maximizeDiv.addEventListener('click', this.maximize.bind(this), true); - this.stackDiv.addEventListener('click', this.stack.bind(this), true); - this.minimizeDiv.addEventListener('click', this.minimize.bind(this), true); - this.closeDiv.addEventListener('click', this.cancelAction.bind(this)); - - // Mouse events. - wrs_addEvent(window, 'mousedown', this.startDrag.bind(this)); - wrs_addEvent(window, 'mouseup', this.stopDrag.bind(this)); - wrs_addEvent(window, 'mousemove', this.drag.bind(this)); - wrs_addEvent(window, 'resize', this.onWindowResize.bind(this)); - // Key events. - wrs_addEvent(window, 'keydown', this.onKeyDown.bind(this)); - } - - /** - * Removes draggable events from an object. - * @ignore - */ - removeListeners() { - // Mouse events. - wrs_removeEvent(window, 'mousedown', this.startDrag); - wrs_removeEvent(window, 'mouseup', this.stopDrag); - wrs_removeEvent(window, 'mousemove', this.drag); - wrs_removeEvent(window, 'resize', this.onWindowResize); - // Key events - wrs_removeEvent(window, 'keydown', this.onKeyDown); - } - - - /** - * Returns mouse or touch coordinates (on touch events ev.ClientX doesn't exists) - * @param {event} ev mouse or touch event - * @return {object} with the X and Y coordinates. - * @ignore - */ - eventClient(ev) { - if (typeof(ev.clientX) == 'undefined' && ev.changedTouches) { - var client = { - X : ev.changedTouches[0].clientX, - Y : ev.changedTouches[0].clientY - }; - return client; - } - else { - client = { - X : ev.clientX, - Y : ev.clientY - }; - return client; - } - } - - /** - * Start drag function: set the object dragDataObject with the draggable object offsets coordinates. - * when drag starts (on touchstart or mousedown events). - * - * @param {event} ev touchstart or mousedown event. - * @ignore - */ - startDrag(ev) { - if (this.properties.state == 'minimized') { - return; - } - if (ev.target.className == 'wrs_modal_title') { - if(typeof this.dragDataObject === 'undefined' || this.dragDataObject === null) { - ev = ev || event; - // Save first click mouse point on screen - this.dragDataObject = { - x: this.eventClient(ev).X, - y: this.eventClient(ev).Y - }; - // Reset last drag position when start drag - this.lastDrag = { - x: "0px", - y: "0px" - }; - // Init right and bottom values for window modal if it isn't exist. - if(this.container.style.right == ''){ - this.container.style.right = "0px"; - } - if(this.container.style.bottom == ''){ - this.container.style.bottom = "0px"; - } - - // Needed for IE11 for apply disabled mouse events on editor because iexplorer need a dinamic object to apply this property. - if (this.isIE11()) { - // this.iframe.style['position'] = 'relative'; - } - // Apply class for disable involuntary select text when drag. - wrs_addClass(document.body, 'wrs_noselect'); - wrs_addClass(this.overlay, 'wrs_overlay_active'); - // Obtain screen limits for prevent overflow. - this.limitWindow = this.getLimitWindow(); - } - } - - } - - /** - * UpdatesdragDataObject with the draggable object coordinates when the draggable object is being moved. - * - * @param {event} ev touchmouve or mousemove events. - * @ignore - */ - drag(ev) { - if (this.dragDataObject) { - ev.preventDefault(); - ev = ev || event; - // Calculate max and min between actual mouse position and limit of screeen. It restric the movement of modal into window. - var limitY = Math.min(this.eventClient(ev).Y + window.pageYOffset,this.limitWindow.minPointer.y + window.pageYOffset); - limitY = Math.max(this.limitWindow.maxPointer.y + window.pageYOffset,limitY); - var limitX = Math.min(this.eventClient(ev).X + window.pageXOffset,this.limitWindow.minPointer.x + window.pageXOffset); - limitX = Math.max(this.limitWindow.maxPointer.x + window.pageXOffset,limitX); - // Substract limit with first position to obtain relative pixels increment to the anchor point. - var dragX = limitX - this.dragDataObject.x + "px"; - var dragY = limitY - this.dragDataObject.y + "px"; - // Save last valid position of modal before window overflow. - this.lastDrag = { - x: dragX, - y:dragY - }; - // This move modal with hadware acceleration. - this.container.style.transform = "translate3d(" + dragX + "," + dragY + ",0)"; - } - if (this.resizeDataObject) { - var limitX = Math.min(this.eventClient(ev).X,window.innerWidth - this.scrollbarWidth - 7); - var limitY = Math.min(this.eventClient(ev).Y,window.innerHeight - 7); - if (limitX < 0) { - limitX = 0; - } - - if (limitY < 0) { - limitY = 0; - } - - var scaleMultiplier; - if (this.leftScale) { - scaleMultiplier = -1; - } - else { - scaleMultiplier = 1; - } - this.container.style.width = this.initialWidth + scaleMultiplier * (limitX - this.resizeDataObject.x) + 'px'; - this.container.style.height = this.initialHeight + scaleMultiplier * (limitY - this.resizeDataObject.y) + 'px'; - if (!this.leftScale) { - if (this.resizeDataObject.x - limitX - this.initialWidth < -580) { - this.container.style.right = this.initialRight - (limitX - this.resizeDataObject.x) + 'px'; - } - else { - this.container.style.right = this.initialRight + this.initialWidth - 580 + "px"; - this.container.style.width = "580px"; - } - if (this.resizeDataObject.y - limitY < this.initialHeight - 338) { - this.container.style.bottom = this.initialBottom - (limitY - this.resizeDataObject.y) + 'px'; - } - else { - this.container.style.bottom = this.initialBottom + this.initialHeight - 338 + "px"; - this.container.style.height = "338px"; - } - } - this.recalculateScale(); - this.recalculatePosition(); - } - } - /** - * Get limits of actual window to limit modal movement - * @return {Object} Object containing mouseX and mouseY are coordinates of actual mouse on screen. - * @ignore - */ - getLimitWindow() { - // Obtain dimentions of window page. - var maxWidth = window.innerWidth; - var maxHeight = window.innerHeight; - - // Calculate relative position of mouse point into window. - var offSetToolbarY = (this.container.offsetHeight + parseInt(this.container.style.bottom)) - (maxHeight - (this.dragDataObject.y - window.pageXOffset)); - var offSetToolbarX = maxWidth - this.scrollbarWidth - (this.dragDataObject.x - window.pageXOffset) - parseInt(this.container.style.right); - - // Calculate limits with sizes of window, modal and mouse position. - var minPointerY = maxHeight - this.container.offsetHeight + offSetToolbarY; - var maxPointerY = this.title.offsetHeight - (this.title.offsetHeight - offSetToolbarY); - var minPointerX = maxWidth - offSetToolbarX - this.scrollbarWidth; - var maxPointerX = (this.container.offsetWidth - offSetToolbarX); - var minPointer = {x: minPointerX,y: minPointerY}; - var maxPointer = {x: maxPointerX,y: maxPointerY}; - return {minPointer : minPointer, maxPointer:maxPointer}; - } - /** - * Get Scrollbar width size of browser - * @ignore - */ - getScrollBarWidth() { - // Create a paragraph with full width of page. - var inner = document.createElement('p'); - inner.style.width = "100%"; - inner.style.height = "200px"; - - // Create a hidden div to compare sizes. - var outer = document.createElement('div'); - outer.style.position = "absolute"; - outer.style.top = "0px"; - outer.style.left = "0px"; - outer.style.visibility = "hidden"; - outer.style.width = "200px"; - outer.style.height = "150px"; - outer.style.overflow = "hidden"; - outer.appendChild(inner); - - document.body.appendChild(outer); - var widthOuter = inner.offsetWidth; - - // Change type overflow of paragraph for measure scrollbar. - outer.style.overflow = 'scroll'; - var widthInner = inner.offsetWidth; - - // If measure is the same, we compare with internal div. - if (widthOuter == widthInner) { - widthInner = outer.clientWidth; - } - document.body.removeChild(outer); - - return (widthOuter - widthInner); - } - - /** - * Set the dragDataObject to null when the drag finish (touchend or mouseup events). - * - * @param {event} ev touchend or mouseup event. - * @ignore - */ - stopDrag(ev) { - // Due to we have multiple events that call this function, we need only to execute the next modifiers one time, - // when the user stops to drag and dragDataObject is not null (the object to drag is attached). - if (this.dragDataObject || this.resizeDataObject) { - // If modal doesn't change, it's not necessary to set position with interpolation - this.container.style.transform = ''; - if (this.dragDataObject) { - this.container.style.right = parseInt(this.container.style.right) - parseInt(this.lastDrag.x) + pageXOffset + "px"; - this.container.style.bottom = parseInt(this.container.style.bottom) - parseInt(this.lastDrag.y) + pageYOffset + "px"; - } - // We make focus on editor after drag modal windows to prevent lose focus. - this.focus(); - // Restore mouse events on iframe - // this.iframe.style['pointer-events'] = 'auto'; - document.body.style['user-select'] = ''; - // Restore static state of iframe if we use iexplorer - if (this.isIE11()) { - // this.iframe.style['position'] = null; - } - // Active text select event - wrs_removeClass(document.body, 'wrs_noselect'); - wrs_removeClass(this.overlay, 'wrs_overlay_active'); - } - this.dragDataObject = null; - this.resizeDataObject = null; - this.initialWidth = null; - this.leftScale = null; - } - - /** - * Recalculating scale for modal when resize browser window * - * @ignore - */ - onWindowResize() { - this.recalculateScrollBar(); - this.recalculatePosition(); - this.recalculateScale(); - } - - /** - * Keydown events: - * Esc key close modal window. - * Tab key tab to submit button. - * @param {event} ev - */ - onKeyDown(ev) { - if (ev.key !== undefined && ev.repeat === false) { - // Code for detect Esc event - if (ev.key === "Escape" || ev.key === 'Esc') { - if (this.properties.open) { - this.cancelAction(); - } - } - // Code for detect Tab event - if (ev.key === "Tab") { - this.submitButton.focus(); - ev.preventDefault(); - } - } - } - /** - * Recalculating position for modal when resize browser window - * @ignore - */ - recalculatePosition() { - this.container.style.right = Math.min(parseInt(this.container.style.right), window.innerWidth - this.scrollbarWidth - this.container.offsetWidth) + "px"; - if(parseInt(this.container.style.right) < 0) { - this.container.style.right = "0px"; - } - this.container.style.bottom = Math.min(parseInt(this.container.style.bottom), window.innerHeight - this.container.offsetHeight) + "px"; - if(parseInt(this.container.style.bottom) < 0) { - this.container.style.bottom = "0px"; - } - } - - /** - * Recalculating scale for modal when resize browser window - * @ignore - */ - recalculateScale() { - var sizeModificated = false; - if (parseInt(this.container.style.width) > 580) { - this.container.style.width = Math.min(parseInt(this.container.style.width), window.innerWidth - this.scrollbarWidth) + "px"; - sizeModificated = true; - } - else { - this.container.style.width = "580px"; - sizeModificated = true; - } - if (parseInt(this.container.style.height) > 338) { - this.container.style.height = Math.min(parseInt(this.container.style.height), window.innerHeight) + "px"; - sizeModificated = true; - } - else { - this.container.style.height = "338px"; - sizeModificated = true; - } - if (sizeModificated) { - this.recalculateSize(); - } - } - - /** - * Recalculating width of scrollBar browser - * @ignore - */ - recalculateScrollBar() { - this.hasScrollBar = window.innerWidth > document.documentElement.clientWidth; - if(this.hasScrollBar){ - this.scrollbarWidth = this.getScrollBarWidth(); - } - else { - this.scrollbarWidth = 0; - } - } - - /** - * Hide soft keyboards on IOS systems. - * @ignore - */ - hideKeyboard() { - document.activeElement.blur(); - } - - /** - * Focus to content object - * @ignore - */ - focus() { - if (this.contentManager != null && typeof this.contentManager.onFocus !== 'undefined') { - this.contentManager.onFocus(); - } - } - - /** - * Returns true when the device is on portrait mode. - * @ignore - */ - portraitMode() { - return window.innerHeight > window.innerWidth; - } - - /** - * Change container sizes when the keyboard is opened on iOS. - * @ignore - */ - openedIosSoftkeyboard() { - if (!this.iosSoftkeyboardOpened && this.iosDivHeight != null && this.iosDivHeight == "100" + this.iosMeasureUnit) { - if (this.portraitMode()) { - this.setContainerHeight("63" + this.iosMeasureUnit); - } - else { - this.setContainerHeight("40" + this.iosMeasureUnit); - } - } - this.iosSoftkeyboardOpened = true; - } - - /** - * Change container sizes when the keyboard is closed on iOS. - * @ignore - */ - closedIosSoftkeyboard() { - this.iosSoftkeyboardOpened = false; - this.setContainerHeight("100" + this.iosMeasureUnit); - } - - /** - * Change container sizes when orientation is changed on iOS. - * @ignore - */ - orientationChangeIosSoftkeyboard() { - if (this.iosSoftkeyboardOpened) { - if (this.portraitMode()) { - this.setContainerHeight("63" + this.iosMeasureUnit); - } - else { - this.setContainerHeight("40" + this.iosMeasureUnit); - } - } - else { - this.setContainerHeight("100" + this.iosMeasureUnit); - } - } - - /** - * Change container sizes when orientation is changed on Android. - * @ignore - */ - orientationChangeAndroidSoftkeyboard() { - this.setContainerHeight("100%"); - } - - /** - * Set iframe container height. - * @ignore - */ - setContainerHeight(height) { - this.iosDivHeight = height; - this.wrapper.style.height = height; - // this.editor.getElement().style.height = (this.container.offsetHeight -10) - this.controlsDiv.offsetHeight + 'px'; - } - - /** - * Check content of editor before close action - * @ignore - */ - showPopUpMessage() { - if (this.properties.state == 'minimized') { - this.stack(); - } - this.popup.show(); - } - - setTitle(title) { - this.title.innerHTML = title; - } -} -/** - * This class shows a dialog message overlaying a dom element in order to - * accept / cancel discart changes. The dialog can be closed i.e the overlay dissapears - * o canceled. In this last case a callback function should be called. - * - * The constructor accepts the following attributes object: - * { - * overlayElement: '', Element to be overlayed. - * callbacks: { - * 'closeCallback' : function(), // Callback function to be called if the dialog is closed. - * 'cancelCallback' : function() // Callback function to be called if the dialog is cancelled - * strings: { - * 'submitString' : '', // Submit button string - * 'cancelString : ''. // Cancel button string - * 'message': '' // Message string - * } - * } - * @param {object} popupProperties - */ -class PopUpMessage { - - constructor(popupProperties) { - this.overlay = popupProperties.overlayElement; - this.callbacks = popupProperties.callbacks; - this.overlayEnvolture = this.overlay.appendChild(document.createElement("div")); - this.overlayEnvolture.setAttribute("class", "wrs_popupmessage_overlay_envolture"); - - this.message = this.overlayEnvolture.appendChild(document.createElement("div")); - this.message.id = "wrs_popupmessage" - this.message.setAttribute("class", "wrs_popupmessage_panel"); - this.message.innerHTML = popupProperties.strings.message; - - var overlay = this.overlayEnvolture.appendChild(document.createElement("div")); - overlay.setAttribute("class", "wrs_popupmessage_overlay"); - // We create a overlay that close popup message on click in there - overlay.addEventListener("click", this.cancelAction.bind(this)); - - this.buttonArea = this.message.appendChild(document.createElement('div')); - this.buttonArea.setAttribute("class", "wrs_popupmessage_button_area"); - this.buttonArea.id = 'wrs_popup_button_area'; - - // Buttons creation - var buttonSubmitArguments = { - class: "wrs_button_accept", - innerHTML: popupProperties.strings.submitString, - id: 'wrs_popup_accept_button' - }; - this.acceptButton = this.createButton(buttonSubmitArguments, this.closeAction.bind(this)); - this.buttonArea.appendChild(this.acceptButton); - - var buttonCancelArguments = { - class: "wrs_button_cancel", - innerHTML: popupProperties.strings.cancelString, - id: 'wrs_popup_cancel_button' - }; - this.cancelButton = this.createButton(buttonCancelArguments, this.cancelAction.bind(this)); - this.buttonArea.appendChild(this.cancelButton); - } - - /** - * This method create a button with arguments and return button dom object - * @param {object} parameters An object containg id, class and innerHTML button text. - * @param {object} callback Callback method to call on click event. - */ - createButton(parameters, callback) { - function popUpButton(parameters) { - this.element = document.createElement("button"); - this.element.setAttribute("id", parameters.id); - this.element.setAttribute("class", parameters.class); - this.element.innerHTML = parameters.innerHTML; - this.element.addEventListener("click", callback); - } - - popUpButton.prototype.getElement = function() { - return this.element; - } - - return new popUpButton(parameters).getElement(); - } - - /** - * This method show the popupmessage containing a message, and two buttons - * to cancel the action or close the modal dialog. - */ - show() { - if (this.overlayEnvolture.style.display != 'block') { - // Clear focus with blur for prevent press anykey - document.activeElement.blur(); - - // For works with Safari - window.focus(); - this.overlayEnvolture.style.display = 'block'; - } - else { - this.overlayEnvolture.style.display = 'none'; - _wrs_modalWindow.focus(); - } - } - - /** - * This method cancel the popupMessage: the dialog dissapears revealing the overlaid element. - * A callback method is called (if defined). For example a method to focus the overlaid element. - */ - cancelAction() { - this.overlayEnvolture.style.display = 'none'; - if (typeof this.callbacks.cancelCallback !== 'undefined') { - this.callbacks.cancelCallback(); - } - } - - /** - * This method closes the popupMessage: the dialog dissapears and the close callback is called. - * For example to close the overlaid element. - */ - closeAction() { - this.cancelAction(); - if (typeof this.callbacks.closeCallback !== 'undefined') { - this.callbacks.closeCallback(); - } - } -}/** - * This class implements ModalContent interface. Manage the following: - * - insertion in modal object (insert(modalObject) method) - * - actions to be done once the modal object has been submited (submitAction() method) - * - updates itself when modalObject is updated with a re-open action for example (update(modalObject) method) - * - comunicates to modalObject if some changes have be done (hasChanges() method) - * - * @param {object} editorAttributes editor attributes. See http://docs.wiris.com/en/mathtype/mathtype_web/sdk-api/parameters - * for further information. - * @ignore - */ -class contentManager { - // Editor listener. - constructor(editorAttributes) { - this.editorListener = new EditorListener(); - this.editor = null; - this.editorAttributes = editorAttributes; - this.lastImageWasNew = false; - // Device properties - var ua = navigator.userAgent.toLowerCase(); - this.deviceProperties = {}; - this.deviceProperties.isAndroid = ua.indexOf("android") > -1; - this.deviceProperties.isIOS = ((ua.indexOf("ipad") > -1) || (ua.indexOf("iphone") > -1)); - // Toolbar - this.toolbar = null; - this.loadEditor(); - } - - /** - * Mandatory method: inserts editor into modal object content container. - * @param {object} modalObject - * @ignore - */ - insert(modalObject) { - // Before insert the editor we update the modal object title to avoid weird render display. - this.updateTitle(modalObject); - this.insertEditor(modalObject); - } - - /** - * Method to insert MathType into modal object. This method - * watis until editor JavaScript is loaded to insert the editor into - * contentContainer modal object element. - * @ignore - */ - insertEditor(modalObject) { - // To know if editor JavaScript is loaded we need to wait until com.wiris.jsEditor namespace is ready. - if ('com' in window && 'wiris' in window.com && 'jsEditor' in window.com.wiris) { - this.editor = com.wiris.jsEditor.JsEditor.newInstance(this.editorAttributes); - this.editor.insertInto(modalObject.contentContainer); - this.editor.focus(); - // Setting div in rtl in case of it's activated. - if (this.editor.getEditorModel().isRTL()) { - this.editor.element.style.direction = 'rtl'; - } - - // Editor listener: this object manages the changes logic of editor. - this.editor.getEditorModel().addEditorListener(this.editorListener); - - // iOS events. - if (modalObject.deviceProperties['isIOS']) { - setTimeout(function() { _wrs_modalWindow.hideKeyboard() }, 400); - var formulaDisplayDiv = document.getElementsByClassName('wrs_formulaDisplay')[0]; - wrs_addEvent(formulaDisplayDiv, 'focus', modalObject.openedIosSoftkeyboard.bind(modalObject)); - wrs_addEvent(formulaDisplayDiv, 'blur', modalObject.closedIosSoftkeyboard.bind(modalObject)); - } - - this.onOpen(modalObject); - } else { - setTimeout(contentManager.prototype.insertEditor.bind(this, modalObject), 100); - } - } - - /** - * Loads MathType ediitor JavaScript. - * @ignore - */ - loadEditor() { - var queryParams = window.location.search.substring(1).split("&"); - var version = ""; - for (var i = 0; i < queryParams.length; i++) { - var pos = queryParams[i].indexOf("v="); - if (pos >= 0) { - version = queryParams[i].substring(2); - } - } - - var script = document.createElement('script'); - script.type = 'text/javascript'; - var editorUrl = _wrs_conf_editorUrl; - // Change to https if necessary. - // We create an object url for parse url string and work more efficiently. - var urlObject = document.createElement('a'); - urlObject.href = editorUrl; - - if (window.location.href.indexOf("https://") == 0) { - // It check if browser is https and configuration is http. If this is so, we will replace protocol. - if (urlObject.protocol == 'http:') { - urlObject.protocol = 'https:'; - } - } - - // Check protocol and remove port if it's standard. - if (urlObject.port == '80' || urlObject.port == '443') { - editorUrl = urlObject.protocol + '//' + urlObject.hostname + '/' + urlObject.pathname; - } else { - editorUrl = urlObject.protocol + '//' + urlObject.hostname + ':' + urlObject.port + '/' + urlObject.pathname; - } - - // Editor stats. - var statEditor = _wrs_conf_editor; - var statSaveMode = _wrs_conf_saveMode; - var statVersion = _wrs_conf_version; - - script.src = editorUrl + "?lang=" + _wrs_int_langCode + '&stats-editor=' + statEditor + '&stats-mode=' + statSaveMode + '&stats-version=' + statVersion; - document.getElementsByTagName('head')[0].appendChild(script); - } - - /** - * Set the editor initial content: an existing formula or a blank MathML - */ - setInitialContent() { - if (!_wrs_isNewElement) { - var mathml = wrs_mathmlDecode(_wrs_temporalImage.getAttribute(_wrs_conf_imageMathmlAttribute)); - this.setMathML(mathml); - } - } - - /** - * Set a MathML into editor. - * @param {string} mathml MathML string. - * @param {bool} focusDisabled if true editor don't get focus after the MathML is set. false by default. - * @ignore - */ - setMathML(mathml, focusDisabled) { - // By default focus is enabled - if (typeof focusDisabled === 'undefined') { - focusDisabled = false; - } - // Using setMathML method is not a change produced by the user but for the API - // so we set to false the contentChange property of editorListener. - this.editor.setMathMLWithCallback(mathml, function() { - this.editorListener.setWaitingForChanges(true); - }.bind(this)); - // We need to wait a little until the callback finish. - setTimeout(function(){ - this.editorListener.setIsContentChanged(false);}.bind(this), 500); - - // In some scenarios - like closing modal object - editor mustn't be focused. - if (!focusDisabled){ - this.onFocus(); - } - } - - /** - * Set focus on editor. - * @ignore - */ - onFocus() { - // TODO: Check editor avaliable. - if (typeof this.editor !== 'undefined' && this.editor != null) { - this.editor.focus(); - } - } - - /** - * Mandatory method: modal object calls this method to execute a callback action - * on submit. - * This method updates the edition area (inserting a new formula or update an older one), - * and focus the edition area too. - * @ignore - */ - submitAction() { - var mathML = this.editor.getMathML(); - // Add class for custom editors. - if (wrs_int_getCustomEditorEnabled() != null) { - mathML = wrs_mathmlAddEditorAttribute(mathML); - } - var mathmlEntitiesEncoded = wrs_mathmlEntities(mathML); - wrs_int_updateFormula(mathmlEntitiesEncoded, null, _wrs_int_langCode); - wrs_int_disableCustomEditors(); - wrs_int_notifyWindowClosed(); - _wrs_editMode = (window._wrs_conf_defaultEditMode) ? _wrs_conf_defaultEditMode : 'images'; - - // Set disabled focus to prevent lost focus. - this.setEmptyMathML(); - wrs_int_disableCustomEditors(); - // Reconvering editing area focus. - setTimeout( - function() { - if (typeof _wrs_currentEditor !== 'undefined' && _wrs_currentEditor) { - _wrs_currentEditor.focus(); - } - }, 100); - } - - /** - * Set an empty MathML into the editor in order to clean the edit area. - * @ignore - */ - setEmptyMathML() { - // As second argument we pass - if (this.deviceProperties.isAndroid || this.deviceProperties.isIOS) { - // We need to set a empty annotation in order to maintain editor in Hand mode. - // Adding dir rtl in case of it's activated. - if (this.editor.getEditorModel().isRTL()) { - this.setMathML('[]"', true); - }else{ - this.setMathML('[]"', true); - } - } else { - if (this.editor.getEditorModel().isRTL()) { - this.setMathML('', true); - }else{ - this.setMathML('', true); - } - } - } - - /** - * Mandatory method: modal object calls this method when is updated, for example re-editing a formula when the - * editor is open with another formula. This method updates the editor content (with an empty MathML or an exising formula), - * updates - if needed - the editor toolbar (math --> chem or chem --> math) and recover the focus. - * @param {object} modalObject - * @ignore - */ - onOpen(modalObject) { - if (_wrs_isNewElement) { - this.setEmptyMathML(); - this.lastImageWasNew = true; - } - else { - this.setMathML(wrs_mathmlDecode(_wrs_temporalImage.getAttribute(_wrs_conf_imageMathmlAttribute))); - this.lastImageWasNew = false; - } - this.updateToolbar(modalObject); - this.onFocus(); - } - - /** - * Sets the correct toolbar depending if exist other custom toolbars at the same time (e.g: Chemistry) - * @ignore - */ - updateToolbar(modalObject) { - this.updateTitle(modalObject); - var customEditor; - if (customEditor = wrs_int_getCustomEditorEnabled()) { - var toolbar = customEditor.toolbar ? customEditor.toolbar : _wrs_int_wirisProperties['toolbar']; - if (this.toolbar == null || this.toolbar != toolbar) { - this.setToolbar(toolbar); - } - } else { - var toolbar = this.getToolbar(); - if (this.toolbar == null || this.toolbar != toolbar) { - this.setToolbar(toolbar); - wrs_int_disableCustomEditors(); - } - } - } - /** - * Updates the modalObject title: if a custom editor (with a custom toolbar) is enabled - * picks the custom editor title. Otherwise default title. - * @param {object} modalObject - * @ignore - */ - updateTitle(modalObject) { - var customEditor; - if (customEditor = wrs_int_getCustomEditorEnabled()) { - modalObject.setTitle(customEditor.title); - } else { - modalObject.setTitle('MathType'); - } - } - /** - * Returns toolbar depending on the configuration local or serverside. - * @ignore - */ - getToolbar() { - var toolbar = (typeof _wrs_conf_editorParameters == 'undefined' || typeof _wrs_conf_editorParameters['toolbar'] == 'undefined') ? 'general' : _wrs_conf_editorParameters['toolbar']; - if(toolbar == 'general'){ - toolbar = (typeof _wrs_int_wirisProperties == 'undefined' || typeof _wrs_int_wirisProperties['toolbar'] == 'undefined') ? 'general' : _wrs_int_wirisProperties['toolbar']; - } - return toolbar; - } - - /** - * Set a toolbar into editor. - * @param {string} toolbar toolbar name. - * @ignore - */ - setToolbar(toolbar) { - this.toolbar = toolbar; - this.editor.setParams({'toolbar': this.toolbar}); - } - - /** - * Returns true if the content of the editor has been changed. The logic of the changes - * is delegated to editorListener object. - * @ignore - */ - hasChanges() { - return (!this.editor.isFormulaEmpty() && this.editorListener.getIsContentChanged()); - } -} -/** - * EditorListener class. This class implement EditorListener interface - * and contains the logic to determine if editor has been changed or not. - * @ignore - */ -class EditorListener { - constructor() { - this.isContentChanged = false; - this.waitingForChanges = false; - } - - /** - * EditorListener method set if content is changed - * @ignore - */ - setIsContentChanged (value) { - this.isContentChanged = value; - }; - /** - * EditorListener method to get if content is changed - * @ignore - */ - getIsContentChanged (value) { - return this.isContentChanged; - }; - /** - * EditorListener method to wait changes - * @ignore - */ - setWaitingForChanges (value) { - this.waitingForChanges = value; - }; - /** - * EditorListener method to overwrite - * @ignore - */ - caretPositionChanged (editor) {}; - /** - * EditorListener method to overwrite - * @ignore - */ - clipboardChanged (editor) {}; - /** - * EditorListener method to set if content is changed - * @ignore - */ - contentChanged (editor) { - if (this.waitingForChanges === true && this.isContentChanged === false) { - this.isContentChanged = true; - } - } - /** - * EditorListener method to overwrite - * @ignore - */ - styleChanged (editor) {}; - /** - * EditorListener method to overwrite - * @ignore - */ - transformationReceived (editor) {} -}// TODO: Methods to static? -/** - * StringManager class to use strings in code correctly with control. - * @ignore - */ -class StringManager { - constructor() { - // Strings are empty when it creates, it set when calls load method. - this.strings = null; - this.stringsLoaded = false; - } - - /** - * This method return a string passing a key. - * @param {string} key of array strings that you want. - * @return string A text that you want or key if it doesn't exist. - * @ignore - */ - getString(key) { - // Wait 200ms and recall this method if strings aren't load. - if (!this.stringsLoaded) { - setTimeout(this.getString.bind(this, key), 100); - return; - } - if (key in this.strings) { - return this.strings[key]; - } - return key; - } - /** - * This method load all strings to the manager and unset it for prevent bad usage. - * @param {array} String array of language - * @ignore - */ - loadStrings(langStrings) { - if (!this.stringsLoaded) { - this.strings = langStrings; - // Activate variable to unlock getStrings - this.stringsLoaded = true; - } - } -}var _wrs_conf_core_loaded = true; diff --git a/core/global.js b/core/global.js new file mode 100644 index 00000000..563a4197 --- /dev/null +++ b/core/global.js @@ -0,0 +1,23 @@ +import Core from './src/core.src.js'; +import Parser from './src/parser.js'; +import Util from './src/util.js'; +import Image from './src/image.js'; +import Configuration from './src/configuration.js'; +import Listeners from './src/listeners'; +import backwardsLib from './src/backwardslib.js'; +import polyfills from './src/polyfills.js'; +import IntegrationModel from './src/integrationmodel.js'; +import MathML from './src/mathml.js'; +import './styles.src.css'; + +// Expose WirisPlugin variable to the window. +window.WirisPlugin = { + Core: Core, + Parser: Parser, + Image: Image, + MathML: MathML, + Util: Util, + Configuration: Configuration, + Listeners: Listeners, + IntegrationModel: IntegrationModel +} diff --git a/core/package-lock.json b/core/package-lock.json new file mode 100644 index 00000000..88b3191f --- /dev/null +++ b/core/package-lock.json @@ -0,0 +1,5957 @@ +{ + "name": "mathtype-js-lib", + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "@babel/code-frame": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", + "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0" + } + }, + "@babel/core": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.0.1.tgz", + "integrity": "sha512-7Yy2vRB6KYbhWeIrrwJmKv9UwDxokmlo43wi6AV84oNs4Gi71NTNGh3YxY/hK3+CxuSc6wcKSl25F2tQOhm1GQ==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0", + "@babel/generator": "7.0.0", + "@babel/helpers": "7.0.0", + "@babel/parser": "7.0.0", + "@babel/template": "7.0.0", + "@babel/traverse": "7.0.0", + "@babel/types": "7.0.0", + "convert-source-map": "1.6.0", + "debug": "3.2.5", + "json5": "0.5.1", + "lodash": "4.17.11", + "resolve": "1.8.1", + "semver": "5.5.1", + "source-map": "0.5.7" + } + }, + "@babel/generator": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0.tgz", + "integrity": "sha512-/BM2vupkpbZXq22l1ALO7MqXJZH2k8bKVv8Y+pABFnzWdztDB/ZLveP5At21vLz5c2YtSE6p7j2FZEsqafMz5Q==", + "dev": true, + "requires": { + "@babel/types": "7.0.0", + "jsesc": "2.5.1", + "lodash": "4.17.11", + "source-map": "0.5.7", + "trim-right": "1.0.1" + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz", + "integrity": "sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q==", + "dev": true, + "requires": { + "@babel/types": "7.0.0" + } + }, + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.0.0.tgz", + "integrity": "sha512-9HdU8lrAc4FUZOy+y2w//kUhynSpkGIRYDzJW1oKJx7+v8m6UEAbAd2tSvxirsq2kJTXJZZS6Eo8FnUDUH0ZWw==", + "dev": true, + "requires": { + "@babel/helper-explode-assignable-expression": "7.0.0", + "@babel/types": "7.0.0" + } + }, + "@babel/helper-call-delegate": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-call-delegate/-/helper-call-delegate-7.0.0.tgz", + "integrity": "sha512-HdYG6vr4KgXHK0q1QRZ8guoYCF5rZjIdPlhcVY+j4EBK/FDR+cXRM5/6lQr3NIWDc7dO1KfgjG5rfH6lM89VBw==", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "7.0.0", + "@babel/traverse": "7.0.0", + "@babel/types": "7.0.0" + } + }, + "@babel/helper-define-map": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.0.0.tgz", + "integrity": "sha512-acbCxYS9XufWxsBiclmXMK1CFz7en/XSYvHFcbb3Jb8BqjFEBrA46WlIsoSQTRG/eYN60HciUnzdyQxOZhrHfw==", + "dev": true, + "requires": { + "@babel/helper-function-name": "7.0.0", + "@babel/types": "7.0.0", + "lodash": "4.17.11" + } + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.0.0.tgz", + "integrity": "sha512-5gLPwdDnYf8GfPsjS+UmZUtYE1jaXTFm1P+ymGobqvXbA0q3ANgpH60+C6zDrRAWXYbQXYvzzQC/r0gJVNNltQ==", + "dev": true, + "requires": { + "@babel/traverse": "7.0.0", + "@babel/types": "7.0.0" + } + }, + "@babel/helper-function-name": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0.tgz", + "integrity": "sha512-Zo+LGvfYp4rMtz84BLF3bavFTdf8y4rJtMPTe2J+rxYmnDOIeH8le++VFI/pRJU+rQhjqiXxE4LMaIau28Tv1Q==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "7.0.0", + "@babel/template": "7.0.0", + "@babel/types": "7.0.0" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", + "integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", + "dev": true, + "requires": { + "@babel/types": "7.0.0" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.0.0.tgz", + "integrity": "sha512-Ggv5sldXUeSKsuzLkddtyhyHe2YantsxWKNi7A+7LeD12ExRDWTRk29JCXpaHPAbMaIPZSil7n+lq78WY2VY7w==", + "dev": true, + "requires": { + "@babel/types": "7.0.0" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.0.0.tgz", + "integrity": "sha512-avo+lm/QmZlv27Zsi0xEor2fKcqWG56D5ae9dzklpIaY7cQMK5N8VSpaNVPPagiqmy7LrEjK1IWdGMOqPu5csg==", + "dev": true, + "requires": { + "@babel/types": "7.0.0" + } + }, + "@babel/helper-module-imports": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz", + "integrity": "sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A==", + "dev": true, + "requires": { + "@babel/types": "7.0.0" + } + }, + "@babel/helper-module-transforms": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.0.0.tgz", + "integrity": "sha512-QdwmTTlPmT7TZcf30dnqm8pem+o48tVt991xXogE5CQCwqSpWKuzH2E9v8VWeccQ66a6/CmrLZ+bwp66JYeM5A==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "7.0.0", + "@babel/helper-simple-access": "7.0.0", + "@babel/helper-split-export-declaration": "7.0.0", + "@babel/template": "7.0.0", + "@babel/types": "7.0.0", + "lodash": "4.17.11" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz", + "integrity": "sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g==", + "dev": true, + "requires": { + "@babel/types": "7.0.0" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz", + "integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==", + "dev": true + }, + "@babel/helper-regex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-regex/-/helper-regex-7.0.0.tgz", + "integrity": "sha512-TR0/N0NDCcUIUEbqV6dCO+LptmmSQFQ7q70lfcEB4URsjD0E1HzicrwUH+ap6BAQ2jhCX9Q4UqZy4wilujWlkg==", + "dev": true, + "requires": { + "lodash": "4.17.11" + } + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.0.0.tgz", + "integrity": "sha512-3o4sYLOsK6m0A7t1P0saTanBPmk5MAlxVnp9773Of4L8PMVLukU7loZix5KoJgflxSo2c2ETTzseptc0rQEp7A==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "7.0.0", + "@babel/helper-wrap-function": "7.0.0", + "@babel/template": "7.0.0", + "@babel/traverse": "7.0.0", + "@babel/types": "7.0.0" + } + }, + "@babel/helper-replace-supers": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.0.0.tgz", + "integrity": "sha512-fsSv7VogxzMSmGch6DwhKHGsciVXo7hbfhBgH9ZrgJMXKMjO7ASQTUfbVL7MU1uCfviyqjucazGK7TWPT9weuQ==", + "dev": true, + "requires": { + "@babel/helper-member-expression-to-functions": "7.0.0", + "@babel/helper-optimise-call-expression": "7.0.0", + "@babel/traverse": "7.0.0", + "@babel/types": "7.0.0" + } + }, + "@babel/helper-simple-access": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.0.0.tgz", + "integrity": "sha512-CNeuX52jbQSq4j1n+R+21xrjbTjsnXa9n1aERbgHRD/p9h4Udkxr1n24yPMQmnTETHdnQDvkVSYWFw/ETAymYg==", + "dev": true, + "requires": { + "@babel/template": "7.0.0", + "@babel/types": "7.0.0" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz", + "integrity": "sha512-MXkOJqva62dfC0w85mEf/LucPPS/1+04nmmRMPEBUB++hiiThQ2zPtX/mEWQ3mtzCEjIJvPY8nuwxXtQeQwUag==", + "dev": true, + "requires": { + "@babel/types": "7.0.0" + } + }, + "@babel/helper-wrap-function": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.0.0.tgz", + "integrity": "sha512-kjprWPDNVPZ/9pyLRXcZBvfjnFwqokmXTPTaC4AV8Ns7WRl7ewSxrB19AWZzQsC/WSPQLOw1ciR8uPYkAM1znA==", + "dev": true, + "requires": { + "@babel/helper-function-name": "7.0.0", + "@babel/template": "7.0.0", + "@babel/traverse": "7.0.0", + "@babel/types": "7.0.0" + } + }, + "@babel/helpers": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.0.0.tgz", + "integrity": "sha512-jbvgR8iLZPnyk6m/UqdXYsSxbVtRi7Pd3CzB4OPwPBnmhNG1DWjiiy777NTuoyIcniszK51R40L5pgfXAfHDtw==", + "dev": true, + "requires": { + "@babel/template": "7.0.0", + "@babel/traverse": "7.0.0", + "@babel/types": "7.0.0" + } + }, + "@babel/highlight": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", + "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "dev": true, + "requires": { + "chalk": "2.4.1", + "esutils": "2.0.2", + "js-tokens": "4.0.0" + } + }, + "@babel/parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.0.0.tgz", + "integrity": "sha512-RgJhNdRinpO8zibnoHbzTTexNs4c8ROkXFBanNDZTLHjwbdLk8J5cJSKulx/bycWTLYmKVNCkxRtVCoJnqPk+g==", + "dev": true + }, + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.0.0.tgz", + "integrity": "sha512-QsXmmjLrFADCcDQAfdQn7tfBRLjpTzRWaDpKpW4ZXW1fahPG4SvjcF1xfvVnXGC662RSExYXL+6DAqbtgqMXeA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/helper-remap-async-to-generator": "7.0.0", + "@babel/plugin-syntax-async-generators": "7.0.0" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.0.0.tgz", + "integrity": "sha512-kfVdUkIAGJIVmHmtS/40i/fg/AGnw/rsZBCaapY5yjeO5RA9m165Xbw9KMOu2nqXP5dTFjEjHdfNdoVcHv133Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/plugin-syntax-json-strings": "7.0.0" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.0.0.tgz", + "integrity": "sha512-14fhfoPcNu7itSen7Py1iGN0gEm87hX/B+8nZPqkdmANyyYWYMY2pjA3r8WXbWVKMzfnSNS0xY8GVS0IjXi/iw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/plugin-syntax-object-rest-spread": "7.0.0" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.0.0.tgz", + "integrity": "sha512-JPqAvLG1s13B/AuoBjdBYvn38RqW6n1TzrQO839/sIpqLpbnXKacsAgpZHzLD83Sm8SDXMkkrAvEnJ25+0yIpw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/plugin-syntax-optional-catch-binding": "7.0.0" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.0.0.tgz", + "integrity": "sha512-tM3icA6GhC3ch2SkmSxv7J/hCWKISzwycub6eGsDrFDgukD4dZ/I+x81XgW0YslS6mzNuQ1Cbzh5osjIMgepPQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/helper-regex": "7.0.0", + "regexpu-core": "4.2.0" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.0.0.tgz", + "integrity": "sha512-im7ged00ddGKAjcZgewXmp1vxSZQQywuQXe2B1A7kajjZmDeY/ekMPmWr9zJgveSaQH0k7BcGrojQhcK06l0zA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.0.0.tgz", + "integrity": "sha512-UlSfNydC+XLj4bw7ijpldc1uZ/HB84vw+U6BTuqMdIEmz/LDe63w/GHtpQMdXWdqQZFeAI9PjnHe/vDhwirhKA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.0.0.tgz", + "integrity": "sha512-5A0n4p6bIiVe5OvQPxBnesezsgFJdHhSs3uFSvaPdMqtsovajLZ+G2vZyvNe10EzJBWWo3AcHGKhAFUxqwp2dw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.0.0.tgz", + "integrity": "sha512-Wc+HVvwjcq5qBg1w5RG9o9RVzmCaAg/Vp0erHCKpAYV8La6I94o4GQAmFYNmkzoMO6gzoOSulpKeSSz6mPEoZw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.0.0.tgz", + "integrity": "sha512-2EZDBl1WIO/q4DIkIp4s86sdp4ZifL51MoIviLY/gG/mLSuOIEg7J8o6mhbxOTvUJkaN50n+8u41FVsr5KLy/w==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-async-to-generator": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.0.0.tgz", + "integrity": "sha512-CiWNhSMZzj1n3uEKUUS/oL+a7Xi8hnPQB6GpC1WfL/ZYvxBLDBn14sHMo5EyOaeArccSonyk5jFIKMRRbrHOnQ==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0", + "@babel/helper-remap-async-to-generator": "7.0.0" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.0.0.tgz", + "integrity": "sha512-AOBiyUp7vYTqz2Jibe1UaAWL0Hl9JUXEgjFvvvcSc9MVDItv46ViXFw2F7SVt1B5k+KWjl44eeXOAk3UDEaJjQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.0.0.tgz", + "integrity": "sha512-GWEMCrmHQcYWISilUrk9GDqH4enf3UmhOEbNbNrlNAX1ssH3MsS1xLOS6rdjRVPgA7XXVPn87tRkdTEoA/dxEg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "lodash": "4.17.11" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.0.0.tgz", + "integrity": "sha512-8LBm7XsHQiNISEmb+ejBiHi1pUihwUf+lrIwyVsXVbQ1vLqgkvhgayK5JnW3WXvQD2rmM0qxFAIyDE5vtMem2A==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "7.0.0", + "@babel/helper-define-map": "7.0.0", + "@babel/helper-function-name": "7.0.0", + "@babel/helper-optimise-call-expression": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0", + "@babel/helper-replace-supers": "7.0.0", + "@babel/helper-split-export-declaration": "7.0.0", + "globals": "11.7.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.0.0.tgz", + "integrity": "sha512-ubouZdChNAv4AAWAgU7QKbB93NU5sHwInEWfp+/OzJKA02E6Woh9RVoX4sZrbRwtybky/d7baTUqwFx+HgbvMA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.0.0.tgz", + "integrity": "sha512-Fr2GtF8YJSXGTyFPakPFB4ODaEKGU04bPsAllAIabwoXdFrPxL0LVXQX5dQWoxOjjgozarJcC9eWGsj0fD6Zsg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-dotall-regex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.0.0.tgz", + "integrity": "sha512-00THs8eJxOJUFVx1w8i1MBF4XH4PsAjKjQ1eqN/uCH3YKwP21GCKfrn6YZFZswbOk9+0cw1zGQPHVc1KBlSxig==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/helper-regex": "7.0.0", + "regexpu-core": "4.2.0" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.0.0.tgz", + "integrity": "sha512-w2vfPkMqRkdxx+C71ATLJG30PpwtTpW7DDdLqYt2acXU7YjztzeWW2Jk1T6hKqCLYCcEA5UQM/+xTAm+QCSnuQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.0.0.tgz", + "integrity": "sha512-Ig74elCuFQ0mvHkWUq5qDCNI3qHWlop5w4TcDxdtJiOk8Egqe2uxDRY9XnXGSlmWClClmnixcoYumyvbAuj4dA==", + "dev": true, + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.0.0.tgz", + "integrity": "sha512-TlxKecN20X2tt2UEr2LNE6aqA0oPeMT1Y3cgz8k4Dn1j5ObT8M3nl9aA37LLklx0PBZKETC9ZAf9n/6SujTuXA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.0.0.tgz", + "integrity": "sha512-mR7JN9vkwsAIot74pSwzn/2Gq4nn2wN0HKtQyJLc1ghAarsymdBMTfh+Q/aeR2N3heXs3URQscTLrKe3yUU7Yw==", + "dev": true, + "requires": { + "@babel/helper-function-name": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.0.0.tgz", + "integrity": "sha512-1NTDBWkeNXgpUcyoVFxbr9hS57EpZYXpje92zv0SUzjdu3enaRwF/l3cmyRnXLtIdyJASyiS6PtybK+CgKf7jA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.0.0.tgz", + "integrity": "sha512-CtSVpT/0tty/4405qczoIHm41YfFbPChplsmfBwsi3RTq/M9cHgVb3ixI5bqqgdKkqWwSX2sXqejvMKLuTVU+Q==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.0.0.tgz", + "integrity": "sha512-BIcQLgPFCxi7YygtNpz5xj+7HxhOprbCGZKeLW6Kxsn1eHS6sJZMw4MfmqFZagl/v6IVa0AJoMHdDXLVrpd3Aw==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0", + "@babel/helper-simple-access": "7.0.0" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.0.0.tgz", + "integrity": "sha512-8EDKMAsitLkiF/D4Zhe9CHEE2XLh4bfLbb9/Zf3FgXYQOZyZYyg7EAel/aT2A7bHv62jwHf09q2KU/oEexr83g==", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.0.0.tgz", + "integrity": "sha512-EMyKpzgugxef+R1diXDwqw/Hmt5ls8VxfI8Gq5Lo8Qp3oKIepkYG4L/mvE2dmZSRalgL9sguoPKbnQ1m96hVFw==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-new-target": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.0.0.tgz", + "integrity": "sha512-yin069FYjah+LbqfGeTfzIBODex/e++Yfa0rH0fpfam9uTbuEeEOx5GLGr210ggOV77mVRNoeqSYqeuaqSzVSw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.0.0.tgz", + "integrity": "sha512-BfAiF1l18Xr1shy1NyyQgLiHDvh/S7APiEM5+0wxTsQ+e3fgXO+NA47u4PvppzH0meJS21y0gZHcjnvUAJj8tQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/helper-replace-supers": "7.0.0" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.0.0.tgz", + "integrity": "sha512-eWngvRBWx0gScot0xa340JzrkA+8HGAk1OaCHDfXAjkrTFkp73Lcf+78s7AStSdRML5nzx5aXpnjN1MfrjkBoA==", + "dev": true, + "requires": { + "@babel/helper-call-delegate": "7.0.0", + "@babel/helper-get-function-arity": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.0.0.tgz", + "integrity": "sha512-sj2qzsEx8KDVv1QuJc/dEfilkg3RRPvPYx/VnKLtItVQRWt1Wqf5eVCOLZm29CiGFfYYsA3VPjfizTCV0S0Dlw==", + "dev": true, + "requires": { + "regenerator-transform": "0.13.3" + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.0.0.tgz", + "integrity": "sha512-g/99LI4vm5iOf5r1Gdxq5Xmu91zvjhEG5+yZDJW268AZELAu4J1EiFLnkSG3yuUsZyOipVOVUKoGPYwfsTymhw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.0.0.tgz", + "integrity": "sha512-L702YFy2EvirrR4shTj0g2xQp7aNwZoWNCkNu2mcoU0uyzMl0XRwDSwzB/xp6DSUFiBmEXuyAyEN16LsgVqGGQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.0.0.tgz", + "integrity": "sha512-LFUToxiyS/WD+XEWpkx/XJBrUXKewSZpzX68s+yEOtIbdnsRjpryDw9U06gYc6klYEij/+KQVRnD3nz3AoKmjw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/helper-regex": "7.0.0" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.0.0.tgz", + "integrity": "sha512-vA6rkTCabRZu7Nbl9DfLZE1imj4tzdWcg5vtdQGvj+OH9itNNB6hxuRMHuIY8SGnEt1T9g5foqs9LnrHzsqEFg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.0.0.tgz", + "integrity": "sha512-1r1X5DO78WnaAIvs5uC48t41LLckxsYklJrZjNKcevyz83sF2l4RHbw29qrCPr/6ksFsdfRpT/ZgxNWHXRnffg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.0.0.tgz", + "integrity": "sha512-uJBrJhBOEa3D033P95nPHu3nbFwFE9ZgXsfEitzoIXIwqAZWk7uXcg06yFKXz9FSxBH5ucgU/cYdX0IV8ldHKw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "7.0.0", + "@babel/helper-regex": "7.0.0", + "regexpu-core": "4.2.0" + } + }, + "@babel/preset-env": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.0.0.tgz", + "integrity": "sha512-Fnx1wWaWv2w2rl+VHxA9si//Da40941IQ29fKiRejVR7oN1FxSEL8+SyAX/2oKIye2gPvY/GBbJVEKQ/oi43zQ==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "7.0.0", + "@babel/helper-plugin-utils": "7.0.0", + "@babel/plugin-proposal-async-generator-functions": "7.0.0", + "@babel/plugin-proposal-json-strings": "7.0.0", + "@babel/plugin-proposal-object-rest-spread": "7.0.0", + "@babel/plugin-proposal-optional-catch-binding": "7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "7.0.0", + "@babel/plugin-syntax-async-generators": "7.0.0", + "@babel/plugin-syntax-object-rest-spread": "7.0.0", + "@babel/plugin-syntax-optional-catch-binding": "7.0.0", + "@babel/plugin-transform-arrow-functions": "7.0.0", + "@babel/plugin-transform-async-to-generator": "7.0.0", + "@babel/plugin-transform-block-scoped-functions": "7.0.0", + "@babel/plugin-transform-block-scoping": "7.0.0", + "@babel/plugin-transform-classes": "7.0.0", + "@babel/plugin-transform-computed-properties": "7.0.0", + "@babel/plugin-transform-destructuring": "7.0.0", + "@babel/plugin-transform-dotall-regex": "7.0.0", + "@babel/plugin-transform-duplicate-keys": "7.0.0", + "@babel/plugin-transform-exponentiation-operator": "7.0.0", + "@babel/plugin-transform-for-of": "7.0.0", + "@babel/plugin-transform-function-name": "7.0.0", + "@babel/plugin-transform-literals": "7.0.0", + "@babel/plugin-transform-modules-amd": "7.0.0", + "@babel/plugin-transform-modules-commonjs": "7.0.0", + "@babel/plugin-transform-modules-systemjs": "7.0.0", + "@babel/plugin-transform-modules-umd": "7.0.0", + "@babel/plugin-transform-new-target": "7.0.0", + "@babel/plugin-transform-object-super": "7.0.0", + "@babel/plugin-transform-parameters": "7.0.0", + "@babel/plugin-transform-regenerator": "7.0.0", + "@babel/plugin-transform-shorthand-properties": "7.0.0", + "@babel/plugin-transform-spread": "7.0.0", + "@babel/plugin-transform-sticky-regex": "7.0.0", + "@babel/plugin-transform-template-literals": "7.0.0", + "@babel/plugin-transform-typeof-symbol": "7.0.0", + "@babel/plugin-transform-unicode-regex": "7.0.0", + "browserslist": "4.1.1", + "invariant": "2.2.4", + "js-levenshtein": "1.1.3", + "semver": "5.5.1" + } + }, + "@babel/template": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0.tgz", + "integrity": "sha512-VLQZik/G5mjYJ6u19U3W2u7eM+rA/NGzH+GtHDFFkLTKLW66OasFrxZ/yK7hkyQcswrmvugFyZpDFRW0DjcjCw==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0", + "@babel/parser": "7.0.0", + "@babel/types": "7.0.0" + } + }, + "@babel/traverse": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0.tgz", + "integrity": "sha512-ka/lwaonJZTlJyn97C4g5FYjPOx+Oxd3ab05hbDr1Mx9aP1FclJ+SUHyLx3Tx40sGmOVJApDxE6puJhd3ld2kw==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0", + "@babel/generator": "7.0.0", + "@babel/helper-function-name": "7.0.0", + "@babel/helper-split-export-declaration": "7.0.0", + "@babel/parser": "7.0.0", + "@babel/types": "7.0.0", + "debug": "3.2.5", + "globals": "11.7.0", + "lodash": "4.17.11" + } + }, + "@babel/types": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0.tgz", + "integrity": "sha512-5tPDap4bGKTLPtci2SUl/B7Gv8RnuJFuQoWx26RJobS0fFrz4reUA3JnwIM+HVHEmWE0C1mzKhDtTp8NsWY02Q==", + "dev": true, + "requires": { + "esutils": "2.0.2", + "lodash": "4.17.11", + "to-fast-properties": "2.0.0" + } + }, + "@webassemblyjs/ast": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.7.6.tgz", + "integrity": "sha512-8nkZS48EVsMUU0v6F1LCIOw4RYWLm2plMtbhFTjNgeXmsTNLuU3xTRtnljt9BFQB+iPbLRobkNrCWftWnNC7wQ==", + "dev": true, + "requires": { + "@webassemblyjs/helper-module-context": "1.7.6", + "@webassemblyjs/helper-wasm-bytecode": "1.7.6", + "@webassemblyjs/wast-parser": "1.7.6", + "mamacro": "0.0.3" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.7.6.tgz", + "integrity": "sha512-VBOZvaOyBSkPZdIt5VBMg3vPWxouuM13dPXGWI1cBh3oFLNcFJ8s9YA7S9l4mPI7+Q950QqOmqj06oa83hNWBA==", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.7.6.tgz", + "integrity": "sha512-SCzhcQWHXfrfMSKcj8zHg1/kL9kb3aa5TN4plc/EREOs5Xop0ci5bdVBApbk2yfVi8aL+Ly4Qpp3/TRAUInjrg==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.7.6.tgz", + "integrity": "sha512-1/gW5NaGsEOZ02fjnFiU8/OEEXU1uVbv2um0pQ9YVL3IHSkyk6xOwokzyqqO1qDZQUAllb+V8irtClPWntbVqw==", + "dev": true + }, + "@webassemblyjs/helper-code-frame": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.7.6.tgz", + "integrity": "sha512-+suMJOkSn9+vEvDvgyWyrJo5vJsWSDXZmJAjtoUq4zS4eqHyXImpktvHOZwXp1XQjO5H+YQwsBgqTQEc0J/5zg==", + "dev": true, + "requires": { + "@webassemblyjs/wast-printer": "1.7.6" + } + }, + "@webassemblyjs/helper-fsm": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.7.6.tgz", + "integrity": "sha512-HCS6KN3wgxUihGBW7WFzEC/o8Eyvk0d56uazusnxXthDPnkWiMv+kGi9xXswL2cvfYfeK5yiM17z2K5BVlwypw==", + "dev": true + }, + "@webassemblyjs/helper-module-context": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.7.6.tgz", + "integrity": "sha512-e8/6GbY7OjLM+6OsN7f2krC2qYVNaSr0B0oe4lWdmq5sL++8dYDD1TFbD1TdAdWMRTYNr/Qq7ovXWzia2EbSjw==", + "dev": true, + "requires": { + "mamacro": "0.0.3" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.7.6.tgz", + "integrity": "sha512-PzYFCb7RjjSdAOljyvLWVqd6adAOabJW+8yRT+NWhXuf1nNZWH+igFZCUK9k7Cx7CsBbzIfXjJc7u56zZgFj9Q==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.7.6.tgz", + "integrity": "sha512-3GS628ppDPSuwcYlQ7cDCGr4W2n9c4hLzvnRKeuz+lGsJSmc/ADVoYpm1ts2vlB1tGHkjtQMni+yu8mHoMlKlA==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-buffer": "1.7.6", + "@webassemblyjs/helper-wasm-bytecode": "1.7.6", + "@webassemblyjs/wasm-gen": "1.7.6" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.7.6.tgz", + "integrity": "sha512-V4cIp0ruyw+hawUHwQLn6o2mFEw4t50tk530oKsYXQhEzKR+xNGDxs/SFFuyTO7X3NzEu4usA3w5jzhl2RYyzQ==", + "dev": true, + "requires": { + "@xtuc/ieee754": "1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.7.6.tgz", + "integrity": "sha512-ojdlG8WpM394lBow4ncTGJoIVZ4aAtNOWHhfAM7m7zprmkVcKK+2kK5YJ9Bmj6/ketTtOn7wGSHCtMt+LzqgYQ==", + "dev": true, + "requires": { + "@xtuc/long": "4.2.1" + } + }, + "@webassemblyjs/utf8": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.7.6.tgz", + "integrity": "sha512-oId+tLxQ+AeDC34ELRYNSqJRaScB0TClUU6KQfpB8rNT6oelYlz8axsPhf6yPTg7PBJ/Z5WcXmUYiHEWgbbHJw==", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.7.6.tgz", + "integrity": "sha512-pTNjLO3o41v/Vz9VFLl+I3YLImpCSpodFW77pNoH4agn5I6GgSxXHXtvWDTvYJFty0jSeXZWLEmbaSIRUDlekg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-buffer": "1.7.6", + "@webassemblyjs/helper-wasm-bytecode": "1.7.6", + "@webassemblyjs/helper-wasm-section": "1.7.6", + "@webassemblyjs/wasm-gen": "1.7.6", + "@webassemblyjs/wasm-opt": "1.7.6", + "@webassemblyjs/wasm-parser": "1.7.6", + "@webassemblyjs/wast-printer": "1.7.6" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.7.6.tgz", + "integrity": "sha512-mQvFJVumtmRKEUXMohwn8nSrtjJJl6oXwF3FotC5t6e2hlKMh8sIaW03Sck2MDzw9xPogZD7tdP5kjPlbH9EcQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-wasm-bytecode": "1.7.6", + "@webassemblyjs/ieee754": "1.7.6", + "@webassemblyjs/leb128": "1.7.6", + "@webassemblyjs/utf8": "1.7.6" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.7.6.tgz", + "integrity": "sha512-go44K90fSIsDwRgtHhX14VtbdDPdK2sZQtZqUcMRvTojdozj5tLI0VVJAzLCfz51NOkFXezPeVTAYFqrZ6rI8Q==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-buffer": "1.7.6", + "@webassemblyjs/wasm-gen": "1.7.6", + "@webassemblyjs/wasm-parser": "1.7.6" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.7.6.tgz", + "integrity": "sha512-t1T6TfwNY85pDA/HWPA8kB9xA4sp9ajlRg5W7EKikqrynTyFo+/qDzIpvdkOkOGjlS6d4n4SX59SPuIayR22Yg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-api-error": "1.7.6", + "@webassemblyjs/helper-wasm-bytecode": "1.7.6", + "@webassemblyjs/ieee754": "1.7.6", + "@webassemblyjs/leb128": "1.7.6", + "@webassemblyjs/utf8": "1.7.6" + } + }, + "@webassemblyjs/wast-parser": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.7.6.tgz", + "integrity": "sha512-1MaWTErN0ziOsNUlLdvwS+NS1QWuI/kgJaAGAMHX8+fMJFgOJDmN/xsG4h/A1Gtf/tz5VyXQciaqHZqp2q0vfg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/floating-point-hex-parser": "1.7.6", + "@webassemblyjs/helper-api-error": "1.7.6", + "@webassemblyjs/helper-code-frame": "1.7.6", + "@webassemblyjs/helper-fsm": "1.7.6", + "@xtuc/long": "4.2.1", + "mamacro": "0.0.3" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.7.6.tgz", + "integrity": "sha512-vHdHSK1tOetvDcl1IV1OdDeGNe/NDDQ+KzuZHMtqTVP1xO/tZ/IKNpj5BaGk1OYFdsDWQqb31PIwdEyPntOWRQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/wast-parser": "1.7.6", + "@xtuc/long": "4.2.1" + } + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.1.tgz", + "integrity": "sha512-FZdkNBDqBRHKQ2MEbSC17xnPFOhZxeJ2YGSfr2BKf3sujG49Qe3bB+rGCwQfIaA7WHnGeGkSijX4FuBCdrzW/g==", + "dev": true + }, + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "dev": true + }, + "acorn-dynamic-import": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz", + "integrity": "sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg==", + "dev": true, + "requires": { + "acorn": "5.7.3" + } + }, + "ajv": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz", + "integrity": "sha512-LqZ9wY+fx3UMiiPd741yB2pj3hhil+hQc8taf4o2QGRFpWgZ2V5C8HA165DY9sS3fJwsk7uT7ZlFEyC3Ig3lLg==", + "dev": true, + "requires": { + "fast-deep-equal": "2.0.1", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.4.1", + "uri-js": "4.2.2" + } + }, + "ajv-errors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ajv-errors/-/ajv-errors-1.0.0.tgz", + "integrity": "sha1-7PAh+hCP0X37Xms4Py3SM+Mf/Fk=", + "dev": true + }, + "ajv-keywords": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", + "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", + "dev": true + }, + "alphanum-sort": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz", + "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", + "dev": true + }, + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.3" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "3.1.10", + "normalize-path": "2.1.1" + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "1.0.3" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "dev": true, + "requires": { + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "babel-loader": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.2.tgz", + "integrity": "sha512-Law0PGtRV1JL8Y9Wpzc0d6EE0GD7LzXWCfaeWwboUMcBWNG6gvaWTK1/+BK7a4X5EmeJiGEuDDFxUsOa8RSWCw==", + "dev": true, + "requires": { + "find-cache-dir": "1.0.0", + "loader-utils": "1.1.0", + "mkdirp": "0.5.1", + "util.promisify": "1.0.0" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "1.0.1", + "class-utils": "0.3.6", + "component-emitter": "1.2.1", + "define-property": "1.0.0", + "isobject": "3.0.1", + "mixin-deep": "1.3.1", + "pascalcase": "0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + } + } + }, + "base64-js": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", + "dev": true + }, + "big.js": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", + "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", + "dev": true + }, + "binary-extensions": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", + "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", + "dev": true + }, + "bluebird": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.2.tgz", + "integrity": "sha512-dhHTWMI7kMx5whMQntl7Vr9C6BvV10lFXDAasnqnrMYhXVCzzk6IO9Fo2L75jXHT07WrOngL1WDXOp+yYS91Yg==", + "dev": true + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", + "dev": true + }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "1.1.0", + "array-unique": "0.3.2", + "extend-shallow": "2.0.1", + "fill-range": "4.0.0", + "isobject": "3.0.1", + "repeat-element": "1.1.3", + "snapdragon": "0.8.2", + "snapdragon-node": "2.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.2" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "1.0.3", + "cipher-base": "1.0.4", + "create-hash": "1.2.0", + "evp_bytestokey": "1.0.3", + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "1.2.0", + "browserify-des": "1.0.2", + "evp_bytestokey": "1.0.3" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dev": true, + "requires": { + "cipher-base": "1.0.4", + "des.js": "1.0.0", + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "randombytes": "2.0.6" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "browserify-rsa": "4.0.1", + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "elliptic": "6.4.1", + "inherits": "2.0.3", + "parse-asn1": "5.1.1" + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "1.0.6" + } + }, + "browserslist": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.1.1.tgz", + "integrity": "sha512-VBorw+tgpOtZ1BYhrVSVTzTt/3+vSE3eFUh0N2GCFK1HffceOaf32YS/bs6WiFhjDAblAFrx85jMy3BG9fBK2Q==", + "dev": true, + "requires": { + "caniuse-lite": "1.0.30000885", + "electron-to-chromium": "1.3.67", + "node-releases": "1.0.0-alpha.11" + } + }, + "buffer": { + "version": "4.9.1", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "dev": true, + "requires": { + "base64-js": "1.3.0", + "ieee754": "1.1.12", + "isarray": "1.0.0" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "cacache": { + "version": "10.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", + "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", + "dev": true, + "requires": { + "bluebird": "3.5.2", + "chownr": "1.0.1", + "glob": "7.1.3", + "graceful-fs": "4.1.11", + "lru-cache": "4.1.3", + "mississippi": "2.0.0", + "mkdirp": "0.5.1", + "move-concurrently": "1.0.1", + "promise-inflight": "1.0.1", + "rimraf": "2.6.2", + "ssri": "5.3.0", + "unique-filename": "1.1.0", + "y18n": "4.0.0" + } + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "1.0.0", + "component-emitter": "1.2.1", + "get-value": "2.0.6", + "has-value": "1.0.0", + "isobject": "3.0.1", + "set-value": "2.0.0", + "to-object-path": "0.3.0", + "union-value": "1.0.0", + "unset-value": "1.0.0" + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "caniuse-api": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", + "integrity": "sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==", + "dev": true, + "requires": { + "browserslist": "4.1.1", + "caniuse-lite": "1.0.30000885", + "lodash.memoize": "4.1.2", + "lodash.uniq": "4.5.0" + } + }, + "caniuse-lite": { + "version": "1.0.30000885", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000885.tgz", + "integrity": "sha512-cXKbYwpxBLd7qHyej16JazPoUacqoVuDhvR61U7Fr5vSxMUiodzcYa1rQYRYfZ5GexV03vGZHd722vNPLjPJGQ==", + "dev": true + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.5.0" + } + }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, + "chokidar": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", + "integrity": "sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ==", + "dev": true, + "requires": { + "anymatch": "2.0.0", + "async-each": "1.0.1", + "braces": "2.3.2", + "glob-parent": "3.1.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "4.0.0", + "lodash.debounce": "4.0.8", + "normalize-path": "2.1.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.2.1", + "upath": "1.1.0" + } + }, + "chownr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", + "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", + "dev": true + }, + "chrome-trace-event": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.0.tgz", + "integrity": "sha512-xDbVgyfDTT2piup/h8dK/y4QZfJRSa73bw1WZ8b4XM1o7fsFubUVGYcE+1ANtOzJJELGpYoG2961z0Z6OAld9A==", + "dev": true, + "requires": { + "tslib": "1.9.3" + } + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "define-property": "0.2.5", + "isobject": "3.0.1", + "static-extend": "0.1.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + } + } + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "wrap-ansi": "2.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "coa": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/coa/-/coa-2.0.1.tgz", + "integrity": "sha512-5wfTTO8E2/ja4jFSxePXlG5nRu5bBtL/r1HCIpJW/lzT6yDtKl0u0Z4o/Vpz32IpKmBn7HerheEZQgA9N2DarQ==", + "dev": true, + "requires": { + "q": "1.5.1" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "1.0.0", + "object-visit": "1.0.1" + } + }, + "color": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz", + "integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w==", + "dev": true, + "requires": { + "color-convert": "1.9.3", + "color-string": "1.5.3" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "color-string": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.3.tgz", + "integrity": "sha512-dC2C5qeWoYkxki5UAXapdjqO672AM4vZuPGRQfO8b5HKuKGBbKWpITyDYN7TOFKvRW7kOgAn3746clDBMDJyQw==", + "dev": true, + "requires": { + "color-name": "1.1.3", + "simple-swizzle": "0.2.2" + } + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "commander": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "1.1.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "typedarray": "0.0.6" + } + }, + "console-browserify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", + "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", + "dev": true, + "requires": { + "date-now": "0.1.4" + } + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "convert-source-map": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz", + "integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", + "dev": true, + "requires": { + "aproba": "1.2.0", + "fs-write-stream-atomic": "1.0.10", + "iferr": "0.1.5", + "mkdirp": "0.5.1", + "rimraf": "2.6.2", + "run-queue": "1.0.3" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cosmiconfig": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-5.0.6.tgz", + "integrity": "sha512-6DWfizHriCrFWURP1/qyhsiFvYdlJzbCzmtFWh744+KyWsJo5+kPzUZZaMRSSItoYc0pxFX7gEO7ZC1/gN/7AQ==", + "dev": true, + "requires": { + "is-directory": "0.3.1", + "js-yaml": "3.12.0", + "parse-json": "4.0.0" + } + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "elliptic": "6.4.1" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "1.0.4", + "inherits": "2.0.3", + "md5.js": "1.3.4", + "ripemd160": "2.0.2", + "sha.js": "2.4.11" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "1.0.4", + "create-hash": "1.2.0", + "inherits": "2.0.3", + "ripemd160": "2.0.2", + "safe-buffer": "5.1.2", + "sha.js": "2.4.11" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "1.0.5", + "path-key": "2.0.1", + "semver": "5.5.1", + "shebang-command": "1.2.0", + "which": "1.3.1" + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "1.0.1", + "browserify-sign": "4.0.4", + "create-ecdh": "4.0.3", + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "diffie-hellman": "5.0.3", + "inherits": "2.0.3", + "pbkdf2": "3.0.16", + "public-encrypt": "4.0.2", + "randombytes": "2.0.6", + "randomfill": "1.0.4" + } + }, + "css-color-names": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz", + "integrity": "sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=", + "dev": true + }, + "css-declaration-sorter": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/css-declaration-sorter/-/css-declaration-sorter-3.0.1.tgz", + "integrity": "sha512-jH4024SHZ3e0M7ann9VxpFpH3moplRXNz9ZBqvFMZqi09Yo5ARbs2wdPH8GqN9iRTlQynrbGbraNbBxBLei85Q==", + "dev": true, + "requires": { + "postcss": "6.0.23", + "timsort": "0.3.0" + } + }, + "css-loader": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/css-loader/-/css-loader-1.0.0.tgz", + "integrity": "sha512-tMXlTYf3mIMt3b0dDCOQFJiVvxbocJ5Ho577WiGPYPZcqVEO218L2iU22pDXzkTZCLDE+9AmGSUkWxeh/nZReA==", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "css-selector-tokenizer": "0.7.0", + "icss-utils": "2.1.0", + "loader-utils": "1.1.0", + "lodash.camelcase": "4.3.0", + "postcss": "6.0.23", + "postcss-modules-extract-imports": "1.2.0", + "postcss-modules-local-by-default": "1.2.0", + "postcss-modules-scope": "1.1.0", + "postcss-modules-values": "1.3.0", + "postcss-value-parser": "3.3.0", + "source-list-map": "2.0.0" + } + }, + "css-select": { + "version": "1.3.0-rc0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.3.0-rc0.tgz", + "integrity": "sha1-b5MZaqrnN2ZuoQNqjLFKj8t6kjE=", + "dev": true, + "requires": { + "boolbase": "1.0.0", + "css-what": "2.1.0", + "domutils": "1.5.1", + "nth-check": "1.0.1" + } + }, + "css-select-base-adapter": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/css-select-base-adapter/-/css-select-base-adapter-0.1.0.tgz", + "integrity": "sha1-AQKz0UYw34bD65+p9UVicBBs+ZA=", + "dev": true + }, + "css-selector-tokenizer": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.7.0.tgz", + "integrity": "sha1-5piEdK6MlTR3v15+/s/OzNnPTIY=", + "dev": true, + "requires": { + "cssesc": "0.1.0", + "fastparse": "1.1.1", + "regexpu-core": "1.0.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + }, + "regexpu-core": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", + "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", + "dev": true, + "requires": { + "regenerate": "1.4.0", + "regjsgen": "0.2.0", + "regjsparser": "0.1.5" + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "0.5.0" + } + } + } + }, + "css-tree": { + "version": "1.0.0-alpha25", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha25.tgz", + "integrity": "sha512-XC6xLW/JqIGirnZuUWHXCHRaAjje2b3OIB0Vj5RIJo6mIi/AdJo30quQl5LxUl0gkXDIrTrFGbMlcZjyFplz1A==", + "dev": true, + "requires": { + "mdn-data": "1.2.0", + "source-map": "0.5.7" + } + }, + "css-unit-converter": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/css-unit-converter/-/css-unit-converter-1.1.1.tgz", + "integrity": "sha1-2bkoGtz9jO2TW9urqDeGiX9k6ZY=", + "dev": true + }, + "css-url-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/css-url-regex/-/css-url-regex-1.1.0.tgz", + "integrity": "sha1-g4NCMMyfdMRX3lnuvRVD/uuDt+w=", + "dev": true + }, + "css-what": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz", + "integrity": "sha1-lGfQMsOM+u+58teVASUwYvh/ob0=", + "dev": true + }, + "cssesc": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-0.1.0.tgz", + "integrity": "sha1-yBSQPkViM3GgR3tAEJqq++6t27Q=", + "dev": true + }, + "cssnano": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-4.1.0.tgz", + "integrity": "sha512-7x24b/ghbrQv2QRgqMR12H3ZZ38xYCKJSXfg21YCtnIE177/NyvMkeiuQdWauIgMjySaTZ+cd5PN2qvfbsGeSw==", + "dev": true, + "requires": { + "cosmiconfig": "5.0.6", + "cssnano-preset-default": "4.0.0", + "is-resolvable": "1.1.0", + "postcss": "6.0.23" + } + }, + "cssnano-preset-default": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-4.0.0.tgz", + "integrity": "sha1-wzQoe099SfstFwqS+SFGVXiOO2s=", + "dev": true, + "requires": { + "css-declaration-sorter": "3.0.1", + "cssnano-util-raw-cache": "4.0.0", + "postcss": "6.0.23", + "postcss-calc": "6.0.1", + "postcss-colormin": "4.0.1", + "postcss-convert-values": "4.0.0", + "postcss-discard-comments": "4.0.0", + "postcss-discard-duplicates": "4.0.0", + "postcss-discard-empty": "4.0.0", + "postcss-discard-overridden": "4.0.0", + "postcss-merge-longhand": "4.0.5", + "postcss-merge-rules": "4.0.1", + "postcss-minify-font-values": "4.0.0", + "postcss-minify-gradients": "4.0.0", + "postcss-minify-params": "4.0.0", + "postcss-minify-selectors": "4.0.0", + "postcss-normalize-charset": "4.0.0", + "postcss-normalize-display-values": "4.0.0", + "postcss-normalize-positions": "4.0.0", + "postcss-normalize-repeat-style": "4.0.0", + "postcss-normalize-string": "4.0.0", + "postcss-normalize-timing-functions": "4.0.0", + "postcss-normalize-unicode": "4.0.0", + "postcss-normalize-url": "4.0.0", + "postcss-normalize-whitespace": "4.0.0", + "postcss-ordered-values": "4.1.0", + "postcss-reduce-initial": "4.0.1", + "postcss-reduce-transforms": "4.0.0", + "postcss-svgo": "4.0.0", + "postcss-unique-selectors": "4.0.0" + } + }, + "cssnano-util-get-arguments": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-util-get-arguments/-/cssnano-util-get-arguments-4.0.0.tgz", + "integrity": "sha1-7ToIKZ8h11dBsg87gfGU7UnMFQ8=", + "dev": true + }, + "cssnano-util-get-match": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-util-get-match/-/cssnano-util-get-match-4.0.0.tgz", + "integrity": "sha1-wOTKB/U4a7F+xeUiULT1lhNlFW0=", + "dev": true + }, + "cssnano-util-raw-cache": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-util-raw-cache/-/cssnano-util-raw-cache-4.0.0.tgz", + "integrity": "sha1-vgooVuJfGF9feivMBiTii38Xmp8=", + "dev": true, + "requires": { + "postcss": "6.0.23" + } + }, + "cssnano-util-same-parent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cssnano-util-same-parent/-/cssnano-util-same-parent-4.0.0.tgz", + "integrity": "sha1-0qPeEDmqmLxOwlAB+gUDMMKhbaw=", + "dev": true + }, + "csso": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/csso/-/csso-3.5.1.tgz", + "integrity": "sha512-vrqULLffYU1Q2tLdJvaCYbONStnfkfimRxXNaGjxMldI0C7JPBC4rB1RyjhfdZ4m1frm8pM9uRPKH3d2knZ8gg==", + "dev": true, + "requires": { + "css-tree": "1.0.0-alpha.29" + }, + "dependencies": { + "css-tree": { + "version": "1.0.0-alpha.29", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.29.tgz", + "integrity": "sha512-sRNb1XydwkW9IOci6iB2xmy8IGCj6r/fr+JWitvJ2JxQRPzN3T4AGGVWCMlVmVwM1gtgALJRmGIlWv5ppnGGkg==", + "dev": true, + "requires": { + "mdn-data": "1.1.4", + "source-map": "0.5.7" + } + }, + "mdn-data": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-1.1.4.tgz", + "integrity": "sha512-FSYbp3lyKjyj3E7fMl6rYvUdX0FBXaluGqlFoYESWQlyUTq8R+wp0rkFxoYFqZlHCvsUXGjyJmLQSnXToYhOSA==", + "dev": true + } + } + }, + "cyclist": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", + "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", + "dev": true + }, + "date-now": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", + "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", + "dev": true + }, + "debug": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.5.tgz", + "integrity": "sha512-D61LaDQPQkxJ5AUM2mbSJRbPkNs/TmdmOeLAi1hgDkpDfIfetSrjmWhccwtuResSwMbACjx/xXQofvM9CE/aeg==", + "dev": true, + "requires": { + "ms": "2.1.1" + } + }, + "decamelize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-2.0.0.tgz", + "integrity": "sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg==", + "dev": true, + "requires": { + "xregexp": "4.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "1.0.12" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "1.0.2", + "isobject": "3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + } + } + }, + "des.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" + } + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "miller-rabin": "4.0.1", + "randombytes": "2.0.6" + } + }, + "dom-serializer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", + "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "dev": true, + "requires": { + "domelementtype": "1.1.3", + "entities": "1.1.1" + }, + "dependencies": { + "domelementtype": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", + "dev": true + } + } + }, + "domain-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", + "dev": true + }, + "domelementtype": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", + "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "dev": true + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "dev": true, + "requires": { + "dom-serializer": "0.1.0", + "domelementtype": "1.3.0" + } + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "dev": true, + "requires": { + "is-obj": "1.0.1" + } + }, + "duplexify": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", + "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", + "dev": true, + "requires": { + "end-of-stream": "1.4.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "stream-shift": "1.0.0" + } + }, + "electron-to-chromium": { + "version": "1.3.67", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.67.tgz", + "integrity": "sha512-h3zEBLdHvsKfaXv1SHAtykJyNtwYFEKkrWGSFyW1BzGgPQ4ykAzD5Hd8C5MZGTAEhkCKmtyIwYUrapsI0xfKww==", + "dev": true + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "brorand": "1.1.0", + "hash.js": "1.1.5", + "hmac-drbg": "1.0.1", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1", + "minimalistic-crypto-utils": "1.0.1" + } + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, + "requires": { + "once": "1.4.0" + } + }, + "enhanced-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", + "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "memory-fs": "0.4.1", + "tapable": "1.1.0" + } + }, + "entities": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", + "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "dev": true + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "dev": true, + "requires": { + "prr": "1.0.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + } + }, + "es-abstract": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", + "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", + "dev": true, + "requires": { + "es-to-primitive": "1.1.1", + "function-bind": "1.1.1", + "has": "1.0.3", + "is-callable": "1.1.4", + "is-regex": "1.0.4" + } + }, + "es-to-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", + "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", + "dev": true, + "requires": { + "is-callable": "1.1.4", + "is-date-object": "1.0.1", + "is-symbol": "1.0.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "4.2.1", + "estraverse": "4.2.0" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "dev": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "1.3.4", + "safe-buffer": "5.1.2" + } + }, + "execa": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz", + "integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==", + "dev": true, + "requires": { + "cross-spawn": "6.0.5", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "1.0.0", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, + "external-editor": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", + "dev": true, + "requires": { + "chardet": "0.7.0", + "iconv-lite": "0.4.24", + "tmp": "0.0.33" + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "0.3.2", + "define-property": "1.0.0", + "expand-brackets": "2.1.4", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + } + } + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fastparse": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz", + "integrity": "sha1-0eJkOzipTXWDtHkGDmxK/8lAcfg=", + "dev": true + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "find-cache-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", + "integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=", + "dev": true, + "requires": { + "commondir": "1.0.1", + "make-dir": "1.3.0", + "pkg-dir": "2.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "flatten": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/flatten/-/flatten-1.0.2.tgz", + "integrity": "sha1-2uRqnXj74lKSJYzB54CkHZXAN4I=", + "dev": true + }, + "flush-write-stream": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", + "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.6" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "0.2.2" + } + }, + "from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.6" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "iferr": "0.1.5", + "imurmurhash": "0.1.4", + "readable-stream": "2.3.6" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "3.1.0", + "path-dirname": "1.0.2" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "2.1.1" + } + } + } + }, + "global-modules-path": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/global-modules-path/-/global-modules-path-2.3.0.tgz", + "integrity": "sha512-HchvMJNYh9dGSCy8pOQ2O8u/hoXaL+0XhnrwH0RyLiSXMMTl9W3N6KUU73+JFOg5PGjtzl6VZzUQsnrpm7Szag==", + "dev": true + }, + "globals": { + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", + "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "1.0.0", + "isobject": "3.0.1" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" + } + }, + "hex-color-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/hex-color-regex/-/hex-color-regex-1.1.0.tgz", + "integrity": "sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==", + "dev": true + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "1.1.5", + "minimalistic-assert": "1.0.1", + "minimalistic-crypto-utils": "1.0.1" + } + }, + "hsl-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hsl-regex/-/hsl-regex-1.0.0.tgz", + "integrity": "sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4=", + "dev": true + }, + "hsla-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hsla-regex/-/hsla-regex-1.0.0.tgz", + "integrity": "sha1-wc56MWjIxmFAM6S194d/OyJfnDg=", + "dev": true + }, + "html-comment-regex": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/html-comment-regex/-/html-comment-regex-1.1.1.tgz", + "integrity": "sha1-ZouTd26q5V696POtRkswekljYl4=", + "dev": true + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": "2.1.2" + } + }, + "icss-replace-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz", + "integrity": "sha1-Bupvg2ead0njhs/h/oEq5dsiPe0=", + "dev": true + }, + "icss-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-2.1.0.tgz", + "integrity": "sha1-g/Cg7DeL8yRheLbCrZE28TWxyWI=", + "dev": true, + "requires": { + "postcss": "6.0.23" + } + }, + "ieee754": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", + "dev": true + }, + "iferr": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", + "dev": true + }, + "import-local": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-1.0.0.tgz", + "integrity": "sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ==", + "dev": true, + "requires": { + "pkg-dir": "2.0.0", + "resolve-cwd": "2.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indexes-of": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", + "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", + "dev": true + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "inquirer": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", + "dev": true, + "requires": { + "ansi-escapes": "3.1.0", + "chalk": "2.4.1", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "3.0.3", + "figures": "2.0.0", + "lodash": "4.17.11", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rxjs": "6.3.2", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "interpret": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", + "dev": true + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "1.4.0" + } + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "dev": true + }, + "is-absolute-url": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-2.1.0.tgz", + "integrity": "sha1-UFMN+4T8yap9vnhS6Do3uTufKqY=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "1.11.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "dev": true + }, + "is-color-stop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-color-stop/-/is-color-stop-1.1.0.tgz", + "integrity": "sha1-z/9HGu5N1cnhWFmPvhKWe1za00U=", + "dev": true, + "requires": { + "css-color-names": "0.0.4", + "hex-color-regex": "1.1.0", + "hsl-regex": "1.0.0", + "hsla-regex": "1.0.0", + "rgb-regex": "1.0.1", + "rgba-regex": "1.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-directory": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", + "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", + "dev": true + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "3.0.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, + "requires": { + "has": "1.0.3" + } + }, + "is-resolvable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-svg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-svg/-/is-svg-3.0.0.tgz", + "integrity": "sha512-gi4iHK53LR2ujhLVVj+37Ykh9GLqYHX6JOVXbLAucaG/Cqw9xwdFOjDM2qeifLs1sF1npXXFvDu0r5HNgCMrzQ==", + "dev": true, + "requires": { + "html-comment-regex": "1.1.1" + } + }, + "is-symbol": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", + "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "js-levenshtein": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.3.tgz", + "integrity": "sha512-/812MXr9RBtMObviZ8gQBhHO8MOrGj8HlEE+4ccMTElNA/6I3u39u+bhny55Lk921yn44nSZFy9naNLElL5wgQ==", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "1.0.10", + "esprima": "4.0.1" + } + }, + "jsesc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", + "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "last-call-webpack-plugin": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/last-call-webpack-plugin/-/last-call-webpack-plugin-3.0.0.tgz", + "integrity": "sha512-7KI2l2GIZa9p2spzPIVZBYyNKkN+e/SQPpnjlTiPhdbDW3F86tdKKELxKpzJ5sgU19wQWsACULZmpTPYHeWO5w==", + "dev": true, + "requires": { + "lodash": "4.17.11", + "webpack-sources": "1.2.0" + } + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "dev": true, + "requires": { + "invert-kv": "2.0.0" + } + }, + "loader-runner": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.0.tgz", + "integrity": "sha1-9IKuqC1UPgeSFwDVpG7yb9rGuKI=", + "dev": true + }, + "loader-utils": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", + "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", + "dev": true, + "requires": { + "big.js": "3.2.0", + "emojis-list": "2.1.0", + "json5": "0.5.1" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "2.0.0", + "path-exists": "3.0.0" + } + }, + "lodash": { + "version": "4.17.11", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", + "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "dev": true + }, + "lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", + "dev": true + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", + "dev": true + }, + "lodash.uniq": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", + "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=", + "dev": true + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "4.0.0" + } + }, + "lru-cache": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "3.0.0" + } + }, + "mamacro": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz", + "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA==", + "dev": true + }, + "map-age-cleaner": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.2.tgz", + "integrity": "sha512-UN1dNocxQq44IhJyMI4TU8phc2m9BddacHRPRjKGLYaF0jqd3xLz0jS0skpAU9WgYyoR4gHtUpzytNBS385FWQ==", + "dev": true, + "requires": { + "p-defer": "1.0.0" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "1.0.1" + } + }, + "md5.js": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", + "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", + "dev": true, + "requires": { + "hash-base": "3.0.4", + "inherits": "2.0.3" + } + }, + "mdn-data": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-1.2.0.tgz", + "integrity": "sha512-esDqNvsJB2q5V28+u7NdtdMg6Rmg4khQmAVSjUiX7BY/7haIv0K2yWM43hYp0or+3nvG7+UaTF1JHz31hgU1TA==", + "dev": true + }, + "mem": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz", + "integrity": "sha512-WQxG/5xYc3tMbYLXoXPm81ET2WDULiU5FxbuIoNbJqLOOI8zehXFdZuiUEgfdrU2mVB1pxBZUGlYORSrpuJreA==", + "dev": true, + "requires": { + "map-age-cleaner": "0.1.2", + "mimic-fn": "1.2.0", + "p-is-promise": "1.1.0" + } + }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "0.1.7", + "readable-stream": "2.3.6" + } + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "braces": "2.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "extglob": "2.0.4", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.13", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "brorand": "1.1.0" + } + }, + "mime": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.3.1.tgz", + "integrity": "sha512-OEUllcVoydBHGN1z84yfQDimn58pZNNNXgZlHXSboxMlFvgI6MXSWpWKpFRra7H1HxpVhHTkrghfRW49k6yjeg==", + "dev": true + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "mini-css-extract-plugin": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-0.4.2.tgz", + "integrity": "sha512-ots7URQH4wccfJq9Ssrzu2+qupbncAce4TmTzunI9CIwlQMp2XI+WNUw6xWF6MMAGAm1cbUVINrSjATaVMyKXg==", + "dev": true, + "requires": { + "loader-utils": "1.1.0", + "schema-utils": "1.0.0", + "webpack-sources": "1.2.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mississippi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", + "integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==", + "dev": true, + "requires": { + "concat-stream": "1.6.2", + "duplexify": "3.6.0", + "end-of-stream": "1.4.1", + "flush-write-stream": "1.0.3", + "from2": "2.3.0", + "parallel-transform": "1.1.0", + "pump": "2.0.1", + "pumpify": "1.5.1", + "stream-each": "1.2.3", + "through2": "2.0.3" + } + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "1.0.2", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "dev": true, + "requires": { + "aproba": "1.2.0", + "copy-concurrently": "1.0.5", + "fs-write-stream-atomic": "1.0.10", + "mkdirp": "0.5.1", + "rimraf": "2.6.2", + "run-queue": "1.0.3" + } + }, + "ms": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", + "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "dev": true + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "fragment-cache": "0.2.1", + "is-windows": "1.0.2", + "kind-of": "6.0.2", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + } + }, + "neo-async": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.2.tgz", + "integrity": "sha512-vdqTKI9GBIYcAEbFAcpKPErKINfPF5zIuz3/niBfq8WUZjpT2tytLlFVrBgWdOtqI4uaA/Rb6No0hux39XXDuw==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-libs-browser": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", + "integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", + "dev": true, + "requires": { + "assert": "1.4.1", + "browserify-zlib": "0.2.0", + "buffer": "4.9.1", + "console-browserify": "1.1.0", + "constants-browserify": "1.0.0", + "crypto-browserify": "3.12.0", + "domain-browser": "1.2.0", + "events": "1.1.1", + "https-browserify": "1.0.0", + "os-browserify": "0.3.0", + "path-browserify": "0.0.0", + "process": "0.11.10", + "punycode": "1.4.1", + "querystring-es3": "0.2.1", + "readable-stream": "2.3.6", + "stream-browserify": "2.0.1", + "stream-http": "2.8.3", + "string_decoder": "1.1.1", + "timers-browserify": "2.0.10", + "tty-browserify": "0.0.0", + "url": "0.11.0", + "util": "0.10.4", + "vm-browserify": "0.0.4" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } + } + }, + "node-releases": { + "version": "1.0.0-alpha.11", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.0.0-alpha.11.tgz", + "integrity": "sha512-CaViu+2FqTNYOYNihXa5uPS/zry92I3vPU4nCB6JB3OeZ2UGtOpF5gRwuN4+m3hbEcL47bOXyun1jX2iC+3uEQ==", + "dev": true, + "requires": { + "semver": "5.5.1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, + "normalize-url": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz", + "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==", + "dev": true + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "2.0.1" + } + }, + "nth-check": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.1.tgz", + "integrity": "sha1-mSms32KPwsQQmN6rgqxYDPFJquQ=", + "dev": true, + "requires": { + "boolbase": "1.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "0.1.1", + "define-property": "0.2.5", + "kind-of": "3.2.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "object-keys": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", + "dev": true + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "3.0.1" + } + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "dev": true, + "requires": { + "define-properties": "1.1.3", + "es-abstract": "1.12.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "3.0.1" + } + }, + "object.values": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.0.4.tgz", + "integrity": "sha1-5STaCbT2b/Bd9FdUbscqyZ8TBpo=", + "dev": true, + "requires": { + "define-properties": "1.1.3", + "es-abstract": "1.12.0", + "function-bind": "1.1.1", + "has": "1.0.3" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "1.2.0" + } + }, + "optimize-css-assets-webpack-plugin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/optimize-css-assets-webpack-plugin/-/optimize-css-assets-webpack-plugin-5.0.1.tgz", + "integrity": "sha512-Rqm6sSjWtx9FchdP0uzTQDc7GXDKnwVEGoSxjezPkzMewx7gEWE9IMUYKmigTRC4U3RaNSwYVnUDLuIdtTpm0A==", + "dev": true, + "requires": { + "cssnano": "4.1.0", + "last-call-webpack-plugin": "3.0.0" + } + }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, + "os-locale": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.0.1.tgz", + "integrity": "sha512-7g5e7dmXPtzcP4bgsZ8ixDVqA7oWYuEz4lOSujeWyliPai4gfVDiFIcwBg3aGCPnmSGfzOKTK3ccPn0CKv3DBw==", + "dev": true, + "requires": { + "execa": "0.10.0", + "lcid": "2.0.0", + "mem": "4.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-is-promise": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "1.3.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "pako": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", + "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", + "dev": true + }, + "parallel-transform": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", + "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=", + "dev": true, + "requires": { + "cyclist": "0.2.2", + "inherits": "2.0.3", + "readable-stream": "2.3.6" + } + }, + "parse-asn1": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", + "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", + "dev": true, + "requires": { + "asn1.js": "4.10.1", + "browserify-aes": "1.2.0", + "create-hash": "1.2.0", + "evp_bytestokey": "1.0.3", + "pbkdf2": "3.0.16" + } + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "1.3.2", + "json-parse-better-errors": "1.0.2" + } + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", + "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "pbkdf2": { + "version": "3.0.16", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", + "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", + "dev": true, + "requires": { + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "ripemd160": "2.0.2", + "safe-buffer": "5.1.2", + "sha.js": "2.4.11" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "2.1.0" + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "postcss": { + "version": "6.0.23", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-6.0.23.tgz", + "integrity": "sha512-soOk1h6J3VMTZtVeVpv15/Hpdl2cBLX3CAw4TAbkpTJiNPk9YP/zWcD1ND+xEtvyuuvKzbxliTOIyvkSeSJ6ag==", + "dev": true, + "requires": { + "chalk": "2.4.1", + "source-map": "0.6.1", + "supports-color": "5.5.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "postcss-calc": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-6.0.1.tgz", + "integrity": "sha1-PSQXG79udinUIqQ26/5t2VEfQzA=", + "dev": true, + "requires": { + "css-unit-converter": "1.1.1", + "postcss": "6.0.23", + "postcss-selector-parser": "2.2.3", + "reduce-css-calc": "2.1.4" + } + }, + "postcss-colormin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-4.0.1.tgz", + "integrity": "sha1-bxwYoBVbxpYT8v8ThD4uSuj/C74=", + "dev": true, + "requires": { + "browserslist": "4.1.1", + "color": "3.0.0", + "has": "1.0.3", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-convert-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-4.0.0.tgz", + "integrity": "sha1-d9d9mu0dxOaVbmUcw0nVMwWHb2I=", + "dev": true, + "requires": { + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-discard-comments": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-4.0.0.tgz", + "integrity": "sha1-loSimedrPpMmPvj9KtvxocCP2I0=", + "dev": true, + "requires": { + "postcss": "6.0.23" + } + }, + "postcss-discard-duplicates": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-4.0.0.tgz", + "integrity": "sha1-QvPCZ/hfqQngQsNXZ+z9Zcsr1yw=", + "dev": true, + "requires": { + "postcss": "6.0.23" + } + }, + "postcss-discard-empty": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-4.0.0.tgz", + "integrity": "sha1-VeGKWcdBKOOMfSgEvPpAVmEfuX8=", + "dev": true, + "requires": { + "postcss": "6.0.23" + } + }, + "postcss-discard-overridden": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-4.0.0.tgz", + "integrity": "sha1-Sgv4WXh4TPH4HtLBwf2dlkodofo=", + "dev": true, + "requires": { + "postcss": "6.0.23" + } + }, + "postcss-merge-longhand": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-4.0.5.tgz", + "integrity": "sha512-tw2obF6I2VhXhPMObQc1QpQO850m3arhqP3PcBAU7Tx70v73QF6brs9uK0XKMNuC7BPo6DW+fh07cGhrLL57HA==", + "dev": true, + "requires": { + "css-color-names": "0.0.4", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0", + "stylehacks": "4.0.0" + } + }, + "postcss-merge-rules": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-4.0.1.tgz", + "integrity": "sha1-Qw/Vmz8u0uivzQsxJ47aOYVKuxA=", + "dev": true, + "requires": { + "browserslist": "4.1.1", + "caniuse-api": "3.0.0", + "cssnano-util-same-parent": "4.0.0", + "postcss": "6.0.23", + "postcss-selector-parser": "3.1.1", + "vendors": "1.0.2" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz", + "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", + "dev": true, + "requires": { + "dot-prop": "4.2.0", + "indexes-of": "1.0.1", + "uniq": "1.0.1" + } + } + } + }, + "postcss-minify-font-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-font-values/-/postcss-minify-font-values-4.0.0.tgz", + "integrity": "sha1-TMM9KD1qgXWQNudX75gdksvYW+0=", + "dev": true, + "requires": { + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-minify-gradients": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-gradients/-/postcss-minify-gradients-4.0.0.tgz", + "integrity": "sha1-P8ORZDnSepu4Bm23za2AFlDrCQ4=", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "4.0.0", + "is-color-stop": "1.1.0", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-minify-params": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-4.0.0.tgz", + "integrity": "sha1-BekWbuSMBa9lGYnOhNOcG015BnQ=", + "dev": true, + "requires": { + "alphanum-sort": "1.0.2", + "cssnano-util-get-arguments": "4.0.0", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0", + "uniqs": "2.0.0" + } + }, + "postcss-minify-selectors": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-4.0.0.tgz", + "integrity": "sha1-sen2xGNBbT/Nyybnt4XZX2FXiq0=", + "dev": true, + "requires": { + "alphanum-sort": "1.0.2", + "has": "1.0.3", + "postcss": "6.0.23", + "postcss-selector-parser": "3.1.1" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz", + "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", + "dev": true, + "requires": { + "dot-prop": "4.2.0", + "indexes-of": "1.0.1", + "uniq": "1.0.1" + } + } + } + }, + "postcss-modules-extract-imports": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.2.0.tgz", + "integrity": "sha1-ZhQOzs447wa/DT41XWm/WdFB6oU=", + "dev": true, + "requires": { + "postcss": "6.0.23" + } + }, + "postcss-modules-local-by-default": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.2.0.tgz", + "integrity": "sha1-99gMOYxaOT+nlkRmvRlQCn1hwGk=", + "dev": true, + "requires": { + "css-selector-tokenizer": "0.7.0", + "postcss": "6.0.23" + } + }, + "postcss-modules-scope": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/postcss-modules-scope/-/postcss-modules-scope-1.1.0.tgz", + "integrity": "sha1-1upkmUx5+XtipytCb75gVqGUu5A=", + "dev": true, + "requires": { + "css-selector-tokenizer": "0.7.0", + "postcss": "6.0.23" + } + }, + "postcss-modules-values": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/postcss-modules-values/-/postcss-modules-values-1.3.0.tgz", + "integrity": "sha1-7P+p1+GSUYOJ9CrQ6D9yrsRW6iA=", + "dev": true, + "requires": { + "icss-replace-symbols": "1.1.0", + "postcss": "6.0.23" + } + }, + "postcss-normalize-charset": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-4.0.0.tgz", + "integrity": "sha1-JFJyknAtXoEp6vo9HeSe1RpqtzA=", + "dev": true, + "requires": { + "postcss": "6.0.23" + } + }, + "postcss-normalize-display-values": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-display-values/-/postcss-normalize-display-values-4.0.0.tgz", + "integrity": "sha1-lQ4Me+NEV3ChYP/9a2ZEw8DNj4k=", + "dev": true, + "requires": { + "cssnano-util-get-match": "4.0.0", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-normalize-positions": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-positions/-/postcss-normalize-positions-4.0.0.tgz", + "integrity": "sha1-7pNDq5gbgixjq3JhXszNCFZERaM=", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "4.0.0", + "has": "1.0.3", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-normalize-repeat-style": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-4.0.0.tgz", + "integrity": "sha1-txHFks8W+vn/V15C+hALZ5kIPv8=", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "4.0.0", + "cssnano-util-get-match": "4.0.0", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-normalize-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-string/-/postcss-normalize-string-4.0.0.tgz", + "integrity": "sha1-cYy20wpvrGrGqDDjLAbAfbxm/l0=", + "dev": true, + "requires": { + "has": "1.0.3", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-normalize-timing-functions": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-timing-functions/-/postcss-normalize-timing-functions-4.0.0.tgz", + "integrity": "sha1-A1HymIaqmB1D2RssK9GuptCvbSM=", + "dev": true, + "requires": { + "cssnano-util-get-match": "4.0.0", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-normalize-unicode": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-4.0.0.tgz", + "integrity": "sha1-Ws1dR7rqXRdnSyzMSuUWb6iM35c=", + "dev": true, + "requires": { + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-normalize-url": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-url/-/postcss-normalize-url-4.0.0.tgz", + "integrity": "sha1-t6nIrSbPJmlMFG6y1ovQz0mVbw0=", + "dev": true, + "requires": { + "is-absolute-url": "2.1.0", + "normalize-url": "3.3.0", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-normalize-whitespace": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-normalize-whitespace/-/postcss-normalize-whitespace-4.0.0.tgz", + "integrity": "sha1-HafnaxCuY8EYJ/oE/Du0oe/pnMA=", + "dev": true, + "requires": { + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-ordered-values": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-ordered-values/-/postcss-ordered-values-4.1.0.tgz", + "integrity": "sha512-gbqbEiONKKJgoOKhtzBjFqmHSzviPL4rv0ACVcFS7wxWXBY07agFXRQ7Y3eMGV0ZORzQXp2NGnj0c+imJG0NcA==", + "dev": true, + "requires": { + "cssnano-util-get-arguments": "4.0.0", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-reduce-initial": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-4.0.1.tgz", + "integrity": "sha1-8tWPUM6isMXcEnjW6l7Q/1gpwpM=", + "dev": true, + "requires": { + "browserslist": "4.1.1", + "caniuse-api": "3.0.0", + "has": "1.0.3", + "postcss": "6.0.23" + } + }, + "postcss-reduce-transforms": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-reduce-transforms/-/postcss-reduce-transforms-4.0.0.tgz", + "integrity": "sha1-9kX8dEDDUnT0DegQThStcWPt8Yg=", + "dev": true, + "requires": { + "cssnano-util-get-match": "4.0.0", + "has": "1.0.3", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0" + } + }, + "postcss-selector-parser": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-2.2.3.tgz", + "integrity": "sha1-+UN3iGBsPJrO4W/+jYsWKX8nu5A=", + "dev": true, + "requires": { + "flatten": "1.0.2", + "indexes-of": "1.0.1", + "uniq": "1.0.1" + } + }, + "postcss-svgo": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-svgo/-/postcss-svgo-4.0.0.tgz", + "integrity": "sha1-wLutAlIPxjbJ14sOhAPi5RXDIoU=", + "dev": true, + "requires": { + "is-svg": "3.0.0", + "postcss": "6.0.23", + "postcss-value-parser": "3.3.0", + "svgo": "1.0.5" + } + }, + "postcss-unique-selectors": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-4.0.0.tgz", + "integrity": "sha1-BMHpdkx1h0JhMDQCxB8Ol2n8VQE=", + "dev": true, + "requires": { + "alphanum-sort": "1.0.2", + "postcss": "6.0.23", + "uniqs": "2.0.0" + } + }, + "postcss-value-parser": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.0.tgz", + "integrity": "sha1-h/OPnxj3dKSrTIojL1xc6IcqnRU=", + "dev": true + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "public-encrypt": { + "version": "4.0.2", + "resolved": "http://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", + "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "browserify-rsa": "4.0.1", + "create-hash": "1.2.0", + "parse-asn1": "5.1.1", + "randombytes": "2.0.6" + } + }, + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, + "requires": { + "end-of-stream": "1.4.1", + "once": "1.4.0" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "dev": true, + "requires": { + "duplexify": "3.6.0", + "inherits": "2.0.3", + "pump": "2.0.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", + "dev": true + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "randombytes": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", + "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "2.0.6", + "safe-buffer": "5.1.2" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "micromatch": "3.1.10", + "readable-stream": "2.3.6" + } + }, + "reduce-css-calc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/reduce-css-calc/-/reduce-css-calc-2.1.4.tgz", + "integrity": "sha512-i/vWQbyd3aJRmip9OVSN9V6nIjLf/gg/ctxb0CpvHWtcRysFl/ngDBQD+rqavxdw/doScA3GMBXhzkHQ4GCzFQ==", + "dev": true, + "requires": { + "css-unit-converter": "1.1.1", + "postcss-value-parser": "3.3.0" + } + }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-7.0.0.tgz", + "integrity": "sha512-s5NGghCE4itSlUS+0WUj88G6cfMVMmH8boTPNvABf8od+2dhT9WDlWu8n01raQAJZMOK8Ch6jSexaRO7swd6aw==", + "dev": true, + "requires": { + "regenerate": "1.4.0" + } + }, + "regenerator-transform": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.13.3.tgz", + "integrity": "sha512-5ipTrZFSq5vU2YoGoww4uaRVAK4wyYC4TSICibbfEPOruUu8FFP7ErV0BjmbIOEpn3O/k9na9UEdYR/3m7N6uA==", + "dev": true, + "requires": { + "private": "0.1.8" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "3.0.2", + "safe-regex": "1.1.0" + } + }, + "regexpu-core": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.2.0.tgz", + "integrity": "sha512-Z835VSnJJ46CNBttalHD/dB+Sj2ezmY6Xp38npwU87peK6mqOzOpV8eYktdkLTEkzzD+JsTcxd84ozd8I14+rw==", + "dev": true, + "requires": { + "regenerate": "1.4.0", + "regenerate-unicode-properties": "7.0.0", + "regjsgen": "0.4.0", + "regjsparser": "0.3.0", + "unicode-match-property-ecmascript": "1.0.4", + "unicode-match-property-value-ecmascript": "1.0.2" + } + }, + "regjsgen": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.4.0.tgz", + "integrity": "sha512-X51Lte1gCYUdlwhF28+2YMO0U6WeN0GLpgpA7LK7mbdDnkQYiwvEpmpe0F/cv5L14EbxgrdayAG3JETBv0dbXA==", + "dev": true + }, + "regjsparser": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.3.0.tgz", + "integrity": "sha512-zza72oZBBHzt64G7DxdqrOo/30bhHkwMUoT0WqfGu98XLd7N+1tsy5MJ96Bk4MD0y74n629RhmrGW6XlnLLwCA==", + "dev": true, + "requires": { + "jsesc": "0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "1.0.6" + } + }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "dev": true, + "requires": { + "resolve-from": "3.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "2.0.1", + "signal-exit": "3.0.2" + } + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "rgb-regex": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rgb-regex/-/rgb-regex-1.0.1.tgz", + "integrity": "sha1-wODWiC3w4jviVKR16O3UGRX+rrE=", + "dev": true + }, + "rgba-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/rgba-regex/-/rgba-regex-1.0.0.tgz", + "integrity": "sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=", + "dev": true + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "3.0.4", + "inherits": "2.0.3" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "2.1.0" + } + }, + "run-queue": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "dev": true, + "requires": { + "aproba": "1.2.0" + } + }, + "rxjs": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.2.tgz", + "integrity": "sha512-hV7criqbR0pe7EeL3O66UYVg92IR0XsA97+9y+BWTePK9SKmEI5Qd3Zj6uPnGkNzXsBywBQWTvujPl+1Kn9Zjw==", + "dev": true, + "requires": { + "tslib": "1.9.3" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "0.1.15" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, + "schema-utils": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", + "integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==", + "dev": true, + "requires": { + "ajv": "6.5.3", + "ajv-errors": "1.0.0", + "ajv-keywords": "3.2.0" + } + }, + "semver": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", + "dev": true + }, + "serialize-javascript": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz", + "integrity": "sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "split-string": "3.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "sha.js": { + "version": "2.4.11", + "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "simple-swizzle": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", + "integrity": "sha1-pNprY1/8zMoz9w0Xy5JZLeleVXo=", + "dev": true, + "requires": { + "is-arrayish": "0.3.2" + }, + "dependencies": { + "is-arrayish": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", + "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==", + "dev": true + } + } + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "0.11.2", + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "map-cache": "0.2.2", + "source-map": "0.5.7", + "source-map-resolve": "0.5.2", + "use": "3.1.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "1.0.0", + "isobject": "3.0.1", + "snapdragon-util": "3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "source-list-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", + "integrity": "sha512-I2UmuJSRr/T8jisiROLU3A3ltr+swpniSmNPI4Ml3ZCX6tVnDsuZzK7F2hl5jTqbZBWCEKlj5HRQiPExXLgE8A==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "2.1.2", + "decode-uri-component": "0.2.0", + "resolve-url": "0.2.1", + "source-map-url": "0.4.0", + "urix": "0.1.0" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "3.0.2" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "ssri": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", + "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "stable": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "0.2.5", + "object-copy": "0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + } + } + }, + "stream-browserify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", + "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.6" + } + }, + "stream-each": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", + "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==", + "dev": true, + "requires": { + "end-of-stream": "1.4.1", + "stream-shift": "1.0.0" + } + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "dev": true, + "requires": { + "builtin-status-codes": "3.0.0", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "to-arraybuffer": "1.0.1", + "xtend": "4.0.1" + } + }, + "stream-shift": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", + "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + } + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "style-loader": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-0.23.0.tgz", + "integrity": "sha512-uCcN7XWHkqwGVt7skpInW6IGO1tG6ReyFQ1Cseh0VcN6VdcFQi62aG/2F3Y9ueA8x4IVlfaSUxpmQXQD9QrEuQ==", + "dev": true, + "requires": { + "loader-utils": "1.1.0", + "schema-utils": "0.4.7" + }, + "dependencies": { + "schema-utils": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", + "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==", + "dev": true, + "requires": { + "ajv": "6.5.3", + "ajv-keywords": "3.2.0" + } + } + } + }, + "stylehacks": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-4.0.0.tgz", + "integrity": "sha1-ZLMjlRxKJOX8ey7AbBN78y0VXoo=", + "dev": true, + "requires": { + "browserslist": "4.1.1", + "postcss": "6.0.23", + "postcss-selector-parser": "3.1.1" + }, + "dependencies": { + "postcss-selector-parser": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-3.1.1.tgz", + "integrity": "sha1-T4dfSvsMllc9XPTXQBGu4lCn6GU=", + "dev": true, + "requires": { + "dot-prop": "4.2.0", + "indexes-of": "1.0.1", + "uniq": "1.0.1" + } + } + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + }, + "svgo": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/svgo/-/svgo-1.0.5.tgz", + "integrity": "sha512-nYrifviB77aNKDNKKyuay3M9aYiK6Hv5gJVDdjj2ZXTQmI8WZc8+UPLR5IpVlktJfSu3co/4XcWgrgI6seGBPg==", + "dev": true, + "requires": { + "coa": "2.0.1", + "colors": "1.1.2", + "css-select": "1.3.0-rc0", + "css-select-base-adapter": "0.1.0", + "css-tree": "1.0.0-alpha25", + "css-url-regex": "1.1.0", + "csso": "3.5.1", + "js-yaml": "3.10.0", + "mkdirp": "0.5.1", + "object.values": "1.0.4", + "sax": "1.2.4", + "stable": "0.1.8", + "unquote": "1.1.1", + "util.promisify": "1.0.0" + }, + "dependencies": { + "js-yaml": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "dev": true, + "requires": { + "argparse": "1.0.10", + "esprima": "4.0.1" + } + } + } + }, + "tapable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.0.tgz", + "integrity": "sha512-IlqtmLVaZA2qab8epUXbVWRn3aB1imbDMJtjB3nu4X0NqPkcY/JH9ZtCBWKHWPxs8Svi9tyo8w2dBoi07qZbBA==", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "2.3.6", + "xtend": "4.0.1" + } + }, + "timers-browserify": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", + "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", + "dev": true, + "requires": { + "setimmediate": "1.0.5" + } + }, + "timsort": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", + "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "regex-not": "1.0.2", + "safe-regex": "1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "repeat-string": "1.6.1" + } + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "dev": true + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "uglify-es": { + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "dev": true, + "requires": { + "commander": "2.13.0", + "source-map": "0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "uglifyjs-webpack-plugin": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.3.0.tgz", + "integrity": "sha512-ovHIch0AMlxjD/97j9AYovZxG5wnHOPkL7T1GKochBADp/Zwc44pEWNqpKl1Loupp1WhFg7SlYmHZRUfdAacgw==", + "dev": true, + "requires": { + "cacache": "10.0.4", + "find-cache-dir": "1.0.0", + "schema-utils": "0.4.7", + "serialize-javascript": "1.5.0", + "source-map": "0.6.1", + "uglify-es": "3.3.9", + "webpack-sources": "1.2.0", + "worker-farm": "1.6.0" + }, + "dependencies": { + "schema-utils": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", + "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==", + "dev": true, + "requires": { + "ajv": "6.5.3", + "ajv-keywords": "3.2.0" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "dev": true, + "requires": { + "unicode-canonical-property-names-ecmascript": "1.0.4", + "unicode-property-aliases-ecmascript": "1.0.4" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz", + "integrity": "sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ==", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz", + "integrity": "sha512-2WSLa6OdYd2ng8oqiGIWnJqyFArvhn+5vgx5GTxMbUYjCYKUcuKS62YLFF0R/BDGlB1yzXjQOLtPAfHsgirEpg==", + "dev": true + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "get-value": "2.0.6", + "is-extendable": "0.1.1", + "set-value": "0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "to-object-path": "0.3.0" + } + } + } + }, + "uniq": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", + "dev": true + }, + "uniqs": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/uniqs/-/uniqs-2.0.0.tgz", + "integrity": "sha1-/+3ks2slKQaW5uFl1KWe25mOawI=", + "dev": true + }, + "unique-filename": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.0.tgz", + "integrity": "sha1-0F8v5AMlYIcfMOk8vnNe6iAVFPM=", + "dev": true, + "requires": { + "unique-slug": "2.0.0" + } + }, + "unique-slug": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.0.tgz", + "integrity": "sha1-22Z258fMBimHj/GWCXx4hVrp9Ks=", + "dev": true, + "requires": { + "imurmurhash": "0.1.4" + } + }, + "unquote": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unquote/-/unquote-1.1.1.tgz", + "integrity": "sha1-j97XMk7G6IoP+LkF58CYzcCG1UQ=", + "dev": true + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "0.3.1", + "isobject": "3.0.1" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "0.1.4", + "isobject": "2.1.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "upath": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", + "dev": true + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "2.1.1" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "url-loader": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/url-loader/-/url-loader-1.1.1.tgz", + "integrity": "sha512-vugEeXjyYFBCUOpX+ZuaunbK3QXMKaQ3zUnRfIpRBlGkY7QizCnzyyn2ASfcxsvyU3ef+CJppVywnl3Kgf13Gg==", + "dev": true, + "requires": { + "loader-utils": "1.1.0", + "mime": "2.3.1", + "schema-utils": "1.0.0" + } + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "dev": true, + "requires": { + "define-properties": "1.1.3", + "object.getownpropertydescriptors": "2.0.3" + } + }, + "v8-compile-cache": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.2.tgz", + "integrity": "sha512-1wFuMUIM16MDJRCrpbpuEPTUGmM5QMUg0cr3KFwra2XgOgFcPGDQHDh3CszSCD2Zewc/dh/pamNEW8CbfDebUw==", + "dev": true + }, + "vendors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/vendors/-/vendors-1.0.2.tgz", + "integrity": "sha512-w/hry/368nO21AN9QljsaIhb9ZiZtZARoVH5f3CsFbawdLdayCgKRPup7CggujvySMxx0I91NOyxdVENohprLQ==", + "dev": true + }, + "vm-browserify": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", + "dev": true, + "requires": { + "indexof": "0.0.1" + } + }, + "watchpack": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", + "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", + "dev": true, + "requires": { + "chokidar": "2.0.4", + "graceful-fs": "4.1.11", + "neo-async": "2.5.2" + } + }, + "webpack": { + "version": "4.19.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.19.0.tgz", + "integrity": "sha512-Ak3mMGtA8F1ar4ZP6VCLiICNIPoillROGYstnEd+LzI5Tkvz0qTITeTMcAFjxyYsaxu98F97yrCWdcxRUMPAYw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.6", + "@webassemblyjs/helper-module-context": "1.7.6", + "@webassemblyjs/wasm-edit": "1.7.6", + "@webassemblyjs/wasm-parser": "1.7.6", + "acorn": "5.7.3", + "acorn-dynamic-import": "3.0.0", + "ajv": "6.5.3", + "ajv-keywords": "3.2.0", + "chrome-trace-event": "1.0.0", + "enhanced-resolve": "4.1.0", + "eslint-scope": "4.0.0", + "json-parse-better-errors": "1.0.2", + "loader-runner": "2.3.0", + "loader-utils": "1.1.0", + "memory-fs": "0.4.1", + "micromatch": "3.1.10", + "mkdirp": "0.5.1", + "neo-async": "2.5.2", + "node-libs-browser": "2.1.0", + "schema-utils": "0.4.7", + "tapable": "1.1.0", + "uglifyjs-webpack-plugin": "1.3.0", + "watchpack": "1.6.0", + "webpack-sources": "1.2.0" + }, + "dependencies": { + "schema-utils": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", + "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==", + "dev": true, + "requires": { + "ajv": "6.5.3", + "ajv-keywords": "3.2.0" + } + } + } + }, + "webpack-cli": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.1.0.tgz", + "integrity": "sha512-p5NeKDtYwjZozUWq6kGNs9w+Gtw/CPvyuXjXn2HMdz8Tie+krjEg8oAtonvIyITZdvpF7XG9xDHwscLr2c+ugQ==", + "dev": true, + "requires": { + "chalk": "2.4.1", + "cross-spawn": "6.0.5", + "enhanced-resolve": "4.1.0", + "global-modules-path": "2.3.0", + "import-local": "1.0.0", + "inquirer": "6.2.0", + "interpret": "1.1.0", + "loader-utils": "1.1.0", + "supports-color": "5.5.0", + "v8-compile-cache": "2.0.2", + "yargs": "12.0.2" + } + }, + "webpack-sources": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.2.0.tgz", + "integrity": "sha512-9BZwxR85dNsjWz3blyxdOhTgtnQvv3OEs5xofI0wPYTwu5kaWxS08UuD1oI7WLBLpRO+ylf0ofnXLXWmGb2WMw==", + "dev": true, + "requires": { + "source-list-map": "2.0.0", + "source-map": "0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "worker-farm": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz", + "integrity": "sha512-6w+3tHbM87WnSWnENBUvA2pxJPLhQUg5LKwUQHq3r+XPhIM+Gh2R5ycbwPCyuGbNg+lPgdcnQUhuC02kJCvffQ==", + "dev": true, + "requires": { + "errno": "0.1.7" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "xregexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.0.0.tgz", + "integrity": "sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg==", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.2.tgz", + "integrity": "sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==", + "dev": true, + "requires": { + "cliui": "4.1.0", + "decamelize": "2.0.0", + "find-up": "3.0.0", + "get-caller-file": "1.0.3", + "os-locale": "3.0.1", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "4.0.0", + "yargs-parser": "10.1.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "3.0.0", + "path-exists": "3.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + } + } + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "4.1.0" + } + } + } +} diff --git a/core/package.json b/core/package.json index 2662fcb3..e920994f 100644 --- a/core/package.json +++ b/core/package.json @@ -1,14 +1,22 @@ { - "babel": { - "presets": [ - "env" - ] - }, + "name": "mathtype-js-lib", + "description": "MathType Web Integration API", + "main": "core.src.js", "scripts": { - "build": "babel core.src.js --out-file core.js --watch" + "build-dev": "webpack --mode development", + "build": "webpack --mode production" }, + "license": "GPL-3.0", "devDependencies": { - "babel-cli": "^6.26.0", - "babel-preset-env": "^1.7.0" + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "babel-loader": "^8.0.2", + "css-loader": "^1.0.0", + "mini-css-extract-plugin": "^0.4.2", + "optimize-css-assets-webpack-plugin": "^5.0.1", + "style-loader": "^0.23.0", + "url-loader": "^1.1.1", + "webpack": "^4.17.2", + "webpack-cli": "^3.1.0" } } diff --git a/core/src/accessibility.js b/core/src/accessibility.js new file mode 100644 index 00000000..c1b48d55 --- /dev/null +++ b/core/src/accessibility.js @@ -0,0 +1,52 @@ +import TextCache from './cache'; +import Core from './core.src'; +import ServiceProvider from './serviceprovider'; +import MathML from './mathml.js'; + +/** + * Class representing MathType accessible class. This class converts MathML into accessible text. + */ +export default class Accessibility { + + /** + * Gets the accessible text of a given MathML calling mathml2accessible service. + * @param {string} mathML - MathML to be converted to accessible text. + * @param {string} language - language of the accessible text. + * @param {Object[]} data - object containing parameters to send to textService service. + * @return {string} Accessibility from mathml string on language string. + */ + static mathMLToAccessible(mathML, language, data) { + // Check MathML class. If the class is chemistry, + // we add chemistry to data to force accessibility service + // to load chemistry grammar. + if (MathML.containClass(mathML, 'wrs_chemistry')) { + data['mode'] = 'chemistry'; + } + var accessibleText; + + if (Accessibility.cache.get(mathML)) { + accessibleText = Accessibility.cache.get[mathML]; + } + else { + data['service'] = 'mathml2accessible'; + data['lang'] = language; + var accessibleJsonResponse = JSON.parse(ServiceProvider.getService('service', data)); + if (accessibleJsonResponse.status != 'error') { + accessibleText = accessibleJsonResponse.result.text; + Accessibility.cache.populate(mathML, accessibleText); + } + else { + accessibleText = Core.getStringManager().getString('error_convert_accessibility'); + } + } + + return accessibleText; + } +} + +/** + * Static property. This property contains an instance of TextCache class to manage the JavaScript accessible cache. + * Each entry of the cache object contains the MathML and it's correspondent accessibility text. + * @type {TextCache} + */ +Accessibility.cache = new TextCache(); diff --git a/core/src/backwardslib.js b/core/src/backwardslib.js new file mode 100644 index 00000000..8a4f342b --- /dev/null +++ b/core/src/backwardslib.js @@ -0,0 +1,65 @@ +import Core from './core.src'; +import Parser from './parser'; +import Listeners from './listeners'; + +var backwardsLib; +export default backwardsLib; + +// Backward compatibility library for public methods previous to version 7.6.0 +/** + * Add a new callback to a MathType listener. + * @param {Object} jsonListener - an Object containing listener name and a callback. + * @tutorial tutorial + * @deprecated Since version 7.6.0. Use Listeners.newListener instead. + */ +function wrs_addPluginListener(jsonListener) { + // TODO: Add documentation URL + doc example. + console.warn('Deprecated method'); + var eventName; + eventName = Object.keys(jsonListener)[0]; + var callback; + callback = jsonListener[eventName]; + var pluginListener = Listeners.newListener(eventName, callback); + Core.addGlobalListener(pluginListener); +} + +// Expose the method globally. +window.wrs_addPluginListener = wrs_addPluginListener; + +/** + * Parses initial HTML code. If the HTML contains data generated by WIRIS, this data would be converted as following: + *
+ * MathML code: Image containing the corresponding MathML formulas.
+ * MathML code with LaTeX annotation : LaTeX.
+ * 
+ * @param {string} code - HTML code with data generated by MathType. + * @param {string} language - language for the formula. + * @return {string} HTML code with the WIRIS data converted into LaTeX and images. + * @deprecated Since version 7.6.0. Use Parser.initParse instead. + */ +function wrs_initParse(code, language) { + console.warn('Deprecated method. Use Parser.endParse instead.'); + return Parser.initParse(code, language); +} + +// Expose the method globally. +window.wrs_initParse = wrs_initParse; + + +/** + * Parses end HTML code. The end HTML code is HTML code with embedded images or LaTeX formulas created with MathType.
+ * By default this method converts the formula images and LaTeX strings in MathML.
+ * If image mode is enabled the images will not be converted into MathML. For further information see {@link http://www.wiris.com/plugins/docs/full-mathml-mode}. + * @param {string} code - string to be parsed. + * @param {Object} wirisProperties - extra attributes for the formula. + * @param {string} language - language for the formula. + * @return {string} + * @deprecated Since version 7.6.0. Use Parser.initParse instead. + */ +function wrs_endParse(code, wirisProperties, language) { + console.warn('Deprecated method. Use Parser.endParse instead.') + return Parser.endParse(code, wirisProperties, language); +} + +// Expose the method globally. +window.wrs_endParse = wrs_endParse; diff --git a/core/src/cache.js b/core/src/cache.js new file mode 100644 index 00000000..35305138 --- /dev/null +++ b/core/src/cache.js @@ -0,0 +1,37 @@ +/** + * Class representing a client cache class. This class contains pairs of + * strings (key/value) which can be retrieved in any moment. Usually used + * to store AJAX responses for text services like mathml2latex. + */ +export default class TextCache { + constructor() { + /** + * Cache array object. Contains all cache entries. + * @type {Object[]} + */ + this.cache = []; + } + + /** + * This method populates a key/value pair into the cache property. + * @param {string} key - The cache key, usually the service string parameter. + * @param {string} value - The cache value, usually the service response. + */ + populate(key, value) { + this.cache[key] = value; + } + + /** + * This method retrieves a cache value. Usually called before call a text service. + * @param {string} key - The cache key, usually the service string parameter. + * @return {string} value - The cache value, if exists. False otherwise. + */ + get(key) { + if (this.cache.hasOwnProperty(key)) { + return this.cache[key] + } + else { + return false; + } + } +} diff --git a/core/src/cas.js b/core/src/cas.js new file mode 100644 index 00000000..03831ca9 --- /dev/null +++ b/core/src/cas.js @@ -0,0 +1,253 @@ +var wrs_int_opener; +var appletObject; +var initialXML = ''; +var closeFunction; + +if (window.opener) { // For popup mode. + wrs_int_opener = window.opener; + closeFunction = window.close; +} +// FCKeditor integration begin +else { // For iframe mode. + wrs_int_opener = window.parent; + + while (wrs_int_opener.InnerDialogLoaded) { + wrs_int_opener = wrs_int_opener.parent; + } +} + +if (window.parent.InnerDialogLoaded) { // Iframe mode. + window.parent.InnerDialogLoaded(); + closeFunction = window.parent.Cancel; +} +else if (window.opener.parent.FCKeditorAPI) { // Popup mode. + wrs_int_opener = window.opener.parent; +} +// FCKeditor integration end. + +function getMathmlFromAppletCode(appletCode) { + var optionForm = document.getElementById('optionForm'); + appletObject = wrs_int_opener.wrs_createObject(appletCode, document); + + optionForm.width.value = parseInt(appletObject.width); + optionForm.height.value = parseInt(appletObject.height); + + var params = appletObject.childNodes; + var mathml = ''; + + for (var i = 0; i < params.length; ++i) { + if (params[i].name == 'xmlinitialtext') { + mathml = params[i].value; + } + else if (params[i].name == 'requestfirstevaluation') { + optionForm.executeonload.checked = (params[i].value == 'true') ? true : false; + } + else if (params[i].name == 'toolbar') { + optionForm.toolbar.checked = (params[i].value == 'floating') ? false : true; + } + else if (params[i].name == 'requestfocus') { + optionForm.focusonload.checked = (params[i].value == 'true') ? true : false; + } + else if (params[i].name == 'level') { + optionForm.level.checked = (params[i].value == 'primary') ? true : false; + } + } + + return mathml; +} + +function createIframePath(params) { + var iframePath = wrs_int_opener._wrs_conf_CASPath; + iframePath += ((iframePath.indexOf('?') == -1) ? '?' : '&') + 'mode=applet&'; + + for (var i in params) { + iframePath += wrs_int_opener.wrs_urlencode(i) + '=' + wrs_int_opener.wrs_urlencode(params[i]); + } + + return iframePath; +} + +function createIframe(params) { + var iframe = document.createElement('iframe'); + iframe.id = 'appletContainerIframe'; + iframe.src = createIframePath(params); + iframe.width = '100%'; + iframe.height = '100%'; + iframe.frameBorder = 0; + + wrs_int_opener.wrs_addEvent(iframe, 'load', function () { + if (initialXML.length > 0) { + var applet = iframe.contentWindow.document.getElementById('applet'); + + function setAppletMathml() { + // Internet explorer fails on "applet.isActive". It only supports "applet.isActive()". + + try { + if (applet.isActive()) { + applet.setXML(initialXML); + } + else { + setTimeout(setAppletMathml, 50); + } + } + catch (e) { + setTimeout(setAppletMathml, 50); + } + } + + setAppletMathml(); + } + }); + + document.getElementById('appletContainer').appendChild(iframe); +} + +function reloadIframe(params) { + var iframe = document.getElementById('appletContainerIframe'); + var applet = iframe.contentWindow.document.getElementById('applet'); + initialXML = applet.getXML(); + iframe.src = createIframePath(params); +} + +wrs_int_opener.wrs_addEvent(window, 'load', function () { + // Getting language list object changes its value, the iframe should be refreshed. + + wrs_int_opener.wrs_addEvent(languageList, 'change', function () { + reloadIframe({ + 'lang': languageList.value + }); + }); + + // Setting iframe language. + var language; + + if (wrs_int_opener._wrs_isNewElement) { + var queryParams = wrs_int_opener.wrs_getQueryParams(window); + + var availableLangs = new Array(); + for (var i = 0; i < languageList.options.length; i++){ + availableLangs[i] = languageList.options[i].value; + } + + if (typeof queryParams['lang'] != 'undefined' && wrs_int_opener.wrs_arrayContains(availableLangs, queryParams['lang']) != -1){ + language = queryParams['lang']; + }else if (typeof queryParams['lang'] != 'undefined' && wrs_int_opener.wrs_arrayContains(availableLangs, queryParams['lang'].substr(0,2)) != -1){ + language = queryParams['lang'].substr(0,2); + }else{ + language = wrs_int_opener._wrs_int_language + } + } + else { + var appletCode = wrs_int_opener._wrs_temporalImage.getAttribute(wrs_int_opener._wrs_conf_CASMathmlAttribute); + initialXML = getMathmlFromAppletCode(wrs_int_opener.wrs_mathmlDecode(appletCode)); + + var language = ''; + + // We can convert initialXML to an object and get its "lang" value. However, IE does not support this functionability, so we use string parsing. + var languageStart = initialXML.indexOf('lang="'); + + if (languageStart != -1) { + var languageEnd = initialXML.indexOf('"', languageStart + 6); // 6+ because 'lang="'.length is 6. + + if (languageEnd != -1) { + language = initialXML.substring(languageStart + 6, languageEnd); + } + } + } + + // Creating the iframe. + + createIframe({ + 'lang': language + }); + + // Selecting the language on the