formiojs
Version:
Common js library for client side interaction with <form.io>
51 lines (43 loc) • 3.8 MB
JavaScript
/*
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
* This devtool is neither made for production nor for readable output files.
* It uses "eval()" calls to create a separate source file in the browser devtools.
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
* or disable the default devtool with "devtool: false".
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Formio"] = factory();
else
root["Formio"] = factory();
})(self, function() {
return /******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./lib/Element.js":
/*!************************!*\
!*** ./lib/Element.js ***!
\************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es.weak-map.js */ \"./node_modules/core-js/modules/es.weak-map.js\");\n\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\n__webpack_require__(/*! core-js/modules/es.object.assign.js */ \"./node_modules/core-js/modules/es.object.assign.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n\n__webpack_require__(/*! core-js/modules/es.regexp.constructor.js */ \"./node_modules/core-js/modules/es.regexp.constructor.js\");\n\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n\nvar _EventEmitter = _interopRequireDefault(__webpack_require__(/*! ./EventEmitter */ \"./lib/EventEmitter.js\"));\n\nvar _Formio = __webpack_require__(/*! ./Formio */ \"./lib/Formio.js\");\n\nvar FormioUtils = _interopRequireWildcard(__webpack_require__(/*! ./utils/utils */ \"./lib/utils/utils.js\"));\n\nvar _i18next = _interopRequireDefault(__webpack_require__(/*! i18next */ \"./node_modules/i18next/dist/cjs/i18next.js\"));\n\nvar _lodash = _interopRequireDefault(__webpack_require__(/*! lodash */ \"./node_modules/lodash/lodash.js\"));\n\nvar _moment = _interopRequireDefault(__webpack_require__(/*! moment */ \"./node_modules/moment/moment.js\"));\n\nvar _vanillaTextMask = _interopRequireDefault(__webpack_require__(/*! @formio/vanilla-text-mask */ \"./node_modules/@formio/vanilla-text-mask/dist/vanillaTextMask.js\"));\n\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\n\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n/**\n * The root component for all elements within the Form.io renderer.\n */\nvar Element = /*#__PURE__*/function () {\n function Element(options) {\n _classCallCheck(this, Element);\n\n /**\n * The options for this component.\n * @type {{}}\n */\n this.options = Object.assign({\n language: 'en',\n highlightErrors: true,\n componentErrorClass: 'formio-error-wrapper',\n componentWarningClass: 'formio-warning-wrapper',\n row: '',\n namespace: 'formio'\n }, options || {});\n /**\n * The ID of this component. This value is auto-generated when the component is created, but\n * can also be provided from the component.id value passed into the constructor.\n * @type {string}\n */\n\n this.id = FormioUtils.getRandomComponentId();\n /**\n * An array of event handlers so that the destry command can deregister them.\n * @type {Array}\n */\n\n this.eventHandlers = []; // Use the i18next that is passed in, otherwise use the global version.\n\n this.i18next = this.options.i18next || _i18next.default;\n /**\n * An instance of the EventEmitter class to handle the emitting and registration of events.\n *\n * @type {EventEmitter}\n */\n\n this.events = options && options.events ? options.events : new _EventEmitter.default();\n this.defaultMask = null;\n /**\n * Conditional to show or hide helplinks in editForm\n *\n * @type {*|boolean}\n */\n\n this.helplinks = this.helplinks = this.options.helplinks === 'false' ? false : this.options.helplinks || 'https://help.form.io';\n }\n /**\n * Register for a new event within this component.\n *\n * @example\n * let component = new BaseComponent({\n * type: 'textfield',\n * label: 'First Name',\n * key: 'firstName'\n * });\n * component.on('componentChange', (changed) => {\n * console.log('this element is changed.');\n * });\n *\n *\n * @param {string} event - The event you wish to register the handler for.\n * @param {function} cb - The callback handler to handle this event.\n */\n\n\n _createClass(Element, [{\n key: \"on\",\n value: function on(event, cb, internal) {\n var once = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n\n if (!this.events) {\n return;\n }\n\n var type = \"\".concat(this.options.namespace, \".\").concat(event); // Store the component id in the handler so that we can determine which events are for this component.\n\n cb.id = this.id;\n cb.key = this.key;\n cb.internal = internal; // Register for this event.\n\n return this.events[once ? 'once' : 'on'](type, cb);\n }\n /**\n * Register for a new single-fire event within this component.\n *\n * @param {string} event - The event you wish to register the handler for.\n * @param {function} cb - The callback handler to handle this event.\n */\n\n }, {\n key: \"once\",\n value: function once(event, cb, internal) {\n return this.on(event, cb, internal, true);\n }\n /**\n * Allow catching any event.\n *\n * @param cb\n * @returns {this}\n */\n\n }, {\n key: \"onAny\",\n value: function onAny(cb) {\n if (!this.events) {\n return;\n }\n\n return this.events.onAny(cb);\n }\n /**\n * Removes the listener that will be fired when any event is emitted.\n *\n * @param cb\n * @returns {this}\n */\n\n }, {\n key: \"offAny\",\n value: function offAny(cb) {\n if (!this.events) {\n return;\n }\n\n return this.events.offAny(cb);\n }\n /**\n * Removes a listener for a certain event. Not passing the 2nd arg will remove all listeners for that event.\n *\n * @param {string} event - The event you wish to register the handler for.\n * @param {function|undefined} cb - The callback handler to handle this event.\n */\n\n }, {\n key: \"off\",\n value: function off(event, cb) {\n var _this = this;\n\n if (!this.events) {\n return;\n }\n\n var type = \"\".concat(this.options.namespace, \".\").concat(event);\n this.events.listeners(type).forEach(function (listener) {\n // Ensure the listener is for this element\n if (!listener || listener.id !== _this.id) {\n return;\n } // If there is a given callback, only deal with the match\n\n\n if (cb && cb !== listener) {\n return;\n }\n\n _this.events.off(type, listener);\n });\n }\n /**\n * Emit a new event.\n *\n * @param {string} event - The event to emit.\n * @param {Object} data - The data to emit with the handler.\n */\n\n }, {\n key: \"emit\",\n value: function emit(event) {\n if (this.events) {\n var _this$events;\n\n for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n data[_key - 1] = arguments[_key];\n }\n\n (_this$events = this.events).emit.apply(_this$events, [\"\".concat(this.options.namespace, \".\").concat(event)].concat(data));\n }\n }\n /**\n * Check if the component has an event handler set up for the event.\n *\n * @param {string} event - The event name.\n * @returns {boolean}\n */\n\n }, {\n key: \"hasEventHandler\",\n value: function hasEventHandler(event) {\n var _this2 = this;\n\n if (!this.events) {\n return false;\n }\n\n var type = \"\".concat(this.options.namespace, \".\").concat(event);\n return this.events.listeners(type).some(function (listener) {\n if (!listener) {\n return false;\n }\n\n return listener.id === _this2.id || listener.key === _this2.key;\n });\n }\n /**\n * Wrapper method to add an event listener to an HTML element.\n *\n * @param obj\n * The DOM element to add the event to.\n * @param type\n * The event name to add.\n * @param func\n * The callback function to be executed when the listener is triggered.\n * @param persistent\n * If this listener should persist beyond \"destroy\" commands.\n */\n\n }, {\n key: \"addEventListener\",\n value: function addEventListener(obj, type, func, persistent) {\n if (!obj) {\n return;\n }\n\n if (!persistent) {\n this.eventHandlers.push({\n id: this.id,\n obj: obj,\n type: type,\n func: func\n });\n }\n\n if ('addEventListener' in obj) {\n obj.addEventListener(type, func, false);\n } else if ('attachEvent' in obj) {\n obj.attachEvent(\"on\".concat(type), func);\n }\n\n return this;\n }\n /**\n * Remove an event listener from the object.\n *\n * @param obj\n * @param type\n */\n\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(obj, type) {\n var _this3 = this;\n\n var func = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n var indexes = [];\n\n if (!obj) {\n return;\n }\n\n this.eventHandlers.forEach(function (handler, index) {\n if (handler.id === _this3.id && obj.removeEventListener && handler.type === type && (!func || handler.func === func)) {\n obj.removeEventListener(type, handler.func);\n indexes.push(index);\n }\n });\n\n if (indexes.length) {\n _lodash.default.pullAt(this.eventHandlers, indexes);\n }\n\n return this;\n }\n }, {\n key: \"removeEventListeners\",\n value: function removeEventListeners() {\n var _this4 = this;\n\n this.eventHandlers.forEach(function (handler) {\n if (_this4.id === handler.id && handler.type && handler.obj && handler.obj.removeEventListener) {\n handler.obj.removeEventListener(handler.type, handler.func);\n }\n });\n this.eventHandlers = [];\n }\n }, {\n key: \"removeAllEvents\",\n value: function removeAllEvents(includeExternal) {\n var _this5 = this;\n\n _lodash.default.each(this.events._events, function (events, type) {\n _lodash.default.each(events, function (listener) {\n if (listener && _this5.id === listener.id && (includeExternal || listener.internal)) {\n _this5.events.off(type, listener);\n }\n });\n });\n }\n /**\n * Removes all event listeners attached to this component.\n */\n\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.removeEventListeners();\n this.removeAllEvents();\n }\n /**\n * Append an HTML DOM element to a container.\n *\n * @param element\n * @param container\n */\n\n }, {\n key: \"appendTo\",\n value: function appendTo(element, container) {\n container === null || container === void 0 ? void 0 : container.appendChild(element);\n return this;\n }\n /**\n * Prepend an HTML DOM element to a container.\n *\n * @param {HTMLElement} element - The DOM element to prepend.\n * @param {HTMLElement} container - The DOM element that is the container of the element getting prepended.\n */\n\n }, {\n key: \"prependTo\",\n value: function prependTo(element, container) {\n if (container) {\n if (container.firstChild) {\n try {\n container.insertBefore(element, container.firstChild);\n } catch (err) {\n console.warn(err);\n container.appendChild(element);\n }\n } else {\n container.appendChild(element);\n }\n }\n\n return this;\n }\n /**\n * Removes an HTML DOM element from its bounding container.\n *\n * @param {HTMLElement} element - The element to remove.\n * @param {HTMLElement} container - The DOM element that is the container of the element to remove.\n */\n\n }, {\n key: \"removeChildFrom\",\n value: function removeChildFrom(element, container) {\n if (container && container.contains(element)) {\n try {\n container.removeChild(element);\n } catch (err) {\n console.warn(err);\n }\n }\n\n return this;\n }\n /**\n * Alias for document.createElement.\n *\n * @param {string} type - The type of element to create\n * @param {Object} attr - The element attributes to add to the created element.\n * @param {Various} children - Child elements. Can be a DOM Element, string or array of both.\n *\n * @return {HTMLElement} - The created element.\n */\n\n }, {\n key: \"ce\",\n value: function ce(type, attr) {\n var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n // console.warn('Call to deprecated this.ce(). Dom elements should be created with templates, not manually with ce.');\n // Create the element.\n var element = document.createElement(type); // Add attributes.\n\n if (attr) {\n this.attr(element, attr);\n } // Append the children.\n\n\n this.appendChild(element, children);\n return element;\n }\n /**\n * Append different types of children.\n *\n * @param child\n */\n\n }, {\n key: \"appendChild\",\n value: function appendChild(element, child) {\n var _this6 = this;\n\n if (Array.isArray(child)) {\n child.forEach(function (oneChild) {\n return _this6.appendChild(element, oneChild);\n });\n } else if (child instanceof HTMLElement || child instanceof Text) {\n element.appendChild(child);\n } else if (child) {\n element.appendChild(this.text(child.toString()));\n }\n\n return this;\n }\n /**\n * Creates a new input mask placeholder.\n * @param {HTMLElement} mask - The input mask.\n * @returns {string} - The placeholder that will exist within the input as they type.\n */\n\n }, {\n key: \"maskPlaceholder\",\n value: function maskPlaceholder(mask) {\n var _this7 = this;\n\n return mask.map(function (char) {\n return char instanceof RegExp ? _this7.placeholderChar : char;\n }).join('');\n }\n }, {\n key: \"placeholderChar\",\n get: function get() {\n var _this$component;\n\n return ((_this$component = this.component) === null || _this$component === void 0 ? void 0 : _this$component.inputMaskPlaceholderChar) || '_';\n }\n /**\n * Sets the input mask for an input.\n *\n * @param {HTMLElement} input - The html input to apply the mask to.\n * @param {String} inputMask - The input mask to add to this input.\n * @param {Boolean} usePlaceholder - Set the mask placeholder on the input.\n */\n\n }, {\n key: \"setInputMask\",\n value: function setInputMask(input, inputMask, usePlaceholder) {\n if (input && inputMask) {\n var mask = FormioUtils.getInputMask(inputMask, this.placeholderChar);\n this.defaultMask = mask;\n\n try {\n //destroy previous mask\n if (input.mask) {\n input.mask.destroy();\n }\n\n input.mask = (0, _vanillaTextMask.default)({\n inputElement: input,\n mask: mask,\n placeholderChar: this.placeholderChar,\n shadowRoot: this.root ? this.root.shadowRoot : null\n });\n } catch (e) {\n // Don't pass error up, to prevent form rejection.\n // Internal bug of vanilla-text-mask on iOS (`selectionEnd`);\n console.warn(e);\n }\n\n if (mask.numeric) {\n input.setAttribute('pattern', '\\\\d*');\n }\n\n if (usePlaceholder) {\n input.setAttribute('placeholder', this.maskPlaceholder(mask));\n }\n }\n }\n /**\n * Translate a text using the i18n system.\n *\n * @param {string|Array<string>} text - The i18n identifier.\n * @param {Object} params - The i18n parameters to use for translation.\n */\n\n }, {\n key: \"t\",\n value: function t(text) {\n var _this$i18next;\n\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n return (_this$i18next = this.i18next).t.apply(_this$i18next, [text].concat(args));\n }\n /**\n * Alias to create a text node.\n * @param text\n * @returns {Text}\n */\n\n }, {\n key: \"text\",\n value: function text(_text) {\n return document.createTextNode(this.t(_text));\n }\n /**\n * Adds an object of attributes onto an element.\n * @param {HtmlElement} element - The element to add the attributes to.\n * @param {Object} attr - The attributes to add to the input element.\n */\n\n }, {\n key: \"attr\",\n value: function attr(element, _attr) {\n var _this8 = this;\n\n if (!element) {\n return;\n }\n\n _lodash.default.each(_attr, function (value, key) {\n if (typeof value !== 'undefined') {\n if (key.indexOf('on') === 0) {\n // If this is an event, add a listener.\n _this8.addEventListener(element, key.substr(2).toLowerCase(), value);\n } else {\n // Otherwise it is just an attribute.\n element.setAttribute(key, value);\n }\n }\n });\n }\n /**\n * Determines if an element has a class.\n *\n * Taken from jQuery https://j11y.io/jquery/#v=1.5.0&fn=jQuery.fn.hasClass\n */\n\n }, {\n key: \"hasClass\",\n value: function hasClass(element, className) {\n if (!element) {\n return false;\n } // Allow templates to intercept.\n\n\n className = \" \".concat(className, \" \");\n return \" \".concat(element.className, \" \").replace(/[\\n\\t\\r]/g, ' ').indexOf(className) > -1;\n }\n /**\n * Adds a class to a DOM element.\n *\n * @param element\n * The element to add a class to.\n * @param className\n * The name of the class to add.\n */\n\n }, {\n key: \"addClass\",\n value: function addClass(element, className) {\n if (!element || !(element instanceof HTMLElement)) {\n return this;\n } // Allow templates to intercept.\n\n\n var classes = element.getAttribute('class');\n\n if (!(classes !== null && classes !== void 0 && classes.includes(className))) {\n element.setAttribute('class', \"\".concat(classes, \" \").concat(className));\n }\n\n return this;\n }\n /**\n * Remove a class from a DOM element.\n *\n * @param element\n * The DOM element to remove the class from.\n * @param className\n * The name of the class that is to be removed.\n */\n\n }, {\n key: \"removeClass\",\n value: function removeClass(element, className) {\n if (!element || !className || !(element instanceof HTMLElement)) {\n return this;\n } // Allow templates to intercept.\n\n\n var cls = element.getAttribute('class');\n\n if (cls) {\n cls = cls.replace(new RegExp(\" \".concat(className), 'g'), '');\n element.setAttribute('class', cls);\n }\n\n return this;\n }\n /**\n * Empty's an HTML DOM element.\n *\n * @param {HTMLElement} element - The element you wish to empty.\n */\n\n }, {\n key: \"empty\",\n value: function empty(element) {\n if (element) {\n while (element.firstChild) {\n element.removeChild(element.firstChild);\n }\n }\n }\n /**\n * Create an evaluation context for all script executions and interpolations.\n *\n * @param additional\n * @return {*}\n */\n\n }, {\n key: \"evalContext\",\n value: function evalContext(additional) {\n var _this$options;\n\n return Object.assign({\n _: _lodash.default,\n utils: FormioUtils,\n util: FormioUtils,\n user: _Formio.GlobalFormio.getUser(),\n moment: _moment.default,\n instance: this,\n self: this,\n token: _Formio.GlobalFormio.getToken({\n decode: true\n }),\n config: this.root && this.root.form && this.root.form.config ? this.root.form.config : (_this$options = this.options) !== null && _this$options !== void 0 && _this$options.formConfig ? this.options.formConfig : {}\n }, additional, _lodash.default.get(this.root, 'options.evalContext', {}));\n }\n /**\n * Performs an interpolation using the evaluation context of this component.\n *\n * @param string\n * @param data\n * @return {XML|string|*|void}\n */\n\n }, {\n key: \"interpolate\",\n value: function interpolate(string, data) {\n var _this9 = this;\n\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (typeof string !== 'function' && this.component.content && !FormioUtils.Evaluator.templateSettings.interpolate.test(string)) {\n string = FormioUtils.translateHTMLTemplate(String(string), function (value) {\n return _this9.t(value);\n });\n }\n\n return FormioUtils.interpolate(string, this.evalContext(data), options);\n }\n /**\n * Performs an evaluation using the evaluation context of this component.\n *\n * @param func\n * @param args\n * @param ret\n * @param tokenize\n * @return {*}\n */\n\n }, {\n key: \"evaluate\",\n value: function evaluate(func, args, ret, tokenize) {\n return FormioUtils.evaluate(func, this.evalContext(args), ret, tokenize);\n }\n /**\n * Allow for options to hook into the functionality of this renderer.\n * @return {*}\n */\n\n }, {\n key: \"hook\",\n value: function hook() {\n var name = arguments[0];\n\n if (this.options && this.options.hooks && this.options.hooks[name]) {\n return this.options.hooks[name].apply(this, Array.prototype.slice.call(arguments, 1));\n } else {\n // If this is an async hook instead of a sync.\n var fn = typeof arguments[arguments.length - 1] === 'function' ? arguments[arguments.length - 1] : null;\n\n if (fn) {\n return fn(null, arguments[1]);\n } else {\n return arguments[1];\n }\n }\n }\n }]);\n\n return Element;\n}();\n\nexports[\"default\"] = Element;\n\n//# sourceURL=webpack://Formio/./lib/Element.js?");
/***/ }),
/***/ "./lib/EventEmitter.js":
/*!*****************************!*\
!*** ./lib/EventEmitter.js ***!
\*****************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
eval("\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\n__webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ \"./node_modules/core-js/modules/es.object.get-prototype-of.js\");\n\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n\n__webpack_require__(/*! core-js/modules/es.reflect.get.js */ \"./node_modules/core-js/modules/es.reflect.get.js\");\n\n__webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ \"./node_modules/core-js/modules/es.object.get-own-property-descriptor.js\");\n\n__webpack_require__(/*! core-js/modules/es.reflect.construct.js */ \"./node_modules/core-js/modules/es.reflect.construct.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es.weak-map.js */ \"./node_modules/core-js/modules/es.weak-map.js\");\n\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n\nvar _eventemitter = __webpack_require__(/*! eventemitter3 */ \"./node_modules/eventemitter3/index.js\");\n\nvar utils = _interopRequireWildcard(__webpack_require__(/*! ./utils/utils */ \"./lib/utils/utils.js\"));\n\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\n\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _get() { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }\n\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar EventEmitter = /*#__PURE__*/function (_EventEmitter) {\n _inherits(EventEmitter, _EventEmitter);\n\n var _super = _createSuper(EventEmitter);\n\n function EventEmitter() {\n var _thisSuper, _thisSuper2, _this;\n\n var conf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, EventEmitter);\n\n var _conf$loadLimit = conf.loadLimit,\n loadLimit = _conf$loadLimit === void 0 ? 1000 : _conf$loadLimit,\n _conf$eventsSafeInter = conf.eventsSafeInterval,\n eventsSafeInterval = _conf$eventsSafeInter === void 0 ? 300 : _conf$eventsSafeInter;\n _this = _super.call(this);\n\n _defineProperty(_assertThisInitialized(_this), \"onAny\", function (fn) {\n _this.on('any', fn);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"offAny\", function (fn) {\n _this.off('any', fn);\n });\n\n var overloadHandler = function overloadHandler() {\n console.warn(\"There were more than \".concat(loadLimit, \" events emitted in \").concat(eventsSafeInterval, \" ms. It might be caused by events' infinite loop\"), _this.id);\n };\n\n var dispatch = utils.observeOverload(overloadHandler, {\n limit: loadLimit,\n delay: eventsSafeInterval\n });\n\n _this.emit = function () {\n var _get2, _get3;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n (_get2 = _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(EventEmitter.prototype)), \"emit\", _thisSuper)).call.apply(_get2, [_thisSuper].concat(args));\n\n (_get3 = _get((_thisSuper2 = _assertThisInitialized(_this), _getPrototypeOf(EventEmitter.prototype)), \"emit\", _thisSuper2)).call.apply(_get3, [_thisSuper2, 'any'].concat(args));\n\n dispatch();\n };\n\n return _this;\n }\n\n return _createClass(EventEmitter);\n}(_eventemitter.EventEmitter);\n\nexports[\"default\"] = EventEmitter;\n\n//# sourceURL=webpack://Formio/./lib/EventEmitter.js?");
/***/ }),
/***/ "./lib/Formio.js":
/*!***********************!*\
!*** ./lib/Formio.js ***!
\***********************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
eval("\n\n__webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n\n__webpack_require__(/*! core-js/modules/es.function.name.js */ \"./node_modules/core-js/modules/es.function.name.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.from.js */ \"./node_modules/core-js/modules/es.array.from.js\");\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = exports.GlobalFormio = void 0;\n\n__webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n\n__webpack_require__(/*! core-js/modules/es.string.match.js */ \"./node_modules/core-js/modules/es.string.match.js\");\n\n__webpack_require__(/*! core-js/modules/es.string.search.js */ \"./node_modules/core-js/modules/es.string.search.js\");\n\n__webpack_require__(/*! core-js/modules/es.string.split.js */ \"./node_modules/core-js/modules/es.string.split.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.concat.js */ \"./node_modules/core-js/modules/es.array.concat.js\");\n\n__webpack_require__(/*! core-js/modules/es.regexp.constructor.js */ \"./node_modules/core-js/modules/es.regexp.constructor.js\");\n\n__webpack_require__(/*! core-js/modules/es.regexp.to-string.js */ \"./node_modules/core-js/modules/es.regexp.to-string.js\");\n\n__webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.join.js */ \"./node_modules/core-js/modules/es.array.join.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.includes.js */ \"./node_modules/core-js/modules/es.array.includes.js\");\n\n__webpack_require__(/*! core-js/modules/es.string.includes.js */ \"./node_modules/core-js/modules/es.string.includes.js\");\n\n__webpack_require__(/*! core-js/modules/es.object.assign.js */ \"./node_modules/core-js/modules/es.object.assign.js\");\n\n__webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n\n__webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n\n__webpack_require__(/*! core-js/modules/es.number.constructor.js */ \"./node_modules/core-js/modules/es.number.constructor.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.filter.js */ \"./node_modules/core-js/modules/es.array.filter.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.sort.js */ \"./node_modules/core-js/modules/es.array.sort.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.map.js */ \"./node_modules/core-js/modules/es.array.map.js\");\n\n__webpack_require__(/*! core-js/modules/es.symbol.js */ \"./node_modules/core-js/modules/es.symbol.js\");\n\n__webpack_require__(/*! core-js/modules/es.symbol.description.js */ \"./node_modules/core-js/modules/es.symbol.description.js\");\n\n__webpack_require__(/*! core-js/modules/es.symbol.iterator.js */ \"./node_modules/core-js/modules/es.symbol.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es.array.iterator.js */ \"./node_modules/core-js/modules/es.array.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/es.string.iterator.js */ \"./node_modules/core-js/modules/es.string.iterator.js\");\n\n__webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ \"./node_modules/core-js/modules/web.dom-collections.iterator.js\");\n\nvar _nativePromiseOnly = _interopRequireDefault(__webpack_require__(/*! native-promise-only */ \"./node_modules/native-promise-only/lib/npo.src.js\"));\n\nvar _fetchPonyfill2 = _interopRequireDefault(__webpack_require__(/*! fetch-ponyfill */ \"./node_modules/fetch-ponyfill/build/fetch-browser.js\"));\n\nvar _EventEmitter = _interopRequireDefault(__webpack_require__(/*! ./EventEmitter */ \"./lib/EventEmitter.js\"));\n\nvar _browserCookies = _interopRequireDefault(__webpack_require__(/*! browser-cookies */ \"./node_modules/browser-cookies/src/browser-cookies.js\"));\n\nvar _providers = _interopRequireDefault(__webpack_require__(/*! ./providers */ \"./lib/providers/index.js\"));\n\nvar _intersection2 = _interopRequireDefault(__webpack_require__(/*! lodash/intersection */ \"./node_modules/lodash/intersection.js\"));\n\nvar _get2 = _interopRequireDefault(__webpack_require__(/*! lodash/get */ \"./node_modules/lodash/get.js\"));\n\nvar _cloneDeep2 = _interopRequireDefault(__webpack_require__(/*! lodash/cloneDeep */ \"./node_modules/lodash/cloneDeep.js\"));\n\nvar _defaults2 = _interopRequireDefault(__webpack_require__(/*! lodash/defaults */ \"./node_modules/lodash/defaults.js\"));\n\nvar _utils = __webpack_require__(/*! ./utils/utils */ \"./lib/utils/utils.js\");\n\nvar _jwtDecode = _interopRequireDefault(__webpack_require__(/*! jwt-decode */ \"./node_modules/jwt-decode/build/jwt-decode.esm.js\"));\n\n__webpack_require__(/*! ./polyfills */ \"./lib/polyfills/index.js\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nvar _fetchPonyfill = (0, _fetchPonyfill2.default)({\n Promise: _nativePromiseOnly.default\n}),\n fetch = _fetchPonyfill.fetch,\n Headers = _fetchPonyfill.Headers;\n\nvar isBoolean = function isBoolean(val) {\n return _typeof(val) === _typeof(true);\n};\n\nvar isNil = function isNil(val) {\n return val === null || val === undefined;\n};\n\nvar isObject = function isObject(val) {\n return val && _typeof(val) === 'object';\n};\n\nfunction cloneResponse(response) {\n var copy = (0, _cloneDeep2.default)(response);\n\n if (Array.isArray(response)) {\n copy.skip = response.skip;\n copy.limit = response.limit;\n copy.serverCount = response.serverCount;\n }\n\n return copy;\n}\n/**\n * The Formio interface class.\n *\n * let formio = new Formio('https://examples.form.io/example');\n */\n\n\nvar Formio = /*#__PURE__*/function () {\n /* eslint-disable max-statements */\n function Formio(path) {\n var _this = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Formio);\n\n // Ensure we have an instance of Formio.\n if (!(this instanceof Formio)) {\n return new Formio(path);\n } // Initialize our variables.\n\n\n this.base = '';\n this.projectsUrl = '';\n this.projectUrl = '';\n this.projectId = '';\n this.roleUrl = '';\n this.rolesUrl = '';\n this.roleId = '';\n this.formUrl = '';\n this.formsUrl = '';\n this.formId = '';\n this.submissionsUrl = '';\n this.submissionUrl = '';\n this.submissionId = '';\n this.actionsUrl = '';\n this.actionId = '';\n this.actionUrl = '';\n this.vsUrl = '';\n this.vId = '';\n this.vUrl = '';\n this.query = ''; // Store the original path and options.\n\n this.path = path;\n this.options = options;\n\n if (options.hasOwnProperty('base')) {\n this.base = options.base;\n } else if (Formio.baseUrl) {\n this.base = Formio.baseUrl;\n } else if (typeof window !== 'undefined') {\n this.base = window.location.href.match(/http[s]?:\\/\\/api./)[0];\n }\n\n if (!path) {\n // Allow user to create new projects if this was instantiated without\n // a url\n this.projectUrl = Formio.projectUrl || \"\".concat(this.base, \"/project\");\n this.projectsUrl = \"\".concat(this.base, \"/project\");\n this.projectId = false;\n this.query = '';\n return;\n }\n\n if (options.hasOwnProperty('project')) {\n this.projectUrl = options.project;\n }\n\n var project = this.projectUrl || Formio.projectUrl;\n var projectRegEx = /(^|\\/)(project)($|\\/[^/]+)/;\n var isProjectUrl = path.search(projectRegEx) !== -1; // The baseURL is the same as the projectUrl, and does not contain \"/project/MONGO_ID\" in\n // its domain. This is almost certainly against the Open Source server.\n\n if (project && this.base === project && !isProjectUrl) {\n this.noProject = true;\n this.projectUrl = this.base;\n } // Normalize to an absolute path.\n\n\n if (path.indexOf('http') !== 0 && path.indexOf('//') !== 0) {\n path = this.base + path;\n }\n\n var hostparts = this.getUrlParts(path);\n var parts = [];\n var hostName = hostparts[1] + hostparts[2];\n path = hostparts.length > 3 ? hostparts[3] :